diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..975c435 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +settings.py +.env diff --git a/app/.env.example b/app/.env.example new file mode 100644 index 0000000..e8e7364 --- /dev/null +++ b/app/.env.example @@ -0,0 +1,20 @@ +SECRET_KEY = 장고 시크릿키 + +# db 구조 정의 +ENGINE = django.db.backends.mysql +NAME = +USER = +PASSWORD = +HOST = +PORT = +init_command = SET sql_mode="STRICT_TRANS_TABLES" + + +# 소셜 로그인 api 키와 시크릿값 +SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = +SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = +SOCIAL_AUTH_GOOGLE_OAUTH2_REDIRECT_URI = +SOCIAL_AUTH_GOOGLE_OAUTH2_SCOPE=["profile", "email"] + +SOCIAL_AUTH_KAKAO_KEY = +SOCIAL_AUTH_KAKAO_SECRET = diff --git a/app/__init__.py b/app/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/app/__pycache__/__init__.cpython-312.pyc b/app/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..ecdc0ce Binary files /dev/null and b/app/__pycache__/__init__.cpython-312.pyc differ diff --git a/app/__pycache__/admin.cpython-312.pyc b/app/__pycache__/admin.cpython-312.pyc new file mode 100644 index 0000000..9b0aa99 Binary files /dev/null and b/app/__pycache__/admin.cpython-312.pyc differ diff --git a/app/__pycache__/apps.cpython-312.pyc b/app/__pycache__/apps.cpython-312.pyc new file mode 100644 index 0000000..4e18d09 Binary files /dev/null and b/app/__pycache__/apps.cpython-312.pyc differ diff --git a/app/__pycache__/forms.cpython-312.pyc b/app/__pycache__/forms.cpython-312.pyc new file mode 100644 index 0000000..03225c1 Binary files /dev/null and b/app/__pycache__/forms.cpython-312.pyc differ diff --git a/app/__pycache__/models.cpython-312.pyc b/app/__pycache__/models.cpython-312.pyc new file mode 100644 index 0000000..63f3a9f Binary files /dev/null and b/app/__pycache__/models.cpython-312.pyc differ diff --git a/app/__pycache__/operator.cpython-312.pyc b/app/__pycache__/operator.cpython-312.pyc new file mode 100644 index 0000000..d27ba32 Binary files /dev/null and b/app/__pycache__/operator.cpython-312.pyc differ diff --git a/app/__pycache__/urls.cpython-312.pyc b/app/__pycache__/urls.cpython-312.pyc new file mode 100644 index 0000000..e12323d Binary files /dev/null and b/app/__pycache__/urls.cpython-312.pyc differ diff --git a/app/__pycache__/views.cpython-312.pyc b/app/__pycache__/views.cpython-312.pyc new file mode 100644 index 0000000..7c69fde Binary files /dev/null and b/app/__pycache__/views.cpython-312.pyc differ diff --git a/app/admin.py b/app/admin.py new file mode 100644 index 0000000..5d3a402 --- /dev/null +++ b/app/admin.py @@ -0,0 +1,6 @@ +# admin.py + +from django.contrib import admin +from .models import LocalUser + +admin.site.register(LocalUser) diff --git a/app/apps.py b/app/apps.py new file mode 100644 index 0000000..f3675a7 --- /dev/null +++ b/app/apps.py @@ -0,0 +1,12 @@ +from django.apps import AppConfig +from django.conf import settings + + +class MainConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'app' + + def ready(self): + if settings.SCHEDULER_DEFAULT: + from . import operator + operator.start() diff --git a/app/forms.py b/app/forms.py new file mode 100644 index 0000000..290a9d9 --- /dev/null +++ b/app/forms.py @@ -0,0 +1,7 @@ +# app/forms.py + +from django import forms + +class LocalLoginForm(forms.Form): + user_id = forms.CharField(label="아이디", max_length=100) + user_pw = forms.CharField(label="비밀번호", widget=forms.PasswordInput) diff --git a/app/migrations/0001_initial.py b/app/migrations/0001_initial.py new file mode 100644 index 0000000..6943faa --- /dev/null +++ b/app/migrations/0001_initial.py @@ -0,0 +1,29 @@ +# Generated by Django 5.2 on 2025-05-07 09:58 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='LocalUser', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('password', models.CharField(max_length=128, verbose_name='password')), + ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), + ('user_id', models.CharField(max_length=100, unique=True)), + ('user_pw', models.CharField(max_length=100)), + ('user_name', models.CharField(max_length=100)), + ('is_admin', models.BooleanField(default=False)), + ], + options={ + 'abstract': False, + }, + ), + ] diff --git a/app/migrations/0002_remove_localuser_last_login_and_more.py b/app/migrations/0002_remove_localuser_last_login_and_more.py new file mode 100644 index 0000000..7d80e92 --- /dev/null +++ b/app/migrations/0002_remove_localuser_last_login_and_more.py @@ -0,0 +1,21 @@ +# Generated by Django 5.2 on 2025-05-07 10:21 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('app', '0001_initial'), + ] + + operations = [ + migrations.RemoveField( + model_name='localuser', + name='last_login', + ), + migrations.RemoveField( + model_name='localuser', + name='password', + ), + ] diff --git a/app/migrations/0003_alter_localuser_table.py b/app/migrations/0003_alter_localuser_table.py new file mode 100644 index 0000000..18b31f5 --- /dev/null +++ b/app/migrations/0003_alter_localuser_table.py @@ -0,0 +1,17 @@ +# Generated by Django 5.2 on 2025-05-09 02:19 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('app', '0002_remove_localuser_last_login_and_more'), + ] + + operations = [ + migrations.AlterModelTable( + name='localuser', + table='user', + ), + ] diff --git a/app/migrations/0004_asset_coin_archive_coin_recent_trade_history_and_more.py b/app/migrations/0004_asset_coin_archive_coin_recent_trade_history_and_more.py new file mode 100644 index 0000000..65592c1 --- /dev/null +++ b/app/migrations/0004_asset_coin_archive_coin_recent_trade_history_and_more.py @@ -0,0 +1,136 @@ +# Generated by Django 5.2 on 2025-05-18 04:47 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('app', '0003_alter_localuser_table'), + ] + + operations = [ + migrations.CreateModel( + name='Asset', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('coin_name', models.CharField(max_length=10)), + ('coin_amount', models.FloatField()), + ('coin_price', models.FloatField()), + ('total_value', models.FloatField()), + ('trade_time', models.DateTimeField(auto_now_add=True)), + ('money', models.FloatField()), + ], + options={ + 'db_table': 'asset', + }, + ), + migrations.CreateModel( + name='coin_archive', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('coin_name', models.CharField(max_length=10)), + ('opening_price', models.FloatField()), + ('high_price', models.FloatField()), + ('low_price', models.FloatField()), + ('trade_price', models.FloatField()), + ('time_stamp', models.DateTimeField()), + ('candle_acc_trade_price', models.FloatField()), + ('candle_acc_trade_volume', models.FloatField()), + ('candle_time_kst', models.DateTimeField(auto_now_add=True)), + ('interval', models.CharField(max_length=10)), + ], + options={ + 'db_table': 'coin_archive', + }, + ), + migrations.CreateModel( + name='coin_recent', + fields=[ + ('coin_name', models.CharField(max_length=10, primary_key=True, serialize=False)), + ('opening_price', models.FloatField()), + ('high_price', models.FloatField()), + ('low_price', models.FloatField()), + ('trade_price', models.FloatField()), + ('time_stamp', models.DateTimeField()), + ('candle_acc_trade_price', models.FloatField()), + ('candle_acc_trade_volume', models.FloatField()), + ('candle_time_kst', models.DateTimeField(auto_now_add=True)), + ('interval', models.CharField(max_length=10)), + ], + options={ + 'db_table': 'coin_recent', + }, + ), + migrations.CreateModel( + name='trade_history', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('coin_name', models.CharField(max_length=10)), + ('coin_price', models.FloatField()), + ('coin_amount', models.FloatField()), + ('order_time', models.DateTimeField()), + ('trade_time', models.DateTimeField(auto_now_add=True)), + ('is_deal', models.BooleanField(default=False)), + ('trade_fee', models.FloatField(default=0.0)), + ], + options={ + 'db_table': 'trade_history', + }, + ), + migrations.CreateModel( + name='trade_order_request', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('coin_name', models.CharField(max_length=10)), + ('coin_price', models.FloatField()), + ('coin_amount', models.FloatField()), + ('order_time', models.DateTimeField(auto_now_add=True)), + ('trade_type', models.CharField(max_length=10)), + ('order_id', models.FloatField(unique=True)), + ], + options={ + 'db_table': 'trade_request', + }, + ), + migrations.AddIndex( + model_name='localuser', + index=models.Index(fields=['user_id'], name='user_user_id_31c9cf_idx'), + ), + migrations.AddField( + model_name='asset', + name='user_id', + field=models.ForeignKey(db_column='user_id', on_delete=django.db.models.deletion.CASCADE, to='app.localuser'), + ), + migrations.AddIndex( + model_name='coin_archive', + index=models.Index(fields=['coin_name', 'time_stamp'], name='coin_archiv_coin_na_eaa4b2_idx'), + ), + migrations.AddIndex( + model_name='coin_recent', + index=models.Index(fields=['coin_name', 'time_stamp'], name='coin_recent_coin_na_70d127_idx'), + ), + migrations.AddField( + model_name='trade_history', + name='user_id', + field=models.ForeignKey(db_column='user_id', on_delete=django.db.models.deletion.CASCADE, to='app.localuser'), + ), + migrations.AddField( + model_name='trade_order_request', + name='user_id', + field=models.ForeignKey(db_column='user_id', on_delete=django.db.models.deletion.CASCADE, to='app.localuser'), + ), + migrations.AddIndex( + model_name='asset', + index=models.Index(fields=['user_id'], name='asset_user_id_bcef9f_idx'), + ), + migrations.AddIndex( + model_name='trade_history', + index=models.Index(fields=['user_id'], name='trade_histo_user_id_8687dc_idx'), + ), + migrations.AddIndex( + model_name='trade_order_request', + index=models.Index(fields=['user_id'], name='trade_reque_user_id_5667ec_idx'), + ), + ] diff --git a/app/migrations/__init__.py b/app/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/app/migrations/__pycache__/0001_initial.cpython-312.pyc b/app/migrations/__pycache__/0001_initial.cpython-312.pyc new file mode 100644 index 0000000..913fc7f Binary files /dev/null and b/app/migrations/__pycache__/0001_initial.cpython-312.pyc differ diff --git a/app/migrations/__pycache__/0002_remove_localuser_last_login_and_more.cpython-312.pyc b/app/migrations/__pycache__/0002_remove_localuser_last_login_and_more.cpython-312.pyc new file mode 100644 index 0000000..80ef7c2 Binary files /dev/null and b/app/migrations/__pycache__/0002_remove_localuser_last_login_and_more.cpython-312.pyc differ diff --git a/app/migrations/__pycache__/0003_alter_localuser_table.cpython-312.pyc b/app/migrations/__pycache__/0003_alter_localuser_table.cpython-312.pyc new file mode 100644 index 0000000..65b38db Binary files /dev/null and b/app/migrations/__pycache__/0003_alter_localuser_table.cpython-312.pyc differ diff --git a/app/migrations/__pycache__/0004_asset_coin_archive_coin_recent_trade_history_and_more.cpython-312.pyc b/app/migrations/__pycache__/0004_asset_coin_archive_coin_recent_trade_history_and_more.cpython-312.pyc new file mode 100644 index 0000000..ce3a190 Binary files /dev/null and b/app/migrations/__pycache__/0004_asset_coin_archive_coin_recent_trade_history_and_more.cpython-312.pyc differ diff --git a/app/migrations/__pycache__/__init__.cpython-312.pyc b/app/migrations/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..3ff2a65 Binary files /dev/null and b/app/migrations/__pycache__/__init__.cpython-312.pyc differ diff --git a/app/models.py b/app/models.py new file mode 100644 index 0000000..8c0f17e --- /dev/null +++ b/app/models.py @@ -0,0 +1,125 @@ +from django.db import models +from django.contrib.auth.models import BaseUserManager + +class LocalUserManager(BaseUserManager): + def create_user(self, user_id, user_pw, user_name, is_admin=False): + user = self.model( + user_id=user_id, + user_name=user_name, + is_admin=is_admin + ) + user.set_password(user_pw) + user.save(using=self._db) + return user + + def create_superuser(self, user_id, user_pw, user_name): + user = self.create_user( + user_id=user_id, + user_pw=user_pw, + user_name=user_name, + is_admin=True + ) + user.is_staff = True + user.is_superuser = True + user.save(using=self._db) + return user + +class LocalUser(models.Model): + user_id = models.CharField(max_length=100, unique=True) + user_pw = models.CharField(max_length=100) + user_name = models.CharField(max_length=100) + is_admin = models.BooleanField(default=False) + + def __str__(self): + return self.user_name + + class Meta: + db_table = "user" + indexes = [ + models.Index(fields=["user_id"]), + ] + +class coin_recent(models.Model): + coin_name = models.CharField(max_length=10, primary_key=True) + opening_price = models.FloatField() + high_price = models.FloatField() + low_price = models.FloatField() + trade_price = models.FloatField() + time_stamp = models.DateTimeField() + candle_acc_trade_price = models.FloatField() + candle_acc_trade_volume = models.FloatField() + candle_time_kst = models.DateTimeField(auto_now_add=True) + interval = models.CharField(max_length=10) + + + class Meta: + db_table = "coin_recent" + indexes = [ + models.Index(fields=["coin_name", "time_stamp"]), + ] + + +class coin_archive(models.Model): + coin_name = models.CharField(max_length=10) + opening_price = models.FloatField() + high_price = models.FloatField() + low_price = models.FloatField() + trade_price = models.FloatField() + time_stamp = models.DateTimeField() + candle_acc_trade_price = models.FloatField() + candle_acc_trade_volume = models.FloatField() + candle_time_kst = models.DateTimeField(auto_now_add=True) + interval = models.CharField(max_length=10) + + class Meta: + db_table = "coin_archive" + indexes = [ + models.Index(fields=["coin_name", "time_stamp"]), + ] + +class trade_order_request(models.Model): + user_id = models.ForeignKey(LocalUser, on_delete=models.CASCADE, db_column='user_id') + coin_name = models.CharField(max_length=10) + coin_price = models.FloatField() + coin_amount = models.FloatField() + order_time = models.DateTimeField(auto_now_add=True) + trade_type = models.CharField(max_length=10) # 'buy' or 'sell' + order_id = models.FloatField(unique=True) + + class Meta: + db_table = "trade_request" + indexes = [ + models.Index(fields=["user_id"]) + ] + +class Asset(models.Model): + user_id = models.ForeignKey(LocalUser, on_delete=models.CASCADE,db_column='user_id') + coin_name = models.CharField(max_length=10) + coin_amount = models.FloatField() + coin_price = models.FloatField() + total_value = models.FloatField() + trade_time = models.DateTimeField(auto_now_add=True) + money = models.FloatField() + + class Meta: + db_table = "asset" + indexes = [ + models.Index(fields=["user_id"]), + ] + + +class trade_history(models.Model): + user_id = models.ForeignKey(LocalUser, on_delete=models.CASCADE,db_column='user_id') + coin_name = models.CharField(max_length=10) + coin_price = models.FloatField() + coin_amount = models.FloatField() + order_time = models.DateTimeField() + trade_time = models.DateTimeField(auto_now_add=True) + is_deal = models.BooleanField(default=False) + trade_fee = models.FloatField(default=0.0) + + class Meta: + db_table = "trade_history" + indexes = [ + models.Index(fields=["user_id"]) + ] diff --git a/app/operator.py b/app/operator.py new file mode 100644 index 0000000..1c13b21 --- /dev/null +++ b/app/operator.py @@ -0,0 +1,10 @@ +from apscheduler.schedulers.background import BackgroundScheduler +from app.views import coin_store_scheduler +from app.views import compare_order_and_coin_value_scheduler + + +def start(): + scheduler = BackgroundScheduler(timezone='Asia/Seoul') + scheduler.add_job(coin_store_scheduler, 'interval', seconds=60) + scheduler.add_job(compare_order_and_coin_value_scheduler, 'interval', seconds=3) + scheduler.start() \ No newline at end of file diff --git a/app/requirements.txt b/app/requirements.txt new file mode 100644 index 0000000..23d7cb9 --- /dev/null +++ b/app/requirements.txt @@ -0,0 +1,2 @@ +python-dotenv +# pip install -r requirements.txt 명령어로 한번에 설치 가능 \ No newline at end of file diff --git a/css/find_ID.css b/app/static/css/find_page.css similarity index 100% rename from css/find_ID.css rename to app/static/css/find_page.css diff --git a/css/main.css b/app/static/css/index.css similarity index 100% rename from css/main.css rename to app/static/css/index.css diff --git a/style.css b/app/static/css/style.css similarity index 100% rename from style.css rename to app/static/css/style.css diff --git a/app/static/js/RestAPI.js b/app/static/js/RestAPI.js new file mode 100644 index 0000000..e270c86 --- /dev/null +++ b/app/static/js/RestAPI.js @@ -0,0 +1,44 @@ +require('dotenv').config(); +const mysql = require('mysql2/promise'); + +// AWS RDS 연결 설정 +//npm install dotenv 다운로드 필요 +const dbConfig = { + host: awsData.env.DB_HOST, + user: awsData.env.DB_USER, + password: awsData.env.DB_PASSWORD, + database: awsData.env.DB_NAME +}; + +// 최신 데이터 값을 가져오는 함수 +async function getSensorData() { + let connection; + + try { + // 데이터베이스 연결 + connection = await mysql.createConnection(dbConfig); + + // 최신 index 값 조회 쿼리 + const [rows] = await connection.execute( + `SELECT * FROM your_table_name ORDER BY index DESC LIMIT 1` //가장 최근 데이터값들을 가져옴 (움직임, 가스, 온습도) + ); + + if (rows.length > 0) { + console.log("value:", rows); //가져오는데 성공했을 시 나오는 값 + const dataSet = [rows[0].data1, rows[0].data2, rows[0].data3] //각 테이블 이름으로 data1,2,3으로 저장될것으로 예상됨 + return dataSet; + } else { + console.log("No data"); //데이터 테이블이 비어있음. + return null; + } + } catch (error) { + console.error("Database query error:", error); //쿼리문제 + } finally { + if (connection) { + await connection.end(); // 연결 해제 + } + } +} + +// 주기적으로 최신 index 값 호출 +setInterval(getSensorData, 1000); //1초 \ No newline at end of file diff --git a/app/static/js/coin_data.js b/app/static/js/coin_data.js new file mode 100644 index 0000000..22813d0 --- /dev/null +++ b/app/static/js/coin_data.js @@ -0,0 +1,59 @@ +let interval = null; + +function fetch_coin_data() { + console.log("running fetch_coin_data") + function fetch_data() { + fetch('/coin_value') + .then(response => response.json()) + .then(data=> { + document.getElementById('value').innerText = data.value;}) + .catch(error => { + console.error('Error fetching data:', error); + }); + } + if (!interval) { + interval = setInterval(fetch_data, 5000); + } +} + +function coin_trade_request(){ + const amount = document.getElementById('amount') + const price = document.getElementById('price') + const coin_name = document.getElementById("coin-name") + let trade_type = document.getElementById("trade-action") + + if (type.value == "매수"){ + trade_type = "buy"; + } else if (type.value == "매도"){ + trade_type = "sell"; + } + + fetch("trade_request", { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + coin_name: coin_name.value, + coin_price: price.value, + coin_amount: amount.value, + trade_type : trade_type + }) + }) + .then(response => { + if (response.ok) { + return response.json(); + } else { + throw new Error('Network response was not ok'); + } + }) +} + + + +/*function persentage_amount() { + const amount = document.getElementById('amount').value; + const value = document.getElementById('value').innerText; + const total = parseFloat(amount) * parseFloat(value); + document.getElementById('total').innerText = total.toFixed(2); +}*/ \ No newline at end of file diff --git a/app/static/js/index.js b/app/static/js/index.js new file mode 100644 index 0000000..a911567 --- /dev/null +++ b/app/static/js/index.js @@ -0,0 +1,254 @@ +// DOM이 모두 로드된 뒤 실행 +document.addEventListener("DOMContentLoaded", () => { + // 탭 전환 기능 + const tabButtons = document.querySelectorAll(".tab-btn"); + const contentBoxes = document.querySelectorAll(".content-box"); + + tabButtons.forEach((btn) => { + btn.addEventListener("click", () => { + contentBoxes.forEach((box) => box.classList.remove("active")); + const target = document.getElementById(btn.dataset.target); + if (target) target.classList.add("active"); + }); + }); + + const loginBtn = document.getElementById("loginBtn"); + if (loginBtn) { + loginBtn.addEventListener("click", () => { + window.location.href = "login.html"; + }); + } + + const searchBtn = document.getElementById("searchBtn"); + if (searchBtn) { + searchBtn.addEventListener("click", () => { + const coinName = document.getElementById("coinSearch").value; + alert(`'${coinName}'로 검색을 수행합니다(예시).`); + }); + } + + // 예시 데이터 주석 처리 + /* + document.getElementById("total-assets").textContent = "10,000,000"; + document.getElementById("available-balance").textContent = "2,000,000"; + document.getElementById("totalHoldings").textContent = "8,000,000"; + document.getElementById("krwBalance").textContent = "1,000,000"; + + const sampleHistory = [ + { date: "2025-03-01", type: "매수", coin: "BTC", amount: 0.01 }, + { date: "2025-03-02", type: "매도", coin: "ETH", amount: 0.5 }, + ]; + const historyList = document.getElementById("historyList"); + sampleHistory.forEach(item => { + const li = document.createElement("li"); + li.textContent = `${item.date} | ${item.type} | ${item.coin} ${item.amount}`; + historyList.appendChild(li); + }); + + const sampleOpenOrders = [ + { date: "2025-03-03", type: "매수", coin: "XRP", amount: 100 }, + ]; + const openOrdersList = document.getElementById("openOrdersList"); + sampleOpenOrders.forEach(item => { + const li = document.createElement("li"); + li.textContent = `${item.date} | ${item.type} | ${item.coin} ${item.amount}`; + openOrdersList.appendChild(li); + }); + + const samplePending = [ + { date: "2025-03-04", action: "출금대기", coin: "KRW", amount: 500000 }, + ]; + const pendingDepositList = document.getElementById("pendingDepositList"); + samplePending.forEach(item => { + const li = document.createElement("li"); + li.textContent = `${item.date} | ${item.action} | ${item.coin} ${item.amount}`; + pendingDepositList.appendChild(li); + }); + + const sampleProfitLoss = [ + { coin: "BTC", profit: 300000 }, + { coin: "ETH", profit: -50000 }, + ]; + const profitLossList = document.getElementById("profitLossList"); + sampleProfitLoss.forEach(item => { + const li = document.createElement("li"); + li.textContent = `${item.coin} | 손익: ${item.profit} KRW`; + profitLossList.appendChild(li); + }); + + const sampleHoldings = [ + { coin: "BTC", amount: 0.05 }, + { coin: "ETH", amount: 1.2 }, + { coin: "XRP", amount: 500 }, + ]; + const coinHoldingsList = document.getElementById("coinHoldingsList"); + sampleHoldings.forEach(item => { + const li = document.createElement("li"); + li.textContent = `${item.coin} : ${item.amount}`; + coinHoldingsList.appendChild(li); + }); + */ +}); + +// 샘플 데이터 주석 처리 +/* +const sampleData = [ + { time_close: "2025-01-01", open: 49500, high: 50800, low: 49300, close: 50000 }, + ... +]; +const coinListData = [ + { name: "비트코인", price: 59823, change: 2.34, volume: 12456.78 }, + ... +]; +*/ + +// 빈 배열로 대체 (초기 렌더링 방지) +const sampleData = []; +const coinListData = []; + +// 차트 기본 옵션 (빈 데이터) +const options = { + series: [{ + data: [] + }], + chart: { + type: 'candlestick', + height: 500, + toolbar: { tools: {} }, + background: 'transparent' + }, + theme: { mode: "dark" }, + grid: { show: false }, + plotOptions: { + candlestick: { wick: { useFillColor: true } } + }, + xaxis: { + labels: { show: false }, + type: 'datetime', + categories: [], + axisBorder: { show: false }, + axisTicks: { show: false } + }, + yaxis: { show: false }, + tooltip: { + y: { + formatter: v => `$ ${v.toFixed(2)}` + } + } +}; + +const miniOptions = { + series: [{ + name: "가격", + data: [] + }], + chart: { + type: 'area', + height: 150, + toolbar: { show: false }, + background: 'transparent' + }, + stroke: { + curve: 'smooth', + width: 2 + }, + fill: { + type: 'gradient', + gradient: { + shadeIntensity: 1, + opacityFrom: 0.7, + opacityTo: 0.3, + stops: [0, 100] + } + }, + grid: { show: false }, + xaxis: { + type: 'datetime', + categories: [], + labels: { show: false }, + axisBorder: { show: false }, + axisTicks: { show: false } + }, + yaxis: { show: false }, + tooltip: { + y: { + formatter: val => '$' + val.toFixed(2) + }, + theme: 'dark' + }, + colors: ['#007bff'] +}; + +// 차트 생성 +document.addEventListener('DOMContentLoaded', function () { + const chart = new ApexCharts(document.querySelector("#chart"), options); + chart.render(); + + const miniChart = new ApexCharts(document.querySelector("#mini-chart"), miniOptions); + miniChart.render(); + + // 테이블 초기화 + const coinListBody = document.getElementById('coin-list-body'); + if (coinListBody) coinListBody.innerHTML = ''; + + // 거래창 + const priceInput = document.querySelector('.input-group input[placeholder="금액 입력"]'); + const quantityInput = document.querySelector('.input-group input[placeholder="직접 입력"]'); + const totalInput = document.querySelector('.input-group input[disabled]'); + + function calculateTotal() { + const price = parseFloat(priceInput.value) || 0; + const quantity = parseFloat(quantityInput.value) || 0; + totalInput.value = (price * quantity).toLocaleString() + ' 원'; + } + + priceInput.addEventListener('input', calculateTotal); + quantityInput.addEventListener('input', calculateTotal); + + const buyBtn = document.querySelector('.buy-btn'); + const sellBtn = document.querySelector('.sell-btn'); + const tradeActionBtn = document.querySelector('.trade-action'); + + buyBtn.addEventListener('click', function () { + buyBtn.style.opacity = '1'; + sellBtn.style.opacity = '0.5'; + tradeActionBtn.textContent = '매수'; + }); + + sellBtn.addEventListener('click', function () { + sellBtn.style.opacity = '1'; + buyBtn.style.opacity = '0.5'; + tradeActionBtn.textContent = '매도'; + }); + + buyBtn.style.opacity = '1'; + sellBtn.style.opacity = '0.5'; + tradeActionBtn.textContent = '매수'; + + const percentButtons = document.querySelectorAll('.percentage-buttons button'); + percentButtons.forEach(btn => { + btn.addEventListener('click', function () { + const percent = parseInt(btn.textContent) / 100; + const maxQuantity = 1.0; // 실제 로직에서 대체 + quantityInput.value = (maxQuantity * percent).toFixed(4); + calculateTotal(); + }); + }); + + const minusBtn = document.querySelector('.adjust-buttons button:first-child'); + const plusBtn = document.querySelector('.adjust-buttons button:last-child'); + + minusBtn.addEventListener('click', function () { + const currentPrice = parseFloat(priceInput.value) || 0; + priceInput.value = Math.max(0, currentPrice - 100).toString(); + calculateTotal(); + }); + + plusBtn.addEventListener('click', function () { + const currentPrice = parseFloat(priceInput.value) || 0; + priceInput.value = (currentPrice + 100).toString(); + calculateTotal(); + }); + + calculateTotal(); +}); diff --git a/app/static/js/login.js b/app/static/js/login.js new file mode 100644 index 0000000..8d34f37 --- /dev/null +++ b/app/static/js/login.js @@ -0,0 +1,25 @@ +function socialLoginPopup(provider) { + const redirectUrl = '/main_page/'; + const loginUrl = `/accounts/${provider}/login/?next=${redirectUrl}`; + + const width = 500; + const height = 600; + const left = (screen.width / 2) - (width / 2); + const top = (screen.height / 2) - (height / 2); + + const popup = window.open( + loginUrl, + `${provider}_login`, + `width=${width},height=${height},top=${top},left=${left},resizable=yes,scrollbars=yes` + ); + + // ✅ 메시지 수신 처리 + window.addEventListener("message", function(event) { + if (event.data === "social-login-success") { + if (popup && !popup.closed) { + popup.close(); + } + window.location.href = redirectUrl; + } + }); +} diff --git a/app/static/js/script.js b/app/static/js/script.js new file mode 100644 index 0000000..720ac24 --- /dev/null +++ b/app/static/js/script.js @@ -0,0 +1,351 @@ +// DOM이 모두 로드된 뒤 실행 +document.addEventListener("DOMContentLoaded", () => { + // 탭 전환 기능 + const tabButtons = document.querySelectorAll(".tab-btn"); + const contentBoxes = document.querySelectorAll(".content-box"); + + tabButtons.forEach((btn) => { + btn.addEventListener("click", () => { + // 모든 content-box에서 active 제거 + contentBoxes.forEach((box) => box.classList.remove("active")); + // 클릭한 버튼에 해당하는 content-box만 active 추가 + const target = document.getElementById(btn.dataset.target); + if (target) { + target.classList.add("active"); + } + }); + }); + + // 예시: 로그인 버튼 클릭 시 login.html로 이동 + const loginBtn = document.getElementById("loginBtn"); + if (loginBtn) { + loginBtn.addEventListener("click", () => { + window.location.href = "login.html"; + }); + } + + // 검색 버튼 클릭 시 예시 기능 + const searchBtn = document.getElementById("searchBtn"); + if (searchBtn) { + searchBtn.addEventListener("click", () => { + const coinName = document.getElementById("coinSearch").value; + alert(`'${coinName}'로 검색을 수행합니다(예시).`); + // 실제로는 서버나 DB에서 검색 결과를 받아 아래 목록에 반영하는 로직 필요 + }); + } + + // 샘플 데이터 표시(실제론 서버나 DB에서 받아와서 표시) + document.getElementById("total-assets").textContent = "10,000,000"; // 총 투자자산 예시 + document.getElementById("available-balance").textContent = "2,000,000"; // 예수금 예시 + document.getElementById("totalHoldings").textContent = "8,000,000"; // 총 보유자산 예시 + document.getElementById("krwBalance").textContent = "1,000,000"; // 보유 KRW 예시 + + // 예시 거래내역 + const historyList = document.getElementById("historyList"); + if (historyList) { + const sampleHistory = [ + { date: "2025-03-01", type: "매수", coin: "BTC", amount: 0.01 }, + { date: "2025-03-02", type: "매도", coin: "ETH", amount: 0.5 }, + ]; + sampleHistory.forEach((item) => { + const li = document.createElement("li"); + li.textContent = `${item.date} | ${item.type} | ${item.coin} ${item.amount}`; + historyList.appendChild(li); + }); + } + + // 예시 미체결 + const openOrdersList = document.getElementById("openOrdersList"); + if (openOrdersList) { + const sampleOpenOrders = [ + { date: "2025-03-03", type: "매수", coin: "XRP", amount: 100 }, + ]; + sampleOpenOrders.forEach((item) => { + const li = document.createElement("li"); + li.textContent = `${item.date} | ${item.type} | ${item.coin} ${item.amount}`; + openOrdersList.appendChild(li); + }); + } + + // 예시 입출금대기 + const pendingDepositList = document.getElementById("pendingDepositList"); + if (pendingDepositList) { + const samplePending = [ + { date: "2025-03-04", action: "출금대기", coin: "KRW", amount: 500000 }, + ]; + samplePending.forEach((item) => { + const li = document.createElement("li"); + li.textContent = `${item.date} | ${item.action} | ${item.coin} ${item.amount}`; + pendingDepositList.appendChild(li); + }); + } + + // 예시 투자손익 + const profitLossList = document.getElementById("profitLossList"); + if (profitLossList) { + const sampleProfitLoss = [ + { coin: "BTC", profit: 300000 }, + { coin: "ETH", profit: -50000 }, + ]; + sampleProfitLoss.forEach((item) => { + const li = document.createElement("li"); + li.textContent = `${item.coin} | 손익: ${item.profit} KRW`; + profitLossList.appendChild(li); + }); + } + + // 예시 보유 코인 목록 + const coinHoldingsList = document.getElementById("coinHoldingsList"); + if (coinHoldingsList) { + const sampleHoldings = [ + { coin: "BTC", amount: 0.05 }, + { coin: "ETH", amount: 1.2 }, + { coin: "XRP", amount: 500 }, + ]; + sampleHoldings.forEach((item) => { + const li = document.createElement("li"); + li.textContent = `${item.coin} : ${item.amount}`; + coinHoldingsList.appendChild(li); + }); + } + }); + + + // 샘플 데이터 - 캔들스틱 차트용 +const sampleData = [ + { time_close: "2025-01-01", open: 49500, high: 50800, low: 49300, close: 50000 }, + { time_close: "2025-01-02", open: 50100, high: 51500, low: 50000, close: 51200 }, + { time_close: "2025-01-03", open: 51300, high: 52700, low: 51000, close: 52500 }, + { time_close: "2025-01-04", open: 52600, high: 53500, low: 52200, close: 53000 }, + { time_close: "2025-01-05", open: 53100, high: 53200, low: 51500, close: 51800 }, + { time_close: "2025-01-06", open: 51900, high: 53000, low: 51700, close: 52700 }, + { time_close: "2025-01-07", open: 52800, high: 54500, low: 52600, close: 54200 }, + { time_close: "2025-01-08", open: 54300, high: 55300, low: 53900, close: 55100 }, + { time_close: "2025-01-09", open: 55200, high: 55400, low: 54000, close: 54500 }, + { time_close: "2025-01-10", open: 54600, high: 56300, low: 54400, close: 56000 }, + { time_close: "2025-01-11", open: 56100, high: 57500, low: 55800, close: 57200 }, + { time_close: "2025-01-12", open: 57300, high: 58600, low: 57100, close: 58400 }, + { time_close: "2025-01-13", open: 58500, high: 58700, low: 57400, close: 57800 }, + { time_close: "2025-01-14", open: 57900, high: 59400, low: 57700, close: 59100 }, + { time_close: "2025-01-15", open: 59200, high: 60100, low: 59000, close: 59800 }, +]; + +// 코인 목록 데이터 +const coinListData = [ + { name: "비트코인", price: 59823, change: 2.34, volume: 12456.78 }, + { name: "이더리움", price: 3256, change: 1.25, volume: 8549.32 }, + { name: "리플", price: 0.52, change: -0.75, volume: 4852.16 }, + { name: "라이트코인", price: 189.45, change: 0.88, volume: 2154.96 }, + { name: "도지코인", price: 0.08, change: 5.23, volume: 9621.45 }, + { name: "카르다노", price: 0.46, change: -1.32, volume: 3256.78 }, + { name: "폴카닷", price: 5.87, change: 0.54, volume: 1895.34 }, + { name: "솔라나", price: 119.45, change: 3.67, volume: 5632.12 } +]; + +// 메인 차트 설정 (캔들스틱 차트로 변경) +const options = { + series: [{ + data: sampleData.map(price => ({ + x: price.time_close, + y: [price.open, price.high, price.low, price.close], + })) + }], + chart: { + type: 'candlestick', + height: 500, + toolbar: { + tools: {} + }, + background: 'transparent' + }, + theme: { + mode: "dark" + }, + grid: { + show: false + }, + plotOptions: { + candlestick: { + wick: { + useFillColor: true + } + } + }, + xaxis: { + labels: { + show: false, + datetimeFormatter: { + month: "mmm 'yy" + } + }, + type: 'datetime', + categories: sampleData.map(date => date.time_close), + axisBorder: { + show: false + }, + axisTicks: { + show: false + } + }, + yaxis: { + show: false + }, + tooltip: { + y: { + formatter: v => `$ ${v.toFixed(2)}` + } + } +}; + +// 미니 차트 설정 (간단한 영역 차트 유지) +const miniOptions = { + series: [{ + name: "가격", + data: sampleData.slice(-7).map(price => Number(price.close)) + }], + chart: { + type: 'area', + height: 150, + toolbar: { + show: false + }, + background: 'transparent' + }, + stroke: { + curve: 'smooth', + width: 2 + }, + fill: { + type: 'gradient', + gradient: { + shadeIntensity: 1, + opacityFrom: 0.7, + opacityTo: 0.3, + stops: [0, 100] + } + }, + grid: { + show: false + }, + xaxis: { + type: 'datetime', + categories: sampleData.slice(-7).map(date => date.time_close), + labels: { + show: false + }, + axisBorder: { + show: false + }, + axisTicks: { + show: false + } + }, + yaxis: { + show: false + }, + tooltip: { + y: { + formatter: function(val) { + return '$' + val.toFixed(2); + } + }, + theme: 'dark' + }, + colors: ['#007bff'] +}; + +// 차트 생성 및 이벤트 처리 +document.addEventListener('DOMContentLoaded', function() { + const chart = new ApexCharts(document.querySelector("#chart"), options); + chart.render(); + + const miniChart = new ApexCharts(document.querySelector("#mini-chart"), miniOptions); + miniChart.render(); + + // 코인 목록 채우기 + const coinListBody = document.getElementById('coin-list-body'); + + coinListData.forEach(coin => { + const row = document.createElement('tr'); + row.innerHTML = ` + ${coin.name} + $${coin.price.toLocaleString()} + ${coin.change >= 0 ? '+' : ''}${coin.change}% + ${coin.volume.toLocaleString()} + `; + coinListBody.appendChild(row); + + // 행 클릭 이벤트 추가 + row.style.cursor = 'pointer'; + row.addEventListener('click', function() { + document.querySelector('.coin-graph h1').textContent = `${coin.name} 차트`; + }); + }); + + // 가격 및 수량 입력에 따른 총액 계산 + const priceInput = document.querySelector('.input-group input[placeholder="금액 입력"]'); + const quantityInput = document.querySelector('.input-group input[placeholder="직접 입력"]'); + const totalInput = document.querySelector('.input-group input[disabled]'); + + function calculateTotal() { + const price = parseFloat(priceInput.value) || 0; + const quantity = parseFloat(quantityInput.value) || 0; + totalInput.value = (price * quantity).toLocaleString() + ' 원'; + } + + priceInput.addEventListener('input', calculateTotal); + quantityInput.addEventListener('input', calculateTotal); + + // 버튼 클릭 이벤트 + const buyBtn = document.querySelector('.buy-btn'); + const sellBtn = document.querySelector('.sell-btn'); + const tradeActionBtn = document.querySelector('.trade-action'); + + buyBtn.addEventListener('click', function() { + buyBtn.style.opacity = '1'; + sellBtn.style.opacity = '0.5'; + tradeActionBtn.textContent = '매수'; + }); + + sellBtn.addEventListener('click', function() { + sellBtn.style.opacity = '1'; + buyBtn.style.opacity = '0.5'; + tradeActionBtn.textContent = '매도'; + }); + + // 기본값 설정 + buyBtn.style.opacity = '1'; + sellBtn.style.opacity = '0.5'; + tradeActionBtn.textContent = '매수'; + + // 퍼센트 버튼 이벤트 + const percentButtons = document.querySelectorAll('.percentage-buttons button'); + percentButtons.forEach(btn => { + btn.addEventListener('click', function() { + const percent = parseInt(btn.textContent) / 100; + // 실제 구현에서는 보유 자산 정보를 기반으로 계산 + const maxQuantity = 1.0; // 예시: 최대 구매 가능 코인 수량 + quantityInput.value = (maxQuantity * percent).toFixed(4); + calculateTotal(); + }); + }); + + // +/- 버튼 이벤트 + const minusBtn = document.querySelector('.adjust-buttons button:first-child'); + const plusBtn = document.querySelector('.adjust-buttons button:last-child'); + + minusBtn.addEventListener('click', function() { + const currentPrice = parseFloat(priceInput.value) || 0; + priceInput.value = Math.max(0, currentPrice - 100).toString(); + calculateTotal(); + }); + + plusBtn.addEventListener('click', function() { + const currentPrice = parseFloat(priceInput.value) || 0; + priceInput.value = (currentPrice + 100).toString(); + calculateTotal(); + }); + + // 초기 총액 계산 + calculateTotal(); +}); diff --git a/html/find_ID.HTML b/app/templates/find_id.HTML similarity index 67% rename from html/find_ID.HTML rename to app/templates/find_id.HTML index 5a0be65..e262fde 100644 --- a/html/find_ID.HTML +++ b/app/templates/find_id.HTML @@ -1,18 +1,19 @@ +{% load static %} 아이디 찾기 - +

아이디 찾기

-
+
- 로그인 페이지로 돌아가기 + 로그인 페이지로 돌아가기 diff --git a/app/templates/find_pw.HTML b/app/templates/find_pw.HTML new file mode 100644 index 0000000..24598ae --- /dev/null +++ b/app/templates/find_pw.HTML @@ -0,0 +1,23 @@ +{% load static %} + + + + + + 비밀번호 찾기 + + + +

비밀번호 찾기

+
+ + + + + + + +
+ 로그인 페이지로 돌아가기 + + diff --git a/app/templates/login_page.html b/app/templates/login_page.html new file mode 100644 index 0000000..c1d61be --- /dev/null +++ b/app/templates/login_page.html @@ -0,0 +1,48 @@ +{% load static %} + + + + + + + 로그인 페이지 + + + + +
+ +
+ +
+
+

로그인

+
+ {% csrf_token %} + {{ form.as_p }} + +
+ + + + +
+
+ + diff --git a/html/main.HTML b/app/templates/main_page.html similarity index 56% rename from html/main.HTML rename to app/templates/main_page.html index 28c7d1f..613d9c2 100644 --- a/html/main.HTML +++ b/app/templates/main_page.html @@ -1,32 +1,48 @@ +{% load static %} + 코인 거래 메인페이지 - + + + +
- +
-

코인 그래프

+

비트코인 (BTC) 차트

+
@@ -41,7 +57,7 @@

코인 목록

거래금 - + @@ -53,13 +69,13 @@

코인 목록

미니 그래프

- +
-

고가: 0

-

저가: 0

-

거래량: 0

-

거래대금: 0

+

고가: 61,245.00

+

저가: 58,752.00

+

거래량: 12,456.78

+

거래대금: 735,487,952

@@ -73,7 +89,7 @@

보유자산

- +
@@ -99,4 +115,4 @@

보유자산

- + \ No newline at end of file diff --git a/html/manual.html b/app/templates/manual.html similarity index 56% rename from html/manual.html rename to app/templates/manual.html index 7c50673..97b45fe 100644 --- a/html/manual.html +++ b/app/templates/manual.html @@ -1,24 +1,35 @@ +{% load static %} 입출금 연습 - + -
- +
+ +
+
입/출금 연습
입/출금 설명
@@ -50,5 +61,7 @@
+
+ diff --git a/app/templates/register_page.html b/app/templates/register_page.html new file mode 100644 index 0000000..09d66e5 --- /dev/null +++ b/app/templates/register_page.html @@ -0,0 +1,33 @@ +{% load static %} + + + + + + + +
+ {% csrf_token %} +

회원가입 테스트 화면

+ + + + + + + + + + +
+ +
+ +
+ +
+
+ + diff --git a/app/templates/sample/login_page copy.html b/app/templates/sample/login_page copy.html new file mode 100644 index 0000000..bcb19cc --- /dev/null +++ b/app/templates/sample/login_page copy.html @@ -0,0 +1,14 @@ + + + + + + 로그인 페이지 + + +

로그인 페이지입니다.

+
+
+ + + \ No newline at end of file diff --git a/app/templates/sample/register_page copy.html b/app/templates/sample/register_page copy.html new file mode 100644 index 0000000..52852e3 --- /dev/null +++ b/app/templates/sample/register_page copy.html @@ -0,0 +1,14 @@ + + + + + + 회원가입 페이지 + + +

회원가입 페이지입니다.

+
+
+ + + \ No newline at end of file diff --git a/app/tests.py b/app/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/app/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/app/urls.py b/app/urls.py new file mode 100644 index 0000000..224bac6 --- /dev/null +++ b/app/urls.py @@ -0,0 +1,24 @@ +# app/urls.py + +from django.urls import path, include +from . import views + +urlpatterns = [ + path('', views.main_page, name='main_page'), + + # 페이지 이동요청 + path('main_page/', views.main_page, name='main_page'), + path('main/', views.main_page, name='main_page'), + path("login_page/", views.login_page, name = 'login_page'), + path("register_page/", views.register_page, name = 'register_page'), + path("find_id/", views.find_id, name = 'find_id'), + path("find_pw/", views.find_pw, name = 'find_pw'), + path("manual/", views.manual, name = 'manual'), + + # 기능 처리요청 + path('login/', views.login, name='login'), + path('register/', views.register, name='register'), + path('logout/', views.logout, name='logout'), + path('coin_value/', views.coin_live_value, name='coin_value'), + path('trade_request/' , views.trade_order_request, name='coin_buy_request'), +] diff --git a/app/utils.py b/app/utils.py new file mode 100644 index 0000000..2d7b7a2 --- /dev/null +++ b/app/utils.py @@ -0,0 +1,9 @@ +from django.contrib.auth.hashers import make_password, check_password + + +# 비밀번호 암호화 유틸 +def hash_password(raw_password): + return make_password(raw_password) + +def verify_password(raw_password, hashed_password): + return check_password(raw_password, hashed_password) \ No newline at end of file diff --git a/app/views.py b/app/views.py new file mode 100644 index 0000000..487cc72 --- /dev/null +++ b/app/views.py @@ -0,0 +1,374 @@ +from django.shortcuts import render, redirect +from django.utils import timezone +from django.http import JsonResponse +from django.contrib import messages +from .forms import LocalLoginForm +from .models import LocalUser, coin_recent, coin_archive, trade_order_request, trade_history, Asset +from django.contrib.auth.hashers import make_password, check_password +from datetime import datetime +from decimal import Decimal + +#pip install requests +import requests +import schedule +import time +import threading +import json + +# 메인 페이지 호출 +# @login_required(login_url='login_page') # 로그인 안 했으면 이 URL로 리다이렉트 +def main_page(request): + user = request.user # 인증된 사용자 객체 가져오기 + + # 메시지를 띄우거나 다른 로직 필요하면 추가 가능 + context = { + 'user': user + } + return render(request, 'main_page.html', context) + +# 로그인 페이지 호출 +def login_page(request): + form = LocalLoginForm() + return render(request, 'login_page.html', {'form': form}) + +# 로그인 데이터 처리 (로컬 로그인) +def login(request): + if request.method == 'POST': + form = LocalLoginForm(request.POST) + if form.is_valid(): + user_id = form.cleaned_data['user_id'] + user_pw = form.cleaned_data['user_pw'] + try: + user = LocalUser.objects.get(user_id=user_id) + if check_password(user_pw, user.user_pw): # 비밀번호 비교 + request.session['local_user_id'] = user.user_id + request.session['money'] = 1000000 # 임시 money값 + print("로그인에 성공하였습니다.") + return redirect('main_page') + else: + form.add_error(None, "아이디 또는 비밀번호가 잘못되었습니다.") + print("아이디 또는 비밀번호가 잘못되었습니다.") + except LocalUser.DoesNotExist: + form.add_error(None, "아이디 또는 비밀번호가 잘못되었습니다.") + print("아이디 또는 비밀번호가 잘못되었습니다.") + else: + form = LocalLoginForm() + return render(request, 'login_page.html', {'form': form}) + +# 로그아웃 기능 +def logout(request): + request.session.flush() # 모든 세션 데이터를 한 줄로 제거 + return redirect('login_page') + +# 회원가입 페이지 호출 +def register_page(request): + return render(request, 'register_page.html') + +# 회원가입 데이터 처리 +def register(request): + if request.method == 'POST': + register_id = request.POST.get('register_id') + register_pw = request.POST.get('register_pw') + register_name = request.POST.get('register_name') + is_admin = request.POST.get('is_admin') == 'True' + + if not register_id or not register_pw or not register_name: + messages.error(request, '모든 항목을 입력해 주세요.') + print("모든 항목을 입력해 주세요.") + return render(request, 'register_page.html') + + if LocalUser.objects.filter(user_id=register_id).exists(): + messages.error(request, '이미 사용 중인 아이디입니다.') + print("이미 사용 중인 아이디입니다.") + return render(request, 'register_page.html') + + try: + user = LocalUser.objects.create( + user_id=register_id, + user_pw=make_password(register_pw), # 비밀번호 해싱 + user_name=register_name, + is_admin=is_admin + ) + messages.success(request, '회원가입이 완료되었습니다. 로그인해주세요.') + return redirect('login_page') + + except Exception as e: + messages.error(request, f'회원가입에 실패했습니다: {e}') + print("회원가입에 실패했습니다.") + return render(request, 'register_page.html') + + +# ID찾기 페이지 호출 +def find_id(request): + return render(request, 'find_id.html') + +# PW찾기 페이지 호출 +def find_pw(request): + return render(request, 'find_pw.html') + +# 사용설명서 페이지 호출 +def manual(request): + return render(request, 'manual.html') + + +live_coin_data_scheduler_running = False +user_trade_request = list() +coin_data_history = list() + +BTC, ETH, XRP, DOGE = None, None, None, None +# 코인 데이터 저장 + +def main(request): + global live_coin_data_scheduler_running + + # 스케줄러가 실행 중인지 확인 + if not live_coin_data_scheduler_running: + # 스케줄러를 별도의 스레드에서 실행 + thread = threading.Thread(target=coin_store_scheduler) + thread.daemon = True + thread.start() + live_coin_data_scheduler_running = True + return render(request, 'index.html') + +def load_coin_data(request): + coin_data = coin_recent.objects.all() + coin_data_history = [] + + if coin_data.exists(): + for coin in coin_data: + coin_data_history.append({ + 'coin_name': coin.coin_name, + 'opening_price': float(coin.opening_price), + 'high_price': float(coin.high_price), + 'low_price': float(coin.low_price), + 'trade_price': float(coin.trade_price), + 'time_stamp': coin.time_stamp.isoformat(), # ISO 형식으로 문자열 변환 + 'candle_acc_trade_price': float(coin.candle_acc_trade_price), + 'candle_acc_trade_volume': float(coin.candle_acc_trade_volume), + 'candle_date_time_kst': coin.candle_date_time_kst.isoformat() if coin.candle_date_time_kst else None, + }) + return JsonResponse({'coin_data': coin_data_history}) + else: + return JsonResponse({'error': 'No data found'}, status=404) + +def remove_order(request): + # 주문을 삭제하는 함수 + if request.method == 'POST': + order_id = request.POST.get('order_id') + for order in user_trade_request: + if order['order_id'] == order_id: + user_trade_request.remove(order) + break + return JsonResponse({'status': 'success'}) + else: + print("Error: Invalid request method") + return None + +def compare_order_and_coin_value_scheduler(): + for order in user_trade_request[:]: # 리스트 순회 중 제거 방지를 위해 슬라이싱 사용 + # 현재 코인 가격 결정 + if order['coin_name'] == "KRW-BTC": + coin_value = BTC + elif order['coin_name'] == "KRW-ETH": + coin_value = ETH + elif order['coin_name'] == "KRW-XRP": + coin_value = XRP + elif order['coin_name'] == "KRW-DOGE": + coin_value = DOGE + else: + continue # 해당하는 코인이 없으면 무시 + + # 구매 조건 만족 + if order['trade_type'] == 'buy' and order['coin_price'] >= coin_value: + trade_history.objects.create( + user_id=order['user_id'], + coin_name=order['coin_name'], + coin_price=order['coin_price'], + coin_amount=order['coin_amount'], + order_time=order['order_time'] + ) + user_trade_request.remove(order) + + # 판매 조건 만족 + elif order['trade_type'] == 'sell' and order['coin_price'] <= coin_value: + # 자산 증가 처리 + try: + asset = Asset.objects.get(user=order['user_id']) + total_gain = Decimal(order['coin_price']) * Decimal(order['coin_amount']) + asset.money += total_gain + asset.save() + except Asset.DoesNotExist: + print("?") + pass + + # 거래 기록 저장 + trade_history.objects.create( + user_id=order['user_id'], + coin_name=order['coin_name'], + coin_price=order['coin_price'], + coin_amount=order['coin_amount'], + order_time=order['order_time'] + ) + user_trade_request.remove(order) + + return None + + +def coin_store_scheduler(): + # 스케줄러를 실행하는 함수 코인저장장 + store_value = schedule.every(1).seconds.do(coin_value_store) + # schedule.every(1).seconds.do(coin_live_value) + while True: + schedule.run_pending() + + # time.sleep(1) + + if store_value is True: #DB 저장 실패시 + time.sleep(60) # 1초 대기 + else: + break + + +def coin_value_store(): + result_arr = fetch_coin_prices() + if result_arr is not False: + + # API 호출 실패 처리 + if not result_arr: + print("Warning: fetch_coin_prices() returned None. Skipping this cycle.") + return False # 저장 실패 처리 + + for coin in result_arr: + # naive datetime → aware datetime으로 변환 + naive_time = datetime.fromtimestamp(coin["timestamp"] / 1000) + time_aware = timezone.make_aware(naive_time) + + coin_recent.objects.update_or_create( + coin_name=coin["market"], + defaults={ + 'opening_price': coin["opening_price"], + 'high_price': coin["high_price"], + 'low_price': coin["low_price"], + 'trade_price': coin["trade_price"], + 'time_stamp': time_aware, + 'candle_acc_trade_price': coin["acc_trade_price_24h"], + 'candle_acc_trade_volume': coin["acc_trade_volume_24h"], + 'interval': '1s', + } + ) + + coin_archive.objects.create( + coin_name=coin["market"], + opening_price=coin["opening_price"], + high_price=coin["high_price"], + low_price=coin["low_price"], + trade_price=coin["trade_price"], + time_stamp=time_aware, # ✅ timezone-aware datetime 사용 + candle_acc_trade_price=coin["acc_trade_price_24h"], + candle_acc_trade_volume=coin["acc_trade_volume_24h"], + interval='1s', + ) + return True + else: + return False + +def fetch_coin_prices(): + """ + request 없이 호출 가능한 백그라운드용 함수 + """ + url = "https://api.upbit.com" + param = { + 'markets': 'KRW-BTC,KRW-ETH,KRW-XRP,KRW-DOGE' + } + response = requests.get(url + '/v1/ticker', params=param) + result_arr = [] + + if response.status_code == 200: + data = response.json() + global BTC, ETH, XRP, DOGE + for coin in data: + result_arr.append({ + "market": coin.get("market"), + "trade_price": coin.get("trade_price"), + "opening_price": coin.get("opening_price"), + "high_price": coin.get("high_price"), + "low_price": coin.get("low_price"), + "acc_trade_price_24h": coin.get("acc_trade_price_24h"), + "acc_trade_volume_24h": coin.get("acc_trade_volume_24h"), + "timestamp": coin.get("timestamp"), + "trade_date_kst": coin.get("trade_date_kst"), + }) + + if coin.get("market") == "KRW-BTC": + BTC = coin.get("trade_price") + elif coin.get("market") == "KRW-ETH": + ETH = coin.get("trade_price") + elif coin.get("market") == "KRW-XRP": + XRP = coin.get("trade_price") + elif coin.get("market") == "KRW-DOGE": + DOGE = coin.get("trade_price") + + return result_arr + else: + print("Error:", response.status_code) + return None + +def coin_live_value(request): + """ + Django view 함수: HTTP 요청에 응답 + """ + result_arr = fetch_coin_prices() + if result_arr is not None: + return JsonResponse({'value': result_arr}) + else: + return JsonResponse({'error': 'Failed to fetch data'}, status=500) + + +def trade_order_request(request): + if request.method == 'POST': + data = json.loads(request.body) + coin_name = data.POST.get('coin_name') + coin_price = data.POST.get('coin_price') + coin_amount = data.POST.get('coin_amount') + trade_type_buy_sell = data.POST.get('trade_type') + user = LocalUser.objects.get(user_id=request.session['user_id']) + + try: + user = LocalUser.objects.get(user_id=request.session['user_id']) + total_cost = coin_price * coin_amount + + # 구매일 경우 asset에서 돈 차감 + if trade_type_buy_sell == 'buy': + asset = Asset.objects.get(user=user) + + if asset.money >= total_cost: + asset.money -= total_cost + asset.save() + else: + return JsonResponse({'error': '보유 자금이 부족합니다.'}, status=400) + #메모리에 저장 + user_trade_request.append({ + 'user_id': user, + 'coin_name': coin_name, + 'coin_price': coin_price, + 'coin_amount': coin_amount, + 'trade_type': trade_type_buy_sell, + 'order_time': datetime.now() + }) + except LocalUser.DoesNotExist: + print("??") + pass + + + #DB저장 요청 + trade_order_request.objects.create( + user_id=user, + coin_name=coin_name, + coin_price=coin_price, + coin_amount=coin_amount, + trade_type = trade_type_buy_sell, + order_time=datetime.now() + ) + else: + print("거래요청 오류") + return None diff --git a/coin_project/__init__.py b/coin_project/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/coin_project/__pycache__/__init__.cpython-312.pyc b/coin_project/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..0a83f20 Binary files /dev/null and b/coin_project/__pycache__/__init__.cpython-312.pyc differ diff --git a/coin_project/__pycache__/settings.cpython-312.pyc b/coin_project/__pycache__/settings.cpython-312.pyc new file mode 100644 index 0000000..376491c Binary files /dev/null and b/coin_project/__pycache__/settings.cpython-312.pyc differ diff --git a/coin_project/__pycache__/urls.cpython-312.pyc b/coin_project/__pycache__/urls.cpython-312.pyc new file mode 100644 index 0000000..3562638 Binary files /dev/null and b/coin_project/__pycache__/urls.cpython-312.pyc differ diff --git a/coin_project/__pycache__/views.cpython-312.pyc b/coin_project/__pycache__/views.cpython-312.pyc new file mode 100644 index 0000000..68bb072 Binary files /dev/null and b/coin_project/__pycache__/views.cpython-312.pyc differ diff --git a/coin_project/__pycache__/wsgi.cpython-312.pyc b/coin_project/__pycache__/wsgi.cpython-312.pyc new file mode 100644 index 0000000..7642b09 Binary files /dev/null and b/coin_project/__pycache__/wsgi.cpython-312.pyc differ diff --git a/coin_project/asgi.py b/coin_project/asgi.py new file mode 100644 index 0000000..5af2650 --- /dev/null +++ b/coin_project/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for coin_project project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/5.1/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'coin_project.settings') + +application = get_asgi_application() diff --git a/coin_project/settings.py b/coin_project/settings.py new file mode 100644 index 0000000..c753c4d --- /dev/null +++ b/coin_project/settings.py @@ -0,0 +1,133 @@ +from pathlib import Path +from django.contrib.messages import constants as messages +import os +from dotenv import load_dotenv +import json + +load_dotenv(os.path.join(os.path.dirname(os.path.dirname(__file__)), 'app', '.env')) + +BASE_DIR = Path(__file__).resolve().parent.parent + +SECRET_KEY = os.getenv("SECRET_KEY") +if not SECRET_KEY: + raise Exception("SECRET_KEY is missing! Please set it in the .env file.") +DEBUG = True +ALLOWED_HOSTS = [] + +# 로그인 관련 설정 +LOGIN_URL = '/login_page/' +LOGIN_REDIRECT_URL = '/main_page/' # 로그인 성공 시 이동 +LOGOUT_REDIRECT_URL = '/login_page/' + +# 세션 설정 +SESSION_ENGINE = 'django.contrib.sessions.backends.db' +SESSION_COOKIE_AGE = 3600 +SESSION_SAVE_EVERY_REQUEST = True +SESSION_EXPIRE_AT_BROWSER_CLOSE = False + +# 메시지 태그 설정 +MESSAGE_TAGS = { + messages.ERROR: 'error', + messages.SUCCESS: 'success', +} + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'app', + 'social_django', +] + +#pip install django-apscheduler +###scheduler +APSCHEDULER_DATETIME_FORMAT = "N j, Y, f:s a" # Default + +SCHEDULER_DEFAULT = True +### + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'social_django.middleware.SocialAuthExceptionMiddleware', +] + +AUTHENTICATION_BACKENDS = [ + 'social_core.backends.google.GoogleOAuth2', + 'social_core.backends.kakao.KakaoOAuth2', + 'django.contrib.auth.backends.ModelBackend', +] + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [BASE_DIR / 'templates'], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + 'social_django.context_processors.backends', + 'social_django.context_processors.login_redirect', + ], + }, + }, +] + +# 프로젝트의 URL 라우팅을 정의하는 파일 +ROOT_URLCONF = 'coin_project.urls' + +WSGI_APPLICATION = 'coin_project.wsgi.application' + +DATABASES = { + 'default': { + 'ENGINE': os.getenv("ENGINE"), + 'NAME': os.getenv("NAME"), + 'USER': os.getenv("USER"), + 'PASSWORD': os.getenv("PASSWORD"), + 'HOST': os.getenv("HOST"), + 'PORT': os.getenv("PORT"), + 'OPTIONS': { + 'init_command': os.getenv("init_command") + } + } +} + +AUTH_PASSWORD_VALIDATORS = [ + {'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator'}, + {'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator'}, + {'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator'}, + {'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator'}, +] + +LANGUAGE_CODE = 'en-us' +TIME_ZONE = 'UTC' +USE_I18N = True +USE_TZ = True + +STATIC_URL = '/static/' +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' + +# 소셜 로그인 관련 키 (실제 값은 개인 키로 설정 필요) +SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = os.getenv("SOCIAL_AUTH_GOOGLE_OAUTH2_KEY") +SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = os.getenv("SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET") +SOCIAL_AUTH_GOOGLE_OAUTH2_REDIRECT_URI = os.getenv("SOCIAL_AUTH_GOOGLE_OAUTH2_REDIRECT_URI") +SOCIAL_AUTH_GOOGLE_OAUTH2_SCOPE = json.loads(os.getenv("SOCIAL_AUTH_GOOGLE_OAUTH2_SCOPE", '["email", "profile"]')) + +SOCIAL_AUTH_KAKAO_KEY = os.getenv("SOCIAL_AUTH_KAKAO_KEY") +SOCIAL_AUTH_KAKAO_SECRET = os.getenv("SOCIAL_AUTH_KAKAO_SECRET") + +# 소셜 로그인에서 사용할 모델 설정 (카카오, 구글) +SOCIAL_AUTH_USER_MODEL = 'auth.User' # 소셜 로그인 모델 사용 + +ALLOWED_HOSTS = ['localhost', '127.0.0.1'] diff --git a/coin_project/urls.py b/coin_project/urls.py new file mode 100644 index 0000000..fa011a7 --- /dev/null +++ b/coin_project/urls.py @@ -0,0 +1,10 @@ +# coin_project/urls.py + +from django.contrib import admin +from django.urls import path, include + +urlpatterns = [ + path('', include('app.urls')), # 기본 앱 + path('admin/', admin.site.urls), + path('auth/', include('social_django.urls', namespace='social')), +] diff --git a/coin_project/wsgi.py b/coin_project/wsgi.py new file mode 100644 index 0000000..b5b060d --- /dev/null +++ b/coin_project/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for coin_project project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/5.1/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'coin_project.settings') + +application = get_wsgi_application() diff --git a/css/find_pw.css b/css/find_pw.css deleted file mode 100644 index b4a44ff..0000000 --- a/css/find_pw.css +++ /dev/null @@ -1,63 +0,0 @@ -body { - font-family: Arial, sans-serif; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - height: 100vh; - background-color: #f4f4f4; - margin: 0; -} - -h2 { - color: #333; -} - -form { - background: white; - padding: 20px; - border-radius: 8px; - box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); - display: flex; - flex-direction: column; - width: 300px; -} - -label { - margin-top: 10px; - font-weight: bold; -} - -input { - padding: 8px; - margin-top: 5px; - border: 1px solid #ccc; - border-radius: 4px; -} - -button { - margin-top: 15px; - padding: 10px; - background-color: #007bff; - color: white; - border: none; - border-radius: 4px; - cursor: pointer; - font-size: 16px; -} - -button:hover { - background-color: #0056b3; -} - -a { - display: block; - margin-top: 15px; - text-decoration: none; - color: #007bff; - font-size: 14px; -} - -a:hover { - text-decoration: underline; -} diff --git a/db.sqlite3 b/db.sqlite3 new file mode 100644 index 0000000..cae6bee Binary files /dev/null and b/db.sqlite3 differ diff --git a/html/find_pw.HTML b/html/find_pw.HTML deleted file mode 100644 index 32745a4..0000000 --- a/html/find_pw.HTML +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - 비밀번호 찾기 - - - -

비밀번호 찾기

-
- - - - - - - -
- 로그인 페이지로 돌아가기 - - diff --git a/html/login.HTML b/html/login.HTML deleted file mode 100644 index f81ec05..0000000 --- a/html/login.HTML +++ /dev/null @@ -1,58 +0,0 @@ - - - - - 로그인 페이지 - - - -
- -
- - -
- -
- -

로그인

-
-
- - -
-
- - -
- -
- - - -
-
- - diff --git a/html/signup.html b/html/signup.html deleted file mode 100644 index ee300af..0000000 --- a/html/signup.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - 회원가입 - - - - -
-
-

회원가입

-
- -
- - - -
- - - -
- - - -
- - - -
- - - -
- - - -
- -
-

약관 내용

- - -
- - -
-
- - diff --git a/manage.py b/manage.py new file mode 100644 index 0000000..abd6a93 --- /dev/null +++ b/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + """Run administrative tasks.""" + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'coin_project.settings') + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc + execute_from_command_line(sys.argv) + + +if __name__ == '__main__': + main() diff --git a/node_modules/.bin/loose-envify b/node_modules/.bin/loose-envify new file mode 100644 index 0000000..076f91b --- /dev/null +++ b/node_modules/.bin/loose-envify @@ -0,0 +1,16 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../loose-envify/cli.js" "$@" +else + exec node "$basedir/../loose-envify/cli.js" "$@" +fi diff --git a/node_modules/.bin/loose-envify.cmd b/node_modules/.bin/loose-envify.cmd new file mode 100644 index 0000000..599576f --- /dev/null +++ b/node_modules/.bin/loose-envify.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\loose-envify\cli.js" %* diff --git a/node_modules/.bin/loose-envify.ps1 b/node_modules/.bin/loose-envify.ps1 new file mode 100644 index 0000000..eb866fc --- /dev/null +++ b/node_modules/.bin/loose-envify.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../loose-envify/cli.js" $args + } else { + & "$basedir/node$exe" "$basedir/../loose-envify/cli.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../loose-envify/cli.js" $args + } else { + & "node$exe" "$basedir/../loose-envify/cli.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json new file mode 100644 index 0000000..82b1e66 --- /dev/null +++ b/node_modules/.package-lock.json @@ -0,0 +1,150 @@ +{ + "name": "coin_project", + "lockfileVersion": 3, + "requires": true, + "packages": { + "node_modules/@svgdotjs/svg.draggable.js": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@svgdotjs/svg.draggable.js/-/svg.draggable.js-3.0.6.tgz", + "integrity": "sha512-7iJFm9lL3C40HQcqzEfezK2l+dW2CpoVY3b77KQGqc8GXWa6LhhmX5Ckv7alQfUXBuZbjpICZ+Dvq1czlGx7gA==", + "license": "MIT", + "peerDependencies": { + "@svgdotjs/svg.js": "^3.2.4" + } + }, + "node_modules/@svgdotjs/svg.filter.js": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/@svgdotjs/svg.filter.js/-/svg.filter.js-3.0.9.tgz", + "integrity": "sha512-/69XMRCDoam2HgC4ldHIaDgeQf1ViHIsa0Ld4uWgiXtZ+E24DWHe/9Ib6kbNiZ7WRIdlVokUDR1Fg0kjIpkfbw==", + "license": "MIT", + "dependencies": { + "@svgdotjs/svg.js": "^3.2.4" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/@svgdotjs/svg.js": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@svgdotjs/svg.js/-/svg.js-3.2.4.tgz", + "integrity": "sha512-BjJ/7vWNowlX3Z8O4ywT58DqbNRyYlkk6Yz/D13aB7hGmfQTvGX4Tkgtm/ApYlu9M7lCQi15xUEidqMUmdMYwg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Fuzzyma" + } + }, + "node_modules/@svgdotjs/svg.resize.js": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@svgdotjs/svg.resize.js/-/svg.resize.js-2.0.5.tgz", + "integrity": "sha512-4heRW4B1QrJeENfi7326lUPYBCevj78FJs8kfeDxn5st0IYPIRXoTtOSYvTzFWgaWWXd3YCDE6ao4fmv91RthA==", + "license": "MIT", + "engines": { + "node": ">= 14.18" + }, + "peerDependencies": { + "@svgdotjs/svg.js": "^3.2.4", + "@svgdotjs/svg.select.js": "^4.0.1" + } + }, + "node_modules/@svgdotjs/svg.select.js": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@svgdotjs/svg.select.js/-/svg.select.js-4.0.2.tgz", + "integrity": "sha512-5gWdrvoQX3keo03SCmgaBbD+kFftq0F/f2bzCbNnpkkvW6tk4rl4MakORzFuNjvXPWwB4az9GwuvVxQVnjaK2g==", + "license": "MIT", + "engines": { + "node": ">= 14.18" + }, + "peerDependencies": { + "@svgdotjs/svg.js": "^3.2.4" + } + }, + "node_modules/@yr/monotone-cubic-spline": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@yr/monotone-cubic-spline/-/monotone-cubic-spline-1.0.3.tgz", + "integrity": "sha512-FQXkOta0XBSUPHndIKON2Y9JeQz5ZeMqLYZVVK93FliNBFm7LNMIZmY6FrMEB9XPcDbE2bekMbZD6kzDkxwYjA==", + "license": "MIT" + }, + "node_modules/apexcharts": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/apexcharts/-/apexcharts-4.5.0.tgz", + "integrity": "sha512-E7ZkrVqPNBUWy/Rmg8DEIqHNBmElzICE/oxOX5Ekvs2ICQUOK/VkEkMH09JGJu+O/EA0NL31hxlmF+wrwrSLaQ==", + "license": "MIT", + "dependencies": { + "@svgdotjs/svg.draggable.js": "^3.0.4", + "@svgdotjs/svg.filter.js": "^3.0.8", + "@svgdotjs/svg.js": "^3.2.4", + "@svgdotjs/svg.resize.js": "^2.0.2", + "@svgdotjs/svg.select.js": "^4.0.1", + "@yr/monotone-cubic-spline": "^1.0.3" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "license": "MIT" + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "license": "MIT", + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/prop-types": { + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + } + }, + "node_modules/react": { + "version": "19.1.0", + "resolved": "https://registry.npmjs.org/react/-/react-19.1.0.tgz", + "integrity": "sha512-FS+XFBNvn3GTAWq26joslQgWNoFu08F4kl0J4CgdNKADkdSGXQyTCnKteIAJy96Br6YbpEU1LSzV5dYtjMkMDg==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-apexcharts": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/react-apexcharts/-/react-apexcharts-1.7.0.tgz", + "integrity": "sha512-03oScKJyNLRf0Oe+ihJxFZliBQM9vW3UWwomVn4YVRTN1jsIR58dLWt0v1sb8RwJVHDMbeHiKQueM0KGpn7nOA==", + "license": "MIT", + "dependencies": { + "prop-types": "^15.8.1" + }, + "peerDependencies": { + "apexcharts": ">=4.0.0", + "react": ">=0.13" + } + }, + "node_modules/react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "license": "MIT" + } + } +} diff --git a/node_modules/@svgdotjs/svg.draggable.js/LICENSE b/node_modules/@svgdotjs/svg.draggable.js/LICENSE new file mode 100644 index 0000000..83a83e2 --- /dev/null +++ b/node_modules/@svgdotjs/svg.draggable.js/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2018 Ulrich-Matthias + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@svgdotjs/svg.draggable.js/README.md b/node_modules/@svgdotjs/svg.draggable.js/README.md new file mode 100644 index 0000000..c83869b --- /dev/null +++ b/node_modules/@svgdotjs/svg.draggable.js/README.md @@ -0,0 +1,152 @@ +# svg.draggable.js + +A plugin for the [svgdotjs.github.io](https://svgdotjs.github.io/) library to make elements draggable. + +svg.draggable.js is licensed under the terms of the MIT License. + +## Usage + +Install the plugin: + +```sh +npm install @svgdotjs/svg.js @svgdotjs/svg.draggable.js +``` + +Include this plugin after including the svg.js library in your html document. + +```html + + +``` + +Or for esm just require it: + +```js +import { SVG } from '@svgdotjs/svg.js' +import '@svgdotjs/svg.draggable.js' +``` + +To make an element draggable just call `draggable()` on the element + +```javascript +var draw = SVG().addTo('#canvas').size(400, 400) +var rect = draw.rect(100, 100) + +rect.draggable() +``` + +Yes indeed, that's it! Now the `rect` is draggable. + +## Events + +The Plugin fires 4 different events + +- beforedrag (cancelable) +- dragstart +- dragmove (cancelable) +- dragend + +You can bind/unbind listeners to this events: + +```javascript +// bind +rect.on('dragstart.namespace', function (event) { + // event.detail.event hold the given data explained below + // this == rect +}) + +// unbind +rect.off('dragstart.namespace') +``` + +### event.detail + +`beforedrag`, `dragstart`, `dragmove` and `dragend` gives you the mouse / touch `event` and the `handler` which calculates the drag. The `dragmove` event also gives you the `dx` and `dy` values for your convenience. +Except for `beforedrag` the events also give you `detail.box` which holds the initial or new bbox of the element before or after the drag. + +You can use this property to implement custom drag behavior as seen below. + +Please note that the bounding box is not what you would expect for nested svgs because those calculate their bbox based on their content and not their x, y, width and height values. Therefore stuff like constraints needs to be implemented a bit differently. + +### Cancelable Events + +You can prevent the default action of `beforedrag` and `dragmove` with a call to `event.preventDefault()` in the callback function. +The shape won't be dragged in this case. That is helpfull if you want to implement your own drag handling. + +```javascript +rect.draggable().on('beforedrag', (e) => { + e.preventDefault() + // no other events are bound + // drag was completely prevented +}) + +rect.draggable().on('dragmove', (e) => { + e.preventDefault() + e.detail.handler.move(100, 200) + // events are still bound e.g. dragend will fire anyway +}) +``` + +### Custom Drag Behavior + +#### Constraints + +```js +// Some constraints (x, y, width, height) +const constraints = new SVG.Box(100, 100, 400, 400) + +rect.on('dragmove.namespace', (e) => { + const { handler, box } = e.detail + e.preventDefault() + + let { x, y } = box + + // In case your dragged element is a nested element, + // you are better off using the rbox() instead of bbox() + + if (x < constraints.x) { + x = constraints.x + } + + if (y < constraints.y) { + y = constraints.y + } + + if (box.x2 > constraints.x2) { + x = constraints.x2 - box.w + } + + if (box.y2 > constraints.y2) { + y = constraints.y2 - box.h + } + + handler.move(x - (x % 50), y - (y % 50)) +}) +``` + +#### Snap to grid + +```js +rect.on('dragmove.namespace', (e) => { + const { handler, box } = e.detail + e.preventDefault() + + handler.move(box.x - (box.x % 50), box.y - (box.y % 50)) +}) +``` + +## Remove + +The draggable functionality can be removed calling draggable again with false as argument: + +```javascript +rect.draggable(false) +``` + +## Restrictions + +- If your root-svg is transformed this plugin won't work properly in Firefox. Viewbox however is not affected. + +## Dependencies + +This module requires svg.js >= v3.0.10 diff --git a/node_modules/@svgdotjs/svg.draggable.js/dist/svg.draggable.js b/node_modules/@svgdotjs/svg.draggable.js/dist/svg.draggable.js new file mode 100644 index 0000000..9949528 --- /dev/null +++ b/node_modules/@svgdotjs/svg.draggable.js/dist/svg.draggable.js @@ -0,0 +1,11 @@ +(function(e,o){typeof exports=="object"&&typeof module<"u"?o(require("@svgdotjs/svg.js")):typeof define=="function"&&define.amd?define(["@svgdotjs/svg.js"],o):(e=typeof globalThis<"u"?globalThis:e||self,o(e.SVG))})(this,function(e){"use strict";/*! +* @svgdotjs/svg.draggable.js - An extension for svg.js which allows to drag elements with your mouse +* @version 3.0.6 +* https://github.com/svgdotjs/svg.draggable.js +* +* @copyright Wout Fierens +* @license MIT +* +* BUILT: Sat Feb 08 2025 09:31:06 GMT+0100 (Central European Standard Time) +*/const o=s=>(s.changedTouches&&(s=s.changedTouches[0]),{x:s.clientX,y:s.clientY});class f{constructor(t){t.remember("_draggable",this),this.el=t,this.drag=this.drag.bind(this),this.startDrag=this.startDrag.bind(this),this.endDrag=this.endDrag.bind(this)}init(t){t?(this.el.on("mousedown.drag",this.startDrag),this.el.on("touchstart.drag",this.startDrag,{passive:!1})):(this.el.off("mousedown.drag"),this.el.off("touchstart.drag"))}startDrag(t){const i=!t.type.indexOf("mouse");if(i&&t.which!==1&&t.buttons!==0||this.el.dispatch("beforedrag",{event:t,handler:this}).defaultPrevented)return;t.preventDefault(),t.stopPropagation(),this.init(!1),this.box=this.el.bbox(),this.lastClick=this.el.point(o(t));const r=(i?"mousemove":"touchmove")+".drag",n=(i?"mouseup":"touchend")+".drag";e.on(window,r,this.drag,this,{passive:!1}),e.on(window,n,this.endDrag,this,{passive:!1}),this.el.fire("dragstart",{event:t,handler:this,box:this.box})}drag(t){const{box:i,lastClick:r}=this,n=this.el.point(o(t)),d=n.x-r.x,a=n.y-r.y;if(!d&&!a)return i;const h=i.x+d,l=i.y+a;this.box=new e.Box(h,l,i.w,i.h),this.lastClick=n,!this.el.dispatch("dragmove",{event:t,handler:this,box:this.box,dx:d,dy:a}).defaultPrevented&&this.move(h,l)}move(t,i){this.el.type==="svg"?e.G.prototype.move.call(this.el,t,i):this.el.move(t,i)}endDrag(t){this.drag(t),this.el.fire("dragend",{event:t,handler:this,box:this.box}),e.off(window,"mousemove.drag"),e.off(window,"touchmove.drag"),e.off(window,"mouseup.drag"),e.off(window,"touchend.drag"),this.init(!0)}}e.extend(e.Element,{draggable(s=!0){return(this.remember("_draggable")||new f(this)).init(s),this}})}); +//# sourceMappingURL=svg.draggable.js.map diff --git a/node_modules/@svgdotjs/svg.draggable.js/dist/svg.draggable.js.map b/node_modules/@svgdotjs/svg.draggable.js/dist/svg.draggable.js.map new file mode 100644 index 0000000..d49858a --- /dev/null +++ b/node_modules/@svgdotjs/svg.draggable.js/dist/svg.draggable.js.map @@ -0,0 +1 @@ +{"version":3,"file":"svg.draggable.js","sources":["../src/svg.draggable.js"],"sourcesContent":["import { Box, Element, G, extend, off, on } from '@svgdotjs/svg.js'\n\nconst getCoordsFromEvent = (ev) => {\n if (ev.changedTouches) {\n ev = ev.changedTouches[0]\n }\n return { x: ev.clientX, y: ev.clientY }\n}\n\n// Creates handler, saves it\nclass DragHandler {\n constructor(el) {\n el.remember('_draggable', this)\n this.el = el\n\n this.drag = this.drag.bind(this)\n this.startDrag = this.startDrag.bind(this)\n this.endDrag = this.endDrag.bind(this)\n }\n\n // Enables or disabled drag based on input\n init(enabled) {\n if (enabled) {\n this.el.on('mousedown.drag', this.startDrag)\n this.el.on('touchstart.drag', this.startDrag, { passive: false })\n } else {\n this.el.off('mousedown.drag')\n this.el.off('touchstart.drag')\n }\n }\n\n // Start dragging\n startDrag(ev) {\n const isMouse = !ev.type.indexOf('mouse')\n\n // Check for left button\n if (isMouse && ev.which !== 1 && ev.buttons !== 0) {\n return\n }\n\n // Fire beforedrag event\n if (\n this.el.dispatch('beforedrag', { event: ev, handler: this })\n .defaultPrevented\n ) {\n return\n }\n\n // Prevent browser drag behavior as soon as possible\n ev.preventDefault()\n\n // Prevent propagation to a parent that might also have dragging enabled\n ev.stopPropagation()\n\n // Make sure that start events are unbound so that one element\n // is only dragged by one input only\n this.init(false)\n\n this.box = this.el.bbox()\n this.lastClick = this.el.point(getCoordsFromEvent(ev))\n\n const eventMove = (isMouse ? 'mousemove' : 'touchmove') + '.drag'\n const eventEnd = (isMouse ? 'mouseup' : 'touchend') + '.drag'\n\n // Bind drag and end events to window\n on(window, eventMove, this.drag, this, { passive: false })\n on(window, eventEnd, this.endDrag, this, { passive: false })\n\n // Fire dragstart event\n this.el.fire('dragstart', { event: ev, handler: this, box: this.box })\n }\n\n // While dragging\n drag(ev) {\n const { box, lastClick } = this\n\n const currentClick = this.el.point(getCoordsFromEvent(ev))\n const dx = currentClick.x - lastClick.x\n const dy = currentClick.y - lastClick.y\n\n if (!dx && !dy) return box\n\n const x = box.x + dx\n const y = box.y + dy\n this.box = new Box(x, y, box.w, box.h)\n this.lastClick = currentClick\n\n if (\n this.el.dispatch('dragmove', {\n event: ev,\n handler: this,\n box: this.box,\n dx,\n dy,\n }).defaultPrevented\n ) {\n return\n }\n\n this.move(x, y)\n }\n\n move(x, y) {\n // Svg elements bbox depends on their content even though they have\n // x, y, width and height - strange!\n // Thats why we handle them the same as groups\n if (this.el.type === 'svg') {\n G.prototype.move.call(this.el, x, y)\n } else {\n this.el.move(x, y)\n }\n }\n\n endDrag(ev) {\n // final drag\n this.drag(ev)\n\n // fire dragend event\n this.el.fire('dragend', { event: ev, handler: this, box: this.box })\n\n // unbind events\n off(window, 'mousemove.drag')\n off(window, 'touchmove.drag')\n off(window, 'mouseup.drag')\n off(window, 'touchend.drag')\n\n // Rebind initial Events\n this.init(true)\n }\n}\n\nextend(Element, {\n draggable(enable = true) {\n const dragHandler = this.remember('_draggable') || new DragHandler(this)\n dragHandler.init(enable)\n return this\n },\n})\n"],"names":["getCoordsFromEvent","ev","DragHandler","el","enabled","isMouse","eventMove","eventEnd","on","box","lastClick","currentClick","dx","dy","x","y","Box","G","off","svg_js","Element","enable"],"mappings":";;;;;;;;;uPAEA,MAAMA,EAAsBC,IACtBA,EAAG,iBACLA,EAAKA,EAAG,eAAe,CAAC,GAEnB,CAAE,EAAGA,EAAG,QAAS,EAAGA,EAAG,OAAS,GAIzC,MAAMC,CAAY,CAChB,YAAYC,EAAI,CACdA,EAAG,SAAS,aAAc,IAAI,EAC9B,KAAK,GAAKA,EAEV,KAAK,KAAO,KAAK,KAAK,KAAK,IAAI,EAC/B,KAAK,UAAY,KAAK,UAAU,KAAK,IAAI,EACzC,KAAK,QAAU,KAAK,QAAQ,KAAK,IAAI,CACtC,CAGD,KAAKC,EAAS,CACRA,GACF,KAAK,GAAG,GAAG,iBAAkB,KAAK,SAAS,EAC3C,KAAK,GAAG,GAAG,kBAAmB,KAAK,UAAW,CAAE,QAAS,GAAO,IAEhE,KAAK,GAAG,IAAI,gBAAgB,EAC5B,KAAK,GAAG,IAAI,iBAAiB,EAEhC,CAGD,UAAUH,EAAI,CACZ,MAAMI,EAAU,CAACJ,EAAG,KAAK,QAAQ,OAAO,EAQxC,GALII,GAAWJ,EAAG,QAAU,GAAKA,EAAG,UAAY,GAM9C,KAAK,GAAG,SAAS,aAAc,CAAE,MAAOA,EAAI,QAAS,KAAM,EACxD,iBAEH,OAIFA,EAAG,eAAgB,EAGnBA,EAAG,gBAAiB,EAIpB,KAAK,KAAK,EAAK,EAEf,KAAK,IAAM,KAAK,GAAG,KAAM,EACzB,KAAK,UAAY,KA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,EAC5BA,EAAG,IAAC,OAAQ,cAAc,EAC1BA,EAAG,IAAC,OAAQ,eAAe,EAG3B,KAAK,KAAK,EAAI,CACf,CACH,CAEMC,EAAA,OAACC,UAAS,CACd,UAAUC,EAAS,GAAM,CAEvB,OADoB,KAAK,SAAS,YAAY,GAAK,IAAInB,EAAY,IAAI,GAC3D,KAAKmB,CAAM,EAChB,IACR,CACH,CAAC"} \ No newline at end of file diff --git a/node_modules/@svgdotjs/svg.draggable.js/package.json b/node_modules/@svgdotjs/svg.draggable.js/package.json new file mode 100644 index 0000000..217396c --- /dev/null +++ b/node_modules/@svgdotjs/svg.draggable.js/package.json @@ -0,0 +1,72 @@ +{ + "name": "@svgdotjs/svg.draggable.js", + "version": "3.0.6", + "description": "An extension for svg.js which allows to drag elements with your mouse", + "type": "module", + "main": "dist/svg.draggable.js", + "module": "src/svg.draggable.js", + "exports": { + ".": { + "import": { + "types": "./svg.draggable.js.d.ts", + "default": "./src/svg.draggable.js" + }, + "require": { + "types": "./svg.draggable.js.d.cts", + "default": "./src/svg.draggable.js" + }, + "browser": { + "types": "./svg.draggable.js.d.ts", + "default": "./src/svg.draggable.js" + } + } + }, + "unpkg": "dist/svg.draggable.js", + "jsdelivr": "dist/svg.draggable.js", + "files": [ + "/dist", + "/src", + "/svg.draggable.js.d.ts", + "/svg.draggable.js.d.cts" + ], + "keywords": [ + "svg.js", + "draggable", + "mouse" + ], + "bugs": "https://github.com/svgdotjs/svg.draggable.js/issues", + "license": "MIT", + "typings": "./svg.draggable.js.d.ts", + "author": { + "name": "Wout Fierens" + }, + "contributors": [ + { + "name": "Wout Fierens" + }, + { + "name": "Ulrich-Matthias Schäfer" + } + ], + "homepage": "https://github.com/svgdotjs/svg.draggable.js", + "repository": { + "type": "git", + "url": "git+https://github.com/svgdotjs/svg.draggable.js.git" + }, + "scripts": { + "build": "npm run fix && vite build", + "fix": "npx eslint --fix", + "prepublishOnly": "rm -rf ./dist && npm run build" + }, + "devDependencies": { + "eslint": "^8.36.0", + "eslint-plugin-prettier": "^4.2.1", + "eslint-config-prettier": "^8.8.0", + "prettier": "^2.8.5", + "typescript": "^5.0.2", + "vite": "^4.2.1" + }, + "peerDependencies": { + "@svgdotjs/svg.js": "^3.2.4" + } +} diff --git a/node_modules/@svgdotjs/svg.draggable.js/src/svg.draggable.js b/node_modules/@svgdotjs/svg.draggable.js/src/svg.draggable.js new file mode 100644 index 0000000..6ec03bc --- /dev/null +++ b/node_modules/@svgdotjs/svg.draggable.js/src/svg.draggable.js @@ -0,0 +1,138 @@ +import { Box, Element, G, extend, off, on } from '@svgdotjs/svg.js' + +const getCoordsFromEvent = (ev) => { + if (ev.changedTouches) { + ev = ev.changedTouches[0] + } + return { x: ev.clientX, y: ev.clientY } +} + +// Creates handler, saves it +class DragHandler { + constructor(el) { + el.remember('_draggable', this) + this.el = el + + this.drag = this.drag.bind(this) + this.startDrag = this.startDrag.bind(this) + this.endDrag = this.endDrag.bind(this) + } + + // Enables or disabled drag based on input + init(enabled) { + if (enabled) { + this.el.on('mousedown.drag', this.startDrag) + this.el.on('touchstart.drag', this.startDrag, { passive: false }) + } else { + this.el.off('mousedown.drag') + this.el.off('touchstart.drag') + } + } + + // Start dragging + startDrag(ev) { + const isMouse = !ev.type.indexOf('mouse') + + // Check for left button + if (isMouse && ev.which !== 1 && ev.buttons !== 0) { + return + } + + // Fire beforedrag event + if ( + this.el.dispatch('beforedrag', { event: ev, handler: this }) + .defaultPrevented + ) { + return + } + + // Prevent browser drag behavior as soon as possible + ev.preventDefault() + + // Prevent propagation to a parent that might also have dragging enabled + ev.stopPropagation() + + // Make sure that start events are unbound so that one element + // is only dragged by one input only + this.init(false) + + this.box = this.el.bbox() + this.lastClick = this.el.point(getCoordsFromEvent(ev)) + + const eventMove = (isMouse ? 'mousemove' : 'touchmove') + '.drag' + const eventEnd = (isMouse ? 'mouseup' : 'touchend') + '.drag' + + // Bind drag and end events to window + on(window, eventMove, this.drag, this, { passive: false }) + on(window, eventEnd, this.endDrag, this, { passive: false }) + + // Fire dragstart event + this.el.fire('dragstart', { event: ev, handler: this, box: this.box }) + } + + // While dragging + drag(ev) { + const { box, lastClick } = this + + const currentClick = this.el.point(getCoordsFromEvent(ev)) + const dx = currentClick.x - lastClick.x + const dy = currentClick.y - lastClick.y + + if (!dx && !dy) return box + + const x = box.x + dx + const y = box.y + dy + this.box = new Box(x, y, box.w, box.h) + this.lastClick = currentClick + + if ( + this.el.dispatch('dragmove', { + event: ev, + handler: this, + box: this.box, + dx, + dy, + }).defaultPrevented + ) { + return + } + + this.move(x, y) + } + + move(x, y) { + // Svg elements bbox depends on their content even though they have + // x, y, width and height - strange! + // Thats why we handle them the same as groups + if (this.el.type === 'svg') { + G.prototype.move.call(this.el, x, y) + } else { + this.el.move(x, y) + } + } + + endDrag(ev) { + // final drag + this.drag(ev) + + // fire dragend event + this.el.fire('dragend', { event: ev, handler: this, box: this.box }) + + // unbind events + off(window, 'mousemove.drag') + off(window, 'touchmove.drag') + off(window, 'mouseup.drag') + off(window, 'touchend.drag') + + // Rebind initial Events + this.init(true) + } +} + +extend(Element, { + draggable(enable = true) { + const dragHandler = this.remember('_draggable') || new DragHandler(this) + dragHandler.init(enable) + return this + }, +}) diff --git a/node_modules/@svgdotjs/svg.draggable.js/svg.draggable.js.d.cts b/node_modules/@svgdotjs/svg.draggable.js/svg.draggable.js.d.cts new file mode 100644 index 0000000..b4174e9 --- /dev/null +++ b/node_modules/@svgdotjs/svg.draggable.js/svg.draggable.js.d.cts @@ -0,0 +1,7 @@ +import { Element } from '@svgdotjs/svg.js' + +declare module '@svgdotjs/svg.js' { + interface Element { + draggable(enable?: boolean): this + } +} diff --git a/node_modules/@svgdotjs/svg.draggable.js/svg.draggable.js.d.ts b/node_modules/@svgdotjs/svg.draggable.js/svg.draggable.js.d.ts new file mode 100644 index 0000000..b4174e9 --- /dev/null +++ b/node_modules/@svgdotjs/svg.draggable.js/svg.draggable.js.d.ts @@ -0,0 +1,7 @@ +import { Element } from '@svgdotjs/svg.js' + +declare module '@svgdotjs/svg.js' { + interface Element { + draggable(enable?: boolean): this + } +} diff --git a/node_modules/@svgdotjs/svg.filter.js/LICENSE b/node_modules/@svgdotjs/svg.filter.js/LICENSE new file mode 100644 index 0000000..8af737e --- /dev/null +++ b/node_modules/@svgdotjs/svg.filter.js/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2018 Wout Fierens + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@svgdotjs/svg.filter.js/README.md b/node_modules/@svgdotjs/svg.filter.js/README.md new file mode 100644 index 0000000..aad5be5 --- /dev/null +++ b/node_modules/@svgdotjs/svg.filter.js/README.md @@ -0,0 +1,652 @@ +# svg.filter.js + +A plugin for [svg.js](https://svgdotjs.github.io) adding filter functionality. + +svg.filter.js is licensed under the terms of the MIT License. + +- [Examples](#examples) +- [Furthermore](#furthermore) + - [unfilter](#unfilter) + - [referencing the filter node](#referencing-the-filter-node) + - [Animating filter values](#animating-filter-values) + - [Chaining Effects](#chaining-effects) +- [Effect Classes](#effect-classes) + +## Usage + +### Npm + +```sh +npm i @svgdotjs/svg.filter.js +``` + +### Yarn + +```sh +yarn add @svgdotjs/svg.filter.js +``` + +Include this plugin after including the svg.js library in your html document. + +Here is how each filter effect on the example page is achieved. + + +## Examples +- [gaussian blur](#gaussian-blur) +- [horizontal blur](#horizontal-blur) +- [desaturate](#desaturate) +- [contrast](#contrast) +- [sepiatone](#sepiatone) +- [hue rotate 180](#hue-rotate-180) +- [luminance to alpha](#luminance-to-alpha) +- [colorize](#colorize) +- [posterize](#posterize) +- [darken](#darken) +- [lighten](#lighten) +- [invert](#invert) +- [gamma correct 1](#gamma-correct-1) +- [gamma correct 2](#gamma-correct-2) +- [drop shadow](#drop-shadow) +- [extrude](#extrude) + +### original + +```javascript +var image = draw.image('path/to/image.jpg').size(300, 300) +``` + +### gaussian blur + +```javascript +image.filterWith(function(add) { + add.gaussianBlur(30) +}) +``` + +### horizontal blur + +```javascript +image.filterWith(function(add) { + add.gaussianBlur(30, 0) +}) +``` + +### desaturate + +```javascript +image.filterWith(function(add) { + add.colorMatrix('saturate', 0) +}) +``` + +### contrast + +```javascript +image.filterWith(function(add) { + var amount = 1.5 + + add.componentTransfer({ + type: 'linear', + slope: amount, + intercept: -(0.3 * amount) + 0.3 + }) +}) +``` + +### sepiatone + +```javascript +image.filterWith(function(add) { + add.colorMatrix('matrix', [ .343, .669, .119, 0, 0 + , .249, .626, .130, 0, 0 + , .172, .334, .111, 0, 0 + , .000, .000, .000, 1, 0 ]) +}) +``` + +### hue rotate 180 + +```javascript +image.filterWith(function(add) { + add.colorMatrix('hueRotate', 180) +}) +``` + +### luminance to alpha + +```javascript +image.filterWith(function(add) { + add.colorMatrix('luminanceToAlpha') +}) +``` + +### colorize + +```javascript +image.filterWith(function(add) { + add.colorMatrix('matrix', [ 1.0, 0, 0, 0, 0 + , 0, 0.2, 0, 0, 0 + , 0, 0, 0.2, 0, 0 + , 0, 0, 0, 1.0, 0 ]) +}) +``` + +### posterize + +```javascript +image.filterWith(function(add) { + add.componentTransfer({ + type: 'discrete', + tableValues: [0, 0.2, 0.4, 0.6, 0.8, 1] + }) +}) +``` + +### darken + +```javascript +image.filterWith(function(add) { + add.componentTransfer({ + type: 'linear', + slope: 0.2 + }) +}) +``` + +### lighten + +```javascript +image.filterWith(function(add) { + add.componentTransfer({ + type: 'linear', + slope: 1.5, + intercept: 0.2 + }) +}) +``` + +### invert + +```javascript +image.filterWith(function(add) { + add.componentTransfer({ + type: 'table' + tableValues: [1, 0] + }) +}) +``` + +### gamma correct 1 + +```javascript +image.filterWith(function(add) { + add.componentTransfer({ + g: { type: 'gamma', amplitude: 1, exponent: 0.5 } + }) +}) +``` + +### gamma correct 2 + +```javascript +image.filterWith(function(add) { + add.componentTransfer({ + g: { type: 'gamma', amplitude: 1, exponent: 0.5, offset: -0.1 } + }) +}) +``` + + +### drop shadow +You will notice that all the effect descriptions have a drop shadow. Here is how this drop shadow can be achieved: + +```javascript +var text = draw.text('SVG text with drop shadow').fill('#fff') + +text.filterWith(function(add) { + var blur = add.offset(0, 1).in(add.$sourceAlpha).gaussianBlur(1) + + add.blend(add.$source, blur) +}) +``` + +This technique can be achieved on any other shape of course: + +```javascript +var rect = draw.rect(100,100).fill('#f09').stroke({ width: 3, color: '#0f9' }).move(10,10) + +rect.filterWith(function(add) { + var blur = add.offset(20, 20).in(add.$sourceAlpha).gaussianBlur(5) + + add.blend(add.$source, blur) + + this.size('200%','200%').move('-50%', '-50%') +}) +``` + +If the drop shadow should get the colour of the shape so it appears like coloured glass: + +```javascript +var rect = draw.rect(100,100).fill('#f09').stroke({ width: 3, color: '#0f9' }).move(10,10) + +rect.filterWith(function(add) { + var blur = add.offset(20, 20).gaussianBlur(5) + + add.blend(add.$source, blur) + + this.size('200%','200%').move('-50%', '-50%') +}) +``` + +### extrude +```javascript +image.filterWith(function(add){ + var matrix = add.convolveMatrix([ + 1,0,0,0,0,0, + 0,1,0,0,0,0, + 0,0,1,0,0,0, + 0,0,0,1,0,0, + 0,0,0,0,1,0, + 0,0,0,0,0,1 + ]).attr({ + devisor: '2', + preserveAlpha: 'false' + }).in(add.$sourceAlpha) + + //recolor it + var color = add.composite(add.flood('#ff2222'),matrix,'in'); + + //merge all of them toggether + add.merge(color,add.$source); +}) +``` + + +## Furthermore +Some more features you should know about. + +### unfilter +The `unfilter` method removes the filter attribute from the node: + +```javascript +image.unfilter() +``` + +### creating a reusable filter +its also posible to create a filter by using the `new` keyword +*NOTE: when creating a filter this way, it can take an optional attr object* +```javascript +var filter = new SVG.Filter(); + +// create the filters effects here +filter.offset(20, 20).gaussianBlur(5); +filter.blend(filter.$source, blur); +filter.size('200%','200%').move('-50%', '-50%') +``` +then once you have created the filter you can use it one multiple elements +```javascript +var image = new SVG.Image(); +var shape = new SVG.Rect(10, 10); + +image.filterWith(filter); +shape.filterWith(filter); +``` + +### referencing the filter node +An internal reference to the filter node is made in the element: + +```javascript +image.filterer() +``` + +This can also be very useful to reuse an existing filter on various elements: + +```javascript +otherimage.filterWith(image.filterer()) +``` + +### Animating filter values +Every filter value can be animated as well: + +```javascript +var hueRotate + +image.filterWith(function(add) { + hueRotate = add.colorMatrix('hueRotate', 0) +}) + +hueRotate.animate(3000).attr('values', 360) +``` + +### Chaining Effects + +[Method chaining](https://en.wikipedia.org/wiki/Method_chaining) is a programing style where each function returns the object it belongs to, for an example look at JQuery.
+it's possible to chain the effects on a filter when you are creating them, for example: +```javascript +image.filterWith(function(add){ + add.flood('black',0.5).composite(add.$sourceAlpha,'in').offset(10).merge(add.$source) +}) +``` + +this would create a basic shadow filter where the first input on the `composite` effect would be the `flood` effect, and the input on the offset effect would be the `composite` effect.
+same with the `merge` effect, its first input would be the `offset` effect, and its second input would be `add.$source` + +some effects like [Merge](#merge), [Blend](blend), [Composite](#composite), [DisplacementMap](displacementmap) have thier arguments changed when they are chained, for example +```javascript +image.filterWith(function(add){ + add.flood('black',0.5).composite(add.$sourceAlpha,'in') +}) +``` +the `composite` effects first input is set to the `flood` effect and its second input becomes the first argument, this is the same for the merge, blend, composite, and displacmentMap effect.
+for more details check out each effects doc below + +## Effect Classes + +- [Base Effect Class](base-effect-class) +- [Blend](#blend) +- [ColorMatrix](#colormatrix) +- [ComponentTransfer](#componenttransfer) +- [Composite](#composite) +- [ConvolveMatrix](#convolvematrix) +- [DiffuseLighting](#diffuselighting) +- [DisplacementMap](#displacementmap) +- [Flood](#flood) +- [GaussianBlur](#gaussianblur) +- [Image](#image) +- [Merge](#merge) +- [Morphology](#morphology) +- [Offset](#offset) +- [SpecularLighting](#specularlighting) +- [Tile](#tile) +- [Turbulence](#turbulence) + +### Base Effect Class + +#### in(effect) + gets or sets the `in` attribute of the effect + + - **effect:** this can be another effect or a string
+ if **effect** is not provided it will look for another effect on the same filter whose `result` is equal to this effects `in` attribute, else it will return the value of the `in` attribute + ```javascript + image.filterWith(function(add){ + var offset = add.offset(10) + + //create the blur effect and then set its input + var blur = add.gaussianBlur(3) + + //set the input to an effect + blur.in(offset) + + //this will return the offset effect + var input = blur.in() + + //set the input to a string + blur.in('another-result-as-a-string') + + //this will return a string since there is no other effect which has a matching result attribute + var input2 = blur.in() + }) + ``` + +#### in2(effect) + gets or sets the `in2` attribute of the effect
+ this function works the same as the [in](#ineffect) method.
+ it's only on effects ([Blend](#blend), [Composite](#composite), and [DisplacementMap](#displacementmap)) + +#### result(string) + gets or sets the `result` attribute of the effect + + - **string:** if a string is provided it will set the value of the `result` attribute.
+ if no arguments are provided it will act as a getter and return the value of the `result` attribute + +### Blend + +[W3 doc](https://www.w3.org/TR/SVG/filters.html#feBlendElement) + +```javascript +filter.blend(in1, in2, mode) +//or +new SVG.BlendEffect({in1, in2, mode}) +``` + +- **in1**: an effect or the result of effect +- **in2**: same as **in1** +- **mode**: "normal | multiply | screen | darken | lighten" defaults to "normal" + +**chaining** when this effect is called right after another effect, for example: +```javascript +filter.offset(10).blend(filter.$source) +``` +the first input is set to the `offset` effect and the second input is set to `filter.$source` or what ever was passed as the first argument, and the second input becomes the **mode** + +### ColorMatrix + +[W3 doc](https://www.w3.org/TR/SVG/filters.html#feColorMatrixElement) + +```javascript +filter.colorMatrix(type, values); +//or +new SVG.ColorMatrixEffect({type, values}); +``` + +- **type**: "matrix | saturate | hueRotate | luminanceToAlpha" +- **values** + - **type="matrix"**: values would be a matrix the size of 4x5 + - **type="saturate"**: number (0 to 1) + - **type="hueRotate"**: number (0 to 360) deg + - **type="luminanceToAlpha"**: value not needed + +### ComponentTransfer + +[W3 doc](https://www.w3.org/TR/SVG/filters.html#feComponentTransferElement) + +```javascript +filter.componentTransfer(components); +// or +filter.componentTransfer(function (add) { add.funcA({ type... }) }); +//or +new SVG.ComponentTransferEffect(); +``` + +- **components**: an object which is set for all chanels or `r`, `g`, `b`, `a` properties for each chanel + ```javascript + type: "identity | table | discrete | linear | gamma", + + //type="table" + tableValues: "0 0.5 2 1", //number separated by spaces + + //type="linear" + slope: 1, //number + intercept: 3,//number + + //type="gamma" + amplitude: 0, //number + exponent: 0, //number + offset: 0 //number + } + ``` + +### Composite + +[W3 doc](https://www.w3.org/TR/SVG/filters.html#feCompositeElement) + +```javascript +filter.composite(in1, in2, operator); +//or +new SVG.CompositeEffect({in1, in2, operator}); +``` + +- **in1**: an effect or the result of an effect +- **in2**: same as **in1** +- **operator**: "over | in | out | atop | xor | arithmetic" defaults to "over" + +**chaining** when this effect is called right after another effect, for example: +```javascript +filter.flood('black',0.5).composite(filter.$sourceAlpha,'in') +``` +the first input is set to the `flood` effect and the second input is set to `filter.$sourceAlpha` or what ever was passed as the first argument.
+also the second argument becomes the **operator** + +### ConvolveMatrix + +[W3 doc](https://www.w3.org/TR/SVG/filters.html#feConvolveMatrixElement) + +```javascript +filter.convolveMatrix(matrix); +//or +new SVG.ConvolveMatrixEffect({matrix}); +``` + +- **matrix**: a square matrix of numbers that will be applied to the image + - exmaple: + ```javascript + [ + 1,0,0, + 0,1,0, + 0,0,1 + ] + ``` + +### DiffuseLighting + +[W3 doc](https://www.w3.org/TR/SVG/filters.html#feDiffuseLightingElement) + +```javascript +filter.diffuseLighting(surfaceScale, lightingColor, diffuseConstant, kernelUnitLength); +//or +new SVG.DiffuseLightingEffect({surfaceScale, lightingColor, diffuseConstant, kernelUnitLength}); +``` + +***very complicated, just check out the W3 doc*** + +### DisplacementMap + +[W3 doc](https://www.w3.org/TR/SVG/filters.html#feDisplacementMapElement) + +```javascript +filter.displacementMap(in1, in2, scale, xChannelSelector, yChannelSelector); +//or +new SVG.DisplacementMapEffect({in1, in2, scale, xChannelSelector, yChannelSelector}); +``` + +***very complicated, just check out the W3 doc*** + +**chaining** when this effect is called right after another effect, for example: +```javascript +filter.offset(20,50).displacementMap(filter.$source,2) +``` +the first input is set to the `offset` effect and the second input is set to `filter.$source` or what ever was passed as the first argument.
+also the second argument becomes the **scale**, and the third argument is the **xChannelSelector** and so on + +### Flood + +[W3 doc](https://www.w3.org/TR/SVG/filters.html#feFloodElement) + +```javascript +filter.flood(color,opacity); +//or +new SVG.FloodEffect(color,opacity); +``` + +- **color**: a named or hex color in string format +- **opacity**: number form 0 to 1 + +### GaussianBlur + +[W3 doc](https://www.w3.org/TR/SVG/filters.html#feGaussianBlurElement) + +```javascript +filter.gaussianBlur(x, y); +//or +new SVG.GaussianBlurEffect({x, y}); +``` + +- **x**: blur on the X +- **y**: blur on the y, will default to the **x** if not provided + +### Image + +[W3 doc](https://www.w3.org/TR/SVG/filters.html#feImageElement) + +```javascript +filter.image(src); +//or +new SVG.ImageEffect({src}); +``` + +### Merge + +[W3 doc](https://www.w3.org/TR/SVG/filters.html#feMergeElement) + +```javascript +filter.merge(); +//or +new SVG.MergeEffect(); +``` + +- **Array**: an Array of effects or effect results `filter.merge([effectOne,"result-two",another_effect])` +- **chaining** you can also chain the merge effect `filter.offset(10).merge(anotherEffect)` which will result in a merge effect with its first input set to the `offset` effect and its second input set to `anotherEffect` + +### Morphology + +[W3 doc](https://www.w3.org/TR/SVG/filters.html#feMorphologyElement) + +```javascript +filter.morphology(operator, radius); +//or +new SVG.MorphologyEffect({operator, radius}); +``` + +- **operator**: "erode | dilate" +- **radius**: a single number or a string of two numbers separated by a space + - the first number is the X + - the second number is the Y, if no second number was provided it will default to the first number + +### Offset + +[W3 doc](https://www.w3.org/TR/SVG/filters.html#feOffsetElement) + +```javascript +filter.offset(x, y); +//or +new SVG.OffsetEffect({x, y}); +``` + +- **x**: move on the X +- **y**: move on the y, will default to the **x** if not provided + +### SpecularLighting + +[W3 doc](https://www.w3.org/TR/SVG/filters.html#feSpecularLightingElement) + +```javascript +filter.specularLighting(surfaceScale, lightingColor, diffuseConstant, specularExponent, kernelUnitLength); +//or +new SVG.SpecularLightingEffect(surfaceScale, lightingColor, diffuseConstant, specularExponent, kernelUnitLength); +``` + +***very complicated, just check out the W3 doc*** + +### Tile + +[W3 doc](https://www.w3.org/TR/SVG/filters.html#feTileElement) + +```javascript +filter.tile(); +//or +new SVG.TileEffect(); +``` + +***no arguments, but if you want to find out what it does check out the W3 doc*** + +### Turbulence + +[W3 doc](https://www.w3.org/TR/SVG/filters.html#feTurbulenceElement) + +```javascript +filter.turbulence(baseFrequency, numOctaves, seed, stitchTiles, type); +//or +new SVG.TurbulenceEffect({baseFrequency, numOctaves, seed, stitchTiles, type}); +``` + +***very complicated, just check out the W3 doc*** diff --git a/node_modules/@svgdotjs/svg.filter.js/dist/svg.filter.js b/node_modules/@svgdotjs/svg.filter.js/dist/svg.filter.js new file mode 100644 index 0000000..cf6ddca --- /dev/null +++ b/node_modules/@svgdotjs/svg.filter.js/dist/svg.filter.js @@ -0,0 +1,395 @@ +/*! +* @svgdotjs/svg.filter.js - A plugin for svg.js adding filter functionality +* @version 3.0.9 +* https://github.com/svgdotjs/svg.filter.js +* +* @copyright Wout Fierens +* @license MIT +* +* BUILT: Mon Feb 24 2025 17:15:33 GMT+0100 (Central European Standard Time) +*/; +this.SVG = this.SVG || {}; +this.SVG.Filter = (function (svg_js) { + 'use strict'; + + class Filter extends svg_js.Element { + constructor(node) { + super(svg_js.nodeOrNew('filter', node), node); + this.$source = 'SourceGraphic'; + this.$sourceAlpha = 'SourceAlpha'; + this.$background = 'BackgroundImage'; + this.$backgroundAlpha = 'BackgroundAlpha'; + this.$fill = 'FillPaint'; + this.$stroke = 'StrokePaint'; + this.$autoSetIn = true; + } + put(element, i) { + element = super.put(element, i); + if (!element.attr('in') && this.$autoSetIn) { + element.attr('in', this.$source); + } + if (!element.attr('result')) { + element.attr('result', element.id()); + } + return element; + } + + // Unmask all masked elements and remove itself + remove() { + // unmask all targets + this.targets().each('unfilter'); + + // remove mask from parent + return super.remove(); + } + targets() { + return svg_js.find('svg [filter*="' + this.id() + '"]'); + } + toString() { + return 'url(#' + this.id() + ')'; + } + } + + // Create Effect class + class Effect extends svg_js.Element { + constructor(node, attr) { + super(node, attr); + this.result(this.id()); + } + in(effect) { + // Act as getter + if (effect == null) { + const _in = this.attr('in'); + const ref = this.parent() && this.parent().find(`[result="${_in}"]`)[0]; + return ref || _in; + } + + // Avr as setter + return this.attr('in', effect); + } + + // Named result + result(result) { + return this.attr('result', result); + } + + // Stringification + toString() { + return this.result(); + } + } + + // This function takes an array with attr keys and sets for every key the + // attribute to the value of one paramater + // getAttrSetter(['a', 'b']) becomes this.attr({a: param1, b: param2}) + const getAttrSetter = params => { + return function (...args) { + for (let i = params.length; i--;) { + if (args[i] != null) { + this.attr(params[i], args[i]); + } + } + }; + }; + const updateFunctions = { + blend: getAttrSetter(['in', 'in2', 'mode']), + // ColorMatrix effect + colorMatrix: getAttrSetter(['type', 'values']), + // Composite effect + composite: getAttrSetter(['in', 'in2', 'operator']), + // ConvolveMatrix effect + convolveMatrix: function (matrix) { + matrix = new svg_js.Array(matrix).toString(); + this.attr({ + order: Math.sqrt(matrix.split(' ').length), + kernelMatrix: matrix + }); + }, + // DiffuseLighting effect + diffuseLighting: getAttrSetter(['surfaceScale', 'lightingColor', 'diffuseConstant', 'kernelUnitLength']), + // DisplacementMap effect + displacementMap: getAttrSetter(['in', 'in2', 'scale', 'xChannelSelector', 'yChannelSelector']), + // DropShadow effect + dropShadow: getAttrSetter(['in', 'dx', 'dy', 'stdDeviation']), + // Flood effect + flood: getAttrSetter(['flood-color', 'flood-opacity']), + // Gaussian Blur effect + gaussianBlur: function (x = 0, y = x) { + this.attr('stdDeviation', x + ' ' + y); + }, + // Image effect + image: function (src) { + this.attr('href', src, svg_js.namespaces.xlink); + }, + // Morphology effect + morphology: getAttrSetter(['operator', 'radius']), + // Offset effect + offset: getAttrSetter(['dx', 'dy']), + // SpecularLighting effect + specularLighting: getAttrSetter(['surfaceScale', 'lightingColor', 'diffuseConstant', 'specularExponent', 'kernelUnitLength']), + // Tile effect + tile: getAttrSetter([]), + // Turbulence effect + turbulence: getAttrSetter(['baseFrequency', 'numOctaves', 'seed', 'stitchTiles', 'type']) + }; + const filterNames = ['blend', 'colorMatrix', 'componentTransfer', 'composite', 'convolveMatrix', 'diffuseLighting', 'displacementMap', 'dropShadow', 'flood', 'gaussianBlur', 'image', 'merge', 'morphology', 'offset', 'specularLighting', 'tile', 'turbulence']; + + // For every filter create a class + filterNames.forEach(effect => { + const name = svg_js.utils.capitalize(effect); + const fn = updateFunctions[effect]; + Filter[name + 'Effect'] = class extends Effect { + constructor(node) { + super(svg_js.nodeOrNew('fe' + name, node), node); + } + + // This function takes all parameters from the factory call + // and updates the attributes according to the updateFunctions + update(args) { + fn.apply(this, args); + return this; + } + }; + + // Add factory function to filter + // Allow to pass a function or object + // The attr object is catched from "wrapWithAttrCheck" + Filter.prototype[effect] = svg_js.wrapWithAttrCheck(function (fn, ...args) { + const effect = new Filter[name + 'Effect'](); + if (fn == null) return this.put(effect); + + // For Effects which can take children, a function is allowed + if (typeof fn === 'function') { + fn.call(effect, effect); + } else { + // In case it is not a function, add it to arguments + args.unshift(fn); + } + return this.put(effect).update(args); + }); + }); + + // Correct factories which are not that simple + svg_js.extend(Filter, { + merge(arrayOrFn) { + const node = this.put(new Filter.MergeEffect()); + + // If a function was passed, execute it + // That makes stuff like this possible: + // filter.merge((mergeEffect) => mergeEffect.mergeNode(in)) + if (typeof arrayOrFn === 'function') { + arrayOrFn.call(node, node); + return node; + } + + // Check if first child is an array, otherwise use arguments as array + const children = arrayOrFn instanceof Array ? arrayOrFn : [...arguments]; + children.forEach(child => { + if (child instanceof Filter.MergeNode) { + node.put(child); + } else { + node.mergeNode(child); + } + }); + return node; + }, + componentTransfer(components = {}) { + const node = this.put(new Filter.ComponentTransferEffect()); + if (typeof components === 'function') { + components.call(node, node); + return node; + } + + // If no component is set, we use the given object for all components + if (!components.r && !components.g && !components.b && !components.a) { + const temp = components; + components = { + r: temp, + g: temp, + b: temp, + a: temp + }; + } + for (const c in components) { + // components[c] has to hold an attributes object + node.add(new Filter['Func' + c.toUpperCase()](components[c])); + } + return node; + } + }); + const filterChildNodes = ['distantLight', 'pointLight', 'spotLight', 'mergeNode', 'FuncR', 'FuncG', 'FuncB', 'FuncA']; + filterChildNodes.forEach(child => { + const name = svg_js.utils.capitalize(child); + Filter[name] = class extends Effect { + constructor(node) { + super(svg_js.nodeOrNew('fe' + name, node), node); + } + }; + }); + const componentFuncs = ['funcR', 'funcG', 'funcB', 'funcA']; + + // Add an update function for componentTransfer-children + componentFuncs.forEach(function (c) { + const _class = Filter[svg_js.utils.capitalize(c)]; + const fn = svg_js.wrapWithAttrCheck(function () { + return this.put(new _class()); + }); + Filter.ComponentTransferEffect.prototype[c] = fn; + }); + const lights = ['distantLight', 'pointLight', 'spotLight']; + + // Add light sources factories to lightining effects + lights.forEach(light => { + const _class = Filter[svg_js.utils.capitalize(light)]; + const fn = svg_js.wrapWithAttrCheck(function () { + return this.put(new _class()); + }); + Filter.DiffuseLightingEffect.prototype[light] = fn; + Filter.SpecularLightingEffect.prototype[light] = fn; + }); + svg_js.extend(Filter.MergeEffect, { + mergeNode(_in) { + return this.put(new Filter.MergeNode()).attr('in', _in); + } + }); + + // add .filter function + svg_js.extend(svg_js.Defs, { + // Define filter + filter: function (block) { + const filter = this.put(new Filter()); + + /* invoke passed block */ + if (typeof block === 'function') { + block.call(filter, filter); + } + return filter; + } + }); + svg_js.extend(svg_js.Container, { + // Define filter on defs + filter: function (block) { + return this.defs().filter(block); + } + }); + svg_js.extend(svg_js.Element, { + // Create filter element in defs and store reference + filterWith: function (block) { + const filter = block instanceof Filter ? block : this.defs().filter(block); + return this.attr('filter', filter); + }, + // Remove filter + unfilter: function (remove) { + /* remove filter attribute */ + return this.attr('filter', null); + }, + filterer() { + return this.reference('filter'); + } + }); + + // chaining + const chainingEffects = { + // Blend effect + blend: function (in2, mode) { + return this.parent() && this.parent().blend(this, in2, mode); // pass this as the first input + }, + // ColorMatrix effect + colorMatrix: function (type, values) { + return this.parent() && this.parent().colorMatrix(type, values).in(this); + }, + // ComponentTransfer effect + componentTransfer: function (components) { + return this.parent() && this.parent().componentTransfer(components).in(this); + }, + // Composite effect + composite: function (in2, operator) { + return this.parent() && this.parent().composite(this, in2, operator); // pass this as the first input + }, + // ConvolveMatrix effect + convolveMatrix: function (matrix) { + return this.parent() && this.parent().convolveMatrix(matrix).in(this); + }, + // DiffuseLighting effect + diffuseLighting: function (surfaceScale, lightingColor, diffuseConstant, kernelUnitLength) { + return this.parent() && this.parent().diffuseLighting(surfaceScale, diffuseConstant, kernelUnitLength).in(this); + }, + // DisplacementMap effect + displacementMap: function (in2, scale, xChannelSelector, yChannelSelector) { + return this.parent() && this.parent().displacementMap(this, in2, scale, xChannelSelector, yChannelSelector); // pass this as the first input + }, + // DisplacementMap effect + dropShadow: function (x, y, stdDeviation) { + return this.parent() && this.parent().dropShadow(this, x, y, stdDeviation).in(this); // pass this as the first input + }, + // Flood effect + flood: function (color, opacity) { + return this.parent() && this.parent().flood(color, opacity); // this effect dont have inputs + }, + // Gaussian Blur effect + gaussianBlur: function (x, y) { + return this.parent() && this.parent().gaussianBlur(x, y).in(this); + }, + // Image effect + image: function (src) { + return this.parent() && this.parent().image(src); // this effect dont have inputs + }, + // Merge effect + merge: function (arg) { + arg = arg instanceof Array ? arg : [...arg]; + return this.parent() && this.parent().merge(this, ...arg); // pass this as the first argument + }, + // Morphology effect + morphology: function (operator, radius) { + return this.parent() && this.parent().morphology(operator, radius).in(this); + }, + // Offset effect + offset: function (dx, dy) { + return this.parent() && this.parent().offset(dx, dy).in(this); + }, + // SpecularLighting effect + specularLighting: function (surfaceScale, lightingColor, diffuseConstant, specularExponent, kernelUnitLength) { + return this.parent() && this.parent().specularLighting(surfaceScale, diffuseConstant, specularExponent, kernelUnitLength).in(this); + }, + // Tile effect + tile: function () { + return this.parent() && this.parent().tile().in(this); + }, + // Turbulence effect + turbulence: function (baseFrequency, numOctaves, seed, stitchTiles, type) { + return this.parent() && this.parent().turbulence(baseFrequency, numOctaves, seed, stitchTiles, type).in(this); + } + }; + svg_js.extend(Effect, chainingEffects); + + // Effect-specific extensions + svg_js.extend(Filter.MergeEffect, { + in: function (effect) { + if (effect instanceof Filter.MergeNode) { + this.add(effect, 0); + } else { + this.add(new Filter.MergeNode().in(effect), 0); + } + return this; + } + }); + svg_js.extend([Filter.CompositeEffect, Filter.BlendEffect, Filter.DisplacementMapEffect], { + in2: function (effect) { + if (effect == null) { + const in2 = this.attr('in2'); + const ref = this.parent() && this.parent().find(`[result="${in2}"]`)[0]; + return ref || in2; + } + return this.attr('in2', effect); + } + }); + + // Presets + Filter.filter = { + sepiatone: [0.343, 0.669, 0.119, 0, 0, 0.249, 0.626, 0.130, 0, 0, 0.172, 0.334, 0.111, 0, 0, 0.000, 0.000, 0.000, 1, 0] + }; + + return Filter; + +})(SVG); +//# sourceMappingURL=svg.filter.js.map diff --git a/node_modules/@svgdotjs/svg.filter.js/dist/svg.filter.js.map b/node_modules/@svgdotjs/svg.filter.js/dist/svg.filter.js.map new file mode 100644 index 0000000..20e9569 --- /dev/null +++ b/node_modules/@svgdotjs/svg.filter.js/dist/svg.filter.js.map @@ -0,0 +1 @@ +{"version":3,"file":"svg.filter.js","sources":["../src/svg.filter.js"],"sourcesContent":["import {\n Array as SVGArray,\n Container,\n Defs,\n Element,\n extend,\n find,\n namespaces as ns,\n nodeOrNew,\n utils,\n wrapWithAttrCheck\n} from '@svgdotjs/svg.js'\n\nexport default class Filter extends Element {\n constructor (node) {\n super(nodeOrNew('filter', node), node)\n\n this.$source = 'SourceGraphic'\n this.$sourceAlpha = 'SourceAlpha'\n this.$background = 'BackgroundImage'\n this.$backgroundAlpha = 'BackgroundAlpha'\n this.$fill = 'FillPaint'\n this.$stroke = 'StrokePaint'\n this.$autoSetIn = true\n }\n\n put (element, i) {\n element = super.put(element, i)\n\n if (!element.attr('in') && this.$autoSetIn) {\n element.attr('in', this.$source)\n }\n if (!element.attr('result')) {\n element.attr('result', element.id())\n }\n\n return element\n }\n\n // Unmask all masked elements and remove itself\n remove () {\n // unmask all targets\n this.targets().each('unfilter')\n\n // remove mask from parent\n return super.remove()\n }\n\n targets () {\n return find('svg [filter*=\"' + this.id() + '\"]')\n }\n\n toString () {\n return 'url(#' + this.id() + ')'\n }\n}\n\n// Create Effect class\nclass Effect extends Element {\n constructor (node, attr) {\n super(node, attr)\n this.result(this.id())\n }\n\n in (effect) {\n // Act as getter\n if (effect == null) {\n const _in = this.attr('in')\n const ref = this.parent() && this.parent().find(`[result=\"${_in}\"]`)[0]\n return ref || _in\n }\n\n // Avr as setter\n return this.attr('in', effect)\n }\n\n // Named result\n result (result) {\n return this.attr('result', result)\n }\n\n // Stringification\n toString () {\n return this.result()\n }\n}\n\n// This function takes an array with attr keys and sets for every key the\n// attribute to the value of one paramater\n// getAttrSetter(['a', 'b']) becomes this.attr({a: param1, b: param2})\nconst getAttrSetter = (params) => {\n return function (...args) {\n for (let i = params.length; i--;) {\n if (args[i] != null) {\n this.attr(params[i], args[i])\n }\n }\n }\n}\n\nconst updateFunctions = {\n blend: getAttrSetter(['in', 'in2', 'mode']),\n // ColorMatrix effect\n colorMatrix: getAttrSetter(['type', 'values']),\n // Composite effect\n composite: getAttrSetter(['in', 'in2', 'operator']),\n // ConvolveMatrix effect\n convolveMatrix: function (matrix) {\n matrix = new SVGArray(matrix).toString()\n\n this.attr({\n order: Math.sqrt(matrix.split(' ').length),\n kernelMatrix: matrix\n })\n },\n // DiffuseLighting effect\n diffuseLighting: getAttrSetter(['surfaceScale', 'lightingColor', 'diffuseConstant', 'kernelUnitLength']),\n // DisplacementMap effect\n displacementMap: getAttrSetter(['in', 'in2', 'scale', 'xChannelSelector', 'yChannelSelector']),\n // DropShadow effect\n dropShadow: getAttrSetter(['in', 'dx', 'dy', 'stdDeviation']),\n // Flood effect\n flood: getAttrSetter(['flood-color', 'flood-opacity']),\n // Gaussian Blur effect\n gaussianBlur: function (x = 0, y = x) {\n this.attr('stdDeviation', x + ' ' + y)\n },\n // Image effect\n image: function (src) {\n this.attr('href', src, ns.xlink)\n },\n // Morphology effect\n morphology: getAttrSetter(['operator', 'radius']),\n // Offset effect\n offset: getAttrSetter(['dx', 'dy']),\n // SpecularLighting effect\n specularLighting: getAttrSetter(['surfaceScale', 'lightingColor', 'diffuseConstant', 'specularExponent', 'kernelUnitLength']),\n // Tile effect\n tile: getAttrSetter([]),\n // Turbulence effect\n turbulence: getAttrSetter(['baseFrequency', 'numOctaves', 'seed', 'stitchTiles', 'type'])\n}\n\nconst filterNames = [\n 'blend',\n 'colorMatrix',\n 'componentTransfer',\n 'composite',\n 'convolveMatrix',\n 'diffuseLighting',\n 'displacementMap',\n 'dropShadow',\n 'flood',\n 'gaussianBlur',\n 'image',\n 'merge',\n 'morphology',\n 'offset',\n 'specularLighting',\n 'tile',\n 'turbulence'\n]\n\n// For every filter create a class\nfilterNames.forEach((effect) => {\n const name = utils.capitalize(effect)\n const fn = updateFunctions[effect]\n\n Filter[name + 'Effect'] = class extends Effect {\n constructor (node) {\n super(nodeOrNew('fe' + name, node), node)\n }\n\n // This function takes all parameters from the factory call\n // and updates the attributes according to the updateFunctions\n update (args) {\n fn.apply(this, args)\n return this\n }\n }\n\n // Add factory function to filter\n // Allow to pass a function or object\n // The attr object is catched from \"wrapWithAttrCheck\"\n Filter.prototype[effect] = wrapWithAttrCheck(function (fn, ...args) {\n const effect = new Filter[name + 'Effect']()\n\n if (fn == null) return this.put(effect)\n\n // For Effects which can take children, a function is allowed\n if (typeof fn === 'function') {\n fn.call(effect, effect)\n } else {\n // In case it is not a function, add it to arguments\n args.unshift(fn)\n }\n return this.put(effect).update(args)\n })\n})\n\n// Correct factories which are not that simple\nextend(Filter, {\n merge (arrayOrFn) {\n const node = this.put(new Filter.MergeEffect())\n\n // If a function was passed, execute it\n // That makes stuff like this possible:\n // filter.merge((mergeEffect) => mergeEffect.mergeNode(in))\n if (typeof arrayOrFn === 'function') {\n arrayOrFn.call(node, node)\n return node\n }\n\n // Check if first child is an array, otherwise use arguments as array\n const children = arrayOrFn instanceof Array ? arrayOrFn : [...arguments]\n\n children.forEach((child) => {\n if (child instanceof Filter.MergeNode) {\n node.put(child)\n } else {\n node.mergeNode(child)\n }\n })\n\n return node\n },\n componentTransfer (components = {}) {\n const node = this.put(new Filter.ComponentTransferEffect())\n\n if (typeof components === 'function') {\n components.call(node, node)\n return node\n }\n\n // If no component is set, we use the given object for all components\n if (!components.r && !components.g && !components.b && !components.a) {\n const temp = components\n components = {\n r: temp, g: temp, b: temp, a: temp\n }\n }\n\n for (const c in components) {\n // components[c] has to hold an attributes object\n node.add(new Filter['Func' + c.toUpperCase()](components[c]))\n }\n\n return node\n }\n})\n\nconst filterChildNodes = [\n 'distantLight',\n 'pointLight',\n 'spotLight',\n 'mergeNode',\n 'FuncR',\n 'FuncG',\n 'FuncB',\n 'FuncA'\n]\n\nfilterChildNodes.forEach((child) => {\n const name = utils.capitalize(child)\n Filter[name] = class extends Effect {\n constructor (node) {\n super(nodeOrNew('fe' + name, node), node)\n }\n }\n})\n\nconst componentFuncs = [\n 'funcR',\n 'funcG',\n 'funcB',\n 'funcA'\n]\n\n// Add an update function for componentTransfer-children\ncomponentFuncs.forEach(function (c) {\n const _class = Filter[utils.capitalize(c)]\n const fn = wrapWithAttrCheck(function () {\n return this.put(new _class())\n })\n\n Filter.ComponentTransferEffect.prototype[c] = fn\n})\n\nconst lights = [\n 'distantLight',\n 'pointLight',\n 'spotLight'\n]\n\n// Add light sources factories to lightining effects\nlights.forEach((light) => {\n const _class = Filter[utils.capitalize(light)]\n const fn = wrapWithAttrCheck(function () {\n return this.put(new _class())\n })\n\n Filter.DiffuseLightingEffect.prototype[light] = fn\n Filter.SpecularLightingEffect.prototype[light] = fn\n})\n\nextend(Filter.MergeEffect, {\n mergeNode (_in) {\n return this.put(new Filter.MergeNode()).attr('in', _in)\n }\n})\n\n// add .filter function\nextend(Defs, {\n // Define filter\n filter: function (block) {\n const filter = this.put(new Filter())\n\n /* invoke passed block */\n if (typeof block === 'function') { block.call(filter, filter) }\n\n return filter\n }\n})\n\nextend(Container, {\n // Define filter on defs\n filter: function (block) {\n return this.defs().filter(block)\n }\n})\n\nextend(Element, {\n // Create filter element in defs and store reference\n filterWith: function (block) {\n const filter = block instanceof Filter\n ? block\n : this.defs().filter(block)\n\n return this.attr('filter', filter)\n },\n // Remove filter\n unfilter: function (remove) {\n /* remove filter attribute */\n return this.attr('filter', null)\n },\n filterer () {\n return this.reference('filter')\n }\n})\n\n// chaining\nconst chainingEffects = {\n // Blend effect\n blend: function (in2, mode) {\n return this.parent() && this.parent().blend(this, in2, mode) // pass this as the first input\n },\n // ColorMatrix effect\n colorMatrix: function (type, values) {\n return this.parent() && this.parent().colorMatrix(type, values).in(this)\n },\n // ComponentTransfer effect\n componentTransfer: function (components) {\n return this.parent() && this.parent().componentTransfer(components).in(this)\n },\n // Composite effect\n composite: function (in2, operator) {\n return this.parent() && this.parent().composite(this, in2, operator) // pass this as the first input\n },\n // ConvolveMatrix effect\n convolveMatrix: function (matrix) {\n return this.parent() && this.parent().convolveMatrix(matrix).in(this)\n },\n // DiffuseLighting effect\n diffuseLighting: function (surfaceScale, lightingColor, diffuseConstant, kernelUnitLength) {\n return this.parent() && this.parent().diffuseLighting(surfaceScale, diffuseConstant, kernelUnitLength).in(this)\n },\n // DisplacementMap effect\n displacementMap: function (in2, scale, xChannelSelector, yChannelSelector) {\n return this.parent() && this.parent().displacementMap(this, in2, scale, xChannelSelector, yChannelSelector) // pass this as the first input\n },\n // DisplacementMap effect\n dropShadow: function (x, y, stdDeviation) {\n return this.parent() && this.parent().dropShadow(this, x, y, stdDeviation).in(this) // pass this as the first input\n },\n // Flood effect\n flood: function (color, opacity) {\n return this.parent() && this.parent().flood(color, opacity) // this effect dont have inputs\n },\n // Gaussian Blur effect\n gaussianBlur: function (x, y) {\n return this.parent() && this.parent().gaussianBlur(x, y).in(this)\n },\n // Image effect\n image: function (src) {\n return this.parent() && this.parent().image(src) // this effect dont have inputs\n },\n // Merge effect\n merge: function (arg) {\n arg = arg instanceof Array ? arg : [...arg]\n return this.parent() && this.parent().merge(this, ...arg) // pass this as the first argument\n },\n // Morphology effect\n morphology: function (operator, radius) {\n return this.parent() && this.parent().morphology(operator, radius).in(this)\n },\n // Offset effect\n offset: function (dx, dy) {\n return this.parent() && this.parent().offset(dx, dy).in(this)\n },\n // SpecularLighting effect\n specularLighting: function (surfaceScale, lightingColor, diffuseConstant, specularExponent, kernelUnitLength) {\n return this.parent() && this.parent().specularLighting(surfaceScale, diffuseConstant, specularExponent, kernelUnitLength).in(this)\n },\n // Tile effect\n tile: function () {\n return this.parent() && this.parent().tile().in(this)\n },\n // Turbulence effect\n turbulence: function (baseFrequency, numOctaves, seed, stitchTiles, type) {\n return this.parent() && this.parent().turbulence(baseFrequency, numOctaves, seed, stitchTiles, type).in(this)\n }\n}\n\nextend(Effect, chainingEffects)\n\n// Effect-specific extensions\nextend(Filter.MergeEffect, {\n in: function (effect) {\n if (effect instanceof Filter.MergeNode) {\n this.add(effect, 0)\n } else {\n this.add(new Filter.MergeNode().in(effect), 0)\n }\n\n return this\n }\n})\n\nextend([Filter.CompositeEffect, Filter.BlendEffect, Filter.DisplacementMapEffect], {\n in2: function (effect) {\n if (effect == null) {\n const in2 = this.attr('in2')\n const ref = this.parent() && this.parent().find(`[result=\"${in2}\"]`)[0]\n return ref || in2\n }\n return this.attr('in2', effect)\n }\n})\n\n// Presets\nFilter.filter = {\n sepiatone: [\n 0.343, 0.669, 0.119, 0, 0,\n 0.249, 0.626, 0.130, 0, 0,\n 0.172, 0.334, 0.111, 0, 0,\n 0.000, 0.000, 0.000, 1, 0]\n}\n"],"names":["Filter","Element","constructor","node","nodeOrNew","$source","$sourceAlpha","$background","$backgroundAlpha","$fill","$stroke","$autoSetIn","put","element","i","attr","id","remove","targets","each","find","toString","Effect","result","in","effect","_in","ref","parent","getAttrSetter","params","args","length","updateFunctions","blend","colorMatrix","composite","convolveMatrix","matrix","SVGArray","order","Math","sqrt","split","kernelMatrix","diffuseLighting","displacementMap","dropShadow","flood","gaussianBlur","x","y","image","src","ns","xlink","morphology","offset","specularLighting","tile","turbulence","filterNames","forEach","name","utils","capitalize","fn","update","apply","prototype","wrapWithAttrCheck","call","unshift","extend","merge","arrayOrFn","MergeEffect","children","Array","arguments","child","MergeNode","mergeNode","componentTransfer","components","ComponentTransferEffect","r","g","b","a","temp","c","add","toUpperCase","filterChildNodes","componentFuncs","_class","lights","light","DiffuseLightingEffect","SpecularLightingEffect","Defs","filter","block","Container","defs","filterWith","unfilter","filterer","reference","chainingEffects","in2","mode","type","values","operator","surfaceScale","lightingColor","diffuseConstant","kernelUnitLength","scale","xChannelSelector","yChannelSelector","stdDeviation","color","opacity","arg","radius","dx","dy","specularExponent","baseFrequency","numOctaves","seed","stitchTiles","CompositeEffect","BlendEffect","DisplacementMapEffect","sepiatone"],"mappings":";;;;;;;;;;;;;;EAae,MAAMA,MAAM,SAASC,cAAO,CAAC;IAC1CC,WAAWA,CAAEC,IAAI,EAAE;MACjB,KAAK,CAACC,gBAAS,CAAC,QAAQ,EAAED,IAAI,CAAC,EAAEA,IAAI,CAAC;MAEtC,IAAI,CAACE,OAAO,GAAG,eAAe;MAC9B,IAAI,CAACC,YAAY,GAAG,aAAa;MACjC,IAAI,CAACC,WAAW,GAAG,iBAAiB;MACpC,IAAI,CAACC,gBAAgB,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AE,KAAK,EAAE,CAAC,EAAE,CAAC,EACzB,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;EAC7B,CAAC;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/@svgdotjs/svg.filter.js/dist/svg.filter.min.js b/node_modules/@svgdotjs/svg.filter.js/dist/svg.filter.min.js new file mode 100644 index 0000000..a30971f --- /dev/null +++ b/node_modules/@svgdotjs/svg.filter.js/dist/svg.filter.min.js @@ -0,0 +1,13 @@ +/*! @svgdotjs/svg.filter.js v3.0.9 MIT*/; +/*! +* @svgdotjs/svg.filter.js - A plugin for svg.js adding filter functionality +* @version 3.0.9 +* https://github.com/svgdotjs/svg.filter.js +* +* @copyright Wout Fierens +* @license MIT +* +* BUILT: Mon Feb 24 2025 17:15:33 GMT+0100 (Central European Standard Time) +*/ +this.SVG=this.SVG||{},this.SVG.Filter=function(t){"use strict";class Filter extends t.Element{constructor(e){super(t.nodeOrNew("filter",e),e),this.$source="SourceGraphic",this.$sourceAlpha="SourceAlpha",this.$background="BackgroundImage",this.$backgroundAlpha="BackgroundAlpha",this.$fill="FillPaint",this.$stroke="StrokePaint",this.$autoSetIn=!0}put(t,e){return!(t=super.put(t,e)).attr("in")&&this.$autoSetIn&&t.attr("in",this.$source),t.attr("result")||t.attr("result",t.id()),t}remove(){return this.targets().each("unfilter"),super.remove()}targets(){return t.find('svg [filter*="'+this.id()+'"]')}toString(){return"url(#"+this.id()+")"}}class e extends t.Element{constructor(t,e){super(t,e),this.result(this.id())}in(t){if(null==t){const t=this.attr("in");return this.parent()&&this.parent().find(`[result="${t}"]`)[0]||t}return this.attr("in",t)}result(t){return this.attr("result",t)}toString(){return this.result()}}const n=t=>function(...e){for(let n=t.length;n--;)null!=e[n]&&this.attr(t[n],e[n])},r={blend:n(["in","in2","mode"]),colorMatrix:n(["type","values"]),composite:n(["in","in2","operator"]),convolveMatrix:function(e){e=new t.Array(e).toString(),this.attr({order:Math.sqrt(e.split(" ").length),kernelMatrix:e})},diffuseLighting:n(["surfaceScale","lightingColor","diffuseConstant","kernelUnitLength"]),displacementMap:n(["in","in2","scale","xChannelSelector","yChannelSelector"]),dropShadow:n(["in","dx","dy","stdDeviation"]),flood:n(["flood-color","flood-opacity"]),gaussianBlur:function(t=0,e=t){this.attr("stdDeviation",t+" "+e)},image:function(e){this.attr("href",e,t.namespaces.xlink)},morphology:n(["operator","radius"]),offset:n(["dx","dy"]),specularLighting:n(["surfaceScale","lightingColor","diffuseConstant","specularExponent","kernelUnitLength"]),tile:n([]),turbulence:n(["baseFrequency","numOctaves","seed","stitchTiles","type"])};["blend","colorMatrix","componentTransfer","composite","convolveMatrix","diffuseLighting","displacementMap","dropShadow","flood","gaussianBlur","image","merge","morphology","offset","specularLighting","tile","turbulence"].forEach((n=>{const i=t.utils.capitalize(n),s=r[n];Filter[i+"Effect"]=class extends e{constructor(e){super(t.nodeOrNew("fe"+i,e),e)}update(t){return s.apply(this,t),this}},Filter.prototype[n]=t.wrapWithAttrCheck((function(t,...e){const n=new Filter[i+"Effect"];return null==t?this.put(n):("function"==typeof t?t.call(n,n):e.unshift(t),this.put(n).update(e))}))})),t.extend(Filter,{merge(t){const e=this.put(new Filter.MergeEffect);if("function"==typeof t)return t.call(e,e),e;return(t instanceof Array?t:[...arguments]).forEach((t=>{t instanceof Filter.MergeNode?e.put(t):e.mergeNode(t)})),e},componentTransfer(t={}){const e=this.put(new Filter.ComponentTransferEffect);if("function"==typeof t)return t.call(e,e),e;if(!(t.r||t.g||t.b||t.a)){t={r:t,g:t,b:t,a:t}}for(const n in t)e.add(new(Filter["Func"+n.toUpperCase()])(t[n]));return e}});["distantLight","pointLight","spotLight","mergeNode","FuncR","FuncG","FuncB","FuncA"].forEach((n=>{const r=t.utils.capitalize(n);Filter[r]=class extends e{constructor(e){super(t.nodeOrNew("fe"+r,e),e)}}}));["funcR","funcG","funcB","funcA"].forEach((function(e){const n=Filter[t.utils.capitalize(e)],r=t.wrapWithAttrCheck((function(){return this.put(new n)}));Filter.ComponentTransferEffect.prototype[e]=r}));["distantLight","pointLight","spotLight"].forEach((e=>{const n=Filter[t.utils.capitalize(e)],r=t.wrapWithAttrCheck((function(){return this.put(new n)}));Filter.DiffuseLightingEffect.prototype[e]=r,Filter.SpecularLightingEffect.prototype[e]=r})),t.extend(Filter.MergeEffect,{mergeNode(t){return this.put(new Filter.MergeNode).attr("in",t)}}),t.extend(t.Defs,{filter:function(t){const e=this.put(new Filter);return"function"==typeof t&&t.call(e,e),e}}),t.extend(t.Container,{filter:function(t){return this.defs().filter(t)}}),t.extend(t.Element,{filterWith:function(t){const e=t instanceof Filter?t:this.defs().filter(t);return this.attr("filter",e)},unfilter:function(t){return this.attr("filter",null)},filterer(){return this.reference("filter")}});const i={blend:function(t,e){return this.parent()&&this.parent().blend(this,t,e)},colorMatrix:function(t,e){return this.parent()&&this.parent().colorMatrix(t,e).in(this)},componentTransfer:function(t){return this.parent()&&this.parent().componentTransfer(t).in(this)},composite:function(t,e){return this.parent()&&this.parent().composite(this,t,e)},convolveMatrix:function(t){return this.parent()&&this.parent().convolveMatrix(t).in(this)},diffuseLighting:function(t,e,n,r){return this.parent()&&this.parent().diffuseLighting(t,n,r).in(this)},displacementMap:function(t,e,n,r){return this.parent()&&this.parent().displacementMap(this,t,e,n,r)},dropShadow:function(t,e,n){return this.parent()&&this.parent().dropShadow(this,t,e,n).in(this)},flood:function(t,e){return this.parent()&&this.parent().flood(t,e)},gaussianBlur:function(t,e){return this.parent()&&this.parent().gaussianBlur(t,e).in(this)},image:function(t){return this.parent()&&this.parent().image(t)},merge:function(t){return t=t instanceof Array?t:[...t],this.parent()&&this.parent().merge(this,...t)},morphology:function(t,e){return this.parent()&&this.parent().morphology(t,e).in(this)},offset:function(t,e){return this.parent()&&this.parent().offset(t,e).in(this)},specularLighting:function(t,e,n,r,i){return this.parent()&&this.parent().specularLighting(t,n,r,i).in(this)},tile:function(){return this.parent()&&this.parent().tile().in(this)},turbulence:function(t,e,n,r,i){return this.parent()&&this.parent().turbulence(t,e,n,r,i).in(this)}};return t.extend(e,i),t.extend(Filter.MergeEffect,{in:function(t){return t instanceof Filter.MergeNode?this.add(t,0):this.add((new Filter.MergeNode).in(t),0),this}}),t.extend([Filter.CompositeEffect,Filter.BlendEffect,Filter.DisplacementMapEffect],{in2:function(t){if(null==t){const t=this.attr("in2");return this.parent()&&this.parent().find(`[result="${t}"]`)[0]||t}return this.attr("in2",t)}}),Filter.filter={sepiatone:[.343,.669,.119,0,0,.249,.626,.13,0,0,.172,.334,.111,0,0,0,0,0,1,0]},Filter}(SVG); +//# sourceMappingURL=svg.filter.min.js.map diff --git a/node_modules/@svgdotjs/svg.filter.js/dist/svg.filter.min.js.map b/node_modules/@svgdotjs/svg.filter.js/dist/svg.filter.min.js.map new file mode 100644 index 0000000..73c5f96 --- /dev/null +++ b/node_modules/@svgdotjs/svg.filter.js/dist/svg.filter.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"svg.filter.min.js","sources":["../src/svg.filter.js"],"sourcesContent":["import {\n Array as SVGArray,\n Container,\n Defs,\n Element,\n extend,\n find,\n namespaces as ns,\n nodeOrNew,\n utils,\n wrapWithAttrCheck\n} from '@svgdotjs/svg.js'\n\nexport default class Filter extends Element {\n constructor (node) {\n super(nodeOrNew('filter', node), node)\n\n this.$source = 'SourceGraphic'\n this.$sourceAlpha = 'SourceAlpha'\n this.$background = 'BackgroundImage'\n this.$backgroundAlpha = 'BackgroundAlpha'\n this.$fill = 'FillPaint'\n this.$stroke = 'StrokePaint'\n this.$autoSetIn = true\n }\n\n put (element, i) {\n element = super.put(element, i)\n\n if (!element.attr('in') && this.$autoSetIn) {\n element.attr('in', this.$source)\n }\n if (!element.attr('result')) {\n element.attr('result', element.id())\n }\n\n return element\n }\n\n // Unmask all masked elements and remove itself\n remove () {\n // unmask all targets\n this.targets().each('unfilter')\n\n // remove mask from parent\n return super.remove()\n }\n\n targets () {\n return find('svg [filter*=\"' + this.id() + '\"]')\n }\n\n toString () {\n return 'url(#' + this.id() + ')'\n }\n}\n\n// Create Effect class\nclass Effect extends Element {\n constructor (node, attr) {\n super(node, attr)\n this.result(this.id())\n }\n\n in (effect) {\n // Act as getter\n if (effect == null) {\n const _in = this.attr('in')\n const ref = this.parent() && this.parent().find(`[result=\"${_in}\"]`)[0]\n return ref || _in\n }\n\n // Avr as setter\n return this.attr('in', effect)\n }\n\n // Named result\n result (result) {\n return this.attr('result', result)\n }\n\n // Stringification\n toString () {\n return this.result()\n }\n}\n\n// This function takes an array with attr keys and sets for every key the\n// attribute to the value of one paramater\n// getAttrSetter(['a', 'b']) becomes this.attr({a: param1, b: param2})\nconst getAttrSetter = (params) => {\n return function (...args) {\n for (let i = params.length; i--;) {\n if (args[i] != null) {\n this.attr(params[i], args[i])\n }\n }\n }\n}\n\nconst updateFunctions = {\n blend: getAttrSetter(['in', 'in2', 'mode']),\n // ColorMatrix effect\n colorMatrix: getAttrSetter(['type', 'values']),\n // Composite effect\n composite: getAttrSetter(['in', 'in2', 'operator']),\n // ConvolveMatrix effect\n convolveMatrix: function (matrix) {\n matrix = new SVGArray(matrix).toString()\n\n this.attr({\n order: Math.sqrt(matrix.split(' ').length),\n kernelMatrix: matrix\n })\n },\n // DiffuseLighting effect\n diffuseLighting: getAttrSetter(['surfaceScale', 'lightingColor', 'diffuseConstant', 'kernelUnitLength']),\n // DisplacementMap effect\n displacementMap: getAttrSetter(['in', 'in2', 'scale', 'xChannelSelector', 'yChannelSelector']),\n // DropShadow effect\n dropShadow: getAttrSetter(['in', 'dx', 'dy', 'stdDeviation']),\n // Flood effect\n flood: getAttrSetter(['flood-color', 'flood-opacity']),\n // Gaussian Blur effect\n gaussianBlur: function (x = 0, y = x) {\n this.attr('stdDeviation', x + ' ' + y)\n },\n // Image effect\n image: function (src) {\n this.attr('href', src, ns.xlink)\n },\n // Morphology effect\n morphology: getAttrSetter(['operator', 'radius']),\n // Offset effect\n offset: getAttrSetter(['dx', 'dy']),\n // SpecularLighting effect\n specularLighting: getAttrSetter(['surfaceScale', 'lightingColor', 'diffuseConstant', 'specularExponent', 'kernelUnitLength']),\n // Tile effect\n tile: getAttrSetter([]),\n // Turbulence effect\n turbulence: getAttrSetter(['baseFrequency', 'numOctaves', 'seed', 'stitchTiles', 'type'])\n}\n\nconst filterNames = [\n 'blend',\n 'colorMatrix',\n 'componentTransfer',\n 'composite',\n 'convolveMatrix',\n 'diffuseLighting',\n 'displacementMap',\n 'dropShadow',\n 'flood',\n 'gaussianBlur',\n 'image',\n 'merge',\n 'morphology',\n 'offset',\n 'specularLighting',\n 'tile',\n 'turbulence'\n]\n\n// For every filter create a class\nfilterNames.forEach((effect) => {\n const name = utils.capitalize(effect)\n const fn = updateFunctions[effect]\n\n Filter[name + 'Effect'] = class extends Effect {\n constructor (node) {\n super(nodeOrNew('fe' + name, node), node)\n }\n\n // This function takes all parameters from the factory call\n // and updates the attributes according to the updateFunctions\n update (args) {\n fn.apply(this, args)\n return this\n }\n }\n\n // Add factory function to filter\n // Allow to pass a function or object\n // The attr object is catched from \"wrapWithAttrCheck\"\n Filter.prototype[effect] = wrapWithAttrCheck(function (fn, ...args) {\n const effect = new Filter[name + 'Effect']()\n\n if (fn == null) return this.put(effect)\n\n // For Effects which can take children, a function is allowed\n if (typeof fn === 'function') {\n fn.call(effect, effect)\n } else {\n // In case it is not a function, add it to arguments\n args.unshift(fn)\n }\n return this.put(effect).update(args)\n })\n})\n\n// Correct factories which are not that simple\nextend(Filter, {\n merge (arrayOrFn) {\n const node = this.put(new Filter.MergeEffect())\n\n // If a function was passed, execute it\n // That makes stuff like this possible:\n // filter.merge((mergeEffect) => mergeEffect.mergeNode(in))\n if (typeof arrayOrFn === 'function') {\n arrayOrFn.call(node, node)\n return node\n }\n\n // Check if first child is an array, otherwise use arguments as array\n const children = arrayOrFn instanceof Array ? arrayOrFn : [...arguments]\n\n children.forEach((child) => {\n if (child instanceof Filter.MergeNode) {\n node.put(child)\n } else {\n node.mergeNode(child)\n }\n })\n\n return node\n },\n componentTransfer (components = {}) {\n const node = this.put(new Filter.ComponentTransferEffect())\n\n if (typeof components === 'function') {\n components.call(node, node)\n return node\n }\n\n // If no component is set, we use the given object for all components\n if (!components.r && !components.g && !components.b && !components.a) {\n const temp = components\n components = {\n r: temp, g: temp, b: temp, a: temp\n }\n }\n\n for (const c in components) {\n // components[c] has to hold an attributes object\n node.add(new Filter['Func' + c.toUpperCase()](components[c]))\n }\n\n return node\n }\n})\n\nconst filterChildNodes = [\n 'distantLight',\n 'pointLight',\n 'spotLight',\n 'mergeNode',\n 'FuncR',\n 'FuncG',\n 'FuncB',\n 'FuncA'\n]\n\nfilterChildNodes.forEach((child) => {\n const name = utils.capitalize(child)\n Filter[name] = class extends Effect {\n constructor (node) {\n super(nodeOrNew('fe' + name, node), node)\n }\n }\n})\n\nconst componentFuncs = [\n 'funcR',\n 'funcG',\n 'funcB',\n 'funcA'\n]\n\n// Add an update function for componentTransfer-children\ncomponentFuncs.forEach(function (c) {\n const _class = Filter[utils.capitalize(c)]\n const fn = wrapWithAttrCheck(function () {\n return this.put(new _class())\n })\n\n Filter.ComponentTransferEffect.prototype[c] = fn\n})\n\nconst lights = [\n 'distantLight',\n 'pointLight',\n 'spotLight'\n]\n\n// Add light sources factories to lightining effects\nlights.forEach((light) => {\n const _class = Filter[utils.capitalize(light)]\n const fn = wrapWithAttrCheck(function () {\n return this.put(new _class())\n })\n\n Filter.DiffuseLightingEffect.prototype[light] = fn\n Filter.SpecularLightingEffect.prototype[light] = fn\n})\n\nextend(Filter.MergeEffect, {\n mergeNode (_in) {\n return this.put(new Filter.MergeNode()).attr('in', _in)\n }\n})\n\n// add .filter function\nextend(Defs, {\n // Define filter\n filter: function (block) {\n const filter = this.put(new Filter())\n\n /* invoke passed block */\n if (typeof block === 'function') { block.call(filter, filter) }\n\n return filter\n }\n})\n\nextend(Container, {\n // Define filter on defs\n filter: function (block) {\n return this.defs().filter(block)\n }\n})\n\nextend(Element, {\n // Create filter element in defs and store reference\n filterWith: function (block) {\n const filter = block instanceof Filter\n ? block\n : this.defs().filter(block)\n\n return this.attr('filter', filter)\n },\n // Remove filter\n unfilter: function (remove) {\n /* remove filter attribute */\n return this.attr('filter', null)\n },\n filterer () {\n return this.reference('filter')\n }\n})\n\n// chaining\nconst chainingEffects = {\n // Blend effect\n blend: function (in2, mode) {\n return this.parent() && this.parent().blend(this, in2, mode) // pass this as the first input\n },\n // ColorMatrix effect\n colorMatrix: function (type, values) {\n return this.parent() && this.parent().colorMatrix(type, values).in(this)\n },\n // ComponentTransfer effect\n componentTransfer: function (components) {\n return this.parent() && this.parent().componentTransfer(components).in(this)\n },\n // Composite effect\n composite: function (in2, operator) {\n return this.parent() && this.parent().composite(this, in2, operator) // pass this as the first input\n },\n // ConvolveMatrix effect\n convolveMatrix: function (matrix) {\n return this.parent() && this.parent().convolveMatrix(matrix).in(this)\n },\n // DiffuseLighting effect\n diffuseLighting: function (surfaceScale, lightingColor, diffuseConstant, kernelUnitLength) {\n return this.parent() && this.parent().diffuseLighting(surfaceScale, diffuseConstant, kernelUnitLength).in(this)\n },\n // DisplacementMap effect\n displacementMap: function (in2, scale, xChannelSelector, yChannelSelector) {\n return this.parent() && this.parent().displacementMap(this, in2, scale, xChannelSelector, yChannelSelector) // pass this as the first input\n },\n // DisplacementMap effect\n dropShadow: function (x, y, stdDeviation) {\n return this.parent() && this.parent().dropShadow(this, x, y, stdDeviation).in(this) // pass this as the first input\n },\n // Flood effect\n flood: function (color, opacity) {\n return this.parent() && this.parent().flood(color, opacity) // this effect dont have inputs\n },\n // Gaussian Blur effect\n gaussianBlur: function (x, y) {\n return this.parent() && this.parent().gaussianBlur(x, y).in(this)\n },\n // Image effect\n image: function (src) {\n return this.parent() && this.parent().image(src) // this effect dont have inputs\n },\n // Merge effect\n merge: function (arg) {\n arg = arg instanceof Array ? arg : [...arg]\n return this.parent() && this.parent().merge(this, ...arg) // pass this as the first argument\n },\n // Morphology effect\n morphology: function (operator, radius) {\n return this.parent() && this.parent().morphology(operator, radius).in(this)\n },\n // Offset effect\n offset: function (dx, dy) {\n return this.parent() && this.parent().offset(dx, dy).in(this)\n },\n // SpecularLighting effect\n specularLighting: function (surfaceScale, lightingColor, diffuseConstant, specularExponent, kernelUnitLength) {\n return this.parent() && this.parent().specularLighting(surfaceScale, diffuseConstant, specularExponent, kernelUnitLength).in(this)\n },\n // Tile effect\n tile: function () {\n return this.parent() && this.parent().tile().in(this)\n },\n // Turbulence effect\n turbulence: function (baseFrequency, numOctaves, seed, stitchTiles, type) {\n return this.parent() && this.parent().turbulence(baseFrequency, numOctaves, seed, stitchTiles, type).in(this)\n }\n}\n\nextend(Effect, chainingEffects)\n\n// Effect-specific extensions\nextend(Filter.MergeEffect, {\n in: function (effect) {\n if (effect instanceof Filter.MergeNode) {\n this.add(effect, 0)\n } else {\n this.add(new Filter.MergeNode().in(effect), 0)\n }\n\n return this\n }\n})\n\nextend([Filter.CompositeEffect, Filter.BlendEffect, Filter.DisplacementMapEffect], {\n in2: function (effect) {\n if (effect == null) {\n const in2 = this.attr('in2')\n const ref = this.parent() && this.parent().find(`[result=\"${in2}\"]`)[0]\n return ref || in2\n }\n return this.attr('in2', effect)\n }\n})\n\n// Presets\nFilter.filter = {\n sepiatone: [\n 0.343, 0.669, 0.119, 0, 0,\n 0.249, 0.626, 0.130, 0, 0,\n 0.172, 0.334, 0.111, 0, 0,\n 0.000, 0.000, 0.000, 1, 0]\n}\n"],"names":["Filter","Element","constructor","node","super","nodeOrNew","this","$source","$sourceAlpha","$background","$backgroundAlpha","$fill","$stroke","$autoSetIn","put","element","i","attr","id","remove","targets","each","find","toString","Effect","result","in","effect","_in","parent","getAttrSetter","params","args","length","updateFunctions","blend","colorMatrix","composite","convolveMatrix","matrix","SVGArray","order","Math","sqrt","split","kernelMatrix","diffuseLighting","displacementMap","dropShadow","flood","gaussianBlur","x","y","image","src","ns","xlink","morphology","offset","specularLighting","tile","turbulence","forEach","name","utils","capitalize","fn","update","apply","prototype","wrapWithAttrCheck","call","unshift","svg_js","extend","merge","arrayOrFn","MergeEffect","Array","arguments","child","MergeNode","mergeNode","componentTransfer","components","ComponentTransferEffect","r","g","b","a","c","add","toUpperCase","_class","light","DiffuseLightingEffect","SpecularLightingEffect","Defs","filter","block","Container","defs","filterWith","unfilter","filterer","reference","chainingEffects","in2","mode","type","values","operator","surfaceScale","lightingColor","diffuseConstant","kernelUnitLength","scale","xChannelSelector","yChannelSelector","stdDeviation","color","opacity","arg","radius","dx","dy","specularExponent","baseFrequency","numOctaves","seed","stitchTiles","CompositeEffect","BlendEffect","DisplacementMapEffect","sepiatone"],"mappings":";;;;;;;;;;;+DAae,MAAMA,eAAeC,EAAAA,QAClCC,YAAaC,GACXC,MAAMC,EAAAA,UAAU,SAAUF,GAAOA,GAEjCG,KAAKC,QAAU,gBACfD,KAAKE,aAAe,cACpBF,KAAKG,YAAc,kBACnBH,KAAKI,iBAAmB,kBACxBJ,KAAKK,MAAQ,YACbL,KAAKM,QAAU,cACfN,KAAKO,YAAa,EAGpBC,IAAKC,EAASC,GAUZ,QATAD,EAAUX,MAAMU,IAAIC,EAASC,IAEhBC,KAAK,OAASX,KAAKO,YAC9BE,EAAQE,KAAK,KAAMX,KAAKC,SAErBQ,EAAQE,KAAK,WAChBF,EAAQE,KAAK,SAAUF,EAAQG,MAG1BH,EAITI,SAKE,OAHAb,KAAKc,UAAUC,KAAK,YAGbjB,MAAMe,SAGfC,UACE,OAAOE,EAAIA,KAAC,iBAAmBhB,KAAKY,KAAO,MAG7CK,WACE,MAAO,QAAUjB,KAAKY,KAAO,KAKjC,MAAMM,UAAevB,EAAAA,QACnBC,YAAaC,EAAMc,GACjBb,MAAMD,EAAMc,GACZX,KAAKmB,OAAOnB,KAAKY,MAGnBQ,GAAIC,GAEF,GAAc,MAAVA,EAAgB,CAClB,MAAMC,EAAMtB,KAAKW,KAAK,MAEtB,OADYX,KAAKuB,UAAYvB,KAAKuB,SAASP,KAAK,YAAYM,OAAS,IACvDA,EAIhB,OAAOtB,KAAKW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KAAK,MAAOU,MAK5B3B,OAAOkG,OAAS,CACdoC,UAAW,CACT,KAAO,KAAO,KAAO,EAAG,EACxB,KAAO,KAAO,IAAO,EAAG,EACxB,KAAO,KAAO,KAAO,EAAG,EACxB,EAAO,EAAO,EAAO,EAAG"} \ No newline at end of file diff --git a/node_modules/@svgdotjs/svg.filter.js/dist/svg.filter.node.cjs b/node_modules/@svgdotjs/svg.filter.js/dist/svg.filter.node.cjs new file mode 100644 index 0000000..39aeab2 --- /dev/null +++ b/node_modules/@svgdotjs/svg.filter.js/dist/svg.filter.node.cjs @@ -0,0 +1,393 @@ +/*! +* @svgdotjs/svg.filter.js - A plugin for svg.js adding filter functionality +* @version 3.0.9 +* https://github.com/svgdotjs/svg.filter.js +* +* @copyright Wout Fierens +* @license MIT +* +* BUILT: Mon Feb 24 2025 17:15:33 GMT+0100 (Central European Standard Time) +*/; +'use strict'; + +var svg_js = require('@svgdotjs/svg.js'); + +class Filter extends svg_js.Element { + constructor(node) { + super(svg_js.nodeOrNew('filter', node), node); + this.$source = 'SourceGraphic'; + this.$sourceAlpha = 'SourceAlpha'; + this.$background = 'BackgroundImage'; + this.$backgroundAlpha = 'BackgroundAlpha'; + this.$fill = 'FillPaint'; + this.$stroke = 'StrokePaint'; + this.$autoSetIn = true; + } + put(element, i) { + element = super.put(element, i); + if (!element.attr('in') && this.$autoSetIn) { + element.attr('in', this.$source); + } + if (!element.attr('result')) { + element.attr('result', element.id()); + } + return element; + } + + // Unmask all masked elements and remove itself + remove() { + // unmask all targets + this.targets().each('unfilter'); + + // remove mask from parent + return super.remove(); + } + targets() { + return svg_js.find('svg [filter*="' + this.id() + '"]'); + } + toString() { + return 'url(#' + this.id() + ')'; + } +} + +// Create Effect class +class Effect extends svg_js.Element { + constructor(node, attr) { + super(node, attr); + this.result(this.id()); + } + in(effect) { + // Act as getter + if (effect == null) { + const _in = this.attr('in'); + const ref = this.parent() && this.parent().find(`[result="${_in}"]`)[0]; + return ref || _in; + } + + // Avr as setter + return this.attr('in', effect); + } + + // Named result + result(result) { + return this.attr('result', result); + } + + // Stringification + toString() { + return this.result(); + } +} + +// This function takes an array with attr keys and sets for every key the +// attribute to the value of one paramater +// getAttrSetter(['a', 'b']) becomes this.attr({a: param1, b: param2}) +const getAttrSetter = params => { + return function (...args) { + for (let i = params.length; i--;) { + if (args[i] != null) { + this.attr(params[i], args[i]); + } + } + }; +}; +const updateFunctions = { + blend: getAttrSetter(['in', 'in2', 'mode']), + // ColorMatrix effect + colorMatrix: getAttrSetter(['type', 'values']), + // Composite effect + composite: getAttrSetter(['in', 'in2', 'operator']), + // ConvolveMatrix effect + convolveMatrix: function (matrix) { + matrix = new svg_js.Array(matrix).toString(); + this.attr({ + order: Math.sqrt(matrix.split(' ').length), + kernelMatrix: matrix + }); + }, + // DiffuseLighting effect + diffuseLighting: getAttrSetter(['surfaceScale', 'lightingColor', 'diffuseConstant', 'kernelUnitLength']), + // DisplacementMap effect + displacementMap: getAttrSetter(['in', 'in2', 'scale', 'xChannelSelector', 'yChannelSelector']), + // DropShadow effect + dropShadow: getAttrSetter(['in', 'dx', 'dy', 'stdDeviation']), + // Flood effect + flood: getAttrSetter(['flood-color', 'flood-opacity']), + // Gaussian Blur effect + gaussianBlur: function (x = 0, y = x) { + this.attr('stdDeviation', x + ' ' + y); + }, + // Image effect + image: function (src) { + this.attr('href', src, svg_js.namespaces.xlink); + }, + // Morphology effect + morphology: getAttrSetter(['operator', 'radius']), + // Offset effect + offset: getAttrSetter(['dx', 'dy']), + // SpecularLighting effect + specularLighting: getAttrSetter(['surfaceScale', 'lightingColor', 'diffuseConstant', 'specularExponent', 'kernelUnitLength']), + // Tile effect + tile: getAttrSetter([]), + // Turbulence effect + turbulence: getAttrSetter(['baseFrequency', 'numOctaves', 'seed', 'stitchTiles', 'type']) +}; +const filterNames = ['blend', 'colorMatrix', 'componentTransfer', 'composite', 'convolveMatrix', 'diffuseLighting', 'displacementMap', 'dropShadow', 'flood', 'gaussianBlur', 'image', 'merge', 'morphology', 'offset', 'specularLighting', 'tile', 'turbulence']; + +// For every filter create a class +filterNames.forEach(effect => { + const name = svg_js.utils.capitalize(effect); + const fn = updateFunctions[effect]; + Filter[name + 'Effect'] = class extends Effect { + constructor(node) { + super(svg_js.nodeOrNew('fe' + name, node), node); + } + + // This function takes all parameters from the factory call + // and updates the attributes according to the updateFunctions + update(args) { + fn.apply(this, args); + return this; + } + }; + + // Add factory function to filter + // Allow to pass a function or object + // The attr object is catched from "wrapWithAttrCheck" + Filter.prototype[effect] = svg_js.wrapWithAttrCheck(function (fn, ...args) { + const effect = new Filter[name + 'Effect'](); + if (fn == null) return this.put(effect); + + // For Effects which can take children, a function is allowed + if (typeof fn === 'function') { + fn.call(effect, effect); + } else { + // In case it is not a function, add it to arguments + args.unshift(fn); + } + return this.put(effect).update(args); + }); +}); + +// Correct factories which are not that simple +svg_js.extend(Filter, { + merge(arrayOrFn) { + const node = this.put(new Filter.MergeEffect()); + + // If a function was passed, execute it + // That makes stuff like this possible: + // filter.merge((mergeEffect) => mergeEffect.mergeNode(in)) + if (typeof arrayOrFn === 'function') { + arrayOrFn.call(node, node); + return node; + } + + // Check if first child is an array, otherwise use arguments as array + const children = arrayOrFn instanceof Array ? arrayOrFn : [...arguments]; + children.forEach(child => { + if (child instanceof Filter.MergeNode) { + node.put(child); + } else { + node.mergeNode(child); + } + }); + return node; + }, + componentTransfer(components = {}) { + const node = this.put(new Filter.ComponentTransferEffect()); + if (typeof components === 'function') { + components.call(node, node); + return node; + } + + // If no component is set, we use the given object for all components + if (!components.r && !components.g && !components.b && !components.a) { + const temp = components; + components = { + r: temp, + g: temp, + b: temp, + a: temp + }; + } + for (const c in components) { + // components[c] has to hold an attributes object + node.add(new Filter['Func' + c.toUpperCase()](components[c])); + } + return node; + } +}); +const filterChildNodes = ['distantLight', 'pointLight', 'spotLight', 'mergeNode', 'FuncR', 'FuncG', 'FuncB', 'FuncA']; +filterChildNodes.forEach(child => { + const name = svg_js.utils.capitalize(child); + Filter[name] = class extends Effect { + constructor(node) { + super(svg_js.nodeOrNew('fe' + name, node), node); + } + }; +}); +const componentFuncs = ['funcR', 'funcG', 'funcB', 'funcA']; + +// Add an update function for componentTransfer-children +componentFuncs.forEach(function (c) { + const _class = Filter[svg_js.utils.capitalize(c)]; + const fn = svg_js.wrapWithAttrCheck(function () { + return this.put(new _class()); + }); + Filter.ComponentTransferEffect.prototype[c] = fn; +}); +const lights = ['distantLight', 'pointLight', 'spotLight']; + +// Add light sources factories to lightining effects +lights.forEach(light => { + const _class = Filter[svg_js.utils.capitalize(light)]; + const fn = svg_js.wrapWithAttrCheck(function () { + return this.put(new _class()); + }); + Filter.DiffuseLightingEffect.prototype[light] = fn; + Filter.SpecularLightingEffect.prototype[light] = fn; +}); +svg_js.extend(Filter.MergeEffect, { + mergeNode(_in) { + return this.put(new Filter.MergeNode()).attr('in', _in); + } +}); + +// add .filter function +svg_js.extend(svg_js.Defs, { + // Define filter + filter: function (block) { + const filter = this.put(new Filter()); + + /* invoke passed block */ + if (typeof block === 'function') { + block.call(filter, filter); + } + return filter; + } +}); +svg_js.extend(svg_js.Container, { + // Define filter on defs + filter: function (block) { + return this.defs().filter(block); + } +}); +svg_js.extend(svg_js.Element, { + // Create filter element in defs and store reference + filterWith: function (block) { + const filter = block instanceof Filter ? block : this.defs().filter(block); + return this.attr('filter', filter); + }, + // Remove filter + unfilter: function (remove) { + /* remove filter attribute */ + return this.attr('filter', null); + }, + filterer() { + return this.reference('filter'); + } +}); + +// chaining +const chainingEffects = { + // Blend effect + blend: function (in2, mode) { + return this.parent() && this.parent().blend(this, in2, mode); // pass this as the first input + }, + // ColorMatrix effect + colorMatrix: function (type, values) { + return this.parent() && this.parent().colorMatrix(type, values).in(this); + }, + // ComponentTransfer effect + componentTransfer: function (components) { + return this.parent() && this.parent().componentTransfer(components).in(this); + }, + // Composite effect + composite: function (in2, operator) { + return this.parent() && this.parent().composite(this, in2, operator); // pass this as the first input + }, + // ConvolveMatrix effect + convolveMatrix: function (matrix) { + return this.parent() && this.parent().convolveMatrix(matrix).in(this); + }, + // DiffuseLighting effect + diffuseLighting: function (surfaceScale, lightingColor, diffuseConstant, kernelUnitLength) { + return this.parent() && this.parent().diffuseLighting(surfaceScale, diffuseConstant, kernelUnitLength).in(this); + }, + // DisplacementMap effect + displacementMap: function (in2, scale, xChannelSelector, yChannelSelector) { + return this.parent() && this.parent().displacementMap(this, in2, scale, xChannelSelector, yChannelSelector); // pass this as the first input + }, + // DisplacementMap effect + dropShadow: function (x, y, stdDeviation) { + return this.parent() && this.parent().dropShadow(this, x, y, stdDeviation).in(this); // pass this as the first input + }, + // Flood effect + flood: function (color, opacity) { + return this.parent() && this.parent().flood(color, opacity); // this effect dont have inputs + }, + // Gaussian Blur effect + gaussianBlur: function (x, y) { + return this.parent() && this.parent().gaussianBlur(x, y).in(this); + }, + // Image effect + image: function (src) { + return this.parent() && this.parent().image(src); // this effect dont have inputs + }, + // Merge effect + merge: function (arg) { + arg = arg instanceof Array ? arg : [...arg]; + return this.parent() && this.parent().merge(this, ...arg); // pass this as the first argument + }, + // Morphology effect + morphology: function (operator, radius) { + return this.parent() && this.parent().morphology(operator, radius).in(this); + }, + // Offset effect + offset: function (dx, dy) { + return this.parent() && this.parent().offset(dx, dy).in(this); + }, + // SpecularLighting effect + specularLighting: function (surfaceScale, lightingColor, diffuseConstant, specularExponent, kernelUnitLength) { + return this.parent() && this.parent().specularLighting(surfaceScale, diffuseConstant, specularExponent, kernelUnitLength).in(this); + }, + // Tile effect + tile: function () { + return this.parent() && this.parent().tile().in(this); + }, + // Turbulence effect + turbulence: function (baseFrequency, numOctaves, seed, stitchTiles, type) { + return this.parent() && this.parent().turbulence(baseFrequency, numOctaves, seed, stitchTiles, type).in(this); + } +}; +svg_js.extend(Effect, chainingEffects); + +// Effect-specific extensions +svg_js.extend(Filter.MergeEffect, { + in: function (effect) { + if (effect instanceof Filter.MergeNode) { + this.add(effect, 0); + } else { + this.add(new Filter.MergeNode().in(effect), 0); + } + return this; + } +}); +svg_js.extend([Filter.CompositeEffect, Filter.BlendEffect, Filter.DisplacementMapEffect], { + in2: function (effect) { + if (effect == null) { + const in2 = this.attr('in2'); + const ref = this.parent() && this.parent().find(`[result="${in2}"]`)[0]; + return ref || in2; + } + return this.attr('in2', effect); + } +}); + +// Presets +Filter.filter = { + sepiatone: [0.343, 0.669, 0.119, 0, 0, 0.249, 0.626, 0.130, 0, 0, 0.172, 0.334, 0.111, 0, 0, 0.000, 0.000, 0.000, 1, 0] +}; + +module.exports = Filter; +//# sourceMappingURL=svg.filter.node.cjs.map diff --git a/node_modules/@svgdotjs/svg.filter.js/dist/svg.filter.node.cjs.map b/node_modules/@svgdotjs/svg.filter.js/dist/svg.filter.node.cjs.map new file mode 100644 index 0000000..00cdc95 --- /dev/null +++ b/node_modules/@svgdotjs/svg.filter.js/dist/svg.filter.node.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"svg.filter.node.cjs","sources":["../src/svg.filter.js"],"sourcesContent":["import {\n Array as SVGArray,\n Container,\n Defs,\n Element,\n extend,\n find,\n namespaces as ns,\n nodeOrNew,\n utils,\n wrapWithAttrCheck\n} from '@svgdotjs/svg.js'\n\nexport default class Filter extends Element {\n constructor (node) {\n super(nodeOrNew('filter', node), node)\n\n this.$source = 'SourceGraphic'\n this.$sourceAlpha = 'SourceAlpha'\n this.$background = 'BackgroundImage'\n this.$backgroundAlpha = 'BackgroundAlpha'\n this.$fill = 'FillPaint'\n this.$stroke = 'StrokePaint'\n this.$autoSetIn = true\n }\n\n put (element, i) {\n element = super.put(element, i)\n\n if (!element.attr('in') && this.$autoSetIn) {\n element.attr('in', this.$source)\n }\n if (!element.attr('result')) {\n element.attr('result', element.id())\n }\n\n return element\n }\n\n // Unmask all masked elements and remove itself\n remove () {\n // unmask all targets\n this.targets().each('unfilter')\n\n // remove mask from parent\n return super.remove()\n }\n\n targets () {\n return find('svg [filter*=\"' + this.id() + '\"]')\n }\n\n toString () {\n return 'url(#' + this.id() + ')'\n }\n}\n\n// Create Effect class\nclass Effect extends Element {\n constructor (node, attr) {\n super(node, attr)\n this.result(this.id())\n }\n\n in (effect) {\n // Act as getter\n if (effect == null) {\n const _in = this.attr('in')\n const ref = this.parent() && this.parent().find(`[result=\"${_in}\"]`)[0]\n return ref || _in\n }\n\n // Avr as setter\n return this.attr('in', effect)\n }\n\n // Named result\n result (result) {\n return this.attr('result', result)\n }\n\n // Stringification\n toString () {\n return this.result()\n }\n}\n\n// This function takes an array with attr keys and sets for every key the\n// attribute to the value of one paramater\n// getAttrSetter(['a', 'b']) becomes this.attr({a: param1, b: param2})\nconst getAttrSetter = (params) => {\n return function (...args) {\n for (let i = params.length; i--;) {\n if (args[i] != null) {\n this.attr(params[i], args[i])\n }\n }\n }\n}\n\nconst updateFunctions = {\n blend: getAttrSetter(['in', 'in2', 'mode']),\n // ColorMatrix effect\n colorMatrix: getAttrSetter(['type', 'values']),\n // Composite effect\n composite: getAttrSetter(['in', 'in2', 'operator']),\n // ConvolveMatrix effect\n convolveMatrix: function (matrix) {\n matrix = new SVGArray(matrix).toString()\n\n this.attr({\n order: Math.sqrt(matrix.split(' ').length),\n kernelMatrix: matrix\n })\n },\n // DiffuseLighting effect\n diffuseLighting: getAttrSetter(['surfaceScale', 'lightingColor', 'diffuseConstant', 'kernelUnitLength']),\n // DisplacementMap effect\n displacementMap: getAttrSetter(['in', 'in2', 'scale', 'xChannelSelector', 'yChannelSelector']),\n // DropShadow effect\n dropShadow: getAttrSetter(['in', 'dx', 'dy', 'stdDeviation']),\n // Flood effect\n flood: getAttrSetter(['flood-color', 'flood-opacity']),\n // Gaussian Blur effect\n gaussianBlur: function (x = 0, y = x) {\n this.attr('stdDeviation', x + ' ' + y)\n },\n // Image effect\n image: function (src) {\n this.attr('href', src, ns.xlink)\n },\n // Morphology effect\n morphology: getAttrSetter(['operator', 'radius']),\n // Offset effect\n offset: getAttrSetter(['dx', 'dy']),\n // SpecularLighting effect\n specularLighting: getAttrSetter(['surfaceScale', 'lightingColor', 'diffuseConstant', 'specularExponent', 'kernelUnitLength']),\n // Tile effect\n tile: getAttrSetter([]),\n // Turbulence effect\n turbulence: getAttrSetter(['baseFrequency', 'numOctaves', 'seed', 'stitchTiles', 'type'])\n}\n\nconst filterNames = [\n 'blend',\n 'colorMatrix',\n 'componentTransfer',\n 'composite',\n 'convolveMatrix',\n 'diffuseLighting',\n 'displacementMap',\n 'dropShadow',\n 'flood',\n 'gaussianBlur',\n 'image',\n 'merge',\n 'morphology',\n 'offset',\n 'specularLighting',\n 'tile',\n 'turbulence'\n]\n\n// For every filter create a class\nfilterNames.forEach((effect) => {\n const name = utils.capitalize(effect)\n const fn = updateFunctions[effect]\n\n Filter[name + 'Effect'] = class extends Effect {\n constructor (node) {\n super(nodeOrNew('fe' + name, node), node)\n }\n\n // This function takes all parameters from the factory call\n // and updates the attributes according to the updateFunctions\n update (args) {\n fn.apply(this, args)\n return this\n }\n }\n\n // Add factory function to filter\n // Allow to pass a function or object\n // The attr object is catched from \"wrapWithAttrCheck\"\n Filter.prototype[effect] = wrapWithAttrCheck(function (fn, ...args) {\n const effect = new Filter[name + 'Effect']()\n\n if (fn == null) return this.put(effect)\n\n // For Effects which can take children, a function is allowed\n if (typeof fn === 'function') {\n fn.call(effect, effect)\n } else {\n // In case it is not a function, add it to arguments\n args.unshift(fn)\n }\n return this.put(effect).update(args)\n })\n})\n\n// Correct factories which are not that simple\nextend(Filter, {\n merge (arrayOrFn) {\n const node = this.put(new Filter.MergeEffect())\n\n // If a function was passed, execute it\n // That makes stuff like this possible:\n // filter.merge((mergeEffect) => mergeEffect.mergeNode(in))\n if (typeof arrayOrFn === 'function') {\n arrayOrFn.call(node, node)\n return node\n }\n\n // Check if first child is an array, otherwise use arguments as array\n const children = arrayOrFn instanceof Array ? arrayOrFn : [...arguments]\n\n children.forEach((child) => {\n if (child instanceof Filter.MergeNode) {\n node.put(child)\n } else {\n node.mergeNode(child)\n }\n })\n\n return node\n },\n componentTransfer (components = {}) {\n const node = this.put(new Filter.ComponentTransferEffect())\n\n if (typeof components === 'function') {\n components.call(node, node)\n return node\n }\n\n // If no component is set, we use the given object for all components\n if (!components.r && !components.g && !components.b && !components.a) {\n const temp = components\n components = {\n r: temp, g: temp, b: temp, a: temp\n }\n }\n\n for (const c in components) {\n // components[c] has to hold an attributes object\n node.add(new Filter['Func' + c.toUpperCase()](components[c]))\n }\n\n return node\n }\n})\n\nconst filterChildNodes = [\n 'distantLight',\n 'pointLight',\n 'spotLight',\n 'mergeNode',\n 'FuncR',\n 'FuncG',\n 'FuncB',\n 'FuncA'\n]\n\nfilterChildNodes.forEach((child) => {\n const name = utils.capitalize(child)\n Filter[name] = class extends Effect {\n constructor (node) {\n super(nodeOrNew('fe' + name, node), node)\n }\n }\n})\n\nconst componentFuncs = [\n 'funcR',\n 'funcG',\n 'funcB',\n 'funcA'\n]\n\n// Add an update function for componentTransfer-children\ncomponentFuncs.forEach(function (c) {\n const _class = Filter[utils.capitalize(c)]\n const fn = wrapWithAttrCheck(function () {\n return this.put(new _class())\n })\n\n Filter.ComponentTransferEffect.prototype[c] = fn\n})\n\nconst lights = [\n 'distantLight',\n 'pointLight',\n 'spotLight'\n]\n\n// Add light sources factories to lightining effects\nlights.forEach((light) => {\n const _class = Filter[utils.capitalize(light)]\n const fn = wrapWithAttrCheck(function () {\n return this.put(new _class())\n })\n\n Filter.DiffuseLightingEffect.prototype[light] = fn\n Filter.SpecularLightingEffect.prototype[light] = fn\n})\n\nextend(Filter.MergeEffect, {\n mergeNode (_in) {\n return this.put(new Filter.MergeNode()).attr('in', _in)\n }\n})\n\n// add .filter function\nextend(Defs, {\n // Define filter\n filter: function (block) {\n const filter = this.put(new Filter())\n\n /* invoke passed block */\n if (typeof block === 'function') { block.call(filter, filter) }\n\n return filter\n }\n})\n\nextend(Container, {\n // Define filter on defs\n filter: function (block) {\n return this.defs().filter(block)\n }\n})\n\nextend(Element, {\n // Create filter element in defs and store reference\n filterWith: function (block) {\n const filter = block instanceof Filter\n ? block\n : this.defs().filter(block)\n\n return this.attr('filter', filter)\n },\n // Remove filter\n unfilter: function (remove) {\n /* remove filter attribute */\n return this.attr('filter', null)\n },\n filterer () {\n return this.reference('filter')\n }\n})\n\n// chaining\nconst chainingEffects = {\n // Blend effect\n blend: function (in2, mode) {\n return this.parent() && this.parent().blend(this, in2, mode) // pass this as the first input\n },\n // ColorMatrix effect\n colorMatrix: function (type, values) {\n return this.parent() && this.parent().colorMatrix(type, values).in(this)\n },\n // ComponentTransfer effect\n componentTransfer: function (components) {\n return this.parent() && this.parent().componentTransfer(components).in(this)\n },\n // Composite effect\n composite: function (in2, operator) {\n return this.parent() && this.parent().composite(this, in2, operator) // pass this as the first input\n },\n // ConvolveMatrix effect\n convolveMatrix: function (matrix) {\n return this.parent() && this.parent().convolveMatrix(matrix).in(this)\n },\n // DiffuseLighting effect\n diffuseLighting: function (surfaceScale, lightingColor, diffuseConstant, kernelUnitLength) {\n return this.parent() && this.parent().diffuseLighting(surfaceScale, diffuseConstant, kernelUnitLength).in(this)\n },\n // DisplacementMap effect\n displacementMap: function (in2, scale, xChannelSelector, yChannelSelector) {\n return this.parent() && this.parent().displacementMap(this, in2, scale, xChannelSelector, yChannelSelector) // pass this as the first input\n },\n // DisplacementMap effect\n dropShadow: function (x, y, stdDeviation) {\n return this.parent() && this.parent().dropShadow(this, x, y, stdDeviation).in(this) // pass this as the first input\n },\n // Flood effect\n flood: function (color, opacity) {\n return this.parent() && this.parent().flood(color, opacity) // this effect dont have inputs\n },\n // Gaussian Blur effect\n gaussianBlur: function (x, y) {\n return this.parent() && this.parent().gaussianBlur(x, y).in(this)\n },\n // Image effect\n image: function (src) {\n return this.parent() && this.parent().image(src) // this effect dont have inputs\n },\n // Merge effect\n merge: function (arg) {\n arg = arg instanceof Array ? arg : [...arg]\n return this.parent() && this.parent().merge(this, ...arg) // pass this as the first argument\n },\n // Morphology effect\n morphology: function (operator, radius) {\n return this.parent() && this.parent().morphology(operator, radius).in(this)\n },\n // Offset effect\n offset: function (dx, dy) {\n return this.parent() && this.parent().offset(dx, dy).in(this)\n },\n // SpecularLighting effect\n specularLighting: function (surfaceScale, lightingColor, diffuseConstant, specularExponent, kernelUnitLength) {\n return this.parent() && this.parent().specularLighting(surfaceScale, diffuseConstant, specularExponent, kernelUnitLength).in(this)\n },\n // Tile effect\n tile: function () {\n return this.parent() && this.parent().tile().in(this)\n },\n // Turbulence effect\n turbulence: function (baseFrequency, numOctaves, seed, stitchTiles, type) {\n return this.parent() && this.parent().turbulence(baseFrequency, numOctaves, seed, stitchTiles, type).in(this)\n }\n}\n\nextend(Effect, chainingEffects)\n\n// Effect-specific extensions\nextend(Filter.MergeEffect, {\n in: function (effect) {\n if (effect instanceof Filter.MergeNode) {\n this.add(effect, 0)\n } else {\n this.add(new Filter.MergeNode().in(effect), 0)\n }\n\n return this\n }\n})\n\nextend([Filter.CompositeEffect, Filter.BlendEffect, Filter.DisplacementMapEffect], {\n in2: function (effect) {\n if (effect == null) {\n const in2 = this.attr('in2')\n const ref = this.parent() && this.parent().find(`[result=\"${in2}\"]`)[0]\n return ref || in2\n }\n return this.attr('in2', effect)\n }\n})\n\n// Presets\nFilter.filter = {\n sepiatone: [\n 0.343, 0.669, 0.119, 0, 0,\n 0.249, 0.626, 0.130, 0, 0,\n 0.172, 0.334, 0.111, 0, 0,\n 0.000, 0.000, 0.000, 1, 0]\n}\n"],"names":["Filter","Element","constructor","node","nodeOrNew","$source","$sourceAlpha","$background","$backgroundAlpha","$fill","$stroke","$autoSetIn","put","element","i","attr","id","remove","targets","each","find","toString","Effect","result","in","effect","_in","ref","parent","getAttrSetter","params","args","length","updateFunctions","blend","colorMatrix","composite","convolveMatrix","matrix","SVGArray","order","Math","sqrt","split","kernelMatrix","diffuseLighting","displacementMap","dropShadow","flood","gaussianBlur","x","y","image","src","ns","xlink","morphology","offset","specularLighting","tile","turbulence","filterNames","forEach","name","utils","capitalize","fn","update","apply","prototype","wrapWithAttrCheck","call","unshift","extend","merge","arrayOrFn","MergeEffect","children","Array","arguments","child","MergeNode","mergeNode","componentTransfer","components","ComponentTransferEffect","r","g","b","a","temp","c","add","toUpperCase","filterChildNodes","componentFuncs","_class","lights","light","DiffuseLightingEffect","SpecularLightingEffect","Defs","filter","block","Container","defs","filterWith","unfilter","filterer","reference","chainingEffects","in2","mode","type","values","operator","surfaceScale","lightingColor","diffuseConstant","kernelUnitLength","scale","xChannelSelector","yChannelSelector","stdDeviation","color","opacity","arg","radius","dx","dy","specularExponent","baseFrequency","numOctaves","seed","stitchTiles","CompositeEffect","BlendEffect","DisplacementMapEffect","sepiatone"],"mappings":";;;;;;;;;;;;;;AAae,MAAMA,MAAM,SAASC,cAAO,CAAC;EAC1CC,WAAWA,CAAEC,IAAI,EAAE;IACjB,KAAK,CAACC,gBAAS,CAAC,QAAQ,EAAED,IAAI,CAAC,EAAEA,IAAI,CAAC;IAEtC,IAAI,CAACE,OAAO,GAAG,eAAe;IAC9B,IAAI,CAACC,YAAY,GAAG,aAAa;IACjC,IAAI,CAACC,WAAW,GAAG,iBAAiB;IACpC,IAAI,CAACC,gBAAgB,GAAG,iBAAiB;IACzC,IAAI,CAACC,KAAK,GAAG,WAAW;IACxB,IAAI,CAACC,OAAO,GAAG,aAAa;IAC5B,IAAI,CAACC,UAAU,GAAG,IAAI;AACxB;AAEAC,EAAAA,GAAGA,CAAEC,OAAO,EAAEC,CAAC,EAAE;IACfD,OAAO,GAAG,KAAK,CAACD,GAAG,CAACC,OAAO,EAAEC,CAAC,CAAC;IAE/B,IAAI,CAACD,OAAO,CAACE,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAACJ,UAAU,EAAE;MAC1CE,OAAO,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,CAACV,OAAO,CAAC;AAClC;AACA,IAAA,IAAI,CAACQ,OAAO,CAACE,IAAI,CAAC,QAAQ,CAAC,EAAE;MAC3BF,OAAO,CAACE,IAAI,CAAC,QAAQ,EAAEF,OAAO,CAACG,EAAE,EAAE,CAA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CAAC,EAAE;AACjF1B,EAAAA,GAAG,EAAE,UAAUtF,MAAM,EAAE;IACrB,IAAIA,MAAM,IAAI,IAAI,EAAE;AAClB,MAAA,MAAMsF,GAAG,GAAG,IAAI,CAAChG,IAAI,CAAC,KAAK,CAAC;MAC5B,MAAMY,GAAG,GAAG,IAAI,CAACC,MAAM,EAAE,IAAI,IAAI,CAACA,MAAM,EAAE,CAACR,IAAI,CAAC,CAAA,SAAA,EAAY2F,GAAG,CAAI,EAAA,CAAA,CAAC,CAAC,CAAC,CAAC;MACvE,OAAOpF,GAAG,IAAIoF,GAAG;AACnB;AACA,IAAA,OAAO,IAAI,CAAChG,IAAI,CAAC,KAAK,EAAEU,MAAM,CAAC;AACjC;AACF,CAAC,CAAC;;AAEF;AACAzB,MAAM,CAACsG,MAAM,GAAG;AACdoC,EAAAA,SAAS,EAAE,CACT,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EACzB,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EACzB,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EACzB,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AAC7B,CAAC;;;;"} \ No newline at end of file diff --git a/node_modules/@svgdotjs/svg.filter.js/package.json b/node_modules/@svgdotjs/svg.filter.js/package.json new file mode 100644 index 0000000..4e788c1 --- /dev/null +++ b/node_modules/@svgdotjs/svg.filter.js/package.json @@ -0,0 +1,101 @@ +{ + "name": "@svgdotjs/svg.filter.js", + "version": "3.0.9", + "description": "A plugin for svg.js adding filter functionality", + "keywords": [ + "svg.js", + "filter", + "effect" + ], + "bugs": "https://github.com/svgdotjs/svg.filter.js/issues", + "license": "MIT", + "typings": "./svg.filter.js.d.ts", + "author": { + "name": "Wout Fierens" + }, + "maintainers": [ + { + "name": "Wout Fierens", + "email": "wout@mick-wout.com", + "web": "https://svgdotjs.github.io/" + }, + { + "name": "Ulrich-Matthias Schäfer", + "email": "ulima.ums@googlemail.com" + }, + { + "name": "Robert Friedl" + } + ], + "homepage": "https://github.com/svgdotjs/svg.filter.js", + "type": "module", + "main": "dist/svg.filter.node.cjs", + "unpkg": "dist/svg.filter.min.js", + "jsdelivr": "dist/svg.filter.min.js", + "browser": "src/svg.filter.js", + "module": "src/svg.filter.js", + "exports": { + ".": { + "import": { + "types": "./svg.filter.js.d.ts", + "default": "./src/svg.filter.js" + }, + "require": { + "types": "./svg.filter.js.d.cts", + "default": "./dist/svg.filter.node.cjs" + } + } + }, + "files": [ + "/dist", + "/src", + "/svg.filter.js.d.ts", + "/svg.filter.js.d.cts" + ], + "repository": { + "type": "git", + "url": "https://github.com/svgdotjs/svg.filter.js.git" + }, + "engines": { + "node": ">= 0.8.0" + }, + "scripts": { + "build": "npm run fix && npm run rollup", + "fix": "npx eslint ./src --fix", + "lint": "npx eslint ./src", + "rollup": "npx rollup -c .config/rollup.config.js", + "zip": "zip -j dist/svg.filter.js.zip -- LICENSE README.md dist/svg.filter.js dist/svg.filter.js.map dist/svg.filter.min.js dist/svg.filter.min.js.map", + "prepublishOnly": "rm -rf ./dist && npm run build", + "postpublish": "npm run zip" + }, + "devDependencies": { + "@babel/core": "^7.26.9", + "@babel/plugin-transform-runtime": "^7.26.9", + "@babel/preset-env": "^7.26.9", + "@rollup/plugin-babel": "^6.0.4", + "@rollup/plugin-commonjs": "^28.0.2", + "@rollup/plugin-multi-entry": "^6.0.1", + "@rollup/plugin-node-resolve": "^16.0.0", + "babel-eslint": "^10.1.0", + "core-js": "^3.40.0", + "eslint": "^8.0.1", + "eslint-config-standard": "^17.1.0", + "eslint-plugin-import": "^2.31.0", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-promise": "^6.0.9", + "eslint-plugin-standard": "^5.0.0", + "jasmine": "^5.6.0", + "jasmine-core": "^5.6.0", + "rollup": "^4.34.8", + "rollup-plugin-filesize": "^10.0.0", + "rollup-plugin-terser": "^7.0.2", + "babel-plugin-polyfill-corejs3": "^0.11.1" + }, + "dependencies": { + "@svgdotjs/svg.js": "^3.2.4" + }, + "browserslist": [ + "defaults and fully supports es6-module", + "maintained node versions" + ] +} diff --git a/node_modules/@svgdotjs/svg.filter.js/src/svg.filter.js b/node_modules/@svgdotjs/svg.filter.js/src/svg.filter.js new file mode 100644 index 0000000..344bd56 --- /dev/null +++ b/node_modules/@svgdotjs/svg.filter.js/src/svg.filter.js @@ -0,0 +1,457 @@ +import { + Array as SVGArray, + Container, + Defs, + Element, + extend, + find, + namespaces as ns, + nodeOrNew, + utils, + wrapWithAttrCheck +} from '@svgdotjs/svg.js' + +export default class Filter extends Element { + constructor (node) { + super(nodeOrNew('filter', node), node) + + this.$source = 'SourceGraphic' + this.$sourceAlpha = 'SourceAlpha' + this.$background = 'BackgroundImage' + this.$backgroundAlpha = 'BackgroundAlpha' + this.$fill = 'FillPaint' + this.$stroke = 'StrokePaint' + this.$autoSetIn = true + } + + put (element, i) { + element = super.put(element, i) + + if (!element.attr('in') && this.$autoSetIn) { + element.attr('in', this.$source) + } + if (!element.attr('result')) { + element.attr('result', element.id()) + } + + return element + } + + // Unmask all masked elements and remove itself + remove () { + // unmask all targets + this.targets().each('unfilter') + + // remove mask from parent + return super.remove() + } + + targets () { + return find('svg [filter*="' + this.id() + '"]') + } + + toString () { + return 'url(#' + this.id() + ')' + } +} + +// Create Effect class +class Effect extends Element { + constructor (node, attr) { + super(node, attr) + this.result(this.id()) + } + + in (effect) { + // Act as getter + if (effect == null) { + const _in = this.attr('in') + const ref = this.parent() && this.parent().find(`[result="${_in}"]`)[0] + return ref || _in + } + + // Avr as setter + return this.attr('in', effect) + } + + // Named result + result (result) { + return this.attr('result', result) + } + + // Stringification + toString () { + return this.result() + } +} + +// This function takes an array with attr keys and sets for every key the +// attribute to the value of one paramater +// getAttrSetter(['a', 'b']) becomes this.attr({a: param1, b: param2}) +const getAttrSetter = (params) => { + return function (...args) { + for (let i = params.length; i--;) { + if (args[i] != null) { + this.attr(params[i], args[i]) + } + } + } +} + +const updateFunctions = { + blend: getAttrSetter(['in', 'in2', 'mode']), + // ColorMatrix effect + colorMatrix: getAttrSetter(['type', 'values']), + // Composite effect + composite: getAttrSetter(['in', 'in2', 'operator']), + // ConvolveMatrix effect + convolveMatrix: function (matrix) { + matrix = new SVGArray(matrix).toString() + + this.attr({ + order: Math.sqrt(matrix.split(' ').length), + kernelMatrix: matrix + }) + }, + // DiffuseLighting effect + diffuseLighting: getAttrSetter(['surfaceScale', 'lightingColor', 'diffuseConstant', 'kernelUnitLength']), + // DisplacementMap effect + displacementMap: getAttrSetter(['in', 'in2', 'scale', 'xChannelSelector', 'yChannelSelector']), + // DropShadow effect + dropShadow: getAttrSetter(['in', 'dx', 'dy', 'stdDeviation']), + // Flood effect + flood: getAttrSetter(['flood-color', 'flood-opacity']), + // Gaussian Blur effect + gaussianBlur: function (x = 0, y = x) { + this.attr('stdDeviation', x + ' ' + y) + }, + // Image effect + image: function (src) { + this.attr('href', src, ns.xlink) + }, + // Morphology effect + morphology: getAttrSetter(['operator', 'radius']), + // Offset effect + offset: getAttrSetter(['dx', 'dy']), + // SpecularLighting effect + specularLighting: getAttrSetter(['surfaceScale', 'lightingColor', 'diffuseConstant', 'specularExponent', 'kernelUnitLength']), + // Tile effect + tile: getAttrSetter([]), + // Turbulence effect + turbulence: getAttrSetter(['baseFrequency', 'numOctaves', 'seed', 'stitchTiles', 'type']) +} + +const filterNames = [ + 'blend', + 'colorMatrix', + 'componentTransfer', + 'composite', + 'convolveMatrix', + 'diffuseLighting', + 'displacementMap', + 'dropShadow', + 'flood', + 'gaussianBlur', + 'image', + 'merge', + 'morphology', + 'offset', + 'specularLighting', + 'tile', + 'turbulence' +] + +// For every filter create a class +filterNames.forEach((effect) => { + const name = utils.capitalize(effect) + const fn = updateFunctions[effect] + + Filter[name + 'Effect'] = class extends Effect { + constructor (node) { + super(nodeOrNew('fe' + name, node), node) + } + + // This function takes all parameters from the factory call + // and updates the attributes according to the updateFunctions + update (args) { + fn.apply(this, args) + return this + } + } + + // Add factory function to filter + // Allow to pass a function or object + // The attr object is catched from "wrapWithAttrCheck" + Filter.prototype[effect] = wrapWithAttrCheck(function (fn, ...args) { + const effect = new Filter[name + 'Effect']() + + if (fn == null) return this.put(effect) + + // For Effects which can take children, a function is allowed + if (typeof fn === 'function') { + fn.call(effect, effect) + } else { + // In case it is not a function, add it to arguments + args.unshift(fn) + } + return this.put(effect).update(args) + }) +}) + +// Correct factories which are not that simple +extend(Filter, { + merge (arrayOrFn) { + const node = this.put(new Filter.MergeEffect()) + + // If a function was passed, execute it + // That makes stuff like this possible: + // filter.merge((mergeEffect) => mergeEffect.mergeNode(in)) + if (typeof arrayOrFn === 'function') { + arrayOrFn.call(node, node) + return node + } + + // Check if first child is an array, otherwise use arguments as array + const children = arrayOrFn instanceof Array ? arrayOrFn : [...arguments] + + children.forEach((child) => { + if (child instanceof Filter.MergeNode) { + node.put(child) + } else { + node.mergeNode(child) + } + }) + + return node + }, + componentTransfer (components = {}) { + const node = this.put(new Filter.ComponentTransferEffect()) + + if (typeof components === 'function') { + components.call(node, node) + return node + } + + // If no component is set, we use the given object for all components + if (!components.r && !components.g && !components.b && !components.a) { + const temp = components + components = { + r: temp, g: temp, b: temp, a: temp + } + } + + for (const c in components) { + // components[c] has to hold an attributes object + node.add(new Filter['Func' + c.toUpperCase()](components[c])) + } + + return node + } +}) + +const filterChildNodes = [ + 'distantLight', + 'pointLight', + 'spotLight', + 'mergeNode', + 'FuncR', + 'FuncG', + 'FuncB', + 'FuncA' +] + +filterChildNodes.forEach((child) => { + const name = utils.capitalize(child) + Filter[name] = class extends Effect { + constructor (node) { + super(nodeOrNew('fe' + name, node), node) + } + } +}) + +const componentFuncs = [ + 'funcR', + 'funcG', + 'funcB', + 'funcA' +] + +// Add an update function for componentTransfer-children +componentFuncs.forEach(function (c) { + const _class = Filter[utils.capitalize(c)] + const fn = wrapWithAttrCheck(function () { + return this.put(new _class()) + }) + + Filter.ComponentTransferEffect.prototype[c] = fn +}) + +const lights = [ + 'distantLight', + 'pointLight', + 'spotLight' +] + +// Add light sources factories to lightining effects +lights.forEach((light) => { + const _class = Filter[utils.capitalize(light)] + const fn = wrapWithAttrCheck(function () { + return this.put(new _class()) + }) + + Filter.DiffuseLightingEffect.prototype[light] = fn + Filter.SpecularLightingEffect.prototype[light] = fn +}) + +extend(Filter.MergeEffect, { + mergeNode (_in) { + return this.put(new Filter.MergeNode()).attr('in', _in) + } +}) + +// add .filter function +extend(Defs, { + // Define filter + filter: function (block) { + const filter = this.put(new Filter()) + + /* invoke passed block */ + if (typeof block === 'function') { block.call(filter, filter) } + + return filter + } +}) + +extend(Container, { + // Define filter on defs + filter: function (block) { + return this.defs().filter(block) + } +}) + +extend(Element, { + // Create filter element in defs and store reference + filterWith: function (block) { + const filter = block instanceof Filter + ? block + : this.defs().filter(block) + + return this.attr('filter', filter) + }, + // Remove filter + unfilter: function (remove) { + /* remove filter attribute */ + return this.attr('filter', null) + }, + filterer () { + return this.reference('filter') + } +}) + +// chaining +const chainingEffects = { + // Blend effect + blend: function (in2, mode) { + return this.parent() && this.parent().blend(this, in2, mode) // pass this as the first input + }, + // ColorMatrix effect + colorMatrix: function (type, values) { + return this.parent() && this.parent().colorMatrix(type, values).in(this) + }, + // ComponentTransfer effect + componentTransfer: function (components) { + return this.parent() && this.parent().componentTransfer(components).in(this) + }, + // Composite effect + composite: function (in2, operator) { + return this.parent() && this.parent().composite(this, in2, operator) // pass this as the first input + }, + // ConvolveMatrix effect + convolveMatrix: function (matrix) { + return this.parent() && this.parent().convolveMatrix(matrix).in(this) + }, + // DiffuseLighting effect + diffuseLighting: function (surfaceScale, lightingColor, diffuseConstant, kernelUnitLength) { + return this.parent() && this.parent().diffuseLighting(surfaceScale, diffuseConstant, kernelUnitLength).in(this) + }, + // DisplacementMap effect + displacementMap: function (in2, scale, xChannelSelector, yChannelSelector) { + return this.parent() && this.parent().displacementMap(this, in2, scale, xChannelSelector, yChannelSelector) // pass this as the first input + }, + // DisplacementMap effect + dropShadow: function (x, y, stdDeviation) { + return this.parent() && this.parent().dropShadow(this, x, y, stdDeviation).in(this) // pass this as the first input + }, + // Flood effect + flood: function (color, opacity) { + return this.parent() && this.parent().flood(color, opacity) // this effect dont have inputs + }, + // Gaussian Blur effect + gaussianBlur: function (x, y) { + return this.parent() && this.parent().gaussianBlur(x, y).in(this) + }, + // Image effect + image: function (src) { + return this.parent() && this.parent().image(src) // this effect dont have inputs + }, + // Merge effect + merge: function (arg) { + arg = arg instanceof Array ? arg : [...arg] + return this.parent() && this.parent().merge(this, ...arg) // pass this as the first argument + }, + // Morphology effect + morphology: function (operator, radius) { + return this.parent() && this.parent().morphology(operator, radius).in(this) + }, + // Offset effect + offset: function (dx, dy) { + return this.parent() && this.parent().offset(dx, dy).in(this) + }, + // SpecularLighting effect + specularLighting: function (surfaceScale, lightingColor, diffuseConstant, specularExponent, kernelUnitLength) { + return this.parent() && this.parent().specularLighting(surfaceScale, diffuseConstant, specularExponent, kernelUnitLength).in(this) + }, + // Tile effect + tile: function () { + return this.parent() && this.parent().tile().in(this) + }, + // Turbulence effect + turbulence: function (baseFrequency, numOctaves, seed, stitchTiles, type) { + return this.parent() && this.parent().turbulence(baseFrequency, numOctaves, seed, stitchTiles, type).in(this) + } +} + +extend(Effect, chainingEffects) + +// Effect-specific extensions +extend(Filter.MergeEffect, { + in: function (effect) { + if (effect instanceof Filter.MergeNode) { + this.add(effect, 0) + } else { + this.add(new Filter.MergeNode().in(effect), 0) + } + + return this + } +}) + +extend([Filter.CompositeEffect, Filter.BlendEffect, Filter.DisplacementMapEffect], { + in2: function (effect) { + if (effect == null) { + const in2 = this.attr('in2') + const ref = this.parent() && this.parent().find(`[result="${in2}"]`)[0] + return ref || in2 + } + return this.attr('in2', effect) + } +}) + +// Presets +Filter.filter = { + sepiatone: [ + 0.343, 0.669, 0.119, 0, 0, + 0.249, 0.626, 0.130, 0, 0, + 0.172, 0.334, 0.111, 0, 0, + 0.000, 0.000, 0.000, 1, 0] +} diff --git a/node_modules/@svgdotjs/svg.filter.js/svg.filter.js.d.cts b/node_modules/@svgdotjs/svg.filter.js/svg.filter.js.d.cts new file mode 100644 index 0000000..6f2e5b0 --- /dev/null +++ b/node_modules/@svgdotjs/svg.filter.js/svg.filter.js.d.cts @@ -0,0 +1,288 @@ +import {Element, List} from '@svgdotjs/svg.js' + +declare module "@svgdotjs/svg.js" { + + type EffectOrString = Effect | string + type componentsOrFn = { + r: number, + g: number, + b: number, + a: number + } | number | ((componentTransfer: ComponentTransferEffect) => void) + + export class Filter extends Element { + constructor (node?: SVGFilterElement) + constructor (attr: Object) + + targets (): List + + node: SVGFilterElement + $source: 'SourceGraphic' + $sourceAlpha: 'SourceAlpha' + $background: 'BackgroundImage' + $backgroundAlpha: 'BackgroundAlpha' + $fill: 'FillPaint' + $stroke: 'StrokePaint' + $autoSetIn: boolean + + blend (in1: EffectOrString, in2: EffectOrString, mode: string): BlendEffect + colorMatrix (type: string, values: Array | string ): ColorMatrixEffect + componentTransfer (components: componentsOrFn): ComponentTransferEffect + composite (in1: EffectOrString, in2: EffectOrString, operator: string): CompositeEffect + convolveMatrix (matrix: Array | string): ConvolveMatrixEffect + diffuseLighting (surfaceScale: number, lightingColor: string, diffuseConstant: number, kernelUnitLength: number): DiffuseLightingEffect + displacementMap (in1: EffectOrString, in2: EffectOrString, scale: number, xChannelSelector: string, yChannelSelector: string): DisplacementMapEffect + dropShadow (in1: EffectOrString, dx: number, dy: number, stdDeviation: number): DropShadowEffect + flood (color: string, opacity: number): FloodEffect + gaussianBlur (x: number, y: number): GaussianBlurEffect + image (src: string): ImageEffect + merge (input: Array | ((mergeEffect: MergeEffect) => void)): MergeEffect + morphology (operator: string, radius: number): MorphologyEffect + offset (x: number, y: number): OffsetEffect + specularLighting (surfaceScale: number, lightingColor: string, diffuseConstant: number, specularExponent: number, kernelUnitLength: number): SpecularLightingEffect + tile (): TileEffect + turbulence (baseFrequency: number, numOctaves: number, seed: number, stitchTiles: string, type: string): TurbulenceEffect + } + + interface SVGFEDropShadowElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly dx: SVGAnimatedNumber; + readonly dy: SVGAnimatedNumber; + readonly stdDeviationX: SVGAnimatedNumber; + readonly stdDeviationY: SVGAnimatedNumber; + setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; + addEventListener(type: K, listener: (this: SVGFEDisplacementMapElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: SVGFEDisplacementMapElement, ev: SVGElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; + } + + type SVGEffectElement = + SVGFEBlendElement | + SVGFEBlendElement | + SVGFEColorMatrixElement | + SVGFEComponentTransferElement | + SVGFECompositeElement | + SVGFEConvolveMatrixElement | + SVGFEDiffuseLightingElement | + SVGFEDisplacementMapElement | + SVGFEDropShadowElement | + SVGFEFloodElement | + SVGFEGaussianBlurElement | + SVGFEImageElement | + SVGFEMergeElement | + SVGFEMorphologyElement | + SVGFEOffsetElement | + SVGFESpecularLightingElement | + SVGFETileElement | + SVGFETurbulenceElement + + // Base class for all effects + class Effect extends Element { + constructor (node?: SVGEffectElement) + constructor (attr: Object) + in (): Effect | string + in (effect: Effect | string): this + result (): string + result (result: string): this + + blend (in2: EffectOrString, mode: string): BlendEffect + colorMatrix (type: string, values: Array | string ): ColorMatrixEffect + componentTransfer (components: componentsOrFn): ComponentTransferEffect + composite (in2: EffectOrString, operator: string): CompositeEffect + convolveMatrix (matrix: Array | string): ConvolveMatrixEffect + diffuseLighting (surfaceScale: number, lightingColor: string, diffuseConstant: number, kernelUnitLength: number): DiffuseLightingEffect + displacementMap (in2: EffectOrString, scale: number, xChannelSelector: string, yChannelSelector: string): DisplacementMapEffect + dropShadow (dx: number, dy: number, stdDeviation: number): DropShadowEffect + flood (color: string, opacity: number): FloodEffect + gaussianBlur (x: number, y: number): GaussianBlurEffect + image (src: string): ImageEffect + merge (input: Array | ((mergeEffect: MergeEffect) => void)): MergeEffect + morphology (operator: string, radius: number): MorphologyEffect + offset (x: number, y: number): OffsetEffect + specularLighting (surfaceScale: number, lightingColor: string, diffuseConstant: number, specularExponent: number, kernelUnitLength: number): SpecularLightingEffect + tile (): TileEffect + turbulence (baseFrequency: number, numOctaves: number, seed: number, stitchTiles: string, type: string): TurbulenceEffect + } + + interface LightEffects { + distantLight (attr?: Object | SVGFEDistantLightElement): DistantLight + pointLight (attr?: Object | SVGFEPointLightElement): PointLight + spotLight (attr?: Object | SVGFESpotLightElement): SpotLight + } + + // The following classes are all available effects + // which can be used with filter + class BlendEffect extends Effect { + constructor (node: SVGFEBlendElement) + constructor (attr: Object) + + in2 (effect: EffectOrString): this + in2 (): EffectOrString + } + + class ColorMatrixEffect extends Effect { + constructor (node: SVGFEColorMatrixElement) + constructor (attr: Object) + } + + class ComponentTransferEffect extends Effect { + constructor (node: SVGFEComponentTransferElement) + constructor (attr: Object) + + funcR (attr?: Object | SVGFEFuncRElement): FuncR + funcG (attr?: Object | SVGFEFuncGElement): FuncG + funcB (attr?: Object | SVGFEFuncBElement): FuncB + funcA (attr?: Object | SVGFEFuncAElement): FuncA + } + + class CompositeEffect extends Effect { + constructor (node: SVGFECompositeElement) + constructor (attr: Object) + + in2 (effect: EffectOrString): this + in2 (): EffectOrString + } + + class ConvolveMatrixEffect extends Effect { + constructor (node: SVGFEConvolveMatrixElement) + constructor (attr: Object) + } + + class DiffuseLightingEffect extends Effect implements LightEffects { + constructor (node: SVGFEDiffuseLightingElement) + constructor (attr: Object) + + distantLight (attr?: Object | SVGFEDistantLightElement): DistantLight + pointLight (attr?: Object | SVGFEPointLightElement): PointLight + spotLight (attr?: Object | SVGFESpotLightElement): SpotLight + } + + class DisplacementMapEffect extends Effect { + constructor (node: SVGFEDisplacementMapElement) + constructor (attr: Object) + + in2 (effect: EffectOrString): this + in2 (): EffectOrString + } + + class DropShadowEffect extends Effect { + constructor (node: SVGFEDropShadowElement) + constructor (attr: Object) + } + + class FloodEffect extends Effect { + constructor (node: SVGFEFloodElement) + constructor (attr: Object) + } + + class GaussianBlurEffect extends Effect { + constructor (node: SVGFEGaussianBlurElement) + constructor (attr: Object) + } + + class ImageEffect extends Effect { + constructor (node: SVGFEImageElement) + constructor (attr: Object) + } + + class MergeEffect extends Effect { + constructor (node: SVGFEMergeElement) + constructor (attr: Object) + + mergeNode (attr?: Object | SVGFEMergeNodeElement): MergeNode + } + + class MorphologyEffect extends Effect { + constructor (node: SVGFEMorphologyElement) + constructor (attr: Object) + } + + class OffsetEffect extends Effect { + constructor (node: SVGFEOffsetElement) + constructor (attr: Object) + } + + class SpecularLightingEffect extends Effect { + constructor (node: SVGFESpecularLightingElement) + constructor (attr: Object) + + distantLight (attr?: Object | SVGFEDistantLightElement): DistantLight + pointLight (attr?: Object | SVGFEPointLightElement): PointLight + spotLight (attr?: Object | SVGFESpotLightElement): SpotLight + } + + class TileEffect extends Effect { + constructor (node: SVGFETileElement) + constructor (attr: Object) + } + + class TurbulenceEffect extends Effect { + constructor (node: SVGFETurbulenceElement) + constructor (attr: Object) + } + + + + // These are the lightsources for the following effects: + // - DiffuseLightingEffect + // - SpecularLightingEffect + class DistantLight extends Effect { + constructor (node: SVGFEDistantLightElement) + constructor (attr: Object) + } + + class PointLight extends Effect { + constructor (node: SVGFEPointLightElement) + constructor (attr: Object) + } + + class SpotLight extends Effect { + constructor (node: SVGFESpotLightElement) + constructor (attr: Object) + } + + // Mergenode is the element required for the MergeEffect + class MergeNode extends Effect { + constructor (node: SVGFEMergeNodeElement) + constructor (attr: Object) + } + + // Component elements for the ComponentTransferEffect + class FuncR extends Effect { + constructor (node: SVGFEFuncRElement) + constructor (attr: Object) + } + + class FuncG extends Effect { + constructor (node: SVGFEFuncGElement) + constructor (attr: Object) + } + + class FuncB extends Effect { + constructor (node: SVGFEFuncBElement) + constructor (attr: Object) + } + + class FuncA extends Effect { + constructor (node: SVGFEFuncAElement) + constructor (attr: Object) + } + + + + // Extensions of the core lib + interface Element { + filterWith(filterOrFn?: Filter | ((filter: Filter) => void)): this + filterer(): Filter | null + unfilter(): this + } + + interface Defs { + filter(fn?: (filter: Filter) => void): Filter + } + + interface Container { + filter(fn?: (filter: Filter) => void): Filter + } +} diff --git a/node_modules/@svgdotjs/svg.filter.js/svg.filter.js.d.ts b/node_modules/@svgdotjs/svg.filter.js/svg.filter.js.d.ts new file mode 100644 index 0000000..6f2e5b0 --- /dev/null +++ b/node_modules/@svgdotjs/svg.filter.js/svg.filter.js.d.ts @@ -0,0 +1,288 @@ +import {Element, List} from '@svgdotjs/svg.js' + +declare module "@svgdotjs/svg.js" { + + type EffectOrString = Effect | string + type componentsOrFn = { + r: number, + g: number, + b: number, + a: number + } | number | ((componentTransfer: ComponentTransferEffect) => void) + + export class Filter extends Element { + constructor (node?: SVGFilterElement) + constructor (attr: Object) + + targets (): List + + node: SVGFilterElement + $source: 'SourceGraphic' + $sourceAlpha: 'SourceAlpha' + $background: 'BackgroundImage' + $backgroundAlpha: 'BackgroundAlpha' + $fill: 'FillPaint' + $stroke: 'StrokePaint' + $autoSetIn: boolean + + blend (in1: EffectOrString, in2: EffectOrString, mode: string): BlendEffect + colorMatrix (type: string, values: Array | string ): ColorMatrixEffect + componentTransfer (components: componentsOrFn): ComponentTransferEffect + composite (in1: EffectOrString, in2: EffectOrString, operator: string): CompositeEffect + convolveMatrix (matrix: Array | string): ConvolveMatrixEffect + diffuseLighting (surfaceScale: number, lightingColor: string, diffuseConstant: number, kernelUnitLength: number): DiffuseLightingEffect + displacementMap (in1: EffectOrString, in2: EffectOrString, scale: number, xChannelSelector: string, yChannelSelector: string): DisplacementMapEffect + dropShadow (in1: EffectOrString, dx: number, dy: number, stdDeviation: number): DropShadowEffect + flood (color: string, opacity: number): FloodEffect + gaussianBlur (x: number, y: number): GaussianBlurEffect + image (src: string): ImageEffect + merge (input: Array | ((mergeEffect: MergeEffect) => void)): MergeEffect + morphology (operator: string, radius: number): MorphologyEffect + offset (x: number, y: number): OffsetEffect + specularLighting (surfaceScale: number, lightingColor: string, diffuseConstant: number, specularExponent: number, kernelUnitLength: number): SpecularLightingEffect + tile (): TileEffect + turbulence (baseFrequency: number, numOctaves: number, seed: number, stitchTiles: string, type: string): TurbulenceEffect + } + + interface SVGFEDropShadowElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly dx: SVGAnimatedNumber; + readonly dy: SVGAnimatedNumber; + readonly stdDeviationX: SVGAnimatedNumber; + readonly stdDeviationY: SVGAnimatedNumber; + setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; + addEventListener(type: K, listener: (this: SVGFEDisplacementMapElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: SVGFEDisplacementMapElement, ev: SVGElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; + } + + type SVGEffectElement = + SVGFEBlendElement | + SVGFEBlendElement | + SVGFEColorMatrixElement | + SVGFEComponentTransferElement | + SVGFECompositeElement | + SVGFEConvolveMatrixElement | + SVGFEDiffuseLightingElement | + SVGFEDisplacementMapElement | + SVGFEDropShadowElement | + SVGFEFloodElement | + SVGFEGaussianBlurElement | + SVGFEImageElement | + SVGFEMergeElement | + SVGFEMorphologyElement | + SVGFEOffsetElement | + SVGFESpecularLightingElement | + SVGFETileElement | + SVGFETurbulenceElement + + // Base class for all effects + class Effect extends Element { + constructor (node?: SVGEffectElement) + constructor (attr: Object) + in (): Effect | string + in (effect: Effect | string): this + result (): string + result (result: string): this + + blend (in2: EffectOrString, mode: string): BlendEffect + colorMatrix (type: string, values: Array | string ): ColorMatrixEffect + componentTransfer (components: componentsOrFn): ComponentTransferEffect + composite (in2: EffectOrString, operator: string): CompositeEffect + convolveMatrix (matrix: Array | string): ConvolveMatrixEffect + diffuseLighting (surfaceScale: number, lightingColor: string, diffuseConstant: number, kernelUnitLength: number): DiffuseLightingEffect + displacementMap (in2: EffectOrString, scale: number, xChannelSelector: string, yChannelSelector: string): DisplacementMapEffect + dropShadow (dx: number, dy: number, stdDeviation: number): DropShadowEffect + flood (color: string, opacity: number): FloodEffect + gaussianBlur (x: number, y: number): GaussianBlurEffect + image (src: string): ImageEffect + merge (input: Array | ((mergeEffect: MergeEffect) => void)): MergeEffect + morphology (operator: string, radius: number): MorphologyEffect + offset (x: number, y: number): OffsetEffect + specularLighting (surfaceScale: number, lightingColor: string, diffuseConstant: number, specularExponent: number, kernelUnitLength: number): SpecularLightingEffect + tile (): TileEffect + turbulence (baseFrequency: number, numOctaves: number, seed: number, stitchTiles: string, type: string): TurbulenceEffect + } + + interface LightEffects { + distantLight (attr?: Object | SVGFEDistantLightElement): DistantLight + pointLight (attr?: Object | SVGFEPointLightElement): PointLight + spotLight (attr?: Object | SVGFESpotLightElement): SpotLight + } + + // The following classes are all available effects + // which can be used with filter + class BlendEffect extends Effect { + constructor (node: SVGFEBlendElement) + constructor (attr: Object) + + in2 (effect: EffectOrString): this + in2 (): EffectOrString + } + + class ColorMatrixEffect extends Effect { + constructor (node: SVGFEColorMatrixElement) + constructor (attr: Object) + } + + class ComponentTransferEffect extends Effect { + constructor (node: SVGFEComponentTransferElement) + constructor (attr: Object) + + funcR (attr?: Object | SVGFEFuncRElement): FuncR + funcG (attr?: Object | SVGFEFuncGElement): FuncG + funcB (attr?: Object | SVGFEFuncBElement): FuncB + funcA (attr?: Object | SVGFEFuncAElement): FuncA + } + + class CompositeEffect extends Effect { + constructor (node: SVGFECompositeElement) + constructor (attr: Object) + + in2 (effect: EffectOrString): this + in2 (): EffectOrString + } + + class ConvolveMatrixEffect extends Effect { + constructor (node: SVGFEConvolveMatrixElement) + constructor (attr: Object) + } + + class DiffuseLightingEffect extends Effect implements LightEffects { + constructor (node: SVGFEDiffuseLightingElement) + constructor (attr: Object) + + distantLight (attr?: Object | SVGFEDistantLightElement): DistantLight + pointLight (attr?: Object | SVGFEPointLightElement): PointLight + spotLight (attr?: Object | SVGFESpotLightElement): SpotLight + } + + class DisplacementMapEffect extends Effect { + constructor (node: SVGFEDisplacementMapElement) + constructor (attr: Object) + + in2 (effect: EffectOrString): this + in2 (): EffectOrString + } + + class DropShadowEffect extends Effect { + constructor (node: SVGFEDropShadowElement) + constructor (attr: Object) + } + + class FloodEffect extends Effect { + constructor (node: SVGFEFloodElement) + constructor (attr: Object) + } + + class GaussianBlurEffect extends Effect { + constructor (node: SVGFEGaussianBlurElement) + constructor (attr: Object) + } + + class ImageEffect extends Effect { + constructor (node: SVGFEImageElement) + constructor (attr: Object) + } + + class MergeEffect extends Effect { + constructor (node: SVGFEMergeElement) + constructor (attr: Object) + + mergeNode (attr?: Object | SVGFEMergeNodeElement): MergeNode + } + + class MorphologyEffect extends Effect { + constructor (node: SVGFEMorphologyElement) + constructor (attr: Object) + } + + class OffsetEffect extends Effect { + constructor (node: SVGFEOffsetElement) + constructor (attr: Object) + } + + class SpecularLightingEffect extends Effect { + constructor (node: SVGFESpecularLightingElement) + constructor (attr: Object) + + distantLight (attr?: Object | SVGFEDistantLightElement): DistantLight + pointLight (attr?: Object | SVGFEPointLightElement): PointLight + spotLight (attr?: Object | SVGFESpotLightElement): SpotLight + } + + class TileEffect extends Effect { + constructor (node: SVGFETileElement) + constructor (attr: Object) + } + + class TurbulenceEffect extends Effect { + constructor (node: SVGFETurbulenceElement) + constructor (attr: Object) + } + + + + // These are the lightsources for the following effects: + // - DiffuseLightingEffect + // - SpecularLightingEffect + class DistantLight extends Effect { + constructor (node: SVGFEDistantLightElement) + constructor (attr: Object) + } + + class PointLight extends Effect { + constructor (node: SVGFEPointLightElement) + constructor (attr: Object) + } + + class SpotLight extends Effect { + constructor (node: SVGFESpotLightElement) + constructor (attr: Object) + } + + // Mergenode is the element required for the MergeEffect + class MergeNode extends Effect { + constructor (node: SVGFEMergeNodeElement) + constructor (attr: Object) + } + + // Component elements for the ComponentTransferEffect + class FuncR extends Effect { + constructor (node: SVGFEFuncRElement) + constructor (attr: Object) + } + + class FuncG extends Effect { + constructor (node: SVGFEFuncGElement) + constructor (attr: Object) + } + + class FuncB extends Effect { + constructor (node: SVGFEFuncBElement) + constructor (attr: Object) + } + + class FuncA extends Effect { + constructor (node: SVGFEFuncAElement) + constructor (attr: Object) + } + + + + // Extensions of the core lib + interface Element { + filterWith(filterOrFn?: Filter | ((filter: Filter) => void)): this + filterer(): Filter | null + unfilter(): this + } + + interface Defs { + filter(fn?: (filter: Filter) => void): Filter + } + + interface Container { + filter(fn?: (filter: Filter) => void): Filter + } +} diff --git a/node_modules/@svgdotjs/svg.js/.config/karma.conf.cjs b/node_modules/@svgdotjs/svg.js/.config/karma.conf.cjs new file mode 100644 index 0000000..7584c92 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/.config/karma.conf.cjs @@ -0,0 +1,88 @@ +// Karma configuration +const karmaCommon = require('./karma.conf.common.cjs') + +let chromeBin = 'ChromeHeadless' +if (process.platform === 'linux') { + // We need to choose either Chrome or Chromium. + // Canary is not available on linux. + // If we do not find Chromium then we can deduce that + // either Chrome is installed or there is no Chrome variant at all, + // in which case karma-chrome-launcher will output an error. + // If `which` finds nothing it will throw an error. + const { execSync } = require('child_process') + + try { + if (execSync('which chromium-browser')) chromeBin = 'ChromiumHeadless' + } catch (e) {} +} + +module.exports = function (config) { + config.set( + Object.assign(karmaCommon(config), { + files: [ + 'spec/RAFPlugin.js', + { + pattern: 'spec/fixtures/fixture.css', + included: false, + served: true + }, + { + pattern: 'spec/fixtures/pixel.png', + included: false, + served: true + }, + { + pattern: 'src/**/*.js', + included: false, + served: true, + type: 'modules' + }, + { + pattern: 'spec/helpers.js', + included: false, + served: true, + type: 'module' + }, + { + pattern: 'spec/setupBrowser.js', + included: true, + type: 'module' + }, + { + pattern: 'spec/spec/*/**/*.js', + included: true, + type: 'module' + } + ], + + // preprocess matching files before serving them to the browser + // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor + preprocessors: { + 'src/**/*.js': ['coverage'] + }, + + // test results reporter to use + // possible values: 'dots', 'progress' + // available reporters: https://npmjs.org/browse/keyword/karma-reporter + reporters: ['progress', 'coverage'], + coverageReporter: { + // Specify a reporter type. + type: 'lcov', + dir: 'coverage/', + subdir: function (browser) { + // normalization process to keep a consistent browser name accross different OS + return browser.toLowerCase().split(/[ /-]/)[0] // output the results into: './coverage/firefox/' + }, + instrumenterOptions: { + istanbul: { + esModules: true + } + } + }, + + // start these browsers + // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher + browsers: [chromeBin, 'FirefoxHeadless'] + }) + ) +} diff --git a/node_modules/@svgdotjs/svg.js/.config/karma.conf.common.cjs b/node_modules/@svgdotjs/svg.js/.config/karma.conf.common.cjs new file mode 100644 index 0000000..4808996 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/.config/karma.conf.common.cjs @@ -0,0 +1,67 @@ +// Karma shared configuration + +const os = require('os') +const cpuCount = os.cpus().length + +module.exports = function (config) { + return { + // base path that will be used to resolve all patterns (eg. files, exclude) + basePath: '../', + + // frameworks to use + // available frameworks: https://npmjs.org/browse/keyword/karma-adapter + frameworks: ['jasmine'], + + // list of files / patterns to load in the browser + files: [ + '.config/pretest.js', + 'spec/RAFPlugin.js', + { + pattern: 'spec/fixtures/fixture.css', + included: false, + served: true + }, + { + pattern: 'spec/fixtures/fixture.svg', + included: false, + served: true + }, + { + pattern: 'spec/fixtures/pixel.png', + included: false, + served: true + }, + 'dist/svg.js', + 'spec/spec/*.js' + ], + + proxies: { + '/fixtures/': '/base/spec/fixtures/', + '/spec/': '/base/spec/' + }, + + // web server port + port: 9876, + + // enable / disable colors in the output (reporters and logs) + colors: true, + + // level of logging + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG + logLevel: config.LOG_INFO, + + // enable / disable watching file and executing tests whenever any file changes + autoWatch: false, + + // Continuous Integration mode + // if true, Karma captures browsers, runs the tests and exits + singleRun: true, + + // Concurrency level + // how many browser should be started simultaneous + concurrency: cpuCount || Infinity, + + // list of files to exclude + exclude: [] + } +} diff --git a/node_modules/@svgdotjs/svg.js/.config/karma.conf.saucelabs.cjs b/node_modules/@svgdotjs/svg.js/.config/karma.conf.saucelabs.cjs new file mode 100644 index 0000000..484ebee --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/.config/karma.conf.saucelabs.cjs @@ -0,0 +1,144 @@ +// Karma configuration +// https://wiki.saucelabs.com/display/DOCS/Platform+Configurator + +// TODO: remove dotenv after local test +// require('dotenv').config() + +const karmaCommon = require('./karma.conf.common.cjs') + +const SauceLabsLaunchers = { + /** Real mobile devices are not available + * Your account does not have access to Android devices. + * Please contact sales@saucelabs.com to add this feature to your account. */ + /* sl_android_chrome: { + base: 'SauceLabs', + appiumVersion: '1.5.3', + deviceName: 'Samsung Galaxy S7 Device', + deviceOrientation: 'portrait', + browserName: 'Chrome', + platformVersion: '6.0', + platformName: 'Android' + }, */ + /* sl_android: { + base: 'SauceLabs', + browserName: 'Android', + deviceName: 'Android Emulator', + deviceOrientation: 'portrait' + }, */ + SL_firefox_latest: { + base: 'SauceLabs', + browserName: 'firefox', + version: 'latest' + }, + SL_chrome_latest: { + base: 'SauceLabs', + browserName: 'chrome', + version: 'latest' + }, + SL_InternetExplorer: { + base: 'SauceLabs', + browserName: 'internet explorer', + version: '11.0' + } /* + sl_windows_edge: { + base: 'SauceLabs', + browserName: 'MicrosoftEdge', + version: 'latest', + platform: 'Windows 10' + }, + sl_macos_safari: { + base: 'SauceLabs', + browserName: 'safari', + platform: 'macOS 10.13', + version: '12.0', + recordVideo: true, + recordScreenshots: true, + screenResolution: '1024x768' + } */ /*, + sl_macos_iphone: { + base: 'SauceLabs', + browserName: 'Safari', + deviceName: 'iPhone SE Simulator', + deviceOrientation: 'portrait', + platformVersion: '10.2', + platformName: 'iOS' + } + 'SL_Chrome': { + base: 'SauceLabs', + browserName: 'chrome', + version: '48.0', + platform: 'Linux' + }, + 'SL_Firefox': { + base: 'SauceLabs', + browserName: 'firefox', + version: '50.0', + platform: 'Windows 10' + }, + 'SL_Safari': { + base: 'SauceLabs', + browserName: 'safari', + platform: 'OS X 10.11', + version: '10.0' + } */ +} + +module.exports = function (config) { + if (!process.env.SAUCE_USERNAME || !process.env.SAUCE_ACCESS_KEY) { + console.error( + 'SAUCE_USERNAME and SAUCE_ACCESS_KEY must be provided as environment variables.' + ) + console.warn('Aborting Sauce Labs test') + process.exit(1) + } + const settings = Object.assign(karmaCommon(config), { + // Concurrency level + // how many browser should be started simultaneous + // Saucelabs allow up to 5 concurrent sessions on the free open source tier. + concurrency: 5, + + // this specifies which plugins karma should load + // by default all karma plugins, starting with `karma-` will load + // so if you are really puzzled why something isn't working, then comment + // out plugins: [] - it's here to make karma load faster + // get possible karma plugins by `ls node_modules | grep 'karma-*'` + plugins: ['karma-jasmine', 'karma-sauce-launcher'], + + // logLevel: config.LOG_DEBUG, + + // test results reporter to use + // possible values: 'dots', 'progress' + // available reporters: https://npmjs.org/browse/keyword/karma-reporter + reporters: ['dots', 'saucelabs'], + + customLaunchers: SauceLabsLaunchers, + + // start these browsers + browsers: Object.keys(SauceLabsLaunchers), + sauceLabs: { + testName: 'SVG.js Unit Tests' + // connectOptions: { + // noSslBumpDomains: "all" + // }, + // connectOptions: { + // port: 5757, + // logfile: 'sauce_connect.log' + // }, + } + + // The number of disconnections tolerated. + // browserDisconnectTolerance: 0, // well, sometimes it helps to just restart + // // How long does Karma wait for a browser to reconnect (in ms). + // browserDisconnectTimeout: 10 * 60 * 1000, + // // How long will Karma wait for a message from a browser before disconnecting from it (in ms). ~ macOS 10.12 needs more than 7 minutes + // browserNoActivityTimeout: 20 * 60 * 1000, + // // Timeout for capturing a browser (in ms). On newer versions of iOS simulator (10.0+), the start up time could be between 3 - 6 minutes. + // captureTimeout: 12 * 60 * 1000, // this is useful if saucelabs takes a long time to boot a vm + + // // Required to make Safari on Sauce Labs play nice. + // // hostname: 'karmalocal.dev' + }) + + console.log(settings) + config.set(settings) +} diff --git a/node_modules/@svgdotjs/svg.js/.config/polyfillListIE.js b/node_modules/@svgdotjs/svg.js/.config/polyfillListIE.js new file mode 100644 index 0000000..7c7fc33 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/.config/polyfillListIE.js @@ -0,0 +1,33 @@ +/* global SVGElement */ +/* eslint no-new-object: "off" */ + +import CustomEventPolyfill from '@target/custom-event-polyfill/src/index.js6' +import children from '../src/polyfills/children.js' + +/* IE 11 has no innerHTML on SVGElement */ +import '../src/polyfills/innerHTML.js' + +/* IE 11 has no correct CustomEvent implementation */ +CustomEventPolyfill() + +/* IE 11 has no children on SVGElement */ +try { + if (!SVGElement.prototype.children) { + Object.defineProperty(SVGElement.prototype, 'children', { + get: function () { + return children(this) + } + }) + } +} catch (e) {} + +/* IE 11 cannot handle getPrototypeOf(not_obj) */ +try { + delete Object.getPrototypeOf('test') +} catch (e) { + var old = Object.getPrototypeOf + Object.getPrototypeOf = function (o) { + if (typeof o !== 'object') o = new Object(o) + return old.call(this, o) + } +} diff --git a/node_modules/@svgdotjs/svg.js/.config/pretest.js b/node_modules/@svgdotjs/svg.js/.config/pretest.js new file mode 100644 index 0000000..0e6ecb7 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/.config/pretest.js @@ -0,0 +1,22 @@ +/* global XMLHttpRequest */ +'use strict' + +function get(uri) { + var xhr = new XMLHttpRequest() + xhr.open('GET', uri, false) + xhr.send() + if (xhr.status !== 200) { + console.error('SVG.js fixture could not be loaded. Tests will fail.') + } + return xhr.responseText +} + +function main() { + var style = document.createElement('style') + document.head.appendChild(style) + style.sheet.insertRule(get('/fixtures/fixture.css'), 0) + + document.body.innerHTML = get('/fixtures/fixture.svg') +} + +main() diff --git a/node_modules/@svgdotjs/svg.js/.config/rollup.config.js b/node_modules/@svgdotjs/svg.js/.config/rollup.config.js new file mode 100644 index 0000000..69f656c --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/.config/rollup.config.js @@ -0,0 +1,144 @@ +import pkg from '../package.json' with { type: 'json' } +import babel from '@rollup/plugin-babel' +import resolve from '@rollup/plugin-node-resolve' +import commonjs from '@rollup/plugin-commonjs' +import filesize from 'rollup-plugin-filesize' +import terser from '@rollup/plugin-terser' + +const buildDate = Date() + +const headerLong = `/*! +* ${pkg.name} - ${pkg.description} +* @version ${pkg.version} +* ${pkg.homepage} +* +* @copyright ${pkg.author} +* @license ${pkg.license} +* +* BUILT: ${buildDate} +*/;` + +const headerShort = `/*! ${pkg.name} v${pkg.version} ${pkg.license}*/;` + +const getBabelConfig = (node = false) => { + let targets = pkg.browserslist + const plugins = [ + [ + '@babel/transform-runtime', + { + version: '^7.24.7', + regenerator: false, + useESModules: true + } + ], + [ + 'polyfill-corejs3', + { + method: 'usage-pure' + } + ] + ] + + if (node) { + targets = 'maintained node versions' + } + + return babel({ + include: 'src/**', + babelHelpers: 'runtime', + babelrc: false, + targets: targets, + presets: [ + [ + '@babel/preset-env', + { + modules: false, + // useBuildins and plugin-transform-runtime are mutually exclusive + // https://github.com/babel/babel/issues/10271#issuecomment-528379505 + // use babel-polyfills when released + useBuiltIns: false, + bugfixes: true, + loose: true + } + ] + ], + plugins + }) +} + +// When few of these get mangled nothing works anymore +// We loose literally nothing by let these unmangled +const classes = [ + 'A', + 'ClipPath', + 'Defs', + 'Element', + 'G', + 'Image', + 'Marker', + 'Path', + 'Polygon', + 'Rect', + 'Stop', + 'Svg', + 'Text', + 'Tspan', + 'Circle', + 'Container', + 'Dom', + 'Ellipse', + 'Gradient', + 'Line', + 'Mask', + 'Pattern', + 'Polyline', + 'Shape', + 'Style', + 'Symbol', + 'TextPath', + 'Use' +] + +const config = (node, min, esm = false) => ({ + input: node || esm ? './src/main.js' : './src/svg.js', + output: { + file: esm + ? './dist/svg.esm.js' + : node + ? './dist/svg.node.cjs' + : min + ? './dist/svg.min.js' + : './dist/svg.js', + format: esm ? 'esm' : node ? 'cjs' : 'iife', + name: 'SVG', + sourcemap: true, + banner: headerLong, + // remove Object.freeze + freeze: false + }, + treeshake: { + // property getter have no sideeffects + propertyReadSideEffects: false + }, + plugins: [ + resolve({ browser: !node }), + commonjs(), + getBabelConfig(node), + filesize(), + !min + ? {} + : terser({ + mangle: { + reserved: classes + }, + output: { + preamble: headerShort + } + }) + ] +}) + +// [node, minified, esm] +const modes = [[false], [false, true], [true], [false, false, true]] + +export default modes.map((m) => config(...m)) diff --git a/node_modules/@svgdotjs/svg.js/.config/rollup.polyfills.js b/node_modules/@svgdotjs/svg.js/.config/rollup.polyfills.js new file mode 100644 index 0000000..9fdfbfd --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/.config/rollup.polyfills.js @@ -0,0 +1,20 @@ +import resolve from '@rollup/plugin-node-resolve' +import commonjs from '@rollup/plugin-commonjs' +import filesize from 'rollup-plugin-filesize' + +// We dont need babel. All polyfills are compatible +const config = (ie) => ({ + input: './.config/polyfillListIE.js', + output: { + file: 'dist/polyfillsIE.js', + format: 'iife' + }, + plugins: [ + resolve({ browser: true }), + commonjs(), + //terser(), + filesize() + ] +}) + +export default [true].map(config) diff --git a/node_modules/@svgdotjs/svg.js/.config/rollup.tests.js b/node_modules/@svgdotjs/svg.js/.config/rollup.tests.js new file mode 100644 index 0000000..fe093b6 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/.config/rollup.tests.js @@ -0,0 +1,55 @@ +import * as pkg from '../package.json' +import babel from '@rollup/plugin-babel' +import multiEntry from '@rollup/plugin-multi-entry' +import resolve from '@rollup/plugin-node-resolve' +import commonjs from '@rollup/plugin-commonjs' + +const getBabelConfig = (targets) => + babel({ + include: ['src/**', 'spec/**/*'], + babelHelpers: 'runtime', + babelrc: false, + presets: [ + [ + '@babel/preset-env', + { + modules: false, + targets: targets || pkg.browserslist, + // useBuildins and plugin-transform-runtime are mutually exclusive + // https://github.com/babel/babel/issues/10271#issuecomment-528379505 + // use babel-polyfills when released + useBuiltIns: false, + // corejs: 3, + bugfixes: true + } + ] + ], + plugins: [ + [ + '@babel/plugin-transform-runtime', + { + corejs: 3, + helpers: true, + useESModules: true, + version: '^7.9.6', + regenerator: false + } + ] + ] + }) + +export default { + input: ['spec/setupBrowser.js', 'spec/spec/*/*.js'], + output: { + file: 'spec/es5TestBundle.js', + name: 'SVGTests', + format: 'iife' + }, + plugins: [ + resolve({ browser: true }), + commonjs(), + getBabelConfig(), + multiEntry() + ], + external: ['@babel/runtime', '@babel/runtime-corejs3'] +} diff --git a/node_modules/@svgdotjs/svg.js/LICENSE.txt b/node_modules/@svgdotjs/svg.js/LICENSE.txt new file mode 100644 index 0000000..41b1b10 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/LICENSE.txt @@ -0,0 +1,21 @@ +Copyright (c) 2012-2018 Wout Fierens +https://svgdotjs.github.io/ + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/@svgdotjs/svg.js/README.md b/node_modules/@svgdotjs/svg.js/README.md new file mode 100644 index 0000000..e02fcd1 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/README.md @@ -0,0 +1,34 @@ +# SVG.js + +[![Build Status](https://travis-ci.org/svgdotjs/svg.js.svg?branch=master)](https://travis-ci.org/svgdotjs/svg.js) +[![Coverage Status](https://coveralls.io/repos/github/svgdotjs/svg.js/badge.svg?branch=master)](https://coveralls.io/github/svgdotjs/svg.js?branch=master) +[![Cdnjs](https://img.shields.io/cdnjs/v/svg.js.svg)](https://cdnjs.com/libraries/svg.js) +[![jsdelivr](https://badgen.net/jsdelivr/v/npm/@svgdotjs/svg.js)](https://cdn.jsdelivr.net/npm/@svgdotjs/svg.js) +[![Join the chat at https://gitter.im/svgdotjs/svg.js](https://badges.gitter.im/svgdotjs/svg.js.svg)](https://gitter.im/svgdotjs/svg.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![Twitter](https://img.shields.io/badge/Twitter-@svg__js-green.svg)](https://twitter.com/svg_js) + +**A lightweight library for manipulating and animating SVG, without any dependencies.** + +SVG.js is licensed under the terms of the MIT License. + +## Installation + +#### Npm: + +`npm install @svgdotjs/svg.js` + +#### Yarn: + +`yarn add @svgdotjs/svg.js` + +#### CDNs: + +[https://cdnjs.com/libraries/svg.js](https://cdnjs.com/libraries/svg.js) +[https://cdn.jsdelivr.net/npm/@svgdotjs/svg.js](https://cdn.jsdelivr.net/npm/@svgdotjs/svg.js) +[https://unpkg.com/@svgdotjs/svg.js](https://unpkg.com/@svgdotjs/svg.js) + +## Documentation + +Check [svgjs.dev](https://svgjs.dev/docs/3.0/) to learn more. + +[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ulima.ums%40googlemail.com&lc=US&item_name=SVG.JS¤cy_code=EUR&bn=PP-DonationsBF%3Abtn_donate_74x21.png%3ANonHostedGuest) or [![Sponsor](https://img.shields.io/badge/Sponsor-svg.js-green.svg)](https://github.com/sponsors/Fuzzyma) diff --git a/node_modules/@svgdotjs/svg.js/dist/polyfillsIE.js b/node_modules/@svgdotjs/svg.js/dist/polyfillsIE.js new file mode 100644 index 0000000..1b2d99b --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/dist/polyfillsIE.js @@ -0,0 +1,473 @@ +(function () { + 'use strict'; + + /* Polyfill service v3.16.0 + * For detailed credits and licence information see https://github.com/financial-times/polyfill-service. + * + * UA detected: ie/9.0.0 + * Features requested: CustomEvent + * + * - Event, License: CC0 (required by "CustomEvent") + * - CustomEvent, License: CC0 */ + + function CustomEventPolyfill() { + (function (undefined$1) { + if (!((function (global) { + + if (!('Event' in global)) return false; + if (typeof global.Event === 'function') return true; + + try { + + // In IE 9-11, the Event object exists but cannot be instantiated + new Event('click'); + return true; + } catch (e) { + return false; + } + }(this)))) { + + // Event + (function () { + var unlistenableWindowEvents = { + click: 1, + dblclick: 1, + keyup: 1, + keypress: 1, + keydown: 1, + mousedown: 1, + mouseup: 1, + mousemove: 1, + mouseover: 1, + mouseenter: 1, + mouseleave: 1, + mouseout: 1, + storage: 1, + storagecommit: 1, + textinput: 1 + }; + + function indexOf(array, element) { + var + index = -1, + length = array.length; + + while (++index < length) { + if (index in array && array[index] === element) { + return index; + } + } + + return -1; + } + + var existingProto = (window.Event && window.Event.prototype) || null; + window.Event = Window.prototype.Event = function Event(type, eventInitDict) { + if (!type) { + throw new Error('Not enough arguments'); + } + + // Shortcut if browser supports createEvent + if ('createEvent' in document) { + var event = document.createEvent('Event'); + var bubbles = eventInitDict && eventInitDict.bubbles !== undefined$1 ? + eventInitDict.bubbles : false; + var cancelable = eventInitDict && eventInitDict.cancelable !== undefined$1 ? + eventInitDict.cancelable : false; + + event.initEvent(type, bubbles, cancelable); + + return event; + } + + var event = document.createEventObject(); + + event.type = type; + event.bubbles = + eventInitDict && eventInitDict.bubbles !== undefined$1 ? eventInitDict.bubbles : false; + event.cancelable = + eventInitDict && eventInitDict.cancelable !== undefined$1 ? eventInitDict.cancelable : + false; + + return event; + }; + if (existingProto) { + Object.defineProperty(window.Event, 'prototype', { + configurable: false, + enumerable: false, + writable: true, + value: existingProto + }); + } + + if (!('createEvent' in document)) { + window.addEventListener = Window.prototype.addEventListener = + Document.prototype.addEventListener = + Element.prototype.addEventListener = function addEventListener() { + var + element = this, + type = arguments[0], + listener = arguments[1]; + + if (element === window && type in unlistenableWindowEvents) { + throw new Error('In IE8 the event: ' + type + + ' is not available on the window object.'); + } + + if (!element._events) { + element._events = {}; + } + + if (!element._events[type]) { + element._events[type] = function (event) { + var + list = element._events[event.type].list, + events = list.slice(), + index = -1, + length = events.length, + eventElement; + + event.preventDefault = function preventDefault() { + if (event.cancelable !== false) { + event.returnValue = false; + } + }; + + event.stopPropagation = function stopPropagation() { + event.cancelBubble = true; + }; + + event.stopImmediatePropagation = function stopImmediatePropagation() { + event.cancelBubble = true; + event.cancelImmediate = true; + }; + + event.currentTarget = element; + event.relatedTarget = event.fromElement || null; + event.target = event.target || event.srcElement || element; + event.timeStamp = new Date().getTime(); + + if (event.clientX) { + event.pageX = event.clientX + document.documentElement.scrollLeft; + event.pageY = event.clientY + document.documentElement.scrollTop; + } + + while (++index < length && !event.cancelImmediate) { + if (index in events) { + eventElement = events[index]; + + if (indexOf(list, eventElement) !== -1 && + typeof eventElement === 'function') { + eventElement.call(element, event); + } + } + } + }; + + element._events[type].list = []; + + if (element.attachEvent) { + element.attachEvent('on' + type, element._events[type]); + } + } + + element._events[type].list.push(listener); + }; + + window.removeEventListener = Window.prototype.removeEventListener = + Document.prototype.removeEventListener = + Element.prototype.removeEventListener = function removeEventListener() { + var + element = this, + type = arguments[0], + listener = arguments[1], + index; + + if (element._events && element._events[type] && element._events[type].list) { + index = indexOf(element._events[type].list, listener); + + if (index !== -1) { + element._events[type].list.splice(index, 1); + + if (!element._events[type].list.length) { + if (element.detachEvent) { + element.detachEvent('on' + type, element._events[type]); + } + delete element._events[type]; + } + } + } + }; + + window.dispatchEvent = Window.prototype.dispatchEvent = Document.prototype.dispatchEvent = + Element.prototype.dispatchEvent = function dispatchEvent(event) { + if (!arguments.length) { + throw new Error('Not enough arguments'); + } + + if (!event || typeof event.type !== 'string') { + throw new Error('DOM Events Exception 0'); + } + + var element = this, type = event.type; + + try { + if (!event.bubbles) { + event.cancelBubble = true; + + var cancelBubbleEvent = function (event) { + event.cancelBubble = true; + + (element || window).detachEvent('on' + type, cancelBubbleEvent); + }; + + this.attachEvent('on' + type, cancelBubbleEvent); + } + + this.fireEvent('on' + type, event); + } catch (error) { + event.target = element; + + do { + event.currentTarget = element; + + if ('_events' in element && typeof element._events[type] === 'function') { + element._events[type].call(element, event); + } + + if (typeof element['on' + type] === 'function') { + element['on' + type].call(element, event); + } + + element = element.nodeType === 9 ? element.parentWindow : element.parentNode; + } while (element && !event.cancelBubble); + } + + return true; + }; + + // Add the DOMContentLoaded Event + document.attachEvent('onreadystatechange', function () { + if (document.readyState === 'complete') { + document.dispatchEvent(new Event('DOMContentLoaded', { + bubbles: true + })); + } + }); + } + }()); + + } + + if (!('CustomEvent' in this && + + // In Safari, typeof CustomEvent == 'object' but it otherwise works fine + (typeof this.CustomEvent === 'function' || + (this.CustomEvent.toString().indexOf('CustomEventConstructor') > -1)))) { + + // CustomEvent + this.CustomEvent = function CustomEvent(type, eventInitDict) { + if (!type) { + throw Error( + 'TypeError: Failed to construct "CustomEvent": An event name must be provided.'); + } + + var event; + eventInitDict = eventInitDict || {bubbles: false, cancelable: false, detail: null}; + + if ('createEvent' in document) { + try { + event = document.createEvent('CustomEvent'); + event.initCustomEvent(type, eventInitDict.bubbles, eventInitDict.cancelable, + eventInitDict.detail); + } catch (error) { + // for browsers which don't support CustomEvent at all, we use a regular event instead + event = document.createEvent('Event'); + event.initEvent(type, eventInitDict.bubbles, eventInitDict.cancelable); + event.detail = eventInitDict.detail; + } + } else { + + // IE8 + event = new Event(type, eventInitDict); + event.detail = eventInitDict && eventInitDict.detail || null; + } + return event; + }; + + CustomEvent.prototype = Event.prototype; + + } + + }).call('object' === typeof window && window || 'object' === typeof self && self || + 'object' === typeof global && global || {}); + } + + // Map function + + // Filter function + function filter(array, block) { + let i; + const il = array.length; + const result = []; + + for (i = 0; i < il; i++) { + if (block(array[i])) { + result.push(array[i]); + } + } + + return result + } + + // IE11: children does not work for svg nodes + function children(node) { + return filter(node.childNodes, function (child) { + return child.nodeType === 1 + }) + } + + (function () { + try { + if (SVGElement.prototype.innerHTML) return + } catch (e) { + return + } + + const serializeXML = function (node, output) { + const nodeType = node.nodeType; + if (nodeType === 3) { + output.push( + node.textContent + .replace(/&/, '&') + .replace(/', '>') + ); + } else if (nodeType === 1) { + output.push('<', node.tagName); + if (node.hasAttributes()) { + [].forEach.call(node.attributes, function (attrNode) { + output.push(' ', attrNode.name, '="', attrNode.value, '"'); + }); + } + output.push('>'); + if (node.hasChildNodes()) { + [].forEach.call(node.childNodes, function (childNode) { + serializeXML(childNode, output); + }); + } + output.push(''); + } else if (nodeType === 8) { + output.push(''); + } + }; + + Object.defineProperty(SVGElement.prototype, 'innerHTML', { + get: function () { + const output = []; + let childNode = this.firstChild; + while (childNode) { + serializeXML(childNode, output); + childNode = childNode.nextSibling; + } + return output.join('') + }, + set: function (markupText) { + while (this.firstChild) { + this.removeChild(this.firstChild); + } + + try { + const dXML = new DOMParser(); + dXML.async = false; + + const sXML = + "" + + markupText + + ''; + const svgDocElement = dXML.parseFromString( + sXML, + 'text/xml' + ).documentElement; + + let childNode = svgDocElement.firstChild; + while (childNode) { + this.appendChild(this.ownerDocument.importNode(childNode, true)); + childNode = childNode.nextSibling; + } + } catch (e) { + throw new Error('Can not set innerHTML on node') + } + } + }); + + Object.defineProperty(SVGElement.prototype, 'outerHTML', { + get: function () { + const output = []; + serializeXML(this, output); + return output.join('') + }, + set: function (markupText) { + while (this.firstChild) { + this.removeChild(this.firstChild); + } + + try { + const dXML = new DOMParser(); + dXML.async = false; + + const sXML = + "" + + markupText + + ''; + const svgDocElement = dXML.parseFromString( + sXML, + 'text/xml' + ).documentElement; + + let childNode = svgDocElement.firstChild; + while (childNode) { + this.parentNode.insertBefore( + this.ownerDocument.importNode(childNode, true), + this + ); + // this.appendChild(this.ownerDocument.importNode(childNode, true)); + childNode = childNode.nextSibling; + } + } catch (e) { + throw new Error('Can not set outerHTML on node') + } + } + }); + })(); + + /* global SVGElement */ + /* eslint no-new-object: "off" */ + + + /* IE 11 has no correct CustomEvent implementation */ + CustomEventPolyfill(); + + /* IE 11 has no children on SVGElement */ + try { + if (!SVGElement.prototype.children) { + Object.defineProperty(SVGElement.prototype, 'children', { + get: function () { + return children(this) + } + }); + } + } catch (e) {} + + /* IE 11 cannot handle getPrototypeOf(not_obj) */ + try { + delete Object.getPrototypeOf('test'); + } catch (e) { + var old = Object.getPrototypeOf; + Object.getPrototypeOf = function (o) { + if (typeof o !== 'object') o = new Object(o); + return old.call(this, o) + }; + } + +})(); diff --git a/node_modules/@svgdotjs/svg.js/dist/svg.esm.js b/node_modules/@svgdotjs/svg.js/dist/svg.esm.js new file mode 100644 index 0000000..0ebbde7 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/dist/svg.esm.js @@ -0,0 +1,6823 @@ +/*! +* @svgdotjs/svg.js - A lightweight library for manipulating and animating SVG. +* @version 3.2.4 +* https://svgjs.dev/ +* +* @copyright Wout Fierens +* @license MIT +* +* BUILT: Thu Jun 27 2024 12:00:16 GMT+0200 (Central European Summer Time) +*/; +const methods$1 = {}; +const names = []; +function registerMethods(name, m) { + if (Array.isArray(name)) { + for (const _name of name) { + registerMethods(_name, m); + } + return; + } + if (typeof name === 'object') { + for (const _name in name) { + registerMethods(_name, name[_name]); + } + return; + } + addMethodNames(Object.getOwnPropertyNames(m)); + methods$1[name] = Object.assign(methods$1[name] || {}, m); +} +function getMethodsFor(name) { + return methods$1[name] || {}; +} +function getMethodNames() { + return [...new Set(names)]; +} +function addMethodNames(_names) { + names.push(..._names); +} + +// Map function +function map(array, block) { + let i; + const il = array.length; + const result = []; + for (i = 0; i < il; i++) { + result.push(block(array[i])); + } + return result; +} + +// Filter function +function filter(array, block) { + let i; + const il = array.length; + const result = []; + for (i = 0; i < il; i++) { + if (block(array[i])) { + result.push(array[i]); + } + } + return result; +} + +// Degrees to radians +function radians(d) { + return d % 360 * Math.PI / 180; +} + +// Radians to degrees +function degrees(r) { + return r * 180 / Math.PI % 360; +} + +// Convert camel cased string to dash separated +function unCamelCase(s) { + return s.replace(/([A-Z])/g, function (m, g) { + return '-' + g.toLowerCase(); + }); +} + +// Capitalize first letter of a string +function capitalize(s) { + return s.charAt(0).toUpperCase() + s.slice(1); +} + +// Calculate proportional width and height values when necessary +function proportionalSize(element, width, height, box) { + if (width == null || height == null) { + box = box || element.bbox(); + if (width == null) { + width = box.width / box.height * height; + } else if (height == null) { + height = box.height / box.width * width; + } + } + return { + width: width, + height: height + }; +} + +/** + * This function adds support for string origins. + * It searches for an origin in o.origin o.ox and o.originX. + * This way, origin: {x: 'center', y: 50} can be passed as well as ox: 'center', oy: 50 + **/ +function getOrigin(o, element) { + const origin = o.origin; + // First check if origin is in ox or originX + let ox = o.ox != null ? o.ox : o.originX != null ? o.originX : 'center'; + let oy = o.oy != null ? o.oy : o.originY != null ? o.originY : 'center'; + + // Then check if origin was used and overwrite in that case + if (origin != null) { + [ox, oy] = Array.isArray(origin) ? origin : typeof origin === 'object' ? [origin.x, origin.y] : [origin, origin]; + } + + // Make sure to only call bbox when actually needed + const condX = typeof ox === 'string'; + const condY = typeof oy === 'string'; + if (condX || condY) { + const { + height, + width, + x, + y + } = element.bbox(); + + // And only overwrite if string was passed for this specific axis + if (condX) { + ox = ox.includes('left') ? x : ox.includes('right') ? x + width : x + width / 2; + } + if (condY) { + oy = oy.includes('top') ? y : oy.includes('bottom') ? y + height : y + height / 2; + } + } + + // Return the origin as it is if it wasn't a string + return [ox, oy]; +} +const descriptiveElements = new Set(['desc', 'metadata', 'title']); +const isDescriptive = element => descriptiveElements.has(element.nodeName); +const writeDataToDom = (element, data, defaults = {}) => { + const cloned = { + ...data + }; + for (const key in cloned) { + if (cloned[key].valueOf() === defaults[key]) { + delete cloned[key]; + } + } + if (Object.keys(cloned).length) { + element.node.setAttribute('data-svgjs', JSON.stringify(cloned)); // see #428 + } else { + element.node.removeAttribute('data-svgjs'); + element.node.removeAttribute('svgjs:data'); + } +}; + +var utils = { + __proto__: null, + capitalize: capitalize, + degrees: degrees, + filter: filter, + getOrigin: getOrigin, + isDescriptive: isDescriptive, + map: map, + proportionalSize: proportionalSize, + radians: radians, + unCamelCase: unCamelCase, + writeDataToDom: writeDataToDom +}; + +// Default namespaces +const svg = 'http://www.w3.org/2000/svg'; +const html = 'http://www.w3.org/1999/xhtml'; +const xmlns = 'http://www.w3.org/2000/xmlns/'; +const xlink = 'http://www.w3.org/1999/xlink'; + +var namespaces = { + __proto__: null, + html: html, + svg: svg, + xlink: xlink, + xmlns: xmlns +}; + +const globals = { + window: typeof window === 'undefined' ? null : window, + document: typeof document === 'undefined' ? null : document +}; +function registerWindow(win = null, doc = null) { + globals.window = win; + globals.document = doc; +} +const save = {}; +function saveWindow() { + save.window = globals.window; + save.document = globals.document; +} +function restoreWindow() { + globals.window = save.window; + globals.document = save.document; +} +function withWindow(win, fn) { + saveWindow(); + registerWindow(win, win.document); + fn(win, win.document); + restoreWindow(); +} +function getWindow() { + return globals.window; +} + +class Base { + // constructor (node/*, {extensions = []} */) { + // // this.tags = [] + // // + // // for (let extension of extensions) { + // // extension.setup.call(this, node) + // // this.tags.push(extension.name) + // // } + // } +} + +const elements = {}; +const root = '___SYMBOL___ROOT___'; + +// Method for element creation +function create(name, ns = svg) { + // create element + return globals.document.createElementNS(ns, name); +} +function makeInstance(element, isHTML = false) { + if (element instanceof Base) return element; + if (typeof element === 'object') { + return adopter(element); + } + if (element == null) { + return new elements[root](); + } + if (typeof element === 'string' && element.charAt(0) !== '<') { + return adopter(globals.document.querySelector(element)); + } + + // Make sure, that HTML elements are created with the correct namespace + const wrapper = isHTML ? globals.document.createElement('div') : create('svg'); + wrapper.innerHTML = element; + + // We can use firstChild here because we know, + // that the first char is < and thus an element + element = adopter(wrapper.firstChild); + + // make sure, that element doesn't have its wrapper attached + wrapper.removeChild(wrapper.firstChild); + return element; +} +function nodeOrNew(name, node) { + return node && (node instanceof globals.window.Node || node.ownerDocument && node instanceof node.ownerDocument.defaultView.Node) ? node : create(name); +} + +// Adopt existing svg elements +function adopt(node) { + // check for presence of node + if (!node) return null; + + // make sure a node isn't already adopted + if (node.instance instanceof Base) return node.instance; + if (node.nodeName === '#document-fragment') { + return new elements.Fragment(node); + } + + // initialize variables + let className = capitalize(node.nodeName || 'Dom'); + + // Make sure that gradients are adopted correctly + if (className === 'LinearGradient' || className === 'RadialGradient') { + className = 'Gradient'; + + // Fallback to Dom if element is not known + } else if (!elements[className]) { + className = 'Dom'; + } + return new elements[className](node); +} +let adopter = adopt; +function mockAdopt(mock = adopt) { + adopter = mock; +} +function register(element, name = element.name, asRoot = false) { + elements[name] = element; + if (asRoot) elements[root] = element; + addMethodNames(Object.getOwnPropertyNames(element.prototype)); + return element; +} +function getClass(name) { + return elements[name]; +} + +// Element id sequence +let did = 1000; + +// Get next named element id +function eid(name) { + return 'Svgjs' + capitalize(name) + did++; +} + +// Deep new id assignment +function assignNewId(node) { + // do the same for SVG child nodes as well + for (let i = node.children.length - 1; i >= 0; i--) { + assignNewId(node.children[i]); + } + if (node.id) { + node.id = eid(node.nodeName); + return node; + } + return node; +} + +// Method for extending objects +function extend(modules, methods) { + let key, i; + modules = Array.isArray(modules) ? modules : [modules]; + for (i = modules.length - 1; i >= 0; i--) { + for (key in methods) { + modules[i].prototype[key] = methods[key]; + } + } +} +function wrapWithAttrCheck(fn) { + return function (...args) { + const o = args[args.length - 1]; + if (o && o.constructor === Object && !(o instanceof Array)) { + return fn.apply(this, args.slice(0, -1)).attr(o); + } else { + return fn.apply(this, args); + } + }; +} + +// Get all siblings, including myself +function siblings() { + return this.parent().children(); +} + +// Get the current position siblings +function position() { + return this.parent().index(this); +} + +// Get the next element (will return null if there is none) +function next() { + return this.siblings()[this.position() + 1]; +} + +// Get the next element (will return null if there is none) +function prev() { + return this.siblings()[this.position() - 1]; +} + +// Send given element one step forward +function forward() { + const i = this.position(); + const p = this.parent(); + + // move node one step forward + p.add(this.remove(), i + 1); + return this; +} + +// Send given element one step backward +function backward() { + const i = this.position(); + const p = this.parent(); + p.add(this.remove(), i ? i - 1 : 0); + return this; +} + +// Send given element all the way to the front +function front() { + const p = this.parent(); + + // Move node forward + p.add(this.remove()); + return this; +} + +// Send given element all the way to the back +function back() { + const p = this.parent(); + + // Move node back + p.add(this.remove(), 0); + return this; +} + +// Inserts a given element before the targeted element +function before(element) { + element = makeInstance(element); + element.remove(); + const i = this.position(); + this.parent().add(element, i); + return this; +} + +// Inserts a given element after the targeted element +function after(element) { + element = makeInstance(element); + element.remove(); + const i = this.position(); + this.parent().add(element, i + 1); + return this; +} +function insertBefore(element) { + element = makeInstance(element); + element.before(this); + return this; +} +function insertAfter(element) { + element = makeInstance(element); + element.after(this); + return this; +} +registerMethods('Dom', { + siblings, + position, + next, + prev, + forward, + backward, + front, + back, + before, + after, + insertBefore, + insertAfter +}); + +// Parse unit value +const numberAndUnit = /^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i; + +// Parse hex value +const hex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i; + +// Parse rgb value +const rgb = /rgb\((\d+),(\d+),(\d+)\)/; + +// Parse reference id +const reference = /(#[a-z_][a-z0-9\-_]*)/i; + +// splits a transformation chain +const transforms = /\)\s*,?\s*/; + +// Whitespace +const whitespace = /\s/g; + +// Test hex value +const isHex = /^#[a-f0-9]{3}$|^#[a-f0-9]{6}$/i; + +// Test rgb value +const isRgb = /^rgb\(/; + +// Test for blank string +const isBlank = /^(\s+)?$/; + +// Test for numeric string +const isNumber = /^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i; + +// Test for image url +const isImage = /\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i; + +// split at whitespace and comma +const delimiter = /[\s,]+/; + +// Test for path letter +const isPathLetter = /[MLHVCSQTAZ]/i; + +var regex = { + __proto__: null, + delimiter: delimiter, + hex: hex, + isBlank: isBlank, + isHex: isHex, + isImage: isImage, + isNumber: isNumber, + isPathLetter: isPathLetter, + isRgb: isRgb, + numberAndUnit: numberAndUnit, + reference: reference, + rgb: rgb, + transforms: transforms, + whitespace: whitespace +}; + +// Return array of classes on the node +function classes() { + const attr = this.attr('class'); + return attr == null ? [] : attr.trim().split(delimiter); +} + +// Return true if class exists on the node, false otherwise +function hasClass(name) { + return this.classes().indexOf(name) !== -1; +} + +// Add class to the node +function addClass(name) { + if (!this.hasClass(name)) { + const array = this.classes(); + array.push(name); + this.attr('class', array.join(' ')); + } + return this; +} + +// Remove class from the node +function removeClass(name) { + if (this.hasClass(name)) { + this.attr('class', this.classes().filter(function (c) { + return c !== name; + }).join(' ')); + } + return this; +} + +// Toggle the presence of a class on the node +function toggleClass(name) { + return this.hasClass(name) ? this.removeClass(name) : this.addClass(name); +} +registerMethods('Dom', { + classes, + hasClass, + addClass, + removeClass, + toggleClass +}); + +// Dynamic style generator +function css(style, val) { + const ret = {}; + if (arguments.length === 0) { + // get full style as object + this.node.style.cssText.split(/\s*;\s*/).filter(function (el) { + return !!el.length; + }).forEach(function (el) { + const t = el.split(/\s*:\s*/); + ret[t[0]] = t[1]; + }); + return ret; + } + if (arguments.length < 2) { + // get style properties as array + if (Array.isArray(style)) { + for (const name of style) { + const cased = name; + ret[name] = this.node.style.getPropertyValue(cased); + } + return ret; + } + + // get style for property + if (typeof style === 'string') { + return this.node.style.getPropertyValue(style); + } + + // set styles in object + if (typeof style === 'object') { + for (const name in style) { + // set empty string if null/undefined/'' was given + this.node.style.setProperty(name, style[name] == null || isBlank.test(style[name]) ? '' : style[name]); + } + } + } + + // set style for property + if (arguments.length === 2) { + this.node.style.setProperty(style, val == null || isBlank.test(val) ? '' : val); + } + return this; +} + +// Show element +function show() { + return this.css('display', ''); +} + +// Hide element +function hide() { + return this.css('display', 'none'); +} + +// Is element visible? +function visible() { + return this.css('display') !== 'none'; +} +registerMethods('Dom', { + css, + show, + hide, + visible +}); + +// Store data values on svg nodes +function data(a, v, r) { + if (a == null) { + // get an object of attributes + return this.data(map(filter(this.node.attributes, el => el.nodeName.indexOf('data-') === 0), el => el.nodeName.slice(5))); + } else if (a instanceof Array) { + const data = {}; + for (const key of a) { + data[key] = this.data(key); + } + return data; + } else if (typeof a === 'object') { + for (v in a) { + this.data(v, a[v]); + } + } else if (arguments.length < 2) { + try { + return JSON.parse(this.attr('data-' + a)); + } catch (e) { + return this.attr('data-' + a); + } + } else { + this.attr('data-' + a, v === null ? null : r === true || typeof v === 'string' || typeof v === 'number' ? v : JSON.stringify(v)); + } + return this; +} +registerMethods('Dom', { + data +}); + +// Remember arbitrary data +function remember(k, v) { + // remember every item in an object individually + if (typeof arguments[0] === 'object') { + for (const key in k) { + this.remember(key, k[key]); + } + } else if (arguments.length === 1) { + // retrieve memory + return this.memory()[k]; + } else { + // store memory + this.memory()[k] = v; + } + return this; +} + +// Erase a given memory +function forget() { + if (arguments.length === 0) { + this._memory = {}; + } else { + for (let i = arguments.length - 1; i >= 0; i--) { + delete this.memory()[arguments[i]]; + } + } + return this; +} + +// This triggers creation of a new hidden class which is not performant +// However, this function is not rarely used so it will not happen frequently +// Return local memory object +function memory() { + return this._memory = this._memory || {}; +} +registerMethods('Dom', { + remember, + forget, + memory +}); + +function sixDigitHex(hex) { + return hex.length === 4 ? ['#', hex.substring(1, 2), hex.substring(1, 2), hex.substring(2, 3), hex.substring(2, 3), hex.substring(3, 4), hex.substring(3, 4)].join('') : hex; +} +function componentHex(component) { + const integer = Math.round(component); + const bounded = Math.max(0, Math.min(255, integer)); + const hex = bounded.toString(16); + return hex.length === 1 ? '0' + hex : hex; +} +function is(object, space) { + for (let i = space.length; i--;) { + if (object[space[i]] == null) { + return false; + } + } + return true; +} +function getParameters(a, b) { + const params = is(a, 'rgb') ? { + _a: a.r, + _b: a.g, + _c: a.b, + _d: 0, + space: 'rgb' + } : is(a, 'xyz') ? { + _a: a.x, + _b: a.y, + _c: a.z, + _d: 0, + space: 'xyz' + } : is(a, 'hsl') ? { + _a: a.h, + _b: a.s, + _c: a.l, + _d: 0, + space: 'hsl' + } : is(a, 'lab') ? { + _a: a.l, + _b: a.a, + _c: a.b, + _d: 0, + space: 'lab' + } : is(a, 'lch') ? { + _a: a.l, + _b: a.c, + _c: a.h, + _d: 0, + space: 'lch' + } : is(a, 'cmyk') ? { + _a: a.c, + _b: a.m, + _c: a.y, + _d: a.k, + space: 'cmyk' + } : { + _a: 0, + _b: 0, + _c: 0, + space: 'rgb' + }; + params.space = b || params.space; + return params; +} +function cieSpace(space) { + if (space === 'lab' || space === 'xyz' || space === 'lch') { + return true; + } else { + return false; + } +} +function hueToRgb(p, q, t) { + if (t < 0) t += 1; + if (t > 1) t -= 1; + if (t < 1 / 6) return p + (q - p) * 6 * t; + if (t < 1 / 2) return q; + if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6; + return p; +} +class Color { + constructor(...inputs) { + this.init(...inputs); + } + + // Test if given value is a color + static isColor(color) { + return color && (color instanceof Color || this.isRgb(color) || this.test(color)); + } + + // Test if given value is an rgb object + static isRgb(color) { + return color && typeof color.r === 'number' && typeof color.g === 'number' && typeof color.b === 'number'; + } + + /* + Generating random colors + */ + static random(mode = 'vibrant', t) { + // Get the math modules + const { + random, + round, + sin, + PI: pi + } = Math; + + // Run the correct generator + if (mode === 'vibrant') { + const l = (81 - 57) * random() + 57; + const c = (83 - 45) * random() + 45; + const h = 360 * random(); + const color = new Color(l, c, h, 'lch'); + return color; + } else if (mode === 'sine') { + t = t == null ? random() : t; + const r = round(80 * sin(2 * pi * t / 0.5 + 0.01) + 150); + const g = round(50 * sin(2 * pi * t / 0.5 + 4.6) + 200); + const b = round(100 * sin(2 * pi * t / 0.5 + 2.3) + 150); + const color = new Color(r, g, b); + return color; + } else if (mode === 'pastel') { + const l = (94 - 86) * random() + 86; + const c = (26 - 9) * random() + 9; + const h = 360 * random(); + const color = new Color(l, c, h, 'lch'); + return color; + } else if (mode === 'dark') { + const l = 10 + 10 * random(); + const c = (125 - 75) * random() + 86; + const h = 360 * random(); + const color = new Color(l, c, h, 'lch'); + return color; + } else if (mode === 'rgb') { + const r = 255 * random(); + const g = 255 * random(); + const b = 255 * random(); + const color = new Color(r, g, b); + return color; + } else if (mode === 'lab') { + const l = 100 * random(); + const a = 256 * random() - 128; + const b = 256 * random() - 128; + const color = new Color(l, a, b, 'lab'); + return color; + } else if (mode === 'grey') { + const grey = 255 * random(); + const color = new Color(grey, grey, grey); + return color; + } else { + throw new Error('Unsupported random color mode'); + } + } + + // Test if given value is a color string + static test(color) { + return typeof color === 'string' && (isHex.test(color) || isRgb.test(color)); + } + cmyk() { + // Get the rgb values for the current color + const { + _a, + _b, + _c + } = this.rgb(); + const [r, g, b] = [_a, _b, _c].map(v => v / 255); + + // Get the cmyk values in an unbounded format + const k = Math.min(1 - r, 1 - g, 1 - b); + if (k === 1) { + // Catch the black case + return new Color(0, 0, 0, 1, 'cmyk'); + } + const c = (1 - r - k) / (1 - k); + const m = (1 - g - k) / (1 - k); + const y = (1 - b - k) / (1 - k); + + // Construct the new color + const color = new Color(c, m, y, k, 'cmyk'); + return color; + } + hsl() { + // Get the rgb values + const { + _a, + _b, + _c + } = this.rgb(); + const [r, g, b] = [_a, _b, _c].map(v => v / 255); + + // Find the maximum and minimum values to get the lightness + const max = Math.max(r, g, b); + const min = Math.min(r, g, b); + const l = (max + min) / 2; + + // If the r, g, v values are identical then we are grey + const isGrey = max === min; + + // Calculate the hue and saturation + const delta = max - min; + const s = isGrey ? 0 : l > 0.5 ? delta / (2 - max - min) : delta / (max + min); + const h = isGrey ? 0 : max === r ? ((g - b) / delta + (g < b ? 6 : 0)) / 6 : max === g ? ((b - r) / delta + 2) / 6 : max === b ? ((r - g) / delta + 4) / 6 : 0; + + // Construct and return the new color + const color = new Color(360 * h, 100 * s, 100 * l, 'hsl'); + return color; + } + init(a = 0, b = 0, c = 0, d = 0, space = 'rgb') { + // This catches the case when a falsy value is passed like '' + a = !a ? 0 : a; + + // Reset all values in case the init function is rerun with new color space + if (this.space) { + for (const component in this.space) { + delete this[this.space[component]]; + } + } + if (typeof a === 'number') { + // Allow for the case that we don't need d... + space = typeof d === 'string' ? d : space; + d = typeof d === 'string' ? 0 : d; + + // Assign the values straight to the color + Object.assign(this, { + _a: a, + _b: b, + _c: c, + _d: d, + space + }); + // If the user gave us an array, make the color from it + } else if (a instanceof Array) { + this.space = b || (typeof a[3] === 'string' ? a[3] : a[4]) || 'rgb'; + Object.assign(this, { + _a: a[0], + _b: a[1], + _c: a[2], + _d: a[3] || 0 + }); + } else if (a instanceof Object) { + // Set the object up and assign its values directly + const values = getParameters(a, b); + Object.assign(this, values); + } else if (typeof a === 'string') { + if (isRgb.test(a)) { + const noWhitespace = a.replace(whitespace, ''); + const [_a, _b, _c] = rgb.exec(noWhitespace).slice(1, 4).map(v => parseInt(v)); + Object.assign(this, { + _a, + _b, + _c, + _d: 0, + space: 'rgb' + }); + } else if (isHex.test(a)) { + const hexParse = v => parseInt(v, 16); + const [, _a, _b, _c] = hex.exec(sixDigitHex(a)).map(hexParse); + Object.assign(this, { + _a, + _b, + _c, + _d: 0, + space: 'rgb' + }); + } else throw Error("Unsupported string format, can't construct Color"); + } + + // Now add the components as a convenience + const { + _a, + _b, + _c, + _d + } = this; + const components = this.space === 'rgb' ? { + r: _a, + g: _b, + b: _c + } : this.space === 'xyz' ? { + x: _a, + y: _b, + z: _c + } : this.space === 'hsl' ? { + h: _a, + s: _b, + l: _c + } : this.space === 'lab' ? { + l: _a, + a: _b, + b: _c + } : this.space === 'lch' ? { + l: _a, + c: _b, + h: _c + } : this.space === 'cmyk' ? { + c: _a, + m: _b, + y: _c, + k: _d + } : {}; + Object.assign(this, components); + } + lab() { + // Get the xyz color + const { + x, + y, + z + } = this.xyz(); + + // Get the lab components + const l = 116 * y - 16; + const a = 500 * (x - y); + const b = 200 * (y - z); + + // Construct and return a new color + const color = new Color(l, a, b, 'lab'); + return color; + } + lch() { + // Get the lab color directly + const { + l, + a, + b + } = this.lab(); + + // Get the chromaticity and the hue using polar coordinates + const c = Math.sqrt(a ** 2 + b ** 2); + let h = 180 * Math.atan2(b, a) / Math.PI; + if (h < 0) { + h *= -1; + h = 360 - h; + } + + // Make a new color and return it + const color = new Color(l, c, h, 'lch'); + return color; + } + /* + Conversion Methods + */ + + rgb() { + if (this.space === 'rgb') { + return this; + } else if (cieSpace(this.space)) { + // Convert to the xyz color space + let { + x, + y, + z + } = this; + if (this.space === 'lab' || this.space === 'lch') { + // Get the values in the lab space + let { + l, + a, + b + } = this; + if (this.space === 'lch') { + const { + c, + h + } = this; + const dToR = Math.PI / 180; + a = c * Math.cos(dToR * h); + b = c * Math.sin(dToR * h); + } + + // Undo the nonlinear function + const yL = (l + 16) / 116; + const xL = a / 500 + yL; + const zL = yL - b / 200; + + // Get the xyz values + const ct = 16 / 116; + const mx = 0.008856; + const nm = 7.787; + x = 0.95047 * (xL ** 3 > mx ? xL ** 3 : (xL - ct) / nm); + y = 1.0 * (yL ** 3 > mx ? yL ** 3 : (yL - ct) / nm); + z = 1.08883 * (zL ** 3 > mx ? zL ** 3 : (zL - ct) / nm); + } + + // Convert xyz to unbounded rgb values + const rU = x * 3.2406 + y * -1.5372 + z * -0.4986; + const gU = x * -0.9689 + y * 1.8758 + z * 0.0415; + const bU = x * 0.0557 + y * -0.204 + z * 1.057; + + // Convert the values to true rgb values + const pow = Math.pow; + const bd = 0.0031308; + const r = rU > bd ? 1.055 * pow(rU, 1 / 2.4) - 0.055 : 12.92 * rU; + const g = gU > bd ? 1.055 * pow(gU, 1 / 2.4) - 0.055 : 12.92 * gU; + const b = bU > bd ? 1.055 * pow(bU, 1 / 2.4) - 0.055 : 12.92 * bU; + + // Make and return the color + const color = new Color(255 * r, 255 * g, 255 * b); + return color; + } else if (this.space === 'hsl') { + // https://bgrins.github.io/TinyColor/docs/tinycolor.html + // Get the current hsl values + let { + h, + s, + l + } = this; + h /= 360; + s /= 100; + l /= 100; + + // If we are grey, then just make the color directly + if (s === 0) { + l *= 255; + const color = new Color(l, l, l); + return color; + } + + // TODO I have no idea what this does :D If you figure it out, tell me! + const q = l < 0.5 ? l * (1 + s) : l + s - l * s; + const p = 2 * l - q; + + // Get the rgb values + const r = 255 * hueToRgb(p, q, h + 1 / 3); + const g = 255 * hueToRgb(p, q, h); + const b = 255 * hueToRgb(p, q, h - 1 / 3); + + // Make a new color + const color = new Color(r, g, b); + return color; + } else if (this.space === 'cmyk') { + // https://gist.github.com/felipesabino/5066336 + // Get the normalised cmyk values + const { + c, + m, + y, + k + } = this; + + // Get the rgb values + const r = 255 * (1 - Math.min(1, c * (1 - k) + k)); + const g = 255 * (1 - Math.min(1, m * (1 - k) + k)); + const b = 255 * (1 - Math.min(1, y * (1 - k) + k)); + + // Form the color and return it + const color = new Color(r, g, b); + return color; + } else { + return this; + } + } + toArray() { + const { + _a, + _b, + _c, + _d, + space + } = this; + return [_a, _b, _c, _d, space]; + } + toHex() { + const [r, g, b] = this._clamped().map(componentHex); + return `#${r}${g}${b}`; + } + toRgb() { + const [rV, gV, bV] = this._clamped(); + const string = `rgb(${rV},${gV},${bV})`; + return string; + } + toString() { + return this.toHex(); + } + xyz() { + // Normalise the red, green and blue values + const { + _a: r255, + _b: g255, + _c: b255 + } = this.rgb(); + const [r, g, b] = [r255, g255, b255].map(v => v / 255); + + // Convert to the lab rgb space + const rL = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92; + const gL = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92; + const bL = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92; + + // Convert to the xyz color space without bounding the values + const xU = (rL * 0.4124 + gL * 0.3576 + bL * 0.1805) / 0.95047; + const yU = (rL * 0.2126 + gL * 0.7152 + bL * 0.0722) / 1.0; + const zU = (rL * 0.0193 + gL * 0.1192 + bL * 0.9505) / 1.08883; + + // Get the proper xyz values by applying the bounding + const x = xU > 0.008856 ? Math.pow(xU, 1 / 3) : 7.787 * xU + 16 / 116; + const y = yU > 0.008856 ? Math.pow(yU, 1 / 3) : 7.787 * yU + 16 / 116; + const z = zU > 0.008856 ? Math.pow(zU, 1 / 3) : 7.787 * zU + 16 / 116; + + // Make and return the color + const color = new Color(x, y, z, 'xyz'); + return color; + } + + /* + Input and Output methods + */ + + _clamped() { + const { + _a, + _b, + _c + } = this.rgb(); + const { + max, + min, + round + } = Math; + const format = v => max(0, min(round(v), 255)); + return [_a, _b, _c].map(format); + } + + /* + Constructing colors + */ +} + +class Point { + // Initialize + constructor(...args) { + this.init(...args); + } + + // Clone point + clone() { + return new Point(this); + } + init(x, y) { + const base = { + x: 0, + y: 0 + }; + + // ensure source as object + const source = Array.isArray(x) ? { + x: x[0], + y: x[1] + } : typeof x === 'object' ? { + x: x.x, + y: x.y + } : { + x: x, + y: y + }; + + // merge source + this.x = source.x == null ? base.x : source.x; + this.y = source.y == null ? base.y : source.y; + return this; + } + toArray() { + return [this.x, this.y]; + } + transform(m) { + return this.clone().transformO(m); + } + + // Transform point with matrix + transformO(m) { + if (!Matrix.isMatrixLike(m)) { + m = new Matrix(m); + } + const { + x, + y + } = this; + + // Perform the matrix multiplication + this.x = m.a * x + m.c * y + m.e; + this.y = m.b * x + m.d * y + m.f; + return this; + } +} +function point(x, y) { + return new Point(x, y).transformO(this.screenCTM().inverseO()); +} + +function closeEnough(a, b, threshold) { + return Math.abs(b - a) < (1e-6); +} +class Matrix { + constructor(...args) { + this.init(...args); + } + static formatTransforms(o) { + // Get all of the parameters required to form the matrix + const flipBoth = o.flip === 'both' || o.flip === true; + const flipX = o.flip && (flipBoth || o.flip === 'x') ? -1 : 1; + const flipY = o.flip && (flipBoth || o.flip === 'y') ? -1 : 1; + const skewX = o.skew && o.skew.length ? o.skew[0] : isFinite(o.skew) ? o.skew : isFinite(o.skewX) ? o.skewX : 0; + const skewY = o.skew && o.skew.length ? o.skew[1] : isFinite(o.skew) ? o.skew : isFinite(o.skewY) ? o.skewY : 0; + const scaleX = o.scale && o.scale.length ? o.scale[0] * flipX : isFinite(o.scale) ? o.scale * flipX : isFinite(o.scaleX) ? o.scaleX * flipX : flipX; + const scaleY = o.scale && o.scale.length ? o.scale[1] * flipY : isFinite(o.scale) ? o.scale * flipY : isFinite(o.scaleY) ? o.scaleY * flipY : flipY; + const shear = o.shear || 0; + const theta = o.rotate || o.theta || 0; + const origin = new Point(o.origin || o.around || o.ox || o.originX, o.oy || o.originY); + const ox = origin.x; + const oy = origin.y; + // We need Point to be invalid if nothing was passed because we cannot default to 0 here. That is why NaN + const position = new Point(o.position || o.px || o.positionX || NaN, o.py || o.positionY || NaN); + const px = position.x; + const py = position.y; + const translate = new Point(o.translate || o.tx || o.translateX, o.ty || o.translateY); + const tx = translate.x; + const ty = translate.y; + const relative = new Point(o.relative || o.rx || o.relativeX, o.ry || o.relativeY); + const rx = relative.x; + const ry = relative.y; + + // Populate all of the values + return { + scaleX, + scaleY, + skewX, + skewY, + shear, + theta, + rx, + ry, + tx, + ty, + ox, + oy, + px, + py + }; + } + static fromArray(a) { + return { + a: a[0], + b: a[1], + c: a[2], + d: a[3], + e: a[4], + f: a[5] + }; + } + static isMatrixLike(o) { + return o.a != null || o.b != null || o.c != null || o.d != null || o.e != null || o.f != null; + } + + // left matrix, right matrix, target matrix which is overwritten + static matrixMultiply(l, r, o) { + // Work out the product directly + const a = l.a * r.a + l.c * r.b; + const b = l.b * r.a + l.d * r.b; + const c = l.a * r.c + l.c * r.d; + const d = l.b * r.c + l.d * r.d; + const e = l.e + l.a * r.e + l.c * r.f; + const f = l.f + l.b * r.e + l.d * r.f; + + // make sure to use local variables because l/r and o could be the same + o.a = a; + o.b = b; + o.c = c; + o.d = d; + o.e = e; + o.f = f; + return o; + } + around(cx, cy, matrix) { + return this.clone().aroundO(cx, cy, matrix); + } + + // Transform around a center point + aroundO(cx, cy, matrix) { + const dx = cx || 0; + const dy = cy || 0; + return this.translateO(-dx, -dy).lmultiplyO(matrix).translateO(dx, dy); + } + + // Clones this matrix + clone() { + return new Matrix(this); + } + + // Decomposes this matrix into its affine parameters + decompose(cx = 0, cy = 0) { + // Get the parameters from the matrix + const a = this.a; + const b = this.b; + const c = this.c; + const d = this.d; + const e = this.e; + const f = this.f; + + // Figure out if the winding direction is clockwise or counterclockwise + const determinant = a * d - b * c; + const ccw = determinant > 0 ? 1 : -1; + + // Since we only shear in x, we can use the x basis to get the x scale + // and the rotation of the resulting matrix + const sx = ccw * Math.sqrt(a * a + b * b); + const thetaRad = Math.atan2(ccw * b, ccw * a); + const theta = 180 / Math.PI * thetaRad; + const ct = Math.cos(thetaRad); + const st = Math.sin(thetaRad); + + // We can then solve the y basis vector simultaneously to get the other + // two affine parameters directly from these parameters + const lam = (a * c + b * d) / determinant; + const sy = c * sx / (lam * a - b) || d * sx / (lam * b + a); + + // Use the translations + const tx = e - cx + cx * ct * sx + cy * (lam * ct * sx - st * sy); + const ty = f - cy + cx * st * sx + cy * (lam * st * sx + ct * sy); + + // Construct the decomposition and return it + return { + // Return the affine parameters + scaleX: sx, + scaleY: sy, + shear: lam, + rotate: theta, + translateX: tx, + translateY: ty, + originX: cx, + originY: cy, + // Return the matrix parameters + a: this.a, + b: this.b, + c: this.c, + d: this.d, + e: this.e, + f: this.f + }; + } + + // Check if two matrices are equal + equals(other) { + if (other === this) return true; + const comp = new Matrix(other); + return closeEnough(this.a, comp.a) && closeEnough(this.b, comp.b) && closeEnough(this.c, comp.c) && closeEnough(this.d, comp.d) && closeEnough(this.e, comp.e) && closeEnough(this.f, comp.f); + } + + // Flip matrix on x or y, at a given offset + flip(axis, around) { + return this.clone().flipO(axis, around); + } + flipO(axis, around) { + return axis === 'x' ? this.scaleO(-1, 1, around, 0) : axis === 'y' ? this.scaleO(1, -1, 0, around) : this.scaleO(-1, -1, axis, around || axis); // Define an x, y flip point + } + + // Initialize + init(source) { + const base = Matrix.fromArray([1, 0, 0, 1, 0, 0]); + + // ensure source as object + source = source instanceof Element ? source.matrixify() : typeof source === 'string' ? Matrix.fromArray(source.split(delimiter).map(parseFloat)) : Array.isArray(source) ? Matrix.fromArray(source) : typeof source === 'object' && Matrix.isMatrixLike(source) ? source : typeof source === 'object' ? new Matrix().transform(source) : arguments.length === 6 ? Matrix.fromArray([].slice.call(arguments)) : base; + + // Merge the source matrix with the base matrix + this.a = source.a != null ? source.a : base.a; + this.b = source.b != null ? source.b : base.b; + this.c = source.c != null ? source.c : base.c; + this.d = source.d != null ? source.d : base.d; + this.e = source.e != null ? source.e : base.e; + this.f = source.f != null ? source.f : base.f; + return this; + } + inverse() { + return this.clone().inverseO(); + } + + // Inverses matrix + inverseO() { + // Get the current parameters out of the matrix + const a = this.a; + const b = this.b; + const c = this.c; + const d = this.d; + const e = this.e; + const f = this.f; + + // Invert the 2x2 matrix in the top left + const det = a * d - b * c; + if (!det) throw new Error('Cannot invert ' + this); + + // Calculate the top 2x2 matrix + const na = d / det; + const nb = -b / det; + const nc = -c / det; + const nd = a / det; + + // Apply the inverted matrix to the top right + const ne = -(na * e + nc * f); + const nf = -(nb * e + nd * f); + + // Construct the inverted matrix + this.a = na; + this.b = nb; + this.c = nc; + this.d = nd; + this.e = ne; + this.f = nf; + return this; + } + lmultiply(matrix) { + return this.clone().lmultiplyO(matrix); + } + lmultiplyO(matrix) { + const r = this; + const l = matrix instanceof Matrix ? matrix : new Matrix(matrix); + return Matrix.matrixMultiply(l, r, this); + } + + // Left multiplies by the given matrix + multiply(matrix) { + return this.clone().multiplyO(matrix); + } + multiplyO(matrix) { + // Get the matrices + const l = this; + const r = matrix instanceof Matrix ? matrix : new Matrix(matrix); + return Matrix.matrixMultiply(l, r, this); + } + + // Rotate matrix + rotate(r, cx, cy) { + return this.clone().rotateO(r, cx, cy); + } + rotateO(r, cx = 0, cy = 0) { + // Convert degrees to radians + r = radians(r); + const cos = Math.cos(r); + const sin = Math.sin(r); + const { + a, + b, + c, + d, + e, + f + } = this; + this.a = a * cos - b * sin; + this.b = b * cos + a * sin; + this.c = c * cos - d * sin; + this.d = d * cos + c * sin; + this.e = e * cos - f * sin + cy * sin - cx * cos + cx; + this.f = f * cos + e * sin - cx * sin - cy * cos + cy; + return this; + } + + // Scale matrix + scale() { + return this.clone().scaleO(...arguments); + } + scaleO(x, y = x, cx = 0, cy = 0) { + // Support uniform scaling + if (arguments.length === 3) { + cy = cx; + cx = y; + y = x; + } + const { + a, + b, + c, + d, + e, + f + } = this; + this.a = a * x; + this.b = b * y; + this.c = c * x; + this.d = d * y; + this.e = e * x - cx * x + cx; + this.f = f * y - cy * y + cy; + return this; + } + + // Shear matrix + shear(a, cx, cy) { + return this.clone().shearO(a, cx, cy); + } + + // eslint-disable-next-line no-unused-vars + shearO(lx, cx = 0, cy = 0) { + const { + a, + b, + c, + d, + e, + f + } = this; + this.a = a + b * lx; + this.c = c + d * lx; + this.e = e + f * lx - cy * lx; + return this; + } + + // Skew Matrix + skew() { + return this.clone().skewO(...arguments); + } + skewO(x, y = x, cx = 0, cy = 0) { + // support uniformal skew + if (arguments.length === 3) { + cy = cx; + cx = y; + y = x; + } + + // Convert degrees to radians + x = radians(x); + y = radians(y); + const lx = Math.tan(x); + const ly = Math.tan(y); + const { + a, + b, + c, + d, + e, + f + } = this; + this.a = a + b * lx; + this.b = b + a * ly; + this.c = c + d * lx; + this.d = d + c * ly; + this.e = e + f * lx - cy * lx; + this.f = f + e * ly - cx * ly; + return this; + } + + // SkewX + skewX(x, cx, cy) { + return this.skew(x, 0, cx, cy); + } + + // SkewY + skewY(y, cx, cy) { + return this.skew(0, y, cx, cy); + } + toArray() { + return [this.a, this.b, this.c, this.d, this.e, this.f]; + } + + // Convert matrix to string + toString() { + return 'matrix(' + this.a + ',' + this.b + ',' + this.c + ',' + this.d + ',' + this.e + ',' + this.f + ')'; + } + + // Transform a matrix into another matrix by manipulating the space + transform(o) { + // Check if o is a matrix and then left multiply it directly + if (Matrix.isMatrixLike(o)) { + const matrix = new Matrix(o); + return matrix.multiplyO(this); + } + + // Get the proposed transformations and the current transformations + const t = Matrix.formatTransforms(o); + const current = this; + const { + x: ox, + y: oy + } = new Point(t.ox, t.oy).transform(current); + + // Construct the resulting matrix + const transformer = new Matrix().translateO(t.rx, t.ry).lmultiplyO(current).translateO(-ox, -oy).scaleO(t.scaleX, t.scaleY).skewO(t.skewX, t.skewY).shearO(t.shear).rotateO(t.theta).translateO(ox, oy); + + // If we want the origin at a particular place, we force it there + if (isFinite(t.px) || isFinite(t.py)) { + const origin = new Point(ox, oy).transform(transformer); + // TODO: Replace t.px with isFinite(t.px) + // Doesn't work because t.px is also 0 if it wasn't passed + const dx = isFinite(t.px) ? t.px - origin.x : 0; + const dy = isFinite(t.py) ? t.py - origin.y : 0; + transformer.translateO(dx, dy); + } + + // Translate now after positioning + transformer.translateO(t.tx, t.ty); + return transformer; + } + + // Translate matrix + translate(x, y) { + return this.clone().translateO(x, y); + } + translateO(x, y) { + this.e += x || 0; + this.f += y || 0; + return this; + } + valueOf() { + return { + a: this.a, + b: this.b, + c: this.c, + d: this.d, + e: this.e, + f: this.f + }; + } +} +function ctm() { + return new Matrix(this.node.getCTM()); +} +function screenCTM() { + try { + /* https://bugzilla.mozilla.org/show_bug.cgi?id=1344537 + This is needed because FF does not return the transformation matrix + for the inner coordinate system when getScreenCTM() is called on nested svgs. + However all other Browsers do that */ + if (typeof this.isRoot === 'function' && !this.isRoot()) { + const rect = this.rect(1, 1); + const m = rect.node.getScreenCTM(); + rect.remove(); + return new Matrix(m); + } + return new Matrix(this.node.getScreenCTM()); + } catch (e) { + console.warn(`Cannot get CTM from SVG node ${this.node.nodeName}. Is the element rendered?`); + return new Matrix(); + } +} +register(Matrix, 'Matrix'); + +function parser() { + // Reuse cached element if possible + if (!parser.nodes) { + const svg = makeInstance().size(2, 0); + svg.node.style.cssText = ['opacity: 0', 'position: absolute', 'left: -100%', 'top: -100%', 'overflow: hidden'].join(';'); + svg.attr('focusable', 'false'); + svg.attr('aria-hidden', 'true'); + const path = svg.path().node; + parser.nodes = { + svg, + path + }; + } + if (!parser.nodes.svg.node.parentNode) { + const b = globals.document.body || globals.document.documentElement; + parser.nodes.svg.addTo(b); + } + return parser.nodes; +} + +function isNulledBox(box) { + return !box.width && !box.height && !box.x && !box.y; +} +function domContains(node) { + return node === globals.document || (globals.document.documentElement.contains || function (node) { + // This is IE - it does not support contains() for top-level SVGs + while (node.parentNode) { + node = node.parentNode; + } + return node === globals.document; + }).call(globals.document.documentElement, node); +} +class Box { + constructor(...args) { + this.init(...args); + } + addOffset() { + // offset by window scroll position, because getBoundingClientRect changes when window is scrolled + this.x += globals.window.pageXOffset; + this.y += globals.window.pageYOffset; + return new Box(this); + } + init(source) { + const base = [0, 0, 0, 0]; + source = typeof source === 'string' ? source.split(delimiter).map(parseFloat) : Array.isArray(source) ? source : typeof source === 'object' ? [source.left != null ? source.left : source.x, source.top != null ? source.top : source.y, source.width, source.height] : arguments.length === 4 ? [].slice.call(arguments) : base; + this.x = source[0] || 0; + this.y = source[1] || 0; + this.width = this.w = source[2] || 0; + this.height = this.h = source[3] || 0; + + // Add more bounding box properties + this.x2 = this.x + this.w; + this.y2 = this.y + this.h; + this.cx = this.x + this.w / 2; + this.cy = this.y + this.h / 2; + return this; + } + isNulled() { + return isNulledBox(this); + } + + // Merge rect box with another, return a new instance + merge(box) { + const x = Math.min(this.x, box.x); + const y = Math.min(this.y, box.y); + const width = Math.max(this.x + this.width, box.x + box.width) - x; + const height = Math.max(this.y + this.height, box.y + box.height) - y; + return new Box(x, y, width, height); + } + toArray() { + return [this.x, this.y, this.width, this.height]; + } + toString() { + return this.x + ' ' + this.y + ' ' + this.width + ' ' + this.height; + } + transform(m) { + if (!(m instanceof Matrix)) { + m = new Matrix(m); + } + let xMin = Infinity; + let xMax = -Infinity; + let yMin = Infinity; + let yMax = -Infinity; + const pts = [new Point(this.x, this.y), new Point(this.x2, this.y), new Point(this.x, this.y2), new Point(this.x2, this.y2)]; + pts.forEach(function (p) { + p = p.transform(m); + xMin = Math.min(xMin, p.x); + xMax = Math.max(xMax, p.x); + yMin = Math.min(yMin, p.y); + yMax = Math.max(yMax, p.y); + }); + return new Box(xMin, yMin, xMax - xMin, yMax - yMin); + } +} +function getBox(el, getBBoxFn, retry) { + let box; + try { + // Try to get the box with the provided function + box = getBBoxFn(el.node); + + // If the box is worthless and not even in the dom, retry + // by throwing an error here... + if (isNulledBox(box) && !domContains(el.node)) { + throw new Error('Element not in the dom'); + } + } catch (e) { + // ... and calling the retry handler here + box = retry(el); + } + return box; +} +function bbox() { + // Function to get bbox is getBBox() + const getBBox = node => node.getBBox(); + + // Take all measures so that a stupid browser renders the element + // so we can get the bbox from it when we try again + const retry = el => { + try { + const clone = el.clone().addTo(parser().svg).show(); + const box = clone.node.getBBox(); + clone.remove(); + return box; + } catch (e) { + // We give up... + throw new Error(`Getting bbox of element "${el.node.nodeName}" is not possible: ${e.toString()}`); + } + }; + const box = getBox(this, getBBox, retry); + const bbox = new Box(box); + return bbox; +} +function rbox(el) { + const getRBox = node => node.getBoundingClientRect(); + const retry = el => { + // There is no point in trying tricks here because if we insert the element into the dom ourselves + // it obviously will be at the wrong position + throw new Error(`Getting rbox of element "${el.node.nodeName}" is not possible`); + }; + const box = getBox(this, getRBox, retry); + const rbox = new Box(box); + + // If an element was passed, we want the bbox in the coordinate system of that element + if (el) { + return rbox.transform(el.screenCTM().inverseO()); + } + + // Else we want it in absolute screen coordinates + // Therefore we need to add the scrollOffset + return rbox.addOffset(); +} + +// Checks whether the given point is inside the bounding box +function inside(x, y) { + const box = this.bbox(); + return x > box.x && y > box.y && x < box.x + box.width && y < box.y + box.height; +} +registerMethods({ + viewbox: { + viewbox(x, y, width, height) { + // act as getter + if (x == null) return new Box(this.attr('viewBox')); + + // act as setter + return this.attr('viewBox', new Box(x, y, width, height)); + }, + zoom(level, point) { + // Its best to rely on the attributes here and here is why: + // clientXYZ: Doesn't work on non-root svgs because they dont have a CSSBox (silly!) + // getBoundingClientRect: Doesn't work because Chrome just ignores width and height of nested svgs completely + // that means, their clientRect is always as big as the content. + // Furthermore this size is incorrect if the element is further transformed by its parents + // computedStyle: Only returns meaningful values if css was used with px. We dont go this route here! + // getBBox: returns the bounding box of its content - that doesn't help! + let { + width, + height + } = this.attr(['width', 'height']); + + // Width and height is a string when a number with a unit is present which we can't use + // So we try clientXYZ + if (!width && !height || typeof width === 'string' || typeof height === 'string') { + width = this.node.clientWidth; + height = this.node.clientHeight; + } + + // Giving up... + if (!width || !height) { + throw new Error('Impossible to get absolute width and height. Please provide an absolute width and height attribute on the zooming element'); + } + const v = this.viewbox(); + const zoomX = width / v.width; + const zoomY = height / v.height; + const zoom = Math.min(zoomX, zoomY); + if (level == null) { + return zoom; + } + let zoomAmount = zoom / level; + + // Set the zoomAmount to the highest value which is safe to process and recover from + // The * 100 is a bit of wiggle room for the matrix transformation + if (zoomAmount === Infinity) zoomAmount = Number.MAX_SAFE_INTEGER / 100; + point = point || new Point(width / 2 / zoomX + v.x, height / 2 / zoomY + v.y); + const box = new Box(v).transform(new Matrix({ + scale: zoomAmount, + origin: point + })); + return this.viewbox(box); + } + } +}); +register(Box, 'Box'); + +// import { subClassArray } from './ArrayPolyfill.js' + +class List extends Array { + constructor(arr = [], ...args) { + super(arr, ...args); + if (typeof arr === 'number') return this; + this.length = 0; + this.push(...arr); + } +} +extend([List], { + each(fnOrMethodName, ...args) { + if (typeof fnOrMethodName === 'function') { + return this.map((el, i, arr) => { + return fnOrMethodName.call(el, el, i, arr); + }); + } else { + return this.map(el => { + return el[fnOrMethodName](...args); + }); + } + }, + toArray() { + return Array.prototype.concat.apply([], this); + } +}); +const reserved = ['toArray', 'constructor', 'each']; +List.extend = function (methods) { + methods = methods.reduce((obj, name) => { + // Don't overwrite own methods + if (reserved.includes(name)) return obj; + + // Don't add private methods + if (name[0] === '_') return obj; + + // Allow access to original Array methods through a prefix + if (name in Array.prototype) { + obj['$' + name] = Array.prototype[name]; + } + + // Relay every call to each() + obj[name] = function (...attrs) { + return this.each(name, ...attrs); + }; + return obj; + }, {}); + extend([List], methods); +}; + +function baseFind(query, parent) { + return new List(map((parent || globals.document).querySelectorAll(query), function (node) { + return adopt(node); + })); +} + +// Scoped find method +function find(query) { + return baseFind(query, this.node); +} +function findOne(query) { + return adopt(this.node.querySelector(query)); +} + +let listenerId = 0; +const windowEvents = {}; +function getEvents(instance) { + let n = instance.getEventHolder(); + + // We dont want to save events in global space + if (n === globals.window) n = windowEvents; + if (!n.events) n.events = {}; + return n.events; +} +function getEventTarget(instance) { + return instance.getEventTarget(); +} +function clearEvents(instance) { + let n = instance.getEventHolder(); + if (n === globals.window) n = windowEvents; + if (n.events) n.events = {}; +} + +// Add event binder in the SVG namespace +function on(node, events, listener, binding, options) { + const l = listener.bind(binding || node); + const instance = makeInstance(node); + const bag = getEvents(instance); + const n = getEventTarget(instance); + + // events can be an array of events or a string of events + events = Array.isArray(events) ? events : events.split(delimiter); + + // add id to listener + if (!listener._svgjsListenerId) { + listener._svgjsListenerId = ++listenerId; + } + events.forEach(function (event) { + const ev = event.split('.')[0]; + const ns = event.split('.')[1] || '*'; + + // ensure valid object + bag[ev] = bag[ev] || {}; + bag[ev][ns] = bag[ev][ns] || {}; + + // reference listener + bag[ev][ns][listener._svgjsListenerId] = l; + + // add listener + n.addEventListener(ev, l, options || false); + }); +} + +// Add event unbinder in the SVG namespace +function off(node, events, listener, options) { + const instance = makeInstance(node); + const bag = getEvents(instance); + const n = getEventTarget(instance); + + // listener can be a function or a number + if (typeof listener === 'function') { + listener = listener._svgjsListenerId; + if (!listener) return; + } + + // events can be an array of events or a string or undefined + events = Array.isArray(events) ? events : (events || '').split(delimiter); + events.forEach(function (event) { + const ev = event && event.split('.')[0]; + const ns = event && event.split('.')[1]; + let namespace, l; + if (listener) { + // remove listener reference + if (bag[ev] && bag[ev][ns || '*']) { + // removeListener + n.removeEventListener(ev, bag[ev][ns || '*'][listener], options || false); + delete bag[ev][ns || '*'][listener]; + } + } else if (ev && ns) { + // remove all listeners for a namespaced event + if (bag[ev] && bag[ev][ns]) { + for (l in bag[ev][ns]) { + off(n, [ev, ns].join('.'), l); + } + delete bag[ev][ns]; + } + } else if (ns) { + // remove all listeners for a specific namespace + for (event in bag) { + for (namespace in bag[event]) { + if (ns === namespace) { + off(n, [event, ns].join('.')); + } + } + } + } else if (ev) { + // remove all listeners for the event + if (bag[ev]) { + for (namespace in bag[ev]) { + off(n, [ev, namespace].join('.')); + } + delete bag[ev]; + } + } else { + // remove all listeners on a given node + for (event in bag) { + off(n, event); + } + clearEvents(instance); + } + }); +} +function dispatch(node, event, data, options) { + const n = getEventTarget(node); + + // Dispatch event + if (event instanceof globals.window.Event) { + n.dispatchEvent(event); + } else { + event = new globals.window.CustomEvent(event, { + detail: data, + cancelable: true, + ...options + }); + n.dispatchEvent(event); + } + return event; +} + +class EventTarget extends Base { + addEventListener() {} + dispatch(event, data, options) { + return dispatch(this, event, data, options); + } + dispatchEvent(event) { + const bag = this.getEventHolder().events; + if (!bag) return true; + const events = bag[event.type]; + for (const i in events) { + for (const j in events[i]) { + events[i][j](event); + } + } + return !event.defaultPrevented; + } + + // Fire given event + fire(event, data, options) { + this.dispatch(event, data, options); + return this; + } + getEventHolder() { + return this; + } + getEventTarget() { + return this; + } + + // Unbind event from listener + off(event, listener, options) { + off(this, event, listener, options); + return this; + } + + // Bind given event to listener + on(event, listener, binding, options) { + on(this, event, listener, binding, options); + return this; + } + removeEventListener() {} +} +register(EventTarget, 'EventTarget'); + +function noop() {} + +// Default animation values +const timeline = { + duration: 400, + ease: '>', + delay: 0 +}; + +// Default attribute values +const attrs = { + // fill and stroke + 'fill-opacity': 1, + 'stroke-opacity': 1, + 'stroke-width': 0, + 'stroke-linejoin': 'miter', + 'stroke-linecap': 'butt', + fill: '#000000', + stroke: '#000000', + opacity: 1, + // position + x: 0, + y: 0, + cx: 0, + cy: 0, + // size + width: 0, + height: 0, + // radius + r: 0, + rx: 0, + ry: 0, + // gradient + offset: 0, + 'stop-opacity': 1, + 'stop-color': '#000000', + // text + 'text-anchor': 'start' +}; + +var defaults = { + __proto__: null, + attrs: attrs, + noop: noop, + timeline: timeline +}; + +class SVGArray extends Array { + constructor(...args) { + super(...args); + this.init(...args); + } + clone() { + return new this.constructor(this); + } + init(arr) { + // This catches the case, that native map tries to create an array with new Array(1) + if (typeof arr === 'number') return this; + this.length = 0; + this.push(...this.parse(arr)); + return this; + } + + // Parse whitespace separated string + parse(array = []) { + // If already is an array, no need to parse it + if (array instanceof Array) return array; + return array.trim().split(delimiter).map(parseFloat); + } + toArray() { + return Array.prototype.concat.apply([], this); + } + toSet() { + return new Set(this); + } + toString() { + return this.join(' '); + } + + // Flattens the array if needed + valueOf() { + const ret = []; + ret.push(...this); + return ret; + } +} + +// Module for unit conversions +class SVGNumber { + // Initialize + constructor(...args) { + this.init(...args); + } + convert(unit) { + return new SVGNumber(this.value, unit); + } + + // Divide number + divide(number) { + number = new SVGNumber(number); + return new SVGNumber(this / number, this.unit || number.unit); + } + init(value, unit) { + unit = Array.isArray(value) ? value[1] : unit; + value = Array.isArray(value) ? value[0] : value; + + // initialize defaults + this.value = 0; + this.unit = unit || ''; + + // parse value + if (typeof value === 'number') { + // ensure a valid numeric value + this.value = isNaN(value) ? 0 : !isFinite(value) ? value < 0 ? -3.4e38 : +3.4e38 : value; + } else if (typeof value === 'string') { + unit = value.match(numberAndUnit); + if (unit) { + // make value numeric + this.value = parseFloat(unit[1]); + + // normalize + if (unit[5] === '%') { + this.value /= 100; + } else if (unit[5] === 's') { + this.value *= 1000; + } + + // store unit + this.unit = unit[5]; + } + } else { + if (value instanceof SVGNumber) { + this.value = value.valueOf(); + this.unit = value.unit; + } + } + return this; + } + + // Subtract number + minus(number) { + number = new SVGNumber(number); + return new SVGNumber(this - number, this.unit || number.unit); + } + + // Add number + plus(number) { + number = new SVGNumber(number); + return new SVGNumber(this + number, this.unit || number.unit); + } + + // Multiply number + times(number) { + number = new SVGNumber(number); + return new SVGNumber(this * number, this.unit || number.unit); + } + toArray() { + return [this.value, this.unit]; + } + toJSON() { + return this.toString(); + } + toString() { + return (this.unit === '%' ? ~~(this.value * 1e8) / 1e6 : this.unit === 's' ? this.value / 1e3 : this.value) + this.unit; + } + valueOf() { + return this.value; + } +} + +const colorAttributes = new Set(['fill', 'stroke', 'color', 'bgcolor', 'stop-color', 'flood-color', 'lighting-color']); +const hooks = []; +function registerAttrHook(fn) { + hooks.push(fn); +} + +// Set svg element attribute +function attr(attr, val, ns) { + // act as full getter + if (attr == null) { + // get an object of attributes + attr = {}; + val = this.node.attributes; + for (const node of val) { + attr[node.nodeName] = isNumber.test(node.nodeValue) ? parseFloat(node.nodeValue) : node.nodeValue; + } + return attr; + } else if (attr instanceof Array) { + // loop through array and get all values + return attr.reduce((last, curr) => { + last[curr] = this.attr(curr); + return last; + }, {}); + } else if (typeof attr === 'object' && attr.constructor === Object) { + // apply every attribute individually if an object is passed + for (val in attr) this.attr(val, attr[val]); + } else if (val === null) { + // remove value + this.node.removeAttribute(attr); + } else if (val == null) { + // act as a getter if the first and only argument is not an object + val = this.node.getAttribute(attr); + return val == null ? attrs[attr] : isNumber.test(val) ? parseFloat(val) : val; + } else { + // Loop through hooks and execute them to convert value + val = hooks.reduce((_val, hook) => { + return hook(attr, _val, this); + }, val); + + // ensure correct numeric values (also accepts NaN and Infinity) + if (typeof val === 'number') { + val = new SVGNumber(val); + } else if (colorAttributes.has(attr) && Color.isColor(val)) { + // ensure full hex color + val = new Color(val); + } else if (val.constructor === Array) { + // Check for plain arrays and parse array values + val = new SVGArray(val); + } + + // if the passed attribute is leading... + if (attr === 'leading') { + // ... call the leading method instead + if (this.leading) { + this.leading(val); + } + } else { + // set given attribute on node + typeof ns === 'string' ? this.node.setAttributeNS(ns, attr, val.toString()) : this.node.setAttribute(attr, val.toString()); + } + + // rebuild if required + if (this.rebuild && (attr === 'font-size' || attr === 'x')) { + this.rebuild(); + } + } + return this; +} + +class Dom extends EventTarget { + constructor(node, attrs) { + super(); + this.node = node; + this.type = node.nodeName; + if (attrs && node !== attrs) { + this.attr(attrs); + } + } + + // Add given element at a position + add(element, i) { + element = makeInstance(element); + + // If non-root svg nodes are added we have to remove their namespaces + if (element.removeNamespace && this.node instanceof globals.window.SVGElement) { + element.removeNamespace(); + } + if (i == null) { + this.node.appendChild(element.node); + } else if (element.node !== this.node.childNodes[i]) { + this.node.insertBefore(element.node, this.node.childNodes[i]); + } + return this; + } + + // Add element to given container and return self + addTo(parent, i) { + return makeInstance(parent).put(this, i); + } + + // Returns all child elements + children() { + return new List(map(this.node.children, function (node) { + return adopt(node); + })); + } + + // Remove all elements in this container + clear() { + // remove children + while (this.node.hasChildNodes()) { + this.node.removeChild(this.node.lastChild); + } + return this; + } + + // Clone element + clone(deep = true, assignNewIds = true) { + // write dom data to the dom so the clone can pickup the data + this.writeDataToDom(); + + // clone element + let nodeClone = this.node.cloneNode(deep); + if (assignNewIds) { + // assign new id + nodeClone = assignNewId(nodeClone); + } + return new this.constructor(nodeClone); + } + + // Iterates over all children and invokes a given block + each(block, deep) { + const children = this.children(); + let i, il; + for (i = 0, il = children.length; i < il; i++) { + block.apply(children[i], [i, children]); + if (deep) { + children[i].each(block, deep); + } + } + return this; + } + element(nodeName, attrs) { + return this.put(new Dom(create(nodeName), attrs)); + } + + // Get first child + first() { + return adopt(this.node.firstChild); + } + + // Get a element at the given index + get(i) { + return adopt(this.node.childNodes[i]); + } + getEventHolder() { + return this.node; + } + getEventTarget() { + return this.node; + } + + // Checks if the given element is a child + has(element) { + return this.index(element) >= 0; + } + html(htmlOrFn, outerHTML) { + return this.xml(htmlOrFn, outerHTML, html); + } + + // Get / set id + id(id) { + // generate new id if no id set + if (typeof id === 'undefined' && !this.node.id) { + this.node.id = eid(this.type); + } + + // don't set directly with this.node.id to make `null` work correctly + return this.attr('id', id); + } + + // Gets index of given element + index(element) { + return [].slice.call(this.node.childNodes).indexOf(element.node); + } + + // Get the last child + last() { + return adopt(this.node.lastChild); + } + + // matches the element vs a css selector + matches(selector) { + const el = this.node; + const matcher = el.matches || el.matchesSelector || el.msMatchesSelector || el.mozMatchesSelector || el.webkitMatchesSelector || el.oMatchesSelector || null; + return matcher && matcher.call(el, selector); + } + + // Returns the parent element instance + parent(type) { + let parent = this; + + // check for parent + if (!parent.node.parentNode) return null; + + // get parent element + parent = adopt(parent.node.parentNode); + if (!type) return parent; + + // loop through ancestors if type is given + do { + if (typeof type === 'string' ? parent.matches(type) : parent instanceof type) return parent; + } while (parent = adopt(parent.node.parentNode)); + return parent; + } + + // Basically does the same as `add()` but returns the added element instead + put(element, i) { + element = makeInstance(element); + this.add(element, i); + return element; + } + + // Add element to given container and return container + putIn(parent, i) { + return makeInstance(parent).add(this, i); + } + + // Remove element + remove() { + if (this.parent()) { + this.parent().removeElement(this); + } + return this; + } + + // Remove a given child + removeElement(element) { + this.node.removeChild(element.node); + return this; + } + + // Replace this with element + replace(element) { + element = makeInstance(element); + if (this.node.parentNode) { + this.node.parentNode.replaceChild(element.node, this.node); + } + return element; + } + round(precision = 2, map = null) { + const factor = 10 ** precision; + const attrs = this.attr(map); + for (const i in attrs) { + if (typeof attrs[i] === 'number') { + attrs[i] = Math.round(attrs[i] * factor) / factor; + } + } + this.attr(attrs); + return this; + } + + // Import / Export raw svg + svg(svgOrFn, outerSVG) { + return this.xml(svgOrFn, outerSVG, svg); + } + + // Return id on string conversion + toString() { + return this.id(); + } + words(text) { + // This is faster than removing all children and adding a new one + this.node.textContent = text; + return this; + } + wrap(node) { + const parent = this.parent(); + if (!parent) { + return this.addTo(node); + } + const position = parent.index(this); + return parent.put(node, position).put(this); + } + + // write svgjs data to the dom + writeDataToDom() { + // dump variables recursively + this.each(function () { + this.writeDataToDom(); + }); + return this; + } + + // Import / Export raw svg + xml(xmlOrFn, outerXML, ns) { + if (typeof xmlOrFn === 'boolean') { + ns = outerXML; + outerXML = xmlOrFn; + xmlOrFn = null; + } + + // act as getter if no svg string is given + if (xmlOrFn == null || typeof xmlOrFn === 'function') { + // The default for exports is, that the outerNode is included + outerXML = outerXML == null ? true : outerXML; + + // write svgjs data to the dom + this.writeDataToDom(); + let current = this; + + // An export modifier was passed + if (xmlOrFn != null) { + current = adopt(current.node.cloneNode(true)); + + // If the user wants outerHTML we need to process this node, too + if (outerXML) { + const result = xmlOrFn(current); + current = result || current; + + // The user does not want this node? Well, then he gets nothing + if (result === false) return ''; + } + + // Deep loop through all children and apply modifier + current.each(function () { + const result = xmlOrFn(this); + const _this = result || this; + + // If modifier returns false, discard node + if (result === false) { + this.remove(); + + // If modifier returns new node, use it + } else if (result && this !== _this) { + this.replace(_this); + } + }, true); + } + + // Return outer or inner content + return outerXML ? current.node.outerHTML : current.node.innerHTML; + } + + // Act as setter if we got a string + + // The default for import is, that the current node is not replaced + outerXML = outerXML == null ? false : outerXML; + + // Create temporary holder + const well = create('wrapper', ns); + const fragment = globals.document.createDocumentFragment(); + + // Dump raw svg + well.innerHTML = xmlOrFn; + + // Transplant nodes into the fragment + for (let len = well.children.length; len--;) { + fragment.appendChild(well.firstElementChild); + } + const parent = this.parent(); + + // Add the whole fragment at once + return outerXML ? this.replace(fragment) && parent : this.add(fragment); + } +} +extend(Dom, { + attr, + find, + findOne +}); +register(Dom, 'Dom'); + +class Element extends Dom { + constructor(node, attrs) { + super(node, attrs); + + // initialize data object + this.dom = {}; + + // create circular reference + this.node.instance = this; + if (node.hasAttribute('data-svgjs') || node.hasAttribute('svgjs:data')) { + // pull svgjs data from the dom (getAttributeNS doesn't work in html5) + this.setData(JSON.parse(node.getAttribute('data-svgjs')) ?? JSON.parse(node.getAttribute('svgjs:data')) ?? {}); + } + } + + // Move element by its center + center(x, y) { + return this.cx(x).cy(y); + } + + // Move by center over x-axis + cx(x) { + return x == null ? this.x() + this.width() / 2 : this.x(x - this.width() / 2); + } + + // Move by center over y-axis + cy(y) { + return y == null ? this.y() + this.height() / 2 : this.y(y - this.height() / 2); + } + + // Get defs + defs() { + const root = this.root(); + return root && root.defs(); + } + + // Relative move over x and y axes + dmove(x, y) { + return this.dx(x).dy(y); + } + + // Relative move over x axis + dx(x = 0) { + return this.x(new SVGNumber(x).plus(this.x())); + } + + // Relative move over y axis + dy(y = 0) { + return this.y(new SVGNumber(y).plus(this.y())); + } + getEventHolder() { + return this; + } + + // Set height of element + height(height) { + return this.attr('height', height); + } + + // Move element to given x and y values + move(x, y) { + return this.x(x).y(y); + } + + // return array of all ancestors of given type up to the root svg + parents(until = this.root()) { + const isSelector = typeof until === 'string'; + if (!isSelector) { + until = makeInstance(until); + } + const parents = new List(); + let parent = this; + while ((parent = parent.parent()) && parent.node !== globals.document && parent.nodeName !== '#document-fragment') { + parents.push(parent); + if (!isSelector && parent.node === until.node) { + break; + } + if (isSelector && parent.matches(until)) { + break; + } + if (parent.node === this.root().node) { + // We worked our way to the root and didn't match `until` + return null; + } + } + return parents; + } + + // Get referenced element form attribute value + reference(attr) { + attr = this.attr(attr); + if (!attr) return null; + const m = (attr + '').match(reference); + return m ? makeInstance(m[1]) : null; + } + + // Get parent document + root() { + const p = this.parent(getClass(root)); + return p && p.root(); + } + + // set given data to the elements data property + setData(o) { + this.dom = o; + return this; + } + + // Set element size to given width and height + size(width, height) { + const p = proportionalSize(this, width, height); + return this.width(new SVGNumber(p.width)).height(new SVGNumber(p.height)); + } + + // Set width of element + width(width) { + return this.attr('width', width); + } + + // write svgjs data to the dom + writeDataToDom() { + writeDataToDom(this, this.dom); + return super.writeDataToDom(); + } + + // Move over x-axis + x(x) { + return this.attr('x', x); + } + + // Move over y-axis + y(y) { + return this.attr('y', y); + } +} +extend(Element, { + bbox, + rbox, + inside, + point, + ctm, + screenCTM +}); +register(Element, 'Element'); + +// Define list of available attributes for stroke and fill +const sugar = { + stroke: ['color', 'width', 'opacity', 'linecap', 'linejoin', 'miterlimit', 'dasharray', 'dashoffset'], + fill: ['color', 'opacity', 'rule'], + prefix: function (t, a) { + return a === 'color' ? t : t + '-' + a; + } +} + +// Add sugar for fill and stroke +; +['fill', 'stroke'].forEach(function (m) { + const extension = {}; + let i; + extension[m] = function (o) { + if (typeof o === 'undefined') { + return this.attr(m); + } + if (typeof o === 'string' || o instanceof Color || Color.isRgb(o) || o instanceof Element) { + this.attr(m, o); + } else { + // set all attributes from sugar.fill and sugar.stroke list + for (i = sugar[m].length - 1; i >= 0; i--) { + if (o[sugar[m][i]] != null) { + this.attr(sugar.prefix(m, sugar[m][i]), o[sugar[m][i]]); + } + } + } + return this; + }; + registerMethods(['Element', 'Runner'], extension); +}); +registerMethods(['Element', 'Runner'], { + // Let the user set the matrix directly + matrix: function (mat, b, c, d, e, f) { + // Act as a getter + if (mat == null) { + return new Matrix(this); + } + + // Act as a setter, the user can pass a matrix or a set of numbers + return this.attr('transform', new Matrix(mat, b, c, d, e, f)); + }, + // Map rotation to transform + rotate: function (angle, cx, cy) { + return this.transform({ + rotate: angle, + ox: cx, + oy: cy + }, true); + }, + // Map skew to transform + skew: function (x, y, cx, cy) { + return arguments.length === 1 || arguments.length === 3 ? this.transform({ + skew: x, + ox: y, + oy: cx + }, true) : this.transform({ + skew: [x, y], + ox: cx, + oy: cy + }, true); + }, + shear: function (lam, cx, cy) { + return this.transform({ + shear: lam, + ox: cx, + oy: cy + }, true); + }, + // Map scale to transform + scale: function (x, y, cx, cy) { + return arguments.length === 1 || arguments.length === 3 ? this.transform({ + scale: x, + ox: y, + oy: cx + }, true) : this.transform({ + scale: [x, y], + ox: cx, + oy: cy + }, true); + }, + // Map translate to transform + translate: function (x, y) { + return this.transform({ + translate: [x, y] + }, true); + }, + // Map relative translations to transform + relative: function (x, y) { + return this.transform({ + relative: [x, y] + }, true); + }, + // Map flip to transform + flip: function (direction = 'both', origin = 'center') { + if ('xybothtrue'.indexOf(direction) === -1) { + origin = direction; + direction = 'both'; + } + return this.transform({ + flip: direction, + origin: origin + }, true); + }, + // Opacity + opacity: function (value) { + return this.attr('opacity', value); + } +}); +registerMethods('radius', { + // Add x and y radius + radius: function (x, y = x) { + const type = (this._element || this).type; + return type === 'radialGradient' ? this.attr('r', new SVGNumber(x)) : this.rx(x).ry(y); + } +}); +registerMethods('Path', { + // Get path length + length: function () { + return this.node.getTotalLength(); + }, + // Get point at length + pointAt: function (length) { + return new Point(this.node.getPointAtLength(length)); + } +}); +registerMethods(['Element', 'Runner'], { + // Set font + font: function (a, v) { + if (typeof a === 'object') { + for (v in a) this.font(v, a[v]); + return this; + } + return a === 'leading' ? this.leading(v) : a === 'anchor' ? this.attr('text-anchor', v) : a === 'size' || a === 'family' || a === 'weight' || a === 'stretch' || a === 'variant' || a === 'style' ? this.attr('font-' + a, v) : this.attr(a, v); + } +}); + +// Add events to elements +const methods = ['click', 'dblclick', 'mousedown', 'mouseup', 'mouseover', 'mouseout', 'mousemove', 'mouseenter', 'mouseleave', 'touchstart', 'touchmove', 'touchleave', 'touchend', 'touchcancel', 'contextmenu', 'wheel', 'pointerdown', 'pointermove', 'pointerup', 'pointerleave', 'pointercancel'].reduce(function (last, event) { + // add event to Element + const fn = function (f) { + if (f === null) { + this.off(event); + } else { + this.on(event, f); + } + return this; + }; + last[event] = fn; + return last; +}, {}); +registerMethods('Element', methods); + +// Reset all transformations +function untransform() { + return this.attr('transform', null); +} + +// merge the whole transformation chain into one matrix and returns it +function matrixify() { + const matrix = (this.attr('transform') || '' + // split transformations + ).split(transforms).slice(0, -1).map(function (str) { + // generate key => value pairs + const kv = str.trim().split('('); + return [kv[0], kv[1].split(delimiter).map(function (str) { + return parseFloat(str); + })]; + }).reverse() + // merge every transformation into one matrix + .reduce(function (matrix, transform) { + if (transform[0] === 'matrix') { + return matrix.lmultiply(Matrix.fromArray(transform[1])); + } + return matrix[transform[0]].apply(matrix, transform[1]); + }, new Matrix()); + return matrix; +} + +// add an element to another parent without changing the visual representation on the screen +function toParent(parent, i) { + if (this === parent) return this; + if (isDescriptive(this.node)) return this.addTo(parent, i); + const ctm = this.screenCTM(); + const pCtm = parent.screenCTM().inverse(); + this.addTo(parent, i).untransform().transform(pCtm.multiply(ctm)); + return this; +} + +// same as above with parent equals root-svg +function toRoot(i) { + return this.toParent(this.root(), i); +} + +// Add transformations +function transform(o, relative) { + // Act as a getter if no object was passed + if (o == null || typeof o === 'string') { + const decomposed = new Matrix(this).decompose(); + return o == null ? decomposed : decomposed[o]; + } + if (!Matrix.isMatrixLike(o)) { + // Set the origin according to the defined transform + o = { + ...o, + origin: getOrigin(o, this) + }; + } + + // The user can pass a boolean, an Element or an Matrix or nothing + const cleanRelative = relative === true ? this : relative || false; + const result = new Matrix(cleanRelative).transform(o); + return this.attr('transform', result); +} +registerMethods('Element', { + untransform, + matrixify, + toParent, + toRoot, + transform +}); + +class Container extends Element { + flatten() { + this.each(function () { + if (this instanceof Container) { + return this.flatten().ungroup(); + } + }); + return this; + } + ungroup(parent = this.parent(), index = parent.index(this)) { + // when parent != this, we want append all elements to the end + index = index === -1 ? parent.children().length : index; + this.each(function (i, children) { + // reverse each + return children[children.length - i - 1].toParent(parent, index); + }); + return this.remove(); + } +} +register(Container, 'Container'); + +class Defs extends Container { + constructor(node, attrs = node) { + super(nodeOrNew('defs', node), attrs); + } + flatten() { + return this; + } + ungroup() { + return this; + } +} +register(Defs, 'Defs'); + +class Shape extends Element {} +register(Shape, 'Shape'); + +// Radius x value +function rx(rx) { + return this.attr('rx', rx); +} + +// Radius y value +function ry(ry) { + return this.attr('ry', ry); +} + +// Move over x-axis +function x$3(x) { + return x == null ? this.cx() - this.rx() : this.cx(x + this.rx()); +} + +// Move over y-axis +function y$3(y) { + return y == null ? this.cy() - this.ry() : this.cy(y + this.ry()); +} + +// Move by center over x-axis +function cx$1(x) { + return this.attr('cx', x); +} + +// Move by center over y-axis +function cy$1(y) { + return this.attr('cy', y); +} + +// Set width of element +function width$2(width) { + return width == null ? this.rx() * 2 : this.rx(new SVGNumber(width).divide(2)); +} + +// Set height of element +function height$2(height) { + return height == null ? this.ry() * 2 : this.ry(new SVGNumber(height).divide(2)); +} + +var circled = { + __proto__: null, + cx: cx$1, + cy: cy$1, + height: height$2, + rx: rx, + ry: ry, + width: width$2, + x: x$3, + y: y$3 +}; + +class Ellipse extends Shape { + constructor(node, attrs = node) { + super(nodeOrNew('ellipse', node), attrs); + } + size(width, height) { + const p = proportionalSize(this, width, height); + return this.rx(new SVGNumber(p.width).divide(2)).ry(new SVGNumber(p.height).divide(2)); + } +} +extend(Ellipse, circled); +registerMethods('Container', { + // Create an ellipse + ellipse: wrapWithAttrCheck(function (width = 0, height = width) { + return this.put(new Ellipse()).size(width, height).move(0, 0); + }) +}); +register(Ellipse, 'Ellipse'); + +class Fragment extends Dom { + constructor(node = globals.document.createDocumentFragment()) { + super(node); + } + + // Import / Export raw xml + xml(xmlOrFn, outerXML, ns) { + if (typeof xmlOrFn === 'boolean') { + ns = outerXML; + outerXML = xmlOrFn; + xmlOrFn = null; + } + + // because this is a fragment we have to put all elements into a wrapper first + // before we can get the innerXML from it + if (xmlOrFn == null || typeof xmlOrFn === 'function') { + const wrapper = new Dom(create('wrapper', ns)); + wrapper.add(this.node.cloneNode(true)); + return wrapper.xml(false, ns); + } + + // Act as setter if we got a string + return super.xml(xmlOrFn, false, ns); + } +} +register(Fragment, 'Fragment'); + +function from(x, y) { + return (this._element || this).type === 'radialGradient' ? this.attr({ + fx: new SVGNumber(x), + fy: new SVGNumber(y) + }) : this.attr({ + x1: new SVGNumber(x), + y1: new SVGNumber(y) + }); +} +function to(x, y) { + return (this._element || this).type === 'radialGradient' ? this.attr({ + cx: new SVGNumber(x), + cy: new SVGNumber(y) + }) : this.attr({ + x2: new SVGNumber(x), + y2: new SVGNumber(y) + }); +} + +var gradiented = { + __proto__: null, + from: from, + to: to +}; + +class Gradient extends Container { + constructor(type, attrs) { + super(nodeOrNew(type + 'Gradient', typeof type === 'string' ? null : type), attrs); + } + + // custom attr to handle transform + attr(a, b, c) { + if (a === 'transform') a = 'gradientTransform'; + return super.attr(a, b, c); + } + bbox() { + return new Box(); + } + targets() { + return baseFind('svg [fill*=' + this.id() + ']'); + } + + // Alias string conversion to fill + toString() { + return this.url(); + } + + // Update gradient + update(block) { + // remove all stops + this.clear(); + + // invoke passed block + if (typeof block === 'function') { + block.call(this, this); + } + return this; + } + + // Return the fill id + url() { + return 'url(#' + this.id() + ')'; + } +} +extend(Gradient, gradiented); +registerMethods({ + Container: { + // Create gradient element in defs + gradient(...args) { + return this.defs().gradient(...args); + } + }, + // define gradient + Defs: { + gradient: wrapWithAttrCheck(function (type, block) { + return this.put(new Gradient(type)).update(block); + }) + } +}); +register(Gradient, 'Gradient'); + +class Pattern extends Container { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('pattern', node), attrs); + } + + // custom attr to handle transform + attr(a, b, c) { + if (a === 'transform') a = 'patternTransform'; + return super.attr(a, b, c); + } + bbox() { + return new Box(); + } + targets() { + return baseFind('svg [fill*=' + this.id() + ']'); + } + + // Alias string conversion to fill + toString() { + return this.url(); + } + + // Update pattern by rebuilding + update(block) { + // remove content + this.clear(); + + // invoke passed block + if (typeof block === 'function') { + block.call(this, this); + } + return this; + } + + // Return the fill id + url() { + return 'url(#' + this.id() + ')'; + } +} +registerMethods({ + Container: { + // Create pattern element in defs + pattern(...args) { + return this.defs().pattern(...args); + } + }, + Defs: { + pattern: wrapWithAttrCheck(function (width, height, block) { + return this.put(new Pattern()).update(block).attr({ + x: 0, + y: 0, + width: width, + height: height, + patternUnits: 'userSpaceOnUse' + }); + }) + } +}); +register(Pattern, 'Pattern'); + +class Image extends Shape { + constructor(node, attrs = node) { + super(nodeOrNew('image', node), attrs); + } + + // (re)load image + load(url, callback) { + if (!url) return this; + const img = new globals.window.Image(); + on(img, 'load', function (e) { + const p = this.parent(Pattern); + + // ensure image size + if (this.width() === 0 && this.height() === 0) { + this.size(img.width, img.height); + } + if (p instanceof Pattern) { + // ensure pattern size if not set + if (p.width() === 0 && p.height() === 0) { + p.size(this.width(), this.height()); + } + } + if (typeof callback === 'function') { + callback.call(this, e); + } + }, this); + on(img, 'load error', function () { + // dont forget to unbind memory leaking events + off(img); + }); + return this.attr('href', img.src = url, xlink); + } +} +registerAttrHook(function (attr, val, _this) { + // convert image fill and stroke to patterns + if (attr === 'fill' || attr === 'stroke') { + if (isImage.test(val)) { + val = _this.root().defs().image(val); + } + } + if (val instanceof Image) { + val = _this.root().defs().pattern(0, 0, pattern => { + pattern.add(val); + }); + } + return val; +}); +registerMethods({ + Container: { + // create image element, load image and set its size + image: wrapWithAttrCheck(function (source, callback) { + return this.put(new Image()).size(0, 0).load(source, callback); + }) + } +}); +register(Image, 'Image'); + +class PointArray extends SVGArray { + // Get bounding box of points + bbox() { + let maxX = -Infinity; + let maxY = -Infinity; + let minX = Infinity; + let minY = Infinity; + this.forEach(function (el) { + maxX = Math.max(el[0], maxX); + maxY = Math.max(el[1], maxY); + minX = Math.min(el[0], minX); + minY = Math.min(el[1], minY); + }); + return new Box(minX, minY, maxX - minX, maxY - minY); + } + + // Move point string + move(x, y) { + const box = this.bbox(); + + // get relative offset + x -= box.x; + y -= box.y; + + // move every point + if (!isNaN(x) && !isNaN(y)) { + for (let i = this.length - 1; i >= 0; i--) { + this[i] = [this[i][0] + x, this[i][1] + y]; + } + } + return this; + } + + // Parse point string and flat array + parse(array = [0, 0]) { + const points = []; + + // if it is an array, we flatten it and therefore clone it to 1 depths + if (array instanceof Array) { + array = Array.prototype.concat.apply([], array); + } else { + // Else, it is considered as a string + // parse points + array = array.trim().split(delimiter).map(parseFloat); + } + + // validate points - https://svgwg.org/svg2-draft/shapes.html#DataTypePoints + // Odd number of coordinates is an error. In such cases, drop the last odd coordinate. + if (array.length % 2 !== 0) array.pop(); + + // wrap points in two-tuples + for (let i = 0, len = array.length; i < len; i = i + 2) { + points.push([array[i], array[i + 1]]); + } + return points; + } + + // Resize poly string + size(width, height) { + let i; + const box = this.bbox(); + + // recalculate position of all points according to new size + for (i = this.length - 1; i >= 0; i--) { + if (box.width) this[i][0] = (this[i][0] - box.x) * width / box.width + box.x; + if (box.height) this[i][1] = (this[i][1] - box.y) * height / box.height + box.y; + } + return this; + } + + // Convert array to line object + toLine() { + return { + x1: this[0][0], + y1: this[0][1], + x2: this[1][0], + y2: this[1][1] + }; + } + + // Convert array to string + toString() { + const array = []; + // convert to a poly point string + for (let i = 0, il = this.length; i < il; i++) { + array.push(this[i].join(',')); + } + return array.join(' '); + } + transform(m) { + return this.clone().transformO(m); + } + + // transform points with matrix (similar to Point.transform) + transformO(m) { + if (!Matrix.isMatrixLike(m)) { + m = new Matrix(m); + } + for (let i = this.length; i--;) { + // Perform the matrix multiplication + const [x, y] = this[i]; + this[i][0] = m.a * x + m.c * y + m.e; + this[i][1] = m.b * x + m.d * y + m.f; + } + return this; + } +} + +const MorphArray = PointArray; + +// Move by left top corner over x-axis +function x$2(x) { + return x == null ? this.bbox().x : this.move(x, this.bbox().y); +} + +// Move by left top corner over y-axis +function y$2(y) { + return y == null ? this.bbox().y : this.move(this.bbox().x, y); +} + +// Set width of element +function width$1(width) { + const b = this.bbox(); + return width == null ? b.width : this.size(width, b.height); +} + +// Set height of element +function height$1(height) { + const b = this.bbox(); + return height == null ? b.height : this.size(b.width, height); +} + +var pointed = { + __proto__: null, + MorphArray: MorphArray, + height: height$1, + width: width$1, + x: x$2, + y: y$2 +}; + +class Line extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('line', node), attrs); + } + + // Get array + array() { + return new PointArray([[this.attr('x1'), this.attr('y1')], [this.attr('x2'), this.attr('y2')]]); + } + + // Move by left top corner + move(x, y) { + return this.attr(this.array().move(x, y).toLine()); + } + + // Overwrite native plot() method + plot(x1, y1, x2, y2) { + if (x1 == null) { + return this.array(); + } else if (typeof y1 !== 'undefined') { + x1 = { + x1, + y1, + x2, + y2 + }; + } else { + x1 = new PointArray(x1).toLine(); + } + return this.attr(x1); + } + + // Set element size to given width and height + size(width, height) { + const p = proportionalSize(this, width, height); + return this.attr(this.array().size(p.width, p.height).toLine()); + } +} +extend(Line, pointed); +registerMethods({ + Container: { + // Create a line element + line: wrapWithAttrCheck(function (...args) { + // make sure plot is called as a setter + // x1 is not necessarily a number, it can also be an array, a string and a PointArray + return Line.prototype.plot.apply(this.put(new Line()), args[0] != null ? args : [0, 0, 0, 0]); + }) + } +}); +register(Line, 'Line'); + +class Marker extends Container { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('marker', node), attrs); + } + + // Set height of element + height(height) { + return this.attr('markerHeight', height); + } + orient(orient) { + return this.attr('orient', orient); + } + + // Set marker refX and refY + ref(x, y) { + return this.attr('refX', x).attr('refY', y); + } + + // Return the fill id + toString() { + return 'url(#' + this.id() + ')'; + } + + // Update marker + update(block) { + // remove all content + this.clear(); + + // invoke passed block + if (typeof block === 'function') { + block.call(this, this); + } + return this; + } + + // Set width of element + width(width) { + return this.attr('markerWidth', width); + } +} +registerMethods({ + Container: { + marker(...args) { + // Create marker element in defs + return this.defs().marker(...args); + } + }, + Defs: { + // Create marker + marker: wrapWithAttrCheck(function (width, height, block) { + // Set default viewbox to match the width and height, set ref to cx and cy and set orient to auto + return this.put(new Marker()).size(width, height).ref(width / 2, height / 2).viewbox(0, 0, width, height).attr('orient', 'auto').update(block); + }) + }, + marker: { + // Create and attach markers + marker(marker, width, height, block) { + let attr = ['marker']; + + // Build attribute name + if (marker !== 'all') attr.push(marker); + attr = attr.join('-'); + + // Set marker attribute + marker = arguments[1] instanceof Marker ? arguments[1] : this.defs().marker(width, height, block); + return this.attr(attr, marker); + } + } +}); +register(Marker, 'Marker'); + +/*** +Base Class +========== +The base stepper class that will be +***/ + +function makeSetterGetter(k, f) { + return function (v) { + if (v == null) return this[k]; + this[k] = v; + if (f) f.call(this); + return this; + }; +} +const easing = { + '-': function (pos) { + return pos; + }, + '<>': function (pos) { + return -Math.cos(pos * Math.PI) / 2 + 0.5; + }, + '>': function (pos) { + return Math.sin(pos * Math.PI / 2); + }, + '<': function (pos) { + return -Math.cos(pos * Math.PI / 2) + 1; + }, + bezier: function (x1, y1, x2, y2) { + // see https://www.w3.org/TR/css-easing-1/#cubic-bezier-algo + return function (t) { + if (t < 0) { + if (x1 > 0) { + return y1 / x1 * t; + } else if (x2 > 0) { + return y2 / x2 * t; + } else { + return 0; + } + } else if (t > 1) { + if (x2 < 1) { + return (1 - y2) / (1 - x2) * t + (y2 - x2) / (1 - x2); + } else if (x1 < 1) { + return (1 - y1) / (1 - x1) * t + (y1 - x1) / (1 - x1); + } else { + return 1; + } + } else { + return 3 * t * (1 - t) ** 2 * y1 + 3 * t ** 2 * (1 - t) * y2 + t ** 3; + } + }; + }, + // see https://www.w3.org/TR/css-easing-1/#step-timing-function-algo + steps: function (steps, stepPosition = 'end') { + // deal with "jump-" prefix + stepPosition = stepPosition.split('-').reverse()[0]; + let jumps = steps; + if (stepPosition === 'none') { + --jumps; + } else if (stepPosition === 'both') { + ++jumps; + } + + // The beforeFlag is essentially useless + return (t, beforeFlag = false) => { + // Step is called currentStep in referenced url + let step = Math.floor(t * steps); + const jumping = t * step % 1 === 0; + if (stepPosition === 'start' || stepPosition === 'both') { + ++step; + } + if (beforeFlag && jumping) { + --step; + } + if (t >= 0 && step < 0) { + step = 0; + } + if (t <= 1 && step > jumps) { + step = jumps; + } + return step / jumps; + }; + } +}; +class Stepper { + done() { + return false; + } +} + +/*** +Easing Functions +================ +***/ + +class Ease extends Stepper { + constructor(fn = timeline.ease) { + super(); + this.ease = easing[fn] || fn; + } + step(from, to, pos) { + if (typeof from !== 'number') { + return pos < 1 ? from : to; + } + return from + (to - from) * this.ease(pos); + } +} + +/*** +Controller Types +================ +***/ + +class Controller extends Stepper { + constructor(fn) { + super(); + this.stepper = fn; + } + done(c) { + return c.done; + } + step(current, target, dt, c) { + return this.stepper(current, target, dt, c); + } +} +function recalculate() { + // Apply the default parameters + const duration = (this._duration || 500) / 1000; + const overshoot = this._overshoot || 0; + + // Calculate the PID natural response + const eps = 1e-10; + const pi = Math.PI; + const os = Math.log(overshoot / 100 + eps); + const zeta = -os / Math.sqrt(pi * pi + os * os); + const wn = 3.9 / (zeta * duration); + + // Calculate the Spring values + this.d = 2 * zeta * wn; + this.k = wn * wn; +} +class Spring extends Controller { + constructor(duration = 500, overshoot = 0) { + super(); + this.duration(duration).overshoot(overshoot); + } + step(current, target, dt, c) { + if (typeof current === 'string') return current; + c.done = dt === Infinity; + if (dt === Infinity) return target; + if (dt === 0) return current; + if (dt > 100) dt = 16; + dt /= 1000; + + // Get the previous velocity + const velocity = c.velocity || 0; + + // Apply the control to get the new position and store it + const acceleration = -this.d * velocity - this.k * (current - target); + const newPosition = current + velocity * dt + acceleration * dt * dt / 2; + + // Store the velocity + c.velocity = velocity + acceleration * dt; + + // Figure out if we have converged, and if so, pass the value + c.done = Math.abs(target - newPosition) + Math.abs(velocity) < 0.002; + return c.done ? target : newPosition; + } +} +extend(Spring, { + duration: makeSetterGetter('_duration', recalculate), + overshoot: makeSetterGetter('_overshoot', recalculate) +}); +class PID extends Controller { + constructor(p = 0.1, i = 0.01, d = 0, windup = 1000) { + super(); + this.p(p).i(i).d(d).windup(windup); + } + step(current, target, dt, c) { + if (typeof current === 'string') return current; + c.done = dt === Infinity; + if (dt === Infinity) return target; + if (dt === 0) return current; + const p = target - current; + let i = (c.integral || 0) + p * dt; + const d = (p - (c.error || 0)) / dt; + const windup = this._windup; + + // antiwindup + if (windup !== false) { + i = Math.max(-windup, Math.min(i, windup)); + } + c.error = p; + c.integral = i; + c.done = Math.abs(p) < 0.001; + return c.done ? target : current + (this.P * p + this.I * i + this.D * d); + } +} +extend(PID, { + windup: makeSetterGetter('_windup'), + p: makeSetterGetter('P'), + i: makeSetterGetter('I'), + d: makeSetterGetter('D') +}); + +const segmentParameters = { + M: 2, + L: 2, + H: 1, + V: 1, + C: 6, + S: 4, + Q: 4, + T: 2, + A: 7, + Z: 0 +}; +const pathHandlers = { + M: function (c, p, p0) { + p.x = p0.x = c[0]; + p.y = p0.y = c[1]; + return ['M', p.x, p.y]; + }, + L: function (c, p) { + p.x = c[0]; + p.y = c[1]; + return ['L', c[0], c[1]]; + }, + H: function (c, p) { + p.x = c[0]; + return ['H', c[0]]; + }, + V: function (c, p) { + p.y = c[0]; + return ['V', c[0]]; + }, + C: function (c, p) { + p.x = c[4]; + p.y = c[5]; + return ['C', c[0], c[1], c[2], c[3], c[4], c[5]]; + }, + S: function (c, p) { + p.x = c[2]; + p.y = c[3]; + return ['S', c[0], c[1], c[2], c[3]]; + }, + Q: function (c, p) { + p.x = c[2]; + p.y = c[3]; + return ['Q', c[0], c[1], c[2], c[3]]; + }, + T: function (c, p) { + p.x = c[0]; + p.y = c[1]; + return ['T', c[0], c[1]]; + }, + Z: function (c, p, p0) { + p.x = p0.x; + p.y = p0.y; + return ['Z']; + }, + A: function (c, p) { + p.x = c[5]; + p.y = c[6]; + return ['A', c[0], c[1], c[2], c[3], c[4], c[5], c[6]]; + } +}; +const mlhvqtcsaz = 'mlhvqtcsaz'.split(''); +for (let i = 0, il = mlhvqtcsaz.length; i < il; ++i) { + pathHandlers[mlhvqtcsaz[i]] = function (i) { + return function (c, p, p0) { + if (i === 'H') c[0] = c[0] + p.x;else if (i === 'V') c[0] = c[0] + p.y;else if (i === 'A') { + c[5] = c[5] + p.x; + c[6] = c[6] + p.y; + } else { + for (let j = 0, jl = c.length; j < jl; ++j) { + c[j] = c[j] + (j % 2 ? p.y : p.x); + } + } + return pathHandlers[i](c, p, p0); + }; + }(mlhvqtcsaz[i].toUpperCase()); +} +function makeAbsolut(parser) { + const command = parser.segment[0]; + return pathHandlers[command](parser.segment.slice(1), parser.p, parser.p0); +} +function segmentComplete(parser) { + return parser.segment.length && parser.segment.length - 1 === segmentParameters[parser.segment[0].toUpperCase()]; +} +function startNewSegment(parser, token) { + parser.inNumber && finalizeNumber(parser, false); + const pathLetter = isPathLetter.test(token); + if (pathLetter) { + parser.segment = [token]; + } else { + const lastCommand = parser.lastCommand; + const small = lastCommand.toLowerCase(); + const isSmall = lastCommand === small; + parser.segment = [small === 'm' ? isSmall ? 'l' : 'L' : lastCommand]; + } + parser.inSegment = true; + parser.lastCommand = parser.segment[0]; + return pathLetter; +} +function finalizeNumber(parser, inNumber) { + if (!parser.inNumber) throw new Error('Parser Error'); + parser.number && parser.segment.push(parseFloat(parser.number)); + parser.inNumber = inNumber; + parser.number = ''; + parser.pointSeen = false; + parser.hasExponent = false; + if (segmentComplete(parser)) { + finalizeSegment(parser); + } +} +function finalizeSegment(parser) { + parser.inSegment = false; + if (parser.absolute) { + parser.segment = makeAbsolut(parser); + } + parser.segments.push(parser.segment); +} +function isArcFlag(parser) { + if (!parser.segment.length) return false; + const isArc = parser.segment[0].toUpperCase() === 'A'; + const length = parser.segment.length; + return isArc && (length === 4 || length === 5); +} +function isExponential(parser) { + return parser.lastToken.toUpperCase() === 'E'; +} +const pathDelimiters = new Set([' ', ',', '\t', '\n', '\r', '\f']); +function pathParser(d, toAbsolute = true) { + let index = 0; + let token = ''; + const parser = { + segment: [], + inNumber: false, + number: '', + lastToken: '', + inSegment: false, + segments: [], + pointSeen: false, + hasExponent: false, + absolute: toAbsolute, + p0: new Point(), + p: new Point() + }; + while (parser.lastToken = token, token = d.charAt(index++)) { + if (!parser.inSegment) { + if (startNewSegment(parser, token)) { + continue; + } + } + if (token === '.') { + if (parser.pointSeen || parser.hasExponent) { + finalizeNumber(parser, false); + --index; + continue; + } + parser.inNumber = true; + parser.pointSeen = true; + parser.number += token; + continue; + } + if (!isNaN(parseInt(token))) { + if (parser.number === '0' || isArcFlag(parser)) { + parser.inNumber = true; + parser.number = token; + finalizeNumber(parser, true); + continue; + } + parser.inNumber = true; + parser.number += token; + continue; + } + if (pathDelimiters.has(token)) { + if (parser.inNumber) { + finalizeNumber(parser, false); + } + continue; + } + if (token === '-' || token === '+') { + if (parser.inNumber && !isExponential(parser)) { + finalizeNumber(parser, false); + --index; + continue; + } + parser.number += token; + parser.inNumber = true; + continue; + } + if (token.toUpperCase() === 'E') { + parser.number += token; + parser.hasExponent = true; + continue; + } + if (isPathLetter.test(token)) { + if (parser.inNumber) { + finalizeNumber(parser, false); + } else if (!segmentComplete(parser)) { + throw new Error('parser Error'); + } else { + finalizeSegment(parser); + } + --index; + } + } + if (parser.inNumber) { + finalizeNumber(parser, false); + } + if (parser.inSegment && segmentComplete(parser)) { + finalizeSegment(parser); + } + return parser.segments; +} + +function arrayToString(a) { + let s = ''; + for (let i = 0, il = a.length; i < il; i++) { + s += a[i][0]; + if (a[i][1] != null) { + s += a[i][1]; + if (a[i][2] != null) { + s += ' '; + s += a[i][2]; + if (a[i][3] != null) { + s += ' '; + s += a[i][3]; + s += ' '; + s += a[i][4]; + if (a[i][5] != null) { + s += ' '; + s += a[i][5]; + s += ' '; + s += a[i][6]; + if (a[i][7] != null) { + s += ' '; + s += a[i][7]; + } + } + } + } + } + } + return s + ' '; +} +class PathArray extends SVGArray { + // Get bounding box of path + bbox() { + parser().path.setAttribute('d', this.toString()); + return new Box(parser.nodes.path.getBBox()); + } + + // Move path string + move(x, y) { + // get bounding box of current situation + const box = this.bbox(); + + // get relative offset + x -= box.x; + y -= box.y; + if (!isNaN(x) && !isNaN(y)) { + // move every point + for (let l, i = this.length - 1; i >= 0; i--) { + l = this[i][0]; + if (l === 'M' || l === 'L' || l === 'T') { + this[i][1] += x; + this[i][2] += y; + } else if (l === 'H') { + this[i][1] += x; + } else if (l === 'V') { + this[i][1] += y; + } else if (l === 'C' || l === 'S' || l === 'Q') { + this[i][1] += x; + this[i][2] += y; + this[i][3] += x; + this[i][4] += y; + if (l === 'C') { + this[i][5] += x; + this[i][6] += y; + } + } else if (l === 'A') { + this[i][6] += x; + this[i][7] += y; + } + } + } + return this; + } + + // Absolutize and parse path to array + parse(d = 'M0 0') { + if (Array.isArray(d)) { + d = Array.prototype.concat.apply([], d).toString(); + } + return pathParser(d); + } + + // Resize path string + size(width, height) { + // get bounding box of current situation + const box = this.bbox(); + let i, l; + + // If the box width or height is 0 then we ignore + // transformations on the respective axis + box.width = box.width === 0 ? 1 : box.width; + box.height = box.height === 0 ? 1 : box.height; + + // recalculate position of all points according to new size + for (i = this.length - 1; i >= 0; i--) { + l = this[i][0]; + if (l === 'M' || l === 'L' || l === 'T') { + this[i][1] = (this[i][1] - box.x) * width / box.width + box.x; + this[i][2] = (this[i][2] - box.y) * height / box.height + box.y; + } else if (l === 'H') { + this[i][1] = (this[i][1] - box.x) * width / box.width + box.x; + } else if (l === 'V') { + this[i][1] = (this[i][1] - box.y) * height / box.height + box.y; + } else if (l === 'C' || l === 'S' || l === 'Q') { + this[i][1] = (this[i][1] - box.x) * width / box.width + box.x; + this[i][2] = (this[i][2] - box.y) * height / box.height + box.y; + this[i][3] = (this[i][3] - box.x) * width / box.width + box.x; + this[i][4] = (this[i][4] - box.y) * height / box.height + box.y; + if (l === 'C') { + this[i][5] = (this[i][5] - box.x) * width / box.width + box.x; + this[i][6] = (this[i][6] - box.y) * height / box.height + box.y; + } + } else if (l === 'A') { + // resize radii + this[i][1] = this[i][1] * width / box.width; + this[i][2] = this[i][2] * height / box.height; + + // move position values + this[i][6] = (this[i][6] - box.x) * width / box.width + box.x; + this[i][7] = (this[i][7] - box.y) * height / box.height + box.y; + } + } + return this; + } + + // Convert array to string + toString() { + return arrayToString(this); + } +} + +const getClassForType = value => { + const type = typeof value; + if (type === 'number') { + return SVGNumber; + } else if (type === 'string') { + if (Color.isColor(value)) { + return Color; + } else if (delimiter.test(value)) { + return isPathLetter.test(value) ? PathArray : SVGArray; + } else if (numberAndUnit.test(value)) { + return SVGNumber; + } else { + return NonMorphable; + } + } else if (morphableTypes.indexOf(value.constructor) > -1) { + return value.constructor; + } else if (Array.isArray(value)) { + return SVGArray; + } else if (type === 'object') { + return ObjectBag; + } else { + return NonMorphable; + } +}; +class Morphable { + constructor(stepper) { + this._stepper = stepper || new Ease('-'); + this._from = null; + this._to = null; + this._type = null; + this._context = null; + this._morphObj = null; + } + at(pos) { + return this._morphObj.morph(this._from, this._to, pos, this._stepper, this._context); + } + done() { + const complete = this._context.map(this._stepper.done).reduce(function (last, curr) { + return last && curr; + }, true); + return complete; + } + from(val) { + if (val == null) { + return this._from; + } + this._from = this._set(val); + return this; + } + stepper(stepper) { + if (stepper == null) return this._stepper; + this._stepper = stepper; + return this; + } + to(val) { + if (val == null) { + return this._to; + } + this._to = this._set(val); + return this; + } + type(type) { + // getter + if (type == null) { + return this._type; + } + + // setter + this._type = type; + return this; + } + _set(value) { + if (!this._type) { + this.type(getClassForType(value)); + } + let result = new this._type(value); + if (this._type === Color) { + result = this._to ? result[this._to[4]]() : this._from ? result[this._from[4]]() : result; + } + if (this._type === ObjectBag) { + result = this._to ? result.align(this._to) : this._from ? result.align(this._from) : result; + } + result = result.toConsumable(); + this._morphObj = this._morphObj || new this._type(); + this._context = this._context || Array.apply(null, Array(result.length)).map(Object).map(function (o) { + o.done = true; + return o; + }); + return result; + } +} +class NonMorphable { + constructor(...args) { + this.init(...args); + } + init(val) { + val = Array.isArray(val) ? val[0] : val; + this.value = val; + return this; + } + toArray() { + return [this.value]; + } + valueOf() { + return this.value; + } +} +class TransformBag { + constructor(...args) { + this.init(...args); + } + init(obj) { + if (Array.isArray(obj)) { + obj = { + scaleX: obj[0], + scaleY: obj[1], + shear: obj[2], + rotate: obj[3], + translateX: obj[4], + translateY: obj[5], + originX: obj[6], + originY: obj[7] + }; + } + Object.assign(this, TransformBag.defaults, obj); + return this; + } + toArray() { + const v = this; + return [v.scaleX, v.scaleY, v.shear, v.rotate, v.translateX, v.translateY, v.originX, v.originY]; + } +} +TransformBag.defaults = { + scaleX: 1, + scaleY: 1, + shear: 0, + rotate: 0, + translateX: 0, + translateY: 0, + originX: 0, + originY: 0 +}; +const sortByKey = (a, b) => { + return a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0; +}; +class ObjectBag { + constructor(...args) { + this.init(...args); + } + align(other) { + const values = this.values; + for (let i = 0, il = values.length; i < il; ++i) { + // If the type is the same we only need to check if the color is in the correct format + if (values[i + 1] === other[i + 1]) { + if (values[i + 1] === Color && other[i + 7] !== values[i + 7]) { + const space = other[i + 7]; + const color = new Color(this.values.splice(i + 3, 5))[space]().toArray(); + this.values.splice(i + 3, 0, ...color); + } + i += values[i + 2] + 2; + continue; + } + if (!other[i + 1]) { + return this; + } + + // The types differ, so we overwrite the new type with the old one + // And initialize it with the types default (e.g. black for color or 0 for number) + const defaultObject = new other[i + 1]().toArray(); + + // Than we fix the values array + const toDelete = values[i + 2] + 3; + values.splice(i, toDelete, other[i], other[i + 1], other[i + 2], ...defaultObject); + i += values[i + 2] + 2; + } + return this; + } + init(objOrArr) { + this.values = []; + if (Array.isArray(objOrArr)) { + this.values = objOrArr.slice(); + return; + } + objOrArr = objOrArr || {}; + const entries = []; + for (const i in objOrArr) { + const Type = getClassForType(objOrArr[i]); + const val = new Type(objOrArr[i]).toArray(); + entries.push([i, Type, val.length, ...val]); + } + entries.sort(sortByKey); + this.values = entries.reduce((last, curr) => last.concat(curr), []); + return this; + } + toArray() { + return this.values; + } + valueOf() { + const obj = {}; + const arr = this.values; + + // for (var i = 0, len = arr.length; i < len; i += 2) { + while (arr.length) { + const key = arr.shift(); + const Type = arr.shift(); + const num = arr.shift(); + const values = arr.splice(0, num); + obj[key] = new Type(values); // .valueOf() + } + return obj; + } +} +const morphableTypes = [NonMorphable, TransformBag, ObjectBag]; +function registerMorphableType(type = []) { + morphableTypes.push(...[].concat(type)); +} +function makeMorphable() { + extend(morphableTypes, { + to(val) { + return new Morphable().type(this.constructor).from(this.toArray()) // this.valueOf()) + .to(val); + }, + fromArray(arr) { + this.init(arr); + return this; + }, + toConsumable() { + return this.toArray(); + }, + morph(from, to, pos, stepper, context) { + const mapper = function (i, index) { + return stepper.step(i, to[index], pos, context[index], context); + }; + return this.fromArray(from.map(mapper)); + } + }); +} + +class Path extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('path', node), attrs); + } + + // Get array + array() { + return this._array || (this._array = new PathArray(this.attr('d'))); + } + + // Clear array cache + clear() { + delete this._array; + return this; + } + + // Set height of element + height(height) { + return height == null ? this.bbox().height : this.size(this.bbox().width, height); + } + + // Move by left top corner + move(x, y) { + return this.attr('d', this.array().move(x, y)); + } + + // Plot new path + plot(d) { + return d == null ? this.array() : this.clear().attr('d', typeof d === 'string' ? d : this._array = new PathArray(d)); + } + + // Set element size to given width and height + size(width, height) { + const p = proportionalSize(this, width, height); + return this.attr('d', this.array().size(p.width, p.height)); + } + + // Set width of element + width(width) { + return width == null ? this.bbox().width : this.size(width, this.bbox().height); + } + + // Move by left top corner over x-axis + x(x) { + return x == null ? this.bbox().x : this.move(x, this.bbox().y); + } + + // Move by left top corner over y-axis + y(y) { + return y == null ? this.bbox().y : this.move(this.bbox().x, y); + } +} + +// Define morphable array +Path.prototype.MorphArray = PathArray; + +// Add parent method +registerMethods({ + Container: { + // Create a wrapped path element + path: wrapWithAttrCheck(function (d) { + // make sure plot is called as a setter + return this.put(new Path()).plot(d || new PathArray()); + }) + } +}); +register(Path, 'Path'); + +// Get array +function array() { + return this._array || (this._array = new PointArray(this.attr('points'))); +} + +// Clear array cache +function clear() { + delete this._array; + return this; +} + +// Move by left top corner +function move$2(x, y) { + return this.attr('points', this.array().move(x, y)); +} + +// Plot new path +function plot(p) { + return p == null ? this.array() : this.clear().attr('points', typeof p === 'string' ? p : this._array = new PointArray(p)); +} + +// Set element size to given width and height +function size$1(width, height) { + const p = proportionalSize(this, width, height); + return this.attr('points', this.array().size(p.width, p.height)); +} + +var poly = { + __proto__: null, + array: array, + clear: clear, + move: move$2, + plot: plot, + size: size$1 +}; + +class Polygon extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('polygon', node), attrs); + } +} +registerMethods({ + Container: { + // Create a wrapped polygon element + polygon: wrapWithAttrCheck(function (p) { + // make sure plot is called as a setter + return this.put(new Polygon()).plot(p || new PointArray()); + }) + } +}); +extend(Polygon, pointed); +extend(Polygon, poly); +register(Polygon, 'Polygon'); + +class Polyline extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('polyline', node), attrs); + } +} +registerMethods({ + Container: { + // Create a wrapped polygon element + polyline: wrapWithAttrCheck(function (p) { + // make sure plot is called as a setter + return this.put(new Polyline()).plot(p || new PointArray()); + }) + } +}); +extend(Polyline, pointed); +extend(Polyline, poly); +register(Polyline, 'Polyline'); + +class Rect extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('rect', node), attrs); + } +} +extend(Rect, { + rx, + ry +}); +registerMethods({ + Container: { + // Create a rect element + rect: wrapWithAttrCheck(function (width, height) { + return this.put(new Rect()).size(width, height); + }) + } +}); +register(Rect, 'Rect'); + +class Queue { + constructor() { + this._first = null; + this._last = null; + } + + // Shows us the first item in the list + first() { + return this._first && this._first.value; + } + + // Shows us the last item in the list + last() { + return this._last && this._last.value; + } + push(value) { + // An item stores an id and the provided value + const item = typeof value.next !== 'undefined' ? value : { + value: value, + next: null, + prev: null + }; + + // Deal with the queue being empty or populated + if (this._last) { + item.prev = this._last; + this._last.next = item; + this._last = item; + } else { + this._last = item; + this._first = item; + } + + // Return the current item + return item; + } + + // Removes the item that was returned from the push + remove(item) { + // Relink the previous item + if (item.prev) item.prev.next = item.next; + if (item.next) item.next.prev = item.prev; + if (item === this._last) this._last = item.prev; + if (item === this._first) this._first = item.next; + + // Invalidate item + item.prev = null; + item.next = null; + } + shift() { + // Check if we have a value + const remove = this._first; + if (!remove) return null; + + // If we do, remove it and relink things + this._first = remove.next; + if (this._first) this._first.prev = null; + this._last = this._first ? this._last : null; + return remove.value; + } +} + +const Animator = { + nextDraw: null, + frames: new Queue(), + timeouts: new Queue(), + immediates: new Queue(), + timer: () => globals.window.performance || globals.window.Date, + transforms: [], + frame(fn) { + // Store the node + const node = Animator.frames.push({ + run: fn + }); + + // Request an animation frame if we don't have one + if (Animator.nextDraw === null) { + Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw); + } + + // Return the node so we can remove it easily + return node; + }, + timeout(fn, delay) { + delay = delay || 0; + + // Work out when the event should fire + const time = Animator.timer().now() + delay; + + // Add the timeout to the end of the queue + const node = Animator.timeouts.push({ + run: fn, + time: time + }); + + // Request another animation frame if we need one + if (Animator.nextDraw === null) { + Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw); + } + return node; + }, + immediate(fn) { + // Add the immediate fn to the end of the queue + const node = Animator.immediates.push(fn); + // Request another animation frame if we need one + if (Animator.nextDraw === null) { + Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw); + } + return node; + }, + cancelFrame(node) { + node != null && Animator.frames.remove(node); + }, + clearTimeout(node) { + node != null && Animator.timeouts.remove(node); + }, + cancelImmediate(node) { + node != null && Animator.immediates.remove(node); + }, + _draw(now) { + // Run all the timeouts we can run, if they are not ready yet, add them + // to the end of the queue immediately! (bad timeouts!!! [sarcasm]) + let nextTimeout = null; + const lastTimeout = Animator.timeouts.last(); + while (nextTimeout = Animator.timeouts.shift()) { + // Run the timeout if its time, or push it to the end + if (now >= nextTimeout.time) { + nextTimeout.run(); + } else { + Animator.timeouts.push(nextTimeout); + } + + // If we hit the last item, we should stop shifting out more items + if (nextTimeout === lastTimeout) break; + } + + // Run all of the animation frames + let nextFrame = null; + const lastFrame = Animator.frames.last(); + while (nextFrame !== lastFrame && (nextFrame = Animator.frames.shift())) { + nextFrame.run(now); + } + let nextImmediate = null; + while (nextImmediate = Animator.immediates.shift()) { + nextImmediate(); + } + + // If we have remaining timeouts or frames, draw until we don't anymore + Animator.nextDraw = Animator.timeouts.first() || Animator.frames.first() ? globals.window.requestAnimationFrame(Animator._draw) : null; + } +}; + +const makeSchedule = function (runnerInfo) { + const start = runnerInfo.start; + const duration = runnerInfo.runner.duration(); + const end = start + duration; + return { + start: start, + duration: duration, + end: end, + runner: runnerInfo.runner + }; +}; +const defaultSource = function () { + const w = globals.window; + return (w.performance || w.Date).now(); +}; +class Timeline extends EventTarget { + // Construct a new timeline on the given element + constructor(timeSource = defaultSource) { + super(); + this._timeSource = timeSource; + + // terminate resets all variables to their initial state + this.terminate(); + } + active() { + return !!this._nextFrame; + } + finish() { + // Go to end and pause + this.time(this.getEndTimeOfTimeline() + 1); + return this.pause(); + } + + // Calculates the end of the timeline + getEndTime() { + const lastRunnerInfo = this.getLastRunnerInfo(); + const lastDuration = lastRunnerInfo ? lastRunnerInfo.runner.duration() : 0; + const lastStartTime = lastRunnerInfo ? lastRunnerInfo.start : this._time; + return lastStartTime + lastDuration; + } + getEndTimeOfTimeline() { + const endTimes = this._runners.map(i => i.start + i.runner.duration()); + return Math.max(0, ...endTimes); + } + getLastRunnerInfo() { + return this.getRunnerInfoById(this._lastRunnerId); + } + getRunnerInfoById(id) { + return this._runners[this._runnerIds.indexOf(id)] || null; + } + pause() { + this._paused = true; + return this._continue(); + } + persist(dtOrForever) { + if (dtOrForever == null) return this._persist; + this._persist = dtOrForever; + return this; + } + play() { + // Now make sure we are not paused and continue the animation + this._paused = false; + return this.updateTime()._continue(); + } + reverse(yes) { + const currentSpeed = this.speed(); + if (yes == null) return this.speed(-currentSpeed); + const positive = Math.abs(currentSpeed); + return this.speed(yes ? -positive : positive); + } + + // schedules a runner on the timeline + schedule(runner, delay, when) { + if (runner == null) { + return this._runners.map(makeSchedule); + } + + // The start time for the next animation can either be given explicitly, + // derived from the current timeline time or it can be relative to the + // last start time to chain animations directly + + let absoluteStartTime = 0; + const endTime = this.getEndTime(); + delay = delay || 0; + + // Work out when to start the animation + if (when == null || when === 'last' || when === 'after') { + // Take the last time and increment + absoluteStartTime = endTime; + } else if (when === 'absolute' || when === 'start') { + absoluteStartTime = delay; + delay = 0; + } else if (when === 'now') { + absoluteStartTime = this._time; + } else if (when === 'relative') { + const runnerInfo = this.getRunnerInfoById(runner.id); + if (runnerInfo) { + absoluteStartTime = runnerInfo.start + delay; + delay = 0; + } + } else if (when === 'with-last') { + const lastRunnerInfo = this.getLastRunnerInfo(); + const lastStartTime = lastRunnerInfo ? lastRunnerInfo.start : this._time; + absoluteStartTime = lastStartTime; + } else { + throw new Error('Invalid value for the "when" parameter'); + } + + // Manage runner + runner.unschedule(); + runner.timeline(this); + const persist = runner.persist(); + const runnerInfo = { + persist: persist === null ? this._persist : persist, + start: absoluteStartTime + delay, + runner + }; + this._lastRunnerId = runner.id; + this._runners.push(runnerInfo); + this._runners.sort((a, b) => a.start - b.start); + this._runnerIds = this._runners.map(info => info.runner.id); + this.updateTime()._continue(); + return this; + } + seek(dt) { + return this.time(this._time + dt); + } + source(fn) { + if (fn == null) return this._timeSource; + this._timeSource = fn; + return this; + } + speed(speed) { + if (speed == null) return this._speed; + this._speed = speed; + return this; + } + stop() { + // Go to start and pause + this.time(0); + return this.pause(); + } + time(time) { + if (time == null) return this._time; + this._time = time; + return this._continue(true); + } + + // Remove the runner from this timeline + unschedule(runner) { + const index = this._runnerIds.indexOf(runner.id); + if (index < 0) return this; + this._runners.splice(index, 1); + this._runnerIds.splice(index, 1); + runner.timeline(null); + return this; + } + + // Makes sure, that after pausing the time doesn't jump + updateTime() { + if (!this.active()) { + this._lastSourceTime = this._timeSource(); + } + return this; + } + + // Checks if we are running and continues the animation + _continue(immediateStep = false) { + Animator.cancelFrame(this._nextFrame); + this._nextFrame = null; + if (immediateStep) return this._stepImmediate(); + if (this._paused) return this; + this._nextFrame = Animator.frame(this._step); + return this; + } + _stepFn(immediateStep = false) { + // Get the time delta from the last time and update the time + const time = this._timeSource(); + let dtSource = time - this._lastSourceTime; + if (immediateStep) dtSource = 0; + const dtTime = this._speed * dtSource + (this._time - this._lastStepTime); + this._lastSourceTime = time; + + // Only update the time if we use the timeSource. + // Otherwise use the current time + if (!immediateStep) { + // Update the time + this._time += dtTime; + this._time = this._time < 0 ? 0 : this._time; + } + this._lastStepTime = this._time; + this.fire('time', this._time); + + // This is for the case that the timeline was seeked so that the time + // is now before the startTime of the runner. That is why we need to set + // the runner to position 0 + + // FIXME: + // However, resetting in insertion order leads to bugs. Considering the case, + // where 2 runners change the same attribute but in different times, + // resetting both of them will lead to the case where the later defined + // runner always wins the reset even if the other runner started earlier + // and therefore should win the attribute battle + // this can be solved by resetting them backwards + for (let k = this._runners.length; k--;) { + // Get and run the current runner and ignore it if its inactive + const runnerInfo = this._runners[k]; + const runner = runnerInfo.runner; + + // Make sure that we give the actual difference + // between runner start time and now + const dtToStart = this._time - runnerInfo.start; + + // Dont run runner if not started yet + // and try to reset it + if (dtToStart <= 0) { + runner.reset(); + } + } + + // Run all of the runners directly + let runnersLeft = false; + for (let i = 0, len = this._runners.length; i < len; i++) { + // Get and run the current runner and ignore it if its inactive + const runnerInfo = this._runners[i]; + const runner = runnerInfo.runner; + let dt = dtTime; + + // Make sure that we give the actual difference + // between runner start time and now + const dtToStart = this._time - runnerInfo.start; + + // Dont run runner if not started yet + if (dtToStart <= 0) { + runnersLeft = true; + continue; + } else if (dtToStart < dt) { + // Adjust dt to make sure that animation is on point + dt = dtToStart; + } + if (!runner.active()) continue; + + // If this runner is still going, signal that we need another animation + // frame, otherwise, remove the completed runner + const finished = runner.step(dt).done; + if (!finished) { + runnersLeft = true; + // continue + } else if (runnerInfo.persist !== true) { + // runner is finished. And runner might get removed + const endTime = runner.duration() - runner.time() + this._time; + if (endTime + runnerInfo.persist < this._time) { + // Delete runner and correct index + runner.unschedule(); + --i; + --len; + } + } + } + + // Basically: we continue when there are runners right from us in time + // when -->, and when runners are left from us when <-- + if (runnersLeft && !(this._speed < 0 && this._time === 0) || this._runnerIds.length && this._speed < 0 && this._time > 0) { + this._continue(); + } else { + this.pause(); + this.fire('finished'); + } + return this; + } + terminate() { + // cleanup memory + + // Store the timing variables + this._startTime = 0; + this._speed = 1.0; + + // Determines how long a runner is hold in memory. Can be a dt or true/false + this._persist = 0; + + // Keep track of the running animations and their starting parameters + this._nextFrame = null; + this._paused = true; + this._runners = []; + this._runnerIds = []; + this._lastRunnerId = -1; + this._time = 0; + this._lastSourceTime = 0; + this._lastStepTime = 0; + + // Make sure that step is always called in class context + this._step = this._stepFn.bind(this, false); + this._stepImmediate = this._stepFn.bind(this, true); + } +} +registerMethods({ + Element: { + timeline: function (timeline) { + if (timeline == null) { + this._timeline = this._timeline || new Timeline(); + return this._timeline; + } else { + this._timeline = timeline; + return this; + } + } + } +}); + +class Runner extends EventTarget { + constructor(options) { + super(); + + // Store a unique id on the runner, so that we can identify it later + this.id = Runner.id++; + + // Ensure a default value + options = options == null ? timeline.duration : options; + + // Ensure that we get a controller + options = typeof options === 'function' ? new Controller(options) : options; + + // Declare all of the variables + this._element = null; + this._timeline = null; + this.done = false; + this._queue = []; + + // Work out the stepper and the duration + this._duration = typeof options === 'number' && options; + this._isDeclarative = options instanceof Controller; + this._stepper = this._isDeclarative ? options : new Ease(); + + // We copy the current values from the timeline because they can change + this._history = {}; + + // Store the state of the runner + this.enabled = true; + this._time = 0; + this._lastTime = 0; + + // At creation, the runner is in reset state + this._reseted = true; + + // Save transforms applied to this runner + this.transforms = new Matrix(); + this.transformId = 1; + + // Looping variables + this._haveReversed = false; + this._reverse = false; + this._loopsDone = 0; + this._swing = false; + this._wait = 0; + this._times = 1; + this._frameId = null; + + // Stores how long a runner is stored after being done + this._persist = this._isDeclarative ? true : null; + } + static sanitise(duration, delay, when) { + // Initialise the default parameters + let times = 1; + let swing = false; + let wait = 0; + duration = duration ?? timeline.duration; + delay = delay ?? timeline.delay; + when = when || 'last'; + + // If we have an object, unpack the values + if (typeof duration === 'object' && !(duration instanceof Stepper)) { + delay = duration.delay ?? delay; + when = duration.when ?? when; + swing = duration.swing || swing; + times = duration.times ?? times; + wait = duration.wait ?? wait; + duration = duration.duration ?? timeline.duration; + } + return { + duration: duration, + delay: delay, + swing: swing, + times: times, + wait: wait, + when: when + }; + } + active(enabled) { + if (enabled == null) return this.enabled; + this.enabled = enabled; + return this; + } + + /* + Private Methods + =============== + Methods that shouldn't be used externally + */ + addTransform(transform) { + this.transforms.lmultiplyO(transform); + return this; + } + after(fn) { + return this.on('finished', fn); + } + animate(duration, delay, when) { + const o = Runner.sanitise(duration, delay, when); + const runner = new Runner(o.duration); + if (this._timeline) runner.timeline(this._timeline); + if (this._element) runner.element(this._element); + return runner.loop(o).schedule(o.delay, o.when); + } + clearTransform() { + this.transforms = new Matrix(); + return this; + } + + // TODO: Keep track of all transformations so that deletion is faster + clearTransformsFromQueue() { + if (!this.done || !this._timeline || !this._timeline._runnerIds.includes(this.id)) { + this._queue = this._queue.filter(item => { + return !item.isTransform; + }); + } + } + delay(delay) { + return this.animate(0, delay); + } + duration() { + return this._times * (this._wait + this._duration) - this._wait; + } + during(fn) { + return this.queue(null, fn); + } + ease(fn) { + this._stepper = new Ease(fn); + return this; + } + /* + Runner Definitions + ================== + These methods help us define the runtime behaviour of the Runner or they + help us make new runners from the current runner + */ + + element(element) { + if (element == null) return this._element; + this._element = element; + element._prepareRunner(); + return this; + } + finish() { + return this.step(Infinity); + } + loop(times, swing, wait) { + // Deal with the user passing in an object + if (typeof times === 'object') { + swing = times.swing; + wait = times.wait; + times = times.times; + } + + // Sanitise the values and store them + this._times = times || Infinity; + this._swing = swing || false; + this._wait = wait || 0; + + // Allow true to be passed + if (this._times === true) { + this._times = Infinity; + } + return this; + } + loops(p) { + const loopDuration = this._duration + this._wait; + if (p == null) { + const loopsDone = Math.floor(this._time / loopDuration); + const relativeTime = this._time - loopsDone * loopDuration; + const position = relativeTime / this._duration; + return Math.min(loopsDone + position, this._times); + } + const whole = Math.floor(p); + const partial = p % 1; + const time = loopDuration * whole + this._duration * partial; + return this.time(time); + } + persist(dtOrForever) { + if (dtOrForever == null) return this._persist; + this._persist = dtOrForever; + return this; + } + position(p) { + // Get all of the variables we need + const x = this._time; + const d = this._duration; + const w = this._wait; + const t = this._times; + const s = this._swing; + const r = this._reverse; + let position; + if (p == null) { + /* + This function converts a time to a position in the range [0, 1] + The full explanation can be found in this desmos demonstration + https://www.desmos.com/calculator/u4fbavgche + The logic is slightly simplified here because we can use booleans + */ + + // Figure out the value without thinking about the start or end time + const f = function (x) { + const swinging = s * Math.floor(x % (2 * (w + d)) / (w + d)); + const backwards = swinging && !r || !swinging && r; + const uncliped = Math.pow(-1, backwards) * (x % (w + d)) / d + backwards; + const clipped = Math.max(Math.min(uncliped, 1), 0); + return clipped; + }; + + // Figure out the value by incorporating the start time + const endTime = t * (w + d) - w; + position = x <= 0 ? Math.round(f(1e-5)) : x < endTime ? f(x) : Math.round(f(endTime - 1e-5)); + return position; + } + + // Work out the loops done and add the position to the loops done + const loopsDone = Math.floor(this.loops()); + const swingForward = s && loopsDone % 2 === 0; + const forwards = swingForward && !r || r && swingForward; + position = loopsDone + (forwards ? p : 1 - p); + return this.loops(position); + } + progress(p) { + if (p == null) { + return Math.min(1, this._time / this.duration()); + } + return this.time(p * this.duration()); + } + + /* + Basic Functionality + =================== + These methods allow us to attach basic functions to the runner directly + */ + queue(initFn, runFn, retargetFn, isTransform) { + this._queue.push({ + initialiser: initFn || noop, + runner: runFn || noop, + retarget: retargetFn, + isTransform: isTransform, + initialised: false, + finished: false + }); + const timeline = this.timeline(); + timeline && this.timeline()._continue(); + return this; + } + reset() { + if (this._reseted) return this; + this.time(0); + this._reseted = true; + return this; + } + reverse(reverse) { + this._reverse = reverse == null ? !this._reverse : reverse; + return this; + } + schedule(timeline, delay, when) { + // The user doesn't need to pass a timeline if we already have one + if (!(timeline instanceof Timeline)) { + when = delay; + delay = timeline; + timeline = this.timeline(); + } + + // If there is no timeline, yell at the user... + if (!timeline) { + throw Error('Runner cannot be scheduled without timeline'); + } + + // Schedule the runner on the timeline provided + timeline.schedule(this, delay, when); + return this; + } + step(dt) { + // If we are inactive, this stepper just gets skipped + if (!this.enabled) return this; + + // Update the time and get the new position + dt = dt == null ? 16 : dt; + this._time += dt; + const position = this.position(); + + // Figure out if we need to run the stepper in this frame + const running = this._lastPosition !== position && this._time >= 0; + this._lastPosition = position; + + // Figure out if we just started + const duration = this.duration(); + const justStarted = this._lastTime <= 0 && this._time > 0; + const justFinished = this._lastTime < duration && this._time >= duration; + this._lastTime = this._time; + if (justStarted) { + this.fire('start', this); + } + + // Work out if the runner is finished set the done flag here so animations + // know, that they are running in the last step (this is good for + // transformations which can be merged) + const declarative = this._isDeclarative; + this.done = !declarative && !justFinished && this._time >= duration; + + // Runner is running. So its not in reset state anymore + this._reseted = false; + let converged = false; + // Call initialise and the run function + if (running || declarative) { + this._initialise(running); + + // clear the transforms on this runner so they dont get added again and again + this.transforms = new Matrix(); + converged = this._run(declarative ? dt : position); + this.fire('step', this); + } + // correct the done flag here + // declarative animations itself know when they converged + this.done = this.done || converged && declarative; + if (justFinished) { + this.fire('finished', this); + } + return this; + } + + /* + Runner animation methods + ======================== + Control how the animation plays + */ + time(time) { + if (time == null) { + return this._time; + } + const dt = time - this._time; + this.step(dt); + return this; + } + timeline(timeline) { + // check explicitly for undefined so we can set the timeline to null + if (typeof timeline === 'undefined') return this._timeline; + this._timeline = timeline; + return this; + } + unschedule() { + const timeline = this.timeline(); + timeline && timeline.unschedule(this); + return this; + } + + // Run each initialise function in the runner if required + _initialise(running) { + // If we aren't running, we shouldn't initialise when not declarative + if (!running && !this._isDeclarative) return; + + // Loop through all of the initialisers + for (let i = 0, len = this._queue.length; i < len; ++i) { + // Get the current initialiser + const current = this._queue[i]; + + // Determine whether we need to initialise + const needsIt = this._isDeclarative || !current.initialised && running; + running = !current.finished; + + // Call the initialiser if we need to + if (needsIt && running) { + current.initialiser.call(this); + current.initialised = true; + } + } + } + + // Save a morpher to the morpher list so that we can retarget it later + _rememberMorpher(method, morpher) { + this._history[method] = { + morpher: morpher, + caller: this._queue[this._queue.length - 1] + }; + + // We have to resume the timeline in case a controller + // is already done without being ever run + // This can happen when e.g. this is done: + // anim = el.animate(new SVG.Spring) + // and later + // anim.move(...) + if (this._isDeclarative) { + const timeline = this.timeline(); + timeline && timeline.play(); + } + } + + // Try to set the target for a morpher if the morpher exists, otherwise + // Run each run function for the position or dt given + _run(positionOrDt) { + // Run all of the _queue directly + let allfinished = true; + for (let i = 0, len = this._queue.length; i < len; ++i) { + // Get the current function to run + const current = this._queue[i]; + + // Run the function if its not finished, we keep track of the finished + // flag for the sake of declarative _queue + const converged = current.runner.call(this, positionOrDt); + current.finished = current.finished || converged === true; + allfinished = allfinished && current.finished; + } + + // We report when all of the constructors are finished + return allfinished; + } + + // do nothing and return false + _tryRetarget(method, target, extra) { + if (this._history[method]) { + // if the last method wasn't even initialised, throw it away + if (!this._history[method].caller.initialised) { + const index = this._queue.indexOf(this._history[method].caller); + this._queue.splice(index, 1); + return false; + } + + // for the case of transformations, we use the special retarget function + // which has access to the outer scope + if (this._history[method].caller.retarget) { + this._history[method].caller.retarget.call(this, target, extra); + // for everything else a simple morpher change is sufficient + } else { + this._history[method].morpher.to(target); + } + this._history[method].caller.finished = false; + const timeline = this.timeline(); + timeline && timeline.play(); + return true; + } + return false; + } +} +Runner.id = 0; +class FakeRunner { + constructor(transforms = new Matrix(), id = -1, done = true) { + this.transforms = transforms; + this.id = id; + this.done = done; + } + clearTransformsFromQueue() {} +} +extend([Runner, FakeRunner], { + mergeWith(runner) { + return new FakeRunner(runner.transforms.lmultiply(this.transforms), runner.id); + } +}); + +// FakeRunner.emptyRunner = new FakeRunner() + +const lmultiply = (last, curr) => last.lmultiplyO(curr); +const getRunnerTransform = runner => runner.transforms; +function mergeTransforms() { + // Find the matrix to apply to the element and apply it + const runners = this._transformationRunners.runners; + const netTransform = runners.map(getRunnerTransform).reduce(lmultiply, new Matrix()); + this.transform(netTransform); + this._transformationRunners.merge(); + if (this._transformationRunners.length() === 1) { + this._frameId = null; + } +} +class RunnerArray { + constructor() { + this.runners = []; + this.ids = []; + } + add(runner) { + if (this.runners.includes(runner)) return; + const id = runner.id + 1; + this.runners.push(runner); + this.ids.push(id); + return this; + } + clearBefore(id) { + const deleteCnt = this.ids.indexOf(id + 1) || 1; + this.ids.splice(0, deleteCnt, 0); + this.runners.splice(0, deleteCnt, new FakeRunner()).forEach(r => r.clearTransformsFromQueue()); + return this; + } + edit(id, newRunner) { + const index = this.ids.indexOf(id + 1); + this.ids.splice(index, 1, id + 1); + this.runners.splice(index, 1, newRunner); + return this; + } + getByID(id) { + return this.runners[this.ids.indexOf(id + 1)]; + } + length() { + return this.ids.length; + } + merge() { + let lastRunner = null; + for (let i = 0; i < this.runners.length; ++i) { + const runner = this.runners[i]; + const condition = lastRunner && runner.done && lastRunner.done && ( + // don't merge runner when persisted on timeline + !runner._timeline || !runner._timeline._runnerIds.includes(runner.id)) && (!lastRunner._timeline || !lastRunner._timeline._runnerIds.includes(lastRunner.id)); + if (condition) { + // the +1 happens in the function + this.remove(runner.id); + const newRunner = runner.mergeWith(lastRunner); + this.edit(lastRunner.id, newRunner); + lastRunner = newRunner; + --i; + } else { + lastRunner = runner; + } + } + return this; + } + remove(id) { + const index = this.ids.indexOf(id + 1); + this.ids.splice(index, 1); + this.runners.splice(index, 1); + return this; + } +} +registerMethods({ + Element: { + animate(duration, delay, when) { + const o = Runner.sanitise(duration, delay, when); + const timeline = this.timeline(); + return new Runner(o.duration).loop(o).element(this).timeline(timeline.play()).schedule(o.delay, o.when); + }, + delay(by, when) { + return this.animate(0, by, when); + }, + // this function searches for all runners on the element and deletes the ones + // which run before the current one. This is because absolute transformations + // overwrite anything anyway so there is no need to waste time computing + // other runners + _clearTransformRunnersBefore(currentRunner) { + this._transformationRunners.clearBefore(currentRunner.id); + }, + _currentTransform(current) { + return this._transformationRunners.runners + // we need the equal sign here to make sure, that also transformations + // on the same runner which execute before the current transformation are + // taken into account + .filter(runner => runner.id <= current.id).map(getRunnerTransform).reduce(lmultiply, new Matrix()); + }, + _addRunner(runner) { + this._transformationRunners.add(runner); + + // Make sure that the runner merge is executed at the very end of + // all Animator functions. That is why we use immediate here to execute + // the merge right after all frames are run + Animator.cancelImmediate(this._frameId); + this._frameId = Animator.immediate(mergeTransforms.bind(this)); + }, + _prepareRunner() { + if (this._frameId == null) { + this._transformationRunners = new RunnerArray().add(new FakeRunner(new Matrix(this))); + } + } + } +}); + +// Will output the elements from array A that are not in the array B +const difference = (a, b) => a.filter(x => !b.includes(x)); +extend(Runner, { + attr(a, v) { + return this.styleAttr('attr', a, v); + }, + // Add animatable styles + css(s, v) { + return this.styleAttr('css', s, v); + }, + styleAttr(type, nameOrAttrs, val) { + if (typeof nameOrAttrs === 'string') { + return this.styleAttr(type, { + [nameOrAttrs]: val + }); + } + let attrs = nameOrAttrs; + if (this._tryRetarget(type, attrs)) return this; + let morpher = new Morphable(this._stepper).to(attrs); + let keys = Object.keys(attrs); + this.queue(function () { + morpher = morpher.from(this.element()[type](keys)); + }, function (pos) { + this.element()[type](morpher.at(pos).valueOf()); + return morpher.done(); + }, function (newToAttrs) { + // Check if any new keys were added + const newKeys = Object.keys(newToAttrs); + const differences = difference(newKeys, keys); + + // If their are new keys, initialize them and add them to morpher + if (differences.length) { + // Get the values + const addedFromAttrs = this.element()[type](differences); + + // Get the already initialized values + const oldFromAttrs = new ObjectBag(morpher.from()).valueOf(); + + // Merge old and new + Object.assign(oldFromAttrs, addedFromAttrs); + morpher.from(oldFromAttrs); + } + + // Get the object from the morpher + const oldToAttrs = new ObjectBag(morpher.to()).valueOf(); + + // Merge in new attributes + Object.assign(oldToAttrs, newToAttrs); + + // Change morpher target + morpher.to(oldToAttrs); + + // Make sure that we save the work we did so we don't need it to do again + keys = newKeys; + attrs = newToAttrs; + }); + this._rememberMorpher(type, morpher); + return this; + }, + zoom(level, point) { + if (this._tryRetarget('zoom', level, point)) return this; + let morpher = new Morphable(this._stepper).to(new SVGNumber(level)); + this.queue(function () { + morpher = morpher.from(this.element().zoom()); + }, function (pos) { + this.element().zoom(morpher.at(pos), point); + return morpher.done(); + }, function (newLevel, newPoint) { + point = newPoint; + morpher.to(newLevel); + }); + this._rememberMorpher('zoom', morpher); + return this; + }, + /** + ** absolute transformations + **/ + + // + // M v -----|-----(D M v = F v)------|-----> T v + // + // 1. define the final state (T) and decompose it (once) + // t = [tx, ty, the, lam, sy, sx] + // 2. on every frame: pull the current state of all previous transforms + // (M - m can change) + // and then write this as m = [tx0, ty0, the0, lam0, sy0, sx0] + // 3. Find the interpolated matrix F(pos) = m + pos * (t - m) + // - Note F(0) = M + // - Note F(1) = T + // 4. Now you get the delta matrix as a result: D = F * inv(M) + + transform(transforms, relative, affine) { + // If we have a declarative function, we should retarget it if possible + relative = transforms.relative || relative; + if (this._isDeclarative && !relative && this._tryRetarget('transform', transforms)) { + return this; + } + + // Parse the parameters + const isMatrix = Matrix.isMatrixLike(transforms); + affine = transforms.affine != null ? transforms.affine : affine != null ? affine : !isMatrix; + + // Create a morpher and set its type + const morpher = new Morphable(this._stepper).type(affine ? TransformBag : Matrix); + let origin; + let element; + let current; + let currentAngle; + let startTransform; + function setup() { + // make sure element and origin is defined + element = element || this.element(); + origin = origin || getOrigin(transforms, element); + startTransform = new Matrix(relative ? undefined : element); + + // add the runner to the element so it can merge transformations + element._addRunner(this); + + // Deactivate all transforms that have run so far if we are absolute + if (!relative) { + element._clearTransformRunnersBefore(this); + } + } + function run(pos) { + // clear all other transforms before this in case something is saved + // on this runner. We are absolute. We dont need these! + if (!relative) this.clearTransform(); + const { + x, + y + } = new Point(origin).transform(element._currentTransform(this)); + let target = new Matrix({ + ...transforms, + origin: [x, y] + }); + let start = this._isDeclarative && current ? current : startTransform; + if (affine) { + target = target.decompose(x, y); + start = start.decompose(x, y); + + // Get the current and target angle as it was set + const rTarget = target.rotate; + const rCurrent = start.rotate; + + // Figure out the shortest path to rotate directly + const possibilities = [rTarget - 360, rTarget, rTarget + 360]; + const distances = possibilities.map(a => Math.abs(a - rCurrent)); + const shortest = Math.min(...distances); + const index = distances.indexOf(shortest); + target.rotate = possibilities[index]; + } + if (relative) { + // we have to be careful here not to overwrite the rotation + // with the rotate method of Matrix + if (!isMatrix) { + target.rotate = transforms.rotate || 0; + } + if (this._isDeclarative && currentAngle) { + start.rotate = currentAngle; + } + } + morpher.from(start); + morpher.to(target); + const affineParameters = morpher.at(pos); + currentAngle = affineParameters.rotate; + current = new Matrix(affineParameters); + this.addTransform(current); + element._addRunner(this); + return morpher.done(); + } + function retarget(newTransforms) { + // only get a new origin if it changed since the last call + if ((newTransforms.origin || 'center').toString() !== (transforms.origin || 'center').toString()) { + origin = getOrigin(newTransforms, element); + } + + // overwrite the old transformations with the new ones + transforms = { + ...newTransforms, + origin + }; + } + this.queue(setup, run, retarget, true); + this._isDeclarative && this._rememberMorpher('transform', morpher); + return this; + }, + // Animatable x-axis + x(x) { + return this._queueNumber('x', x); + }, + // Animatable y-axis + y(y) { + return this._queueNumber('y', y); + }, + ax(x) { + return this._queueNumber('ax', x); + }, + ay(y) { + return this._queueNumber('ay', y); + }, + dx(x = 0) { + return this._queueNumberDelta('x', x); + }, + dy(y = 0) { + return this._queueNumberDelta('y', y); + }, + dmove(x, y) { + return this.dx(x).dy(y); + }, + _queueNumberDelta(method, to) { + to = new SVGNumber(to); + + // Try to change the target if we have this method already registered + if (this._tryRetarget(method, to)) return this; + + // Make a morpher and queue the animation + const morpher = new Morphable(this._stepper).to(to); + let from = null; + this.queue(function () { + from = this.element()[method](); + morpher.from(from); + morpher.to(from + to); + }, function (pos) { + this.element()[method](morpher.at(pos)); + return morpher.done(); + }, function (newTo) { + morpher.to(from + new SVGNumber(newTo)); + }); + + // Register the morpher so that if it is changed again, we can retarget it + this._rememberMorpher(method, morpher); + return this; + }, + _queueObject(method, to) { + // Try to change the target if we have this method already registered + if (this._tryRetarget(method, to)) return this; + + // Make a morpher and queue the animation + const morpher = new Morphable(this._stepper).to(to); + this.queue(function () { + morpher.from(this.element()[method]()); + }, function (pos) { + this.element()[method](morpher.at(pos)); + return morpher.done(); + }); + + // Register the morpher so that if it is changed again, we can retarget it + this._rememberMorpher(method, morpher); + return this; + }, + _queueNumber(method, value) { + return this._queueObject(method, new SVGNumber(value)); + }, + // Animatable center x-axis + cx(x) { + return this._queueNumber('cx', x); + }, + // Animatable center y-axis + cy(y) { + return this._queueNumber('cy', y); + }, + // Add animatable move + move(x, y) { + return this.x(x).y(y); + }, + amove(x, y) { + return this.ax(x).ay(y); + }, + // Add animatable center + center(x, y) { + return this.cx(x).cy(y); + }, + // Add animatable size + size(width, height) { + // animate bbox based size for all other elements + let box; + if (!width || !height) { + box = this._element.bbox(); + } + if (!width) { + width = box.width / box.height * height; + } + if (!height) { + height = box.height / box.width * width; + } + return this.width(width).height(height); + }, + // Add animatable width + width(width) { + return this._queueNumber('width', width); + }, + // Add animatable height + height(height) { + return this._queueNumber('height', height); + }, + // Add animatable plot + plot(a, b, c, d) { + // Lines can be plotted with 4 arguments + if (arguments.length === 4) { + return this.plot([a, b, c, d]); + } + if (this._tryRetarget('plot', a)) return this; + const morpher = new Morphable(this._stepper).type(this._element.MorphArray).to(a); + this.queue(function () { + morpher.from(this._element.array()); + }, function (pos) { + this._element.plot(morpher.at(pos)); + return morpher.done(); + }); + this._rememberMorpher('plot', morpher); + return this; + }, + // Add leading method + leading(value) { + return this._queueNumber('leading', value); + }, + // Add animatable viewbox + viewbox(x, y, width, height) { + return this._queueObject('viewbox', new Box(x, y, width, height)); + }, + update(o) { + if (typeof o !== 'object') { + return this.update({ + offset: arguments[0], + color: arguments[1], + opacity: arguments[2] + }); + } + if (o.opacity != null) this.attr('stop-opacity', o.opacity); + if (o.color != null) this.attr('stop-color', o.color); + if (o.offset != null) this.attr('offset', o.offset); + return this; + } +}); +extend(Runner, { + rx, + ry, + from, + to +}); +register(Runner, 'Runner'); + +class Svg extends Container { + constructor(node, attrs = node) { + super(nodeOrNew('svg', node), attrs); + this.namespace(); + } + + // Creates and returns defs element + defs() { + if (!this.isRoot()) return this.root().defs(); + return adopt(this.node.querySelector('defs')) || this.put(new Defs()); + } + isRoot() { + return !this.node.parentNode || !(this.node.parentNode instanceof globals.window.SVGElement) && this.node.parentNode.nodeName !== '#document-fragment'; + } + + // Add namespaces + namespace() { + if (!this.isRoot()) return this.root().namespace(); + return this.attr({ + xmlns: svg, + version: '1.1' + }).attr('xmlns:xlink', xlink, xmlns); + } + removeNamespace() { + return this.attr({ + xmlns: null, + version: null + }).attr('xmlns:xlink', null, xmlns).attr('xmlns:svgjs', null, xmlns); + } + + // Check if this is a root svg + // If not, call root() from this element + root() { + if (this.isRoot()) return this; + return super.root(); + } +} +registerMethods({ + Container: { + // Create nested svg document + nested: wrapWithAttrCheck(function () { + return this.put(new Svg()); + }) + } +}); +register(Svg, 'Svg', true); + +class Symbol extends Container { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('symbol', node), attrs); + } +} +registerMethods({ + Container: { + symbol: wrapWithAttrCheck(function () { + return this.put(new Symbol()); + }) + } +}); +register(Symbol, 'Symbol'); + +// Create plain text node +function plain(text) { + // clear if build mode is disabled + if (this._build === false) { + this.clear(); + } + + // create text node + this.node.appendChild(globals.document.createTextNode(text)); + return this; +} + +// Get length of text element +function length() { + return this.node.getComputedTextLength(); +} + +// Move over x-axis +// Text is moved by its bounding box +// text-anchor does NOT matter +function x$1(x, box = this.bbox()) { + if (x == null) { + return box.x; + } + return this.attr('x', this.attr('x') + x - box.x); +} + +// Move over y-axis +function y$1(y, box = this.bbox()) { + if (y == null) { + return box.y; + } + return this.attr('y', this.attr('y') + y - box.y); +} +function move$1(x, y, box = this.bbox()) { + return this.x(x, box).y(y, box); +} + +// Move center over x-axis +function cx(x, box = this.bbox()) { + if (x == null) { + return box.cx; + } + return this.attr('x', this.attr('x') + x - box.cx); +} + +// Move center over y-axis +function cy(y, box = this.bbox()) { + if (y == null) { + return box.cy; + } + return this.attr('y', this.attr('y') + y - box.cy); +} +function center(x, y, box = this.bbox()) { + return this.cx(x, box).cy(y, box); +} +function ax(x) { + return this.attr('x', x); +} +function ay(y) { + return this.attr('y', y); +} +function amove(x, y) { + return this.ax(x).ay(y); +} + +// Enable / disable build mode +function build(build) { + this._build = !!build; + return this; +} + +var textable = { + __proto__: null, + amove: amove, + ax: ax, + ay: ay, + build: build, + center: center, + cx: cx, + cy: cy, + length: length, + move: move$1, + plain: plain, + x: x$1, + y: y$1 +}; + +class Text extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('text', node), attrs); + this.dom.leading = this.dom.leading ?? new SVGNumber(1.3); // store leading value for rebuilding + this._rebuild = true; // enable automatic updating of dy values + this._build = false; // disable build mode for adding multiple lines + } + + // Set / get leading + leading(value) { + // act as getter + if (value == null) { + return this.dom.leading; + } + + // act as setter + this.dom.leading = new SVGNumber(value); + return this.rebuild(); + } + + // Rebuild appearance type + rebuild(rebuild) { + // store new rebuild flag if given + if (typeof rebuild === 'boolean') { + this._rebuild = rebuild; + } + + // define position of all lines + if (this._rebuild) { + const self = this; + let blankLineOffset = 0; + const leading = this.dom.leading; + this.each(function (i) { + if (isDescriptive(this.node)) return; + const fontSize = globals.window.getComputedStyle(this.node).getPropertyValue('font-size'); + const dy = leading * new SVGNumber(fontSize); + if (this.dom.newLined) { + this.attr('x', self.attr('x')); + if (this.text() === '\n') { + blankLineOffset += dy; + } else { + this.attr('dy', i ? dy + blankLineOffset : 0); + blankLineOffset = 0; + } + } + }); + this.fire('rebuild'); + } + return this; + } + + // overwrite method from parent to set data properly + setData(o) { + this.dom = o; + this.dom.leading = new SVGNumber(o.leading || 1.3); + return this; + } + writeDataToDom() { + writeDataToDom(this, this.dom, { + leading: 1.3 + }); + return this; + } + + // Set the text content + text(text) { + // act as getter + if (text === undefined) { + const children = this.node.childNodes; + let firstLine = 0; + text = ''; + for (let i = 0, len = children.length; i < len; ++i) { + // skip textPaths - they are no lines + if (children[i].nodeName === 'textPath' || isDescriptive(children[i])) { + if (i === 0) firstLine = i + 1; + continue; + } + + // add newline if its not the first child and newLined is set to true + if (i !== firstLine && children[i].nodeType !== 3 && adopt(children[i]).dom.newLined === true) { + text += '\n'; + } + + // add content of this node + text += children[i].textContent; + } + return text; + } + + // remove existing content + this.clear().build(true); + if (typeof text === 'function') { + // call block + text.call(this, this); + } else { + // store text and make sure text is not blank + text = (text + '').split('\n'); + + // build new lines + for (let j = 0, jl = text.length; j < jl; j++) { + this.newLine(text[j]); + } + } + + // disable build mode and rebuild lines + return this.build(false).rebuild(); + } +} +extend(Text, textable); +registerMethods({ + Container: { + // Create text element + text: wrapWithAttrCheck(function (text = '') { + return this.put(new Text()).text(text); + }), + // Create plain text element + plain: wrapWithAttrCheck(function (text = '') { + return this.put(new Text()).plain(text); + }) + } +}); +register(Text, 'Text'); + +class Tspan extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('tspan', node), attrs); + this._build = false; // disable build mode for adding multiple lines + } + + // Shortcut dx + dx(dx) { + return this.attr('dx', dx); + } + + // Shortcut dy + dy(dy) { + return this.attr('dy', dy); + } + + // Create new line + newLine() { + // mark new line + this.dom.newLined = true; + + // fetch parent + const text = this.parent(); + + // early return in case we are not in a text element + if (!(text instanceof Text)) { + return this; + } + const i = text.index(this); + const fontSize = globals.window.getComputedStyle(this.node).getPropertyValue('font-size'); + const dy = text.dom.leading * new SVGNumber(fontSize); + + // apply new position + return this.dy(i ? dy : 0).attr('x', text.x()); + } + + // Set text content + text(text) { + if (text == null) return this.node.textContent + (this.dom.newLined ? '\n' : ''); + if (typeof text === 'function') { + this.clear().build(true); + text.call(this, this); + this.build(false); + } else { + this.plain(text); + } + return this; + } +} +extend(Tspan, textable); +registerMethods({ + Tspan: { + tspan: wrapWithAttrCheck(function (text = '') { + const tspan = new Tspan(); + + // clear if build mode is disabled + if (!this._build) { + this.clear(); + } + + // add new tspan + return this.put(tspan).text(text); + }) + }, + Text: { + newLine: function (text = '') { + return this.tspan(text).newLine(); + } + } +}); +register(Tspan, 'Tspan'); + +class Circle extends Shape { + constructor(node, attrs = node) { + super(nodeOrNew('circle', node), attrs); + } + radius(r) { + return this.attr('r', r); + } + + // Radius x value + rx(rx) { + return this.attr('r', rx); + } + + // Alias radius x value + ry(ry) { + return this.rx(ry); + } + size(size) { + return this.radius(new SVGNumber(size).divide(2)); + } +} +extend(Circle, { + x: x$3, + y: y$3, + cx: cx$1, + cy: cy$1, + width: width$2, + height: height$2 +}); +registerMethods({ + Container: { + // Create circle element + circle: wrapWithAttrCheck(function (size = 0) { + return this.put(new Circle()).size(size).move(0, 0); + }) + } +}); +register(Circle, 'Circle'); + +class ClipPath extends Container { + constructor(node, attrs = node) { + super(nodeOrNew('clipPath', node), attrs); + } + + // Unclip all clipped elements and remove itself + remove() { + // unclip all targets + this.targets().forEach(function (el) { + el.unclip(); + }); + + // remove clipPath from parent + return super.remove(); + } + targets() { + return baseFind('svg [clip-path*=' + this.id() + ']'); + } +} +registerMethods({ + Container: { + // Create clipping element + clip: wrapWithAttrCheck(function () { + return this.defs().put(new ClipPath()); + }) + }, + Element: { + // Distribute clipPath to svg element + clipper() { + return this.reference('clip-path'); + }, + clipWith(element) { + // use given clip or create a new one + const clipper = element instanceof ClipPath ? element : this.parent().clip().add(element); + + // apply mask + return this.attr('clip-path', 'url(#' + clipper.id() + ')'); + }, + // Unclip element + unclip() { + return this.attr('clip-path', null); + } + } +}); +register(ClipPath, 'ClipPath'); + +class ForeignObject extends Element { + constructor(node, attrs = node) { + super(nodeOrNew('foreignObject', node), attrs); + } +} +registerMethods({ + Container: { + foreignObject: wrapWithAttrCheck(function (width, height) { + return this.put(new ForeignObject()).size(width, height); + }) + } +}); +register(ForeignObject, 'ForeignObject'); + +function dmove(dx, dy) { + this.children().forEach(child => { + let bbox; + + // We have to wrap this for elements that dont have a bbox + // e.g. title and other descriptive elements + try { + // Get the childs bbox + // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1905039 + // Because bbox for nested svgs returns the contents bbox in the coordinate space of the svg itself (weird!), we cant use bbox for svgs + // Therefore we have to use getBoundingClientRect. But THAT is broken (as explained in the bug). + // Funnily enough the broken behavior would work for us but that breaks it in chrome + // So we have to replicate the broken behavior of FF by just reading the attributes of the svg itself + bbox = child.node instanceof getWindow().SVGSVGElement ? new Box(child.attr(['x', 'y', 'width', 'height'])) : child.bbox(); + } catch (e) { + return; + } + + // Get childs matrix + const m = new Matrix(child); + // Translate childs matrix by amount and + // transform it back into parents space + const matrix = m.translate(dx, dy).transform(m.inverse()); + // Calculate new x and y from old box + const p = new Point(bbox.x, bbox.y).transform(matrix); + // Move element + child.move(p.x, p.y); + }); + return this; +} +function dx(dx) { + return this.dmove(dx, 0); +} +function dy(dy) { + return this.dmove(0, dy); +} +function height(height, box = this.bbox()) { + if (height == null) return box.height; + return this.size(box.width, height, box); +} +function move(x = 0, y = 0, box = this.bbox()) { + const dx = x - box.x; + const dy = y - box.y; + return this.dmove(dx, dy); +} +function size(width, height, box = this.bbox()) { + const p = proportionalSize(this, width, height, box); + const scaleX = p.width / box.width; + const scaleY = p.height / box.height; + this.children().forEach(child => { + const o = new Point(box).transform(new Matrix(child).inverse()); + child.scale(scaleX, scaleY, o.x, o.y); + }); + return this; +} +function width(width, box = this.bbox()) { + if (width == null) return box.width; + return this.size(width, box.height, box); +} +function x(x, box = this.bbox()) { + if (x == null) return box.x; + return this.move(x, box.y, box); +} +function y(y, box = this.bbox()) { + if (y == null) return box.y; + return this.move(box.x, y, box); +} + +var containerGeometry = { + __proto__: null, + dmove: dmove, + dx: dx, + dy: dy, + height: height, + move: move, + size: size, + width: width, + x: x, + y: y +}; + +class G extends Container { + constructor(node, attrs = node) { + super(nodeOrNew('g', node), attrs); + } +} +extend(G, containerGeometry); +registerMethods({ + Container: { + // Create a group element + group: wrapWithAttrCheck(function () { + return this.put(new G()); + }) + } +}); +register(G, 'G'); + +class A extends Container { + constructor(node, attrs = node) { + super(nodeOrNew('a', node), attrs); + } + + // Link target attribute + target(target) { + return this.attr('target', target); + } + + // Link url + to(url) { + return this.attr('href', url, xlink); + } +} +extend(A, containerGeometry); +registerMethods({ + Container: { + // Create a hyperlink element + link: wrapWithAttrCheck(function (url) { + return this.put(new A()).to(url); + }) + }, + Element: { + unlink() { + const link = this.linker(); + if (!link) return this; + const parent = link.parent(); + if (!parent) { + return this.remove(); + } + const index = parent.index(link); + parent.add(this, index); + link.remove(); + return this; + }, + linkTo(url) { + // reuse old link if possible + let link = this.linker(); + if (!link) { + link = new A(); + this.wrap(link); + } + if (typeof url === 'function') { + url.call(link, link); + } else { + link.to(url); + } + return this; + }, + linker() { + const link = this.parent(); + if (link && link.node.nodeName.toLowerCase() === 'a') { + return link; + } + return null; + } + } +}); +register(A, 'A'); + +class Mask extends Container { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('mask', node), attrs); + } + + // Unmask all masked elements and remove itself + remove() { + // unmask all targets + this.targets().forEach(function (el) { + el.unmask(); + }); + + // remove mask from parent + return super.remove(); + } + targets() { + return baseFind('svg [mask*=' + this.id() + ']'); + } +} +registerMethods({ + Container: { + mask: wrapWithAttrCheck(function () { + return this.defs().put(new Mask()); + }) + }, + Element: { + // Distribute mask to svg element + masker() { + return this.reference('mask'); + }, + maskWith(element) { + // use given mask or create a new one + const masker = element instanceof Mask ? element : this.parent().mask().add(element); + + // apply mask + return this.attr('mask', 'url(#' + masker.id() + ')'); + }, + // Unmask element + unmask() { + return this.attr('mask', null); + } + } +}); +register(Mask, 'Mask'); + +class Stop extends Element { + constructor(node, attrs = node) { + super(nodeOrNew('stop', node), attrs); + } + + // add color stops + update(o) { + if (typeof o === 'number' || o instanceof SVGNumber) { + o = { + offset: arguments[0], + color: arguments[1], + opacity: arguments[2] + }; + } + + // set attributes + if (o.opacity != null) this.attr('stop-opacity', o.opacity); + if (o.color != null) this.attr('stop-color', o.color); + if (o.offset != null) this.attr('offset', new SVGNumber(o.offset)); + return this; + } +} +registerMethods({ + Gradient: { + // Add a color stop + stop: function (offset, color, opacity) { + return this.put(new Stop()).update(offset, color, opacity); + } + } +}); +register(Stop, 'Stop'); + +function cssRule(selector, rule) { + if (!selector) return ''; + if (!rule) return selector; + let ret = selector + '{'; + for (const i in rule) { + ret += unCamelCase(i) + ':' + rule[i] + ';'; + } + ret += '}'; + return ret; +} +class Style extends Element { + constructor(node, attrs = node) { + super(nodeOrNew('style', node), attrs); + } + addText(w = '') { + this.node.textContent += w; + return this; + } + font(name, src, params = {}) { + return this.rule('@font-face', { + fontFamily: name, + src: src, + ...params + }); + } + rule(selector, obj) { + return this.addText(cssRule(selector, obj)); + } +} +registerMethods('Dom', { + style(selector, obj) { + return this.put(new Style()).rule(selector, obj); + }, + fontface(name, src, params) { + return this.put(new Style()).font(name, src, params); + } +}); +register(Style, 'Style'); + +class TextPath extends Text { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('textPath', node), attrs); + } + + // return the array of the path track element + array() { + const track = this.track(); + return track ? track.array() : null; + } + + // Plot path if any + plot(d) { + const track = this.track(); + let pathArray = null; + if (track) { + pathArray = track.plot(d); + } + return d == null ? pathArray : this; + } + + // Get the path element + track() { + return this.reference('href'); + } +} +registerMethods({ + Container: { + textPath: wrapWithAttrCheck(function (text, path) { + // Convert text to instance if needed + if (!(text instanceof Text)) { + text = this.text(text); + } + return text.path(path); + }) + }, + Text: { + // Create path for text to run on + path: wrapWithAttrCheck(function (track, importNodes = true) { + const textPath = new TextPath(); + + // if track is a path, reuse it + if (!(track instanceof Path)) { + // create path element + track = this.defs().path(track); + } + + // link textPath to path and add content + textPath.attr('href', '#' + track, xlink); + + // Transplant all nodes from text to textPath + let node; + if (importNodes) { + while (node = this.node.firstChild) { + textPath.node.appendChild(node); + } + } + + // add textPath element as child node and return textPath + return this.put(textPath); + }), + // Get the textPath children + textPath() { + return this.findOne('textPath'); + } + }, + Path: { + // creates a textPath from this path + text: wrapWithAttrCheck(function (text) { + // Convert text to instance if needed + if (!(text instanceof Text)) { + text = new Text().addTo(this.parent()).text(text); + } + + // Create textPath from text and path and return + return text.path(this); + }), + targets() { + return baseFind('svg textPath').filter(node => { + return (node.attr('href') || '').includes(this.id()); + }); + + // Does not work in IE11. Use when IE support is dropped + // return baseFind('svg textPath[*|href*=' + this.id() + ']') + } + } +}); +TextPath.prototype.MorphArray = PathArray; +register(TextPath, 'TextPath'); + +class Use extends Shape { + constructor(node, attrs = node) { + super(nodeOrNew('use', node), attrs); + } + + // Use element as a reference + use(element, file) { + // Set lined element + return this.attr('href', (file || '') + '#' + element, xlink); + } +} +registerMethods({ + Container: { + // Create a use element + use: wrapWithAttrCheck(function (element, file) { + return this.put(new Use()).use(element, file); + }) + } +}); +register(Use, 'Use'); + +/* Optional Modules */ +const SVG = makeInstance; +extend([Svg, Symbol, Image, Pattern, Marker], getMethodsFor('viewbox')); +extend([Line, Polyline, Polygon, Path], getMethodsFor('marker')); +extend(Text, getMethodsFor('Text')); +extend(Path, getMethodsFor('Path')); +extend(Defs, getMethodsFor('Defs')); +extend([Text, Tspan], getMethodsFor('Tspan')); +extend([Rect, Ellipse, Gradient, Runner], getMethodsFor('radius')); +extend(EventTarget, getMethodsFor('EventTarget')); +extend(Dom, getMethodsFor('Dom')); +extend(Element, getMethodsFor('Element')); +extend(Shape, getMethodsFor('Shape')); +extend([Container, Fragment], getMethodsFor('Container')); +extend(Gradient, getMethodsFor('Gradient')); +extend(Runner, getMethodsFor('Runner')); +List.extend(getMethodNames()); +registerMorphableType([SVGNumber, Color, Box, Matrix, SVGArray, PointArray, PathArray, Point]); +makeMorphable(); + +export { A, Animator, SVGArray as Array, Box, Circle, ClipPath, Color, Container, Controller, Defs, Dom, Ease, Element, Ellipse, EventTarget, ForeignObject, Fragment, G, Gradient, Image, Line, List, Marker, Mask, Matrix, Morphable, NonMorphable, SVGNumber as Number, ObjectBag, PID, Path, PathArray, Pattern, Point, PointArray, Polygon, Polyline, Queue, Rect, Runner, SVG, Shape, Spring, Stop, Style, Svg, Symbol, Text, TextPath, Timeline, TransformBag, Tspan, Use, adopt, assignNewId, clearEvents, create, defaults, dispatch, easing, eid, extend, baseFind as find, getClass, getEventTarget, getEvents, getWindow, makeInstance, makeMorphable, mockAdopt, namespaces, nodeOrNew, off, on, parser, regex, register, registerMorphableType, registerWindow, restoreWindow, root, saveWindow, utils, windowEvents, withWindow, wrapWithAttrCheck }; +//# sourceMappingURL=svg.esm.js.map diff --git a/node_modules/@svgdotjs/svg.js/dist/svg.esm.js.map b/node_modules/@svgdotjs/svg.js/dist/svg.esm.js.map new file mode 100644 index 0000000..403a04c --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/dist/svg.esm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"svg.esm.js","sources":["../src/utils/methods.js","../src/utils/utils.js","../src/modules/core/namespaces.js","../src/utils/window.js","../src/types/Base.js","../src/utils/adopter.js","../src/modules/optional/arrange.js","../src/modules/core/regex.js","../src/modules/optional/class.js","../src/modules/optional/css.js","../src/modules/optional/data.js","../src/modules/optional/memory.js","../src/types/Color.js","../src/types/Point.js","../src/types/Matrix.js","../src/modules/core/parser.js","../src/types/Box.js","../src/types/List.js","../src/modules/core/selector.js","../src/modules/core/event.js","../src/types/EventTarget.js","../src/modules/core/defaults.js","../src/types/SVGArray.js","../src/types/SVGNumber.js","../src/modules/core/attr.js","../src/elements/Dom.js","../src/elements/Element.js","../src/modules/optional/sugar.js","../src/modules/optional/transform.js","../src/elements/Container.js","../src/elements/Defs.js","../src/elements/Shape.js","../src/modules/core/circled.js","../src/elements/Ellipse.js","../src/elements/Fragment.js","../src/modules/core/gradiented.js","../src/elements/Gradient.js","../src/elements/Pattern.js","../src/elements/Image.js","../src/types/PointArray.js","../src/modules/core/pointed.js","../src/elements/Line.js","../src/elements/Marker.js","../src/animation/Controller.js","../src/utils/pathParser.js","../src/types/PathArray.js","../src/animation/Morphable.js","../src/elements/Path.js","../src/modules/core/poly.js","../src/elements/Polygon.js","../src/elements/Polyline.js","../src/elements/Rect.js","../src/animation/Queue.js","../src/animation/Animator.js","../src/animation/Timeline.js","../src/animation/Runner.js","../src/elements/Svg.js","../src/elements/Symbol.js","../src/modules/core/textable.js","../src/elements/Text.js","../src/elements/Tspan.js","../src/elements/Circle.js","../src/elements/ClipPath.js","../src/elements/ForeignObject.js","../src/modules/core/containerGeometry.js","../src/elements/G.js","../src/elements/A.js","../src/elements/Mask.js","../src/elements/Stop.js","../src/elements/Style.js","../src/elements/TextPath.js","../src/elements/Use.js","../src/main.js"],"sourcesContent":["const methods = {}\nconst names = []\n\nexport function registerMethods(name, m) {\n if (Array.isArray(name)) {\n for (const _name of name) {\n registerMethods(_name, m)\n }\n return\n }\n\n if (typeof name === 'object') {\n for (const _name in name) {\n registerMethods(_name, name[_name])\n }\n return\n }\n\n addMethodNames(Object.getOwnPropertyNames(m))\n methods[name] = Object.assign(methods[name] || {}, m)\n}\n\nexport function getMethodsFor(name) {\n return methods[name] || {}\n}\n\nexport function getMethodNames() {\n return [...new Set(names)]\n}\n\nexport function addMethodNames(_names) {\n names.push(..._names)\n}\n","// Map function\nexport function map(array, block) {\n let i\n const il = array.length\n const result = []\n\n for (i = 0; i < il; i++) {\n result.push(block(array[i]))\n }\n\n return result\n}\n\n// Filter function\nexport function filter(array, block) {\n let i\n const il = array.length\n const result = []\n\n for (i = 0; i < il; i++) {\n if (block(array[i])) {\n result.push(array[i])\n }\n }\n\n return result\n}\n\n// Degrees to radians\nexport function radians(d) {\n return ((d % 360) * Math.PI) / 180\n}\n\n// Radians to degrees\nexport function degrees(r) {\n return ((r * 180) / Math.PI) % 360\n}\n\n// Convert camel cased string to dash separated\nexport function unCamelCase(s) {\n return s.replace(/([A-Z])/g, function (m, g) {\n return '-' + g.toLowerCase()\n })\n}\n\n// Capitalize first letter of a string\nexport function capitalize(s) {\n return s.charAt(0).toUpperCase() + s.slice(1)\n}\n\n// Calculate proportional width and height values when necessary\nexport function proportionalSize(element, width, height, box) {\n if (width == null || height == null) {\n box = box || element.bbox()\n\n if (width == null) {\n width = (box.width / box.height) * height\n } else if (height == null) {\n height = (box.height / box.width) * width\n }\n }\n\n return {\n width: width,\n height: height\n }\n}\n\n/**\n * This function adds support for string origins.\n * It searches for an origin in o.origin o.ox and o.originX.\n * This way, origin: {x: 'center', y: 50} can be passed as well as ox: 'center', oy: 50\n **/\nexport function getOrigin(o, element) {\n const origin = o.origin\n // First check if origin is in ox or originX\n let ox = o.ox != null ? o.ox : o.originX != null ? o.originX : 'center'\n let oy = o.oy != null ? o.oy : o.originY != null ? o.originY : 'center'\n\n // Then check if origin was used and overwrite in that case\n if (origin != null) {\n ;[ox, oy] = Array.isArray(origin)\n ? origin\n : typeof origin === 'object'\n ? [origin.x, origin.y]\n : [origin, origin]\n }\n\n // Make sure to only call bbox when actually needed\n const condX = typeof ox === 'string'\n const condY = typeof oy === 'string'\n if (condX || condY) {\n const { height, width, x, y } = element.bbox()\n\n // And only overwrite if string was passed for this specific axis\n if (condX) {\n ox = ox.includes('left')\n ? x\n : ox.includes('right')\n ? x + width\n : x + width / 2\n }\n\n if (condY) {\n oy = oy.includes('top')\n ? y\n : oy.includes('bottom')\n ? y + height\n : y + height / 2\n }\n }\n\n // Return the origin as it is if it wasn't a string\n return [ox, oy]\n}\n\nconst descriptiveElements = new Set(['desc', 'metadata', 'title'])\nexport const isDescriptive = (element) =>\n descriptiveElements.has(element.nodeName)\n\nexport const writeDataToDom = (element, data, defaults = {}) => {\n const cloned = { ...data }\n\n for (const key in cloned) {\n if (cloned[key].valueOf() === defaults[key]) {\n delete cloned[key]\n }\n }\n\n if (Object.keys(cloned).length) {\n element.node.setAttribute('data-svgjs', JSON.stringify(cloned)) // see #428\n } else {\n element.node.removeAttribute('data-svgjs')\n element.node.removeAttribute('svgjs:data')\n }\n}\n","// Default namespaces\nexport const svg = 'http://www.w3.org/2000/svg'\nexport const html = 'http://www.w3.org/1999/xhtml'\nexport const xmlns = 'http://www.w3.org/2000/xmlns/'\nexport const xlink = 'http://www.w3.org/1999/xlink'\n","export const globals = {\n window: typeof window === 'undefined' ? null : window,\n document: typeof document === 'undefined' ? null : document\n}\n\nexport function registerWindow(win = null, doc = null) {\n globals.window = win\n globals.document = doc\n}\n\nconst save = {}\n\nexport function saveWindow() {\n save.window = globals.window\n save.document = globals.document\n}\n\nexport function restoreWindow() {\n globals.window = save.window\n globals.document = save.document\n}\n\nexport function withWindow(win, fn) {\n saveWindow()\n registerWindow(win, win.document)\n fn(win, win.document)\n restoreWindow()\n}\n\nexport function getWindow() {\n return globals.window\n}\n","export default class Base {\n // constructor (node/*, {extensions = []} */) {\n // // this.tags = []\n // //\n // // for (let extension of extensions) {\n // // extension.setup.call(this, node)\n // // this.tags.push(extension.name)\n // // }\n // }\n}\n","import { addMethodNames } from './methods.js'\nimport { capitalize } from './utils.js'\nimport { svg } from '../modules/core/namespaces.js'\nimport { globals } from '../utils/window.js'\nimport Base from '../types/Base.js'\n\nconst elements = {}\nexport const root = '___SYMBOL___ROOT___'\n\n// Method for element creation\nexport function create(name, ns = svg) {\n // create element\n return globals.document.createElementNS(ns, name)\n}\n\nexport function makeInstance(element, isHTML = false) {\n if (element instanceof Base) return element\n\n if (typeof element === 'object') {\n return adopter(element)\n }\n\n if (element == null) {\n return new elements[root]()\n }\n\n if (typeof element === 'string' && element.charAt(0) !== '<') {\n return adopter(globals.document.querySelector(element))\n }\n\n // Make sure, that HTML elements are created with the correct namespace\n const wrapper = isHTML ? globals.document.createElement('div') : create('svg')\n wrapper.innerHTML = element\n\n // We can use firstChild here because we know,\n // that the first char is < and thus an element\n element = adopter(wrapper.firstChild)\n\n // make sure, that element doesn't have its wrapper attached\n wrapper.removeChild(wrapper.firstChild)\n return element\n}\n\nexport function nodeOrNew(name, node) {\n return node &&\n (node instanceof globals.window.Node ||\n (node.ownerDocument &&\n node instanceof node.ownerDocument.defaultView.Node))\n ? node\n : create(name)\n}\n\n// Adopt existing svg elements\nexport function adopt(node) {\n // check for presence of node\n if (!node) return null\n\n // make sure a node isn't already adopted\n if (node.instance instanceof Base) return node.instance\n\n if (node.nodeName === '#document-fragment') {\n return new elements.Fragment(node)\n }\n\n // initialize variables\n let className = capitalize(node.nodeName || 'Dom')\n\n // Make sure that gradients are adopted correctly\n if (className === 'LinearGradient' || className === 'RadialGradient') {\n className = 'Gradient'\n\n // Fallback to Dom if element is not known\n } else if (!elements[className]) {\n className = 'Dom'\n }\n\n return new elements[className](node)\n}\n\nlet adopter = adopt\n\nexport function mockAdopt(mock = adopt) {\n adopter = mock\n}\n\nexport function register(element, name = element.name, asRoot = false) {\n elements[name] = element\n if (asRoot) elements[root] = element\n\n addMethodNames(Object.getOwnPropertyNames(element.prototype))\n\n return element\n}\n\nexport function getClass(name) {\n return elements[name]\n}\n\n// Element id sequence\nlet did = 1000\n\n// Get next named element id\nexport function eid(name) {\n return 'Svgjs' + capitalize(name) + did++\n}\n\n// Deep new id assignment\nexport function assignNewId(node) {\n // do the same for SVG child nodes as well\n for (let i = node.children.length - 1; i >= 0; i--) {\n assignNewId(node.children[i])\n }\n\n if (node.id) {\n node.id = eid(node.nodeName)\n return node\n }\n\n return node\n}\n\n// Method for extending objects\nexport function extend(modules, methods) {\n let key, i\n\n modules = Array.isArray(modules) ? modules : [modules]\n\n for (i = modules.length - 1; i >= 0; i--) {\n for (key in methods) {\n modules[i].prototype[key] = methods[key]\n }\n }\n}\n\nexport function wrapWithAttrCheck(fn) {\n return function (...args) {\n const o = args[args.length - 1]\n\n if (o && o.constructor === Object && !(o instanceof Array)) {\n return fn.apply(this, args.slice(0, -1)).attr(o)\n } else {\n return fn.apply(this, args)\n }\n }\n}\n","import { makeInstance } from '../../utils/adopter.js'\nimport { registerMethods } from '../../utils/methods.js'\n\n// Get all siblings, including myself\nexport function siblings() {\n return this.parent().children()\n}\n\n// Get the current position siblings\nexport function position() {\n return this.parent().index(this)\n}\n\n// Get the next element (will return null if there is none)\nexport function next() {\n return this.siblings()[this.position() + 1]\n}\n\n// Get the next element (will return null if there is none)\nexport function prev() {\n return this.siblings()[this.position() - 1]\n}\n\n// Send given element one step forward\nexport function forward() {\n const i = this.position()\n const p = this.parent()\n\n // move node one step forward\n p.add(this.remove(), i + 1)\n\n return this\n}\n\n// Send given element one step backward\nexport function backward() {\n const i = this.position()\n const p = this.parent()\n\n p.add(this.remove(), i ? i - 1 : 0)\n\n return this\n}\n\n// Send given element all the way to the front\nexport function front() {\n const p = this.parent()\n\n // Move node forward\n p.add(this.remove())\n\n return this\n}\n\n// Send given element all the way to the back\nexport function back() {\n const p = this.parent()\n\n // Move node back\n p.add(this.remove(), 0)\n\n return this\n}\n\n// Inserts a given element before the targeted element\nexport function before(element) {\n element = makeInstance(element)\n element.remove()\n\n const i = this.position()\n\n this.parent().add(element, i)\n\n return this\n}\n\n// Inserts a given element after the targeted element\nexport function after(element) {\n element = makeInstance(element)\n element.remove()\n\n const i = this.position()\n\n this.parent().add(element, i + 1)\n\n return this\n}\n\nexport function insertBefore(element) {\n element = makeInstance(element)\n element.before(this)\n return this\n}\n\nexport function insertAfter(element) {\n element = makeInstance(element)\n element.after(this)\n return this\n}\n\nregisterMethods('Dom', {\n siblings,\n position,\n next,\n prev,\n forward,\n backward,\n front,\n back,\n before,\n after,\n insertBefore,\n insertAfter\n})\n","// Parse unit value\nexport const numberAndUnit =\n /^([+-]?(\\d+(\\.\\d*)?|\\.\\d+)(e[+-]?\\d+)?)([a-z%]*)$/i\n\n// Parse hex value\nexport const hex = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i\n\n// Parse rgb value\nexport const rgb = /rgb\\((\\d+),(\\d+),(\\d+)\\)/\n\n// Parse reference id\nexport const reference = /(#[a-z_][a-z0-9\\-_]*)/i\n\n// splits a transformation chain\nexport const transforms = /\\)\\s*,?\\s*/\n\n// Whitespace\nexport const whitespace = /\\s/g\n\n// Test hex value\nexport const isHex = /^#[a-f0-9]{3}$|^#[a-f0-9]{6}$/i\n\n// Test rgb value\nexport const isRgb = /^rgb\\(/\n\n// Test for blank string\nexport const isBlank = /^(\\s+)?$/\n\n// Test for numeric string\nexport const isNumber = /^[+-]?(\\d+(\\.\\d*)?|\\.\\d+)(e[+-]?\\d+)?$/i\n\n// Test for image url\nexport const isImage = /\\.(jpg|jpeg|png|gif|svg)(\\?[^=]+.*)?/i\n\n// split at whitespace and comma\nexport const delimiter = /[\\s,]+/\n\n// Test for path letter\nexport const isPathLetter = /[MLHVCSQTAZ]/i\n","import { delimiter } from '../core/regex.js'\nimport { registerMethods } from '../../utils/methods.js'\n\n// Return array of classes on the node\nexport function classes() {\n const attr = this.attr('class')\n return attr == null ? [] : attr.trim().split(delimiter)\n}\n\n// Return true if class exists on the node, false otherwise\nexport function hasClass(name) {\n return this.classes().indexOf(name) !== -1\n}\n\n// Add class to the node\nexport function addClass(name) {\n if (!this.hasClass(name)) {\n const array = this.classes()\n array.push(name)\n this.attr('class', array.join(' '))\n }\n\n return this\n}\n\n// Remove class from the node\nexport function removeClass(name) {\n if (this.hasClass(name)) {\n this.attr(\n 'class',\n this.classes()\n .filter(function (c) {\n return c !== name\n })\n .join(' ')\n )\n }\n\n return this\n}\n\n// Toggle the presence of a class on the node\nexport function toggleClass(name) {\n return this.hasClass(name) ? this.removeClass(name) : this.addClass(name)\n}\n\nregisterMethods('Dom', {\n classes,\n hasClass,\n addClass,\n removeClass,\n toggleClass\n})\n","import { isBlank } from '../core/regex.js'\nimport { registerMethods } from '../../utils/methods.js'\n\n// Dynamic style generator\nexport function css(style, val) {\n const ret = {}\n if (arguments.length === 0) {\n // get full style as object\n this.node.style.cssText\n .split(/\\s*;\\s*/)\n .filter(function (el) {\n return !!el.length\n })\n .forEach(function (el) {\n const t = el.split(/\\s*:\\s*/)\n ret[t[0]] = t[1]\n })\n return ret\n }\n\n if (arguments.length < 2) {\n // get style properties as array\n if (Array.isArray(style)) {\n for (const name of style) {\n const cased = name\n ret[name] = this.node.style.getPropertyValue(cased)\n }\n return ret\n }\n\n // get style for property\n if (typeof style === 'string') {\n return this.node.style.getPropertyValue(style)\n }\n\n // set styles in object\n if (typeof style === 'object') {\n for (const name in style) {\n // set empty string if null/undefined/'' was given\n this.node.style.setProperty(\n name,\n style[name] == null || isBlank.test(style[name]) ? '' : style[name]\n )\n }\n }\n }\n\n // set style for property\n if (arguments.length === 2) {\n this.node.style.setProperty(\n style,\n val == null || isBlank.test(val) ? '' : val\n )\n }\n\n return this\n}\n\n// Show element\nexport function show() {\n return this.css('display', '')\n}\n\n// Hide element\nexport function hide() {\n return this.css('display', 'none')\n}\n\n// Is element visible?\nexport function visible() {\n return this.css('display') !== 'none'\n}\n\nregisterMethods('Dom', {\n css,\n show,\n hide,\n visible\n})\n","import { registerMethods } from '../../utils/methods.js'\nimport { filter, map } from '../../utils/utils.js'\n\n// Store data values on svg nodes\nexport function data(a, v, r) {\n if (a == null) {\n // get an object of attributes\n return this.data(\n map(\n filter(\n this.node.attributes,\n (el) => el.nodeName.indexOf('data-') === 0\n ),\n (el) => el.nodeName.slice(5)\n )\n )\n } else if (a instanceof Array) {\n const data = {}\n for (const key of a) {\n data[key] = this.data(key)\n }\n return data\n } else if (typeof a === 'object') {\n for (v in a) {\n this.data(v, a[v])\n }\n } else if (arguments.length < 2) {\n try {\n return JSON.parse(this.attr('data-' + a))\n } catch (e) {\n return this.attr('data-' + a)\n }\n } else {\n this.attr(\n 'data-' + a,\n v === null\n ? null\n : r === true || typeof v === 'string' || typeof v === 'number'\n ? v\n : JSON.stringify(v)\n )\n }\n\n return this\n}\n\nregisterMethods('Dom', { data })\n","import { registerMethods } from '../../utils/methods.js'\n\n// Remember arbitrary data\nexport function remember(k, v) {\n // remember every item in an object individually\n if (typeof arguments[0] === 'object') {\n for (const key in k) {\n this.remember(key, k[key])\n }\n } else if (arguments.length === 1) {\n // retrieve memory\n return this.memory()[k]\n } else {\n // store memory\n this.memory()[k] = v\n }\n\n return this\n}\n\n// Erase a given memory\nexport function forget() {\n if (arguments.length === 0) {\n this._memory = {}\n } else {\n for (let i = arguments.length - 1; i >= 0; i--) {\n delete this.memory()[arguments[i]]\n }\n }\n return this\n}\n\n// This triggers creation of a new hidden class which is not performant\n// However, this function is not rarely used so it will not happen frequently\n// Return local memory object\nexport function memory() {\n return (this._memory = this._memory || {})\n}\n\nregisterMethods('Dom', { remember, forget, memory })\n","import { hex, isHex, isRgb, rgb, whitespace } from '../modules/core/regex.js'\n\nfunction sixDigitHex(hex) {\n return hex.length === 4\n ? [\n '#',\n hex.substring(1, 2),\n hex.substring(1, 2),\n hex.substring(2, 3),\n hex.substring(2, 3),\n hex.substring(3, 4),\n hex.substring(3, 4)\n ].join('')\n : hex\n}\n\nfunction componentHex(component) {\n const integer = Math.round(component)\n const bounded = Math.max(0, Math.min(255, integer))\n const hex = bounded.toString(16)\n return hex.length === 1 ? '0' + hex : hex\n}\n\nfunction is(object, space) {\n for (let i = space.length; i--; ) {\n if (object[space[i]] == null) {\n return false\n }\n }\n return true\n}\n\nfunction getParameters(a, b) {\n const params = is(a, 'rgb')\n ? { _a: a.r, _b: a.g, _c: a.b, _d: 0, space: 'rgb' }\n : is(a, 'xyz')\n ? { _a: a.x, _b: a.y, _c: a.z, _d: 0, space: 'xyz' }\n : is(a, 'hsl')\n ? { _a: a.h, _b: a.s, _c: a.l, _d: 0, space: 'hsl' }\n : is(a, 'lab')\n ? { _a: a.l, _b: a.a, _c: a.b, _d: 0, space: 'lab' }\n : is(a, 'lch')\n ? { _a: a.l, _b: a.c, _c: a.h, _d: 0, space: 'lch' }\n : is(a, 'cmyk')\n ? { _a: a.c, _b: a.m, _c: a.y, _d: a.k, space: 'cmyk' }\n : { _a: 0, _b: 0, _c: 0, space: 'rgb' }\n\n params.space = b || params.space\n return params\n}\n\nfunction cieSpace(space) {\n if (space === 'lab' || space === 'xyz' || space === 'lch') {\n return true\n } else {\n return false\n }\n}\n\nfunction hueToRgb(p, q, t) {\n if (t < 0) t += 1\n if (t > 1) t -= 1\n if (t < 1 / 6) return p + (q - p) * 6 * t\n if (t < 1 / 2) return q\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6\n return p\n}\n\nexport default class Color {\n constructor(...inputs) {\n this.init(...inputs)\n }\n\n // Test if given value is a color\n static isColor(color) {\n return (\n color && (color instanceof Color || this.isRgb(color) || this.test(color))\n )\n }\n\n // Test if given value is an rgb object\n static isRgb(color) {\n return (\n color &&\n typeof color.r === 'number' &&\n typeof color.g === 'number' &&\n typeof color.b === 'number'\n )\n }\n\n /*\n Generating random colors\n */\n static random(mode = 'vibrant', t) {\n // Get the math modules\n const { random, round, sin, PI: pi } = Math\n\n // Run the correct generator\n if (mode === 'vibrant') {\n const l = (81 - 57) * random() + 57\n const c = (83 - 45) * random() + 45\n const h = 360 * random()\n const color = new Color(l, c, h, 'lch')\n return color\n } else if (mode === 'sine') {\n t = t == null ? random() : t\n const r = round(80 * sin((2 * pi * t) / 0.5 + 0.01) + 150)\n const g = round(50 * sin((2 * pi * t) / 0.5 + 4.6) + 200)\n const b = round(100 * sin((2 * pi * t) / 0.5 + 2.3) + 150)\n const color = new Color(r, g, b)\n return color\n } else if (mode === 'pastel') {\n const l = (94 - 86) * random() + 86\n const c = (26 - 9) * random() + 9\n const h = 360 * random()\n const color = new Color(l, c, h, 'lch')\n return color\n } else if (mode === 'dark') {\n const l = 10 + 10 * random()\n const c = (125 - 75) * random() + 86\n const h = 360 * random()\n const color = new Color(l, c, h, 'lch')\n return color\n } else if (mode === 'rgb') {\n const r = 255 * random()\n const g = 255 * random()\n const b = 255 * random()\n const color = new Color(r, g, b)\n return color\n } else if (mode === 'lab') {\n const l = 100 * random()\n const a = 256 * random() - 128\n const b = 256 * random() - 128\n const color = new Color(l, a, b, 'lab')\n return color\n } else if (mode === 'grey') {\n const grey = 255 * random()\n const color = new Color(grey, grey, grey)\n return color\n } else {\n throw new Error('Unsupported random color mode')\n }\n }\n\n // Test if given value is a color string\n static test(color) {\n return typeof color === 'string' && (isHex.test(color) || isRgb.test(color))\n }\n\n cmyk() {\n // Get the rgb values for the current color\n const { _a, _b, _c } = this.rgb()\n const [r, g, b] = [_a, _b, _c].map((v) => v / 255)\n\n // Get the cmyk values in an unbounded format\n const k = Math.min(1 - r, 1 - g, 1 - b)\n\n if (k === 1) {\n // Catch the black case\n return new Color(0, 0, 0, 1, 'cmyk')\n }\n\n const c = (1 - r - k) / (1 - k)\n const m = (1 - g - k) / (1 - k)\n const y = (1 - b - k) / (1 - k)\n\n // Construct the new color\n const color = new Color(c, m, y, k, 'cmyk')\n return color\n }\n\n hsl() {\n // Get the rgb values\n const { _a, _b, _c } = this.rgb()\n const [r, g, b] = [_a, _b, _c].map((v) => v / 255)\n\n // Find the maximum and minimum values to get the lightness\n const max = Math.max(r, g, b)\n const min = Math.min(r, g, b)\n const l = (max + min) / 2\n\n // If the r, g, v values are identical then we are grey\n const isGrey = max === min\n\n // Calculate the hue and saturation\n const delta = max - min\n const s = isGrey\n ? 0\n : l > 0.5\n ? delta / (2 - max - min)\n : delta / (max + min)\n const h = isGrey\n ? 0\n : max === r\n ? ((g - b) / delta + (g < b ? 6 : 0)) / 6\n : max === g\n ? ((b - r) / delta + 2) / 6\n : max === b\n ? ((r - g) / delta + 4) / 6\n : 0\n\n // Construct and return the new color\n const color = new Color(360 * h, 100 * s, 100 * l, 'hsl')\n return color\n }\n\n init(a = 0, b = 0, c = 0, d = 0, space = 'rgb') {\n // This catches the case when a falsy value is passed like ''\n a = !a ? 0 : a\n\n // Reset all values in case the init function is rerun with new color space\n if (this.space) {\n for (const component in this.space) {\n delete this[this.space[component]]\n }\n }\n\n if (typeof a === 'number') {\n // Allow for the case that we don't need d...\n space = typeof d === 'string' ? d : space\n d = typeof d === 'string' ? 0 : d\n\n // Assign the values straight to the color\n Object.assign(this, { _a: a, _b: b, _c: c, _d: d, space })\n // If the user gave us an array, make the color from it\n } else if (a instanceof Array) {\n this.space = b || (typeof a[3] === 'string' ? a[3] : a[4]) || 'rgb'\n Object.assign(this, { _a: a[0], _b: a[1], _c: a[2], _d: a[3] || 0 })\n } else if (a instanceof Object) {\n // Set the object up and assign its values directly\n const values = getParameters(a, b)\n Object.assign(this, values)\n } else if (typeof a === 'string') {\n if (isRgb.test(a)) {\n const noWhitespace = a.replace(whitespace, '')\n const [_a, _b, _c] = rgb\n .exec(noWhitespace)\n .slice(1, 4)\n .map((v) => parseInt(v))\n Object.assign(this, { _a, _b, _c, _d: 0, space: 'rgb' })\n } else if (isHex.test(a)) {\n const hexParse = (v) => parseInt(v, 16)\n const [, _a, _b, _c] = hex.exec(sixDigitHex(a)).map(hexParse)\n Object.assign(this, { _a, _b, _c, _d: 0, space: 'rgb' })\n } else throw Error(\"Unsupported string format, can't construct Color\")\n }\n\n // Now add the components as a convenience\n const { _a, _b, _c, _d } = this\n const components =\n this.space === 'rgb'\n ? { r: _a, g: _b, b: _c }\n : this.space === 'xyz'\n ? { x: _a, y: _b, z: _c }\n : this.space === 'hsl'\n ? { h: _a, s: _b, l: _c }\n : this.space === 'lab'\n ? { l: _a, a: _b, b: _c }\n : this.space === 'lch'\n ? { l: _a, c: _b, h: _c }\n : this.space === 'cmyk'\n ? { c: _a, m: _b, y: _c, k: _d }\n : {}\n Object.assign(this, components)\n }\n\n lab() {\n // Get the xyz color\n const { x, y, z } = this.xyz()\n\n // Get the lab components\n const l = 116 * y - 16\n const a = 500 * (x - y)\n const b = 200 * (y - z)\n\n // Construct and return a new color\n const color = new Color(l, a, b, 'lab')\n return color\n }\n\n lch() {\n // Get the lab color directly\n const { l, a, b } = this.lab()\n\n // Get the chromaticity and the hue using polar coordinates\n const c = Math.sqrt(a ** 2 + b ** 2)\n let h = (180 * Math.atan2(b, a)) / Math.PI\n if (h < 0) {\n h *= -1\n h = 360 - h\n }\n\n // Make a new color and return it\n const color = new Color(l, c, h, 'lch')\n return color\n }\n /*\n Conversion Methods\n */\n\n rgb() {\n if (this.space === 'rgb') {\n return this\n } else if (cieSpace(this.space)) {\n // Convert to the xyz color space\n let { x, y, z } = this\n if (this.space === 'lab' || this.space === 'lch') {\n // Get the values in the lab space\n let { l, a, b } = this\n if (this.space === 'lch') {\n const { c, h } = this\n const dToR = Math.PI / 180\n a = c * Math.cos(dToR * h)\n b = c * Math.sin(dToR * h)\n }\n\n // Undo the nonlinear function\n const yL = (l + 16) / 116\n const xL = a / 500 + yL\n const zL = yL - b / 200\n\n // Get the xyz values\n const ct = 16 / 116\n const mx = 0.008856\n const nm = 7.787\n x = 0.95047 * (xL ** 3 > mx ? xL ** 3 : (xL - ct) / nm)\n y = 1.0 * (yL ** 3 > mx ? yL ** 3 : (yL - ct) / nm)\n z = 1.08883 * (zL ** 3 > mx ? zL ** 3 : (zL - ct) / nm)\n }\n\n // Convert xyz to unbounded rgb values\n const rU = x * 3.2406 + y * -1.5372 + z * -0.4986\n const gU = x * -0.9689 + y * 1.8758 + z * 0.0415\n const bU = x * 0.0557 + y * -0.204 + z * 1.057\n\n // Convert the values to true rgb values\n const pow = Math.pow\n const bd = 0.0031308\n const r = rU > bd ? 1.055 * pow(rU, 1 / 2.4) - 0.055 : 12.92 * rU\n const g = gU > bd ? 1.055 * pow(gU, 1 / 2.4) - 0.055 : 12.92 * gU\n const b = bU > bd ? 1.055 * pow(bU, 1 / 2.4) - 0.055 : 12.92 * bU\n\n // Make and return the color\n const color = new Color(255 * r, 255 * g, 255 * b)\n return color\n } else if (this.space === 'hsl') {\n // https://bgrins.github.io/TinyColor/docs/tinycolor.html\n // Get the current hsl values\n let { h, s, l } = this\n h /= 360\n s /= 100\n l /= 100\n\n // If we are grey, then just make the color directly\n if (s === 0) {\n l *= 255\n const color = new Color(l, l, l)\n return color\n }\n\n // TODO I have no idea what this does :D If you figure it out, tell me!\n const q = l < 0.5 ? l * (1 + s) : l + s - l * s\n const p = 2 * l - q\n\n // Get the rgb values\n const r = 255 * hueToRgb(p, q, h + 1 / 3)\n const g = 255 * hueToRgb(p, q, h)\n const b = 255 * hueToRgb(p, q, h - 1 / 3)\n\n // Make a new color\n const color = new Color(r, g, b)\n return color\n } else if (this.space === 'cmyk') {\n // https://gist.github.com/felipesabino/5066336\n // Get the normalised cmyk values\n const { c, m, y, k } = this\n\n // Get the rgb values\n const r = 255 * (1 - Math.min(1, c * (1 - k) + k))\n const g = 255 * (1 - Math.min(1, m * (1 - k) + k))\n const b = 255 * (1 - Math.min(1, y * (1 - k) + k))\n\n // Form the color and return it\n const color = new Color(r, g, b)\n return color\n } else {\n return this\n }\n }\n\n toArray() {\n const { _a, _b, _c, _d, space } = this\n return [_a, _b, _c, _d, space]\n }\n\n toHex() {\n const [r, g, b] = this._clamped().map(componentHex)\n return `#${r}${g}${b}`\n }\n\n toRgb() {\n const [rV, gV, bV] = this._clamped()\n const string = `rgb(${rV},${gV},${bV})`\n return string\n }\n\n toString() {\n return this.toHex()\n }\n\n xyz() {\n // Normalise the red, green and blue values\n const { _a: r255, _b: g255, _c: b255 } = this.rgb()\n const [r, g, b] = [r255, g255, b255].map((v) => v / 255)\n\n // Convert to the lab rgb space\n const rL = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92\n const gL = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92\n const bL = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92\n\n // Convert to the xyz color space without bounding the values\n const xU = (rL * 0.4124 + gL * 0.3576 + bL * 0.1805) / 0.95047\n const yU = (rL * 0.2126 + gL * 0.7152 + bL * 0.0722) / 1.0\n const zU = (rL * 0.0193 + gL * 0.1192 + bL * 0.9505) / 1.08883\n\n // Get the proper xyz values by applying the bounding\n const x = xU > 0.008856 ? Math.pow(xU, 1 / 3) : 7.787 * xU + 16 / 116\n const y = yU > 0.008856 ? Math.pow(yU, 1 / 3) : 7.787 * yU + 16 / 116\n const z = zU > 0.008856 ? Math.pow(zU, 1 / 3) : 7.787 * zU + 16 / 116\n\n // Make and return the color\n const color = new Color(x, y, z, 'xyz')\n return color\n }\n\n /*\n Input and Output methods\n */\n\n _clamped() {\n const { _a, _b, _c } = this.rgb()\n const { max, min, round } = Math\n const format = (v) => max(0, min(round(v), 255))\n return [_a, _b, _c].map(format)\n }\n\n /*\n Constructing colors\n */\n}\n","import Matrix from './Matrix.js'\n\nexport default class Point {\n // Initialize\n constructor(...args) {\n this.init(...args)\n }\n\n // Clone point\n clone() {\n return new Point(this)\n }\n\n init(x, y) {\n const base = { x: 0, y: 0 }\n\n // ensure source as object\n const source = Array.isArray(x)\n ? { x: x[0], y: x[1] }\n : typeof x === 'object'\n ? { x: x.x, y: x.y }\n : { x: x, y: y }\n\n // merge source\n this.x = source.x == null ? base.x : source.x\n this.y = source.y == null ? base.y : source.y\n\n return this\n }\n\n toArray() {\n return [this.x, this.y]\n }\n\n transform(m) {\n return this.clone().transformO(m)\n }\n\n // Transform point with matrix\n transformO(m) {\n if (!Matrix.isMatrixLike(m)) {\n m = new Matrix(m)\n }\n\n const { x, y } = this\n\n // Perform the matrix multiplication\n this.x = m.a * x + m.c * y + m.e\n this.y = m.b * x + m.d * y + m.f\n\n return this\n }\n}\n\nexport function point(x, y) {\n return new Point(x, y).transformO(this.screenCTM().inverseO())\n}\n","import { delimiter } from '../modules/core/regex.js'\nimport { radians } from '../utils/utils.js'\nimport { register } from '../utils/adopter.js'\nimport Element from '../elements/Element.js'\nimport Point from './Point.js'\n\nfunction closeEnough(a, b, threshold) {\n return Math.abs(b - a) < (threshold || 1e-6)\n}\n\nexport default class Matrix {\n constructor(...args) {\n this.init(...args)\n }\n\n static formatTransforms(o) {\n // Get all of the parameters required to form the matrix\n const flipBoth = o.flip === 'both' || o.flip === true\n const flipX = o.flip && (flipBoth || o.flip === 'x') ? -1 : 1\n const flipY = o.flip && (flipBoth || o.flip === 'y') ? -1 : 1\n const skewX =\n o.skew && o.skew.length\n ? o.skew[0]\n : isFinite(o.skew)\n ? o.skew\n : isFinite(o.skewX)\n ? o.skewX\n : 0\n const skewY =\n o.skew && o.skew.length\n ? o.skew[1]\n : isFinite(o.skew)\n ? o.skew\n : isFinite(o.skewY)\n ? o.skewY\n : 0\n const scaleX =\n o.scale && o.scale.length\n ? o.scale[0] * flipX\n : isFinite(o.scale)\n ? o.scale * flipX\n : isFinite(o.scaleX)\n ? o.scaleX * flipX\n : flipX\n const scaleY =\n o.scale && o.scale.length\n ? o.scale[1] * flipY\n : isFinite(o.scale)\n ? o.scale * flipY\n : isFinite(o.scaleY)\n ? o.scaleY * flipY\n : flipY\n const shear = o.shear || 0\n const theta = o.rotate || o.theta || 0\n const origin = new Point(\n o.origin || o.around || o.ox || o.originX,\n o.oy || o.originY\n )\n const ox = origin.x\n const oy = origin.y\n // We need Point to be invalid if nothing was passed because we cannot default to 0 here. That is why NaN\n const position = new Point(\n o.position || o.px || o.positionX || NaN,\n o.py || o.positionY || NaN\n )\n const px = position.x\n const py = position.y\n const translate = new Point(\n o.translate || o.tx || o.translateX,\n o.ty || o.translateY\n )\n const tx = translate.x\n const ty = translate.y\n const relative = new Point(\n o.relative || o.rx || o.relativeX,\n o.ry || o.relativeY\n )\n const rx = relative.x\n const ry = relative.y\n\n // Populate all of the values\n return {\n scaleX,\n scaleY,\n skewX,\n skewY,\n shear,\n theta,\n rx,\n ry,\n tx,\n ty,\n ox,\n oy,\n px,\n py\n }\n }\n\n static fromArray(a) {\n return { a: a[0], b: a[1], c: a[2], d: a[3], e: a[4], f: a[5] }\n }\n\n static isMatrixLike(o) {\n return (\n o.a != null ||\n o.b != null ||\n o.c != null ||\n o.d != null ||\n o.e != null ||\n o.f != null\n )\n }\n\n // left matrix, right matrix, target matrix which is overwritten\n static matrixMultiply(l, r, o) {\n // Work out the product directly\n const a = l.a * r.a + l.c * r.b\n const b = l.b * r.a + l.d * r.b\n const c = l.a * r.c + l.c * r.d\n const d = l.b * r.c + l.d * r.d\n const e = l.e + l.a * r.e + l.c * r.f\n const f = l.f + l.b * r.e + l.d * r.f\n\n // make sure to use local variables because l/r and o could be the same\n o.a = a\n o.b = b\n o.c = c\n o.d = d\n o.e = e\n o.f = f\n\n return o\n }\n\n around(cx, cy, matrix) {\n return this.clone().aroundO(cx, cy, matrix)\n }\n\n // Transform around a center point\n aroundO(cx, cy, matrix) {\n const dx = cx || 0\n const dy = cy || 0\n return this.translateO(-dx, -dy).lmultiplyO(matrix).translateO(dx, dy)\n }\n\n // Clones this matrix\n clone() {\n return new Matrix(this)\n }\n\n // Decomposes this matrix into its affine parameters\n decompose(cx = 0, cy = 0) {\n // Get the parameters from the matrix\n const a = this.a\n const b = this.b\n const c = this.c\n const d = this.d\n const e = this.e\n const f = this.f\n\n // Figure out if the winding direction is clockwise or counterclockwise\n const determinant = a * d - b * c\n const ccw = determinant > 0 ? 1 : -1\n\n // Since we only shear in x, we can use the x basis to get the x scale\n // and the rotation of the resulting matrix\n const sx = ccw * Math.sqrt(a * a + b * b)\n const thetaRad = Math.atan2(ccw * b, ccw * a)\n const theta = (180 / Math.PI) * thetaRad\n const ct = Math.cos(thetaRad)\n const st = Math.sin(thetaRad)\n\n // We can then solve the y basis vector simultaneously to get the other\n // two affine parameters directly from these parameters\n const lam = (a * c + b * d) / determinant\n const sy = (c * sx) / (lam * a - b) || (d * sx) / (lam * b + a)\n\n // Use the translations\n const tx = e - cx + cx * ct * sx + cy * (lam * ct * sx - st * sy)\n const ty = f - cy + cx * st * sx + cy * (lam * st * sx + ct * sy)\n\n // Construct the decomposition and return it\n return {\n // Return the affine parameters\n scaleX: sx,\n scaleY: sy,\n shear: lam,\n rotate: theta,\n translateX: tx,\n translateY: ty,\n originX: cx,\n originY: cy,\n\n // Return the matrix parameters\n a: this.a,\n b: this.b,\n c: this.c,\n d: this.d,\n e: this.e,\n f: this.f\n }\n }\n\n // Check if two matrices are equal\n equals(other) {\n if (other === this) return true\n const comp = new Matrix(other)\n return (\n closeEnough(this.a, comp.a) &&\n closeEnough(this.b, comp.b) &&\n closeEnough(this.c, comp.c) &&\n closeEnough(this.d, comp.d) &&\n closeEnough(this.e, comp.e) &&\n closeEnough(this.f, comp.f)\n )\n }\n\n // Flip matrix on x or y, at a given offset\n flip(axis, around) {\n return this.clone().flipO(axis, around)\n }\n\n flipO(axis, around) {\n return axis === 'x'\n ? this.scaleO(-1, 1, around, 0)\n : axis === 'y'\n ? this.scaleO(1, -1, 0, around)\n : this.scaleO(-1, -1, axis, around || axis) // Define an x, y flip point\n }\n\n // Initialize\n init(source) {\n const base = Matrix.fromArray([1, 0, 0, 1, 0, 0])\n\n // ensure source as object\n source =\n source instanceof Element\n ? source.matrixify()\n : typeof source === 'string'\n ? Matrix.fromArray(source.split(delimiter).map(parseFloat))\n : Array.isArray(source)\n ? Matrix.fromArray(source)\n : typeof source === 'object' && Matrix.isMatrixLike(source)\n ? source\n : typeof source === 'object'\n ? new Matrix().transform(source)\n : arguments.length === 6\n ? Matrix.fromArray([].slice.call(arguments))\n : base\n\n // Merge the source matrix with the base matrix\n this.a = source.a != null ? source.a : base.a\n this.b = source.b != null ? source.b : base.b\n this.c = source.c != null ? source.c : base.c\n this.d = source.d != null ? source.d : base.d\n this.e = source.e != null ? source.e : base.e\n this.f = source.f != null ? source.f : base.f\n\n return this\n }\n\n inverse() {\n return this.clone().inverseO()\n }\n\n // Inverses matrix\n inverseO() {\n // Get the current parameters out of the matrix\n const a = this.a\n const b = this.b\n const c = this.c\n const d = this.d\n const e = this.e\n const f = this.f\n\n // Invert the 2x2 matrix in the top left\n const det = a * d - b * c\n if (!det) throw new Error('Cannot invert ' + this)\n\n // Calculate the top 2x2 matrix\n const na = d / det\n const nb = -b / det\n const nc = -c / det\n const nd = a / det\n\n // Apply the inverted matrix to the top right\n const ne = -(na * e + nc * f)\n const nf = -(nb * e + nd * f)\n\n // Construct the inverted matrix\n this.a = na\n this.b = nb\n this.c = nc\n this.d = nd\n this.e = ne\n this.f = nf\n\n return this\n }\n\n lmultiply(matrix) {\n return this.clone().lmultiplyO(matrix)\n }\n\n lmultiplyO(matrix) {\n const r = this\n const l = matrix instanceof Matrix ? matrix : new Matrix(matrix)\n\n return Matrix.matrixMultiply(l, r, this)\n }\n\n // Left multiplies by the given matrix\n multiply(matrix) {\n return this.clone().multiplyO(matrix)\n }\n\n multiplyO(matrix) {\n // Get the matrices\n const l = this\n const r = matrix instanceof Matrix ? matrix : new Matrix(matrix)\n\n return Matrix.matrixMultiply(l, r, this)\n }\n\n // Rotate matrix\n rotate(r, cx, cy) {\n return this.clone().rotateO(r, cx, cy)\n }\n\n rotateO(r, cx = 0, cy = 0) {\n // Convert degrees to radians\n r = radians(r)\n\n const cos = Math.cos(r)\n const sin = Math.sin(r)\n\n const { a, b, c, d, e, f } = this\n\n this.a = a * cos - b * sin\n this.b = b * cos + a * sin\n this.c = c * cos - d * sin\n this.d = d * cos + c * sin\n this.e = e * cos - f * sin + cy * sin - cx * cos + cx\n this.f = f * cos + e * sin - cx * sin - cy * cos + cy\n\n return this\n }\n\n // Scale matrix\n scale() {\n return this.clone().scaleO(...arguments)\n }\n\n scaleO(x, y = x, cx = 0, cy = 0) {\n // Support uniform scaling\n if (arguments.length === 3) {\n cy = cx\n cx = y\n y = x\n }\n\n const { a, b, c, d, e, f } = this\n\n this.a = a * x\n this.b = b * y\n this.c = c * x\n this.d = d * y\n this.e = e * x - cx * x + cx\n this.f = f * y - cy * y + cy\n\n return this\n }\n\n // Shear matrix\n shear(a, cx, cy) {\n return this.clone().shearO(a, cx, cy)\n }\n\n // eslint-disable-next-line no-unused-vars\n shearO(lx, cx = 0, cy = 0) {\n const { a, b, c, d, e, f } = this\n\n this.a = a + b * lx\n this.c = c + d * lx\n this.e = e + f * lx - cy * lx\n\n return this\n }\n\n // Skew Matrix\n skew() {\n return this.clone().skewO(...arguments)\n }\n\n skewO(x, y = x, cx = 0, cy = 0) {\n // support uniformal skew\n if (arguments.length === 3) {\n cy = cx\n cx = y\n y = x\n }\n\n // Convert degrees to radians\n x = radians(x)\n y = radians(y)\n\n const lx = Math.tan(x)\n const ly = Math.tan(y)\n\n const { a, b, c, d, e, f } = this\n\n this.a = a + b * lx\n this.b = b + a * ly\n this.c = c + d * lx\n this.d = d + c * ly\n this.e = e + f * lx - cy * lx\n this.f = f + e * ly - cx * ly\n\n return this\n }\n\n // SkewX\n skewX(x, cx, cy) {\n return this.skew(x, 0, cx, cy)\n }\n\n // SkewY\n skewY(y, cx, cy) {\n return this.skew(0, y, cx, cy)\n }\n\n toArray() {\n return [this.a, this.b, this.c, this.d, this.e, this.f]\n }\n\n // Convert matrix to string\n toString() {\n return (\n 'matrix(' +\n this.a +\n ',' +\n this.b +\n ',' +\n this.c +\n ',' +\n this.d +\n ',' +\n this.e +\n ',' +\n this.f +\n ')'\n )\n }\n\n // Transform a matrix into another matrix by manipulating the space\n transform(o) {\n // Check if o is a matrix and then left multiply it directly\n if (Matrix.isMatrixLike(o)) {\n const matrix = new Matrix(o)\n return matrix.multiplyO(this)\n }\n\n // Get the proposed transformations and the current transformations\n const t = Matrix.formatTransforms(o)\n const current = this\n const { x: ox, y: oy } = new Point(t.ox, t.oy).transform(current)\n\n // Construct the resulting matrix\n const transformer = new Matrix()\n .translateO(t.rx, t.ry)\n .lmultiplyO(current)\n .translateO(-ox, -oy)\n .scaleO(t.scaleX, t.scaleY)\n .skewO(t.skewX, t.skewY)\n .shearO(t.shear)\n .rotateO(t.theta)\n .translateO(ox, oy)\n\n // If we want the origin at a particular place, we force it there\n if (isFinite(t.px) || isFinite(t.py)) {\n const origin = new Point(ox, oy).transform(transformer)\n // TODO: Replace t.px with isFinite(t.px)\n // Doesn't work because t.px is also 0 if it wasn't passed\n const dx = isFinite(t.px) ? t.px - origin.x : 0\n const dy = isFinite(t.py) ? t.py - origin.y : 0\n transformer.translateO(dx, dy)\n }\n\n // Translate now after positioning\n transformer.translateO(t.tx, t.ty)\n return transformer\n }\n\n // Translate matrix\n translate(x, y) {\n return this.clone().translateO(x, y)\n }\n\n translateO(x, y) {\n this.e += x || 0\n this.f += y || 0\n return this\n }\n\n valueOf() {\n return {\n a: this.a,\n b: this.b,\n c: this.c,\n d: this.d,\n e: this.e,\n f: this.f\n }\n }\n}\n\nexport function ctm() {\n return new Matrix(this.node.getCTM())\n}\n\nexport function screenCTM() {\n try {\n /* https://bugzilla.mozilla.org/show_bug.cgi?id=1344537\n This is needed because FF does not return the transformation matrix\n for the inner coordinate system when getScreenCTM() is called on nested svgs.\n However all other Browsers do that */\n if (typeof this.isRoot === 'function' && !this.isRoot()) {\n const rect = this.rect(1, 1)\n const m = rect.node.getScreenCTM()\n rect.remove()\n return new Matrix(m)\n }\n return new Matrix(this.node.getScreenCTM())\n } catch (e) {\n console.warn(\n `Cannot get CTM from SVG node ${this.node.nodeName}. Is the element rendered?`\n )\n return new Matrix()\n }\n}\n\nregister(Matrix, 'Matrix')\n","import { globals } from '../../utils/window.js'\nimport { makeInstance } from '../../utils/adopter.js'\n\nexport default function parser() {\n // Reuse cached element if possible\n if (!parser.nodes) {\n const svg = makeInstance().size(2, 0)\n svg.node.style.cssText = [\n 'opacity: 0',\n 'position: absolute',\n 'left: -100%',\n 'top: -100%',\n 'overflow: hidden'\n ].join(';')\n\n svg.attr('focusable', 'false')\n svg.attr('aria-hidden', 'true')\n\n const path = svg.path().node\n\n parser.nodes = { svg, path }\n }\n\n if (!parser.nodes.svg.node.parentNode) {\n const b = globals.document.body || globals.document.documentElement\n parser.nodes.svg.addTo(b)\n }\n\n return parser.nodes\n}\n","import { delimiter } from '../modules/core/regex.js'\nimport { globals } from '../utils/window.js'\nimport { register } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Matrix from './Matrix.js'\nimport Point from './Point.js'\nimport parser from '../modules/core/parser.js'\n\nexport function isNulledBox(box) {\n return !box.width && !box.height && !box.x && !box.y\n}\n\nexport function domContains(node) {\n return (\n node === globals.document ||\n (\n globals.document.documentElement.contains ||\n function (node) {\n // This is IE - it does not support contains() for top-level SVGs\n while (node.parentNode) {\n node = node.parentNode\n }\n return node === globals.document\n }\n ).call(globals.document.documentElement, node)\n )\n}\n\nexport default class Box {\n constructor(...args) {\n this.init(...args)\n }\n\n addOffset() {\n // offset by window scroll position, because getBoundingClientRect changes when window is scrolled\n this.x += globals.window.pageXOffset\n this.y += globals.window.pageYOffset\n return new Box(this)\n }\n\n init(source) {\n const base = [0, 0, 0, 0]\n source =\n typeof source === 'string'\n ? source.split(delimiter).map(parseFloat)\n : Array.isArray(source)\n ? source\n : typeof source === 'object'\n ? [\n source.left != null ? source.left : source.x,\n source.top != null ? source.top : source.y,\n source.width,\n source.height\n ]\n : arguments.length === 4\n ? [].slice.call(arguments)\n : base\n\n this.x = source[0] || 0\n this.y = source[1] || 0\n this.width = this.w = source[2] || 0\n this.height = this.h = source[3] || 0\n\n // Add more bounding box properties\n this.x2 = this.x + this.w\n this.y2 = this.y + this.h\n this.cx = this.x + this.w / 2\n this.cy = this.y + this.h / 2\n\n return this\n }\n\n isNulled() {\n return isNulledBox(this)\n }\n\n // Merge rect box with another, return a new instance\n merge(box) {\n const x = Math.min(this.x, box.x)\n const y = Math.min(this.y, box.y)\n const width = Math.max(this.x + this.width, box.x + box.width) - x\n const height = Math.max(this.y + this.height, box.y + box.height) - y\n\n return new Box(x, y, width, height)\n }\n\n toArray() {\n return [this.x, this.y, this.width, this.height]\n }\n\n toString() {\n return this.x + ' ' + this.y + ' ' + this.width + ' ' + this.height\n }\n\n transform(m) {\n if (!(m instanceof Matrix)) {\n m = new Matrix(m)\n }\n\n let xMin = Infinity\n let xMax = -Infinity\n let yMin = Infinity\n let yMax = -Infinity\n\n const pts = [\n new Point(this.x, this.y),\n new Point(this.x2, this.y),\n new Point(this.x, this.y2),\n new Point(this.x2, this.y2)\n ]\n\n pts.forEach(function (p) {\n p = p.transform(m)\n xMin = Math.min(xMin, p.x)\n xMax = Math.max(xMax, p.x)\n yMin = Math.min(yMin, p.y)\n yMax = Math.max(yMax, p.y)\n })\n\n return new Box(xMin, yMin, xMax - xMin, yMax - yMin)\n }\n}\n\nfunction getBox(el, getBBoxFn, retry) {\n let box\n\n try {\n // Try to get the box with the provided function\n box = getBBoxFn(el.node)\n\n // If the box is worthless and not even in the dom, retry\n // by throwing an error here...\n if (isNulledBox(box) && !domContains(el.node)) {\n throw new Error('Element not in the dom')\n }\n } catch (e) {\n // ... and calling the retry handler here\n box = retry(el)\n }\n\n return box\n}\n\nexport function bbox() {\n // Function to get bbox is getBBox()\n const getBBox = (node) => node.getBBox()\n\n // Take all measures so that a stupid browser renders the element\n // so we can get the bbox from it when we try again\n const retry = (el) => {\n try {\n const clone = el.clone().addTo(parser().svg).show()\n const box = clone.node.getBBox()\n clone.remove()\n return box\n } catch (e) {\n // We give up...\n throw new Error(\n `Getting bbox of element \"${\n el.node.nodeName\n }\" is not possible: ${e.toString()}`\n )\n }\n }\n\n const box = getBox(this, getBBox, retry)\n const bbox = new Box(box)\n\n return bbox\n}\n\nexport function rbox(el) {\n const getRBox = (node) => node.getBoundingClientRect()\n const retry = (el) => {\n // There is no point in trying tricks here because if we insert the element into the dom ourselves\n // it obviously will be at the wrong position\n throw new Error(\n `Getting rbox of element \"${el.node.nodeName}\" is not possible`\n )\n }\n\n const box = getBox(this, getRBox, retry)\n const rbox = new Box(box)\n\n // If an element was passed, we want the bbox in the coordinate system of that element\n if (el) {\n return rbox.transform(el.screenCTM().inverseO())\n }\n\n // Else we want it in absolute screen coordinates\n // Therefore we need to add the scrollOffset\n return rbox.addOffset()\n}\n\n// Checks whether the given point is inside the bounding box\nexport function inside(x, y) {\n const box = this.bbox()\n\n return (\n x > box.x && y > box.y && x < box.x + box.width && y < box.y + box.height\n )\n}\n\nregisterMethods({\n viewbox: {\n viewbox(x, y, width, height) {\n // act as getter\n if (x == null) return new Box(this.attr('viewBox'))\n\n // act as setter\n return this.attr('viewBox', new Box(x, y, width, height))\n },\n\n zoom(level, point) {\n // Its best to rely on the attributes here and here is why:\n // clientXYZ: Doesn't work on non-root svgs because they dont have a CSSBox (silly!)\n // getBoundingClientRect: Doesn't work because Chrome just ignores width and height of nested svgs completely\n // that means, their clientRect is always as big as the content.\n // Furthermore this size is incorrect if the element is further transformed by its parents\n // computedStyle: Only returns meaningful values if css was used with px. We dont go this route here!\n // getBBox: returns the bounding box of its content - that doesn't help!\n let { width, height } = this.attr(['width', 'height'])\n\n // Width and height is a string when a number with a unit is present which we can't use\n // So we try clientXYZ\n if (\n (!width && !height) ||\n typeof width === 'string' ||\n typeof height === 'string'\n ) {\n width = this.node.clientWidth\n height = this.node.clientHeight\n }\n\n // Giving up...\n if (!width || !height) {\n throw new Error(\n 'Impossible to get absolute width and height. Please provide an absolute width and height attribute on the zooming element'\n )\n }\n\n const v = this.viewbox()\n\n const zoomX = width / v.width\n const zoomY = height / v.height\n const zoom = Math.min(zoomX, zoomY)\n\n if (level == null) {\n return zoom\n }\n\n let zoomAmount = zoom / level\n\n // Set the zoomAmount to the highest value which is safe to process and recover from\n // The * 100 is a bit of wiggle room for the matrix transformation\n if (zoomAmount === Infinity) zoomAmount = Number.MAX_SAFE_INTEGER / 100\n\n point =\n point || new Point(width / 2 / zoomX + v.x, height / 2 / zoomY + v.y)\n\n const box = new Box(v).transform(\n new Matrix({ scale: zoomAmount, origin: point })\n )\n\n return this.viewbox(box)\n }\n }\n})\n\nregister(Box, 'Box')\n","import { extend } from '../utils/adopter.js'\n// import { subClassArray } from './ArrayPolyfill.js'\n\nclass List extends Array {\n constructor(arr = [], ...args) {\n super(arr, ...args)\n if (typeof arr === 'number') return this\n this.length = 0\n this.push(...arr)\n }\n}\n\n/* = subClassArray('List', Array, function (arr = []) {\n // This catches the case, that native map tries to create an array with new Array(1)\n if (typeof arr === 'number') return this\n this.length = 0\n this.push(...arr)\n}) */\n\nexport default List\n\nextend([List], {\n each(fnOrMethodName, ...args) {\n if (typeof fnOrMethodName === 'function') {\n return this.map((el, i, arr) => {\n return fnOrMethodName.call(el, el, i, arr)\n })\n } else {\n return this.map((el) => {\n return el[fnOrMethodName](...args)\n })\n }\n },\n\n toArray() {\n return Array.prototype.concat.apply([], this)\n }\n})\n\nconst reserved = ['toArray', 'constructor', 'each']\n\nList.extend = function (methods) {\n methods = methods.reduce((obj, name) => {\n // Don't overwrite own methods\n if (reserved.includes(name)) return obj\n\n // Don't add private methods\n if (name[0] === '_') return obj\n\n // Allow access to original Array methods through a prefix\n if (name in Array.prototype) {\n obj['$' + name] = Array.prototype[name]\n }\n\n // Relay every call to each()\n obj[name] = function (...attrs) {\n return this.each(name, ...attrs)\n }\n return obj\n }, {})\n\n extend([List], methods)\n}\n","import { adopt } from '../../utils/adopter.js'\nimport { globals } from '../../utils/window.js'\nimport { map } from '../../utils/utils.js'\nimport List from '../../types/List.js'\n\nexport default function baseFind(query, parent) {\n return new List(\n map((parent || globals.document).querySelectorAll(query), function (node) {\n return adopt(node)\n })\n )\n}\n\n// Scoped find method\nexport function find(query) {\n return baseFind(query, this.node)\n}\n\nexport function findOne(query) {\n return adopt(this.node.querySelector(query))\n}\n","import { delimiter } from './regex.js'\nimport { makeInstance } from '../../utils/adopter.js'\nimport { globals } from '../../utils/window.js'\n\nlet listenerId = 0\nexport const windowEvents = {}\n\nexport function getEvents(instance) {\n let n = instance.getEventHolder()\n\n // We dont want to save events in global space\n if (n === globals.window) n = windowEvents\n if (!n.events) n.events = {}\n return n.events\n}\n\nexport function getEventTarget(instance) {\n return instance.getEventTarget()\n}\n\nexport function clearEvents(instance) {\n let n = instance.getEventHolder()\n if (n === globals.window) n = windowEvents\n if (n.events) n.events = {}\n}\n\n// Add event binder in the SVG namespace\nexport function on(node, events, listener, binding, options) {\n const l = listener.bind(binding || node)\n const instance = makeInstance(node)\n const bag = getEvents(instance)\n const n = getEventTarget(instance)\n\n // events can be an array of events or a string of events\n events = Array.isArray(events) ? events : events.split(delimiter)\n\n // add id to listener\n if (!listener._svgjsListenerId) {\n listener._svgjsListenerId = ++listenerId\n }\n\n events.forEach(function (event) {\n const ev = event.split('.')[0]\n const ns = event.split('.')[1] || '*'\n\n // ensure valid object\n bag[ev] = bag[ev] || {}\n bag[ev][ns] = bag[ev][ns] || {}\n\n // reference listener\n bag[ev][ns][listener._svgjsListenerId] = l\n\n // add listener\n n.addEventListener(ev, l, options || false)\n })\n}\n\n// Add event unbinder in the SVG namespace\nexport function off(node, events, listener, options) {\n const instance = makeInstance(node)\n const bag = getEvents(instance)\n const n = getEventTarget(instance)\n\n // listener can be a function or a number\n if (typeof listener === 'function') {\n listener = listener._svgjsListenerId\n if (!listener) return\n }\n\n // events can be an array of events or a string or undefined\n events = Array.isArray(events) ? events : (events || '').split(delimiter)\n\n events.forEach(function (event) {\n const ev = event && event.split('.')[0]\n const ns = event && event.split('.')[1]\n let namespace, l\n\n if (listener) {\n // remove listener reference\n if (bag[ev] && bag[ev][ns || '*']) {\n // removeListener\n n.removeEventListener(\n ev,\n bag[ev][ns || '*'][listener],\n options || false\n )\n\n delete bag[ev][ns || '*'][listener]\n }\n } else if (ev && ns) {\n // remove all listeners for a namespaced event\n if (bag[ev] && bag[ev][ns]) {\n for (l in bag[ev][ns]) {\n off(n, [ev, ns].join('.'), l)\n }\n\n delete bag[ev][ns]\n }\n } else if (ns) {\n // remove all listeners for a specific namespace\n for (event in bag) {\n for (namespace in bag[event]) {\n if (ns === namespace) {\n off(n, [event, ns].join('.'))\n }\n }\n }\n } else if (ev) {\n // remove all listeners for the event\n if (bag[ev]) {\n for (namespace in bag[ev]) {\n off(n, [ev, namespace].join('.'))\n }\n\n delete bag[ev]\n }\n } else {\n // remove all listeners on a given node\n for (event in bag) {\n off(n, event)\n }\n\n clearEvents(instance)\n }\n })\n}\n\nexport function dispatch(node, event, data, options) {\n const n = getEventTarget(node)\n\n // Dispatch event\n if (event instanceof globals.window.Event) {\n n.dispatchEvent(event)\n } else {\n event = new globals.window.CustomEvent(event, {\n detail: data,\n cancelable: true,\n ...options\n })\n n.dispatchEvent(event)\n }\n return event\n}\n","import { dispatch, off, on } from '../modules/core/event.js'\nimport { register } from '../utils/adopter.js'\nimport Base from './Base.js'\n\nexport default class EventTarget extends Base {\n addEventListener() {}\n\n dispatch(event, data, options) {\n return dispatch(this, event, data, options)\n }\n\n dispatchEvent(event) {\n const bag = this.getEventHolder().events\n if (!bag) return true\n\n const events = bag[event.type]\n\n for (const i in events) {\n for (const j in events[i]) {\n events[i][j](event)\n }\n }\n\n return !event.defaultPrevented\n }\n\n // Fire given event\n fire(event, data, options) {\n this.dispatch(event, data, options)\n return this\n }\n\n getEventHolder() {\n return this\n }\n\n getEventTarget() {\n return this\n }\n\n // Unbind event from listener\n off(event, listener, options) {\n off(this, event, listener, options)\n return this\n }\n\n // Bind given event to listener\n on(event, listener, binding, options) {\n on(this, event, listener, binding, options)\n return this\n }\n\n removeEventListener() {}\n}\n\nregister(EventTarget, 'EventTarget')\n","export function noop() {}\n\n// Default animation values\nexport const timeline = {\n duration: 400,\n ease: '>',\n delay: 0\n}\n\n// Default attribute values\nexport const attrs = {\n // fill and stroke\n 'fill-opacity': 1,\n 'stroke-opacity': 1,\n 'stroke-width': 0,\n 'stroke-linejoin': 'miter',\n 'stroke-linecap': 'butt',\n fill: '#000000',\n stroke: '#000000',\n opacity: 1,\n\n // position\n x: 0,\n y: 0,\n cx: 0,\n cy: 0,\n\n // size\n width: 0,\n height: 0,\n\n // radius\n r: 0,\n rx: 0,\n ry: 0,\n\n // gradient\n offset: 0,\n 'stop-opacity': 1,\n 'stop-color': '#000000',\n\n // text\n 'text-anchor': 'start'\n}\n","import { delimiter } from '../modules/core/regex.js'\n\nexport default class SVGArray extends Array {\n constructor(...args) {\n super(...args)\n this.init(...args)\n }\n\n clone() {\n return new this.constructor(this)\n }\n\n init(arr) {\n // This catches the case, that native map tries to create an array with new Array(1)\n if (typeof arr === 'number') return this\n this.length = 0\n this.push(...this.parse(arr))\n return this\n }\n\n // Parse whitespace separated string\n parse(array = []) {\n // If already is an array, no need to parse it\n if (array instanceof Array) return array\n\n return array.trim().split(delimiter).map(parseFloat)\n }\n\n toArray() {\n return Array.prototype.concat.apply([], this)\n }\n\n toSet() {\n return new Set(this)\n }\n\n toString() {\n return this.join(' ')\n }\n\n // Flattens the array if needed\n valueOf() {\n const ret = []\n ret.push(...this)\n return ret\n }\n}\n","import { numberAndUnit } from '../modules/core/regex.js'\n\n// Module for unit conversions\nexport default class SVGNumber {\n // Initialize\n constructor(...args) {\n this.init(...args)\n }\n\n convert(unit) {\n return new SVGNumber(this.value, unit)\n }\n\n // Divide number\n divide(number) {\n number = new SVGNumber(number)\n return new SVGNumber(this / number, this.unit || number.unit)\n }\n\n init(value, unit) {\n unit = Array.isArray(value) ? value[1] : unit\n value = Array.isArray(value) ? value[0] : value\n\n // initialize defaults\n this.value = 0\n this.unit = unit || ''\n\n // parse value\n if (typeof value === 'number') {\n // ensure a valid numeric value\n this.value = isNaN(value)\n ? 0\n : !isFinite(value)\n ? value < 0\n ? -3.4e38\n : +3.4e38\n : value\n } else if (typeof value === 'string') {\n unit = value.match(numberAndUnit)\n\n if (unit) {\n // make value numeric\n this.value = parseFloat(unit[1])\n\n // normalize\n if (unit[5] === '%') {\n this.value /= 100\n } else if (unit[5] === 's') {\n this.value *= 1000\n }\n\n // store unit\n this.unit = unit[5]\n }\n } else {\n if (value instanceof SVGNumber) {\n this.value = value.valueOf()\n this.unit = value.unit\n }\n }\n\n return this\n }\n\n // Subtract number\n minus(number) {\n number = new SVGNumber(number)\n return new SVGNumber(this - number, this.unit || number.unit)\n }\n\n // Add number\n plus(number) {\n number = new SVGNumber(number)\n return new SVGNumber(this + number, this.unit || number.unit)\n }\n\n // Multiply number\n times(number) {\n number = new SVGNumber(number)\n return new SVGNumber(this * number, this.unit || number.unit)\n }\n\n toArray() {\n return [this.value, this.unit]\n }\n\n toJSON() {\n return this.toString()\n }\n\n toString() {\n return (\n (this.unit === '%'\n ? ~~(this.value * 1e8) / 1e6\n : this.unit === 's'\n ? this.value / 1e3\n : this.value) + this.unit\n )\n }\n\n valueOf() {\n return this.value\n }\n}\n","import { attrs as defaults } from './defaults.js'\nimport { isNumber } from './regex.js'\nimport Color from '../../types/Color.js'\nimport SVGArray from '../../types/SVGArray.js'\nimport SVGNumber from '../../types/SVGNumber.js'\n\nconst colorAttributes = new Set([\n 'fill',\n 'stroke',\n 'color',\n 'bgcolor',\n 'stop-color',\n 'flood-color',\n 'lighting-color'\n])\n\nconst hooks = []\nexport function registerAttrHook(fn) {\n hooks.push(fn)\n}\n\n// Set svg element attribute\nexport default function attr(attr, val, ns) {\n // act as full getter\n if (attr == null) {\n // get an object of attributes\n attr = {}\n val = this.node.attributes\n\n for (const node of val) {\n attr[node.nodeName] = isNumber.test(node.nodeValue)\n ? parseFloat(node.nodeValue)\n : node.nodeValue\n }\n\n return attr\n } else if (attr instanceof Array) {\n // loop through array and get all values\n return attr.reduce((last, curr) => {\n last[curr] = this.attr(curr)\n return last\n }, {})\n } else if (typeof attr === 'object' && attr.constructor === Object) {\n // apply every attribute individually if an object is passed\n for (val in attr) this.attr(val, attr[val])\n } else if (val === null) {\n // remove value\n this.node.removeAttribute(attr)\n } else if (val == null) {\n // act as a getter if the first and only argument is not an object\n val = this.node.getAttribute(attr)\n return val == null\n ? defaults[attr]\n : isNumber.test(val)\n ? parseFloat(val)\n : val\n } else {\n // Loop through hooks and execute them to convert value\n val = hooks.reduce((_val, hook) => {\n return hook(attr, _val, this)\n }, val)\n\n // ensure correct numeric values (also accepts NaN and Infinity)\n if (typeof val === 'number') {\n val = new SVGNumber(val)\n } else if (colorAttributes.has(attr) && Color.isColor(val)) {\n // ensure full hex color\n val = new Color(val)\n } else if (val.constructor === Array) {\n // Check for plain arrays and parse array values\n val = new SVGArray(val)\n }\n\n // if the passed attribute is leading...\n if (attr === 'leading') {\n // ... call the leading method instead\n if (this.leading) {\n this.leading(val)\n }\n } else {\n // set given attribute on node\n typeof ns === 'string'\n ? this.node.setAttributeNS(ns, attr, val.toString())\n : this.node.setAttribute(attr, val.toString())\n }\n\n // rebuild if required\n if (this.rebuild && (attr === 'font-size' || attr === 'x')) {\n this.rebuild()\n }\n }\n\n return this\n}\n","import {\n adopt,\n assignNewId,\n eid,\n extend,\n makeInstance,\n create,\n register\n} from '../utils/adopter.js'\nimport { find, findOne } from '../modules/core/selector.js'\nimport { globals } from '../utils/window.js'\nimport { map } from '../utils/utils.js'\nimport { svg, html } from '../modules/core/namespaces.js'\nimport EventTarget from '../types/EventTarget.js'\nimport List from '../types/List.js'\nimport attr from '../modules/core/attr.js'\n\nexport default class Dom extends EventTarget {\n constructor(node, attrs) {\n super()\n this.node = node\n this.type = node.nodeName\n\n if (attrs && node !== attrs) {\n this.attr(attrs)\n }\n }\n\n // Add given element at a position\n add(element, i) {\n element = makeInstance(element)\n\n // If non-root svg nodes are added we have to remove their namespaces\n if (\n element.removeNamespace &&\n this.node instanceof globals.window.SVGElement\n ) {\n element.removeNamespace()\n }\n\n if (i == null) {\n this.node.appendChild(element.node)\n } else if (element.node !== this.node.childNodes[i]) {\n this.node.insertBefore(element.node, this.node.childNodes[i])\n }\n\n return this\n }\n\n // Add element to given container and return self\n addTo(parent, i) {\n return makeInstance(parent).put(this, i)\n }\n\n // Returns all child elements\n children() {\n return new List(\n map(this.node.children, function (node) {\n return adopt(node)\n })\n )\n }\n\n // Remove all elements in this container\n clear() {\n // remove children\n while (this.node.hasChildNodes()) {\n this.node.removeChild(this.node.lastChild)\n }\n\n return this\n }\n\n // Clone element\n clone(deep = true, assignNewIds = true) {\n // write dom data to the dom so the clone can pickup the data\n this.writeDataToDom()\n\n // clone element\n let nodeClone = this.node.cloneNode(deep)\n if (assignNewIds) {\n // assign new id\n nodeClone = assignNewId(nodeClone)\n }\n return new this.constructor(nodeClone)\n }\n\n // Iterates over all children and invokes a given block\n each(block, deep) {\n const children = this.children()\n let i, il\n\n for (i = 0, il = children.length; i < il; i++) {\n block.apply(children[i], [i, children])\n\n if (deep) {\n children[i].each(block, deep)\n }\n }\n\n return this\n }\n\n element(nodeName, attrs) {\n return this.put(new Dom(create(nodeName), attrs))\n }\n\n // Get first child\n first() {\n return adopt(this.node.firstChild)\n }\n\n // Get a element at the given index\n get(i) {\n return adopt(this.node.childNodes[i])\n }\n\n getEventHolder() {\n return this.node\n }\n\n getEventTarget() {\n return this.node\n }\n\n // Checks if the given element is a child\n has(element) {\n return this.index(element) >= 0\n }\n\n html(htmlOrFn, outerHTML) {\n return this.xml(htmlOrFn, outerHTML, html)\n }\n\n // Get / set id\n id(id) {\n // generate new id if no id set\n if (typeof id === 'undefined' && !this.node.id) {\n this.node.id = eid(this.type)\n }\n\n // don't set directly with this.node.id to make `null` work correctly\n return this.attr('id', id)\n }\n\n // Gets index of given element\n index(element) {\n return [].slice.call(this.node.childNodes).indexOf(element.node)\n }\n\n // Get the last child\n last() {\n return adopt(this.node.lastChild)\n }\n\n // matches the element vs a css selector\n matches(selector) {\n const el = this.node\n const matcher =\n el.matches ||\n el.matchesSelector ||\n el.msMatchesSelector ||\n el.mozMatchesSelector ||\n el.webkitMatchesSelector ||\n el.oMatchesSelector ||\n null\n return matcher && matcher.call(el, selector)\n }\n\n // Returns the parent element instance\n parent(type) {\n let parent = this\n\n // check for parent\n if (!parent.node.parentNode) return null\n\n // get parent element\n parent = adopt(parent.node.parentNode)\n\n if (!type) return parent\n\n // loop through ancestors if type is given\n do {\n if (\n typeof type === 'string' ? parent.matches(type) : parent instanceof type\n )\n return parent\n } while ((parent = adopt(parent.node.parentNode)))\n\n return parent\n }\n\n // Basically does the same as `add()` but returns the added element instead\n put(element, i) {\n element = makeInstance(element)\n this.add(element, i)\n return element\n }\n\n // Add element to given container and return container\n putIn(parent, i) {\n return makeInstance(parent).add(this, i)\n }\n\n // Remove element\n remove() {\n if (this.parent()) {\n this.parent().removeElement(this)\n }\n\n return this\n }\n\n // Remove a given child\n removeElement(element) {\n this.node.removeChild(element.node)\n\n return this\n }\n\n // Replace this with element\n replace(element) {\n element = makeInstance(element)\n\n if (this.node.parentNode) {\n this.node.parentNode.replaceChild(element.node, this.node)\n }\n\n return element\n }\n\n round(precision = 2, map = null) {\n const factor = 10 ** precision\n const attrs = this.attr(map)\n\n for (const i in attrs) {\n if (typeof attrs[i] === 'number') {\n attrs[i] = Math.round(attrs[i] * factor) / factor\n }\n }\n\n this.attr(attrs)\n return this\n }\n\n // Import / Export raw svg\n svg(svgOrFn, outerSVG) {\n return this.xml(svgOrFn, outerSVG, svg)\n }\n\n // Return id on string conversion\n toString() {\n return this.id()\n }\n\n words(text) {\n // This is faster than removing all children and adding a new one\n this.node.textContent = text\n return this\n }\n\n wrap(node) {\n const parent = this.parent()\n\n if (!parent) {\n return this.addTo(node)\n }\n\n const position = parent.index(this)\n return parent.put(node, position).put(this)\n }\n\n // write svgjs data to the dom\n writeDataToDom() {\n // dump variables recursively\n this.each(function () {\n this.writeDataToDom()\n })\n\n return this\n }\n\n // Import / Export raw svg\n xml(xmlOrFn, outerXML, ns) {\n if (typeof xmlOrFn === 'boolean') {\n ns = outerXML\n outerXML = xmlOrFn\n xmlOrFn = null\n }\n\n // act as getter if no svg string is given\n if (xmlOrFn == null || typeof xmlOrFn === 'function') {\n // The default for exports is, that the outerNode is included\n outerXML = outerXML == null ? true : outerXML\n\n // write svgjs data to the dom\n this.writeDataToDom()\n let current = this\n\n // An export modifier was passed\n if (xmlOrFn != null) {\n current = adopt(current.node.cloneNode(true))\n\n // If the user wants outerHTML we need to process this node, too\n if (outerXML) {\n const result = xmlOrFn(current)\n current = result || current\n\n // The user does not want this node? Well, then he gets nothing\n if (result === false) return ''\n }\n\n // Deep loop through all children and apply modifier\n current.each(function () {\n const result = xmlOrFn(this)\n const _this = result || this\n\n // If modifier returns false, discard node\n if (result === false) {\n this.remove()\n\n // If modifier returns new node, use it\n } else if (result && this !== _this) {\n this.replace(_this)\n }\n }, true)\n }\n\n // Return outer or inner content\n return outerXML ? current.node.outerHTML : current.node.innerHTML\n }\n\n // Act as setter if we got a string\n\n // The default for import is, that the current node is not replaced\n outerXML = outerXML == null ? false : outerXML\n\n // Create temporary holder\n const well = create('wrapper', ns)\n const fragment = globals.document.createDocumentFragment()\n\n // Dump raw svg\n well.innerHTML = xmlOrFn\n\n // Transplant nodes into the fragment\n for (let len = well.children.length; len--; ) {\n fragment.appendChild(well.firstElementChild)\n }\n\n const parent = this.parent()\n\n // Add the whole fragment at once\n return outerXML ? this.replace(fragment) && parent : this.add(fragment)\n }\n}\n\nextend(Dom, { attr, find, findOne })\nregister(Dom, 'Dom')\n","import { bbox, rbox, inside } from '../types/Box.js'\nimport { ctm, screenCTM } from '../types/Matrix.js'\nimport {\n extend,\n getClass,\n makeInstance,\n register,\n root\n} from '../utils/adopter.js'\nimport { globals } from '../utils/window.js'\nimport { point } from '../types/Point.js'\nimport { proportionalSize, writeDataToDom } from '../utils/utils.js'\nimport { reference } from '../modules/core/regex.js'\nimport Dom from './Dom.js'\nimport List from '../types/List.js'\nimport SVGNumber from '../types/SVGNumber.js'\n\nexport default class Element extends Dom {\n constructor(node, attrs) {\n super(node, attrs)\n\n // initialize data object\n this.dom = {}\n\n // create circular reference\n this.node.instance = this\n\n if (node.hasAttribute('data-svgjs') || node.hasAttribute('svgjs:data')) {\n // pull svgjs data from the dom (getAttributeNS doesn't work in html5)\n this.setData(\n JSON.parse(node.getAttribute('data-svgjs')) ??\n JSON.parse(node.getAttribute('svgjs:data')) ??\n {}\n )\n }\n }\n\n // Move element by its center\n center(x, y) {\n return this.cx(x).cy(y)\n }\n\n // Move by center over x-axis\n cx(x) {\n return x == null\n ? this.x() + this.width() / 2\n : this.x(x - this.width() / 2)\n }\n\n // Move by center over y-axis\n cy(y) {\n return y == null\n ? this.y() + this.height() / 2\n : this.y(y - this.height() / 2)\n }\n\n // Get defs\n defs() {\n const root = this.root()\n return root && root.defs()\n }\n\n // Relative move over x and y axes\n dmove(x, y) {\n return this.dx(x).dy(y)\n }\n\n // Relative move over x axis\n dx(x = 0) {\n return this.x(new SVGNumber(x).plus(this.x()))\n }\n\n // Relative move over y axis\n dy(y = 0) {\n return this.y(new SVGNumber(y).plus(this.y()))\n }\n\n getEventHolder() {\n return this\n }\n\n // Set height of element\n height(height) {\n return this.attr('height', height)\n }\n\n // Move element to given x and y values\n move(x, y) {\n return this.x(x).y(y)\n }\n\n // return array of all ancestors of given type up to the root svg\n parents(until = this.root()) {\n const isSelector = typeof until === 'string'\n if (!isSelector) {\n until = makeInstance(until)\n }\n const parents = new List()\n let parent = this\n\n while (\n (parent = parent.parent()) &&\n parent.node !== globals.document &&\n parent.nodeName !== '#document-fragment'\n ) {\n parents.push(parent)\n\n if (!isSelector && parent.node === until.node) {\n break\n }\n if (isSelector && parent.matches(until)) {\n break\n }\n if (parent.node === this.root().node) {\n // We worked our way to the root and didn't match `until`\n return null\n }\n }\n\n return parents\n }\n\n // Get referenced element form attribute value\n reference(attr) {\n attr = this.attr(attr)\n if (!attr) return null\n\n const m = (attr + '').match(reference)\n return m ? makeInstance(m[1]) : null\n }\n\n // Get parent document\n root() {\n const p = this.parent(getClass(root))\n return p && p.root()\n }\n\n // set given data to the elements data property\n setData(o) {\n this.dom = o\n return this\n }\n\n // Set element size to given width and height\n size(width, height) {\n const p = proportionalSize(this, width, height)\n\n return this.width(new SVGNumber(p.width)).height(new SVGNumber(p.height))\n }\n\n // Set width of element\n width(width) {\n return this.attr('width', width)\n }\n\n // write svgjs data to the dom\n writeDataToDom() {\n writeDataToDom(this, this.dom)\n return super.writeDataToDom()\n }\n\n // Move over x-axis\n x(x) {\n return this.attr('x', x)\n }\n\n // Move over y-axis\n y(y) {\n return this.attr('y', y)\n }\n}\n\nextend(Element, {\n bbox,\n rbox,\n inside,\n point,\n ctm,\n screenCTM\n})\n\nregister(Element, 'Element')\n","import { registerMethods } from '../../utils/methods.js'\nimport Color from '../../types/Color.js'\nimport Element from '../../elements/Element.js'\nimport Matrix from '../../types/Matrix.js'\nimport Point from '../../types/Point.js'\nimport SVGNumber from '../../types/SVGNumber.js'\n\n// Define list of available attributes for stroke and fill\nconst sugar = {\n stroke: [\n 'color',\n 'width',\n 'opacity',\n 'linecap',\n 'linejoin',\n 'miterlimit',\n 'dasharray',\n 'dashoffset'\n ],\n fill: ['color', 'opacity', 'rule'],\n prefix: function (t, a) {\n return a === 'color' ? t : t + '-' + a\n }\n}\n\n// Add sugar for fill and stroke\n;['fill', 'stroke'].forEach(function (m) {\n const extension = {}\n let i\n\n extension[m] = function (o) {\n if (typeof o === 'undefined') {\n return this.attr(m)\n }\n if (\n typeof o === 'string' ||\n o instanceof Color ||\n Color.isRgb(o) ||\n o instanceof Element\n ) {\n this.attr(m, o)\n } else {\n // set all attributes from sugar.fill and sugar.stroke list\n for (i = sugar[m].length - 1; i >= 0; i--) {\n if (o[sugar[m][i]] != null) {\n this.attr(sugar.prefix(m, sugar[m][i]), o[sugar[m][i]])\n }\n }\n }\n\n return this\n }\n\n registerMethods(['Element', 'Runner'], extension)\n})\n\nregisterMethods(['Element', 'Runner'], {\n // Let the user set the matrix directly\n matrix: function (mat, b, c, d, e, f) {\n // Act as a getter\n if (mat == null) {\n return new Matrix(this)\n }\n\n // Act as a setter, the user can pass a matrix or a set of numbers\n return this.attr('transform', new Matrix(mat, b, c, d, e, f))\n },\n\n // Map rotation to transform\n rotate: function (angle, cx, cy) {\n return this.transform({ rotate: angle, ox: cx, oy: cy }, true)\n },\n\n // Map skew to transform\n skew: function (x, y, cx, cy) {\n return arguments.length === 1 || arguments.length === 3\n ? this.transform({ skew: x, ox: y, oy: cx }, true)\n : this.transform({ skew: [x, y], ox: cx, oy: cy }, true)\n },\n\n shear: function (lam, cx, cy) {\n return this.transform({ shear: lam, ox: cx, oy: cy }, true)\n },\n\n // Map scale to transform\n scale: function (x, y, cx, cy) {\n return arguments.length === 1 || arguments.length === 3\n ? this.transform({ scale: x, ox: y, oy: cx }, true)\n : this.transform({ scale: [x, y], ox: cx, oy: cy }, true)\n },\n\n // Map translate to transform\n translate: function (x, y) {\n return this.transform({ translate: [x, y] }, true)\n },\n\n // Map relative translations to transform\n relative: function (x, y) {\n return this.transform({ relative: [x, y] }, true)\n },\n\n // Map flip to transform\n flip: function (direction = 'both', origin = 'center') {\n if ('xybothtrue'.indexOf(direction) === -1) {\n origin = direction\n direction = 'both'\n }\n\n return this.transform({ flip: direction, origin: origin }, true)\n },\n\n // Opacity\n opacity: function (value) {\n return this.attr('opacity', value)\n }\n})\n\nregisterMethods('radius', {\n // Add x and y radius\n radius: function (x, y = x) {\n const type = (this._element || this).type\n return type === 'radialGradient'\n ? this.attr('r', new SVGNumber(x))\n : this.rx(x).ry(y)\n }\n})\n\nregisterMethods('Path', {\n // Get path length\n length: function () {\n return this.node.getTotalLength()\n },\n // Get point at length\n pointAt: function (length) {\n return new Point(this.node.getPointAtLength(length))\n }\n})\n\nregisterMethods(['Element', 'Runner'], {\n // Set font\n font: function (a, v) {\n if (typeof a === 'object') {\n for (v in a) this.font(v, a[v])\n return this\n }\n\n return a === 'leading'\n ? this.leading(v)\n : a === 'anchor'\n ? this.attr('text-anchor', v)\n : a === 'size' ||\n a === 'family' ||\n a === 'weight' ||\n a === 'stretch' ||\n a === 'variant' ||\n a === 'style'\n ? this.attr('font-' + a, v)\n : this.attr(a, v)\n }\n})\n\n// Add events to elements\nconst methods = [\n 'click',\n 'dblclick',\n 'mousedown',\n 'mouseup',\n 'mouseover',\n 'mouseout',\n 'mousemove',\n 'mouseenter',\n 'mouseleave',\n 'touchstart',\n 'touchmove',\n 'touchleave',\n 'touchend',\n 'touchcancel',\n 'contextmenu',\n 'wheel',\n 'pointerdown',\n 'pointermove',\n 'pointerup',\n 'pointerleave',\n 'pointercancel'\n].reduce(function (last, event) {\n // add event to Element\n const fn = function (f) {\n if (f === null) {\n this.off(event)\n } else {\n this.on(event, f)\n }\n return this\n }\n\n last[event] = fn\n return last\n}, {})\n\nregisterMethods('Element', methods)\n","import { getOrigin, isDescriptive } from '../../utils/utils.js'\nimport { delimiter, transforms } from '../core/regex.js'\nimport { registerMethods } from '../../utils/methods.js'\nimport Matrix from '../../types/Matrix.js'\n\n// Reset all transformations\nexport function untransform() {\n return this.attr('transform', null)\n}\n\n// merge the whole transformation chain into one matrix and returns it\nexport function matrixify() {\n const matrix = (this.attr('transform') || '')\n // split transformations\n .split(transforms)\n .slice(0, -1)\n .map(function (str) {\n // generate key => value pairs\n const kv = str.trim().split('(')\n return [\n kv[0],\n kv[1].split(delimiter).map(function (str) {\n return parseFloat(str)\n })\n ]\n })\n .reverse()\n // merge every transformation into one matrix\n .reduce(function (matrix, transform) {\n if (transform[0] === 'matrix') {\n return matrix.lmultiply(Matrix.fromArray(transform[1]))\n }\n return matrix[transform[0]].apply(matrix, transform[1])\n }, new Matrix())\n\n return matrix\n}\n\n// add an element to another parent without changing the visual representation on the screen\nexport function toParent(parent, i) {\n if (this === parent) return this\n\n if (isDescriptive(this.node)) return this.addTo(parent, i)\n\n const ctm = this.screenCTM()\n const pCtm = parent.screenCTM().inverse()\n\n this.addTo(parent, i).untransform().transform(pCtm.multiply(ctm))\n\n return this\n}\n\n// same as above with parent equals root-svg\nexport function toRoot(i) {\n return this.toParent(this.root(), i)\n}\n\n// Add transformations\nexport function transform(o, relative) {\n // Act as a getter if no object was passed\n if (o == null || typeof o === 'string') {\n const decomposed = new Matrix(this).decompose()\n return o == null ? decomposed : decomposed[o]\n }\n\n if (!Matrix.isMatrixLike(o)) {\n // Set the origin according to the defined transform\n o = { ...o, origin: getOrigin(o, this) }\n }\n\n // The user can pass a boolean, an Element or an Matrix or nothing\n const cleanRelative = relative === true ? this : relative || false\n const result = new Matrix(cleanRelative).transform(o)\n return this.attr('transform', result)\n}\n\nregisterMethods('Element', {\n untransform,\n matrixify,\n toParent,\n toRoot,\n transform\n})\n","import { register } from '../utils/adopter.js'\nimport Element from './Element.js'\n\nexport default class Container extends Element {\n flatten() {\n this.each(function () {\n if (this instanceof Container) {\n return this.flatten().ungroup()\n }\n })\n\n return this\n }\n\n ungroup(parent = this.parent(), index = parent.index(this)) {\n // when parent != this, we want append all elements to the end\n index = index === -1 ? parent.children().length : index\n\n this.each(function (i, children) {\n // reverse each\n return children[children.length - i - 1].toParent(parent, index)\n })\n\n return this.remove()\n }\n}\n\nregister(Container, 'Container')\n","import { nodeOrNew, register } from '../utils/adopter.js'\nimport Container from './Container.js'\n\nexport default class Defs extends Container {\n constructor(node, attrs = node) {\n super(nodeOrNew('defs', node), attrs)\n }\n\n flatten() {\n return this\n }\n\n ungroup() {\n return this\n }\n}\n\nregister(Defs, 'Defs')\n","import { register } from '../utils/adopter.js'\nimport Element from './Element.js'\n\nexport default class Shape extends Element {}\n\nregister(Shape, 'Shape')\n","import SVGNumber from '../../types/SVGNumber.js'\n\n// Radius x value\nexport function rx(rx) {\n return this.attr('rx', rx)\n}\n\n// Radius y value\nexport function ry(ry) {\n return this.attr('ry', ry)\n}\n\n// Move over x-axis\nexport function x(x) {\n return x == null ? this.cx() - this.rx() : this.cx(x + this.rx())\n}\n\n// Move over y-axis\nexport function y(y) {\n return y == null ? this.cy() - this.ry() : this.cy(y + this.ry())\n}\n\n// Move by center over x-axis\nexport function cx(x) {\n return this.attr('cx', x)\n}\n\n// Move by center over y-axis\nexport function cy(y) {\n return this.attr('cy', y)\n}\n\n// Set width of element\nexport function width(width) {\n return width == null ? this.rx() * 2 : this.rx(new SVGNumber(width).divide(2))\n}\n\n// Set height of element\nexport function height(height) {\n return height == null\n ? this.ry() * 2\n : this.ry(new SVGNumber(height).divide(2))\n}\n","import {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { proportionalSize } from '../utils/utils.js'\nimport { registerMethods } from '../utils/methods.js'\nimport SVGNumber from '../types/SVGNumber.js'\nimport Shape from './Shape.js'\nimport * as circled from '../modules/core/circled.js'\n\nexport default class Ellipse extends Shape {\n constructor(node, attrs = node) {\n super(nodeOrNew('ellipse', node), attrs)\n }\n\n size(width, height) {\n const p = proportionalSize(this, width, height)\n\n return this.rx(new SVGNumber(p.width).divide(2)).ry(\n new SVGNumber(p.height).divide(2)\n )\n }\n}\n\nextend(Ellipse, circled)\n\nregisterMethods('Container', {\n // Create an ellipse\n ellipse: wrapWithAttrCheck(function (width = 0, height = width) {\n return this.put(new Ellipse()).size(width, height).move(0, 0)\n })\n})\n\nregister(Ellipse, 'Ellipse')\n","import Dom from './Dom.js'\nimport { globals } from '../utils/window.js'\nimport { register, create } from '../utils/adopter.js'\n\nclass Fragment extends Dom {\n constructor(node = globals.document.createDocumentFragment()) {\n super(node)\n }\n\n // Import / Export raw xml\n xml(xmlOrFn, outerXML, ns) {\n if (typeof xmlOrFn === 'boolean') {\n ns = outerXML\n outerXML = xmlOrFn\n xmlOrFn = null\n }\n\n // because this is a fragment we have to put all elements into a wrapper first\n // before we can get the innerXML from it\n if (xmlOrFn == null || typeof xmlOrFn === 'function') {\n const wrapper = new Dom(create('wrapper', ns))\n wrapper.add(this.node.cloneNode(true))\n\n return wrapper.xml(false, ns)\n }\n\n // Act as setter if we got a string\n return super.xml(xmlOrFn, false, ns)\n }\n}\n\nregister(Fragment, 'Fragment')\n\nexport default Fragment\n","import SVGNumber from '../../types/SVGNumber.js'\n\nexport function from(x, y) {\n return (this._element || this).type === 'radialGradient'\n ? this.attr({ fx: new SVGNumber(x), fy: new SVGNumber(y) })\n : this.attr({ x1: new SVGNumber(x), y1: new SVGNumber(y) })\n}\n\nexport function to(x, y) {\n return (this._element || this).type === 'radialGradient'\n ? this.attr({ cx: new SVGNumber(x), cy: new SVGNumber(y) })\n : this.attr({ x2: new SVGNumber(x), y2: new SVGNumber(y) })\n}\n","import {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Box from '../types/Box.js'\nimport Container from './Container.js'\nimport baseFind from '../modules/core/selector.js'\nimport * as gradiented from '../modules/core/gradiented.js'\n\nexport default class Gradient extends Container {\n constructor(type, attrs) {\n super(\n nodeOrNew(type + 'Gradient', typeof type === 'string' ? null : type),\n attrs\n )\n }\n\n // custom attr to handle transform\n attr(a, b, c) {\n if (a === 'transform') a = 'gradientTransform'\n return super.attr(a, b, c)\n }\n\n bbox() {\n return new Box()\n }\n\n targets() {\n return baseFind('svg [fill*=' + this.id() + ']')\n }\n\n // Alias string conversion to fill\n toString() {\n return this.url()\n }\n\n // Update gradient\n update(block) {\n // remove all stops\n this.clear()\n\n // invoke passed block\n if (typeof block === 'function') {\n block.call(this, this)\n }\n\n return this\n }\n\n // Return the fill id\n url() {\n return 'url(#' + this.id() + ')'\n }\n}\n\nextend(Gradient, gradiented)\n\nregisterMethods({\n Container: {\n // Create gradient element in defs\n gradient(...args) {\n return this.defs().gradient(...args)\n }\n },\n // define gradient\n Defs: {\n gradient: wrapWithAttrCheck(function (type, block) {\n return this.put(new Gradient(type)).update(block)\n })\n }\n})\n\nregister(Gradient, 'Gradient')\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Box from '../types/Box.js'\nimport Container from './Container.js'\nimport baseFind from '../modules/core/selector.js'\n\nexport default class Pattern extends Container {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('pattern', node), attrs)\n }\n\n // custom attr to handle transform\n attr(a, b, c) {\n if (a === 'transform') a = 'patternTransform'\n return super.attr(a, b, c)\n }\n\n bbox() {\n return new Box()\n }\n\n targets() {\n return baseFind('svg [fill*=' + this.id() + ']')\n }\n\n // Alias string conversion to fill\n toString() {\n return this.url()\n }\n\n // Update pattern by rebuilding\n update(block) {\n // remove content\n this.clear()\n\n // invoke passed block\n if (typeof block === 'function') {\n block.call(this, this)\n }\n\n return this\n }\n\n // Return the fill id\n url() {\n return 'url(#' + this.id() + ')'\n }\n}\n\nregisterMethods({\n Container: {\n // Create pattern element in defs\n pattern(...args) {\n return this.defs().pattern(...args)\n }\n },\n Defs: {\n pattern: wrapWithAttrCheck(function (width, height, block) {\n return this.put(new Pattern()).update(block).attr({\n x: 0,\n y: 0,\n width: width,\n height: height,\n patternUnits: 'userSpaceOnUse'\n })\n })\n }\n})\n\nregister(Pattern, 'Pattern')\n","import { isImage } from '../modules/core/regex.js'\nimport { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { off, on } from '../modules/core/event.js'\nimport { registerAttrHook } from '../modules/core/attr.js'\nimport { registerMethods } from '../utils/methods.js'\nimport { xlink } from '../modules/core/namespaces.js'\nimport Pattern from './Pattern.js'\nimport Shape from './Shape.js'\nimport { globals } from '../utils/window.js'\n\nexport default class Image extends Shape {\n constructor(node, attrs = node) {\n super(nodeOrNew('image', node), attrs)\n }\n\n // (re)load image\n load(url, callback) {\n if (!url) return this\n\n const img = new globals.window.Image()\n\n on(\n img,\n 'load',\n function (e) {\n const p = this.parent(Pattern)\n\n // ensure image size\n if (this.width() === 0 && this.height() === 0) {\n this.size(img.width, img.height)\n }\n\n if (p instanceof Pattern) {\n // ensure pattern size if not set\n if (p.width() === 0 && p.height() === 0) {\n p.size(this.width(), this.height())\n }\n }\n\n if (typeof callback === 'function') {\n callback.call(this, e)\n }\n },\n this\n )\n\n on(img, 'load error', function () {\n // dont forget to unbind memory leaking events\n off(img)\n })\n\n return this.attr('href', (img.src = url), xlink)\n }\n}\n\nregisterAttrHook(function (attr, val, _this) {\n // convert image fill and stroke to patterns\n if (attr === 'fill' || attr === 'stroke') {\n if (isImage.test(val)) {\n val = _this.root().defs().image(val)\n }\n }\n\n if (val instanceof Image) {\n val = _this\n .root()\n .defs()\n .pattern(0, 0, (pattern) => {\n pattern.add(val)\n })\n }\n\n return val\n})\n\nregisterMethods({\n Container: {\n // create image element, load image and set its size\n image: wrapWithAttrCheck(function (source, callback) {\n return this.put(new Image()).size(0, 0).load(source, callback)\n })\n }\n})\n\nregister(Image, 'Image')\n","import { delimiter } from '../modules/core/regex.js'\nimport SVGArray from './SVGArray.js'\nimport Box from './Box.js'\nimport Matrix from './Matrix.js'\n\nexport default class PointArray extends SVGArray {\n // Get bounding box of points\n bbox() {\n let maxX = -Infinity\n let maxY = -Infinity\n let minX = Infinity\n let minY = Infinity\n this.forEach(function (el) {\n maxX = Math.max(el[0], maxX)\n maxY = Math.max(el[1], maxY)\n minX = Math.min(el[0], minX)\n minY = Math.min(el[1], minY)\n })\n return new Box(minX, minY, maxX - minX, maxY - minY)\n }\n\n // Move point string\n move(x, y) {\n const box = this.bbox()\n\n // get relative offset\n x -= box.x\n y -= box.y\n\n // move every point\n if (!isNaN(x) && !isNaN(y)) {\n for (let i = this.length - 1; i >= 0; i--) {\n this[i] = [this[i][0] + x, this[i][1] + y]\n }\n }\n\n return this\n }\n\n // Parse point string and flat array\n parse(array = [0, 0]) {\n const points = []\n\n // if it is an array, we flatten it and therefore clone it to 1 depths\n if (array instanceof Array) {\n array = Array.prototype.concat.apply([], array)\n } else {\n // Else, it is considered as a string\n // parse points\n array = array.trim().split(delimiter).map(parseFloat)\n }\n\n // validate points - https://svgwg.org/svg2-draft/shapes.html#DataTypePoints\n // Odd number of coordinates is an error. In such cases, drop the last odd coordinate.\n if (array.length % 2 !== 0) array.pop()\n\n // wrap points in two-tuples\n for (let i = 0, len = array.length; i < len; i = i + 2) {\n points.push([array[i], array[i + 1]])\n }\n\n return points\n }\n\n // Resize poly string\n size(width, height) {\n let i\n const box = this.bbox()\n\n // recalculate position of all points according to new size\n for (i = this.length - 1; i >= 0; i--) {\n if (box.width)\n this[i][0] = ((this[i][0] - box.x) * width) / box.width + box.x\n if (box.height)\n this[i][1] = ((this[i][1] - box.y) * height) / box.height + box.y\n }\n\n return this\n }\n\n // Convert array to line object\n toLine() {\n return {\n x1: this[0][0],\n y1: this[0][1],\n x2: this[1][0],\n y2: this[1][1]\n }\n }\n\n // Convert array to string\n toString() {\n const array = []\n // convert to a poly point string\n for (let i = 0, il = this.length; i < il; i++) {\n array.push(this[i].join(','))\n }\n\n return array.join(' ')\n }\n\n transform(m) {\n return this.clone().transformO(m)\n }\n\n // transform points with matrix (similar to Point.transform)\n transformO(m) {\n if (!Matrix.isMatrixLike(m)) {\n m = new Matrix(m)\n }\n\n for (let i = this.length; i--; ) {\n // Perform the matrix multiplication\n const [x, y] = this[i]\n this[i][0] = m.a * x + m.c * y + m.e\n this[i][1] = m.b * x + m.d * y + m.f\n }\n\n return this\n }\n}\n","import PointArray from '../../types/PointArray.js'\n\nexport const MorphArray = PointArray\n\n// Move by left top corner over x-axis\nexport function x(x) {\n return x == null ? this.bbox().x : this.move(x, this.bbox().y)\n}\n\n// Move by left top corner over y-axis\nexport function y(y) {\n return y == null ? this.bbox().y : this.move(this.bbox().x, y)\n}\n\n// Set width of element\nexport function width(width) {\n const b = this.bbox()\n return width == null ? b.width : this.size(width, b.height)\n}\n\n// Set height of element\nexport function height(height) {\n const b = this.bbox()\n return height == null ? b.height : this.size(b.width, height)\n}\n","import {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { proportionalSize } from '../utils/utils.js'\nimport { registerMethods } from '../utils/methods.js'\nimport PointArray from '../types/PointArray.js'\nimport Shape from './Shape.js'\nimport * as pointed from '../modules/core/pointed.js'\n\nexport default class Line extends Shape {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('line', node), attrs)\n }\n\n // Get array\n array() {\n return new PointArray([\n [this.attr('x1'), this.attr('y1')],\n [this.attr('x2'), this.attr('y2')]\n ])\n }\n\n // Move by left top corner\n move(x, y) {\n return this.attr(this.array().move(x, y).toLine())\n }\n\n // Overwrite native plot() method\n plot(x1, y1, x2, y2) {\n if (x1 == null) {\n return this.array()\n } else if (typeof y1 !== 'undefined') {\n x1 = { x1, y1, x2, y2 }\n } else {\n x1 = new PointArray(x1).toLine()\n }\n\n return this.attr(x1)\n }\n\n // Set element size to given width and height\n size(width, height) {\n const p = proportionalSize(this, width, height)\n return this.attr(this.array().size(p.width, p.height).toLine())\n }\n}\n\nextend(Line, pointed)\n\nregisterMethods({\n Container: {\n // Create a line element\n line: wrapWithAttrCheck(function (...args) {\n // make sure plot is called as a setter\n // x1 is not necessarily a number, it can also be an array, a string and a PointArray\n return Line.prototype.plot.apply(\n this.put(new Line()),\n args[0] != null ? args : [0, 0, 0, 0]\n )\n })\n }\n})\n\nregister(Line, 'Line')\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Container from './Container.js'\n\nexport default class Marker extends Container {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('marker', node), attrs)\n }\n\n // Set height of element\n height(height) {\n return this.attr('markerHeight', height)\n }\n\n orient(orient) {\n return this.attr('orient', orient)\n }\n\n // Set marker refX and refY\n ref(x, y) {\n return this.attr('refX', x).attr('refY', y)\n }\n\n // Return the fill id\n toString() {\n return 'url(#' + this.id() + ')'\n }\n\n // Update marker\n update(block) {\n // remove all content\n this.clear()\n\n // invoke passed block\n if (typeof block === 'function') {\n block.call(this, this)\n }\n\n return this\n }\n\n // Set width of element\n width(width) {\n return this.attr('markerWidth', width)\n }\n}\n\nregisterMethods({\n Container: {\n marker(...args) {\n // Create marker element in defs\n return this.defs().marker(...args)\n }\n },\n Defs: {\n // Create marker\n marker: wrapWithAttrCheck(function (width, height, block) {\n // Set default viewbox to match the width and height, set ref to cx and cy and set orient to auto\n return this.put(new Marker())\n .size(width, height)\n .ref(width / 2, height / 2)\n .viewbox(0, 0, width, height)\n .attr('orient', 'auto')\n .update(block)\n })\n },\n marker: {\n // Create and attach markers\n marker(marker, width, height, block) {\n let attr = ['marker']\n\n // Build attribute name\n if (marker !== 'all') attr.push(marker)\n attr = attr.join('-')\n\n // Set marker attribute\n marker =\n arguments[1] instanceof Marker\n ? arguments[1]\n : this.defs().marker(width, height, block)\n\n return this.attr(attr, marker)\n }\n }\n})\n\nregister(Marker, 'Marker')\n","import { timeline } from '../modules/core/defaults.js'\nimport { extend } from '../utils/adopter.js'\n\n/***\nBase Class\n==========\nThe base stepper class that will be\n***/\n\nfunction makeSetterGetter(k, f) {\n return function (v) {\n if (v == null) return this[k]\n this[k] = v\n if (f) f.call(this)\n return this\n }\n}\n\nexport const easing = {\n '-': function (pos) {\n return pos\n },\n '<>': function (pos) {\n return -Math.cos(pos * Math.PI) / 2 + 0.5\n },\n '>': function (pos) {\n return Math.sin((pos * Math.PI) / 2)\n },\n '<': function (pos) {\n return -Math.cos((pos * Math.PI) / 2) + 1\n },\n bezier: function (x1, y1, x2, y2) {\n // see https://www.w3.org/TR/css-easing-1/#cubic-bezier-algo\n return function (t) {\n if (t < 0) {\n if (x1 > 0) {\n return (y1 / x1) * t\n } else if (x2 > 0) {\n return (y2 / x2) * t\n } else {\n return 0\n }\n } else if (t > 1) {\n if (x2 < 1) {\n return ((1 - y2) / (1 - x2)) * t + (y2 - x2) / (1 - x2)\n } else if (x1 < 1) {\n return ((1 - y1) / (1 - x1)) * t + (y1 - x1) / (1 - x1)\n } else {\n return 1\n }\n } else {\n return 3 * t * (1 - t) ** 2 * y1 + 3 * t ** 2 * (1 - t) * y2 + t ** 3\n }\n }\n },\n // see https://www.w3.org/TR/css-easing-1/#step-timing-function-algo\n steps: function (steps, stepPosition = 'end') {\n // deal with \"jump-\" prefix\n stepPosition = stepPosition.split('-').reverse()[0]\n\n let jumps = steps\n if (stepPosition === 'none') {\n --jumps\n } else if (stepPosition === 'both') {\n ++jumps\n }\n\n // The beforeFlag is essentially useless\n return (t, beforeFlag = false) => {\n // Step is called currentStep in referenced url\n let step = Math.floor(t * steps)\n const jumping = (t * step) % 1 === 0\n\n if (stepPosition === 'start' || stepPosition === 'both') {\n ++step\n }\n\n if (beforeFlag && jumping) {\n --step\n }\n\n if (t >= 0 && step < 0) {\n step = 0\n }\n\n if (t <= 1 && step > jumps) {\n step = jumps\n }\n\n return step / jumps\n }\n }\n}\n\nexport class Stepper {\n done() {\n return false\n }\n}\n\n/***\nEasing Functions\n================\n***/\n\nexport class Ease extends Stepper {\n constructor(fn = timeline.ease) {\n super()\n this.ease = easing[fn] || fn\n }\n\n step(from, to, pos) {\n if (typeof from !== 'number') {\n return pos < 1 ? from : to\n }\n return from + (to - from) * this.ease(pos)\n }\n}\n\n/***\nController Types\n================\n***/\n\nexport class Controller extends Stepper {\n constructor(fn) {\n super()\n this.stepper = fn\n }\n\n done(c) {\n return c.done\n }\n\n step(current, target, dt, c) {\n return this.stepper(current, target, dt, c)\n }\n}\n\nfunction recalculate() {\n // Apply the default parameters\n const duration = (this._duration || 500) / 1000\n const overshoot = this._overshoot || 0\n\n // Calculate the PID natural response\n const eps = 1e-10\n const pi = Math.PI\n const os = Math.log(overshoot / 100 + eps)\n const zeta = -os / Math.sqrt(pi * pi + os * os)\n const wn = 3.9 / (zeta * duration)\n\n // Calculate the Spring values\n this.d = 2 * zeta * wn\n this.k = wn * wn\n}\n\nexport class Spring extends Controller {\n constructor(duration = 500, overshoot = 0) {\n super()\n this.duration(duration).overshoot(overshoot)\n }\n\n step(current, target, dt, c) {\n if (typeof current === 'string') return current\n c.done = dt === Infinity\n if (dt === Infinity) return target\n if (dt === 0) return current\n\n if (dt > 100) dt = 16\n\n dt /= 1000\n\n // Get the previous velocity\n const velocity = c.velocity || 0\n\n // Apply the control to get the new position and store it\n const acceleration = -this.d * velocity - this.k * (current - target)\n const newPosition = current + velocity * dt + (acceleration * dt * dt) / 2\n\n // Store the velocity\n c.velocity = velocity + acceleration * dt\n\n // Figure out if we have converged, and if so, pass the value\n c.done = Math.abs(target - newPosition) + Math.abs(velocity) < 0.002\n return c.done ? target : newPosition\n }\n}\n\nextend(Spring, {\n duration: makeSetterGetter('_duration', recalculate),\n overshoot: makeSetterGetter('_overshoot', recalculate)\n})\n\nexport class PID extends Controller {\n constructor(p = 0.1, i = 0.01, d = 0, windup = 1000) {\n super()\n this.p(p).i(i).d(d).windup(windup)\n }\n\n step(current, target, dt, c) {\n if (typeof current === 'string') return current\n c.done = dt === Infinity\n\n if (dt === Infinity) return target\n if (dt === 0) return current\n\n const p = target - current\n let i = (c.integral || 0) + p * dt\n const d = (p - (c.error || 0)) / dt\n const windup = this._windup\n\n // antiwindup\n if (windup !== false) {\n i = Math.max(-windup, Math.min(i, windup))\n }\n\n c.error = p\n c.integral = i\n\n c.done = Math.abs(p) < 0.001\n\n return c.done ? target : current + (this.P * p + this.I * i + this.D * d)\n }\n}\n\nextend(PID, {\n windup: makeSetterGetter('_windup'),\n p: makeSetterGetter('P'),\n i: makeSetterGetter('I'),\n d: makeSetterGetter('D')\n})\n","import { isPathLetter } from '../modules/core/regex.js'\nimport Point from '../types/Point.js'\n\nconst segmentParameters = {\n M: 2,\n L: 2,\n H: 1,\n V: 1,\n C: 6,\n S: 4,\n Q: 4,\n T: 2,\n A: 7,\n Z: 0\n}\n\nconst pathHandlers = {\n M: function (c, p, p0) {\n p.x = p0.x = c[0]\n p.y = p0.y = c[1]\n\n return ['M', p.x, p.y]\n },\n L: function (c, p) {\n p.x = c[0]\n p.y = c[1]\n return ['L', c[0], c[1]]\n },\n H: function (c, p) {\n p.x = c[0]\n return ['H', c[0]]\n },\n V: function (c, p) {\n p.y = c[0]\n return ['V', c[0]]\n },\n C: function (c, p) {\n p.x = c[4]\n p.y = c[5]\n return ['C', c[0], c[1], c[2], c[3], c[4], c[5]]\n },\n S: function (c, p) {\n p.x = c[2]\n p.y = c[3]\n return ['S', c[0], c[1], c[2], c[3]]\n },\n Q: function (c, p) {\n p.x = c[2]\n p.y = c[3]\n return ['Q', c[0], c[1], c[2], c[3]]\n },\n T: function (c, p) {\n p.x = c[0]\n p.y = c[1]\n return ['T', c[0], c[1]]\n },\n Z: function (c, p, p0) {\n p.x = p0.x\n p.y = p0.y\n return ['Z']\n },\n A: function (c, p) {\n p.x = c[5]\n p.y = c[6]\n return ['A', c[0], c[1], c[2], c[3], c[4], c[5], c[6]]\n }\n}\n\nconst mlhvqtcsaz = 'mlhvqtcsaz'.split('')\n\nfor (let i = 0, il = mlhvqtcsaz.length; i < il; ++i) {\n pathHandlers[mlhvqtcsaz[i]] = (function (i) {\n return function (c, p, p0) {\n if (i === 'H') c[0] = c[0] + p.x\n else if (i === 'V') c[0] = c[0] + p.y\n else if (i === 'A') {\n c[5] = c[5] + p.x\n c[6] = c[6] + p.y\n } else {\n for (let j = 0, jl = c.length; j < jl; ++j) {\n c[j] = c[j] + (j % 2 ? p.y : p.x)\n }\n }\n\n return pathHandlers[i](c, p, p0)\n }\n })(mlhvqtcsaz[i].toUpperCase())\n}\n\nfunction makeAbsolut(parser) {\n const command = parser.segment[0]\n return pathHandlers[command](parser.segment.slice(1), parser.p, parser.p0)\n}\n\nfunction segmentComplete(parser) {\n return (\n parser.segment.length &&\n parser.segment.length - 1 ===\n segmentParameters[parser.segment[0].toUpperCase()]\n )\n}\n\nfunction startNewSegment(parser, token) {\n parser.inNumber && finalizeNumber(parser, false)\n const pathLetter = isPathLetter.test(token)\n\n if (pathLetter) {\n parser.segment = [token]\n } else {\n const lastCommand = parser.lastCommand\n const small = lastCommand.toLowerCase()\n const isSmall = lastCommand === small\n parser.segment = [small === 'm' ? (isSmall ? 'l' : 'L') : lastCommand]\n }\n\n parser.inSegment = true\n parser.lastCommand = parser.segment[0]\n\n return pathLetter\n}\n\nfunction finalizeNumber(parser, inNumber) {\n if (!parser.inNumber) throw new Error('Parser Error')\n parser.number && parser.segment.push(parseFloat(parser.number))\n parser.inNumber = inNumber\n parser.number = ''\n parser.pointSeen = false\n parser.hasExponent = false\n\n if (segmentComplete(parser)) {\n finalizeSegment(parser)\n }\n}\n\nfunction finalizeSegment(parser) {\n parser.inSegment = false\n if (parser.absolute) {\n parser.segment = makeAbsolut(parser)\n }\n parser.segments.push(parser.segment)\n}\n\nfunction isArcFlag(parser) {\n if (!parser.segment.length) return false\n const isArc = parser.segment[0].toUpperCase() === 'A'\n const length = parser.segment.length\n\n return isArc && (length === 4 || length === 5)\n}\n\nfunction isExponential(parser) {\n return parser.lastToken.toUpperCase() === 'E'\n}\n\nconst pathDelimiters = new Set([' ', ',', '\\t', '\\n', '\\r', '\\f'])\nexport function pathParser(d, toAbsolute = true) {\n let index = 0\n let token = ''\n const parser = {\n segment: [],\n inNumber: false,\n number: '',\n lastToken: '',\n inSegment: false,\n segments: [],\n pointSeen: false,\n hasExponent: false,\n absolute: toAbsolute,\n p0: new Point(),\n p: new Point()\n }\n\n while (((parser.lastToken = token), (token = d.charAt(index++)))) {\n if (!parser.inSegment) {\n if (startNewSegment(parser, token)) {\n continue\n }\n }\n\n if (token === '.') {\n if (parser.pointSeen || parser.hasExponent) {\n finalizeNumber(parser, false)\n --index\n continue\n }\n parser.inNumber = true\n parser.pointSeen = true\n parser.number += token\n continue\n }\n\n if (!isNaN(parseInt(token))) {\n if (parser.number === '0' || isArcFlag(parser)) {\n parser.inNumber = true\n parser.number = token\n finalizeNumber(parser, true)\n continue\n }\n\n parser.inNumber = true\n parser.number += token\n continue\n }\n\n if (pathDelimiters.has(token)) {\n if (parser.inNumber) {\n finalizeNumber(parser, false)\n }\n continue\n }\n\n if (token === '-' || token === '+') {\n if (parser.inNumber && !isExponential(parser)) {\n finalizeNumber(parser, false)\n --index\n continue\n }\n parser.number += token\n parser.inNumber = true\n continue\n }\n\n if (token.toUpperCase() === 'E') {\n parser.number += token\n parser.hasExponent = true\n continue\n }\n\n if (isPathLetter.test(token)) {\n if (parser.inNumber) {\n finalizeNumber(parser, false)\n } else if (!segmentComplete(parser)) {\n throw new Error('parser Error')\n } else {\n finalizeSegment(parser)\n }\n --index\n }\n }\n\n if (parser.inNumber) {\n finalizeNumber(parser, false)\n }\n\n if (parser.inSegment && segmentComplete(parser)) {\n finalizeSegment(parser)\n }\n\n return parser.segments\n}\n","import SVGArray from './SVGArray.js'\nimport parser from '../modules/core/parser.js'\nimport Box from './Box.js'\nimport { pathParser } from '../utils/pathParser.js'\n\nfunction arrayToString(a) {\n let s = ''\n for (let i = 0, il = a.length; i < il; i++) {\n s += a[i][0]\n\n if (a[i][1] != null) {\n s += a[i][1]\n\n if (a[i][2] != null) {\n s += ' '\n s += a[i][2]\n\n if (a[i][3] != null) {\n s += ' '\n s += a[i][3]\n s += ' '\n s += a[i][4]\n\n if (a[i][5] != null) {\n s += ' '\n s += a[i][5]\n s += ' '\n s += a[i][6]\n\n if (a[i][7] != null) {\n s += ' '\n s += a[i][7]\n }\n }\n }\n }\n }\n }\n\n return s + ' '\n}\n\nexport default class PathArray extends SVGArray {\n // Get bounding box of path\n bbox() {\n parser().path.setAttribute('d', this.toString())\n return new Box(parser.nodes.path.getBBox())\n }\n\n // Move path string\n move(x, y) {\n // get bounding box of current situation\n const box = this.bbox()\n\n // get relative offset\n x -= box.x\n y -= box.y\n\n if (!isNaN(x) && !isNaN(y)) {\n // move every point\n for (let l, i = this.length - 1; i >= 0; i--) {\n l = this[i][0]\n\n if (l === 'M' || l === 'L' || l === 'T') {\n this[i][1] += x\n this[i][2] += y\n } else if (l === 'H') {\n this[i][1] += x\n } else if (l === 'V') {\n this[i][1] += y\n } else if (l === 'C' || l === 'S' || l === 'Q') {\n this[i][1] += x\n this[i][2] += y\n this[i][3] += x\n this[i][4] += y\n\n if (l === 'C') {\n this[i][5] += x\n this[i][6] += y\n }\n } else if (l === 'A') {\n this[i][6] += x\n this[i][7] += y\n }\n }\n }\n\n return this\n }\n\n // Absolutize and parse path to array\n parse(d = 'M0 0') {\n if (Array.isArray(d)) {\n d = Array.prototype.concat.apply([], d).toString()\n }\n\n return pathParser(d)\n }\n\n // Resize path string\n size(width, height) {\n // get bounding box of current situation\n const box = this.bbox()\n let i, l\n\n // If the box width or height is 0 then we ignore\n // transformations on the respective axis\n box.width = box.width === 0 ? 1 : box.width\n box.height = box.height === 0 ? 1 : box.height\n\n // recalculate position of all points according to new size\n for (i = this.length - 1; i >= 0; i--) {\n l = this[i][0]\n\n if (l === 'M' || l === 'L' || l === 'T') {\n this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x\n this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y\n } else if (l === 'H') {\n this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x\n } else if (l === 'V') {\n this[i][1] = ((this[i][1] - box.y) * height) / box.height + box.y\n } else if (l === 'C' || l === 'S' || l === 'Q') {\n this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x\n this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y\n this[i][3] = ((this[i][3] - box.x) * width) / box.width + box.x\n this[i][4] = ((this[i][4] - box.y) * height) / box.height + box.y\n\n if (l === 'C') {\n this[i][5] = ((this[i][5] - box.x) * width) / box.width + box.x\n this[i][6] = ((this[i][6] - box.y) * height) / box.height + box.y\n }\n } else if (l === 'A') {\n // resize radii\n this[i][1] = (this[i][1] * width) / box.width\n this[i][2] = (this[i][2] * height) / box.height\n\n // move position values\n this[i][6] = ((this[i][6] - box.x) * width) / box.width + box.x\n this[i][7] = ((this[i][7] - box.y) * height) / box.height + box.y\n }\n }\n\n return this\n }\n\n // Convert array to string\n toString() {\n return arrayToString(this)\n }\n}\n","import { Ease } from './Controller.js'\nimport {\n delimiter,\n numberAndUnit,\n isPathLetter\n} from '../modules/core/regex.js'\nimport { extend } from '../utils/adopter.js'\nimport Color from '../types/Color.js'\nimport PathArray from '../types/PathArray.js'\nimport SVGArray from '../types/SVGArray.js'\nimport SVGNumber from '../types/SVGNumber.js'\n\nconst getClassForType = (value) => {\n const type = typeof value\n\n if (type === 'number') {\n return SVGNumber\n } else if (type === 'string') {\n if (Color.isColor(value)) {\n return Color\n } else if (delimiter.test(value)) {\n return isPathLetter.test(value) ? PathArray : SVGArray\n } else if (numberAndUnit.test(value)) {\n return SVGNumber\n } else {\n return NonMorphable\n }\n } else if (morphableTypes.indexOf(value.constructor) > -1) {\n return value.constructor\n } else if (Array.isArray(value)) {\n return SVGArray\n } else if (type === 'object') {\n return ObjectBag\n } else {\n return NonMorphable\n }\n}\n\nexport default class Morphable {\n constructor(stepper) {\n this._stepper = stepper || new Ease('-')\n\n this._from = null\n this._to = null\n this._type = null\n this._context = null\n this._morphObj = null\n }\n\n at(pos) {\n return this._morphObj.morph(\n this._from,\n this._to,\n pos,\n this._stepper,\n this._context\n )\n }\n\n done() {\n const complete = this._context.map(this._stepper.done).reduce(function (\n last,\n curr\n ) {\n return last && curr\n }, true)\n return complete\n }\n\n from(val) {\n if (val == null) {\n return this._from\n }\n\n this._from = this._set(val)\n return this\n }\n\n stepper(stepper) {\n if (stepper == null) return this._stepper\n this._stepper = stepper\n return this\n }\n\n to(val) {\n if (val == null) {\n return this._to\n }\n\n this._to = this._set(val)\n return this\n }\n\n type(type) {\n // getter\n if (type == null) {\n return this._type\n }\n\n // setter\n this._type = type\n return this\n }\n\n _set(value) {\n if (!this._type) {\n this.type(getClassForType(value))\n }\n\n let result = new this._type(value)\n if (this._type === Color) {\n result = this._to\n ? result[this._to[4]]()\n : this._from\n ? result[this._from[4]]()\n : result\n }\n\n if (this._type === ObjectBag) {\n result = this._to\n ? result.align(this._to)\n : this._from\n ? result.align(this._from)\n : result\n }\n\n result = result.toConsumable()\n\n this._morphObj = this._morphObj || new this._type()\n this._context =\n this._context ||\n Array.apply(null, Array(result.length))\n .map(Object)\n .map(function (o) {\n o.done = true\n return o\n })\n return result\n }\n}\n\nexport class NonMorphable {\n constructor(...args) {\n this.init(...args)\n }\n\n init(val) {\n val = Array.isArray(val) ? val[0] : val\n this.value = val\n return this\n }\n\n toArray() {\n return [this.value]\n }\n\n valueOf() {\n return this.value\n }\n}\n\nexport class TransformBag {\n constructor(...args) {\n this.init(...args)\n }\n\n init(obj) {\n if (Array.isArray(obj)) {\n obj = {\n scaleX: obj[0],\n scaleY: obj[1],\n shear: obj[2],\n rotate: obj[3],\n translateX: obj[4],\n translateY: obj[5],\n originX: obj[6],\n originY: obj[7]\n }\n }\n\n Object.assign(this, TransformBag.defaults, obj)\n return this\n }\n\n toArray() {\n const v = this\n\n return [\n v.scaleX,\n v.scaleY,\n v.shear,\n v.rotate,\n v.translateX,\n v.translateY,\n v.originX,\n v.originY\n ]\n }\n}\n\nTransformBag.defaults = {\n scaleX: 1,\n scaleY: 1,\n shear: 0,\n rotate: 0,\n translateX: 0,\n translateY: 0,\n originX: 0,\n originY: 0\n}\n\nconst sortByKey = (a, b) => {\n return a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0\n}\n\nexport class ObjectBag {\n constructor(...args) {\n this.init(...args)\n }\n\n align(other) {\n const values = this.values\n for (let i = 0, il = values.length; i < il; ++i) {\n // If the type is the same we only need to check if the color is in the correct format\n if (values[i + 1] === other[i + 1]) {\n if (values[i + 1] === Color && other[i + 7] !== values[i + 7]) {\n const space = other[i + 7]\n const color = new Color(this.values.splice(i + 3, 5))\n [space]()\n .toArray()\n this.values.splice(i + 3, 0, ...color)\n }\n\n i += values[i + 2] + 2\n continue\n }\n\n if (!other[i + 1]) {\n return this\n }\n\n // The types differ, so we overwrite the new type with the old one\n // And initialize it with the types default (e.g. black for color or 0 for number)\n const defaultObject = new other[i + 1]().toArray()\n\n // Than we fix the values array\n const toDelete = values[i + 2] + 3\n\n values.splice(\n i,\n toDelete,\n other[i],\n other[i + 1],\n other[i + 2],\n ...defaultObject\n )\n\n i += values[i + 2] + 2\n }\n return this\n }\n\n init(objOrArr) {\n this.values = []\n\n if (Array.isArray(objOrArr)) {\n this.values = objOrArr.slice()\n return\n }\n\n objOrArr = objOrArr || {}\n const entries = []\n\n for (const i in objOrArr) {\n const Type = getClassForType(objOrArr[i])\n const val = new Type(objOrArr[i]).toArray()\n entries.push([i, Type, val.length, ...val])\n }\n\n entries.sort(sortByKey)\n\n this.values = entries.reduce((last, curr) => last.concat(curr), [])\n return this\n }\n\n toArray() {\n return this.values\n }\n\n valueOf() {\n const obj = {}\n const arr = this.values\n\n // for (var i = 0, len = arr.length; i < len; i += 2) {\n while (arr.length) {\n const key = arr.shift()\n const Type = arr.shift()\n const num = arr.shift()\n const values = arr.splice(0, num)\n obj[key] = new Type(values) // .valueOf()\n }\n\n return obj\n }\n}\n\nconst morphableTypes = [NonMorphable, TransformBag, ObjectBag]\n\nexport function registerMorphableType(type = []) {\n morphableTypes.push(...[].concat(type))\n}\n\nexport function makeMorphable() {\n extend(morphableTypes, {\n to(val) {\n return new Morphable()\n .type(this.constructor)\n .from(this.toArray()) // this.valueOf())\n .to(val)\n },\n fromArray(arr) {\n this.init(arr)\n return this\n },\n toConsumable() {\n return this.toArray()\n },\n morph(from, to, pos, stepper, context) {\n const mapper = function (i, index) {\n return stepper.step(i, to[index], pos, context[index], context)\n }\n\n return this.fromArray(from.map(mapper))\n }\n })\n}\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { proportionalSize } from '../utils/utils.js'\nimport { registerMethods } from '../utils/methods.js'\nimport PathArray from '../types/PathArray.js'\nimport Shape from './Shape.js'\n\nexport default class Path extends Shape {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('path', node), attrs)\n }\n\n // Get array\n array() {\n return this._array || (this._array = new PathArray(this.attr('d')))\n }\n\n // Clear array cache\n clear() {\n delete this._array\n return this\n }\n\n // Set height of element\n height(height) {\n return height == null\n ? this.bbox().height\n : this.size(this.bbox().width, height)\n }\n\n // Move by left top corner\n move(x, y) {\n return this.attr('d', this.array().move(x, y))\n }\n\n // Plot new path\n plot(d) {\n return d == null\n ? this.array()\n : this.clear().attr(\n 'd',\n typeof d === 'string' ? d : (this._array = new PathArray(d))\n )\n }\n\n // Set element size to given width and height\n size(width, height) {\n const p = proportionalSize(this, width, height)\n return this.attr('d', this.array().size(p.width, p.height))\n }\n\n // Set width of element\n width(width) {\n return width == null\n ? this.bbox().width\n : this.size(width, this.bbox().height)\n }\n\n // Move by left top corner over x-axis\n x(x) {\n return x == null ? this.bbox().x : this.move(x, this.bbox().y)\n }\n\n // Move by left top corner over y-axis\n y(y) {\n return y == null ? this.bbox().y : this.move(this.bbox().x, y)\n }\n}\n\n// Define morphable array\nPath.prototype.MorphArray = PathArray\n\n// Add parent method\nregisterMethods({\n Container: {\n // Create a wrapped path element\n path: wrapWithAttrCheck(function (d) {\n // make sure plot is called as a setter\n return this.put(new Path()).plot(d || new PathArray())\n })\n }\n})\n\nregister(Path, 'Path')\n","import { proportionalSize } from '../../utils/utils.js'\nimport PointArray from '../../types/PointArray.js'\n\n// Get array\nexport function array() {\n return this._array || (this._array = new PointArray(this.attr('points')))\n}\n\n// Clear array cache\nexport function clear() {\n delete this._array\n return this\n}\n\n// Move by left top corner\nexport function move(x, y) {\n return this.attr('points', this.array().move(x, y))\n}\n\n// Plot new path\nexport function plot(p) {\n return p == null\n ? this.array()\n : this.clear().attr(\n 'points',\n typeof p === 'string' ? p : (this._array = new PointArray(p))\n )\n}\n\n// Set element size to given width and height\nexport function size(width, height) {\n const p = proportionalSize(this, width, height)\n return this.attr('points', this.array().size(p.width, p.height))\n}\n","import {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport PointArray from '../types/PointArray.js'\nimport Shape from './Shape.js'\nimport * as pointed from '../modules/core/pointed.js'\nimport * as poly from '../modules/core/poly.js'\n\nexport default class Polygon extends Shape {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('polygon', node), attrs)\n }\n}\n\nregisterMethods({\n Container: {\n // Create a wrapped polygon element\n polygon: wrapWithAttrCheck(function (p) {\n // make sure plot is called as a setter\n return this.put(new Polygon()).plot(p || new PointArray())\n })\n }\n})\n\nextend(Polygon, pointed)\nextend(Polygon, poly)\nregister(Polygon, 'Polygon')\n","import {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport PointArray from '../types/PointArray.js'\nimport Shape from './Shape.js'\nimport * as pointed from '../modules/core/pointed.js'\nimport * as poly from '../modules/core/poly.js'\n\nexport default class Polyline extends Shape {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('polyline', node), attrs)\n }\n}\n\nregisterMethods({\n Container: {\n // Create a wrapped polygon element\n polyline: wrapWithAttrCheck(function (p) {\n // make sure plot is called as a setter\n return this.put(new Polyline()).plot(p || new PointArray())\n })\n }\n})\n\nextend(Polyline, pointed)\nextend(Polyline, poly)\nregister(Polyline, 'Polyline')\n","import {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport { rx, ry } from '../modules/core/circled.js'\nimport Shape from './Shape.js'\n\nexport default class Rect extends Shape {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('rect', node), attrs)\n }\n}\n\nextend(Rect, { rx, ry })\n\nregisterMethods({\n Container: {\n // Create a rect element\n rect: wrapWithAttrCheck(function (width, height) {\n return this.put(new Rect()).size(width, height)\n })\n }\n})\n\nregister(Rect, 'Rect')\n","export default class Queue {\n constructor() {\n this._first = null\n this._last = null\n }\n\n // Shows us the first item in the list\n first() {\n return this._first && this._first.value\n }\n\n // Shows us the last item in the list\n last() {\n return this._last && this._last.value\n }\n\n push(value) {\n // An item stores an id and the provided value\n const item =\n typeof value.next !== 'undefined'\n ? value\n : { value: value, next: null, prev: null }\n\n // Deal with the queue being empty or populated\n if (this._last) {\n item.prev = this._last\n this._last.next = item\n this._last = item\n } else {\n this._last = item\n this._first = item\n }\n\n // Return the current item\n return item\n }\n\n // Removes the item that was returned from the push\n remove(item) {\n // Relink the previous item\n if (item.prev) item.prev.next = item.next\n if (item.next) item.next.prev = item.prev\n if (item === this._last) this._last = item.prev\n if (item === this._first) this._first = item.next\n\n // Invalidate item\n item.prev = null\n item.next = null\n }\n\n shift() {\n // Check if we have a value\n const remove = this._first\n if (!remove) return null\n\n // If we do, remove it and relink things\n this._first = remove.next\n if (this._first) this._first.prev = null\n this._last = this._first ? this._last : null\n return remove.value\n }\n}\n","import { globals } from '../utils/window.js'\nimport Queue from './Queue.js'\n\nconst Animator = {\n nextDraw: null,\n frames: new Queue(),\n timeouts: new Queue(),\n immediates: new Queue(),\n timer: () => globals.window.performance || globals.window.Date,\n transforms: [],\n\n frame(fn) {\n // Store the node\n const node = Animator.frames.push({ run: fn })\n\n // Request an animation frame if we don't have one\n if (Animator.nextDraw === null) {\n Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw)\n }\n\n // Return the node so we can remove it easily\n return node\n },\n\n timeout(fn, delay) {\n delay = delay || 0\n\n // Work out when the event should fire\n const time = Animator.timer().now() + delay\n\n // Add the timeout to the end of the queue\n const node = Animator.timeouts.push({ run: fn, time: time })\n\n // Request another animation frame if we need one\n if (Animator.nextDraw === null) {\n Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw)\n }\n\n return node\n },\n\n immediate(fn) {\n // Add the immediate fn to the end of the queue\n const node = Animator.immediates.push(fn)\n // Request another animation frame if we need one\n if (Animator.nextDraw === null) {\n Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw)\n }\n\n return node\n },\n\n cancelFrame(node) {\n node != null && Animator.frames.remove(node)\n },\n\n clearTimeout(node) {\n node != null && Animator.timeouts.remove(node)\n },\n\n cancelImmediate(node) {\n node != null && Animator.immediates.remove(node)\n },\n\n _draw(now) {\n // Run all the timeouts we can run, if they are not ready yet, add them\n // to the end of the queue immediately! (bad timeouts!!! [sarcasm])\n let nextTimeout = null\n const lastTimeout = Animator.timeouts.last()\n while ((nextTimeout = Animator.timeouts.shift())) {\n // Run the timeout if its time, or push it to the end\n if (now >= nextTimeout.time) {\n nextTimeout.run()\n } else {\n Animator.timeouts.push(nextTimeout)\n }\n\n // If we hit the last item, we should stop shifting out more items\n if (nextTimeout === lastTimeout) break\n }\n\n // Run all of the animation frames\n let nextFrame = null\n const lastFrame = Animator.frames.last()\n while (nextFrame !== lastFrame && (nextFrame = Animator.frames.shift())) {\n nextFrame.run(now)\n }\n\n let nextImmediate = null\n while ((nextImmediate = Animator.immediates.shift())) {\n nextImmediate()\n }\n\n // If we have remaining timeouts or frames, draw until we don't anymore\n Animator.nextDraw =\n Animator.timeouts.first() || Animator.frames.first()\n ? globals.window.requestAnimationFrame(Animator._draw)\n : null\n }\n}\n\nexport default Animator\n","import { globals } from '../utils/window.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Animator from './Animator.js'\nimport EventTarget from '../types/EventTarget.js'\n\nconst makeSchedule = function (runnerInfo) {\n const start = runnerInfo.start\n const duration = runnerInfo.runner.duration()\n const end = start + duration\n return {\n start: start,\n duration: duration,\n end: end,\n runner: runnerInfo.runner\n }\n}\n\nconst defaultSource = function () {\n const w = globals.window\n return (w.performance || w.Date).now()\n}\n\nexport default class Timeline extends EventTarget {\n // Construct a new timeline on the given element\n constructor(timeSource = defaultSource) {\n super()\n\n this._timeSource = timeSource\n\n // terminate resets all variables to their initial state\n this.terminate()\n }\n\n active() {\n return !!this._nextFrame\n }\n\n finish() {\n // Go to end and pause\n this.time(this.getEndTimeOfTimeline() + 1)\n return this.pause()\n }\n\n // Calculates the end of the timeline\n getEndTime() {\n const lastRunnerInfo = this.getLastRunnerInfo()\n const lastDuration = lastRunnerInfo ? lastRunnerInfo.runner.duration() : 0\n const lastStartTime = lastRunnerInfo ? lastRunnerInfo.start : this._time\n return lastStartTime + lastDuration\n }\n\n getEndTimeOfTimeline() {\n const endTimes = this._runners.map((i) => i.start + i.runner.duration())\n return Math.max(0, ...endTimes)\n }\n\n getLastRunnerInfo() {\n return this.getRunnerInfoById(this._lastRunnerId)\n }\n\n getRunnerInfoById(id) {\n return this._runners[this._runnerIds.indexOf(id)] || null\n }\n\n pause() {\n this._paused = true\n return this._continue()\n }\n\n persist(dtOrForever) {\n if (dtOrForever == null) return this._persist\n this._persist = dtOrForever\n return this\n }\n\n play() {\n // Now make sure we are not paused and continue the animation\n this._paused = false\n return this.updateTime()._continue()\n }\n\n reverse(yes) {\n const currentSpeed = this.speed()\n if (yes == null) return this.speed(-currentSpeed)\n\n const positive = Math.abs(currentSpeed)\n return this.speed(yes ? -positive : positive)\n }\n\n // schedules a runner on the timeline\n schedule(runner, delay, when) {\n if (runner == null) {\n return this._runners.map(makeSchedule)\n }\n\n // The start time for the next animation can either be given explicitly,\n // derived from the current timeline time or it can be relative to the\n // last start time to chain animations directly\n\n let absoluteStartTime = 0\n const endTime = this.getEndTime()\n delay = delay || 0\n\n // Work out when to start the animation\n if (when == null || when === 'last' || when === 'after') {\n // Take the last time and increment\n absoluteStartTime = endTime\n } else if (when === 'absolute' || when === 'start') {\n absoluteStartTime = delay\n delay = 0\n } else if (when === 'now') {\n absoluteStartTime = this._time\n } else if (when === 'relative') {\n const runnerInfo = this.getRunnerInfoById(runner.id)\n if (runnerInfo) {\n absoluteStartTime = runnerInfo.start + delay\n delay = 0\n }\n } else if (when === 'with-last') {\n const lastRunnerInfo = this.getLastRunnerInfo()\n const lastStartTime = lastRunnerInfo ? lastRunnerInfo.start : this._time\n absoluteStartTime = lastStartTime\n } else {\n throw new Error('Invalid value for the \"when\" parameter')\n }\n\n // Manage runner\n runner.unschedule()\n runner.timeline(this)\n\n const persist = runner.persist()\n const runnerInfo = {\n persist: persist === null ? this._persist : persist,\n start: absoluteStartTime + delay,\n runner\n }\n\n this._lastRunnerId = runner.id\n\n this._runners.push(runnerInfo)\n this._runners.sort((a, b) => a.start - b.start)\n this._runnerIds = this._runners.map((info) => info.runner.id)\n\n this.updateTime()._continue()\n return this\n }\n\n seek(dt) {\n return this.time(this._time + dt)\n }\n\n source(fn) {\n if (fn == null) return this._timeSource\n this._timeSource = fn\n return this\n }\n\n speed(speed) {\n if (speed == null) return this._speed\n this._speed = speed\n return this\n }\n\n stop() {\n // Go to start and pause\n this.time(0)\n return this.pause()\n }\n\n time(time) {\n if (time == null) return this._time\n this._time = time\n return this._continue(true)\n }\n\n // Remove the runner from this timeline\n unschedule(runner) {\n const index = this._runnerIds.indexOf(runner.id)\n if (index < 0) return this\n\n this._runners.splice(index, 1)\n this._runnerIds.splice(index, 1)\n\n runner.timeline(null)\n return this\n }\n\n // Makes sure, that after pausing the time doesn't jump\n updateTime() {\n if (!this.active()) {\n this._lastSourceTime = this._timeSource()\n }\n return this\n }\n\n // Checks if we are running and continues the animation\n _continue(immediateStep = false) {\n Animator.cancelFrame(this._nextFrame)\n this._nextFrame = null\n\n if (immediateStep) return this._stepImmediate()\n if (this._paused) return this\n\n this._nextFrame = Animator.frame(this._step)\n return this\n }\n\n _stepFn(immediateStep = false) {\n // Get the time delta from the last time and update the time\n const time = this._timeSource()\n let dtSource = time - this._lastSourceTime\n\n if (immediateStep) dtSource = 0\n\n const dtTime = this._speed * dtSource + (this._time - this._lastStepTime)\n this._lastSourceTime = time\n\n // Only update the time if we use the timeSource.\n // Otherwise use the current time\n if (!immediateStep) {\n // Update the time\n this._time += dtTime\n this._time = this._time < 0 ? 0 : this._time\n }\n this._lastStepTime = this._time\n this.fire('time', this._time)\n\n // This is for the case that the timeline was seeked so that the time\n // is now before the startTime of the runner. That is why we need to set\n // the runner to position 0\n\n // FIXME:\n // However, resetting in insertion order leads to bugs. Considering the case,\n // where 2 runners change the same attribute but in different times,\n // resetting both of them will lead to the case where the later defined\n // runner always wins the reset even if the other runner started earlier\n // and therefore should win the attribute battle\n // this can be solved by resetting them backwards\n for (let k = this._runners.length; k--; ) {\n // Get and run the current runner and ignore it if its inactive\n const runnerInfo = this._runners[k]\n const runner = runnerInfo.runner\n\n // Make sure that we give the actual difference\n // between runner start time and now\n const dtToStart = this._time - runnerInfo.start\n\n // Dont run runner if not started yet\n // and try to reset it\n if (dtToStart <= 0) {\n runner.reset()\n }\n }\n\n // Run all of the runners directly\n let runnersLeft = false\n for (let i = 0, len = this._runners.length; i < len; i++) {\n // Get and run the current runner and ignore it if its inactive\n const runnerInfo = this._runners[i]\n const runner = runnerInfo.runner\n let dt = dtTime\n\n // Make sure that we give the actual difference\n // between runner start time and now\n const dtToStart = this._time - runnerInfo.start\n\n // Dont run runner if not started yet\n if (dtToStart <= 0) {\n runnersLeft = true\n continue\n } else if (dtToStart < dt) {\n // Adjust dt to make sure that animation is on point\n dt = dtToStart\n }\n\n if (!runner.active()) continue\n\n // If this runner is still going, signal that we need another animation\n // frame, otherwise, remove the completed runner\n const finished = runner.step(dt).done\n if (!finished) {\n runnersLeft = true\n // continue\n } else if (runnerInfo.persist !== true) {\n // runner is finished. And runner might get removed\n const endTime = runner.duration() - runner.time() + this._time\n\n if (endTime + runnerInfo.persist < this._time) {\n // Delete runner and correct index\n runner.unschedule()\n --i\n --len\n }\n }\n }\n\n // Basically: we continue when there are runners right from us in time\n // when -->, and when runners are left from us when <--\n if (\n (runnersLeft && !(this._speed < 0 && this._time === 0)) ||\n (this._runnerIds.length && this._speed < 0 && this._time > 0)\n ) {\n this._continue()\n } else {\n this.pause()\n this.fire('finished')\n }\n\n return this\n }\n\n terminate() {\n // cleanup memory\n\n // Store the timing variables\n this._startTime = 0\n this._speed = 1.0\n\n // Determines how long a runner is hold in memory. Can be a dt or true/false\n this._persist = 0\n\n // Keep track of the running animations and their starting parameters\n this._nextFrame = null\n this._paused = true\n this._runners = []\n this._runnerIds = []\n this._lastRunnerId = -1\n this._time = 0\n this._lastSourceTime = 0\n this._lastStepTime = 0\n\n // Make sure that step is always called in class context\n this._step = this._stepFn.bind(this, false)\n this._stepImmediate = this._stepFn.bind(this, true)\n }\n}\n\nregisterMethods({\n Element: {\n timeline: function (timeline) {\n if (timeline == null) {\n this._timeline = this._timeline || new Timeline()\n return this._timeline\n } else {\n this._timeline = timeline\n return this\n }\n }\n }\n})\n","import { Controller, Ease, Stepper } from './Controller.js'\nimport { extend, register } from '../utils/adopter.js'\nimport { from, to } from '../modules/core/gradiented.js'\nimport { getOrigin } from '../utils/utils.js'\nimport { noop, timeline } from '../modules/core/defaults.js'\nimport { registerMethods } from '../utils/methods.js'\nimport { rx, ry } from '../modules/core/circled.js'\nimport Animator from './Animator.js'\nimport Box from '../types/Box.js'\nimport EventTarget from '../types/EventTarget.js'\nimport Matrix from '../types/Matrix.js'\nimport Morphable, { TransformBag, ObjectBag } from './Morphable.js'\nimport Point from '../types/Point.js'\nimport SVGNumber from '../types/SVGNumber.js'\nimport Timeline from './Timeline.js'\n\nexport default class Runner extends EventTarget {\n constructor(options) {\n super()\n\n // Store a unique id on the runner, so that we can identify it later\n this.id = Runner.id++\n\n // Ensure a default value\n options = options == null ? timeline.duration : options\n\n // Ensure that we get a controller\n options = typeof options === 'function' ? new Controller(options) : options\n\n // Declare all of the variables\n this._element = null\n this._timeline = null\n this.done = false\n this._queue = []\n\n // Work out the stepper and the duration\n this._duration = typeof options === 'number' && options\n this._isDeclarative = options instanceof Controller\n this._stepper = this._isDeclarative ? options : new Ease()\n\n // We copy the current values from the timeline because they can change\n this._history = {}\n\n // Store the state of the runner\n this.enabled = true\n this._time = 0\n this._lastTime = 0\n\n // At creation, the runner is in reset state\n this._reseted = true\n\n // Save transforms applied to this runner\n this.transforms = new Matrix()\n this.transformId = 1\n\n // Looping variables\n this._haveReversed = false\n this._reverse = false\n this._loopsDone = 0\n this._swing = false\n this._wait = 0\n this._times = 1\n\n this._frameId = null\n\n // Stores how long a runner is stored after being done\n this._persist = this._isDeclarative ? true : null\n }\n\n static sanitise(duration, delay, when) {\n // Initialise the default parameters\n let times = 1\n let swing = false\n let wait = 0\n duration = duration ?? timeline.duration\n delay = delay ?? timeline.delay\n when = when || 'last'\n\n // If we have an object, unpack the values\n if (typeof duration === 'object' && !(duration instanceof Stepper)) {\n delay = duration.delay ?? delay\n when = duration.when ?? when\n swing = duration.swing || swing\n times = duration.times ?? times\n wait = duration.wait ?? wait\n duration = duration.duration ?? timeline.duration\n }\n\n return {\n duration: duration,\n delay: delay,\n swing: swing,\n times: times,\n wait: wait,\n when: when\n }\n }\n\n active(enabled) {\n if (enabled == null) return this.enabled\n this.enabled = enabled\n return this\n }\n\n /*\n Private Methods\n ===============\n Methods that shouldn't be used externally\n */\n addTransform(transform) {\n this.transforms.lmultiplyO(transform)\n return this\n }\n\n after(fn) {\n return this.on('finished', fn)\n }\n\n animate(duration, delay, when) {\n const o = Runner.sanitise(duration, delay, when)\n const runner = new Runner(o.duration)\n if (this._timeline) runner.timeline(this._timeline)\n if (this._element) runner.element(this._element)\n return runner.loop(o).schedule(o.delay, o.when)\n }\n\n clearTransform() {\n this.transforms = new Matrix()\n return this\n }\n\n // TODO: Keep track of all transformations so that deletion is faster\n clearTransformsFromQueue() {\n if (\n !this.done ||\n !this._timeline ||\n !this._timeline._runnerIds.includes(this.id)\n ) {\n this._queue = this._queue.filter((item) => {\n return !item.isTransform\n })\n }\n }\n\n delay(delay) {\n return this.animate(0, delay)\n }\n\n duration() {\n return this._times * (this._wait + this._duration) - this._wait\n }\n\n during(fn) {\n return this.queue(null, fn)\n }\n\n ease(fn) {\n this._stepper = new Ease(fn)\n return this\n }\n /*\n Runner Definitions\n ==================\n These methods help us define the runtime behaviour of the Runner or they\n help us make new runners from the current runner\n */\n\n element(element) {\n if (element == null) return this._element\n this._element = element\n element._prepareRunner()\n return this\n }\n\n finish() {\n return this.step(Infinity)\n }\n\n loop(times, swing, wait) {\n // Deal with the user passing in an object\n if (typeof times === 'object') {\n swing = times.swing\n wait = times.wait\n times = times.times\n }\n\n // Sanitise the values and store them\n this._times = times || Infinity\n this._swing = swing || false\n this._wait = wait || 0\n\n // Allow true to be passed\n if (this._times === true) {\n this._times = Infinity\n }\n\n return this\n }\n\n loops(p) {\n const loopDuration = this._duration + this._wait\n if (p == null) {\n const loopsDone = Math.floor(this._time / loopDuration)\n const relativeTime = this._time - loopsDone * loopDuration\n const position = relativeTime / this._duration\n return Math.min(loopsDone + position, this._times)\n }\n const whole = Math.floor(p)\n const partial = p % 1\n const time = loopDuration * whole + this._duration * partial\n return this.time(time)\n }\n\n persist(dtOrForever) {\n if (dtOrForever == null) return this._persist\n this._persist = dtOrForever\n return this\n }\n\n position(p) {\n // Get all of the variables we need\n const x = this._time\n const d = this._duration\n const w = this._wait\n const t = this._times\n const s = this._swing\n const r = this._reverse\n let position\n\n if (p == null) {\n /*\n This function converts a time to a position in the range [0, 1]\n The full explanation can be found in this desmos demonstration\n https://www.desmos.com/calculator/u4fbavgche\n The logic is slightly simplified here because we can use booleans\n */\n\n // Figure out the value without thinking about the start or end time\n const f = function (x) {\n const swinging = s * Math.floor((x % (2 * (w + d))) / (w + d))\n const backwards = (swinging && !r) || (!swinging && r)\n const uncliped =\n (Math.pow(-1, backwards) * (x % (w + d))) / d + backwards\n const clipped = Math.max(Math.min(uncliped, 1), 0)\n return clipped\n }\n\n // Figure out the value by incorporating the start time\n const endTime = t * (w + d) - w\n position =\n x <= 0\n ? Math.round(f(1e-5))\n : x < endTime\n ? f(x)\n : Math.round(f(endTime - 1e-5))\n return position\n }\n\n // Work out the loops done and add the position to the loops done\n const loopsDone = Math.floor(this.loops())\n const swingForward = s && loopsDone % 2 === 0\n const forwards = (swingForward && !r) || (r && swingForward)\n position = loopsDone + (forwards ? p : 1 - p)\n return this.loops(position)\n }\n\n progress(p) {\n if (p == null) {\n return Math.min(1, this._time / this.duration())\n }\n return this.time(p * this.duration())\n }\n\n /*\n Basic Functionality\n ===================\n These methods allow us to attach basic functions to the runner directly\n */\n queue(initFn, runFn, retargetFn, isTransform) {\n this._queue.push({\n initialiser: initFn || noop,\n runner: runFn || noop,\n retarget: retargetFn,\n isTransform: isTransform,\n initialised: false,\n finished: false\n })\n const timeline = this.timeline()\n timeline && this.timeline()._continue()\n return this\n }\n\n reset() {\n if (this._reseted) return this\n this.time(0)\n this._reseted = true\n return this\n }\n\n reverse(reverse) {\n this._reverse = reverse == null ? !this._reverse : reverse\n return this\n }\n\n schedule(timeline, delay, when) {\n // The user doesn't need to pass a timeline if we already have one\n if (!(timeline instanceof Timeline)) {\n when = delay\n delay = timeline\n timeline = this.timeline()\n }\n\n // If there is no timeline, yell at the user...\n if (!timeline) {\n throw Error('Runner cannot be scheduled without timeline')\n }\n\n // Schedule the runner on the timeline provided\n timeline.schedule(this, delay, when)\n return this\n }\n\n step(dt) {\n // If we are inactive, this stepper just gets skipped\n if (!this.enabled) return this\n\n // Update the time and get the new position\n dt = dt == null ? 16 : dt\n this._time += dt\n const position = this.position()\n\n // Figure out if we need to run the stepper in this frame\n const running = this._lastPosition !== position && this._time >= 0\n this._lastPosition = position\n\n // Figure out if we just started\n const duration = this.duration()\n const justStarted = this._lastTime <= 0 && this._time > 0\n const justFinished = this._lastTime < duration && this._time >= duration\n\n this._lastTime = this._time\n if (justStarted) {\n this.fire('start', this)\n }\n\n // Work out if the runner is finished set the done flag here so animations\n // know, that they are running in the last step (this is good for\n // transformations which can be merged)\n const declarative = this._isDeclarative\n this.done = !declarative && !justFinished && this._time >= duration\n\n // Runner is running. So its not in reset state anymore\n this._reseted = false\n\n let converged = false\n // Call initialise and the run function\n if (running || declarative) {\n this._initialise(running)\n\n // clear the transforms on this runner so they dont get added again and again\n this.transforms = new Matrix()\n converged = this._run(declarative ? dt : position)\n\n this.fire('step', this)\n }\n // correct the done flag here\n // declarative animations itself know when they converged\n this.done = this.done || (converged && declarative)\n if (justFinished) {\n this.fire('finished', this)\n }\n return this\n }\n\n /*\n Runner animation methods\n ========================\n Control how the animation plays\n */\n time(time) {\n if (time == null) {\n return this._time\n }\n const dt = time - this._time\n this.step(dt)\n return this\n }\n\n timeline(timeline) {\n // check explicitly for undefined so we can set the timeline to null\n if (typeof timeline === 'undefined') return this._timeline\n this._timeline = timeline\n return this\n }\n\n unschedule() {\n const timeline = this.timeline()\n timeline && timeline.unschedule(this)\n return this\n }\n\n // Run each initialise function in the runner if required\n _initialise(running) {\n // If we aren't running, we shouldn't initialise when not declarative\n if (!running && !this._isDeclarative) return\n\n // Loop through all of the initialisers\n for (let i = 0, len = this._queue.length; i < len; ++i) {\n // Get the current initialiser\n const current = this._queue[i]\n\n // Determine whether we need to initialise\n const needsIt = this._isDeclarative || (!current.initialised && running)\n running = !current.finished\n\n // Call the initialiser if we need to\n if (needsIt && running) {\n current.initialiser.call(this)\n current.initialised = true\n }\n }\n }\n\n // Save a morpher to the morpher list so that we can retarget it later\n _rememberMorpher(method, morpher) {\n this._history[method] = {\n morpher: morpher,\n caller: this._queue[this._queue.length - 1]\n }\n\n // We have to resume the timeline in case a controller\n // is already done without being ever run\n // This can happen when e.g. this is done:\n // anim = el.animate(new SVG.Spring)\n // and later\n // anim.move(...)\n if (this._isDeclarative) {\n const timeline = this.timeline()\n timeline && timeline.play()\n }\n }\n\n // Try to set the target for a morpher if the morpher exists, otherwise\n // Run each run function for the position or dt given\n _run(positionOrDt) {\n // Run all of the _queue directly\n let allfinished = true\n for (let i = 0, len = this._queue.length; i < len; ++i) {\n // Get the current function to run\n const current = this._queue[i]\n\n // Run the function if its not finished, we keep track of the finished\n // flag for the sake of declarative _queue\n const converged = current.runner.call(this, positionOrDt)\n current.finished = current.finished || converged === true\n allfinished = allfinished && current.finished\n }\n\n // We report when all of the constructors are finished\n return allfinished\n }\n\n // do nothing and return false\n _tryRetarget(method, target, extra) {\n if (this._history[method]) {\n // if the last method wasn't even initialised, throw it away\n if (!this._history[method].caller.initialised) {\n const index = this._queue.indexOf(this._history[method].caller)\n this._queue.splice(index, 1)\n return false\n }\n\n // for the case of transformations, we use the special retarget function\n // which has access to the outer scope\n if (this._history[method].caller.retarget) {\n this._history[method].caller.retarget.call(this, target, extra)\n // for everything else a simple morpher change is sufficient\n } else {\n this._history[method].morpher.to(target)\n }\n\n this._history[method].caller.finished = false\n const timeline = this.timeline()\n timeline && timeline.play()\n return true\n }\n return false\n }\n}\n\nRunner.id = 0\n\nexport class FakeRunner {\n constructor(transforms = new Matrix(), id = -1, done = true) {\n this.transforms = transforms\n this.id = id\n this.done = done\n }\n\n clearTransformsFromQueue() {}\n}\n\nextend([Runner, FakeRunner], {\n mergeWith(runner) {\n return new FakeRunner(\n runner.transforms.lmultiply(this.transforms),\n runner.id\n )\n }\n})\n\n// FakeRunner.emptyRunner = new FakeRunner()\n\nconst lmultiply = (last, curr) => last.lmultiplyO(curr)\nconst getRunnerTransform = (runner) => runner.transforms\n\nfunction mergeTransforms() {\n // Find the matrix to apply to the element and apply it\n const runners = this._transformationRunners.runners\n const netTransform = runners\n .map(getRunnerTransform)\n .reduce(lmultiply, new Matrix())\n\n this.transform(netTransform)\n\n this._transformationRunners.merge()\n\n if (this._transformationRunners.length() === 1) {\n this._frameId = null\n }\n}\n\nexport class RunnerArray {\n constructor() {\n this.runners = []\n this.ids = []\n }\n\n add(runner) {\n if (this.runners.includes(runner)) return\n const id = runner.id + 1\n\n this.runners.push(runner)\n this.ids.push(id)\n\n return this\n }\n\n clearBefore(id) {\n const deleteCnt = this.ids.indexOf(id + 1) || 1\n this.ids.splice(0, deleteCnt, 0)\n this.runners\n .splice(0, deleteCnt, new FakeRunner())\n .forEach((r) => r.clearTransformsFromQueue())\n return this\n }\n\n edit(id, newRunner) {\n const index = this.ids.indexOf(id + 1)\n this.ids.splice(index, 1, id + 1)\n this.runners.splice(index, 1, newRunner)\n return this\n }\n\n getByID(id) {\n return this.runners[this.ids.indexOf(id + 1)]\n }\n\n length() {\n return this.ids.length\n }\n\n merge() {\n let lastRunner = null\n for (let i = 0; i < this.runners.length; ++i) {\n const runner = this.runners[i]\n\n const condition =\n lastRunner &&\n runner.done &&\n lastRunner.done &&\n // don't merge runner when persisted on timeline\n (!runner._timeline ||\n !runner._timeline._runnerIds.includes(runner.id)) &&\n (!lastRunner._timeline ||\n !lastRunner._timeline._runnerIds.includes(lastRunner.id))\n\n if (condition) {\n // the +1 happens in the function\n this.remove(runner.id)\n const newRunner = runner.mergeWith(lastRunner)\n this.edit(lastRunner.id, newRunner)\n lastRunner = newRunner\n --i\n } else {\n lastRunner = runner\n }\n }\n\n return this\n }\n\n remove(id) {\n const index = this.ids.indexOf(id + 1)\n this.ids.splice(index, 1)\n this.runners.splice(index, 1)\n return this\n }\n}\n\nregisterMethods({\n Element: {\n animate(duration, delay, when) {\n const o = Runner.sanitise(duration, delay, when)\n const timeline = this.timeline()\n return new Runner(o.duration)\n .loop(o)\n .element(this)\n .timeline(timeline.play())\n .schedule(o.delay, o.when)\n },\n\n delay(by, when) {\n return this.animate(0, by, when)\n },\n\n // this function searches for all runners on the element and deletes the ones\n // which run before the current one. This is because absolute transformations\n // overwrite anything anyway so there is no need to waste time computing\n // other runners\n _clearTransformRunnersBefore(currentRunner) {\n this._transformationRunners.clearBefore(currentRunner.id)\n },\n\n _currentTransform(current) {\n return (\n this._transformationRunners.runners\n // we need the equal sign here to make sure, that also transformations\n // on the same runner which execute before the current transformation are\n // taken into account\n .filter((runner) => runner.id <= current.id)\n .map(getRunnerTransform)\n .reduce(lmultiply, new Matrix())\n )\n },\n\n _addRunner(runner) {\n this._transformationRunners.add(runner)\n\n // Make sure that the runner merge is executed at the very end of\n // all Animator functions. That is why we use immediate here to execute\n // the merge right after all frames are run\n Animator.cancelImmediate(this._frameId)\n this._frameId = Animator.immediate(mergeTransforms.bind(this))\n },\n\n _prepareRunner() {\n if (this._frameId == null) {\n this._transformationRunners = new RunnerArray().add(\n new FakeRunner(new Matrix(this))\n )\n }\n }\n }\n})\n\n// Will output the elements from array A that are not in the array B\nconst difference = (a, b) => a.filter((x) => !b.includes(x))\n\nextend(Runner, {\n attr(a, v) {\n return this.styleAttr('attr', a, v)\n },\n\n // Add animatable styles\n css(s, v) {\n return this.styleAttr('css', s, v)\n },\n\n styleAttr(type, nameOrAttrs, val) {\n if (typeof nameOrAttrs === 'string') {\n return this.styleAttr(type, { [nameOrAttrs]: val })\n }\n\n let attrs = nameOrAttrs\n if (this._tryRetarget(type, attrs)) return this\n\n let morpher = new Morphable(this._stepper).to(attrs)\n let keys = Object.keys(attrs)\n\n this.queue(\n function () {\n morpher = morpher.from(this.element()[type](keys))\n },\n function (pos) {\n this.element()[type](morpher.at(pos).valueOf())\n return morpher.done()\n },\n function (newToAttrs) {\n // Check if any new keys were added\n const newKeys = Object.keys(newToAttrs)\n const differences = difference(newKeys, keys)\n\n // If their are new keys, initialize them and add them to morpher\n if (differences.length) {\n // Get the values\n const addedFromAttrs = this.element()[type](differences)\n\n // Get the already initialized values\n const oldFromAttrs = new ObjectBag(morpher.from()).valueOf()\n\n // Merge old and new\n Object.assign(oldFromAttrs, addedFromAttrs)\n morpher.from(oldFromAttrs)\n }\n\n // Get the object from the morpher\n const oldToAttrs = new ObjectBag(morpher.to()).valueOf()\n\n // Merge in new attributes\n Object.assign(oldToAttrs, newToAttrs)\n\n // Change morpher target\n morpher.to(oldToAttrs)\n\n // Make sure that we save the work we did so we don't need it to do again\n keys = newKeys\n attrs = newToAttrs\n }\n )\n\n this._rememberMorpher(type, morpher)\n return this\n },\n\n zoom(level, point) {\n if (this._tryRetarget('zoom', level, point)) return this\n\n let morpher = new Morphable(this._stepper).to(new SVGNumber(level))\n\n this.queue(\n function () {\n morpher = morpher.from(this.element().zoom())\n },\n function (pos) {\n this.element().zoom(morpher.at(pos), point)\n return morpher.done()\n },\n function (newLevel, newPoint) {\n point = newPoint\n morpher.to(newLevel)\n }\n )\n\n this._rememberMorpher('zoom', morpher)\n return this\n },\n\n /**\n ** absolute transformations\n **/\n\n //\n // M v -----|-----(D M v = F v)------|-----> T v\n //\n // 1. define the final state (T) and decompose it (once)\n // t = [tx, ty, the, lam, sy, sx]\n // 2. on every frame: pull the current state of all previous transforms\n // (M - m can change)\n // and then write this as m = [tx0, ty0, the0, lam0, sy0, sx0]\n // 3. Find the interpolated matrix F(pos) = m + pos * (t - m)\n // - Note F(0) = M\n // - Note F(1) = T\n // 4. Now you get the delta matrix as a result: D = F * inv(M)\n\n transform(transforms, relative, affine) {\n // If we have a declarative function, we should retarget it if possible\n relative = transforms.relative || relative\n if (\n this._isDeclarative &&\n !relative &&\n this._tryRetarget('transform', transforms)\n ) {\n return this\n }\n\n // Parse the parameters\n const isMatrix = Matrix.isMatrixLike(transforms)\n affine =\n transforms.affine != null\n ? transforms.affine\n : affine != null\n ? affine\n : !isMatrix\n\n // Create a morpher and set its type\n const morpher = new Morphable(this._stepper).type(\n affine ? TransformBag : Matrix\n )\n\n let origin\n let element\n let current\n let currentAngle\n let startTransform\n\n function setup() {\n // make sure element and origin is defined\n element = element || this.element()\n origin = origin || getOrigin(transforms, element)\n\n startTransform = new Matrix(relative ? undefined : element)\n\n // add the runner to the element so it can merge transformations\n element._addRunner(this)\n\n // Deactivate all transforms that have run so far if we are absolute\n if (!relative) {\n element._clearTransformRunnersBefore(this)\n }\n }\n\n function run(pos) {\n // clear all other transforms before this in case something is saved\n // on this runner. We are absolute. We dont need these!\n if (!relative) this.clearTransform()\n\n const { x, y } = new Point(origin).transform(\n element._currentTransform(this)\n )\n\n let target = new Matrix({ ...transforms, origin: [x, y] })\n let start = this._isDeclarative && current ? current : startTransform\n\n if (affine) {\n target = target.decompose(x, y)\n start = start.decompose(x, y)\n\n // Get the current and target angle as it was set\n const rTarget = target.rotate\n const rCurrent = start.rotate\n\n // Figure out the shortest path to rotate directly\n const possibilities = [rTarget - 360, rTarget, rTarget + 360]\n const distances = possibilities.map((a) => Math.abs(a - rCurrent))\n const shortest = Math.min(...distances)\n const index = distances.indexOf(shortest)\n target.rotate = possibilities[index]\n }\n\n if (relative) {\n // we have to be careful here not to overwrite the rotation\n // with the rotate method of Matrix\n if (!isMatrix) {\n target.rotate = transforms.rotate || 0\n }\n if (this._isDeclarative && currentAngle) {\n start.rotate = currentAngle\n }\n }\n\n morpher.from(start)\n morpher.to(target)\n\n const affineParameters = morpher.at(pos)\n currentAngle = affineParameters.rotate\n current = new Matrix(affineParameters)\n\n this.addTransform(current)\n element._addRunner(this)\n return morpher.done()\n }\n\n function retarget(newTransforms) {\n // only get a new origin if it changed since the last call\n if (\n (newTransforms.origin || 'center').toString() !==\n (transforms.origin || 'center').toString()\n ) {\n origin = getOrigin(newTransforms, element)\n }\n\n // overwrite the old transformations with the new ones\n transforms = { ...newTransforms, origin }\n }\n\n this.queue(setup, run, retarget, true)\n this._isDeclarative && this._rememberMorpher('transform', morpher)\n return this\n },\n\n // Animatable x-axis\n x(x) {\n return this._queueNumber('x', x)\n },\n\n // Animatable y-axis\n y(y) {\n return this._queueNumber('y', y)\n },\n\n ax(x) {\n return this._queueNumber('ax', x)\n },\n\n ay(y) {\n return this._queueNumber('ay', y)\n },\n\n dx(x = 0) {\n return this._queueNumberDelta('x', x)\n },\n\n dy(y = 0) {\n return this._queueNumberDelta('y', y)\n },\n\n dmove(x, y) {\n return this.dx(x).dy(y)\n },\n\n _queueNumberDelta(method, to) {\n to = new SVGNumber(to)\n\n // Try to change the target if we have this method already registered\n if (this._tryRetarget(method, to)) return this\n\n // Make a morpher and queue the animation\n const morpher = new Morphable(this._stepper).to(to)\n let from = null\n this.queue(\n function () {\n from = this.element()[method]()\n morpher.from(from)\n morpher.to(from + to)\n },\n function (pos) {\n this.element()[method](morpher.at(pos))\n return morpher.done()\n },\n function (newTo) {\n morpher.to(from + new SVGNumber(newTo))\n }\n )\n\n // Register the morpher so that if it is changed again, we can retarget it\n this._rememberMorpher(method, morpher)\n return this\n },\n\n _queueObject(method, to) {\n // Try to change the target if we have this method already registered\n if (this._tryRetarget(method, to)) return this\n\n // Make a morpher and queue the animation\n const morpher = new Morphable(this._stepper).to(to)\n this.queue(\n function () {\n morpher.from(this.element()[method]())\n },\n function (pos) {\n this.element()[method](morpher.at(pos))\n return morpher.done()\n }\n )\n\n // Register the morpher so that if it is changed again, we can retarget it\n this._rememberMorpher(method, morpher)\n return this\n },\n\n _queueNumber(method, value) {\n return this._queueObject(method, new SVGNumber(value))\n },\n\n // Animatable center x-axis\n cx(x) {\n return this._queueNumber('cx', x)\n },\n\n // Animatable center y-axis\n cy(y) {\n return this._queueNumber('cy', y)\n },\n\n // Add animatable move\n move(x, y) {\n return this.x(x).y(y)\n },\n\n amove(x, y) {\n return this.ax(x).ay(y)\n },\n\n // Add animatable center\n center(x, y) {\n return this.cx(x).cy(y)\n },\n\n // Add animatable size\n size(width, height) {\n // animate bbox based size for all other elements\n let box\n\n if (!width || !height) {\n box = this._element.bbox()\n }\n\n if (!width) {\n width = (box.width / box.height) * height\n }\n\n if (!height) {\n height = (box.height / box.width) * width\n }\n\n return this.width(width).height(height)\n },\n\n // Add animatable width\n width(width) {\n return this._queueNumber('width', width)\n },\n\n // Add animatable height\n height(height) {\n return this._queueNumber('height', height)\n },\n\n // Add animatable plot\n plot(a, b, c, d) {\n // Lines can be plotted with 4 arguments\n if (arguments.length === 4) {\n return this.plot([a, b, c, d])\n }\n\n if (this._tryRetarget('plot', a)) return this\n\n const morpher = new Morphable(this._stepper)\n .type(this._element.MorphArray)\n .to(a)\n\n this.queue(\n function () {\n morpher.from(this._element.array())\n },\n function (pos) {\n this._element.plot(morpher.at(pos))\n return morpher.done()\n }\n )\n\n this._rememberMorpher('plot', morpher)\n return this\n },\n\n // Add leading method\n leading(value) {\n return this._queueNumber('leading', value)\n },\n\n // Add animatable viewbox\n viewbox(x, y, width, height) {\n return this._queueObject('viewbox', new Box(x, y, width, height))\n },\n\n update(o) {\n if (typeof o !== 'object') {\n return this.update({\n offset: arguments[0],\n color: arguments[1],\n opacity: arguments[2]\n })\n }\n\n if (o.opacity != null) this.attr('stop-opacity', o.opacity)\n if (o.color != null) this.attr('stop-color', o.color)\n if (o.offset != null) this.attr('offset', o.offset)\n\n return this\n }\n})\n\nextend(Runner, { rx, ry, from, to })\nregister(Runner, 'Runner')\n","import {\n adopt,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { svg, xlink, xmlns } from '../modules/core/namespaces.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Container from './Container.js'\nimport Defs from './Defs.js'\nimport { globals } from '../utils/window.js'\n\nexport default class Svg extends Container {\n constructor(node, attrs = node) {\n super(nodeOrNew('svg', node), attrs)\n this.namespace()\n }\n\n // Creates and returns defs element\n defs() {\n if (!this.isRoot()) return this.root().defs()\n\n return adopt(this.node.querySelector('defs')) || this.put(new Defs())\n }\n\n isRoot() {\n return (\n !this.node.parentNode ||\n (!(this.node.parentNode instanceof globals.window.SVGElement) &&\n this.node.parentNode.nodeName !== '#document-fragment')\n )\n }\n\n // Add namespaces\n namespace() {\n if (!this.isRoot()) return this.root().namespace()\n return this.attr({ xmlns: svg, version: '1.1' }).attr(\n 'xmlns:xlink',\n xlink,\n xmlns\n )\n }\n\n removeNamespace() {\n return this.attr({ xmlns: null, version: null })\n .attr('xmlns:xlink', null, xmlns)\n .attr('xmlns:svgjs', null, xmlns)\n }\n\n // Check if this is a root svg\n // If not, call root() from this element\n root() {\n if (this.isRoot()) return this\n return super.root()\n }\n}\n\nregisterMethods({\n Container: {\n // Create nested svg document\n nested: wrapWithAttrCheck(function () {\n return this.put(new Svg())\n })\n }\n})\n\nregister(Svg, 'Svg', true)\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Container from './Container.js'\n\nexport default class Symbol extends Container {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('symbol', node), attrs)\n }\n}\n\nregisterMethods({\n Container: {\n symbol: wrapWithAttrCheck(function () {\n return this.put(new Symbol())\n })\n }\n})\n\nregister(Symbol, 'Symbol')\n","import { globals } from '../../utils/window.js'\n\n// Create plain text node\nexport function plain(text) {\n // clear if build mode is disabled\n if (this._build === false) {\n this.clear()\n }\n\n // create text node\n this.node.appendChild(globals.document.createTextNode(text))\n\n return this\n}\n\n// Get length of text element\nexport function length() {\n return this.node.getComputedTextLength()\n}\n\n// Move over x-axis\n// Text is moved by its bounding box\n// text-anchor does NOT matter\nexport function x(x, box = this.bbox()) {\n if (x == null) {\n return box.x\n }\n\n return this.attr('x', this.attr('x') + x - box.x)\n}\n\n// Move over y-axis\nexport function y(y, box = this.bbox()) {\n if (y == null) {\n return box.y\n }\n\n return this.attr('y', this.attr('y') + y - box.y)\n}\n\nexport function move(x, y, box = this.bbox()) {\n return this.x(x, box).y(y, box)\n}\n\n// Move center over x-axis\nexport function cx(x, box = this.bbox()) {\n if (x == null) {\n return box.cx\n }\n\n return this.attr('x', this.attr('x') + x - box.cx)\n}\n\n// Move center over y-axis\nexport function cy(y, box = this.bbox()) {\n if (y == null) {\n return box.cy\n }\n\n return this.attr('y', this.attr('y') + y - box.cy)\n}\n\nexport function center(x, y, box = this.bbox()) {\n return this.cx(x, box).cy(y, box)\n}\n\nexport function ax(x) {\n return this.attr('x', x)\n}\n\nexport function ay(y) {\n return this.attr('y', y)\n}\n\nexport function amove(x, y) {\n return this.ax(x).ay(y)\n}\n\n// Enable / disable build mode\nexport function build(build) {\n this._build = !!build\n return this\n}\n","import {\n adopt,\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport SVGNumber from '../types/SVGNumber.js'\nimport Shape from './Shape.js'\nimport { globals } from '../utils/window.js'\nimport * as textable from '../modules/core/textable.js'\nimport { isDescriptive, writeDataToDom } from '../utils/utils.js'\n\nexport default class Text extends Shape {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('text', node), attrs)\n\n this.dom.leading = this.dom.leading ?? new SVGNumber(1.3) // store leading value for rebuilding\n this._rebuild = true // enable automatic updating of dy values\n this._build = false // disable build mode for adding multiple lines\n }\n\n // Set / get leading\n leading(value) {\n // act as getter\n if (value == null) {\n return this.dom.leading\n }\n\n // act as setter\n this.dom.leading = new SVGNumber(value)\n\n return this.rebuild()\n }\n\n // Rebuild appearance type\n rebuild(rebuild) {\n // store new rebuild flag if given\n if (typeof rebuild === 'boolean') {\n this._rebuild = rebuild\n }\n\n // define position of all lines\n if (this._rebuild) {\n const self = this\n let blankLineOffset = 0\n const leading = this.dom.leading\n\n this.each(function (i) {\n if (isDescriptive(this.node)) return\n\n const fontSize = globals.window\n .getComputedStyle(this.node)\n .getPropertyValue('font-size')\n\n const dy = leading * new SVGNumber(fontSize)\n\n if (this.dom.newLined) {\n this.attr('x', self.attr('x'))\n\n if (this.text() === '\\n') {\n blankLineOffset += dy\n } else {\n this.attr('dy', i ? dy + blankLineOffset : 0)\n blankLineOffset = 0\n }\n }\n })\n\n this.fire('rebuild')\n }\n\n return this\n }\n\n // overwrite method from parent to set data properly\n setData(o) {\n this.dom = o\n this.dom.leading = new SVGNumber(o.leading || 1.3)\n return this\n }\n\n writeDataToDom() {\n writeDataToDom(this, this.dom, { leading: 1.3 })\n return this\n }\n\n // Set the text content\n text(text) {\n // act as getter\n if (text === undefined) {\n const children = this.node.childNodes\n let firstLine = 0\n text = ''\n\n for (let i = 0, len = children.length; i < len; ++i) {\n // skip textPaths - they are no lines\n if (children[i].nodeName === 'textPath' || isDescriptive(children[i])) {\n if (i === 0) firstLine = i + 1\n continue\n }\n\n // add newline if its not the first child and newLined is set to true\n if (\n i !== firstLine &&\n children[i].nodeType !== 3 &&\n adopt(children[i]).dom.newLined === true\n ) {\n text += '\\n'\n }\n\n // add content of this node\n text += children[i].textContent\n }\n\n return text\n }\n\n // remove existing content\n this.clear().build(true)\n\n if (typeof text === 'function') {\n // call block\n text.call(this, this)\n } else {\n // store text and make sure text is not blank\n text = (text + '').split('\\n')\n\n // build new lines\n for (let j = 0, jl = text.length; j < jl; j++) {\n this.newLine(text[j])\n }\n }\n\n // disable build mode and rebuild lines\n return this.build(false).rebuild()\n }\n}\n\nextend(Text, textable)\n\nregisterMethods({\n Container: {\n // Create text element\n text: wrapWithAttrCheck(function (text = '') {\n return this.put(new Text()).text(text)\n }),\n\n // Create plain text element\n plain: wrapWithAttrCheck(function (text = '') {\n return this.put(new Text()).plain(text)\n })\n }\n})\n\nregister(Text, 'Text')\n","import {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { globals } from '../utils/window.js'\nimport { registerMethods } from '../utils/methods.js'\nimport SVGNumber from '../types/SVGNumber.js'\nimport Shape from './Shape.js'\nimport Text from './Text.js'\nimport * as textable from '../modules/core/textable.js'\n\nexport default class Tspan extends Shape {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('tspan', node), attrs)\n this._build = false // disable build mode for adding multiple lines\n }\n\n // Shortcut dx\n dx(dx) {\n return this.attr('dx', dx)\n }\n\n // Shortcut dy\n dy(dy) {\n return this.attr('dy', dy)\n }\n\n // Create new line\n newLine() {\n // mark new line\n this.dom.newLined = true\n\n // fetch parent\n const text = this.parent()\n\n // early return in case we are not in a text element\n if (!(text instanceof Text)) {\n return this\n }\n\n const i = text.index(this)\n\n const fontSize = globals.window\n .getComputedStyle(this.node)\n .getPropertyValue('font-size')\n const dy = text.dom.leading * new SVGNumber(fontSize)\n\n // apply new position\n return this.dy(i ? dy : 0).attr('x', text.x())\n }\n\n // Set text content\n text(text) {\n if (text == null)\n return this.node.textContent + (this.dom.newLined ? '\\n' : '')\n\n if (typeof text === 'function') {\n this.clear().build(true)\n text.call(this, this)\n this.build(false)\n } else {\n this.plain(text)\n }\n\n return this\n }\n}\n\nextend(Tspan, textable)\n\nregisterMethods({\n Tspan: {\n tspan: wrapWithAttrCheck(function (text = '') {\n const tspan = new Tspan()\n\n // clear if build mode is disabled\n if (!this._build) {\n this.clear()\n }\n\n // add new tspan\n return this.put(tspan).text(text)\n })\n },\n Text: {\n newLine: function (text = '') {\n return this.tspan(text).newLine()\n }\n }\n})\n\nregister(Tspan, 'Tspan')\n","import { cx, cy, height, width, x, y } from '../modules/core/circled.js'\nimport {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport SVGNumber from '../types/SVGNumber.js'\nimport Shape from './Shape.js'\n\nexport default class Circle extends Shape {\n constructor(node, attrs = node) {\n super(nodeOrNew('circle', node), attrs)\n }\n\n radius(r) {\n return this.attr('r', r)\n }\n\n // Radius x value\n rx(rx) {\n return this.attr('r', rx)\n }\n\n // Alias radius x value\n ry(ry) {\n return this.rx(ry)\n }\n\n size(size) {\n return this.radius(new SVGNumber(size).divide(2))\n }\n}\n\nextend(Circle, { x, y, cx, cy, width, height })\n\nregisterMethods({\n Container: {\n // Create circle element\n circle: wrapWithAttrCheck(function (size = 0) {\n return this.put(new Circle()).size(size).move(0, 0)\n })\n }\n})\n\nregister(Circle, 'Circle')\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Container from './Container.js'\nimport baseFind from '../modules/core/selector.js'\n\nexport default class ClipPath extends Container {\n constructor(node, attrs = node) {\n super(nodeOrNew('clipPath', node), attrs)\n }\n\n // Unclip all clipped elements and remove itself\n remove() {\n // unclip all targets\n this.targets().forEach(function (el) {\n el.unclip()\n })\n\n // remove clipPath from parent\n return super.remove()\n }\n\n targets() {\n return baseFind('svg [clip-path*=' + this.id() + ']')\n }\n}\n\nregisterMethods({\n Container: {\n // Create clipping element\n clip: wrapWithAttrCheck(function () {\n return this.defs().put(new ClipPath())\n })\n },\n Element: {\n // Distribute clipPath to svg element\n clipper() {\n return this.reference('clip-path')\n },\n\n clipWith(element) {\n // use given clip or create a new one\n const clipper =\n element instanceof ClipPath\n ? element\n : this.parent().clip().add(element)\n\n // apply mask\n return this.attr('clip-path', 'url(#' + clipper.id() + ')')\n },\n\n // Unclip element\n unclip() {\n return this.attr('clip-path', null)\n }\n }\n})\n\nregister(ClipPath, 'ClipPath')\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Element from './Element.js'\n\nexport default class ForeignObject extends Element {\n constructor(node, attrs = node) {\n super(nodeOrNew('foreignObject', node), attrs)\n }\n}\n\nregisterMethods({\n Container: {\n foreignObject: wrapWithAttrCheck(function (width, height) {\n return this.put(new ForeignObject()).size(width, height)\n })\n }\n})\n\nregister(ForeignObject, 'ForeignObject')\n","import Matrix from '../../types/Matrix.js'\nimport Point from '../../types/Point.js'\nimport Box from '../../types/Box.js'\nimport { proportionalSize } from '../../utils/utils.js'\nimport { getWindow } from '../../utils/window.js'\n\nexport function dmove(dx, dy) {\n this.children().forEach((child) => {\n let bbox\n\n // We have to wrap this for elements that dont have a bbox\n // e.g. title and other descriptive elements\n try {\n // Get the childs bbox\n // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1905039\n // Because bbox for nested svgs returns the contents bbox in the coordinate space of the svg itself (weird!), we cant use bbox for svgs\n // Therefore we have to use getBoundingClientRect. But THAT is broken (as explained in the bug).\n // Funnily enough the broken behavior would work for us but that breaks it in chrome\n // So we have to replicate the broken behavior of FF by just reading the attributes of the svg itself\n bbox =\n child.node instanceof getWindow().SVGSVGElement\n ? new Box(child.attr(['x', 'y', 'width', 'height']))\n : child.bbox()\n } catch (e) {\n return\n }\n\n // Get childs matrix\n const m = new Matrix(child)\n // Translate childs matrix by amount and\n // transform it back into parents space\n const matrix = m.translate(dx, dy).transform(m.inverse())\n // Calculate new x and y from old box\n const p = new Point(bbox.x, bbox.y).transform(matrix)\n // Move element\n child.move(p.x, p.y)\n })\n\n return this\n}\n\nexport function dx(dx) {\n return this.dmove(dx, 0)\n}\n\nexport function dy(dy) {\n return this.dmove(0, dy)\n}\n\nexport function height(height, box = this.bbox()) {\n if (height == null) return box.height\n return this.size(box.width, height, box)\n}\n\nexport function move(x = 0, y = 0, box = this.bbox()) {\n const dx = x - box.x\n const dy = y - box.y\n\n return this.dmove(dx, dy)\n}\n\nexport function size(width, height, box = this.bbox()) {\n const p = proportionalSize(this, width, height, box)\n const scaleX = p.width / box.width\n const scaleY = p.height / box.height\n\n this.children().forEach((child) => {\n const o = new Point(box).transform(new Matrix(child).inverse())\n child.scale(scaleX, scaleY, o.x, o.y)\n })\n\n return this\n}\n\nexport function width(width, box = this.bbox()) {\n if (width == null) return box.width\n return this.size(width, box.height, box)\n}\n\nexport function x(x, box = this.bbox()) {\n if (x == null) return box.x\n return this.move(x, box.y, box)\n}\n\nexport function y(y, box = this.bbox()) {\n if (y == null) return box.y\n return this.move(box.x, y, box)\n}\n","import {\n nodeOrNew,\n register,\n wrapWithAttrCheck,\n extend\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Container from './Container.js'\nimport * as containerGeometry from '../modules/core/containerGeometry.js'\n\nexport default class G extends Container {\n constructor(node, attrs = node) {\n super(nodeOrNew('g', node), attrs)\n }\n}\n\nextend(G, containerGeometry)\n\nregisterMethods({\n Container: {\n // Create a group element\n group: wrapWithAttrCheck(function () {\n return this.put(new G())\n })\n }\n})\n\nregister(G, 'G')\n","import {\n nodeOrNew,\n register,\n wrapWithAttrCheck,\n extend\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport { xlink } from '../modules/core/namespaces.js'\nimport Container from './Container.js'\nimport * as containerGeometry from '../modules/core/containerGeometry.js'\n\nexport default class A extends Container {\n constructor(node, attrs = node) {\n super(nodeOrNew('a', node), attrs)\n }\n\n // Link target attribute\n target(target) {\n return this.attr('target', target)\n }\n\n // Link url\n to(url) {\n return this.attr('href', url, xlink)\n }\n}\n\nextend(A, containerGeometry)\n\nregisterMethods({\n Container: {\n // Create a hyperlink element\n link: wrapWithAttrCheck(function (url) {\n return this.put(new A()).to(url)\n })\n },\n Element: {\n unlink() {\n const link = this.linker()\n\n if (!link) return this\n\n const parent = link.parent()\n\n if (!parent) {\n return this.remove()\n }\n\n const index = parent.index(link)\n parent.add(this, index)\n\n link.remove()\n return this\n },\n linkTo(url) {\n // reuse old link if possible\n let link = this.linker()\n\n if (!link) {\n link = new A()\n this.wrap(link)\n }\n\n if (typeof url === 'function') {\n url.call(link, link)\n } else {\n link.to(url)\n }\n\n return this\n },\n linker() {\n const link = this.parent()\n if (link && link.node.nodeName.toLowerCase() === 'a') {\n return link\n }\n\n return null\n }\n }\n})\n\nregister(A, 'A')\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Container from './Container.js'\nimport baseFind from '../modules/core/selector.js'\n\nexport default class Mask extends Container {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('mask', node), attrs)\n }\n\n // Unmask all masked elements and remove itself\n remove() {\n // unmask all targets\n this.targets().forEach(function (el) {\n el.unmask()\n })\n\n // remove mask from parent\n return super.remove()\n }\n\n targets() {\n return baseFind('svg [mask*=' + this.id() + ']')\n }\n}\n\nregisterMethods({\n Container: {\n mask: wrapWithAttrCheck(function () {\n return this.defs().put(new Mask())\n })\n },\n Element: {\n // Distribute mask to svg element\n masker() {\n return this.reference('mask')\n },\n\n maskWith(element) {\n // use given mask or create a new one\n const masker =\n element instanceof Mask ? element : this.parent().mask().add(element)\n\n // apply mask\n return this.attr('mask', 'url(#' + masker.id() + ')')\n },\n\n // Unmask element\n unmask() {\n return this.attr('mask', null)\n }\n }\n})\n\nregister(Mask, 'Mask')\n","import { nodeOrNew, register } from '../utils/adopter.js'\nimport Element from './Element.js'\nimport SVGNumber from '../types/SVGNumber.js'\nimport { registerMethods } from '../utils/methods.js'\n\nexport default class Stop extends Element {\n constructor(node, attrs = node) {\n super(nodeOrNew('stop', node), attrs)\n }\n\n // add color stops\n update(o) {\n if (typeof o === 'number' || o instanceof SVGNumber) {\n o = {\n offset: arguments[0],\n color: arguments[1],\n opacity: arguments[2]\n }\n }\n\n // set attributes\n if (o.opacity != null) this.attr('stop-opacity', o.opacity)\n if (o.color != null) this.attr('stop-color', o.color)\n if (o.offset != null) this.attr('offset', new SVGNumber(o.offset))\n\n return this\n }\n}\n\nregisterMethods({\n Gradient: {\n // Add a color stop\n stop: function (offset, color, opacity) {\n return this.put(new Stop()).update(offset, color, opacity)\n }\n }\n})\n\nregister(Stop, 'Stop')\n","import { nodeOrNew, register } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport { unCamelCase } from '../utils/utils.js'\nimport Element from './Element.js'\n\nfunction cssRule(selector, rule) {\n if (!selector) return ''\n if (!rule) return selector\n\n let ret = selector + '{'\n\n for (const i in rule) {\n ret += unCamelCase(i) + ':' + rule[i] + ';'\n }\n\n ret += '}'\n\n return ret\n}\n\nexport default class Style extends Element {\n constructor(node, attrs = node) {\n super(nodeOrNew('style', node), attrs)\n }\n\n addText(w = '') {\n this.node.textContent += w\n return this\n }\n\n font(name, src, params = {}) {\n return this.rule('@font-face', {\n fontFamily: name,\n src: src,\n ...params\n })\n }\n\n rule(selector, obj) {\n return this.addText(cssRule(selector, obj))\n }\n}\n\nregisterMethods('Dom', {\n style(selector, obj) {\n return this.put(new Style()).rule(selector, obj)\n },\n fontface(name, src, params) {\n return this.put(new Style()).font(name, src, params)\n }\n})\n\nregister(Style, 'Style')\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport { xlink } from '../modules/core/namespaces.js'\nimport Path from './Path.js'\nimport PathArray from '../types/PathArray.js'\nimport Text from './Text.js'\nimport baseFind from '../modules/core/selector.js'\n\nexport default class TextPath extends Text {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('textPath', node), attrs)\n }\n\n // return the array of the path track element\n array() {\n const track = this.track()\n\n return track ? track.array() : null\n }\n\n // Plot path if any\n plot(d) {\n const track = this.track()\n let pathArray = null\n\n if (track) {\n pathArray = track.plot(d)\n }\n\n return d == null ? pathArray : this\n }\n\n // Get the path element\n track() {\n return this.reference('href')\n }\n}\n\nregisterMethods({\n Container: {\n textPath: wrapWithAttrCheck(function (text, path) {\n // Convert text to instance if needed\n if (!(text instanceof Text)) {\n text = this.text(text)\n }\n\n return text.path(path)\n })\n },\n Text: {\n // Create path for text to run on\n path: wrapWithAttrCheck(function (track, importNodes = true) {\n const textPath = new TextPath()\n\n // if track is a path, reuse it\n if (!(track instanceof Path)) {\n // create path element\n track = this.defs().path(track)\n }\n\n // link textPath to path and add content\n textPath.attr('href', '#' + track, xlink)\n\n // Transplant all nodes from text to textPath\n let node\n if (importNodes) {\n while ((node = this.node.firstChild)) {\n textPath.node.appendChild(node)\n }\n }\n\n // add textPath element as child node and return textPath\n return this.put(textPath)\n }),\n\n // Get the textPath children\n textPath() {\n return this.findOne('textPath')\n }\n },\n Path: {\n // creates a textPath from this path\n text: wrapWithAttrCheck(function (text) {\n // Convert text to instance if needed\n if (!(text instanceof Text)) {\n text = new Text().addTo(this.parent()).text(text)\n }\n\n // Create textPath from text and path and return\n return text.path(this)\n }),\n\n targets() {\n return baseFind('svg textPath').filter((node) => {\n return (node.attr('href') || '').includes(this.id())\n })\n\n // Does not work in IE11. Use when IE support is dropped\n // return baseFind('svg textPath[*|href*=' + this.id() + ']')\n }\n }\n})\n\nTextPath.prototype.MorphArray = PathArray\nregister(TextPath, 'TextPath')\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport { xlink } from '../modules/core/namespaces.js'\nimport Shape from './Shape.js'\n\nexport default class Use extends Shape {\n constructor(node, attrs = node) {\n super(nodeOrNew('use', node), attrs)\n }\n\n // Use element as a reference\n use(element, file) {\n // Set lined element\n return this.attr('href', (file || '') + '#' + element, xlink)\n }\n}\n\nregisterMethods({\n Container: {\n // Create a use element\n use: wrapWithAttrCheck(function (element, file) {\n return this.put(new Use()).use(element, file)\n })\n }\n})\n\nregister(Use, 'Use')\n","/* Optional Modules */\nimport './modules/optional/arrange.js'\nimport './modules/optional/class.js'\nimport './modules/optional/css.js'\nimport './modules/optional/data.js'\nimport './modules/optional/memory.js'\nimport './modules/optional/sugar.js'\nimport './modules/optional/transform.js'\n\nimport { extend, makeInstance } from './utils/adopter.js'\nimport { getMethodNames, getMethodsFor } from './utils/methods.js'\nimport Box from './types/Box.js'\nimport Color from './types/Color.js'\nimport Container from './elements/Container.js'\nimport Defs from './elements/Defs.js'\nimport Dom from './elements/Dom.js'\nimport Element from './elements/Element.js'\nimport Ellipse from './elements/Ellipse.js'\nimport EventTarget from './types/EventTarget.js'\nimport Fragment from './elements/Fragment.js'\nimport Gradient from './elements/Gradient.js'\nimport Image from './elements/Image.js'\nimport Line from './elements/Line.js'\nimport List from './types/List.js'\nimport Marker from './elements/Marker.js'\nimport Matrix from './types/Matrix.js'\nimport Morphable, {\n NonMorphable,\n ObjectBag,\n TransformBag,\n makeMorphable,\n registerMorphableType\n} from './animation/Morphable.js'\nimport Path from './elements/Path.js'\nimport PathArray from './types/PathArray.js'\nimport Pattern from './elements/Pattern.js'\nimport PointArray from './types/PointArray.js'\nimport Point from './types/Point.js'\nimport Polygon from './elements/Polygon.js'\nimport Polyline from './elements/Polyline.js'\nimport Rect from './elements/Rect.js'\nimport Runner from './animation/Runner.js'\nimport SVGArray from './types/SVGArray.js'\nimport SVGNumber from './types/SVGNumber.js'\nimport Shape from './elements/Shape.js'\nimport Svg from './elements/Svg.js'\nimport Symbol from './elements/Symbol.js'\nimport Text from './elements/Text.js'\nimport Tspan from './elements/Tspan.js'\nimport * as defaults from './modules/core/defaults.js'\nimport * as utils from './utils/utils.js'\nimport * as namespaces from './modules/core/namespaces.js'\nimport * as regex from './modules/core/regex.js'\n\nexport {\n Morphable,\n registerMorphableType,\n makeMorphable,\n TransformBag,\n ObjectBag,\n NonMorphable\n}\n\nexport { defaults, utils, namespaces, regex }\nexport const SVG = makeInstance\nexport { default as parser } from './modules/core/parser.js'\nexport { default as find } from './modules/core/selector.js'\nexport * from './modules/core/event.js'\nexport * from './utils/adopter.js'\nexport {\n getWindow,\n registerWindow,\n restoreWindow,\n saveWindow,\n withWindow\n} from './utils/window.js'\n\n/* Animation Modules */\nexport { default as Animator } from './animation/Animator.js'\nexport {\n Controller,\n Ease,\n PID,\n Spring,\n easing\n} from './animation/Controller.js'\nexport { default as Queue } from './animation/Queue.js'\nexport { default as Runner } from './animation/Runner.js'\nexport { default as Timeline } from './animation/Timeline.js'\n\n/* Types */\nexport { default as Array } from './types/SVGArray.js'\nexport { default as Box } from './types/Box.js'\nexport { default as Color } from './types/Color.js'\nexport { default as EventTarget } from './types/EventTarget.js'\nexport { default as Matrix } from './types/Matrix.js'\nexport { default as Number } from './types/SVGNumber.js'\nexport { default as PathArray } from './types/PathArray.js'\nexport { default as Point } from './types/Point.js'\nexport { default as PointArray } from './types/PointArray.js'\nexport { default as List } from './types/List.js'\n\n/* Elements */\nexport { default as Circle } from './elements/Circle.js'\nexport { default as ClipPath } from './elements/ClipPath.js'\nexport { default as Container } from './elements/Container.js'\nexport { default as Defs } from './elements/Defs.js'\nexport { default as Dom } from './elements/Dom.js'\nexport { default as Element } from './elements/Element.js'\nexport { default as Ellipse } from './elements/Ellipse.js'\nexport { default as ForeignObject } from './elements/ForeignObject.js'\nexport { default as Fragment } from './elements/Fragment.js'\nexport { default as Gradient } from './elements/Gradient.js'\nexport { default as G } from './elements/G.js'\nexport { default as A } from './elements/A.js'\nexport { default as Image } from './elements/Image.js'\nexport { default as Line } from './elements/Line.js'\nexport { default as Marker } from './elements/Marker.js'\nexport { default as Mask } from './elements/Mask.js'\nexport { default as Path } from './elements/Path.js'\nexport { default as Pattern } from './elements/Pattern.js'\nexport { default as Polygon } from './elements/Polygon.js'\nexport { default as Polyline } from './elements/Polyline.js'\nexport { default as Rect } from './elements/Rect.js'\nexport { default as Shape } from './elements/Shape.js'\nexport { default as Stop } from './elements/Stop.js'\nexport { default as Style } from './elements/Style.js'\nexport { default as Svg } from './elements/Svg.js'\nexport { default as Symbol } from './elements/Symbol.js'\nexport { default as Text } from './elements/Text.js'\nexport { default as TextPath } from './elements/TextPath.js'\nexport { default as Tspan } from './elements/Tspan.js'\nexport { default as Use } from './elements/Use.js'\n\nextend([Svg, Symbol, Image, Pattern, Marker], getMethodsFor('viewbox'))\n\nextend([Line, Polyline, Polygon, Path], getMethodsFor('marker'))\n\nextend(Text, getMethodsFor('Text'))\nextend(Path, getMethodsFor('Path'))\n\nextend(Defs, getMethodsFor('Defs'))\n\nextend([Text, Tspan], getMethodsFor('Tspan'))\n\nextend([Rect, Ellipse, Gradient, Runner], getMethodsFor('radius'))\n\nextend(EventTarget, getMethodsFor('EventTarget'))\nextend(Dom, getMethodsFor('Dom'))\nextend(Element, getMethodsFor('Element'))\nextend(Shape, getMethodsFor('Shape'))\nextend([Container, Fragment], getMethodsFor('Container'))\nextend(Gradient, getMethodsFor('Gradient'))\n\nextend(Runner, getMethodsFor('Runner'))\n\nList.extend(getMethodNames())\n\nregisterMorphableType([\n SVGNumber,\n Color,\n Box,\n Matrix,\n SVGArray,\n PointArray,\n PathArray,\n Point\n])\n\nmakeMorphable()\n"],"names":["methods","names","registerMethods","name","m","Array","isArray","_name","addMethodNames","Object","getOwnPropertyNames","assign","getMethodsFor","getMethodNames","Set","_names","push","map","array","block","i","il","length","result","filter","radians","d","Math","PI","degrees","r","unCamelCase","s","replace","g","toLowerCase","capitalize","charAt","toUpperCase","slice","proportionalSize","element","width","height","box","bbox","getOrigin","o","origin","ox","originX","oy","originY","x","y","condX","condY","includes","descriptiveElements","isDescriptive","has","nodeName","writeDataToDom","data","defaults","cloned","key","valueOf","keys","node","setAttribute","JSON","stringify","removeAttribute","svg","html","xmlns","xlink","globals","window","document","registerWindow","win","doc","save","saveWindow","restoreWindow","withWindow","fn","getWindow","Base","elements","root","create","ns","createElementNS","makeInstance","isHTML","adopter","querySelector","wrapper","createElement","innerHTML","firstChild","removeChild","nodeOrNew","Node","ownerDocument","defaultView","adopt","instance","Fragment","className","mockAdopt","mock","register","asRoot","prototype","getClass","did","eid","assignNewId","children","id","extend","modules","wrapWithAttrCheck","args","constructor","apply","attr","siblings","parent","position","index","next","prev","forward","p","add","remove","backward","front","back","before","after","insertBefore","insertAfter","numberAndUnit","hex","rgb","reference","transforms","whitespace","isHex","isRgb","isBlank","isNumber","isImage","delimiter","isPathLetter","classes","trim","split","hasClass","indexOf","addClass","join","removeClass","c","toggleClass","css","style","val","ret","arguments","cssText","el","forEach","t","cased","getPropertyValue","setProperty","test","show","hide","visible","a","v","attributes","parse","e","remember","k","memory","forget","_memory","sixDigitHex","substring","componentHex","component","integer","round","bounded","max","min","toString","is","object","space","getParameters","b","params","_a","_b","_c","_d","z","h","l","cieSpace","hueToRgb","q","Color","inputs","init","isColor","color","random","mode","sin","pi","grey","Error","cmyk","hsl","isGrey","delta","values","noWhitespace","exec","parseInt","hexParse","components","lab","xyz","lch","sqrt","atan2","dToR","cos","yL","xL","zL","ct","mx","nm","rU","gU","bU","pow","bd","toArray","toHex","_clamped","toRgb","rV","gV","bV","string","r255","g255","b255","rL","gL","bL","xU","yU","zU","format","Point","clone","base","source","transform","transformO","Matrix","isMatrixLike","f","point","screenCTM","inverseO","closeEnough","threshold","abs","formatTransforms","flipBoth","flip","flipX","flipY","skewX","skew","isFinite","skewY","scaleX","scale","scaleY","shear","theta","rotate","around","px","positionX","NaN","py","positionY","translate","tx","translateX","ty","translateY","relative","rx","relativeX","ry","relativeY","fromArray","matrixMultiply","cx","cy","matrix","aroundO","dx","dy","translateO","lmultiplyO","decompose","determinant","ccw","sx","thetaRad","st","lam","sy","equals","other","comp","axis","flipO","scaleO","Element","matrixify","parseFloat","call","inverse","det","na","nb","nc","nd","ne","nf","lmultiply","multiply","multiplyO","rotateO","shearO","lx","skewO","tan","ly","current","transformer","ctm","getCTM","isRoot","rect","getScreenCTM","console","warn","parser","nodes","size","path","parentNode","body","documentElement","addTo","isNulledBox","domContains","contains","Box","addOffset","pageXOffset","pageYOffset","left","top","w","x2","y2","isNulled","merge","xMin","Infinity","xMax","yMin","yMax","pts","getBox","getBBoxFn","retry","getBBox","rbox","getRBox","getBoundingClientRect","inside","viewbox","zoom","level","clientWidth","clientHeight","zoomX","zoomY","zoomAmount","Number","MAX_SAFE_INTEGER","List","arr","each","fnOrMethodName","concat","reserved","reduce","obj","attrs","baseFind","query","querySelectorAll","find","findOne","listenerId","windowEvents","getEvents","n","getEventHolder","events","getEventTarget","clearEvents","on","listener","binding","options","bind","bag","_svgjsListenerId","event","ev","addEventListener","off","namespace","removeEventListener","dispatch","Event","dispatchEvent","CustomEvent","detail","cancelable","EventTarget","type","j","defaultPrevented","fire","noop","timeline","duration","ease","delay","fill","stroke","opacity","offset","SVGArray","toSet","SVGNumber","convert","unit","value","divide","number","isNaN","match","minus","plus","times","toJSON","colorAttributes","hooks","registerAttrHook","nodeValue","last","curr","getAttribute","_val","hook","leading","setAttributeNS","rebuild","Dom","removeNamespace","SVGElement","appendChild","childNodes","put","clear","hasChildNodes","lastChild","deep","assignNewIds","nodeClone","cloneNode","first","get","htmlOrFn","outerHTML","xml","matches","selector","matcher","matchesSelector","msMatchesSelector","mozMatchesSelector","webkitMatchesSelector","oMatchesSelector","putIn","removeElement","replaceChild","precision","factor","svgOrFn","outerSVG","words","text","textContent","wrap","xmlOrFn","outerXML","_this","well","fragment","createDocumentFragment","len","firstElementChild","dom","hasAttribute","setData","center","defs","dmove","move","parents","until","isSelector","sugar","prefix","extension","mat","angle","direction","radius","_element","getTotalLength","pointAt","getPointAtLength","font","untransform","str","kv","reverse","toParent","pCtm","toRoot","decomposed","cleanRelative","Container","flatten","ungroup","Defs","Shape","Ellipse","circled","ellipse","from","fx","fy","x1","y1","to","Gradient","targets","url","update","gradiented","gradient","Pattern","pattern","patternUnits","Image","load","callback","img","src","image","PointArray","maxX","maxY","minX","minY","points","pop","toLine","MorphArray","Line","plot","pointed","line","Marker","orient","ref","marker","makeSetterGetter","easing","pos","bezier","steps","stepPosition","jumps","beforeFlag","step","floor","jumping","Stepper","done","Ease","Controller","stepper","target","dt","recalculate","_duration","overshoot","_overshoot","eps","os","log","zeta","wn","Spring","velocity","acceleration","newPosition","PID","windup","integral","error","_windup","P","I","D","segmentParameters","M","L","H","V","C","S","Q","T","A","Z","pathHandlers","p0","mlhvqtcsaz","jl","makeAbsolut","command","segment","segmentComplete","startNewSegment","token","inNumber","finalizeNumber","pathLetter","lastCommand","small","isSmall","inSegment","pointSeen","hasExponent","finalizeSegment","absolute","segments","isArcFlag","isArc","isExponential","lastToken","pathDelimiters","pathParser","toAbsolute","arrayToString","PathArray","getClassForType","NonMorphable","morphableTypes","ObjectBag","Morphable","_stepper","_from","_to","_type","_context","_morphObj","at","morph","complete","_set","align","toConsumable","TransformBag","sortByKey","splice","defaultObject","toDelete","objOrArr","entries","Type","sort","shift","num","registerMorphableType","makeMorphable","context","mapper","Path","_array","Polygon","polygon","poly","Polyline","polyline","Rect","Queue","_first","_last","item","Animator","nextDraw","frames","timeouts","immediates","timer","performance","Date","frame","run","requestAnimationFrame","_draw","timeout","time","now","immediate","cancelFrame","clearTimeout","cancelImmediate","nextTimeout","lastTimeout","nextFrame","lastFrame","nextImmediate","makeSchedule","runnerInfo","start","runner","end","defaultSource","Timeline","timeSource","_timeSource","terminate","active","_nextFrame","finish","getEndTimeOfTimeline","pause","getEndTime","lastRunnerInfo","getLastRunnerInfo","lastDuration","lastStartTime","_time","endTimes","_runners","getRunnerInfoById","_lastRunnerId","_runnerIds","_paused","_continue","persist","dtOrForever","_persist","play","updateTime","yes","currentSpeed","speed","positive","schedule","when","absoluteStartTime","endTime","unschedule","info","seek","_speed","stop","_lastSourceTime","immediateStep","_stepImmediate","_step","_stepFn","dtSource","dtTime","_lastStepTime","dtToStart","reset","runnersLeft","finished","_startTime","_timeline","Runner","_queue","_isDeclarative","_history","enabled","_lastTime","_reseted","transformId","_haveReversed","_reverse","_loopsDone","_swing","_wait","_times","_frameId","sanitise","swing","wait","addTransform","animate","loop","clearTransform","clearTransformsFromQueue","isTransform","during","queue","_prepareRunner","loops","loopDuration","loopsDone","relativeTime","whole","partial","swinging","backwards","uncliped","clipped","swingForward","forwards","progress","initFn","runFn","retargetFn","initialiser","retarget","initialised","running","_lastPosition","justStarted","justFinished","declarative","converged","_initialise","_run","needsIt","_rememberMorpher","method","morpher","caller","positionOrDt","allfinished","_tryRetarget","extra","FakeRunner","mergeWith","getRunnerTransform","mergeTransforms","runners","_transformationRunners","netTransform","RunnerArray","ids","clearBefore","deleteCnt","edit","newRunner","getByID","lastRunner","condition","by","_clearTransformRunnersBefore","currentRunner","_currentTransform","_addRunner","difference","styleAttr","nameOrAttrs","newToAttrs","newKeys","differences","addedFromAttrs","oldFromAttrs","oldToAttrs","newLevel","newPoint","affine","isMatrix","currentAngle","startTransform","setup","undefined","rTarget","rCurrent","possibilities","distances","shortest","affineParameters","newTransforms","_queueNumber","ax","ay","_queueNumberDelta","newTo","_queueObject","amove","Svg","version","nested","Symbol","symbol","plain","_build","createTextNode","getComputedTextLength","build","Text","_rebuild","self","blankLineOffset","fontSize","getComputedStyle","newLined","firstLine","nodeType","newLine","textable","Tspan","tspan","Circle","circle","ClipPath","unclip","clip","clipper","clipWith","ForeignObject","foreignObject","child","SVGSVGElement","G","containerGeometry","group","link","unlink","linker","linkTo","Mask","unmask","mask","masker","maskWith","Stop","cssRule","rule","Style","addText","fontFamily","fontface","TextPath","track","pathArray","textPath","importNodes","Use","use","file","SVG"],"mappings":";;;;;;;;;;AAAA,MAAMA,SAAO,GAAG,EAAE,CAAA;AAClB,MAAMC,KAAK,GAAG,EAAE,CAAA;AAET,SAASC,eAAeA,CAACC,IAAI,EAAEC,CAAC,EAAE;AACvC,EAAA,IAAIC,KAAK,CAACC,OAAO,CAACH,IAAI,CAAC,EAAE;AACvB,IAAA,KAAK,MAAMI,KAAK,IAAIJ,IAAI,EAAE;AACxBD,MAAAA,eAAe,CAACK,KAAK,EAAEH,CAAC,CAAC,CAAA;AAC3B,KAAA;AACA,IAAA,OAAA;AACF,GAAA;AAEA,EAAA,IAAI,OAAOD,IAAI,KAAK,QAAQ,EAAE;AAC5B,IAAA,KAAK,MAAMI,KAAK,IAAIJ,IAAI,EAAE;AACxBD,MAAAA,eAAe,CAACK,KAAK,EAAEJ,IAAI,CAACI,KAAK,CAAC,CAAC,CAAA;AACrC,KAAA;AACA,IAAA,OAAA;AACF,GAAA;AAEAC,EAAAA,cAAc,CAACC,MAAM,CAACC,mBAAmB,CAACN,CAAC,CAAC,CAAC,CAAA;AAC7CJ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svg.js b/node_modules/@svgdotjs/svg.js/dist/svg.js new file mode 100644 index 0000000..695c738 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/dist/svg.js @@ -0,0 +1,6924 @@ +/*! +* @svgdotjs/svg.js - A lightweight library for manipulating and animating SVG. +* @version 3.2.4 +* https://svgjs.dev/ +* +* @copyright Wout Fierens +* @license MIT +* +* BUILT: Thu Jun 27 2024 12:00:16 GMT+0200 (Central European Summer Time) +*/; +var SVG = (function () { + 'use strict'; + + const methods$1 = {}; + const names = []; + function registerMethods(name, m) { + if (Array.isArray(name)) { + for (const _name of name) { + registerMethods(_name, m); + } + return; + } + if (typeof name === 'object') { + for (const _name in name) { + registerMethods(_name, name[_name]); + } + return; + } + addMethodNames(Object.getOwnPropertyNames(m)); + methods$1[name] = Object.assign(methods$1[name] || {}, m); + } + function getMethodsFor(name) { + return methods$1[name] || {}; + } + function getMethodNames() { + return [...new Set(names)]; + } + function addMethodNames(_names) { + names.push(..._names); + } + + // Map function + function map(array, block) { + let i; + const il = array.length; + const result = []; + for (i = 0; i < il; i++) { + result.push(block(array[i])); + } + return result; + } + + // Filter function + function filter(array, block) { + let i; + const il = array.length; + const result = []; + for (i = 0; i < il; i++) { + if (block(array[i])) { + result.push(array[i]); + } + } + return result; + } + + // Degrees to radians + function radians(d) { + return d % 360 * Math.PI / 180; + } + + // Radians to degrees + function degrees(r) { + return r * 180 / Math.PI % 360; + } + + // Convert camel cased string to dash separated + function unCamelCase(s) { + return s.replace(/([A-Z])/g, function (m, g) { + return '-' + g.toLowerCase(); + }); + } + + // Capitalize first letter of a string + function capitalize(s) { + return s.charAt(0).toUpperCase() + s.slice(1); + } + + // Calculate proportional width and height values when necessary + function proportionalSize(element, width, height, box) { + if (width == null || height == null) { + box = box || element.bbox(); + if (width == null) { + width = box.width / box.height * height; + } else if (height == null) { + height = box.height / box.width * width; + } + } + return { + width: width, + height: height + }; + } + + /** + * This function adds support for string origins. + * It searches for an origin in o.origin o.ox and o.originX. + * This way, origin: {x: 'center', y: 50} can be passed as well as ox: 'center', oy: 50 + **/ + function getOrigin(o, element) { + const origin = o.origin; + // First check if origin is in ox or originX + let ox = o.ox != null ? o.ox : o.originX != null ? o.originX : 'center'; + let oy = o.oy != null ? o.oy : o.originY != null ? o.originY : 'center'; + + // Then check if origin was used and overwrite in that case + if (origin != null) { + [ox, oy] = Array.isArray(origin) ? origin : typeof origin === 'object' ? [origin.x, origin.y] : [origin, origin]; + } + + // Make sure to only call bbox when actually needed + const condX = typeof ox === 'string'; + const condY = typeof oy === 'string'; + if (condX || condY) { + const { + height, + width, + x, + y + } = element.bbox(); + + // And only overwrite if string was passed for this specific axis + if (condX) { + ox = ox.includes('left') ? x : ox.includes('right') ? x + width : x + width / 2; + } + if (condY) { + oy = oy.includes('top') ? y : oy.includes('bottom') ? y + height : y + height / 2; + } + } + + // Return the origin as it is if it wasn't a string + return [ox, oy]; + } + const descriptiveElements = new Set(['desc', 'metadata', 'title']); + const isDescriptive = element => descriptiveElements.has(element.nodeName); + const writeDataToDom = (element, data, defaults = {}) => { + const cloned = { + ...data + }; + for (const key in cloned) { + if (cloned[key].valueOf() === defaults[key]) { + delete cloned[key]; + } + } + if (Object.keys(cloned).length) { + element.node.setAttribute('data-svgjs', JSON.stringify(cloned)); // see #428 + } else { + element.node.removeAttribute('data-svgjs'); + element.node.removeAttribute('svgjs:data'); + } + }; + + var utils = { + __proto__: null, + capitalize: capitalize, + degrees: degrees, + filter: filter, + getOrigin: getOrigin, + isDescriptive: isDescriptive, + map: map, + proportionalSize: proportionalSize, + radians: radians, + unCamelCase: unCamelCase, + writeDataToDom: writeDataToDom + }; + + // Default namespaces + const svg = 'http://www.w3.org/2000/svg'; + const html = 'http://www.w3.org/1999/xhtml'; + const xmlns = 'http://www.w3.org/2000/xmlns/'; + const xlink = 'http://www.w3.org/1999/xlink'; + + var namespaces = { + __proto__: null, + html: html, + svg: svg, + xlink: xlink, + xmlns: xmlns + }; + + const globals = { + window: typeof window === 'undefined' ? null : window, + document: typeof document === 'undefined' ? null : document + }; + function registerWindow(win = null, doc = null) { + globals.window = win; + globals.document = doc; + } + const save = {}; + function saveWindow() { + save.window = globals.window; + save.document = globals.document; + } + function restoreWindow() { + globals.window = save.window; + globals.document = save.document; + } + function withWindow(win, fn) { + saveWindow(); + registerWindow(win, win.document); + fn(win, win.document); + restoreWindow(); + } + function getWindow() { + return globals.window; + } + + class Base { + // constructor (node/*, {extensions = []} */) { + // // this.tags = [] + // // + // // for (let extension of extensions) { + // // extension.setup.call(this, node) + // // this.tags.push(extension.name) + // // } + // } + } + + const elements = {}; + const root = '___SYMBOL___ROOT___'; + + // Method for element creation + function create(name, ns = svg) { + // create element + return globals.document.createElementNS(ns, name); + } + function makeInstance(element, isHTML = false) { + if (element instanceof Base) return element; + if (typeof element === 'object') { + return adopter(element); + } + if (element == null) { + return new elements[root](); + } + if (typeof element === 'string' && element.charAt(0) !== '<') { + return adopter(globals.document.querySelector(element)); + } + + // Make sure, that HTML elements are created with the correct namespace + const wrapper = isHTML ? globals.document.createElement('div') : create('svg'); + wrapper.innerHTML = element; + + // We can use firstChild here because we know, + // that the first char is < and thus an element + element = adopter(wrapper.firstChild); + + // make sure, that element doesn't have its wrapper attached + wrapper.removeChild(wrapper.firstChild); + return element; + } + function nodeOrNew(name, node) { + return node && (node instanceof globals.window.Node || node.ownerDocument && node instanceof node.ownerDocument.defaultView.Node) ? node : create(name); + } + + // Adopt existing svg elements + function adopt(node) { + // check for presence of node + if (!node) return null; + + // make sure a node isn't already adopted + if (node.instance instanceof Base) return node.instance; + if (node.nodeName === '#document-fragment') { + return new elements.Fragment(node); + } + + // initialize variables + let className = capitalize(node.nodeName || 'Dom'); + + // Make sure that gradients are adopted correctly + if (className === 'LinearGradient' || className === 'RadialGradient') { + className = 'Gradient'; + + // Fallback to Dom if element is not known + } else if (!elements[className]) { + className = 'Dom'; + } + return new elements[className](node); + } + let adopter = adopt; + function mockAdopt(mock = adopt) { + adopter = mock; + } + function register(element, name = element.name, asRoot = false) { + elements[name] = element; + if (asRoot) elements[root] = element; + addMethodNames(Object.getOwnPropertyNames(element.prototype)); + return element; + } + function getClass(name) { + return elements[name]; + } + + // Element id sequence + let did = 1000; + + // Get next named element id + function eid(name) { + return 'Svgjs' + capitalize(name) + did++; + } + + // Deep new id assignment + function assignNewId(node) { + // do the same for SVG child nodes as well + for (let i = node.children.length - 1; i >= 0; i--) { + assignNewId(node.children[i]); + } + if (node.id) { + node.id = eid(node.nodeName); + return node; + } + return node; + } + + // Method for extending objects + function extend(modules, methods) { + let key, i; + modules = Array.isArray(modules) ? modules : [modules]; + for (i = modules.length - 1; i >= 0; i--) { + for (key in methods) { + modules[i].prototype[key] = methods[key]; + } + } + } + function wrapWithAttrCheck(fn) { + return function (...args) { + const o = args[args.length - 1]; + if (o && o.constructor === Object && !(o instanceof Array)) { + return fn.apply(this, args.slice(0, -1)).attr(o); + } else { + return fn.apply(this, args); + } + }; + } + + // Get all siblings, including myself + function siblings() { + return this.parent().children(); + } + + // Get the current position siblings + function position() { + return this.parent().index(this); + } + + // Get the next element (will return null if there is none) + function next() { + return this.siblings()[this.position() + 1]; + } + + // Get the next element (will return null if there is none) + function prev() { + return this.siblings()[this.position() - 1]; + } + + // Send given element one step forward + function forward() { + const i = this.position(); + const p = this.parent(); + + // move node one step forward + p.add(this.remove(), i + 1); + return this; + } + + // Send given element one step backward + function backward() { + const i = this.position(); + const p = this.parent(); + p.add(this.remove(), i ? i - 1 : 0); + return this; + } + + // Send given element all the way to the front + function front() { + const p = this.parent(); + + // Move node forward + p.add(this.remove()); + return this; + } + + // Send given element all the way to the back + function back() { + const p = this.parent(); + + // Move node back + p.add(this.remove(), 0); + return this; + } + + // Inserts a given element before the targeted element + function before(element) { + element = makeInstance(element); + element.remove(); + const i = this.position(); + this.parent().add(element, i); + return this; + } + + // Inserts a given element after the targeted element + function after(element) { + element = makeInstance(element); + element.remove(); + const i = this.position(); + this.parent().add(element, i + 1); + return this; + } + function insertBefore(element) { + element = makeInstance(element); + element.before(this); + return this; + } + function insertAfter(element) { + element = makeInstance(element); + element.after(this); + return this; + } + registerMethods('Dom', { + siblings, + position, + next, + prev, + forward, + backward, + front, + back, + before, + after, + insertBefore, + insertAfter + }); + + // Parse unit value + const numberAndUnit = /^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i; + + // Parse hex value + const hex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i; + + // Parse rgb value + const rgb = /rgb\((\d+),(\d+),(\d+)\)/; + + // Parse reference id + const reference = /(#[a-z_][a-z0-9\-_]*)/i; + + // splits a transformation chain + const transforms = /\)\s*,?\s*/; + + // Whitespace + const whitespace = /\s/g; + + // Test hex value + const isHex = /^#[a-f0-9]{3}$|^#[a-f0-9]{6}$/i; + + // Test rgb value + const isRgb = /^rgb\(/; + + // Test for blank string + const isBlank = /^(\s+)?$/; + + // Test for numeric string + const isNumber = /^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i; + + // Test for image url + const isImage = /\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i; + + // split at whitespace and comma + const delimiter = /[\s,]+/; + + // Test for path letter + const isPathLetter = /[MLHVCSQTAZ]/i; + + var regex = { + __proto__: null, + delimiter: delimiter, + hex: hex, + isBlank: isBlank, + isHex: isHex, + isImage: isImage, + isNumber: isNumber, + isPathLetter: isPathLetter, + isRgb: isRgb, + numberAndUnit: numberAndUnit, + reference: reference, + rgb: rgb, + transforms: transforms, + whitespace: whitespace + }; + + // Return array of classes on the node + function classes() { + const attr = this.attr('class'); + return attr == null ? [] : attr.trim().split(delimiter); + } + + // Return true if class exists on the node, false otherwise + function hasClass(name) { + return this.classes().indexOf(name) !== -1; + } + + // Add class to the node + function addClass(name) { + if (!this.hasClass(name)) { + const array = this.classes(); + array.push(name); + this.attr('class', array.join(' ')); + } + return this; + } + + // Remove class from the node + function removeClass(name) { + if (this.hasClass(name)) { + this.attr('class', this.classes().filter(function (c) { + return c !== name; + }).join(' ')); + } + return this; + } + + // Toggle the presence of a class on the node + function toggleClass(name) { + return this.hasClass(name) ? this.removeClass(name) : this.addClass(name); + } + registerMethods('Dom', { + classes, + hasClass, + addClass, + removeClass, + toggleClass + }); + + // Dynamic style generator + function css(style, val) { + const ret = {}; + if (arguments.length === 0) { + // get full style as object + this.node.style.cssText.split(/\s*;\s*/).filter(function (el) { + return !!el.length; + }).forEach(function (el) { + const t = el.split(/\s*:\s*/); + ret[t[0]] = t[1]; + }); + return ret; + } + if (arguments.length < 2) { + // get style properties as array + if (Array.isArray(style)) { + for (const name of style) { + const cased = name; + ret[name] = this.node.style.getPropertyValue(cased); + } + return ret; + } + + // get style for property + if (typeof style === 'string') { + return this.node.style.getPropertyValue(style); + } + + // set styles in object + if (typeof style === 'object') { + for (const name in style) { + // set empty string if null/undefined/'' was given + this.node.style.setProperty(name, style[name] == null || isBlank.test(style[name]) ? '' : style[name]); + } + } + } + + // set style for property + if (arguments.length === 2) { + this.node.style.setProperty(style, val == null || isBlank.test(val) ? '' : val); + } + return this; + } + + // Show element + function show() { + return this.css('display', ''); + } + + // Hide element + function hide() { + return this.css('display', 'none'); + } + + // Is element visible? + function visible() { + return this.css('display') !== 'none'; + } + registerMethods('Dom', { + css, + show, + hide, + visible + }); + + // Store data values on svg nodes + function data(a, v, r) { + if (a == null) { + // get an object of attributes + return this.data(map(filter(this.node.attributes, el => el.nodeName.indexOf('data-') === 0), el => el.nodeName.slice(5))); + } else if (a instanceof Array) { + const data = {}; + for (const key of a) { + data[key] = this.data(key); + } + return data; + } else if (typeof a === 'object') { + for (v in a) { + this.data(v, a[v]); + } + } else if (arguments.length < 2) { + try { + return JSON.parse(this.attr('data-' + a)); + } catch (e) { + return this.attr('data-' + a); + } + } else { + this.attr('data-' + a, v === null ? null : r === true || typeof v === 'string' || typeof v === 'number' ? v : JSON.stringify(v)); + } + return this; + } + registerMethods('Dom', { + data + }); + + // Remember arbitrary data + function remember(k, v) { + // remember every item in an object individually + if (typeof arguments[0] === 'object') { + for (const key in k) { + this.remember(key, k[key]); + } + } else if (arguments.length === 1) { + // retrieve memory + return this.memory()[k]; + } else { + // store memory + this.memory()[k] = v; + } + return this; + } + + // Erase a given memory + function forget() { + if (arguments.length === 0) { + this._memory = {}; + } else { + for (let i = arguments.length - 1; i >= 0; i--) { + delete this.memory()[arguments[i]]; + } + } + return this; + } + + // This triggers creation of a new hidden class which is not performant + // However, this function is not rarely used so it will not happen frequently + // Return local memory object + function memory() { + return this._memory = this._memory || {}; + } + registerMethods('Dom', { + remember, + forget, + memory + }); + + function sixDigitHex(hex) { + return hex.length === 4 ? ['#', hex.substring(1, 2), hex.substring(1, 2), hex.substring(2, 3), hex.substring(2, 3), hex.substring(3, 4), hex.substring(3, 4)].join('') : hex; + } + function componentHex(component) { + const integer = Math.round(component); + const bounded = Math.max(0, Math.min(255, integer)); + const hex = bounded.toString(16); + return hex.length === 1 ? '0' + hex : hex; + } + function is(object, space) { + for (let i = space.length; i--;) { + if (object[space[i]] == null) { + return false; + } + } + return true; + } + function getParameters(a, b) { + const params = is(a, 'rgb') ? { + _a: a.r, + _b: a.g, + _c: a.b, + _d: 0, + space: 'rgb' + } : is(a, 'xyz') ? { + _a: a.x, + _b: a.y, + _c: a.z, + _d: 0, + space: 'xyz' + } : is(a, 'hsl') ? { + _a: a.h, + _b: a.s, + _c: a.l, + _d: 0, + space: 'hsl' + } : is(a, 'lab') ? { + _a: a.l, + _b: a.a, + _c: a.b, + _d: 0, + space: 'lab' + } : is(a, 'lch') ? { + _a: a.l, + _b: a.c, + _c: a.h, + _d: 0, + space: 'lch' + } : is(a, 'cmyk') ? { + _a: a.c, + _b: a.m, + _c: a.y, + _d: a.k, + space: 'cmyk' + } : { + _a: 0, + _b: 0, + _c: 0, + space: 'rgb' + }; + params.space = b || params.space; + return params; + } + function cieSpace(space) { + if (space === 'lab' || space === 'xyz' || space === 'lch') { + return true; + } else { + return false; + } + } + function hueToRgb(p, q, t) { + if (t < 0) t += 1; + if (t > 1) t -= 1; + if (t < 1 / 6) return p + (q - p) * 6 * t; + if (t < 1 / 2) return q; + if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6; + return p; + } + class Color { + constructor(...inputs) { + this.init(...inputs); + } + + // Test if given value is a color + static isColor(color) { + return color && (color instanceof Color || this.isRgb(color) || this.test(color)); + } + + // Test if given value is an rgb object + static isRgb(color) { + return color && typeof color.r === 'number' && typeof color.g === 'number' && typeof color.b === 'number'; + } + + /* + Generating random colors + */ + static random(mode = 'vibrant', t) { + // Get the math modules + const { + random, + round, + sin, + PI: pi + } = Math; + + // Run the correct generator + if (mode === 'vibrant') { + const l = (81 - 57) * random() + 57; + const c = (83 - 45) * random() + 45; + const h = 360 * random(); + const color = new Color(l, c, h, 'lch'); + return color; + } else if (mode === 'sine') { + t = t == null ? random() : t; + const r = round(80 * sin(2 * pi * t / 0.5 + 0.01) + 150); + const g = round(50 * sin(2 * pi * t / 0.5 + 4.6) + 200); + const b = round(100 * sin(2 * pi * t / 0.5 + 2.3) + 150); + const color = new Color(r, g, b); + return color; + } else if (mode === 'pastel') { + const l = (94 - 86) * random() + 86; + const c = (26 - 9) * random() + 9; + const h = 360 * random(); + const color = new Color(l, c, h, 'lch'); + return color; + } else if (mode === 'dark') { + const l = 10 + 10 * random(); + const c = (125 - 75) * random() + 86; + const h = 360 * random(); + const color = new Color(l, c, h, 'lch'); + return color; + } else if (mode === 'rgb') { + const r = 255 * random(); + const g = 255 * random(); + const b = 255 * random(); + const color = new Color(r, g, b); + return color; + } else if (mode === 'lab') { + const l = 100 * random(); + const a = 256 * random() - 128; + const b = 256 * random() - 128; + const color = new Color(l, a, b, 'lab'); + return color; + } else if (mode === 'grey') { + const grey = 255 * random(); + const color = new Color(grey, grey, grey); + return color; + } else { + throw new Error('Unsupported random color mode'); + } + } + + // Test if given value is a color string + static test(color) { + return typeof color === 'string' && (isHex.test(color) || isRgb.test(color)); + } + cmyk() { + // Get the rgb values for the current color + const { + _a, + _b, + _c + } = this.rgb(); + const [r, g, b] = [_a, _b, _c].map(v => v / 255); + + // Get the cmyk values in an unbounded format + const k = Math.min(1 - r, 1 - g, 1 - b); + if (k === 1) { + // Catch the black case + return new Color(0, 0, 0, 1, 'cmyk'); + } + const c = (1 - r - k) / (1 - k); + const m = (1 - g - k) / (1 - k); + const y = (1 - b - k) / (1 - k); + + // Construct the new color + const color = new Color(c, m, y, k, 'cmyk'); + return color; + } + hsl() { + // Get the rgb values + const { + _a, + _b, + _c + } = this.rgb(); + const [r, g, b] = [_a, _b, _c].map(v => v / 255); + + // Find the maximum and minimum values to get the lightness + const max = Math.max(r, g, b); + const min = Math.min(r, g, b); + const l = (max + min) / 2; + + // If the r, g, v values are identical then we are grey + const isGrey = max === min; + + // Calculate the hue and saturation + const delta = max - min; + const s = isGrey ? 0 : l > 0.5 ? delta / (2 - max - min) : delta / (max + min); + const h = isGrey ? 0 : max === r ? ((g - b) / delta + (g < b ? 6 : 0)) / 6 : max === g ? ((b - r) / delta + 2) / 6 : max === b ? ((r - g) / delta + 4) / 6 : 0; + + // Construct and return the new color + const color = new Color(360 * h, 100 * s, 100 * l, 'hsl'); + return color; + } + init(a = 0, b = 0, c = 0, d = 0, space = 'rgb') { + // This catches the case when a falsy value is passed like '' + a = !a ? 0 : a; + + // Reset all values in case the init function is rerun with new color space + if (this.space) { + for (const component in this.space) { + delete this[this.space[component]]; + } + } + if (typeof a === 'number') { + // Allow for the case that we don't need d... + space = typeof d === 'string' ? d : space; + d = typeof d === 'string' ? 0 : d; + + // Assign the values straight to the color + Object.assign(this, { + _a: a, + _b: b, + _c: c, + _d: d, + space + }); + // If the user gave us an array, make the color from it + } else if (a instanceof Array) { + this.space = b || (typeof a[3] === 'string' ? a[3] : a[4]) || 'rgb'; + Object.assign(this, { + _a: a[0], + _b: a[1], + _c: a[2], + _d: a[3] || 0 + }); + } else if (a instanceof Object) { + // Set the object up and assign its values directly + const values = getParameters(a, b); + Object.assign(this, values); + } else if (typeof a === 'string') { + if (isRgb.test(a)) { + const noWhitespace = a.replace(whitespace, ''); + const [_a, _b, _c] = rgb.exec(noWhitespace).slice(1, 4).map(v => parseInt(v)); + Object.assign(this, { + _a, + _b, + _c, + _d: 0, + space: 'rgb' + }); + } else if (isHex.test(a)) { + const hexParse = v => parseInt(v, 16); + const [, _a, _b, _c] = hex.exec(sixDigitHex(a)).map(hexParse); + Object.assign(this, { + _a, + _b, + _c, + _d: 0, + space: 'rgb' + }); + } else throw Error("Unsupported string format, can't construct Color"); + } + + // Now add the components as a convenience + const { + _a, + _b, + _c, + _d + } = this; + const components = this.space === 'rgb' ? { + r: _a, + g: _b, + b: _c + } : this.space === 'xyz' ? { + x: _a, + y: _b, + z: _c + } : this.space === 'hsl' ? { + h: _a, + s: _b, + l: _c + } : this.space === 'lab' ? { + l: _a, + a: _b, + b: _c + } : this.space === 'lch' ? { + l: _a, + c: _b, + h: _c + } : this.space === 'cmyk' ? { + c: _a, + m: _b, + y: _c, + k: _d + } : {}; + Object.assign(this, components); + } + lab() { + // Get the xyz color + const { + x, + y, + z + } = this.xyz(); + + // Get the lab components + const l = 116 * y - 16; + const a = 500 * (x - y); + const b = 200 * (y - z); + + // Construct and return a new color + const color = new Color(l, a, b, 'lab'); + return color; + } + lch() { + // Get the lab color directly + const { + l, + a, + b + } = this.lab(); + + // Get the chromaticity and the hue using polar coordinates + const c = Math.sqrt(a ** 2 + b ** 2); + let h = 180 * Math.atan2(b, a) / Math.PI; + if (h < 0) { + h *= -1; + h = 360 - h; + } + + // Make a new color and return it + const color = new Color(l, c, h, 'lch'); + return color; + } + /* + Conversion Methods + */ + + rgb() { + if (this.space === 'rgb') { + return this; + } else if (cieSpace(this.space)) { + // Convert to the xyz color space + let { + x, + y, + z + } = this; + if (this.space === 'lab' || this.space === 'lch') { + // Get the values in the lab space + let { + l, + a, + b + } = this; + if (this.space === 'lch') { + const { + c, + h + } = this; + const dToR = Math.PI / 180; + a = c * Math.cos(dToR * h); + b = c * Math.sin(dToR * h); + } + + // Undo the nonlinear function + const yL = (l + 16) / 116; + const xL = a / 500 + yL; + const zL = yL - b / 200; + + // Get the xyz values + const ct = 16 / 116; + const mx = 0.008856; + const nm = 7.787; + x = 0.95047 * (xL ** 3 > mx ? xL ** 3 : (xL - ct) / nm); + y = 1.0 * (yL ** 3 > mx ? yL ** 3 : (yL - ct) / nm); + z = 1.08883 * (zL ** 3 > mx ? zL ** 3 : (zL - ct) / nm); + } + + // Convert xyz to unbounded rgb values + const rU = x * 3.2406 + y * -1.5372 + z * -0.4986; + const gU = x * -0.9689 + y * 1.8758 + z * 0.0415; + const bU = x * 0.0557 + y * -0.204 + z * 1.057; + + // Convert the values to true rgb values + const pow = Math.pow; + const bd = 0.0031308; + const r = rU > bd ? 1.055 * pow(rU, 1 / 2.4) - 0.055 : 12.92 * rU; + const g = gU > bd ? 1.055 * pow(gU, 1 / 2.4) - 0.055 : 12.92 * gU; + const b = bU > bd ? 1.055 * pow(bU, 1 / 2.4) - 0.055 : 12.92 * bU; + + // Make and return the color + const color = new Color(255 * r, 255 * g, 255 * b); + return color; + } else if (this.space === 'hsl') { + // https://bgrins.github.io/TinyColor/docs/tinycolor.html + // Get the current hsl values + let { + h, + s, + l + } = this; + h /= 360; + s /= 100; + l /= 100; + + // If we are grey, then just make the color directly + if (s === 0) { + l *= 255; + const color = new Color(l, l, l); + return color; + } + + // TODO I have no idea what this does :D If you figure it out, tell me! + const q = l < 0.5 ? l * (1 + s) : l + s - l * s; + const p = 2 * l - q; + + // Get the rgb values + const r = 255 * hueToRgb(p, q, h + 1 / 3); + const g = 255 * hueToRgb(p, q, h); + const b = 255 * hueToRgb(p, q, h - 1 / 3); + + // Make a new color + const color = new Color(r, g, b); + return color; + } else if (this.space === 'cmyk') { + // https://gist.github.com/felipesabino/5066336 + // Get the normalised cmyk values + const { + c, + m, + y, + k + } = this; + + // Get the rgb values + const r = 255 * (1 - Math.min(1, c * (1 - k) + k)); + const g = 255 * (1 - Math.min(1, m * (1 - k) + k)); + const b = 255 * (1 - Math.min(1, y * (1 - k) + k)); + + // Form the color and return it + const color = new Color(r, g, b); + return color; + } else { + return this; + } + } + toArray() { + const { + _a, + _b, + _c, + _d, + space + } = this; + return [_a, _b, _c, _d, space]; + } + toHex() { + const [r, g, b] = this._clamped().map(componentHex); + return `#${r}${g}${b}`; + } + toRgb() { + const [rV, gV, bV] = this._clamped(); + const string = `rgb(${rV},${gV},${bV})`; + return string; + } + toString() { + return this.toHex(); + } + xyz() { + // Normalise the red, green and blue values + const { + _a: r255, + _b: g255, + _c: b255 + } = this.rgb(); + const [r, g, b] = [r255, g255, b255].map(v => v / 255); + + // Convert to the lab rgb space + const rL = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92; + const gL = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92; + const bL = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92; + + // Convert to the xyz color space without bounding the values + const xU = (rL * 0.4124 + gL * 0.3576 + bL * 0.1805) / 0.95047; + const yU = (rL * 0.2126 + gL * 0.7152 + bL * 0.0722) / 1.0; + const zU = (rL * 0.0193 + gL * 0.1192 + bL * 0.9505) / 1.08883; + + // Get the proper xyz values by applying the bounding + const x = xU > 0.008856 ? Math.pow(xU, 1 / 3) : 7.787 * xU + 16 / 116; + const y = yU > 0.008856 ? Math.pow(yU, 1 / 3) : 7.787 * yU + 16 / 116; + const z = zU > 0.008856 ? Math.pow(zU, 1 / 3) : 7.787 * zU + 16 / 116; + + // Make and return the color + const color = new Color(x, y, z, 'xyz'); + return color; + } + + /* + Input and Output methods + */ + + _clamped() { + const { + _a, + _b, + _c + } = this.rgb(); + const { + max, + min, + round + } = Math; + const format = v => max(0, min(round(v), 255)); + return [_a, _b, _c].map(format); + } + + /* + Constructing colors + */ + } + + class Point { + // Initialize + constructor(...args) { + this.init(...args); + } + + // Clone point + clone() { + return new Point(this); + } + init(x, y) { + const base = { + x: 0, + y: 0 + }; + + // ensure source as object + const source = Array.isArray(x) ? { + x: x[0], + y: x[1] + } : typeof x === 'object' ? { + x: x.x, + y: x.y + } : { + x: x, + y: y + }; + + // merge source + this.x = source.x == null ? base.x : source.x; + this.y = source.y == null ? base.y : source.y; + return this; + } + toArray() { + return [this.x, this.y]; + } + transform(m) { + return this.clone().transformO(m); + } + + // Transform point with matrix + transformO(m) { + if (!Matrix.isMatrixLike(m)) { + m = new Matrix(m); + } + const { + x, + y + } = this; + + // Perform the matrix multiplication + this.x = m.a * x + m.c * y + m.e; + this.y = m.b * x + m.d * y + m.f; + return this; + } + } + function point(x, y) { + return new Point(x, y).transformO(this.screenCTM().inverseO()); + } + + function closeEnough(a, b, threshold) { + return Math.abs(b - a) < (1e-6); + } + class Matrix { + constructor(...args) { + this.init(...args); + } + static formatTransforms(o) { + // Get all of the parameters required to form the matrix + const flipBoth = o.flip === 'both' || o.flip === true; + const flipX = o.flip && (flipBoth || o.flip === 'x') ? -1 : 1; + const flipY = o.flip && (flipBoth || o.flip === 'y') ? -1 : 1; + const skewX = o.skew && o.skew.length ? o.skew[0] : isFinite(o.skew) ? o.skew : isFinite(o.skewX) ? o.skewX : 0; + const skewY = o.skew && o.skew.length ? o.skew[1] : isFinite(o.skew) ? o.skew : isFinite(o.skewY) ? o.skewY : 0; + const scaleX = o.scale && o.scale.length ? o.scale[0] * flipX : isFinite(o.scale) ? o.scale * flipX : isFinite(o.scaleX) ? o.scaleX * flipX : flipX; + const scaleY = o.scale && o.scale.length ? o.scale[1] * flipY : isFinite(o.scale) ? o.scale * flipY : isFinite(o.scaleY) ? o.scaleY * flipY : flipY; + const shear = o.shear || 0; + const theta = o.rotate || o.theta || 0; + const origin = new Point(o.origin || o.around || o.ox || o.originX, o.oy || o.originY); + const ox = origin.x; + const oy = origin.y; + // We need Point to be invalid if nothing was passed because we cannot default to 0 here. That is why NaN + const position = new Point(o.position || o.px || o.positionX || NaN, o.py || o.positionY || NaN); + const px = position.x; + const py = position.y; + const translate = new Point(o.translate || o.tx || o.translateX, o.ty || o.translateY); + const tx = translate.x; + const ty = translate.y; + const relative = new Point(o.relative || o.rx || o.relativeX, o.ry || o.relativeY); + const rx = relative.x; + const ry = relative.y; + + // Populate all of the values + return { + scaleX, + scaleY, + skewX, + skewY, + shear, + theta, + rx, + ry, + tx, + ty, + ox, + oy, + px, + py + }; + } + static fromArray(a) { + return { + a: a[0], + b: a[1], + c: a[2], + d: a[3], + e: a[4], + f: a[5] + }; + } + static isMatrixLike(o) { + return o.a != null || o.b != null || o.c != null || o.d != null || o.e != null || o.f != null; + } + + // left matrix, right matrix, target matrix which is overwritten + static matrixMultiply(l, r, o) { + // Work out the product directly + const a = l.a * r.a + l.c * r.b; + const b = l.b * r.a + l.d * r.b; + const c = l.a * r.c + l.c * r.d; + const d = l.b * r.c + l.d * r.d; + const e = l.e + l.a * r.e + l.c * r.f; + const f = l.f + l.b * r.e + l.d * r.f; + + // make sure to use local variables because l/r and o could be the same + o.a = a; + o.b = b; + o.c = c; + o.d = d; + o.e = e; + o.f = f; + return o; + } + around(cx, cy, matrix) { + return this.clone().aroundO(cx, cy, matrix); + } + + // Transform around a center point + aroundO(cx, cy, matrix) { + const dx = cx || 0; + const dy = cy || 0; + return this.translateO(-dx, -dy).lmultiplyO(matrix).translateO(dx, dy); + } + + // Clones this matrix + clone() { + return new Matrix(this); + } + + // Decomposes this matrix into its affine parameters + decompose(cx = 0, cy = 0) { + // Get the parameters from the matrix + const a = this.a; + const b = this.b; + const c = this.c; + const d = this.d; + const e = this.e; + const f = this.f; + + // Figure out if the winding direction is clockwise or counterclockwise + const determinant = a * d - b * c; + const ccw = determinant > 0 ? 1 : -1; + + // Since we only shear in x, we can use the x basis to get the x scale + // and the rotation of the resulting matrix + const sx = ccw * Math.sqrt(a * a + b * b); + const thetaRad = Math.atan2(ccw * b, ccw * a); + const theta = 180 / Math.PI * thetaRad; + const ct = Math.cos(thetaRad); + const st = Math.sin(thetaRad); + + // We can then solve the y basis vector simultaneously to get the other + // two affine parameters directly from these parameters + const lam = (a * c + b * d) / determinant; + const sy = c * sx / (lam * a - b) || d * sx / (lam * b + a); + + // Use the translations + const tx = e - cx + cx * ct * sx + cy * (lam * ct * sx - st * sy); + const ty = f - cy + cx * st * sx + cy * (lam * st * sx + ct * sy); + + // Construct the decomposition and return it + return { + // Return the affine parameters + scaleX: sx, + scaleY: sy, + shear: lam, + rotate: theta, + translateX: tx, + translateY: ty, + originX: cx, + originY: cy, + // Return the matrix parameters + a: this.a, + b: this.b, + c: this.c, + d: this.d, + e: this.e, + f: this.f + }; + } + + // Check if two matrices are equal + equals(other) { + if (other === this) return true; + const comp = new Matrix(other); + return closeEnough(this.a, comp.a) && closeEnough(this.b, comp.b) && closeEnough(this.c, comp.c) && closeEnough(this.d, comp.d) && closeEnough(this.e, comp.e) && closeEnough(this.f, comp.f); + } + + // Flip matrix on x or y, at a given offset + flip(axis, around) { + return this.clone().flipO(axis, around); + } + flipO(axis, around) { + return axis === 'x' ? this.scaleO(-1, 1, around, 0) : axis === 'y' ? this.scaleO(1, -1, 0, around) : this.scaleO(-1, -1, axis, around || axis); // Define an x, y flip point + } + + // Initialize + init(source) { + const base = Matrix.fromArray([1, 0, 0, 1, 0, 0]); + + // ensure source as object + source = source instanceof Element ? source.matrixify() : typeof source === 'string' ? Matrix.fromArray(source.split(delimiter).map(parseFloat)) : Array.isArray(source) ? Matrix.fromArray(source) : typeof source === 'object' && Matrix.isMatrixLike(source) ? source : typeof source === 'object' ? new Matrix().transform(source) : arguments.length === 6 ? Matrix.fromArray([].slice.call(arguments)) : base; + + // Merge the source matrix with the base matrix + this.a = source.a != null ? source.a : base.a; + this.b = source.b != null ? source.b : base.b; + this.c = source.c != null ? source.c : base.c; + this.d = source.d != null ? source.d : base.d; + this.e = source.e != null ? source.e : base.e; + this.f = source.f != null ? source.f : base.f; + return this; + } + inverse() { + return this.clone().inverseO(); + } + + // Inverses matrix + inverseO() { + // Get the current parameters out of the matrix + const a = this.a; + const b = this.b; + const c = this.c; + const d = this.d; + const e = this.e; + const f = this.f; + + // Invert the 2x2 matrix in the top left + const det = a * d - b * c; + if (!det) throw new Error('Cannot invert ' + this); + + // Calculate the top 2x2 matrix + const na = d / det; + const nb = -b / det; + const nc = -c / det; + const nd = a / det; + + // Apply the inverted matrix to the top right + const ne = -(na * e + nc * f); + const nf = -(nb * e + nd * f); + + // Construct the inverted matrix + this.a = na; + this.b = nb; + this.c = nc; + this.d = nd; + this.e = ne; + this.f = nf; + return this; + } + lmultiply(matrix) { + return this.clone().lmultiplyO(matrix); + } + lmultiplyO(matrix) { + const r = this; + const l = matrix instanceof Matrix ? matrix : new Matrix(matrix); + return Matrix.matrixMultiply(l, r, this); + } + + // Left multiplies by the given matrix + multiply(matrix) { + return this.clone().multiplyO(matrix); + } + multiplyO(matrix) { + // Get the matrices + const l = this; + const r = matrix instanceof Matrix ? matrix : new Matrix(matrix); + return Matrix.matrixMultiply(l, r, this); + } + + // Rotate matrix + rotate(r, cx, cy) { + return this.clone().rotateO(r, cx, cy); + } + rotateO(r, cx = 0, cy = 0) { + // Convert degrees to radians + r = radians(r); + const cos = Math.cos(r); + const sin = Math.sin(r); + const { + a, + b, + c, + d, + e, + f + } = this; + this.a = a * cos - b * sin; + this.b = b * cos + a * sin; + this.c = c * cos - d * sin; + this.d = d * cos + c * sin; + this.e = e * cos - f * sin + cy * sin - cx * cos + cx; + this.f = f * cos + e * sin - cx * sin - cy * cos + cy; + return this; + } + + // Scale matrix + scale() { + return this.clone().scaleO(...arguments); + } + scaleO(x, y = x, cx = 0, cy = 0) { + // Support uniform scaling + if (arguments.length === 3) { + cy = cx; + cx = y; + y = x; + } + const { + a, + b, + c, + d, + e, + f + } = this; + this.a = a * x; + this.b = b * y; + this.c = c * x; + this.d = d * y; + this.e = e * x - cx * x + cx; + this.f = f * y - cy * y + cy; + return this; + } + + // Shear matrix + shear(a, cx, cy) { + return this.clone().shearO(a, cx, cy); + } + + // eslint-disable-next-line no-unused-vars + shearO(lx, cx = 0, cy = 0) { + const { + a, + b, + c, + d, + e, + f + } = this; + this.a = a + b * lx; + this.c = c + d * lx; + this.e = e + f * lx - cy * lx; + return this; + } + + // Skew Matrix + skew() { + return this.clone().skewO(...arguments); + } + skewO(x, y = x, cx = 0, cy = 0) { + // support uniformal skew + if (arguments.length === 3) { + cy = cx; + cx = y; + y = x; + } + + // Convert degrees to radians + x = radians(x); + y = radians(y); + const lx = Math.tan(x); + const ly = Math.tan(y); + const { + a, + b, + c, + d, + e, + f + } = this; + this.a = a + b * lx; + this.b = b + a * ly; + this.c = c + d * lx; + this.d = d + c * ly; + this.e = e + f * lx - cy * lx; + this.f = f + e * ly - cx * ly; + return this; + } + + // SkewX + skewX(x, cx, cy) { + return this.skew(x, 0, cx, cy); + } + + // SkewY + skewY(y, cx, cy) { + return this.skew(0, y, cx, cy); + } + toArray() { + return [this.a, this.b, this.c, this.d, this.e, this.f]; + } + + // Convert matrix to string + toString() { + return 'matrix(' + this.a + ',' + this.b + ',' + this.c + ',' + this.d + ',' + this.e + ',' + this.f + ')'; + } + + // Transform a matrix into another matrix by manipulating the space + transform(o) { + // Check if o is a matrix and then left multiply it directly + if (Matrix.isMatrixLike(o)) { + const matrix = new Matrix(o); + return matrix.multiplyO(this); + } + + // Get the proposed transformations and the current transformations + const t = Matrix.formatTransforms(o); + const current = this; + const { + x: ox, + y: oy + } = new Point(t.ox, t.oy).transform(current); + + // Construct the resulting matrix + const transformer = new Matrix().translateO(t.rx, t.ry).lmultiplyO(current).translateO(-ox, -oy).scaleO(t.scaleX, t.scaleY).skewO(t.skewX, t.skewY).shearO(t.shear).rotateO(t.theta).translateO(ox, oy); + + // If we want the origin at a particular place, we force it there + if (isFinite(t.px) || isFinite(t.py)) { + const origin = new Point(ox, oy).transform(transformer); + // TODO: Replace t.px with isFinite(t.px) + // Doesn't work because t.px is also 0 if it wasn't passed + const dx = isFinite(t.px) ? t.px - origin.x : 0; + const dy = isFinite(t.py) ? t.py - origin.y : 0; + transformer.translateO(dx, dy); + } + + // Translate now after positioning + transformer.translateO(t.tx, t.ty); + return transformer; + } + + // Translate matrix + translate(x, y) { + return this.clone().translateO(x, y); + } + translateO(x, y) { + this.e += x || 0; + this.f += y || 0; + return this; + } + valueOf() { + return { + a: this.a, + b: this.b, + c: this.c, + d: this.d, + e: this.e, + f: this.f + }; + } + } + function ctm() { + return new Matrix(this.node.getCTM()); + } + function screenCTM() { + try { + /* https://bugzilla.mozilla.org/show_bug.cgi?id=1344537 + This is needed because FF does not return the transformation matrix + for the inner coordinate system when getScreenCTM() is called on nested svgs. + However all other Browsers do that */ + if (typeof this.isRoot === 'function' && !this.isRoot()) { + const rect = this.rect(1, 1); + const m = rect.node.getScreenCTM(); + rect.remove(); + return new Matrix(m); + } + return new Matrix(this.node.getScreenCTM()); + } catch (e) { + console.warn(`Cannot get CTM from SVG node ${this.node.nodeName}. Is the element rendered?`); + return new Matrix(); + } + } + register(Matrix, 'Matrix'); + + function parser() { + // Reuse cached element if possible + if (!parser.nodes) { + const svg = makeInstance().size(2, 0); + svg.node.style.cssText = ['opacity: 0', 'position: absolute', 'left: -100%', 'top: -100%', 'overflow: hidden'].join(';'); + svg.attr('focusable', 'false'); + svg.attr('aria-hidden', 'true'); + const path = svg.path().node; + parser.nodes = { + svg, + path + }; + } + if (!parser.nodes.svg.node.parentNode) { + const b = globals.document.body || globals.document.documentElement; + parser.nodes.svg.addTo(b); + } + return parser.nodes; + } + + function isNulledBox(box) { + return !box.width && !box.height && !box.x && !box.y; + } + function domContains(node) { + return node === globals.document || (globals.document.documentElement.contains || function (node) { + // This is IE - it does not support contains() for top-level SVGs + while (node.parentNode) { + node = node.parentNode; + } + return node === globals.document; + }).call(globals.document.documentElement, node); + } + class Box { + constructor(...args) { + this.init(...args); + } + addOffset() { + // offset by window scroll position, because getBoundingClientRect changes when window is scrolled + this.x += globals.window.pageXOffset; + this.y += globals.window.pageYOffset; + return new Box(this); + } + init(source) { + const base = [0, 0, 0, 0]; + source = typeof source === 'string' ? source.split(delimiter).map(parseFloat) : Array.isArray(source) ? source : typeof source === 'object' ? [source.left != null ? source.left : source.x, source.top != null ? source.top : source.y, source.width, source.height] : arguments.length === 4 ? [].slice.call(arguments) : base; + this.x = source[0] || 0; + this.y = source[1] || 0; + this.width = this.w = source[2] || 0; + this.height = this.h = source[3] || 0; + + // Add more bounding box properties + this.x2 = this.x + this.w; + this.y2 = this.y + this.h; + this.cx = this.x + this.w / 2; + this.cy = this.y + this.h / 2; + return this; + } + isNulled() { + return isNulledBox(this); + } + + // Merge rect box with another, return a new instance + merge(box) { + const x = Math.min(this.x, box.x); + const y = Math.min(this.y, box.y); + const width = Math.max(this.x + this.width, box.x + box.width) - x; + const height = Math.max(this.y + this.height, box.y + box.height) - y; + return new Box(x, y, width, height); + } + toArray() { + return [this.x, this.y, this.width, this.height]; + } + toString() { + return this.x + ' ' + this.y + ' ' + this.width + ' ' + this.height; + } + transform(m) { + if (!(m instanceof Matrix)) { + m = new Matrix(m); + } + let xMin = Infinity; + let xMax = -Infinity; + let yMin = Infinity; + let yMax = -Infinity; + const pts = [new Point(this.x, this.y), new Point(this.x2, this.y), new Point(this.x, this.y2), new Point(this.x2, this.y2)]; + pts.forEach(function (p) { + p = p.transform(m); + xMin = Math.min(xMin, p.x); + xMax = Math.max(xMax, p.x); + yMin = Math.min(yMin, p.y); + yMax = Math.max(yMax, p.y); + }); + return new Box(xMin, yMin, xMax - xMin, yMax - yMin); + } + } + function getBox(el, getBBoxFn, retry) { + let box; + try { + // Try to get the box with the provided function + box = getBBoxFn(el.node); + + // If the box is worthless and not even in the dom, retry + // by throwing an error here... + if (isNulledBox(box) && !domContains(el.node)) { + throw new Error('Element not in the dom'); + } + } catch (e) { + // ... and calling the retry handler here + box = retry(el); + } + return box; + } + function bbox() { + // Function to get bbox is getBBox() + const getBBox = node => node.getBBox(); + + // Take all measures so that a stupid browser renders the element + // so we can get the bbox from it when we try again + const retry = el => { + try { + const clone = el.clone().addTo(parser().svg).show(); + const box = clone.node.getBBox(); + clone.remove(); + return box; + } catch (e) { + // We give up... + throw new Error(`Getting bbox of element "${el.node.nodeName}" is not possible: ${e.toString()}`); + } + }; + const box = getBox(this, getBBox, retry); + const bbox = new Box(box); + return bbox; + } + function rbox(el) { + const getRBox = node => node.getBoundingClientRect(); + const retry = el => { + // There is no point in trying tricks here because if we insert the element into the dom ourselves + // it obviously will be at the wrong position + throw new Error(`Getting rbox of element "${el.node.nodeName}" is not possible`); + }; + const box = getBox(this, getRBox, retry); + const rbox = new Box(box); + + // If an element was passed, we want the bbox in the coordinate system of that element + if (el) { + return rbox.transform(el.screenCTM().inverseO()); + } + + // Else we want it in absolute screen coordinates + // Therefore we need to add the scrollOffset + return rbox.addOffset(); + } + + // Checks whether the given point is inside the bounding box + function inside(x, y) { + const box = this.bbox(); + return x > box.x && y > box.y && x < box.x + box.width && y < box.y + box.height; + } + registerMethods({ + viewbox: { + viewbox(x, y, width, height) { + // act as getter + if (x == null) return new Box(this.attr('viewBox')); + + // act as setter + return this.attr('viewBox', new Box(x, y, width, height)); + }, + zoom(level, point) { + // Its best to rely on the attributes here and here is why: + // clientXYZ: Doesn't work on non-root svgs because they dont have a CSSBox (silly!) + // getBoundingClientRect: Doesn't work because Chrome just ignores width and height of nested svgs completely + // that means, their clientRect is always as big as the content. + // Furthermore this size is incorrect if the element is further transformed by its parents + // computedStyle: Only returns meaningful values if css was used with px. We dont go this route here! + // getBBox: returns the bounding box of its content - that doesn't help! + let { + width, + height + } = this.attr(['width', 'height']); + + // Width and height is a string when a number with a unit is present which we can't use + // So we try clientXYZ + if (!width && !height || typeof width === 'string' || typeof height === 'string') { + width = this.node.clientWidth; + height = this.node.clientHeight; + } + + // Giving up... + if (!width || !height) { + throw new Error('Impossible to get absolute width and height. Please provide an absolute width and height attribute on the zooming element'); + } + const v = this.viewbox(); + const zoomX = width / v.width; + const zoomY = height / v.height; + const zoom = Math.min(zoomX, zoomY); + if (level == null) { + return zoom; + } + let zoomAmount = zoom / level; + + // Set the zoomAmount to the highest value which is safe to process and recover from + // The * 100 is a bit of wiggle room for the matrix transformation + if (zoomAmount === Infinity) zoomAmount = Number.MAX_SAFE_INTEGER / 100; + point = point || new Point(width / 2 / zoomX + v.x, height / 2 / zoomY + v.y); + const box = new Box(v).transform(new Matrix({ + scale: zoomAmount, + origin: point + })); + return this.viewbox(box); + } + } + }); + register(Box, 'Box'); + + // import { subClassArray } from './ArrayPolyfill.js' + + class List extends Array { + constructor(arr = [], ...args) { + super(arr, ...args); + if (typeof arr === 'number') return this; + this.length = 0; + this.push(...arr); + } + } + extend([List], { + each(fnOrMethodName, ...args) { + if (typeof fnOrMethodName === 'function') { + return this.map((el, i, arr) => { + return fnOrMethodName.call(el, el, i, arr); + }); + } else { + return this.map(el => { + return el[fnOrMethodName](...args); + }); + } + }, + toArray() { + return Array.prototype.concat.apply([], this); + } + }); + const reserved = ['toArray', 'constructor', 'each']; + List.extend = function (methods) { + methods = methods.reduce((obj, name) => { + // Don't overwrite own methods + if (reserved.includes(name)) return obj; + + // Don't add private methods + if (name[0] === '_') return obj; + + // Allow access to original Array methods through a prefix + if (name in Array.prototype) { + obj['$' + name] = Array.prototype[name]; + } + + // Relay every call to each() + obj[name] = function (...attrs) { + return this.each(name, ...attrs); + }; + return obj; + }, {}); + extend([List], methods); + }; + + function baseFind(query, parent) { + return new List(map((parent || globals.document).querySelectorAll(query), function (node) { + return adopt(node); + })); + } + + // Scoped find method + function find(query) { + return baseFind(query, this.node); + } + function findOne(query) { + return adopt(this.node.querySelector(query)); + } + + let listenerId = 0; + const windowEvents = {}; + function getEvents(instance) { + let n = instance.getEventHolder(); + + // We dont want to save events in global space + if (n === globals.window) n = windowEvents; + if (!n.events) n.events = {}; + return n.events; + } + function getEventTarget(instance) { + return instance.getEventTarget(); + } + function clearEvents(instance) { + let n = instance.getEventHolder(); + if (n === globals.window) n = windowEvents; + if (n.events) n.events = {}; + } + + // Add event binder in the SVG namespace + function on(node, events, listener, binding, options) { + const l = listener.bind(binding || node); + const instance = makeInstance(node); + const bag = getEvents(instance); + const n = getEventTarget(instance); + + // events can be an array of events or a string of events + events = Array.isArray(events) ? events : events.split(delimiter); + + // add id to listener + if (!listener._svgjsListenerId) { + listener._svgjsListenerId = ++listenerId; + } + events.forEach(function (event) { + const ev = event.split('.')[0]; + const ns = event.split('.')[1] || '*'; + + // ensure valid object + bag[ev] = bag[ev] || {}; + bag[ev][ns] = bag[ev][ns] || {}; + + // reference listener + bag[ev][ns][listener._svgjsListenerId] = l; + + // add listener + n.addEventListener(ev, l, options || false); + }); + } + + // Add event unbinder in the SVG namespace + function off(node, events, listener, options) { + const instance = makeInstance(node); + const bag = getEvents(instance); + const n = getEventTarget(instance); + + // listener can be a function or a number + if (typeof listener === 'function') { + listener = listener._svgjsListenerId; + if (!listener) return; + } + + // events can be an array of events or a string or undefined + events = Array.isArray(events) ? events : (events || '').split(delimiter); + events.forEach(function (event) { + const ev = event && event.split('.')[0]; + const ns = event && event.split('.')[1]; + let namespace, l; + if (listener) { + // remove listener reference + if (bag[ev] && bag[ev][ns || '*']) { + // removeListener + n.removeEventListener(ev, bag[ev][ns || '*'][listener], options || false); + delete bag[ev][ns || '*'][listener]; + } + } else if (ev && ns) { + // remove all listeners for a namespaced event + if (bag[ev] && bag[ev][ns]) { + for (l in bag[ev][ns]) { + off(n, [ev, ns].join('.'), l); + } + delete bag[ev][ns]; + } + } else if (ns) { + // remove all listeners for a specific namespace + for (event in bag) { + for (namespace in bag[event]) { + if (ns === namespace) { + off(n, [event, ns].join('.')); + } + } + } + } else if (ev) { + // remove all listeners for the event + if (bag[ev]) { + for (namespace in bag[ev]) { + off(n, [ev, namespace].join('.')); + } + delete bag[ev]; + } + } else { + // remove all listeners on a given node + for (event in bag) { + off(n, event); + } + clearEvents(instance); + } + }); + } + function dispatch(node, event, data, options) { + const n = getEventTarget(node); + + // Dispatch event + if (event instanceof globals.window.Event) { + n.dispatchEvent(event); + } else { + event = new globals.window.CustomEvent(event, { + detail: data, + cancelable: true, + ...options + }); + n.dispatchEvent(event); + } + return event; + } + + class EventTarget extends Base { + addEventListener() {} + dispatch(event, data, options) { + return dispatch(this, event, data, options); + } + dispatchEvent(event) { + const bag = this.getEventHolder().events; + if (!bag) return true; + const events = bag[event.type]; + for (const i in events) { + for (const j in events[i]) { + events[i][j](event); + } + } + return !event.defaultPrevented; + } + + // Fire given event + fire(event, data, options) { + this.dispatch(event, data, options); + return this; + } + getEventHolder() { + return this; + } + getEventTarget() { + return this; + } + + // Unbind event from listener + off(event, listener, options) { + off(this, event, listener, options); + return this; + } + + // Bind given event to listener + on(event, listener, binding, options) { + on(this, event, listener, binding, options); + return this; + } + removeEventListener() {} + } + register(EventTarget, 'EventTarget'); + + function noop() {} + + // Default animation values + const timeline = { + duration: 400, + ease: '>', + delay: 0 + }; + + // Default attribute values + const attrs = { + // fill and stroke + 'fill-opacity': 1, + 'stroke-opacity': 1, + 'stroke-width': 0, + 'stroke-linejoin': 'miter', + 'stroke-linecap': 'butt', + fill: '#000000', + stroke: '#000000', + opacity: 1, + // position + x: 0, + y: 0, + cx: 0, + cy: 0, + // size + width: 0, + height: 0, + // radius + r: 0, + rx: 0, + ry: 0, + // gradient + offset: 0, + 'stop-opacity': 1, + 'stop-color': '#000000', + // text + 'text-anchor': 'start' + }; + + var defaults = { + __proto__: null, + attrs: attrs, + noop: noop, + timeline: timeline + }; + + class SVGArray extends Array { + constructor(...args) { + super(...args); + this.init(...args); + } + clone() { + return new this.constructor(this); + } + init(arr) { + // This catches the case, that native map tries to create an array with new Array(1) + if (typeof arr === 'number') return this; + this.length = 0; + this.push(...this.parse(arr)); + return this; + } + + // Parse whitespace separated string + parse(array = []) { + // If already is an array, no need to parse it + if (array instanceof Array) return array; + return array.trim().split(delimiter).map(parseFloat); + } + toArray() { + return Array.prototype.concat.apply([], this); + } + toSet() { + return new Set(this); + } + toString() { + return this.join(' '); + } + + // Flattens the array if needed + valueOf() { + const ret = []; + ret.push(...this); + return ret; + } + } + + // Module for unit conversions + class SVGNumber { + // Initialize + constructor(...args) { + this.init(...args); + } + convert(unit) { + return new SVGNumber(this.value, unit); + } + + // Divide number + divide(number) { + number = new SVGNumber(number); + return new SVGNumber(this / number, this.unit || number.unit); + } + init(value, unit) { + unit = Array.isArray(value) ? value[1] : unit; + value = Array.isArray(value) ? value[0] : value; + + // initialize defaults + this.value = 0; + this.unit = unit || ''; + + // parse value + if (typeof value === 'number') { + // ensure a valid numeric value + this.value = isNaN(value) ? 0 : !isFinite(value) ? value < 0 ? -3.4e38 : +3.4e38 : value; + } else if (typeof value === 'string') { + unit = value.match(numberAndUnit); + if (unit) { + // make value numeric + this.value = parseFloat(unit[1]); + + // normalize + if (unit[5] === '%') { + this.value /= 100; + } else if (unit[5] === 's') { + this.value *= 1000; + } + + // store unit + this.unit = unit[5]; + } + } else { + if (value instanceof SVGNumber) { + this.value = value.valueOf(); + this.unit = value.unit; + } + } + return this; + } + + // Subtract number + minus(number) { + number = new SVGNumber(number); + return new SVGNumber(this - number, this.unit || number.unit); + } + + // Add number + plus(number) { + number = new SVGNumber(number); + return new SVGNumber(this + number, this.unit || number.unit); + } + + // Multiply number + times(number) { + number = new SVGNumber(number); + return new SVGNumber(this * number, this.unit || number.unit); + } + toArray() { + return [this.value, this.unit]; + } + toJSON() { + return this.toString(); + } + toString() { + return (this.unit === '%' ? ~~(this.value * 1e8) / 1e6 : this.unit === 's' ? this.value / 1e3 : this.value) + this.unit; + } + valueOf() { + return this.value; + } + } + + const colorAttributes = new Set(['fill', 'stroke', 'color', 'bgcolor', 'stop-color', 'flood-color', 'lighting-color']); + const hooks = []; + function registerAttrHook(fn) { + hooks.push(fn); + } + + // Set svg element attribute + function attr(attr, val, ns) { + // act as full getter + if (attr == null) { + // get an object of attributes + attr = {}; + val = this.node.attributes; + for (const node of val) { + attr[node.nodeName] = isNumber.test(node.nodeValue) ? parseFloat(node.nodeValue) : node.nodeValue; + } + return attr; + } else if (attr instanceof Array) { + // loop through array and get all values + return attr.reduce((last, curr) => { + last[curr] = this.attr(curr); + return last; + }, {}); + } else if (typeof attr === 'object' && attr.constructor === Object) { + // apply every attribute individually if an object is passed + for (val in attr) this.attr(val, attr[val]); + } else if (val === null) { + // remove value + this.node.removeAttribute(attr); + } else if (val == null) { + // act as a getter if the first and only argument is not an object + val = this.node.getAttribute(attr); + return val == null ? attrs[attr] : isNumber.test(val) ? parseFloat(val) : val; + } else { + // Loop through hooks and execute them to convert value + val = hooks.reduce((_val, hook) => { + return hook(attr, _val, this); + }, val); + + // ensure correct numeric values (also accepts NaN and Infinity) + if (typeof val === 'number') { + val = new SVGNumber(val); + } else if (colorAttributes.has(attr) && Color.isColor(val)) { + // ensure full hex color + val = new Color(val); + } else if (val.constructor === Array) { + // Check for plain arrays and parse array values + val = new SVGArray(val); + } + + // if the passed attribute is leading... + if (attr === 'leading') { + // ... call the leading method instead + if (this.leading) { + this.leading(val); + } + } else { + // set given attribute on node + typeof ns === 'string' ? this.node.setAttributeNS(ns, attr, val.toString()) : this.node.setAttribute(attr, val.toString()); + } + + // rebuild if required + if (this.rebuild && (attr === 'font-size' || attr === 'x')) { + this.rebuild(); + } + } + return this; + } + + class Dom extends EventTarget { + constructor(node, attrs) { + super(); + this.node = node; + this.type = node.nodeName; + if (attrs && node !== attrs) { + this.attr(attrs); + } + } + + // Add given element at a position + add(element, i) { + element = makeInstance(element); + + // If non-root svg nodes are added we have to remove their namespaces + if (element.removeNamespace && this.node instanceof globals.window.SVGElement) { + element.removeNamespace(); + } + if (i == null) { + this.node.appendChild(element.node); + } else if (element.node !== this.node.childNodes[i]) { + this.node.insertBefore(element.node, this.node.childNodes[i]); + } + return this; + } + + // Add element to given container and return self + addTo(parent, i) { + return makeInstance(parent).put(this, i); + } + + // Returns all child elements + children() { + return new List(map(this.node.children, function (node) { + return adopt(node); + })); + } + + // Remove all elements in this container + clear() { + // remove children + while (this.node.hasChildNodes()) { + this.node.removeChild(this.node.lastChild); + } + return this; + } + + // Clone element + clone(deep = true, assignNewIds = true) { + // write dom data to the dom so the clone can pickup the data + this.writeDataToDom(); + + // clone element + let nodeClone = this.node.cloneNode(deep); + if (assignNewIds) { + // assign new id + nodeClone = assignNewId(nodeClone); + } + return new this.constructor(nodeClone); + } + + // Iterates over all children and invokes a given block + each(block, deep) { + const children = this.children(); + let i, il; + for (i = 0, il = children.length; i < il; i++) { + block.apply(children[i], [i, children]); + if (deep) { + children[i].each(block, deep); + } + } + return this; + } + element(nodeName, attrs) { + return this.put(new Dom(create(nodeName), attrs)); + } + + // Get first child + first() { + return adopt(this.node.firstChild); + } + + // Get a element at the given index + get(i) { + return adopt(this.node.childNodes[i]); + } + getEventHolder() { + return this.node; + } + getEventTarget() { + return this.node; + } + + // Checks if the given element is a child + has(element) { + return this.index(element) >= 0; + } + html(htmlOrFn, outerHTML) { + return this.xml(htmlOrFn, outerHTML, html); + } + + // Get / set id + id(id) { + // generate new id if no id set + if (typeof id === 'undefined' && !this.node.id) { + this.node.id = eid(this.type); + } + + // don't set directly with this.node.id to make `null` work correctly + return this.attr('id', id); + } + + // Gets index of given element + index(element) { + return [].slice.call(this.node.childNodes).indexOf(element.node); + } + + // Get the last child + last() { + return adopt(this.node.lastChild); + } + + // matches the element vs a css selector + matches(selector) { + const el = this.node; + const matcher = el.matches || el.matchesSelector || el.msMatchesSelector || el.mozMatchesSelector || el.webkitMatchesSelector || el.oMatchesSelector || null; + return matcher && matcher.call(el, selector); + } + + // Returns the parent element instance + parent(type) { + let parent = this; + + // check for parent + if (!parent.node.parentNode) return null; + + // get parent element + parent = adopt(parent.node.parentNode); + if (!type) return parent; + + // loop through ancestors if type is given + do { + if (typeof type === 'string' ? parent.matches(type) : parent instanceof type) return parent; + } while (parent = adopt(parent.node.parentNode)); + return parent; + } + + // Basically does the same as `add()` but returns the added element instead + put(element, i) { + element = makeInstance(element); + this.add(element, i); + return element; + } + + // Add element to given container and return container + putIn(parent, i) { + return makeInstance(parent).add(this, i); + } + + // Remove element + remove() { + if (this.parent()) { + this.parent().removeElement(this); + } + return this; + } + + // Remove a given child + removeElement(element) { + this.node.removeChild(element.node); + return this; + } + + // Replace this with element + replace(element) { + element = makeInstance(element); + if (this.node.parentNode) { + this.node.parentNode.replaceChild(element.node, this.node); + } + return element; + } + round(precision = 2, map = null) { + const factor = 10 ** precision; + const attrs = this.attr(map); + for (const i in attrs) { + if (typeof attrs[i] === 'number') { + attrs[i] = Math.round(attrs[i] * factor) / factor; + } + } + this.attr(attrs); + return this; + } + + // Import / Export raw svg + svg(svgOrFn, outerSVG) { + return this.xml(svgOrFn, outerSVG, svg); + } + + // Return id on string conversion + toString() { + return this.id(); + } + words(text) { + // This is faster than removing all children and adding a new one + this.node.textContent = text; + return this; + } + wrap(node) { + const parent = this.parent(); + if (!parent) { + return this.addTo(node); + } + const position = parent.index(this); + return parent.put(node, position).put(this); + } + + // write svgjs data to the dom + writeDataToDom() { + // dump variables recursively + this.each(function () { + this.writeDataToDom(); + }); + return this; + } + + // Import / Export raw svg + xml(xmlOrFn, outerXML, ns) { + if (typeof xmlOrFn === 'boolean') { + ns = outerXML; + outerXML = xmlOrFn; + xmlOrFn = null; + } + + // act as getter if no svg string is given + if (xmlOrFn == null || typeof xmlOrFn === 'function') { + // The default for exports is, that the outerNode is included + outerXML = outerXML == null ? true : outerXML; + + // write svgjs data to the dom + this.writeDataToDom(); + let current = this; + + // An export modifier was passed + if (xmlOrFn != null) { + current = adopt(current.node.cloneNode(true)); + + // If the user wants outerHTML we need to process this node, too + if (outerXML) { + const result = xmlOrFn(current); + current = result || current; + + // The user does not want this node? Well, then he gets nothing + if (result === false) return ''; + } + + // Deep loop through all children and apply modifier + current.each(function () { + const result = xmlOrFn(this); + const _this = result || this; + + // If modifier returns false, discard node + if (result === false) { + this.remove(); + + // If modifier returns new node, use it + } else if (result && this !== _this) { + this.replace(_this); + } + }, true); + } + + // Return outer or inner content + return outerXML ? current.node.outerHTML : current.node.innerHTML; + } + + // Act as setter if we got a string + + // The default for import is, that the current node is not replaced + outerXML = outerXML == null ? false : outerXML; + + // Create temporary holder + const well = create('wrapper', ns); + const fragment = globals.document.createDocumentFragment(); + + // Dump raw svg + well.innerHTML = xmlOrFn; + + // Transplant nodes into the fragment + for (let len = well.children.length; len--;) { + fragment.appendChild(well.firstElementChild); + } + const parent = this.parent(); + + // Add the whole fragment at once + return outerXML ? this.replace(fragment) && parent : this.add(fragment); + } + } + extend(Dom, { + attr, + find, + findOne + }); + register(Dom, 'Dom'); + + class Element extends Dom { + constructor(node, attrs) { + super(node, attrs); + + // initialize data object + this.dom = {}; + + // create circular reference + this.node.instance = this; + if (node.hasAttribute('data-svgjs') || node.hasAttribute('svgjs:data')) { + // pull svgjs data from the dom (getAttributeNS doesn't work in html5) + this.setData(JSON.parse(node.getAttribute('data-svgjs')) ?? JSON.parse(node.getAttribute('svgjs:data')) ?? {}); + } + } + + // Move element by its center + center(x, y) { + return this.cx(x).cy(y); + } + + // Move by center over x-axis + cx(x) { + return x == null ? this.x() + this.width() / 2 : this.x(x - this.width() / 2); + } + + // Move by center over y-axis + cy(y) { + return y == null ? this.y() + this.height() / 2 : this.y(y - this.height() / 2); + } + + // Get defs + defs() { + const root = this.root(); + return root && root.defs(); + } + + // Relative move over x and y axes + dmove(x, y) { + return this.dx(x).dy(y); + } + + // Relative move over x axis + dx(x = 0) { + return this.x(new SVGNumber(x).plus(this.x())); + } + + // Relative move over y axis + dy(y = 0) { + return this.y(new SVGNumber(y).plus(this.y())); + } + getEventHolder() { + return this; + } + + // Set height of element + height(height) { + return this.attr('height', height); + } + + // Move element to given x and y values + move(x, y) { + return this.x(x).y(y); + } + + // return array of all ancestors of given type up to the root svg + parents(until = this.root()) { + const isSelector = typeof until === 'string'; + if (!isSelector) { + until = makeInstance(until); + } + const parents = new List(); + let parent = this; + while ((parent = parent.parent()) && parent.node !== globals.document && parent.nodeName !== '#document-fragment') { + parents.push(parent); + if (!isSelector && parent.node === until.node) { + break; + } + if (isSelector && parent.matches(until)) { + break; + } + if (parent.node === this.root().node) { + // We worked our way to the root and didn't match `until` + return null; + } + } + return parents; + } + + // Get referenced element form attribute value + reference(attr) { + attr = this.attr(attr); + if (!attr) return null; + const m = (attr + '').match(reference); + return m ? makeInstance(m[1]) : null; + } + + // Get parent document + root() { + const p = this.parent(getClass(root)); + return p && p.root(); + } + + // set given data to the elements data property + setData(o) { + this.dom = o; + return this; + } + + // Set element size to given width and height + size(width, height) { + const p = proportionalSize(this, width, height); + return this.width(new SVGNumber(p.width)).height(new SVGNumber(p.height)); + } + + // Set width of element + width(width) { + return this.attr('width', width); + } + + // write svgjs data to the dom + writeDataToDom() { + writeDataToDom(this, this.dom); + return super.writeDataToDom(); + } + + // Move over x-axis + x(x) { + return this.attr('x', x); + } + + // Move over y-axis + y(y) { + return this.attr('y', y); + } + } + extend(Element, { + bbox, + rbox, + inside, + point, + ctm, + screenCTM + }); + register(Element, 'Element'); + + // Define list of available attributes for stroke and fill + const sugar = { + stroke: ['color', 'width', 'opacity', 'linecap', 'linejoin', 'miterlimit', 'dasharray', 'dashoffset'], + fill: ['color', 'opacity', 'rule'], + prefix: function (t, a) { + return a === 'color' ? t : t + '-' + a; + } + } + + // Add sugar for fill and stroke + ; + ['fill', 'stroke'].forEach(function (m) { + const extension = {}; + let i; + extension[m] = function (o) { + if (typeof o === 'undefined') { + return this.attr(m); + } + if (typeof o === 'string' || o instanceof Color || Color.isRgb(o) || o instanceof Element) { + this.attr(m, o); + } else { + // set all attributes from sugar.fill and sugar.stroke list + for (i = sugar[m].length - 1; i >= 0; i--) { + if (o[sugar[m][i]] != null) { + this.attr(sugar.prefix(m, sugar[m][i]), o[sugar[m][i]]); + } + } + } + return this; + }; + registerMethods(['Element', 'Runner'], extension); + }); + registerMethods(['Element', 'Runner'], { + // Let the user set the matrix directly + matrix: function (mat, b, c, d, e, f) { + // Act as a getter + if (mat == null) { + return new Matrix(this); + } + + // Act as a setter, the user can pass a matrix or a set of numbers + return this.attr('transform', new Matrix(mat, b, c, d, e, f)); + }, + // Map rotation to transform + rotate: function (angle, cx, cy) { + return this.transform({ + rotate: angle, + ox: cx, + oy: cy + }, true); + }, + // Map skew to transform + skew: function (x, y, cx, cy) { + return arguments.length === 1 || arguments.length === 3 ? this.transform({ + skew: x, + ox: y, + oy: cx + }, true) : this.transform({ + skew: [x, y], + ox: cx, + oy: cy + }, true); + }, + shear: function (lam, cx, cy) { + return this.transform({ + shear: lam, + ox: cx, + oy: cy + }, true); + }, + // Map scale to transform + scale: function (x, y, cx, cy) { + return arguments.length === 1 || arguments.length === 3 ? this.transform({ + scale: x, + ox: y, + oy: cx + }, true) : this.transform({ + scale: [x, y], + ox: cx, + oy: cy + }, true); + }, + // Map translate to transform + translate: function (x, y) { + return this.transform({ + translate: [x, y] + }, true); + }, + // Map relative translations to transform + relative: function (x, y) { + return this.transform({ + relative: [x, y] + }, true); + }, + // Map flip to transform + flip: function (direction = 'both', origin = 'center') { + if ('xybothtrue'.indexOf(direction) === -1) { + origin = direction; + direction = 'both'; + } + return this.transform({ + flip: direction, + origin: origin + }, true); + }, + // Opacity + opacity: function (value) { + return this.attr('opacity', value); + } + }); + registerMethods('radius', { + // Add x and y radius + radius: function (x, y = x) { + const type = (this._element || this).type; + return type === 'radialGradient' ? this.attr('r', new SVGNumber(x)) : this.rx(x).ry(y); + } + }); + registerMethods('Path', { + // Get path length + length: function () { + return this.node.getTotalLength(); + }, + // Get point at length + pointAt: function (length) { + return new Point(this.node.getPointAtLength(length)); + } + }); + registerMethods(['Element', 'Runner'], { + // Set font + font: function (a, v) { + if (typeof a === 'object') { + for (v in a) this.font(v, a[v]); + return this; + } + return a === 'leading' ? this.leading(v) : a === 'anchor' ? this.attr('text-anchor', v) : a === 'size' || a === 'family' || a === 'weight' || a === 'stretch' || a === 'variant' || a === 'style' ? this.attr('font-' + a, v) : this.attr(a, v); + } + }); + + // Add events to elements + const methods = ['click', 'dblclick', 'mousedown', 'mouseup', 'mouseover', 'mouseout', 'mousemove', 'mouseenter', 'mouseleave', 'touchstart', 'touchmove', 'touchleave', 'touchend', 'touchcancel', 'contextmenu', 'wheel', 'pointerdown', 'pointermove', 'pointerup', 'pointerleave', 'pointercancel'].reduce(function (last, event) { + // add event to Element + const fn = function (f) { + if (f === null) { + this.off(event); + } else { + this.on(event, f); + } + return this; + }; + last[event] = fn; + return last; + }, {}); + registerMethods('Element', methods); + + // Reset all transformations + function untransform() { + return this.attr('transform', null); + } + + // merge the whole transformation chain into one matrix and returns it + function matrixify() { + const matrix = (this.attr('transform') || '' + // split transformations + ).split(transforms).slice(0, -1).map(function (str) { + // generate key => value pairs + const kv = str.trim().split('('); + return [kv[0], kv[1].split(delimiter).map(function (str) { + return parseFloat(str); + })]; + }).reverse() + // merge every transformation into one matrix + .reduce(function (matrix, transform) { + if (transform[0] === 'matrix') { + return matrix.lmultiply(Matrix.fromArray(transform[1])); + } + return matrix[transform[0]].apply(matrix, transform[1]); + }, new Matrix()); + return matrix; + } + + // add an element to another parent without changing the visual representation on the screen + function toParent(parent, i) { + if (this === parent) return this; + if (isDescriptive(this.node)) return this.addTo(parent, i); + const ctm = this.screenCTM(); + const pCtm = parent.screenCTM().inverse(); + this.addTo(parent, i).untransform().transform(pCtm.multiply(ctm)); + return this; + } + + // same as above with parent equals root-svg + function toRoot(i) { + return this.toParent(this.root(), i); + } + + // Add transformations + function transform(o, relative) { + // Act as a getter if no object was passed + if (o == null || typeof o === 'string') { + const decomposed = new Matrix(this).decompose(); + return o == null ? decomposed : decomposed[o]; + } + if (!Matrix.isMatrixLike(o)) { + // Set the origin according to the defined transform + o = { + ...o, + origin: getOrigin(o, this) + }; + } + + // The user can pass a boolean, an Element or an Matrix or nothing + const cleanRelative = relative === true ? this : relative || false; + const result = new Matrix(cleanRelative).transform(o); + return this.attr('transform', result); + } + registerMethods('Element', { + untransform, + matrixify, + toParent, + toRoot, + transform + }); + + class Container extends Element { + flatten() { + this.each(function () { + if (this instanceof Container) { + return this.flatten().ungroup(); + } + }); + return this; + } + ungroup(parent = this.parent(), index = parent.index(this)) { + // when parent != this, we want append all elements to the end + index = index === -1 ? parent.children().length : index; + this.each(function (i, children) { + // reverse each + return children[children.length - i - 1].toParent(parent, index); + }); + return this.remove(); + } + } + register(Container, 'Container'); + + class Defs extends Container { + constructor(node, attrs = node) { + super(nodeOrNew('defs', node), attrs); + } + flatten() { + return this; + } + ungroup() { + return this; + } + } + register(Defs, 'Defs'); + + class Shape extends Element {} + register(Shape, 'Shape'); + + // Radius x value + function rx(rx) { + return this.attr('rx', rx); + } + + // Radius y value + function ry(ry) { + return this.attr('ry', ry); + } + + // Move over x-axis + function x$3(x) { + return x == null ? this.cx() - this.rx() : this.cx(x + this.rx()); + } + + // Move over y-axis + function y$3(y) { + return y == null ? this.cy() - this.ry() : this.cy(y + this.ry()); + } + + // Move by center over x-axis + function cx$1(x) { + return this.attr('cx', x); + } + + // Move by center over y-axis + function cy$1(y) { + return this.attr('cy', y); + } + + // Set width of element + function width$2(width) { + return width == null ? this.rx() * 2 : this.rx(new SVGNumber(width).divide(2)); + } + + // Set height of element + function height$2(height) { + return height == null ? this.ry() * 2 : this.ry(new SVGNumber(height).divide(2)); + } + + var circled = { + __proto__: null, + cx: cx$1, + cy: cy$1, + height: height$2, + rx: rx, + ry: ry, + width: width$2, + x: x$3, + y: y$3 + }; + + class Ellipse extends Shape { + constructor(node, attrs = node) { + super(nodeOrNew('ellipse', node), attrs); + } + size(width, height) { + const p = proportionalSize(this, width, height); + return this.rx(new SVGNumber(p.width).divide(2)).ry(new SVGNumber(p.height).divide(2)); + } + } + extend(Ellipse, circled); + registerMethods('Container', { + // Create an ellipse + ellipse: wrapWithAttrCheck(function (width = 0, height = width) { + return this.put(new Ellipse()).size(width, height).move(0, 0); + }) + }); + register(Ellipse, 'Ellipse'); + + class Fragment extends Dom { + constructor(node = globals.document.createDocumentFragment()) { + super(node); + } + + // Import / Export raw xml + xml(xmlOrFn, outerXML, ns) { + if (typeof xmlOrFn === 'boolean') { + ns = outerXML; + outerXML = xmlOrFn; + xmlOrFn = null; + } + + // because this is a fragment we have to put all elements into a wrapper first + // before we can get the innerXML from it + if (xmlOrFn == null || typeof xmlOrFn === 'function') { + const wrapper = new Dom(create('wrapper', ns)); + wrapper.add(this.node.cloneNode(true)); + return wrapper.xml(false, ns); + } + + // Act as setter if we got a string + return super.xml(xmlOrFn, false, ns); + } + } + register(Fragment, 'Fragment'); + + function from(x, y) { + return (this._element || this).type === 'radialGradient' ? this.attr({ + fx: new SVGNumber(x), + fy: new SVGNumber(y) + }) : this.attr({ + x1: new SVGNumber(x), + y1: new SVGNumber(y) + }); + } + function to(x, y) { + return (this._element || this).type === 'radialGradient' ? this.attr({ + cx: new SVGNumber(x), + cy: new SVGNumber(y) + }) : this.attr({ + x2: new SVGNumber(x), + y2: new SVGNumber(y) + }); + } + + var gradiented = { + __proto__: null, + from: from, + to: to + }; + + class Gradient extends Container { + constructor(type, attrs) { + super(nodeOrNew(type + 'Gradient', typeof type === 'string' ? null : type), attrs); + } + + // custom attr to handle transform + attr(a, b, c) { + if (a === 'transform') a = 'gradientTransform'; + return super.attr(a, b, c); + } + bbox() { + return new Box(); + } + targets() { + return baseFind('svg [fill*=' + this.id() + ']'); + } + + // Alias string conversion to fill + toString() { + return this.url(); + } + + // Update gradient + update(block) { + // remove all stops + this.clear(); + + // invoke passed block + if (typeof block === 'function') { + block.call(this, this); + } + return this; + } + + // Return the fill id + url() { + return 'url(#' + this.id() + ')'; + } + } + extend(Gradient, gradiented); + registerMethods({ + Container: { + // Create gradient element in defs + gradient(...args) { + return this.defs().gradient(...args); + } + }, + // define gradient + Defs: { + gradient: wrapWithAttrCheck(function (type, block) { + return this.put(new Gradient(type)).update(block); + }) + } + }); + register(Gradient, 'Gradient'); + + class Pattern extends Container { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('pattern', node), attrs); + } + + // custom attr to handle transform + attr(a, b, c) { + if (a === 'transform') a = 'patternTransform'; + return super.attr(a, b, c); + } + bbox() { + return new Box(); + } + targets() { + return baseFind('svg [fill*=' + this.id() + ']'); + } + + // Alias string conversion to fill + toString() { + return this.url(); + } + + // Update pattern by rebuilding + update(block) { + // remove content + this.clear(); + + // invoke passed block + if (typeof block === 'function') { + block.call(this, this); + } + return this; + } + + // Return the fill id + url() { + return 'url(#' + this.id() + ')'; + } + } + registerMethods({ + Container: { + // Create pattern element in defs + pattern(...args) { + return this.defs().pattern(...args); + } + }, + Defs: { + pattern: wrapWithAttrCheck(function (width, height, block) { + return this.put(new Pattern()).update(block).attr({ + x: 0, + y: 0, + width: width, + height: height, + patternUnits: 'userSpaceOnUse' + }); + }) + } + }); + register(Pattern, 'Pattern'); + + class Image extends Shape { + constructor(node, attrs = node) { + super(nodeOrNew('image', node), attrs); + } + + // (re)load image + load(url, callback) { + if (!url) return this; + const img = new globals.window.Image(); + on(img, 'load', function (e) { + const p = this.parent(Pattern); + + // ensure image size + if (this.width() === 0 && this.height() === 0) { + this.size(img.width, img.height); + } + if (p instanceof Pattern) { + // ensure pattern size if not set + if (p.width() === 0 && p.height() === 0) { + p.size(this.width(), this.height()); + } + } + if (typeof callback === 'function') { + callback.call(this, e); + } + }, this); + on(img, 'load error', function () { + // dont forget to unbind memory leaking events + off(img); + }); + return this.attr('href', img.src = url, xlink); + } + } + registerAttrHook(function (attr, val, _this) { + // convert image fill and stroke to patterns + if (attr === 'fill' || attr === 'stroke') { + if (isImage.test(val)) { + val = _this.root().defs().image(val); + } + } + if (val instanceof Image) { + val = _this.root().defs().pattern(0, 0, pattern => { + pattern.add(val); + }); + } + return val; + }); + registerMethods({ + Container: { + // create image element, load image and set its size + image: wrapWithAttrCheck(function (source, callback) { + return this.put(new Image()).size(0, 0).load(source, callback); + }) + } + }); + register(Image, 'Image'); + + class PointArray extends SVGArray { + // Get bounding box of points + bbox() { + let maxX = -Infinity; + let maxY = -Infinity; + let minX = Infinity; + let minY = Infinity; + this.forEach(function (el) { + maxX = Math.max(el[0], maxX); + maxY = Math.max(el[1], maxY); + minX = Math.min(el[0], minX); + minY = Math.min(el[1], minY); + }); + return new Box(minX, minY, maxX - minX, maxY - minY); + } + + // Move point string + move(x, y) { + const box = this.bbox(); + + // get relative offset + x -= box.x; + y -= box.y; + + // move every point + if (!isNaN(x) && !isNaN(y)) { + for (let i = this.length - 1; i >= 0; i--) { + this[i] = [this[i][0] + x, this[i][1] + y]; + } + } + return this; + } + + // Parse point string and flat array + parse(array = [0, 0]) { + const points = []; + + // if it is an array, we flatten it and therefore clone it to 1 depths + if (array instanceof Array) { + array = Array.prototype.concat.apply([], array); + } else { + // Else, it is considered as a string + // parse points + array = array.trim().split(delimiter).map(parseFloat); + } + + // validate points - https://svgwg.org/svg2-draft/shapes.html#DataTypePoints + // Odd number of coordinates is an error. In such cases, drop the last odd coordinate. + if (array.length % 2 !== 0) array.pop(); + + // wrap points in two-tuples + for (let i = 0, len = array.length; i < len; i = i + 2) { + points.push([array[i], array[i + 1]]); + } + return points; + } + + // Resize poly string + size(width, height) { + let i; + const box = this.bbox(); + + // recalculate position of all points according to new size + for (i = this.length - 1; i >= 0; i--) { + if (box.width) this[i][0] = (this[i][0] - box.x) * width / box.width + box.x; + if (box.height) this[i][1] = (this[i][1] - box.y) * height / box.height + box.y; + } + return this; + } + + // Convert array to line object + toLine() { + return { + x1: this[0][0], + y1: this[0][1], + x2: this[1][0], + y2: this[1][1] + }; + } + + // Convert array to string + toString() { + const array = []; + // convert to a poly point string + for (let i = 0, il = this.length; i < il; i++) { + array.push(this[i].join(',')); + } + return array.join(' '); + } + transform(m) { + return this.clone().transformO(m); + } + + // transform points with matrix (similar to Point.transform) + transformO(m) { + if (!Matrix.isMatrixLike(m)) { + m = new Matrix(m); + } + for (let i = this.length; i--;) { + // Perform the matrix multiplication + const [x, y] = this[i]; + this[i][0] = m.a * x + m.c * y + m.e; + this[i][1] = m.b * x + m.d * y + m.f; + } + return this; + } + } + + const MorphArray = PointArray; + + // Move by left top corner over x-axis + function x$2(x) { + return x == null ? this.bbox().x : this.move(x, this.bbox().y); + } + + // Move by left top corner over y-axis + function y$2(y) { + return y == null ? this.bbox().y : this.move(this.bbox().x, y); + } + + // Set width of element + function width$1(width) { + const b = this.bbox(); + return width == null ? b.width : this.size(width, b.height); + } + + // Set height of element + function height$1(height) { + const b = this.bbox(); + return height == null ? b.height : this.size(b.width, height); + } + + var pointed = { + __proto__: null, + MorphArray: MorphArray, + height: height$1, + width: width$1, + x: x$2, + y: y$2 + }; + + class Line extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('line', node), attrs); + } + + // Get array + array() { + return new PointArray([[this.attr('x1'), this.attr('y1')], [this.attr('x2'), this.attr('y2')]]); + } + + // Move by left top corner + move(x, y) { + return this.attr(this.array().move(x, y).toLine()); + } + + // Overwrite native plot() method + plot(x1, y1, x2, y2) { + if (x1 == null) { + return this.array(); + } else if (typeof y1 !== 'undefined') { + x1 = { + x1, + y1, + x2, + y2 + }; + } else { + x1 = new PointArray(x1).toLine(); + } + return this.attr(x1); + } + + // Set element size to given width and height + size(width, height) { + const p = proportionalSize(this, width, height); + return this.attr(this.array().size(p.width, p.height).toLine()); + } + } + extend(Line, pointed); + registerMethods({ + Container: { + // Create a line element + line: wrapWithAttrCheck(function (...args) { + // make sure plot is called as a setter + // x1 is not necessarily a number, it can also be an array, a string and a PointArray + return Line.prototype.plot.apply(this.put(new Line()), args[0] != null ? args : [0, 0, 0, 0]); + }) + } + }); + register(Line, 'Line'); + + class Marker extends Container { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('marker', node), attrs); + } + + // Set height of element + height(height) { + return this.attr('markerHeight', height); + } + orient(orient) { + return this.attr('orient', orient); + } + + // Set marker refX and refY + ref(x, y) { + return this.attr('refX', x).attr('refY', y); + } + + // Return the fill id + toString() { + return 'url(#' + this.id() + ')'; + } + + // Update marker + update(block) { + // remove all content + this.clear(); + + // invoke passed block + if (typeof block === 'function') { + block.call(this, this); + } + return this; + } + + // Set width of element + width(width) { + return this.attr('markerWidth', width); + } + } + registerMethods({ + Container: { + marker(...args) { + // Create marker element in defs + return this.defs().marker(...args); + } + }, + Defs: { + // Create marker + marker: wrapWithAttrCheck(function (width, height, block) { + // Set default viewbox to match the width and height, set ref to cx and cy and set orient to auto + return this.put(new Marker()).size(width, height).ref(width / 2, height / 2).viewbox(0, 0, width, height).attr('orient', 'auto').update(block); + }) + }, + marker: { + // Create and attach markers + marker(marker, width, height, block) { + let attr = ['marker']; + + // Build attribute name + if (marker !== 'all') attr.push(marker); + attr = attr.join('-'); + + // Set marker attribute + marker = arguments[1] instanceof Marker ? arguments[1] : this.defs().marker(width, height, block); + return this.attr(attr, marker); + } + } + }); + register(Marker, 'Marker'); + + /*** + Base Class + ========== + The base stepper class that will be + ***/ + + function makeSetterGetter(k, f) { + return function (v) { + if (v == null) return this[k]; + this[k] = v; + if (f) f.call(this); + return this; + }; + } + const easing = { + '-': function (pos) { + return pos; + }, + '<>': function (pos) { + return -Math.cos(pos * Math.PI) / 2 + 0.5; + }, + '>': function (pos) { + return Math.sin(pos * Math.PI / 2); + }, + '<': function (pos) { + return -Math.cos(pos * Math.PI / 2) + 1; + }, + bezier: function (x1, y1, x2, y2) { + // see https://www.w3.org/TR/css-easing-1/#cubic-bezier-algo + return function (t) { + if (t < 0) { + if (x1 > 0) { + return y1 / x1 * t; + } else if (x2 > 0) { + return y2 / x2 * t; + } else { + return 0; + } + } else if (t > 1) { + if (x2 < 1) { + return (1 - y2) / (1 - x2) * t + (y2 - x2) / (1 - x2); + } else if (x1 < 1) { + return (1 - y1) / (1 - x1) * t + (y1 - x1) / (1 - x1); + } else { + return 1; + } + } else { + return 3 * t * (1 - t) ** 2 * y1 + 3 * t ** 2 * (1 - t) * y2 + t ** 3; + } + }; + }, + // see https://www.w3.org/TR/css-easing-1/#step-timing-function-algo + steps: function (steps, stepPosition = 'end') { + // deal with "jump-" prefix + stepPosition = stepPosition.split('-').reverse()[0]; + let jumps = steps; + if (stepPosition === 'none') { + --jumps; + } else if (stepPosition === 'both') { + ++jumps; + } + + // The beforeFlag is essentially useless + return (t, beforeFlag = false) => { + // Step is called currentStep in referenced url + let step = Math.floor(t * steps); + const jumping = t * step % 1 === 0; + if (stepPosition === 'start' || stepPosition === 'both') { + ++step; + } + if (beforeFlag && jumping) { + --step; + } + if (t >= 0 && step < 0) { + step = 0; + } + if (t <= 1 && step > jumps) { + step = jumps; + } + return step / jumps; + }; + } + }; + class Stepper { + done() { + return false; + } + } + + /*** + Easing Functions + ================ + ***/ + + class Ease extends Stepper { + constructor(fn = timeline.ease) { + super(); + this.ease = easing[fn] || fn; + } + step(from, to, pos) { + if (typeof from !== 'number') { + return pos < 1 ? from : to; + } + return from + (to - from) * this.ease(pos); + } + } + + /*** + Controller Types + ================ + ***/ + + class Controller extends Stepper { + constructor(fn) { + super(); + this.stepper = fn; + } + done(c) { + return c.done; + } + step(current, target, dt, c) { + return this.stepper(current, target, dt, c); + } + } + function recalculate() { + // Apply the default parameters + const duration = (this._duration || 500) / 1000; + const overshoot = this._overshoot || 0; + + // Calculate the PID natural response + const eps = 1e-10; + const pi = Math.PI; + const os = Math.log(overshoot / 100 + eps); + const zeta = -os / Math.sqrt(pi * pi + os * os); + const wn = 3.9 / (zeta * duration); + + // Calculate the Spring values + this.d = 2 * zeta * wn; + this.k = wn * wn; + } + class Spring extends Controller { + constructor(duration = 500, overshoot = 0) { + super(); + this.duration(duration).overshoot(overshoot); + } + step(current, target, dt, c) { + if (typeof current === 'string') return current; + c.done = dt === Infinity; + if (dt === Infinity) return target; + if (dt === 0) return current; + if (dt > 100) dt = 16; + dt /= 1000; + + // Get the previous velocity + const velocity = c.velocity || 0; + + // Apply the control to get the new position and store it + const acceleration = -this.d * velocity - this.k * (current - target); + const newPosition = current + velocity * dt + acceleration * dt * dt / 2; + + // Store the velocity + c.velocity = velocity + acceleration * dt; + + // Figure out if we have converged, and if so, pass the value + c.done = Math.abs(target - newPosition) + Math.abs(velocity) < 0.002; + return c.done ? target : newPosition; + } + } + extend(Spring, { + duration: makeSetterGetter('_duration', recalculate), + overshoot: makeSetterGetter('_overshoot', recalculate) + }); + class PID extends Controller { + constructor(p = 0.1, i = 0.01, d = 0, windup = 1000) { + super(); + this.p(p).i(i).d(d).windup(windup); + } + step(current, target, dt, c) { + if (typeof current === 'string') return current; + c.done = dt === Infinity; + if (dt === Infinity) return target; + if (dt === 0) return current; + const p = target - current; + let i = (c.integral || 0) + p * dt; + const d = (p - (c.error || 0)) / dt; + const windup = this._windup; + + // antiwindup + if (windup !== false) { + i = Math.max(-windup, Math.min(i, windup)); + } + c.error = p; + c.integral = i; + c.done = Math.abs(p) < 0.001; + return c.done ? target : current + (this.P * p + this.I * i + this.D * d); + } + } + extend(PID, { + windup: makeSetterGetter('_windup'), + p: makeSetterGetter('P'), + i: makeSetterGetter('I'), + d: makeSetterGetter('D') + }); + + const segmentParameters = { + M: 2, + L: 2, + H: 1, + V: 1, + C: 6, + S: 4, + Q: 4, + T: 2, + A: 7, + Z: 0 + }; + const pathHandlers = { + M: function (c, p, p0) { + p.x = p0.x = c[0]; + p.y = p0.y = c[1]; + return ['M', p.x, p.y]; + }, + L: function (c, p) { + p.x = c[0]; + p.y = c[1]; + return ['L', c[0], c[1]]; + }, + H: function (c, p) { + p.x = c[0]; + return ['H', c[0]]; + }, + V: function (c, p) { + p.y = c[0]; + return ['V', c[0]]; + }, + C: function (c, p) { + p.x = c[4]; + p.y = c[5]; + return ['C', c[0], c[1], c[2], c[3], c[4], c[5]]; + }, + S: function (c, p) { + p.x = c[2]; + p.y = c[3]; + return ['S', c[0], c[1], c[2], c[3]]; + }, + Q: function (c, p) { + p.x = c[2]; + p.y = c[3]; + return ['Q', c[0], c[1], c[2], c[3]]; + }, + T: function (c, p) { + p.x = c[0]; + p.y = c[1]; + return ['T', c[0], c[1]]; + }, + Z: function (c, p, p0) { + p.x = p0.x; + p.y = p0.y; + return ['Z']; + }, + A: function (c, p) { + p.x = c[5]; + p.y = c[6]; + return ['A', c[0], c[1], c[2], c[3], c[4], c[5], c[6]]; + } + }; + const mlhvqtcsaz = 'mlhvqtcsaz'.split(''); + for (let i = 0, il = mlhvqtcsaz.length; i < il; ++i) { + pathHandlers[mlhvqtcsaz[i]] = function (i) { + return function (c, p, p0) { + if (i === 'H') c[0] = c[0] + p.x;else if (i === 'V') c[0] = c[0] + p.y;else if (i === 'A') { + c[5] = c[5] + p.x; + c[6] = c[6] + p.y; + } else { + for (let j = 0, jl = c.length; j < jl; ++j) { + c[j] = c[j] + (j % 2 ? p.y : p.x); + } + } + return pathHandlers[i](c, p, p0); + }; + }(mlhvqtcsaz[i].toUpperCase()); + } + function makeAbsolut(parser) { + const command = parser.segment[0]; + return pathHandlers[command](parser.segment.slice(1), parser.p, parser.p0); + } + function segmentComplete(parser) { + return parser.segment.length && parser.segment.length - 1 === segmentParameters[parser.segment[0].toUpperCase()]; + } + function startNewSegment(parser, token) { + parser.inNumber && finalizeNumber(parser, false); + const pathLetter = isPathLetter.test(token); + if (pathLetter) { + parser.segment = [token]; + } else { + const lastCommand = parser.lastCommand; + const small = lastCommand.toLowerCase(); + const isSmall = lastCommand === small; + parser.segment = [small === 'm' ? isSmall ? 'l' : 'L' : lastCommand]; + } + parser.inSegment = true; + parser.lastCommand = parser.segment[0]; + return pathLetter; + } + function finalizeNumber(parser, inNumber) { + if (!parser.inNumber) throw new Error('Parser Error'); + parser.number && parser.segment.push(parseFloat(parser.number)); + parser.inNumber = inNumber; + parser.number = ''; + parser.pointSeen = false; + parser.hasExponent = false; + if (segmentComplete(parser)) { + finalizeSegment(parser); + } + } + function finalizeSegment(parser) { + parser.inSegment = false; + if (parser.absolute) { + parser.segment = makeAbsolut(parser); + } + parser.segments.push(parser.segment); + } + function isArcFlag(parser) { + if (!parser.segment.length) return false; + const isArc = parser.segment[0].toUpperCase() === 'A'; + const length = parser.segment.length; + return isArc && (length === 4 || length === 5); + } + function isExponential(parser) { + return parser.lastToken.toUpperCase() === 'E'; + } + const pathDelimiters = new Set([' ', ',', '\t', '\n', '\r', '\f']); + function pathParser(d, toAbsolute = true) { + let index = 0; + let token = ''; + const parser = { + segment: [], + inNumber: false, + number: '', + lastToken: '', + inSegment: false, + segments: [], + pointSeen: false, + hasExponent: false, + absolute: toAbsolute, + p0: new Point(), + p: new Point() + }; + while (parser.lastToken = token, token = d.charAt(index++)) { + if (!parser.inSegment) { + if (startNewSegment(parser, token)) { + continue; + } + } + if (token === '.') { + if (parser.pointSeen || parser.hasExponent) { + finalizeNumber(parser, false); + --index; + continue; + } + parser.inNumber = true; + parser.pointSeen = true; + parser.number += token; + continue; + } + if (!isNaN(parseInt(token))) { + if (parser.number === '0' || isArcFlag(parser)) { + parser.inNumber = true; + parser.number = token; + finalizeNumber(parser, true); + continue; + } + parser.inNumber = true; + parser.number += token; + continue; + } + if (pathDelimiters.has(token)) { + if (parser.inNumber) { + finalizeNumber(parser, false); + } + continue; + } + if (token === '-' || token === '+') { + if (parser.inNumber && !isExponential(parser)) { + finalizeNumber(parser, false); + --index; + continue; + } + parser.number += token; + parser.inNumber = true; + continue; + } + if (token.toUpperCase() === 'E') { + parser.number += token; + parser.hasExponent = true; + continue; + } + if (isPathLetter.test(token)) { + if (parser.inNumber) { + finalizeNumber(parser, false); + } else if (!segmentComplete(parser)) { + throw new Error('parser Error'); + } else { + finalizeSegment(parser); + } + --index; + } + } + if (parser.inNumber) { + finalizeNumber(parser, false); + } + if (parser.inSegment && segmentComplete(parser)) { + finalizeSegment(parser); + } + return parser.segments; + } + + function arrayToString(a) { + let s = ''; + for (let i = 0, il = a.length; i < il; i++) { + s += a[i][0]; + if (a[i][1] != null) { + s += a[i][1]; + if (a[i][2] != null) { + s += ' '; + s += a[i][2]; + if (a[i][3] != null) { + s += ' '; + s += a[i][3]; + s += ' '; + s += a[i][4]; + if (a[i][5] != null) { + s += ' '; + s += a[i][5]; + s += ' '; + s += a[i][6]; + if (a[i][7] != null) { + s += ' '; + s += a[i][7]; + } + } + } + } + } + } + return s + ' '; + } + class PathArray extends SVGArray { + // Get bounding box of path + bbox() { + parser().path.setAttribute('d', this.toString()); + return new Box(parser.nodes.path.getBBox()); + } + + // Move path string + move(x, y) { + // get bounding box of current situation + const box = this.bbox(); + + // get relative offset + x -= box.x; + y -= box.y; + if (!isNaN(x) && !isNaN(y)) { + // move every point + for (let l, i = this.length - 1; i >= 0; i--) { + l = this[i][0]; + if (l === 'M' || l === 'L' || l === 'T') { + this[i][1] += x; + this[i][2] += y; + } else if (l === 'H') { + this[i][1] += x; + } else if (l === 'V') { + this[i][1] += y; + } else if (l === 'C' || l === 'S' || l === 'Q') { + this[i][1] += x; + this[i][2] += y; + this[i][3] += x; + this[i][4] += y; + if (l === 'C') { + this[i][5] += x; + this[i][6] += y; + } + } else if (l === 'A') { + this[i][6] += x; + this[i][7] += y; + } + } + } + return this; + } + + // Absolutize and parse path to array + parse(d = 'M0 0') { + if (Array.isArray(d)) { + d = Array.prototype.concat.apply([], d).toString(); + } + return pathParser(d); + } + + // Resize path string + size(width, height) { + // get bounding box of current situation + const box = this.bbox(); + let i, l; + + // If the box width or height is 0 then we ignore + // transformations on the respective axis + box.width = box.width === 0 ? 1 : box.width; + box.height = box.height === 0 ? 1 : box.height; + + // recalculate position of all points according to new size + for (i = this.length - 1; i >= 0; i--) { + l = this[i][0]; + if (l === 'M' || l === 'L' || l === 'T') { + this[i][1] = (this[i][1] - box.x) * width / box.width + box.x; + this[i][2] = (this[i][2] - box.y) * height / box.height + box.y; + } else if (l === 'H') { + this[i][1] = (this[i][1] - box.x) * width / box.width + box.x; + } else if (l === 'V') { + this[i][1] = (this[i][1] - box.y) * height / box.height + box.y; + } else if (l === 'C' || l === 'S' || l === 'Q') { + this[i][1] = (this[i][1] - box.x) * width / box.width + box.x; + this[i][2] = (this[i][2] - box.y) * height / box.height + box.y; + this[i][3] = (this[i][3] - box.x) * width / box.width + box.x; + this[i][4] = (this[i][4] - box.y) * height / box.height + box.y; + if (l === 'C') { + this[i][5] = (this[i][5] - box.x) * width / box.width + box.x; + this[i][6] = (this[i][6] - box.y) * height / box.height + box.y; + } + } else if (l === 'A') { + // resize radii + this[i][1] = this[i][1] * width / box.width; + this[i][2] = this[i][2] * height / box.height; + + // move position values + this[i][6] = (this[i][6] - box.x) * width / box.width + box.x; + this[i][7] = (this[i][7] - box.y) * height / box.height + box.y; + } + } + return this; + } + + // Convert array to string + toString() { + return arrayToString(this); + } + } + + const getClassForType = value => { + const type = typeof value; + if (type === 'number') { + return SVGNumber; + } else if (type === 'string') { + if (Color.isColor(value)) { + return Color; + } else if (delimiter.test(value)) { + return isPathLetter.test(value) ? PathArray : SVGArray; + } else if (numberAndUnit.test(value)) { + return SVGNumber; + } else { + return NonMorphable; + } + } else if (morphableTypes.indexOf(value.constructor) > -1) { + return value.constructor; + } else if (Array.isArray(value)) { + return SVGArray; + } else if (type === 'object') { + return ObjectBag; + } else { + return NonMorphable; + } + }; + class Morphable { + constructor(stepper) { + this._stepper = stepper || new Ease('-'); + this._from = null; + this._to = null; + this._type = null; + this._context = null; + this._morphObj = null; + } + at(pos) { + return this._morphObj.morph(this._from, this._to, pos, this._stepper, this._context); + } + done() { + const complete = this._context.map(this._stepper.done).reduce(function (last, curr) { + return last && curr; + }, true); + return complete; + } + from(val) { + if (val == null) { + return this._from; + } + this._from = this._set(val); + return this; + } + stepper(stepper) { + if (stepper == null) return this._stepper; + this._stepper = stepper; + return this; + } + to(val) { + if (val == null) { + return this._to; + } + this._to = this._set(val); + return this; + } + type(type) { + // getter + if (type == null) { + return this._type; + } + + // setter + this._type = type; + return this; + } + _set(value) { + if (!this._type) { + this.type(getClassForType(value)); + } + let result = new this._type(value); + if (this._type === Color) { + result = this._to ? result[this._to[4]]() : this._from ? result[this._from[4]]() : result; + } + if (this._type === ObjectBag) { + result = this._to ? result.align(this._to) : this._from ? result.align(this._from) : result; + } + result = result.toConsumable(); + this._morphObj = this._morphObj || new this._type(); + this._context = this._context || Array.apply(null, Array(result.length)).map(Object).map(function (o) { + o.done = true; + return o; + }); + return result; + } + } + class NonMorphable { + constructor(...args) { + this.init(...args); + } + init(val) { + val = Array.isArray(val) ? val[0] : val; + this.value = val; + return this; + } + toArray() { + return [this.value]; + } + valueOf() { + return this.value; + } + } + class TransformBag { + constructor(...args) { + this.init(...args); + } + init(obj) { + if (Array.isArray(obj)) { + obj = { + scaleX: obj[0], + scaleY: obj[1], + shear: obj[2], + rotate: obj[3], + translateX: obj[4], + translateY: obj[5], + originX: obj[6], + originY: obj[7] + }; + } + Object.assign(this, TransformBag.defaults, obj); + return this; + } + toArray() { + const v = this; + return [v.scaleX, v.scaleY, v.shear, v.rotate, v.translateX, v.translateY, v.originX, v.originY]; + } + } + TransformBag.defaults = { + scaleX: 1, + scaleY: 1, + shear: 0, + rotate: 0, + translateX: 0, + translateY: 0, + originX: 0, + originY: 0 + }; + const sortByKey = (a, b) => { + return a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0; + }; + class ObjectBag { + constructor(...args) { + this.init(...args); + } + align(other) { + const values = this.values; + for (let i = 0, il = values.length; i < il; ++i) { + // If the type is the same we only need to check if the color is in the correct format + if (values[i + 1] === other[i + 1]) { + if (values[i + 1] === Color && other[i + 7] !== values[i + 7]) { + const space = other[i + 7]; + const color = new Color(this.values.splice(i + 3, 5))[space]().toArray(); + this.values.splice(i + 3, 0, ...color); + } + i += values[i + 2] + 2; + continue; + } + if (!other[i + 1]) { + return this; + } + + // The types differ, so we overwrite the new type with the old one + // And initialize it with the types default (e.g. black for color or 0 for number) + const defaultObject = new other[i + 1]().toArray(); + + // Than we fix the values array + const toDelete = values[i + 2] + 3; + values.splice(i, toDelete, other[i], other[i + 1], other[i + 2], ...defaultObject); + i += values[i + 2] + 2; + } + return this; + } + init(objOrArr) { + this.values = []; + if (Array.isArray(objOrArr)) { + this.values = objOrArr.slice(); + return; + } + objOrArr = objOrArr || {}; + const entries = []; + for (const i in objOrArr) { + const Type = getClassForType(objOrArr[i]); + const val = new Type(objOrArr[i]).toArray(); + entries.push([i, Type, val.length, ...val]); + } + entries.sort(sortByKey); + this.values = entries.reduce((last, curr) => last.concat(curr), []); + return this; + } + toArray() { + return this.values; + } + valueOf() { + const obj = {}; + const arr = this.values; + + // for (var i = 0, len = arr.length; i < len; i += 2) { + while (arr.length) { + const key = arr.shift(); + const Type = arr.shift(); + const num = arr.shift(); + const values = arr.splice(0, num); + obj[key] = new Type(values); // .valueOf() + } + return obj; + } + } + const morphableTypes = [NonMorphable, TransformBag, ObjectBag]; + function registerMorphableType(type = []) { + morphableTypes.push(...[].concat(type)); + } + function makeMorphable() { + extend(morphableTypes, { + to(val) { + return new Morphable().type(this.constructor).from(this.toArray()) // this.valueOf()) + .to(val); + }, + fromArray(arr) { + this.init(arr); + return this; + }, + toConsumable() { + return this.toArray(); + }, + morph(from, to, pos, stepper, context) { + const mapper = function (i, index) { + return stepper.step(i, to[index], pos, context[index], context); + }; + return this.fromArray(from.map(mapper)); + } + }); + } + + class Path extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('path', node), attrs); + } + + // Get array + array() { + return this._array || (this._array = new PathArray(this.attr('d'))); + } + + // Clear array cache + clear() { + delete this._array; + return this; + } + + // Set height of element + height(height) { + return height == null ? this.bbox().height : this.size(this.bbox().width, height); + } + + // Move by left top corner + move(x, y) { + return this.attr('d', this.array().move(x, y)); + } + + // Plot new path + plot(d) { + return d == null ? this.array() : this.clear().attr('d', typeof d === 'string' ? d : this._array = new PathArray(d)); + } + + // Set element size to given width and height + size(width, height) { + const p = proportionalSize(this, width, height); + return this.attr('d', this.array().size(p.width, p.height)); + } + + // Set width of element + width(width) { + return width == null ? this.bbox().width : this.size(width, this.bbox().height); + } + + // Move by left top corner over x-axis + x(x) { + return x == null ? this.bbox().x : this.move(x, this.bbox().y); + } + + // Move by left top corner over y-axis + y(y) { + return y == null ? this.bbox().y : this.move(this.bbox().x, y); + } + } + + // Define morphable array + Path.prototype.MorphArray = PathArray; + + // Add parent method + registerMethods({ + Container: { + // Create a wrapped path element + path: wrapWithAttrCheck(function (d) { + // make sure plot is called as a setter + return this.put(new Path()).plot(d || new PathArray()); + }) + } + }); + register(Path, 'Path'); + + // Get array + function array() { + return this._array || (this._array = new PointArray(this.attr('points'))); + } + + // Clear array cache + function clear() { + delete this._array; + return this; + } + + // Move by left top corner + function move$2(x, y) { + return this.attr('points', this.array().move(x, y)); + } + + // Plot new path + function plot(p) { + return p == null ? this.array() : this.clear().attr('points', typeof p === 'string' ? p : this._array = new PointArray(p)); + } + + // Set element size to given width and height + function size$1(width, height) { + const p = proportionalSize(this, width, height); + return this.attr('points', this.array().size(p.width, p.height)); + } + + var poly = { + __proto__: null, + array: array, + clear: clear, + move: move$2, + plot: plot, + size: size$1 + }; + + class Polygon extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('polygon', node), attrs); + } + } + registerMethods({ + Container: { + // Create a wrapped polygon element + polygon: wrapWithAttrCheck(function (p) { + // make sure plot is called as a setter + return this.put(new Polygon()).plot(p || new PointArray()); + }) + } + }); + extend(Polygon, pointed); + extend(Polygon, poly); + register(Polygon, 'Polygon'); + + class Polyline extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('polyline', node), attrs); + } + } + registerMethods({ + Container: { + // Create a wrapped polygon element + polyline: wrapWithAttrCheck(function (p) { + // make sure plot is called as a setter + return this.put(new Polyline()).plot(p || new PointArray()); + }) + } + }); + extend(Polyline, pointed); + extend(Polyline, poly); + register(Polyline, 'Polyline'); + + class Rect extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('rect', node), attrs); + } + } + extend(Rect, { + rx, + ry + }); + registerMethods({ + Container: { + // Create a rect element + rect: wrapWithAttrCheck(function (width, height) { + return this.put(new Rect()).size(width, height); + }) + } + }); + register(Rect, 'Rect'); + + class Queue { + constructor() { + this._first = null; + this._last = null; + } + + // Shows us the first item in the list + first() { + return this._first && this._first.value; + } + + // Shows us the last item in the list + last() { + return this._last && this._last.value; + } + push(value) { + // An item stores an id and the provided value + const item = typeof value.next !== 'undefined' ? value : { + value: value, + next: null, + prev: null + }; + + // Deal with the queue being empty or populated + if (this._last) { + item.prev = this._last; + this._last.next = item; + this._last = item; + } else { + this._last = item; + this._first = item; + } + + // Return the current item + return item; + } + + // Removes the item that was returned from the push + remove(item) { + // Relink the previous item + if (item.prev) item.prev.next = item.next; + if (item.next) item.next.prev = item.prev; + if (item === this._last) this._last = item.prev; + if (item === this._first) this._first = item.next; + + // Invalidate item + item.prev = null; + item.next = null; + } + shift() { + // Check if we have a value + const remove = this._first; + if (!remove) return null; + + // If we do, remove it and relink things + this._first = remove.next; + if (this._first) this._first.prev = null; + this._last = this._first ? this._last : null; + return remove.value; + } + } + + const Animator = { + nextDraw: null, + frames: new Queue(), + timeouts: new Queue(), + immediates: new Queue(), + timer: () => globals.window.performance || globals.window.Date, + transforms: [], + frame(fn) { + // Store the node + const node = Animator.frames.push({ + run: fn + }); + + // Request an animation frame if we don't have one + if (Animator.nextDraw === null) { + Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw); + } + + // Return the node so we can remove it easily + return node; + }, + timeout(fn, delay) { + delay = delay || 0; + + // Work out when the event should fire + const time = Animator.timer().now() + delay; + + // Add the timeout to the end of the queue + const node = Animator.timeouts.push({ + run: fn, + time: time + }); + + // Request another animation frame if we need one + if (Animator.nextDraw === null) { + Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw); + } + return node; + }, + immediate(fn) { + // Add the immediate fn to the end of the queue + const node = Animator.immediates.push(fn); + // Request another animation frame if we need one + if (Animator.nextDraw === null) { + Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw); + } + return node; + }, + cancelFrame(node) { + node != null && Animator.frames.remove(node); + }, + clearTimeout(node) { + node != null && Animator.timeouts.remove(node); + }, + cancelImmediate(node) { + node != null && Animator.immediates.remove(node); + }, + _draw(now) { + // Run all the timeouts we can run, if they are not ready yet, add them + // to the end of the queue immediately! (bad timeouts!!! [sarcasm]) + let nextTimeout = null; + const lastTimeout = Animator.timeouts.last(); + while (nextTimeout = Animator.timeouts.shift()) { + // Run the timeout if its time, or push it to the end + if (now >= nextTimeout.time) { + nextTimeout.run(); + } else { + Animator.timeouts.push(nextTimeout); + } + + // If we hit the last item, we should stop shifting out more items + if (nextTimeout === lastTimeout) break; + } + + // Run all of the animation frames + let nextFrame = null; + const lastFrame = Animator.frames.last(); + while (nextFrame !== lastFrame && (nextFrame = Animator.frames.shift())) { + nextFrame.run(now); + } + let nextImmediate = null; + while (nextImmediate = Animator.immediates.shift()) { + nextImmediate(); + } + + // If we have remaining timeouts or frames, draw until we don't anymore + Animator.nextDraw = Animator.timeouts.first() || Animator.frames.first() ? globals.window.requestAnimationFrame(Animator._draw) : null; + } + }; + + const makeSchedule = function (runnerInfo) { + const start = runnerInfo.start; + const duration = runnerInfo.runner.duration(); + const end = start + duration; + return { + start: start, + duration: duration, + end: end, + runner: runnerInfo.runner + }; + }; + const defaultSource = function () { + const w = globals.window; + return (w.performance || w.Date).now(); + }; + class Timeline extends EventTarget { + // Construct a new timeline on the given element + constructor(timeSource = defaultSource) { + super(); + this._timeSource = timeSource; + + // terminate resets all variables to their initial state + this.terminate(); + } + active() { + return !!this._nextFrame; + } + finish() { + // Go to end and pause + this.time(this.getEndTimeOfTimeline() + 1); + return this.pause(); + } + + // Calculates the end of the timeline + getEndTime() { + const lastRunnerInfo = this.getLastRunnerInfo(); + const lastDuration = lastRunnerInfo ? lastRunnerInfo.runner.duration() : 0; + const lastStartTime = lastRunnerInfo ? lastRunnerInfo.start : this._time; + return lastStartTime + lastDuration; + } + getEndTimeOfTimeline() { + const endTimes = this._runners.map(i => i.start + i.runner.duration()); + return Math.max(0, ...endTimes); + } + getLastRunnerInfo() { + return this.getRunnerInfoById(this._lastRunnerId); + } + getRunnerInfoById(id) { + return this._runners[this._runnerIds.indexOf(id)] || null; + } + pause() { + this._paused = true; + return this._continue(); + } + persist(dtOrForever) { + if (dtOrForever == null) return this._persist; + this._persist = dtOrForever; + return this; + } + play() { + // Now make sure we are not paused and continue the animation + this._paused = false; + return this.updateTime()._continue(); + } + reverse(yes) { + const currentSpeed = this.speed(); + if (yes == null) return this.speed(-currentSpeed); + const positive = Math.abs(currentSpeed); + return this.speed(yes ? -positive : positive); + } + + // schedules a runner on the timeline + schedule(runner, delay, when) { + if (runner == null) { + return this._runners.map(makeSchedule); + } + + // The start time for the next animation can either be given explicitly, + // derived from the current timeline time or it can be relative to the + // last start time to chain animations directly + + let absoluteStartTime = 0; + const endTime = this.getEndTime(); + delay = delay || 0; + + // Work out when to start the animation + if (when == null || when === 'last' || when === 'after') { + // Take the last time and increment + absoluteStartTime = endTime; + } else if (when === 'absolute' || when === 'start') { + absoluteStartTime = delay; + delay = 0; + } else if (when === 'now') { + absoluteStartTime = this._time; + } else if (when === 'relative') { + const runnerInfo = this.getRunnerInfoById(runner.id); + if (runnerInfo) { + absoluteStartTime = runnerInfo.start + delay; + delay = 0; + } + } else if (when === 'with-last') { + const lastRunnerInfo = this.getLastRunnerInfo(); + const lastStartTime = lastRunnerInfo ? lastRunnerInfo.start : this._time; + absoluteStartTime = lastStartTime; + } else { + throw new Error('Invalid value for the "when" parameter'); + } + + // Manage runner + runner.unschedule(); + runner.timeline(this); + const persist = runner.persist(); + const runnerInfo = { + persist: persist === null ? this._persist : persist, + start: absoluteStartTime + delay, + runner + }; + this._lastRunnerId = runner.id; + this._runners.push(runnerInfo); + this._runners.sort((a, b) => a.start - b.start); + this._runnerIds = this._runners.map(info => info.runner.id); + this.updateTime()._continue(); + return this; + } + seek(dt) { + return this.time(this._time + dt); + } + source(fn) { + if (fn == null) return this._timeSource; + this._timeSource = fn; + return this; + } + speed(speed) { + if (speed == null) return this._speed; + this._speed = speed; + return this; + } + stop() { + // Go to start and pause + this.time(0); + return this.pause(); + } + time(time) { + if (time == null) return this._time; + this._time = time; + return this._continue(true); + } + + // Remove the runner from this timeline + unschedule(runner) { + const index = this._runnerIds.indexOf(runner.id); + if (index < 0) return this; + this._runners.splice(index, 1); + this._runnerIds.splice(index, 1); + runner.timeline(null); + return this; + } + + // Makes sure, that after pausing the time doesn't jump + updateTime() { + if (!this.active()) { + this._lastSourceTime = this._timeSource(); + } + return this; + } + + // Checks if we are running and continues the animation + _continue(immediateStep = false) { + Animator.cancelFrame(this._nextFrame); + this._nextFrame = null; + if (immediateStep) return this._stepImmediate(); + if (this._paused) return this; + this._nextFrame = Animator.frame(this._step); + return this; + } + _stepFn(immediateStep = false) { + // Get the time delta from the last time and update the time + const time = this._timeSource(); + let dtSource = time - this._lastSourceTime; + if (immediateStep) dtSource = 0; + const dtTime = this._speed * dtSource + (this._time - this._lastStepTime); + this._lastSourceTime = time; + + // Only update the time if we use the timeSource. + // Otherwise use the current time + if (!immediateStep) { + // Update the time + this._time += dtTime; + this._time = this._time < 0 ? 0 : this._time; + } + this._lastStepTime = this._time; + this.fire('time', this._time); + + // This is for the case that the timeline was seeked so that the time + // is now before the startTime of the runner. That is why we need to set + // the runner to position 0 + + // FIXME: + // However, resetting in insertion order leads to bugs. Considering the case, + // where 2 runners change the same attribute but in different times, + // resetting both of them will lead to the case where the later defined + // runner always wins the reset even if the other runner started earlier + // and therefore should win the attribute battle + // this can be solved by resetting them backwards + for (let k = this._runners.length; k--;) { + // Get and run the current runner and ignore it if its inactive + const runnerInfo = this._runners[k]; + const runner = runnerInfo.runner; + + // Make sure that we give the actual difference + // between runner start time and now + const dtToStart = this._time - runnerInfo.start; + + // Dont run runner if not started yet + // and try to reset it + if (dtToStart <= 0) { + runner.reset(); + } + } + + // Run all of the runners directly + let runnersLeft = false; + for (let i = 0, len = this._runners.length; i < len; i++) { + // Get and run the current runner and ignore it if its inactive + const runnerInfo = this._runners[i]; + const runner = runnerInfo.runner; + let dt = dtTime; + + // Make sure that we give the actual difference + // between runner start time and now + const dtToStart = this._time - runnerInfo.start; + + // Dont run runner if not started yet + if (dtToStart <= 0) { + runnersLeft = true; + continue; + } else if (dtToStart < dt) { + // Adjust dt to make sure that animation is on point + dt = dtToStart; + } + if (!runner.active()) continue; + + // If this runner is still going, signal that we need another animation + // frame, otherwise, remove the completed runner + const finished = runner.step(dt).done; + if (!finished) { + runnersLeft = true; + // continue + } else if (runnerInfo.persist !== true) { + // runner is finished. And runner might get removed + const endTime = runner.duration() - runner.time() + this._time; + if (endTime + runnerInfo.persist < this._time) { + // Delete runner and correct index + runner.unschedule(); + --i; + --len; + } + } + } + + // Basically: we continue when there are runners right from us in time + // when -->, and when runners are left from us when <-- + if (runnersLeft && !(this._speed < 0 && this._time === 0) || this._runnerIds.length && this._speed < 0 && this._time > 0) { + this._continue(); + } else { + this.pause(); + this.fire('finished'); + } + return this; + } + terminate() { + // cleanup memory + + // Store the timing variables + this._startTime = 0; + this._speed = 1.0; + + // Determines how long a runner is hold in memory. Can be a dt or true/false + this._persist = 0; + + // Keep track of the running animations and their starting parameters + this._nextFrame = null; + this._paused = true; + this._runners = []; + this._runnerIds = []; + this._lastRunnerId = -1; + this._time = 0; + this._lastSourceTime = 0; + this._lastStepTime = 0; + + // Make sure that step is always called in class context + this._step = this._stepFn.bind(this, false); + this._stepImmediate = this._stepFn.bind(this, true); + } + } + registerMethods({ + Element: { + timeline: function (timeline) { + if (timeline == null) { + this._timeline = this._timeline || new Timeline(); + return this._timeline; + } else { + this._timeline = timeline; + return this; + } + } + } + }); + + class Runner extends EventTarget { + constructor(options) { + super(); + + // Store a unique id on the runner, so that we can identify it later + this.id = Runner.id++; + + // Ensure a default value + options = options == null ? timeline.duration : options; + + // Ensure that we get a controller + options = typeof options === 'function' ? new Controller(options) : options; + + // Declare all of the variables + this._element = null; + this._timeline = null; + this.done = false; + this._queue = []; + + // Work out the stepper and the duration + this._duration = typeof options === 'number' && options; + this._isDeclarative = options instanceof Controller; + this._stepper = this._isDeclarative ? options : new Ease(); + + // We copy the current values from the timeline because they can change + this._history = {}; + + // Store the state of the runner + this.enabled = true; + this._time = 0; + this._lastTime = 0; + + // At creation, the runner is in reset state + this._reseted = true; + + // Save transforms applied to this runner + this.transforms = new Matrix(); + this.transformId = 1; + + // Looping variables + this._haveReversed = false; + this._reverse = false; + this._loopsDone = 0; + this._swing = false; + this._wait = 0; + this._times = 1; + this._frameId = null; + + // Stores how long a runner is stored after being done + this._persist = this._isDeclarative ? true : null; + } + static sanitise(duration, delay, when) { + // Initialise the default parameters + let times = 1; + let swing = false; + let wait = 0; + duration = duration ?? timeline.duration; + delay = delay ?? timeline.delay; + when = when || 'last'; + + // If we have an object, unpack the values + if (typeof duration === 'object' && !(duration instanceof Stepper)) { + delay = duration.delay ?? delay; + when = duration.when ?? when; + swing = duration.swing || swing; + times = duration.times ?? times; + wait = duration.wait ?? wait; + duration = duration.duration ?? timeline.duration; + } + return { + duration: duration, + delay: delay, + swing: swing, + times: times, + wait: wait, + when: when + }; + } + active(enabled) { + if (enabled == null) return this.enabled; + this.enabled = enabled; + return this; + } + + /* + Private Methods + =============== + Methods that shouldn't be used externally + */ + addTransform(transform) { + this.transforms.lmultiplyO(transform); + return this; + } + after(fn) { + return this.on('finished', fn); + } + animate(duration, delay, when) { + const o = Runner.sanitise(duration, delay, when); + const runner = new Runner(o.duration); + if (this._timeline) runner.timeline(this._timeline); + if (this._element) runner.element(this._element); + return runner.loop(o).schedule(o.delay, o.when); + } + clearTransform() { + this.transforms = new Matrix(); + return this; + } + + // TODO: Keep track of all transformations so that deletion is faster + clearTransformsFromQueue() { + if (!this.done || !this._timeline || !this._timeline._runnerIds.includes(this.id)) { + this._queue = this._queue.filter(item => { + return !item.isTransform; + }); + } + } + delay(delay) { + return this.animate(0, delay); + } + duration() { + return this._times * (this._wait + this._duration) - this._wait; + } + during(fn) { + return this.queue(null, fn); + } + ease(fn) { + this._stepper = new Ease(fn); + return this; + } + /* + Runner Definitions + ================== + These methods help us define the runtime behaviour of the Runner or they + help us make new runners from the current runner + */ + + element(element) { + if (element == null) return this._element; + this._element = element; + element._prepareRunner(); + return this; + } + finish() { + return this.step(Infinity); + } + loop(times, swing, wait) { + // Deal with the user passing in an object + if (typeof times === 'object') { + swing = times.swing; + wait = times.wait; + times = times.times; + } + + // Sanitise the values and store them + this._times = times || Infinity; + this._swing = swing || false; + this._wait = wait || 0; + + // Allow true to be passed + if (this._times === true) { + this._times = Infinity; + } + return this; + } + loops(p) { + const loopDuration = this._duration + this._wait; + if (p == null) { + const loopsDone = Math.floor(this._time / loopDuration); + const relativeTime = this._time - loopsDone * loopDuration; + const position = relativeTime / this._duration; + return Math.min(loopsDone + position, this._times); + } + const whole = Math.floor(p); + const partial = p % 1; + const time = loopDuration * whole + this._duration * partial; + return this.time(time); + } + persist(dtOrForever) { + if (dtOrForever == null) return this._persist; + this._persist = dtOrForever; + return this; + } + position(p) { + // Get all of the variables we need + const x = this._time; + const d = this._duration; + const w = this._wait; + const t = this._times; + const s = this._swing; + const r = this._reverse; + let position; + if (p == null) { + /* + This function converts a time to a position in the range [0, 1] + The full explanation can be found in this desmos demonstration + https://www.desmos.com/calculator/u4fbavgche + The logic is slightly simplified here because we can use booleans + */ + + // Figure out the value without thinking about the start or end time + const f = function (x) { + const swinging = s * Math.floor(x % (2 * (w + d)) / (w + d)); + const backwards = swinging && !r || !swinging && r; + const uncliped = Math.pow(-1, backwards) * (x % (w + d)) / d + backwards; + const clipped = Math.max(Math.min(uncliped, 1), 0); + return clipped; + }; + + // Figure out the value by incorporating the start time + const endTime = t * (w + d) - w; + position = x <= 0 ? Math.round(f(1e-5)) : x < endTime ? f(x) : Math.round(f(endTime - 1e-5)); + return position; + } + + // Work out the loops done and add the position to the loops done + const loopsDone = Math.floor(this.loops()); + const swingForward = s && loopsDone % 2 === 0; + const forwards = swingForward && !r || r && swingForward; + position = loopsDone + (forwards ? p : 1 - p); + return this.loops(position); + } + progress(p) { + if (p == null) { + return Math.min(1, this._time / this.duration()); + } + return this.time(p * this.duration()); + } + + /* + Basic Functionality + =================== + These methods allow us to attach basic functions to the runner directly + */ + queue(initFn, runFn, retargetFn, isTransform) { + this._queue.push({ + initialiser: initFn || noop, + runner: runFn || noop, + retarget: retargetFn, + isTransform: isTransform, + initialised: false, + finished: false + }); + const timeline = this.timeline(); + timeline && this.timeline()._continue(); + return this; + } + reset() { + if (this._reseted) return this; + this.time(0); + this._reseted = true; + return this; + } + reverse(reverse) { + this._reverse = reverse == null ? !this._reverse : reverse; + return this; + } + schedule(timeline, delay, when) { + // The user doesn't need to pass a timeline if we already have one + if (!(timeline instanceof Timeline)) { + when = delay; + delay = timeline; + timeline = this.timeline(); + } + + // If there is no timeline, yell at the user... + if (!timeline) { + throw Error('Runner cannot be scheduled without timeline'); + } + + // Schedule the runner on the timeline provided + timeline.schedule(this, delay, when); + return this; + } + step(dt) { + // If we are inactive, this stepper just gets skipped + if (!this.enabled) return this; + + // Update the time and get the new position + dt = dt == null ? 16 : dt; + this._time += dt; + const position = this.position(); + + // Figure out if we need to run the stepper in this frame + const running = this._lastPosition !== position && this._time >= 0; + this._lastPosition = position; + + // Figure out if we just started + const duration = this.duration(); + const justStarted = this._lastTime <= 0 && this._time > 0; + const justFinished = this._lastTime < duration && this._time >= duration; + this._lastTime = this._time; + if (justStarted) { + this.fire('start', this); + } + + // Work out if the runner is finished set the done flag here so animations + // know, that they are running in the last step (this is good for + // transformations which can be merged) + const declarative = this._isDeclarative; + this.done = !declarative && !justFinished && this._time >= duration; + + // Runner is running. So its not in reset state anymore + this._reseted = false; + let converged = false; + // Call initialise and the run function + if (running || declarative) { + this._initialise(running); + + // clear the transforms on this runner so they dont get added again and again + this.transforms = new Matrix(); + converged = this._run(declarative ? dt : position); + this.fire('step', this); + } + // correct the done flag here + // declarative animations itself know when they converged + this.done = this.done || converged && declarative; + if (justFinished) { + this.fire('finished', this); + } + return this; + } + + /* + Runner animation methods + ======================== + Control how the animation plays + */ + time(time) { + if (time == null) { + return this._time; + } + const dt = time - this._time; + this.step(dt); + return this; + } + timeline(timeline) { + // check explicitly for undefined so we can set the timeline to null + if (typeof timeline === 'undefined') return this._timeline; + this._timeline = timeline; + return this; + } + unschedule() { + const timeline = this.timeline(); + timeline && timeline.unschedule(this); + return this; + } + + // Run each initialise function in the runner if required + _initialise(running) { + // If we aren't running, we shouldn't initialise when not declarative + if (!running && !this._isDeclarative) return; + + // Loop through all of the initialisers + for (let i = 0, len = this._queue.length; i < len; ++i) { + // Get the current initialiser + const current = this._queue[i]; + + // Determine whether we need to initialise + const needsIt = this._isDeclarative || !current.initialised && running; + running = !current.finished; + + // Call the initialiser if we need to + if (needsIt && running) { + current.initialiser.call(this); + current.initialised = true; + } + } + } + + // Save a morpher to the morpher list so that we can retarget it later + _rememberMorpher(method, morpher) { + this._history[method] = { + morpher: morpher, + caller: this._queue[this._queue.length - 1] + }; + + // We have to resume the timeline in case a controller + // is already done without being ever run + // This can happen when e.g. this is done: + // anim = el.animate(new SVG.Spring) + // and later + // anim.move(...) + if (this._isDeclarative) { + const timeline = this.timeline(); + timeline && timeline.play(); + } + } + + // Try to set the target for a morpher if the morpher exists, otherwise + // Run each run function for the position or dt given + _run(positionOrDt) { + // Run all of the _queue directly + let allfinished = true; + for (let i = 0, len = this._queue.length; i < len; ++i) { + // Get the current function to run + const current = this._queue[i]; + + // Run the function if its not finished, we keep track of the finished + // flag for the sake of declarative _queue + const converged = current.runner.call(this, positionOrDt); + current.finished = current.finished || converged === true; + allfinished = allfinished && current.finished; + } + + // We report when all of the constructors are finished + return allfinished; + } + + // do nothing and return false + _tryRetarget(method, target, extra) { + if (this._history[method]) { + // if the last method wasn't even initialised, throw it away + if (!this._history[method].caller.initialised) { + const index = this._queue.indexOf(this._history[method].caller); + this._queue.splice(index, 1); + return false; + } + + // for the case of transformations, we use the special retarget function + // which has access to the outer scope + if (this._history[method].caller.retarget) { + this._history[method].caller.retarget.call(this, target, extra); + // for everything else a simple morpher change is sufficient + } else { + this._history[method].morpher.to(target); + } + this._history[method].caller.finished = false; + const timeline = this.timeline(); + timeline && timeline.play(); + return true; + } + return false; + } + } + Runner.id = 0; + class FakeRunner { + constructor(transforms = new Matrix(), id = -1, done = true) { + this.transforms = transforms; + this.id = id; + this.done = done; + } + clearTransformsFromQueue() {} + } + extend([Runner, FakeRunner], { + mergeWith(runner) { + return new FakeRunner(runner.transforms.lmultiply(this.transforms), runner.id); + } + }); + + // FakeRunner.emptyRunner = new FakeRunner() + + const lmultiply = (last, curr) => last.lmultiplyO(curr); + const getRunnerTransform = runner => runner.transforms; + function mergeTransforms() { + // Find the matrix to apply to the element and apply it + const runners = this._transformationRunners.runners; + const netTransform = runners.map(getRunnerTransform).reduce(lmultiply, new Matrix()); + this.transform(netTransform); + this._transformationRunners.merge(); + if (this._transformationRunners.length() === 1) { + this._frameId = null; + } + } + class RunnerArray { + constructor() { + this.runners = []; + this.ids = []; + } + add(runner) { + if (this.runners.includes(runner)) return; + const id = runner.id + 1; + this.runners.push(runner); + this.ids.push(id); + return this; + } + clearBefore(id) { + const deleteCnt = this.ids.indexOf(id + 1) || 1; + this.ids.splice(0, deleteCnt, 0); + this.runners.splice(0, deleteCnt, new FakeRunner()).forEach(r => r.clearTransformsFromQueue()); + return this; + } + edit(id, newRunner) { + const index = this.ids.indexOf(id + 1); + this.ids.splice(index, 1, id + 1); + this.runners.splice(index, 1, newRunner); + return this; + } + getByID(id) { + return this.runners[this.ids.indexOf(id + 1)]; + } + length() { + return this.ids.length; + } + merge() { + let lastRunner = null; + for (let i = 0; i < this.runners.length; ++i) { + const runner = this.runners[i]; + const condition = lastRunner && runner.done && lastRunner.done && ( + // don't merge runner when persisted on timeline + !runner._timeline || !runner._timeline._runnerIds.includes(runner.id)) && (!lastRunner._timeline || !lastRunner._timeline._runnerIds.includes(lastRunner.id)); + if (condition) { + // the +1 happens in the function + this.remove(runner.id); + const newRunner = runner.mergeWith(lastRunner); + this.edit(lastRunner.id, newRunner); + lastRunner = newRunner; + --i; + } else { + lastRunner = runner; + } + } + return this; + } + remove(id) { + const index = this.ids.indexOf(id + 1); + this.ids.splice(index, 1); + this.runners.splice(index, 1); + return this; + } + } + registerMethods({ + Element: { + animate(duration, delay, when) { + const o = Runner.sanitise(duration, delay, when); + const timeline = this.timeline(); + return new Runner(o.duration).loop(o).element(this).timeline(timeline.play()).schedule(o.delay, o.when); + }, + delay(by, when) { + return this.animate(0, by, when); + }, + // this function searches for all runners on the element and deletes the ones + // which run before the current one. This is because absolute transformations + // overwrite anything anyway so there is no need to waste time computing + // other runners + _clearTransformRunnersBefore(currentRunner) { + this._transformationRunners.clearBefore(currentRunner.id); + }, + _currentTransform(current) { + return this._transformationRunners.runners + // we need the equal sign here to make sure, that also transformations + // on the same runner which execute before the current transformation are + // taken into account + .filter(runner => runner.id <= current.id).map(getRunnerTransform).reduce(lmultiply, new Matrix()); + }, + _addRunner(runner) { + this._transformationRunners.add(runner); + + // Make sure that the runner merge is executed at the very end of + // all Animator functions. That is why we use immediate here to execute + // the merge right after all frames are run + Animator.cancelImmediate(this._frameId); + this._frameId = Animator.immediate(mergeTransforms.bind(this)); + }, + _prepareRunner() { + if (this._frameId == null) { + this._transformationRunners = new RunnerArray().add(new FakeRunner(new Matrix(this))); + } + } + } + }); + + // Will output the elements from array A that are not in the array B + const difference = (a, b) => a.filter(x => !b.includes(x)); + extend(Runner, { + attr(a, v) { + return this.styleAttr('attr', a, v); + }, + // Add animatable styles + css(s, v) { + return this.styleAttr('css', s, v); + }, + styleAttr(type, nameOrAttrs, val) { + if (typeof nameOrAttrs === 'string') { + return this.styleAttr(type, { + [nameOrAttrs]: val + }); + } + let attrs = nameOrAttrs; + if (this._tryRetarget(type, attrs)) return this; + let morpher = new Morphable(this._stepper).to(attrs); + let keys = Object.keys(attrs); + this.queue(function () { + morpher = morpher.from(this.element()[type](keys)); + }, function (pos) { + this.element()[type](morpher.at(pos).valueOf()); + return morpher.done(); + }, function (newToAttrs) { + // Check if any new keys were added + const newKeys = Object.keys(newToAttrs); + const differences = difference(newKeys, keys); + + // If their are new keys, initialize them and add them to morpher + if (differences.length) { + // Get the values + const addedFromAttrs = this.element()[type](differences); + + // Get the already initialized values + const oldFromAttrs = new ObjectBag(morpher.from()).valueOf(); + + // Merge old and new + Object.assign(oldFromAttrs, addedFromAttrs); + morpher.from(oldFromAttrs); + } + + // Get the object from the morpher + const oldToAttrs = new ObjectBag(morpher.to()).valueOf(); + + // Merge in new attributes + Object.assign(oldToAttrs, newToAttrs); + + // Change morpher target + morpher.to(oldToAttrs); + + // Make sure that we save the work we did so we don't need it to do again + keys = newKeys; + attrs = newToAttrs; + }); + this._rememberMorpher(type, morpher); + return this; + }, + zoom(level, point) { + if (this._tryRetarget('zoom', level, point)) return this; + let morpher = new Morphable(this._stepper).to(new SVGNumber(level)); + this.queue(function () { + morpher = morpher.from(this.element().zoom()); + }, function (pos) { + this.element().zoom(morpher.at(pos), point); + return morpher.done(); + }, function (newLevel, newPoint) { + point = newPoint; + morpher.to(newLevel); + }); + this._rememberMorpher('zoom', morpher); + return this; + }, + /** + ** absolute transformations + **/ + + // + // M v -----|-----(D M v = F v)------|-----> T v + // + // 1. define the final state (T) and decompose it (once) + // t = [tx, ty, the, lam, sy, sx] + // 2. on every frame: pull the current state of all previous transforms + // (M - m can change) + // and then write this as m = [tx0, ty0, the0, lam0, sy0, sx0] + // 3. Find the interpolated matrix F(pos) = m + pos * (t - m) + // - Note F(0) = M + // - Note F(1) = T + // 4. Now you get the delta matrix as a result: D = F * inv(M) + + transform(transforms, relative, affine) { + // If we have a declarative function, we should retarget it if possible + relative = transforms.relative || relative; + if (this._isDeclarative && !relative && this._tryRetarget('transform', transforms)) { + return this; + } + + // Parse the parameters + const isMatrix = Matrix.isMatrixLike(transforms); + affine = transforms.affine != null ? transforms.affine : affine != null ? affine : !isMatrix; + + // Create a morpher and set its type + const morpher = new Morphable(this._stepper).type(affine ? TransformBag : Matrix); + let origin; + let element; + let current; + let currentAngle; + let startTransform; + function setup() { + // make sure element and origin is defined + element = element || this.element(); + origin = origin || getOrigin(transforms, element); + startTransform = new Matrix(relative ? undefined : element); + + // add the runner to the element so it can merge transformations + element._addRunner(this); + + // Deactivate all transforms that have run so far if we are absolute + if (!relative) { + element._clearTransformRunnersBefore(this); + } + } + function run(pos) { + // clear all other transforms before this in case something is saved + // on this runner. We are absolute. We dont need these! + if (!relative) this.clearTransform(); + const { + x, + y + } = new Point(origin).transform(element._currentTransform(this)); + let target = new Matrix({ + ...transforms, + origin: [x, y] + }); + let start = this._isDeclarative && current ? current : startTransform; + if (affine) { + target = target.decompose(x, y); + start = start.decompose(x, y); + + // Get the current and target angle as it was set + const rTarget = target.rotate; + const rCurrent = start.rotate; + + // Figure out the shortest path to rotate directly + const possibilities = [rTarget - 360, rTarget, rTarget + 360]; + const distances = possibilities.map(a => Math.abs(a - rCurrent)); + const shortest = Math.min(...distances); + const index = distances.indexOf(shortest); + target.rotate = possibilities[index]; + } + if (relative) { + // we have to be careful here not to overwrite the rotation + // with the rotate method of Matrix + if (!isMatrix) { + target.rotate = transforms.rotate || 0; + } + if (this._isDeclarative && currentAngle) { + start.rotate = currentAngle; + } + } + morpher.from(start); + morpher.to(target); + const affineParameters = morpher.at(pos); + currentAngle = affineParameters.rotate; + current = new Matrix(affineParameters); + this.addTransform(current); + element._addRunner(this); + return morpher.done(); + } + function retarget(newTransforms) { + // only get a new origin if it changed since the last call + if ((newTransforms.origin || 'center').toString() !== (transforms.origin || 'center').toString()) { + origin = getOrigin(newTransforms, element); + } + + // overwrite the old transformations with the new ones + transforms = { + ...newTransforms, + origin + }; + } + this.queue(setup, run, retarget, true); + this._isDeclarative && this._rememberMorpher('transform', morpher); + return this; + }, + // Animatable x-axis + x(x) { + return this._queueNumber('x', x); + }, + // Animatable y-axis + y(y) { + return this._queueNumber('y', y); + }, + ax(x) { + return this._queueNumber('ax', x); + }, + ay(y) { + return this._queueNumber('ay', y); + }, + dx(x = 0) { + return this._queueNumberDelta('x', x); + }, + dy(y = 0) { + return this._queueNumberDelta('y', y); + }, + dmove(x, y) { + return this.dx(x).dy(y); + }, + _queueNumberDelta(method, to) { + to = new SVGNumber(to); + + // Try to change the target if we have this method already registered + if (this._tryRetarget(method, to)) return this; + + // Make a morpher and queue the animation + const morpher = new Morphable(this._stepper).to(to); + let from = null; + this.queue(function () { + from = this.element()[method](); + morpher.from(from); + morpher.to(from + to); + }, function (pos) { + this.element()[method](morpher.at(pos)); + return morpher.done(); + }, function (newTo) { + morpher.to(from + new SVGNumber(newTo)); + }); + + // Register the morpher so that if it is changed again, we can retarget it + this._rememberMorpher(method, morpher); + return this; + }, + _queueObject(method, to) { + // Try to change the target if we have this method already registered + if (this._tryRetarget(method, to)) return this; + + // Make a morpher and queue the animation + const morpher = new Morphable(this._stepper).to(to); + this.queue(function () { + morpher.from(this.element()[method]()); + }, function (pos) { + this.element()[method](morpher.at(pos)); + return morpher.done(); + }); + + // Register the morpher so that if it is changed again, we can retarget it + this._rememberMorpher(method, morpher); + return this; + }, + _queueNumber(method, value) { + return this._queueObject(method, new SVGNumber(value)); + }, + // Animatable center x-axis + cx(x) { + return this._queueNumber('cx', x); + }, + // Animatable center y-axis + cy(y) { + return this._queueNumber('cy', y); + }, + // Add animatable move + move(x, y) { + return this.x(x).y(y); + }, + amove(x, y) { + return this.ax(x).ay(y); + }, + // Add animatable center + center(x, y) { + return this.cx(x).cy(y); + }, + // Add animatable size + size(width, height) { + // animate bbox based size for all other elements + let box; + if (!width || !height) { + box = this._element.bbox(); + } + if (!width) { + width = box.width / box.height * height; + } + if (!height) { + height = box.height / box.width * width; + } + return this.width(width).height(height); + }, + // Add animatable width + width(width) { + return this._queueNumber('width', width); + }, + // Add animatable height + height(height) { + return this._queueNumber('height', height); + }, + // Add animatable plot + plot(a, b, c, d) { + // Lines can be plotted with 4 arguments + if (arguments.length === 4) { + return this.plot([a, b, c, d]); + } + if (this._tryRetarget('plot', a)) return this; + const morpher = new Morphable(this._stepper).type(this._element.MorphArray).to(a); + this.queue(function () { + morpher.from(this._element.array()); + }, function (pos) { + this._element.plot(morpher.at(pos)); + return morpher.done(); + }); + this._rememberMorpher('plot', morpher); + return this; + }, + // Add leading method + leading(value) { + return this._queueNumber('leading', value); + }, + // Add animatable viewbox + viewbox(x, y, width, height) { + return this._queueObject('viewbox', new Box(x, y, width, height)); + }, + update(o) { + if (typeof o !== 'object') { + return this.update({ + offset: arguments[0], + color: arguments[1], + opacity: arguments[2] + }); + } + if (o.opacity != null) this.attr('stop-opacity', o.opacity); + if (o.color != null) this.attr('stop-color', o.color); + if (o.offset != null) this.attr('offset', o.offset); + return this; + } + }); + extend(Runner, { + rx, + ry, + from, + to + }); + register(Runner, 'Runner'); + + class Svg extends Container { + constructor(node, attrs = node) { + super(nodeOrNew('svg', node), attrs); + this.namespace(); + } + + // Creates and returns defs element + defs() { + if (!this.isRoot()) return this.root().defs(); + return adopt(this.node.querySelector('defs')) || this.put(new Defs()); + } + isRoot() { + return !this.node.parentNode || !(this.node.parentNode instanceof globals.window.SVGElement) && this.node.parentNode.nodeName !== '#document-fragment'; + } + + // Add namespaces + namespace() { + if (!this.isRoot()) return this.root().namespace(); + return this.attr({ + xmlns: svg, + version: '1.1' + }).attr('xmlns:xlink', xlink, xmlns); + } + removeNamespace() { + return this.attr({ + xmlns: null, + version: null + }).attr('xmlns:xlink', null, xmlns).attr('xmlns:svgjs', null, xmlns); + } + + // Check if this is a root svg + // If not, call root() from this element + root() { + if (this.isRoot()) return this; + return super.root(); + } + } + registerMethods({ + Container: { + // Create nested svg document + nested: wrapWithAttrCheck(function () { + return this.put(new Svg()); + }) + } + }); + register(Svg, 'Svg', true); + + class Symbol extends Container { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('symbol', node), attrs); + } + } + registerMethods({ + Container: { + symbol: wrapWithAttrCheck(function () { + return this.put(new Symbol()); + }) + } + }); + register(Symbol, 'Symbol'); + + // Create plain text node + function plain(text) { + // clear if build mode is disabled + if (this._build === false) { + this.clear(); + } + + // create text node + this.node.appendChild(globals.document.createTextNode(text)); + return this; + } + + // Get length of text element + function length() { + return this.node.getComputedTextLength(); + } + + // Move over x-axis + // Text is moved by its bounding box + // text-anchor does NOT matter + function x$1(x, box = this.bbox()) { + if (x == null) { + return box.x; + } + return this.attr('x', this.attr('x') + x - box.x); + } + + // Move over y-axis + function y$1(y, box = this.bbox()) { + if (y == null) { + return box.y; + } + return this.attr('y', this.attr('y') + y - box.y); + } + function move$1(x, y, box = this.bbox()) { + return this.x(x, box).y(y, box); + } + + // Move center over x-axis + function cx(x, box = this.bbox()) { + if (x == null) { + return box.cx; + } + return this.attr('x', this.attr('x') + x - box.cx); + } + + // Move center over y-axis + function cy(y, box = this.bbox()) { + if (y == null) { + return box.cy; + } + return this.attr('y', this.attr('y') + y - box.cy); + } + function center(x, y, box = this.bbox()) { + return this.cx(x, box).cy(y, box); + } + function ax(x) { + return this.attr('x', x); + } + function ay(y) { + return this.attr('y', y); + } + function amove(x, y) { + return this.ax(x).ay(y); + } + + // Enable / disable build mode + function build(build) { + this._build = !!build; + return this; + } + + var textable = { + __proto__: null, + amove: amove, + ax: ax, + ay: ay, + build: build, + center: center, + cx: cx, + cy: cy, + length: length, + move: move$1, + plain: plain, + x: x$1, + y: y$1 + }; + + class Text extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('text', node), attrs); + this.dom.leading = this.dom.leading ?? new SVGNumber(1.3); // store leading value for rebuilding + this._rebuild = true; // enable automatic updating of dy values + this._build = false; // disable build mode for adding multiple lines + } + + // Set / get leading + leading(value) { + // act as getter + if (value == null) { + return this.dom.leading; + } + + // act as setter + this.dom.leading = new SVGNumber(value); + return this.rebuild(); + } + + // Rebuild appearance type + rebuild(rebuild) { + // store new rebuild flag if given + if (typeof rebuild === 'boolean') { + this._rebuild = rebuild; + } + + // define position of all lines + if (this._rebuild) { + const self = this; + let blankLineOffset = 0; + const leading = this.dom.leading; + this.each(function (i) { + if (isDescriptive(this.node)) return; + const fontSize = globals.window.getComputedStyle(this.node).getPropertyValue('font-size'); + const dy = leading * new SVGNumber(fontSize); + if (this.dom.newLined) { + this.attr('x', self.attr('x')); + if (this.text() === '\n') { + blankLineOffset += dy; + } else { + this.attr('dy', i ? dy + blankLineOffset : 0); + blankLineOffset = 0; + } + } + }); + this.fire('rebuild'); + } + return this; + } + + // overwrite method from parent to set data properly + setData(o) { + this.dom = o; + this.dom.leading = new SVGNumber(o.leading || 1.3); + return this; + } + writeDataToDom() { + writeDataToDom(this, this.dom, { + leading: 1.3 + }); + return this; + } + + // Set the text content + text(text) { + // act as getter + if (text === undefined) { + const children = this.node.childNodes; + let firstLine = 0; + text = ''; + for (let i = 0, len = children.length; i < len; ++i) { + // skip textPaths - they are no lines + if (children[i].nodeName === 'textPath' || isDescriptive(children[i])) { + if (i === 0) firstLine = i + 1; + continue; + } + + // add newline if its not the first child and newLined is set to true + if (i !== firstLine && children[i].nodeType !== 3 && adopt(children[i]).dom.newLined === true) { + text += '\n'; + } + + // add content of this node + text += children[i].textContent; + } + return text; + } + + // remove existing content + this.clear().build(true); + if (typeof text === 'function') { + // call block + text.call(this, this); + } else { + // store text and make sure text is not blank + text = (text + '').split('\n'); + + // build new lines + for (let j = 0, jl = text.length; j < jl; j++) { + this.newLine(text[j]); + } + } + + // disable build mode and rebuild lines + return this.build(false).rebuild(); + } + } + extend(Text, textable); + registerMethods({ + Container: { + // Create text element + text: wrapWithAttrCheck(function (text = '') { + return this.put(new Text()).text(text); + }), + // Create plain text element + plain: wrapWithAttrCheck(function (text = '') { + return this.put(new Text()).plain(text); + }) + } + }); + register(Text, 'Text'); + + class Tspan extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('tspan', node), attrs); + this._build = false; // disable build mode for adding multiple lines + } + + // Shortcut dx + dx(dx) { + return this.attr('dx', dx); + } + + // Shortcut dy + dy(dy) { + return this.attr('dy', dy); + } + + // Create new line + newLine() { + // mark new line + this.dom.newLined = true; + + // fetch parent + const text = this.parent(); + + // early return in case we are not in a text element + if (!(text instanceof Text)) { + return this; + } + const i = text.index(this); + const fontSize = globals.window.getComputedStyle(this.node).getPropertyValue('font-size'); + const dy = text.dom.leading * new SVGNumber(fontSize); + + // apply new position + return this.dy(i ? dy : 0).attr('x', text.x()); + } + + // Set text content + text(text) { + if (text == null) return this.node.textContent + (this.dom.newLined ? '\n' : ''); + if (typeof text === 'function') { + this.clear().build(true); + text.call(this, this); + this.build(false); + } else { + this.plain(text); + } + return this; + } + } + extend(Tspan, textable); + registerMethods({ + Tspan: { + tspan: wrapWithAttrCheck(function (text = '') { + const tspan = new Tspan(); + + // clear if build mode is disabled + if (!this._build) { + this.clear(); + } + + // add new tspan + return this.put(tspan).text(text); + }) + }, + Text: { + newLine: function (text = '') { + return this.tspan(text).newLine(); + } + } + }); + register(Tspan, 'Tspan'); + + class Circle extends Shape { + constructor(node, attrs = node) { + super(nodeOrNew('circle', node), attrs); + } + radius(r) { + return this.attr('r', r); + } + + // Radius x value + rx(rx) { + return this.attr('r', rx); + } + + // Alias radius x value + ry(ry) { + return this.rx(ry); + } + size(size) { + return this.radius(new SVGNumber(size).divide(2)); + } + } + extend(Circle, { + x: x$3, + y: y$3, + cx: cx$1, + cy: cy$1, + width: width$2, + height: height$2 + }); + registerMethods({ + Container: { + // Create circle element + circle: wrapWithAttrCheck(function (size = 0) { + return this.put(new Circle()).size(size).move(0, 0); + }) + } + }); + register(Circle, 'Circle'); + + class ClipPath extends Container { + constructor(node, attrs = node) { + super(nodeOrNew('clipPath', node), attrs); + } + + // Unclip all clipped elements and remove itself + remove() { + // unclip all targets + this.targets().forEach(function (el) { + el.unclip(); + }); + + // remove clipPath from parent + return super.remove(); + } + targets() { + return baseFind('svg [clip-path*=' + this.id() + ']'); + } + } + registerMethods({ + Container: { + // Create clipping element + clip: wrapWithAttrCheck(function () { + return this.defs().put(new ClipPath()); + }) + }, + Element: { + // Distribute clipPath to svg element + clipper() { + return this.reference('clip-path'); + }, + clipWith(element) { + // use given clip or create a new one + const clipper = element instanceof ClipPath ? element : this.parent().clip().add(element); + + // apply mask + return this.attr('clip-path', 'url(#' + clipper.id() + ')'); + }, + // Unclip element + unclip() { + return this.attr('clip-path', null); + } + } + }); + register(ClipPath, 'ClipPath'); + + class ForeignObject extends Element { + constructor(node, attrs = node) { + super(nodeOrNew('foreignObject', node), attrs); + } + } + registerMethods({ + Container: { + foreignObject: wrapWithAttrCheck(function (width, height) { + return this.put(new ForeignObject()).size(width, height); + }) + } + }); + register(ForeignObject, 'ForeignObject'); + + function dmove(dx, dy) { + this.children().forEach(child => { + let bbox; + + // We have to wrap this for elements that dont have a bbox + // e.g. title and other descriptive elements + try { + // Get the childs bbox + // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1905039 + // Because bbox for nested svgs returns the contents bbox in the coordinate space of the svg itself (weird!), we cant use bbox for svgs + // Therefore we have to use getBoundingClientRect. But THAT is broken (as explained in the bug). + // Funnily enough the broken behavior would work for us but that breaks it in chrome + // So we have to replicate the broken behavior of FF by just reading the attributes of the svg itself + bbox = child.node instanceof getWindow().SVGSVGElement ? new Box(child.attr(['x', 'y', 'width', 'height'])) : child.bbox(); + } catch (e) { + return; + } + + // Get childs matrix + const m = new Matrix(child); + // Translate childs matrix by amount and + // transform it back into parents space + const matrix = m.translate(dx, dy).transform(m.inverse()); + // Calculate new x and y from old box + const p = new Point(bbox.x, bbox.y).transform(matrix); + // Move element + child.move(p.x, p.y); + }); + return this; + } + function dx(dx) { + return this.dmove(dx, 0); + } + function dy(dy) { + return this.dmove(0, dy); + } + function height(height, box = this.bbox()) { + if (height == null) return box.height; + return this.size(box.width, height, box); + } + function move(x = 0, y = 0, box = this.bbox()) { + const dx = x - box.x; + const dy = y - box.y; + return this.dmove(dx, dy); + } + function size(width, height, box = this.bbox()) { + const p = proportionalSize(this, width, height, box); + const scaleX = p.width / box.width; + const scaleY = p.height / box.height; + this.children().forEach(child => { + const o = new Point(box).transform(new Matrix(child).inverse()); + child.scale(scaleX, scaleY, o.x, o.y); + }); + return this; + } + function width(width, box = this.bbox()) { + if (width == null) return box.width; + return this.size(width, box.height, box); + } + function x(x, box = this.bbox()) { + if (x == null) return box.x; + return this.move(x, box.y, box); + } + function y(y, box = this.bbox()) { + if (y == null) return box.y; + return this.move(box.x, y, box); + } + + var containerGeometry = { + __proto__: null, + dmove: dmove, + dx: dx, + dy: dy, + height: height, + move: move, + size: size, + width: width, + x: x, + y: y + }; + + class G extends Container { + constructor(node, attrs = node) { + super(nodeOrNew('g', node), attrs); + } + } + extend(G, containerGeometry); + registerMethods({ + Container: { + // Create a group element + group: wrapWithAttrCheck(function () { + return this.put(new G()); + }) + } + }); + register(G, 'G'); + + class A extends Container { + constructor(node, attrs = node) { + super(nodeOrNew('a', node), attrs); + } + + // Link target attribute + target(target) { + return this.attr('target', target); + } + + // Link url + to(url) { + return this.attr('href', url, xlink); + } + } + extend(A, containerGeometry); + registerMethods({ + Container: { + // Create a hyperlink element + link: wrapWithAttrCheck(function (url) { + return this.put(new A()).to(url); + }) + }, + Element: { + unlink() { + const link = this.linker(); + if (!link) return this; + const parent = link.parent(); + if (!parent) { + return this.remove(); + } + const index = parent.index(link); + parent.add(this, index); + link.remove(); + return this; + }, + linkTo(url) { + // reuse old link if possible + let link = this.linker(); + if (!link) { + link = new A(); + this.wrap(link); + } + if (typeof url === 'function') { + url.call(link, link); + } else { + link.to(url); + } + return this; + }, + linker() { + const link = this.parent(); + if (link && link.node.nodeName.toLowerCase() === 'a') { + return link; + } + return null; + } + } + }); + register(A, 'A'); + + class Mask extends Container { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('mask', node), attrs); + } + + // Unmask all masked elements and remove itself + remove() { + // unmask all targets + this.targets().forEach(function (el) { + el.unmask(); + }); + + // remove mask from parent + return super.remove(); + } + targets() { + return baseFind('svg [mask*=' + this.id() + ']'); + } + } + registerMethods({ + Container: { + mask: wrapWithAttrCheck(function () { + return this.defs().put(new Mask()); + }) + }, + Element: { + // Distribute mask to svg element + masker() { + return this.reference('mask'); + }, + maskWith(element) { + // use given mask or create a new one + const masker = element instanceof Mask ? element : this.parent().mask().add(element); + + // apply mask + return this.attr('mask', 'url(#' + masker.id() + ')'); + }, + // Unmask element + unmask() { + return this.attr('mask', null); + } + } + }); + register(Mask, 'Mask'); + + class Stop extends Element { + constructor(node, attrs = node) { + super(nodeOrNew('stop', node), attrs); + } + + // add color stops + update(o) { + if (typeof o === 'number' || o instanceof SVGNumber) { + o = { + offset: arguments[0], + color: arguments[1], + opacity: arguments[2] + }; + } + + // set attributes + if (o.opacity != null) this.attr('stop-opacity', o.opacity); + if (o.color != null) this.attr('stop-color', o.color); + if (o.offset != null) this.attr('offset', new SVGNumber(o.offset)); + return this; + } + } + registerMethods({ + Gradient: { + // Add a color stop + stop: function (offset, color, opacity) { + return this.put(new Stop()).update(offset, color, opacity); + } + } + }); + register(Stop, 'Stop'); + + function cssRule(selector, rule) { + if (!selector) return ''; + if (!rule) return selector; + let ret = selector + '{'; + for (const i in rule) { + ret += unCamelCase(i) + ':' + rule[i] + ';'; + } + ret += '}'; + return ret; + } + class Style extends Element { + constructor(node, attrs = node) { + super(nodeOrNew('style', node), attrs); + } + addText(w = '') { + this.node.textContent += w; + return this; + } + font(name, src, params = {}) { + return this.rule('@font-face', { + fontFamily: name, + src: src, + ...params + }); + } + rule(selector, obj) { + return this.addText(cssRule(selector, obj)); + } + } + registerMethods('Dom', { + style(selector, obj) { + return this.put(new Style()).rule(selector, obj); + }, + fontface(name, src, params) { + return this.put(new Style()).font(name, src, params); + } + }); + register(Style, 'Style'); + + class TextPath extends Text { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('textPath', node), attrs); + } + + // return the array of the path track element + array() { + const track = this.track(); + return track ? track.array() : null; + } + + // Plot path if any + plot(d) { + const track = this.track(); + let pathArray = null; + if (track) { + pathArray = track.plot(d); + } + return d == null ? pathArray : this; + } + + // Get the path element + track() { + return this.reference('href'); + } + } + registerMethods({ + Container: { + textPath: wrapWithAttrCheck(function (text, path) { + // Convert text to instance if needed + if (!(text instanceof Text)) { + text = this.text(text); + } + return text.path(path); + }) + }, + Text: { + // Create path for text to run on + path: wrapWithAttrCheck(function (track, importNodes = true) { + const textPath = new TextPath(); + + // if track is a path, reuse it + if (!(track instanceof Path)) { + // create path element + track = this.defs().path(track); + } + + // link textPath to path and add content + textPath.attr('href', '#' + track, xlink); + + // Transplant all nodes from text to textPath + let node; + if (importNodes) { + while (node = this.node.firstChild) { + textPath.node.appendChild(node); + } + } + + // add textPath element as child node and return textPath + return this.put(textPath); + }), + // Get the textPath children + textPath() { + return this.findOne('textPath'); + } + }, + Path: { + // creates a textPath from this path + text: wrapWithAttrCheck(function (text) { + // Convert text to instance if needed + if (!(text instanceof Text)) { + text = new Text().addTo(this.parent()).text(text); + } + + // Create textPath from text and path and return + return text.path(this); + }), + targets() { + return baseFind('svg textPath').filter(node => { + return (node.attr('href') || '').includes(this.id()); + }); + + // Does not work in IE11. Use when IE support is dropped + // return baseFind('svg textPath[*|href*=' + this.id() + ']') + } + } + }); + TextPath.prototype.MorphArray = PathArray; + register(TextPath, 'TextPath'); + + class Use extends Shape { + constructor(node, attrs = node) { + super(nodeOrNew('use', node), attrs); + } + + // Use element as a reference + use(element, file) { + // Set lined element + return this.attr('href', (file || '') + '#' + element, xlink); + } + } + registerMethods({ + Container: { + // Create a use element + use: wrapWithAttrCheck(function (element, file) { + return this.put(new Use()).use(element, file); + }) + } + }); + register(Use, 'Use'); + + /* Optional Modules */ + const SVG$1 = makeInstance; + extend([Svg, Symbol, Image, Pattern, Marker], getMethodsFor('viewbox')); + extend([Line, Polyline, Polygon, Path], getMethodsFor('marker')); + extend(Text, getMethodsFor('Text')); + extend(Path, getMethodsFor('Path')); + extend(Defs, getMethodsFor('Defs')); + extend([Text, Tspan], getMethodsFor('Tspan')); + extend([Rect, Ellipse, Gradient, Runner], getMethodsFor('radius')); + extend(EventTarget, getMethodsFor('EventTarget')); + extend(Dom, getMethodsFor('Dom')); + extend(Element, getMethodsFor('Element')); + extend(Shape, getMethodsFor('Shape')); + extend([Container, Fragment], getMethodsFor('Container')); + extend(Gradient, getMethodsFor('Gradient')); + extend(Runner, getMethodsFor('Runner')); + List.extend(getMethodNames()); + registerMorphableType([SVGNumber, Color, Box, Matrix, SVGArray, PointArray, PathArray, Point]); + makeMorphable(); + + var svgMembers = { + __proto__: null, + A: A, + Animator: Animator, + Array: SVGArray, + Box: Box, + Circle: Circle, + ClipPath: ClipPath, + Color: Color, + Container: Container, + Controller: Controller, + Defs: Defs, + Dom: Dom, + Ease: Ease, + Element: Element, + Ellipse: Ellipse, + EventTarget: EventTarget, + ForeignObject: ForeignObject, + Fragment: Fragment, + G: G, + Gradient: Gradient, + Image: Image, + Line: Line, + List: List, + Marker: Marker, + Mask: Mask, + Matrix: Matrix, + Morphable: Morphable, + NonMorphable: NonMorphable, + Number: SVGNumber, + ObjectBag: ObjectBag, + PID: PID, + Path: Path, + PathArray: PathArray, + Pattern: Pattern, + Point: Point, + PointArray: PointArray, + Polygon: Polygon, + Polyline: Polyline, + Queue: Queue, + Rect: Rect, + Runner: Runner, + SVG: SVG$1, + Shape: Shape, + Spring: Spring, + Stop: Stop, + Style: Style, + Svg: Svg, + Symbol: Symbol, + Text: Text, + TextPath: TextPath, + Timeline: Timeline, + TransformBag: TransformBag, + Tspan: Tspan, + Use: Use, + adopt: adopt, + assignNewId: assignNewId, + clearEvents: clearEvents, + create: create, + defaults: defaults, + dispatch: dispatch, + easing: easing, + eid: eid, + extend: extend, + find: baseFind, + getClass: getClass, + getEventTarget: getEventTarget, + getEvents: getEvents, + getWindow: getWindow, + makeInstance: makeInstance, + makeMorphable: makeMorphable, + mockAdopt: mockAdopt, + namespaces: namespaces, + nodeOrNew: nodeOrNew, + off: off, + on: on, + parser: parser, + regex: regex, + register: register, + registerMorphableType: registerMorphableType, + registerWindow: registerWindow, + restoreWindow: restoreWindow, + root: root, + saveWindow: saveWindow, + utils: utils, + windowEvents: windowEvents, + withWindow: withWindow, + wrapWithAttrCheck: wrapWithAttrCheck + }; + + // The main wrapping element + function SVG(element, isHTML) { + return makeInstance(element, isHTML); + } + Object.assign(SVG, svgMembers); + + return SVG; + +})(); +//# sourceMappingURL=svg.js.map diff --git a/node_modules/@svgdotjs/svg.js/dist/svg.js.map b/node_modules/@svgdotjs/svg.js/dist/svg.js.map new file mode 100644 index 0000000..04c43a2 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/dist/svg.js.map @@ -0,0 +1 @@ +{"version":3,"file":"svg.js","sources":["../src/utils/methods.js","../src/utils/utils.js","../src/modules/core/namespaces.js","../src/utils/window.js","../src/types/Base.js","../src/utils/adopter.js","../src/modules/optional/arrange.js","../src/modules/core/regex.js","../src/modules/optional/class.js","../src/modules/optional/css.js","../src/modules/optional/data.js","../src/modules/optional/memory.js","../src/types/Color.js","../src/types/Point.js","../src/types/Matrix.js","../src/modules/core/parser.js","../src/types/Box.js","../src/types/List.js","../src/modules/core/selector.js","../src/modules/core/event.js","../src/types/EventTarget.js","../src/modules/core/defaults.js","../src/types/SVGArray.js","../src/types/SVGNumber.js","../src/modules/core/attr.js","../src/elements/Dom.js","../src/elements/Element.js","../src/modules/optional/sugar.js","../src/modules/optional/transform.js","../src/elements/Container.js","../src/elements/Defs.js","../src/elements/Shape.js","../src/modules/core/circled.js","../src/elements/Ellipse.js","../src/elements/Fragment.js","../src/modules/core/gradiented.js","../src/elements/Gradient.js","../src/elements/Pattern.js","../src/elements/Image.js","../src/types/PointArray.js","../src/modules/core/pointed.js","../src/elements/Line.js","../src/elements/Marker.js","../src/animation/Controller.js","../src/utils/pathParser.js","../src/types/PathArray.js","../src/animation/Morphable.js","../src/elements/Path.js","../src/modules/core/poly.js","../src/elements/Polygon.js","../src/elements/Polyline.js","../src/elements/Rect.js","../src/animation/Queue.js","../src/animation/Animator.js","../src/animation/Timeline.js","../src/animation/Runner.js","../src/elements/Svg.js","../src/elements/Symbol.js","../src/modules/core/textable.js","../src/elements/Text.js","../src/elements/Tspan.js","../src/elements/Circle.js","../src/elements/ClipPath.js","../src/elements/ForeignObject.js","../src/modules/core/containerGeometry.js","../src/elements/G.js","../src/elements/A.js","../src/elements/Mask.js","../src/elements/Stop.js","../src/elements/Style.js","../src/elements/TextPath.js","../src/elements/Use.js","../src/main.js","../src/svg.js"],"sourcesContent":["const methods = {}\nconst names = []\n\nexport function registerMethods(name, m) {\n if (Array.isArray(name)) {\n for (const _name of name) {\n registerMethods(_name, m)\n }\n return\n }\n\n if (typeof name === 'object') {\n for (const _name in name) {\n registerMethods(_name, name[_name])\n }\n return\n }\n\n addMethodNames(Object.getOwnPropertyNames(m))\n methods[name] = Object.assign(methods[name] || {}, m)\n}\n\nexport function getMethodsFor(name) {\n return methods[name] || {}\n}\n\nexport function getMethodNames() {\n return [...new Set(names)]\n}\n\nexport function addMethodNames(_names) {\n names.push(..._names)\n}\n","// Map function\nexport function map(array, block) {\n let i\n const il = array.length\n const result = []\n\n for (i = 0; i < il; i++) {\n result.push(block(array[i]))\n }\n\n return result\n}\n\n// Filter function\nexport function filter(array, block) {\n let i\n const il = array.length\n const result = []\n\n for (i = 0; i < il; i++) {\n if (block(array[i])) {\n result.push(array[i])\n }\n }\n\n return result\n}\n\n// Degrees to radians\nexport function radians(d) {\n return ((d % 360) * Math.PI) / 180\n}\n\n// Radians to degrees\nexport function degrees(r) {\n return ((r * 180) / Math.PI) % 360\n}\n\n// Convert camel cased string to dash separated\nexport function unCamelCase(s) {\n return s.replace(/([A-Z])/g, function (m, g) {\n return '-' + g.toLowerCase()\n })\n}\n\n// Capitalize first letter of a string\nexport function capitalize(s) {\n return s.charAt(0).toUpperCase() + s.slice(1)\n}\n\n// Calculate proportional width and height values when necessary\nexport function proportionalSize(element, width, height, box) {\n if (width == null || height == null) {\n box = box || element.bbox()\n\n if (width == null) {\n width = (box.width / box.height) * height\n } else if (height == null) {\n height = (box.height / box.width) * width\n }\n }\n\n return {\n width: width,\n height: height\n }\n}\n\n/**\n * This function adds support for string origins.\n * It searches for an origin in o.origin o.ox and o.originX.\n * This way, origin: {x: 'center', y: 50} can be passed as well as ox: 'center', oy: 50\n **/\nexport function getOrigin(o, element) {\n const origin = o.origin\n // First check if origin is in ox or originX\n let ox = o.ox != null ? o.ox : o.originX != null ? o.originX : 'center'\n let oy = o.oy != null ? o.oy : o.originY != null ? o.originY : 'center'\n\n // Then check if origin was used and overwrite in that case\n if (origin != null) {\n ;[ox, oy] = Array.isArray(origin)\n ? origin\n : typeof origin === 'object'\n ? [origin.x, origin.y]\n : [origin, origin]\n }\n\n // Make sure to only call bbox when actually needed\n const condX = typeof ox === 'string'\n const condY = typeof oy === 'string'\n if (condX || condY) {\n const { height, width, x, y } = element.bbox()\n\n // And only overwrite if string was passed for this specific axis\n if (condX) {\n ox = ox.includes('left')\n ? x\n : ox.includes('right')\n ? x + width\n : x + width / 2\n }\n\n if (condY) {\n oy = oy.includes('top')\n ? y\n : oy.includes('bottom')\n ? y + height\n : y + height / 2\n }\n }\n\n // Return the origin as it is if it wasn't a string\n return [ox, oy]\n}\n\nconst descriptiveElements = new Set(['desc', 'metadata', 'title'])\nexport const isDescriptive = (element) =>\n descriptiveElements.has(element.nodeName)\n\nexport const writeDataToDom = (element, data, defaults = {}) => {\n const cloned = { ...data }\n\n for (const key in cloned) {\n if (cloned[key].valueOf() === defaults[key]) {\n delete cloned[key]\n }\n }\n\n if (Object.keys(cloned).length) {\n element.node.setAttribute('data-svgjs', JSON.stringify(cloned)) // see #428\n } else {\n element.node.removeAttribute('data-svgjs')\n element.node.removeAttribute('svgjs:data')\n }\n}\n","// Default namespaces\nexport const svg = 'http://www.w3.org/2000/svg'\nexport const html = 'http://www.w3.org/1999/xhtml'\nexport const xmlns = 'http://www.w3.org/2000/xmlns/'\nexport const xlink = 'http://www.w3.org/1999/xlink'\n","export const globals = {\n window: typeof window === 'undefined' ? null : window,\n document: typeof document === 'undefined' ? null : document\n}\n\nexport function registerWindow(win = null, doc = null) {\n globals.window = win\n globals.document = doc\n}\n\nconst save = {}\n\nexport function saveWindow() {\n save.window = globals.window\n save.document = globals.document\n}\n\nexport function restoreWindow() {\n globals.window = save.window\n globals.document = save.document\n}\n\nexport function withWindow(win, fn) {\n saveWindow()\n registerWindow(win, win.document)\n fn(win, win.document)\n restoreWindow()\n}\n\nexport function getWindow() {\n return globals.window\n}\n","export default class Base {\n // constructor (node/*, {extensions = []} */) {\n // // this.tags = []\n // //\n // // for (let extension of extensions) {\n // // extension.setup.call(this, node)\n // // this.tags.push(extension.name)\n // // }\n // }\n}\n","import { addMethodNames } from './methods.js'\nimport { capitalize } from './utils.js'\nimport { svg } from '../modules/core/namespaces.js'\nimport { globals } from '../utils/window.js'\nimport Base from '../types/Base.js'\n\nconst elements = {}\nexport const root = '___SYMBOL___ROOT___'\n\n// Method for element creation\nexport function create(name, ns = svg) {\n // create element\n return globals.document.createElementNS(ns, name)\n}\n\nexport function makeInstance(element, isHTML = false) {\n if (element instanceof Base) return element\n\n if (typeof element === 'object') {\n return adopter(element)\n }\n\n if (element == null) {\n return new elements[root]()\n }\n\n if (typeof element === 'string' && element.charAt(0) !== '<') {\n return adopter(globals.document.querySelector(element))\n }\n\n // Make sure, that HTML elements are created with the correct namespace\n const wrapper = isHTML ? globals.document.createElement('div') : create('svg')\n wrapper.innerHTML = element\n\n // We can use firstChild here because we know,\n // that the first char is < and thus an element\n element = adopter(wrapper.firstChild)\n\n // make sure, that element doesn't have its wrapper attached\n wrapper.removeChild(wrapper.firstChild)\n return element\n}\n\nexport function nodeOrNew(name, node) {\n return node &&\n (node instanceof globals.window.Node ||\n (node.ownerDocument &&\n node instanceof node.ownerDocument.defaultView.Node))\n ? node\n : create(name)\n}\n\n// Adopt existing svg elements\nexport function adopt(node) {\n // check for presence of node\n if (!node) return null\n\n // make sure a node isn't already adopted\n if (node.instance instanceof Base) return node.instance\n\n if (node.nodeName === '#document-fragment') {\n return new elements.Fragment(node)\n }\n\n // initialize variables\n let className = capitalize(node.nodeName || 'Dom')\n\n // Make sure that gradients are adopted correctly\n if (className === 'LinearGradient' || className === 'RadialGradient') {\n className = 'Gradient'\n\n // Fallback to Dom if element is not known\n } else if (!elements[className]) {\n className = 'Dom'\n }\n\n return new elements[className](node)\n}\n\nlet adopter = adopt\n\nexport function mockAdopt(mock = adopt) {\n adopter = mock\n}\n\nexport function register(element, name = element.name, asRoot = false) {\n elements[name] = element\n if (asRoot) elements[root] = element\n\n addMethodNames(Object.getOwnPropertyNames(element.prototype))\n\n return element\n}\n\nexport function getClass(name) {\n return elements[name]\n}\n\n// Element id sequence\nlet did = 1000\n\n// Get next named element id\nexport function eid(name) {\n return 'Svgjs' + capitalize(name) + did++\n}\n\n// Deep new id assignment\nexport function assignNewId(node) {\n // do the same for SVG child nodes as well\n for (let i = node.children.length - 1; i >= 0; i--) {\n assignNewId(node.children[i])\n }\n\n if (node.id) {\n node.id = eid(node.nodeName)\n return node\n }\n\n return node\n}\n\n// Method for extending objects\nexport function extend(modules, methods) {\n let key, i\n\n modules = Array.isArray(modules) ? modules : [modules]\n\n for (i = modules.length - 1; i >= 0; i--) {\n for (key in methods) {\n modules[i].prototype[key] = methods[key]\n }\n }\n}\n\nexport function wrapWithAttrCheck(fn) {\n return function (...args) {\n const o = args[args.length - 1]\n\n if (o && o.constructor === Object && !(o instanceof Array)) {\n return fn.apply(this, args.slice(0, -1)).attr(o)\n } else {\n return fn.apply(this, args)\n }\n }\n}\n","import { makeInstance } from '../../utils/adopter.js'\nimport { registerMethods } from '../../utils/methods.js'\n\n// Get all siblings, including myself\nexport function siblings() {\n return this.parent().children()\n}\n\n// Get the current position siblings\nexport function position() {\n return this.parent().index(this)\n}\n\n// Get the next element (will return null if there is none)\nexport function next() {\n return this.siblings()[this.position() + 1]\n}\n\n// Get the next element (will return null if there is none)\nexport function prev() {\n return this.siblings()[this.position() - 1]\n}\n\n// Send given element one step forward\nexport function forward() {\n const i = this.position()\n const p = this.parent()\n\n // move node one step forward\n p.add(this.remove(), i + 1)\n\n return this\n}\n\n// Send given element one step backward\nexport function backward() {\n const i = this.position()\n const p = this.parent()\n\n p.add(this.remove(), i ? i - 1 : 0)\n\n return this\n}\n\n// Send given element all the way to the front\nexport function front() {\n const p = this.parent()\n\n // Move node forward\n p.add(this.remove())\n\n return this\n}\n\n// Send given element all the way to the back\nexport function back() {\n const p = this.parent()\n\n // Move node back\n p.add(this.remove(), 0)\n\n return this\n}\n\n// Inserts a given element before the targeted element\nexport function before(element) {\n element = makeInstance(element)\n element.remove()\n\n const i = this.position()\n\n this.parent().add(element, i)\n\n return this\n}\n\n// Inserts a given element after the targeted element\nexport function after(element) {\n element = makeInstance(element)\n element.remove()\n\n const i = this.position()\n\n this.parent().add(element, i + 1)\n\n return this\n}\n\nexport function insertBefore(element) {\n element = makeInstance(element)\n element.before(this)\n return this\n}\n\nexport function insertAfter(element) {\n element = makeInstance(element)\n element.after(this)\n return this\n}\n\nregisterMethods('Dom', {\n siblings,\n position,\n next,\n prev,\n forward,\n backward,\n front,\n back,\n before,\n after,\n insertBefore,\n insertAfter\n})\n","// Parse unit value\nexport const numberAndUnit =\n /^([+-]?(\\d+(\\.\\d*)?|\\.\\d+)(e[+-]?\\d+)?)([a-z%]*)$/i\n\n// Parse hex value\nexport const hex = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i\n\n// Parse rgb value\nexport const rgb = /rgb\\((\\d+),(\\d+),(\\d+)\\)/\n\n// Parse reference id\nexport const reference = /(#[a-z_][a-z0-9\\-_]*)/i\n\n// splits a transformation chain\nexport const transforms = /\\)\\s*,?\\s*/\n\n// Whitespace\nexport const whitespace = /\\s/g\n\n// Test hex value\nexport const isHex = /^#[a-f0-9]{3}$|^#[a-f0-9]{6}$/i\n\n// Test rgb value\nexport const isRgb = /^rgb\\(/\n\n// Test for blank string\nexport const isBlank = /^(\\s+)?$/\n\n// Test for numeric string\nexport const isNumber = /^[+-]?(\\d+(\\.\\d*)?|\\.\\d+)(e[+-]?\\d+)?$/i\n\n// Test for image url\nexport const isImage = /\\.(jpg|jpeg|png|gif|svg)(\\?[^=]+.*)?/i\n\n// split at whitespace and comma\nexport const delimiter = /[\\s,]+/\n\n// Test for path letter\nexport const isPathLetter = /[MLHVCSQTAZ]/i\n","import { delimiter } from '../core/regex.js'\nimport { registerMethods } from '../../utils/methods.js'\n\n// Return array of classes on the node\nexport function classes() {\n const attr = this.attr('class')\n return attr == null ? [] : attr.trim().split(delimiter)\n}\n\n// Return true if class exists on the node, false otherwise\nexport function hasClass(name) {\n return this.classes().indexOf(name) !== -1\n}\n\n// Add class to the node\nexport function addClass(name) {\n if (!this.hasClass(name)) {\n const array = this.classes()\n array.push(name)\n this.attr('class', array.join(' '))\n }\n\n return this\n}\n\n// Remove class from the node\nexport function removeClass(name) {\n if (this.hasClass(name)) {\n this.attr(\n 'class',\n this.classes()\n .filter(function (c) {\n return c !== name\n })\n .join(' ')\n )\n }\n\n return this\n}\n\n// Toggle the presence of a class on the node\nexport function toggleClass(name) {\n return this.hasClass(name) ? this.removeClass(name) : this.addClass(name)\n}\n\nregisterMethods('Dom', {\n classes,\n hasClass,\n addClass,\n removeClass,\n toggleClass\n})\n","import { isBlank } from '../core/regex.js'\nimport { registerMethods } from '../../utils/methods.js'\n\n// Dynamic style generator\nexport function css(style, val) {\n const ret = {}\n if (arguments.length === 0) {\n // get full style as object\n this.node.style.cssText\n .split(/\\s*;\\s*/)\n .filter(function (el) {\n return !!el.length\n })\n .forEach(function (el) {\n const t = el.split(/\\s*:\\s*/)\n ret[t[0]] = t[1]\n })\n return ret\n }\n\n if (arguments.length < 2) {\n // get style properties as array\n if (Array.isArray(style)) {\n for (const name of style) {\n const cased = name\n ret[name] = this.node.style.getPropertyValue(cased)\n }\n return ret\n }\n\n // get style for property\n if (typeof style === 'string') {\n return this.node.style.getPropertyValue(style)\n }\n\n // set styles in object\n if (typeof style === 'object') {\n for (const name in style) {\n // set empty string if null/undefined/'' was given\n this.node.style.setProperty(\n name,\n style[name] == null || isBlank.test(style[name]) ? '' : style[name]\n )\n }\n }\n }\n\n // set style for property\n if (arguments.length === 2) {\n this.node.style.setProperty(\n style,\n val == null || isBlank.test(val) ? '' : val\n )\n }\n\n return this\n}\n\n// Show element\nexport function show() {\n return this.css('display', '')\n}\n\n// Hide element\nexport function hide() {\n return this.css('display', 'none')\n}\n\n// Is element visible?\nexport function visible() {\n return this.css('display') !== 'none'\n}\n\nregisterMethods('Dom', {\n css,\n show,\n hide,\n visible\n})\n","import { registerMethods } from '../../utils/methods.js'\nimport { filter, map } from '../../utils/utils.js'\n\n// Store data values on svg nodes\nexport function data(a, v, r) {\n if (a == null) {\n // get an object of attributes\n return this.data(\n map(\n filter(\n this.node.attributes,\n (el) => el.nodeName.indexOf('data-') === 0\n ),\n (el) => el.nodeName.slice(5)\n )\n )\n } else if (a instanceof Array) {\n const data = {}\n for (const key of a) {\n data[key] = this.data(key)\n }\n return data\n } else if (typeof a === 'object') {\n for (v in a) {\n this.data(v, a[v])\n }\n } else if (arguments.length < 2) {\n try {\n return JSON.parse(this.attr('data-' + a))\n } catch (e) {\n return this.attr('data-' + a)\n }\n } else {\n this.attr(\n 'data-' + a,\n v === null\n ? null\n : r === true || typeof v === 'string' || typeof v === 'number'\n ? v\n : JSON.stringify(v)\n )\n }\n\n return this\n}\n\nregisterMethods('Dom', { data })\n","import { registerMethods } from '../../utils/methods.js'\n\n// Remember arbitrary data\nexport function remember(k, v) {\n // remember every item in an object individually\n if (typeof arguments[0] === 'object') {\n for (const key in k) {\n this.remember(key, k[key])\n }\n } else if (arguments.length === 1) {\n // retrieve memory\n return this.memory()[k]\n } else {\n // store memory\n this.memory()[k] = v\n }\n\n return this\n}\n\n// Erase a given memory\nexport function forget() {\n if (arguments.length === 0) {\n this._memory = {}\n } else {\n for (let i = arguments.length - 1; i >= 0; i--) {\n delete this.memory()[arguments[i]]\n }\n }\n return this\n}\n\n// This triggers creation of a new hidden class which is not performant\n// However, this function is not rarely used so it will not happen frequently\n// Return local memory object\nexport function memory() {\n return (this._memory = this._memory || {})\n}\n\nregisterMethods('Dom', { remember, forget, memory })\n","import { hex, isHex, isRgb, rgb, whitespace } from '../modules/core/regex.js'\n\nfunction sixDigitHex(hex) {\n return hex.length === 4\n ? [\n '#',\n hex.substring(1, 2),\n hex.substring(1, 2),\n hex.substring(2, 3),\n hex.substring(2, 3),\n hex.substring(3, 4),\n hex.substring(3, 4)\n ].join('')\n : hex\n}\n\nfunction componentHex(component) {\n const integer = Math.round(component)\n const bounded = Math.max(0, Math.min(255, integer))\n const hex = bounded.toString(16)\n return hex.length === 1 ? '0' + hex : hex\n}\n\nfunction is(object, space) {\n for (let i = space.length; i--; ) {\n if (object[space[i]] == null) {\n return false\n }\n }\n return true\n}\n\nfunction getParameters(a, b) {\n const params = is(a, 'rgb')\n ? { _a: a.r, _b: a.g, _c: a.b, _d: 0, space: 'rgb' }\n : is(a, 'xyz')\n ? { _a: a.x, _b: a.y, _c: a.z, _d: 0, space: 'xyz' }\n : is(a, 'hsl')\n ? { _a: a.h, _b: a.s, _c: a.l, _d: 0, space: 'hsl' }\n : is(a, 'lab')\n ? { _a: a.l, _b: a.a, _c: a.b, _d: 0, space: 'lab' }\n : is(a, 'lch')\n ? { _a: a.l, _b: a.c, _c: a.h, _d: 0, space: 'lch' }\n : is(a, 'cmyk')\n ? { _a: a.c, _b: a.m, _c: a.y, _d: a.k, space: 'cmyk' }\n : { _a: 0, _b: 0, _c: 0, space: 'rgb' }\n\n params.space = b || params.space\n return params\n}\n\nfunction cieSpace(space) {\n if (space === 'lab' || space === 'xyz' || space === 'lch') {\n return true\n } else {\n return false\n }\n}\n\nfunction hueToRgb(p, q, t) {\n if (t < 0) t += 1\n if (t > 1) t -= 1\n if (t < 1 / 6) return p + (q - p) * 6 * t\n if (t < 1 / 2) return q\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6\n return p\n}\n\nexport default class Color {\n constructor(...inputs) {\n this.init(...inputs)\n }\n\n // Test if given value is a color\n static isColor(color) {\n return (\n color && (color instanceof Color || this.isRgb(color) || this.test(color))\n )\n }\n\n // Test if given value is an rgb object\n static isRgb(color) {\n return (\n color &&\n typeof color.r === 'number' &&\n typeof color.g === 'number' &&\n typeof color.b === 'number'\n )\n }\n\n /*\n Generating random colors\n */\n static random(mode = 'vibrant', t) {\n // Get the math modules\n const { random, round, sin, PI: pi } = Math\n\n // Run the correct generator\n if (mode === 'vibrant') {\n const l = (81 - 57) * random() + 57\n const c = (83 - 45) * random() + 45\n const h = 360 * random()\n const color = new Color(l, c, h, 'lch')\n return color\n } else if (mode === 'sine') {\n t = t == null ? random() : t\n const r = round(80 * sin((2 * pi * t) / 0.5 + 0.01) + 150)\n const g = round(50 * sin((2 * pi * t) / 0.5 + 4.6) + 200)\n const b = round(100 * sin((2 * pi * t) / 0.5 + 2.3) + 150)\n const color = new Color(r, g, b)\n return color\n } else if (mode === 'pastel') {\n const l = (94 - 86) * random() + 86\n const c = (26 - 9) * random() + 9\n const h = 360 * random()\n const color = new Color(l, c, h, 'lch')\n return color\n } else if (mode === 'dark') {\n const l = 10 + 10 * random()\n const c = (125 - 75) * random() + 86\n const h = 360 * random()\n const color = new Color(l, c, h, 'lch')\n return color\n } else if (mode === 'rgb') {\n const r = 255 * random()\n const g = 255 * random()\n const b = 255 * random()\n const color = new Color(r, g, b)\n return color\n } else if (mode === 'lab') {\n const l = 100 * random()\n const a = 256 * random() - 128\n const b = 256 * random() - 128\n const color = new Color(l, a, b, 'lab')\n return color\n } else if (mode === 'grey') {\n const grey = 255 * random()\n const color = new Color(grey, grey, grey)\n return color\n } else {\n throw new Error('Unsupported random color mode')\n }\n }\n\n // Test if given value is a color string\n static test(color) {\n return typeof color === 'string' && (isHex.test(color) || isRgb.test(color))\n }\n\n cmyk() {\n // Get the rgb values for the current color\n const { _a, _b, _c } = this.rgb()\n const [r, g, b] = [_a, _b, _c].map((v) => v / 255)\n\n // Get the cmyk values in an unbounded format\n const k = Math.min(1 - r, 1 - g, 1 - b)\n\n if (k === 1) {\n // Catch the black case\n return new Color(0, 0, 0, 1, 'cmyk')\n }\n\n const c = (1 - r - k) / (1 - k)\n const m = (1 - g - k) / (1 - k)\n const y = (1 - b - k) / (1 - k)\n\n // Construct the new color\n const color = new Color(c, m, y, k, 'cmyk')\n return color\n }\n\n hsl() {\n // Get the rgb values\n const { _a, _b, _c } = this.rgb()\n const [r, g, b] = [_a, _b, _c].map((v) => v / 255)\n\n // Find the maximum and minimum values to get the lightness\n const max = Math.max(r, g, b)\n const min = Math.min(r, g, b)\n const l = (max + min) / 2\n\n // If the r, g, v values are identical then we are grey\n const isGrey = max === min\n\n // Calculate the hue and saturation\n const delta = max - min\n const s = isGrey\n ? 0\n : l > 0.5\n ? delta / (2 - max - min)\n : delta / (max + min)\n const h = isGrey\n ? 0\n : max === r\n ? ((g - b) / delta + (g < b ? 6 : 0)) / 6\n : max === g\n ? ((b - r) / delta + 2) / 6\n : max === b\n ? ((r - g) / delta + 4) / 6\n : 0\n\n // Construct and return the new color\n const color = new Color(360 * h, 100 * s, 100 * l, 'hsl')\n return color\n }\n\n init(a = 0, b = 0, c = 0, d = 0, space = 'rgb') {\n // This catches the case when a falsy value is passed like ''\n a = !a ? 0 : a\n\n // Reset all values in case the init function is rerun with new color space\n if (this.space) {\n for (const component in this.space) {\n delete this[this.space[component]]\n }\n }\n\n if (typeof a === 'number') {\n // Allow for the case that we don't need d...\n space = typeof d === 'string' ? d : space\n d = typeof d === 'string' ? 0 : d\n\n // Assign the values straight to the color\n Object.assign(this, { _a: a, _b: b, _c: c, _d: d, space })\n // If the user gave us an array, make the color from it\n } else if (a instanceof Array) {\n this.space = b || (typeof a[3] === 'string' ? a[3] : a[4]) || 'rgb'\n Object.assign(this, { _a: a[0], _b: a[1], _c: a[2], _d: a[3] || 0 })\n } else if (a instanceof Object) {\n // Set the object up and assign its values directly\n const values = getParameters(a, b)\n Object.assign(this, values)\n } else if (typeof a === 'string') {\n if (isRgb.test(a)) {\n const noWhitespace = a.replace(whitespace, '')\n const [_a, _b, _c] = rgb\n .exec(noWhitespace)\n .slice(1, 4)\n .map((v) => parseInt(v))\n Object.assign(this, { _a, _b, _c, _d: 0, space: 'rgb' })\n } else if (isHex.test(a)) {\n const hexParse = (v) => parseInt(v, 16)\n const [, _a, _b, _c] = hex.exec(sixDigitHex(a)).map(hexParse)\n Object.assign(this, { _a, _b, _c, _d: 0, space: 'rgb' })\n } else throw Error(\"Unsupported string format, can't construct Color\")\n }\n\n // Now add the components as a convenience\n const { _a, _b, _c, _d } = this\n const components =\n this.space === 'rgb'\n ? { r: _a, g: _b, b: _c }\n : this.space === 'xyz'\n ? { x: _a, y: _b, z: _c }\n : this.space === 'hsl'\n ? { h: _a, s: _b, l: _c }\n : this.space === 'lab'\n ? { l: _a, a: _b, b: _c }\n : this.space === 'lch'\n ? { l: _a, c: _b, h: _c }\n : this.space === 'cmyk'\n ? { c: _a, m: _b, y: _c, k: _d }\n : {}\n Object.assign(this, components)\n }\n\n lab() {\n // Get the xyz color\n const { x, y, z } = this.xyz()\n\n // Get the lab components\n const l = 116 * y - 16\n const a = 500 * (x - y)\n const b = 200 * (y - z)\n\n // Construct and return a new color\n const color = new Color(l, a, b, 'lab')\n return color\n }\n\n lch() {\n // Get the lab color directly\n const { l, a, b } = this.lab()\n\n // Get the chromaticity and the hue using polar coordinates\n const c = Math.sqrt(a ** 2 + b ** 2)\n let h = (180 * Math.atan2(b, a)) / Math.PI\n if (h < 0) {\n h *= -1\n h = 360 - h\n }\n\n // Make a new color and return it\n const color = new Color(l, c, h, 'lch')\n return color\n }\n /*\n Conversion Methods\n */\n\n rgb() {\n if (this.space === 'rgb') {\n return this\n } else if (cieSpace(this.space)) {\n // Convert to the xyz color space\n let { x, y, z } = this\n if (this.space === 'lab' || this.space === 'lch') {\n // Get the values in the lab space\n let { l, a, b } = this\n if (this.space === 'lch') {\n const { c, h } = this\n const dToR = Math.PI / 180\n a = c * Math.cos(dToR * h)\n b = c * Math.sin(dToR * h)\n }\n\n // Undo the nonlinear function\n const yL = (l + 16) / 116\n const xL = a / 500 + yL\n const zL = yL - b / 200\n\n // Get the xyz values\n const ct = 16 / 116\n const mx = 0.008856\n const nm = 7.787\n x = 0.95047 * (xL ** 3 > mx ? xL ** 3 : (xL - ct) / nm)\n y = 1.0 * (yL ** 3 > mx ? yL ** 3 : (yL - ct) / nm)\n z = 1.08883 * (zL ** 3 > mx ? zL ** 3 : (zL - ct) / nm)\n }\n\n // Convert xyz to unbounded rgb values\n const rU = x * 3.2406 + y * -1.5372 + z * -0.4986\n const gU = x * -0.9689 + y * 1.8758 + z * 0.0415\n const bU = x * 0.0557 + y * -0.204 + z * 1.057\n\n // Convert the values to true rgb values\n const pow = Math.pow\n const bd = 0.0031308\n const r = rU > bd ? 1.055 * pow(rU, 1 / 2.4) - 0.055 : 12.92 * rU\n const g = gU > bd ? 1.055 * pow(gU, 1 / 2.4) - 0.055 : 12.92 * gU\n const b = bU > bd ? 1.055 * pow(bU, 1 / 2.4) - 0.055 : 12.92 * bU\n\n // Make and return the color\n const color = new Color(255 * r, 255 * g, 255 * b)\n return color\n } else if (this.space === 'hsl') {\n // https://bgrins.github.io/TinyColor/docs/tinycolor.html\n // Get the current hsl values\n let { h, s, l } = this\n h /= 360\n s /= 100\n l /= 100\n\n // If we are grey, then just make the color directly\n if (s === 0) {\n l *= 255\n const color = new Color(l, l, l)\n return color\n }\n\n // TODO I have no idea what this does :D If you figure it out, tell me!\n const q = l < 0.5 ? l * (1 + s) : l + s - l * s\n const p = 2 * l - q\n\n // Get the rgb values\n const r = 255 * hueToRgb(p, q, h + 1 / 3)\n const g = 255 * hueToRgb(p, q, h)\n const b = 255 * hueToRgb(p, q, h - 1 / 3)\n\n // Make a new color\n const color = new Color(r, g, b)\n return color\n } else if (this.space === 'cmyk') {\n // https://gist.github.com/felipesabino/5066336\n // Get the normalised cmyk values\n const { c, m, y, k } = this\n\n // Get the rgb values\n const r = 255 * (1 - Math.min(1, c * (1 - k) + k))\n const g = 255 * (1 - Math.min(1, m * (1 - k) + k))\n const b = 255 * (1 - Math.min(1, y * (1 - k) + k))\n\n // Form the color and return it\n const color = new Color(r, g, b)\n return color\n } else {\n return this\n }\n }\n\n toArray() {\n const { _a, _b, _c, _d, space } = this\n return [_a, _b, _c, _d, space]\n }\n\n toHex() {\n const [r, g, b] = this._clamped().map(componentHex)\n return `#${r}${g}${b}`\n }\n\n toRgb() {\n const [rV, gV, bV] = this._clamped()\n const string = `rgb(${rV},${gV},${bV})`\n return string\n }\n\n toString() {\n return this.toHex()\n }\n\n xyz() {\n // Normalise the red, green and blue values\n const { _a: r255, _b: g255, _c: b255 } = this.rgb()\n const [r, g, b] = [r255, g255, b255].map((v) => v / 255)\n\n // Convert to the lab rgb space\n const rL = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92\n const gL = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92\n const bL = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92\n\n // Convert to the xyz color space without bounding the values\n const xU = (rL * 0.4124 + gL * 0.3576 + bL * 0.1805) / 0.95047\n const yU = (rL * 0.2126 + gL * 0.7152 + bL * 0.0722) / 1.0\n const zU = (rL * 0.0193 + gL * 0.1192 + bL * 0.9505) / 1.08883\n\n // Get the proper xyz values by applying the bounding\n const x = xU > 0.008856 ? Math.pow(xU, 1 / 3) : 7.787 * xU + 16 / 116\n const y = yU > 0.008856 ? Math.pow(yU, 1 / 3) : 7.787 * yU + 16 / 116\n const z = zU > 0.008856 ? Math.pow(zU, 1 / 3) : 7.787 * zU + 16 / 116\n\n // Make and return the color\n const color = new Color(x, y, z, 'xyz')\n return color\n }\n\n /*\n Input and Output methods\n */\n\n _clamped() {\n const { _a, _b, _c } = this.rgb()\n const { max, min, round } = Math\n const format = (v) => max(0, min(round(v), 255))\n return [_a, _b, _c].map(format)\n }\n\n /*\n Constructing colors\n */\n}\n","import Matrix from './Matrix.js'\n\nexport default class Point {\n // Initialize\n constructor(...args) {\n this.init(...args)\n }\n\n // Clone point\n clone() {\n return new Point(this)\n }\n\n init(x, y) {\n const base = { x: 0, y: 0 }\n\n // ensure source as object\n const source = Array.isArray(x)\n ? { x: x[0], y: x[1] }\n : typeof x === 'object'\n ? { x: x.x, y: x.y }\n : { x: x, y: y }\n\n // merge source\n this.x = source.x == null ? base.x : source.x\n this.y = source.y == null ? base.y : source.y\n\n return this\n }\n\n toArray() {\n return [this.x, this.y]\n }\n\n transform(m) {\n return this.clone().transformO(m)\n }\n\n // Transform point with matrix\n transformO(m) {\n if (!Matrix.isMatrixLike(m)) {\n m = new Matrix(m)\n }\n\n const { x, y } = this\n\n // Perform the matrix multiplication\n this.x = m.a * x + m.c * y + m.e\n this.y = m.b * x + m.d * y + m.f\n\n return this\n }\n}\n\nexport function point(x, y) {\n return new Point(x, y).transformO(this.screenCTM().inverseO())\n}\n","import { delimiter } from '../modules/core/regex.js'\nimport { radians } from '../utils/utils.js'\nimport { register } from '../utils/adopter.js'\nimport Element from '../elements/Element.js'\nimport Point from './Point.js'\n\nfunction closeEnough(a, b, threshold) {\n return Math.abs(b - a) < (threshold || 1e-6)\n}\n\nexport default class Matrix {\n constructor(...args) {\n this.init(...args)\n }\n\n static formatTransforms(o) {\n // Get all of the parameters required to form the matrix\n const flipBoth = o.flip === 'both' || o.flip === true\n const flipX = o.flip && (flipBoth || o.flip === 'x') ? -1 : 1\n const flipY = o.flip && (flipBoth || o.flip === 'y') ? -1 : 1\n const skewX =\n o.skew && o.skew.length\n ? o.skew[0]\n : isFinite(o.skew)\n ? o.skew\n : isFinite(o.skewX)\n ? o.skewX\n : 0\n const skewY =\n o.skew && o.skew.length\n ? o.skew[1]\n : isFinite(o.skew)\n ? o.skew\n : isFinite(o.skewY)\n ? o.skewY\n : 0\n const scaleX =\n o.scale && o.scale.length\n ? o.scale[0] * flipX\n : isFinite(o.scale)\n ? o.scale * flipX\n : isFinite(o.scaleX)\n ? o.scaleX * flipX\n : flipX\n const scaleY =\n o.scale && o.scale.length\n ? o.scale[1] * flipY\n : isFinite(o.scale)\n ? o.scale * flipY\n : isFinite(o.scaleY)\n ? o.scaleY * flipY\n : flipY\n const shear = o.shear || 0\n const theta = o.rotate || o.theta || 0\n const origin = new Point(\n o.origin || o.around || o.ox || o.originX,\n o.oy || o.originY\n )\n const ox = origin.x\n const oy = origin.y\n // We need Point to be invalid if nothing was passed because we cannot default to 0 here. That is why NaN\n const position = new Point(\n o.position || o.px || o.positionX || NaN,\n o.py || o.positionY || NaN\n )\n const px = position.x\n const py = position.y\n const translate = new Point(\n o.translate || o.tx || o.translateX,\n o.ty || o.translateY\n )\n const tx = translate.x\n const ty = translate.y\n const relative = new Point(\n o.relative || o.rx || o.relativeX,\n o.ry || o.relativeY\n )\n const rx = relative.x\n const ry = relative.y\n\n // Populate all of the values\n return {\n scaleX,\n scaleY,\n skewX,\n skewY,\n shear,\n theta,\n rx,\n ry,\n tx,\n ty,\n ox,\n oy,\n px,\n py\n }\n }\n\n static fromArray(a) {\n return { a: a[0], b: a[1], c: a[2], d: a[3], e: a[4], f: a[5] }\n }\n\n static isMatrixLike(o) {\n return (\n o.a != null ||\n o.b != null ||\n o.c != null ||\n o.d != null ||\n o.e != null ||\n o.f != null\n )\n }\n\n // left matrix, right matrix, target matrix which is overwritten\n static matrixMultiply(l, r, o) {\n // Work out the product directly\n const a = l.a * r.a + l.c * r.b\n const b = l.b * r.a + l.d * r.b\n const c = l.a * r.c + l.c * r.d\n const d = l.b * r.c + l.d * r.d\n const e = l.e + l.a * r.e + l.c * r.f\n const f = l.f + l.b * r.e + l.d * r.f\n\n // make sure to use local variables because l/r and o could be the same\n o.a = a\n o.b = b\n o.c = c\n o.d = d\n o.e = e\n o.f = f\n\n return o\n }\n\n around(cx, cy, matrix) {\n return this.clone().aroundO(cx, cy, matrix)\n }\n\n // Transform around a center point\n aroundO(cx, cy, matrix) {\n const dx = cx || 0\n const dy = cy || 0\n return this.translateO(-dx, -dy).lmultiplyO(matrix).translateO(dx, dy)\n }\n\n // Clones this matrix\n clone() {\n return new Matrix(this)\n }\n\n // Decomposes this matrix into its affine parameters\n decompose(cx = 0, cy = 0) {\n // Get the parameters from the matrix\n const a = this.a\n const b = this.b\n const c = this.c\n const d = this.d\n const e = this.e\n const f = this.f\n\n // Figure out if the winding direction is clockwise or counterclockwise\n const determinant = a * d - b * c\n const ccw = determinant > 0 ? 1 : -1\n\n // Since we only shear in x, we can use the x basis to get the x scale\n // and the rotation of the resulting matrix\n const sx = ccw * Math.sqrt(a * a + b * b)\n const thetaRad = Math.atan2(ccw * b, ccw * a)\n const theta = (180 / Math.PI) * thetaRad\n const ct = Math.cos(thetaRad)\n const st = Math.sin(thetaRad)\n\n // We can then solve the y basis vector simultaneously to get the other\n // two affine parameters directly from these parameters\n const lam = (a * c + b * d) / determinant\n const sy = (c * sx) / (lam * a - b) || (d * sx) / (lam * b + a)\n\n // Use the translations\n const tx = e - cx + cx * ct * sx + cy * (lam * ct * sx - st * sy)\n const ty = f - cy + cx * st * sx + cy * (lam * st * sx + ct * sy)\n\n // Construct the decomposition and return it\n return {\n // Return the affine parameters\n scaleX: sx,\n scaleY: sy,\n shear: lam,\n rotate: theta,\n translateX: tx,\n translateY: ty,\n originX: cx,\n originY: cy,\n\n // Return the matrix parameters\n a: this.a,\n b: this.b,\n c: this.c,\n d: this.d,\n e: this.e,\n f: this.f\n }\n }\n\n // Check if two matrices are equal\n equals(other) {\n if (other === this) return true\n const comp = new Matrix(other)\n return (\n closeEnough(this.a, comp.a) &&\n closeEnough(this.b, comp.b) &&\n closeEnough(this.c, comp.c) &&\n closeEnough(this.d, comp.d) &&\n closeEnough(this.e, comp.e) &&\n closeEnough(this.f, comp.f)\n )\n }\n\n // Flip matrix on x or y, at a given offset\n flip(axis, around) {\n return this.clone().flipO(axis, around)\n }\n\n flipO(axis, around) {\n return axis === 'x'\n ? this.scaleO(-1, 1, around, 0)\n : axis === 'y'\n ? this.scaleO(1, -1, 0, around)\n : this.scaleO(-1, -1, axis, around || axis) // Define an x, y flip point\n }\n\n // Initialize\n init(source) {\n const base = Matrix.fromArray([1, 0, 0, 1, 0, 0])\n\n // ensure source as object\n source =\n source instanceof Element\n ? source.matrixify()\n : typeof source === 'string'\n ? Matrix.fromArray(source.split(delimiter).map(parseFloat))\n : Array.isArray(source)\n ? Matrix.fromArray(source)\n : typeof source === 'object' && Matrix.isMatrixLike(source)\n ? source\n : typeof source === 'object'\n ? new Matrix().transform(source)\n : arguments.length === 6\n ? Matrix.fromArray([].slice.call(arguments))\n : base\n\n // Merge the source matrix with the base matrix\n this.a = source.a != null ? source.a : base.a\n this.b = source.b != null ? source.b : base.b\n this.c = source.c != null ? source.c : base.c\n this.d = source.d != null ? source.d : base.d\n this.e = source.e != null ? source.e : base.e\n this.f = source.f != null ? source.f : base.f\n\n return this\n }\n\n inverse() {\n return this.clone().inverseO()\n }\n\n // Inverses matrix\n inverseO() {\n // Get the current parameters out of the matrix\n const a = this.a\n const b = this.b\n const c = this.c\n const d = this.d\n const e = this.e\n const f = this.f\n\n // Invert the 2x2 matrix in the top left\n const det = a * d - b * c\n if (!det) throw new Error('Cannot invert ' + this)\n\n // Calculate the top 2x2 matrix\n const na = d / det\n const nb = -b / det\n const nc = -c / det\n const nd = a / det\n\n // Apply the inverted matrix to the top right\n const ne = -(na * e + nc * f)\n const nf = -(nb * e + nd * f)\n\n // Construct the inverted matrix\n this.a = na\n this.b = nb\n this.c = nc\n this.d = nd\n this.e = ne\n this.f = nf\n\n return this\n }\n\n lmultiply(matrix) {\n return this.clone().lmultiplyO(matrix)\n }\n\n lmultiplyO(matrix) {\n const r = this\n const l = matrix instanceof Matrix ? matrix : new Matrix(matrix)\n\n return Matrix.matrixMultiply(l, r, this)\n }\n\n // Left multiplies by the given matrix\n multiply(matrix) {\n return this.clone().multiplyO(matrix)\n }\n\n multiplyO(matrix) {\n // Get the matrices\n const l = this\n const r = matrix instanceof Matrix ? matrix : new Matrix(matrix)\n\n return Matrix.matrixMultiply(l, r, this)\n }\n\n // Rotate matrix\n rotate(r, cx, cy) {\n return this.clone().rotateO(r, cx, cy)\n }\n\n rotateO(r, cx = 0, cy = 0) {\n // Convert degrees to radians\n r = radians(r)\n\n const cos = Math.cos(r)\n const sin = Math.sin(r)\n\n const { a, b, c, d, e, f } = this\n\n this.a = a * cos - b * sin\n this.b = b * cos + a * sin\n this.c = c * cos - d * sin\n this.d = d * cos + c * sin\n this.e = e * cos - f * sin + cy * sin - cx * cos + cx\n this.f = f * cos + e * sin - cx * sin - cy * cos + cy\n\n return this\n }\n\n // Scale matrix\n scale() {\n return this.clone().scaleO(...arguments)\n }\n\n scaleO(x, y = x, cx = 0, cy = 0) {\n // Support uniform scaling\n if (arguments.length === 3) {\n cy = cx\n cx = y\n y = x\n }\n\n const { a, b, c, d, e, f } = this\n\n this.a = a * x\n this.b = b * y\n this.c = c * x\n this.d = d * y\n this.e = e * x - cx * x + cx\n this.f = f * y - cy * y + cy\n\n return this\n }\n\n // Shear matrix\n shear(a, cx, cy) {\n return this.clone().shearO(a, cx, cy)\n }\n\n // eslint-disable-next-line no-unused-vars\n shearO(lx, cx = 0, cy = 0) {\n const { a, b, c, d, e, f } = this\n\n this.a = a + b * lx\n this.c = c + d * lx\n this.e = e + f * lx - cy * lx\n\n return this\n }\n\n // Skew Matrix\n skew() {\n return this.clone().skewO(...arguments)\n }\n\n skewO(x, y = x, cx = 0, cy = 0) {\n // support uniformal skew\n if (arguments.length === 3) {\n cy = cx\n cx = y\n y = x\n }\n\n // Convert degrees to radians\n x = radians(x)\n y = radians(y)\n\n const lx = Math.tan(x)\n const ly = Math.tan(y)\n\n const { a, b, c, d, e, f } = this\n\n this.a = a + b * lx\n this.b = b + a * ly\n this.c = c + d * lx\n this.d = d + c * ly\n this.e = e + f * lx - cy * lx\n this.f = f + e * ly - cx * ly\n\n return this\n }\n\n // SkewX\n skewX(x, cx, cy) {\n return this.skew(x, 0, cx, cy)\n }\n\n // SkewY\n skewY(y, cx, cy) {\n return this.skew(0, y, cx, cy)\n }\n\n toArray() {\n return [this.a, this.b, this.c, this.d, this.e, this.f]\n }\n\n // Convert matrix to string\n toString() {\n return (\n 'matrix(' +\n this.a +\n ',' +\n this.b +\n ',' +\n this.c +\n ',' +\n this.d +\n ',' +\n this.e +\n ',' +\n this.f +\n ')'\n )\n }\n\n // Transform a matrix into another matrix by manipulating the space\n transform(o) {\n // Check if o is a matrix and then left multiply it directly\n if (Matrix.isMatrixLike(o)) {\n const matrix = new Matrix(o)\n return matrix.multiplyO(this)\n }\n\n // Get the proposed transformations and the current transformations\n const t = Matrix.formatTransforms(o)\n const current = this\n const { x: ox, y: oy } = new Point(t.ox, t.oy).transform(current)\n\n // Construct the resulting matrix\n const transformer = new Matrix()\n .translateO(t.rx, t.ry)\n .lmultiplyO(current)\n .translateO(-ox, -oy)\n .scaleO(t.scaleX, t.scaleY)\n .skewO(t.skewX, t.skewY)\n .shearO(t.shear)\n .rotateO(t.theta)\n .translateO(ox, oy)\n\n // If we want the origin at a particular place, we force it there\n if (isFinite(t.px) || isFinite(t.py)) {\n const origin = new Point(ox, oy).transform(transformer)\n // TODO: Replace t.px with isFinite(t.px)\n // Doesn't work because t.px is also 0 if it wasn't passed\n const dx = isFinite(t.px) ? t.px - origin.x : 0\n const dy = isFinite(t.py) ? t.py - origin.y : 0\n transformer.translateO(dx, dy)\n }\n\n // Translate now after positioning\n transformer.translateO(t.tx, t.ty)\n return transformer\n }\n\n // Translate matrix\n translate(x, y) {\n return this.clone().translateO(x, y)\n }\n\n translateO(x, y) {\n this.e += x || 0\n this.f += y || 0\n return this\n }\n\n valueOf() {\n return {\n a: this.a,\n b: this.b,\n c: this.c,\n d: this.d,\n e: this.e,\n f: this.f\n }\n }\n}\n\nexport function ctm() {\n return new Matrix(this.node.getCTM())\n}\n\nexport function screenCTM() {\n try {\n /* https://bugzilla.mozilla.org/show_bug.cgi?id=1344537\n This is needed because FF does not return the transformation matrix\n for the inner coordinate system when getScreenCTM() is called on nested svgs.\n However all other Browsers do that */\n if (typeof this.isRoot === 'function' && !this.isRoot()) {\n const rect = this.rect(1, 1)\n const m = rect.node.getScreenCTM()\n rect.remove()\n return new Matrix(m)\n }\n return new Matrix(this.node.getScreenCTM())\n } catch (e) {\n console.warn(\n `Cannot get CTM from SVG node ${this.node.nodeName}. Is the element rendered?`\n )\n return new Matrix()\n }\n}\n\nregister(Matrix, 'Matrix')\n","import { globals } from '../../utils/window.js'\nimport { makeInstance } from '../../utils/adopter.js'\n\nexport default function parser() {\n // Reuse cached element if possible\n if (!parser.nodes) {\n const svg = makeInstance().size(2, 0)\n svg.node.style.cssText = [\n 'opacity: 0',\n 'position: absolute',\n 'left: -100%',\n 'top: -100%',\n 'overflow: hidden'\n ].join(';')\n\n svg.attr('focusable', 'false')\n svg.attr('aria-hidden', 'true')\n\n const path = svg.path().node\n\n parser.nodes = { svg, path }\n }\n\n if (!parser.nodes.svg.node.parentNode) {\n const b = globals.document.body || globals.document.documentElement\n parser.nodes.svg.addTo(b)\n }\n\n return parser.nodes\n}\n","import { delimiter } from '../modules/core/regex.js'\nimport { globals } from '../utils/window.js'\nimport { register } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Matrix from './Matrix.js'\nimport Point from './Point.js'\nimport parser from '../modules/core/parser.js'\n\nexport function isNulledBox(box) {\n return !box.width && !box.height && !box.x && !box.y\n}\n\nexport function domContains(node) {\n return (\n node === globals.document ||\n (\n globals.document.documentElement.contains ||\n function (node) {\n // This is IE - it does not support contains() for top-level SVGs\n while (node.parentNode) {\n node = node.parentNode\n }\n return node === globals.document\n }\n ).call(globals.document.documentElement, node)\n )\n}\n\nexport default class Box {\n constructor(...args) {\n this.init(...args)\n }\n\n addOffset() {\n // offset by window scroll position, because getBoundingClientRect changes when window is scrolled\n this.x += globals.window.pageXOffset\n this.y += globals.window.pageYOffset\n return new Box(this)\n }\n\n init(source) {\n const base = [0, 0, 0, 0]\n source =\n typeof source === 'string'\n ? source.split(delimiter).map(parseFloat)\n : Array.isArray(source)\n ? source\n : typeof source === 'object'\n ? [\n source.left != null ? source.left : source.x,\n source.top != null ? source.top : source.y,\n source.width,\n source.height\n ]\n : arguments.length === 4\n ? [].slice.call(arguments)\n : base\n\n this.x = source[0] || 0\n this.y = source[1] || 0\n this.width = this.w = source[2] || 0\n this.height = this.h = source[3] || 0\n\n // Add more bounding box properties\n this.x2 = this.x + this.w\n this.y2 = this.y + this.h\n this.cx = this.x + this.w / 2\n this.cy = this.y + this.h / 2\n\n return this\n }\n\n isNulled() {\n return isNulledBox(this)\n }\n\n // Merge rect box with another, return a new instance\n merge(box) {\n const x = Math.min(this.x, box.x)\n const y = Math.min(this.y, box.y)\n const width = Math.max(this.x + this.width, box.x + box.width) - x\n const height = Math.max(this.y + this.height, box.y + box.height) - y\n\n return new Box(x, y, width, height)\n }\n\n toArray() {\n return [this.x, this.y, this.width, this.height]\n }\n\n toString() {\n return this.x + ' ' + this.y + ' ' + this.width + ' ' + this.height\n }\n\n transform(m) {\n if (!(m instanceof Matrix)) {\n m = new Matrix(m)\n }\n\n let xMin = Infinity\n let xMax = -Infinity\n let yMin = Infinity\n let yMax = -Infinity\n\n const pts = [\n new Point(this.x, this.y),\n new Point(this.x2, this.y),\n new Point(this.x, this.y2),\n new Point(this.x2, this.y2)\n ]\n\n pts.forEach(function (p) {\n p = p.transform(m)\n xMin = Math.min(xMin, p.x)\n xMax = Math.max(xMax, p.x)\n yMin = Math.min(yMin, p.y)\n yMax = Math.max(yMax, p.y)\n })\n\n return new Box(xMin, yMin, xMax - xMin, yMax - yMin)\n }\n}\n\nfunction getBox(el, getBBoxFn, retry) {\n let box\n\n try {\n // Try to get the box with the provided function\n box = getBBoxFn(el.node)\n\n // If the box is worthless and not even in the dom, retry\n // by throwing an error here...\n if (isNulledBox(box) && !domContains(el.node)) {\n throw new Error('Element not in the dom')\n }\n } catch (e) {\n // ... and calling the retry handler here\n box = retry(el)\n }\n\n return box\n}\n\nexport function bbox() {\n // Function to get bbox is getBBox()\n const getBBox = (node) => node.getBBox()\n\n // Take all measures so that a stupid browser renders the element\n // so we can get the bbox from it when we try again\n const retry = (el) => {\n try {\n const clone = el.clone().addTo(parser().svg).show()\n const box = clone.node.getBBox()\n clone.remove()\n return box\n } catch (e) {\n // We give up...\n throw new Error(\n `Getting bbox of element \"${\n el.node.nodeName\n }\" is not possible: ${e.toString()}`\n )\n }\n }\n\n const box = getBox(this, getBBox, retry)\n const bbox = new Box(box)\n\n return bbox\n}\n\nexport function rbox(el) {\n const getRBox = (node) => node.getBoundingClientRect()\n const retry = (el) => {\n // There is no point in trying tricks here because if we insert the element into the dom ourselves\n // it obviously will be at the wrong position\n throw new Error(\n `Getting rbox of element \"${el.node.nodeName}\" is not possible`\n )\n }\n\n const box = getBox(this, getRBox, retry)\n const rbox = new Box(box)\n\n // If an element was passed, we want the bbox in the coordinate system of that element\n if (el) {\n return rbox.transform(el.screenCTM().inverseO())\n }\n\n // Else we want it in absolute screen coordinates\n // Therefore we need to add the scrollOffset\n return rbox.addOffset()\n}\n\n// Checks whether the given point is inside the bounding box\nexport function inside(x, y) {\n const box = this.bbox()\n\n return (\n x > box.x && y > box.y && x < box.x + box.width && y < box.y + box.height\n )\n}\n\nregisterMethods({\n viewbox: {\n viewbox(x, y, width, height) {\n // act as getter\n if (x == null) return new Box(this.attr('viewBox'))\n\n // act as setter\n return this.attr('viewBox', new Box(x, y, width, height))\n },\n\n zoom(level, point) {\n // Its best to rely on the attributes here and here is why:\n // clientXYZ: Doesn't work on non-root svgs because they dont have a CSSBox (silly!)\n // getBoundingClientRect: Doesn't work because Chrome just ignores width and height of nested svgs completely\n // that means, their clientRect is always as big as the content.\n // Furthermore this size is incorrect if the element is further transformed by its parents\n // computedStyle: Only returns meaningful values if css was used with px. We dont go this route here!\n // getBBox: returns the bounding box of its content - that doesn't help!\n let { width, height } = this.attr(['width', 'height'])\n\n // Width and height is a string when a number with a unit is present which we can't use\n // So we try clientXYZ\n if (\n (!width && !height) ||\n typeof width === 'string' ||\n typeof height === 'string'\n ) {\n width = this.node.clientWidth\n height = this.node.clientHeight\n }\n\n // Giving up...\n if (!width || !height) {\n throw new Error(\n 'Impossible to get absolute width and height. Please provide an absolute width and height attribute on the zooming element'\n )\n }\n\n const v = this.viewbox()\n\n const zoomX = width / v.width\n const zoomY = height / v.height\n const zoom = Math.min(zoomX, zoomY)\n\n if (level == null) {\n return zoom\n }\n\n let zoomAmount = zoom / level\n\n // Set the zoomAmount to the highest value which is safe to process and recover from\n // The * 100 is a bit of wiggle room for the matrix transformation\n if (zoomAmount === Infinity) zoomAmount = Number.MAX_SAFE_INTEGER / 100\n\n point =\n point || new Point(width / 2 / zoomX + v.x, height / 2 / zoomY + v.y)\n\n const box = new Box(v).transform(\n new Matrix({ scale: zoomAmount, origin: point })\n )\n\n return this.viewbox(box)\n }\n }\n})\n\nregister(Box, 'Box')\n","import { extend } from '../utils/adopter.js'\n// import { subClassArray } from './ArrayPolyfill.js'\n\nclass List extends Array {\n constructor(arr = [], ...args) {\n super(arr, ...args)\n if (typeof arr === 'number') return this\n this.length = 0\n this.push(...arr)\n }\n}\n\n/* = subClassArray('List', Array, function (arr = []) {\n // This catches the case, that native map tries to create an array with new Array(1)\n if (typeof arr === 'number') return this\n this.length = 0\n this.push(...arr)\n}) */\n\nexport default List\n\nextend([List], {\n each(fnOrMethodName, ...args) {\n if (typeof fnOrMethodName === 'function') {\n return this.map((el, i, arr) => {\n return fnOrMethodName.call(el, el, i, arr)\n })\n } else {\n return this.map((el) => {\n return el[fnOrMethodName](...args)\n })\n }\n },\n\n toArray() {\n return Array.prototype.concat.apply([], this)\n }\n})\n\nconst reserved = ['toArray', 'constructor', 'each']\n\nList.extend = function (methods) {\n methods = methods.reduce((obj, name) => {\n // Don't overwrite own methods\n if (reserved.includes(name)) return obj\n\n // Don't add private methods\n if (name[0] === '_') return obj\n\n // Allow access to original Array methods through a prefix\n if (name in Array.prototype) {\n obj['$' + name] = Array.prototype[name]\n }\n\n // Relay every call to each()\n obj[name] = function (...attrs) {\n return this.each(name, ...attrs)\n }\n return obj\n }, {})\n\n extend([List], methods)\n}\n","import { adopt } from '../../utils/adopter.js'\nimport { globals } from '../../utils/window.js'\nimport { map } from '../../utils/utils.js'\nimport List from '../../types/List.js'\n\nexport default function baseFind(query, parent) {\n return new List(\n map((parent || globals.document).querySelectorAll(query), function (node) {\n return adopt(node)\n })\n )\n}\n\n// Scoped find method\nexport function find(query) {\n return baseFind(query, this.node)\n}\n\nexport function findOne(query) {\n return adopt(this.node.querySelector(query))\n}\n","import { delimiter } from './regex.js'\nimport { makeInstance } from '../../utils/adopter.js'\nimport { globals } from '../../utils/window.js'\n\nlet listenerId = 0\nexport const windowEvents = {}\n\nexport function getEvents(instance) {\n let n = instance.getEventHolder()\n\n // We dont want to save events in global space\n if (n === globals.window) n = windowEvents\n if (!n.events) n.events = {}\n return n.events\n}\n\nexport function getEventTarget(instance) {\n return instance.getEventTarget()\n}\n\nexport function clearEvents(instance) {\n let n = instance.getEventHolder()\n if (n === globals.window) n = windowEvents\n if (n.events) n.events = {}\n}\n\n// Add event binder in the SVG namespace\nexport function on(node, events, listener, binding, options) {\n const l = listener.bind(binding || node)\n const instance = makeInstance(node)\n const bag = getEvents(instance)\n const n = getEventTarget(instance)\n\n // events can be an array of events or a string of events\n events = Array.isArray(events) ? events : events.split(delimiter)\n\n // add id to listener\n if (!listener._svgjsListenerId) {\n listener._svgjsListenerId = ++listenerId\n }\n\n events.forEach(function (event) {\n const ev = event.split('.')[0]\n const ns = event.split('.')[1] || '*'\n\n // ensure valid object\n bag[ev] = bag[ev] || {}\n bag[ev][ns] = bag[ev][ns] || {}\n\n // reference listener\n bag[ev][ns][listener._svgjsListenerId] = l\n\n // add listener\n n.addEventListener(ev, l, options || false)\n })\n}\n\n// Add event unbinder in the SVG namespace\nexport function off(node, events, listener, options) {\n const instance = makeInstance(node)\n const bag = getEvents(instance)\n const n = getEventTarget(instance)\n\n // listener can be a function or a number\n if (typeof listener === 'function') {\n listener = listener._svgjsListenerId\n if (!listener) return\n }\n\n // events can be an array of events or a string or undefined\n events = Array.isArray(events) ? events : (events || '').split(delimiter)\n\n events.forEach(function (event) {\n const ev = event && event.split('.')[0]\n const ns = event && event.split('.')[1]\n let namespace, l\n\n if (listener) {\n // remove listener reference\n if (bag[ev] && bag[ev][ns || '*']) {\n // removeListener\n n.removeEventListener(\n ev,\n bag[ev][ns || '*'][listener],\n options || false\n )\n\n delete bag[ev][ns || '*'][listener]\n }\n } else if (ev && ns) {\n // remove all listeners for a namespaced event\n if (bag[ev] && bag[ev][ns]) {\n for (l in bag[ev][ns]) {\n off(n, [ev, ns].join('.'), l)\n }\n\n delete bag[ev][ns]\n }\n } else if (ns) {\n // remove all listeners for a specific namespace\n for (event in bag) {\n for (namespace in bag[event]) {\n if (ns === namespace) {\n off(n, [event, ns].join('.'))\n }\n }\n }\n } else if (ev) {\n // remove all listeners for the event\n if (bag[ev]) {\n for (namespace in bag[ev]) {\n off(n, [ev, namespace].join('.'))\n }\n\n delete bag[ev]\n }\n } else {\n // remove all listeners on a given node\n for (event in bag) {\n off(n, event)\n }\n\n clearEvents(instance)\n }\n })\n}\n\nexport function dispatch(node, event, data, options) {\n const n = getEventTarget(node)\n\n // Dispatch event\n if (event instanceof globals.window.Event) {\n n.dispatchEvent(event)\n } else {\n event = new globals.window.CustomEvent(event, {\n detail: data,\n cancelable: true,\n ...options\n })\n n.dispatchEvent(event)\n }\n return event\n}\n","import { dispatch, off, on } from '../modules/core/event.js'\nimport { register } from '../utils/adopter.js'\nimport Base from './Base.js'\n\nexport default class EventTarget extends Base {\n addEventListener() {}\n\n dispatch(event, data, options) {\n return dispatch(this, event, data, options)\n }\n\n dispatchEvent(event) {\n const bag = this.getEventHolder().events\n if (!bag) return true\n\n const events = bag[event.type]\n\n for (const i in events) {\n for (const j in events[i]) {\n events[i][j](event)\n }\n }\n\n return !event.defaultPrevented\n }\n\n // Fire given event\n fire(event, data, options) {\n this.dispatch(event, data, options)\n return this\n }\n\n getEventHolder() {\n return this\n }\n\n getEventTarget() {\n return this\n }\n\n // Unbind event from listener\n off(event, listener, options) {\n off(this, event, listener, options)\n return this\n }\n\n // Bind given event to listener\n on(event, listener, binding, options) {\n on(this, event, listener, binding, options)\n return this\n }\n\n removeEventListener() {}\n}\n\nregister(EventTarget, 'EventTarget')\n","export function noop() {}\n\n// Default animation values\nexport const timeline = {\n duration: 400,\n ease: '>',\n delay: 0\n}\n\n// Default attribute values\nexport const attrs = {\n // fill and stroke\n 'fill-opacity': 1,\n 'stroke-opacity': 1,\n 'stroke-width': 0,\n 'stroke-linejoin': 'miter',\n 'stroke-linecap': 'butt',\n fill: '#000000',\n stroke: '#000000',\n opacity: 1,\n\n // position\n x: 0,\n y: 0,\n cx: 0,\n cy: 0,\n\n // size\n width: 0,\n height: 0,\n\n // radius\n r: 0,\n rx: 0,\n ry: 0,\n\n // gradient\n offset: 0,\n 'stop-opacity': 1,\n 'stop-color': '#000000',\n\n // text\n 'text-anchor': 'start'\n}\n","import { delimiter } from '../modules/core/regex.js'\n\nexport default class SVGArray extends Array {\n constructor(...args) {\n super(...args)\n this.init(...args)\n }\n\n clone() {\n return new this.constructor(this)\n }\n\n init(arr) {\n // This catches the case, that native map tries to create an array with new Array(1)\n if (typeof arr === 'number') return this\n this.length = 0\n this.push(...this.parse(arr))\n return this\n }\n\n // Parse whitespace separated string\n parse(array = []) {\n // If already is an array, no need to parse it\n if (array instanceof Array) return array\n\n return array.trim().split(delimiter).map(parseFloat)\n }\n\n toArray() {\n return Array.prototype.concat.apply([], this)\n }\n\n toSet() {\n return new Set(this)\n }\n\n toString() {\n return this.join(' ')\n }\n\n // Flattens the array if needed\n valueOf() {\n const ret = []\n ret.push(...this)\n return ret\n }\n}\n","import { numberAndUnit } from '../modules/core/regex.js'\n\n// Module for unit conversions\nexport default class SVGNumber {\n // Initialize\n constructor(...args) {\n this.init(...args)\n }\n\n convert(unit) {\n return new SVGNumber(this.value, unit)\n }\n\n // Divide number\n divide(number) {\n number = new SVGNumber(number)\n return new SVGNumber(this / number, this.unit || number.unit)\n }\n\n init(value, unit) {\n unit = Array.isArray(value) ? value[1] : unit\n value = Array.isArray(value) ? value[0] : value\n\n // initialize defaults\n this.value = 0\n this.unit = unit || ''\n\n // parse value\n if (typeof value === 'number') {\n // ensure a valid numeric value\n this.value = isNaN(value)\n ? 0\n : !isFinite(value)\n ? value < 0\n ? -3.4e38\n : +3.4e38\n : value\n } else if (typeof value === 'string') {\n unit = value.match(numberAndUnit)\n\n if (unit) {\n // make value numeric\n this.value = parseFloat(unit[1])\n\n // normalize\n if (unit[5] === '%') {\n this.value /= 100\n } else if (unit[5] === 's') {\n this.value *= 1000\n }\n\n // store unit\n this.unit = unit[5]\n }\n } else {\n if (value instanceof SVGNumber) {\n this.value = value.valueOf()\n this.unit = value.unit\n }\n }\n\n return this\n }\n\n // Subtract number\n minus(number) {\n number = new SVGNumber(number)\n return new SVGNumber(this - number, this.unit || number.unit)\n }\n\n // Add number\n plus(number) {\n number = new SVGNumber(number)\n return new SVGNumber(this + number, this.unit || number.unit)\n }\n\n // Multiply number\n times(number) {\n number = new SVGNumber(number)\n return new SVGNumber(this * number, this.unit || number.unit)\n }\n\n toArray() {\n return [this.value, this.unit]\n }\n\n toJSON() {\n return this.toString()\n }\n\n toString() {\n return (\n (this.unit === '%'\n ? ~~(this.value * 1e8) / 1e6\n : this.unit === 's'\n ? this.value / 1e3\n : this.value) + this.unit\n )\n }\n\n valueOf() {\n return this.value\n }\n}\n","import { attrs as defaults } from './defaults.js'\nimport { isNumber } from './regex.js'\nimport Color from '../../types/Color.js'\nimport SVGArray from '../../types/SVGArray.js'\nimport SVGNumber from '../../types/SVGNumber.js'\n\nconst colorAttributes = new Set([\n 'fill',\n 'stroke',\n 'color',\n 'bgcolor',\n 'stop-color',\n 'flood-color',\n 'lighting-color'\n])\n\nconst hooks = []\nexport function registerAttrHook(fn) {\n hooks.push(fn)\n}\n\n// Set svg element attribute\nexport default function attr(attr, val, ns) {\n // act as full getter\n if (attr == null) {\n // get an object of attributes\n attr = {}\n val = this.node.attributes\n\n for (const node of val) {\n attr[node.nodeName] = isNumber.test(node.nodeValue)\n ? parseFloat(node.nodeValue)\n : node.nodeValue\n }\n\n return attr\n } else if (attr instanceof Array) {\n // loop through array and get all values\n return attr.reduce((last, curr) => {\n last[curr] = this.attr(curr)\n return last\n }, {})\n } else if (typeof attr === 'object' && attr.constructor === Object) {\n // apply every attribute individually if an object is passed\n for (val in attr) this.attr(val, attr[val])\n } else if (val === null) {\n // remove value\n this.node.removeAttribute(attr)\n } else if (val == null) {\n // act as a getter if the first and only argument is not an object\n val = this.node.getAttribute(attr)\n return val == null\n ? defaults[attr]\n : isNumber.test(val)\n ? parseFloat(val)\n : val\n } else {\n // Loop through hooks and execute them to convert value\n val = hooks.reduce((_val, hook) => {\n return hook(attr, _val, this)\n }, val)\n\n // ensure correct numeric values (also accepts NaN and Infinity)\n if (typeof val === 'number') {\n val = new SVGNumber(val)\n } else if (colorAttributes.has(attr) && Color.isColor(val)) {\n // ensure full hex color\n val = new Color(val)\n } else if (val.constructor === Array) {\n // Check for plain arrays and parse array values\n val = new SVGArray(val)\n }\n\n // if the passed attribute is leading...\n if (attr === 'leading') {\n // ... call the leading method instead\n if (this.leading) {\n this.leading(val)\n }\n } else {\n // set given attribute on node\n typeof ns === 'string'\n ? this.node.setAttributeNS(ns, attr, val.toString())\n : this.node.setAttribute(attr, val.toString())\n }\n\n // rebuild if required\n if (this.rebuild && (attr === 'font-size' || attr === 'x')) {\n this.rebuild()\n }\n }\n\n return this\n}\n","import {\n adopt,\n assignNewId,\n eid,\n extend,\n makeInstance,\n create,\n register\n} from '../utils/adopter.js'\nimport { find, findOne } from '../modules/core/selector.js'\nimport { globals } from '../utils/window.js'\nimport { map } from '../utils/utils.js'\nimport { svg, html } from '../modules/core/namespaces.js'\nimport EventTarget from '../types/EventTarget.js'\nimport List from '../types/List.js'\nimport attr from '../modules/core/attr.js'\n\nexport default class Dom extends EventTarget {\n constructor(node, attrs) {\n super()\n this.node = node\n this.type = node.nodeName\n\n if (attrs && node !== attrs) {\n this.attr(attrs)\n }\n }\n\n // Add given element at a position\n add(element, i) {\n element = makeInstance(element)\n\n // If non-root svg nodes are added we have to remove their namespaces\n if (\n element.removeNamespace &&\n this.node instanceof globals.window.SVGElement\n ) {\n element.removeNamespace()\n }\n\n if (i == null) {\n this.node.appendChild(element.node)\n } else if (element.node !== this.node.childNodes[i]) {\n this.node.insertBefore(element.node, this.node.childNodes[i])\n }\n\n return this\n }\n\n // Add element to given container and return self\n addTo(parent, i) {\n return makeInstance(parent).put(this, i)\n }\n\n // Returns all child elements\n children() {\n return new List(\n map(this.node.children, function (node) {\n return adopt(node)\n })\n )\n }\n\n // Remove all elements in this container\n clear() {\n // remove children\n while (this.node.hasChildNodes()) {\n this.node.removeChild(this.node.lastChild)\n }\n\n return this\n }\n\n // Clone element\n clone(deep = true, assignNewIds = true) {\n // write dom data to the dom so the clone can pickup the data\n this.writeDataToDom()\n\n // clone element\n let nodeClone = this.node.cloneNode(deep)\n if (assignNewIds) {\n // assign new id\n nodeClone = assignNewId(nodeClone)\n }\n return new this.constructor(nodeClone)\n }\n\n // Iterates over all children and invokes a given block\n each(block, deep) {\n const children = this.children()\n let i, il\n\n for (i = 0, il = children.length; i < il; i++) {\n block.apply(children[i], [i, children])\n\n if (deep) {\n children[i].each(block, deep)\n }\n }\n\n return this\n }\n\n element(nodeName, attrs) {\n return this.put(new Dom(create(nodeName), attrs))\n }\n\n // Get first child\n first() {\n return adopt(this.node.firstChild)\n }\n\n // Get a element at the given index\n get(i) {\n return adopt(this.node.childNodes[i])\n }\n\n getEventHolder() {\n return this.node\n }\n\n getEventTarget() {\n return this.node\n }\n\n // Checks if the given element is a child\n has(element) {\n return this.index(element) >= 0\n }\n\n html(htmlOrFn, outerHTML) {\n return this.xml(htmlOrFn, outerHTML, html)\n }\n\n // Get / set id\n id(id) {\n // generate new id if no id set\n if (typeof id === 'undefined' && !this.node.id) {\n this.node.id = eid(this.type)\n }\n\n // don't set directly with this.node.id to make `null` work correctly\n return this.attr('id', id)\n }\n\n // Gets index of given element\n index(element) {\n return [].slice.call(this.node.childNodes).indexOf(element.node)\n }\n\n // Get the last child\n last() {\n return adopt(this.node.lastChild)\n }\n\n // matches the element vs a css selector\n matches(selector) {\n const el = this.node\n const matcher =\n el.matches ||\n el.matchesSelector ||\n el.msMatchesSelector ||\n el.mozMatchesSelector ||\n el.webkitMatchesSelector ||\n el.oMatchesSelector ||\n null\n return matcher && matcher.call(el, selector)\n }\n\n // Returns the parent element instance\n parent(type) {\n let parent = this\n\n // check for parent\n if (!parent.node.parentNode) return null\n\n // get parent element\n parent = adopt(parent.node.parentNode)\n\n if (!type) return parent\n\n // loop through ancestors if type is given\n do {\n if (\n typeof type === 'string' ? parent.matches(type) : parent instanceof type\n )\n return parent\n } while ((parent = adopt(parent.node.parentNode)))\n\n return parent\n }\n\n // Basically does the same as `add()` but returns the added element instead\n put(element, i) {\n element = makeInstance(element)\n this.add(element, i)\n return element\n }\n\n // Add element to given container and return container\n putIn(parent, i) {\n return makeInstance(parent).add(this, i)\n }\n\n // Remove element\n remove() {\n if (this.parent()) {\n this.parent().removeElement(this)\n }\n\n return this\n }\n\n // Remove a given child\n removeElement(element) {\n this.node.removeChild(element.node)\n\n return this\n }\n\n // Replace this with element\n replace(element) {\n element = makeInstance(element)\n\n if (this.node.parentNode) {\n this.node.parentNode.replaceChild(element.node, this.node)\n }\n\n return element\n }\n\n round(precision = 2, map = null) {\n const factor = 10 ** precision\n const attrs = this.attr(map)\n\n for (const i in attrs) {\n if (typeof attrs[i] === 'number') {\n attrs[i] = Math.round(attrs[i] * factor) / factor\n }\n }\n\n this.attr(attrs)\n return this\n }\n\n // Import / Export raw svg\n svg(svgOrFn, outerSVG) {\n return this.xml(svgOrFn, outerSVG, svg)\n }\n\n // Return id on string conversion\n toString() {\n return this.id()\n }\n\n words(text) {\n // This is faster than removing all children and adding a new one\n this.node.textContent = text\n return this\n }\n\n wrap(node) {\n const parent = this.parent()\n\n if (!parent) {\n return this.addTo(node)\n }\n\n const position = parent.index(this)\n return parent.put(node, position).put(this)\n }\n\n // write svgjs data to the dom\n writeDataToDom() {\n // dump variables recursively\n this.each(function () {\n this.writeDataToDom()\n })\n\n return this\n }\n\n // Import / Export raw svg\n xml(xmlOrFn, outerXML, ns) {\n if (typeof xmlOrFn === 'boolean') {\n ns = outerXML\n outerXML = xmlOrFn\n xmlOrFn = null\n }\n\n // act as getter if no svg string is given\n if (xmlOrFn == null || typeof xmlOrFn === 'function') {\n // The default for exports is, that the outerNode is included\n outerXML = outerXML == null ? true : outerXML\n\n // write svgjs data to the dom\n this.writeDataToDom()\n let current = this\n\n // An export modifier was passed\n if (xmlOrFn != null) {\n current = adopt(current.node.cloneNode(true))\n\n // If the user wants outerHTML we need to process this node, too\n if (outerXML) {\n const result = xmlOrFn(current)\n current = result || current\n\n // The user does not want this node? Well, then he gets nothing\n if (result === false) return ''\n }\n\n // Deep loop through all children and apply modifier\n current.each(function () {\n const result = xmlOrFn(this)\n const _this = result || this\n\n // If modifier returns false, discard node\n if (result === false) {\n this.remove()\n\n // If modifier returns new node, use it\n } else if (result && this !== _this) {\n this.replace(_this)\n }\n }, true)\n }\n\n // Return outer or inner content\n return outerXML ? current.node.outerHTML : current.node.innerHTML\n }\n\n // Act as setter if we got a string\n\n // The default for import is, that the current node is not replaced\n outerXML = outerXML == null ? false : outerXML\n\n // Create temporary holder\n const well = create('wrapper', ns)\n const fragment = globals.document.createDocumentFragment()\n\n // Dump raw svg\n well.innerHTML = xmlOrFn\n\n // Transplant nodes into the fragment\n for (let len = well.children.length; len--; ) {\n fragment.appendChild(well.firstElementChild)\n }\n\n const parent = this.parent()\n\n // Add the whole fragment at once\n return outerXML ? this.replace(fragment) && parent : this.add(fragment)\n }\n}\n\nextend(Dom, { attr, find, findOne })\nregister(Dom, 'Dom')\n","import { bbox, rbox, inside } from '../types/Box.js'\nimport { ctm, screenCTM } from '../types/Matrix.js'\nimport {\n extend,\n getClass,\n makeInstance,\n register,\n root\n} from '../utils/adopter.js'\nimport { globals } from '../utils/window.js'\nimport { point } from '../types/Point.js'\nimport { proportionalSize, writeDataToDom } from '../utils/utils.js'\nimport { reference } from '../modules/core/regex.js'\nimport Dom from './Dom.js'\nimport List from '../types/List.js'\nimport SVGNumber from '../types/SVGNumber.js'\n\nexport default class Element extends Dom {\n constructor(node, attrs) {\n super(node, attrs)\n\n // initialize data object\n this.dom = {}\n\n // create circular reference\n this.node.instance = this\n\n if (node.hasAttribute('data-svgjs') || node.hasAttribute('svgjs:data')) {\n // pull svgjs data from the dom (getAttributeNS doesn't work in html5)\n this.setData(\n JSON.parse(node.getAttribute('data-svgjs')) ??\n JSON.parse(node.getAttribute('svgjs:data')) ??\n {}\n )\n }\n }\n\n // Move element by its center\n center(x, y) {\n return this.cx(x).cy(y)\n }\n\n // Move by center over x-axis\n cx(x) {\n return x == null\n ? this.x() + this.width() / 2\n : this.x(x - this.width() / 2)\n }\n\n // Move by center over y-axis\n cy(y) {\n return y == null\n ? this.y() + this.height() / 2\n : this.y(y - this.height() / 2)\n }\n\n // Get defs\n defs() {\n const root = this.root()\n return root && root.defs()\n }\n\n // Relative move over x and y axes\n dmove(x, y) {\n return this.dx(x).dy(y)\n }\n\n // Relative move over x axis\n dx(x = 0) {\n return this.x(new SVGNumber(x).plus(this.x()))\n }\n\n // Relative move over y axis\n dy(y = 0) {\n return this.y(new SVGNumber(y).plus(this.y()))\n }\n\n getEventHolder() {\n return this\n }\n\n // Set height of element\n height(height) {\n return this.attr('height', height)\n }\n\n // Move element to given x and y values\n move(x, y) {\n return this.x(x).y(y)\n }\n\n // return array of all ancestors of given type up to the root svg\n parents(until = this.root()) {\n const isSelector = typeof until === 'string'\n if (!isSelector) {\n until = makeInstance(until)\n }\n const parents = new List()\n let parent = this\n\n while (\n (parent = parent.parent()) &&\n parent.node !== globals.document &&\n parent.nodeName !== '#document-fragment'\n ) {\n parents.push(parent)\n\n if (!isSelector && parent.node === until.node) {\n break\n }\n if (isSelector && parent.matches(until)) {\n break\n }\n if (parent.node === this.root().node) {\n // We worked our way to the root and didn't match `until`\n return null\n }\n }\n\n return parents\n }\n\n // Get referenced element form attribute value\n reference(attr) {\n attr = this.attr(attr)\n if (!attr) return null\n\n const m = (attr + '').match(reference)\n return m ? makeInstance(m[1]) : null\n }\n\n // Get parent document\n root() {\n const p = this.parent(getClass(root))\n return p && p.root()\n }\n\n // set given data to the elements data property\n setData(o) {\n this.dom = o\n return this\n }\n\n // Set element size to given width and height\n size(width, height) {\n const p = proportionalSize(this, width, height)\n\n return this.width(new SVGNumber(p.width)).height(new SVGNumber(p.height))\n }\n\n // Set width of element\n width(width) {\n return this.attr('width', width)\n }\n\n // write svgjs data to the dom\n writeDataToDom() {\n writeDataToDom(this, this.dom)\n return super.writeDataToDom()\n }\n\n // Move over x-axis\n x(x) {\n return this.attr('x', x)\n }\n\n // Move over y-axis\n y(y) {\n return this.attr('y', y)\n }\n}\n\nextend(Element, {\n bbox,\n rbox,\n inside,\n point,\n ctm,\n screenCTM\n})\n\nregister(Element, 'Element')\n","import { registerMethods } from '../../utils/methods.js'\nimport Color from '../../types/Color.js'\nimport Element from '../../elements/Element.js'\nimport Matrix from '../../types/Matrix.js'\nimport Point from '../../types/Point.js'\nimport SVGNumber from '../../types/SVGNumber.js'\n\n// Define list of available attributes for stroke and fill\nconst sugar = {\n stroke: [\n 'color',\n 'width',\n 'opacity',\n 'linecap',\n 'linejoin',\n 'miterlimit',\n 'dasharray',\n 'dashoffset'\n ],\n fill: ['color', 'opacity', 'rule'],\n prefix: function (t, a) {\n return a === 'color' ? t : t + '-' + a\n }\n}\n\n// Add sugar for fill and stroke\n;['fill', 'stroke'].forEach(function (m) {\n const extension = {}\n let i\n\n extension[m] = function (o) {\n if (typeof o === 'undefined') {\n return this.attr(m)\n }\n if (\n typeof o === 'string' ||\n o instanceof Color ||\n Color.isRgb(o) ||\n o instanceof Element\n ) {\n this.attr(m, o)\n } else {\n // set all attributes from sugar.fill and sugar.stroke list\n for (i = sugar[m].length - 1; i >= 0; i--) {\n if (o[sugar[m][i]] != null) {\n this.attr(sugar.prefix(m, sugar[m][i]), o[sugar[m][i]])\n }\n }\n }\n\n return this\n }\n\n registerMethods(['Element', 'Runner'], extension)\n})\n\nregisterMethods(['Element', 'Runner'], {\n // Let the user set the matrix directly\n matrix: function (mat, b, c, d, e, f) {\n // Act as a getter\n if (mat == null) {\n return new Matrix(this)\n }\n\n // Act as a setter, the user can pass a matrix or a set of numbers\n return this.attr('transform', new Matrix(mat, b, c, d, e, f))\n },\n\n // Map rotation to transform\n rotate: function (angle, cx, cy) {\n return this.transform({ rotate: angle, ox: cx, oy: cy }, true)\n },\n\n // Map skew to transform\n skew: function (x, y, cx, cy) {\n return arguments.length === 1 || arguments.length === 3\n ? this.transform({ skew: x, ox: y, oy: cx }, true)\n : this.transform({ skew: [x, y], ox: cx, oy: cy }, true)\n },\n\n shear: function (lam, cx, cy) {\n return this.transform({ shear: lam, ox: cx, oy: cy }, true)\n },\n\n // Map scale to transform\n scale: function (x, y, cx, cy) {\n return arguments.length === 1 || arguments.length === 3\n ? this.transform({ scale: x, ox: y, oy: cx }, true)\n : this.transform({ scale: [x, y], ox: cx, oy: cy }, true)\n },\n\n // Map translate to transform\n translate: function (x, y) {\n return this.transform({ translate: [x, y] }, true)\n },\n\n // Map relative translations to transform\n relative: function (x, y) {\n return this.transform({ relative: [x, y] }, true)\n },\n\n // Map flip to transform\n flip: function (direction = 'both', origin = 'center') {\n if ('xybothtrue'.indexOf(direction) === -1) {\n origin = direction\n direction = 'both'\n }\n\n return this.transform({ flip: direction, origin: origin }, true)\n },\n\n // Opacity\n opacity: function (value) {\n return this.attr('opacity', value)\n }\n})\n\nregisterMethods('radius', {\n // Add x and y radius\n radius: function (x, y = x) {\n const type = (this._element || this).type\n return type === 'radialGradient'\n ? this.attr('r', new SVGNumber(x))\n : this.rx(x).ry(y)\n }\n})\n\nregisterMethods('Path', {\n // Get path length\n length: function () {\n return this.node.getTotalLength()\n },\n // Get point at length\n pointAt: function (length) {\n return new Point(this.node.getPointAtLength(length))\n }\n})\n\nregisterMethods(['Element', 'Runner'], {\n // Set font\n font: function (a, v) {\n if (typeof a === 'object') {\n for (v in a) this.font(v, a[v])\n return this\n }\n\n return a === 'leading'\n ? this.leading(v)\n : a === 'anchor'\n ? this.attr('text-anchor', v)\n : a === 'size' ||\n a === 'family' ||\n a === 'weight' ||\n a === 'stretch' ||\n a === 'variant' ||\n a === 'style'\n ? this.attr('font-' + a, v)\n : this.attr(a, v)\n }\n})\n\n// Add events to elements\nconst methods = [\n 'click',\n 'dblclick',\n 'mousedown',\n 'mouseup',\n 'mouseover',\n 'mouseout',\n 'mousemove',\n 'mouseenter',\n 'mouseleave',\n 'touchstart',\n 'touchmove',\n 'touchleave',\n 'touchend',\n 'touchcancel',\n 'contextmenu',\n 'wheel',\n 'pointerdown',\n 'pointermove',\n 'pointerup',\n 'pointerleave',\n 'pointercancel'\n].reduce(function (last, event) {\n // add event to Element\n const fn = function (f) {\n if (f === null) {\n this.off(event)\n } else {\n this.on(event, f)\n }\n return this\n }\n\n last[event] = fn\n return last\n}, {})\n\nregisterMethods('Element', methods)\n","import { getOrigin, isDescriptive } from '../../utils/utils.js'\nimport { delimiter, transforms } from '../core/regex.js'\nimport { registerMethods } from '../../utils/methods.js'\nimport Matrix from '../../types/Matrix.js'\n\n// Reset all transformations\nexport function untransform() {\n return this.attr('transform', null)\n}\n\n// merge the whole transformation chain into one matrix and returns it\nexport function matrixify() {\n const matrix = (this.attr('transform') || '')\n // split transformations\n .split(transforms)\n .slice(0, -1)\n .map(function (str) {\n // generate key => value pairs\n const kv = str.trim().split('(')\n return [\n kv[0],\n kv[1].split(delimiter).map(function (str) {\n return parseFloat(str)\n })\n ]\n })\n .reverse()\n // merge every transformation into one matrix\n .reduce(function (matrix, transform) {\n if (transform[0] === 'matrix') {\n return matrix.lmultiply(Matrix.fromArray(transform[1]))\n }\n return matrix[transform[0]].apply(matrix, transform[1])\n }, new Matrix())\n\n return matrix\n}\n\n// add an element to another parent without changing the visual representation on the screen\nexport function toParent(parent, i) {\n if (this === parent) return this\n\n if (isDescriptive(this.node)) return this.addTo(parent, i)\n\n const ctm = this.screenCTM()\n const pCtm = parent.screenCTM().inverse()\n\n this.addTo(parent, i).untransform().transform(pCtm.multiply(ctm))\n\n return this\n}\n\n// same as above with parent equals root-svg\nexport function toRoot(i) {\n return this.toParent(this.root(), i)\n}\n\n// Add transformations\nexport function transform(o, relative) {\n // Act as a getter if no object was passed\n if (o == null || typeof o === 'string') {\n const decomposed = new Matrix(this).decompose()\n return o == null ? decomposed : decomposed[o]\n }\n\n if (!Matrix.isMatrixLike(o)) {\n // Set the origin according to the defined transform\n o = { ...o, origin: getOrigin(o, this) }\n }\n\n // The user can pass a boolean, an Element or an Matrix or nothing\n const cleanRelative = relative === true ? this : relative || false\n const result = new Matrix(cleanRelative).transform(o)\n return this.attr('transform', result)\n}\n\nregisterMethods('Element', {\n untransform,\n matrixify,\n toParent,\n toRoot,\n transform\n})\n","import { register } from '../utils/adopter.js'\nimport Element from './Element.js'\n\nexport default class Container extends Element {\n flatten() {\n this.each(function () {\n if (this instanceof Container) {\n return this.flatten().ungroup()\n }\n })\n\n return this\n }\n\n ungroup(parent = this.parent(), index = parent.index(this)) {\n // when parent != this, we want append all elements to the end\n index = index === -1 ? parent.children().length : index\n\n this.each(function (i, children) {\n // reverse each\n return children[children.length - i - 1].toParent(parent, index)\n })\n\n return this.remove()\n }\n}\n\nregister(Container, 'Container')\n","import { nodeOrNew, register } from '../utils/adopter.js'\nimport Container from './Container.js'\n\nexport default class Defs extends Container {\n constructor(node, attrs = node) {\n super(nodeOrNew('defs', node), attrs)\n }\n\n flatten() {\n return this\n }\n\n ungroup() {\n return this\n }\n}\n\nregister(Defs, 'Defs')\n","import { register } from '../utils/adopter.js'\nimport Element from './Element.js'\n\nexport default class Shape extends Element {}\n\nregister(Shape, 'Shape')\n","import SVGNumber from '../../types/SVGNumber.js'\n\n// Radius x value\nexport function rx(rx) {\n return this.attr('rx', rx)\n}\n\n// Radius y value\nexport function ry(ry) {\n return this.attr('ry', ry)\n}\n\n// Move over x-axis\nexport function x(x) {\n return x == null ? this.cx() - this.rx() : this.cx(x + this.rx())\n}\n\n// Move over y-axis\nexport function y(y) {\n return y == null ? this.cy() - this.ry() : this.cy(y + this.ry())\n}\n\n// Move by center over x-axis\nexport function cx(x) {\n return this.attr('cx', x)\n}\n\n// Move by center over y-axis\nexport function cy(y) {\n return this.attr('cy', y)\n}\n\n// Set width of element\nexport function width(width) {\n return width == null ? this.rx() * 2 : this.rx(new SVGNumber(width).divide(2))\n}\n\n// Set height of element\nexport function height(height) {\n return height == null\n ? this.ry() * 2\n : this.ry(new SVGNumber(height).divide(2))\n}\n","import {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { proportionalSize } from '../utils/utils.js'\nimport { registerMethods } from '../utils/methods.js'\nimport SVGNumber from '../types/SVGNumber.js'\nimport Shape from './Shape.js'\nimport * as circled from '../modules/core/circled.js'\n\nexport default class Ellipse extends Shape {\n constructor(node, attrs = node) {\n super(nodeOrNew('ellipse', node), attrs)\n }\n\n size(width, height) {\n const p = proportionalSize(this, width, height)\n\n return this.rx(new SVGNumber(p.width).divide(2)).ry(\n new SVGNumber(p.height).divide(2)\n )\n }\n}\n\nextend(Ellipse, circled)\n\nregisterMethods('Container', {\n // Create an ellipse\n ellipse: wrapWithAttrCheck(function (width = 0, height = width) {\n return this.put(new Ellipse()).size(width, height).move(0, 0)\n })\n})\n\nregister(Ellipse, 'Ellipse')\n","import Dom from './Dom.js'\nimport { globals } from '../utils/window.js'\nimport { register, create } from '../utils/adopter.js'\n\nclass Fragment extends Dom {\n constructor(node = globals.document.createDocumentFragment()) {\n super(node)\n }\n\n // Import / Export raw xml\n xml(xmlOrFn, outerXML, ns) {\n if (typeof xmlOrFn === 'boolean') {\n ns = outerXML\n outerXML = xmlOrFn\n xmlOrFn = null\n }\n\n // because this is a fragment we have to put all elements into a wrapper first\n // before we can get the innerXML from it\n if (xmlOrFn == null || typeof xmlOrFn === 'function') {\n const wrapper = new Dom(create('wrapper', ns))\n wrapper.add(this.node.cloneNode(true))\n\n return wrapper.xml(false, ns)\n }\n\n // Act as setter if we got a string\n return super.xml(xmlOrFn, false, ns)\n }\n}\n\nregister(Fragment, 'Fragment')\n\nexport default Fragment\n","import SVGNumber from '../../types/SVGNumber.js'\n\nexport function from(x, y) {\n return (this._element || this).type === 'radialGradient'\n ? this.attr({ fx: new SVGNumber(x), fy: new SVGNumber(y) })\n : this.attr({ x1: new SVGNumber(x), y1: new SVGNumber(y) })\n}\n\nexport function to(x, y) {\n return (this._element || this).type === 'radialGradient'\n ? this.attr({ cx: new SVGNumber(x), cy: new SVGNumber(y) })\n : this.attr({ x2: new SVGNumber(x), y2: new SVGNumber(y) })\n}\n","import {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Box from '../types/Box.js'\nimport Container from './Container.js'\nimport baseFind from '../modules/core/selector.js'\nimport * as gradiented from '../modules/core/gradiented.js'\n\nexport default class Gradient extends Container {\n constructor(type, attrs) {\n super(\n nodeOrNew(type + 'Gradient', typeof type === 'string' ? null : type),\n attrs\n )\n }\n\n // custom attr to handle transform\n attr(a, b, c) {\n if (a === 'transform') a = 'gradientTransform'\n return super.attr(a, b, c)\n }\n\n bbox() {\n return new Box()\n }\n\n targets() {\n return baseFind('svg [fill*=' + this.id() + ']')\n }\n\n // Alias string conversion to fill\n toString() {\n return this.url()\n }\n\n // Update gradient\n update(block) {\n // remove all stops\n this.clear()\n\n // invoke passed block\n if (typeof block === 'function') {\n block.call(this, this)\n }\n\n return this\n }\n\n // Return the fill id\n url() {\n return 'url(#' + this.id() + ')'\n }\n}\n\nextend(Gradient, gradiented)\n\nregisterMethods({\n Container: {\n // Create gradient element in defs\n gradient(...args) {\n return this.defs().gradient(...args)\n }\n },\n // define gradient\n Defs: {\n gradient: wrapWithAttrCheck(function (type, block) {\n return this.put(new Gradient(type)).update(block)\n })\n }\n})\n\nregister(Gradient, 'Gradient')\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Box from '../types/Box.js'\nimport Container from './Container.js'\nimport baseFind from '../modules/core/selector.js'\n\nexport default class Pattern extends Container {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('pattern', node), attrs)\n }\n\n // custom attr to handle transform\n attr(a, b, c) {\n if (a === 'transform') a = 'patternTransform'\n return super.attr(a, b, c)\n }\n\n bbox() {\n return new Box()\n }\n\n targets() {\n return baseFind('svg [fill*=' + this.id() + ']')\n }\n\n // Alias string conversion to fill\n toString() {\n return this.url()\n }\n\n // Update pattern by rebuilding\n update(block) {\n // remove content\n this.clear()\n\n // invoke passed block\n if (typeof block === 'function') {\n block.call(this, this)\n }\n\n return this\n }\n\n // Return the fill id\n url() {\n return 'url(#' + this.id() + ')'\n }\n}\n\nregisterMethods({\n Container: {\n // Create pattern element in defs\n pattern(...args) {\n return this.defs().pattern(...args)\n }\n },\n Defs: {\n pattern: wrapWithAttrCheck(function (width, height, block) {\n return this.put(new Pattern()).update(block).attr({\n x: 0,\n y: 0,\n width: width,\n height: height,\n patternUnits: 'userSpaceOnUse'\n })\n })\n }\n})\n\nregister(Pattern, 'Pattern')\n","import { isImage } from '../modules/core/regex.js'\nimport { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { off, on } from '../modules/core/event.js'\nimport { registerAttrHook } from '../modules/core/attr.js'\nimport { registerMethods } from '../utils/methods.js'\nimport { xlink } from '../modules/core/namespaces.js'\nimport Pattern from './Pattern.js'\nimport Shape from './Shape.js'\nimport { globals } from '../utils/window.js'\n\nexport default class Image extends Shape {\n constructor(node, attrs = node) {\n super(nodeOrNew('image', node), attrs)\n }\n\n // (re)load image\n load(url, callback) {\n if (!url) return this\n\n const img = new globals.window.Image()\n\n on(\n img,\n 'load',\n function (e) {\n const p = this.parent(Pattern)\n\n // ensure image size\n if (this.width() === 0 && this.height() === 0) {\n this.size(img.width, img.height)\n }\n\n if (p instanceof Pattern) {\n // ensure pattern size if not set\n if (p.width() === 0 && p.height() === 0) {\n p.size(this.width(), this.height())\n }\n }\n\n if (typeof callback === 'function') {\n callback.call(this, e)\n }\n },\n this\n )\n\n on(img, 'load error', function () {\n // dont forget to unbind memory leaking events\n off(img)\n })\n\n return this.attr('href', (img.src = url), xlink)\n }\n}\n\nregisterAttrHook(function (attr, val, _this) {\n // convert image fill and stroke to patterns\n if (attr === 'fill' || attr === 'stroke') {\n if (isImage.test(val)) {\n val = _this.root().defs().image(val)\n }\n }\n\n if (val instanceof Image) {\n val = _this\n .root()\n .defs()\n .pattern(0, 0, (pattern) => {\n pattern.add(val)\n })\n }\n\n return val\n})\n\nregisterMethods({\n Container: {\n // create image element, load image and set its size\n image: wrapWithAttrCheck(function (source, callback) {\n return this.put(new Image()).size(0, 0).load(source, callback)\n })\n }\n})\n\nregister(Image, 'Image')\n","import { delimiter } from '../modules/core/regex.js'\nimport SVGArray from './SVGArray.js'\nimport Box from './Box.js'\nimport Matrix from './Matrix.js'\n\nexport default class PointArray extends SVGArray {\n // Get bounding box of points\n bbox() {\n let maxX = -Infinity\n let maxY = -Infinity\n let minX = Infinity\n let minY = Infinity\n this.forEach(function (el) {\n maxX = Math.max(el[0], maxX)\n maxY = Math.max(el[1], maxY)\n minX = Math.min(el[0], minX)\n minY = Math.min(el[1], minY)\n })\n return new Box(minX, minY, maxX - minX, maxY - minY)\n }\n\n // Move point string\n move(x, y) {\n const box = this.bbox()\n\n // get relative offset\n x -= box.x\n y -= box.y\n\n // move every point\n if (!isNaN(x) && !isNaN(y)) {\n for (let i = this.length - 1; i >= 0; i--) {\n this[i] = [this[i][0] + x, this[i][1] + y]\n }\n }\n\n return this\n }\n\n // Parse point string and flat array\n parse(array = [0, 0]) {\n const points = []\n\n // if it is an array, we flatten it and therefore clone it to 1 depths\n if (array instanceof Array) {\n array = Array.prototype.concat.apply([], array)\n } else {\n // Else, it is considered as a string\n // parse points\n array = array.trim().split(delimiter).map(parseFloat)\n }\n\n // validate points - https://svgwg.org/svg2-draft/shapes.html#DataTypePoints\n // Odd number of coordinates is an error. In such cases, drop the last odd coordinate.\n if (array.length % 2 !== 0) array.pop()\n\n // wrap points in two-tuples\n for (let i = 0, len = array.length; i < len; i = i + 2) {\n points.push([array[i], array[i + 1]])\n }\n\n return points\n }\n\n // Resize poly string\n size(width, height) {\n let i\n const box = this.bbox()\n\n // recalculate position of all points according to new size\n for (i = this.length - 1; i >= 0; i--) {\n if (box.width)\n this[i][0] = ((this[i][0] - box.x) * width) / box.width + box.x\n if (box.height)\n this[i][1] = ((this[i][1] - box.y) * height) / box.height + box.y\n }\n\n return this\n }\n\n // Convert array to line object\n toLine() {\n return {\n x1: this[0][0],\n y1: this[0][1],\n x2: this[1][0],\n y2: this[1][1]\n }\n }\n\n // Convert array to string\n toString() {\n const array = []\n // convert to a poly point string\n for (let i = 0, il = this.length; i < il; i++) {\n array.push(this[i].join(','))\n }\n\n return array.join(' ')\n }\n\n transform(m) {\n return this.clone().transformO(m)\n }\n\n // transform points with matrix (similar to Point.transform)\n transformO(m) {\n if (!Matrix.isMatrixLike(m)) {\n m = new Matrix(m)\n }\n\n for (let i = this.length; i--; ) {\n // Perform the matrix multiplication\n const [x, y] = this[i]\n this[i][0] = m.a * x + m.c * y + m.e\n this[i][1] = m.b * x + m.d * y + m.f\n }\n\n return this\n }\n}\n","import PointArray from '../../types/PointArray.js'\n\nexport const MorphArray = PointArray\n\n// Move by left top corner over x-axis\nexport function x(x) {\n return x == null ? this.bbox().x : this.move(x, this.bbox().y)\n}\n\n// Move by left top corner over y-axis\nexport function y(y) {\n return y == null ? this.bbox().y : this.move(this.bbox().x, y)\n}\n\n// Set width of element\nexport function width(width) {\n const b = this.bbox()\n return width == null ? b.width : this.size(width, b.height)\n}\n\n// Set height of element\nexport function height(height) {\n const b = this.bbox()\n return height == null ? b.height : this.size(b.width, height)\n}\n","import {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { proportionalSize } from '../utils/utils.js'\nimport { registerMethods } from '../utils/methods.js'\nimport PointArray from '../types/PointArray.js'\nimport Shape from './Shape.js'\nimport * as pointed from '../modules/core/pointed.js'\n\nexport default class Line extends Shape {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('line', node), attrs)\n }\n\n // Get array\n array() {\n return new PointArray([\n [this.attr('x1'), this.attr('y1')],\n [this.attr('x2'), this.attr('y2')]\n ])\n }\n\n // Move by left top corner\n move(x, y) {\n return this.attr(this.array().move(x, y).toLine())\n }\n\n // Overwrite native plot() method\n plot(x1, y1, x2, y2) {\n if (x1 == null) {\n return this.array()\n } else if (typeof y1 !== 'undefined') {\n x1 = { x1, y1, x2, y2 }\n } else {\n x1 = new PointArray(x1).toLine()\n }\n\n return this.attr(x1)\n }\n\n // Set element size to given width and height\n size(width, height) {\n const p = proportionalSize(this, width, height)\n return this.attr(this.array().size(p.width, p.height).toLine())\n }\n}\n\nextend(Line, pointed)\n\nregisterMethods({\n Container: {\n // Create a line element\n line: wrapWithAttrCheck(function (...args) {\n // make sure plot is called as a setter\n // x1 is not necessarily a number, it can also be an array, a string and a PointArray\n return Line.prototype.plot.apply(\n this.put(new Line()),\n args[0] != null ? args : [0, 0, 0, 0]\n )\n })\n }\n})\n\nregister(Line, 'Line')\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Container from './Container.js'\n\nexport default class Marker extends Container {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('marker', node), attrs)\n }\n\n // Set height of element\n height(height) {\n return this.attr('markerHeight', height)\n }\n\n orient(orient) {\n return this.attr('orient', orient)\n }\n\n // Set marker refX and refY\n ref(x, y) {\n return this.attr('refX', x).attr('refY', y)\n }\n\n // Return the fill id\n toString() {\n return 'url(#' + this.id() + ')'\n }\n\n // Update marker\n update(block) {\n // remove all content\n this.clear()\n\n // invoke passed block\n if (typeof block === 'function') {\n block.call(this, this)\n }\n\n return this\n }\n\n // Set width of element\n width(width) {\n return this.attr('markerWidth', width)\n }\n}\n\nregisterMethods({\n Container: {\n marker(...args) {\n // Create marker element in defs\n return this.defs().marker(...args)\n }\n },\n Defs: {\n // Create marker\n marker: wrapWithAttrCheck(function (width, height, block) {\n // Set default viewbox to match the width and height, set ref to cx and cy and set orient to auto\n return this.put(new Marker())\n .size(width, height)\n .ref(width / 2, height / 2)\n .viewbox(0, 0, width, height)\n .attr('orient', 'auto')\n .update(block)\n })\n },\n marker: {\n // Create and attach markers\n marker(marker, width, height, block) {\n let attr = ['marker']\n\n // Build attribute name\n if (marker !== 'all') attr.push(marker)\n attr = attr.join('-')\n\n // Set marker attribute\n marker =\n arguments[1] instanceof Marker\n ? arguments[1]\n : this.defs().marker(width, height, block)\n\n return this.attr(attr, marker)\n }\n }\n})\n\nregister(Marker, 'Marker')\n","import { timeline } from '../modules/core/defaults.js'\nimport { extend } from '../utils/adopter.js'\n\n/***\nBase Class\n==========\nThe base stepper class that will be\n***/\n\nfunction makeSetterGetter(k, f) {\n return function (v) {\n if (v == null) return this[k]\n this[k] = v\n if (f) f.call(this)\n return this\n }\n}\n\nexport const easing = {\n '-': function (pos) {\n return pos\n },\n '<>': function (pos) {\n return -Math.cos(pos * Math.PI) / 2 + 0.5\n },\n '>': function (pos) {\n return Math.sin((pos * Math.PI) / 2)\n },\n '<': function (pos) {\n return -Math.cos((pos * Math.PI) / 2) + 1\n },\n bezier: function (x1, y1, x2, y2) {\n // see https://www.w3.org/TR/css-easing-1/#cubic-bezier-algo\n return function (t) {\n if (t < 0) {\n if (x1 > 0) {\n return (y1 / x1) * t\n } else if (x2 > 0) {\n return (y2 / x2) * t\n } else {\n return 0\n }\n } else if (t > 1) {\n if (x2 < 1) {\n return ((1 - y2) / (1 - x2)) * t + (y2 - x2) / (1 - x2)\n } else if (x1 < 1) {\n return ((1 - y1) / (1 - x1)) * t + (y1 - x1) / (1 - x1)\n } else {\n return 1\n }\n } else {\n return 3 * t * (1 - t) ** 2 * y1 + 3 * t ** 2 * (1 - t) * y2 + t ** 3\n }\n }\n },\n // see https://www.w3.org/TR/css-easing-1/#step-timing-function-algo\n steps: function (steps, stepPosition = 'end') {\n // deal with \"jump-\" prefix\n stepPosition = stepPosition.split('-').reverse()[0]\n\n let jumps = steps\n if (stepPosition === 'none') {\n --jumps\n } else if (stepPosition === 'both') {\n ++jumps\n }\n\n // The beforeFlag is essentially useless\n return (t, beforeFlag = false) => {\n // Step is called currentStep in referenced url\n let step = Math.floor(t * steps)\n const jumping = (t * step) % 1 === 0\n\n if (stepPosition === 'start' || stepPosition === 'both') {\n ++step\n }\n\n if (beforeFlag && jumping) {\n --step\n }\n\n if (t >= 0 && step < 0) {\n step = 0\n }\n\n if (t <= 1 && step > jumps) {\n step = jumps\n }\n\n return step / jumps\n }\n }\n}\n\nexport class Stepper {\n done() {\n return false\n }\n}\n\n/***\nEasing Functions\n================\n***/\n\nexport class Ease extends Stepper {\n constructor(fn = timeline.ease) {\n super()\n this.ease = easing[fn] || fn\n }\n\n step(from, to, pos) {\n if (typeof from !== 'number') {\n return pos < 1 ? from : to\n }\n return from + (to - from) * this.ease(pos)\n }\n}\n\n/***\nController Types\n================\n***/\n\nexport class Controller extends Stepper {\n constructor(fn) {\n super()\n this.stepper = fn\n }\n\n done(c) {\n return c.done\n }\n\n step(current, target, dt, c) {\n return this.stepper(current, target, dt, c)\n }\n}\n\nfunction recalculate() {\n // Apply the default parameters\n const duration = (this._duration || 500) / 1000\n const overshoot = this._overshoot || 0\n\n // Calculate the PID natural response\n const eps = 1e-10\n const pi = Math.PI\n const os = Math.log(overshoot / 100 + eps)\n const zeta = -os / Math.sqrt(pi * pi + os * os)\n const wn = 3.9 / (zeta * duration)\n\n // Calculate the Spring values\n this.d = 2 * zeta * wn\n this.k = wn * wn\n}\n\nexport class Spring extends Controller {\n constructor(duration = 500, overshoot = 0) {\n super()\n this.duration(duration).overshoot(overshoot)\n }\n\n step(current, target, dt, c) {\n if (typeof current === 'string') return current\n c.done = dt === Infinity\n if (dt === Infinity) return target\n if (dt === 0) return current\n\n if (dt > 100) dt = 16\n\n dt /= 1000\n\n // Get the previous velocity\n const velocity = c.velocity || 0\n\n // Apply the control to get the new position and store it\n const acceleration = -this.d * velocity - this.k * (current - target)\n const newPosition = current + velocity * dt + (acceleration * dt * dt) / 2\n\n // Store the velocity\n c.velocity = velocity + acceleration * dt\n\n // Figure out if we have converged, and if so, pass the value\n c.done = Math.abs(target - newPosition) + Math.abs(velocity) < 0.002\n return c.done ? target : newPosition\n }\n}\n\nextend(Spring, {\n duration: makeSetterGetter('_duration', recalculate),\n overshoot: makeSetterGetter('_overshoot', recalculate)\n})\n\nexport class PID extends Controller {\n constructor(p = 0.1, i = 0.01, d = 0, windup = 1000) {\n super()\n this.p(p).i(i).d(d).windup(windup)\n }\n\n step(current, target, dt, c) {\n if (typeof current === 'string') return current\n c.done = dt === Infinity\n\n if (dt === Infinity) return target\n if (dt === 0) return current\n\n const p = target - current\n let i = (c.integral || 0) + p * dt\n const d = (p - (c.error || 0)) / dt\n const windup = this._windup\n\n // antiwindup\n if (windup !== false) {\n i = Math.max(-windup, Math.min(i, windup))\n }\n\n c.error = p\n c.integral = i\n\n c.done = Math.abs(p) < 0.001\n\n return c.done ? target : current + (this.P * p + this.I * i + this.D * d)\n }\n}\n\nextend(PID, {\n windup: makeSetterGetter('_windup'),\n p: makeSetterGetter('P'),\n i: makeSetterGetter('I'),\n d: makeSetterGetter('D')\n})\n","import { isPathLetter } from '../modules/core/regex.js'\nimport Point from '../types/Point.js'\n\nconst segmentParameters = {\n M: 2,\n L: 2,\n H: 1,\n V: 1,\n C: 6,\n S: 4,\n Q: 4,\n T: 2,\n A: 7,\n Z: 0\n}\n\nconst pathHandlers = {\n M: function (c, p, p0) {\n p.x = p0.x = c[0]\n p.y = p0.y = c[1]\n\n return ['M', p.x, p.y]\n },\n L: function (c, p) {\n p.x = c[0]\n p.y = c[1]\n return ['L', c[0], c[1]]\n },\n H: function (c, p) {\n p.x = c[0]\n return ['H', c[0]]\n },\n V: function (c, p) {\n p.y = c[0]\n return ['V', c[0]]\n },\n C: function (c, p) {\n p.x = c[4]\n p.y = c[5]\n return ['C', c[0], c[1], c[2], c[3], c[4], c[5]]\n },\n S: function (c, p) {\n p.x = c[2]\n p.y = c[3]\n return ['S', c[0], c[1], c[2], c[3]]\n },\n Q: function (c, p) {\n p.x = c[2]\n p.y = c[3]\n return ['Q', c[0], c[1], c[2], c[3]]\n },\n T: function (c, p) {\n p.x = c[0]\n p.y = c[1]\n return ['T', c[0], c[1]]\n },\n Z: function (c, p, p0) {\n p.x = p0.x\n p.y = p0.y\n return ['Z']\n },\n A: function (c, p) {\n p.x = c[5]\n p.y = c[6]\n return ['A', c[0], c[1], c[2], c[3], c[4], c[5], c[6]]\n }\n}\n\nconst mlhvqtcsaz = 'mlhvqtcsaz'.split('')\n\nfor (let i = 0, il = mlhvqtcsaz.length; i < il; ++i) {\n pathHandlers[mlhvqtcsaz[i]] = (function (i) {\n return function (c, p, p0) {\n if (i === 'H') c[0] = c[0] + p.x\n else if (i === 'V') c[0] = c[0] + p.y\n else if (i === 'A') {\n c[5] = c[5] + p.x\n c[6] = c[6] + p.y\n } else {\n for (let j = 0, jl = c.length; j < jl; ++j) {\n c[j] = c[j] + (j % 2 ? p.y : p.x)\n }\n }\n\n return pathHandlers[i](c, p, p0)\n }\n })(mlhvqtcsaz[i].toUpperCase())\n}\n\nfunction makeAbsolut(parser) {\n const command = parser.segment[0]\n return pathHandlers[command](parser.segment.slice(1), parser.p, parser.p0)\n}\n\nfunction segmentComplete(parser) {\n return (\n parser.segment.length &&\n parser.segment.length - 1 ===\n segmentParameters[parser.segment[0].toUpperCase()]\n )\n}\n\nfunction startNewSegment(parser, token) {\n parser.inNumber && finalizeNumber(parser, false)\n const pathLetter = isPathLetter.test(token)\n\n if (pathLetter) {\n parser.segment = [token]\n } else {\n const lastCommand = parser.lastCommand\n const small = lastCommand.toLowerCase()\n const isSmall = lastCommand === small\n parser.segment = [small === 'm' ? (isSmall ? 'l' : 'L') : lastCommand]\n }\n\n parser.inSegment = true\n parser.lastCommand = parser.segment[0]\n\n return pathLetter\n}\n\nfunction finalizeNumber(parser, inNumber) {\n if (!parser.inNumber) throw new Error('Parser Error')\n parser.number && parser.segment.push(parseFloat(parser.number))\n parser.inNumber = inNumber\n parser.number = ''\n parser.pointSeen = false\n parser.hasExponent = false\n\n if (segmentComplete(parser)) {\n finalizeSegment(parser)\n }\n}\n\nfunction finalizeSegment(parser) {\n parser.inSegment = false\n if (parser.absolute) {\n parser.segment = makeAbsolut(parser)\n }\n parser.segments.push(parser.segment)\n}\n\nfunction isArcFlag(parser) {\n if (!parser.segment.length) return false\n const isArc = parser.segment[0].toUpperCase() === 'A'\n const length = parser.segment.length\n\n return isArc && (length === 4 || length === 5)\n}\n\nfunction isExponential(parser) {\n return parser.lastToken.toUpperCase() === 'E'\n}\n\nconst pathDelimiters = new Set([' ', ',', '\\t', '\\n', '\\r', '\\f'])\nexport function pathParser(d, toAbsolute = true) {\n let index = 0\n let token = ''\n const parser = {\n segment: [],\n inNumber: false,\n number: '',\n lastToken: '',\n inSegment: false,\n segments: [],\n pointSeen: false,\n hasExponent: false,\n absolute: toAbsolute,\n p0: new Point(),\n p: new Point()\n }\n\n while (((parser.lastToken = token), (token = d.charAt(index++)))) {\n if (!parser.inSegment) {\n if (startNewSegment(parser, token)) {\n continue\n }\n }\n\n if (token === '.') {\n if (parser.pointSeen || parser.hasExponent) {\n finalizeNumber(parser, false)\n --index\n continue\n }\n parser.inNumber = true\n parser.pointSeen = true\n parser.number += token\n continue\n }\n\n if (!isNaN(parseInt(token))) {\n if (parser.number === '0' || isArcFlag(parser)) {\n parser.inNumber = true\n parser.number = token\n finalizeNumber(parser, true)\n continue\n }\n\n parser.inNumber = true\n parser.number += token\n continue\n }\n\n if (pathDelimiters.has(token)) {\n if (parser.inNumber) {\n finalizeNumber(parser, false)\n }\n continue\n }\n\n if (token === '-' || token === '+') {\n if (parser.inNumber && !isExponential(parser)) {\n finalizeNumber(parser, false)\n --index\n continue\n }\n parser.number += token\n parser.inNumber = true\n continue\n }\n\n if (token.toUpperCase() === 'E') {\n parser.number += token\n parser.hasExponent = true\n continue\n }\n\n if (isPathLetter.test(token)) {\n if (parser.inNumber) {\n finalizeNumber(parser, false)\n } else if (!segmentComplete(parser)) {\n throw new Error('parser Error')\n } else {\n finalizeSegment(parser)\n }\n --index\n }\n }\n\n if (parser.inNumber) {\n finalizeNumber(parser, false)\n }\n\n if (parser.inSegment && segmentComplete(parser)) {\n finalizeSegment(parser)\n }\n\n return parser.segments\n}\n","import SVGArray from './SVGArray.js'\nimport parser from '../modules/core/parser.js'\nimport Box from './Box.js'\nimport { pathParser } from '../utils/pathParser.js'\n\nfunction arrayToString(a) {\n let s = ''\n for (let i = 0, il = a.length; i < il; i++) {\n s += a[i][0]\n\n if (a[i][1] != null) {\n s += a[i][1]\n\n if (a[i][2] != null) {\n s += ' '\n s += a[i][2]\n\n if (a[i][3] != null) {\n s += ' '\n s += a[i][3]\n s += ' '\n s += a[i][4]\n\n if (a[i][5] != null) {\n s += ' '\n s += a[i][5]\n s += ' '\n s += a[i][6]\n\n if (a[i][7] != null) {\n s += ' '\n s += a[i][7]\n }\n }\n }\n }\n }\n }\n\n return s + ' '\n}\n\nexport default class PathArray extends SVGArray {\n // Get bounding box of path\n bbox() {\n parser().path.setAttribute('d', this.toString())\n return new Box(parser.nodes.path.getBBox())\n }\n\n // Move path string\n move(x, y) {\n // get bounding box of current situation\n const box = this.bbox()\n\n // get relative offset\n x -= box.x\n y -= box.y\n\n if (!isNaN(x) && !isNaN(y)) {\n // move every point\n for (let l, i = this.length - 1; i >= 0; i--) {\n l = this[i][0]\n\n if (l === 'M' || l === 'L' || l === 'T') {\n this[i][1] += x\n this[i][2] += y\n } else if (l === 'H') {\n this[i][1] += x\n } else if (l === 'V') {\n this[i][1] += y\n } else if (l === 'C' || l === 'S' || l === 'Q') {\n this[i][1] += x\n this[i][2] += y\n this[i][3] += x\n this[i][4] += y\n\n if (l === 'C') {\n this[i][5] += x\n this[i][6] += y\n }\n } else if (l === 'A') {\n this[i][6] += x\n this[i][7] += y\n }\n }\n }\n\n return this\n }\n\n // Absolutize and parse path to array\n parse(d = 'M0 0') {\n if (Array.isArray(d)) {\n d = Array.prototype.concat.apply([], d).toString()\n }\n\n return pathParser(d)\n }\n\n // Resize path string\n size(width, height) {\n // get bounding box of current situation\n const box = this.bbox()\n let i, l\n\n // If the box width or height is 0 then we ignore\n // transformations on the respective axis\n box.width = box.width === 0 ? 1 : box.width\n box.height = box.height === 0 ? 1 : box.height\n\n // recalculate position of all points according to new size\n for (i = this.length - 1; i >= 0; i--) {\n l = this[i][0]\n\n if (l === 'M' || l === 'L' || l === 'T') {\n this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x\n this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y\n } else if (l === 'H') {\n this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x\n } else if (l === 'V') {\n this[i][1] = ((this[i][1] - box.y) * height) / box.height + box.y\n } else if (l === 'C' || l === 'S' || l === 'Q') {\n this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x\n this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y\n this[i][3] = ((this[i][3] - box.x) * width) / box.width + box.x\n this[i][4] = ((this[i][4] - box.y) * height) / box.height + box.y\n\n if (l === 'C') {\n this[i][5] = ((this[i][5] - box.x) * width) / box.width + box.x\n this[i][6] = ((this[i][6] - box.y) * height) / box.height + box.y\n }\n } else if (l === 'A') {\n // resize radii\n this[i][1] = (this[i][1] * width) / box.width\n this[i][2] = (this[i][2] * height) / box.height\n\n // move position values\n this[i][6] = ((this[i][6] - box.x) * width) / box.width + box.x\n this[i][7] = ((this[i][7] - box.y) * height) / box.height + box.y\n }\n }\n\n return this\n }\n\n // Convert array to string\n toString() {\n return arrayToString(this)\n }\n}\n","import { Ease } from './Controller.js'\nimport {\n delimiter,\n numberAndUnit,\n isPathLetter\n} from '../modules/core/regex.js'\nimport { extend } from '../utils/adopter.js'\nimport Color from '../types/Color.js'\nimport PathArray from '../types/PathArray.js'\nimport SVGArray from '../types/SVGArray.js'\nimport SVGNumber from '../types/SVGNumber.js'\n\nconst getClassForType = (value) => {\n const type = typeof value\n\n if (type === 'number') {\n return SVGNumber\n } else if (type === 'string') {\n if (Color.isColor(value)) {\n return Color\n } else if (delimiter.test(value)) {\n return isPathLetter.test(value) ? PathArray : SVGArray\n } else if (numberAndUnit.test(value)) {\n return SVGNumber\n } else {\n return NonMorphable\n }\n } else if (morphableTypes.indexOf(value.constructor) > -1) {\n return value.constructor\n } else if (Array.isArray(value)) {\n return SVGArray\n } else if (type === 'object') {\n return ObjectBag\n } else {\n return NonMorphable\n }\n}\n\nexport default class Morphable {\n constructor(stepper) {\n this._stepper = stepper || new Ease('-')\n\n this._from = null\n this._to = null\n this._type = null\n this._context = null\n this._morphObj = null\n }\n\n at(pos) {\n return this._morphObj.morph(\n this._from,\n this._to,\n pos,\n this._stepper,\n this._context\n )\n }\n\n done() {\n const complete = this._context.map(this._stepper.done).reduce(function (\n last,\n curr\n ) {\n return last && curr\n }, true)\n return complete\n }\n\n from(val) {\n if (val == null) {\n return this._from\n }\n\n this._from = this._set(val)\n return this\n }\n\n stepper(stepper) {\n if (stepper == null) return this._stepper\n this._stepper = stepper\n return this\n }\n\n to(val) {\n if (val == null) {\n return this._to\n }\n\n this._to = this._set(val)\n return this\n }\n\n type(type) {\n // getter\n if (type == null) {\n return this._type\n }\n\n // setter\n this._type = type\n return this\n }\n\n _set(value) {\n if (!this._type) {\n this.type(getClassForType(value))\n }\n\n let result = new this._type(value)\n if (this._type === Color) {\n result = this._to\n ? result[this._to[4]]()\n : this._from\n ? result[this._from[4]]()\n : result\n }\n\n if (this._type === ObjectBag) {\n result = this._to\n ? result.align(this._to)\n : this._from\n ? result.align(this._from)\n : result\n }\n\n result = result.toConsumable()\n\n this._morphObj = this._morphObj || new this._type()\n this._context =\n this._context ||\n Array.apply(null, Array(result.length))\n .map(Object)\n .map(function (o) {\n o.done = true\n return o\n })\n return result\n }\n}\n\nexport class NonMorphable {\n constructor(...args) {\n this.init(...args)\n }\n\n init(val) {\n val = Array.isArray(val) ? val[0] : val\n this.value = val\n return this\n }\n\n toArray() {\n return [this.value]\n }\n\n valueOf() {\n return this.value\n }\n}\n\nexport class TransformBag {\n constructor(...args) {\n this.init(...args)\n }\n\n init(obj) {\n if (Array.isArray(obj)) {\n obj = {\n scaleX: obj[0],\n scaleY: obj[1],\n shear: obj[2],\n rotate: obj[3],\n translateX: obj[4],\n translateY: obj[5],\n originX: obj[6],\n originY: obj[7]\n }\n }\n\n Object.assign(this, TransformBag.defaults, obj)\n return this\n }\n\n toArray() {\n const v = this\n\n return [\n v.scaleX,\n v.scaleY,\n v.shear,\n v.rotate,\n v.translateX,\n v.translateY,\n v.originX,\n v.originY\n ]\n }\n}\n\nTransformBag.defaults = {\n scaleX: 1,\n scaleY: 1,\n shear: 0,\n rotate: 0,\n translateX: 0,\n translateY: 0,\n originX: 0,\n originY: 0\n}\n\nconst sortByKey = (a, b) => {\n return a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0\n}\n\nexport class ObjectBag {\n constructor(...args) {\n this.init(...args)\n }\n\n align(other) {\n const values = this.values\n for (let i = 0, il = values.length; i < il; ++i) {\n // If the type is the same we only need to check if the color is in the correct format\n if (values[i + 1] === other[i + 1]) {\n if (values[i + 1] === Color && other[i + 7] !== values[i + 7]) {\n const space = other[i + 7]\n const color = new Color(this.values.splice(i + 3, 5))\n [space]()\n .toArray()\n this.values.splice(i + 3, 0, ...color)\n }\n\n i += values[i + 2] + 2\n continue\n }\n\n if (!other[i + 1]) {\n return this\n }\n\n // The types differ, so we overwrite the new type with the old one\n // And initialize it with the types default (e.g. black for color or 0 for number)\n const defaultObject = new other[i + 1]().toArray()\n\n // Than we fix the values array\n const toDelete = values[i + 2] + 3\n\n values.splice(\n i,\n toDelete,\n other[i],\n other[i + 1],\n other[i + 2],\n ...defaultObject\n )\n\n i += values[i + 2] + 2\n }\n return this\n }\n\n init(objOrArr) {\n this.values = []\n\n if (Array.isArray(objOrArr)) {\n this.values = objOrArr.slice()\n return\n }\n\n objOrArr = objOrArr || {}\n const entries = []\n\n for (const i in objOrArr) {\n const Type = getClassForType(objOrArr[i])\n const val = new Type(objOrArr[i]).toArray()\n entries.push([i, Type, val.length, ...val])\n }\n\n entries.sort(sortByKey)\n\n this.values = entries.reduce((last, curr) => last.concat(curr), [])\n return this\n }\n\n toArray() {\n return this.values\n }\n\n valueOf() {\n const obj = {}\n const arr = this.values\n\n // for (var i = 0, len = arr.length; i < len; i += 2) {\n while (arr.length) {\n const key = arr.shift()\n const Type = arr.shift()\n const num = arr.shift()\n const values = arr.splice(0, num)\n obj[key] = new Type(values) // .valueOf()\n }\n\n return obj\n }\n}\n\nconst morphableTypes = [NonMorphable, TransformBag, ObjectBag]\n\nexport function registerMorphableType(type = []) {\n morphableTypes.push(...[].concat(type))\n}\n\nexport function makeMorphable() {\n extend(morphableTypes, {\n to(val) {\n return new Morphable()\n .type(this.constructor)\n .from(this.toArray()) // this.valueOf())\n .to(val)\n },\n fromArray(arr) {\n this.init(arr)\n return this\n },\n toConsumable() {\n return this.toArray()\n },\n morph(from, to, pos, stepper, context) {\n const mapper = function (i, index) {\n return stepper.step(i, to[index], pos, context[index], context)\n }\n\n return this.fromArray(from.map(mapper))\n }\n })\n}\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { proportionalSize } from '../utils/utils.js'\nimport { registerMethods } from '../utils/methods.js'\nimport PathArray from '../types/PathArray.js'\nimport Shape from './Shape.js'\n\nexport default class Path extends Shape {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('path', node), attrs)\n }\n\n // Get array\n array() {\n return this._array || (this._array = new PathArray(this.attr('d')))\n }\n\n // Clear array cache\n clear() {\n delete this._array\n return this\n }\n\n // Set height of element\n height(height) {\n return height == null\n ? this.bbox().height\n : this.size(this.bbox().width, height)\n }\n\n // Move by left top corner\n move(x, y) {\n return this.attr('d', this.array().move(x, y))\n }\n\n // Plot new path\n plot(d) {\n return d == null\n ? this.array()\n : this.clear().attr(\n 'd',\n typeof d === 'string' ? d : (this._array = new PathArray(d))\n )\n }\n\n // Set element size to given width and height\n size(width, height) {\n const p = proportionalSize(this, width, height)\n return this.attr('d', this.array().size(p.width, p.height))\n }\n\n // Set width of element\n width(width) {\n return width == null\n ? this.bbox().width\n : this.size(width, this.bbox().height)\n }\n\n // Move by left top corner over x-axis\n x(x) {\n return x == null ? this.bbox().x : this.move(x, this.bbox().y)\n }\n\n // Move by left top corner over y-axis\n y(y) {\n return y == null ? this.bbox().y : this.move(this.bbox().x, y)\n }\n}\n\n// Define morphable array\nPath.prototype.MorphArray = PathArray\n\n// Add parent method\nregisterMethods({\n Container: {\n // Create a wrapped path element\n path: wrapWithAttrCheck(function (d) {\n // make sure plot is called as a setter\n return this.put(new Path()).plot(d || new PathArray())\n })\n }\n})\n\nregister(Path, 'Path')\n","import { proportionalSize } from '../../utils/utils.js'\nimport PointArray from '../../types/PointArray.js'\n\n// Get array\nexport function array() {\n return this._array || (this._array = new PointArray(this.attr('points')))\n}\n\n// Clear array cache\nexport function clear() {\n delete this._array\n return this\n}\n\n// Move by left top corner\nexport function move(x, y) {\n return this.attr('points', this.array().move(x, y))\n}\n\n// Plot new path\nexport function plot(p) {\n return p == null\n ? this.array()\n : this.clear().attr(\n 'points',\n typeof p === 'string' ? p : (this._array = new PointArray(p))\n )\n}\n\n// Set element size to given width and height\nexport function size(width, height) {\n const p = proportionalSize(this, width, height)\n return this.attr('points', this.array().size(p.width, p.height))\n}\n","import {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport PointArray from '../types/PointArray.js'\nimport Shape from './Shape.js'\nimport * as pointed from '../modules/core/pointed.js'\nimport * as poly from '../modules/core/poly.js'\n\nexport default class Polygon extends Shape {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('polygon', node), attrs)\n }\n}\n\nregisterMethods({\n Container: {\n // Create a wrapped polygon element\n polygon: wrapWithAttrCheck(function (p) {\n // make sure plot is called as a setter\n return this.put(new Polygon()).plot(p || new PointArray())\n })\n }\n})\n\nextend(Polygon, pointed)\nextend(Polygon, poly)\nregister(Polygon, 'Polygon')\n","import {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport PointArray from '../types/PointArray.js'\nimport Shape from './Shape.js'\nimport * as pointed from '../modules/core/pointed.js'\nimport * as poly from '../modules/core/poly.js'\n\nexport default class Polyline extends Shape {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('polyline', node), attrs)\n }\n}\n\nregisterMethods({\n Container: {\n // Create a wrapped polygon element\n polyline: wrapWithAttrCheck(function (p) {\n // make sure plot is called as a setter\n return this.put(new Polyline()).plot(p || new PointArray())\n })\n }\n})\n\nextend(Polyline, pointed)\nextend(Polyline, poly)\nregister(Polyline, 'Polyline')\n","import {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport { rx, ry } from '../modules/core/circled.js'\nimport Shape from './Shape.js'\n\nexport default class Rect extends Shape {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('rect', node), attrs)\n }\n}\n\nextend(Rect, { rx, ry })\n\nregisterMethods({\n Container: {\n // Create a rect element\n rect: wrapWithAttrCheck(function (width, height) {\n return this.put(new Rect()).size(width, height)\n })\n }\n})\n\nregister(Rect, 'Rect')\n","export default class Queue {\n constructor() {\n this._first = null\n this._last = null\n }\n\n // Shows us the first item in the list\n first() {\n return this._first && this._first.value\n }\n\n // Shows us the last item in the list\n last() {\n return this._last && this._last.value\n }\n\n push(value) {\n // An item stores an id and the provided value\n const item =\n typeof value.next !== 'undefined'\n ? value\n : { value: value, next: null, prev: null }\n\n // Deal with the queue being empty or populated\n if (this._last) {\n item.prev = this._last\n this._last.next = item\n this._last = item\n } else {\n this._last = item\n this._first = item\n }\n\n // Return the current item\n return item\n }\n\n // Removes the item that was returned from the push\n remove(item) {\n // Relink the previous item\n if (item.prev) item.prev.next = item.next\n if (item.next) item.next.prev = item.prev\n if (item === this._last) this._last = item.prev\n if (item === this._first) this._first = item.next\n\n // Invalidate item\n item.prev = null\n item.next = null\n }\n\n shift() {\n // Check if we have a value\n const remove = this._first\n if (!remove) return null\n\n // If we do, remove it and relink things\n this._first = remove.next\n if (this._first) this._first.prev = null\n this._last = this._first ? this._last : null\n return remove.value\n }\n}\n","import { globals } from '../utils/window.js'\nimport Queue from './Queue.js'\n\nconst Animator = {\n nextDraw: null,\n frames: new Queue(),\n timeouts: new Queue(),\n immediates: new Queue(),\n timer: () => globals.window.performance || globals.window.Date,\n transforms: [],\n\n frame(fn) {\n // Store the node\n const node = Animator.frames.push({ run: fn })\n\n // Request an animation frame if we don't have one\n if (Animator.nextDraw === null) {\n Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw)\n }\n\n // Return the node so we can remove it easily\n return node\n },\n\n timeout(fn, delay) {\n delay = delay || 0\n\n // Work out when the event should fire\n const time = Animator.timer().now() + delay\n\n // Add the timeout to the end of the queue\n const node = Animator.timeouts.push({ run: fn, time: time })\n\n // Request another animation frame if we need one\n if (Animator.nextDraw === null) {\n Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw)\n }\n\n return node\n },\n\n immediate(fn) {\n // Add the immediate fn to the end of the queue\n const node = Animator.immediates.push(fn)\n // Request another animation frame if we need one\n if (Animator.nextDraw === null) {\n Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw)\n }\n\n return node\n },\n\n cancelFrame(node) {\n node != null && Animator.frames.remove(node)\n },\n\n clearTimeout(node) {\n node != null && Animator.timeouts.remove(node)\n },\n\n cancelImmediate(node) {\n node != null && Animator.immediates.remove(node)\n },\n\n _draw(now) {\n // Run all the timeouts we can run, if they are not ready yet, add them\n // to the end of the queue immediately! (bad timeouts!!! [sarcasm])\n let nextTimeout = null\n const lastTimeout = Animator.timeouts.last()\n while ((nextTimeout = Animator.timeouts.shift())) {\n // Run the timeout if its time, or push it to the end\n if (now >= nextTimeout.time) {\n nextTimeout.run()\n } else {\n Animator.timeouts.push(nextTimeout)\n }\n\n // If we hit the last item, we should stop shifting out more items\n if (nextTimeout === lastTimeout) break\n }\n\n // Run all of the animation frames\n let nextFrame = null\n const lastFrame = Animator.frames.last()\n while (nextFrame !== lastFrame && (nextFrame = Animator.frames.shift())) {\n nextFrame.run(now)\n }\n\n let nextImmediate = null\n while ((nextImmediate = Animator.immediates.shift())) {\n nextImmediate()\n }\n\n // If we have remaining timeouts or frames, draw until we don't anymore\n Animator.nextDraw =\n Animator.timeouts.first() || Animator.frames.first()\n ? globals.window.requestAnimationFrame(Animator._draw)\n : null\n }\n}\n\nexport default Animator\n","import { globals } from '../utils/window.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Animator from './Animator.js'\nimport EventTarget from '../types/EventTarget.js'\n\nconst makeSchedule = function (runnerInfo) {\n const start = runnerInfo.start\n const duration = runnerInfo.runner.duration()\n const end = start + duration\n return {\n start: start,\n duration: duration,\n end: end,\n runner: runnerInfo.runner\n }\n}\n\nconst defaultSource = function () {\n const w = globals.window\n return (w.performance || w.Date).now()\n}\n\nexport default class Timeline extends EventTarget {\n // Construct a new timeline on the given element\n constructor(timeSource = defaultSource) {\n super()\n\n this._timeSource = timeSource\n\n // terminate resets all variables to their initial state\n this.terminate()\n }\n\n active() {\n return !!this._nextFrame\n }\n\n finish() {\n // Go to end and pause\n this.time(this.getEndTimeOfTimeline() + 1)\n return this.pause()\n }\n\n // Calculates the end of the timeline\n getEndTime() {\n const lastRunnerInfo = this.getLastRunnerInfo()\n const lastDuration = lastRunnerInfo ? lastRunnerInfo.runner.duration() : 0\n const lastStartTime = lastRunnerInfo ? lastRunnerInfo.start : this._time\n return lastStartTime + lastDuration\n }\n\n getEndTimeOfTimeline() {\n const endTimes = this._runners.map((i) => i.start + i.runner.duration())\n return Math.max(0, ...endTimes)\n }\n\n getLastRunnerInfo() {\n return this.getRunnerInfoById(this._lastRunnerId)\n }\n\n getRunnerInfoById(id) {\n return this._runners[this._runnerIds.indexOf(id)] || null\n }\n\n pause() {\n this._paused = true\n return this._continue()\n }\n\n persist(dtOrForever) {\n if (dtOrForever == null) return this._persist\n this._persist = dtOrForever\n return this\n }\n\n play() {\n // Now make sure we are not paused and continue the animation\n this._paused = false\n return this.updateTime()._continue()\n }\n\n reverse(yes) {\n const currentSpeed = this.speed()\n if (yes == null) return this.speed(-currentSpeed)\n\n const positive = Math.abs(currentSpeed)\n return this.speed(yes ? -positive : positive)\n }\n\n // schedules a runner on the timeline\n schedule(runner, delay, when) {\n if (runner == null) {\n return this._runners.map(makeSchedule)\n }\n\n // The start time for the next animation can either be given explicitly,\n // derived from the current timeline time or it can be relative to the\n // last start time to chain animations directly\n\n let absoluteStartTime = 0\n const endTime = this.getEndTime()\n delay = delay || 0\n\n // Work out when to start the animation\n if (when == null || when === 'last' || when === 'after') {\n // Take the last time and increment\n absoluteStartTime = endTime\n } else if (when === 'absolute' || when === 'start') {\n absoluteStartTime = delay\n delay = 0\n } else if (when === 'now') {\n absoluteStartTime = this._time\n } else if (when === 'relative') {\n const runnerInfo = this.getRunnerInfoById(runner.id)\n if (runnerInfo) {\n absoluteStartTime = runnerInfo.start + delay\n delay = 0\n }\n } else if (when === 'with-last') {\n const lastRunnerInfo = this.getLastRunnerInfo()\n const lastStartTime = lastRunnerInfo ? lastRunnerInfo.start : this._time\n absoluteStartTime = lastStartTime\n } else {\n throw new Error('Invalid value for the \"when\" parameter')\n }\n\n // Manage runner\n runner.unschedule()\n runner.timeline(this)\n\n const persist = runner.persist()\n const runnerInfo = {\n persist: persist === null ? this._persist : persist,\n start: absoluteStartTime + delay,\n runner\n }\n\n this._lastRunnerId = runner.id\n\n this._runners.push(runnerInfo)\n this._runners.sort((a, b) => a.start - b.start)\n this._runnerIds = this._runners.map((info) => info.runner.id)\n\n this.updateTime()._continue()\n return this\n }\n\n seek(dt) {\n return this.time(this._time + dt)\n }\n\n source(fn) {\n if (fn == null) return this._timeSource\n this._timeSource = fn\n return this\n }\n\n speed(speed) {\n if (speed == null) return this._speed\n this._speed = speed\n return this\n }\n\n stop() {\n // Go to start and pause\n this.time(0)\n return this.pause()\n }\n\n time(time) {\n if (time == null) return this._time\n this._time = time\n return this._continue(true)\n }\n\n // Remove the runner from this timeline\n unschedule(runner) {\n const index = this._runnerIds.indexOf(runner.id)\n if (index < 0) return this\n\n this._runners.splice(index, 1)\n this._runnerIds.splice(index, 1)\n\n runner.timeline(null)\n return this\n }\n\n // Makes sure, that after pausing the time doesn't jump\n updateTime() {\n if (!this.active()) {\n this._lastSourceTime = this._timeSource()\n }\n return this\n }\n\n // Checks if we are running and continues the animation\n _continue(immediateStep = false) {\n Animator.cancelFrame(this._nextFrame)\n this._nextFrame = null\n\n if (immediateStep) return this._stepImmediate()\n if (this._paused) return this\n\n this._nextFrame = Animator.frame(this._step)\n return this\n }\n\n _stepFn(immediateStep = false) {\n // Get the time delta from the last time and update the time\n const time = this._timeSource()\n let dtSource = time - this._lastSourceTime\n\n if (immediateStep) dtSource = 0\n\n const dtTime = this._speed * dtSource + (this._time - this._lastStepTime)\n this._lastSourceTime = time\n\n // Only update the time if we use the timeSource.\n // Otherwise use the current time\n if (!immediateStep) {\n // Update the time\n this._time += dtTime\n this._time = this._time < 0 ? 0 : this._time\n }\n this._lastStepTime = this._time\n this.fire('time', this._time)\n\n // This is for the case that the timeline was seeked so that the time\n // is now before the startTime of the runner. That is why we need to set\n // the runner to position 0\n\n // FIXME:\n // However, resetting in insertion order leads to bugs. Considering the case,\n // where 2 runners change the same attribute but in different times,\n // resetting both of them will lead to the case where the later defined\n // runner always wins the reset even if the other runner started earlier\n // and therefore should win the attribute battle\n // this can be solved by resetting them backwards\n for (let k = this._runners.length; k--; ) {\n // Get and run the current runner and ignore it if its inactive\n const runnerInfo = this._runners[k]\n const runner = runnerInfo.runner\n\n // Make sure that we give the actual difference\n // between runner start time and now\n const dtToStart = this._time - runnerInfo.start\n\n // Dont run runner if not started yet\n // and try to reset it\n if (dtToStart <= 0) {\n runner.reset()\n }\n }\n\n // Run all of the runners directly\n let runnersLeft = false\n for (let i = 0, len = this._runners.length; i < len; i++) {\n // Get and run the current runner and ignore it if its inactive\n const runnerInfo = this._runners[i]\n const runner = runnerInfo.runner\n let dt = dtTime\n\n // Make sure that we give the actual difference\n // between runner start time and now\n const dtToStart = this._time - runnerInfo.start\n\n // Dont run runner if not started yet\n if (dtToStart <= 0) {\n runnersLeft = true\n continue\n } else if (dtToStart < dt) {\n // Adjust dt to make sure that animation is on point\n dt = dtToStart\n }\n\n if (!runner.active()) continue\n\n // If this runner is still going, signal that we need another animation\n // frame, otherwise, remove the completed runner\n const finished = runner.step(dt).done\n if (!finished) {\n runnersLeft = true\n // continue\n } else if (runnerInfo.persist !== true) {\n // runner is finished. And runner might get removed\n const endTime = runner.duration() - runner.time() + this._time\n\n if (endTime + runnerInfo.persist < this._time) {\n // Delete runner and correct index\n runner.unschedule()\n --i\n --len\n }\n }\n }\n\n // Basically: we continue when there are runners right from us in time\n // when -->, and when runners are left from us when <--\n if (\n (runnersLeft && !(this._speed < 0 && this._time === 0)) ||\n (this._runnerIds.length && this._speed < 0 && this._time > 0)\n ) {\n this._continue()\n } else {\n this.pause()\n this.fire('finished')\n }\n\n return this\n }\n\n terminate() {\n // cleanup memory\n\n // Store the timing variables\n this._startTime = 0\n this._speed = 1.0\n\n // Determines how long a runner is hold in memory. Can be a dt or true/false\n this._persist = 0\n\n // Keep track of the running animations and their starting parameters\n this._nextFrame = null\n this._paused = true\n this._runners = []\n this._runnerIds = []\n this._lastRunnerId = -1\n this._time = 0\n this._lastSourceTime = 0\n this._lastStepTime = 0\n\n // Make sure that step is always called in class context\n this._step = this._stepFn.bind(this, false)\n this._stepImmediate = this._stepFn.bind(this, true)\n }\n}\n\nregisterMethods({\n Element: {\n timeline: function (timeline) {\n if (timeline == null) {\n this._timeline = this._timeline || new Timeline()\n return this._timeline\n } else {\n this._timeline = timeline\n return this\n }\n }\n }\n})\n","import { Controller, Ease, Stepper } from './Controller.js'\nimport { extend, register } from '../utils/adopter.js'\nimport { from, to } from '../modules/core/gradiented.js'\nimport { getOrigin } from '../utils/utils.js'\nimport { noop, timeline } from '../modules/core/defaults.js'\nimport { registerMethods } from '../utils/methods.js'\nimport { rx, ry } from '../modules/core/circled.js'\nimport Animator from './Animator.js'\nimport Box from '../types/Box.js'\nimport EventTarget from '../types/EventTarget.js'\nimport Matrix from '../types/Matrix.js'\nimport Morphable, { TransformBag, ObjectBag } from './Morphable.js'\nimport Point from '../types/Point.js'\nimport SVGNumber from '../types/SVGNumber.js'\nimport Timeline from './Timeline.js'\n\nexport default class Runner extends EventTarget {\n constructor(options) {\n super()\n\n // Store a unique id on the runner, so that we can identify it later\n this.id = Runner.id++\n\n // Ensure a default value\n options = options == null ? timeline.duration : options\n\n // Ensure that we get a controller\n options = typeof options === 'function' ? new Controller(options) : options\n\n // Declare all of the variables\n this._element = null\n this._timeline = null\n this.done = false\n this._queue = []\n\n // Work out the stepper and the duration\n this._duration = typeof options === 'number' && options\n this._isDeclarative = options instanceof Controller\n this._stepper = this._isDeclarative ? options : new Ease()\n\n // We copy the current values from the timeline because they can change\n this._history = {}\n\n // Store the state of the runner\n this.enabled = true\n this._time = 0\n this._lastTime = 0\n\n // At creation, the runner is in reset state\n this._reseted = true\n\n // Save transforms applied to this runner\n this.transforms = new Matrix()\n this.transformId = 1\n\n // Looping variables\n this._haveReversed = false\n this._reverse = false\n this._loopsDone = 0\n this._swing = false\n this._wait = 0\n this._times = 1\n\n this._frameId = null\n\n // Stores how long a runner is stored after being done\n this._persist = this._isDeclarative ? true : null\n }\n\n static sanitise(duration, delay, when) {\n // Initialise the default parameters\n let times = 1\n let swing = false\n let wait = 0\n duration = duration ?? timeline.duration\n delay = delay ?? timeline.delay\n when = when || 'last'\n\n // If we have an object, unpack the values\n if (typeof duration === 'object' && !(duration instanceof Stepper)) {\n delay = duration.delay ?? delay\n when = duration.when ?? when\n swing = duration.swing || swing\n times = duration.times ?? times\n wait = duration.wait ?? wait\n duration = duration.duration ?? timeline.duration\n }\n\n return {\n duration: duration,\n delay: delay,\n swing: swing,\n times: times,\n wait: wait,\n when: when\n }\n }\n\n active(enabled) {\n if (enabled == null) return this.enabled\n this.enabled = enabled\n return this\n }\n\n /*\n Private Methods\n ===============\n Methods that shouldn't be used externally\n */\n addTransform(transform) {\n this.transforms.lmultiplyO(transform)\n return this\n }\n\n after(fn) {\n return this.on('finished', fn)\n }\n\n animate(duration, delay, when) {\n const o = Runner.sanitise(duration, delay, when)\n const runner = new Runner(o.duration)\n if (this._timeline) runner.timeline(this._timeline)\n if (this._element) runner.element(this._element)\n return runner.loop(o).schedule(o.delay, o.when)\n }\n\n clearTransform() {\n this.transforms = new Matrix()\n return this\n }\n\n // TODO: Keep track of all transformations so that deletion is faster\n clearTransformsFromQueue() {\n if (\n !this.done ||\n !this._timeline ||\n !this._timeline._runnerIds.includes(this.id)\n ) {\n this._queue = this._queue.filter((item) => {\n return !item.isTransform\n })\n }\n }\n\n delay(delay) {\n return this.animate(0, delay)\n }\n\n duration() {\n return this._times * (this._wait + this._duration) - this._wait\n }\n\n during(fn) {\n return this.queue(null, fn)\n }\n\n ease(fn) {\n this._stepper = new Ease(fn)\n return this\n }\n /*\n Runner Definitions\n ==================\n These methods help us define the runtime behaviour of the Runner or they\n help us make new runners from the current runner\n */\n\n element(element) {\n if (element == null) return this._element\n this._element = element\n element._prepareRunner()\n return this\n }\n\n finish() {\n return this.step(Infinity)\n }\n\n loop(times, swing, wait) {\n // Deal with the user passing in an object\n if (typeof times === 'object') {\n swing = times.swing\n wait = times.wait\n times = times.times\n }\n\n // Sanitise the values and store them\n this._times = times || Infinity\n this._swing = swing || false\n this._wait = wait || 0\n\n // Allow true to be passed\n if (this._times === true) {\n this._times = Infinity\n }\n\n return this\n }\n\n loops(p) {\n const loopDuration = this._duration + this._wait\n if (p == null) {\n const loopsDone = Math.floor(this._time / loopDuration)\n const relativeTime = this._time - loopsDone * loopDuration\n const position = relativeTime / this._duration\n return Math.min(loopsDone + position, this._times)\n }\n const whole = Math.floor(p)\n const partial = p % 1\n const time = loopDuration * whole + this._duration * partial\n return this.time(time)\n }\n\n persist(dtOrForever) {\n if (dtOrForever == null) return this._persist\n this._persist = dtOrForever\n return this\n }\n\n position(p) {\n // Get all of the variables we need\n const x = this._time\n const d = this._duration\n const w = this._wait\n const t = this._times\n const s = this._swing\n const r = this._reverse\n let position\n\n if (p == null) {\n /*\n This function converts a time to a position in the range [0, 1]\n The full explanation can be found in this desmos demonstration\n https://www.desmos.com/calculator/u4fbavgche\n The logic is slightly simplified here because we can use booleans\n */\n\n // Figure out the value without thinking about the start or end time\n const f = function (x) {\n const swinging = s * Math.floor((x % (2 * (w + d))) / (w + d))\n const backwards = (swinging && !r) || (!swinging && r)\n const uncliped =\n (Math.pow(-1, backwards) * (x % (w + d))) / d + backwards\n const clipped = Math.max(Math.min(uncliped, 1), 0)\n return clipped\n }\n\n // Figure out the value by incorporating the start time\n const endTime = t * (w + d) - w\n position =\n x <= 0\n ? Math.round(f(1e-5))\n : x < endTime\n ? f(x)\n : Math.round(f(endTime - 1e-5))\n return position\n }\n\n // Work out the loops done and add the position to the loops done\n const loopsDone = Math.floor(this.loops())\n const swingForward = s && loopsDone % 2 === 0\n const forwards = (swingForward && !r) || (r && swingForward)\n position = loopsDone + (forwards ? p : 1 - p)\n return this.loops(position)\n }\n\n progress(p) {\n if (p == null) {\n return Math.min(1, this._time / this.duration())\n }\n return this.time(p * this.duration())\n }\n\n /*\n Basic Functionality\n ===================\n These methods allow us to attach basic functions to the runner directly\n */\n queue(initFn, runFn, retargetFn, isTransform) {\n this._queue.push({\n initialiser: initFn || noop,\n runner: runFn || noop,\n retarget: retargetFn,\n isTransform: isTransform,\n initialised: false,\n finished: false\n })\n const timeline = this.timeline()\n timeline && this.timeline()._continue()\n return this\n }\n\n reset() {\n if (this._reseted) return this\n this.time(0)\n this._reseted = true\n return this\n }\n\n reverse(reverse) {\n this._reverse = reverse == null ? !this._reverse : reverse\n return this\n }\n\n schedule(timeline, delay, when) {\n // The user doesn't need to pass a timeline if we already have one\n if (!(timeline instanceof Timeline)) {\n when = delay\n delay = timeline\n timeline = this.timeline()\n }\n\n // If there is no timeline, yell at the user...\n if (!timeline) {\n throw Error('Runner cannot be scheduled without timeline')\n }\n\n // Schedule the runner on the timeline provided\n timeline.schedule(this, delay, when)\n return this\n }\n\n step(dt) {\n // If we are inactive, this stepper just gets skipped\n if (!this.enabled) return this\n\n // Update the time and get the new position\n dt = dt == null ? 16 : dt\n this._time += dt\n const position = this.position()\n\n // Figure out if we need to run the stepper in this frame\n const running = this._lastPosition !== position && this._time >= 0\n this._lastPosition = position\n\n // Figure out if we just started\n const duration = this.duration()\n const justStarted = this._lastTime <= 0 && this._time > 0\n const justFinished = this._lastTime < duration && this._time >= duration\n\n this._lastTime = this._time\n if (justStarted) {\n this.fire('start', this)\n }\n\n // Work out if the runner is finished set the done flag here so animations\n // know, that they are running in the last step (this is good for\n // transformations which can be merged)\n const declarative = this._isDeclarative\n this.done = !declarative && !justFinished && this._time >= duration\n\n // Runner is running. So its not in reset state anymore\n this._reseted = false\n\n let converged = false\n // Call initialise and the run function\n if (running || declarative) {\n this._initialise(running)\n\n // clear the transforms on this runner so they dont get added again and again\n this.transforms = new Matrix()\n converged = this._run(declarative ? dt : position)\n\n this.fire('step', this)\n }\n // correct the done flag here\n // declarative animations itself know when they converged\n this.done = this.done || (converged && declarative)\n if (justFinished) {\n this.fire('finished', this)\n }\n return this\n }\n\n /*\n Runner animation methods\n ========================\n Control how the animation plays\n */\n time(time) {\n if (time == null) {\n return this._time\n }\n const dt = time - this._time\n this.step(dt)\n return this\n }\n\n timeline(timeline) {\n // check explicitly for undefined so we can set the timeline to null\n if (typeof timeline === 'undefined') return this._timeline\n this._timeline = timeline\n return this\n }\n\n unschedule() {\n const timeline = this.timeline()\n timeline && timeline.unschedule(this)\n return this\n }\n\n // Run each initialise function in the runner if required\n _initialise(running) {\n // If we aren't running, we shouldn't initialise when not declarative\n if (!running && !this._isDeclarative) return\n\n // Loop through all of the initialisers\n for (let i = 0, len = this._queue.length; i < len; ++i) {\n // Get the current initialiser\n const current = this._queue[i]\n\n // Determine whether we need to initialise\n const needsIt = this._isDeclarative || (!current.initialised && running)\n running = !current.finished\n\n // Call the initialiser if we need to\n if (needsIt && running) {\n current.initialiser.call(this)\n current.initialised = true\n }\n }\n }\n\n // Save a morpher to the morpher list so that we can retarget it later\n _rememberMorpher(method, morpher) {\n this._history[method] = {\n morpher: morpher,\n caller: this._queue[this._queue.length - 1]\n }\n\n // We have to resume the timeline in case a controller\n // is already done without being ever run\n // This can happen when e.g. this is done:\n // anim = el.animate(new SVG.Spring)\n // and later\n // anim.move(...)\n if (this._isDeclarative) {\n const timeline = this.timeline()\n timeline && timeline.play()\n }\n }\n\n // Try to set the target for a morpher if the morpher exists, otherwise\n // Run each run function for the position or dt given\n _run(positionOrDt) {\n // Run all of the _queue directly\n let allfinished = true\n for (let i = 0, len = this._queue.length; i < len; ++i) {\n // Get the current function to run\n const current = this._queue[i]\n\n // Run the function if its not finished, we keep track of the finished\n // flag for the sake of declarative _queue\n const converged = current.runner.call(this, positionOrDt)\n current.finished = current.finished || converged === true\n allfinished = allfinished && current.finished\n }\n\n // We report when all of the constructors are finished\n return allfinished\n }\n\n // do nothing and return false\n _tryRetarget(method, target, extra) {\n if (this._history[method]) {\n // if the last method wasn't even initialised, throw it away\n if (!this._history[method].caller.initialised) {\n const index = this._queue.indexOf(this._history[method].caller)\n this._queue.splice(index, 1)\n return false\n }\n\n // for the case of transformations, we use the special retarget function\n // which has access to the outer scope\n if (this._history[method].caller.retarget) {\n this._history[method].caller.retarget.call(this, target, extra)\n // for everything else a simple morpher change is sufficient\n } else {\n this._history[method].morpher.to(target)\n }\n\n this._history[method].caller.finished = false\n const timeline = this.timeline()\n timeline && timeline.play()\n return true\n }\n return false\n }\n}\n\nRunner.id = 0\n\nexport class FakeRunner {\n constructor(transforms = new Matrix(), id = -1, done = true) {\n this.transforms = transforms\n this.id = id\n this.done = done\n }\n\n clearTransformsFromQueue() {}\n}\n\nextend([Runner, FakeRunner], {\n mergeWith(runner) {\n return new FakeRunner(\n runner.transforms.lmultiply(this.transforms),\n runner.id\n )\n }\n})\n\n// FakeRunner.emptyRunner = new FakeRunner()\n\nconst lmultiply = (last, curr) => last.lmultiplyO(curr)\nconst getRunnerTransform = (runner) => runner.transforms\n\nfunction mergeTransforms() {\n // Find the matrix to apply to the element and apply it\n const runners = this._transformationRunners.runners\n const netTransform = runners\n .map(getRunnerTransform)\n .reduce(lmultiply, new Matrix())\n\n this.transform(netTransform)\n\n this._transformationRunners.merge()\n\n if (this._transformationRunners.length() === 1) {\n this._frameId = null\n }\n}\n\nexport class RunnerArray {\n constructor() {\n this.runners = []\n this.ids = []\n }\n\n add(runner) {\n if (this.runners.includes(runner)) return\n const id = runner.id + 1\n\n this.runners.push(runner)\n this.ids.push(id)\n\n return this\n }\n\n clearBefore(id) {\n const deleteCnt = this.ids.indexOf(id + 1) || 1\n this.ids.splice(0, deleteCnt, 0)\n this.runners\n .splice(0, deleteCnt, new FakeRunner())\n .forEach((r) => r.clearTransformsFromQueue())\n return this\n }\n\n edit(id, newRunner) {\n const index = this.ids.indexOf(id + 1)\n this.ids.splice(index, 1, id + 1)\n this.runners.splice(index, 1, newRunner)\n return this\n }\n\n getByID(id) {\n return this.runners[this.ids.indexOf(id + 1)]\n }\n\n length() {\n return this.ids.length\n }\n\n merge() {\n let lastRunner = null\n for (let i = 0; i < this.runners.length; ++i) {\n const runner = this.runners[i]\n\n const condition =\n lastRunner &&\n runner.done &&\n lastRunner.done &&\n // don't merge runner when persisted on timeline\n (!runner._timeline ||\n !runner._timeline._runnerIds.includes(runner.id)) &&\n (!lastRunner._timeline ||\n !lastRunner._timeline._runnerIds.includes(lastRunner.id))\n\n if (condition) {\n // the +1 happens in the function\n this.remove(runner.id)\n const newRunner = runner.mergeWith(lastRunner)\n this.edit(lastRunner.id, newRunner)\n lastRunner = newRunner\n --i\n } else {\n lastRunner = runner\n }\n }\n\n return this\n }\n\n remove(id) {\n const index = this.ids.indexOf(id + 1)\n this.ids.splice(index, 1)\n this.runners.splice(index, 1)\n return this\n }\n}\n\nregisterMethods({\n Element: {\n animate(duration, delay, when) {\n const o = Runner.sanitise(duration, delay, when)\n const timeline = this.timeline()\n return new Runner(o.duration)\n .loop(o)\n .element(this)\n .timeline(timeline.play())\n .schedule(o.delay, o.when)\n },\n\n delay(by, when) {\n return this.animate(0, by, when)\n },\n\n // this function searches for all runners on the element and deletes the ones\n // which run before the current one. This is because absolute transformations\n // overwrite anything anyway so there is no need to waste time computing\n // other runners\n _clearTransformRunnersBefore(currentRunner) {\n this._transformationRunners.clearBefore(currentRunner.id)\n },\n\n _currentTransform(current) {\n return (\n this._transformationRunners.runners\n // we need the equal sign here to make sure, that also transformations\n // on the same runner which execute before the current transformation are\n // taken into account\n .filter((runner) => runner.id <= current.id)\n .map(getRunnerTransform)\n .reduce(lmultiply, new Matrix())\n )\n },\n\n _addRunner(runner) {\n this._transformationRunners.add(runner)\n\n // Make sure that the runner merge is executed at the very end of\n // all Animator functions. That is why we use immediate here to execute\n // the merge right after all frames are run\n Animator.cancelImmediate(this._frameId)\n this._frameId = Animator.immediate(mergeTransforms.bind(this))\n },\n\n _prepareRunner() {\n if (this._frameId == null) {\n this._transformationRunners = new RunnerArray().add(\n new FakeRunner(new Matrix(this))\n )\n }\n }\n }\n})\n\n// Will output the elements from array A that are not in the array B\nconst difference = (a, b) => a.filter((x) => !b.includes(x))\n\nextend(Runner, {\n attr(a, v) {\n return this.styleAttr('attr', a, v)\n },\n\n // Add animatable styles\n css(s, v) {\n return this.styleAttr('css', s, v)\n },\n\n styleAttr(type, nameOrAttrs, val) {\n if (typeof nameOrAttrs === 'string') {\n return this.styleAttr(type, { [nameOrAttrs]: val })\n }\n\n let attrs = nameOrAttrs\n if (this._tryRetarget(type, attrs)) return this\n\n let morpher = new Morphable(this._stepper).to(attrs)\n let keys = Object.keys(attrs)\n\n this.queue(\n function () {\n morpher = morpher.from(this.element()[type](keys))\n },\n function (pos) {\n this.element()[type](morpher.at(pos).valueOf())\n return morpher.done()\n },\n function (newToAttrs) {\n // Check if any new keys were added\n const newKeys = Object.keys(newToAttrs)\n const differences = difference(newKeys, keys)\n\n // If their are new keys, initialize them and add them to morpher\n if (differences.length) {\n // Get the values\n const addedFromAttrs = this.element()[type](differences)\n\n // Get the already initialized values\n const oldFromAttrs = new ObjectBag(morpher.from()).valueOf()\n\n // Merge old and new\n Object.assign(oldFromAttrs, addedFromAttrs)\n morpher.from(oldFromAttrs)\n }\n\n // Get the object from the morpher\n const oldToAttrs = new ObjectBag(morpher.to()).valueOf()\n\n // Merge in new attributes\n Object.assign(oldToAttrs, newToAttrs)\n\n // Change morpher target\n morpher.to(oldToAttrs)\n\n // Make sure that we save the work we did so we don't need it to do again\n keys = newKeys\n attrs = newToAttrs\n }\n )\n\n this._rememberMorpher(type, morpher)\n return this\n },\n\n zoom(level, point) {\n if (this._tryRetarget('zoom', level, point)) return this\n\n let morpher = new Morphable(this._stepper).to(new SVGNumber(level))\n\n this.queue(\n function () {\n morpher = morpher.from(this.element().zoom())\n },\n function (pos) {\n this.element().zoom(morpher.at(pos), point)\n return morpher.done()\n },\n function (newLevel, newPoint) {\n point = newPoint\n morpher.to(newLevel)\n }\n )\n\n this._rememberMorpher('zoom', morpher)\n return this\n },\n\n /**\n ** absolute transformations\n **/\n\n //\n // M v -----|-----(D M v = F v)------|-----> T v\n //\n // 1. define the final state (T) and decompose it (once)\n // t = [tx, ty, the, lam, sy, sx]\n // 2. on every frame: pull the current state of all previous transforms\n // (M - m can change)\n // and then write this as m = [tx0, ty0, the0, lam0, sy0, sx0]\n // 3. Find the interpolated matrix F(pos) = m + pos * (t - m)\n // - Note F(0) = M\n // - Note F(1) = T\n // 4. Now you get the delta matrix as a result: D = F * inv(M)\n\n transform(transforms, relative, affine) {\n // If we have a declarative function, we should retarget it if possible\n relative = transforms.relative || relative\n if (\n this._isDeclarative &&\n !relative &&\n this._tryRetarget('transform', transforms)\n ) {\n return this\n }\n\n // Parse the parameters\n const isMatrix = Matrix.isMatrixLike(transforms)\n affine =\n transforms.affine != null\n ? transforms.affine\n : affine != null\n ? affine\n : !isMatrix\n\n // Create a morpher and set its type\n const morpher = new Morphable(this._stepper).type(\n affine ? TransformBag : Matrix\n )\n\n let origin\n let element\n let current\n let currentAngle\n let startTransform\n\n function setup() {\n // make sure element and origin is defined\n element = element || this.element()\n origin = origin || getOrigin(transforms, element)\n\n startTransform = new Matrix(relative ? undefined : element)\n\n // add the runner to the element so it can merge transformations\n element._addRunner(this)\n\n // Deactivate all transforms that have run so far if we are absolute\n if (!relative) {\n element._clearTransformRunnersBefore(this)\n }\n }\n\n function run(pos) {\n // clear all other transforms before this in case something is saved\n // on this runner. We are absolute. We dont need these!\n if (!relative) this.clearTransform()\n\n const { x, y } = new Point(origin).transform(\n element._currentTransform(this)\n )\n\n let target = new Matrix({ ...transforms, origin: [x, y] })\n let start = this._isDeclarative && current ? current : startTransform\n\n if (affine) {\n target = target.decompose(x, y)\n start = start.decompose(x, y)\n\n // Get the current and target angle as it was set\n const rTarget = target.rotate\n const rCurrent = start.rotate\n\n // Figure out the shortest path to rotate directly\n const possibilities = [rTarget - 360, rTarget, rTarget + 360]\n const distances = possibilities.map((a) => Math.abs(a - rCurrent))\n const shortest = Math.min(...distances)\n const index = distances.indexOf(shortest)\n target.rotate = possibilities[index]\n }\n\n if (relative) {\n // we have to be careful here not to overwrite the rotation\n // with the rotate method of Matrix\n if (!isMatrix) {\n target.rotate = transforms.rotate || 0\n }\n if (this._isDeclarative && currentAngle) {\n start.rotate = currentAngle\n }\n }\n\n morpher.from(start)\n morpher.to(target)\n\n const affineParameters = morpher.at(pos)\n currentAngle = affineParameters.rotate\n current = new Matrix(affineParameters)\n\n this.addTransform(current)\n element._addRunner(this)\n return morpher.done()\n }\n\n function retarget(newTransforms) {\n // only get a new origin if it changed since the last call\n if (\n (newTransforms.origin || 'center').toString() !==\n (transforms.origin || 'center').toString()\n ) {\n origin = getOrigin(newTransforms, element)\n }\n\n // overwrite the old transformations with the new ones\n transforms = { ...newTransforms, origin }\n }\n\n this.queue(setup, run, retarget, true)\n this._isDeclarative && this._rememberMorpher('transform', morpher)\n return this\n },\n\n // Animatable x-axis\n x(x) {\n return this._queueNumber('x', x)\n },\n\n // Animatable y-axis\n y(y) {\n return this._queueNumber('y', y)\n },\n\n ax(x) {\n return this._queueNumber('ax', x)\n },\n\n ay(y) {\n return this._queueNumber('ay', y)\n },\n\n dx(x = 0) {\n return this._queueNumberDelta('x', x)\n },\n\n dy(y = 0) {\n return this._queueNumberDelta('y', y)\n },\n\n dmove(x, y) {\n return this.dx(x).dy(y)\n },\n\n _queueNumberDelta(method, to) {\n to = new SVGNumber(to)\n\n // Try to change the target if we have this method already registered\n if (this._tryRetarget(method, to)) return this\n\n // Make a morpher and queue the animation\n const morpher = new Morphable(this._stepper).to(to)\n let from = null\n this.queue(\n function () {\n from = this.element()[method]()\n morpher.from(from)\n morpher.to(from + to)\n },\n function (pos) {\n this.element()[method](morpher.at(pos))\n return morpher.done()\n },\n function (newTo) {\n morpher.to(from + new SVGNumber(newTo))\n }\n )\n\n // Register the morpher so that if it is changed again, we can retarget it\n this._rememberMorpher(method, morpher)\n return this\n },\n\n _queueObject(method, to) {\n // Try to change the target if we have this method already registered\n if (this._tryRetarget(method, to)) return this\n\n // Make a morpher and queue the animation\n const morpher = new Morphable(this._stepper).to(to)\n this.queue(\n function () {\n morpher.from(this.element()[method]())\n },\n function (pos) {\n this.element()[method](morpher.at(pos))\n return morpher.done()\n }\n )\n\n // Register the morpher so that if it is changed again, we can retarget it\n this._rememberMorpher(method, morpher)\n return this\n },\n\n _queueNumber(method, value) {\n return this._queueObject(method, new SVGNumber(value))\n },\n\n // Animatable center x-axis\n cx(x) {\n return this._queueNumber('cx', x)\n },\n\n // Animatable center y-axis\n cy(y) {\n return this._queueNumber('cy', y)\n },\n\n // Add animatable move\n move(x, y) {\n return this.x(x).y(y)\n },\n\n amove(x, y) {\n return this.ax(x).ay(y)\n },\n\n // Add animatable center\n center(x, y) {\n return this.cx(x).cy(y)\n },\n\n // Add animatable size\n size(width, height) {\n // animate bbox based size for all other elements\n let box\n\n if (!width || !height) {\n box = this._element.bbox()\n }\n\n if (!width) {\n width = (box.width / box.height) * height\n }\n\n if (!height) {\n height = (box.height / box.width) * width\n }\n\n return this.width(width).height(height)\n },\n\n // Add animatable width\n width(width) {\n return this._queueNumber('width', width)\n },\n\n // Add animatable height\n height(height) {\n return this._queueNumber('height', height)\n },\n\n // Add animatable plot\n plot(a, b, c, d) {\n // Lines can be plotted with 4 arguments\n if (arguments.length === 4) {\n return this.plot([a, b, c, d])\n }\n\n if (this._tryRetarget('plot', a)) return this\n\n const morpher = new Morphable(this._stepper)\n .type(this._element.MorphArray)\n .to(a)\n\n this.queue(\n function () {\n morpher.from(this._element.array())\n },\n function (pos) {\n this._element.plot(morpher.at(pos))\n return morpher.done()\n }\n )\n\n this._rememberMorpher('plot', morpher)\n return this\n },\n\n // Add leading method\n leading(value) {\n return this._queueNumber('leading', value)\n },\n\n // Add animatable viewbox\n viewbox(x, y, width, height) {\n return this._queueObject('viewbox', new Box(x, y, width, height))\n },\n\n update(o) {\n if (typeof o !== 'object') {\n return this.update({\n offset: arguments[0],\n color: arguments[1],\n opacity: arguments[2]\n })\n }\n\n if (o.opacity != null) this.attr('stop-opacity', o.opacity)\n if (o.color != null) this.attr('stop-color', o.color)\n if (o.offset != null) this.attr('offset', o.offset)\n\n return this\n }\n})\n\nextend(Runner, { rx, ry, from, to })\nregister(Runner, 'Runner')\n","import {\n adopt,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { svg, xlink, xmlns } from '../modules/core/namespaces.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Container from './Container.js'\nimport Defs from './Defs.js'\nimport { globals } from '../utils/window.js'\n\nexport default class Svg extends Container {\n constructor(node, attrs = node) {\n super(nodeOrNew('svg', node), attrs)\n this.namespace()\n }\n\n // Creates and returns defs element\n defs() {\n if (!this.isRoot()) return this.root().defs()\n\n return adopt(this.node.querySelector('defs')) || this.put(new Defs())\n }\n\n isRoot() {\n return (\n !this.node.parentNode ||\n (!(this.node.parentNode instanceof globals.window.SVGElement) &&\n this.node.parentNode.nodeName !== '#document-fragment')\n )\n }\n\n // Add namespaces\n namespace() {\n if (!this.isRoot()) return this.root().namespace()\n return this.attr({ xmlns: svg, version: '1.1' }).attr(\n 'xmlns:xlink',\n xlink,\n xmlns\n )\n }\n\n removeNamespace() {\n return this.attr({ xmlns: null, version: null })\n .attr('xmlns:xlink', null, xmlns)\n .attr('xmlns:svgjs', null, xmlns)\n }\n\n // Check if this is a root svg\n // If not, call root() from this element\n root() {\n if (this.isRoot()) return this\n return super.root()\n }\n}\n\nregisterMethods({\n Container: {\n // Create nested svg document\n nested: wrapWithAttrCheck(function () {\n return this.put(new Svg())\n })\n }\n})\n\nregister(Svg, 'Svg', true)\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Container from './Container.js'\n\nexport default class Symbol extends Container {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('symbol', node), attrs)\n }\n}\n\nregisterMethods({\n Container: {\n symbol: wrapWithAttrCheck(function () {\n return this.put(new Symbol())\n })\n }\n})\n\nregister(Symbol, 'Symbol')\n","import { globals } from '../../utils/window.js'\n\n// Create plain text node\nexport function plain(text) {\n // clear if build mode is disabled\n if (this._build === false) {\n this.clear()\n }\n\n // create text node\n this.node.appendChild(globals.document.createTextNode(text))\n\n return this\n}\n\n// Get length of text element\nexport function length() {\n return this.node.getComputedTextLength()\n}\n\n// Move over x-axis\n// Text is moved by its bounding box\n// text-anchor does NOT matter\nexport function x(x, box = this.bbox()) {\n if (x == null) {\n return box.x\n }\n\n return this.attr('x', this.attr('x') + x - box.x)\n}\n\n// Move over y-axis\nexport function y(y, box = this.bbox()) {\n if (y == null) {\n return box.y\n }\n\n return this.attr('y', this.attr('y') + y - box.y)\n}\n\nexport function move(x, y, box = this.bbox()) {\n return this.x(x, box).y(y, box)\n}\n\n// Move center over x-axis\nexport function cx(x, box = this.bbox()) {\n if (x == null) {\n return box.cx\n }\n\n return this.attr('x', this.attr('x') + x - box.cx)\n}\n\n// Move center over y-axis\nexport function cy(y, box = this.bbox()) {\n if (y == null) {\n return box.cy\n }\n\n return this.attr('y', this.attr('y') + y - box.cy)\n}\n\nexport function center(x, y, box = this.bbox()) {\n return this.cx(x, box).cy(y, box)\n}\n\nexport function ax(x) {\n return this.attr('x', x)\n}\n\nexport function ay(y) {\n return this.attr('y', y)\n}\n\nexport function amove(x, y) {\n return this.ax(x).ay(y)\n}\n\n// Enable / disable build mode\nexport function build(build) {\n this._build = !!build\n return this\n}\n","import {\n adopt,\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport SVGNumber from '../types/SVGNumber.js'\nimport Shape from './Shape.js'\nimport { globals } from '../utils/window.js'\nimport * as textable from '../modules/core/textable.js'\nimport { isDescriptive, writeDataToDom } from '../utils/utils.js'\n\nexport default class Text extends Shape {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('text', node), attrs)\n\n this.dom.leading = this.dom.leading ?? new SVGNumber(1.3) // store leading value for rebuilding\n this._rebuild = true // enable automatic updating of dy values\n this._build = false // disable build mode for adding multiple lines\n }\n\n // Set / get leading\n leading(value) {\n // act as getter\n if (value == null) {\n return this.dom.leading\n }\n\n // act as setter\n this.dom.leading = new SVGNumber(value)\n\n return this.rebuild()\n }\n\n // Rebuild appearance type\n rebuild(rebuild) {\n // store new rebuild flag if given\n if (typeof rebuild === 'boolean') {\n this._rebuild = rebuild\n }\n\n // define position of all lines\n if (this._rebuild) {\n const self = this\n let blankLineOffset = 0\n const leading = this.dom.leading\n\n this.each(function (i) {\n if (isDescriptive(this.node)) return\n\n const fontSize = globals.window\n .getComputedStyle(this.node)\n .getPropertyValue('font-size')\n\n const dy = leading * new SVGNumber(fontSize)\n\n if (this.dom.newLined) {\n this.attr('x', self.attr('x'))\n\n if (this.text() === '\\n') {\n blankLineOffset += dy\n } else {\n this.attr('dy', i ? dy + blankLineOffset : 0)\n blankLineOffset = 0\n }\n }\n })\n\n this.fire('rebuild')\n }\n\n return this\n }\n\n // overwrite method from parent to set data properly\n setData(o) {\n this.dom = o\n this.dom.leading = new SVGNumber(o.leading || 1.3)\n return this\n }\n\n writeDataToDom() {\n writeDataToDom(this, this.dom, { leading: 1.3 })\n return this\n }\n\n // Set the text content\n text(text) {\n // act as getter\n if (text === undefined) {\n const children = this.node.childNodes\n let firstLine = 0\n text = ''\n\n for (let i = 0, len = children.length; i < len; ++i) {\n // skip textPaths - they are no lines\n if (children[i].nodeName === 'textPath' || isDescriptive(children[i])) {\n if (i === 0) firstLine = i + 1\n continue\n }\n\n // add newline if its not the first child and newLined is set to true\n if (\n i !== firstLine &&\n children[i].nodeType !== 3 &&\n adopt(children[i]).dom.newLined === true\n ) {\n text += '\\n'\n }\n\n // add content of this node\n text += children[i].textContent\n }\n\n return text\n }\n\n // remove existing content\n this.clear().build(true)\n\n if (typeof text === 'function') {\n // call block\n text.call(this, this)\n } else {\n // store text and make sure text is not blank\n text = (text + '').split('\\n')\n\n // build new lines\n for (let j = 0, jl = text.length; j < jl; j++) {\n this.newLine(text[j])\n }\n }\n\n // disable build mode and rebuild lines\n return this.build(false).rebuild()\n }\n}\n\nextend(Text, textable)\n\nregisterMethods({\n Container: {\n // Create text element\n text: wrapWithAttrCheck(function (text = '') {\n return this.put(new Text()).text(text)\n }),\n\n // Create plain text element\n plain: wrapWithAttrCheck(function (text = '') {\n return this.put(new Text()).plain(text)\n })\n }\n})\n\nregister(Text, 'Text')\n","import {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { globals } from '../utils/window.js'\nimport { registerMethods } from '../utils/methods.js'\nimport SVGNumber from '../types/SVGNumber.js'\nimport Shape from './Shape.js'\nimport Text from './Text.js'\nimport * as textable from '../modules/core/textable.js'\n\nexport default class Tspan extends Shape {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('tspan', node), attrs)\n this._build = false // disable build mode for adding multiple lines\n }\n\n // Shortcut dx\n dx(dx) {\n return this.attr('dx', dx)\n }\n\n // Shortcut dy\n dy(dy) {\n return this.attr('dy', dy)\n }\n\n // Create new line\n newLine() {\n // mark new line\n this.dom.newLined = true\n\n // fetch parent\n const text = this.parent()\n\n // early return in case we are not in a text element\n if (!(text instanceof Text)) {\n return this\n }\n\n const i = text.index(this)\n\n const fontSize = globals.window\n .getComputedStyle(this.node)\n .getPropertyValue('font-size')\n const dy = text.dom.leading * new SVGNumber(fontSize)\n\n // apply new position\n return this.dy(i ? dy : 0).attr('x', text.x())\n }\n\n // Set text content\n text(text) {\n if (text == null)\n return this.node.textContent + (this.dom.newLined ? '\\n' : '')\n\n if (typeof text === 'function') {\n this.clear().build(true)\n text.call(this, this)\n this.build(false)\n } else {\n this.plain(text)\n }\n\n return this\n }\n}\n\nextend(Tspan, textable)\n\nregisterMethods({\n Tspan: {\n tspan: wrapWithAttrCheck(function (text = '') {\n const tspan = new Tspan()\n\n // clear if build mode is disabled\n if (!this._build) {\n this.clear()\n }\n\n // add new tspan\n return this.put(tspan).text(text)\n })\n },\n Text: {\n newLine: function (text = '') {\n return this.tspan(text).newLine()\n }\n }\n})\n\nregister(Tspan, 'Tspan')\n","import { cx, cy, height, width, x, y } from '../modules/core/circled.js'\nimport {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport SVGNumber from '../types/SVGNumber.js'\nimport Shape from './Shape.js'\n\nexport default class Circle extends Shape {\n constructor(node, attrs = node) {\n super(nodeOrNew('circle', node), attrs)\n }\n\n radius(r) {\n return this.attr('r', r)\n }\n\n // Radius x value\n rx(rx) {\n return this.attr('r', rx)\n }\n\n // Alias radius x value\n ry(ry) {\n return this.rx(ry)\n }\n\n size(size) {\n return this.radius(new SVGNumber(size).divide(2))\n }\n}\n\nextend(Circle, { x, y, cx, cy, width, height })\n\nregisterMethods({\n Container: {\n // Create circle element\n circle: wrapWithAttrCheck(function (size = 0) {\n return this.put(new Circle()).size(size).move(0, 0)\n })\n }\n})\n\nregister(Circle, 'Circle')\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Container from './Container.js'\nimport baseFind from '../modules/core/selector.js'\n\nexport default class ClipPath extends Container {\n constructor(node, attrs = node) {\n super(nodeOrNew('clipPath', node), attrs)\n }\n\n // Unclip all clipped elements and remove itself\n remove() {\n // unclip all targets\n this.targets().forEach(function (el) {\n el.unclip()\n })\n\n // remove clipPath from parent\n return super.remove()\n }\n\n targets() {\n return baseFind('svg [clip-path*=' + this.id() + ']')\n }\n}\n\nregisterMethods({\n Container: {\n // Create clipping element\n clip: wrapWithAttrCheck(function () {\n return this.defs().put(new ClipPath())\n })\n },\n Element: {\n // Distribute clipPath to svg element\n clipper() {\n return this.reference('clip-path')\n },\n\n clipWith(element) {\n // use given clip or create a new one\n const clipper =\n element instanceof ClipPath\n ? element\n : this.parent().clip().add(element)\n\n // apply mask\n return this.attr('clip-path', 'url(#' + clipper.id() + ')')\n },\n\n // Unclip element\n unclip() {\n return this.attr('clip-path', null)\n }\n }\n})\n\nregister(ClipPath, 'ClipPath')\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Element from './Element.js'\n\nexport default class ForeignObject extends Element {\n constructor(node, attrs = node) {\n super(nodeOrNew('foreignObject', node), attrs)\n }\n}\n\nregisterMethods({\n Container: {\n foreignObject: wrapWithAttrCheck(function (width, height) {\n return this.put(new ForeignObject()).size(width, height)\n })\n }\n})\n\nregister(ForeignObject, 'ForeignObject')\n","import Matrix from '../../types/Matrix.js'\nimport Point from '../../types/Point.js'\nimport Box from '../../types/Box.js'\nimport { proportionalSize } from '../../utils/utils.js'\nimport { getWindow } from '../../utils/window.js'\n\nexport function dmove(dx, dy) {\n this.children().forEach((child) => {\n let bbox\n\n // We have to wrap this for elements that dont have a bbox\n // e.g. title and other descriptive elements\n try {\n // Get the childs bbox\n // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1905039\n // Because bbox for nested svgs returns the contents bbox in the coordinate space of the svg itself (weird!), we cant use bbox for svgs\n // Therefore we have to use getBoundingClientRect. But THAT is broken (as explained in the bug).\n // Funnily enough the broken behavior would work for us but that breaks it in chrome\n // So we have to replicate the broken behavior of FF by just reading the attributes of the svg itself\n bbox =\n child.node instanceof getWindow().SVGSVGElement\n ? new Box(child.attr(['x', 'y', 'width', 'height']))\n : child.bbox()\n } catch (e) {\n return\n }\n\n // Get childs matrix\n const m = new Matrix(child)\n // Translate childs matrix by amount and\n // transform it back into parents space\n const matrix = m.translate(dx, dy).transform(m.inverse())\n // Calculate new x and y from old box\n const p = new Point(bbox.x, bbox.y).transform(matrix)\n // Move element\n child.move(p.x, p.y)\n })\n\n return this\n}\n\nexport function dx(dx) {\n return this.dmove(dx, 0)\n}\n\nexport function dy(dy) {\n return this.dmove(0, dy)\n}\n\nexport function height(height, box = this.bbox()) {\n if (height == null) return box.height\n return this.size(box.width, height, box)\n}\n\nexport function move(x = 0, y = 0, box = this.bbox()) {\n const dx = x - box.x\n const dy = y - box.y\n\n return this.dmove(dx, dy)\n}\n\nexport function size(width, height, box = this.bbox()) {\n const p = proportionalSize(this, width, height, box)\n const scaleX = p.width / box.width\n const scaleY = p.height / box.height\n\n this.children().forEach((child) => {\n const o = new Point(box).transform(new Matrix(child).inverse())\n child.scale(scaleX, scaleY, o.x, o.y)\n })\n\n return this\n}\n\nexport function width(width, box = this.bbox()) {\n if (width == null) return box.width\n return this.size(width, box.height, box)\n}\n\nexport function x(x, box = this.bbox()) {\n if (x == null) return box.x\n return this.move(x, box.y, box)\n}\n\nexport function y(y, box = this.bbox()) {\n if (y == null) return box.y\n return this.move(box.x, y, box)\n}\n","import {\n nodeOrNew,\n register,\n wrapWithAttrCheck,\n extend\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Container from './Container.js'\nimport * as containerGeometry from '../modules/core/containerGeometry.js'\n\nexport default class G extends Container {\n constructor(node, attrs = node) {\n super(nodeOrNew('g', node), attrs)\n }\n}\n\nextend(G, containerGeometry)\n\nregisterMethods({\n Container: {\n // Create a group element\n group: wrapWithAttrCheck(function () {\n return this.put(new G())\n })\n }\n})\n\nregister(G, 'G')\n","import {\n nodeOrNew,\n register,\n wrapWithAttrCheck,\n extend\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport { xlink } from '../modules/core/namespaces.js'\nimport Container from './Container.js'\nimport * as containerGeometry from '../modules/core/containerGeometry.js'\n\nexport default class A extends Container {\n constructor(node, attrs = node) {\n super(nodeOrNew('a', node), attrs)\n }\n\n // Link target attribute\n target(target) {\n return this.attr('target', target)\n }\n\n // Link url\n to(url) {\n return this.attr('href', url, xlink)\n }\n}\n\nextend(A, containerGeometry)\n\nregisterMethods({\n Container: {\n // Create a hyperlink element\n link: wrapWithAttrCheck(function (url) {\n return this.put(new A()).to(url)\n })\n },\n Element: {\n unlink() {\n const link = this.linker()\n\n if (!link) return this\n\n const parent = link.parent()\n\n if (!parent) {\n return this.remove()\n }\n\n const index = parent.index(link)\n parent.add(this, index)\n\n link.remove()\n return this\n },\n linkTo(url) {\n // reuse old link if possible\n let link = this.linker()\n\n if (!link) {\n link = new A()\n this.wrap(link)\n }\n\n if (typeof url === 'function') {\n url.call(link, link)\n } else {\n link.to(url)\n }\n\n return this\n },\n linker() {\n const link = this.parent()\n if (link && link.node.nodeName.toLowerCase() === 'a') {\n return link\n }\n\n return null\n }\n }\n})\n\nregister(A, 'A')\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Container from './Container.js'\nimport baseFind from '../modules/core/selector.js'\n\nexport default class Mask extends Container {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('mask', node), attrs)\n }\n\n // Unmask all masked elements and remove itself\n remove() {\n // unmask all targets\n this.targets().forEach(function (el) {\n el.unmask()\n })\n\n // remove mask from parent\n return super.remove()\n }\n\n targets() {\n return baseFind('svg [mask*=' + this.id() + ']')\n }\n}\n\nregisterMethods({\n Container: {\n mask: wrapWithAttrCheck(function () {\n return this.defs().put(new Mask())\n })\n },\n Element: {\n // Distribute mask to svg element\n masker() {\n return this.reference('mask')\n },\n\n maskWith(element) {\n // use given mask or create a new one\n const masker =\n element instanceof Mask ? element : this.parent().mask().add(element)\n\n // apply mask\n return this.attr('mask', 'url(#' + masker.id() + ')')\n },\n\n // Unmask element\n unmask() {\n return this.attr('mask', null)\n }\n }\n})\n\nregister(Mask, 'Mask')\n","import { nodeOrNew, register } from '../utils/adopter.js'\nimport Element from './Element.js'\nimport SVGNumber from '../types/SVGNumber.js'\nimport { registerMethods } from '../utils/methods.js'\n\nexport default class Stop extends Element {\n constructor(node, attrs = node) {\n super(nodeOrNew('stop', node), attrs)\n }\n\n // add color stops\n update(o) {\n if (typeof o === 'number' || o instanceof SVGNumber) {\n o = {\n offset: arguments[0],\n color: arguments[1],\n opacity: arguments[2]\n }\n }\n\n // set attributes\n if (o.opacity != null) this.attr('stop-opacity', o.opacity)\n if (o.color != null) this.attr('stop-color', o.color)\n if (o.offset != null) this.attr('offset', new SVGNumber(o.offset))\n\n return this\n }\n}\n\nregisterMethods({\n Gradient: {\n // Add a color stop\n stop: function (offset, color, opacity) {\n return this.put(new Stop()).update(offset, color, opacity)\n }\n }\n})\n\nregister(Stop, 'Stop')\n","import { nodeOrNew, register } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport { unCamelCase } from '../utils/utils.js'\nimport Element from './Element.js'\n\nfunction cssRule(selector, rule) {\n if (!selector) return ''\n if (!rule) return selector\n\n let ret = selector + '{'\n\n for (const i in rule) {\n ret += unCamelCase(i) + ':' + rule[i] + ';'\n }\n\n ret += '}'\n\n return ret\n}\n\nexport default class Style extends Element {\n constructor(node, attrs = node) {\n super(nodeOrNew('style', node), attrs)\n }\n\n addText(w = '') {\n this.node.textContent += w\n return this\n }\n\n font(name, src, params = {}) {\n return this.rule('@font-face', {\n fontFamily: name,\n src: src,\n ...params\n })\n }\n\n rule(selector, obj) {\n return this.addText(cssRule(selector, obj))\n }\n}\n\nregisterMethods('Dom', {\n style(selector, obj) {\n return this.put(new Style()).rule(selector, obj)\n },\n fontface(name, src, params) {\n return this.put(new Style()).font(name, src, params)\n }\n})\n\nregister(Style, 'Style')\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport { xlink } from '../modules/core/namespaces.js'\nimport Path from './Path.js'\nimport PathArray from '../types/PathArray.js'\nimport Text from './Text.js'\nimport baseFind from '../modules/core/selector.js'\n\nexport default class TextPath extends Text {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('textPath', node), attrs)\n }\n\n // return the array of the path track element\n array() {\n const track = this.track()\n\n return track ? track.array() : null\n }\n\n // Plot path if any\n plot(d) {\n const track = this.track()\n let pathArray = null\n\n if (track) {\n pathArray = track.plot(d)\n }\n\n return d == null ? pathArray : this\n }\n\n // Get the path element\n track() {\n return this.reference('href')\n }\n}\n\nregisterMethods({\n Container: {\n textPath: wrapWithAttrCheck(function (text, path) {\n // Convert text to instance if needed\n if (!(text instanceof Text)) {\n text = this.text(text)\n }\n\n return text.path(path)\n })\n },\n Text: {\n // Create path for text to run on\n path: wrapWithAttrCheck(function (track, importNodes = true) {\n const textPath = new TextPath()\n\n // if track is a path, reuse it\n if (!(track instanceof Path)) {\n // create path element\n track = this.defs().path(track)\n }\n\n // link textPath to path and add content\n textPath.attr('href', '#' + track, xlink)\n\n // Transplant all nodes from text to textPath\n let node\n if (importNodes) {\n while ((node = this.node.firstChild)) {\n textPath.node.appendChild(node)\n }\n }\n\n // add textPath element as child node and return textPath\n return this.put(textPath)\n }),\n\n // Get the textPath children\n textPath() {\n return this.findOne('textPath')\n }\n },\n Path: {\n // creates a textPath from this path\n text: wrapWithAttrCheck(function (text) {\n // Convert text to instance if needed\n if (!(text instanceof Text)) {\n text = new Text().addTo(this.parent()).text(text)\n }\n\n // Create textPath from text and path and return\n return text.path(this)\n }),\n\n targets() {\n return baseFind('svg textPath').filter((node) => {\n return (node.attr('href') || '').includes(this.id())\n })\n\n // Does not work in IE11. Use when IE support is dropped\n // return baseFind('svg textPath[*|href*=' + this.id() + ']')\n }\n }\n})\n\nTextPath.prototype.MorphArray = PathArray\nregister(TextPath, 'TextPath')\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport { xlink } from '../modules/core/namespaces.js'\nimport Shape from './Shape.js'\n\nexport default class Use extends Shape {\n constructor(node, attrs = node) {\n super(nodeOrNew('use', node), attrs)\n }\n\n // Use element as a reference\n use(element, file) {\n // Set lined element\n return this.attr('href', (file || '') + '#' + element, xlink)\n }\n}\n\nregisterMethods({\n Container: {\n // Create a use element\n use: wrapWithAttrCheck(function (element, file) {\n return this.put(new Use()).use(element, file)\n })\n }\n})\n\nregister(Use, 'Use')\n","/* Optional Modules */\nimport './modules/optional/arrange.js'\nimport './modules/optional/class.js'\nimport './modules/optional/css.js'\nimport './modules/optional/data.js'\nimport './modules/optional/memory.js'\nimport './modules/optional/sugar.js'\nimport './modules/optional/transform.js'\n\nimport { extend, makeInstance } from './utils/adopter.js'\nimport { getMethodNames, getMethodsFor } from './utils/methods.js'\nimport Box from './types/Box.js'\nimport Color from './types/Color.js'\nimport Container from './elements/Container.js'\nimport Defs from './elements/Defs.js'\nimport Dom from './elements/Dom.js'\nimport Element from './elements/Element.js'\nimport Ellipse from './elements/Ellipse.js'\nimport EventTarget from './types/EventTarget.js'\nimport Fragment from './elements/Fragment.js'\nimport Gradient from './elements/Gradient.js'\nimport Image from './elements/Image.js'\nimport Line from './elements/Line.js'\nimport List from './types/List.js'\nimport Marker from './elements/Marker.js'\nimport Matrix from './types/Matrix.js'\nimport Morphable, {\n NonMorphable,\n ObjectBag,\n TransformBag,\n makeMorphable,\n registerMorphableType\n} from './animation/Morphable.js'\nimport Path from './elements/Path.js'\nimport PathArray from './types/PathArray.js'\nimport Pattern from './elements/Pattern.js'\nimport PointArray from './types/PointArray.js'\nimport Point from './types/Point.js'\nimport Polygon from './elements/Polygon.js'\nimport Polyline from './elements/Polyline.js'\nimport Rect from './elements/Rect.js'\nimport Runner from './animation/Runner.js'\nimport SVGArray from './types/SVGArray.js'\nimport SVGNumber from './types/SVGNumber.js'\nimport Shape from './elements/Shape.js'\nimport Svg from './elements/Svg.js'\nimport Symbol from './elements/Symbol.js'\nimport Text from './elements/Text.js'\nimport Tspan from './elements/Tspan.js'\nimport * as defaults from './modules/core/defaults.js'\nimport * as utils from './utils/utils.js'\nimport * as namespaces from './modules/core/namespaces.js'\nimport * as regex from './modules/core/regex.js'\n\nexport {\n Morphable,\n registerMorphableType,\n makeMorphable,\n TransformBag,\n ObjectBag,\n NonMorphable\n}\n\nexport { defaults, utils, namespaces, regex }\nexport const SVG = makeInstance\nexport { default as parser } from './modules/core/parser.js'\nexport { default as find } from './modules/core/selector.js'\nexport * from './modules/core/event.js'\nexport * from './utils/adopter.js'\nexport {\n getWindow,\n registerWindow,\n restoreWindow,\n saveWindow,\n withWindow\n} from './utils/window.js'\n\n/* Animation Modules */\nexport { default as Animator } from './animation/Animator.js'\nexport {\n Controller,\n Ease,\n PID,\n Spring,\n easing\n} from './animation/Controller.js'\nexport { default as Queue } from './animation/Queue.js'\nexport { default as Runner } from './animation/Runner.js'\nexport { default as Timeline } from './animation/Timeline.js'\n\n/* Types */\nexport { default as Array } from './types/SVGArray.js'\nexport { default as Box } from './types/Box.js'\nexport { default as Color } from './types/Color.js'\nexport { default as EventTarget } from './types/EventTarget.js'\nexport { default as Matrix } from './types/Matrix.js'\nexport { default as Number } from './types/SVGNumber.js'\nexport { default as PathArray } from './types/PathArray.js'\nexport { default as Point } from './types/Point.js'\nexport { default as PointArray } from './types/PointArray.js'\nexport { default as List } from './types/List.js'\n\n/* Elements */\nexport { default as Circle } from './elements/Circle.js'\nexport { default as ClipPath } from './elements/ClipPath.js'\nexport { default as Container } from './elements/Container.js'\nexport { default as Defs } from './elements/Defs.js'\nexport { default as Dom } from './elements/Dom.js'\nexport { default as Element } from './elements/Element.js'\nexport { default as Ellipse } from './elements/Ellipse.js'\nexport { default as ForeignObject } from './elements/ForeignObject.js'\nexport { default as Fragment } from './elements/Fragment.js'\nexport { default as Gradient } from './elements/Gradient.js'\nexport { default as G } from './elements/G.js'\nexport { default as A } from './elements/A.js'\nexport { default as Image } from './elements/Image.js'\nexport { default as Line } from './elements/Line.js'\nexport { default as Marker } from './elements/Marker.js'\nexport { default as Mask } from './elements/Mask.js'\nexport { default as Path } from './elements/Path.js'\nexport { default as Pattern } from './elements/Pattern.js'\nexport { default as Polygon } from './elements/Polygon.js'\nexport { default as Polyline } from './elements/Polyline.js'\nexport { default as Rect } from './elements/Rect.js'\nexport { default as Shape } from './elements/Shape.js'\nexport { default as Stop } from './elements/Stop.js'\nexport { default as Style } from './elements/Style.js'\nexport { default as Svg } from './elements/Svg.js'\nexport { default as Symbol } from './elements/Symbol.js'\nexport { default as Text } from './elements/Text.js'\nexport { default as TextPath } from './elements/TextPath.js'\nexport { default as Tspan } from './elements/Tspan.js'\nexport { default as Use } from './elements/Use.js'\n\nextend([Svg, Symbol, Image, Pattern, Marker], getMethodsFor('viewbox'))\n\nextend([Line, Polyline, Polygon, Path], getMethodsFor('marker'))\n\nextend(Text, getMethodsFor('Text'))\nextend(Path, getMethodsFor('Path'))\n\nextend(Defs, getMethodsFor('Defs'))\n\nextend([Text, Tspan], getMethodsFor('Tspan'))\n\nextend([Rect, Ellipse, Gradient, Runner], getMethodsFor('radius'))\n\nextend(EventTarget, getMethodsFor('EventTarget'))\nextend(Dom, getMethodsFor('Dom'))\nextend(Element, getMethodsFor('Element'))\nextend(Shape, getMethodsFor('Shape'))\nextend([Container, Fragment], getMethodsFor('Container'))\nextend(Gradient, getMethodsFor('Gradient'))\n\nextend(Runner, getMethodsFor('Runner'))\n\nList.extend(getMethodNames())\n\nregisterMorphableType([\n SVGNumber,\n Color,\n Box,\n Matrix,\n SVGArray,\n PointArray,\n PathArray,\n Point\n])\n\nmakeMorphable()\n","import * as svgMembers from './main.js'\nimport { makeInstance } from './utils/adopter.js'\n\n// The main wrapping element\nexport default function SVG(element, isHTML) {\n return makeInstance(element, isHTML)\n}\n\nObject.assign(SVG, svgMembers)\n"],"names":["methods","names","registerMethods","name","m","Array","isArray","_name","addMethodNames","Object","getOwnPropertyNames","assign","getMethodsFor","getMethodNames","Set","_names","push","map","array","block","i","il","length","result","filter","radians","d","Math","PI","degrees","r","unCamelCase","s","replace","g","toLowerCase","capitalize","charAt","toUpperCase","slice","proportionalSize","element","width","height","box","bbox","getOrigin","o","origin","ox","originX","oy","originY","x","y","condX","condY","includes","descriptiveElements","isDescriptive","has","nodeName","writeDataToDom","data","defaults","cloned","key","valueOf","keys","node","setAttribute","JSON","stringify","removeAttribute","svg","html","xmlns","xlink","globals","window","document","registerWindow","win","doc","save","saveWindow","restoreWindow","withWindow","fn","getWindow","Base","elements","root","create","ns","createElementNS","makeInstance","isHTML","adopter","querySelector","wrapper","createElement","innerHTML","firstChild","removeChild","nodeOrNew","Node","ownerDocument","defaultView","adopt","instance","Fragment","className","mockAdopt","mock","register","asRoot","prototype","getClass","did","eid","assignNewId","children","id","extend","modules","wrapWithAttrCheck","args","constructor","apply","attr","siblings","parent","position","index","next","prev","forward","p","add","remove","backward","front","back","before","after","insertBefore","insertAfter","numberAndUnit","hex","rgb","reference","transforms","whitespace","isHex","isRgb","isBlank","isNumber","isImage","delimiter","isPathLetter","classes","trim","split","hasClass","indexOf","addClass","join","removeClass","c","toggleClass","css","style","val","ret","arguments","cssText","el","forEach","t","cased","getPropertyValue","setProperty","test","show","hide","visible","a","v","attributes","parse","e","remember","k","memory","forget","_memory","sixDigitHex","substring","componentHex","component","integer","round","bounded","max","min","toString","is","object","space","getParameters","b","params","_a","_b","_c","_d","z","h","l","cieSpace","hueToRgb","q","Color","inputs","init","isColor","color","random","mode","sin","pi","grey","Error","cmyk","hsl","isGrey","delta","values","noWhitespace","exec","parseInt","hexParse","components","lab","xyz","lch","sqrt","atan2","dToR","cos","yL","xL","zL","ct","mx","nm","rU","gU","bU","pow","bd","toArray","toHex","_clamped","toRgb","rV","gV","bV","string","r255","g255","b255","rL","gL","bL","xU","yU","zU","format","Point","clone","base","source","transform","transformO","Matrix","isMatrixLike","f","point","screenCTM","inverseO","closeEnough","threshold","abs","formatTransforms","flipBoth","flip","flipX","flipY","skewX","skew","isFinite","skewY","scaleX","scale","scaleY","shear","theta","rotate","around","px","positionX","NaN","py","positionY","translate","tx","translateX","ty","translateY","relative","rx","relativeX","ry","relativeY","fromArray","matrixMultiply","cx","cy","matrix","aroundO","dx","dy","translateO","lmultiplyO","decompose","determinant","ccw","sx","thetaRad","st","lam","sy","equals","other","comp","axis","flipO","scaleO","Element","matrixify","parseFloat","call","inverse","det","na","nb","nc","nd","ne","nf","lmultiply","multiply","multiplyO","rotateO","shearO","lx","skewO","tan","ly","current","transformer","ctm","getCTM","isRoot","rect","getScreenCTM","console","warn","parser","nodes","size","path","parentNode","body","documentElement","addTo","isNulledBox","domContains","contains","Box","addOffset","pageXOffset","pageYOffset","left","top","w","x2","y2","isNulled","merge","xMin","Infinity","xMax","yMin","yMax","pts","getBox","getBBoxFn","retry","getBBox","rbox","getRBox","getBoundingClientRect","inside","viewbox","zoom","level","clientWidth","clientHeight","zoomX","zoomY","zoomAmount","Number","MAX_SAFE_INTEGER","List","arr","each","fnOrMethodName","concat","reserved","reduce","obj","attrs","baseFind","query","querySelectorAll","find","findOne","listenerId","windowEvents","getEvents","n","getEventHolder","events","getEventTarget","clearEvents","on","listener","binding","options","bind","bag","_svgjsListenerId","event","ev","addEventListener","off","namespace","removeEventListener","dispatch","Event","dispatchEvent","CustomEvent","detail","cancelable","EventTarget","type","j","defaultPrevented","fire","noop","timeline","duration","ease","delay","fill","stroke","opacity","offset","SVGArray","toSet","SVGNumber","convert","unit","value","divide","number","isNaN","match","minus","plus","times","toJSON","colorAttributes","hooks","registerAttrHook","nodeValue","last","curr","getAttribute","_val","hook","leading","setAttributeNS","rebuild","Dom","removeNamespace","SVGElement","appendChild","childNodes","put","clear","hasChildNodes","lastChild","deep","assignNewIds","nodeClone","cloneNode","first","get","htmlOrFn","outerHTML","xml","matches","selector","matcher","matchesSelector","msMatchesSelector","mozMatchesSelector","webkitMatchesSelector","oMatchesSelector","putIn","removeElement","replaceChild","precision","factor","svgOrFn","outerSVG","words","text","textContent","wrap","xmlOrFn","outerXML","_this","well","fragment","createDocumentFragment","len","firstElementChild","dom","hasAttribute","setData","center","defs","dmove","move","parents","until","isSelector","sugar","prefix","extension","mat","angle","direction","radius","_element","getTotalLength","pointAt","getPointAtLength","font","untransform","str","kv","reverse","toParent","pCtm","toRoot","decomposed","cleanRelative","Container","flatten","ungroup","Defs","Shape","Ellipse","circled","ellipse","from","fx","fy","x1","y1","to","Gradient","targets","url","update","gradiented","gradient","Pattern","pattern","patternUnits","Image","load","callback","img","src","image","PointArray","maxX","maxY","minX","minY","points","pop","toLine","MorphArray","Line","plot","pointed","line","Marker","orient","ref","marker","makeSetterGetter","easing","pos","bezier","steps","stepPosition","jumps","beforeFlag","step","floor","jumping","Stepper","done","Ease","Controller","stepper","target","dt","recalculate","_duration","overshoot","_overshoot","eps","os","log","zeta","wn","Spring","velocity","acceleration","newPosition","PID","windup","integral","error","_windup","P","I","D","segmentParameters","M","L","H","V","C","S","Q","T","A","Z","pathHandlers","p0","mlhvqtcsaz","jl","makeAbsolut","command","segment","segmentComplete","startNewSegment","token","inNumber","finalizeNumber","pathLetter","lastCommand","small","isSmall","inSegment","pointSeen","hasExponent","finalizeSegment","absolute","segments","isArcFlag","isArc","isExponential","lastToken","pathDelimiters","pathParser","toAbsolute","arrayToString","PathArray","getClassForType","NonMorphable","morphableTypes","ObjectBag","Morphable","_stepper","_from","_to","_type","_context","_morphObj","at","morph","complete","_set","align","toConsumable","TransformBag","sortByKey","splice","defaultObject","toDelete","objOrArr","entries","Type","sort","shift","num","registerMorphableType","makeMorphable","context","mapper","Path","_array","Polygon","polygon","poly","Polyline","polyline","Rect","Queue","_first","_last","item","Animator","nextDraw","frames","timeouts","immediates","timer","performance","Date","frame","run","requestAnimationFrame","_draw","timeout","time","now","immediate","cancelFrame","clearTimeout","cancelImmediate","nextTimeout","lastTimeout","nextFrame","lastFrame","nextImmediate","makeSchedule","runnerInfo","start","runner","end","defaultSource","Timeline","timeSource","_timeSource","terminate","active","_nextFrame","finish","getEndTimeOfTimeline","pause","getEndTime","lastRunnerInfo","getLastRunnerInfo","lastDuration","lastStartTime","_time","endTimes","_runners","getRunnerInfoById","_lastRunnerId","_runnerIds","_paused","_continue","persist","dtOrForever","_persist","play","updateTime","yes","currentSpeed","speed","positive","schedule","when","absoluteStartTime","endTime","unschedule","info","seek","_speed","stop","_lastSourceTime","immediateStep","_stepImmediate","_step","_stepFn","dtSource","dtTime","_lastStepTime","dtToStart","reset","runnersLeft","finished","_startTime","_timeline","Runner","_queue","_isDeclarative","_history","enabled","_lastTime","_reseted","transformId","_haveReversed","_reverse","_loopsDone","_swing","_wait","_times","_frameId","sanitise","swing","wait","addTransform","animate","loop","clearTransform","clearTransformsFromQueue","isTransform","during","queue","_prepareRunner","loops","loopDuration","loopsDone","relativeTime","whole","partial","swinging","backwards","uncliped","clipped","swingForward","forwards","progress","initFn","runFn","retargetFn","initialiser","retarget","initialised","running","_lastPosition","justStarted","justFinished","declarative","converged","_initialise","_run","needsIt","_rememberMorpher","method","morpher","caller","positionOrDt","allfinished","_tryRetarget","extra","FakeRunner","mergeWith","getRunnerTransform","mergeTransforms","runners","_transformationRunners","netTransform","RunnerArray","ids","clearBefore","deleteCnt","edit","newRunner","getByID","lastRunner","condition","by","_clearTransformRunnersBefore","currentRunner","_currentTransform","_addRunner","difference","styleAttr","nameOrAttrs","newToAttrs","newKeys","differences","addedFromAttrs","oldFromAttrs","oldToAttrs","newLevel","newPoint","affine","isMatrix","currentAngle","startTransform","setup","undefined","rTarget","rCurrent","possibilities","distances","shortest","affineParameters","newTransforms","_queueNumber","ax","ay","_queueNumberDelta","newTo","_queueObject","amove","Svg","version","nested","Symbol","symbol","plain","_build","createTextNode","getComputedTextLength","build","Text","_rebuild","self","blankLineOffset","fontSize","getComputedStyle","newLined","firstLine","nodeType","newLine","textable","Tspan","tspan","Circle","circle","ClipPath","unclip","clip","clipper","clipWith","ForeignObject","foreignObject","child","SVGSVGElement","G","containerGeometry","group","link","unlink","linker","linkTo","Mask","unmask","mask","masker","maskWith","Stop","cssRule","rule","Style","addText","fontFamily","fontface","TextPath","track","pathArray","textPath","importNodes","Use","use","file","SVG","svgMembers"],"mappings":";;;;;;;;;;;;;EAAA,MAAMA,SAAO,GAAG,EAAE,CAAA;EAClB,MAAMC,KAAK,GAAG,EAAE,CAAA;EAET,SAASC,eAAeA,CAACC,IAAI,EAAEC,CAAC,EAAE;EACvC,EAAA,IAAIC,KAAK,CAACC,OAAO,CAACH,IAAI,CAAC,EAAE;EACvB,IAAA,KAAK,MAAMI,KAAK,IAAIJ,IAAI,EAAE;EACxBD,MAAAA,eAAe,CAACK,KAAK,EAAEH,CAAC,CAAC,CAAA;EAC3B,KAAA;EACA,IAAA,OAAA;EACF,GAAA;EAEA,EAAA,IAAI,OAAOD,IAAI,KAAK,QAAQ,EAAE;EAC5B,IAAA,KAAK,MAAMI,KAAK,IAAIJ,IAAI,EAAE;EACxBD,MAAAA,eAAe,CAACK,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B,CAAC,CACpB/P,SAAS,EACTpQ,KAAK,EACLwK,GAAG,EACHzG,MAAM,EACNmM,QAAQ,EACRmI,UAAU,EACViG,SAAS,EACT7a,KAAK,CACN,CAAC,CAAA;EAEF2c,aAAa,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ECtKf;EACe,SAASmR,GAAGA,CAAC78B,OAAO,EAAEwD,MAAM,EAAE;EAC3C,EAAA,OAAOD,YAAY,CAACvD,OAAO,EAAEwD,MAAM,CAAC,CAAA;EACtC,CAAA;EAEAxF,MAAM,CAACE,MAAM,CAAC2+B,GAAG,EAAEC,UAAU,CAAC;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/@svgdotjs/svg.js/dist/svg.min.js b/node_modules/@svgdotjs/svg.js/dist/svg.min.js new file mode 100644 index 0000000..e0097ed --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/dist/svg.min.js @@ -0,0 +1,13 @@ +/*! @svgdotjs/svg.js v3.2.4 MIT*/; +/*! +* @svgdotjs/svg.js - A lightweight library for manipulating and animating SVG. +* @version 3.2.4 +* https://svgjs.dev/ +* +* @copyright Wout Fierens +* @license MIT +* +* BUILT: Thu Jun 27 2024 12:00:16 GMT+0200 (Central European Summer Time) +*/ +var SVG=function(){"use strict";const t={},e=[];function n(e,i){if(Array.isArray(e))for(const t of e)n(t,i);else if("object"!=typeof e)r(Object.getOwnPropertyNames(i)),t[e]=Object.assign(t[e]||{},i);else for(const t in e)n(t,e[t])}function i(e){return t[e]||{}}function r(t){e.push(...t)}function s(t,e){let n;const i=t.length,r=[];for(n=0;nf.has(t.nodeName),m=(t,e,n={})=>{const i={...e};for(const t in i)i[t].valueOf()===n[t]&&delete i[t];Object.keys(i).length?t.node.setAttribute("data-svgjs",JSON.stringify(i)):(t.node.removeAttribute("data-svgjs"),t.node.removeAttribute("svgjs:data"))};var p={__proto__:null,capitalize:a,degrees:function(t){return 180*t/Math.PI%360},filter:o,getOrigin:c,isDescriptive:d,map:s,proportionalSize:l,radians:h,unCamelCase:u,writeDataToDom:m};const y="http://www.w3.org/2000/svg",w="http://www.w3.org/1999/xhtml",g="http://www.w3.org/2000/xmlns/",_="http://www.w3.org/1999/xlink";var x={__proto__:null,html:w,svg:y,xlink:_,xmlns:g};const b={window:"undefined"==typeof window?null:window,document:"undefined"==typeof document?null:document};function v(t=null,e=null){b.window=t,b.document=e}const M={};function O(){M.window=b.window,M.document=b.document}function k(){b.window=M.window,b.document=M.document}function T(){return b.window}class C{}const N={},S="___SYMBOL___ROOT___";function E(t,e=y){return b.document.createElementNS(e,t)}function j(t,e=!1){if(t instanceof C)return t;if("object"==typeof t)return z(t);if(null==t)return new N[S];if("string"==typeof t&&"<"!==t.charAt(0))return z(b.document.querySelector(t));const n=e?b.document.createElement("div"):E("svg");return n.innerHTML=t,t=z(n.firstChild),n.removeChild(n.firstChild),t}function D(t,e){return e&&(e instanceof b.window.Node||e.ownerDocument&&e instanceof e.ownerDocument.defaultView.Node)?e:E(t)}function I(t){if(!t)return null;if(t.instance instanceof C)return t.instance;if("#document-fragment"===t.nodeName)return new N.Fragment(t);let e=a(t.nodeName||"Dom");return"LinearGradient"===e||"RadialGradient"===e?e="Gradient":N[e]||(e="Dom"),new N[e](t)}let z=I;function P(t,e=t.name,n=!1){return N[e]=t,n&&(N[S]=t),r(Object.getOwnPropertyNames(t.prototype)),t}function R(t){return N[t]}let L=1e3;function q(t){return"Svgjs"+a(t)+L++}function F(t){for(let e=t.children.length-1;e>=0;e--)F(t.children[e]);return t.id?(t.id=q(t.nodeName),t):t}function X(t,e){let n,i;for(i=(t=Array.isArray(t)?t:[t]).length-1;i>=0;i--)for(n in e)t[i].prototype[n]=e[n]}function Y(t){return function(...e){const n=e[e.length-1];return!n||n.constructor!==Object||n instanceof Array?t.apply(this,e):t.apply(this,e.slice(0,-1)).attr(n)}}n("Dom",{siblings:function(){return this.parent().children()},position:function(){return this.parent().index(this)},next:function(){return this.siblings()[this.position()+1]},prev:function(){return this.siblings()[this.position()-1]},forward:function(){const t=this.position();return this.parent().add(this.remove(),t+1),this},backward:function(){const t=this.position();return this.parent().add(this.remove(),t?t-1:0),this},front:function(){return this.parent().add(this.remove()),this},back:function(){return this.parent().add(this.remove(),0),this},before:function(t){(t=j(t)).remove();const e=this.position();return this.parent().add(t,e),this},after:function(t){(t=j(t)).remove();const e=this.position();return this.parent().add(t,e+1),this},insertBefore:function(t){return(t=j(t)).before(this),this},insertAfter:function(t){return(t=j(t)).after(this),this}});const B=/^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i,H=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,V=/rgb\((\d+),(\d+),(\d+)\)/,$=/(#[a-z_][a-z0-9\-_]*)/i,U=/\)\s*,?\s*/,W=/\s/g,Q=/^#[a-f0-9]{3}$|^#[a-f0-9]{6}$/i,J=/^rgb\(/,Z=/^(\s+)?$/,K=/^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,tt=/\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i,et=/[\s,]+/,nt=/[MLHVCSQTAZ]/i;var it={__proto__:null,delimiter:et,hex:H,isBlank:Z,isHex:Q,isImage:tt,isNumber:K,isPathLetter:nt,isRgb:J,numberAndUnit:B,reference:$,rgb:V,transforms:U,whitespace:W};function rt(t){const e=Math.round(t),n=Math.max(0,Math.min(255,e)).toString(16);return 1===n.length?"0"+n:n}function st(t,e){for(let n=e.length;n--;)if(null==t[e[n]])return!1;return!0}function ot(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}n("Dom",{classes:function(){const t=this.attr("class");return null==t?[]:t.trim().split(et)},hasClass:function(t){return-1!==this.classes().indexOf(t)},addClass:function(t){if(!this.hasClass(t)){const e=this.classes();e.push(t),this.attr("class",e.join(" "))}return this},removeClass:function(t){return this.hasClass(t)&&this.attr("class",this.classes().filter((function(e){return e!==t})).join(" ")),this},toggleClass:function(t){return this.hasClass(t)?this.removeClass(t):this.addClass(t)}}),n("Dom",{css:function(t,e){const n={};if(0===arguments.length)return this.node.style.cssText.split(/\s*;\s*/).filter((function(t){return!!t.length})).forEach((function(t){const e=t.split(/\s*:\s*/);n[e[0]]=e[1]})),n;if(arguments.length<2){if(Array.isArray(t)){for(const e of t){const t=e;n[e]=this.node.style.getPropertyValue(t)}return n}if("string"==typeof t)return this.node.style.getPropertyValue(t);if("object"==typeof t)for(const e in t)this.node.style.setProperty(e,null==t[e]||Z.test(t[e])?"":t[e])}return 2===arguments.length&&this.node.style.setProperty(t,null==e||Z.test(e)?"":e),this},show:function(){return this.css("display","")},hide:function(){return this.css("display","none")},visible:function(){return"none"!==this.css("display")}}),n("Dom",{data:function(t,e,n){if(null==t)return this.data(s(o(this.node.attributes,(t=>0===t.nodeName.indexOf("data-"))),(t=>t.nodeName.slice(5))));if(t instanceof Array){const e={};for(const n of t)e[n]=this.data(n);return e}if("object"==typeof t)for(e in t)this.data(e,t[e]);else if(arguments.length<2)try{return JSON.parse(this.attr("data-"+t))}catch(e){return this.attr("data-"+t)}else this.attr("data-"+t,null===e?null:!0===n||"string"==typeof e||"number"==typeof e?e:JSON.stringify(e));return this}}),n("Dom",{remember:function(t,e){if("object"==typeof arguments[0])for(const e in t)this.remember(e,t[e]);else{if(1===arguments.length)return this.memory()[t];this.memory()[t]=e}return this},forget:function(){if(0===arguments.length)this._memory={};else for(let t=arguments.length-1;t>=0;t--)delete this.memory()[arguments[t]];return this},memory:function(){return this._memory=this._memory||{}}});class ht{constructor(...t){this.init(...t)}static isColor(t){return t&&(t instanceof ht||this.isRgb(t)||this.test(t))}static isRgb(t){return t&&"number"==typeof t.r&&"number"==typeof t.g&&"number"==typeof t.b}static random(t="vibrant",e){const{random:n,round:i,sin:r,PI:s}=Math;if("vibrant"===t){const t=24*n()+57,e=38*n()+45,i=360*n();return new ht(t,e,i,"lch")}if("sine"===t){const t=i(80*r(2*s*(e=null==e?n():e)/.5+.01)+150),o=i(50*r(2*s*e/.5+4.6)+200),h=i(100*r(2*s*e/.5+2.3)+150);return new ht(t,o,h)}if("pastel"===t){const t=8*n()+86,e=17*n()+9,i=360*n();return new ht(t,e,i,"lch")}if("dark"===t){const t=10+10*n(),e=50*n()+86,i=360*n();return new ht(t,e,i,"lch")}if("rgb"===t){const t=255*n(),e=255*n(),i=255*n();return new ht(t,e,i)}if("lab"===t){const t=100*n(),e=256*n()-128,i=256*n()-128;return new ht(t,e,i,"lab")}if("grey"===t){const t=255*n();return new ht(t,t,t)}throw new Error("Unsupported random color mode")}static test(t){return"string"==typeof t&&(Q.test(t)||J.test(t))}cmyk(){const{_a:t,_b:e,_c:n}=this.rgb(),[i,r,s]=[t,e,n].map((t=>t/255)),o=Math.min(1-i,1-r,1-s);if(1===o)return new ht(0,0,0,1,"cmyk");return new ht((1-i-o)/(1-o),(1-r-o)/(1-o),(1-s-o)/(1-o),o,"cmyk")}hsl(){const{_a:t,_b:e,_c:n}=this.rgb(),[i,r,s]=[t,e,n].map((t=>t/255)),o=Math.max(i,r,s),h=Math.min(i,r,s),u=(o+h)/2,a=o===h,l=o-h;return new ht(360*(a?0:o===i?((r-s)/l+(r.5?l/(2-o-h):l/(o+h)),100*u,"hsl")}init(t=0,e=0,n=0,i=0,r="rgb"){if(t=t||0,this.space)for(const t in this.space)delete this[this.space[t]];if("number"==typeof t)r="string"==typeof i?i:r,i="string"==typeof i?0:i,Object.assign(this,{_a:t,_b:e,_c:n,_d:i,space:r});else if(t instanceof Array)this.space=e||("string"==typeof t[3]?t[3]:t[4])||"rgb",Object.assign(this,{_a:t[0],_b:t[1],_c:t[2],_d:t[3]||0});else if(t instanceof Object){const n=function(t,e){const n=st(t,"rgb")?{_a:t.r,_b:t.g,_c:t.b,_d:0,space:"rgb"}:st(t,"xyz")?{_a:t.x,_b:t.y,_c:t.z,_d:0,space:"xyz"}:st(t,"hsl")?{_a:t.h,_b:t.s,_c:t.l,_d:0,space:"hsl"}:st(t,"lab")?{_a:t.l,_b:t.a,_c:t.b,_d:0,space:"lab"}:st(t,"lch")?{_a:t.l,_b:t.c,_c:t.h,_d:0,space:"lch"}:st(t,"cmyk")?{_a:t.c,_b:t.m,_c:t.y,_d:t.k,space:"cmyk"}:{_a:0,_b:0,_c:0,space:"rgb"};return n.space=e||n.space,n}(t,e);Object.assign(this,n)}else if("string"==typeof t)if(J.test(t)){const e=t.replace(W,""),[n,i,r]=V.exec(e).slice(1,4).map((t=>parseInt(t)));Object.assign(this,{_a:n,_b:i,_c:r,_d:0,space:"rgb"})}else{if(!Q.test(t))throw Error("Unsupported string format, can't construct Color");{const e=t=>parseInt(t,16),[,n,i,r]=H.exec(function(t){return 4===t.length?["#",t.substring(1,2),t.substring(1,2),t.substring(2,3),t.substring(2,3),t.substring(3,4),t.substring(3,4)].join(""):t}(t)).map(e);Object.assign(this,{_a:n,_b:i,_c:r,_d:0,space:"rgb"})}}const{_a:s,_b:o,_c:h,_d:u}=this,a="rgb"===this.space?{r:s,g:o,b:h}:"xyz"===this.space?{x:s,y:o,z:h}:"hsl"===this.space?{h:s,s:o,l:h}:"lab"===this.space?{l:s,a:o,b:h}:"lch"===this.space?{l:s,c:o,h:h}:"cmyk"===this.space?{c:s,m:o,y:h,k:u}:{};Object.assign(this,a)}lab(){const{x:t,y:e,z:n}=this.xyz();return new ht(116*e-16,500*(t-e),200*(e-n),"lab")}lch(){const{l:t,a:e,b:n}=this.lab(),i=Math.sqrt(e**2+n**2);let r=180*Math.atan2(n,e)/Math.PI;r<0&&(r*=-1,r=360-r);return new ht(t,i,r,"lch")}rgb(){if("rgb"===this.space)return this;if("lab"===(t=this.space)||"xyz"===t||"lch"===t){let{x:t,y:e,z:n}=this;if("lab"===this.space||"lch"===this.space){let{l:i,a:r,b:s}=this;if("lch"===this.space){const{c:t,h:e}=this,n=Math.PI/180;r=t*Math.cos(n*e),s=t*Math.sin(n*e)}const o=(i+16)/116,h=r/500+o,u=o-s/200,a=16/116,l=.008856,c=7.787;t=.95047*(h**3>l?h**3:(h-a)/c),e=1*(o**3>l?o**3:(o-a)/c),n=1.08883*(u**3>l?u**3:(u-a)/c)}const i=3.2406*t+-1.5372*e+-.4986*n,r=-.9689*t+1.8758*e+.0415*n,s=.0557*t+-.204*e+1.057*n,o=Math.pow,h=.0031308,u=i>h?1.055*o(i,1/2.4)-.055:12.92*i,a=r>h?1.055*o(r,1/2.4)-.055:12.92*r,l=s>h?1.055*o(s,1/2.4)-.055:12.92*s;return new ht(255*u,255*a,255*l)}if("hsl"===this.space){let{h:t,s:e,l:n}=this;if(t/=360,e/=100,n/=100,0===e){n*=255;return new ht(n,n,n)}const i=n<.5?n*(1+e):n+e-n*e,r=2*n-i,s=255*ot(r,i,t+1/3),o=255*ot(r,i,t),h=255*ot(r,i,t-1/3);return new ht(s,o,h)}if("cmyk"===this.space){const{c:t,m:e,y:n,k:i}=this,r=255*(1-Math.min(1,t*(1-i)+i)),s=255*(1-Math.min(1,e*(1-i)+i)),o=255*(1-Math.min(1,n*(1-i)+i));return new ht(r,s,o)}return this;var t}toArray(){const{_a:t,_b:e,_c:n,_d:i,space:r}=this;return[t,e,n,i,r]}toHex(){const[t,e,n]=this._clamped().map(rt);return`#${t}${e}${n}`}toRgb(){const[t,e,n]=this._clamped();return`rgb(${t},${e},${n})`}toString(){return this.toHex()}xyz(){const{_a:t,_b:e,_c:n}=this.rgb(),[i,r,s]=[t,e,n].map((t=>t/255)),o=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92,h=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92,u=s>.04045?Math.pow((s+.055)/1.055,2.4):s/12.92,a=(.4124*o+.3576*h+.1805*u)/.95047,l=(.2126*o+.7152*h+.0722*u)/1,c=(.0193*o+.1192*h+.9505*u)/1.08883,f=a>.008856?Math.pow(a,1/3):7.787*a+16/116,d=l>.008856?Math.pow(l,1/3):7.787*l+16/116,m=c>.008856?Math.pow(c,1/3):7.787*c+16/116;return new ht(f,d,m,"xyz")}_clamped(){const{_a:t,_b:e,_c:n}=this.rgb(),{max:i,min:r,round:s}=Math;return[t,e,n].map((t=>i(0,r(s(t),255))))}}class ut{constructor(...t){this.init(...t)}clone(){return new ut(this)}init(t,e){const n=0,i=0,r=Array.isArray(t)?{x:t[0],y:t[1]}:"object"==typeof t?{x:t.x,y:t.y}:{x:t,y:e};return this.x=null==r.x?n:r.x,this.y=null==r.y?i:r.y,this}toArray(){return[this.x,this.y]}transform(t){return this.clone().transformO(t)}transformO(t){lt.isMatrixLike(t)||(t=new lt(t));const{x:e,y:n}=this;return this.x=t.a*e+t.c*n+t.e,this.y=t.b*e+t.d*n+t.f,this}}function at(t,e,n){return Math.abs(e-t)<1e-6}class lt{constructor(...t){this.init(...t)}static formatTransforms(t){const e="both"===t.flip||!0===t.flip,n=t.flip&&(e||"x"===t.flip)?-1:1,i=t.flip&&(e||"y"===t.flip)?-1:1,r=t.skew&&t.skew.length?t.skew[0]:isFinite(t.skew)?t.skew:isFinite(t.skewX)?t.skewX:0,s=t.skew&&t.skew.length?t.skew[1]:isFinite(t.skew)?t.skew:isFinite(t.skewY)?t.skewY:0,o=t.scale&&t.scale.length?t.scale[0]*n:isFinite(t.scale)?t.scale*n:isFinite(t.scaleX)?t.scaleX*n:n,h=t.scale&&t.scale.length?t.scale[1]*i:isFinite(t.scale)?t.scale*i:isFinite(t.scaleY)?t.scaleY*i:i,u=t.shear||0,a=t.rotate||t.theta||0,l=new ut(t.origin||t.around||t.ox||t.originX,t.oy||t.originY),c=l.x,f=l.y,d=new ut(t.position||t.px||t.positionX||NaN,t.py||t.positionY||NaN),m=d.x,p=d.y,y=new ut(t.translate||t.tx||t.translateX,t.ty||t.translateY),w=y.x,g=y.y,_=new ut(t.relative||t.rx||t.relativeX,t.ry||t.relativeY);return{scaleX:o,scaleY:h,skewX:r,skewY:s,shear:u,theta:a,rx:_.x,ry:_.y,tx:w,ty:g,ox:c,oy:f,px:m,py:p}}static fromArray(t){return{a:t[0],b:t[1],c:t[2],d:t[3],e:t[4],f:t[5]}}static isMatrixLike(t){return null!=t.a||null!=t.b||null!=t.c||null!=t.d||null!=t.e||null!=t.f}static matrixMultiply(t,e,n){const i=t.a*e.a+t.c*e.b,r=t.b*e.a+t.d*e.b,s=t.a*e.c+t.c*e.d,o=t.b*e.c+t.d*e.d,h=t.e+t.a*e.e+t.c*e.f,u=t.f+t.b*e.e+t.d*e.f;return n.a=i,n.b=r,n.c=s,n.d=o,n.e=h,n.f=u,n}around(t,e,n){return this.clone().aroundO(t,e,n)}aroundO(t,e,n){const i=t||0,r=e||0;return this.translateO(-i,-r).lmultiplyO(n).translateO(i,r)}clone(){return new lt(this)}decompose(t=0,e=0){const n=this.a,i=this.b,r=this.c,s=this.d,o=this.e,h=this.f,u=n*s-i*r,a=u>0?1:-1,l=a*Math.sqrt(n*n+i*i),c=Math.atan2(a*i,a*n),f=180/Math.PI*c,d=Math.cos(c),m=Math.sin(c),p=(n*r+i*s)/u,y=r*l/(p*n-i)||s*l/(p*i+n);return{scaleX:l,scaleY:y,shear:p,rotate:f,translateX:o-t+t*d*l+e*(p*d*l-m*y),translateY:h-e+t*m*l+e*(p*m*l+d*y),originX:t,originY:e,a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}equals(t){if(t===this)return!0;const e=new lt(t);return at(this.a,e.a)&&at(this.b,e.b)&&at(this.c,e.c)&&at(this.d,e.d)&&at(this.e,e.e)&&at(this.f,e.f)}flip(t,e){return this.clone().flipO(t,e)}flipO(t,e){return"x"===t?this.scaleO(-1,1,e,0):"y"===t?this.scaleO(1,-1,0,e):this.scaleO(-1,-1,t,e||t)}init(t){const e=lt.fromArray([1,0,0,1,0,0]);return t=t instanceof Element?t.matrixify():"string"==typeof t?lt.fromArray(t.split(et).map(parseFloat)):Array.isArray(t)?lt.fromArray(t):"object"==typeof t&<.isMatrixLike(t)?t:"object"==typeof t?(new lt).transform(t):6===arguments.length?lt.fromArray([].slice.call(arguments)):e,this.a=null!=t.a?t.a:e.a,this.b=null!=t.b?t.b:e.b,this.c=null!=t.c?t.c:e.c,this.d=null!=t.d?t.d:e.d,this.e=null!=t.e?t.e:e.e,this.f=null!=t.f?t.f:e.f,this}inverse(){return this.clone().inverseO()}inverseO(){const t=this.a,e=this.b,n=this.c,i=this.d,r=this.e,s=this.f,o=t*i-e*n;if(!o)throw new Error("Cannot invert "+this);const h=i/o,u=-e/o,a=-n/o,l=t/o,c=-(h*r+a*s),f=-(u*r+l*s);return this.a=h,this.b=u,this.c=a,this.d=l,this.e=c,this.f=f,this}lmultiply(t){return this.clone().lmultiplyO(t)}lmultiplyO(t){const e=t instanceof lt?t:new lt(t);return lt.matrixMultiply(e,this,this)}multiply(t){return this.clone().multiplyO(t)}multiplyO(t){const e=t instanceof lt?t:new lt(t);return lt.matrixMultiply(this,e,this)}rotate(t,e,n){return this.clone().rotateO(t,e,n)}rotateO(t,e=0,n=0){t=h(t);const i=Math.cos(t),r=Math.sin(t),{a:s,b:o,c:u,d:a,e:l,f:c}=this;return this.a=s*i-o*r,this.b=o*i+s*r,this.c=u*i-a*r,this.d=a*i+u*r,this.e=l*i-c*r+n*r-e*i+e,this.f=c*i+l*r-e*r-n*i+n,this}scale(){return this.clone().scaleO(...arguments)}scaleO(t,e=t,n=0,i=0){3===arguments.length&&(i=n,n=e,e=t);const{a:r,b:s,c:o,d:h,e:u,f:a}=this;return this.a=r*t,this.b=s*e,this.c=o*t,this.d=h*e,this.e=u*t-n*t+n,this.f=a*e-i*e+i,this}shear(t,e,n){return this.clone().shearO(t,e,n)}shearO(t,e=0,n=0){const{a:i,b:r,c:s,d:o,e:h,f:u}=this;return this.a=i+r*t,this.c=s+o*t,this.e=h+u*t-n*t,this}skew(){return this.clone().skewO(...arguments)}skewO(t,e=t,n=0,i=0){3===arguments.length&&(i=n,n=e,e=t),t=h(t),e=h(e);const r=Math.tan(t),s=Math.tan(e),{a:o,b:u,c:a,d:l,e:c,f:f}=this;return this.a=o+u*r,this.b=u+o*s,this.c=a+l*r,this.d=l+a*s,this.e=c+f*r-i*r,this.f=f+c*s-n*s,this}skewX(t,e,n){return this.skew(t,0,e,n)}skewY(t,e,n){return this.skew(0,t,e,n)}toArray(){return[this.a,this.b,this.c,this.d,this.e,this.f]}toString(){return"matrix("+this.a+","+this.b+","+this.c+","+this.d+","+this.e+","+this.f+")"}transform(t){if(lt.isMatrixLike(t)){return new lt(t).multiplyO(this)}const e=lt.formatTransforms(t),{x:n,y:i}=new ut(e.ox,e.oy).transform(this),r=(new lt).translateO(e.rx,e.ry).lmultiplyO(this).translateO(-n,-i).scaleO(e.scaleX,e.scaleY).skewO(e.skewX,e.skewY).shearO(e.shear).rotateO(e.theta).translateO(n,i);if(isFinite(e.px)||isFinite(e.py)){const t=new ut(n,i).transform(r),s=isFinite(e.px)?e.px-t.x:0,o=isFinite(e.py)?e.py-t.y:0;r.translateO(s,o)}return r.translateO(e.tx,e.ty),r}translate(t,e){return this.clone().translateO(t,e)}translateO(t,e){return this.e+=t||0,this.f+=e||0,this}valueOf(){return{a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}}function ct(){if(!ct.nodes){const t=j().size(2,0);t.node.style.cssText=["opacity: 0","position: absolute","left: -100%","top: -100%","overflow: hidden"].join(";"),t.attr("focusable","false"),t.attr("aria-hidden","true");const e=t.path().node;ct.nodes={svg:t,path:e}}if(!ct.nodes.svg.node.parentNode){const t=b.document.body||b.document.documentElement;ct.nodes.svg.addTo(t)}return ct.nodes}function ft(t){return!(t.width||t.height||t.x||t.y)}P(lt,"Matrix");class dt{constructor(...t){this.init(...t)}addOffset(){return this.x+=b.window.pageXOffset,this.y+=b.window.pageYOffset,new dt(this)}init(t){return t="string"==typeof t?t.split(et).map(parseFloat):Array.isArray(t)?t:"object"==typeof t?[null!=t.left?t.left:t.x,null!=t.top?t.top:t.y,t.width,t.height]:4===arguments.length?[].slice.call(arguments):[0,0,0,0],this.x=t[0]||0,this.y=t[1]||0,this.width=this.w=t[2]||0,this.height=this.h=t[3]||0,this.x2=this.x+this.w,this.y2=this.y+this.h,this.cx=this.x+this.w/2,this.cy=this.y+this.h/2,this}isNulled(){return ft(this)}merge(t){const e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),i=Math.max(this.x+this.width,t.x+t.width)-e,r=Math.max(this.y+this.height,t.y+t.height)-n;return new dt(e,n,i,r)}toArray(){return[this.x,this.y,this.width,this.height]}toString(){return this.x+" "+this.y+" "+this.width+" "+this.height}transform(t){t instanceof lt||(t=new lt(t));let e=1/0,n=-1/0,i=1/0,r=-1/0;return[new ut(this.x,this.y),new ut(this.x2,this.y),new ut(this.x,this.y2),new ut(this.x2,this.y2)].forEach((function(s){s=s.transform(t),e=Math.min(e,s.x),n=Math.max(n,s.x),i=Math.min(i,s.y),r=Math.max(r,s.y)})),new dt(e,i,n-e,r-i)}}function mt(t,e,n){let i;try{if(i=e(t.node),ft(i)&&((r=t.node)!==b.document&&!(b.document.documentElement.contains||function(t){for(;t.parentNode;)t=t.parentNode;return t===b.document}).call(b.document.documentElement,r)))throw new Error("Element not in the dom")}catch(e){i=n(t)}var r;return i}n({viewbox:{viewbox(t,e,n,i){return null==t?new dt(this.attr("viewBox")):this.attr("viewBox",new dt(t,e,n,i))},zoom(t,e){let{width:n,height:i}=this.attr(["width","height"]);if((n||i)&&"string"!=typeof n&&"string"!=typeof i||(n=this.node.clientWidth,i=this.node.clientHeight),!n||!i)throw new Error("Impossible to get absolute width and height. Please provide an absolute width and height attribute on the zooming element");const r=this.viewbox(),s=n/r.width,o=i/r.height,h=Math.min(s,o);if(null==t)return h;let u=h/t;u===1/0&&(u=Number.MAX_SAFE_INTEGER/100),e=e||new ut(n/2/s+r.x,i/2/o+r.y);const a=new dt(r).transform(new lt({scale:u,origin:e}));return this.viewbox(a)}}}),P(dt,"Box");class pt extends Array{constructor(t=[],...e){if(super(t,...e),"number"==typeof t)return this;this.length=0,this.push(...t)}}X([pt],{each(t,...e){return"function"==typeof t?this.map(((e,n,i)=>t.call(e,e,n,i))):this.map((n=>n[t](...e)))},toArray(){return Array.prototype.concat.apply([],this)}});const yt=["toArray","constructor","each"];function wt(t,e){return new pt(s((e||b.document).querySelectorAll(t),(function(t){return I(t)})))}pt.extend=function(t){t=t.reduce(((t,e)=>(yt.includes(e)||"_"===e[0]||(e in Array.prototype&&(t["$"+e]=Array.prototype[e]),t[e]=function(...t){return this.each(e,...t)}),t)),{}),X([pt],t)};let gt=0;const _t={};function xt(t){let e=t.getEventHolder();return e===b.window&&(e=_t),e.events||(e.events={}),e.events}function bt(t){return t.getEventTarget()}function vt(t){let e=t.getEventHolder();e===b.window&&(e=_t),e.events&&(e.events={})}function Mt(t,e,n,i,r){const s=n.bind(i||t),o=j(t),h=xt(o),u=bt(o);e=Array.isArray(e)?e:e.split(et),n._svgjsListenerId||(n._svgjsListenerId=++gt),e.forEach((function(t){const e=t.split(".")[0],i=t.split(".")[1]||"*";h[e]=h[e]||{},h[e][i]=h[e][i]||{},h[e][i][n._svgjsListenerId]=s,u.addEventListener(e,s,r||!1)}))}function At(t,e,n,i){const r=j(t),s=xt(r),o=bt(r);("function"!=typeof n||(n=n._svgjsListenerId))&&(e=Array.isArray(e)?e:(e||"").split(et)).forEach((function(t){const e=t&&t.split(".")[0],h=t&&t.split(".")[1];let u,a;if(n)s[e]&&s[e][h||"*"]&&(o.removeEventListener(e,s[e][h||"*"][n],i||!1),delete s[e][h||"*"][n]);else if(e&&h){if(s[e]&&s[e][h]){for(a in s[e][h])At(o,[e,h].join("."),a);delete s[e][h]}}else if(h)for(t in s)for(u in s[t])h===u&&At(o,[t,h].join("."));else if(e){if(s[e]){for(u in s[e])At(o,[e,u].join("."));delete s[e]}}else{for(t in s)At(o,t);vt(r)}}))}function Ot(t,e,n,i){const r=bt(t);return e instanceof b.window.Event||(e=new b.window.CustomEvent(e,{detail:n,cancelable:!0,...i})),r.dispatchEvent(e),e}class kt extends C{addEventListener(){}dispatch(t,e,n){return Ot(this,t,e,n)}dispatchEvent(t){const e=this.getEventHolder().events;if(!e)return!0;const n=e[t.type];for(const e in n)for(const i in n[e])n[e][i](t);return!t.defaultPrevented}fire(t,e,n){return this.dispatch(t,e,n),this}getEventHolder(){return this}getEventTarget(){return this}off(t,e,n){return At(this,t,e,n),this}on(t,e,n,i){return Mt(this,t,e,n,i),this}removeEventListener(){}}function Tt(){}P(kt,"EventTarget");const Ct={duration:400,ease:">",delay:0},Nt={"fill-opacity":1,"stroke-opacity":1,"stroke-width":0,"stroke-linejoin":"miter","stroke-linecap":"butt",fill:"#000000",stroke:"#000000",opacity:1,x:0,y:0,cx:0,cy:0,width:0,height:0,r:0,rx:0,ry:0,offset:0,"stop-opacity":1,"stop-color":"#000000","text-anchor":"start"};var St={__proto__:null,attrs:Nt,noop:Tt,timeline:Ct};class Et extends Array{constructor(...t){super(...t),this.init(...t)}clone(){return new this.constructor(this)}init(t){return"number"==typeof t||(this.length=0,this.push(...this.parse(t))),this}parse(t=[]){return t instanceof Array?t:t.trim().split(et).map(parseFloat)}toArray(){return Array.prototype.concat.apply([],this)}toSet(){return new Set(this)}toString(){return this.join(" ")}valueOf(){const t=[];return t.push(...this),t}}class jt{constructor(...t){this.init(...t)}convert(t){return new jt(this.value,t)}divide(t){return t=new jt(t),new jt(this/t,this.unit||t.unit)}init(t,e){return e=Array.isArray(t)?t[1]:e,t=Array.isArray(t)?t[0]:t,this.value=0,this.unit=e||"","number"==typeof t?this.value=isNaN(t)?0:isFinite(t)?t:t<0?-34e37:34e37:"string"==typeof t?(e=t.match(B))&&(this.value=parseFloat(e[1]),"%"===e[5]?this.value/=100:"s"===e[5]&&(this.value*=1e3),this.unit=e[5]):t instanceof jt&&(this.value=t.valueOf(),this.unit=t.unit),this}minus(t){return t=new jt(t),new jt(this-t,this.unit||t.unit)}plus(t){return t=new jt(t),new jt(this+t,this.unit||t.unit)}times(t){return t=new jt(t),new jt(this*t,this.unit||t.unit)}toArray(){return[this.value,this.unit]}toJSON(){return this.toString()}toString(){return("%"===this.unit?~~(1e8*this.value)/1e6:"s"===this.unit?this.value/1e3:this.value)+this.unit}valueOf(){return this.value}}const Dt=new Set(["fill","stroke","color","bgcolor","stop-color","flood-color","lighting-color"]),It=[];class Dom extends kt{constructor(t,e){super(),this.node=t,this.type=t.nodeName,e&&t!==e&&this.attr(e)}add(t,e){return(t=j(t)).removeNamespace&&this.node instanceof b.window.SVGElement&&t.removeNamespace(),null==e?this.node.appendChild(t.node):t.node!==this.node.childNodes[e]&&this.node.insertBefore(t.node,this.node.childNodes[e]),this}addTo(t,e){return j(t).put(this,e)}children(){return new pt(s(this.node.children,(function(t){return I(t)})))}clear(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return this}clone(t=!0,e=!0){this.writeDataToDom();let n=this.node.cloneNode(t);return e&&(n=F(n)),new this.constructor(n)}each(t,e){const n=this.children();let i,r;for(i=0,r=n.length;i=0}html(t,e){return this.xml(t,e,w)}id(t){return void 0!==t||this.node.id||(this.node.id=q(this.type)),this.attr("id",t)}index(t){return[].slice.call(this.node.childNodes).indexOf(t.node)}last(){return I(this.node.lastChild)}matches(t){const e=this.node,n=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector||null;return n&&n.call(e,t)}parent(t){let e=this;if(!e.node.parentNode)return null;if(e=I(e.node.parentNode),!t)return e;do{if("string"==typeof t?e.matches(t):e instanceof t)return e}while(e=I(e.node.parentNode));return e}put(t,e){return t=j(t),this.add(t,e),t}putIn(t,e){return j(t).add(this,e)}remove(){return this.parent()&&this.parent().removeElement(this),this}removeElement(t){return this.node.removeChild(t.node),this}replace(t){return t=j(t),this.node.parentNode&&this.node.parentNode.replaceChild(t.node,this.node),t}round(t=2,e=null){const n=10**t,i=this.attr(e);for(const t in i)"number"==typeof i[t]&&(i[t]=Math.round(i[t]*n)/n);return this.attr(i),this}svg(t,e){return this.xml(t,e,y)}toString(){return this.id()}words(t){return this.node.textContent=t,this}wrap(t){const e=this.parent();if(!e)return this.addTo(t);const n=e.index(this);return e.put(t,n).put(this)}writeDataToDom(){return this.each((function(){this.writeDataToDom()})),this}xml(t,e,n){if("boolean"==typeof t&&(n=e,e=t,t=null),null==t||"function"==typeof t){e=null==e||e,this.writeDataToDom();let n=this;if(null!=t){if(n=I(n.node.cloneNode(!0)),e){const e=t(n);if(n=e||n,!1===e)return""}n.each((function(){const e=t(this),n=e||this;!1===e?this.remove():e&&this!==n&&this.replace(n)}),!0)}return e?n.node.outerHTML:n.node.innerHTML}e=null!=e&&e;const i=E("wrapper",n),r=b.document.createDocumentFragment();i.innerHTML=t;for(let t=i.children.length;t--;)r.appendChild(i.firstElementChild);const s=this.parent();return e?this.replace(r)&&s:this.add(r)}}X(Dom,{attr:function(t,e,n){if(null==t){t={},e=this.node.attributes;for(const n of e)t[n.nodeName]=K.test(n.nodeValue)?parseFloat(n.nodeValue):n.nodeValue;return t}if(t instanceof Array)return t.reduce(((t,e)=>(t[e]=this.attr(e),t)),{});if("object"==typeof t&&t.constructor===Object)for(e in t)this.attr(e,t[e]);else if(null===e)this.node.removeAttribute(t);else{if(null==e)return null==(e=this.node.getAttribute(t))?Nt[t]:K.test(e)?parseFloat(e):e;"number"==typeof(e=It.reduce(((e,n)=>n(t,e,this)),e))?e=new jt(e):Dt.has(t)&&ht.isColor(e)?e=new ht(e):e.constructor===Array&&(e=new Et(e)),"leading"===t?this.leading&&this.leading(e):"string"==typeof n?this.node.setAttributeNS(n,t,e.toString()):this.node.setAttribute(t,e.toString()),!this.rebuild||"font-size"!==t&&"x"!==t||this.rebuild()}return this},find:function(t){return wt(t,this.node)},findOne:function(t){return I(this.node.querySelector(t))}}),P(Dom,"Dom");class Element extends Dom{constructor(t,e){super(t,e),this.dom={},this.node.instance=this,(t.hasAttribute("data-svgjs")||t.hasAttribute("svgjs:data"))&&this.setData(JSON.parse(t.getAttribute("data-svgjs"))??JSON.parse(t.getAttribute("svgjs:data"))??{})}center(t,e){return this.cx(t).cy(e)}cx(t){return null==t?this.x()+this.width()/2:this.x(t-this.width()/2)}cy(t){return null==t?this.y()+this.height()/2:this.y(t-this.height()/2)}defs(){const t=this.root();return t&&t.defs()}dmove(t,e){return this.dx(t).dy(e)}dx(t=0){return this.x(new jt(t).plus(this.x()))}dy(t=0){return this.y(new jt(t).plus(this.y()))}getEventHolder(){return this}height(t){return this.attr("height",t)}move(t,e){return this.x(t).y(e)}parents(t=this.root()){const e="string"==typeof t;e||(t=j(t));const n=new pt;let i=this;for(;(i=i.parent())&&i.node!==b.document&&"#document-fragment"!==i.nodeName&&(n.push(i),e||i.node!==t.node)&&(!e||!i.matches(t));)if(i.node===this.root().node)return null;return n}reference(t){if(!(t=this.attr(t)))return null;const e=(t+"").match($);return e?j(e[1]):null}root(){const t=this.parent(R(S));return t&&t.root()}setData(t){return this.dom=t,this}size(t,e){const n=l(this,t,e);return this.width(new jt(n.width)).height(new jt(n.height))}width(t){return this.attr("width",t)}writeDataToDom(){return m(this,this.dom),super.writeDataToDom()}x(t){return this.attr("x",t)}y(t){return this.attr("y",t)}}X(Element,{bbox:function(){const t=mt(this,(t=>t.getBBox()),(t=>{try{const e=t.clone().addTo(ct().svg).show(),n=e.node.getBBox();return e.remove(),n}catch(e){throw new Error(`Getting bbox of element "${t.node.nodeName}" is not possible: ${e.toString()}`)}}));return new dt(t)},rbox:function(t){const e=mt(this,(t=>t.getBoundingClientRect()),(t=>{throw new Error(`Getting rbox of element "${t.node.nodeName}" is not possible`)})),n=new dt(e);return t?n.transform(t.screenCTM().inverseO()):n.addOffset()},inside:function(t,e){const n=this.bbox();return t>n.x&&e>n.y&&t=0;i--)null!=e[zt[t][i]]&&this.attr(zt.prefix(t,zt[t][i]),e[zt[t][i]]);return this},n(["Element","Runner"],e)})),n(["Element","Runner"],{matrix:function(t,e,n,i,r,s){return null==t?new lt(this):this.attr("transform",new lt(t,e,n,i,r,s))},rotate:function(t,e,n){return this.transform({rotate:t,ox:e,oy:n},!0)},skew:function(t,e,n,i){return 1===arguments.length||3===arguments.length?this.transform({skew:t,ox:e,oy:n},!0):this.transform({skew:[t,e],ox:n,oy:i},!0)},shear:function(t,e,n){return this.transform({shear:t,ox:e,oy:n},!0)},scale:function(t,e,n,i){return 1===arguments.length||3===arguments.length?this.transform({scale:t,ox:e,oy:n},!0):this.transform({scale:[t,e],ox:n,oy:i},!0)},translate:function(t,e){return this.transform({translate:[t,e]},!0)},relative:function(t,e){return this.transform({relative:[t,e]},!0)},flip:function(t="both",e="center"){return-1==="xybothtrue".indexOf(t)&&(e=t,t="both"),this.transform({flip:t,origin:e},!0)},opacity:function(t){return this.attr("opacity",t)}}),n("radius",{radius:function(t,e=t){return"radialGradient"===(this._element||this).type?this.attr("r",new jt(t)):this.rx(t).ry(e)}}),n("Path",{length:function(){return this.node.getTotalLength()},pointAt:function(t){return new ut(this.node.getPointAtLength(t))}}),n(["Element","Runner"],{font:function(t,e){if("object"==typeof t){for(e in t)this.font(e,t[e]);return this}return"leading"===t?this.leading(e):"anchor"===t?this.attr("text-anchor",e):"size"===t||"family"===t||"weight"===t||"stretch"===t||"variant"===t||"style"===t?this.attr("font-"+t,e):this.attr(t,e)}});n("Element",["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","mouseenter","mouseleave","touchstart","touchmove","touchleave","touchend","touchcancel","contextmenu","wheel","pointerdown","pointermove","pointerup","pointerleave","pointercancel"].reduce((function(t,e){return t[e]=function(t){return null===t?this.off(e):this.on(e,t),this},t}),{})),n("Element",{untransform:function(){return this.attr("transform",null)},matrixify:function(){const t=(this.attr("transform")||"").split(U).slice(0,-1).map((function(t){const e=t.trim().split("(");return[e[0],e[1].split(et).map((function(t){return parseFloat(t)}))]})).reverse().reduce((function(t,e){return"matrix"===e[0]?t.lmultiply(lt.fromArray(e[1])):t[e[0]].apply(t,e[1])}),new lt);return t},toParent:function(t,e){if(this===t)return this;if(d(this.node))return this.addTo(t,e);const n=this.screenCTM(),i=t.screenCTM().inverse();return this.addTo(t,e).untransform().transform(i.multiply(n)),this},toRoot:function(t){return this.toParent(this.root(),t)},transform:function(t,e){if(null==t||"string"==typeof t){const e=new lt(this).decompose();return null==t?e:e[t]}lt.isMatrixLike(t)||(t={...t,origin:c(t,this)});const n=new lt(!0===e?this:e||!1).transform(t);return this.attr("transform",n)}});class Container extends Element{flatten(){return this.each((function(){if(this instanceof Container)return this.flatten().ungroup()})),this}ungroup(t=this.parent(),e=t.index(this)){return e=-1===e?t.children().length:e,this.each((function(n,i){return i[i.length-n-1].toParent(t,e)})),this.remove()}}P(Container,"Container");class Defs extends Container{constructor(t,e=t){super(D("defs",t),e)}flatten(){return this}ungroup(){return this}}P(Defs,"Defs");class Shape extends Element{}function Pt(t){return this.attr("rx",t)}function Rt(t){return this.attr("ry",t)}function Lt(t){return null==t?this.cx()-this.rx():this.cx(t+this.rx())}function qt(t){return null==t?this.cy()-this.ry():this.cy(t+this.ry())}function Ft(t){return this.attr("cx",t)}function Xt(t){return this.attr("cy",t)}function Yt(t){return null==t?2*this.rx():this.rx(new jt(t).divide(2))}function Bt(t){return null==t?2*this.ry():this.ry(new jt(t).divide(2))}P(Shape,"Shape");var Gt={__proto__:null,cx:Ft,cy:Xt,height:Bt,rx:Pt,ry:Rt,width:Yt,x:Lt,y:qt};class Ellipse extends Shape{constructor(t,e=t){super(D("ellipse",t),e)}size(t,e){const n=l(this,t,e);return this.rx(new jt(n.width).divide(2)).ry(new jt(n.height).divide(2))}}X(Ellipse,Gt),n("Container",{ellipse:Y((function(t=0,e=t){return this.put(new Ellipse).size(t,e).move(0,0)}))}),P(Ellipse,"Ellipse");class Ht extends Dom{constructor(t=b.document.createDocumentFragment()){super(t)}xml(t,e,n){if("boolean"==typeof t&&(n=e,e=t,t=null),null==t||"function"==typeof t){const t=new Dom(E("wrapper",n));return t.add(this.node.cloneNode(!0)),t.xml(!1,n)}return super.xml(t,!1,n)}}function Vt(t,e){return"radialGradient"===(this._element||this).type?this.attr({fx:new jt(t),fy:new jt(e)}):this.attr({x1:new jt(t),y1:new jt(e)})}function $t(t,e){return"radialGradient"===(this._element||this).type?this.attr({cx:new jt(t),cy:new jt(e)}):this.attr({x2:new jt(t),y2:new jt(e)})}P(Ht,"Fragment");var Ut,Wt={__proto__:null,from:Vt,to:$t};class Gradient extends Container{constructor(t,e){super(D(t+"Gradient","string"==typeof t?null:t),e)}attr(t,e,n){return"transform"===t&&(t="gradientTransform"),super.attr(t,e,n)}bbox(){return new dt}targets(){return wt("svg [fill*="+this.id()+"]")}toString(){return this.url()}update(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}url(){return"url(#"+this.id()+")"}}X(Gradient,Wt),n({Container:{gradient(...t){return this.defs().gradient(...t)}},Defs:{gradient:Y((function(t,e){return this.put(new Gradient(t)).update(e)}))}}),P(Gradient,"Gradient");class Pattern extends Container{constructor(t,e=t){super(D("pattern",t),e)}attr(t,e,n){return"transform"===t&&(t="patternTransform"),super.attr(t,e,n)}bbox(){return new dt}targets(){return wt("svg [fill*="+this.id()+"]")}toString(){return this.url()}update(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}url(){return"url(#"+this.id()+")"}}n({Container:{pattern(...t){return this.defs().pattern(...t)}},Defs:{pattern:Y((function(t,e,n){return this.put(new Pattern).update(n).attr({x:0,y:0,width:t,height:e,patternUnits:"userSpaceOnUse"})}))}}),P(Pattern,"Pattern");class Image extends Shape{constructor(t,e=t){super(D("image",t),e)}load(t,e){if(!t)return this;const n=new b.window.Image;return Mt(n,"load",(function(t){const i=this.parent(Pattern);0===this.width()&&0===this.height()&&this.size(n.width,n.height),i instanceof Pattern&&0===i.width()&&0===i.height()&&i.size(this.width(),this.height()),"function"==typeof e&&e.call(this,t)}),this),Mt(n,"load error",(function(){At(n)})),this.attr("href",n.src=t,_)}}Ut=function(t,e,n){return"fill"!==t&&"stroke"!==t||tt.test(e)&&(e=n.root().defs().image(e)),e instanceof Image&&(e=n.root().defs().pattern(0,0,(t=>{t.add(e)}))),e},It.push(Ut),n({Container:{image:Y((function(t,e){return this.put(new Image).size(0,0).load(t,e)}))}}),P(Image,"Image");class Qt extends Et{bbox(){let t=-1/0,e=-1/0,n=1/0,i=1/0;return this.forEach((function(r){t=Math.max(r[0],t),e=Math.max(r[1],e),n=Math.min(r[0],n),i=Math.min(r[1],i)})),new dt(n,i,t-n,e-i)}move(t,e){const n=this.bbox();if(t-=n.x,e-=n.y,!isNaN(t)&&!isNaN(e))for(let n=this.length-1;n>=0;n--)this[n]=[this[n][0]+t,this[n][1]+e];return this}parse(t=[0,0]){const e=[];(t=t instanceof Array?Array.prototype.concat.apply([],t):t.trim().split(et).map(parseFloat)).length%2!=0&&t.pop();for(let n=0,i=t.length;n=0;n--)i.width&&(this[n][0]=(this[n][0]-i.x)*t/i.width+i.x),i.height&&(this[n][1]=(this[n][1]-i.y)*e/i.height+i.y);return this}toLine(){return{x1:this[0][0],y1:this[0][1],x2:this[1][0],y2:this[1][1]}}toString(){const t=[];for(let e=0,n=this.length;e":function(t){return-Math.cos(t*Math.PI)/2+.5},">":function(t){return Math.sin(t*Math.PI/2)},"<":function(t){return 1-Math.cos(t*Math.PI/2)},bezier:function(t,e,n,i){return function(r){return r<0?t>0?e/t*r:n>0?i/n*r:0:r>1?n<1?(1-i)/(1-n)*r+(i-n)/(1-n):t<1?(1-e)/(1-t)*r+(e-t)/(1-t):1:3*r*(1-r)**2*e+3*r**2*(1-r)*i+r**3}},steps:function(t,e="end"){e=e.split("-").reverse()[0];let n=t;return"none"===e?--n:"both"===e&&++n,(i,r=!1)=>{let s=Math.floor(i*t);const o=i*s%1==0;return"start"!==e&&"both"!==e||++s,r&&o&&--s,i>=0&&s<0&&(s=0),i<=1&&s>n&&(s=n),s/n}}};class te{done(){return!1}}class ee extends te{constructor(t=Ct.ease){super(),this.ease=Kt[t]||t}step(t,e,n){return"number"!=typeof t?n<1?t:e:t+(e-t)*this.ease(n)}}class ne extends te{constructor(t){super(),this.stepper=t}done(t){return t.done}step(t,e,n,i){return this.stepper(t,e,n,i)}}function ie(){const t=(this._duration||500)/1e3,e=this._overshoot||0,n=Math.PI,i=Math.log(e/100+1e-10),r=-i/Math.sqrt(n*n+i*i),s=3.9/(r*t);this.d=2*r*s,this.k=s*s}class re extends ne{constructor(t=500,e=0){super(),this.duration(t).overshoot(e)}step(t,e,n,i){if("string"==typeof t)return t;if(i.done=n===1/0,n===1/0)return e;if(0===n)return t;n>100&&(n=16),n/=1e3;const r=i.velocity||0,s=-this.d*r-this.k*(t-e),o=t+r*n+s*n*n/2;return i.velocity=r+s*n,i.done=Math.abs(e-o)+Math.abs(r)<.002,i.done?e:o}}X(re,{duration:Zt("_duration",ie),overshoot:Zt("_overshoot",ie)});class se extends ne{constructor(t=.1,e=.01,n=0,i=1e3){super(),this.p(t).i(e).d(n).windup(i)}step(t,e,n,i){if("string"==typeof t)return t;if(i.done=n===1/0,n===1/0)return e;if(0===n)return t;const r=e-t;let s=(i.integral||0)+r*n;const o=(r-(i.error||0))/n,h=this._windup;return!1!==h&&(s=Math.max(-h,Math.min(s,h))),i.error=r,i.integral=s,i.done=Math.abs(r)<.001,i.done?e:t+(this.P*r+this.I*s+this.D*o)}}X(se,{windup:Zt("_windup"),p:Zt("P"),i:Zt("I"),d:Zt("D")});const oe={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0},he={M:function(t,e,n){return e.x=n.x=t[0],e.y=n.y=t[1],["M",e.x,e.y]},L:function(t,e){return e.x=t[0],e.y=t[1],["L",t[0],t[1]]},H:function(t,e){return e.x=t[0],["H",t[0]]},V:function(t,e){return e.y=t[0],["V",t[0]]},C:function(t,e){return e.x=t[4],e.y=t[5],["C",t[0],t[1],t[2],t[3],t[4],t[5]]},S:function(t,e){return e.x=t[2],e.y=t[3],["S",t[0],t[1],t[2],t[3]]},Q:function(t,e){return e.x=t[2],e.y=t[3],["Q",t[0],t[1],t[2],t[3]]},T:function(t,e){return e.x=t[0],e.y=t[1],["T",t[0],t[1]]},Z:function(t,e,n){return e.x=n.x,e.y=n.y,["Z"]},A:function(t,e){return e.x=t[5],e.y=t[6],["A",t[0],t[1],t[2],t[3],t[4],t[5],t[6]]}},ue="mlhvqtcsaz".split("");for(let t=0,e=ue.length;t=0;i--)n=this[i][0],"M"===n||"L"===n||"T"===n?(this[i][1]+=t,this[i][2]+=e):"H"===n?this[i][1]+=t:"V"===n?this[i][1]+=e:"C"===n||"S"===n||"Q"===n?(this[i][1]+=t,this[i][2]+=e,this[i][3]+=t,this[i][4]+=e,"C"===n&&(this[i][5]+=t,this[i][6]+=e)):"A"===n&&(this[i][6]+=t,this[i][7]+=e);return this}parse(t="M0 0"){return Array.isArray(t)&&(t=Array.prototype.concat.apply([],t).toString()),function(t,e=!0){let n=0,i="";const r={segment:[],inNumber:!1,number:"",lastToken:"",inSegment:!1,segments:[],pointSeen:!1,hasExponent:!1,absolute:e,p0:new ut,p:new ut};for(;r.lastToken=i,i=t.charAt(n++);)if(r.inSegment||!le(r,i))if("."!==i)if(isNaN(parseInt(i)))if(pe.has(i))r.inNumber&&ce(r,!1);else if("-"!==i&&"+"!==i)if("E"!==i.toUpperCase()){if(nt.test(i)){if(r.inNumber)ce(r,!1);else{if(!ae(r))throw new Error("parser Error");fe(r)}--n}}else r.number+=i,r.hasExponent=!0;else{if(r.inNumber&&!me(r)){ce(r,!1),--n;continue}r.number+=i,r.inNumber=!0}else{if("0"===r.number||de(r)){r.inNumber=!0,r.number=i,ce(r,!0);continue}r.inNumber=!0,r.number+=i}else{if(r.pointSeen||r.hasExponent){ce(r,!1),--n;continue}r.inNumber=!0,r.pointSeen=!0,r.number+=i}return r.inNumber&&ce(r,!1),r.inSegment&&ae(r)&&fe(r),r.segments}(t)}size(t,e){const n=this.bbox();let i,r;for(n.width=0===n.width?1:n.width,n.height=0===n.height?1:n.height,i=this.length-1;i>=0;i--)r=this[i][0],"M"===r||"L"===r||"T"===r?(this[i][1]=(this[i][1]-n.x)*t/n.width+n.x,this[i][2]=(this[i][2]-n.y)*e/n.height+n.y):"H"===r?this[i][1]=(this[i][1]-n.x)*t/n.width+n.x:"V"===r?this[i][1]=(this[i][1]-n.y)*e/n.height+n.y:"C"===r||"S"===r||"Q"===r?(this[i][1]=(this[i][1]-n.x)*t/n.width+n.x,this[i][2]=(this[i][2]-n.y)*e/n.height+n.y,this[i][3]=(this[i][3]-n.x)*t/n.width+n.x,this[i][4]=(this[i][4]-n.y)*e/n.height+n.y,"C"===r&&(this[i][5]=(this[i][5]-n.x)*t/n.width+n.x,this[i][6]=(this[i][6]-n.y)*e/n.height+n.y)):"A"===r&&(this[i][1]=this[i][1]*t/n.width,this[i][2]=this[i][2]*e/n.height,this[i][6]=(this[i][6]-n.x)*t/n.width+n.x,this[i][7]=(this[i][7]-n.y)*e/n.height+n.y);return this}toString(){return function(t){let e="";for(let n=0,i=t.length;n{const e=typeof t;return"number"===e?jt:"string"===e?ht.isColor(t)?ht:et.test(t)?nt.test(t)?ye:Et:B.test(t)?jt:_e:Me.indexOf(t.constructor)>-1?t.constructor:Array.isArray(t)?Et:"object"===e?ve:_e};class ge{constructor(t){this._stepper=t||new ee("-"),this._from=null,this._to=null,this._type=null,this._context=null,this._morphObj=null}at(t){return this._morphObj.morph(this._from,this._to,t,this._stepper,this._context)}done(){return this._context.map(this._stepper.done).reduce((function(t,e){return t&&e}),!0)}from(t){return null==t?this._from:(this._from=this._set(t),this)}stepper(t){return null==t?this._stepper:(this._stepper=t,this)}to(t){return null==t?this._to:(this._to=this._set(t),this)}type(t){return null==t?this._type:(this._type=t,this)}_set(t){this._type||this.type(we(t));let e=new this._type(t);return this._type===ht&&(e=this._to?e[this._to[4]]():this._from?e[this._from[4]]():e),this._type===ve&&(e=this._to?e.align(this._to):this._from?e.align(this._from):e),e=e.toConsumable(),this._morphObj=this._morphObj||new this._type,this._context=this._context||Array.apply(null,Array(e.length)).map(Object).map((function(t){return t.done=!0,t})),e}}class _e{constructor(...t){this.init(...t)}init(t){return t=Array.isArray(t)?t[0]:t,this.value=t,this}toArray(){return[this.value]}valueOf(){return this.value}}class xe{constructor(...t){this.init(...t)}init(t){return Array.isArray(t)&&(t={scaleX:t[0],scaleY:t[1],shear:t[2],rotate:t[3],translateX:t[4],translateY:t[5],originX:t[6],originY:t[7]}),Object.assign(this,xe.defaults,t),this}toArray(){const t=this;return[t.scaleX,t.scaleY,t.shear,t.rotate,t.translateX,t.translateY,t.originX,t.originY]}}xe.defaults={scaleX:1,scaleY:1,shear:0,rotate:0,translateX:0,translateY:0,originX:0,originY:0};const be=(t,e)=>t[0]e[0]?1:0;class ve{constructor(...t){this.init(...t)}align(t){const e=this.values;for(let n=0,i=e.length;nt.concat(e)),[]),this}toArray(){return this.values}valueOf(){const t={},e=this.values;for(;e.length;){const n=e.shift(),i=e.shift(),r=e.shift(),s=e.splice(0,r);t[n]=new i(s)}return t}}const Me=[_e,xe,ve];function Ae(t=[]){Me.push(...[].concat(t))}function Oe(){X(Me,{to(t){return(new ge).type(this.constructor).from(this.toArray()).to(t)},fromArray(t){return this.init(t),this},toConsumable(){return this.toArray()},morph(t,e,n,i,r){return this.fromArray(t.map((function(t,s){return i.step(t,e[s],n,r[s],r)})))}})}class Path extends Shape{constructor(t,e=t){super(D("path",t),e)}array(){return this._array||(this._array=new ye(this.attr("d")))}clear(){return delete this._array,this}height(t){return null==t?this.bbox().height:this.size(this.bbox().width,t)}move(t,e){return this.attr("d",this.array().move(t,e))}plot(t){return null==t?this.array():this.clear().attr("d","string"==typeof t?t:this._array=new ye(t))}size(t,e){const n=l(this,t,e);return this.attr("d",this.array().size(n.width,n.height))}width(t){return null==t?this.bbox().width:this.size(t,this.bbox().height)}x(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)}y(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)}}Path.prototype.MorphArray=ye,n({Container:{path:Y((function(t){return this.put(new Path).plot(t||new ye)}))}}),P(Path,"Path");var ke={__proto__:null,array:function(){return this._array||(this._array=new Qt(this.attr("points")))},clear:function(){return delete this._array,this},move:function(t,e){return this.attr("points",this.array().move(t,e))},plot:function(t){return null==t?this.array():this.clear().attr("points","string"==typeof t?t:this._array=new Qt(t))},size:function(t,e){const n=l(this,t,e);return this.attr("points",this.array().size(n.width,n.height))}};class Polygon extends Shape{constructor(t,e=t){super(D("polygon",t),e)}}n({Container:{polygon:Y((function(t){return this.put(new Polygon).plot(t||new Qt)}))}}),X(Polygon,Jt),X(Polygon,ke),P(Polygon,"Polygon");class Polyline extends Shape{constructor(t,e=t){super(D("polyline",t),e)}}n({Container:{polyline:Y((function(t){return this.put(new Polyline).plot(t||new Qt)}))}}),X(Polyline,Jt),X(Polyline,ke),P(Polyline,"Polyline");class Rect extends Shape{constructor(t,e=t){super(D("rect",t),e)}}X(Rect,{rx:Pt,ry:Rt}),n({Container:{rect:Y((function(t,e){return this.put(new Rect).size(t,e)}))}}),P(Rect,"Rect");class Te{constructor(){this._first=null,this._last=null}first(){return this._first&&this._first.value}last(){return this._last&&this._last.value}push(t){const e=void 0!==t.next?t:{value:t,next:null,prev:null};return this._last?(e.prev=this._last,this._last.next=e,this._last=e):(this._last=e,this._first=e),e}remove(t){t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t===this._last&&(this._last=t.prev),t===this._first&&(this._first=t.next),t.prev=null,t.next=null}shift(){const t=this._first;return t?(this._first=t.next,this._first&&(this._first.prev=null),this._last=this._first?this._last:null,t.value):null}}const Ce={nextDraw:null,frames:new Te,timeouts:new Te,immediates:new Te,timer:()=>b.window.performance||b.window.Date,transforms:[],frame(t){const e=Ce.frames.push({run:t});return null===Ce.nextDraw&&(Ce.nextDraw=b.window.requestAnimationFrame(Ce._draw)),e},timeout(t,e){e=e||0;const n=Ce.timer().now()+e,i=Ce.timeouts.push({run:t,time:n});return null===Ce.nextDraw&&(Ce.nextDraw=b.window.requestAnimationFrame(Ce._draw)),i},immediate(t){const e=Ce.immediates.push(t);return null===Ce.nextDraw&&(Ce.nextDraw=b.window.requestAnimationFrame(Ce._draw)),e},cancelFrame(t){null!=t&&Ce.frames.remove(t)},clearTimeout(t){null!=t&&Ce.timeouts.remove(t)},cancelImmediate(t){null!=t&&Ce.immediates.remove(t)},_draw(t){let e=null;const n=Ce.timeouts.last();for(;(e=Ce.timeouts.shift())&&(t>=e.time?e.run():Ce.timeouts.push(e),e!==n););let i=null;const r=Ce.frames.last();for(;i!==r&&(i=Ce.frames.shift());)i.run(t);let s=null;for(;s=Ce.immediates.shift();)s();Ce.nextDraw=Ce.timeouts.first()||Ce.frames.first()?b.window.requestAnimationFrame(Ce._draw):null}},Ne=function(t){const e=t.start,n=t.runner.duration();return{start:e,duration:n,end:e+n,runner:t.runner}},Se=function(){const t=b.window;return(t.performance||t.Date).now()};class Ee extends kt{constructor(t=Se){super(),this._timeSource=t,this.terminate()}active(){return!!this._nextFrame}finish(){return this.time(this.getEndTimeOfTimeline()+1),this.pause()}getEndTime(){const t=this.getLastRunnerInfo(),e=t?t.runner.duration():0;return(t?t.start:this._time)+e}getEndTimeOfTimeline(){const t=this._runners.map((t=>t.start+t.runner.duration()));return Math.max(0,...t)}getLastRunnerInfo(){return this.getRunnerInfoById(this._lastRunnerId)}getRunnerInfoById(t){return this._runners[this._runnerIds.indexOf(t)]||null}pause(){return this._paused=!0,this._continue()}persist(t){return null==t?this._persist:(this._persist=t,this)}play(){return this._paused=!1,this.updateTime()._continue()}reverse(t){const e=this.speed();if(null==t)return this.speed(-e);const n=Math.abs(e);return this.speed(t?-n:n)}schedule(t,e,n){if(null==t)return this._runners.map(Ne);let i=0;const r=this.getEndTime();if(e=e||0,null==n||"last"===n||"after"===n)i=r;else if("absolute"===n||"start"===n)i=e,e=0;else if("now"===n)i=this._time;else if("relative"===n){const n=this.getRunnerInfoById(t.id);n&&(i=n.start+e,e=0)}else{if("with-last"!==n)throw new Error('Invalid value for the "when" parameter');{const t=this.getLastRunnerInfo();i=t?t.start:this._time}}t.unschedule(),t.timeline(this);const s=t.persist(),o={persist:null===s?this._persist:s,start:i+e,runner:t};return this._lastRunnerId=t.id,this._runners.push(o),this._runners.sort(((t,e)=>t.start-e.start)),this._runnerIds=this._runners.map((t=>t.runner.id)),this.updateTime()._continue(),this}seek(t){return this.time(this._time+t)}source(t){return null==t?this._timeSource:(this._timeSource=t,this)}speed(t){return null==t?this._speed:(this._speed=t,this)}stop(){return this.time(0),this.pause()}time(t){return null==t?this._time:(this._time=t,this._continue(!0))}unschedule(t){const e=this._runnerIds.indexOf(t.id);return e<0||(this._runners.splice(e,1),this._runnerIds.splice(e,1),t.timeline(null)),this}updateTime(){return this.active()||(this._lastSourceTime=this._timeSource()),this}_continue(t=!1){return Ce.cancelFrame(this._nextFrame),this._nextFrame=null,t?this._stepImmediate():(this._paused||(this._nextFrame=Ce.frame(this._step)),this)}_stepFn(t=!1){const e=this._timeSource();let n=e-this._lastSourceTime;t&&(n=0);const i=this._speed*n+(this._time-this._lastStepTime);this._lastSourceTime=e,t||(this._time+=i,this._time=this._time<0?0:this._time),this._lastStepTime=this._time,this.fire("time",this._time);for(let t=this._runners.length;t--;){const e=this._runners[t],n=e.runner;this._time-e.start<=0&&n.reset()}let r=!1;for(let t=0,e=this._runners.length;t0?this._continue():(this.pause(),this.fire("finished")),this}terminate(){this._startTime=0,this._speed=1,this._persist=0,this._nextFrame=null,this._paused=!0,this._runners=[],this._runnerIds=[],this._lastRunnerId=-1,this._time=0,this._lastSourceTime=0,this._lastStepTime=0,this._step=this._stepFn.bind(this,!1),this._stepImmediate=this._stepFn.bind(this,!0)}}n({Element:{timeline:function(t){return null==t?(this._timeline=this._timeline||new Ee,this._timeline):(this._timeline=t,this)}}});class je extends kt{constructor(t){super(),this.id=je.id++,t="function"==typeof(t=null==t?Ct.duration:t)?new ne(t):t,this._element=null,this._timeline=null,this.done=!1,this._queue=[],this._duration="number"==typeof t&&t,this._isDeclarative=t instanceof ne,this._stepper=this._isDeclarative?t:new ee,this._history={},this.enabled=!0,this._time=0,this._lastTime=0,this._reseted=!0,this.transforms=new lt,this.transformId=1,this._haveReversed=!1,this._reverse=!1,this._loopsDone=0,this._swing=!1,this._wait=0,this._times=1,this._frameId=null,this._persist=!!this._isDeclarative||null}static sanitise(t,e,n){let i=1,r=!1,s=0;return e=e??Ct.delay,n=n||"last","object"!=typeof(t=t??Ct.duration)||t instanceof te||(e=t.delay??e,n=t.when??n,r=t.swing||r,i=t.times??i,s=t.wait??s,t=t.duration??Ct.duration),{duration:t,delay:e,swing:r,times:i,wait:s,when:n}}active(t){return null==t?this.enabled:(this.enabled=t,this)}addTransform(t){return this.transforms.lmultiplyO(t),this}after(t){return this.on("finished",t)}animate(t,e,n){const i=je.sanitise(t,e,n),r=new je(i.duration);return this._timeline&&r.timeline(this._timeline),this._element&&r.element(this._element),r.loop(i).schedule(i.delay,i.when)}clearTransform(){return this.transforms=new lt,this}clearTransformsFromQueue(){this.done&&this._timeline&&this._timeline._runnerIds.includes(this.id)||(this._queue=this._queue.filter((t=>!t.isTransform)))}delay(t){return this.animate(0,t)}duration(){return this._times*(this._wait+this._duration)-this._wait}during(t){return this.queue(null,t)}ease(t){return this._stepper=new ee(t),this}element(t){return null==t?this._element:(this._element=t,t._prepareRunner(),this)}finish(){return this.step(1/0)}loop(t,e,n){return"object"==typeof t&&(e=t.swing,n=t.wait,t=t.times),this._times=t||1/0,this._swing=e||!1,this._wait=n||0,!0===this._times&&(this._times=1/0),this}loops(t){const e=this._duration+this._wait;if(null==t){const t=Math.floor(this._time/e),n=(this._time-t*e)/this._duration;return Math.min(t+n,this._times)}const n=t%1,i=e*Math.floor(t)+this._duration*n;return this.time(i)}persist(t){return null==t?this._persist:(this._persist=t,this)}position(t){const e=this._time,n=this._duration,i=this._wait,r=this._times,s=this._swing,o=this._reverse;let h;if(null==t){const t=function(t){const e=s*Math.floor(t%(2*(i+n))/(i+n)),r=e&&!o||!e&&o,h=Math.pow(-1,r)*(t%(i+n))/n+r;return Math.max(Math.min(h,1),0)},u=r*(i+n)-i;return h=e<=0?Math.round(t(1e-5)):e=0;this._lastPosition=e;const i=this.duration(),r=this._lastTime<=0&&this._time>0,s=this._lastTime=i;this._lastTime=this._time,r&&this.fire("start",this);const o=this._isDeclarative;this.done=!o&&!s&&this._time>=i,this._reseted=!1;let h=!1;return(n||o)&&(this._initialise(n),this.transforms=new lt,h=this._run(o?t:e),this.fire("step",this)),this.done=this.done||h&&o,s&&this.fire("finished",this),this}time(t){if(null==t)return this._time;const e=t-this._time;return this.step(e),this}timeline(t){return void 0===t?this._timeline:(this._timeline=t,this)}unschedule(){const t=this.timeline();return t&&t.unschedule(this),this}_initialise(t){if(t||this._isDeclarative)for(let e=0,n=this._queue.length;et.lmultiplyO(e),ze=t=>t.transforms;function Pe(){const t=this._transformationRunners.runners.map(ze).reduce(Ie,new lt);this.transform(t),this._transformationRunners.merge(),1===this._transformationRunners.length()&&(this._frameId=null)}class Re{constructor(){this.runners=[],this.ids=[]}add(t){if(this.runners.includes(t))return;const e=t.id+1;return this.runners.push(t),this.ids.push(e),this}clearBefore(t){const e=this.ids.indexOf(t+1)||1;return this.ids.splice(0,e,0),this.runners.splice(0,e,new De).forEach((t=>t.clearTransformsFromQueue())),this}edit(t,e){const n=this.ids.indexOf(t+1);return this.ids.splice(n,1,t+1),this.runners.splice(n,1,e),this}getByID(t){return this.runners[this.ids.indexOf(t+1)]}length(){return this.ids.length}merge(){let t=null;for(let e=0;ee.id<=t.id)).map(ze).reduce(Ie,new lt)},_addRunner(t){this._transformationRunners.add(t),Ce.cancelImmediate(this._frameId),this._frameId=Ce.immediate(Pe.bind(this))},_prepareRunner(){null==this._frameId&&(this._transformationRunners=(new Re).add(new De(new lt(this))))}}});X(je,{attr(t,e){return this.styleAttr("attr",t,e)},css(t,e){return this.styleAttr("css",t,e)},styleAttr(t,e,n){if("string"==typeof e)return this.styleAttr(t,{[e]:n});let i=e;if(this._tryRetarget(t,i))return this;let r=new ge(this._stepper).to(i),s=Object.keys(i);return this.queue((function(){r=r.from(this.element()[t](s))}),(function(e){return this.element()[t](r.at(e).valueOf()),r.done()}),(function(e){const n=Object.keys(e),o=(h=s,n.filter((t=>!h.includes(t))));var h;if(o.length){const e=this.element()[t](o),n=new ve(r.from()).valueOf();Object.assign(n,e),r.from(n)}const u=new ve(r.to()).valueOf();Object.assign(u,e),r.to(u),s=n,i=e})),this._rememberMorpher(t,r),this},zoom(t,e){if(this._tryRetarget("zoom",t,e))return this;let n=new ge(this._stepper).to(new jt(t));return this.queue((function(){n=n.from(this.element().zoom())}),(function(t){return this.element().zoom(n.at(t),e),n.done()}),(function(t,i){e=i,n.to(t)})),this._rememberMorpher("zoom",n),this},transform(t,e,n){if(e=t.relative||e,this._isDeclarative&&!e&&this._tryRetarget("transform",t))return this;const i=lt.isMatrixLike(t);n=null!=t.affine?t.affine:null!=n?n:!i;const r=new ge(this._stepper).type(n?xe:lt);let s,o,h,u,a;return this.queue((function(){o=o||this.element(),s=s||c(t,o),a=new lt(e?void 0:o),o._addRunner(this),e||o._clearTransformRunnersBefore(this)}),(function(l){e||this.clearTransform();const{x:c,y:f}=new ut(s).transform(o._currentTransform(this));let d=new lt({...t,origin:[c,f]}),m=this._isDeclarative&&h?h:a;if(n){d=d.decompose(c,f),m=m.decompose(c,f);const t=d.rotate,e=m.rotate,n=[t-360,t,t+360],i=n.map((t=>Math.abs(t-e))),r=Math.min(...i),s=i.indexOf(r);d.rotate=n[s]}e&&(i||(d.rotate=t.rotate||0),this._isDeclarative&&u&&(m.rotate=u)),r.from(m),r.to(d);const p=r.at(l);return u=p.rotate,h=new lt(p),this.addTransform(h),o._addRunner(this),r.done()}),(function(e){(e.origin||"center").toString()!==(t.origin||"center").toString()&&(s=c(e,o)),t={...e,origin:s}}),!0),this._isDeclarative&&this._rememberMorpher("transform",r),this},x(t){return this._queueNumber("x",t)},y(t){return this._queueNumber("y",t)},ax(t){return this._queueNumber("ax",t)},ay(t){return this._queueNumber("ay",t)},dx(t=0){return this._queueNumberDelta("x",t)},dy(t=0){return this._queueNumberDelta("y",t)},dmove(t,e){return this.dx(t).dy(e)},_queueNumberDelta(t,e){if(e=new jt(e),this._tryRetarget(t,e))return this;const n=new ge(this._stepper).to(e);let i=null;return this.queue((function(){i=this.element()[t](),n.from(i),n.to(i+e)}),(function(e){return this.element()[t](n.at(e)),n.done()}),(function(t){n.to(i+new jt(t))})),this._rememberMorpher(t,n),this},_queueObject(t,e){if(this._tryRetarget(t,e))return this;const n=new ge(this._stepper).to(e);return this.queue((function(){n.from(this.element()[t]())}),(function(e){return this.element()[t](n.at(e)),n.done()})),this._rememberMorpher(t,n),this},_queueNumber(t,e){return this._queueObject(t,new jt(e))},cx(t){return this._queueNumber("cx",t)},cy(t){return this._queueNumber("cy",t)},move(t,e){return this.x(t).y(e)},amove(t,e){return this.ax(t).ay(e)},center(t,e){return this.cx(t).cy(e)},size(t,e){let n;return t&&e||(n=this._element.bbox()),t||(t=n.width/n.height*e),e||(e=n.height/n.width*t),this.width(t).height(e)},width(t){return this._queueNumber("width",t)},height(t){return this._queueNumber("height",t)},plot(t,e,n,i){if(4===arguments.length)return this.plot([t,e,n,i]);if(this._tryRetarget("plot",t))return this;const r=new ge(this._stepper).type(this._element.MorphArray).to(t);return this.queue((function(){r.from(this._element.array())}),(function(t){return this._element.plot(r.at(t)),r.done()})),this._rememberMorpher("plot",r),this},leading(t){return this._queueNumber("leading",t)},viewbox(t,e,n,i){return this._queueObject("viewbox",new dt(t,e,n,i))},update(t){return"object"!=typeof t?this.update({offset:arguments[0],color:arguments[1],opacity:arguments[2]}):(null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",t.offset),this)}}),X(je,{rx:Pt,ry:Rt,from:Vt,to:$t}),P(je,"Runner");class Svg extends Container{constructor(t,e=t){super(D("svg",t),e),this.namespace()}defs(){return this.isRoot()?I(this.node.querySelector("defs"))||this.put(new Defs):this.root().defs()}isRoot(){return!this.node.parentNode||!(this.node.parentNode instanceof b.window.SVGElement)&&"#document-fragment"!==this.node.parentNode.nodeName}namespace(){return this.isRoot()?this.attr({xmlns:y,version:"1.1"}).attr("xmlns:xlink",_,g):this.root().namespace()}removeNamespace(){return this.attr({xmlns:null,version:null}).attr("xmlns:xlink",null,g).attr("xmlns:svgjs",null,g)}root(){return this.isRoot()?this:super.root()}}n({Container:{nested:Y((function(){return this.put(new Svg)}))}}),P(Svg,"Svg",!0);class Symbol extends Container{constructor(t,e=t){super(D("symbol",t),e)}}n({Container:{symbol:Y((function(){return this.put(new Symbol)}))}}),P(Symbol,"Symbol");var Le={__proto__:null,amove:function(t,e){return this.ax(t).ay(e)},ax:function(t){return this.attr("x",t)},ay:function(t){return this.attr("y",t)},build:function(t){return this._build=!!t,this},center:function(t,e,n=this.bbox()){return this.cx(t,n).cy(e,n)},cx:function(t,e=this.bbox()){return null==t?e.cx:this.attr("x",this.attr("x")+t-e.cx)},cy:function(t,e=this.bbox()){return null==t?e.cy:this.attr("y",this.attr("y")+t-e.cy)},length:function(){return this.node.getComputedTextLength()},move:function(t,e,n=this.bbox()){return this.x(t,n).y(e,n)},plain:function(t){return!1===this._build&&this.clear(),this.node.appendChild(b.document.createTextNode(t)),this},x:function(t,e=this.bbox()){return null==t?e.x:this.attr("x",this.attr("x")+t-e.x)},y:function(t,e=this.bbox()){return null==t?e.y:this.attr("y",this.attr("y")+t-e.y)}};class Text extends Shape{constructor(t,e=t){super(D("text",t),e),this.dom.leading=this.dom.leading??new jt(1.3),this._rebuild=!0,this._build=!1}leading(t){return null==t?this.dom.leading:(this.dom.leading=new jt(t),this.rebuild())}rebuild(t){if("boolean"==typeof t&&(this._rebuild=t),this._rebuild){const t=this;let e=0;const n=this.dom.leading;this.each((function(i){if(d(this.node))return;const r=b.window.getComputedStyle(this.node).getPropertyValue("font-size"),s=n*new jt(r);this.dom.newLined&&(this.attr("x",t.attr("x")),"\n"===this.text()?e+=s:(this.attr("dy",i?s+e:0),e=0))})),this.fire("rebuild")}return this}setData(t){return this.dom=t,this.dom.leading=new jt(t.leading||1.3),this}writeDataToDom(){return m(this,this.dom,{leading:1.3}),this}text(t){if(void 0===t){const e=this.node.childNodes;let n=0;t="";for(let i=0,r=e.length;i{let i;try{i=n.node instanceof T().SVGSVGElement?new dt(n.attr(["x","y","width","height"])):n.bbox()}catch(t){return}const r=new lt(n),s=r.translate(t,e).transform(r.inverse()),o=new ut(i.x,i.y).transform(s);n.move(o.x,o.y)})),this},dx:function(t){return this.dmove(t,0)},dy:function(t){return this.dmove(0,t)},height:function(t,e=this.bbox()){return null==t?e.height:this.size(e.width,t,e)},move:function(t=0,e=0,n=this.bbox()){const i=t-n.x,r=e-n.y;return this.dmove(i,r)},size:function(t,e,n=this.bbox()){const i=l(this,t,e,n),r=i.width/n.width,s=i.height/n.height;return this.children().forEach((t=>{const e=new ut(n).transform(new lt(t).inverse());t.scale(r,s,e.x,e.y)})),this},width:function(t,e=this.bbox()){return null==t?e.width:this.size(t,e.height,e)},x:function(t,e=this.bbox()){return null==t?e.x:this.move(t,e.y,e)},y:function(t,e=this.bbox()){return null==t?e.y:this.move(e.x,t,e)}};class G extends Container{constructor(t,e=t){super(D("g",t),e)}}X(G,Fe),n({Container:{group:Y((function(){return this.put(new G)}))}}),P(G,"G");class A extends Container{constructor(t,e=t){super(D("a",t),e)}target(t){return this.attr("target",t)}to(t){return this.attr("href",t,_)}}X(A,Fe),n({Container:{link:Y((function(t){return this.put(new A).to(t)}))},Element:{unlink(){const t=this.linker();if(!t)return this;const e=t.parent();if(!e)return this.remove();const n=e.index(t);return e.add(this,n),t.remove(),this},linkTo(t){let e=this.linker();return e||(e=new A,this.wrap(e)),"function"==typeof t?t.call(e,e):e.to(t),this},linker(){const t=this.parent();return t&&"a"===t.node.nodeName.toLowerCase()?t:null}}}),P(A,"A");class Mask extends Container{constructor(t,e=t){super(D("mask",t),e)}remove(){return this.targets().forEach((function(t){t.unmask()})),super.remove()}targets(){return wt("svg [mask*="+this.id()+"]")}}n({Container:{mask:Y((function(){return this.defs().put(new Mask)}))},Element:{masker(){return this.reference("mask")},maskWith(t){const e=t instanceof Mask?t:this.parent().mask().add(t);return this.attr("mask","url(#"+e.id()+")")},unmask(){return this.attr("mask",null)}}}),P(Mask,"Mask");class Stop extends Element{constructor(t,e=t){super(D("stop",t),e)}update(t){return("number"==typeof t||t instanceof jt)&&(t={offset:arguments[0],color:arguments[1],opacity:arguments[2]}),null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",new jt(t.offset)),this}}n({Gradient:{stop:function(t,e,n){return this.put(new Stop).update(t,e,n)}}}),P(Stop,"Stop");class Style extends Element{constructor(t,e=t){super(D("style",t),e)}addText(t=""){return this.node.textContent+=t,this}font(t,e,n={}){return this.rule("@font-face",{fontFamily:t,src:e,...n})}rule(t,e){return this.addText(function(t,e){if(!t)return"";if(!e)return t;let n=t+"{";for(const t in e)n+=u(t)+":"+e[t]+";";return n+="}",n}(t,e))}}n("Dom",{style(t,e){return this.put(new Style).rule(t,e)},fontface(t,e,n){return this.put(new Style).font(t,e,n)}}),P(Style,"Style");class TextPath extends Text{constructor(t,e=t){super(D("textPath",t),e)}array(){const t=this.track();return t?t.array():null}plot(t){const e=this.track();let n=null;return e&&(n=e.plot(t)),null==t?n:this}track(){return this.reference("href")}}n({Container:{textPath:Y((function(t,e){return t instanceof Text||(t=this.text(t)),t.path(e)}))},Text:{path:Y((function(t,e=!0){const n=new TextPath;let i;if(t instanceof Path||(t=this.defs().path(t)),n.attr("href","#"+t,_),e)for(;i=this.node.firstChild;)n.node.appendChild(i);return this.put(n)})),textPath(){return this.findOne("textPath")}},Path:{text:Y((function(t){return t instanceof Text||(t=(new Text).addTo(this.parent()).text(t)),t.path(this)})),targets(){return wt("svg textPath").filter((t=>(t.attr("href")||"").includes(this.id())))}}}),TextPath.prototype.MorphArray=ye,P(TextPath,"TextPath");class Use extends Shape{constructor(t,e=t){super(D("use",t),e)}use(t,e){return this.attr("href",(e||"")+"#"+t,_)}}n({Container:{use:Y((function(t,e){return this.put(new Use).use(t,e)}))}}),P(Use,"Use");const Xe=j;X([Svg,Symbol,Image,Pattern,Marker],i("viewbox")),X([Line,Polyline,Polygon,Path],i("marker")),X(Text,i("Text")),X(Path,i("Path")),X(Defs,i("Defs")),X([Text,Tspan],i("Tspan")),X([Rect,Ellipse,Gradient,je],i("radius")),X(kt,i("EventTarget")),X(Dom,i("Dom")),X(Element,i("Element")),X(Shape,i("Shape")),X([Container,Ht],i("Container")),X(Gradient,i("Gradient")),X(je,i("Runner")),pt.extend([...new Set(e)]),Ae([jt,ht,dt,lt,Et,Qt,ye,ut]),Oe();var Ye={__proto__:null,A:A,Animator:Ce,Array:Et,Box:dt,Circle:Circle,ClipPath:ClipPath,Color:ht,Container:Container,Controller:ne,Defs:Defs,Dom:Dom,Ease:ee,Element:Element,Ellipse:Ellipse,EventTarget:kt,ForeignObject:qe,Fragment:Ht,G:G,Gradient:Gradient,Image:Image,Line:Line,List:pt,Marker:Marker,Mask:Mask,Matrix:lt,Morphable:ge,NonMorphable:_e,Number:jt,ObjectBag:ve,PID:se,Path:Path,PathArray:ye,Pattern:Pattern,Point:ut,PointArray:Qt,Polygon:Polygon,Polyline:Polyline,Queue:Te,Rect:Rect,Runner:je,SVG:Xe,Shape:Shape,Spring:re,Stop:Stop,Style:Style,Svg:Svg,Symbol:Symbol,Text:Text,TextPath:TextPath,Timeline:Ee,TransformBag:xe,Tspan:Tspan,Use:Use,adopt:I,assignNewId:F,clearEvents:vt,create:E,defaults:St,dispatch:Ot,easing:Kt,eid:q,extend:X,find:wt,getClass:R,getEventTarget:bt,getEvents:xt,getWindow:T,makeInstance:j,makeMorphable:Oe,mockAdopt:function(t=I){z=t},namespaces:x,nodeOrNew:D,off:At,on:Mt,parser:ct,regex:it,register:P,registerMorphableType:Ae,registerWindow:v,restoreWindow:k,root:S,saveWindow:O,utils:p,windowEvents:_t,withWindow:function(t,e){O(),v(t,t.document),e(t,t.document),k()},wrapWithAttrCheck:Y};function Be(t,e){return j(t,e)}return Object.assign(Be,Ye),Be}(); +//# sourceMappingURL=svg.min.js.map diff --git a/node_modules/@svgdotjs/svg.js/dist/svg.min.js.map b/node_modules/@svgdotjs/svg.js/dist/svg.min.js.map new file mode 100644 index 0000000..3dc2115 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/dist/svg.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"svg.min.js","sources":["../src/utils/methods.js","../src/utils/utils.js","../src/modules/core/namespaces.js","../src/utils/window.js","../src/types/Base.js","../src/utils/adopter.js","../src/modules/optional/arrange.js","../src/modules/core/regex.js","../src/types/Color.js","../src/modules/optional/class.js","../src/modules/optional/css.js","../src/modules/optional/data.js","../src/modules/optional/memory.js","../src/types/Point.js","../src/types/Matrix.js","../src/modules/core/parser.js","../src/types/Box.js","../src/types/List.js","../src/modules/core/selector.js","../src/modules/core/event.js","../src/types/EventTarget.js","../src/modules/core/defaults.js","../src/types/SVGArray.js","../src/types/SVGNumber.js","../src/modules/core/attr.js","../src/elements/Dom.js","../src/elements/Element.js","../src/modules/optional/sugar.js","../src/modules/optional/transform.js","../src/elements/Container.js","../src/elements/Defs.js","../src/elements/Shape.js","../src/modules/core/circled.js","../src/elements/Ellipse.js","../src/elements/Fragment.js","../src/modules/core/gradiented.js","../src/elements/Gradient.js","../src/elements/Pattern.js","../src/elements/Image.js","../src/types/PointArray.js","../src/modules/core/pointed.js","../src/elements/Line.js","../src/elements/Marker.js","../src/animation/Controller.js","../src/utils/pathParser.js","../src/types/PathArray.js","../src/animation/Morphable.js","../src/elements/Path.js","../src/modules/core/poly.js","../src/elements/Polygon.js","../src/elements/Polyline.js","../src/elements/Rect.js","../src/animation/Queue.js","../src/animation/Animator.js","../src/animation/Timeline.js","../src/animation/Runner.js","../src/elements/Svg.js","../src/elements/Symbol.js","../src/modules/core/textable.js","../src/elements/Text.js","../src/elements/Tspan.js","../src/elements/Circle.js","../src/elements/ClipPath.js","../src/elements/ForeignObject.js","../src/modules/core/containerGeometry.js","../src/elements/G.js","../src/elements/A.js","../src/elements/Mask.js","../src/elements/Stop.js","../src/elements/Style.js","../src/elements/TextPath.js","../src/elements/Use.js","../src/main.js","../src/svg.js"],"sourcesContent":["const methods = {}\nconst names = []\n\nexport function registerMethods(name, m) {\n if (Array.isArray(name)) {\n for (const _name of name) {\n registerMethods(_name, m)\n }\n return\n }\n\n if (typeof name === 'object') {\n for (const _name in name) {\n registerMethods(_name, name[_name])\n }\n return\n }\n\n addMethodNames(Object.getOwnPropertyNames(m))\n methods[name] = Object.assign(methods[name] || {}, m)\n}\n\nexport function getMethodsFor(name) {\n return methods[name] || {}\n}\n\nexport function getMethodNames() {\n return [...new Set(names)]\n}\n\nexport function addMethodNames(_names) {\n names.push(..._names)\n}\n","// Map function\nexport function map(array, block) {\n let i\n const il = array.length\n const result = []\n\n for (i = 0; i < il; i++) {\n result.push(block(array[i]))\n }\n\n return result\n}\n\n// Filter function\nexport function filter(array, block) {\n let i\n const il = array.length\n const result = []\n\n for (i = 0; i < il; i++) {\n if (block(array[i])) {\n result.push(array[i])\n }\n }\n\n return result\n}\n\n// Degrees to radians\nexport function radians(d) {\n return ((d % 360) * Math.PI) / 180\n}\n\n// Radians to degrees\nexport function degrees(r) {\n return ((r * 180) / Math.PI) % 360\n}\n\n// Convert camel cased string to dash separated\nexport function unCamelCase(s) {\n return s.replace(/([A-Z])/g, function (m, g) {\n return '-' + g.toLowerCase()\n })\n}\n\n// Capitalize first letter of a string\nexport function capitalize(s) {\n return s.charAt(0).toUpperCase() + s.slice(1)\n}\n\n// Calculate proportional width and height values when necessary\nexport function proportionalSize(element, width, height, box) {\n if (width == null || height == null) {\n box = box || element.bbox()\n\n if (width == null) {\n width = (box.width / box.height) * height\n } else if (height == null) {\n height = (box.height / box.width) * width\n }\n }\n\n return {\n width: width,\n height: height\n }\n}\n\n/**\n * This function adds support for string origins.\n * It searches for an origin in o.origin o.ox and o.originX.\n * This way, origin: {x: 'center', y: 50} can be passed as well as ox: 'center', oy: 50\n **/\nexport function getOrigin(o, element) {\n const origin = o.origin\n // First check if origin is in ox or originX\n let ox = o.ox != null ? o.ox : o.originX != null ? o.originX : 'center'\n let oy = o.oy != null ? o.oy : o.originY != null ? o.originY : 'center'\n\n // Then check if origin was used and overwrite in that case\n if (origin != null) {\n ;[ox, oy] = Array.isArray(origin)\n ? origin\n : typeof origin === 'object'\n ? [origin.x, origin.y]\n : [origin, origin]\n }\n\n // Make sure to only call bbox when actually needed\n const condX = typeof ox === 'string'\n const condY = typeof oy === 'string'\n if (condX || condY) {\n const { height, width, x, y } = element.bbox()\n\n // And only overwrite if string was passed for this specific axis\n if (condX) {\n ox = ox.includes('left')\n ? x\n : ox.includes('right')\n ? x + width\n : x + width / 2\n }\n\n if (condY) {\n oy = oy.includes('top')\n ? y\n : oy.includes('bottom')\n ? y + height\n : y + height / 2\n }\n }\n\n // Return the origin as it is if it wasn't a string\n return [ox, oy]\n}\n\nconst descriptiveElements = new Set(['desc', 'metadata', 'title'])\nexport const isDescriptive = (element) =>\n descriptiveElements.has(element.nodeName)\n\nexport const writeDataToDom = (element, data, defaults = {}) => {\n const cloned = { ...data }\n\n for (const key in cloned) {\n if (cloned[key].valueOf() === defaults[key]) {\n delete cloned[key]\n }\n }\n\n if (Object.keys(cloned).length) {\n element.node.setAttribute('data-svgjs', JSON.stringify(cloned)) // see #428\n } else {\n element.node.removeAttribute('data-svgjs')\n element.node.removeAttribute('svgjs:data')\n }\n}\n","// Default namespaces\nexport const svg = 'http://www.w3.org/2000/svg'\nexport const html = 'http://www.w3.org/1999/xhtml'\nexport const xmlns = 'http://www.w3.org/2000/xmlns/'\nexport const xlink = 'http://www.w3.org/1999/xlink'\n","export const globals = {\n window: typeof window === 'undefined' ? null : window,\n document: typeof document === 'undefined' ? null : document\n}\n\nexport function registerWindow(win = null, doc = null) {\n globals.window = win\n globals.document = doc\n}\n\nconst save = {}\n\nexport function saveWindow() {\n save.window = globals.window\n save.document = globals.document\n}\n\nexport function restoreWindow() {\n globals.window = save.window\n globals.document = save.document\n}\n\nexport function withWindow(win, fn) {\n saveWindow()\n registerWindow(win, win.document)\n fn(win, win.document)\n restoreWindow()\n}\n\nexport function getWindow() {\n return globals.window\n}\n","export default class Base {\n // constructor (node/*, {extensions = []} */) {\n // // this.tags = []\n // //\n // // for (let extension of extensions) {\n // // extension.setup.call(this, node)\n // // this.tags.push(extension.name)\n // // }\n // }\n}\n","import { addMethodNames } from './methods.js'\nimport { capitalize } from './utils.js'\nimport { svg } from '../modules/core/namespaces.js'\nimport { globals } from '../utils/window.js'\nimport Base from '../types/Base.js'\n\nconst elements = {}\nexport const root = '___SYMBOL___ROOT___'\n\n// Method for element creation\nexport function create(name, ns = svg) {\n // create element\n return globals.document.createElementNS(ns, name)\n}\n\nexport function makeInstance(element, isHTML = false) {\n if (element instanceof Base) return element\n\n if (typeof element === 'object') {\n return adopter(element)\n }\n\n if (element == null) {\n return new elements[root]()\n }\n\n if (typeof element === 'string' && element.charAt(0) !== '<') {\n return adopter(globals.document.querySelector(element))\n }\n\n // Make sure, that HTML elements are created with the correct namespace\n const wrapper = isHTML ? globals.document.createElement('div') : create('svg')\n wrapper.innerHTML = element\n\n // We can use firstChild here because we know,\n // that the first char is < and thus an element\n element = adopter(wrapper.firstChild)\n\n // make sure, that element doesn't have its wrapper attached\n wrapper.removeChild(wrapper.firstChild)\n return element\n}\n\nexport function nodeOrNew(name, node) {\n return node &&\n (node instanceof globals.window.Node ||\n (node.ownerDocument &&\n node instanceof node.ownerDocument.defaultView.Node))\n ? node\n : create(name)\n}\n\n// Adopt existing svg elements\nexport function adopt(node) {\n // check for presence of node\n if (!node) return null\n\n // make sure a node isn't already adopted\n if (node.instance instanceof Base) return node.instance\n\n if (node.nodeName === '#document-fragment') {\n return new elements.Fragment(node)\n }\n\n // initialize variables\n let className = capitalize(node.nodeName || 'Dom')\n\n // Make sure that gradients are adopted correctly\n if (className === 'LinearGradient' || className === 'RadialGradient') {\n className = 'Gradient'\n\n // Fallback to Dom if element is not known\n } else if (!elements[className]) {\n className = 'Dom'\n }\n\n return new elements[className](node)\n}\n\nlet adopter = adopt\n\nexport function mockAdopt(mock = adopt) {\n adopter = mock\n}\n\nexport function register(element, name = element.name, asRoot = false) {\n elements[name] = element\n if (asRoot) elements[root] = element\n\n addMethodNames(Object.getOwnPropertyNames(element.prototype))\n\n return element\n}\n\nexport function getClass(name) {\n return elements[name]\n}\n\n// Element id sequence\nlet did = 1000\n\n// Get next named element id\nexport function eid(name) {\n return 'Svgjs' + capitalize(name) + did++\n}\n\n// Deep new id assignment\nexport function assignNewId(node) {\n // do the same for SVG child nodes as well\n for (let i = node.children.length - 1; i >= 0; i--) {\n assignNewId(node.children[i])\n }\n\n if (node.id) {\n node.id = eid(node.nodeName)\n return node\n }\n\n return node\n}\n\n// Method for extending objects\nexport function extend(modules, methods) {\n let key, i\n\n modules = Array.isArray(modules) ? modules : [modules]\n\n for (i = modules.length - 1; i >= 0; i--) {\n for (key in methods) {\n modules[i].prototype[key] = methods[key]\n }\n }\n}\n\nexport function wrapWithAttrCheck(fn) {\n return function (...args) {\n const o = args[args.length - 1]\n\n if (o && o.constructor === Object && !(o instanceof Array)) {\n return fn.apply(this, args.slice(0, -1)).attr(o)\n } else {\n return fn.apply(this, args)\n }\n }\n}\n","import { makeInstance } from '../../utils/adopter.js'\nimport { registerMethods } from '../../utils/methods.js'\n\n// Get all siblings, including myself\nexport function siblings() {\n return this.parent().children()\n}\n\n// Get the current position siblings\nexport function position() {\n return this.parent().index(this)\n}\n\n// Get the next element (will return null if there is none)\nexport function next() {\n return this.siblings()[this.position() + 1]\n}\n\n// Get the next element (will return null if there is none)\nexport function prev() {\n return this.siblings()[this.position() - 1]\n}\n\n// Send given element one step forward\nexport function forward() {\n const i = this.position()\n const p = this.parent()\n\n // move node one step forward\n p.add(this.remove(), i + 1)\n\n return this\n}\n\n// Send given element one step backward\nexport function backward() {\n const i = this.position()\n const p = this.parent()\n\n p.add(this.remove(), i ? i - 1 : 0)\n\n return this\n}\n\n// Send given element all the way to the front\nexport function front() {\n const p = this.parent()\n\n // Move node forward\n p.add(this.remove())\n\n return this\n}\n\n// Send given element all the way to the back\nexport function back() {\n const p = this.parent()\n\n // Move node back\n p.add(this.remove(), 0)\n\n return this\n}\n\n// Inserts a given element before the targeted element\nexport function before(element) {\n element = makeInstance(element)\n element.remove()\n\n const i = this.position()\n\n this.parent().add(element, i)\n\n return this\n}\n\n// Inserts a given element after the targeted element\nexport function after(element) {\n element = makeInstance(element)\n element.remove()\n\n const i = this.position()\n\n this.parent().add(element, i + 1)\n\n return this\n}\n\nexport function insertBefore(element) {\n element = makeInstance(element)\n element.before(this)\n return this\n}\n\nexport function insertAfter(element) {\n element = makeInstance(element)\n element.after(this)\n return this\n}\n\nregisterMethods('Dom', {\n siblings,\n position,\n next,\n prev,\n forward,\n backward,\n front,\n back,\n before,\n after,\n insertBefore,\n insertAfter\n})\n","// Parse unit value\nexport const numberAndUnit =\n /^([+-]?(\\d+(\\.\\d*)?|\\.\\d+)(e[+-]?\\d+)?)([a-z%]*)$/i\n\n// Parse hex value\nexport const hex = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i\n\n// Parse rgb value\nexport const rgb = /rgb\\((\\d+),(\\d+),(\\d+)\\)/\n\n// Parse reference id\nexport const reference = /(#[a-z_][a-z0-9\\-_]*)/i\n\n// splits a transformation chain\nexport const transforms = /\\)\\s*,?\\s*/\n\n// Whitespace\nexport const whitespace = /\\s/g\n\n// Test hex value\nexport const isHex = /^#[a-f0-9]{3}$|^#[a-f0-9]{6}$/i\n\n// Test rgb value\nexport const isRgb = /^rgb\\(/\n\n// Test for blank string\nexport const isBlank = /^(\\s+)?$/\n\n// Test for numeric string\nexport const isNumber = /^[+-]?(\\d+(\\.\\d*)?|\\.\\d+)(e[+-]?\\d+)?$/i\n\n// Test for image url\nexport const isImage = /\\.(jpg|jpeg|png|gif|svg)(\\?[^=]+.*)?/i\n\n// split at whitespace and comma\nexport const delimiter = /[\\s,]+/\n\n// Test for path letter\nexport const isPathLetter = /[MLHVCSQTAZ]/i\n","import { hex, isHex, isRgb, rgb, whitespace } from '../modules/core/regex.js'\n\nfunction sixDigitHex(hex) {\n return hex.length === 4\n ? [\n '#',\n hex.substring(1, 2),\n hex.substring(1, 2),\n hex.substring(2, 3),\n hex.substring(2, 3),\n hex.substring(3, 4),\n hex.substring(3, 4)\n ].join('')\n : hex\n}\n\nfunction componentHex(component) {\n const integer = Math.round(component)\n const bounded = Math.max(0, Math.min(255, integer))\n const hex = bounded.toString(16)\n return hex.length === 1 ? '0' + hex : hex\n}\n\nfunction is(object, space) {\n for (let i = space.length; i--; ) {\n if (object[space[i]] == null) {\n return false\n }\n }\n return true\n}\n\nfunction getParameters(a, b) {\n const params = is(a, 'rgb')\n ? { _a: a.r, _b: a.g, _c: a.b, _d: 0, space: 'rgb' }\n : is(a, 'xyz')\n ? { _a: a.x, _b: a.y, _c: a.z, _d: 0, space: 'xyz' }\n : is(a, 'hsl')\n ? { _a: a.h, _b: a.s, _c: a.l, _d: 0, space: 'hsl' }\n : is(a, 'lab')\n ? { _a: a.l, _b: a.a, _c: a.b, _d: 0, space: 'lab' }\n : is(a, 'lch')\n ? { _a: a.l, _b: a.c, _c: a.h, _d: 0, space: 'lch' }\n : is(a, 'cmyk')\n ? { _a: a.c, _b: a.m, _c: a.y, _d: a.k, space: 'cmyk' }\n : { _a: 0, _b: 0, _c: 0, space: 'rgb' }\n\n params.space = b || params.space\n return params\n}\n\nfunction cieSpace(space) {\n if (space === 'lab' || space === 'xyz' || space === 'lch') {\n return true\n } else {\n return false\n }\n}\n\nfunction hueToRgb(p, q, t) {\n if (t < 0) t += 1\n if (t > 1) t -= 1\n if (t < 1 / 6) return p + (q - p) * 6 * t\n if (t < 1 / 2) return q\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6\n return p\n}\n\nexport default class Color {\n constructor(...inputs) {\n this.init(...inputs)\n }\n\n // Test if given value is a color\n static isColor(color) {\n return (\n color && (color instanceof Color || this.isRgb(color) || this.test(color))\n )\n }\n\n // Test if given value is an rgb object\n static isRgb(color) {\n return (\n color &&\n typeof color.r === 'number' &&\n typeof color.g === 'number' &&\n typeof color.b === 'number'\n )\n }\n\n /*\n Generating random colors\n */\n static random(mode = 'vibrant', t) {\n // Get the math modules\n const { random, round, sin, PI: pi } = Math\n\n // Run the correct generator\n if (mode === 'vibrant') {\n const l = (81 - 57) * random() + 57\n const c = (83 - 45) * random() + 45\n const h = 360 * random()\n const color = new Color(l, c, h, 'lch')\n return color\n } else if (mode === 'sine') {\n t = t == null ? random() : t\n const r = round(80 * sin((2 * pi * t) / 0.5 + 0.01) + 150)\n const g = round(50 * sin((2 * pi * t) / 0.5 + 4.6) + 200)\n const b = round(100 * sin((2 * pi * t) / 0.5 + 2.3) + 150)\n const color = new Color(r, g, b)\n return color\n } else if (mode === 'pastel') {\n const l = (94 - 86) * random() + 86\n const c = (26 - 9) * random() + 9\n const h = 360 * random()\n const color = new Color(l, c, h, 'lch')\n return color\n } else if (mode === 'dark') {\n const l = 10 + 10 * random()\n const c = (125 - 75) * random() + 86\n const h = 360 * random()\n const color = new Color(l, c, h, 'lch')\n return color\n } else if (mode === 'rgb') {\n const r = 255 * random()\n const g = 255 * random()\n const b = 255 * random()\n const color = new Color(r, g, b)\n return color\n } else if (mode === 'lab') {\n const l = 100 * random()\n const a = 256 * random() - 128\n const b = 256 * random() - 128\n const color = new Color(l, a, b, 'lab')\n return color\n } else if (mode === 'grey') {\n const grey = 255 * random()\n const color = new Color(grey, grey, grey)\n return color\n } else {\n throw new Error('Unsupported random color mode')\n }\n }\n\n // Test if given value is a color string\n static test(color) {\n return typeof color === 'string' && (isHex.test(color) || isRgb.test(color))\n }\n\n cmyk() {\n // Get the rgb values for the current color\n const { _a, _b, _c } = this.rgb()\n const [r, g, b] = [_a, _b, _c].map((v) => v / 255)\n\n // Get the cmyk values in an unbounded format\n const k = Math.min(1 - r, 1 - g, 1 - b)\n\n if (k === 1) {\n // Catch the black case\n return new Color(0, 0, 0, 1, 'cmyk')\n }\n\n const c = (1 - r - k) / (1 - k)\n const m = (1 - g - k) / (1 - k)\n const y = (1 - b - k) / (1 - k)\n\n // Construct the new color\n const color = new Color(c, m, y, k, 'cmyk')\n return color\n }\n\n hsl() {\n // Get the rgb values\n const { _a, _b, _c } = this.rgb()\n const [r, g, b] = [_a, _b, _c].map((v) => v / 255)\n\n // Find the maximum and minimum values to get the lightness\n const max = Math.max(r, g, b)\n const min = Math.min(r, g, b)\n const l = (max + min) / 2\n\n // If the r, g, v values are identical then we are grey\n const isGrey = max === min\n\n // Calculate the hue and saturation\n const delta = max - min\n const s = isGrey\n ? 0\n : l > 0.5\n ? delta / (2 - max - min)\n : delta / (max + min)\n const h = isGrey\n ? 0\n : max === r\n ? ((g - b) / delta + (g < b ? 6 : 0)) / 6\n : max === g\n ? ((b - r) / delta + 2) / 6\n : max === b\n ? ((r - g) / delta + 4) / 6\n : 0\n\n // Construct and return the new color\n const color = new Color(360 * h, 100 * s, 100 * l, 'hsl')\n return color\n }\n\n init(a = 0, b = 0, c = 0, d = 0, space = 'rgb') {\n // This catches the case when a falsy value is passed like ''\n a = !a ? 0 : a\n\n // Reset all values in case the init function is rerun with new color space\n if (this.space) {\n for (const component in this.space) {\n delete this[this.space[component]]\n }\n }\n\n if (typeof a === 'number') {\n // Allow for the case that we don't need d...\n space = typeof d === 'string' ? d : space\n d = typeof d === 'string' ? 0 : d\n\n // Assign the values straight to the color\n Object.assign(this, { _a: a, _b: b, _c: c, _d: d, space })\n // If the user gave us an array, make the color from it\n } else if (a instanceof Array) {\n this.space = b || (typeof a[3] === 'string' ? a[3] : a[4]) || 'rgb'\n Object.assign(this, { _a: a[0], _b: a[1], _c: a[2], _d: a[3] || 0 })\n } else if (a instanceof Object) {\n // Set the object up and assign its values directly\n const values = getParameters(a, b)\n Object.assign(this, values)\n } else if (typeof a === 'string') {\n if (isRgb.test(a)) {\n const noWhitespace = a.replace(whitespace, '')\n const [_a, _b, _c] = rgb\n .exec(noWhitespace)\n .slice(1, 4)\n .map((v) => parseInt(v))\n Object.assign(this, { _a, _b, _c, _d: 0, space: 'rgb' })\n } else if (isHex.test(a)) {\n const hexParse = (v) => parseInt(v, 16)\n const [, _a, _b, _c] = hex.exec(sixDigitHex(a)).map(hexParse)\n Object.assign(this, { _a, _b, _c, _d: 0, space: 'rgb' })\n } else throw Error(\"Unsupported string format, can't construct Color\")\n }\n\n // Now add the components as a convenience\n const { _a, _b, _c, _d } = this\n const components =\n this.space === 'rgb'\n ? { r: _a, g: _b, b: _c }\n : this.space === 'xyz'\n ? { x: _a, y: _b, z: _c }\n : this.space === 'hsl'\n ? { h: _a, s: _b, l: _c }\n : this.space === 'lab'\n ? { l: _a, a: _b, b: _c }\n : this.space === 'lch'\n ? { l: _a, c: _b, h: _c }\n : this.space === 'cmyk'\n ? { c: _a, m: _b, y: _c, k: _d }\n : {}\n Object.assign(this, components)\n }\n\n lab() {\n // Get the xyz color\n const { x, y, z } = this.xyz()\n\n // Get the lab components\n const l = 116 * y - 16\n const a = 500 * (x - y)\n const b = 200 * (y - z)\n\n // Construct and return a new color\n const color = new Color(l, a, b, 'lab')\n return color\n }\n\n lch() {\n // Get the lab color directly\n const { l, a, b } = this.lab()\n\n // Get the chromaticity and the hue using polar coordinates\n const c = Math.sqrt(a ** 2 + b ** 2)\n let h = (180 * Math.atan2(b, a)) / Math.PI\n if (h < 0) {\n h *= -1\n h = 360 - h\n }\n\n // Make a new color and return it\n const color = new Color(l, c, h, 'lch')\n return color\n }\n /*\n Conversion Methods\n */\n\n rgb() {\n if (this.space === 'rgb') {\n return this\n } else if (cieSpace(this.space)) {\n // Convert to the xyz color space\n let { x, y, z } = this\n if (this.space === 'lab' || this.space === 'lch') {\n // Get the values in the lab space\n let { l, a, b } = this\n if (this.space === 'lch') {\n const { c, h } = this\n const dToR = Math.PI / 180\n a = c * Math.cos(dToR * h)\n b = c * Math.sin(dToR * h)\n }\n\n // Undo the nonlinear function\n const yL = (l + 16) / 116\n const xL = a / 500 + yL\n const zL = yL - b / 200\n\n // Get the xyz values\n const ct = 16 / 116\n const mx = 0.008856\n const nm = 7.787\n x = 0.95047 * (xL ** 3 > mx ? xL ** 3 : (xL - ct) / nm)\n y = 1.0 * (yL ** 3 > mx ? yL ** 3 : (yL - ct) / nm)\n z = 1.08883 * (zL ** 3 > mx ? zL ** 3 : (zL - ct) / nm)\n }\n\n // Convert xyz to unbounded rgb values\n const rU = x * 3.2406 + y * -1.5372 + z * -0.4986\n const gU = x * -0.9689 + y * 1.8758 + z * 0.0415\n const bU = x * 0.0557 + y * -0.204 + z * 1.057\n\n // Convert the values to true rgb values\n const pow = Math.pow\n const bd = 0.0031308\n const r = rU > bd ? 1.055 * pow(rU, 1 / 2.4) - 0.055 : 12.92 * rU\n const g = gU > bd ? 1.055 * pow(gU, 1 / 2.4) - 0.055 : 12.92 * gU\n const b = bU > bd ? 1.055 * pow(bU, 1 / 2.4) - 0.055 : 12.92 * bU\n\n // Make and return the color\n const color = new Color(255 * r, 255 * g, 255 * b)\n return color\n } else if (this.space === 'hsl') {\n // https://bgrins.github.io/TinyColor/docs/tinycolor.html\n // Get the current hsl values\n let { h, s, l } = this\n h /= 360\n s /= 100\n l /= 100\n\n // If we are grey, then just make the color directly\n if (s === 0) {\n l *= 255\n const color = new Color(l, l, l)\n return color\n }\n\n // TODO I have no idea what this does :D If you figure it out, tell me!\n const q = l < 0.5 ? l * (1 + s) : l + s - l * s\n const p = 2 * l - q\n\n // Get the rgb values\n const r = 255 * hueToRgb(p, q, h + 1 / 3)\n const g = 255 * hueToRgb(p, q, h)\n const b = 255 * hueToRgb(p, q, h - 1 / 3)\n\n // Make a new color\n const color = new Color(r, g, b)\n return color\n } else if (this.space === 'cmyk') {\n // https://gist.github.com/felipesabino/5066336\n // Get the normalised cmyk values\n const { c, m, y, k } = this\n\n // Get the rgb values\n const r = 255 * (1 - Math.min(1, c * (1 - k) + k))\n const g = 255 * (1 - Math.min(1, m * (1 - k) + k))\n const b = 255 * (1 - Math.min(1, y * (1 - k) + k))\n\n // Form the color and return it\n const color = new Color(r, g, b)\n return color\n } else {\n return this\n }\n }\n\n toArray() {\n const { _a, _b, _c, _d, space } = this\n return [_a, _b, _c, _d, space]\n }\n\n toHex() {\n const [r, g, b] = this._clamped().map(componentHex)\n return `#${r}${g}${b}`\n }\n\n toRgb() {\n const [rV, gV, bV] = this._clamped()\n const string = `rgb(${rV},${gV},${bV})`\n return string\n }\n\n toString() {\n return this.toHex()\n }\n\n xyz() {\n // Normalise the red, green and blue values\n const { _a: r255, _b: g255, _c: b255 } = this.rgb()\n const [r, g, b] = [r255, g255, b255].map((v) => v / 255)\n\n // Convert to the lab rgb space\n const rL = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92\n const gL = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92\n const bL = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92\n\n // Convert to the xyz color space without bounding the values\n const xU = (rL * 0.4124 + gL * 0.3576 + bL * 0.1805) / 0.95047\n const yU = (rL * 0.2126 + gL * 0.7152 + bL * 0.0722) / 1.0\n const zU = (rL * 0.0193 + gL * 0.1192 + bL * 0.9505) / 1.08883\n\n // Get the proper xyz values by applying the bounding\n const x = xU > 0.008856 ? Math.pow(xU, 1 / 3) : 7.787 * xU + 16 / 116\n const y = yU > 0.008856 ? Math.pow(yU, 1 / 3) : 7.787 * yU + 16 / 116\n const z = zU > 0.008856 ? Math.pow(zU, 1 / 3) : 7.787 * zU + 16 / 116\n\n // Make and return the color\n const color = new Color(x, y, z, 'xyz')\n return color\n }\n\n /*\n Input and Output methods\n */\n\n _clamped() {\n const { _a, _b, _c } = this.rgb()\n const { max, min, round } = Math\n const format = (v) => max(0, min(round(v), 255))\n return [_a, _b, _c].map(format)\n }\n\n /*\n Constructing colors\n */\n}\n","import { delimiter } from '../core/regex.js'\nimport { registerMethods } from '../../utils/methods.js'\n\n// Return array of classes on the node\nexport function classes() {\n const attr = this.attr('class')\n return attr == null ? [] : attr.trim().split(delimiter)\n}\n\n// Return true if class exists on the node, false otherwise\nexport function hasClass(name) {\n return this.classes().indexOf(name) !== -1\n}\n\n// Add class to the node\nexport function addClass(name) {\n if (!this.hasClass(name)) {\n const array = this.classes()\n array.push(name)\n this.attr('class', array.join(' '))\n }\n\n return this\n}\n\n// Remove class from the node\nexport function removeClass(name) {\n if (this.hasClass(name)) {\n this.attr(\n 'class',\n this.classes()\n .filter(function (c) {\n return c !== name\n })\n .join(' ')\n )\n }\n\n return this\n}\n\n// Toggle the presence of a class on the node\nexport function toggleClass(name) {\n return this.hasClass(name) ? this.removeClass(name) : this.addClass(name)\n}\n\nregisterMethods('Dom', {\n classes,\n hasClass,\n addClass,\n removeClass,\n toggleClass\n})\n","import { isBlank } from '../core/regex.js'\nimport { registerMethods } from '../../utils/methods.js'\n\n// Dynamic style generator\nexport function css(style, val) {\n const ret = {}\n if (arguments.length === 0) {\n // get full style as object\n this.node.style.cssText\n .split(/\\s*;\\s*/)\n .filter(function (el) {\n return !!el.length\n })\n .forEach(function (el) {\n const t = el.split(/\\s*:\\s*/)\n ret[t[0]] = t[1]\n })\n return ret\n }\n\n if (arguments.length < 2) {\n // get style properties as array\n if (Array.isArray(style)) {\n for (const name of style) {\n const cased = name\n ret[name] = this.node.style.getPropertyValue(cased)\n }\n return ret\n }\n\n // get style for property\n if (typeof style === 'string') {\n return this.node.style.getPropertyValue(style)\n }\n\n // set styles in object\n if (typeof style === 'object') {\n for (const name in style) {\n // set empty string if null/undefined/'' was given\n this.node.style.setProperty(\n name,\n style[name] == null || isBlank.test(style[name]) ? '' : style[name]\n )\n }\n }\n }\n\n // set style for property\n if (arguments.length === 2) {\n this.node.style.setProperty(\n style,\n val == null || isBlank.test(val) ? '' : val\n )\n }\n\n return this\n}\n\n// Show element\nexport function show() {\n return this.css('display', '')\n}\n\n// Hide element\nexport function hide() {\n return this.css('display', 'none')\n}\n\n// Is element visible?\nexport function visible() {\n return this.css('display') !== 'none'\n}\n\nregisterMethods('Dom', {\n css,\n show,\n hide,\n visible\n})\n","import { registerMethods } from '../../utils/methods.js'\nimport { filter, map } from '../../utils/utils.js'\n\n// Store data values on svg nodes\nexport function data(a, v, r) {\n if (a == null) {\n // get an object of attributes\n return this.data(\n map(\n filter(\n this.node.attributes,\n (el) => el.nodeName.indexOf('data-') === 0\n ),\n (el) => el.nodeName.slice(5)\n )\n )\n } else if (a instanceof Array) {\n const data = {}\n for (const key of a) {\n data[key] = this.data(key)\n }\n return data\n } else if (typeof a === 'object') {\n for (v in a) {\n this.data(v, a[v])\n }\n } else if (arguments.length < 2) {\n try {\n return JSON.parse(this.attr('data-' + a))\n } catch (e) {\n return this.attr('data-' + a)\n }\n } else {\n this.attr(\n 'data-' + a,\n v === null\n ? null\n : r === true || typeof v === 'string' || typeof v === 'number'\n ? v\n : JSON.stringify(v)\n )\n }\n\n return this\n}\n\nregisterMethods('Dom', { data })\n","import { registerMethods } from '../../utils/methods.js'\n\n// Remember arbitrary data\nexport function remember(k, v) {\n // remember every item in an object individually\n if (typeof arguments[0] === 'object') {\n for (const key in k) {\n this.remember(key, k[key])\n }\n } else if (arguments.length === 1) {\n // retrieve memory\n return this.memory()[k]\n } else {\n // store memory\n this.memory()[k] = v\n }\n\n return this\n}\n\n// Erase a given memory\nexport function forget() {\n if (arguments.length === 0) {\n this._memory = {}\n } else {\n for (let i = arguments.length - 1; i >= 0; i--) {\n delete this.memory()[arguments[i]]\n }\n }\n return this\n}\n\n// This triggers creation of a new hidden class which is not performant\n// However, this function is not rarely used so it will not happen frequently\n// Return local memory object\nexport function memory() {\n return (this._memory = this._memory || {})\n}\n\nregisterMethods('Dom', { remember, forget, memory })\n","import Matrix from './Matrix.js'\n\nexport default class Point {\n // Initialize\n constructor(...args) {\n this.init(...args)\n }\n\n // Clone point\n clone() {\n return new Point(this)\n }\n\n init(x, y) {\n const base = { x: 0, y: 0 }\n\n // ensure source as object\n const source = Array.isArray(x)\n ? { x: x[0], y: x[1] }\n : typeof x === 'object'\n ? { x: x.x, y: x.y }\n : { x: x, y: y }\n\n // merge source\n this.x = source.x == null ? base.x : source.x\n this.y = source.y == null ? base.y : source.y\n\n return this\n }\n\n toArray() {\n return [this.x, this.y]\n }\n\n transform(m) {\n return this.clone().transformO(m)\n }\n\n // Transform point with matrix\n transformO(m) {\n if (!Matrix.isMatrixLike(m)) {\n m = new Matrix(m)\n }\n\n const { x, y } = this\n\n // Perform the matrix multiplication\n this.x = m.a * x + m.c * y + m.e\n this.y = m.b * x + m.d * y + m.f\n\n return this\n }\n}\n\nexport function point(x, y) {\n return new Point(x, y).transformO(this.screenCTM().inverseO())\n}\n","import { delimiter } from '../modules/core/regex.js'\nimport { radians } from '../utils/utils.js'\nimport { register } from '../utils/adopter.js'\nimport Element from '../elements/Element.js'\nimport Point from './Point.js'\n\nfunction closeEnough(a, b, threshold) {\n return Math.abs(b - a) < (threshold || 1e-6)\n}\n\nexport default class Matrix {\n constructor(...args) {\n this.init(...args)\n }\n\n static formatTransforms(o) {\n // Get all of the parameters required to form the matrix\n const flipBoth = o.flip === 'both' || o.flip === true\n const flipX = o.flip && (flipBoth || o.flip === 'x') ? -1 : 1\n const flipY = o.flip && (flipBoth || o.flip === 'y') ? -1 : 1\n const skewX =\n o.skew && o.skew.length\n ? o.skew[0]\n : isFinite(o.skew)\n ? o.skew\n : isFinite(o.skewX)\n ? o.skewX\n : 0\n const skewY =\n o.skew && o.skew.length\n ? o.skew[1]\n : isFinite(o.skew)\n ? o.skew\n : isFinite(o.skewY)\n ? o.skewY\n : 0\n const scaleX =\n o.scale && o.scale.length\n ? o.scale[0] * flipX\n : isFinite(o.scale)\n ? o.scale * flipX\n : isFinite(o.scaleX)\n ? o.scaleX * flipX\n : flipX\n const scaleY =\n o.scale && o.scale.length\n ? o.scale[1] * flipY\n : isFinite(o.scale)\n ? o.scale * flipY\n : isFinite(o.scaleY)\n ? o.scaleY * flipY\n : flipY\n const shear = o.shear || 0\n const theta = o.rotate || o.theta || 0\n const origin = new Point(\n o.origin || o.around || o.ox || o.originX,\n o.oy || o.originY\n )\n const ox = origin.x\n const oy = origin.y\n // We need Point to be invalid if nothing was passed because we cannot default to 0 here. That is why NaN\n const position = new Point(\n o.position || o.px || o.positionX || NaN,\n o.py || o.positionY || NaN\n )\n const px = position.x\n const py = position.y\n const translate = new Point(\n o.translate || o.tx || o.translateX,\n o.ty || o.translateY\n )\n const tx = translate.x\n const ty = translate.y\n const relative = new Point(\n o.relative || o.rx || o.relativeX,\n o.ry || o.relativeY\n )\n const rx = relative.x\n const ry = relative.y\n\n // Populate all of the values\n return {\n scaleX,\n scaleY,\n skewX,\n skewY,\n shear,\n theta,\n rx,\n ry,\n tx,\n ty,\n ox,\n oy,\n px,\n py\n }\n }\n\n static fromArray(a) {\n return { a: a[0], b: a[1], c: a[2], d: a[3], e: a[4], f: a[5] }\n }\n\n static isMatrixLike(o) {\n return (\n o.a != null ||\n o.b != null ||\n o.c != null ||\n o.d != null ||\n o.e != null ||\n o.f != null\n )\n }\n\n // left matrix, right matrix, target matrix which is overwritten\n static matrixMultiply(l, r, o) {\n // Work out the product directly\n const a = l.a * r.a + l.c * r.b\n const b = l.b * r.a + l.d * r.b\n const c = l.a * r.c + l.c * r.d\n const d = l.b * r.c + l.d * r.d\n const e = l.e + l.a * r.e + l.c * r.f\n const f = l.f + l.b * r.e + l.d * r.f\n\n // make sure to use local variables because l/r and o could be the same\n o.a = a\n o.b = b\n o.c = c\n o.d = d\n o.e = e\n o.f = f\n\n return o\n }\n\n around(cx, cy, matrix) {\n return this.clone().aroundO(cx, cy, matrix)\n }\n\n // Transform around a center point\n aroundO(cx, cy, matrix) {\n const dx = cx || 0\n const dy = cy || 0\n return this.translateO(-dx, -dy).lmultiplyO(matrix).translateO(dx, dy)\n }\n\n // Clones this matrix\n clone() {\n return new Matrix(this)\n }\n\n // Decomposes this matrix into its affine parameters\n decompose(cx = 0, cy = 0) {\n // Get the parameters from the matrix\n const a = this.a\n const b = this.b\n const c = this.c\n const d = this.d\n const e = this.e\n const f = this.f\n\n // Figure out if the winding direction is clockwise or counterclockwise\n const determinant = a * d - b * c\n const ccw = determinant > 0 ? 1 : -1\n\n // Since we only shear in x, we can use the x basis to get the x scale\n // and the rotation of the resulting matrix\n const sx = ccw * Math.sqrt(a * a + b * b)\n const thetaRad = Math.atan2(ccw * b, ccw * a)\n const theta = (180 / Math.PI) * thetaRad\n const ct = Math.cos(thetaRad)\n const st = Math.sin(thetaRad)\n\n // We can then solve the y basis vector simultaneously to get the other\n // two affine parameters directly from these parameters\n const lam = (a * c + b * d) / determinant\n const sy = (c * sx) / (lam * a - b) || (d * sx) / (lam * b + a)\n\n // Use the translations\n const tx = e - cx + cx * ct * sx + cy * (lam * ct * sx - st * sy)\n const ty = f - cy + cx * st * sx + cy * (lam * st * sx + ct * sy)\n\n // Construct the decomposition and return it\n return {\n // Return the affine parameters\n scaleX: sx,\n scaleY: sy,\n shear: lam,\n rotate: theta,\n translateX: tx,\n translateY: ty,\n originX: cx,\n originY: cy,\n\n // Return the matrix parameters\n a: this.a,\n b: this.b,\n c: this.c,\n d: this.d,\n e: this.e,\n f: this.f\n }\n }\n\n // Check if two matrices are equal\n equals(other) {\n if (other === this) return true\n const comp = new Matrix(other)\n return (\n closeEnough(this.a, comp.a) &&\n closeEnough(this.b, comp.b) &&\n closeEnough(this.c, comp.c) &&\n closeEnough(this.d, comp.d) &&\n closeEnough(this.e, comp.e) &&\n closeEnough(this.f, comp.f)\n )\n }\n\n // Flip matrix on x or y, at a given offset\n flip(axis, around) {\n return this.clone().flipO(axis, around)\n }\n\n flipO(axis, around) {\n return axis === 'x'\n ? this.scaleO(-1, 1, around, 0)\n : axis === 'y'\n ? this.scaleO(1, -1, 0, around)\n : this.scaleO(-1, -1, axis, around || axis) // Define an x, y flip point\n }\n\n // Initialize\n init(source) {\n const base = Matrix.fromArray([1, 0, 0, 1, 0, 0])\n\n // ensure source as object\n source =\n source instanceof Element\n ? source.matrixify()\n : typeof source === 'string'\n ? Matrix.fromArray(source.split(delimiter).map(parseFloat))\n : Array.isArray(source)\n ? Matrix.fromArray(source)\n : typeof source === 'object' && Matrix.isMatrixLike(source)\n ? source\n : typeof source === 'object'\n ? new Matrix().transform(source)\n : arguments.length === 6\n ? Matrix.fromArray([].slice.call(arguments))\n : base\n\n // Merge the source matrix with the base matrix\n this.a = source.a != null ? source.a : base.a\n this.b = source.b != null ? source.b : base.b\n this.c = source.c != null ? source.c : base.c\n this.d = source.d != null ? source.d : base.d\n this.e = source.e != null ? source.e : base.e\n this.f = source.f != null ? source.f : base.f\n\n return this\n }\n\n inverse() {\n return this.clone().inverseO()\n }\n\n // Inverses matrix\n inverseO() {\n // Get the current parameters out of the matrix\n const a = this.a\n const b = this.b\n const c = this.c\n const d = this.d\n const e = this.e\n const f = this.f\n\n // Invert the 2x2 matrix in the top left\n const det = a * d - b * c\n if (!det) throw new Error('Cannot invert ' + this)\n\n // Calculate the top 2x2 matrix\n const na = d / det\n const nb = -b / det\n const nc = -c / det\n const nd = a / det\n\n // Apply the inverted matrix to the top right\n const ne = -(na * e + nc * f)\n const nf = -(nb * e + nd * f)\n\n // Construct the inverted matrix\n this.a = na\n this.b = nb\n this.c = nc\n this.d = nd\n this.e = ne\n this.f = nf\n\n return this\n }\n\n lmultiply(matrix) {\n return this.clone().lmultiplyO(matrix)\n }\n\n lmultiplyO(matrix) {\n const r = this\n const l = matrix instanceof Matrix ? matrix : new Matrix(matrix)\n\n return Matrix.matrixMultiply(l, r, this)\n }\n\n // Left multiplies by the given matrix\n multiply(matrix) {\n return this.clone().multiplyO(matrix)\n }\n\n multiplyO(matrix) {\n // Get the matrices\n const l = this\n const r = matrix instanceof Matrix ? matrix : new Matrix(matrix)\n\n return Matrix.matrixMultiply(l, r, this)\n }\n\n // Rotate matrix\n rotate(r, cx, cy) {\n return this.clone().rotateO(r, cx, cy)\n }\n\n rotateO(r, cx = 0, cy = 0) {\n // Convert degrees to radians\n r = radians(r)\n\n const cos = Math.cos(r)\n const sin = Math.sin(r)\n\n const { a, b, c, d, e, f } = this\n\n this.a = a * cos - b * sin\n this.b = b * cos + a * sin\n this.c = c * cos - d * sin\n this.d = d * cos + c * sin\n this.e = e * cos - f * sin + cy * sin - cx * cos + cx\n this.f = f * cos + e * sin - cx * sin - cy * cos + cy\n\n return this\n }\n\n // Scale matrix\n scale() {\n return this.clone().scaleO(...arguments)\n }\n\n scaleO(x, y = x, cx = 0, cy = 0) {\n // Support uniform scaling\n if (arguments.length === 3) {\n cy = cx\n cx = y\n y = x\n }\n\n const { a, b, c, d, e, f } = this\n\n this.a = a * x\n this.b = b * y\n this.c = c * x\n this.d = d * y\n this.e = e * x - cx * x + cx\n this.f = f * y - cy * y + cy\n\n return this\n }\n\n // Shear matrix\n shear(a, cx, cy) {\n return this.clone().shearO(a, cx, cy)\n }\n\n // eslint-disable-next-line no-unused-vars\n shearO(lx, cx = 0, cy = 0) {\n const { a, b, c, d, e, f } = this\n\n this.a = a + b * lx\n this.c = c + d * lx\n this.e = e + f * lx - cy * lx\n\n return this\n }\n\n // Skew Matrix\n skew() {\n return this.clone().skewO(...arguments)\n }\n\n skewO(x, y = x, cx = 0, cy = 0) {\n // support uniformal skew\n if (arguments.length === 3) {\n cy = cx\n cx = y\n y = x\n }\n\n // Convert degrees to radians\n x = radians(x)\n y = radians(y)\n\n const lx = Math.tan(x)\n const ly = Math.tan(y)\n\n const { a, b, c, d, e, f } = this\n\n this.a = a + b * lx\n this.b = b + a * ly\n this.c = c + d * lx\n this.d = d + c * ly\n this.e = e + f * lx - cy * lx\n this.f = f + e * ly - cx * ly\n\n return this\n }\n\n // SkewX\n skewX(x, cx, cy) {\n return this.skew(x, 0, cx, cy)\n }\n\n // SkewY\n skewY(y, cx, cy) {\n return this.skew(0, y, cx, cy)\n }\n\n toArray() {\n return [this.a, this.b, this.c, this.d, this.e, this.f]\n }\n\n // Convert matrix to string\n toString() {\n return (\n 'matrix(' +\n this.a +\n ',' +\n this.b +\n ',' +\n this.c +\n ',' +\n this.d +\n ',' +\n this.e +\n ',' +\n this.f +\n ')'\n )\n }\n\n // Transform a matrix into another matrix by manipulating the space\n transform(o) {\n // Check if o is a matrix and then left multiply it directly\n if (Matrix.isMatrixLike(o)) {\n const matrix = new Matrix(o)\n return matrix.multiplyO(this)\n }\n\n // Get the proposed transformations and the current transformations\n const t = Matrix.formatTransforms(o)\n const current = this\n const { x: ox, y: oy } = new Point(t.ox, t.oy).transform(current)\n\n // Construct the resulting matrix\n const transformer = new Matrix()\n .translateO(t.rx, t.ry)\n .lmultiplyO(current)\n .translateO(-ox, -oy)\n .scaleO(t.scaleX, t.scaleY)\n .skewO(t.skewX, t.skewY)\n .shearO(t.shear)\n .rotateO(t.theta)\n .translateO(ox, oy)\n\n // If we want the origin at a particular place, we force it there\n if (isFinite(t.px) || isFinite(t.py)) {\n const origin = new Point(ox, oy).transform(transformer)\n // TODO: Replace t.px with isFinite(t.px)\n // Doesn't work because t.px is also 0 if it wasn't passed\n const dx = isFinite(t.px) ? t.px - origin.x : 0\n const dy = isFinite(t.py) ? t.py - origin.y : 0\n transformer.translateO(dx, dy)\n }\n\n // Translate now after positioning\n transformer.translateO(t.tx, t.ty)\n return transformer\n }\n\n // Translate matrix\n translate(x, y) {\n return this.clone().translateO(x, y)\n }\n\n translateO(x, y) {\n this.e += x || 0\n this.f += y || 0\n return this\n }\n\n valueOf() {\n return {\n a: this.a,\n b: this.b,\n c: this.c,\n d: this.d,\n e: this.e,\n f: this.f\n }\n }\n}\n\nexport function ctm() {\n return new Matrix(this.node.getCTM())\n}\n\nexport function screenCTM() {\n try {\n /* https://bugzilla.mozilla.org/show_bug.cgi?id=1344537\n This is needed because FF does not return the transformation matrix\n for the inner coordinate system when getScreenCTM() is called on nested svgs.\n However all other Browsers do that */\n if (typeof this.isRoot === 'function' && !this.isRoot()) {\n const rect = this.rect(1, 1)\n const m = rect.node.getScreenCTM()\n rect.remove()\n return new Matrix(m)\n }\n return new Matrix(this.node.getScreenCTM())\n } catch (e) {\n console.warn(\n `Cannot get CTM from SVG node ${this.node.nodeName}. Is the element rendered?`\n )\n return new Matrix()\n }\n}\n\nregister(Matrix, 'Matrix')\n","import { globals } from '../../utils/window.js'\nimport { makeInstance } from '../../utils/adopter.js'\n\nexport default function parser() {\n // Reuse cached element if possible\n if (!parser.nodes) {\n const svg = makeInstance().size(2, 0)\n svg.node.style.cssText = [\n 'opacity: 0',\n 'position: absolute',\n 'left: -100%',\n 'top: -100%',\n 'overflow: hidden'\n ].join(';')\n\n svg.attr('focusable', 'false')\n svg.attr('aria-hidden', 'true')\n\n const path = svg.path().node\n\n parser.nodes = { svg, path }\n }\n\n if (!parser.nodes.svg.node.parentNode) {\n const b = globals.document.body || globals.document.documentElement\n parser.nodes.svg.addTo(b)\n }\n\n return parser.nodes\n}\n","import { delimiter } from '../modules/core/regex.js'\nimport { globals } from '../utils/window.js'\nimport { register } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Matrix from './Matrix.js'\nimport Point from './Point.js'\nimport parser from '../modules/core/parser.js'\n\nexport function isNulledBox(box) {\n return !box.width && !box.height && !box.x && !box.y\n}\n\nexport function domContains(node) {\n return (\n node === globals.document ||\n (\n globals.document.documentElement.contains ||\n function (node) {\n // This is IE - it does not support contains() for top-level SVGs\n while (node.parentNode) {\n node = node.parentNode\n }\n return node === globals.document\n }\n ).call(globals.document.documentElement, node)\n )\n}\n\nexport default class Box {\n constructor(...args) {\n this.init(...args)\n }\n\n addOffset() {\n // offset by window scroll position, because getBoundingClientRect changes when window is scrolled\n this.x += globals.window.pageXOffset\n this.y += globals.window.pageYOffset\n return new Box(this)\n }\n\n init(source) {\n const base = [0, 0, 0, 0]\n source =\n typeof source === 'string'\n ? source.split(delimiter).map(parseFloat)\n : Array.isArray(source)\n ? source\n : typeof source === 'object'\n ? [\n source.left != null ? source.left : source.x,\n source.top != null ? source.top : source.y,\n source.width,\n source.height\n ]\n : arguments.length === 4\n ? [].slice.call(arguments)\n : base\n\n this.x = source[0] || 0\n this.y = source[1] || 0\n this.width = this.w = source[2] || 0\n this.height = this.h = source[3] || 0\n\n // Add more bounding box properties\n this.x2 = this.x + this.w\n this.y2 = this.y + this.h\n this.cx = this.x + this.w / 2\n this.cy = this.y + this.h / 2\n\n return this\n }\n\n isNulled() {\n return isNulledBox(this)\n }\n\n // Merge rect box with another, return a new instance\n merge(box) {\n const x = Math.min(this.x, box.x)\n const y = Math.min(this.y, box.y)\n const width = Math.max(this.x + this.width, box.x + box.width) - x\n const height = Math.max(this.y + this.height, box.y + box.height) - y\n\n return new Box(x, y, width, height)\n }\n\n toArray() {\n return [this.x, this.y, this.width, this.height]\n }\n\n toString() {\n return this.x + ' ' + this.y + ' ' + this.width + ' ' + this.height\n }\n\n transform(m) {\n if (!(m instanceof Matrix)) {\n m = new Matrix(m)\n }\n\n let xMin = Infinity\n let xMax = -Infinity\n let yMin = Infinity\n let yMax = -Infinity\n\n const pts = [\n new Point(this.x, this.y),\n new Point(this.x2, this.y),\n new Point(this.x, this.y2),\n new Point(this.x2, this.y2)\n ]\n\n pts.forEach(function (p) {\n p = p.transform(m)\n xMin = Math.min(xMin, p.x)\n xMax = Math.max(xMax, p.x)\n yMin = Math.min(yMin, p.y)\n yMax = Math.max(yMax, p.y)\n })\n\n return new Box(xMin, yMin, xMax - xMin, yMax - yMin)\n }\n}\n\nfunction getBox(el, getBBoxFn, retry) {\n let box\n\n try {\n // Try to get the box with the provided function\n box = getBBoxFn(el.node)\n\n // If the box is worthless and not even in the dom, retry\n // by throwing an error here...\n if (isNulledBox(box) && !domContains(el.node)) {\n throw new Error('Element not in the dom')\n }\n } catch (e) {\n // ... and calling the retry handler here\n box = retry(el)\n }\n\n return box\n}\n\nexport function bbox() {\n // Function to get bbox is getBBox()\n const getBBox = (node) => node.getBBox()\n\n // Take all measures so that a stupid browser renders the element\n // so we can get the bbox from it when we try again\n const retry = (el) => {\n try {\n const clone = el.clone().addTo(parser().svg).show()\n const box = clone.node.getBBox()\n clone.remove()\n return box\n } catch (e) {\n // We give up...\n throw new Error(\n `Getting bbox of element \"${\n el.node.nodeName\n }\" is not possible: ${e.toString()}`\n )\n }\n }\n\n const box = getBox(this, getBBox, retry)\n const bbox = new Box(box)\n\n return bbox\n}\n\nexport function rbox(el) {\n const getRBox = (node) => node.getBoundingClientRect()\n const retry = (el) => {\n // There is no point in trying tricks here because if we insert the element into the dom ourselves\n // it obviously will be at the wrong position\n throw new Error(\n `Getting rbox of element \"${el.node.nodeName}\" is not possible`\n )\n }\n\n const box = getBox(this, getRBox, retry)\n const rbox = new Box(box)\n\n // If an element was passed, we want the bbox in the coordinate system of that element\n if (el) {\n return rbox.transform(el.screenCTM().inverseO())\n }\n\n // Else we want it in absolute screen coordinates\n // Therefore we need to add the scrollOffset\n return rbox.addOffset()\n}\n\n// Checks whether the given point is inside the bounding box\nexport function inside(x, y) {\n const box = this.bbox()\n\n return (\n x > box.x && y > box.y && x < box.x + box.width && y < box.y + box.height\n )\n}\n\nregisterMethods({\n viewbox: {\n viewbox(x, y, width, height) {\n // act as getter\n if (x == null) return new Box(this.attr('viewBox'))\n\n // act as setter\n return this.attr('viewBox', new Box(x, y, width, height))\n },\n\n zoom(level, point) {\n // Its best to rely on the attributes here and here is why:\n // clientXYZ: Doesn't work on non-root svgs because they dont have a CSSBox (silly!)\n // getBoundingClientRect: Doesn't work because Chrome just ignores width and height of nested svgs completely\n // that means, their clientRect is always as big as the content.\n // Furthermore this size is incorrect if the element is further transformed by its parents\n // computedStyle: Only returns meaningful values if css was used with px. We dont go this route here!\n // getBBox: returns the bounding box of its content - that doesn't help!\n let { width, height } = this.attr(['width', 'height'])\n\n // Width and height is a string when a number with a unit is present which we can't use\n // So we try clientXYZ\n if (\n (!width && !height) ||\n typeof width === 'string' ||\n typeof height === 'string'\n ) {\n width = this.node.clientWidth\n height = this.node.clientHeight\n }\n\n // Giving up...\n if (!width || !height) {\n throw new Error(\n 'Impossible to get absolute width and height. Please provide an absolute width and height attribute on the zooming element'\n )\n }\n\n const v = this.viewbox()\n\n const zoomX = width / v.width\n const zoomY = height / v.height\n const zoom = Math.min(zoomX, zoomY)\n\n if (level == null) {\n return zoom\n }\n\n let zoomAmount = zoom / level\n\n // Set the zoomAmount to the highest value which is safe to process and recover from\n // The * 100 is a bit of wiggle room for the matrix transformation\n if (zoomAmount === Infinity) zoomAmount = Number.MAX_SAFE_INTEGER / 100\n\n point =\n point || new Point(width / 2 / zoomX + v.x, height / 2 / zoomY + v.y)\n\n const box = new Box(v).transform(\n new Matrix({ scale: zoomAmount, origin: point })\n )\n\n return this.viewbox(box)\n }\n }\n})\n\nregister(Box, 'Box')\n","import { extend } from '../utils/adopter.js'\n// import { subClassArray } from './ArrayPolyfill.js'\n\nclass List extends Array {\n constructor(arr = [], ...args) {\n super(arr, ...args)\n if (typeof arr === 'number') return this\n this.length = 0\n this.push(...arr)\n }\n}\n\n/* = subClassArray('List', Array, function (arr = []) {\n // This catches the case, that native map tries to create an array with new Array(1)\n if (typeof arr === 'number') return this\n this.length = 0\n this.push(...arr)\n}) */\n\nexport default List\n\nextend([List], {\n each(fnOrMethodName, ...args) {\n if (typeof fnOrMethodName === 'function') {\n return this.map((el, i, arr) => {\n return fnOrMethodName.call(el, el, i, arr)\n })\n } else {\n return this.map((el) => {\n return el[fnOrMethodName](...args)\n })\n }\n },\n\n toArray() {\n return Array.prototype.concat.apply([], this)\n }\n})\n\nconst reserved = ['toArray', 'constructor', 'each']\n\nList.extend = function (methods) {\n methods = methods.reduce((obj, name) => {\n // Don't overwrite own methods\n if (reserved.includes(name)) return obj\n\n // Don't add private methods\n if (name[0] === '_') return obj\n\n // Allow access to original Array methods through a prefix\n if (name in Array.prototype) {\n obj['$' + name] = Array.prototype[name]\n }\n\n // Relay every call to each()\n obj[name] = function (...attrs) {\n return this.each(name, ...attrs)\n }\n return obj\n }, {})\n\n extend([List], methods)\n}\n","import { adopt } from '../../utils/adopter.js'\nimport { globals } from '../../utils/window.js'\nimport { map } from '../../utils/utils.js'\nimport List from '../../types/List.js'\n\nexport default function baseFind(query, parent) {\n return new List(\n map((parent || globals.document).querySelectorAll(query), function (node) {\n return adopt(node)\n })\n )\n}\n\n// Scoped find method\nexport function find(query) {\n return baseFind(query, this.node)\n}\n\nexport function findOne(query) {\n return adopt(this.node.querySelector(query))\n}\n","import { delimiter } from './regex.js'\nimport { makeInstance } from '../../utils/adopter.js'\nimport { globals } from '../../utils/window.js'\n\nlet listenerId = 0\nexport const windowEvents = {}\n\nexport function getEvents(instance) {\n let n = instance.getEventHolder()\n\n // We dont want to save events in global space\n if (n === globals.window) n = windowEvents\n if (!n.events) n.events = {}\n return n.events\n}\n\nexport function getEventTarget(instance) {\n return instance.getEventTarget()\n}\n\nexport function clearEvents(instance) {\n let n = instance.getEventHolder()\n if (n === globals.window) n = windowEvents\n if (n.events) n.events = {}\n}\n\n// Add event binder in the SVG namespace\nexport function on(node, events, listener, binding, options) {\n const l = listener.bind(binding || node)\n const instance = makeInstance(node)\n const bag = getEvents(instance)\n const n = getEventTarget(instance)\n\n // events can be an array of events or a string of events\n events = Array.isArray(events) ? events : events.split(delimiter)\n\n // add id to listener\n if (!listener._svgjsListenerId) {\n listener._svgjsListenerId = ++listenerId\n }\n\n events.forEach(function (event) {\n const ev = event.split('.')[0]\n const ns = event.split('.')[1] || '*'\n\n // ensure valid object\n bag[ev] = bag[ev] || {}\n bag[ev][ns] = bag[ev][ns] || {}\n\n // reference listener\n bag[ev][ns][listener._svgjsListenerId] = l\n\n // add listener\n n.addEventListener(ev, l, options || false)\n })\n}\n\n// Add event unbinder in the SVG namespace\nexport function off(node, events, listener, options) {\n const instance = makeInstance(node)\n const bag = getEvents(instance)\n const n = getEventTarget(instance)\n\n // listener can be a function or a number\n if (typeof listener === 'function') {\n listener = listener._svgjsListenerId\n if (!listener) return\n }\n\n // events can be an array of events or a string or undefined\n events = Array.isArray(events) ? events : (events || '').split(delimiter)\n\n events.forEach(function (event) {\n const ev = event && event.split('.')[0]\n const ns = event && event.split('.')[1]\n let namespace, l\n\n if (listener) {\n // remove listener reference\n if (bag[ev] && bag[ev][ns || '*']) {\n // removeListener\n n.removeEventListener(\n ev,\n bag[ev][ns || '*'][listener],\n options || false\n )\n\n delete bag[ev][ns || '*'][listener]\n }\n } else if (ev && ns) {\n // remove all listeners for a namespaced event\n if (bag[ev] && bag[ev][ns]) {\n for (l in bag[ev][ns]) {\n off(n, [ev, ns].join('.'), l)\n }\n\n delete bag[ev][ns]\n }\n } else if (ns) {\n // remove all listeners for a specific namespace\n for (event in bag) {\n for (namespace in bag[event]) {\n if (ns === namespace) {\n off(n, [event, ns].join('.'))\n }\n }\n }\n } else if (ev) {\n // remove all listeners for the event\n if (bag[ev]) {\n for (namespace in bag[ev]) {\n off(n, [ev, namespace].join('.'))\n }\n\n delete bag[ev]\n }\n } else {\n // remove all listeners on a given node\n for (event in bag) {\n off(n, event)\n }\n\n clearEvents(instance)\n }\n })\n}\n\nexport function dispatch(node, event, data, options) {\n const n = getEventTarget(node)\n\n // Dispatch event\n if (event instanceof globals.window.Event) {\n n.dispatchEvent(event)\n } else {\n event = new globals.window.CustomEvent(event, {\n detail: data,\n cancelable: true,\n ...options\n })\n n.dispatchEvent(event)\n }\n return event\n}\n","import { dispatch, off, on } from '../modules/core/event.js'\nimport { register } from '../utils/adopter.js'\nimport Base from './Base.js'\n\nexport default class EventTarget extends Base {\n addEventListener() {}\n\n dispatch(event, data, options) {\n return dispatch(this, event, data, options)\n }\n\n dispatchEvent(event) {\n const bag = this.getEventHolder().events\n if (!bag) return true\n\n const events = bag[event.type]\n\n for (const i in events) {\n for (const j in events[i]) {\n events[i][j](event)\n }\n }\n\n return !event.defaultPrevented\n }\n\n // Fire given event\n fire(event, data, options) {\n this.dispatch(event, data, options)\n return this\n }\n\n getEventHolder() {\n return this\n }\n\n getEventTarget() {\n return this\n }\n\n // Unbind event from listener\n off(event, listener, options) {\n off(this, event, listener, options)\n return this\n }\n\n // Bind given event to listener\n on(event, listener, binding, options) {\n on(this, event, listener, binding, options)\n return this\n }\n\n removeEventListener() {}\n}\n\nregister(EventTarget, 'EventTarget')\n","export function noop() {}\n\n// Default animation values\nexport const timeline = {\n duration: 400,\n ease: '>',\n delay: 0\n}\n\n// Default attribute values\nexport const attrs = {\n // fill and stroke\n 'fill-opacity': 1,\n 'stroke-opacity': 1,\n 'stroke-width': 0,\n 'stroke-linejoin': 'miter',\n 'stroke-linecap': 'butt',\n fill: '#000000',\n stroke: '#000000',\n opacity: 1,\n\n // position\n x: 0,\n y: 0,\n cx: 0,\n cy: 0,\n\n // size\n width: 0,\n height: 0,\n\n // radius\n r: 0,\n rx: 0,\n ry: 0,\n\n // gradient\n offset: 0,\n 'stop-opacity': 1,\n 'stop-color': '#000000',\n\n // text\n 'text-anchor': 'start'\n}\n","import { delimiter } from '../modules/core/regex.js'\n\nexport default class SVGArray extends Array {\n constructor(...args) {\n super(...args)\n this.init(...args)\n }\n\n clone() {\n return new this.constructor(this)\n }\n\n init(arr) {\n // This catches the case, that native map tries to create an array with new Array(1)\n if (typeof arr === 'number') return this\n this.length = 0\n this.push(...this.parse(arr))\n return this\n }\n\n // Parse whitespace separated string\n parse(array = []) {\n // If already is an array, no need to parse it\n if (array instanceof Array) return array\n\n return array.trim().split(delimiter).map(parseFloat)\n }\n\n toArray() {\n return Array.prototype.concat.apply([], this)\n }\n\n toSet() {\n return new Set(this)\n }\n\n toString() {\n return this.join(' ')\n }\n\n // Flattens the array if needed\n valueOf() {\n const ret = []\n ret.push(...this)\n return ret\n }\n}\n","import { numberAndUnit } from '../modules/core/regex.js'\n\n// Module for unit conversions\nexport default class SVGNumber {\n // Initialize\n constructor(...args) {\n this.init(...args)\n }\n\n convert(unit) {\n return new SVGNumber(this.value, unit)\n }\n\n // Divide number\n divide(number) {\n number = new SVGNumber(number)\n return new SVGNumber(this / number, this.unit || number.unit)\n }\n\n init(value, unit) {\n unit = Array.isArray(value) ? value[1] : unit\n value = Array.isArray(value) ? value[0] : value\n\n // initialize defaults\n this.value = 0\n this.unit = unit || ''\n\n // parse value\n if (typeof value === 'number') {\n // ensure a valid numeric value\n this.value = isNaN(value)\n ? 0\n : !isFinite(value)\n ? value < 0\n ? -3.4e38\n : +3.4e38\n : value\n } else if (typeof value === 'string') {\n unit = value.match(numberAndUnit)\n\n if (unit) {\n // make value numeric\n this.value = parseFloat(unit[1])\n\n // normalize\n if (unit[5] === '%') {\n this.value /= 100\n } else if (unit[5] === 's') {\n this.value *= 1000\n }\n\n // store unit\n this.unit = unit[5]\n }\n } else {\n if (value instanceof SVGNumber) {\n this.value = value.valueOf()\n this.unit = value.unit\n }\n }\n\n return this\n }\n\n // Subtract number\n minus(number) {\n number = new SVGNumber(number)\n return new SVGNumber(this - number, this.unit || number.unit)\n }\n\n // Add number\n plus(number) {\n number = new SVGNumber(number)\n return new SVGNumber(this + number, this.unit || number.unit)\n }\n\n // Multiply number\n times(number) {\n number = new SVGNumber(number)\n return new SVGNumber(this * number, this.unit || number.unit)\n }\n\n toArray() {\n return [this.value, this.unit]\n }\n\n toJSON() {\n return this.toString()\n }\n\n toString() {\n return (\n (this.unit === '%'\n ? ~~(this.value * 1e8) / 1e6\n : this.unit === 's'\n ? this.value / 1e3\n : this.value) + this.unit\n )\n }\n\n valueOf() {\n return this.value\n }\n}\n","import { attrs as defaults } from './defaults.js'\nimport { isNumber } from './regex.js'\nimport Color from '../../types/Color.js'\nimport SVGArray from '../../types/SVGArray.js'\nimport SVGNumber from '../../types/SVGNumber.js'\n\nconst colorAttributes = new Set([\n 'fill',\n 'stroke',\n 'color',\n 'bgcolor',\n 'stop-color',\n 'flood-color',\n 'lighting-color'\n])\n\nconst hooks = []\nexport function registerAttrHook(fn) {\n hooks.push(fn)\n}\n\n// Set svg element attribute\nexport default function attr(attr, val, ns) {\n // act as full getter\n if (attr == null) {\n // get an object of attributes\n attr = {}\n val = this.node.attributes\n\n for (const node of val) {\n attr[node.nodeName] = isNumber.test(node.nodeValue)\n ? parseFloat(node.nodeValue)\n : node.nodeValue\n }\n\n return attr\n } else if (attr instanceof Array) {\n // loop through array and get all values\n return attr.reduce((last, curr) => {\n last[curr] = this.attr(curr)\n return last\n }, {})\n } else if (typeof attr === 'object' && attr.constructor === Object) {\n // apply every attribute individually if an object is passed\n for (val in attr) this.attr(val, attr[val])\n } else if (val === null) {\n // remove value\n this.node.removeAttribute(attr)\n } else if (val == null) {\n // act as a getter if the first and only argument is not an object\n val = this.node.getAttribute(attr)\n return val == null\n ? defaults[attr]\n : isNumber.test(val)\n ? parseFloat(val)\n : val\n } else {\n // Loop through hooks and execute them to convert value\n val = hooks.reduce((_val, hook) => {\n return hook(attr, _val, this)\n }, val)\n\n // ensure correct numeric values (also accepts NaN and Infinity)\n if (typeof val === 'number') {\n val = new SVGNumber(val)\n } else if (colorAttributes.has(attr) && Color.isColor(val)) {\n // ensure full hex color\n val = new Color(val)\n } else if (val.constructor === Array) {\n // Check for plain arrays and parse array values\n val = new SVGArray(val)\n }\n\n // if the passed attribute is leading...\n if (attr === 'leading') {\n // ... call the leading method instead\n if (this.leading) {\n this.leading(val)\n }\n } else {\n // set given attribute on node\n typeof ns === 'string'\n ? this.node.setAttributeNS(ns, attr, val.toString())\n : this.node.setAttribute(attr, val.toString())\n }\n\n // rebuild if required\n if (this.rebuild && (attr === 'font-size' || attr === 'x')) {\n this.rebuild()\n }\n }\n\n return this\n}\n","import {\n adopt,\n assignNewId,\n eid,\n extend,\n makeInstance,\n create,\n register\n} from '../utils/adopter.js'\nimport { find, findOne } from '../modules/core/selector.js'\nimport { globals } from '../utils/window.js'\nimport { map } from '../utils/utils.js'\nimport { svg, html } from '../modules/core/namespaces.js'\nimport EventTarget from '../types/EventTarget.js'\nimport List from '../types/List.js'\nimport attr from '../modules/core/attr.js'\n\nexport default class Dom extends EventTarget {\n constructor(node, attrs) {\n super()\n this.node = node\n this.type = node.nodeName\n\n if (attrs && node !== attrs) {\n this.attr(attrs)\n }\n }\n\n // Add given element at a position\n add(element, i) {\n element = makeInstance(element)\n\n // If non-root svg nodes are added we have to remove their namespaces\n if (\n element.removeNamespace &&\n this.node instanceof globals.window.SVGElement\n ) {\n element.removeNamespace()\n }\n\n if (i == null) {\n this.node.appendChild(element.node)\n } else if (element.node !== this.node.childNodes[i]) {\n this.node.insertBefore(element.node, this.node.childNodes[i])\n }\n\n return this\n }\n\n // Add element to given container and return self\n addTo(parent, i) {\n return makeInstance(parent).put(this, i)\n }\n\n // Returns all child elements\n children() {\n return new List(\n map(this.node.children, function (node) {\n return adopt(node)\n })\n )\n }\n\n // Remove all elements in this container\n clear() {\n // remove children\n while (this.node.hasChildNodes()) {\n this.node.removeChild(this.node.lastChild)\n }\n\n return this\n }\n\n // Clone element\n clone(deep = true, assignNewIds = true) {\n // write dom data to the dom so the clone can pickup the data\n this.writeDataToDom()\n\n // clone element\n let nodeClone = this.node.cloneNode(deep)\n if (assignNewIds) {\n // assign new id\n nodeClone = assignNewId(nodeClone)\n }\n return new this.constructor(nodeClone)\n }\n\n // Iterates over all children and invokes a given block\n each(block, deep) {\n const children = this.children()\n let i, il\n\n for (i = 0, il = children.length; i < il; i++) {\n block.apply(children[i], [i, children])\n\n if (deep) {\n children[i].each(block, deep)\n }\n }\n\n return this\n }\n\n element(nodeName, attrs) {\n return this.put(new Dom(create(nodeName), attrs))\n }\n\n // Get first child\n first() {\n return adopt(this.node.firstChild)\n }\n\n // Get a element at the given index\n get(i) {\n return adopt(this.node.childNodes[i])\n }\n\n getEventHolder() {\n return this.node\n }\n\n getEventTarget() {\n return this.node\n }\n\n // Checks if the given element is a child\n has(element) {\n return this.index(element) >= 0\n }\n\n html(htmlOrFn, outerHTML) {\n return this.xml(htmlOrFn, outerHTML, html)\n }\n\n // Get / set id\n id(id) {\n // generate new id if no id set\n if (typeof id === 'undefined' && !this.node.id) {\n this.node.id = eid(this.type)\n }\n\n // don't set directly with this.node.id to make `null` work correctly\n return this.attr('id', id)\n }\n\n // Gets index of given element\n index(element) {\n return [].slice.call(this.node.childNodes).indexOf(element.node)\n }\n\n // Get the last child\n last() {\n return adopt(this.node.lastChild)\n }\n\n // matches the element vs a css selector\n matches(selector) {\n const el = this.node\n const matcher =\n el.matches ||\n el.matchesSelector ||\n el.msMatchesSelector ||\n el.mozMatchesSelector ||\n el.webkitMatchesSelector ||\n el.oMatchesSelector ||\n null\n return matcher && matcher.call(el, selector)\n }\n\n // Returns the parent element instance\n parent(type) {\n let parent = this\n\n // check for parent\n if (!parent.node.parentNode) return null\n\n // get parent element\n parent = adopt(parent.node.parentNode)\n\n if (!type) return parent\n\n // loop through ancestors if type is given\n do {\n if (\n typeof type === 'string' ? parent.matches(type) : parent instanceof type\n )\n return parent\n } while ((parent = adopt(parent.node.parentNode)))\n\n return parent\n }\n\n // Basically does the same as `add()` but returns the added element instead\n put(element, i) {\n element = makeInstance(element)\n this.add(element, i)\n return element\n }\n\n // Add element to given container and return container\n putIn(parent, i) {\n return makeInstance(parent).add(this, i)\n }\n\n // Remove element\n remove() {\n if (this.parent()) {\n this.parent().removeElement(this)\n }\n\n return this\n }\n\n // Remove a given child\n removeElement(element) {\n this.node.removeChild(element.node)\n\n return this\n }\n\n // Replace this with element\n replace(element) {\n element = makeInstance(element)\n\n if (this.node.parentNode) {\n this.node.parentNode.replaceChild(element.node, this.node)\n }\n\n return element\n }\n\n round(precision = 2, map = null) {\n const factor = 10 ** precision\n const attrs = this.attr(map)\n\n for (const i in attrs) {\n if (typeof attrs[i] === 'number') {\n attrs[i] = Math.round(attrs[i] * factor) / factor\n }\n }\n\n this.attr(attrs)\n return this\n }\n\n // Import / Export raw svg\n svg(svgOrFn, outerSVG) {\n return this.xml(svgOrFn, outerSVG, svg)\n }\n\n // Return id on string conversion\n toString() {\n return this.id()\n }\n\n words(text) {\n // This is faster than removing all children and adding a new one\n this.node.textContent = text\n return this\n }\n\n wrap(node) {\n const parent = this.parent()\n\n if (!parent) {\n return this.addTo(node)\n }\n\n const position = parent.index(this)\n return parent.put(node, position).put(this)\n }\n\n // write svgjs data to the dom\n writeDataToDom() {\n // dump variables recursively\n this.each(function () {\n this.writeDataToDom()\n })\n\n return this\n }\n\n // Import / Export raw svg\n xml(xmlOrFn, outerXML, ns) {\n if (typeof xmlOrFn === 'boolean') {\n ns = outerXML\n outerXML = xmlOrFn\n xmlOrFn = null\n }\n\n // act as getter if no svg string is given\n if (xmlOrFn == null || typeof xmlOrFn === 'function') {\n // The default for exports is, that the outerNode is included\n outerXML = outerXML == null ? true : outerXML\n\n // write svgjs data to the dom\n this.writeDataToDom()\n let current = this\n\n // An export modifier was passed\n if (xmlOrFn != null) {\n current = adopt(current.node.cloneNode(true))\n\n // If the user wants outerHTML we need to process this node, too\n if (outerXML) {\n const result = xmlOrFn(current)\n current = result || current\n\n // The user does not want this node? Well, then he gets nothing\n if (result === false) return ''\n }\n\n // Deep loop through all children and apply modifier\n current.each(function () {\n const result = xmlOrFn(this)\n const _this = result || this\n\n // If modifier returns false, discard node\n if (result === false) {\n this.remove()\n\n // If modifier returns new node, use it\n } else if (result && this !== _this) {\n this.replace(_this)\n }\n }, true)\n }\n\n // Return outer or inner content\n return outerXML ? current.node.outerHTML : current.node.innerHTML\n }\n\n // Act as setter if we got a string\n\n // The default for import is, that the current node is not replaced\n outerXML = outerXML == null ? false : outerXML\n\n // Create temporary holder\n const well = create('wrapper', ns)\n const fragment = globals.document.createDocumentFragment()\n\n // Dump raw svg\n well.innerHTML = xmlOrFn\n\n // Transplant nodes into the fragment\n for (let len = well.children.length; len--; ) {\n fragment.appendChild(well.firstElementChild)\n }\n\n const parent = this.parent()\n\n // Add the whole fragment at once\n return outerXML ? this.replace(fragment) && parent : this.add(fragment)\n }\n}\n\nextend(Dom, { attr, find, findOne })\nregister(Dom, 'Dom')\n","import { bbox, rbox, inside } from '../types/Box.js'\nimport { ctm, screenCTM } from '../types/Matrix.js'\nimport {\n extend,\n getClass,\n makeInstance,\n register,\n root\n} from '../utils/adopter.js'\nimport { globals } from '../utils/window.js'\nimport { point } from '../types/Point.js'\nimport { proportionalSize, writeDataToDom } from '../utils/utils.js'\nimport { reference } from '../modules/core/regex.js'\nimport Dom from './Dom.js'\nimport List from '../types/List.js'\nimport SVGNumber from '../types/SVGNumber.js'\n\nexport default class Element extends Dom {\n constructor(node, attrs) {\n super(node, attrs)\n\n // initialize data object\n this.dom = {}\n\n // create circular reference\n this.node.instance = this\n\n if (node.hasAttribute('data-svgjs') || node.hasAttribute('svgjs:data')) {\n // pull svgjs data from the dom (getAttributeNS doesn't work in html5)\n this.setData(\n JSON.parse(node.getAttribute('data-svgjs')) ??\n JSON.parse(node.getAttribute('svgjs:data')) ??\n {}\n )\n }\n }\n\n // Move element by its center\n center(x, y) {\n return this.cx(x).cy(y)\n }\n\n // Move by center over x-axis\n cx(x) {\n return x == null\n ? this.x() + this.width() / 2\n : this.x(x - this.width() / 2)\n }\n\n // Move by center over y-axis\n cy(y) {\n return y == null\n ? this.y() + this.height() / 2\n : this.y(y - this.height() / 2)\n }\n\n // Get defs\n defs() {\n const root = this.root()\n return root && root.defs()\n }\n\n // Relative move over x and y axes\n dmove(x, y) {\n return this.dx(x).dy(y)\n }\n\n // Relative move over x axis\n dx(x = 0) {\n return this.x(new SVGNumber(x).plus(this.x()))\n }\n\n // Relative move over y axis\n dy(y = 0) {\n return this.y(new SVGNumber(y).plus(this.y()))\n }\n\n getEventHolder() {\n return this\n }\n\n // Set height of element\n height(height) {\n return this.attr('height', height)\n }\n\n // Move element to given x and y values\n move(x, y) {\n return this.x(x).y(y)\n }\n\n // return array of all ancestors of given type up to the root svg\n parents(until = this.root()) {\n const isSelector = typeof until === 'string'\n if (!isSelector) {\n until = makeInstance(until)\n }\n const parents = new List()\n let parent = this\n\n while (\n (parent = parent.parent()) &&\n parent.node !== globals.document &&\n parent.nodeName !== '#document-fragment'\n ) {\n parents.push(parent)\n\n if (!isSelector && parent.node === until.node) {\n break\n }\n if (isSelector && parent.matches(until)) {\n break\n }\n if (parent.node === this.root().node) {\n // We worked our way to the root and didn't match `until`\n return null\n }\n }\n\n return parents\n }\n\n // Get referenced element form attribute value\n reference(attr) {\n attr = this.attr(attr)\n if (!attr) return null\n\n const m = (attr + '').match(reference)\n return m ? makeInstance(m[1]) : null\n }\n\n // Get parent document\n root() {\n const p = this.parent(getClass(root))\n return p && p.root()\n }\n\n // set given data to the elements data property\n setData(o) {\n this.dom = o\n return this\n }\n\n // Set element size to given width and height\n size(width, height) {\n const p = proportionalSize(this, width, height)\n\n return this.width(new SVGNumber(p.width)).height(new SVGNumber(p.height))\n }\n\n // Set width of element\n width(width) {\n return this.attr('width', width)\n }\n\n // write svgjs data to the dom\n writeDataToDom() {\n writeDataToDom(this, this.dom)\n return super.writeDataToDom()\n }\n\n // Move over x-axis\n x(x) {\n return this.attr('x', x)\n }\n\n // Move over y-axis\n y(y) {\n return this.attr('y', y)\n }\n}\n\nextend(Element, {\n bbox,\n rbox,\n inside,\n point,\n ctm,\n screenCTM\n})\n\nregister(Element, 'Element')\n","import { registerMethods } from '../../utils/methods.js'\nimport Color from '../../types/Color.js'\nimport Element from '../../elements/Element.js'\nimport Matrix from '../../types/Matrix.js'\nimport Point from '../../types/Point.js'\nimport SVGNumber from '../../types/SVGNumber.js'\n\n// Define list of available attributes for stroke and fill\nconst sugar = {\n stroke: [\n 'color',\n 'width',\n 'opacity',\n 'linecap',\n 'linejoin',\n 'miterlimit',\n 'dasharray',\n 'dashoffset'\n ],\n fill: ['color', 'opacity', 'rule'],\n prefix: function (t, a) {\n return a === 'color' ? t : t + '-' + a\n }\n}\n\n// Add sugar for fill and stroke\n;['fill', 'stroke'].forEach(function (m) {\n const extension = {}\n let i\n\n extension[m] = function (o) {\n if (typeof o === 'undefined') {\n return this.attr(m)\n }\n if (\n typeof o === 'string' ||\n o instanceof Color ||\n Color.isRgb(o) ||\n o instanceof Element\n ) {\n this.attr(m, o)\n } else {\n // set all attributes from sugar.fill and sugar.stroke list\n for (i = sugar[m].length - 1; i >= 0; i--) {\n if (o[sugar[m][i]] != null) {\n this.attr(sugar.prefix(m, sugar[m][i]), o[sugar[m][i]])\n }\n }\n }\n\n return this\n }\n\n registerMethods(['Element', 'Runner'], extension)\n})\n\nregisterMethods(['Element', 'Runner'], {\n // Let the user set the matrix directly\n matrix: function (mat, b, c, d, e, f) {\n // Act as a getter\n if (mat == null) {\n return new Matrix(this)\n }\n\n // Act as a setter, the user can pass a matrix or a set of numbers\n return this.attr('transform', new Matrix(mat, b, c, d, e, f))\n },\n\n // Map rotation to transform\n rotate: function (angle, cx, cy) {\n return this.transform({ rotate: angle, ox: cx, oy: cy }, true)\n },\n\n // Map skew to transform\n skew: function (x, y, cx, cy) {\n return arguments.length === 1 || arguments.length === 3\n ? this.transform({ skew: x, ox: y, oy: cx }, true)\n : this.transform({ skew: [x, y], ox: cx, oy: cy }, true)\n },\n\n shear: function (lam, cx, cy) {\n return this.transform({ shear: lam, ox: cx, oy: cy }, true)\n },\n\n // Map scale to transform\n scale: function (x, y, cx, cy) {\n return arguments.length === 1 || arguments.length === 3\n ? this.transform({ scale: x, ox: y, oy: cx }, true)\n : this.transform({ scale: [x, y], ox: cx, oy: cy }, true)\n },\n\n // Map translate to transform\n translate: function (x, y) {\n return this.transform({ translate: [x, y] }, true)\n },\n\n // Map relative translations to transform\n relative: function (x, y) {\n return this.transform({ relative: [x, y] }, true)\n },\n\n // Map flip to transform\n flip: function (direction = 'both', origin = 'center') {\n if ('xybothtrue'.indexOf(direction) === -1) {\n origin = direction\n direction = 'both'\n }\n\n return this.transform({ flip: direction, origin: origin }, true)\n },\n\n // Opacity\n opacity: function (value) {\n return this.attr('opacity', value)\n }\n})\n\nregisterMethods('radius', {\n // Add x and y radius\n radius: function (x, y = x) {\n const type = (this._element || this).type\n return type === 'radialGradient'\n ? this.attr('r', new SVGNumber(x))\n : this.rx(x).ry(y)\n }\n})\n\nregisterMethods('Path', {\n // Get path length\n length: function () {\n return this.node.getTotalLength()\n },\n // Get point at length\n pointAt: function (length) {\n return new Point(this.node.getPointAtLength(length))\n }\n})\n\nregisterMethods(['Element', 'Runner'], {\n // Set font\n font: function (a, v) {\n if (typeof a === 'object') {\n for (v in a) this.font(v, a[v])\n return this\n }\n\n return a === 'leading'\n ? this.leading(v)\n : a === 'anchor'\n ? this.attr('text-anchor', v)\n : a === 'size' ||\n a === 'family' ||\n a === 'weight' ||\n a === 'stretch' ||\n a === 'variant' ||\n a === 'style'\n ? this.attr('font-' + a, v)\n : this.attr(a, v)\n }\n})\n\n// Add events to elements\nconst methods = [\n 'click',\n 'dblclick',\n 'mousedown',\n 'mouseup',\n 'mouseover',\n 'mouseout',\n 'mousemove',\n 'mouseenter',\n 'mouseleave',\n 'touchstart',\n 'touchmove',\n 'touchleave',\n 'touchend',\n 'touchcancel',\n 'contextmenu',\n 'wheel',\n 'pointerdown',\n 'pointermove',\n 'pointerup',\n 'pointerleave',\n 'pointercancel'\n].reduce(function (last, event) {\n // add event to Element\n const fn = function (f) {\n if (f === null) {\n this.off(event)\n } else {\n this.on(event, f)\n }\n return this\n }\n\n last[event] = fn\n return last\n}, {})\n\nregisterMethods('Element', methods)\n","import { getOrigin, isDescriptive } from '../../utils/utils.js'\nimport { delimiter, transforms } from '../core/regex.js'\nimport { registerMethods } from '../../utils/methods.js'\nimport Matrix from '../../types/Matrix.js'\n\n// Reset all transformations\nexport function untransform() {\n return this.attr('transform', null)\n}\n\n// merge the whole transformation chain into one matrix and returns it\nexport function matrixify() {\n const matrix = (this.attr('transform') || '')\n // split transformations\n .split(transforms)\n .slice(0, -1)\n .map(function (str) {\n // generate key => value pairs\n const kv = str.trim().split('(')\n return [\n kv[0],\n kv[1].split(delimiter).map(function (str) {\n return parseFloat(str)\n })\n ]\n })\n .reverse()\n // merge every transformation into one matrix\n .reduce(function (matrix, transform) {\n if (transform[0] === 'matrix') {\n return matrix.lmultiply(Matrix.fromArray(transform[1]))\n }\n return matrix[transform[0]].apply(matrix, transform[1])\n }, new Matrix())\n\n return matrix\n}\n\n// add an element to another parent without changing the visual representation on the screen\nexport function toParent(parent, i) {\n if (this === parent) return this\n\n if (isDescriptive(this.node)) return this.addTo(parent, i)\n\n const ctm = this.screenCTM()\n const pCtm = parent.screenCTM().inverse()\n\n this.addTo(parent, i).untransform().transform(pCtm.multiply(ctm))\n\n return this\n}\n\n// same as above with parent equals root-svg\nexport function toRoot(i) {\n return this.toParent(this.root(), i)\n}\n\n// Add transformations\nexport function transform(o, relative) {\n // Act as a getter if no object was passed\n if (o == null || typeof o === 'string') {\n const decomposed = new Matrix(this).decompose()\n return o == null ? decomposed : decomposed[o]\n }\n\n if (!Matrix.isMatrixLike(o)) {\n // Set the origin according to the defined transform\n o = { ...o, origin: getOrigin(o, this) }\n }\n\n // The user can pass a boolean, an Element or an Matrix or nothing\n const cleanRelative = relative === true ? this : relative || false\n const result = new Matrix(cleanRelative).transform(o)\n return this.attr('transform', result)\n}\n\nregisterMethods('Element', {\n untransform,\n matrixify,\n toParent,\n toRoot,\n transform\n})\n","import { register } from '../utils/adopter.js'\nimport Element from './Element.js'\n\nexport default class Container extends Element {\n flatten() {\n this.each(function () {\n if (this instanceof Container) {\n return this.flatten().ungroup()\n }\n })\n\n return this\n }\n\n ungroup(parent = this.parent(), index = parent.index(this)) {\n // when parent != this, we want append all elements to the end\n index = index === -1 ? parent.children().length : index\n\n this.each(function (i, children) {\n // reverse each\n return children[children.length - i - 1].toParent(parent, index)\n })\n\n return this.remove()\n }\n}\n\nregister(Container, 'Container')\n","import { nodeOrNew, register } from '../utils/adopter.js'\nimport Container from './Container.js'\n\nexport default class Defs extends Container {\n constructor(node, attrs = node) {\n super(nodeOrNew('defs', node), attrs)\n }\n\n flatten() {\n return this\n }\n\n ungroup() {\n return this\n }\n}\n\nregister(Defs, 'Defs')\n","import { register } from '../utils/adopter.js'\nimport Element from './Element.js'\n\nexport default class Shape extends Element {}\n\nregister(Shape, 'Shape')\n","import SVGNumber from '../../types/SVGNumber.js'\n\n// Radius x value\nexport function rx(rx) {\n return this.attr('rx', rx)\n}\n\n// Radius y value\nexport function ry(ry) {\n return this.attr('ry', ry)\n}\n\n// Move over x-axis\nexport function x(x) {\n return x == null ? this.cx() - this.rx() : this.cx(x + this.rx())\n}\n\n// Move over y-axis\nexport function y(y) {\n return y == null ? this.cy() - this.ry() : this.cy(y + this.ry())\n}\n\n// Move by center over x-axis\nexport function cx(x) {\n return this.attr('cx', x)\n}\n\n// Move by center over y-axis\nexport function cy(y) {\n return this.attr('cy', y)\n}\n\n// Set width of element\nexport function width(width) {\n return width == null ? this.rx() * 2 : this.rx(new SVGNumber(width).divide(2))\n}\n\n// Set height of element\nexport function height(height) {\n return height == null\n ? this.ry() * 2\n : this.ry(new SVGNumber(height).divide(2))\n}\n","import {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { proportionalSize } from '../utils/utils.js'\nimport { registerMethods } from '../utils/methods.js'\nimport SVGNumber from '../types/SVGNumber.js'\nimport Shape from './Shape.js'\nimport * as circled from '../modules/core/circled.js'\n\nexport default class Ellipse extends Shape {\n constructor(node, attrs = node) {\n super(nodeOrNew('ellipse', node), attrs)\n }\n\n size(width, height) {\n const p = proportionalSize(this, width, height)\n\n return this.rx(new SVGNumber(p.width).divide(2)).ry(\n new SVGNumber(p.height).divide(2)\n )\n }\n}\n\nextend(Ellipse, circled)\n\nregisterMethods('Container', {\n // Create an ellipse\n ellipse: wrapWithAttrCheck(function (width = 0, height = width) {\n return this.put(new Ellipse()).size(width, height).move(0, 0)\n })\n})\n\nregister(Ellipse, 'Ellipse')\n","import Dom from './Dom.js'\nimport { globals } from '../utils/window.js'\nimport { register, create } from '../utils/adopter.js'\n\nclass Fragment extends Dom {\n constructor(node = globals.document.createDocumentFragment()) {\n super(node)\n }\n\n // Import / Export raw xml\n xml(xmlOrFn, outerXML, ns) {\n if (typeof xmlOrFn === 'boolean') {\n ns = outerXML\n outerXML = xmlOrFn\n xmlOrFn = null\n }\n\n // because this is a fragment we have to put all elements into a wrapper first\n // before we can get the innerXML from it\n if (xmlOrFn == null || typeof xmlOrFn === 'function') {\n const wrapper = new Dom(create('wrapper', ns))\n wrapper.add(this.node.cloneNode(true))\n\n return wrapper.xml(false, ns)\n }\n\n // Act as setter if we got a string\n return super.xml(xmlOrFn, false, ns)\n }\n}\n\nregister(Fragment, 'Fragment')\n\nexport default Fragment\n","import SVGNumber from '../../types/SVGNumber.js'\n\nexport function from(x, y) {\n return (this._element || this).type === 'radialGradient'\n ? this.attr({ fx: new SVGNumber(x), fy: new SVGNumber(y) })\n : this.attr({ x1: new SVGNumber(x), y1: new SVGNumber(y) })\n}\n\nexport function to(x, y) {\n return (this._element || this).type === 'radialGradient'\n ? this.attr({ cx: new SVGNumber(x), cy: new SVGNumber(y) })\n : this.attr({ x2: new SVGNumber(x), y2: new SVGNumber(y) })\n}\n","import {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Box from '../types/Box.js'\nimport Container from './Container.js'\nimport baseFind from '../modules/core/selector.js'\nimport * as gradiented from '../modules/core/gradiented.js'\n\nexport default class Gradient extends Container {\n constructor(type, attrs) {\n super(\n nodeOrNew(type + 'Gradient', typeof type === 'string' ? null : type),\n attrs\n )\n }\n\n // custom attr to handle transform\n attr(a, b, c) {\n if (a === 'transform') a = 'gradientTransform'\n return super.attr(a, b, c)\n }\n\n bbox() {\n return new Box()\n }\n\n targets() {\n return baseFind('svg [fill*=' + this.id() + ']')\n }\n\n // Alias string conversion to fill\n toString() {\n return this.url()\n }\n\n // Update gradient\n update(block) {\n // remove all stops\n this.clear()\n\n // invoke passed block\n if (typeof block === 'function') {\n block.call(this, this)\n }\n\n return this\n }\n\n // Return the fill id\n url() {\n return 'url(#' + this.id() + ')'\n }\n}\n\nextend(Gradient, gradiented)\n\nregisterMethods({\n Container: {\n // Create gradient element in defs\n gradient(...args) {\n return this.defs().gradient(...args)\n }\n },\n // define gradient\n Defs: {\n gradient: wrapWithAttrCheck(function (type, block) {\n return this.put(new Gradient(type)).update(block)\n })\n }\n})\n\nregister(Gradient, 'Gradient')\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Box from '../types/Box.js'\nimport Container from './Container.js'\nimport baseFind from '../modules/core/selector.js'\n\nexport default class Pattern extends Container {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('pattern', node), attrs)\n }\n\n // custom attr to handle transform\n attr(a, b, c) {\n if (a === 'transform') a = 'patternTransform'\n return super.attr(a, b, c)\n }\n\n bbox() {\n return new Box()\n }\n\n targets() {\n return baseFind('svg [fill*=' + this.id() + ']')\n }\n\n // Alias string conversion to fill\n toString() {\n return this.url()\n }\n\n // Update pattern by rebuilding\n update(block) {\n // remove content\n this.clear()\n\n // invoke passed block\n if (typeof block === 'function') {\n block.call(this, this)\n }\n\n return this\n }\n\n // Return the fill id\n url() {\n return 'url(#' + this.id() + ')'\n }\n}\n\nregisterMethods({\n Container: {\n // Create pattern element in defs\n pattern(...args) {\n return this.defs().pattern(...args)\n }\n },\n Defs: {\n pattern: wrapWithAttrCheck(function (width, height, block) {\n return this.put(new Pattern()).update(block).attr({\n x: 0,\n y: 0,\n width: width,\n height: height,\n patternUnits: 'userSpaceOnUse'\n })\n })\n }\n})\n\nregister(Pattern, 'Pattern')\n","import { isImage } from '../modules/core/regex.js'\nimport { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { off, on } from '../modules/core/event.js'\nimport { registerAttrHook } from '../modules/core/attr.js'\nimport { registerMethods } from '../utils/methods.js'\nimport { xlink } from '../modules/core/namespaces.js'\nimport Pattern from './Pattern.js'\nimport Shape from './Shape.js'\nimport { globals } from '../utils/window.js'\n\nexport default class Image extends Shape {\n constructor(node, attrs = node) {\n super(nodeOrNew('image', node), attrs)\n }\n\n // (re)load image\n load(url, callback) {\n if (!url) return this\n\n const img = new globals.window.Image()\n\n on(\n img,\n 'load',\n function (e) {\n const p = this.parent(Pattern)\n\n // ensure image size\n if (this.width() === 0 && this.height() === 0) {\n this.size(img.width, img.height)\n }\n\n if (p instanceof Pattern) {\n // ensure pattern size if not set\n if (p.width() === 0 && p.height() === 0) {\n p.size(this.width(), this.height())\n }\n }\n\n if (typeof callback === 'function') {\n callback.call(this, e)\n }\n },\n this\n )\n\n on(img, 'load error', function () {\n // dont forget to unbind memory leaking events\n off(img)\n })\n\n return this.attr('href', (img.src = url), xlink)\n }\n}\n\nregisterAttrHook(function (attr, val, _this) {\n // convert image fill and stroke to patterns\n if (attr === 'fill' || attr === 'stroke') {\n if (isImage.test(val)) {\n val = _this.root().defs().image(val)\n }\n }\n\n if (val instanceof Image) {\n val = _this\n .root()\n .defs()\n .pattern(0, 0, (pattern) => {\n pattern.add(val)\n })\n }\n\n return val\n})\n\nregisterMethods({\n Container: {\n // create image element, load image and set its size\n image: wrapWithAttrCheck(function (source, callback) {\n return this.put(new Image()).size(0, 0).load(source, callback)\n })\n }\n})\n\nregister(Image, 'Image')\n","import { delimiter } from '../modules/core/regex.js'\nimport SVGArray from './SVGArray.js'\nimport Box from './Box.js'\nimport Matrix from './Matrix.js'\n\nexport default class PointArray extends SVGArray {\n // Get bounding box of points\n bbox() {\n let maxX = -Infinity\n let maxY = -Infinity\n let minX = Infinity\n let minY = Infinity\n this.forEach(function (el) {\n maxX = Math.max(el[0], maxX)\n maxY = Math.max(el[1], maxY)\n minX = Math.min(el[0], minX)\n minY = Math.min(el[1], minY)\n })\n return new Box(minX, minY, maxX - minX, maxY - minY)\n }\n\n // Move point string\n move(x, y) {\n const box = this.bbox()\n\n // get relative offset\n x -= box.x\n y -= box.y\n\n // move every point\n if (!isNaN(x) && !isNaN(y)) {\n for (let i = this.length - 1; i >= 0; i--) {\n this[i] = [this[i][0] + x, this[i][1] + y]\n }\n }\n\n return this\n }\n\n // Parse point string and flat array\n parse(array = [0, 0]) {\n const points = []\n\n // if it is an array, we flatten it and therefore clone it to 1 depths\n if (array instanceof Array) {\n array = Array.prototype.concat.apply([], array)\n } else {\n // Else, it is considered as a string\n // parse points\n array = array.trim().split(delimiter).map(parseFloat)\n }\n\n // validate points - https://svgwg.org/svg2-draft/shapes.html#DataTypePoints\n // Odd number of coordinates is an error. In such cases, drop the last odd coordinate.\n if (array.length % 2 !== 0) array.pop()\n\n // wrap points in two-tuples\n for (let i = 0, len = array.length; i < len; i = i + 2) {\n points.push([array[i], array[i + 1]])\n }\n\n return points\n }\n\n // Resize poly string\n size(width, height) {\n let i\n const box = this.bbox()\n\n // recalculate position of all points according to new size\n for (i = this.length - 1; i >= 0; i--) {\n if (box.width)\n this[i][0] = ((this[i][0] - box.x) * width) / box.width + box.x\n if (box.height)\n this[i][1] = ((this[i][1] - box.y) * height) / box.height + box.y\n }\n\n return this\n }\n\n // Convert array to line object\n toLine() {\n return {\n x1: this[0][0],\n y1: this[0][1],\n x2: this[1][0],\n y2: this[1][1]\n }\n }\n\n // Convert array to string\n toString() {\n const array = []\n // convert to a poly point string\n for (let i = 0, il = this.length; i < il; i++) {\n array.push(this[i].join(','))\n }\n\n return array.join(' ')\n }\n\n transform(m) {\n return this.clone().transformO(m)\n }\n\n // transform points with matrix (similar to Point.transform)\n transformO(m) {\n if (!Matrix.isMatrixLike(m)) {\n m = new Matrix(m)\n }\n\n for (let i = this.length; i--; ) {\n // Perform the matrix multiplication\n const [x, y] = this[i]\n this[i][0] = m.a * x + m.c * y + m.e\n this[i][1] = m.b * x + m.d * y + m.f\n }\n\n return this\n }\n}\n","import PointArray from '../../types/PointArray.js'\n\nexport const MorphArray = PointArray\n\n// Move by left top corner over x-axis\nexport function x(x) {\n return x == null ? this.bbox().x : this.move(x, this.bbox().y)\n}\n\n// Move by left top corner over y-axis\nexport function y(y) {\n return y == null ? this.bbox().y : this.move(this.bbox().x, y)\n}\n\n// Set width of element\nexport function width(width) {\n const b = this.bbox()\n return width == null ? b.width : this.size(width, b.height)\n}\n\n// Set height of element\nexport function height(height) {\n const b = this.bbox()\n return height == null ? b.height : this.size(b.width, height)\n}\n","import {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { proportionalSize } from '../utils/utils.js'\nimport { registerMethods } from '../utils/methods.js'\nimport PointArray from '../types/PointArray.js'\nimport Shape from './Shape.js'\nimport * as pointed from '../modules/core/pointed.js'\n\nexport default class Line extends Shape {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('line', node), attrs)\n }\n\n // Get array\n array() {\n return new PointArray([\n [this.attr('x1'), this.attr('y1')],\n [this.attr('x2'), this.attr('y2')]\n ])\n }\n\n // Move by left top corner\n move(x, y) {\n return this.attr(this.array().move(x, y).toLine())\n }\n\n // Overwrite native plot() method\n plot(x1, y1, x2, y2) {\n if (x1 == null) {\n return this.array()\n } else if (typeof y1 !== 'undefined') {\n x1 = { x1, y1, x2, y2 }\n } else {\n x1 = new PointArray(x1).toLine()\n }\n\n return this.attr(x1)\n }\n\n // Set element size to given width and height\n size(width, height) {\n const p = proportionalSize(this, width, height)\n return this.attr(this.array().size(p.width, p.height).toLine())\n }\n}\n\nextend(Line, pointed)\n\nregisterMethods({\n Container: {\n // Create a line element\n line: wrapWithAttrCheck(function (...args) {\n // make sure plot is called as a setter\n // x1 is not necessarily a number, it can also be an array, a string and a PointArray\n return Line.prototype.plot.apply(\n this.put(new Line()),\n args[0] != null ? args : [0, 0, 0, 0]\n )\n })\n }\n})\n\nregister(Line, 'Line')\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Container from './Container.js'\n\nexport default class Marker extends Container {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('marker', node), attrs)\n }\n\n // Set height of element\n height(height) {\n return this.attr('markerHeight', height)\n }\n\n orient(orient) {\n return this.attr('orient', orient)\n }\n\n // Set marker refX and refY\n ref(x, y) {\n return this.attr('refX', x).attr('refY', y)\n }\n\n // Return the fill id\n toString() {\n return 'url(#' + this.id() + ')'\n }\n\n // Update marker\n update(block) {\n // remove all content\n this.clear()\n\n // invoke passed block\n if (typeof block === 'function') {\n block.call(this, this)\n }\n\n return this\n }\n\n // Set width of element\n width(width) {\n return this.attr('markerWidth', width)\n }\n}\n\nregisterMethods({\n Container: {\n marker(...args) {\n // Create marker element in defs\n return this.defs().marker(...args)\n }\n },\n Defs: {\n // Create marker\n marker: wrapWithAttrCheck(function (width, height, block) {\n // Set default viewbox to match the width and height, set ref to cx and cy and set orient to auto\n return this.put(new Marker())\n .size(width, height)\n .ref(width / 2, height / 2)\n .viewbox(0, 0, width, height)\n .attr('orient', 'auto')\n .update(block)\n })\n },\n marker: {\n // Create and attach markers\n marker(marker, width, height, block) {\n let attr = ['marker']\n\n // Build attribute name\n if (marker !== 'all') attr.push(marker)\n attr = attr.join('-')\n\n // Set marker attribute\n marker =\n arguments[1] instanceof Marker\n ? arguments[1]\n : this.defs().marker(width, height, block)\n\n return this.attr(attr, marker)\n }\n }\n})\n\nregister(Marker, 'Marker')\n","import { timeline } from '../modules/core/defaults.js'\nimport { extend } from '../utils/adopter.js'\n\n/***\nBase Class\n==========\nThe base stepper class that will be\n***/\n\nfunction makeSetterGetter(k, f) {\n return function (v) {\n if (v == null) return this[k]\n this[k] = v\n if (f) f.call(this)\n return this\n }\n}\n\nexport const easing = {\n '-': function (pos) {\n return pos\n },\n '<>': function (pos) {\n return -Math.cos(pos * Math.PI) / 2 + 0.5\n },\n '>': function (pos) {\n return Math.sin((pos * Math.PI) / 2)\n },\n '<': function (pos) {\n return -Math.cos((pos * Math.PI) / 2) + 1\n },\n bezier: function (x1, y1, x2, y2) {\n // see https://www.w3.org/TR/css-easing-1/#cubic-bezier-algo\n return function (t) {\n if (t < 0) {\n if (x1 > 0) {\n return (y1 / x1) * t\n } else if (x2 > 0) {\n return (y2 / x2) * t\n } else {\n return 0\n }\n } else if (t > 1) {\n if (x2 < 1) {\n return ((1 - y2) / (1 - x2)) * t + (y2 - x2) / (1 - x2)\n } else if (x1 < 1) {\n return ((1 - y1) / (1 - x1)) * t + (y1 - x1) / (1 - x1)\n } else {\n return 1\n }\n } else {\n return 3 * t * (1 - t) ** 2 * y1 + 3 * t ** 2 * (1 - t) * y2 + t ** 3\n }\n }\n },\n // see https://www.w3.org/TR/css-easing-1/#step-timing-function-algo\n steps: function (steps, stepPosition = 'end') {\n // deal with \"jump-\" prefix\n stepPosition = stepPosition.split('-').reverse()[0]\n\n let jumps = steps\n if (stepPosition === 'none') {\n --jumps\n } else if (stepPosition === 'both') {\n ++jumps\n }\n\n // The beforeFlag is essentially useless\n return (t, beforeFlag = false) => {\n // Step is called currentStep in referenced url\n let step = Math.floor(t * steps)\n const jumping = (t * step) % 1 === 0\n\n if (stepPosition === 'start' || stepPosition === 'both') {\n ++step\n }\n\n if (beforeFlag && jumping) {\n --step\n }\n\n if (t >= 0 && step < 0) {\n step = 0\n }\n\n if (t <= 1 && step > jumps) {\n step = jumps\n }\n\n return step / jumps\n }\n }\n}\n\nexport class Stepper {\n done() {\n return false\n }\n}\n\n/***\nEasing Functions\n================\n***/\n\nexport class Ease extends Stepper {\n constructor(fn = timeline.ease) {\n super()\n this.ease = easing[fn] || fn\n }\n\n step(from, to, pos) {\n if (typeof from !== 'number') {\n return pos < 1 ? from : to\n }\n return from + (to - from) * this.ease(pos)\n }\n}\n\n/***\nController Types\n================\n***/\n\nexport class Controller extends Stepper {\n constructor(fn) {\n super()\n this.stepper = fn\n }\n\n done(c) {\n return c.done\n }\n\n step(current, target, dt, c) {\n return this.stepper(current, target, dt, c)\n }\n}\n\nfunction recalculate() {\n // Apply the default parameters\n const duration = (this._duration || 500) / 1000\n const overshoot = this._overshoot || 0\n\n // Calculate the PID natural response\n const eps = 1e-10\n const pi = Math.PI\n const os = Math.log(overshoot / 100 + eps)\n const zeta = -os / Math.sqrt(pi * pi + os * os)\n const wn = 3.9 / (zeta * duration)\n\n // Calculate the Spring values\n this.d = 2 * zeta * wn\n this.k = wn * wn\n}\n\nexport class Spring extends Controller {\n constructor(duration = 500, overshoot = 0) {\n super()\n this.duration(duration).overshoot(overshoot)\n }\n\n step(current, target, dt, c) {\n if (typeof current === 'string') return current\n c.done = dt === Infinity\n if (dt === Infinity) return target\n if (dt === 0) return current\n\n if (dt > 100) dt = 16\n\n dt /= 1000\n\n // Get the previous velocity\n const velocity = c.velocity || 0\n\n // Apply the control to get the new position and store it\n const acceleration = -this.d * velocity - this.k * (current - target)\n const newPosition = current + velocity * dt + (acceleration * dt * dt) / 2\n\n // Store the velocity\n c.velocity = velocity + acceleration * dt\n\n // Figure out if we have converged, and if so, pass the value\n c.done = Math.abs(target - newPosition) + Math.abs(velocity) < 0.002\n return c.done ? target : newPosition\n }\n}\n\nextend(Spring, {\n duration: makeSetterGetter('_duration', recalculate),\n overshoot: makeSetterGetter('_overshoot', recalculate)\n})\n\nexport class PID extends Controller {\n constructor(p = 0.1, i = 0.01, d = 0, windup = 1000) {\n super()\n this.p(p).i(i).d(d).windup(windup)\n }\n\n step(current, target, dt, c) {\n if (typeof current === 'string') return current\n c.done = dt === Infinity\n\n if (dt === Infinity) return target\n if (dt === 0) return current\n\n const p = target - current\n let i = (c.integral || 0) + p * dt\n const d = (p - (c.error || 0)) / dt\n const windup = this._windup\n\n // antiwindup\n if (windup !== false) {\n i = Math.max(-windup, Math.min(i, windup))\n }\n\n c.error = p\n c.integral = i\n\n c.done = Math.abs(p) < 0.001\n\n return c.done ? target : current + (this.P * p + this.I * i + this.D * d)\n }\n}\n\nextend(PID, {\n windup: makeSetterGetter('_windup'),\n p: makeSetterGetter('P'),\n i: makeSetterGetter('I'),\n d: makeSetterGetter('D')\n})\n","import { isPathLetter } from '../modules/core/regex.js'\nimport Point from '../types/Point.js'\n\nconst segmentParameters = {\n M: 2,\n L: 2,\n H: 1,\n V: 1,\n C: 6,\n S: 4,\n Q: 4,\n T: 2,\n A: 7,\n Z: 0\n}\n\nconst pathHandlers = {\n M: function (c, p, p0) {\n p.x = p0.x = c[0]\n p.y = p0.y = c[1]\n\n return ['M', p.x, p.y]\n },\n L: function (c, p) {\n p.x = c[0]\n p.y = c[1]\n return ['L', c[0], c[1]]\n },\n H: function (c, p) {\n p.x = c[0]\n return ['H', c[0]]\n },\n V: function (c, p) {\n p.y = c[0]\n return ['V', c[0]]\n },\n C: function (c, p) {\n p.x = c[4]\n p.y = c[5]\n return ['C', c[0], c[1], c[2], c[3], c[4], c[5]]\n },\n S: function (c, p) {\n p.x = c[2]\n p.y = c[3]\n return ['S', c[0], c[1], c[2], c[3]]\n },\n Q: function (c, p) {\n p.x = c[2]\n p.y = c[3]\n return ['Q', c[0], c[1], c[2], c[3]]\n },\n T: function (c, p) {\n p.x = c[0]\n p.y = c[1]\n return ['T', c[0], c[1]]\n },\n Z: function (c, p, p0) {\n p.x = p0.x\n p.y = p0.y\n return ['Z']\n },\n A: function (c, p) {\n p.x = c[5]\n p.y = c[6]\n return ['A', c[0], c[1], c[2], c[3], c[4], c[5], c[6]]\n }\n}\n\nconst mlhvqtcsaz = 'mlhvqtcsaz'.split('')\n\nfor (let i = 0, il = mlhvqtcsaz.length; i < il; ++i) {\n pathHandlers[mlhvqtcsaz[i]] = (function (i) {\n return function (c, p, p0) {\n if (i === 'H') c[0] = c[0] + p.x\n else if (i === 'V') c[0] = c[0] + p.y\n else if (i === 'A') {\n c[5] = c[5] + p.x\n c[6] = c[6] + p.y\n } else {\n for (let j = 0, jl = c.length; j < jl; ++j) {\n c[j] = c[j] + (j % 2 ? p.y : p.x)\n }\n }\n\n return pathHandlers[i](c, p, p0)\n }\n })(mlhvqtcsaz[i].toUpperCase())\n}\n\nfunction makeAbsolut(parser) {\n const command = parser.segment[0]\n return pathHandlers[command](parser.segment.slice(1), parser.p, parser.p0)\n}\n\nfunction segmentComplete(parser) {\n return (\n parser.segment.length &&\n parser.segment.length - 1 ===\n segmentParameters[parser.segment[0].toUpperCase()]\n )\n}\n\nfunction startNewSegment(parser, token) {\n parser.inNumber && finalizeNumber(parser, false)\n const pathLetter = isPathLetter.test(token)\n\n if (pathLetter) {\n parser.segment = [token]\n } else {\n const lastCommand = parser.lastCommand\n const small = lastCommand.toLowerCase()\n const isSmall = lastCommand === small\n parser.segment = [small === 'm' ? (isSmall ? 'l' : 'L') : lastCommand]\n }\n\n parser.inSegment = true\n parser.lastCommand = parser.segment[0]\n\n return pathLetter\n}\n\nfunction finalizeNumber(parser, inNumber) {\n if (!parser.inNumber) throw new Error('Parser Error')\n parser.number && parser.segment.push(parseFloat(parser.number))\n parser.inNumber = inNumber\n parser.number = ''\n parser.pointSeen = false\n parser.hasExponent = false\n\n if (segmentComplete(parser)) {\n finalizeSegment(parser)\n }\n}\n\nfunction finalizeSegment(parser) {\n parser.inSegment = false\n if (parser.absolute) {\n parser.segment = makeAbsolut(parser)\n }\n parser.segments.push(parser.segment)\n}\n\nfunction isArcFlag(parser) {\n if (!parser.segment.length) return false\n const isArc = parser.segment[0].toUpperCase() === 'A'\n const length = parser.segment.length\n\n return isArc && (length === 4 || length === 5)\n}\n\nfunction isExponential(parser) {\n return parser.lastToken.toUpperCase() === 'E'\n}\n\nconst pathDelimiters = new Set([' ', ',', '\\t', '\\n', '\\r', '\\f'])\nexport function pathParser(d, toAbsolute = true) {\n let index = 0\n let token = ''\n const parser = {\n segment: [],\n inNumber: false,\n number: '',\n lastToken: '',\n inSegment: false,\n segments: [],\n pointSeen: false,\n hasExponent: false,\n absolute: toAbsolute,\n p0: new Point(),\n p: new Point()\n }\n\n while (((parser.lastToken = token), (token = d.charAt(index++)))) {\n if (!parser.inSegment) {\n if (startNewSegment(parser, token)) {\n continue\n }\n }\n\n if (token === '.') {\n if (parser.pointSeen || parser.hasExponent) {\n finalizeNumber(parser, false)\n --index\n continue\n }\n parser.inNumber = true\n parser.pointSeen = true\n parser.number += token\n continue\n }\n\n if (!isNaN(parseInt(token))) {\n if (parser.number === '0' || isArcFlag(parser)) {\n parser.inNumber = true\n parser.number = token\n finalizeNumber(parser, true)\n continue\n }\n\n parser.inNumber = true\n parser.number += token\n continue\n }\n\n if (pathDelimiters.has(token)) {\n if (parser.inNumber) {\n finalizeNumber(parser, false)\n }\n continue\n }\n\n if (token === '-' || token === '+') {\n if (parser.inNumber && !isExponential(parser)) {\n finalizeNumber(parser, false)\n --index\n continue\n }\n parser.number += token\n parser.inNumber = true\n continue\n }\n\n if (token.toUpperCase() === 'E') {\n parser.number += token\n parser.hasExponent = true\n continue\n }\n\n if (isPathLetter.test(token)) {\n if (parser.inNumber) {\n finalizeNumber(parser, false)\n } else if (!segmentComplete(parser)) {\n throw new Error('parser Error')\n } else {\n finalizeSegment(parser)\n }\n --index\n }\n }\n\n if (parser.inNumber) {\n finalizeNumber(parser, false)\n }\n\n if (parser.inSegment && segmentComplete(parser)) {\n finalizeSegment(parser)\n }\n\n return parser.segments\n}\n","import SVGArray from './SVGArray.js'\nimport parser from '../modules/core/parser.js'\nimport Box from './Box.js'\nimport { pathParser } from '../utils/pathParser.js'\n\nfunction arrayToString(a) {\n let s = ''\n for (let i = 0, il = a.length; i < il; i++) {\n s += a[i][0]\n\n if (a[i][1] != null) {\n s += a[i][1]\n\n if (a[i][2] != null) {\n s += ' '\n s += a[i][2]\n\n if (a[i][3] != null) {\n s += ' '\n s += a[i][3]\n s += ' '\n s += a[i][4]\n\n if (a[i][5] != null) {\n s += ' '\n s += a[i][5]\n s += ' '\n s += a[i][6]\n\n if (a[i][7] != null) {\n s += ' '\n s += a[i][7]\n }\n }\n }\n }\n }\n }\n\n return s + ' '\n}\n\nexport default class PathArray extends SVGArray {\n // Get bounding box of path\n bbox() {\n parser().path.setAttribute('d', this.toString())\n return new Box(parser.nodes.path.getBBox())\n }\n\n // Move path string\n move(x, y) {\n // get bounding box of current situation\n const box = this.bbox()\n\n // get relative offset\n x -= box.x\n y -= box.y\n\n if (!isNaN(x) && !isNaN(y)) {\n // move every point\n for (let l, i = this.length - 1; i >= 0; i--) {\n l = this[i][0]\n\n if (l === 'M' || l === 'L' || l === 'T') {\n this[i][1] += x\n this[i][2] += y\n } else if (l === 'H') {\n this[i][1] += x\n } else if (l === 'V') {\n this[i][1] += y\n } else if (l === 'C' || l === 'S' || l === 'Q') {\n this[i][1] += x\n this[i][2] += y\n this[i][3] += x\n this[i][4] += y\n\n if (l === 'C') {\n this[i][5] += x\n this[i][6] += y\n }\n } else if (l === 'A') {\n this[i][6] += x\n this[i][7] += y\n }\n }\n }\n\n return this\n }\n\n // Absolutize and parse path to array\n parse(d = 'M0 0') {\n if (Array.isArray(d)) {\n d = Array.prototype.concat.apply([], d).toString()\n }\n\n return pathParser(d)\n }\n\n // Resize path string\n size(width, height) {\n // get bounding box of current situation\n const box = this.bbox()\n let i, l\n\n // If the box width or height is 0 then we ignore\n // transformations on the respective axis\n box.width = box.width === 0 ? 1 : box.width\n box.height = box.height === 0 ? 1 : box.height\n\n // recalculate position of all points according to new size\n for (i = this.length - 1; i >= 0; i--) {\n l = this[i][0]\n\n if (l === 'M' || l === 'L' || l === 'T') {\n this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x\n this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y\n } else if (l === 'H') {\n this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x\n } else if (l === 'V') {\n this[i][1] = ((this[i][1] - box.y) * height) / box.height + box.y\n } else if (l === 'C' || l === 'S' || l === 'Q') {\n this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x\n this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y\n this[i][3] = ((this[i][3] - box.x) * width) / box.width + box.x\n this[i][4] = ((this[i][4] - box.y) * height) / box.height + box.y\n\n if (l === 'C') {\n this[i][5] = ((this[i][5] - box.x) * width) / box.width + box.x\n this[i][6] = ((this[i][6] - box.y) * height) / box.height + box.y\n }\n } else if (l === 'A') {\n // resize radii\n this[i][1] = (this[i][1] * width) / box.width\n this[i][2] = (this[i][2] * height) / box.height\n\n // move position values\n this[i][6] = ((this[i][6] - box.x) * width) / box.width + box.x\n this[i][7] = ((this[i][7] - box.y) * height) / box.height + box.y\n }\n }\n\n return this\n }\n\n // Convert array to string\n toString() {\n return arrayToString(this)\n }\n}\n","import { Ease } from './Controller.js'\nimport {\n delimiter,\n numberAndUnit,\n isPathLetter\n} from '../modules/core/regex.js'\nimport { extend } from '../utils/adopter.js'\nimport Color from '../types/Color.js'\nimport PathArray from '../types/PathArray.js'\nimport SVGArray from '../types/SVGArray.js'\nimport SVGNumber from '../types/SVGNumber.js'\n\nconst getClassForType = (value) => {\n const type = typeof value\n\n if (type === 'number') {\n return SVGNumber\n } else if (type === 'string') {\n if (Color.isColor(value)) {\n return Color\n } else if (delimiter.test(value)) {\n return isPathLetter.test(value) ? PathArray : SVGArray\n } else if (numberAndUnit.test(value)) {\n return SVGNumber\n } else {\n return NonMorphable\n }\n } else if (morphableTypes.indexOf(value.constructor) > -1) {\n return value.constructor\n } else if (Array.isArray(value)) {\n return SVGArray\n } else if (type === 'object') {\n return ObjectBag\n } else {\n return NonMorphable\n }\n}\n\nexport default class Morphable {\n constructor(stepper) {\n this._stepper = stepper || new Ease('-')\n\n this._from = null\n this._to = null\n this._type = null\n this._context = null\n this._morphObj = null\n }\n\n at(pos) {\n return this._morphObj.morph(\n this._from,\n this._to,\n pos,\n this._stepper,\n this._context\n )\n }\n\n done() {\n const complete = this._context.map(this._stepper.done).reduce(function (\n last,\n curr\n ) {\n return last && curr\n }, true)\n return complete\n }\n\n from(val) {\n if (val == null) {\n return this._from\n }\n\n this._from = this._set(val)\n return this\n }\n\n stepper(stepper) {\n if (stepper == null) return this._stepper\n this._stepper = stepper\n return this\n }\n\n to(val) {\n if (val == null) {\n return this._to\n }\n\n this._to = this._set(val)\n return this\n }\n\n type(type) {\n // getter\n if (type == null) {\n return this._type\n }\n\n // setter\n this._type = type\n return this\n }\n\n _set(value) {\n if (!this._type) {\n this.type(getClassForType(value))\n }\n\n let result = new this._type(value)\n if (this._type === Color) {\n result = this._to\n ? result[this._to[4]]()\n : this._from\n ? result[this._from[4]]()\n : result\n }\n\n if (this._type === ObjectBag) {\n result = this._to\n ? result.align(this._to)\n : this._from\n ? result.align(this._from)\n : result\n }\n\n result = result.toConsumable()\n\n this._morphObj = this._morphObj || new this._type()\n this._context =\n this._context ||\n Array.apply(null, Array(result.length))\n .map(Object)\n .map(function (o) {\n o.done = true\n return o\n })\n return result\n }\n}\n\nexport class NonMorphable {\n constructor(...args) {\n this.init(...args)\n }\n\n init(val) {\n val = Array.isArray(val) ? val[0] : val\n this.value = val\n return this\n }\n\n toArray() {\n return [this.value]\n }\n\n valueOf() {\n return this.value\n }\n}\n\nexport class TransformBag {\n constructor(...args) {\n this.init(...args)\n }\n\n init(obj) {\n if (Array.isArray(obj)) {\n obj = {\n scaleX: obj[0],\n scaleY: obj[1],\n shear: obj[2],\n rotate: obj[3],\n translateX: obj[4],\n translateY: obj[5],\n originX: obj[6],\n originY: obj[7]\n }\n }\n\n Object.assign(this, TransformBag.defaults, obj)\n return this\n }\n\n toArray() {\n const v = this\n\n return [\n v.scaleX,\n v.scaleY,\n v.shear,\n v.rotate,\n v.translateX,\n v.translateY,\n v.originX,\n v.originY\n ]\n }\n}\n\nTransformBag.defaults = {\n scaleX: 1,\n scaleY: 1,\n shear: 0,\n rotate: 0,\n translateX: 0,\n translateY: 0,\n originX: 0,\n originY: 0\n}\n\nconst sortByKey = (a, b) => {\n return a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0\n}\n\nexport class ObjectBag {\n constructor(...args) {\n this.init(...args)\n }\n\n align(other) {\n const values = this.values\n for (let i = 0, il = values.length; i < il; ++i) {\n // If the type is the same we only need to check if the color is in the correct format\n if (values[i + 1] === other[i + 1]) {\n if (values[i + 1] === Color && other[i + 7] !== values[i + 7]) {\n const space = other[i + 7]\n const color = new Color(this.values.splice(i + 3, 5))\n [space]()\n .toArray()\n this.values.splice(i + 3, 0, ...color)\n }\n\n i += values[i + 2] + 2\n continue\n }\n\n if (!other[i + 1]) {\n return this\n }\n\n // The types differ, so we overwrite the new type with the old one\n // And initialize it with the types default (e.g. black for color or 0 for number)\n const defaultObject = new other[i + 1]().toArray()\n\n // Than we fix the values array\n const toDelete = values[i + 2] + 3\n\n values.splice(\n i,\n toDelete,\n other[i],\n other[i + 1],\n other[i + 2],\n ...defaultObject\n )\n\n i += values[i + 2] + 2\n }\n return this\n }\n\n init(objOrArr) {\n this.values = []\n\n if (Array.isArray(objOrArr)) {\n this.values = objOrArr.slice()\n return\n }\n\n objOrArr = objOrArr || {}\n const entries = []\n\n for (const i in objOrArr) {\n const Type = getClassForType(objOrArr[i])\n const val = new Type(objOrArr[i]).toArray()\n entries.push([i, Type, val.length, ...val])\n }\n\n entries.sort(sortByKey)\n\n this.values = entries.reduce((last, curr) => last.concat(curr), [])\n return this\n }\n\n toArray() {\n return this.values\n }\n\n valueOf() {\n const obj = {}\n const arr = this.values\n\n // for (var i = 0, len = arr.length; i < len; i += 2) {\n while (arr.length) {\n const key = arr.shift()\n const Type = arr.shift()\n const num = arr.shift()\n const values = arr.splice(0, num)\n obj[key] = new Type(values) // .valueOf()\n }\n\n return obj\n }\n}\n\nconst morphableTypes = [NonMorphable, TransformBag, ObjectBag]\n\nexport function registerMorphableType(type = []) {\n morphableTypes.push(...[].concat(type))\n}\n\nexport function makeMorphable() {\n extend(morphableTypes, {\n to(val) {\n return new Morphable()\n .type(this.constructor)\n .from(this.toArray()) // this.valueOf())\n .to(val)\n },\n fromArray(arr) {\n this.init(arr)\n return this\n },\n toConsumable() {\n return this.toArray()\n },\n morph(from, to, pos, stepper, context) {\n const mapper = function (i, index) {\n return stepper.step(i, to[index], pos, context[index], context)\n }\n\n return this.fromArray(from.map(mapper))\n }\n })\n}\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { proportionalSize } from '../utils/utils.js'\nimport { registerMethods } from '../utils/methods.js'\nimport PathArray from '../types/PathArray.js'\nimport Shape from './Shape.js'\n\nexport default class Path extends Shape {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('path', node), attrs)\n }\n\n // Get array\n array() {\n return this._array || (this._array = new PathArray(this.attr('d')))\n }\n\n // Clear array cache\n clear() {\n delete this._array\n return this\n }\n\n // Set height of element\n height(height) {\n return height == null\n ? this.bbox().height\n : this.size(this.bbox().width, height)\n }\n\n // Move by left top corner\n move(x, y) {\n return this.attr('d', this.array().move(x, y))\n }\n\n // Plot new path\n plot(d) {\n return d == null\n ? this.array()\n : this.clear().attr(\n 'd',\n typeof d === 'string' ? d : (this._array = new PathArray(d))\n )\n }\n\n // Set element size to given width and height\n size(width, height) {\n const p = proportionalSize(this, width, height)\n return this.attr('d', this.array().size(p.width, p.height))\n }\n\n // Set width of element\n width(width) {\n return width == null\n ? this.bbox().width\n : this.size(width, this.bbox().height)\n }\n\n // Move by left top corner over x-axis\n x(x) {\n return x == null ? this.bbox().x : this.move(x, this.bbox().y)\n }\n\n // Move by left top corner over y-axis\n y(y) {\n return y == null ? this.bbox().y : this.move(this.bbox().x, y)\n }\n}\n\n// Define morphable array\nPath.prototype.MorphArray = PathArray\n\n// Add parent method\nregisterMethods({\n Container: {\n // Create a wrapped path element\n path: wrapWithAttrCheck(function (d) {\n // make sure plot is called as a setter\n return this.put(new Path()).plot(d || new PathArray())\n })\n }\n})\n\nregister(Path, 'Path')\n","import { proportionalSize } from '../../utils/utils.js'\nimport PointArray from '../../types/PointArray.js'\n\n// Get array\nexport function array() {\n return this._array || (this._array = new PointArray(this.attr('points')))\n}\n\n// Clear array cache\nexport function clear() {\n delete this._array\n return this\n}\n\n// Move by left top corner\nexport function move(x, y) {\n return this.attr('points', this.array().move(x, y))\n}\n\n// Plot new path\nexport function plot(p) {\n return p == null\n ? this.array()\n : this.clear().attr(\n 'points',\n typeof p === 'string' ? p : (this._array = new PointArray(p))\n )\n}\n\n// Set element size to given width and height\nexport function size(width, height) {\n const p = proportionalSize(this, width, height)\n return this.attr('points', this.array().size(p.width, p.height))\n}\n","import {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport PointArray from '../types/PointArray.js'\nimport Shape from './Shape.js'\nimport * as pointed from '../modules/core/pointed.js'\nimport * as poly from '../modules/core/poly.js'\n\nexport default class Polygon extends Shape {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('polygon', node), attrs)\n }\n}\n\nregisterMethods({\n Container: {\n // Create a wrapped polygon element\n polygon: wrapWithAttrCheck(function (p) {\n // make sure plot is called as a setter\n return this.put(new Polygon()).plot(p || new PointArray())\n })\n }\n})\n\nextend(Polygon, pointed)\nextend(Polygon, poly)\nregister(Polygon, 'Polygon')\n","import {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport PointArray from '../types/PointArray.js'\nimport Shape from './Shape.js'\nimport * as pointed from '../modules/core/pointed.js'\nimport * as poly from '../modules/core/poly.js'\n\nexport default class Polyline extends Shape {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('polyline', node), attrs)\n }\n}\n\nregisterMethods({\n Container: {\n // Create a wrapped polygon element\n polyline: wrapWithAttrCheck(function (p) {\n // make sure plot is called as a setter\n return this.put(new Polyline()).plot(p || new PointArray())\n })\n }\n})\n\nextend(Polyline, pointed)\nextend(Polyline, poly)\nregister(Polyline, 'Polyline')\n","import {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport { rx, ry } from '../modules/core/circled.js'\nimport Shape from './Shape.js'\n\nexport default class Rect extends Shape {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('rect', node), attrs)\n }\n}\n\nextend(Rect, { rx, ry })\n\nregisterMethods({\n Container: {\n // Create a rect element\n rect: wrapWithAttrCheck(function (width, height) {\n return this.put(new Rect()).size(width, height)\n })\n }\n})\n\nregister(Rect, 'Rect')\n","export default class Queue {\n constructor() {\n this._first = null\n this._last = null\n }\n\n // Shows us the first item in the list\n first() {\n return this._first && this._first.value\n }\n\n // Shows us the last item in the list\n last() {\n return this._last && this._last.value\n }\n\n push(value) {\n // An item stores an id and the provided value\n const item =\n typeof value.next !== 'undefined'\n ? value\n : { value: value, next: null, prev: null }\n\n // Deal with the queue being empty or populated\n if (this._last) {\n item.prev = this._last\n this._last.next = item\n this._last = item\n } else {\n this._last = item\n this._first = item\n }\n\n // Return the current item\n return item\n }\n\n // Removes the item that was returned from the push\n remove(item) {\n // Relink the previous item\n if (item.prev) item.prev.next = item.next\n if (item.next) item.next.prev = item.prev\n if (item === this._last) this._last = item.prev\n if (item === this._first) this._first = item.next\n\n // Invalidate item\n item.prev = null\n item.next = null\n }\n\n shift() {\n // Check if we have a value\n const remove = this._first\n if (!remove) return null\n\n // If we do, remove it and relink things\n this._first = remove.next\n if (this._first) this._first.prev = null\n this._last = this._first ? this._last : null\n return remove.value\n }\n}\n","import { globals } from '../utils/window.js'\nimport Queue from './Queue.js'\n\nconst Animator = {\n nextDraw: null,\n frames: new Queue(),\n timeouts: new Queue(),\n immediates: new Queue(),\n timer: () => globals.window.performance || globals.window.Date,\n transforms: [],\n\n frame(fn) {\n // Store the node\n const node = Animator.frames.push({ run: fn })\n\n // Request an animation frame if we don't have one\n if (Animator.nextDraw === null) {\n Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw)\n }\n\n // Return the node so we can remove it easily\n return node\n },\n\n timeout(fn, delay) {\n delay = delay || 0\n\n // Work out when the event should fire\n const time = Animator.timer().now() + delay\n\n // Add the timeout to the end of the queue\n const node = Animator.timeouts.push({ run: fn, time: time })\n\n // Request another animation frame if we need one\n if (Animator.nextDraw === null) {\n Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw)\n }\n\n return node\n },\n\n immediate(fn) {\n // Add the immediate fn to the end of the queue\n const node = Animator.immediates.push(fn)\n // Request another animation frame if we need one\n if (Animator.nextDraw === null) {\n Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw)\n }\n\n return node\n },\n\n cancelFrame(node) {\n node != null && Animator.frames.remove(node)\n },\n\n clearTimeout(node) {\n node != null && Animator.timeouts.remove(node)\n },\n\n cancelImmediate(node) {\n node != null && Animator.immediates.remove(node)\n },\n\n _draw(now) {\n // Run all the timeouts we can run, if they are not ready yet, add them\n // to the end of the queue immediately! (bad timeouts!!! [sarcasm])\n let nextTimeout = null\n const lastTimeout = Animator.timeouts.last()\n while ((nextTimeout = Animator.timeouts.shift())) {\n // Run the timeout if its time, or push it to the end\n if (now >= nextTimeout.time) {\n nextTimeout.run()\n } else {\n Animator.timeouts.push(nextTimeout)\n }\n\n // If we hit the last item, we should stop shifting out more items\n if (nextTimeout === lastTimeout) break\n }\n\n // Run all of the animation frames\n let nextFrame = null\n const lastFrame = Animator.frames.last()\n while (nextFrame !== lastFrame && (nextFrame = Animator.frames.shift())) {\n nextFrame.run(now)\n }\n\n let nextImmediate = null\n while ((nextImmediate = Animator.immediates.shift())) {\n nextImmediate()\n }\n\n // If we have remaining timeouts or frames, draw until we don't anymore\n Animator.nextDraw =\n Animator.timeouts.first() || Animator.frames.first()\n ? globals.window.requestAnimationFrame(Animator._draw)\n : null\n }\n}\n\nexport default Animator\n","import { globals } from '../utils/window.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Animator from './Animator.js'\nimport EventTarget from '../types/EventTarget.js'\n\nconst makeSchedule = function (runnerInfo) {\n const start = runnerInfo.start\n const duration = runnerInfo.runner.duration()\n const end = start + duration\n return {\n start: start,\n duration: duration,\n end: end,\n runner: runnerInfo.runner\n }\n}\n\nconst defaultSource = function () {\n const w = globals.window\n return (w.performance || w.Date).now()\n}\n\nexport default class Timeline extends EventTarget {\n // Construct a new timeline on the given element\n constructor(timeSource = defaultSource) {\n super()\n\n this._timeSource = timeSource\n\n // terminate resets all variables to their initial state\n this.terminate()\n }\n\n active() {\n return !!this._nextFrame\n }\n\n finish() {\n // Go to end and pause\n this.time(this.getEndTimeOfTimeline() + 1)\n return this.pause()\n }\n\n // Calculates the end of the timeline\n getEndTime() {\n const lastRunnerInfo = this.getLastRunnerInfo()\n const lastDuration = lastRunnerInfo ? lastRunnerInfo.runner.duration() : 0\n const lastStartTime = lastRunnerInfo ? lastRunnerInfo.start : this._time\n return lastStartTime + lastDuration\n }\n\n getEndTimeOfTimeline() {\n const endTimes = this._runners.map((i) => i.start + i.runner.duration())\n return Math.max(0, ...endTimes)\n }\n\n getLastRunnerInfo() {\n return this.getRunnerInfoById(this._lastRunnerId)\n }\n\n getRunnerInfoById(id) {\n return this._runners[this._runnerIds.indexOf(id)] || null\n }\n\n pause() {\n this._paused = true\n return this._continue()\n }\n\n persist(dtOrForever) {\n if (dtOrForever == null) return this._persist\n this._persist = dtOrForever\n return this\n }\n\n play() {\n // Now make sure we are not paused and continue the animation\n this._paused = false\n return this.updateTime()._continue()\n }\n\n reverse(yes) {\n const currentSpeed = this.speed()\n if (yes == null) return this.speed(-currentSpeed)\n\n const positive = Math.abs(currentSpeed)\n return this.speed(yes ? -positive : positive)\n }\n\n // schedules a runner on the timeline\n schedule(runner, delay, when) {\n if (runner == null) {\n return this._runners.map(makeSchedule)\n }\n\n // The start time for the next animation can either be given explicitly,\n // derived from the current timeline time or it can be relative to the\n // last start time to chain animations directly\n\n let absoluteStartTime = 0\n const endTime = this.getEndTime()\n delay = delay || 0\n\n // Work out when to start the animation\n if (when == null || when === 'last' || when === 'after') {\n // Take the last time and increment\n absoluteStartTime = endTime\n } else if (when === 'absolute' || when === 'start') {\n absoluteStartTime = delay\n delay = 0\n } else if (when === 'now') {\n absoluteStartTime = this._time\n } else if (when === 'relative') {\n const runnerInfo = this.getRunnerInfoById(runner.id)\n if (runnerInfo) {\n absoluteStartTime = runnerInfo.start + delay\n delay = 0\n }\n } else if (when === 'with-last') {\n const lastRunnerInfo = this.getLastRunnerInfo()\n const lastStartTime = lastRunnerInfo ? lastRunnerInfo.start : this._time\n absoluteStartTime = lastStartTime\n } else {\n throw new Error('Invalid value for the \"when\" parameter')\n }\n\n // Manage runner\n runner.unschedule()\n runner.timeline(this)\n\n const persist = runner.persist()\n const runnerInfo = {\n persist: persist === null ? this._persist : persist,\n start: absoluteStartTime + delay,\n runner\n }\n\n this._lastRunnerId = runner.id\n\n this._runners.push(runnerInfo)\n this._runners.sort((a, b) => a.start - b.start)\n this._runnerIds = this._runners.map((info) => info.runner.id)\n\n this.updateTime()._continue()\n return this\n }\n\n seek(dt) {\n return this.time(this._time + dt)\n }\n\n source(fn) {\n if (fn == null) return this._timeSource\n this._timeSource = fn\n return this\n }\n\n speed(speed) {\n if (speed == null) return this._speed\n this._speed = speed\n return this\n }\n\n stop() {\n // Go to start and pause\n this.time(0)\n return this.pause()\n }\n\n time(time) {\n if (time == null) return this._time\n this._time = time\n return this._continue(true)\n }\n\n // Remove the runner from this timeline\n unschedule(runner) {\n const index = this._runnerIds.indexOf(runner.id)\n if (index < 0) return this\n\n this._runners.splice(index, 1)\n this._runnerIds.splice(index, 1)\n\n runner.timeline(null)\n return this\n }\n\n // Makes sure, that after pausing the time doesn't jump\n updateTime() {\n if (!this.active()) {\n this._lastSourceTime = this._timeSource()\n }\n return this\n }\n\n // Checks if we are running and continues the animation\n _continue(immediateStep = false) {\n Animator.cancelFrame(this._nextFrame)\n this._nextFrame = null\n\n if (immediateStep) return this._stepImmediate()\n if (this._paused) return this\n\n this._nextFrame = Animator.frame(this._step)\n return this\n }\n\n _stepFn(immediateStep = false) {\n // Get the time delta from the last time and update the time\n const time = this._timeSource()\n let dtSource = time - this._lastSourceTime\n\n if (immediateStep) dtSource = 0\n\n const dtTime = this._speed * dtSource + (this._time - this._lastStepTime)\n this._lastSourceTime = time\n\n // Only update the time if we use the timeSource.\n // Otherwise use the current time\n if (!immediateStep) {\n // Update the time\n this._time += dtTime\n this._time = this._time < 0 ? 0 : this._time\n }\n this._lastStepTime = this._time\n this.fire('time', this._time)\n\n // This is for the case that the timeline was seeked so that the time\n // is now before the startTime of the runner. That is why we need to set\n // the runner to position 0\n\n // FIXME:\n // However, resetting in insertion order leads to bugs. Considering the case,\n // where 2 runners change the same attribute but in different times,\n // resetting both of them will lead to the case where the later defined\n // runner always wins the reset even if the other runner started earlier\n // and therefore should win the attribute battle\n // this can be solved by resetting them backwards\n for (let k = this._runners.length; k--; ) {\n // Get and run the current runner and ignore it if its inactive\n const runnerInfo = this._runners[k]\n const runner = runnerInfo.runner\n\n // Make sure that we give the actual difference\n // between runner start time and now\n const dtToStart = this._time - runnerInfo.start\n\n // Dont run runner if not started yet\n // and try to reset it\n if (dtToStart <= 0) {\n runner.reset()\n }\n }\n\n // Run all of the runners directly\n let runnersLeft = false\n for (let i = 0, len = this._runners.length; i < len; i++) {\n // Get and run the current runner and ignore it if its inactive\n const runnerInfo = this._runners[i]\n const runner = runnerInfo.runner\n let dt = dtTime\n\n // Make sure that we give the actual difference\n // between runner start time and now\n const dtToStart = this._time - runnerInfo.start\n\n // Dont run runner if not started yet\n if (dtToStart <= 0) {\n runnersLeft = true\n continue\n } else if (dtToStart < dt) {\n // Adjust dt to make sure that animation is on point\n dt = dtToStart\n }\n\n if (!runner.active()) continue\n\n // If this runner is still going, signal that we need another animation\n // frame, otherwise, remove the completed runner\n const finished = runner.step(dt).done\n if (!finished) {\n runnersLeft = true\n // continue\n } else if (runnerInfo.persist !== true) {\n // runner is finished. And runner might get removed\n const endTime = runner.duration() - runner.time() + this._time\n\n if (endTime + runnerInfo.persist < this._time) {\n // Delete runner and correct index\n runner.unschedule()\n --i\n --len\n }\n }\n }\n\n // Basically: we continue when there are runners right from us in time\n // when -->, and when runners are left from us when <--\n if (\n (runnersLeft && !(this._speed < 0 && this._time === 0)) ||\n (this._runnerIds.length && this._speed < 0 && this._time > 0)\n ) {\n this._continue()\n } else {\n this.pause()\n this.fire('finished')\n }\n\n return this\n }\n\n terminate() {\n // cleanup memory\n\n // Store the timing variables\n this._startTime = 0\n this._speed = 1.0\n\n // Determines how long a runner is hold in memory. Can be a dt or true/false\n this._persist = 0\n\n // Keep track of the running animations and their starting parameters\n this._nextFrame = null\n this._paused = true\n this._runners = []\n this._runnerIds = []\n this._lastRunnerId = -1\n this._time = 0\n this._lastSourceTime = 0\n this._lastStepTime = 0\n\n // Make sure that step is always called in class context\n this._step = this._stepFn.bind(this, false)\n this._stepImmediate = this._stepFn.bind(this, true)\n }\n}\n\nregisterMethods({\n Element: {\n timeline: function (timeline) {\n if (timeline == null) {\n this._timeline = this._timeline || new Timeline()\n return this._timeline\n } else {\n this._timeline = timeline\n return this\n }\n }\n }\n})\n","import { Controller, Ease, Stepper } from './Controller.js'\nimport { extend, register } from '../utils/adopter.js'\nimport { from, to } from '../modules/core/gradiented.js'\nimport { getOrigin } from '../utils/utils.js'\nimport { noop, timeline } from '../modules/core/defaults.js'\nimport { registerMethods } from '../utils/methods.js'\nimport { rx, ry } from '../modules/core/circled.js'\nimport Animator from './Animator.js'\nimport Box from '../types/Box.js'\nimport EventTarget from '../types/EventTarget.js'\nimport Matrix from '../types/Matrix.js'\nimport Morphable, { TransformBag, ObjectBag } from './Morphable.js'\nimport Point from '../types/Point.js'\nimport SVGNumber from '../types/SVGNumber.js'\nimport Timeline from './Timeline.js'\n\nexport default class Runner extends EventTarget {\n constructor(options) {\n super()\n\n // Store a unique id on the runner, so that we can identify it later\n this.id = Runner.id++\n\n // Ensure a default value\n options = options == null ? timeline.duration : options\n\n // Ensure that we get a controller\n options = typeof options === 'function' ? new Controller(options) : options\n\n // Declare all of the variables\n this._element = null\n this._timeline = null\n this.done = false\n this._queue = []\n\n // Work out the stepper and the duration\n this._duration = typeof options === 'number' && options\n this._isDeclarative = options instanceof Controller\n this._stepper = this._isDeclarative ? options : new Ease()\n\n // We copy the current values from the timeline because they can change\n this._history = {}\n\n // Store the state of the runner\n this.enabled = true\n this._time = 0\n this._lastTime = 0\n\n // At creation, the runner is in reset state\n this._reseted = true\n\n // Save transforms applied to this runner\n this.transforms = new Matrix()\n this.transformId = 1\n\n // Looping variables\n this._haveReversed = false\n this._reverse = false\n this._loopsDone = 0\n this._swing = false\n this._wait = 0\n this._times = 1\n\n this._frameId = null\n\n // Stores how long a runner is stored after being done\n this._persist = this._isDeclarative ? true : null\n }\n\n static sanitise(duration, delay, when) {\n // Initialise the default parameters\n let times = 1\n let swing = false\n let wait = 0\n duration = duration ?? timeline.duration\n delay = delay ?? timeline.delay\n when = when || 'last'\n\n // If we have an object, unpack the values\n if (typeof duration === 'object' && !(duration instanceof Stepper)) {\n delay = duration.delay ?? delay\n when = duration.when ?? when\n swing = duration.swing || swing\n times = duration.times ?? times\n wait = duration.wait ?? wait\n duration = duration.duration ?? timeline.duration\n }\n\n return {\n duration: duration,\n delay: delay,\n swing: swing,\n times: times,\n wait: wait,\n when: when\n }\n }\n\n active(enabled) {\n if (enabled == null) return this.enabled\n this.enabled = enabled\n return this\n }\n\n /*\n Private Methods\n ===============\n Methods that shouldn't be used externally\n */\n addTransform(transform) {\n this.transforms.lmultiplyO(transform)\n return this\n }\n\n after(fn) {\n return this.on('finished', fn)\n }\n\n animate(duration, delay, when) {\n const o = Runner.sanitise(duration, delay, when)\n const runner = new Runner(o.duration)\n if (this._timeline) runner.timeline(this._timeline)\n if (this._element) runner.element(this._element)\n return runner.loop(o).schedule(o.delay, o.when)\n }\n\n clearTransform() {\n this.transforms = new Matrix()\n return this\n }\n\n // TODO: Keep track of all transformations so that deletion is faster\n clearTransformsFromQueue() {\n if (\n !this.done ||\n !this._timeline ||\n !this._timeline._runnerIds.includes(this.id)\n ) {\n this._queue = this._queue.filter((item) => {\n return !item.isTransform\n })\n }\n }\n\n delay(delay) {\n return this.animate(0, delay)\n }\n\n duration() {\n return this._times * (this._wait + this._duration) - this._wait\n }\n\n during(fn) {\n return this.queue(null, fn)\n }\n\n ease(fn) {\n this._stepper = new Ease(fn)\n return this\n }\n /*\n Runner Definitions\n ==================\n These methods help us define the runtime behaviour of the Runner or they\n help us make new runners from the current runner\n */\n\n element(element) {\n if (element == null) return this._element\n this._element = element\n element._prepareRunner()\n return this\n }\n\n finish() {\n return this.step(Infinity)\n }\n\n loop(times, swing, wait) {\n // Deal with the user passing in an object\n if (typeof times === 'object') {\n swing = times.swing\n wait = times.wait\n times = times.times\n }\n\n // Sanitise the values and store them\n this._times = times || Infinity\n this._swing = swing || false\n this._wait = wait || 0\n\n // Allow true to be passed\n if (this._times === true) {\n this._times = Infinity\n }\n\n return this\n }\n\n loops(p) {\n const loopDuration = this._duration + this._wait\n if (p == null) {\n const loopsDone = Math.floor(this._time / loopDuration)\n const relativeTime = this._time - loopsDone * loopDuration\n const position = relativeTime / this._duration\n return Math.min(loopsDone + position, this._times)\n }\n const whole = Math.floor(p)\n const partial = p % 1\n const time = loopDuration * whole + this._duration * partial\n return this.time(time)\n }\n\n persist(dtOrForever) {\n if (dtOrForever == null) return this._persist\n this._persist = dtOrForever\n return this\n }\n\n position(p) {\n // Get all of the variables we need\n const x = this._time\n const d = this._duration\n const w = this._wait\n const t = this._times\n const s = this._swing\n const r = this._reverse\n let position\n\n if (p == null) {\n /*\n This function converts a time to a position in the range [0, 1]\n The full explanation can be found in this desmos demonstration\n https://www.desmos.com/calculator/u4fbavgche\n The logic is slightly simplified here because we can use booleans\n */\n\n // Figure out the value without thinking about the start or end time\n const f = function (x) {\n const swinging = s * Math.floor((x % (2 * (w + d))) / (w + d))\n const backwards = (swinging && !r) || (!swinging && r)\n const uncliped =\n (Math.pow(-1, backwards) * (x % (w + d))) / d + backwards\n const clipped = Math.max(Math.min(uncliped, 1), 0)\n return clipped\n }\n\n // Figure out the value by incorporating the start time\n const endTime = t * (w + d) - w\n position =\n x <= 0\n ? Math.round(f(1e-5))\n : x < endTime\n ? f(x)\n : Math.round(f(endTime - 1e-5))\n return position\n }\n\n // Work out the loops done and add the position to the loops done\n const loopsDone = Math.floor(this.loops())\n const swingForward = s && loopsDone % 2 === 0\n const forwards = (swingForward && !r) || (r && swingForward)\n position = loopsDone + (forwards ? p : 1 - p)\n return this.loops(position)\n }\n\n progress(p) {\n if (p == null) {\n return Math.min(1, this._time / this.duration())\n }\n return this.time(p * this.duration())\n }\n\n /*\n Basic Functionality\n ===================\n These methods allow us to attach basic functions to the runner directly\n */\n queue(initFn, runFn, retargetFn, isTransform) {\n this._queue.push({\n initialiser: initFn || noop,\n runner: runFn || noop,\n retarget: retargetFn,\n isTransform: isTransform,\n initialised: false,\n finished: false\n })\n const timeline = this.timeline()\n timeline && this.timeline()._continue()\n return this\n }\n\n reset() {\n if (this._reseted) return this\n this.time(0)\n this._reseted = true\n return this\n }\n\n reverse(reverse) {\n this._reverse = reverse == null ? !this._reverse : reverse\n return this\n }\n\n schedule(timeline, delay, when) {\n // The user doesn't need to pass a timeline if we already have one\n if (!(timeline instanceof Timeline)) {\n when = delay\n delay = timeline\n timeline = this.timeline()\n }\n\n // If there is no timeline, yell at the user...\n if (!timeline) {\n throw Error('Runner cannot be scheduled without timeline')\n }\n\n // Schedule the runner on the timeline provided\n timeline.schedule(this, delay, when)\n return this\n }\n\n step(dt) {\n // If we are inactive, this stepper just gets skipped\n if (!this.enabled) return this\n\n // Update the time and get the new position\n dt = dt == null ? 16 : dt\n this._time += dt\n const position = this.position()\n\n // Figure out if we need to run the stepper in this frame\n const running = this._lastPosition !== position && this._time >= 0\n this._lastPosition = position\n\n // Figure out if we just started\n const duration = this.duration()\n const justStarted = this._lastTime <= 0 && this._time > 0\n const justFinished = this._lastTime < duration && this._time >= duration\n\n this._lastTime = this._time\n if (justStarted) {\n this.fire('start', this)\n }\n\n // Work out if the runner is finished set the done flag here so animations\n // know, that they are running in the last step (this is good for\n // transformations which can be merged)\n const declarative = this._isDeclarative\n this.done = !declarative && !justFinished && this._time >= duration\n\n // Runner is running. So its not in reset state anymore\n this._reseted = false\n\n let converged = false\n // Call initialise and the run function\n if (running || declarative) {\n this._initialise(running)\n\n // clear the transforms on this runner so they dont get added again and again\n this.transforms = new Matrix()\n converged = this._run(declarative ? dt : position)\n\n this.fire('step', this)\n }\n // correct the done flag here\n // declarative animations itself know when they converged\n this.done = this.done || (converged && declarative)\n if (justFinished) {\n this.fire('finished', this)\n }\n return this\n }\n\n /*\n Runner animation methods\n ========================\n Control how the animation plays\n */\n time(time) {\n if (time == null) {\n return this._time\n }\n const dt = time - this._time\n this.step(dt)\n return this\n }\n\n timeline(timeline) {\n // check explicitly for undefined so we can set the timeline to null\n if (typeof timeline === 'undefined') return this._timeline\n this._timeline = timeline\n return this\n }\n\n unschedule() {\n const timeline = this.timeline()\n timeline && timeline.unschedule(this)\n return this\n }\n\n // Run each initialise function in the runner if required\n _initialise(running) {\n // If we aren't running, we shouldn't initialise when not declarative\n if (!running && !this._isDeclarative) return\n\n // Loop through all of the initialisers\n for (let i = 0, len = this._queue.length; i < len; ++i) {\n // Get the current initialiser\n const current = this._queue[i]\n\n // Determine whether we need to initialise\n const needsIt = this._isDeclarative || (!current.initialised && running)\n running = !current.finished\n\n // Call the initialiser if we need to\n if (needsIt && running) {\n current.initialiser.call(this)\n current.initialised = true\n }\n }\n }\n\n // Save a morpher to the morpher list so that we can retarget it later\n _rememberMorpher(method, morpher) {\n this._history[method] = {\n morpher: morpher,\n caller: this._queue[this._queue.length - 1]\n }\n\n // We have to resume the timeline in case a controller\n // is already done without being ever run\n // This can happen when e.g. this is done:\n // anim = el.animate(new SVG.Spring)\n // and later\n // anim.move(...)\n if (this._isDeclarative) {\n const timeline = this.timeline()\n timeline && timeline.play()\n }\n }\n\n // Try to set the target for a morpher if the morpher exists, otherwise\n // Run each run function for the position or dt given\n _run(positionOrDt) {\n // Run all of the _queue directly\n let allfinished = true\n for (let i = 0, len = this._queue.length; i < len; ++i) {\n // Get the current function to run\n const current = this._queue[i]\n\n // Run the function if its not finished, we keep track of the finished\n // flag for the sake of declarative _queue\n const converged = current.runner.call(this, positionOrDt)\n current.finished = current.finished || converged === true\n allfinished = allfinished && current.finished\n }\n\n // We report when all of the constructors are finished\n return allfinished\n }\n\n // do nothing and return false\n _tryRetarget(method, target, extra) {\n if (this._history[method]) {\n // if the last method wasn't even initialised, throw it away\n if (!this._history[method].caller.initialised) {\n const index = this._queue.indexOf(this._history[method].caller)\n this._queue.splice(index, 1)\n return false\n }\n\n // for the case of transformations, we use the special retarget function\n // which has access to the outer scope\n if (this._history[method].caller.retarget) {\n this._history[method].caller.retarget.call(this, target, extra)\n // for everything else a simple morpher change is sufficient\n } else {\n this._history[method].morpher.to(target)\n }\n\n this._history[method].caller.finished = false\n const timeline = this.timeline()\n timeline && timeline.play()\n return true\n }\n return false\n }\n}\n\nRunner.id = 0\n\nexport class FakeRunner {\n constructor(transforms = new Matrix(), id = -1, done = true) {\n this.transforms = transforms\n this.id = id\n this.done = done\n }\n\n clearTransformsFromQueue() {}\n}\n\nextend([Runner, FakeRunner], {\n mergeWith(runner) {\n return new FakeRunner(\n runner.transforms.lmultiply(this.transforms),\n runner.id\n )\n }\n})\n\n// FakeRunner.emptyRunner = new FakeRunner()\n\nconst lmultiply = (last, curr) => last.lmultiplyO(curr)\nconst getRunnerTransform = (runner) => runner.transforms\n\nfunction mergeTransforms() {\n // Find the matrix to apply to the element and apply it\n const runners = this._transformationRunners.runners\n const netTransform = runners\n .map(getRunnerTransform)\n .reduce(lmultiply, new Matrix())\n\n this.transform(netTransform)\n\n this._transformationRunners.merge()\n\n if (this._transformationRunners.length() === 1) {\n this._frameId = null\n }\n}\n\nexport class RunnerArray {\n constructor() {\n this.runners = []\n this.ids = []\n }\n\n add(runner) {\n if (this.runners.includes(runner)) return\n const id = runner.id + 1\n\n this.runners.push(runner)\n this.ids.push(id)\n\n return this\n }\n\n clearBefore(id) {\n const deleteCnt = this.ids.indexOf(id + 1) || 1\n this.ids.splice(0, deleteCnt, 0)\n this.runners\n .splice(0, deleteCnt, new FakeRunner())\n .forEach((r) => r.clearTransformsFromQueue())\n return this\n }\n\n edit(id, newRunner) {\n const index = this.ids.indexOf(id + 1)\n this.ids.splice(index, 1, id + 1)\n this.runners.splice(index, 1, newRunner)\n return this\n }\n\n getByID(id) {\n return this.runners[this.ids.indexOf(id + 1)]\n }\n\n length() {\n return this.ids.length\n }\n\n merge() {\n let lastRunner = null\n for (let i = 0; i < this.runners.length; ++i) {\n const runner = this.runners[i]\n\n const condition =\n lastRunner &&\n runner.done &&\n lastRunner.done &&\n // don't merge runner when persisted on timeline\n (!runner._timeline ||\n !runner._timeline._runnerIds.includes(runner.id)) &&\n (!lastRunner._timeline ||\n !lastRunner._timeline._runnerIds.includes(lastRunner.id))\n\n if (condition) {\n // the +1 happens in the function\n this.remove(runner.id)\n const newRunner = runner.mergeWith(lastRunner)\n this.edit(lastRunner.id, newRunner)\n lastRunner = newRunner\n --i\n } else {\n lastRunner = runner\n }\n }\n\n return this\n }\n\n remove(id) {\n const index = this.ids.indexOf(id + 1)\n this.ids.splice(index, 1)\n this.runners.splice(index, 1)\n return this\n }\n}\n\nregisterMethods({\n Element: {\n animate(duration, delay, when) {\n const o = Runner.sanitise(duration, delay, when)\n const timeline = this.timeline()\n return new Runner(o.duration)\n .loop(o)\n .element(this)\n .timeline(timeline.play())\n .schedule(o.delay, o.when)\n },\n\n delay(by, when) {\n return this.animate(0, by, when)\n },\n\n // this function searches for all runners on the element and deletes the ones\n // which run before the current one. This is because absolute transformations\n // overwrite anything anyway so there is no need to waste time computing\n // other runners\n _clearTransformRunnersBefore(currentRunner) {\n this._transformationRunners.clearBefore(currentRunner.id)\n },\n\n _currentTransform(current) {\n return (\n this._transformationRunners.runners\n // we need the equal sign here to make sure, that also transformations\n // on the same runner which execute before the current transformation are\n // taken into account\n .filter((runner) => runner.id <= current.id)\n .map(getRunnerTransform)\n .reduce(lmultiply, new Matrix())\n )\n },\n\n _addRunner(runner) {\n this._transformationRunners.add(runner)\n\n // Make sure that the runner merge is executed at the very end of\n // all Animator functions. That is why we use immediate here to execute\n // the merge right after all frames are run\n Animator.cancelImmediate(this._frameId)\n this._frameId = Animator.immediate(mergeTransforms.bind(this))\n },\n\n _prepareRunner() {\n if (this._frameId == null) {\n this._transformationRunners = new RunnerArray().add(\n new FakeRunner(new Matrix(this))\n )\n }\n }\n }\n})\n\n// Will output the elements from array A that are not in the array B\nconst difference = (a, b) => a.filter((x) => !b.includes(x))\n\nextend(Runner, {\n attr(a, v) {\n return this.styleAttr('attr', a, v)\n },\n\n // Add animatable styles\n css(s, v) {\n return this.styleAttr('css', s, v)\n },\n\n styleAttr(type, nameOrAttrs, val) {\n if (typeof nameOrAttrs === 'string') {\n return this.styleAttr(type, { [nameOrAttrs]: val })\n }\n\n let attrs = nameOrAttrs\n if (this._tryRetarget(type, attrs)) return this\n\n let morpher = new Morphable(this._stepper).to(attrs)\n let keys = Object.keys(attrs)\n\n this.queue(\n function () {\n morpher = morpher.from(this.element()[type](keys))\n },\n function (pos) {\n this.element()[type](morpher.at(pos).valueOf())\n return morpher.done()\n },\n function (newToAttrs) {\n // Check if any new keys were added\n const newKeys = Object.keys(newToAttrs)\n const differences = difference(newKeys, keys)\n\n // If their are new keys, initialize them and add them to morpher\n if (differences.length) {\n // Get the values\n const addedFromAttrs = this.element()[type](differences)\n\n // Get the already initialized values\n const oldFromAttrs = new ObjectBag(morpher.from()).valueOf()\n\n // Merge old and new\n Object.assign(oldFromAttrs, addedFromAttrs)\n morpher.from(oldFromAttrs)\n }\n\n // Get the object from the morpher\n const oldToAttrs = new ObjectBag(morpher.to()).valueOf()\n\n // Merge in new attributes\n Object.assign(oldToAttrs, newToAttrs)\n\n // Change morpher target\n morpher.to(oldToAttrs)\n\n // Make sure that we save the work we did so we don't need it to do again\n keys = newKeys\n attrs = newToAttrs\n }\n )\n\n this._rememberMorpher(type, morpher)\n return this\n },\n\n zoom(level, point) {\n if (this._tryRetarget('zoom', level, point)) return this\n\n let morpher = new Morphable(this._stepper).to(new SVGNumber(level))\n\n this.queue(\n function () {\n morpher = morpher.from(this.element().zoom())\n },\n function (pos) {\n this.element().zoom(morpher.at(pos), point)\n return morpher.done()\n },\n function (newLevel, newPoint) {\n point = newPoint\n morpher.to(newLevel)\n }\n )\n\n this._rememberMorpher('zoom', morpher)\n return this\n },\n\n /**\n ** absolute transformations\n **/\n\n //\n // M v -----|-----(D M v = F v)------|-----> T v\n //\n // 1. define the final state (T) and decompose it (once)\n // t = [tx, ty, the, lam, sy, sx]\n // 2. on every frame: pull the current state of all previous transforms\n // (M - m can change)\n // and then write this as m = [tx0, ty0, the0, lam0, sy0, sx0]\n // 3. Find the interpolated matrix F(pos) = m + pos * (t - m)\n // - Note F(0) = M\n // - Note F(1) = T\n // 4. Now you get the delta matrix as a result: D = F * inv(M)\n\n transform(transforms, relative, affine) {\n // If we have a declarative function, we should retarget it if possible\n relative = transforms.relative || relative\n if (\n this._isDeclarative &&\n !relative &&\n this._tryRetarget('transform', transforms)\n ) {\n return this\n }\n\n // Parse the parameters\n const isMatrix = Matrix.isMatrixLike(transforms)\n affine =\n transforms.affine != null\n ? transforms.affine\n : affine != null\n ? affine\n : !isMatrix\n\n // Create a morpher and set its type\n const morpher = new Morphable(this._stepper).type(\n affine ? TransformBag : Matrix\n )\n\n let origin\n let element\n let current\n let currentAngle\n let startTransform\n\n function setup() {\n // make sure element and origin is defined\n element = element || this.element()\n origin = origin || getOrigin(transforms, element)\n\n startTransform = new Matrix(relative ? undefined : element)\n\n // add the runner to the element so it can merge transformations\n element._addRunner(this)\n\n // Deactivate all transforms that have run so far if we are absolute\n if (!relative) {\n element._clearTransformRunnersBefore(this)\n }\n }\n\n function run(pos) {\n // clear all other transforms before this in case something is saved\n // on this runner. We are absolute. We dont need these!\n if (!relative) this.clearTransform()\n\n const { x, y } = new Point(origin).transform(\n element._currentTransform(this)\n )\n\n let target = new Matrix({ ...transforms, origin: [x, y] })\n let start = this._isDeclarative && current ? current : startTransform\n\n if (affine) {\n target = target.decompose(x, y)\n start = start.decompose(x, y)\n\n // Get the current and target angle as it was set\n const rTarget = target.rotate\n const rCurrent = start.rotate\n\n // Figure out the shortest path to rotate directly\n const possibilities = [rTarget - 360, rTarget, rTarget + 360]\n const distances = possibilities.map((a) => Math.abs(a - rCurrent))\n const shortest = Math.min(...distances)\n const index = distances.indexOf(shortest)\n target.rotate = possibilities[index]\n }\n\n if (relative) {\n // we have to be careful here not to overwrite the rotation\n // with the rotate method of Matrix\n if (!isMatrix) {\n target.rotate = transforms.rotate || 0\n }\n if (this._isDeclarative && currentAngle) {\n start.rotate = currentAngle\n }\n }\n\n morpher.from(start)\n morpher.to(target)\n\n const affineParameters = morpher.at(pos)\n currentAngle = affineParameters.rotate\n current = new Matrix(affineParameters)\n\n this.addTransform(current)\n element._addRunner(this)\n return morpher.done()\n }\n\n function retarget(newTransforms) {\n // only get a new origin if it changed since the last call\n if (\n (newTransforms.origin || 'center').toString() !==\n (transforms.origin || 'center').toString()\n ) {\n origin = getOrigin(newTransforms, element)\n }\n\n // overwrite the old transformations with the new ones\n transforms = { ...newTransforms, origin }\n }\n\n this.queue(setup, run, retarget, true)\n this._isDeclarative && this._rememberMorpher('transform', morpher)\n return this\n },\n\n // Animatable x-axis\n x(x) {\n return this._queueNumber('x', x)\n },\n\n // Animatable y-axis\n y(y) {\n return this._queueNumber('y', y)\n },\n\n ax(x) {\n return this._queueNumber('ax', x)\n },\n\n ay(y) {\n return this._queueNumber('ay', y)\n },\n\n dx(x = 0) {\n return this._queueNumberDelta('x', x)\n },\n\n dy(y = 0) {\n return this._queueNumberDelta('y', y)\n },\n\n dmove(x, y) {\n return this.dx(x).dy(y)\n },\n\n _queueNumberDelta(method, to) {\n to = new SVGNumber(to)\n\n // Try to change the target if we have this method already registered\n if (this._tryRetarget(method, to)) return this\n\n // Make a morpher and queue the animation\n const morpher = new Morphable(this._stepper).to(to)\n let from = null\n this.queue(\n function () {\n from = this.element()[method]()\n morpher.from(from)\n morpher.to(from + to)\n },\n function (pos) {\n this.element()[method](morpher.at(pos))\n return morpher.done()\n },\n function (newTo) {\n morpher.to(from + new SVGNumber(newTo))\n }\n )\n\n // Register the morpher so that if it is changed again, we can retarget it\n this._rememberMorpher(method, morpher)\n return this\n },\n\n _queueObject(method, to) {\n // Try to change the target if we have this method already registered\n if (this._tryRetarget(method, to)) return this\n\n // Make a morpher and queue the animation\n const morpher = new Morphable(this._stepper).to(to)\n this.queue(\n function () {\n morpher.from(this.element()[method]())\n },\n function (pos) {\n this.element()[method](morpher.at(pos))\n return morpher.done()\n }\n )\n\n // Register the morpher so that if it is changed again, we can retarget it\n this._rememberMorpher(method, morpher)\n return this\n },\n\n _queueNumber(method, value) {\n return this._queueObject(method, new SVGNumber(value))\n },\n\n // Animatable center x-axis\n cx(x) {\n return this._queueNumber('cx', x)\n },\n\n // Animatable center y-axis\n cy(y) {\n return this._queueNumber('cy', y)\n },\n\n // Add animatable move\n move(x, y) {\n return this.x(x).y(y)\n },\n\n amove(x, y) {\n return this.ax(x).ay(y)\n },\n\n // Add animatable center\n center(x, y) {\n return this.cx(x).cy(y)\n },\n\n // Add animatable size\n size(width, height) {\n // animate bbox based size for all other elements\n let box\n\n if (!width || !height) {\n box = this._element.bbox()\n }\n\n if (!width) {\n width = (box.width / box.height) * height\n }\n\n if (!height) {\n height = (box.height / box.width) * width\n }\n\n return this.width(width).height(height)\n },\n\n // Add animatable width\n width(width) {\n return this._queueNumber('width', width)\n },\n\n // Add animatable height\n height(height) {\n return this._queueNumber('height', height)\n },\n\n // Add animatable plot\n plot(a, b, c, d) {\n // Lines can be plotted with 4 arguments\n if (arguments.length === 4) {\n return this.plot([a, b, c, d])\n }\n\n if (this._tryRetarget('plot', a)) return this\n\n const morpher = new Morphable(this._stepper)\n .type(this._element.MorphArray)\n .to(a)\n\n this.queue(\n function () {\n morpher.from(this._element.array())\n },\n function (pos) {\n this._element.plot(morpher.at(pos))\n return morpher.done()\n }\n )\n\n this._rememberMorpher('plot', morpher)\n return this\n },\n\n // Add leading method\n leading(value) {\n return this._queueNumber('leading', value)\n },\n\n // Add animatable viewbox\n viewbox(x, y, width, height) {\n return this._queueObject('viewbox', new Box(x, y, width, height))\n },\n\n update(o) {\n if (typeof o !== 'object') {\n return this.update({\n offset: arguments[0],\n color: arguments[1],\n opacity: arguments[2]\n })\n }\n\n if (o.opacity != null) this.attr('stop-opacity', o.opacity)\n if (o.color != null) this.attr('stop-color', o.color)\n if (o.offset != null) this.attr('offset', o.offset)\n\n return this\n }\n})\n\nextend(Runner, { rx, ry, from, to })\nregister(Runner, 'Runner')\n","import {\n adopt,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { svg, xlink, xmlns } from '../modules/core/namespaces.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Container from './Container.js'\nimport Defs from './Defs.js'\nimport { globals } from '../utils/window.js'\n\nexport default class Svg extends Container {\n constructor(node, attrs = node) {\n super(nodeOrNew('svg', node), attrs)\n this.namespace()\n }\n\n // Creates and returns defs element\n defs() {\n if (!this.isRoot()) return this.root().defs()\n\n return adopt(this.node.querySelector('defs')) || this.put(new Defs())\n }\n\n isRoot() {\n return (\n !this.node.parentNode ||\n (!(this.node.parentNode instanceof globals.window.SVGElement) &&\n this.node.parentNode.nodeName !== '#document-fragment')\n )\n }\n\n // Add namespaces\n namespace() {\n if (!this.isRoot()) return this.root().namespace()\n return this.attr({ xmlns: svg, version: '1.1' }).attr(\n 'xmlns:xlink',\n xlink,\n xmlns\n )\n }\n\n removeNamespace() {\n return this.attr({ xmlns: null, version: null })\n .attr('xmlns:xlink', null, xmlns)\n .attr('xmlns:svgjs', null, xmlns)\n }\n\n // Check if this is a root svg\n // If not, call root() from this element\n root() {\n if (this.isRoot()) return this\n return super.root()\n }\n}\n\nregisterMethods({\n Container: {\n // Create nested svg document\n nested: wrapWithAttrCheck(function () {\n return this.put(new Svg())\n })\n }\n})\n\nregister(Svg, 'Svg', true)\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Container from './Container.js'\n\nexport default class Symbol extends Container {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('symbol', node), attrs)\n }\n}\n\nregisterMethods({\n Container: {\n symbol: wrapWithAttrCheck(function () {\n return this.put(new Symbol())\n })\n }\n})\n\nregister(Symbol, 'Symbol')\n","import { globals } from '../../utils/window.js'\n\n// Create plain text node\nexport function plain(text) {\n // clear if build mode is disabled\n if (this._build === false) {\n this.clear()\n }\n\n // create text node\n this.node.appendChild(globals.document.createTextNode(text))\n\n return this\n}\n\n// Get length of text element\nexport function length() {\n return this.node.getComputedTextLength()\n}\n\n// Move over x-axis\n// Text is moved by its bounding box\n// text-anchor does NOT matter\nexport function x(x, box = this.bbox()) {\n if (x == null) {\n return box.x\n }\n\n return this.attr('x', this.attr('x') + x - box.x)\n}\n\n// Move over y-axis\nexport function y(y, box = this.bbox()) {\n if (y == null) {\n return box.y\n }\n\n return this.attr('y', this.attr('y') + y - box.y)\n}\n\nexport function move(x, y, box = this.bbox()) {\n return this.x(x, box).y(y, box)\n}\n\n// Move center over x-axis\nexport function cx(x, box = this.bbox()) {\n if (x == null) {\n return box.cx\n }\n\n return this.attr('x', this.attr('x') + x - box.cx)\n}\n\n// Move center over y-axis\nexport function cy(y, box = this.bbox()) {\n if (y == null) {\n return box.cy\n }\n\n return this.attr('y', this.attr('y') + y - box.cy)\n}\n\nexport function center(x, y, box = this.bbox()) {\n return this.cx(x, box).cy(y, box)\n}\n\nexport function ax(x) {\n return this.attr('x', x)\n}\n\nexport function ay(y) {\n return this.attr('y', y)\n}\n\nexport function amove(x, y) {\n return this.ax(x).ay(y)\n}\n\n// Enable / disable build mode\nexport function build(build) {\n this._build = !!build\n return this\n}\n","import {\n adopt,\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport SVGNumber from '../types/SVGNumber.js'\nimport Shape from './Shape.js'\nimport { globals } from '../utils/window.js'\nimport * as textable from '../modules/core/textable.js'\nimport { isDescriptive, writeDataToDom } from '../utils/utils.js'\n\nexport default class Text extends Shape {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('text', node), attrs)\n\n this.dom.leading = this.dom.leading ?? new SVGNumber(1.3) // store leading value for rebuilding\n this._rebuild = true // enable automatic updating of dy values\n this._build = false // disable build mode for adding multiple lines\n }\n\n // Set / get leading\n leading(value) {\n // act as getter\n if (value == null) {\n return this.dom.leading\n }\n\n // act as setter\n this.dom.leading = new SVGNumber(value)\n\n return this.rebuild()\n }\n\n // Rebuild appearance type\n rebuild(rebuild) {\n // store new rebuild flag if given\n if (typeof rebuild === 'boolean') {\n this._rebuild = rebuild\n }\n\n // define position of all lines\n if (this._rebuild) {\n const self = this\n let blankLineOffset = 0\n const leading = this.dom.leading\n\n this.each(function (i) {\n if (isDescriptive(this.node)) return\n\n const fontSize = globals.window\n .getComputedStyle(this.node)\n .getPropertyValue('font-size')\n\n const dy = leading * new SVGNumber(fontSize)\n\n if (this.dom.newLined) {\n this.attr('x', self.attr('x'))\n\n if (this.text() === '\\n') {\n blankLineOffset += dy\n } else {\n this.attr('dy', i ? dy + blankLineOffset : 0)\n blankLineOffset = 0\n }\n }\n })\n\n this.fire('rebuild')\n }\n\n return this\n }\n\n // overwrite method from parent to set data properly\n setData(o) {\n this.dom = o\n this.dom.leading = new SVGNumber(o.leading || 1.3)\n return this\n }\n\n writeDataToDom() {\n writeDataToDom(this, this.dom, { leading: 1.3 })\n return this\n }\n\n // Set the text content\n text(text) {\n // act as getter\n if (text === undefined) {\n const children = this.node.childNodes\n let firstLine = 0\n text = ''\n\n for (let i = 0, len = children.length; i < len; ++i) {\n // skip textPaths - they are no lines\n if (children[i].nodeName === 'textPath' || isDescriptive(children[i])) {\n if (i === 0) firstLine = i + 1\n continue\n }\n\n // add newline if its not the first child and newLined is set to true\n if (\n i !== firstLine &&\n children[i].nodeType !== 3 &&\n adopt(children[i]).dom.newLined === true\n ) {\n text += '\\n'\n }\n\n // add content of this node\n text += children[i].textContent\n }\n\n return text\n }\n\n // remove existing content\n this.clear().build(true)\n\n if (typeof text === 'function') {\n // call block\n text.call(this, this)\n } else {\n // store text and make sure text is not blank\n text = (text + '').split('\\n')\n\n // build new lines\n for (let j = 0, jl = text.length; j < jl; j++) {\n this.newLine(text[j])\n }\n }\n\n // disable build mode and rebuild lines\n return this.build(false).rebuild()\n }\n}\n\nextend(Text, textable)\n\nregisterMethods({\n Container: {\n // Create text element\n text: wrapWithAttrCheck(function (text = '') {\n return this.put(new Text()).text(text)\n }),\n\n // Create plain text element\n plain: wrapWithAttrCheck(function (text = '') {\n return this.put(new Text()).plain(text)\n })\n }\n})\n\nregister(Text, 'Text')\n","import {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { globals } from '../utils/window.js'\nimport { registerMethods } from '../utils/methods.js'\nimport SVGNumber from '../types/SVGNumber.js'\nimport Shape from './Shape.js'\nimport Text from './Text.js'\nimport * as textable from '../modules/core/textable.js'\n\nexport default class Tspan extends Shape {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('tspan', node), attrs)\n this._build = false // disable build mode for adding multiple lines\n }\n\n // Shortcut dx\n dx(dx) {\n return this.attr('dx', dx)\n }\n\n // Shortcut dy\n dy(dy) {\n return this.attr('dy', dy)\n }\n\n // Create new line\n newLine() {\n // mark new line\n this.dom.newLined = true\n\n // fetch parent\n const text = this.parent()\n\n // early return in case we are not in a text element\n if (!(text instanceof Text)) {\n return this\n }\n\n const i = text.index(this)\n\n const fontSize = globals.window\n .getComputedStyle(this.node)\n .getPropertyValue('font-size')\n const dy = text.dom.leading * new SVGNumber(fontSize)\n\n // apply new position\n return this.dy(i ? dy : 0).attr('x', text.x())\n }\n\n // Set text content\n text(text) {\n if (text == null)\n return this.node.textContent + (this.dom.newLined ? '\\n' : '')\n\n if (typeof text === 'function') {\n this.clear().build(true)\n text.call(this, this)\n this.build(false)\n } else {\n this.plain(text)\n }\n\n return this\n }\n}\n\nextend(Tspan, textable)\n\nregisterMethods({\n Tspan: {\n tspan: wrapWithAttrCheck(function (text = '') {\n const tspan = new Tspan()\n\n // clear if build mode is disabled\n if (!this._build) {\n this.clear()\n }\n\n // add new tspan\n return this.put(tspan).text(text)\n })\n },\n Text: {\n newLine: function (text = '') {\n return this.tspan(text).newLine()\n }\n }\n})\n\nregister(Tspan, 'Tspan')\n","import { cx, cy, height, width, x, y } from '../modules/core/circled.js'\nimport {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport SVGNumber from '../types/SVGNumber.js'\nimport Shape from './Shape.js'\n\nexport default class Circle extends Shape {\n constructor(node, attrs = node) {\n super(nodeOrNew('circle', node), attrs)\n }\n\n radius(r) {\n return this.attr('r', r)\n }\n\n // Radius x value\n rx(rx) {\n return this.attr('r', rx)\n }\n\n // Alias radius x value\n ry(ry) {\n return this.rx(ry)\n }\n\n size(size) {\n return this.radius(new SVGNumber(size).divide(2))\n }\n}\n\nextend(Circle, { x, y, cx, cy, width, height })\n\nregisterMethods({\n Container: {\n // Create circle element\n circle: wrapWithAttrCheck(function (size = 0) {\n return this.put(new Circle()).size(size).move(0, 0)\n })\n }\n})\n\nregister(Circle, 'Circle')\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Container from './Container.js'\nimport baseFind from '../modules/core/selector.js'\n\nexport default class ClipPath extends Container {\n constructor(node, attrs = node) {\n super(nodeOrNew('clipPath', node), attrs)\n }\n\n // Unclip all clipped elements and remove itself\n remove() {\n // unclip all targets\n this.targets().forEach(function (el) {\n el.unclip()\n })\n\n // remove clipPath from parent\n return super.remove()\n }\n\n targets() {\n return baseFind('svg [clip-path*=' + this.id() + ']')\n }\n}\n\nregisterMethods({\n Container: {\n // Create clipping element\n clip: wrapWithAttrCheck(function () {\n return this.defs().put(new ClipPath())\n })\n },\n Element: {\n // Distribute clipPath to svg element\n clipper() {\n return this.reference('clip-path')\n },\n\n clipWith(element) {\n // use given clip or create a new one\n const clipper =\n element instanceof ClipPath\n ? element\n : this.parent().clip().add(element)\n\n // apply mask\n return this.attr('clip-path', 'url(#' + clipper.id() + ')')\n },\n\n // Unclip element\n unclip() {\n return this.attr('clip-path', null)\n }\n }\n})\n\nregister(ClipPath, 'ClipPath')\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Element from './Element.js'\n\nexport default class ForeignObject extends Element {\n constructor(node, attrs = node) {\n super(nodeOrNew('foreignObject', node), attrs)\n }\n}\n\nregisterMethods({\n Container: {\n foreignObject: wrapWithAttrCheck(function (width, height) {\n return this.put(new ForeignObject()).size(width, height)\n })\n }\n})\n\nregister(ForeignObject, 'ForeignObject')\n","import Matrix from '../../types/Matrix.js'\nimport Point from '../../types/Point.js'\nimport Box from '../../types/Box.js'\nimport { proportionalSize } from '../../utils/utils.js'\nimport { getWindow } from '../../utils/window.js'\n\nexport function dmove(dx, dy) {\n this.children().forEach((child) => {\n let bbox\n\n // We have to wrap this for elements that dont have a bbox\n // e.g. title and other descriptive elements\n try {\n // Get the childs bbox\n // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1905039\n // Because bbox for nested svgs returns the contents bbox in the coordinate space of the svg itself (weird!), we cant use bbox for svgs\n // Therefore we have to use getBoundingClientRect. But THAT is broken (as explained in the bug).\n // Funnily enough the broken behavior would work for us but that breaks it in chrome\n // So we have to replicate the broken behavior of FF by just reading the attributes of the svg itself\n bbox =\n child.node instanceof getWindow().SVGSVGElement\n ? new Box(child.attr(['x', 'y', 'width', 'height']))\n : child.bbox()\n } catch (e) {\n return\n }\n\n // Get childs matrix\n const m = new Matrix(child)\n // Translate childs matrix by amount and\n // transform it back into parents space\n const matrix = m.translate(dx, dy).transform(m.inverse())\n // Calculate new x and y from old box\n const p = new Point(bbox.x, bbox.y).transform(matrix)\n // Move element\n child.move(p.x, p.y)\n })\n\n return this\n}\n\nexport function dx(dx) {\n return this.dmove(dx, 0)\n}\n\nexport function dy(dy) {\n return this.dmove(0, dy)\n}\n\nexport function height(height, box = this.bbox()) {\n if (height == null) return box.height\n return this.size(box.width, height, box)\n}\n\nexport function move(x = 0, y = 0, box = this.bbox()) {\n const dx = x - box.x\n const dy = y - box.y\n\n return this.dmove(dx, dy)\n}\n\nexport function size(width, height, box = this.bbox()) {\n const p = proportionalSize(this, width, height, box)\n const scaleX = p.width / box.width\n const scaleY = p.height / box.height\n\n this.children().forEach((child) => {\n const o = new Point(box).transform(new Matrix(child).inverse())\n child.scale(scaleX, scaleY, o.x, o.y)\n })\n\n return this\n}\n\nexport function width(width, box = this.bbox()) {\n if (width == null) return box.width\n return this.size(width, box.height, box)\n}\n\nexport function x(x, box = this.bbox()) {\n if (x == null) return box.x\n return this.move(x, box.y, box)\n}\n\nexport function y(y, box = this.bbox()) {\n if (y == null) return box.y\n return this.move(box.x, y, box)\n}\n","import {\n nodeOrNew,\n register,\n wrapWithAttrCheck,\n extend\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Container from './Container.js'\nimport * as containerGeometry from '../modules/core/containerGeometry.js'\n\nexport default class G extends Container {\n constructor(node, attrs = node) {\n super(nodeOrNew('g', node), attrs)\n }\n}\n\nextend(G, containerGeometry)\n\nregisterMethods({\n Container: {\n // Create a group element\n group: wrapWithAttrCheck(function () {\n return this.put(new G())\n })\n }\n})\n\nregister(G, 'G')\n","import {\n nodeOrNew,\n register,\n wrapWithAttrCheck,\n extend\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport { xlink } from '../modules/core/namespaces.js'\nimport Container from './Container.js'\nimport * as containerGeometry from '../modules/core/containerGeometry.js'\n\nexport default class A extends Container {\n constructor(node, attrs = node) {\n super(nodeOrNew('a', node), attrs)\n }\n\n // Link target attribute\n target(target) {\n return this.attr('target', target)\n }\n\n // Link url\n to(url) {\n return this.attr('href', url, xlink)\n }\n}\n\nextend(A, containerGeometry)\n\nregisterMethods({\n Container: {\n // Create a hyperlink element\n link: wrapWithAttrCheck(function (url) {\n return this.put(new A()).to(url)\n })\n },\n Element: {\n unlink() {\n const link = this.linker()\n\n if (!link) return this\n\n const parent = link.parent()\n\n if (!parent) {\n return this.remove()\n }\n\n const index = parent.index(link)\n parent.add(this, index)\n\n link.remove()\n return this\n },\n linkTo(url) {\n // reuse old link if possible\n let link = this.linker()\n\n if (!link) {\n link = new A()\n this.wrap(link)\n }\n\n if (typeof url === 'function') {\n url.call(link, link)\n } else {\n link.to(url)\n }\n\n return this\n },\n linker() {\n const link = this.parent()\n if (link && link.node.nodeName.toLowerCase() === 'a') {\n return link\n }\n\n return null\n }\n }\n})\n\nregister(A, 'A')\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Container from './Container.js'\nimport baseFind from '../modules/core/selector.js'\n\nexport default class Mask extends Container {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('mask', node), attrs)\n }\n\n // Unmask all masked elements and remove itself\n remove() {\n // unmask all targets\n this.targets().forEach(function (el) {\n el.unmask()\n })\n\n // remove mask from parent\n return super.remove()\n }\n\n targets() {\n return baseFind('svg [mask*=' + this.id() + ']')\n }\n}\n\nregisterMethods({\n Container: {\n mask: wrapWithAttrCheck(function () {\n return this.defs().put(new Mask())\n })\n },\n Element: {\n // Distribute mask to svg element\n masker() {\n return this.reference('mask')\n },\n\n maskWith(element) {\n // use given mask or create a new one\n const masker =\n element instanceof Mask ? element : this.parent().mask().add(element)\n\n // apply mask\n return this.attr('mask', 'url(#' + masker.id() + ')')\n },\n\n // Unmask element\n unmask() {\n return this.attr('mask', null)\n }\n }\n})\n\nregister(Mask, 'Mask')\n","import { nodeOrNew, register } from '../utils/adopter.js'\nimport Element from './Element.js'\nimport SVGNumber from '../types/SVGNumber.js'\nimport { registerMethods } from '../utils/methods.js'\n\nexport default class Stop extends Element {\n constructor(node, attrs = node) {\n super(nodeOrNew('stop', node), attrs)\n }\n\n // add color stops\n update(o) {\n if (typeof o === 'number' || o instanceof SVGNumber) {\n o = {\n offset: arguments[0],\n color: arguments[1],\n opacity: arguments[2]\n }\n }\n\n // set attributes\n if (o.opacity != null) this.attr('stop-opacity', o.opacity)\n if (o.color != null) this.attr('stop-color', o.color)\n if (o.offset != null) this.attr('offset', new SVGNumber(o.offset))\n\n return this\n }\n}\n\nregisterMethods({\n Gradient: {\n // Add a color stop\n stop: function (offset, color, opacity) {\n return this.put(new Stop()).update(offset, color, opacity)\n }\n }\n})\n\nregister(Stop, 'Stop')\n","import { nodeOrNew, register } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport { unCamelCase } from '../utils/utils.js'\nimport Element from './Element.js'\n\nfunction cssRule(selector, rule) {\n if (!selector) return ''\n if (!rule) return selector\n\n let ret = selector + '{'\n\n for (const i in rule) {\n ret += unCamelCase(i) + ':' + rule[i] + ';'\n }\n\n ret += '}'\n\n return ret\n}\n\nexport default class Style extends Element {\n constructor(node, attrs = node) {\n super(nodeOrNew('style', node), attrs)\n }\n\n addText(w = '') {\n this.node.textContent += w\n return this\n }\n\n font(name, src, params = {}) {\n return this.rule('@font-face', {\n fontFamily: name,\n src: src,\n ...params\n })\n }\n\n rule(selector, obj) {\n return this.addText(cssRule(selector, obj))\n }\n}\n\nregisterMethods('Dom', {\n style(selector, obj) {\n return this.put(new Style()).rule(selector, obj)\n },\n fontface(name, src, params) {\n return this.put(new Style()).font(name, src, params)\n }\n})\n\nregister(Style, 'Style')\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport { xlink } from '../modules/core/namespaces.js'\nimport Path from './Path.js'\nimport PathArray from '../types/PathArray.js'\nimport Text from './Text.js'\nimport baseFind from '../modules/core/selector.js'\n\nexport default class TextPath extends Text {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('textPath', node), attrs)\n }\n\n // return the array of the path track element\n array() {\n const track = this.track()\n\n return track ? track.array() : null\n }\n\n // Plot path if any\n plot(d) {\n const track = this.track()\n let pathArray = null\n\n if (track) {\n pathArray = track.plot(d)\n }\n\n return d == null ? pathArray : this\n }\n\n // Get the path element\n track() {\n return this.reference('href')\n }\n}\n\nregisterMethods({\n Container: {\n textPath: wrapWithAttrCheck(function (text, path) {\n // Convert text to instance if needed\n if (!(text instanceof Text)) {\n text = this.text(text)\n }\n\n return text.path(path)\n })\n },\n Text: {\n // Create path for text to run on\n path: wrapWithAttrCheck(function (track, importNodes = true) {\n const textPath = new TextPath()\n\n // if track is a path, reuse it\n if (!(track instanceof Path)) {\n // create path element\n track = this.defs().path(track)\n }\n\n // link textPath to path and add content\n textPath.attr('href', '#' + track, xlink)\n\n // Transplant all nodes from text to textPath\n let node\n if (importNodes) {\n while ((node = this.node.firstChild)) {\n textPath.node.appendChild(node)\n }\n }\n\n // add textPath element as child node and return textPath\n return this.put(textPath)\n }),\n\n // Get the textPath children\n textPath() {\n return this.findOne('textPath')\n }\n },\n Path: {\n // creates a textPath from this path\n text: wrapWithAttrCheck(function (text) {\n // Convert text to instance if needed\n if (!(text instanceof Text)) {\n text = new Text().addTo(this.parent()).text(text)\n }\n\n // Create textPath from text and path and return\n return text.path(this)\n }),\n\n targets() {\n return baseFind('svg textPath').filter((node) => {\n return (node.attr('href') || '').includes(this.id())\n })\n\n // Does not work in IE11. Use when IE support is dropped\n // return baseFind('svg textPath[*|href*=' + this.id() + ']')\n }\n }\n})\n\nTextPath.prototype.MorphArray = PathArray\nregister(TextPath, 'TextPath')\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport { xlink } from '../modules/core/namespaces.js'\nimport Shape from './Shape.js'\n\nexport default class Use extends Shape {\n constructor(node, attrs = node) {\n super(nodeOrNew('use', node), attrs)\n }\n\n // Use element as a reference\n use(element, file) {\n // Set lined element\n return this.attr('href', (file || '') + '#' + element, xlink)\n }\n}\n\nregisterMethods({\n Container: {\n // Create a use element\n use: wrapWithAttrCheck(function (element, file) {\n return this.put(new Use()).use(element, file)\n })\n }\n})\n\nregister(Use, 'Use')\n","/* Optional Modules */\nimport './modules/optional/arrange.js'\nimport './modules/optional/class.js'\nimport './modules/optional/css.js'\nimport './modules/optional/data.js'\nimport './modules/optional/memory.js'\nimport './modules/optional/sugar.js'\nimport './modules/optional/transform.js'\n\nimport { extend, makeInstance } from './utils/adopter.js'\nimport { getMethodNames, getMethodsFor } from './utils/methods.js'\nimport Box from './types/Box.js'\nimport Color from './types/Color.js'\nimport Container from './elements/Container.js'\nimport Defs from './elements/Defs.js'\nimport Dom from './elements/Dom.js'\nimport Element from './elements/Element.js'\nimport Ellipse from './elements/Ellipse.js'\nimport EventTarget from './types/EventTarget.js'\nimport Fragment from './elements/Fragment.js'\nimport Gradient from './elements/Gradient.js'\nimport Image from './elements/Image.js'\nimport Line from './elements/Line.js'\nimport List from './types/List.js'\nimport Marker from './elements/Marker.js'\nimport Matrix from './types/Matrix.js'\nimport Morphable, {\n NonMorphable,\n ObjectBag,\n TransformBag,\n makeMorphable,\n registerMorphableType\n} from './animation/Morphable.js'\nimport Path from './elements/Path.js'\nimport PathArray from './types/PathArray.js'\nimport Pattern from './elements/Pattern.js'\nimport PointArray from './types/PointArray.js'\nimport Point from './types/Point.js'\nimport Polygon from './elements/Polygon.js'\nimport Polyline from './elements/Polyline.js'\nimport Rect from './elements/Rect.js'\nimport Runner from './animation/Runner.js'\nimport SVGArray from './types/SVGArray.js'\nimport SVGNumber from './types/SVGNumber.js'\nimport Shape from './elements/Shape.js'\nimport Svg from './elements/Svg.js'\nimport Symbol from './elements/Symbol.js'\nimport Text from './elements/Text.js'\nimport Tspan from './elements/Tspan.js'\nimport * as defaults from './modules/core/defaults.js'\nimport * as utils from './utils/utils.js'\nimport * as namespaces from './modules/core/namespaces.js'\nimport * as regex from './modules/core/regex.js'\n\nexport {\n Morphable,\n registerMorphableType,\n makeMorphable,\n TransformBag,\n ObjectBag,\n NonMorphable\n}\n\nexport { defaults, utils, namespaces, regex }\nexport const SVG = makeInstance\nexport { default as parser } from './modules/core/parser.js'\nexport { default as find } from './modules/core/selector.js'\nexport * from './modules/core/event.js'\nexport * from './utils/adopter.js'\nexport {\n getWindow,\n registerWindow,\n restoreWindow,\n saveWindow,\n withWindow\n} from './utils/window.js'\n\n/* Animation Modules */\nexport { default as Animator } from './animation/Animator.js'\nexport {\n Controller,\n Ease,\n PID,\n Spring,\n easing\n} from './animation/Controller.js'\nexport { default as Queue } from './animation/Queue.js'\nexport { default as Runner } from './animation/Runner.js'\nexport { default as Timeline } from './animation/Timeline.js'\n\n/* Types */\nexport { default as Array } from './types/SVGArray.js'\nexport { default as Box } from './types/Box.js'\nexport { default as Color } from './types/Color.js'\nexport { default as EventTarget } from './types/EventTarget.js'\nexport { default as Matrix } from './types/Matrix.js'\nexport { default as Number } from './types/SVGNumber.js'\nexport { default as PathArray } from './types/PathArray.js'\nexport { default as Point } from './types/Point.js'\nexport { default as PointArray } from './types/PointArray.js'\nexport { default as List } from './types/List.js'\n\n/* Elements */\nexport { default as Circle } from './elements/Circle.js'\nexport { default as ClipPath } from './elements/ClipPath.js'\nexport { default as Container } from './elements/Container.js'\nexport { default as Defs } from './elements/Defs.js'\nexport { default as Dom } from './elements/Dom.js'\nexport { default as Element } from './elements/Element.js'\nexport { default as Ellipse } from './elements/Ellipse.js'\nexport { default as ForeignObject } from './elements/ForeignObject.js'\nexport { default as Fragment } from './elements/Fragment.js'\nexport { default as Gradient } from './elements/Gradient.js'\nexport { default as G } from './elements/G.js'\nexport { default as A } from './elements/A.js'\nexport { default as Image } from './elements/Image.js'\nexport { default as Line } from './elements/Line.js'\nexport { default as Marker } from './elements/Marker.js'\nexport { default as Mask } from './elements/Mask.js'\nexport { default as Path } from './elements/Path.js'\nexport { default as Pattern } from './elements/Pattern.js'\nexport { default as Polygon } from './elements/Polygon.js'\nexport { default as Polyline } from './elements/Polyline.js'\nexport { default as Rect } from './elements/Rect.js'\nexport { default as Shape } from './elements/Shape.js'\nexport { default as Stop } from './elements/Stop.js'\nexport { default as Style } from './elements/Style.js'\nexport { default as Svg } from './elements/Svg.js'\nexport { default as Symbol } from './elements/Symbol.js'\nexport { default as Text } from './elements/Text.js'\nexport { default as TextPath } from './elements/TextPath.js'\nexport { default as Tspan } from './elements/Tspan.js'\nexport { default as Use } from './elements/Use.js'\n\nextend([Svg, Symbol, Image, Pattern, Marker], getMethodsFor('viewbox'))\n\nextend([Line, Polyline, Polygon, Path], getMethodsFor('marker'))\n\nextend(Text, getMethodsFor('Text'))\nextend(Path, getMethodsFor('Path'))\n\nextend(Defs, getMethodsFor('Defs'))\n\nextend([Text, Tspan], getMethodsFor('Tspan'))\n\nextend([Rect, Ellipse, Gradient, Runner], getMethodsFor('radius'))\n\nextend(EventTarget, getMethodsFor('EventTarget'))\nextend(Dom, getMethodsFor('Dom'))\nextend(Element, getMethodsFor('Element'))\nextend(Shape, getMethodsFor('Shape'))\nextend([Container, Fragment], getMethodsFor('Container'))\nextend(Gradient, getMethodsFor('Gradient'))\n\nextend(Runner, getMethodsFor('Runner'))\n\nList.extend(getMethodNames())\n\nregisterMorphableType([\n SVGNumber,\n Color,\n Box,\n Matrix,\n SVGArray,\n PointArray,\n PathArray,\n Point\n])\n\nmakeMorphable()\n","import * as svgMembers from './main.js'\nimport { makeInstance } from './utils/adopter.js'\n\n// The main wrapping element\nexport default function SVG(element, isHTML) {\n return makeInstance(element, isHTML)\n}\n\nObject.assign(SVG, svgMembers)\n"],"names":["methods","names","registerMethods","name","m","Array","isArray","_name","addMethodNames","Object","getOwnPropertyNames","assign","getMethodsFor","_names","push","map","array","block","i","il","length","result","filter","radians","d","Math","PI","unCamelCase","s","replace","g","toLowerCase","capitalize","charAt","toUpperCase","slice","proportionalSize","element","width","height","box","bbox","getOrigin","o","origin","ox","originX","oy","originY","x","y","condX","condY","includes","descriptiveElements","Set","isDescriptive","has","nodeName","writeDataToDom","data","defaults","cloned","key","valueOf","keys","node","setAttribute","JSON","stringify","removeAttribute","r","svg","html","xmlns","xlink","globals","window","document","registerWindow","win","doc","save","saveWindow","restoreWindow","getWindow","Base","elements","root","create","ns","createElementNS","makeInstance","isHTML","adopter","querySelector","wrapper","createElement","innerHTML","firstChild","removeChild","nodeOrNew","Node","ownerDocument","defaultView","adopt","instance","Fragment","className","register","asRoot","prototype","getClass","did","eid","assignNewId","children","id","extend","modules","wrapWithAttrCheck","fn","args","constructor","apply","this","attr","siblings","parent","position","index","next","prev","forward","add","remove","backward","front","back","before","after","insertBefore","insertAfter","numberAndUnit","hex","rgb","reference","transforms","whitespace","isHex","isRgb","isBlank","isNumber","isImage","delimiter","isPathLetter","componentHex","component","integer","round","max","min","toString","is","object","space","hueToRgb","p","q","t","classes","trim","split","hasClass","indexOf","addClass","join","removeClass","c","toggleClass","css","style","val","ret","arguments","cssText","el","forEach","cased","getPropertyValue","setProperty","test","show","hide","visible","a","v","attributes","parse","e","remember","k","memory","forget","_memory","Color","inputs","init","static","color","b","mode","random","sin","pi","l","h","grey","Error","cmyk","_a","_b","_c","hsl","isGrey","delta","_d","values","params","z","getParameters","noWhitespace","exec","parseInt","hexParse","substring","sixDigitHex","components","lab","xyz","lch","sqrt","atan2","dToR","cos","yL","xL","zL","ct","mx","nm","rU","gU","bU","pow","bd","toArray","toHex","_clamped","toRgb","rV","gV","bV","r255","g255","b255","rL","gL","bL","xU","yU","zU","Point","clone","base","source","transform","transformO","Matrix","isMatrixLike","f","closeEnough","threshold","abs","flipBoth","flip","flipX","flipY","skewX","skew","isFinite","skewY","scaleX","scale","scaleY","shear","theta","rotate","around","px","positionX","NaN","py","positionY","translate","tx","translateX","ty","translateY","relative","rx","relativeX","ry","relativeY","cx","cy","matrix","aroundO","dx","dy","translateO","lmultiplyO","decompose","determinant","ccw","sx","thetaRad","st","lam","sy","equals","other","comp","axis","flipO","scaleO","fromArray","Element","matrixify","parseFloat","call","inverse","inverseO","det","na","nb","nc","nd","ne","nf","lmultiply","matrixMultiply","multiply","multiplyO","rotateO","shearO","lx","skewO","tan","ly","formatTransforms","transformer","parser","nodes","size","path","parentNode","body","documentElement","addTo","isNulledBox","Box","addOffset","pageXOffset","pageYOffset","left","top","w","x2","y2","isNulled","merge","xMin","Infinity","xMax","yMin","yMax","getBox","getBBoxFn","retry","contains","viewbox","zoom","level","point","clientWidth","clientHeight","zoomX","zoomY","zoomAmount","Number","MAX_SAFE_INTEGER","List","arr","super","each","fnOrMethodName","concat","reserved","baseFind","query","querySelectorAll","reduce","obj","attrs","listenerId","windowEvents","getEvents","n","getEventHolder","events","getEventTarget","clearEvents","on","listener","binding","options","bind","bag","_svgjsListenerId","event","ev","addEventListener","off","namespace","removeEventListener","dispatch","Event","CustomEvent","detail","cancelable","dispatchEvent","EventTarget","type","j","defaultPrevented","fire","noop","timeline","duration","ease","delay","fill","stroke","opacity","offset","SVGArray","toSet","SVGNumber","convert","unit","value","divide","number","isNaN","match","minus","plus","times","toJSON","colorAttributes","hooks","Dom","removeNamespace","SVGElement","appendChild","childNodes","put","clear","hasChildNodes","lastChild","deep","assignNewIds","nodeClone","cloneNode","first","get","htmlOrFn","outerHTML","xml","last","matches","selector","matcher","matchesSelector","msMatchesSelector","mozMatchesSelector","webkitMatchesSelector","oMatchesSelector","putIn","removeElement","replaceChild","precision","factor","svgOrFn","outerSVG","words","text","textContent","wrap","xmlOrFn","outerXML","current","_this","well","fragment","createDocumentFragment","len","firstElementChild","nodeValue","curr","getAttribute","_val","hook","isColor","leading","setAttributeNS","rebuild","find","findOne","dom","hasAttribute","setData","center","defs","dmove","move","parents","until","isSelector","getBBox","rbox","getBoundingClientRect","screenCTM","inside","ctm","getCTM","isRoot","rect","getScreenCTM","console","warn","sugar","prefix","extension","mat","angle","direction","radius","_element","getTotalLength","pointAt","getPointAtLength","font","untransform","str","kv","reverse","toParent","pCtm","toRoot","decomposed","Container","flatten","ungroup","Defs","Shape","Ellipse","circled","ellipse","from","fx","fy","x1","y1","to","Gradient","targets","url","update","gradiented","gradient","Pattern","pattern","patternUnits","Image","load","callback","img","src","image","PointArray","maxX","maxY","minX","minY","points","pop","toLine","Line","plot","pointed","line","Marker","orient","ref","makeSetterGetter","marker","easing","pos","bezier","steps","stepPosition","jumps","beforeFlag","step","floor","jumping","Stepper","done","Ease","Controller","stepper","target","dt","recalculate","_duration","overshoot","_overshoot","os","log","zeta","wn","Spring","velocity","acceleration","newPosition","PID","windup","integral","error","_windup","P","I","D","segmentParameters","M","L","H","V","C","S","Q","T","A","Z","pathHandlers","p0","mlhvqtcsaz","jl","segmentComplete","segment","startNewSegment","token","inNumber","finalizeNumber","pathLetter","lastCommand","small","isSmall","inSegment","pointSeen","hasExponent","finalizeSegment","absolute","command","makeAbsolut","segments","isArcFlag","isArc","isExponential","lastToken","pathDelimiters","PathArray","toAbsolute","pathParser","arrayToString","getClassForType","NonMorphable","morphableTypes","ObjectBag","Morphable","_stepper","_from","_to","_type","_context","_morphObj","at","morph","_set","align","toConsumable","TransformBag","sortByKey","splice","defaultObject","toDelete","objOrArr","entries","Type","sort","shift","num","registerMorphableType","makeMorphable","context","Path","_array","MorphArray","Polygon","polygon","poly","Polyline","polyline","Rect","Queue","_first","_last","item","Animator","nextDraw","frames","timeouts","immediates","timer","performance","Date","frame","run","requestAnimationFrame","_draw","timeout","time","now","immediate","cancelFrame","clearTimeout","cancelImmediate","nextTimeout","lastTimeout","nextFrame","lastFrame","nextImmediate","makeSchedule","runnerInfo","start","runner","end","defaultSource","Timeline","timeSource","_timeSource","terminate","active","_nextFrame","finish","getEndTimeOfTimeline","pause","getEndTime","lastRunnerInfo","getLastRunnerInfo","lastDuration","_time","endTimes","_runners","getRunnerInfoById","_lastRunnerId","_runnerIds","_paused","_continue","persist","dtOrForever","_persist","play","updateTime","yes","currentSpeed","speed","positive","schedule","when","absoluteStartTime","endTime","unschedule","info","seek","_speed","stop","_lastSourceTime","immediateStep","_stepImmediate","_step","_stepFn","dtSource","dtTime","_lastStepTime","reset","runnersLeft","dtToStart","_startTime","_timeline","Runner","_queue","_isDeclarative","_history","enabled","_lastTime","_reseted","transformId","_haveReversed","_reverse","_loopsDone","_swing","_wait","_times","_frameId","swing","wait","addTransform","animate","sanitise","loop","clearTransform","clearTransformsFromQueue","isTransform","during","queue","_prepareRunner","loops","loopDuration","loopsDone","partial","swinging","backwards","uncliped","swingForward","progress","initFn","runFn","retargetFn","initialiser","retarget","initialised","finished","running","_lastPosition","justStarted","justFinished","declarative","converged","_initialise","_run","needsIt","_rememberMorpher","method","morpher","caller","positionOrDt","allfinished","_tryRetarget","extra","FakeRunner","mergeWith","getRunnerTransform","mergeTransforms","netTransform","_transformationRunners","runners","RunnerArray","ids","clearBefore","deleteCnt","edit","newRunner","getByID","lastRunner","by","_clearTransformRunnersBefore","currentRunner","_currentTransform","_addRunner","styleAttr","nameOrAttrs","newToAttrs","newKeys","differences","difference","addedFromAttrs","oldFromAttrs","oldToAttrs","newLevel","newPoint","affine","isMatrix","currentAngle","startTransform","undefined","rTarget","rCurrent","possibilities","distances","shortest","affineParameters","newTransforms","_queueNumber","ax","ay","_queueNumberDelta","newTo","_queueObject","amove","Svg","version","nested","Symbol","symbol","build","_build","getComputedTextLength","createTextNode","Text","_rebuild","self","blankLineOffset","fontSize","getComputedStyle","newLined","firstLine","nodeType","newLine","textable","plain","Tspan","tspan","Circle","circle","ClipPath","unclip","clip","clipper","clipWith","ForeignObject","foreignObject","child","SVGSVGElement","G","containerGeometry","group","link","unlink","linker","linkTo","Mask","unmask","mask","masker","maskWith","Stop","Style","addText","rule","fontFamily","cssRule","fontface","TextPath","track","pathArray","textPath","importNodes","Use","use","file","SVG","mock","svgMembers"],"mappings":";;;;;;;;;;;gCAAA,MAAMA,EAAU,CAAA,EACVC,EAAQ,GAEP,SAASC,EAAgBC,EAAMC,GACpC,GAAIC,MAAMC,QAAQH,GAChB,IAAK,MAAMI,KAASJ,EAClBD,EAAgBK,EAAOH,QAK3B,GAAoB,iBAATD,EAOXK,EAAeC,OAAOC,oBAAoBN,IAC1CJ,EAAQG,GAAQM,OAAOE,OAAOX,EAAQG,IAAS,GAAIC,QAPjD,IAAK,MAAMG,KAASJ,EAClBD,EAAgBK,EAAOJ,EAAKI,GAOlC,CAEO,SAASK,EAAcT,GAC5B,OAAOH,EAA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nB0B,EAAO,CAAC8yB,IAAKG,OAAQpV,MAAOH,QAASqB,QAASzlB,EAAc,YAE5D0G,EAAO,CAAC2e,KAAM4H,SAAUH,QAASH,MAAO3sB,EAAc,WAEtD0G,EAAOuzB,KAAMj6B,EAAc,SAC3B0G,EAAOimB,KAAM3sB,EAAc,SAE3B0G,EAAOyc,KAAMnjB,EAAc,SAE3B0G,EAAO,CAACuzB,KAAMY,OAAQ76B,EAAc,UAEpC0G,EAAO,CAACymB,KAAM9J,QAASS,SAAU4O,IAAS1yB,EAAc,WAExD0G,EAAOoU,GAAa9a,EAAc,gBAClC0G,EAAOkW,IAAK5c,EAAc,QAC1B0G,EAAO2N,QAASrU,EAAc,YAC9B0G,EAAO0c,MAAOpjB,EAAc,UAC5B0G,EAAO,CAACsc,UAAWjd,IAAW/F,EAAc,cAC5C0G,EAAOod,SAAU9jB,EAAc,aAE/B0G,EAAOgsB,GAAQ1yB,EAAc,WAE7BsY,GAAK5R,OxEjII,IAAI,IAAI/D,IAAItD,KwEmIrBmtB,GAAsB,CACpB1Q,GACA7P,GACAsK,GACA7F,GACAkL,GACAiJ,GACA4F,GACAra,KAGFqc,u1BnExFO,SAAmB6Q,EAAOz3B,GAC/BX,EAAUo4B,CACZ,uLF7DO,SAAoBl5B,EAAKyC,GAC9BtC,IACAJ,EAAeC,EAAKA,EAAIF,UACxB2C,EAAGzC,EAAKA,EAAIF,UACZM,GACF,uBsEvBe,SAAS64B,GAAI57B,EAASwD,GACnC,OAAOD,EAAavD,EAASwD,EAC/B,QAEApF,OAAOE,OAAOs9B,GAAKE"} \ No newline at end of file diff --git a/node_modules/@svgdotjs/svg.js/dist/svg.node.cjs b/node_modules/@svgdotjs/svg.js/dist/svg.node.cjs new file mode 100644 index 0000000..f3766f9 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/dist/svg.node.cjs @@ -0,0 +1,6910 @@ +/*! +* @svgdotjs/svg.js - A lightweight library for manipulating and animating SVG. +* @version 3.2.4 +* https://svgjs.dev/ +* +* @copyright Wout Fierens +* @license MIT +* +* BUILT: Thu Jun 27 2024 12:00:16 GMT+0200 (Central European Summer Time) +*/; +'use strict'; + +const methods$1 = {}; +const names = []; +function registerMethods(name, m) { + if (Array.isArray(name)) { + for (const _name of name) { + registerMethods(_name, m); + } + return; + } + if (typeof name === 'object') { + for (const _name in name) { + registerMethods(_name, name[_name]); + } + return; + } + addMethodNames(Object.getOwnPropertyNames(m)); + methods$1[name] = Object.assign(methods$1[name] || {}, m); +} +function getMethodsFor(name) { + return methods$1[name] || {}; +} +function getMethodNames() { + return [...new Set(names)]; +} +function addMethodNames(_names) { + names.push(..._names); +} + +// Map function +function map(array, block) { + let i; + const il = array.length; + const result = []; + for (i = 0; i < il; i++) { + result.push(block(array[i])); + } + return result; +} + +// Filter function +function filter(array, block) { + let i; + const il = array.length; + const result = []; + for (i = 0; i < il; i++) { + if (block(array[i])) { + result.push(array[i]); + } + } + return result; +} + +// Degrees to radians +function radians(d) { + return d % 360 * Math.PI / 180; +} + +// Radians to degrees +function degrees(r) { + return r * 180 / Math.PI % 360; +} + +// Convert camel cased string to dash separated +function unCamelCase(s) { + return s.replace(/([A-Z])/g, function (m, g) { + return '-' + g.toLowerCase(); + }); +} + +// Capitalize first letter of a string +function capitalize(s) { + return s.charAt(0).toUpperCase() + s.slice(1); +} + +// Calculate proportional width and height values when necessary +function proportionalSize(element, width, height, box) { + if (width == null || height == null) { + box = box || element.bbox(); + if (width == null) { + width = box.width / box.height * height; + } else if (height == null) { + height = box.height / box.width * width; + } + } + return { + width: width, + height: height + }; +} + +/** + * This function adds support for string origins. + * It searches for an origin in o.origin o.ox and o.originX. + * This way, origin: {x: 'center', y: 50} can be passed as well as ox: 'center', oy: 50 + **/ +function getOrigin(o, element) { + const origin = o.origin; + // First check if origin is in ox or originX + let ox = o.ox != null ? o.ox : o.originX != null ? o.originX : 'center'; + let oy = o.oy != null ? o.oy : o.originY != null ? o.originY : 'center'; + + // Then check if origin was used and overwrite in that case + if (origin != null) { + [ox, oy] = Array.isArray(origin) ? origin : typeof origin === 'object' ? [origin.x, origin.y] : [origin, origin]; + } + + // Make sure to only call bbox when actually needed + const condX = typeof ox === 'string'; + const condY = typeof oy === 'string'; + if (condX || condY) { + const { + height, + width, + x, + y + } = element.bbox(); + + // And only overwrite if string was passed for this specific axis + if (condX) { + ox = ox.includes('left') ? x : ox.includes('right') ? x + width : x + width / 2; + } + if (condY) { + oy = oy.includes('top') ? y : oy.includes('bottom') ? y + height : y + height / 2; + } + } + + // Return the origin as it is if it wasn't a string + return [ox, oy]; +} +const descriptiveElements = new Set(['desc', 'metadata', 'title']); +const isDescriptive = element => descriptiveElements.has(element.nodeName); +const writeDataToDom = (element, data, defaults = {}) => { + const cloned = { + ...data + }; + for (const key in cloned) { + if (cloned[key].valueOf() === defaults[key]) { + delete cloned[key]; + } + } + if (Object.keys(cloned).length) { + element.node.setAttribute('data-svgjs', JSON.stringify(cloned)); // see #428 + } else { + element.node.removeAttribute('data-svgjs'); + element.node.removeAttribute('svgjs:data'); + } +}; + +var utils = { + __proto__: null, + capitalize: capitalize, + degrees: degrees, + filter: filter, + getOrigin: getOrigin, + isDescriptive: isDescriptive, + map: map, + proportionalSize: proportionalSize, + radians: radians, + unCamelCase: unCamelCase, + writeDataToDom: writeDataToDom +}; + +// Default namespaces +const svg = 'http://www.w3.org/2000/svg'; +const html = 'http://www.w3.org/1999/xhtml'; +const xmlns = 'http://www.w3.org/2000/xmlns/'; +const xlink = 'http://www.w3.org/1999/xlink'; + +var namespaces = { + __proto__: null, + html: html, + svg: svg, + xlink: xlink, + xmlns: xmlns +}; + +const globals = { + window: typeof window === 'undefined' ? null : window, + document: typeof document === 'undefined' ? null : document +}; +function registerWindow(win = null, doc = null) { + globals.window = win; + globals.document = doc; +} +const save = {}; +function saveWindow() { + save.window = globals.window; + save.document = globals.document; +} +function restoreWindow() { + globals.window = save.window; + globals.document = save.document; +} +function withWindow(win, fn) { + saveWindow(); + registerWindow(win, win.document); + fn(win, win.document); + restoreWindow(); +} +function getWindow() { + return globals.window; +} + +class Base { + // constructor (node/*, {extensions = []} */) { + // // this.tags = [] + // // + // // for (let extension of extensions) { + // // extension.setup.call(this, node) + // // this.tags.push(extension.name) + // // } + // } +} + +const elements = {}; +const root = '___SYMBOL___ROOT___'; + +// Method for element creation +function create(name, ns = svg) { + // create element + return globals.document.createElementNS(ns, name); +} +function makeInstance(element, isHTML = false) { + if (element instanceof Base) return element; + if (typeof element === 'object') { + return adopter(element); + } + if (element == null) { + return new elements[root](); + } + if (typeof element === 'string' && element.charAt(0) !== '<') { + return adopter(globals.document.querySelector(element)); + } + + // Make sure, that HTML elements are created with the correct namespace + const wrapper = isHTML ? globals.document.createElement('div') : create('svg'); + wrapper.innerHTML = element; + + // We can use firstChild here because we know, + // that the first char is < and thus an element + element = adopter(wrapper.firstChild); + + // make sure, that element doesn't have its wrapper attached + wrapper.removeChild(wrapper.firstChild); + return element; +} +function nodeOrNew(name, node) { + return node && (node instanceof globals.window.Node || node.ownerDocument && node instanceof node.ownerDocument.defaultView.Node) ? node : create(name); +} + +// Adopt existing svg elements +function adopt(node) { + // check for presence of node + if (!node) return null; + + // make sure a node isn't already adopted + if (node.instance instanceof Base) return node.instance; + if (node.nodeName === '#document-fragment') { + return new elements.Fragment(node); + } + + // initialize variables + let className = capitalize(node.nodeName || 'Dom'); + + // Make sure that gradients are adopted correctly + if (className === 'LinearGradient' || className === 'RadialGradient') { + className = 'Gradient'; + + // Fallback to Dom if element is not known + } else if (!elements[className]) { + className = 'Dom'; + } + return new elements[className](node); +} +let adopter = adopt; +function mockAdopt(mock = adopt) { + adopter = mock; +} +function register(element, name = element.name, asRoot = false) { + elements[name] = element; + if (asRoot) elements[root] = element; + addMethodNames(Object.getOwnPropertyNames(element.prototype)); + return element; +} +function getClass(name) { + return elements[name]; +} + +// Element id sequence +let did = 1000; + +// Get next named element id +function eid(name) { + return 'Svgjs' + capitalize(name) + did++; +} + +// Deep new id assignment +function assignNewId(node) { + // do the same for SVG child nodes as well + for (let i = node.children.length - 1; i >= 0; i--) { + assignNewId(node.children[i]); + } + if (node.id) { + node.id = eid(node.nodeName); + return node; + } + return node; +} + +// Method for extending objects +function extend(modules, methods) { + let key, i; + modules = Array.isArray(modules) ? modules : [modules]; + for (i = modules.length - 1; i >= 0; i--) { + for (key in methods) { + modules[i].prototype[key] = methods[key]; + } + } +} +function wrapWithAttrCheck(fn) { + return function (...args) { + const o = args[args.length - 1]; + if (o && o.constructor === Object && !(o instanceof Array)) { + return fn.apply(this, args.slice(0, -1)).attr(o); + } else { + return fn.apply(this, args); + } + }; +} + +// Get all siblings, including myself +function siblings() { + return this.parent().children(); +} + +// Get the current position siblings +function position() { + return this.parent().index(this); +} + +// Get the next element (will return null if there is none) +function next() { + return this.siblings()[this.position() + 1]; +} + +// Get the next element (will return null if there is none) +function prev() { + return this.siblings()[this.position() - 1]; +} + +// Send given element one step forward +function forward() { + const i = this.position(); + const p = this.parent(); + + // move node one step forward + p.add(this.remove(), i + 1); + return this; +} + +// Send given element one step backward +function backward() { + const i = this.position(); + const p = this.parent(); + p.add(this.remove(), i ? i - 1 : 0); + return this; +} + +// Send given element all the way to the front +function front() { + const p = this.parent(); + + // Move node forward + p.add(this.remove()); + return this; +} + +// Send given element all the way to the back +function back() { + const p = this.parent(); + + // Move node back + p.add(this.remove(), 0); + return this; +} + +// Inserts a given element before the targeted element +function before(element) { + element = makeInstance(element); + element.remove(); + const i = this.position(); + this.parent().add(element, i); + return this; +} + +// Inserts a given element after the targeted element +function after(element) { + element = makeInstance(element); + element.remove(); + const i = this.position(); + this.parent().add(element, i + 1); + return this; +} +function insertBefore(element) { + element = makeInstance(element); + element.before(this); + return this; +} +function insertAfter(element) { + element = makeInstance(element); + element.after(this); + return this; +} +registerMethods('Dom', { + siblings, + position, + next, + prev, + forward, + backward, + front, + back, + before, + after, + insertBefore, + insertAfter +}); + +// Parse unit value +const numberAndUnit = /^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i; + +// Parse hex value +const hex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i; + +// Parse rgb value +const rgb = /rgb\((\d+),(\d+),(\d+)\)/; + +// Parse reference id +const reference = /(#[a-z_][a-z0-9\-_]*)/i; + +// splits a transformation chain +const transforms = /\)\s*,?\s*/; + +// Whitespace +const whitespace = /\s/g; + +// Test hex value +const isHex = /^#[a-f0-9]{3}$|^#[a-f0-9]{6}$/i; + +// Test rgb value +const isRgb = /^rgb\(/; + +// Test for blank string +const isBlank = /^(\s+)?$/; + +// Test for numeric string +const isNumber = /^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i; + +// Test for image url +const isImage = /\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i; + +// split at whitespace and comma +const delimiter = /[\s,]+/; + +// Test for path letter +const isPathLetter = /[MLHVCSQTAZ]/i; + +var regex = { + __proto__: null, + delimiter: delimiter, + hex: hex, + isBlank: isBlank, + isHex: isHex, + isImage: isImage, + isNumber: isNumber, + isPathLetter: isPathLetter, + isRgb: isRgb, + numberAndUnit: numberAndUnit, + reference: reference, + rgb: rgb, + transforms: transforms, + whitespace: whitespace +}; + +// Return array of classes on the node +function classes() { + const attr = this.attr('class'); + return attr == null ? [] : attr.trim().split(delimiter); +} + +// Return true if class exists on the node, false otherwise +function hasClass(name) { + return this.classes().indexOf(name) !== -1; +} + +// Add class to the node +function addClass(name) { + if (!this.hasClass(name)) { + const array = this.classes(); + array.push(name); + this.attr('class', array.join(' ')); + } + return this; +} + +// Remove class from the node +function removeClass(name) { + if (this.hasClass(name)) { + this.attr('class', this.classes().filter(function (c) { + return c !== name; + }).join(' ')); + } + return this; +} + +// Toggle the presence of a class on the node +function toggleClass(name) { + return this.hasClass(name) ? this.removeClass(name) : this.addClass(name); +} +registerMethods('Dom', { + classes, + hasClass, + addClass, + removeClass, + toggleClass +}); + +// Dynamic style generator +function css(style, val) { + const ret = {}; + if (arguments.length === 0) { + // get full style as object + this.node.style.cssText.split(/\s*;\s*/).filter(function (el) { + return !!el.length; + }).forEach(function (el) { + const t = el.split(/\s*:\s*/); + ret[t[0]] = t[1]; + }); + return ret; + } + if (arguments.length < 2) { + // get style properties as array + if (Array.isArray(style)) { + for (const name of style) { + const cased = name; + ret[name] = this.node.style.getPropertyValue(cased); + } + return ret; + } + + // get style for property + if (typeof style === 'string') { + return this.node.style.getPropertyValue(style); + } + + // set styles in object + if (typeof style === 'object') { + for (const name in style) { + // set empty string if null/undefined/'' was given + this.node.style.setProperty(name, style[name] == null || isBlank.test(style[name]) ? '' : style[name]); + } + } + } + + // set style for property + if (arguments.length === 2) { + this.node.style.setProperty(style, val == null || isBlank.test(val) ? '' : val); + } + return this; +} + +// Show element +function show() { + return this.css('display', ''); +} + +// Hide element +function hide() { + return this.css('display', 'none'); +} + +// Is element visible? +function visible() { + return this.css('display') !== 'none'; +} +registerMethods('Dom', { + css, + show, + hide, + visible +}); + +// Store data values on svg nodes +function data(a, v, r) { + if (a == null) { + // get an object of attributes + return this.data(map(filter(this.node.attributes, el => el.nodeName.indexOf('data-') === 0), el => el.nodeName.slice(5))); + } else if (a instanceof Array) { + const data = {}; + for (const key of a) { + data[key] = this.data(key); + } + return data; + } else if (typeof a === 'object') { + for (v in a) { + this.data(v, a[v]); + } + } else if (arguments.length < 2) { + try { + return JSON.parse(this.attr('data-' + a)); + } catch (e) { + return this.attr('data-' + a); + } + } else { + this.attr('data-' + a, v === null ? null : r === true || typeof v === 'string' || typeof v === 'number' ? v : JSON.stringify(v)); + } + return this; +} +registerMethods('Dom', { + data +}); + +// Remember arbitrary data +function remember(k, v) { + // remember every item in an object individually + if (typeof arguments[0] === 'object') { + for (const key in k) { + this.remember(key, k[key]); + } + } else if (arguments.length === 1) { + // retrieve memory + return this.memory()[k]; + } else { + // store memory + this.memory()[k] = v; + } + return this; +} + +// Erase a given memory +function forget() { + if (arguments.length === 0) { + this._memory = {}; + } else { + for (let i = arguments.length - 1; i >= 0; i--) { + delete this.memory()[arguments[i]]; + } + } + return this; +} + +// This triggers creation of a new hidden class which is not performant +// However, this function is not rarely used so it will not happen frequently +// Return local memory object +function memory() { + return this._memory = this._memory || {}; +} +registerMethods('Dom', { + remember, + forget, + memory +}); + +function sixDigitHex(hex) { + return hex.length === 4 ? ['#', hex.substring(1, 2), hex.substring(1, 2), hex.substring(2, 3), hex.substring(2, 3), hex.substring(3, 4), hex.substring(3, 4)].join('') : hex; +} +function componentHex(component) { + const integer = Math.round(component); + const bounded = Math.max(0, Math.min(255, integer)); + const hex = bounded.toString(16); + return hex.length === 1 ? '0' + hex : hex; +} +function is(object, space) { + for (let i = space.length; i--;) { + if (object[space[i]] == null) { + return false; + } + } + return true; +} +function getParameters(a, b) { + const params = is(a, 'rgb') ? { + _a: a.r, + _b: a.g, + _c: a.b, + _d: 0, + space: 'rgb' + } : is(a, 'xyz') ? { + _a: a.x, + _b: a.y, + _c: a.z, + _d: 0, + space: 'xyz' + } : is(a, 'hsl') ? { + _a: a.h, + _b: a.s, + _c: a.l, + _d: 0, + space: 'hsl' + } : is(a, 'lab') ? { + _a: a.l, + _b: a.a, + _c: a.b, + _d: 0, + space: 'lab' + } : is(a, 'lch') ? { + _a: a.l, + _b: a.c, + _c: a.h, + _d: 0, + space: 'lch' + } : is(a, 'cmyk') ? { + _a: a.c, + _b: a.m, + _c: a.y, + _d: a.k, + space: 'cmyk' + } : { + _a: 0, + _b: 0, + _c: 0, + space: 'rgb' + }; + params.space = b || params.space; + return params; +} +function cieSpace(space) { + if (space === 'lab' || space === 'xyz' || space === 'lch') { + return true; + } else { + return false; + } +} +function hueToRgb(p, q, t) { + if (t < 0) t += 1; + if (t > 1) t -= 1; + if (t < 1 / 6) return p + (q - p) * 6 * t; + if (t < 1 / 2) return q; + if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6; + return p; +} +class Color { + constructor(...inputs) { + this.init(...inputs); + } + + // Test if given value is a color + static isColor(color) { + return color && (color instanceof Color || this.isRgb(color) || this.test(color)); + } + + // Test if given value is an rgb object + static isRgb(color) { + return color && typeof color.r === 'number' && typeof color.g === 'number' && typeof color.b === 'number'; + } + + /* + Generating random colors + */ + static random(mode = 'vibrant', t) { + // Get the math modules + const { + random, + round, + sin, + PI: pi + } = Math; + + // Run the correct generator + if (mode === 'vibrant') { + const l = (81 - 57) * random() + 57; + const c = (83 - 45) * random() + 45; + const h = 360 * random(); + const color = new Color(l, c, h, 'lch'); + return color; + } else if (mode === 'sine') { + t = t == null ? random() : t; + const r = round(80 * sin(2 * pi * t / 0.5 + 0.01) + 150); + const g = round(50 * sin(2 * pi * t / 0.5 + 4.6) + 200); + const b = round(100 * sin(2 * pi * t / 0.5 + 2.3) + 150); + const color = new Color(r, g, b); + return color; + } else if (mode === 'pastel') { + const l = (94 - 86) * random() + 86; + const c = (26 - 9) * random() + 9; + const h = 360 * random(); + const color = new Color(l, c, h, 'lch'); + return color; + } else if (mode === 'dark') { + const l = 10 + 10 * random(); + const c = (125 - 75) * random() + 86; + const h = 360 * random(); + const color = new Color(l, c, h, 'lch'); + return color; + } else if (mode === 'rgb') { + const r = 255 * random(); + const g = 255 * random(); + const b = 255 * random(); + const color = new Color(r, g, b); + return color; + } else if (mode === 'lab') { + const l = 100 * random(); + const a = 256 * random() - 128; + const b = 256 * random() - 128; + const color = new Color(l, a, b, 'lab'); + return color; + } else if (mode === 'grey') { + const grey = 255 * random(); + const color = new Color(grey, grey, grey); + return color; + } else { + throw new Error('Unsupported random color mode'); + } + } + + // Test if given value is a color string + static test(color) { + return typeof color === 'string' && (isHex.test(color) || isRgb.test(color)); + } + cmyk() { + // Get the rgb values for the current color + const { + _a, + _b, + _c + } = this.rgb(); + const [r, g, b] = [_a, _b, _c].map(v => v / 255); + + // Get the cmyk values in an unbounded format + const k = Math.min(1 - r, 1 - g, 1 - b); + if (k === 1) { + // Catch the black case + return new Color(0, 0, 0, 1, 'cmyk'); + } + const c = (1 - r - k) / (1 - k); + const m = (1 - g - k) / (1 - k); + const y = (1 - b - k) / (1 - k); + + // Construct the new color + const color = new Color(c, m, y, k, 'cmyk'); + return color; + } + hsl() { + // Get the rgb values + const { + _a, + _b, + _c + } = this.rgb(); + const [r, g, b] = [_a, _b, _c].map(v => v / 255); + + // Find the maximum and minimum values to get the lightness + const max = Math.max(r, g, b); + const min = Math.min(r, g, b); + const l = (max + min) / 2; + + // If the r, g, v values are identical then we are grey + const isGrey = max === min; + + // Calculate the hue and saturation + const delta = max - min; + const s = isGrey ? 0 : l > 0.5 ? delta / (2 - max - min) : delta / (max + min); + const h = isGrey ? 0 : max === r ? ((g - b) / delta + (g < b ? 6 : 0)) / 6 : max === g ? ((b - r) / delta + 2) / 6 : max === b ? ((r - g) / delta + 4) / 6 : 0; + + // Construct and return the new color + const color = new Color(360 * h, 100 * s, 100 * l, 'hsl'); + return color; + } + init(a = 0, b = 0, c = 0, d = 0, space = 'rgb') { + // This catches the case when a falsy value is passed like '' + a = !a ? 0 : a; + + // Reset all values in case the init function is rerun with new color space + if (this.space) { + for (const component in this.space) { + delete this[this.space[component]]; + } + } + if (typeof a === 'number') { + // Allow for the case that we don't need d... + space = typeof d === 'string' ? d : space; + d = typeof d === 'string' ? 0 : d; + + // Assign the values straight to the color + Object.assign(this, { + _a: a, + _b: b, + _c: c, + _d: d, + space + }); + // If the user gave us an array, make the color from it + } else if (a instanceof Array) { + this.space = b || (typeof a[3] === 'string' ? a[3] : a[4]) || 'rgb'; + Object.assign(this, { + _a: a[0], + _b: a[1], + _c: a[2], + _d: a[3] || 0 + }); + } else if (a instanceof Object) { + // Set the object up and assign its values directly + const values = getParameters(a, b); + Object.assign(this, values); + } else if (typeof a === 'string') { + if (isRgb.test(a)) { + const noWhitespace = a.replace(whitespace, ''); + const [_a, _b, _c] = rgb.exec(noWhitespace).slice(1, 4).map(v => parseInt(v)); + Object.assign(this, { + _a, + _b, + _c, + _d: 0, + space: 'rgb' + }); + } else if (isHex.test(a)) { + const hexParse = v => parseInt(v, 16); + const [, _a, _b, _c] = hex.exec(sixDigitHex(a)).map(hexParse); + Object.assign(this, { + _a, + _b, + _c, + _d: 0, + space: 'rgb' + }); + } else throw Error("Unsupported string format, can't construct Color"); + } + + // Now add the components as a convenience + const { + _a, + _b, + _c, + _d + } = this; + const components = this.space === 'rgb' ? { + r: _a, + g: _b, + b: _c + } : this.space === 'xyz' ? { + x: _a, + y: _b, + z: _c + } : this.space === 'hsl' ? { + h: _a, + s: _b, + l: _c + } : this.space === 'lab' ? { + l: _a, + a: _b, + b: _c + } : this.space === 'lch' ? { + l: _a, + c: _b, + h: _c + } : this.space === 'cmyk' ? { + c: _a, + m: _b, + y: _c, + k: _d + } : {}; + Object.assign(this, components); + } + lab() { + // Get the xyz color + const { + x, + y, + z + } = this.xyz(); + + // Get the lab components + const l = 116 * y - 16; + const a = 500 * (x - y); + const b = 200 * (y - z); + + // Construct and return a new color + const color = new Color(l, a, b, 'lab'); + return color; + } + lch() { + // Get the lab color directly + const { + l, + a, + b + } = this.lab(); + + // Get the chromaticity and the hue using polar coordinates + const c = Math.sqrt(a ** 2 + b ** 2); + let h = 180 * Math.atan2(b, a) / Math.PI; + if (h < 0) { + h *= -1; + h = 360 - h; + } + + // Make a new color and return it + const color = new Color(l, c, h, 'lch'); + return color; + } + /* + Conversion Methods + */ + + rgb() { + if (this.space === 'rgb') { + return this; + } else if (cieSpace(this.space)) { + // Convert to the xyz color space + let { + x, + y, + z + } = this; + if (this.space === 'lab' || this.space === 'lch') { + // Get the values in the lab space + let { + l, + a, + b + } = this; + if (this.space === 'lch') { + const { + c, + h + } = this; + const dToR = Math.PI / 180; + a = c * Math.cos(dToR * h); + b = c * Math.sin(dToR * h); + } + + // Undo the nonlinear function + const yL = (l + 16) / 116; + const xL = a / 500 + yL; + const zL = yL - b / 200; + + // Get the xyz values + const ct = 16 / 116; + const mx = 0.008856; + const nm = 7.787; + x = 0.95047 * (xL ** 3 > mx ? xL ** 3 : (xL - ct) / nm); + y = 1.0 * (yL ** 3 > mx ? yL ** 3 : (yL - ct) / nm); + z = 1.08883 * (zL ** 3 > mx ? zL ** 3 : (zL - ct) / nm); + } + + // Convert xyz to unbounded rgb values + const rU = x * 3.2406 + y * -1.5372 + z * -0.4986; + const gU = x * -0.9689 + y * 1.8758 + z * 0.0415; + const bU = x * 0.0557 + y * -0.204 + z * 1.057; + + // Convert the values to true rgb values + const pow = Math.pow; + const bd = 0.0031308; + const r = rU > bd ? 1.055 * pow(rU, 1 / 2.4) - 0.055 : 12.92 * rU; + const g = gU > bd ? 1.055 * pow(gU, 1 / 2.4) - 0.055 : 12.92 * gU; + const b = bU > bd ? 1.055 * pow(bU, 1 / 2.4) - 0.055 : 12.92 * bU; + + // Make and return the color + const color = new Color(255 * r, 255 * g, 255 * b); + return color; + } else if (this.space === 'hsl') { + // https://bgrins.github.io/TinyColor/docs/tinycolor.html + // Get the current hsl values + let { + h, + s, + l + } = this; + h /= 360; + s /= 100; + l /= 100; + + // If we are grey, then just make the color directly + if (s === 0) { + l *= 255; + const color = new Color(l, l, l); + return color; + } + + // TODO I have no idea what this does :D If you figure it out, tell me! + const q = l < 0.5 ? l * (1 + s) : l + s - l * s; + const p = 2 * l - q; + + // Get the rgb values + const r = 255 * hueToRgb(p, q, h + 1 / 3); + const g = 255 * hueToRgb(p, q, h); + const b = 255 * hueToRgb(p, q, h - 1 / 3); + + // Make a new color + const color = new Color(r, g, b); + return color; + } else if (this.space === 'cmyk') { + // https://gist.github.com/felipesabino/5066336 + // Get the normalised cmyk values + const { + c, + m, + y, + k + } = this; + + // Get the rgb values + const r = 255 * (1 - Math.min(1, c * (1 - k) + k)); + const g = 255 * (1 - Math.min(1, m * (1 - k) + k)); + const b = 255 * (1 - Math.min(1, y * (1 - k) + k)); + + // Form the color and return it + const color = new Color(r, g, b); + return color; + } else { + return this; + } + } + toArray() { + const { + _a, + _b, + _c, + _d, + space + } = this; + return [_a, _b, _c, _d, space]; + } + toHex() { + const [r, g, b] = this._clamped().map(componentHex); + return `#${r}${g}${b}`; + } + toRgb() { + const [rV, gV, bV] = this._clamped(); + const string = `rgb(${rV},${gV},${bV})`; + return string; + } + toString() { + return this.toHex(); + } + xyz() { + // Normalise the red, green and blue values + const { + _a: r255, + _b: g255, + _c: b255 + } = this.rgb(); + const [r, g, b] = [r255, g255, b255].map(v => v / 255); + + // Convert to the lab rgb space + const rL = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92; + const gL = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92; + const bL = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92; + + // Convert to the xyz color space without bounding the values + const xU = (rL * 0.4124 + gL * 0.3576 + bL * 0.1805) / 0.95047; + const yU = (rL * 0.2126 + gL * 0.7152 + bL * 0.0722) / 1.0; + const zU = (rL * 0.0193 + gL * 0.1192 + bL * 0.9505) / 1.08883; + + // Get the proper xyz values by applying the bounding + const x = xU > 0.008856 ? Math.pow(xU, 1 / 3) : 7.787 * xU + 16 / 116; + const y = yU > 0.008856 ? Math.pow(yU, 1 / 3) : 7.787 * yU + 16 / 116; + const z = zU > 0.008856 ? Math.pow(zU, 1 / 3) : 7.787 * zU + 16 / 116; + + // Make and return the color + const color = new Color(x, y, z, 'xyz'); + return color; + } + + /* + Input and Output methods + */ + + _clamped() { + const { + _a, + _b, + _c + } = this.rgb(); + const { + max, + min, + round + } = Math; + const format = v => max(0, min(round(v), 255)); + return [_a, _b, _c].map(format); + } + + /* + Constructing colors + */ +} + +class Point { + // Initialize + constructor(...args) { + this.init(...args); + } + + // Clone point + clone() { + return new Point(this); + } + init(x, y) { + const base = { + x: 0, + y: 0 + }; + + // ensure source as object + const source = Array.isArray(x) ? { + x: x[0], + y: x[1] + } : typeof x === 'object' ? { + x: x.x, + y: x.y + } : { + x: x, + y: y + }; + + // merge source + this.x = source.x == null ? base.x : source.x; + this.y = source.y == null ? base.y : source.y; + return this; + } + toArray() { + return [this.x, this.y]; + } + transform(m) { + return this.clone().transformO(m); + } + + // Transform point with matrix + transformO(m) { + if (!Matrix.isMatrixLike(m)) { + m = new Matrix(m); + } + const { + x, + y + } = this; + + // Perform the matrix multiplication + this.x = m.a * x + m.c * y + m.e; + this.y = m.b * x + m.d * y + m.f; + return this; + } +} +function point(x, y) { + return new Point(x, y).transformO(this.screenCTM().inverseO()); +} + +function closeEnough(a, b, threshold) { + return Math.abs(b - a) < (1e-6); +} +class Matrix { + constructor(...args) { + this.init(...args); + } + static formatTransforms(o) { + // Get all of the parameters required to form the matrix + const flipBoth = o.flip === 'both' || o.flip === true; + const flipX = o.flip && (flipBoth || o.flip === 'x') ? -1 : 1; + const flipY = o.flip && (flipBoth || o.flip === 'y') ? -1 : 1; + const skewX = o.skew && o.skew.length ? o.skew[0] : isFinite(o.skew) ? o.skew : isFinite(o.skewX) ? o.skewX : 0; + const skewY = o.skew && o.skew.length ? o.skew[1] : isFinite(o.skew) ? o.skew : isFinite(o.skewY) ? o.skewY : 0; + const scaleX = o.scale && o.scale.length ? o.scale[0] * flipX : isFinite(o.scale) ? o.scale * flipX : isFinite(o.scaleX) ? o.scaleX * flipX : flipX; + const scaleY = o.scale && o.scale.length ? o.scale[1] * flipY : isFinite(o.scale) ? o.scale * flipY : isFinite(o.scaleY) ? o.scaleY * flipY : flipY; + const shear = o.shear || 0; + const theta = o.rotate || o.theta || 0; + const origin = new Point(o.origin || o.around || o.ox || o.originX, o.oy || o.originY); + const ox = origin.x; + const oy = origin.y; + // We need Point to be invalid if nothing was passed because we cannot default to 0 here. That is why NaN + const position = new Point(o.position || o.px || o.positionX || NaN, o.py || o.positionY || NaN); + const px = position.x; + const py = position.y; + const translate = new Point(o.translate || o.tx || o.translateX, o.ty || o.translateY); + const tx = translate.x; + const ty = translate.y; + const relative = new Point(o.relative || o.rx || o.relativeX, o.ry || o.relativeY); + const rx = relative.x; + const ry = relative.y; + + // Populate all of the values + return { + scaleX, + scaleY, + skewX, + skewY, + shear, + theta, + rx, + ry, + tx, + ty, + ox, + oy, + px, + py + }; + } + static fromArray(a) { + return { + a: a[0], + b: a[1], + c: a[2], + d: a[3], + e: a[4], + f: a[5] + }; + } + static isMatrixLike(o) { + return o.a != null || o.b != null || o.c != null || o.d != null || o.e != null || o.f != null; + } + + // left matrix, right matrix, target matrix which is overwritten + static matrixMultiply(l, r, o) { + // Work out the product directly + const a = l.a * r.a + l.c * r.b; + const b = l.b * r.a + l.d * r.b; + const c = l.a * r.c + l.c * r.d; + const d = l.b * r.c + l.d * r.d; + const e = l.e + l.a * r.e + l.c * r.f; + const f = l.f + l.b * r.e + l.d * r.f; + + // make sure to use local variables because l/r and o could be the same + o.a = a; + o.b = b; + o.c = c; + o.d = d; + o.e = e; + o.f = f; + return o; + } + around(cx, cy, matrix) { + return this.clone().aroundO(cx, cy, matrix); + } + + // Transform around a center point + aroundO(cx, cy, matrix) { + const dx = cx || 0; + const dy = cy || 0; + return this.translateO(-dx, -dy).lmultiplyO(matrix).translateO(dx, dy); + } + + // Clones this matrix + clone() { + return new Matrix(this); + } + + // Decomposes this matrix into its affine parameters + decompose(cx = 0, cy = 0) { + // Get the parameters from the matrix + const a = this.a; + const b = this.b; + const c = this.c; + const d = this.d; + const e = this.e; + const f = this.f; + + // Figure out if the winding direction is clockwise or counterclockwise + const determinant = a * d - b * c; + const ccw = determinant > 0 ? 1 : -1; + + // Since we only shear in x, we can use the x basis to get the x scale + // and the rotation of the resulting matrix + const sx = ccw * Math.sqrt(a * a + b * b); + const thetaRad = Math.atan2(ccw * b, ccw * a); + const theta = 180 / Math.PI * thetaRad; + const ct = Math.cos(thetaRad); + const st = Math.sin(thetaRad); + + // We can then solve the y basis vector simultaneously to get the other + // two affine parameters directly from these parameters + const lam = (a * c + b * d) / determinant; + const sy = c * sx / (lam * a - b) || d * sx / (lam * b + a); + + // Use the translations + const tx = e - cx + cx * ct * sx + cy * (lam * ct * sx - st * sy); + const ty = f - cy + cx * st * sx + cy * (lam * st * sx + ct * sy); + + // Construct the decomposition and return it + return { + // Return the affine parameters + scaleX: sx, + scaleY: sy, + shear: lam, + rotate: theta, + translateX: tx, + translateY: ty, + originX: cx, + originY: cy, + // Return the matrix parameters + a: this.a, + b: this.b, + c: this.c, + d: this.d, + e: this.e, + f: this.f + }; + } + + // Check if two matrices are equal + equals(other) { + if (other === this) return true; + const comp = new Matrix(other); + return closeEnough(this.a, comp.a) && closeEnough(this.b, comp.b) && closeEnough(this.c, comp.c) && closeEnough(this.d, comp.d) && closeEnough(this.e, comp.e) && closeEnough(this.f, comp.f); + } + + // Flip matrix on x or y, at a given offset + flip(axis, around) { + return this.clone().flipO(axis, around); + } + flipO(axis, around) { + return axis === 'x' ? this.scaleO(-1, 1, around, 0) : axis === 'y' ? this.scaleO(1, -1, 0, around) : this.scaleO(-1, -1, axis, around || axis); // Define an x, y flip point + } + + // Initialize + init(source) { + const base = Matrix.fromArray([1, 0, 0, 1, 0, 0]); + + // ensure source as object + source = source instanceof Element ? source.matrixify() : typeof source === 'string' ? Matrix.fromArray(source.split(delimiter).map(parseFloat)) : Array.isArray(source) ? Matrix.fromArray(source) : typeof source === 'object' && Matrix.isMatrixLike(source) ? source : typeof source === 'object' ? new Matrix().transform(source) : arguments.length === 6 ? Matrix.fromArray([].slice.call(arguments)) : base; + + // Merge the source matrix with the base matrix + this.a = source.a != null ? source.a : base.a; + this.b = source.b != null ? source.b : base.b; + this.c = source.c != null ? source.c : base.c; + this.d = source.d != null ? source.d : base.d; + this.e = source.e != null ? source.e : base.e; + this.f = source.f != null ? source.f : base.f; + return this; + } + inverse() { + return this.clone().inverseO(); + } + + // Inverses matrix + inverseO() { + // Get the current parameters out of the matrix + const a = this.a; + const b = this.b; + const c = this.c; + const d = this.d; + const e = this.e; + const f = this.f; + + // Invert the 2x2 matrix in the top left + const det = a * d - b * c; + if (!det) throw new Error('Cannot invert ' + this); + + // Calculate the top 2x2 matrix + const na = d / det; + const nb = -b / det; + const nc = -c / det; + const nd = a / det; + + // Apply the inverted matrix to the top right + const ne = -(na * e + nc * f); + const nf = -(nb * e + nd * f); + + // Construct the inverted matrix + this.a = na; + this.b = nb; + this.c = nc; + this.d = nd; + this.e = ne; + this.f = nf; + return this; + } + lmultiply(matrix) { + return this.clone().lmultiplyO(matrix); + } + lmultiplyO(matrix) { + const r = this; + const l = matrix instanceof Matrix ? matrix : new Matrix(matrix); + return Matrix.matrixMultiply(l, r, this); + } + + // Left multiplies by the given matrix + multiply(matrix) { + return this.clone().multiplyO(matrix); + } + multiplyO(matrix) { + // Get the matrices + const l = this; + const r = matrix instanceof Matrix ? matrix : new Matrix(matrix); + return Matrix.matrixMultiply(l, r, this); + } + + // Rotate matrix + rotate(r, cx, cy) { + return this.clone().rotateO(r, cx, cy); + } + rotateO(r, cx = 0, cy = 0) { + // Convert degrees to radians + r = radians(r); + const cos = Math.cos(r); + const sin = Math.sin(r); + const { + a, + b, + c, + d, + e, + f + } = this; + this.a = a * cos - b * sin; + this.b = b * cos + a * sin; + this.c = c * cos - d * sin; + this.d = d * cos + c * sin; + this.e = e * cos - f * sin + cy * sin - cx * cos + cx; + this.f = f * cos + e * sin - cx * sin - cy * cos + cy; + return this; + } + + // Scale matrix + scale() { + return this.clone().scaleO(...arguments); + } + scaleO(x, y = x, cx = 0, cy = 0) { + // Support uniform scaling + if (arguments.length === 3) { + cy = cx; + cx = y; + y = x; + } + const { + a, + b, + c, + d, + e, + f + } = this; + this.a = a * x; + this.b = b * y; + this.c = c * x; + this.d = d * y; + this.e = e * x - cx * x + cx; + this.f = f * y - cy * y + cy; + return this; + } + + // Shear matrix + shear(a, cx, cy) { + return this.clone().shearO(a, cx, cy); + } + + // eslint-disable-next-line no-unused-vars + shearO(lx, cx = 0, cy = 0) { + const { + a, + b, + c, + d, + e, + f + } = this; + this.a = a + b * lx; + this.c = c + d * lx; + this.e = e + f * lx - cy * lx; + return this; + } + + // Skew Matrix + skew() { + return this.clone().skewO(...arguments); + } + skewO(x, y = x, cx = 0, cy = 0) { + // support uniformal skew + if (arguments.length === 3) { + cy = cx; + cx = y; + y = x; + } + + // Convert degrees to radians + x = radians(x); + y = radians(y); + const lx = Math.tan(x); + const ly = Math.tan(y); + const { + a, + b, + c, + d, + e, + f + } = this; + this.a = a + b * lx; + this.b = b + a * ly; + this.c = c + d * lx; + this.d = d + c * ly; + this.e = e + f * lx - cy * lx; + this.f = f + e * ly - cx * ly; + return this; + } + + // SkewX + skewX(x, cx, cy) { + return this.skew(x, 0, cx, cy); + } + + // SkewY + skewY(y, cx, cy) { + return this.skew(0, y, cx, cy); + } + toArray() { + return [this.a, this.b, this.c, this.d, this.e, this.f]; + } + + // Convert matrix to string + toString() { + return 'matrix(' + this.a + ',' + this.b + ',' + this.c + ',' + this.d + ',' + this.e + ',' + this.f + ')'; + } + + // Transform a matrix into another matrix by manipulating the space + transform(o) { + // Check if o is a matrix and then left multiply it directly + if (Matrix.isMatrixLike(o)) { + const matrix = new Matrix(o); + return matrix.multiplyO(this); + } + + // Get the proposed transformations and the current transformations + const t = Matrix.formatTransforms(o); + const current = this; + const { + x: ox, + y: oy + } = new Point(t.ox, t.oy).transform(current); + + // Construct the resulting matrix + const transformer = new Matrix().translateO(t.rx, t.ry).lmultiplyO(current).translateO(-ox, -oy).scaleO(t.scaleX, t.scaleY).skewO(t.skewX, t.skewY).shearO(t.shear).rotateO(t.theta).translateO(ox, oy); + + // If we want the origin at a particular place, we force it there + if (isFinite(t.px) || isFinite(t.py)) { + const origin = new Point(ox, oy).transform(transformer); + // TODO: Replace t.px with isFinite(t.px) + // Doesn't work because t.px is also 0 if it wasn't passed + const dx = isFinite(t.px) ? t.px - origin.x : 0; + const dy = isFinite(t.py) ? t.py - origin.y : 0; + transformer.translateO(dx, dy); + } + + // Translate now after positioning + transformer.translateO(t.tx, t.ty); + return transformer; + } + + // Translate matrix + translate(x, y) { + return this.clone().translateO(x, y); + } + translateO(x, y) { + this.e += x || 0; + this.f += y || 0; + return this; + } + valueOf() { + return { + a: this.a, + b: this.b, + c: this.c, + d: this.d, + e: this.e, + f: this.f + }; + } +} +function ctm() { + return new Matrix(this.node.getCTM()); +} +function screenCTM() { + try { + /* https://bugzilla.mozilla.org/show_bug.cgi?id=1344537 + This is needed because FF does not return the transformation matrix + for the inner coordinate system when getScreenCTM() is called on nested svgs. + However all other Browsers do that */ + if (typeof this.isRoot === 'function' && !this.isRoot()) { + const rect = this.rect(1, 1); + const m = rect.node.getScreenCTM(); + rect.remove(); + return new Matrix(m); + } + return new Matrix(this.node.getScreenCTM()); + } catch (e) { + console.warn(`Cannot get CTM from SVG node ${this.node.nodeName}. Is the element rendered?`); + return new Matrix(); + } +} +register(Matrix, 'Matrix'); + +function parser() { + // Reuse cached element if possible + if (!parser.nodes) { + const svg = makeInstance().size(2, 0); + svg.node.style.cssText = ['opacity: 0', 'position: absolute', 'left: -100%', 'top: -100%', 'overflow: hidden'].join(';'); + svg.attr('focusable', 'false'); + svg.attr('aria-hidden', 'true'); + const path = svg.path().node; + parser.nodes = { + svg, + path + }; + } + if (!parser.nodes.svg.node.parentNode) { + const b = globals.document.body || globals.document.documentElement; + parser.nodes.svg.addTo(b); + } + return parser.nodes; +} + +function isNulledBox(box) { + return !box.width && !box.height && !box.x && !box.y; +} +function domContains(node) { + return node === globals.document || (globals.document.documentElement.contains || function (node) { + // This is IE - it does not support contains() for top-level SVGs + while (node.parentNode) { + node = node.parentNode; + } + return node === globals.document; + }).call(globals.document.documentElement, node); +} +class Box { + constructor(...args) { + this.init(...args); + } + addOffset() { + // offset by window scroll position, because getBoundingClientRect changes when window is scrolled + this.x += globals.window.pageXOffset; + this.y += globals.window.pageYOffset; + return new Box(this); + } + init(source) { + const base = [0, 0, 0, 0]; + source = typeof source === 'string' ? source.split(delimiter).map(parseFloat) : Array.isArray(source) ? source : typeof source === 'object' ? [source.left != null ? source.left : source.x, source.top != null ? source.top : source.y, source.width, source.height] : arguments.length === 4 ? [].slice.call(arguments) : base; + this.x = source[0] || 0; + this.y = source[1] || 0; + this.width = this.w = source[2] || 0; + this.height = this.h = source[3] || 0; + + // Add more bounding box properties + this.x2 = this.x + this.w; + this.y2 = this.y + this.h; + this.cx = this.x + this.w / 2; + this.cy = this.y + this.h / 2; + return this; + } + isNulled() { + return isNulledBox(this); + } + + // Merge rect box with another, return a new instance + merge(box) { + const x = Math.min(this.x, box.x); + const y = Math.min(this.y, box.y); + const width = Math.max(this.x + this.width, box.x + box.width) - x; + const height = Math.max(this.y + this.height, box.y + box.height) - y; + return new Box(x, y, width, height); + } + toArray() { + return [this.x, this.y, this.width, this.height]; + } + toString() { + return this.x + ' ' + this.y + ' ' + this.width + ' ' + this.height; + } + transform(m) { + if (!(m instanceof Matrix)) { + m = new Matrix(m); + } + let xMin = Infinity; + let xMax = -Infinity; + let yMin = Infinity; + let yMax = -Infinity; + const pts = [new Point(this.x, this.y), new Point(this.x2, this.y), new Point(this.x, this.y2), new Point(this.x2, this.y2)]; + pts.forEach(function (p) { + p = p.transform(m); + xMin = Math.min(xMin, p.x); + xMax = Math.max(xMax, p.x); + yMin = Math.min(yMin, p.y); + yMax = Math.max(yMax, p.y); + }); + return new Box(xMin, yMin, xMax - xMin, yMax - yMin); + } +} +function getBox(el, getBBoxFn, retry) { + let box; + try { + // Try to get the box with the provided function + box = getBBoxFn(el.node); + + // If the box is worthless and not even in the dom, retry + // by throwing an error here... + if (isNulledBox(box) && !domContains(el.node)) { + throw new Error('Element not in the dom'); + } + } catch (e) { + // ... and calling the retry handler here + box = retry(el); + } + return box; +} +function bbox() { + // Function to get bbox is getBBox() + const getBBox = node => node.getBBox(); + + // Take all measures so that a stupid browser renders the element + // so we can get the bbox from it when we try again + const retry = el => { + try { + const clone = el.clone().addTo(parser().svg).show(); + const box = clone.node.getBBox(); + clone.remove(); + return box; + } catch (e) { + // We give up... + throw new Error(`Getting bbox of element "${el.node.nodeName}" is not possible: ${e.toString()}`); + } + }; + const box = getBox(this, getBBox, retry); + const bbox = new Box(box); + return bbox; +} +function rbox(el) { + const getRBox = node => node.getBoundingClientRect(); + const retry = el => { + // There is no point in trying tricks here because if we insert the element into the dom ourselves + // it obviously will be at the wrong position + throw new Error(`Getting rbox of element "${el.node.nodeName}" is not possible`); + }; + const box = getBox(this, getRBox, retry); + const rbox = new Box(box); + + // If an element was passed, we want the bbox in the coordinate system of that element + if (el) { + return rbox.transform(el.screenCTM().inverseO()); + } + + // Else we want it in absolute screen coordinates + // Therefore we need to add the scrollOffset + return rbox.addOffset(); +} + +// Checks whether the given point is inside the bounding box +function inside(x, y) { + const box = this.bbox(); + return x > box.x && y > box.y && x < box.x + box.width && y < box.y + box.height; +} +registerMethods({ + viewbox: { + viewbox(x, y, width, height) { + // act as getter + if (x == null) return new Box(this.attr('viewBox')); + + // act as setter + return this.attr('viewBox', new Box(x, y, width, height)); + }, + zoom(level, point) { + // Its best to rely on the attributes here and here is why: + // clientXYZ: Doesn't work on non-root svgs because they dont have a CSSBox (silly!) + // getBoundingClientRect: Doesn't work because Chrome just ignores width and height of nested svgs completely + // that means, their clientRect is always as big as the content. + // Furthermore this size is incorrect if the element is further transformed by its parents + // computedStyle: Only returns meaningful values if css was used with px. We dont go this route here! + // getBBox: returns the bounding box of its content - that doesn't help! + let { + width, + height + } = this.attr(['width', 'height']); + + // Width and height is a string when a number with a unit is present which we can't use + // So we try clientXYZ + if (!width && !height || typeof width === 'string' || typeof height === 'string') { + width = this.node.clientWidth; + height = this.node.clientHeight; + } + + // Giving up... + if (!width || !height) { + throw new Error('Impossible to get absolute width and height. Please provide an absolute width and height attribute on the zooming element'); + } + const v = this.viewbox(); + const zoomX = width / v.width; + const zoomY = height / v.height; + const zoom = Math.min(zoomX, zoomY); + if (level == null) { + return zoom; + } + let zoomAmount = zoom / level; + + // Set the zoomAmount to the highest value which is safe to process and recover from + // The * 100 is a bit of wiggle room for the matrix transformation + if (zoomAmount === Infinity) zoomAmount = Number.MAX_SAFE_INTEGER / 100; + point = point || new Point(width / 2 / zoomX + v.x, height / 2 / zoomY + v.y); + const box = new Box(v).transform(new Matrix({ + scale: zoomAmount, + origin: point + })); + return this.viewbox(box); + } + } +}); +register(Box, 'Box'); + +// import { subClassArray } from './ArrayPolyfill.js' + +class List extends Array { + constructor(arr = [], ...args) { + super(arr, ...args); + if (typeof arr === 'number') return this; + this.length = 0; + this.push(...arr); + } +} +extend([List], { + each(fnOrMethodName, ...args) { + if (typeof fnOrMethodName === 'function') { + return this.map((el, i, arr) => { + return fnOrMethodName.call(el, el, i, arr); + }); + } else { + return this.map(el => { + return el[fnOrMethodName](...args); + }); + } + }, + toArray() { + return Array.prototype.concat.apply([], this); + } +}); +const reserved = ['toArray', 'constructor', 'each']; +List.extend = function (methods) { + methods = methods.reduce((obj, name) => { + // Don't overwrite own methods + if (reserved.includes(name)) return obj; + + // Don't add private methods + if (name[0] === '_') return obj; + + // Allow access to original Array methods through a prefix + if (name in Array.prototype) { + obj['$' + name] = Array.prototype[name]; + } + + // Relay every call to each() + obj[name] = function (...attrs) { + return this.each(name, ...attrs); + }; + return obj; + }, {}); + extend([List], methods); +}; + +function baseFind(query, parent) { + return new List(map((parent || globals.document).querySelectorAll(query), function (node) { + return adopt(node); + })); +} + +// Scoped find method +function find(query) { + return baseFind(query, this.node); +} +function findOne(query) { + return adopt(this.node.querySelector(query)); +} + +let listenerId = 0; +const windowEvents = {}; +function getEvents(instance) { + let n = instance.getEventHolder(); + + // We dont want to save events in global space + if (n === globals.window) n = windowEvents; + if (!n.events) n.events = {}; + return n.events; +} +function getEventTarget(instance) { + return instance.getEventTarget(); +} +function clearEvents(instance) { + let n = instance.getEventHolder(); + if (n === globals.window) n = windowEvents; + if (n.events) n.events = {}; +} + +// Add event binder in the SVG namespace +function on(node, events, listener, binding, options) { + const l = listener.bind(binding || node); + const instance = makeInstance(node); + const bag = getEvents(instance); + const n = getEventTarget(instance); + + // events can be an array of events or a string of events + events = Array.isArray(events) ? events : events.split(delimiter); + + // add id to listener + if (!listener._svgjsListenerId) { + listener._svgjsListenerId = ++listenerId; + } + events.forEach(function (event) { + const ev = event.split('.')[0]; + const ns = event.split('.')[1] || '*'; + + // ensure valid object + bag[ev] = bag[ev] || {}; + bag[ev][ns] = bag[ev][ns] || {}; + + // reference listener + bag[ev][ns][listener._svgjsListenerId] = l; + + // add listener + n.addEventListener(ev, l, options || false); + }); +} + +// Add event unbinder in the SVG namespace +function off(node, events, listener, options) { + const instance = makeInstance(node); + const bag = getEvents(instance); + const n = getEventTarget(instance); + + // listener can be a function or a number + if (typeof listener === 'function') { + listener = listener._svgjsListenerId; + if (!listener) return; + } + + // events can be an array of events or a string or undefined + events = Array.isArray(events) ? events : (events || '').split(delimiter); + events.forEach(function (event) { + const ev = event && event.split('.')[0]; + const ns = event && event.split('.')[1]; + let namespace, l; + if (listener) { + // remove listener reference + if (bag[ev] && bag[ev][ns || '*']) { + // removeListener + n.removeEventListener(ev, bag[ev][ns || '*'][listener], options || false); + delete bag[ev][ns || '*'][listener]; + } + } else if (ev && ns) { + // remove all listeners for a namespaced event + if (bag[ev] && bag[ev][ns]) { + for (l in bag[ev][ns]) { + off(n, [ev, ns].join('.'), l); + } + delete bag[ev][ns]; + } + } else if (ns) { + // remove all listeners for a specific namespace + for (event in bag) { + for (namespace in bag[event]) { + if (ns === namespace) { + off(n, [event, ns].join('.')); + } + } + } + } else if (ev) { + // remove all listeners for the event + if (bag[ev]) { + for (namespace in bag[ev]) { + off(n, [ev, namespace].join('.')); + } + delete bag[ev]; + } + } else { + // remove all listeners on a given node + for (event in bag) { + off(n, event); + } + clearEvents(instance); + } + }); +} +function dispatch(node, event, data, options) { + const n = getEventTarget(node); + + // Dispatch event + if (event instanceof globals.window.Event) { + n.dispatchEvent(event); + } else { + event = new globals.window.CustomEvent(event, { + detail: data, + cancelable: true, + ...options + }); + n.dispatchEvent(event); + } + return event; +} + +class EventTarget extends Base { + addEventListener() {} + dispatch(event, data, options) { + return dispatch(this, event, data, options); + } + dispatchEvent(event) { + const bag = this.getEventHolder().events; + if (!bag) return true; + const events = bag[event.type]; + for (const i in events) { + for (const j in events[i]) { + events[i][j](event); + } + } + return !event.defaultPrevented; + } + + // Fire given event + fire(event, data, options) { + this.dispatch(event, data, options); + return this; + } + getEventHolder() { + return this; + } + getEventTarget() { + return this; + } + + // Unbind event from listener + off(event, listener, options) { + off(this, event, listener, options); + return this; + } + + // Bind given event to listener + on(event, listener, binding, options) { + on(this, event, listener, binding, options); + return this; + } + removeEventListener() {} +} +register(EventTarget, 'EventTarget'); + +function noop() {} + +// Default animation values +const timeline = { + duration: 400, + ease: '>', + delay: 0 +}; + +// Default attribute values +const attrs = { + // fill and stroke + 'fill-opacity': 1, + 'stroke-opacity': 1, + 'stroke-width': 0, + 'stroke-linejoin': 'miter', + 'stroke-linecap': 'butt', + fill: '#000000', + stroke: '#000000', + opacity: 1, + // position + x: 0, + y: 0, + cx: 0, + cy: 0, + // size + width: 0, + height: 0, + // radius + r: 0, + rx: 0, + ry: 0, + // gradient + offset: 0, + 'stop-opacity': 1, + 'stop-color': '#000000', + // text + 'text-anchor': 'start' +}; + +var defaults = { + __proto__: null, + attrs: attrs, + noop: noop, + timeline: timeline +}; + +class SVGArray extends Array { + constructor(...args) { + super(...args); + this.init(...args); + } + clone() { + return new this.constructor(this); + } + init(arr) { + // This catches the case, that native map tries to create an array with new Array(1) + if (typeof arr === 'number') return this; + this.length = 0; + this.push(...this.parse(arr)); + return this; + } + + // Parse whitespace separated string + parse(array = []) { + // If already is an array, no need to parse it + if (array instanceof Array) return array; + return array.trim().split(delimiter).map(parseFloat); + } + toArray() { + return Array.prototype.concat.apply([], this); + } + toSet() { + return new Set(this); + } + toString() { + return this.join(' '); + } + + // Flattens the array if needed + valueOf() { + const ret = []; + ret.push(...this); + return ret; + } +} + +// Module for unit conversions +class SVGNumber { + // Initialize + constructor(...args) { + this.init(...args); + } + convert(unit) { + return new SVGNumber(this.value, unit); + } + + // Divide number + divide(number) { + number = new SVGNumber(number); + return new SVGNumber(this / number, this.unit || number.unit); + } + init(value, unit) { + unit = Array.isArray(value) ? value[1] : unit; + value = Array.isArray(value) ? value[0] : value; + + // initialize defaults + this.value = 0; + this.unit = unit || ''; + + // parse value + if (typeof value === 'number') { + // ensure a valid numeric value + this.value = isNaN(value) ? 0 : !isFinite(value) ? value < 0 ? -3.4e38 : +3.4e38 : value; + } else if (typeof value === 'string') { + unit = value.match(numberAndUnit); + if (unit) { + // make value numeric + this.value = parseFloat(unit[1]); + + // normalize + if (unit[5] === '%') { + this.value /= 100; + } else if (unit[5] === 's') { + this.value *= 1000; + } + + // store unit + this.unit = unit[5]; + } + } else { + if (value instanceof SVGNumber) { + this.value = value.valueOf(); + this.unit = value.unit; + } + } + return this; + } + + // Subtract number + minus(number) { + number = new SVGNumber(number); + return new SVGNumber(this - number, this.unit || number.unit); + } + + // Add number + plus(number) { + number = new SVGNumber(number); + return new SVGNumber(this + number, this.unit || number.unit); + } + + // Multiply number + times(number) { + number = new SVGNumber(number); + return new SVGNumber(this * number, this.unit || number.unit); + } + toArray() { + return [this.value, this.unit]; + } + toJSON() { + return this.toString(); + } + toString() { + return (this.unit === '%' ? ~~(this.value * 1e8) / 1e6 : this.unit === 's' ? this.value / 1e3 : this.value) + this.unit; + } + valueOf() { + return this.value; + } +} + +const colorAttributes = new Set(['fill', 'stroke', 'color', 'bgcolor', 'stop-color', 'flood-color', 'lighting-color']); +const hooks = []; +function registerAttrHook(fn) { + hooks.push(fn); +} + +// Set svg element attribute +function attr(attr, val, ns) { + // act as full getter + if (attr == null) { + // get an object of attributes + attr = {}; + val = this.node.attributes; + for (const node of val) { + attr[node.nodeName] = isNumber.test(node.nodeValue) ? parseFloat(node.nodeValue) : node.nodeValue; + } + return attr; + } else if (attr instanceof Array) { + // loop through array and get all values + return attr.reduce((last, curr) => { + last[curr] = this.attr(curr); + return last; + }, {}); + } else if (typeof attr === 'object' && attr.constructor === Object) { + // apply every attribute individually if an object is passed + for (val in attr) this.attr(val, attr[val]); + } else if (val === null) { + // remove value + this.node.removeAttribute(attr); + } else if (val == null) { + // act as a getter if the first and only argument is not an object + val = this.node.getAttribute(attr); + return val == null ? attrs[attr] : isNumber.test(val) ? parseFloat(val) : val; + } else { + // Loop through hooks and execute them to convert value + val = hooks.reduce((_val, hook) => { + return hook(attr, _val, this); + }, val); + + // ensure correct numeric values (also accepts NaN and Infinity) + if (typeof val === 'number') { + val = new SVGNumber(val); + } else if (colorAttributes.has(attr) && Color.isColor(val)) { + // ensure full hex color + val = new Color(val); + } else if (val.constructor === Array) { + // Check for plain arrays and parse array values + val = new SVGArray(val); + } + + // if the passed attribute is leading... + if (attr === 'leading') { + // ... call the leading method instead + if (this.leading) { + this.leading(val); + } + } else { + // set given attribute on node + typeof ns === 'string' ? this.node.setAttributeNS(ns, attr, val.toString()) : this.node.setAttribute(attr, val.toString()); + } + + // rebuild if required + if (this.rebuild && (attr === 'font-size' || attr === 'x')) { + this.rebuild(); + } + } + return this; +} + +class Dom extends EventTarget { + constructor(node, attrs) { + super(); + this.node = node; + this.type = node.nodeName; + if (attrs && node !== attrs) { + this.attr(attrs); + } + } + + // Add given element at a position + add(element, i) { + element = makeInstance(element); + + // If non-root svg nodes are added we have to remove their namespaces + if (element.removeNamespace && this.node instanceof globals.window.SVGElement) { + element.removeNamespace(); + } + if (i == null) { + this.node.appendChild(element.node); + } else if (element.node !== this.node.childNodes[i]) { + this.node.insertBefore(element.node, this.node.childNodes[i]); + } + return this; + } + + // Add element to given container and return self + addTo(parent, i) { + return makeInstance(parent).put(this, i); + } + + // Returns all child elements + children() { + return new List(map(this.node.children, function (node) { + return adopt(node); + })); + } + + // Remove all elements in this container + clear() { + // remove children + while (this.node.hasChildNodes()) { + this.node.removeChild(this.node.lastChild); + } + return this; + } + + // Clone element + clone(deep = true, assignNewIds = true) { + // write dom data to the dom so the clone can pickup the data + this.writeDataToDom(); + + // clone element + let nodeClone = this.node.cloneNode(deep); + if (assignNewIds) { + // assign new id + nodeClone = assignNewId(nodeClone); + } + return new this.constructor(nodeClone); + } + + // Iterates over all children and invokes a given block + each(block, deep) { + const children = this.children(); + let i, il; + for (i = 0, il = children.length; i < il; i++) { + block.apply(children[i], [i, children]); + if (deep) { + children[i].each(block, deep); + } + } + return this; + } + element(nodeName, attrs) { + return this.put(new Dom(create(nodeName), attrs)); + } + + // Get first child + first() { + return adopt(this.node.firstChild); + } + + // Get a element at the given index + get(i) { + return adopt(this.node.childNodes[i]); + } + getEventHolder() { + return this.node; + } + getEventTarget() { + return this.node; + } + + // Checks if the given element is a child + has(element) { + return this.index(element) >= 0; + } + html(htmlOrFn, outerHTML) { + return this.xml(htmlOrFn, outerHTML, html); + } + + // Get / set id + id(id) { + // generate new id if no id set + if (typeof id === 'undefined' && !this.node.id) { + this.node.id = eid(this.type); + } + + // don't set directly with this.node.id to make `null` work correctly + return this.attr('id', id); + } + + // Gets index of given element + index(element) { + return [].slice.call(this.node.childNodes).indexOf(element.node); + } + + // Get the last child + last() { + return adopt(this.node.lastChild); + } + + // matches the element vs a css selector + matches(selector) { + const el = this.node; + const matcher = el.matches || el.matchesSelector || el.msMatchesSelector || el.mozMatchesSelector || el.webkitMatchesSelector || el.oMatchesSelector || null; + return matcher && matcher.call(el, selector); + } + + // Returns the parent element instance + parent(type) { + let parent = this; + + // check for parent + if (!parent.node.parentNode) return null; + + // get parent element + parent = adopt(parent.node.parentNode); + if (!type) return parent; + + // loop through ancestors if type is given + do { + if (typeof type === 'string' ? parent.matches(type) : parent instanceof type) return parent; + } while (parent = adopt(parent.node.parentNode)); + return parent; + } + + // Basically does the same as `add()` but returns the added element instead + put(element, i) { + element = makeInstance(element); + this.add(element, i); + return element; + } + + // Add element to given container and return container + putIn(parent, i) { + return makeInstance(parent).add(this, i); + } + + // Remove element + remove() { + if (this.parent()) { + this.parent().removeElement(this); + } + return this; + } + + // Remove a given child + removeElement(element) { + this.node.removeChild(element.node); + return this; + } + + // Replace this with element + replace(element) { + element = makeInstance(element); + if (this.node.parentNode) { + this.node.parentNode.replaceChild(element.node, this.node); + } + return element; + } + round(precision = 2, map = null) { + const factor = 10 ** precision; + const attrs = this.attr(map); + for (const i in attrs) { + if (typeof attrs[i] === 'number') { + attrs[i] = Math.round(attrs[i] * factor) / factor; + } + } + this.attr(attrs); + return this; + } + + // Import / Export raw svg + svg(svgOrFn, outerSVG) { + return this.xml(svgOrFn, outerSVG, svg); + } + + // Return id on string conversion + toString() { + return this.id(); + } + words(text) { + // This is faster than removing all children and adding a new one + this.node.textContent = text; + return this; + } + wrap(node) { + const parent = this.parent(); + if (!parent) { + return this.addTo(node); + } + const position = parent.index(this); + return parent.put(node, position).put(this); + } + + // write svgjs data to the dom + writeDataToDom() { + // dump variables recursively + this.each(function () { + this.writeDataToDom(); + }); + return this; + } + + // Import / Export raw svg + xml(xmlOrFn, outerXML, ns) { + if (typeof xmlOrFn === 'boolean') { + ns = outerXML; + outerXML = xmlOrFn; + xmlOrFn = null; + } + + // act as getter if no svg string is given + if (xmlOrFn == null || typeof xmlOrFn === 'function') { + // The default for exports is, that the outerNode is included + outerXML = outerXML == null ? true : outerXML; + + // write svgjs data to the dom + this.writeDataToDom(); + let current = this; + + // An export modifier was passed + if (xmlOrFn != null) { + current = adopt(current.node.cloneNode(true)); + + // If the user wants outerHTML we need to process this node, too + if (outerXML) { + const result = xmlOrFn(current); + current = result || current; + + // The user does not want this node? Well, then he gets nothing + if (result === false) return ''; + } + + // Deep loop through all children and apply modifier + current.each(function () { + const result = xmlOrFn(this); + const _this = result || this; + + // If modifier returns false, discard node + if (result === false) { + this.remove(); + + // If modifier returns new node, use it + } else if (result && this !== _this) { + this.replace(_this); + } + }, true); + } + + // Return outer or inner content + return outerXML ? current.node.outerHTML : current.node.innerHTML; + } + + // Act as setter if we got a string + + // The default for import is, that the current node is not replaced + outerXML = outerXML == null ? false : outerXML; + + // Create temporary holder + const well = create('wrapper', ns); + const fragment = globals.document.createDocumentFragment(); + + // Dump raw svg + well.innerHTML = xmlOrFn; + + // Transplant nodes into the fragment + for (let len = well.children.length; len--;) { + fragment.appendChild(well.firstElementChild); + } + const parent = this.parent(); + + // Add the whole fragment at once + return outerXML ? this.replace(fragment) && parent : this.add(fragment); + } +} +extend(Dom, { + attr, + find, + findOne +}); +register(Dom, 'Dom'); + +class Element extends Dom { + constructor(node, attrs) { + super(node, attrs); + + // initialize data object + this.dom = {}; + + // create circular reference + this.node.instance = this; + if (node.hasAttribute('data-svgjs') || node.hasAttribute('svgjs:data')) { + // pull svgjs data from the dom (getAttributeNS doesn't work in html5) + this.setData(JSON.parse(node.getAttribute('data-svgjs')) ?? JSON.parse(node.getAttribute('svgjs:data')) ?? {}); + } + } + + // Move element by its center + center(x, y) { + return this.cx(x).cy(y); + } + + // Move by center over x-axis + cx(x) { + return x == null ? this.x() + this.width() / 2 : this.x(x - this.width() / 2); + } + + // Move by center over y-axis + cy(y) { + return y == null ? this.y() + this.height() / 2 : this.y(y - this.height() / 2); + } + + // Get defs + defs() { + const root = this.root(); + return root && root.defs(); + } + + // Relative move over x and y axes + dmove(x, y) { + return this.dx(x).dy(y); + } + + // Relative move over x axis + dx(x = 0) { + return this.x(new SVGNumber(x).plus(this.x())); + } + + // Relative move over y axis + dy(y = 0) { + return this.y(new SVGNumber(y).plus(this.y())); + } + getEventHolder() { + return this; + } + + // Set height of element + height(height) { + return this.attr('height', height); + } + + // Move element to given x and y values + move(x, y) { + return this.x(x).y(y); + } + + // return array of all ancestors of given type up to the root svg + parents(until = this.root()) { + const isSelector = typeof until === 'string'; + if (!isSelector) { + until = makeInstance(until); + } + const parents = new List(); + let parent = this; + while ((parent = parent.parent()) && parent.node !== globals.document && parent.nodeName !== '#document-fragment') { + parents.push(parent); + if (!isSelector && parent.node === until.node) { + break; + } + if (isSelector && parent.matches(until)) { + break; + } + if (parent.node === this.root().node) { + // We worked our way to the root and didn't match `until` + return null; + } + } + return parents; + } + + // Get referenced element form attribute value + reference(attr) { + attr = this.attr(attr); + if (!attr) return null; + const m = (attr + '').match(reference); + return m ? makeInstance(m[1]) : null; + } + + // Get parent document + root() { + const p = this.parent(getClass(root)); + return p && p.root(); + } + + // set given data to the elements data property + setData(o) { + this.dom = o; + return this; + } + + // Set element size to given width and height + size(width, height) { + const p = proportionalSize(this, width, height); + return this.width(new SVGNumber(p.width)).height(new SVGNumber(p.height)); + } + + // Set width of element + width(width) { + return this.attr('width', width); + } + + // write svgjs data to the dom + writeDataToDom() { + writeDataToDom(this, this.dom); + return super.writeDataToDom(); + } + + // Move over x-axis + x(x) { + return this.attr('x', x); + } + + // Move over y-axis + y(y) { + return this.attr('y', y); + } +} +extend(Element, { + bbox, + rbox, + inside, + point, + ctm, + screenCTM +}); +register(Element, 'Element'); + +// Define list of available attributes for stroke and fill +const sugar = { + stroke: ['color', 'width', 'opacity', 'linecap', 'linejoin', 'miterlimit', 'dasharray', 'dashoffset'], + fill: ['color', 'opacity', 'rule'], + prefix: function (t, a) { + return a === 'color' ? t : t + '-' + a; + } +} + +// Add sugar for fill and stroke +; +['fill', 'stroke'].forEach(function (m) { + const extension = {}; + let i; + extension[m] = function (o) { + if (typeof o === 'undefined') { + return this.attr(m); + } + if (typeof o === 'string' || o instanceof Color || Color.isRgb(o) || o instanceof Element) { + this.attr(m, o); + } else { + // set all attributes from sugar.fill and sugar.stroke list + for (i = sugar[m].length - 1; i >= 0; i--) { + if (o[sugar[m][i]] != null) { + this.attr(sugar.prefix(m, sugar[m][i]), o[sugar[m][i]]); + } + } + } + return this; + }; + registerMethods(['Element', 'Runner'], extension); +}); +registerMethods(['Element', 'Runner'], { + // Let the user set the matrix directly + matrix: function (mat, b, c, d, e, f) { + // Act as a getter + if (mat == null) { + return new Matrix(this); + } + + // Act as a setter, the user can pass a matrix or a set of numbers + return this.attr('transform', new Matrix(mat, b, c, d, e, f)); + }, + // Map rotation to transform + rotate: function (angle, cx, cy) { + return this.transform({ + rotate: angle, + ox: cx, + oy: cy + }, true); + }, + // Map skew to transform + skew: function (x, y, cx, cy) { + return arguments.length === 1 || arguments.length === 3 ? this.transform({ + skew: x, + ox: y, + oy: cx + }, true) : this.transform({ + skew: [x, y], + ox: cx, + oy: cy + }, true); + }, + shear: function (lam, cx, cy) { + return this.transform({ + shear: lam, + ox: cx, + oy: cy + }, true); + }, + // Map scale to transform + scale: function (x, y, cx, cy) { + return arguments.length === 1 || arguments.length === 3 ? this.transform({ + scale: x, + ox: y, + oy: cx + }, true) : this.transform({ + scale: [x, y], + ox: cx, + oy: cy + }, true); + }, + // Map translate to transform + translate: function (x, y) { + return this.transform({ + translate: [x, y] + }, true); + }, + // Map relative translations to transform + relative: function (x, y) { + return this.transform({ + relative: [x, y] + }, true); + }, + // Map flip to transform + flip: function (direction = 'both', origin = 'center') { + if ('xybothtrue'.indexOf(direction) === -1) { + origin = direction; + direction = 'both'; + } + return this.transform({ + flip: direction, + origin: origin + }, true); + }, + // Opacity + opacity: function (value) { + return this.attr('opacity', value); + } +}); +registerMethods('radius', { + // Add x and y radius + radius: function (x, y = x) { + const type = (this._element || this).type; + return type === 'radialGradient' ? this.attr('r', new SVGNumber(x)) : this.rx(x).ry(y); + } +}); +registerMethods('Path', { + // Get path length + length: function () { + return this.node.getTotalLength(); + }, + // Get point at length + pointAt: function (length) { + return new Point(this.node.getPointAtLength(length)); + } +}); +registerMethods(['Element', 'Runner'], { + // Set font + font: function (a, v) { + if (typeof a === 'object') { + for (v in a) this.font(v, a[v]); + return this; + } + return a === 'leading' ? this.leading(v) : a === 'anchor' ? this.attr('text-anchor', v) : a === 'size' || a === 'family' || a === 'weight' || a === 'stretch' || a === 'variant' || a === 'style' ? this.attr('font-' + a, v) : this.attr(a, v); + } +}); + +// Add events to elements +const methods = ['click', 'dblclick', 'mousedown', 'mouseup', 'mouseover', 'mouseout', 'mousemove', 'mouseenter', 'mouseleave', 'touchstart', 'touchmove', 'touchleave', 'touchend', 'touchcancel', 'contextmenu', 'wheel', 'pointerdown', 'pointermove', 'pointerup', 'pointerleave', 'pointercancel'].reduce(function (last, event) { + // add event to Element + const fn = function (f) { + if (f === null) { + this.off(event); + } else { + this.on(event, f); + } + return this; + }; + last[event] = fn; + return last; +}, {}); +registerMethods('Element', methods); + +// Reset all transformations +function untransform() { + return this.attr('transform', null); +} + +// merge the whole transformation chain into one matrix and returns it +function matrixify() { + const matrix = (this.attr('transform') || '' + // split transformations + ).split(transforms).slice(0, -1).map(function (str) { + // generate key => value pairs + const kv = str.trim().split('('); + return [kv[0], kv[1].split(delimiter).map(function (str) { + return parseFloat(str); + })]; + }).reverse() + // merge every transformation into one matrix + .reduce(function (matrix, transform) { + if (transform[0] === 'matrix') { + return matrix.lmultiply(Matrix.fromArray(transform[1])); + } + return matrix[transform[0]].apply(matrix, transform[1]); + }, new Matrix()); + return matrix; +} + +// add an element to another parent without changing the visual representation on the screen +function toParent(parent, i) { + if (this === parent) return this; + if (isDescriptive(this.node)) return this.addTo(parent, i); + const ctm = this.screenCTM(); + const pCtm = parent.screenCTM().inverse(); + this.addTo(parent, i).untransform().transform(pCtm.multiply(ctm)); + return this; +} + +// same as above with parent equals root-svg +function toRoot(i) { + return this.toParent(this.root(), i); +} + +// Add transformations +function transform(o, relative) { + // Act as a getter if no object was passed + if (o == null || typeof o === 'string') { + const decomposed = new Matrix(this).decompose(); + return o == null ? decomposed : decomposed[o]; + } + if (!Matrix.isMatrixLike(o)) { + // Set the origin according to the defined transform + o = { + ...o, + origin: getOrigin(o, this) + }; + } + + // The user can pass a boolean, an Element or an Matrix or nothing + const cleanRelative = relative === true ? this : relative || false; + const result = new Matrix(cleanRelative).transform(o); + return this.attr('transform', result); +} +registerMethods('Element', { + untransform, + matrixify, + toParent, + toRoot, + transform +}); + +class Container extends Element { + flatten() { + this.each(function () { + if (this instanceof Container) { + return this.flatten().ungroup(); + } + }); + return this; + } + ungroup(parent = this.parent(), index = parent.index(this)) { + // when parent != this, we want append all elements to the end + index = index === -1 ? parent.children().length : index; + this.each(function (i, children) { + // reverse each + return children[children.length - i - 1].toParent(parent, index); + }); + return this.remove(); + } +} +register(Container, 'Container'); + +class Defs extends Container { + constructor(node, attrs = node) { + super(nodeOrNew('defs', node), attrs); + } + flatten() { + return this; + } + ungroup() { + return this; + } +} +register(Defs, 'Defs'); + +class Shape extends Element {} +register(Shape, 'Shape'); + +// Radius x value +function rx(rx) { + return this.attr('rx', rx); +} + +// Radius y value +function ry(ry) { + return this.attr('ry', ry); +} + +// Move over x-axis +function x$3(x) { + return x == null ? this.cx() - this.rx() : this.cx(x + this.rx()); +} + +// Move over y-axis +function y$3(y) { + return y == null ? this.cy() - this.ry() : this.cy(y + this.ry()); +} + +// Move by center over x-axis +function cx$1(x) { + return this.attr('cx', x); +} + +// Move by center over y-axis +function cy$1(y) { + return this.attr('cy', y); +} + +// Set width of element +function width$2(width) { + return width == null ? this.rx() * 2 : this.rx(new SVGNumber(width).divide(2)); +} + +// Set height of element +function height$2(height) { + return height == null ? this.ry() * 2 : this.ry(new SVGNumber(height).divide(2)); +} + +var circled = { + __proto__: null, + cx: cx$1, + cy: cy$1, + height: height$2, + rx: rx, + ry: ry, + width: width$2, + x: x$3, + y: y$3 +}; + +class Ellipse extends Shape { + constructor(node, attrs = node) { + super(nodeOrNew('ellipse', node), attrs); + } + size(width, height) { + const p = proportionalSize(this, width, height); + return this.rx(new SVGNumber(p.width).divide(2)).ry(new SVGNumber(p.height).divide(2)); + } +} +extend(Ellipse, circled); +registerMethods('Container', { + // Create an ellipse + ellipse: wrapWithAttrCheck(function (width = 0, height = width) { + return this.put(new Ellipse()).size(width, height).move(0, 0); + }) +}); +register(Ellipse, 'Ellipse'); + +class Fragment extends Dom { + constructor(node = globals.document.createDocumentFragment()) { + super(node); + } + + // Import / Export raw xml + xml(xmlOrFn, outerXML, ns) { + if (typeof xmlOrFn === 'boolean') { + ns = outerXML; + outerXML = xmlOrFn; + xmlOrFn = null; + } + + // because this is a fragment we have to put all elements into a wrapper first + // before we can get the innerXML from it + if (xmlOrFn == null || typeof xmlOrFn === 'function') { + const wrapper = new Dom(create('wrapper', ns)); + wrapper.add(this.node.cloneNode(true)); + return wrapper.xml(false, ns); + } + + // Act as setter if we got a string + return super.xml(xmlOrFn, false, ns); + } +} +register(Fragment, 'Fragment'); + +function from(x, y) { + return (this._element || this).type === 'radialGradient' ? this.attr({ + fx: new SVGNumber(x), + fy: new SVGNumber(y) + }) : this.attr({ + x1: new SVGNumber(x), + y1: new SVGNumber(y) + }); +} +function to(x, y) { + return (this._element || this).type === 'radialGradient' ? this.attr({ + cx: new SVGNumber(x), + cy: new SVGNumber(y) + }) : this.attr({ + x2: new SVGNumber(x), + y2: new SVGNumber(y) + }); +} + +var gradiented = { + __proto__: null, + from: from, + to: to +}; + +class Gradient extends Container { + constructor(type, attrs) { + super(nodeOrNew(type + 'Gradient', typeof type === 'string' ? null : type), attrs); + } + + // custom attr to handle transform + attr(a, b, c) { + if (a === 'transform') a = 'gradientTransform'; + return super.attr(a, b, c); + } + bbox() { + return new Box(); + } + targets() { + return baseFind('svg [fill*=' + this.id() + ']'); + } + + // Alias string conversion to fill + toString() { + return this.url(); + } + + // Update gradient + update(block) { + // remove all stops + this.clear(); + + // invoke passed block + if (typeof block === 'function') { + block.call(this, this); + } + return this; + } + + // Return the fill id + url() { + return 'url(#' + this.id() + ')'; + } +} +extend(Gradient, gradiented); +registerMethods({ + Container: { + // Create gradient element in defs + gradient(...args) { + return this.defs().gradient(...args); + } + }, + // define gradient + Defs: { + gradient: wrapWithAttrCheck(function (type, block) { + return this.put(new Gradient(type)).update(block); + }) + } +}); +register(Gradient, 'Gradient'); + +class Pattern extends Container { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('pattern', node), attrs); + } + + // custom attr to handle transform + attr(a, b, c) { + if (a === 'transform') a = 'patternTransform'; + return super.attr(a, b, c); + } + bbox() { + return new Box(); + } + targets() { + return baseFind('svg [fill*=' + this.id() + ']'); + } + + // Alias string conversion to fill + toString() { + return this.url(); + } + + // Update pattern by rebuilding + update(block) { + // remove content + this.clear(); + + // invoke passed block + if (typeof block === 'function') { + block.call(this, this); + } + return this; + } + + // Return the fill id + url() { + return 'url(#' + this.id() + ')'; + } +} +registerMethods({ + Container: { + // Create pattern element in defs + pattern(...args) { + return this.defs().pattern(...args); + } + }, + Defs: { + pattern: wrapWithAttrCheck(function (width, height, block) { + return this.put(new Pattern()).update(block).attr({ + x: 0, + y: 0, + width: width, + height: height, + patternUnits: 'userSpaceOnUse' + }); + }) + } +}); +register(Pattern, 'Pattern'); + +class Image extends Shape { + constructor(node, attrs = node) { + super(nodeOrNew('image', node), attrs); + } + + // (re)load image + load(url, callback) { + if (!url) return this; + const img = new globals.window.Image(); + on(img, 'load', function (e) { + const p = this.parent(Pattern); + + // ensure image size + if (this.width() === 0 && this.height() === 0) { + this.size(img.width, img.height); + } + if (p instanceof Pattern) { + // ensure pattern size if not set + if (p.width() === 0 && p.height() === 0) { + p.size(this.width(), this.height()); + } + } + if (typeof callback === 'function') { + callback.call(this, e); + } + }, this); + on(img, 'load error', function () { + // dont forget to unbind memory leaking events + off(img); + }); + return this.attr('href', img.src = url, xlink); + } +} +registerAttrHook(function (attr, val, _this) { + // convert image fill and stroke to patterns + if (attr === 'fill' || attr === 'stroke') { + if (isImage.test(val)) { + val = _this.root().defs().image(val); + } + } + if (val instanceof Image) { + val = _this.root().defs().pattern(0, 0, pattern => { + pattern.add(val); + }); + } + return val; +}); +registerMethods({ + Container: { + // create image element, load image and set its size + image: wrapWithAttrCheck(function (source, callback) { + return this.put(new Image()).size(0, 0).load(source, callback); + }) + } +}); +register(Image, 'Image'); + +class PointArray extends SVGArray { + // Get bounding box of points + bbox() { + let maxX = -Infinity; + let maxY = -Infinity; + let minX = Infinity; + let minY = Infinity; + this.forEach(function (el) { + maxX = Math.max(el[0], maxX); + maxY = Math.max(el[1], maxY); + minX = Math.min(el[0], minX); + minY = Math.min(el[1], minY); + }); + return new Box(minX, minY, maxX - minX, maxY - minY); + } + + // Move point string + move(x, y) { + const box = this.bbox(); + + // get relative offset + x -= box.x; + y -= box.y; + + // move every point + if (!isNaN(x) && !isNaN(y)) { + for (let i = this.length - 1; i >= 0; i--) { + this[i] = [this[i][0] + x, this[i][1] + y]; + } + } + return this; + } + + // Parse point string and flat array + parse(array = [0, 0]) { + const points = []; + + // if it is an array, we flatten it and therefore clone it to 1 depths + if (array instanceof Array) { + array = Array.prototype.concat.apply([], array); + } else { + // Else, it is considered as a string + // parse points + array = array.trim().split(delimiter).map(parseFloat); + } + + // validate points - https://svgwg.org/svg2-draft/shapes.html#DataTypePoints + // Odd number of coordinates is an error. In such cases, drop the last odd coordinate. + if (array.length % 2 !== 0) array.pop(); + + // wrap points in two-tuples + for (let i = 0, len = array.length; i < len; i = i + 2) { + points.push([array[i], array[i + 1]]); + } + return points; + } + + // Resize poly string + size(width, height) { + let i; + const box = this.bbox(); + + // recalculate position of all points according to new size + for (i = this.length - 1; i >= 0; i--) { + if (box.width) this[i][0] = (this[i][0] - box.x) * width / box.width + box.x; + if (box.height) this[i][1] = (this[i][1] - box.y) * height / box.height + box.y; + } + return this; + } + + // Convert array to line object + toLine() { + return { + x1: this[0][0], + y1: this[0][1], + x2: this[1][0], + y2: this[1][1] + }; + } + + // Convert array to string + toString() { + const array = []; + // convert to a poly point string + for (let i = 0, il = this.length; i < il; i++) { + array.push(this[i].join(',')); + } + return array.join(' '); + } + transform(m) { + return this.clone().transformO(m); + } + + // transform points with matrix (similar to Point.transform) + transformO(m) { + if (!Matrix.isMatrixLike(m)) { + m = new Matrix(m); + } + for (let i = this.length; i--;) { + // Perform the matrix multiplication + const [x, y] = this[i]; + this[i][0] = m.a * x + m.c * y + m.e; + this[i][1] = m.b * x + m.d * y + m.f; + } + return this; + } +} + +const MorphArray = PointArray; + +// Move by left top corner over x-axis +function x$2(x) { + return x == null ? this.bbox().x : this.move(x, this.bbox().y); +} + +// Move by left top corner over y-axis +function y$2(y) { + return y == null ? this.bbox().y : this.move(this.bbox().x, y); +} + +// Set width of element +function width$1(width) { + const b = this.bbox(); + return width == null ? b.width : this.size(width, b.height); +} + +// Set height of element +function height$1(height) { + const b = this.bbox(); + return height == null ? b.height : this.size(b.width, height); +} + +var pointed = { + __proto__: null, + MorphArray: MorphArray, + height: height$1, + width: width$1, + x: x$2, + y: y$2 +}; + +class Line extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('line', node), attrs); + } + + // Get array + array() { + return new PointArray([[this.attr('x1'), this.attr('y1')], [this.attr('x2'), this.attr('y2')]]); + } + + // Move by left top corner + move(x, y) { + return this.attr(this.array().move(x, y).toLine()); + } + + // Overwrite native plot() method + plot(x1, y1, x2, y2) { + if (x1 == null) { + return this.array(); + } else if (typeof y1 !== 'undefined') { + x1 = { + x1, + y1, + x2, + y2 + }; + } else { + x1 = new PointArray(x1).toLine(); + } + return this.attr(x1); + } + + // Set element size to given width and height + size(width, height) { + const p = proportionalSize(this, width, height); + return this.attr(this.array().size(p.width, p.height).toLine()); + } +} +extend(Line, pointed); +registerMethods({ + Container: { + // Create a line element + line: wrapWithAttrCheck(function (...args) { + // make sure plot is called as a setter + // x1 is not necessarily a number, it can also be an array, a string and a PointArray + return Line.prototype.plot.apply(this.put(new Line()), args[0] != null ? args : [0, 0, 0, 0]); + }) + } +}); +register(Line, 'Line'); + +class Marker extends Container { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('marker', node), attrs); + } + + // Set height of element + height(height) { + return this.attr('markerHeight', height); + } + orient(orient) { + return this.attr('orient', orient); + } + + // Set marker refX and refY + ref(x, y) { + return this.attr('refX', x).attr('refY', y); + } + + // Return the fill id + toString() { + return 'url(#' + this.id() + ')'; + } + + // Update marker + update(block) { + // remove all content + this.clear(); + + // invoke passed block + if (typeof block === 'function') { + block.call(this, this); + } + return this; + } + + // Set width of element + width(width) { + return this.attr('markerWidth', width); + } +} +registerMethods({ + Container: { + marker(...args) { + // Create marker element in defs + return this.defs().marker(...args); + } + }, + Defs: { + // Create marker + marker: wrapWithAttrCheck(function (width, height, block) { + // Set default viewbox to match the width and height, set ref to cx and cy and set orient to auto + return this.put(new Marker()).size(width, height).ref(width / 2, height / 2).viewbox(0, 0, width, height).attr('orient', 'auto').update(block); + }) + }, + marker: { + // Create and attach markers + marker(marker, width, height, block) { + let attr = ['marker']; + + // Build attribute name + if (marker !== 'all') attr.push(marker); + attr = attr.join('-'); + + // Set marker attribute + marker = arguments[1] instanceof Marker ? arguments[1] : this.defs().marker(width, height, block); + return this.attr(attr, marker); + } + } +}); +register(Marker, 'Marker'); + +/*** +Base Class +========== +The base stepper class that will be +***/ + +function makeSetterGetter(k, f) { + return function (v) { + if (v == null) return this[k]; + this[k] = v; + if (f) f.call(this); + return this; + }; +} +const easing = { + '-': function (pos) { + return pos; + }, + '<>': function (pos) { + return -Math.cos(pos * Math.PI) / 2 + 0.5; + }, + '>': function (pos) { + return Math.sin(pos * Math.PI / 2); + }, + '<': function (pos) { + return -Math.cos(pos * Math.PI / 2) + 1; + }, + bezier: function (x1, y1, x2, y2) { + // see https://www.w3.org/TR/css-easing-1/#cubic-bezier-algo + return function (t) { + if (t < 0) { + if (x1 > 0) { + return y1 / x1 * t; + } else if (x2 > 0) { + return y2 / x2 * t; + } else { + return 0; + } + } else if (t > 1) { + if (x2 < 1) { + return (1 - y2) / (1 - x2) * t + (y2 - x2) / (1 - x2); + } else if (x1 < 1) { + return (1 - y1) / (1 - x1) * t + (y1 - x1) / (1 - x1); + } else { + return 1; + } + } else { + return 3 * t * (1 - t) ** 2 * y1 + 3 * t ** 2 * (1 - t) * y2 + t ** 3; + } + }; + }, + // see https://www.w3.org/TR/css-easing-1/#step-timing-function-algo + steps: function (steps, stepPosition = 'end') { + // deal with "jump-" prefix + stepPosition = stepPosition.split('-').reverse()[0]; + let jumps = steps; + if (stepPosition === 'none') { + --jumps; + } else if (stepPosition === 'both') { + ++jumps; + } + + // The beforeFlag is essentially useless + return (t, beforeFlag = false) => { + // Step is called currentStep in referenced url + let step = Math.floor(t * steps); + const jumping = t * step % 1 === 0; + if (stepPosition === 'start' || stepPosition === 'both') { + ++step; + } + if (beforeFlag && jumping) { + --step; + } + if (t >= 0 && step < 0) { + step = 0; + } + if (t <= 1 && step > jumps) { + step = jumps; + } + return step / jumps; + }; + } +}; +class Stepper { + done() { + return false; + } +} + +/*** +Easing Functions +================ +***/ + +class Ease extends Stepper { + constructor(fn = timeline.ease) { + super(); + this.ease = easing[fn] || fn; + } + step(from, to, pos) { + if (typeof from !== 'number') { + return pos < 1 ? from : to; + } + return from + (to - from) * this.ease(pos); + } +} + +/*** +Controller Types +================ +***/ + +class Controller extends Stepper { + constructor(fn) { + super(); + this.stepper = fn; + } + done(c) { + return c.done; + } + step(current, target, dt, c) { + return this.stepper(current, target, dt, c); + } +} +function recalculate() { + // Apply the default parameters + const duration = (this._duration || 500) / 1000; + const overshoot = this._overshoot || 0; + + // Calculate the PID natural response + const eps = 1e-10; + const pi = Math.PI; + const os = Math.log(overshoot / 100 + eps); + const zeta = -os / Math.sqrt(pi * pi + os * os); + const wn = 3.9 / (zeta * duration); + + // Calculate the Spring values + this.d = 2 * zeta * wn; + this.k = wn * wn; +} +class Spring extends Controller { + constructor(duration = 500, overshoot = 0) { + super(); + this.duration(duration).overshoot(overshoot); + } + step(current, target, dt, c) { + if (typeof current === 'string') return current; + c.done = dt === Infinity; + if (dt === Infinity) return target; + if (dt === 0) return current; + if (dt > 100) dt = 16; + dt /= 1000; + + // Get the previous velocity + const velocity = c.velocity || 0; + + // Apply the control to get the new position and store it + const acceleration = -this.d * velocity - this.k * (current - target); + const newPosition = current + velocity * dt + acceleration * dt * dt / 2; + + // Store the velocity + c.velocity = velocity + acceleration * dt; + + // Figure out if we have converged, and if so, pass the value + c.done = Math.abs(target - newPosition) + Math.abs(velocity) < 0.002; + return c.done ? target : newPosition; + } +} +extend(Spring, { + duration: makeSetterGetter('_duration', recalculate), + overshoot: makeSetterGetter('_overshoot', recalculate) +}); +class PID extends Controller { + constructor(p = 0.1, i = 0.01, d = 0, windup = 1000) { + super(); + this.p(p).i(i).d(d).windup(windup); + } + step(current, target, dt, c) { + if (typeof current === 'string') return current; + c.done = dt === Infinity; + if (dt === Infinity) return target; + if (dt === 0) return current; + const p = target - current; + let i = (c.integral || 0) + p * dt; + const d = (p - (c.error || 0)) / dt; + const windup = this._windup; + + // antiwindup + if (windup !== false) { + i = Math.max(-windup, Math.min(i, windup)); + } + c.error = p; + c.integral = i; + c.done = Math.abs(p) < 0.001; + return c.done ? target : current + (this.P * p + this.I * i + this.D * d); + } +} +extend(PID, { + windup: makeSetterGetter('_windup'), + p: makeSetterGetter('P'), + i: makeSetterGetter('I'), + d: makeSetterGetter('D') +}); + +const segmentParameters = { + M: 2, + L: 2, + H: 1, + V: 1, + C: 6, + S: 4, + Q: 4, + T: 2, + A: 7, + Z: 0 +}; +const pathHandlers = { + M: function (c, p, p0) { + p.x = p0.x = c[0]; + p.y = p0.y = c[1]; + return ['M', p.x, p.y]; + }, + L: function (c, p) { + p.x = c[0]; + p.y = c[1]; + return ['L', c[0], c[1]]; + }, + H: function (c, p) { + p.x = c[0]; + return ['H', c[0]]; + }, + V: function (c, p) { + p.y = c[0]; + return ['V', c[0]]; + }, + C: function (c, p) { + p.x = c[4]; + p.y = c[5]; + return ['C', c[0], c[1], c[2], c[3], c[4], c[5]]; + }, + S: function (c, p) { + p.x = c[2]; + p.y = c[3]; + return ['S', c[0], c[1], c[2], c[3]]; + }, + Q: function (c, p) { + p.x = c[2]; + p.y = c[3]; + return ['Q', c[0], c[1], c[2], c[3]]; + }, + T: function (c, p) { + p.x = c[0]; + p.y = c[1]; + return ['T', c[0], c[1]]; + }, + Z: function (c, p, p0) { + p.x = p0.x; + p.y = p0.y; + return ['Z']; + }, + A: function (c, p) { + p.x = c[5]; + p.y = c[6]; + return ['A', c[0], c[1], c[2], c[3], c[4], c[5], c[6]]; + } +}; +const mlhvqtcsaz = 'mlhvqtcsaz'.split(''); +for (let i = 0, il = mlhvqtcsaz.length; i < il; ++i) { + pathHandlers[mlhvqtcsaz[i]] = function (i) { + return function (c, p, p0) { + if (i === 'H') c[0] = c[0] + p.x;else if (i === 'V') c[0] = c[0] + p.y;else if (i === 'A') { + c[5] = c[5] + p.x; + c[6] = c[6] + p.y; + } else { + for (let j = 0, jl = c.length; j < jl; ++j) { + c[j] = c[j] + (j % 2 ? p.y : p.x); + } + } + return pathHandlers[i](c, p, p0); + }; + }(mlhvqtcsaz[i].toUpperCase()); +} +function makeAbsolut(parser) { + const command = parser.segment[0]; + return pathHandlers[command](parser.segment.slice(1), parser.p, parser.p0); +} +function segmentComplete(parser) { + return parser.segment.length && parser.segment.length - 1 === segmentParameters[parser.segment[0].toUpperCase()]; +} +function startNewSegment(parser, token) { + parser.inNumber && finalizeNumber(parser, false); + const pathLetter = isPathLetter.test(token); + if (pathLetter) { + parser.segment = [token]; + } else { + const lastCommand = parser.lastCommand; + const small = lastCommand.toLowerCase(); + const isSmall = lastCommand === small; + parser.segment = [small === 'm' ? isSmall ? 'l' : 'L' : lastCommand]; + } + parser.inSegment = true; + parser.lastCommand = parser.segment[0]; + return pathLetter; +} +function finalizeNumber(parser, inNumber) { + if (!parser.inNumber) throw new Error('Parser Error'); + parser.number && parser.segment.push(parseFloat(parser.number)); + parser.inNumber = inNumber; + parser.number = ''; + parser.pointSeen = false; + parser.hasExponent = false; + if (segmentComplete(parser)) { + finalizeSegment(parser); + } +} +function finalizeSegment(parser) { + parser.inSegment = false; + if (parser.absolute) { + parser.segment = makeAbsolut(parser); + } + parser.segments.push(parser.segment); +} +function isArcFlag(parser) { + if (!parser.segment.length) return false; + const isArc = parser.segment[0].toUpperCase() === 'A'; + const length = parser.segment.length; + return isArc && (length === 4 || length === 5); +} +function isExponential(parser) { + return parser.lastToken.toUpperCase() === 'E'; +} +const pathDelimiters = new Set([' ', ',', '\t', '\n', '\r', '\f']); +function pathParser(d, toAbsolute = true) { + let index = 0; + let token = ''; + const parser = { + segment: [], + inNumber: false, + number: '', + lastToken: '', + inSegment: false, + segments: [], + pointSeen: false, + hasExponent: false, + absolute: toAbsolute, + p0: new Point(), + p: new Point() + }; + while (parser.lastToken = token, token = d.charAt(index++)) { + if (!parser.inSegment) { + if (startNewSegment(parser, token)) { + continue; + } + } + if (token === '.') { + if (parser.pointSeen || parser.hasExponent) { + finalizeNumber(parser, false); + --index; + continue; + } + parser.inNumber = true; + parser.pointSeen = true; + parser.number += token; + continue; + } + if (!isNaN(parseInt(token))) { + if (parser.number === '0' || isArcFlag(parser)) { + parser.inNumber = true; + parser.number = token; + finalizeNumber(parser, true); + continue; + } + parser.inNumber = true; + parser.number += token; + continue; + } + if (pathDelimiters.has(token)) { + if (parser.inNumber) { + finalizeNumber(parser, false); + } + continue; + } + if (token === '-' || token === '+') { + if (parser.inNumber && !isExponential(parser)) { + finalizeNumber(parser, false); + --index; + continue; + } + parser.number += token; + parser.inNumber = true; + continue; + } + if (token.toUpperCase() === 'E') { + parser.number += token; + parser.hasExponent = true; + continue; + } + if (isPathLetter.test(token)) { + if (parser.inNumber) { + finalizeNumber(parser, false); + } else if (!segmentComplete(parser)) { + throw new Error('parser Error'); + } else { + finalizeSegment(parser); + } + --index; + } + } + if (parser.inNumber) { + finalizeNumber(parser, false); + } + if (parser.inSegment && segmentComplete(parser)) { + finalizeSegment(parser); + } + return parser.segments; +} + +function arrayToString(a) { + let s = ''; + for (let i = 0, il = a.length; i < il; i++) { + s += a[i][0]; + if (a[i][1] != null) { + s += a[i][1]; + if (a[i][2] != null) { + s += ' '; + s += a[i][2]; + if (a[i][3] != null) { + s += ' '; + s += a[i][3]; + s += ' '; + s += a[i][4]; + if (a[i][5] != null) { + s += ' '; + s += a[i][5]; + s += ' '; + s += a[i][6]; + if (a[i][7] != null) { + s += ' '; + s += a[i][7]; + } + } + } + } + } + } + return s + ' '; +} +class PathArray extends SVGArray { + // Get bounding box of path + bbox() { + parser().path.setAttribute('d', this.toString()); + return new Box(parser.nodes.path.getBBox()); + } + + // Move path string + move(x, y) { + // get bounding box of current situation + const box = this.bbox(); + + // get relative offset + x -= box.x; + y -= box.y; + if (!isNaN(x) && !isNaN(y)) { + // move every point + for (let l, i = this.length - 1; i >= 0; i--) { + l = this[i][0]; + if (l === 'M' || l === 'L' || l === 'T') { + this[i][1] += x; + this[i][2] += y; + } else if (l === 'H') { + this[i][1] += x; + } else if (l === 'V') { + this[i][1] += y; + } else if (l === 'C' || l === 'S' || l === 'Q') { + this[i][1] += x; + this[i][2] += y; + this[i][3] += x; + this[i][4] += y; + if (l === 'C') { + this[i][5] += x; + this[i][6] += y; + } + } else if (l === 'A') { + this[i][6] += x; + this[i][7] += y; + } + } + } + return this; + } + + // Absolutize and parse path to array + parse(d = 'M0 0') { + if (Array.isArray(d)) { + d = Array.prototype.concat.apply([], d).toString(); + } + return pathParser(d); + } + + // Resize path string + size(width, height) { + // get bounding box of current situation + const box = this.bbox(); + let i, l; + + // If the box width or height is 0 then we ignore + // transformations on the respective axis + box.width = box.width === 0 ? 1 : box.width; + box.height = box.height === 0 ? 1 : box.height; + + // recalculate position of all points according to new size + for (i = this.length - 1; i >= 0; i--) { + l = this[i][0]; + if (l === 'M' || l === 'L' || l === 'T') { + this[i][1] = (this[i][1] - box.x) * width / box.width + box.x; + this[i][2] = (this[i][2] - box.y) * height / box.height + box.y; + } else if (l === 'H') { + this[i][1] = (this[i][1] - box.x) * width / box.width + box.x; + } else if (l === 'V') { + this[i][1] = (this[i][1] - box.y) * height / box.height + box.y; + } else if (l === 'C' || l === 'S' || l === 'Q') { + this[i][1] = (this[i][1] - box.x) * width / box.width + box.x; + this[i][2] = (this[i][2] - box.y) * height / box.height + box.y; + this[i][3] = (this[i][3] - box.x) * width / box.width + box.x; + this[i][4] = (this[i][4] - box.y) * height / box.height + box.y; + if (l === 'C') { + this[i][5] = (this[i][5] - box.x) * width / box.width + box.x; + this[i][6] = (this[i][6] - box.y) * height / box.height + box.y; + } + } else if (l === 'A') { + // resize radii + this[i][1] = this[i][1] * width / box.width; + this[i][2] = this[i][2] * height / box.height; + + // move position values + this[i][6] = (this[i][6] - box.x) * width / box.width + box.x; + this[i][7] = (this[i][7] - box.y) * height / box.height + box.y; + } + } + return this; + } + + // Convert array to string + toString() { + return arrayToString(this); + } +} + +const getClassForType = value => { + const type = typeof value; + if (type === 'number') { + return SVGNumber; + } else if (type === 'string') { + if (Color.isColor(value)) { + return Color; + } else if (delimiter.test(value)) { + return isPathLetter.test(value) ? PathArray : SVGArray; + } else if (numberAndUnit.test(value)) { + return SVGNumber; + } else { + return NonMorphable; + } + } else if (morphableTypes.indexOf(value.constructor) > -1) { + return value.constructor; + } else if (Array.isArray(value)) { + return SVGArray; + } else if (type === 'object') { + return ObjectBag; + } else { + return NonMorphable; + } +}; +class Morphable { + constructor(stepper) { + this._stepper = stepper || new Ease('-'); + this._from = null; + this._to = null; + this._type = null; + this._context = null; + this._morphObj = null; + } + at(pos) { + return this._morphObj.morph(this._from, this._to, pos, this._stepper, this._context); + } + done() { + const complete = this._context.map(this._stepper.done).reduce(function (last, curr) { + return last && curr; + }, true); + return complete; + } + from(val) { + if (val == null) { + return this._from; + } + this._from = this._set(val); + return this; + } + stepper(stepper) { + if (stepper == null) return this._stepper; + this._stepper = stepper; + return this; + } + to(val) { + if (val == null) { + return this._to; + } + this._to = this._set(val); + return this; + } + type(type) { + // getter + if (type == null) { + return this._type; + } + + // setter + this._type = type; + return this; + } + _set(value) { + if (!this._type) { + this.type(getClassForType(value)); + } + let result = new this._type(value); + if (this._type === Color) { + result = this._to ? result[this._to[4]]() : this._from ? result[this._from[4]]() : result; + } + if (this._type === ObjectBag) { + result = this._to ? result.align(this._to) : this._from ? result.align(this._from) : result; + } + result = result.toConsumable(); + this._morphObj = this._morphObj || new this._type(); + this._context = this._context || Array.apply(null, Array(result.length)).map(Object).map(function (o) { + o.done = true; + return o; + }); + return result; + } +} +class NonMorphable { + constructor(...args) { + this.init(...args); + } + init(val) { + val = Array.isArray(val) ? val[0] : val; + this.value = val; + return this; + } + toArray() { + return [this.value]; + } + valueOf() { + return this.value; + } +} +class TransformBag { + constructor(...args) { + this.init(...args); + } + init(obj) { + if (Array.isArray(obj)) { + obj = { + scaleX: obj[0], + scaleY: obj[1], + shear: obj[2], + rotate: obj[3], + translateX: obj[4], + translateY: obj[5], + originX: obj[6], + originY: obj[7] + }; + } + Object.assign(this, TransformBag.defaults, obj); + return this; + } + toArray() { + const v = this; + return [v.scaleX, v.scaleY, v.shear, v.rotate, v.translateX, v.translateY, v.originX, v.originY]; + } +} +TransformBag.defaults = { + scaleX: 1, + scaleY: 1, + shear: 0, + rotate: 0, + translateX: 0, + translateY: 0, + originX: 0, + originY: 0 +}; +const sortByKey = (a, b) => { + return a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0; +}; +class ObjectBag { + constructor(...args) { + this.init(...args); + } + align(other) { + const values = this.values; + for (let i = 0, il = values.length; i < il; ++i) { + // If the type is the same we only need to check if the color is in the correct format + if (values[i + 1] === other[i + 1]) { + if (values[i + 1] === Color && other[i + 7] !== values[i + 7]) { + const space = other[i + 7]; + const color = new Color(this.values.splice(i + 3, 5))[space]().toArray(); + this.values.splice(i + 3, 0, ...color); + } + i += values[i + 2] + 2; + continue; + } + if (!other[i + 1]) { + return this; + } + + // The types differ, so we overwrite the new type with the old one + // And initialize it with the types default (e.g. black for color or 0 for number) + const defaultObject = new other[i + 1]().toArray(); + + // Than we fix the values array + const toDelete = values[i + 2] + 3; + values.splice(i, toDelete, other[i], other[i + 1], other[i + 2], ...defaultObject); + i += values[i + 2] + 2; + } + return this; + } + init(objOrArr) { + this.values = []; + if (Array.isArray(objOrArr)) { + this.values = objOrArr.slice(); + return; + } + objOrArr = objOrArr || {}; + const entries = []; + for (const i in objOrArr) { + const Type = getClassForType(objOrArr[i]); + const val = new Type(objOrArr[i]).toArray(); + entries.push([i, Type, val.length, ...val]); + } + entries.sort(sortByKey); + this.values = entries.reduce((last, curr) => last.concat(curr), []); + return this; + } + toArray() { + return this.values; + } + valueOf() { + const obj = {}; + const arr = this.values; + + // for (var i = 0, len = arr.length; i < len; i += 2) { + while (arr.length) { + const key = arr.shift(); + const Type = arr.shift(); + const num = arr.shift(); + const values = arr.splice(0, num); + obj[key] = new Type(values); // .valueOf() + } + return obj; + } +} +const morphableTypes = [NonMorphable, TransformBag, ObjectBag]; +function registerMorphableType(type = []) { + morphableTypes.push(...[].concat(type)); +} +function makeMorphable() { + extend(morphableTypes, { + to(val) { + return new Morphable().type(this.constructor).from(this.toArray()) // this.valueOf()) + .to(val); + }, + fromArray(arr) { + this.init(arr); + return this; + }, + toConsumable() { + return this.toArray(); + }, + morph(from, to, pos, stepper, context) { + const mapper = function (i, index) { + return stepper.step(i, to[index], pos, context[index], context); + }; + return this.fromArray(from.map(mapper)); + } + }); +} + +class Path extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('path', node), attrs); + } + + // Get array + array() { + return this._array || (this._array = new PathArray(this.attr('d'))); + } + + // Clear array cache + clear() { + delete this._array; + return this; + } + + // Set height of element + height(height) { + return height == null ? this.bbox().height : this.size(this.bbox().width, height); + } + + // Move by left top corner + move(x, y) { + return this.attr('d', this.array().move(x, y)); + } + + // Plot new path + plot(d) { + return d == null ? this.array() : this.clear().attr('d', typeof d === 'string' ? d : this._array = new PathArray(d)); + } + + // Set element size to given width and height + size(width, height) { + const p = proportionalSize(this, width, height); + return this.attr('d', this.array().size(p.width, p.height)); + } + + // Set width of element + width(width) { + return width == null ? this.bbox().width : this.size(width, this.bbox().height); + } + + // Move by left top corner over x-axis + x(x) { + return x == null ? this.bbox().x : this.move(x, this.bbox().y); + } + + // Move by left top corner over y-axis + y(y) { + return y == null ? this.bbox().y : this.move(this.bbox().x, y); + } +} + +// Define morphable array +Path.prototype.MorphArray = PathArray; + +// Add parent method +registerMethods({ + Container: { + // Create a wrapped path element + path: wrapWithAttrCheck(function (d) { + // make sure plot is called as a setter + return this.put(new Path()).plot(d || new PathArray()); + }) + } +}); +register(Path, 'Path'); + +// Get array +function array() { + return this._array || (this._array = new PointArray(this.attr('points'))); +} + +// Clear array cache +function clear() { + delete this._array; + return this; +} + +// Move by left top corner +function move$2(x, y) { + return this.attr('points', this.array().move(x, y)); +} + +// Plot new path +function plot(p) { + return p == null ? this.array() : this.clear().attr('points', typeof p === 'string' ? p : this._array = new PointArray(p)); +} + +// Set element size to given width and height +function size$1(width, height) { + const p = proportionalSize(this, width, height); + return this.attr('points', this.array().size(p.width, p.height)); +} + +var poly = { + __proto__: null, + array: array, + clear: clear, + move: move$2, + plot: plot, + size: size$1 +}; + +class Polygon extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('polygon', node), attrs); + } +} +registerMethods({ + Container: { + // Create a wrapped polygon element + polygon: wrapWithAttrCheck(function (p) { + // make sure plot is called as a setter + return this.put(new Polygon()).plot(p || new PointArray()); + }) + } +}); +extend(Polygon, pointed); +extend(Polygon, poly); +register(Polygon, 'Polygon'); + +class Polyline extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('polyline', node), attrs); + } +} +registerMethods({ + Container: { + // Create a wrapped polygon element + polyline: wrapWithAttrCheck(function (p) { + // make sure plot is called as a setter + return this.put(new Polyline()).plot(p || new PointArray()); + }) + } +}); +extend(Polyline, pointed); +extend(Polyline, poly); +register(Polyline, 'Polyline'); + +class Rect extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('rect', node), attrs); + } +} +extend(Rect, { + rx, + ry +}); +registerMethods({ + Container: { + // Create a rect element + rect: wrapWithAttrCheck(function (width, height) { + return this.put(new Rect()).size(width, height); + }) + } +}); +register(Rect, 'Rect'); + +class Queue { + constructor() { + this._first = null; + this._last = null; + } + + // Shows us the first item in the list + first() { + return this._first && this._first.value; + } + + // Shows us the last item in the list + last() { + return this._last && this._last.value; + } + push(value) { + // An item stores an id and the provided value + const item = typeof value.next !== 'undefined' ? value : { + value: value, + next: null, + prev: null + }; + + // Deal with the queue being empty or populated + if (this._last) { + item.prev = this._last; + this._last.next = item; + this._last = item; + } else { + this._last = item; + this._first = item; + } + + // Return the current item + return item; + } + + // Removes the item that was returned from the push + remove(item) { + // Relink the previous item + if (item.prev) item.prev.next = item.next; + if (item.next) item.next.prev = item.prev; + if (item === this._last) this._last = item.prev; + if (item === this._first) this._first = item.next; + + // Invalidate item + item.prev = null; + item.next = null; + } + shift() { + // Check if we have a value + const remove = this._first; + if (!remove) return null; + + // If we do, remove it and relink things + this._first = remove.next; + if (this._first) this._first.prev = null; + this._last = this._first ? this._last : null; + return remove.value; + } +} + +const Animator = { + nextDraw: null, + frames: new Queue(), + timeouts: new Queue(), + immediates: new Queue(), + timer: () => globals.window.performance || globals.window.Date, + transforms: [], + frame(fn) { + // Store the node + const node = Animator.frames.push({ + run: fn + }); + + // Request an animation frame if we don't have one + if (Animator.nextDraw === null) { + Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw); + } + + // Return the node so we can remove it easily + return node; + }, + timeout(fn, delay) { + delay = delay || 0; + + // Work out when the event should fire + const time = Animator.timer().now() + delay; + + // Add the timeout to the end of the queue + const node = Animator.timeouts.push({ + run: fn, + time: time + }); + + // Request another animation frame if we need one + if (Animator.nextDraw === null) { + Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw); + } + return node; + }, + immediate(fn) { + // Add the immediate fn to the end of the queue + const node = Animator.immediates.push(fn); + // Request another animation frame if we need one + if (Animator.nextDraw === null) { + Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw); + } + return node; + }, + cancelFrame(node) { + node != null && Animator.frames.remove(node); + }, + clearTimeout(node) { + node != null && Animator.timeouts.remove(node); + }, + cancelImmediate(node) { + node != null && Animator.immediates.remove(node); + }, + _draw(now) { + // Run all the timeouts we can run, if they are not ready yet, add them + // to the end of the queue immediately! (bad timeouts!!! [sarcasm]) + let nextTimeout = null; + const lastTimeout = Animator.timeouts.last(); + while (nextTimeout = Animator.timeouts.shift()) { + // Run the timeout if its time, or push it to the end + if (now >= nextTimeout.time) { + nextTimeout.run(); + } else { + Animator.timeouts.push(nextTimeout); + } + + // If we hit the last item, we should stop shifting out more items + if (nextTimeout === lastTimeout) break; + } + + // Run all of the animation frames + let nextFrame = null; + const lastFrame = Animator.frames.last(); + while (nextFrame !== lastFrame && (nextFrame = Animator.frames.shift())) { + nextFrame.run(now); + } + let nextImmediate = null; + while (nextImmediate = Animator.immediates.shift()) { + nextImmediate(); + } + + // If we have remaining timeouts or frames, draw until we don't anymore + Animator.nextDraw = Animator.timeouts.first() || Animator.frames.first() ? globals.window.requestAnimationFrame(Animator._draw) : null; + } +}; + +const makeSchedule = function (runnerInfo) { + const start = runnerInfo.start; + const duration = runnerInfo.runner.duration(); + const end = start + duration; + return { + start: start, + duration: duration, + end: end, + runner: runnerInfo.runner + }; +}; +const defaultSource = function () { + const w = globals.window; + return (w.performance || w.Date).now(); +}; +class Timeline extends EventTarget { + // Construct a new timeline on the given element + constructor(timeSource = defaultSource) { + super(); + this._timeSource = timeSource; + + // terminate resets all variables to their initial state + this.terminate(); + } + active() { + return !!this._nextFrame; + } + finish() { + // Go to end and pause + this.time(this.getEndTimeOfTimeline() + 1); + return this.pause(); + } + + // Calculates the end of the timeline + getEndTime() { + const lastRunnerInfo = this.getLastRunnerInfo(); + const lastDuration = lastRunnerInfo ? lastRunnerInfo.runner.duration() : 0; + const lastStartTime = lastRunnerInfo ? lastRunnerInfo.start : this._time; + return lastStartTime + lastDuration; + } + getEndTimeOfTimeline() { + const endTimes = this._runners.map(i => i.start + i.runner.duration()); + return Math.max(0, ...endTimes); + } + getLastRunnerInfo() { + return this.getRunnerInfoById(this._lastRunnerId); + } + getRunnerInfoById(id) { + return this._runners[this._runnerIds.indexOf(id)] || null; + } + pause() { + this._paused = true; + return this._continue(); + } + persist(dtOrForever) { + if (dtOrForever == null) return this._persist; + this._persist = dtOrForever; + return this; + } + play() { + // Now make sure we are not paused and continue the animation + this._paused = false; + return this.updateTime()._continue(); + } + reverse(yes) { + const currentSpeed = this.speed(); + if (yes == null) return this.speed(-currentSpeed); + const positive = Math.abs(currentSpeed); + return this.speed(yes ? -positive : positive); + } + + // schedules a runner on the timeline + schedule(runner, delay, when) { + if (runner == null) { + return this._runners.map(makeSchedule); + } + + // The start time for the next animation can either be given explicitly, + // derived from the current timeline time or it can be relative to the + // last start time to chain animations directly + + let absoluteStartTime = 0; + const endTime = this.getEndTime(); + delay = delay || 0; + + // Work out when to start the animation + if (when == null || when === 'last' || when === 'after') { + // Take the last time and increment + absoluteStartTime = endTime; + } else if (when === 'absolute' || when === 'start') { + absoluteStartTime = delay; + delay = 0; + } else if (when === 'now') { + absoluteStartTime = this._time; + } else if (when === 'relative') { + const runnerInfo = this.getRunnerInfoById(runner.id); + if (runnerInfo) { + absoluteStartTime = runnerInfo.start + delay; + delay = 0; + } + } else if (when === 'with-last') { + const lastRunnerInfo = this.getLastRunnerInfo(); + const lastStartTime = lastRunnerInfo ? lastRunnerInfo.start : this._time; + absoluteStartTime = lastStartTime; + } else { + throw new Error('Invalid value for the "when" parameter'); + } + + // Manage runner + runner.unschedule(); + runner.timeline(this); + const persist = runner.persist(); + const runnerInfo = { + persist: persist === null ? this._persist : persist, + start: absoluteStartTime + delay, + runner + }; + this._lastRunnerId = runner.id; + this._runners.push(runnerInfo); + this._runners.sort((a, b) => a.start - b.start); + this._runnerIds = this._runners.map(info => info.runner.id); + this.updateTime()._continue(); + return this; + } + seek(dt) { + return this.time(this._time + dt); + } + source(fn) { + if (fn == null) return this._timeSource; + this._timeSource = fn; + return this; + } + speed(speed) { + if (speed == null) return this._speed; + this._speed = speed; + return this; + } + stop() { + // Go to start and pause + this.time(0); + return this.pause(); + } + time(time) { + if (time == null) return this._time; + this._time = time; + return this._continue(true); + } + + // Remove the runner from this timeline + unschedule(runner) { + const index = this._runnerIds.indexOf(runner.id); + if (index < 0) return this; + this._runners.splice(index, 1); + this._runnerIds.splice(index, 1); + runner.timeline(null); + return this; + } + + // Makes sure, that after pausing the time doesn't jump + updateTime() { + if (!this.active()) { + this._lastSourceTime = this._timeSource(); + } + return this; + } + + // Checks if we are running and continues the animation + _continue(immediateStep = false) { + Animator.cancelFrame(this._nextFrame); + this._nextFrame = null; + if (immediateStep) return this._stepImmediate(); + if (this._paused) return this; + this._nextFrame = Animator.frame(this._step); + return this; + } + _stepFn(immediateStep = false) { + // Get the time delta from the last time and update the time + const time = this._timeSource(); + let dtSource = time - this._lastSourceTime; + if (immediateStep) dtSource = 0; + const dtTime = this._speed * dtSource + (this._time - this._lastStepTime); + this._lastSourceTime = time; + + // Only update the time if we use the timeSource. + // Otherwise use the current time + if (!immediateStep) { + // Update the time + this._time += dtTime; + this._time = this._time < 0 ? 0 : this._time; + } + this._lastStepTime = this._time; + this.fire('time', this._time); + + // This is for the case that the timeline was seeked so that the time + // is now before the startTime of the runner. That is why we need to set + // the runner to position 0 + + // FIXME: + // However, resetting in insertion order leads to bugs. Considering the case, + // where 2 runners change the same attribute but in different times, + // resetting both of them will lead to the case where the later defined + // runner always wins the reset even if the other runner started earlier + // and therefore should win the attribute battle + // this can be solved by resetting them backwards + for (let k = this._runners.length; k--;) { + // Get and run the current runner and ignore it if its inactive + const runnerInfo = this._runners[k]; + const runner = runnerInfo.runner; + + // Make sure that we give the actual difference + // between runner start time and now + const dtToStart = this._time - runnerInfo.start; + + // Dont run runner if not started yet + // and try to reset it + if (dtToStart <= 0) { + runner.reset(); + } + } + + // Run all of the runners directly + let runnersLeft = false; + for (let i = 0, len = this._runners.length; i < len; i++) { + // Get and run the current runner and ignore it if its inactive + const runnerInfo = this._runners[i]; + const runner = runnerInfo.runner; + let dt = dtTime; + + // Make sure that we give the actual difference + // between runner start time and now + const dtToStart = this._time - runnerInfo.start; + + // Dont run runner if not started yet + if (dtToStart <= 0) { + runnersLeft = true; + continue; + } else if (dtToStart < dt) { + // Adjust dt to make sure that animation is on point + dt = dtToStart; + } + if (!runner.active()) continue; + + // If this runner is still going, signal that we need another animation + // frame, otherwise, remove the completed runner + const finished = runner.step(dt).done; + if (!finished) { + runnersLeft = true; + // continue + } else if (runnerInfo.persist !== true) { + // runner is finished. And runner might get removed + const endTime = runner.duration() - runner.time() + this._time; + if (endTime + runnerInfo.persist < this._time) { + // Delete runner and correct index + runner.unschedule(); + --i; + --len; + } + } + } + + // Basically: we continue when there are runners right from us in time + // when -->, and when runners are left from us when <-- + if (runnersLeft && !(this._speed < 0 && this._time === 0) || this._runnerIds.length && this._speed < 0 && this._time > 0) { + this._continue(); + } else { + this.pause(); + this.fire('finished'); + } + return this; + } + terminate() { + // cleanup memory + + // Store the timing variables + this._startTime = 0; + this._speed = 1.0; + + // Determines how long a runner is hold in memory. Can be a dt or true/false + this._persist = 0; + + // Keep track of the running animations and their starting parameters + this._nextFrame = null; + this._paused = true; + this._runners = []; + this._runnerIds = []; + this._lastRunnerId = -1; + this._time = 0; + this._lastSourceTime = 0; + this._lastStepTime = 0; + + // Make sure that step is always called in class context + this._step = this._stepFn.bind(this, false); + this._stepImmediate = this._stepFn.bind(this, true); + } +} +registerMethods({ + Element: { + timeline: function (timeline) { + if (timeline == null) { + this._timeline = this._timeline || new Timeline(); + return this._timeline; + } else { + this._timeline = timeline; + return this; + } + } + } +}); + +class Runner extends EventTarget { + constructor(options) { + super(); + + // Store a unique id on the runner, so that we can identify it later + this.id = Runner.id++; + + // Ensure a default value + options = options == null ? timeline.duration : options; + + // Ensure that we get a controller + options = typeof options === 'function' ? new Controller(options) : options; + + // Declare all of the variables + this._element = null; + this._timeline = null; + this.done = false; + this._queue = []; + + // Work out the stepper and the duration + this._duration = typeof options === 'number' && options; + this._isDeclarative = options instanceof Controller; + this._stepper = this._isDeclarative ? options : new Ease(); + + // We copy the current values from the timeline because they can change + this._history = {}; + + // Store the state of the runner + this.enabled = true; + this._time = 0; + this._lastTime = 0; + + // At creation, the runner is in reset state + this._reseted = true; + + // Save transforms applied to this runner + this.transforms = new Matrix(); + this.transformId = 1; + + // Looping variables + this._haveReversed = false; + this._reverse = false; + this._loopsDone = 0; + this._swing = false; + this._wait = 0; + this._times = 1; + this._frameId = null; + + // Stores how long a runner is stored after being done + this._persist = this._isDeclarative ? true : null; + } + static sanitise(duration, delay, when) { + // Initialise the default parameters + let times = 1; + let swing = false; + let wait = 0; + duration = duration ?? timeline.duration; + delay = delay ?? timeline.delay; + when = when || 'last'; + + // If we have an object, unpack the values + if (typeof duration === 'object' && !(duration instanceof Stepper)) { + delay = duration.delay ?? delay; + when = duration.when ?? when; + swing = duration.swing || swing; + times = duration.times ?? times; + wait = duration.wait ?? wait; + duration = duration.duration ?? timeline.duration; + } + return { + duration: duration, + delay: delay, + swing: swing, + times: times, + wait: wait, + when: when + }; + } + active(enabled) { + if (enabled == null) return this.enabled; + this.enabled = enabled; + return this; + } + + /* + Private Methods + =============== + Methods that shouldn't be used externally + */ + addTransform(transform) { + this.transforms.lmultiplyO(transform); + return this; + } + after(fn) { + return this.on('finished', fn); + } + animate(duration, delay, when) { + const o = Runner.sanitise(duration, delay, when); + const runner = new Runner(o.duration); + if (this._timeline) runner.timeline(this._timeline); + if (this._element) runner.element(this._element); + return runner.loop(o).schedule(o.delay, o.when); + } + clearTransform() { + this.transforms = new Matrix(); + return this; + } + + // TODO: Keep track of all transformations so that deletion is faster + clearTransformsFromQueue() { + if (!this.done || !this._timeline || !this._timeline._runnerIds.includes(this.id)) { + this._queue = this._queue.filter(item => { + return !item.isTransform; + }); + } + } + delay(delay) { + return this.animate(0, delay); + } + duration() { + return this._times * (this._wait + this._duration) - this._wait; + } + during(fn) { + return this.queue(null, fn); + } + ease(fn) { + this._stepper = new Ease(fn); + return this; + } + /* + Runner Definitions + ================== + These methods help us define the runtime behaviour of the Runner or they + help us make new runners from the current runner + */ + + element(element) { + if (element == null) return this._element; + this._element = element; + element._prepareRunner(); + return this; + } + finish() { + return this.step(Infinity); + } + loop(times, swing, wait) { + // Deal with the user passing in an object + if (typeof times === 'object') { + swing = times.swing; + wait = times.wait; + times = times.times; + } + + // Sanitise the values and store them + this._times = times || Infinity; + this._swing = swing || false; + this._wait = wait || 0; + + // Allow true to be passed + if (this._times === true) { + this._times = Infinity; + } + return this; + } + loops(p) { + const loopDuration = this._duration + this._wait; + if (p == null) { + const loopsDone = Math.floor(this._time / loopDuration); + const relativeTime = this._time - loopsDone * loopDuration; + const position = relativeTime / this._duration; + return Math.min(loopsDone + position, this._times); + } + const whole = Math.floor(p); + const partial = p % 1; + const time = loopDuration * whole + this._duration * partial; + return this.time(time); + } + persist(dtOrForever) { + if (dtOrForever == null) return this._persist; + this._persist = dtOrForever; + return this; + } + position(p) { + // Get all of the variables we need + const x = this._time; + const d = this._duration; + const w = this._wait; + const t = this._times; + const s = this._swing; + const r = this._reverse; + let position; + if (p == null) { + /* + This function converts a time to a position in the range [0, 1] + The full explanation can be found in this desmos demonstration + https://www.desmos.com/calculator/u4fbavgche + The logic is slightly simplified here because we can use booleans + */ + + // Figure out the value without thinking about the start or end time + const f = function (x) { + const swinging = s * Math.floor(x % (2 * (w + d)) / (w + d)); + const backwards = swinging && !r || !swinging && r; + const uncliped = Math.pow(-1, backwards) * (x % (w + d)) / d + backwards; + const clipped = Math.max(Math.min(uncliped, 1), 0); + return clipped; + }; + + // Figure out the value by incorporating the start time + const endTime = t * (w + d) - w; + position = x <= 0 ? Math.round(f(1e-5)) : x < endTime ? f(x) : Math.round(f(endTime - 1e-5)); + return position; + } + + // Work out the loops done and add the position to the loops done + const loopsDone = Math.floor(this.loops()); + const swingForward = s && loopsDone % 2 === 0; + const forwards = swingForward && !r || r && swingForward; + position = loopsDone + (forwards ? p : 1 - p); + return this.loops(position); + } + progress(p) { + if (p == null) { + return Math.min(1, this._time / this.duration()); + } + return this.time(p * this.duration()); + } + + /* + Basic Functionality + =================== + These methods allow us to attach basic functions to the runner directly + */ + queue(initFn, runFn, retargetFn, isTransform) { + this._queue.push({ + initialiser: initFn || noop, + runner: runFn || noop, + retarget: retargetFn, + isTransform: isTransform, + initialised: false, + finished: false + }); + const timeline = this.timeline(); + timeline && this.timeline()._continue(); + return this; + } + reset() { + if (this._reseted) return this; + this.time(0); + this._reseted = true; + return this; + } + reverse(reverse) { + this._reverse = reverse == null ? !this._reverse : reverse; + return this; + } + schedule(timeline, delay, when) { + // The user doesn't need to pass a timeline if we already have one + if (!(timeline instanceof Timeline)) { + when = delay; + delay = timeline; + timeline = this.timeline(); + } + + // If there is no timeline, yell at the user... + if (!timeline) { + throw Error('Runner cannot be scheduled without timeline'); + } + + // Schedule the runner on the timeline provided + timeline.schedule(this, delay, when); + return this; + } + step(dt) { + // If we are inactive, this stepper just gets skipped + if (!this.enabled) return this; + + // Update the time and get the new position + dt = dt == null ? 16 : dt; + this._time += dt; + const position = this.position(); + + // Figure out if we need to run the stepper in this frame + const running = this._lastPosition !== position && this._time >= 0; + this._lastPosition = position; + + // Figure out if we just started + const duration = this.duration(); + const justStarted = this._lastTime <= 0 && this._time > 0; + const justFinished = this._lastTime < duration && this._time >= duration; + this._lastTime = this._time; + if (justStarted) { + this.fire('start', this); + } + + // Work out if the runner is finished set the done flag here so animations + // know, that they are running in the last step (this is good for + // transformations which can be merged) + const declarative = this._isDeclarative; + this.done = !declarative && !justFinished && this._time >= duration; + + // Runner is running. So its not in reset state anymore + this._reseted = false; + let converged = false; + // Call initialise and the run function + if (running || declarative) { + this._initialise(running); + + // clear the transforms on this runner so they dont get added again and again + this.transforms = new Matrix(); + converged = this._run(declarative ? dt : position); + this.fire('step', this); + } + // correct the done flag here + // declarative animations itself know when they converged + this.done = this.done || converged && declarative; + if (justFinished) { + this.fire('finished', this); + } + return this; + } + + /* + Runner animation methods + ======================== + Control how the animation plays + */ + time(time) { + if (time == null) { + return this._time; + } + const dt = time - this._time; + this.step(dt); + return this; + } + timeline(timeline) { + // check explicitly for undefined so we can set the timeline to null + if (typeof timeline === 'undefined') return this._timeline; + this._timeline = timeline; + return this; + } + unschedule() { + const timeline = this.timeline(); + timeline && timeline.unschedule(this); + return this; + } + + // Run each initialise function in the runner if required + _initialise(running) { + // If we aren't running, we shouldn't initialise when not declarative + if (!running && !this._isDeclarative) return; + + // Loop through all of the initialisers + for (let i = 0, len = this._queue.length; i < len; ++i) { + // Get the current initialiser + const current = this._queue[i]; + + // Determine whether we need to initialise + const needsIt = this._isDeclarative || !current.initialised && running; + running = !current.finished; + + // Call the initialiser if we need to + if (needsIt && running) { + current.initialiser.call(this); + current.initialised = true; + } + } + } + + // Save a morpher to the morpher list so that we can retarget it later + _rememberMorpher(method, morpher) { + this._history[method] = { + morpher: morpher, + caller: this._queue[this._queue.length - 1] + }; + + // We have to resume the timeline in case a controller + // is already done without being ever run + // This can happen when e.g. this is done: + // anim = el.animate(new SVG.Spring) + // and later + // anim.move(...) + if (this._isDeclarative) { + const timeline = this.timeline(); + timeline && timeline.play(); + } + } + + // Try to set the target for a morpher if the morpher exists, otherwise + // Run each run function for the position or dt given + _run(positionOrDt) { + // Run all of the _queue directly + let allfinished = true; + for (let i = 0, len = this._queue.length; i < len; ++i) { + // Get the current function to run + const current = this._queue[i]; + + // Run the function if its not finished, we keep track of the finished + // flag for the sake of declarative _queue + const converged = current.runner.call(this, positionOrDt); + current.finished = current.finished || converged === true; + allfinished = allfinished && current.finished; + } + + // We report when all of the constructors are finished + return allfinished; + } + + // do nothing and return false + _tryRetarget(method, target, extra) { + if (this._history[method]) { + // if the last method wasn't even initialised, throw it away + if (!this._history[method].caller.initialised) { + const index = this._queue.indexOf(this._history[method].caller); + this._queue.splice(index, 1); + return false; + } + + // for the case of transformations, we use the special retarget function + // which has access to the outer scope + if (this._history[method].caller.retarget) { + this._history[method].caller.retarget.call(this, target, extra); + // for everything else a simple morpher change is sufficient + } else { + this._history[method].morpher.to(target); + } + this._history[method].caller.finished = false; + const timeline = this.timeline(); + timeline && timeline.play(); + return true; + } + return false; + } +} +Runner.id = 0; +class FakeRunner { + constructor(transforms = new Matrix(), id = -1, done = true) { + this.transforms = transforms; + this.id = id; + this.done = done; + } + clearTransformsFromQueue() {} +} +extend([Runner, FakeRunner], { + mergeWith(runner) { + return new FakeRunner(runner.transforms.lmultiply(this.transforms), runner.id); + } +}); + +// FakeRunner.emptyRunner = new FakeRunner() + +const lmultiply = (last, curr) => last.lmultiplyO(curr); +const getRunnerTransform = runner => runner.transforms; +function mergeTransforms() { + // Find the matrix to apply to the element and apply it + const runners = this._transformationRunners.runners; + const netTransform = runners.map(getRunnerTransform).reduce(lmultiply, new Matrix()); + this.transform(netTransform); + this._transformationRunners.merge(); + if (this._transformationRunners.length() === 1) { + this._frameId = null; + } +} +class RunnerArray { + constructor() { + this.runners = []; + this.ids = []; + } + add(runner) { + if (this.runners.includes(runner)) return; + const id = runner.id + 1; + this.runners.push(runner); + this.ids.push(id); + return this; + } + clearBefore(id) { + const deleteCnt = this.ids.indexOf(id + 1) || 1; + this.ids.splice(0, deleteCnt, 0); + this.runners.splice(0, deleteCnt, new FakeRunner()).forEach(r => r.clearTransformsFromQueue()); + return this; + } + edit(id, newRunner) { + const index = this.ids.indexOf(id + 1); + this.ids.splice(index, 1, id + 1); + this.runners.splice(index, 1, newRunner); + return this; + } + getByID(id) { + return this.runners[this.ids.indexOf(id + 1)]; + } + length() { + return this.ids.length; + } + merge() { + let lastRunner = null; + for (let i = 0; i < this.runners.length; ++i) { + const runner = this.runners[i]; + const condition = lastRunner && runner.done && lastRunner.done && ( + // don't merge runner when persisted on timeline + !runner._timeline || !runner._timeline._runnerIds.includes(runner.id)) && (!lastRunner._timeline || !lastRunner._timeline._runnerIds.includes(lastRunner.id)); + if (condition) { + // the +1 happens in the function + this.remove(runner.id); + const newRunner = runner.mergeWith(lastRunner); + this.edit(lastRunner.id, newRunner); + lastRunner = newRunner; + --i; + } else { + lastRunner = runner; + } + } + return this; + } + remove(id) { + const index = this.ids.indexOf(id + 1); + this.ids.splice(index, 1); + this.runners.splice(index, 1); + return this; + } +} +registerMethods({ + Element: { + animate(duration, delay, when) { + const o = Runner.sanitise(duration, delay, when); + const timeline = this.timeline(); + return new Runner(o.duration).loop(o).element(this).timeline(timeline.play()).schedule(o.delay, o.when); + }, + delay(by, when) { + return this.animate(0, by, when); + }, + // this function searches for all runners on the element and deletes the ones + // which run before the current one. This is because absolute transformations + // overwrite anything anyway so there is no need to waste time computing + // other runners + _clearTransformRunnersBefore(currentRunner) { + this._transformationRunners.clearBefore(currentRunner.id); + }, + _currentTransform(current) { + return this._transformationRunners.runners + // we need the equal sign here to make sure, that also transformations + // on the same runner which execute before the current transformation are + // taken into account + .filter(runner => runner.id <= current.id).map(getRunnerTransform).reduce(lmultiply, new Matrix()); + }, + _addRunner(runner) { + this._transformationRunners.add(runner); + + // Make sure that the runner merge is executed at the very end of + // all Animator functions. That is why we use immediate here to execute + // the merge right after all frames are run + Animator.cancelImmediate(this._frameId); + this._frameId = Animator.immediate(mergeTransforms.bind(this)); + }, + _prepareRunner() { + if (this._frameId == null) { + this._transformationRunners = new RunnerArray().add(new FakeRunner(new Matrix(this))); + } + } + } +}); + +// Will output the elements from array A that are not in the array B +const difference = (a, b) => a.filter(x => !b.includes(x)); +extend(Runner, { + attr(a, v) { + return this.styleAttr('attr', a, v); + }, + // Add animatable styles + css(s, v) { + return this.styleAttr('css', s, v); + }, + styleAttr(type, nameOrAttrs, val) { + if (typeof nameOrAttrs === 'string') { + return this.styleAttr(type, { + [nameOrAttrs]: val + }); + } + let attrs = nameOrAttrs; + if (this._tryRetarget(type, attrs)) return this; + let morpher = new Morphable(this._stepper).to(attrs); + let keys = Object.keys(attrs); + this.queue(function () { + morpher = morpher.from(this.element()[type](keys)); + }, function (pos) { + this.element()[type](morpher.at(pos).valueOf()); + return morpher.done(); + }, function (newToAttrs) { + // Check if any new keys were added + const newKeys = Object.keys(newToAttrs); + const differences = difference(newKeys, keys); + + // If their are new keys, initialize them and add them to morpher + if (differences.length) { + // Get the values + const addedFromAttrs = this.element()[type](differences); + + // Get the already initialized values + const oldFromAttrs = new ObjectBag(morpher.from()).valueOf(); + + // Merge old and new + Object.assign(oldFromAttrs, addedFromAttrs); + morpher.from(oldFromAttrs); + } + + // Get the object from the morpher + const oldToAttrs = new ObjectBag(morpher.to()).valueOf(); + + // Merge in new attributes + Object.assign(oldToAttrs, newToAttrs); + + // Change morpher target + morpher.to(oldToAttrs); + + // Make sure that we save the work we did so we don't need it to do again + keys = newKeys; + attrs = newToAttrs; + }); + this._rememberMorpher(type, morpher); + return this; + }, + zoom(level, point) { + if (this._tryRetarget('zoom', level, point)) return this; + let morpher = new Morphable(this._stepper).to(new SVGNumber(level)); + this.queue(function () { + morpher = morpher.from(this.element().zoom()); + }, function (pos) { + this.element().zoom(morpher.at(pos), point); + return morpher.done(); + }, function (newLevel, newPoint) { + point = newPoint; + morpher.to(newLevel); + }); + this._rememberMorpher('zoom', morpher); + return this; + }, + /** + ** absolute transformations + **/ + + // + // M v -----|-----(D M v = F v)------|-----> T v + // + // 1. define the final state (T) and decompose it (once) + // t = [tx, ty, the, lam, sy, sx] + // 2. on every frame: pull the current state of all previous transforms + // (M - m can change) + // and then write this as m = [tx0, ty0, the0, lam0, sy0, sx0] + // 3. Find the interpolated matrix F(pos) = m + pos * (t - m) + // - Note F(0) = M + // - Note F(1) = T + // 4. Now you get the delta matrix as a result: D = F * inv(M) + + transform(transforms, relative, affine) { + // If we have a declarative function, we should retarget it if possible + relative = transforms.relative || relative; + if (this._isDeclarative && !relative && this._tryRetarget('transform', transforms)) { + return this; + } + + // Parse the parameters + const isMatrix = Matrix.isMatrixLike(transforms); + affine = transforms.affine != null ? transforms.affine : affine != null ? affine : !isMatrix; + + // Create a morpher and set its type + const morpher = new Morphable(this._stepper).type(affine ? TransformBag : Matrix); + let origin; + let element; + let current; + let currentAngle; + let startTransform; + function setup() { + // make sure element and origin is defined + element = element || this.element(); + origin = origin || getOrigin(transforms, element); + startTransform = new Matrix(relative ? undefined : element); + + // add the runner to the element so it can merge transformations + element._addRunner(this); + + // Deactivate all transforms that have run so far if we are absolute + if (!relative) { + element._clearTransformRunnersBefore(this); + } + } + function run(pos) { + // clear all other transforms before this in case something is saved + // on this runner. We are absolute. We dont need these! + if (!relative) this.clearTransform(); + const { + x, + y + } = new Point(origin).transform(element._currentTransform(this)); + let target = new Matrix({ + ...transforms, + origin: [x, y] + }); + let start = this._isDeclarative && current ? current : startTransform; + if (affine) { + target = target.decompose(x, y); + start = start.decompose(x, y); + + // Get the current and target angle as it was set + const rTarget = target.rotate; + const rCurrent = start.rotate; + + // Figure out the shortest path to rotate directly + const possibilities = [rTarget - 360, rTarget, rTarget + 360]; + const distances = possibilities.map(a => Math.abs(a - rCurrent)); + const shortest = Math.min(...distances); + const index = distances.indexOf(shortest); + target.rotate = possibilities[index]; + } + if (relative) { + // we have to be careful here not to overwrite the rotation + // with the rotate method of Matrix + if (!isMatrix) { + target.rotate = transforms.rotate || 0; + } + if (this._isDeclarative && currentAngle) { + start.rotate = currentAngle; + } + } + morpher.from(start); + morpher.to(target); + const affineParameters = morpher.at(pos); + currentAngle = affineParameters.rotate; + current = new Matrix(affineParameters); + this.addTransform(current); + element._addRunner(this); + return morpher.done(); + } + function retarget(newTransforms) { + // only get a new origin if it changed since the last call + if ((newTransforms.origin || 'center').toString() !== (transforms.origin || 'center').toString()) { + origin = getOrigin(newTransforms, element); + } + + // overwrite the old transformations with the new ones + transforms = { + ...newTransforms, + origin + }; + } + this.queue(setup, run, retarget, true); + this._isDeclarative && this._rememberMorpher('transform', morpher); + return this; + }, + // Animatable x-axis + x(x) { + return this._queueNumber('x', x); + }, + // Animatable y-axis + y(y) { + return this._queueNumber('y', y); + }, + ax(x) { + return this._queueNumber('ax', x); + }, + ay(y) { + return this._queueNumber('ay', y); + }, + dx(x = 0) { + return this._queueNumberDelta('x', x); + }, + dy(y = 0) { + return this._queueNumberDelta('y', y); + }, + dmove(x, y) { + return this.dx(x).dy(y); + }, + _queueNumberDelta(method, to) { + to = new SVGNumber(to); + + // Try to change the target if we have this method already registered + if (this._tryRetarget(method, to)) return this; + + // Make a morpher and queue the animation + const morpher = new Morphable(this._stepper).to(to); + let from = null; + this.queue(function () { + from = this.element()[method](); + morpher.from(from); + morpher.to(from + to); + }, function (pos) { + this.element()[method](morpher.at(pos)); + return morpher.done(); + }, function (newTo) { + morpher.to(from + new SVGNumber(newTo)); + }); + + // Register the morpher so that if it is changed again, we can retarget it + this._rememberMorpher(method, morpher); + return this; + }, + _queueObject(method, to) { + // Try to change the target if we have this method already registered + if (this._tryRetarget(method, to)) return this; + + // Make a morpher and queue the animation + const morpher = new Morphable(this._stepper).to(to); + this.queue(function () { + morpher.from(this.element()[method]()); + }, function (pos) { + this.element()[method](morpher.at(pos)); + return morpher.done(); + }); + + // Register the morpher so that if it is changed again, we can retarget it + this._rememberMorpher(method, morpher); + return this; + }, + _queueNumber(method, value) { + return this._queueObject(method, new SVGNumber(value)); + }, + // Animatable center x-axis + cx(x) { + return this._queueNumber('cx', x); + }, + // Animatable center y-axis + cy(y) { + return this._queueNumber('cy', y); + }, + // Add animatable move + move(x, y) { + return this.x(x).y(y); + }, + amove(x, y) { + return this.ax(x).ay(y); + }, + // Add animatable center + center(x, y) { + return this.cx(x).cy(y); + }, + // Add animatable size + size(width, height) { + // animate bbox based size for all other elements + let box; + if (!width || !height) { + box = this._element.bbox(); + } + if (!width) { + width = box.width / box.height * height; + } + if (!height) { + height = box.height / box.width * width; + } + return this.width(width).height(height); + }, + // Add animatable width + width(width) { + return this._queueNumber('width', width); + }, + // Add animatable height + height(height) { + return this._queueNumber('height', height); + }, + // Add animatable plot + plot(a, b, c, d) { + // Lines can be plotted with 4 arguments + if (arguments.length === 4) { + return this.plot([a, b, c, d]); + } + if (this._tryRetarget('plot', a)) return this; + const morpher = new Morphable(this._stepper).type(this._element.MorphArray).to(a); + this.queue(function () { + morpher.from(this._element.array()); + }, function (pos) { + this._element.plot(morpher.at(pos)); + return morpher.done(); + }); + this._rememberMorpher('plot', morpher); + return this; + }, + // Add leading method + leading(value) { + return this._queueNumber('leading', value); + }, + // Add animatable viewbox + viewbox(x, y, width, height) { + return this._queueObject('viewbox', new Box(x, y, width, height)); + }, + update(o) { + if (typeof o !== 'object') { + return this.update({ + offset: arguments[0], + color: arguments[1], + opacity: arguments[2] + }); + } + if (o.opacity != null) this.attr('stop-opacity', o.opacity); + if (o.color != null) this.attr('stop-color', o.color); + if (o.offset != null) this.attr('offset', o.offset); + return this; + } +}); +extend(Runner, { + rx, + ry, + from, + to +}); +register(Runner, 'Runner'); + +class Svg extends Container { + constructor(node, attrs = node) { + super(nodeOrNew('svg', node), attrs); + this.namespace(); + } + + // Creates and returns defs element + defs() { + if (!this.isRoot()) return this.root().defs(); + return adopt(this.node.querySelector('defs')) || this.put(new Defs()); + } + isRoot() { + return !this.node.parentNode || !(this.node.parentNode instanceof globals.window.SVGElement) && this.node.parentNode.nodeName !== '#document-fragment'; + } + + // Add namespaces + namespace() { + if (!this.isRoot()) return this.root().namespace(); + return this.attr({ + xmlns: svg, + version: '1.1' + }).attr('xmlns:xlink', xlink, xmlns); + } + removeNamespace() { + return this.attr({ + xmlns: null, + version: null + }).attr('xmlns:xlink', null, xmlns).attr('xmlns:svgjs', null, xmlns); + } + + // Check if this is a root svg + // If not, call root() from this element + root() { + if (this.isRoot()) return this; + return super.root(); + } +} +registerMethods({ + Container: { + // Create nested svg document + nested: wrapWithAttrCheck(function () { + return this.put(new Svg()); + }) + } +}); +register(Svg, 'Svg', true); + +class Symbol extends Container { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('symbol', node), attrs); + } +} +registerMethods({ + Container: { + symbol: wrapWithAttrCheck(function () { + return this.put(new Symbol()); + }) + } +}); +register(Symbol, 'Symbol'); + +// Create plain text node +function plain(text) { + // clear if build mode is disabled + if (this._build === false) { + this.clear(); + } + + // create text node + this.node.appendChild(globals.document.createTextNode(text)); + return this; +} + +// Get length of text element +function length() { + return this.node.getComputedTextLength(); +} + +// Move over x-axis +// Text is moved by its bounding box +// text-anchor does NOT matter +function x$1(x, box = this.bbox()) { + if (x == null) { + return box.x; + } + return this.attr('x', this.attr('x') + x - box.x); +} + +// Move over y-axis +function y$1(y, box = this.bbox()) { + if (y == null) { + return box.y; + } + return this.attr('y', this.attr('y') + y - box.y); +} +function move$1(x, y, box = this.bbox()) { + return this.x(x, box).y(y, box); +} + +// Move center over x-axis +function cx(x, box = this.bbox()) { + if (x == null) { + return box.cx; + } + return this.attr('x', this.attr('x') + x - box.cx); +} + +// Move center over y-axis +function cy(y, box = this.bbox()) { + if (y == null) { + return box.cy; + } + return this.attr('y', this.attr('y') + y - box.cy); +} +function center(x, y, box = this.bbox()) { + return this.cx(x, box).cy(y, box); +} +function ax(x) { + return this.attr('x', x); +} +function ay(y) { + return this.attr('y', y); +} +function amove(x, y) { + return this.ax(x).ay(y); +} + +// Enable / disable build mode +function build(build) { + this._build = !!build; + return this; +} + +var textable = { + __proto__: null, + amove: amove, + ax: ax, + ay: ay, + build: build, + center: center, + cx: cx, + cy: cy, + length: length, + move: move$1, + plain: plain, + x: x$1, + y: y$1 +}; + +class Text extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('text', node), attrs); + this.dom.leading = this.dom.leading ?? new SVGNumber(1.3); // store leading value for rebuilding + this._rebuild = true; // enable automatic updating of dy values + this._build = false; // disable build mode for adding multiple lines + } + + // Set / get leading + leading(value) { + // act as getter + if (value == null) { + return this.dom.leading; + } + + // act as setter + this.dom.leading = new SVGNumber(value); + return this.rebuild(); + } + + // Rebuild appearance type + rebuild(rebuild) { + // store new rebuild flag if given + if (typeof rebuild === 'boolean') { + this._rebuild = rebuild; + } + + // define position of all lines + if (this._rebuild) { + const self = this; + let blankLineOffset = 0; + const leading = this.dom.leading; + this.each(function (i) { + if (isDescriptive(this.node)) return; + const fontSize = globals.window.getComputedStyle(this.node).getPropertyValue('font-size'); + const dy = leading * new SVGNumber(fontSize); + if (this.dom.newLined) { + this.attr('x', self.attr('x')); + if (this.text() === '\n') { + blankLineOffset += dy; + } else { + this.attr('dy', i ? dy + blankLineOffset : 0); + blankLineOffset = 0; + } + } + }); + this.fire('rebuild'); + } + return this; + } + + // overwrite method from parent to set data properly + setData(o) { + this.dom = o; + this.dom.leading = new SVGNumber(o.leading || 1.3); + return this; + } + writeDataToDom() { + writeDataToDom(this, this.dom, { + leading: 1.3 + }); + return this; + } + + // Set the text content + text(text) { + // act as getter + if (text === undefined) { + const children = this.node.childNodes; + let firstLine = 0; + text = ''; + for (let i = 0, len = children.length; i < len; ++i) { + // skip textPaths - they are no lines + if (children[i].nodeName === 'textPath' || isDescriptive(children[i])) { + if (i === 0) firstLine = i + 1; + continue; + } + + // add newline if its not the first child and newLined is set to true + if (i !== firstLine && children[i].nodeType !== 3 && adopt(children[i]).dom.newLined === true) { + text += '\n'; + } + + // add content of this node + text += children[i].textContent; + } + return text; + } + + // remove existing content + this.clear().build(true); + if (typeof text === 'function') { + // call block + text.call(this, this); + } else { + // store text and make sure text is not blank + text = (text + '').split('\n'); + + // build new lines + for (let j = 0, jl = text.length; j < jl; j++) { + this.newLine(text[j]); + } + } + + // disable build mode and rebuild lines + return this.build(false).rebuild(); + } +} +extend(Text, textable); +registerMethods({ + Container: { + // Create text element + text: wrapWithAttrCheck(function (text = '') { + return this.put(new Text()).text(text); + }), + // Create plain text element + plain: wrapWithAttrCheck(function (text = '') { + return this.put(new Text()).plain(text); + }) + } +}); +register(Text, 'Text'); + +class Tspan extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('tspan', node), attrs); + this._build = false; // disable build mode for adding multiple lines + } + + // Shortcut dx + dx(dx) { + return this.attr('dx', dx); + } + + // Shortcut dy + dy(dy) { + return this.attr('dy', dy); + } + + // Create new line + newLine() { + // mark new line + this.dom.newLined = true; + + // fetch parent + const text = this.parent(); + + // early return in case we are not in a text element + if (!(text instanceof Text)) { + return this; + } + const i = text.index(this); + const fontSize = globals.window.getComputedStyle(this.node).getPropertyValue('font-size'); + const dy = text.dom.leading * new SVGNumber(fontSize); + + // apply new position + return this.dy(i ? dy : 0).attr('x', text.x()); + } + + // Set text content + text(text) { + if (text == null) return this.node.textContent + (this.dom.newLined ? '\n' : ''); + if (typeof text === 'function') { + this.clear().build(true); + text.call(this, this); + this.build(false); + } else { + this.plain(text); + } + return this; + } +} +extend(Tspan, textable); +registerMethods({ + Tspan: { + tspan: wrapWithAttrCheck(function (text = '') { + const tspan = new Tspan(); + + // clear if build mode is disabled + if (!this._build) { + this.clear(); + } + + // add new tspan + return this.put(tspan).text(text); + }) + }, + Text: { + newLine: function (text = '') { + return this.tspan(text).newLine(); + } + } +}); +register(Tspan, 'Tspan'); + +class Circle extends Shape { + constructor(node, attrs = node) { + super(nodeOrNew('circle', node), attrs); + } + radius(r) { + return this.attr('r', r); + } + + // Radius x value + rx(rx) { + return this.attr('r', rx); + } + + // Alias radius x value + ry(ry) { + return this.rx(ry); + } + size(size) { + return this.radius(new SVGNumber(size).divide(2)); + } +} +extend(Circle, { + x: x$3, + y: y$3, + cx: cx$1, + cy: cy$1, + width: width$2, + height: height$2 +}); +registerMethods({ + Container: { + // Create circle element + circle: wrapWithAttrCheck(function (size = 0) { + return this.put(new Circle()).size(size).move(0, 0); + }) + } +}); +register(Circle, 'Circle'); + +class ClipPath extends Container { + constructor(node, attrs = node) { + super(nodeOrNew('clipPath', node), attrs); + } + + // Unclip all clipped elements and remove itself + remove() { + // unclip all targets + this.targets().forEach(function (el) { + el.unclip(); + }); + + // remove clipPath from parent + return super.remove(); + } + targets() { + return baseFind('svg [clip-path*=' + this.id() + ']'); + } +} +registerMethods({ + Container: { + // Create clipping element + clip: wrapWithAttrCheck(function () { + return this.defs().put(new ClipPath()); + }) + }, + Element: { + // Distribute clipPath to svg element + clipper() { + return this.reference('clip-path'); + }, + clipWith(element) { + // use given clip or create a new one + const clipper = element instanceof ClipPath ? element : this.parent().clip().add(element); + + // apply mask + return this.attr('clip-path', 'url(#' + clipper.id() + ')'); + }, + // Unclip element + unclip() { + return this.attr('clip-path', null); + } + } +}); +register(ClipPath, 'ClipPath'); + +class ForeignObject extends Element { + constructor(node, attrs = node) { + super(nodeOrNew('foreignObject', node), attrs); + } +} +registerMethods({ + Container: { + foreignObject: wrapWithAttrCheck(function (width, height) { + return this.put(new ForeignObject()).size(width, height); + }) + } +}); +register(ForeignObject, 'ForeignObject'); + +function dmove(dx, dy) { + this.children().forEach(child => { + let bbox; + + // We have to wrap this for elements that dont have a bbox + // e.g. title and other descriptive elements + try { + // Get the childs bbox + // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1905039 + // Because bbox for nested svgs returns the contents bbox in the coordinate space of the svg itself (weird!), we cant use bbox for svgs + // Therefore we have to use getBoundingClientRect. But THAT is broken (as explained in the bug). + // Funnily enough the broken behavior would work for us but that breaks it in chrome + // So we have to replicate the broken behavior of FF by just reading the attributes of the svg itself + bbox = child.node instanceof getWindow().SVGSVGElement ? new Box(child.attr(['x', 'y', 'width', 'height'])) : child.bbox(); + } catch (e) { + return; + } + + // Get childs matrix + const m = new Matrix(child); + // Translate childs matrix by amount and + // transform it back into parents space + const matrix = m.translate(dx, dy).transform(m.inverse()); + // Calculate new x and y from old box + const p = new Point(bbox.x, bbox.y).transform(matrix); + // Move element + child.move(p.x, p.y); + }); + return this; +} +function dx(dx) { + return this.dmove(dx, 0); +} +function dy(dy) { + return this.dmove(0, dy); +} +function height(height, box = this.bbox()) { + if (height == null) return box.height; + return this.size(box.width, height, box); +} +function move(x = 0, y = 0, box = this.bbox()) { + const dx = x - box.x; + const dy = y - box.y; + return this.dmove(dx, dy); +} +function size(width, height, box = this.bbox()) { + const p = proportionalSize(this, width, height, box); + const scaleX = p.width / box.width; + const scaleY = p.height / box.height; + this.children().forEach(child => { + const o = new Point(box).transform(new Matrix(child).inverse()); + child.scale(scaleX, scaleY, o.x, o.y); + }); + return this; +} +function width(width, box = this.bbox()) { + if (width == null) return box.width; + return this.size(width, box.height, box); +} +function x(x, box = this.bbox()) { + if (x == null) return box.x; + return this.move(x, box.y, box); +} +function y(y, box = this.bbox()) { + if (y == null) return box.y; + return this.move(box.x, y, box); +} + +var containerGeometry = { + __proto__: null, + dmove: dmove, + dx: dx, + dy: dy, + height: height, + move: move, + size: size, + width: width, + x: x, + y: y +}; + +class G extends Container { + constructor(node, attrs = node) { + super(nodeOrNew('g', node), attrs); + } +} +extend(G, containerGeometry); +registerMethods({ + Container: { + // Create a group element + group: wrapWithAttrCheck(function () { + return this.put(new G()); + }) + } +}); +register(G, 'G'); + +class A extends Container { + constructor(node, attrs = node) { + super(nodeOrNew('a', node), attrs); + } + + // Link target attribute + target(target) { + return this.attr('target', target); + } + + // Link url + to(url) { + return this.attr('href', url, xlink); + } +} +extend(A, containerGeometry); +registerMethods({ + Container: { + // Create a hyperlink element + link: wrapWithAttrCheck(function (url) { + return this.put(new A()).to(url); + }) + }, + Element: { + unlink() { + const link = this.linker(); + if (!link) return this; + const parent = link.parent(); + if (!parent) { + return this.remove(); + } + const index = parent.index(link); + parent.add(this, index); + link.remove(); + return this; + }, + linkTo(url) { + // reuse old link if possible + let link = this.linker(); + if (!link) { + link = new A(); + this.wrap(link); + } + if (typeof url === 'function') { + url.call(link, link); + } else { + link.to(url); + } + return this; + }, + linker() { + const link = this.parent(); + if (link && link.node.nodeName.toLowerCase() === 'a') { + return link; + } + return null; + } + } +}); +register(A, 'A'); + +class Mask extends Container { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('mask', node), attrs); + } + + // Unmask all masked elements and remove itself + remove() { + // unmask all targets + this.targets().forEach(function (el) { + el.unmask(); + }); + + // remove mask from parent + return super.remove(); + } + targets() { + return baseFind('svg [mask*=' + this.id() + ']'); + } +} +registerMethods({ + Container: { + mask: wrapWithAttrCheck(function () { + return this.defs().put(new Mask()); + }) + }, + Element: { + // Distribute mask to svg element + masker() { + return this.reference('mask'); + }, + maskWith(element) { + // use given mask or create a new one + const masker = element instanceof Mask ? element : this.parent().mask().add(element); + + // apply mask + return this.attr('mask', 'url(#' + masker.id() + ')'); + }, + // Unmask element + unmask() { + return this.attr('mask', null); + } + } +}); +register(Mask, 'Mask'); + +class Stop extends Element { + constructor(node, attrs = node) { + super(nodeOrNew('stop', node), attrs); + } + + // add color stops + update(o) { + if (typeof o === 'number' || o instanceof SVGNumber) { + o = { + offset: arguments[0], + color: arguments[1], + opacity: arguments[2] + }; + } + + // set attributes + if (o.opacity != null) this.attr('stop-opacity', o.opacity); + if (o.color != null) this.attr('stop-color', o.color); + if (o.offset != null) this.attr('offset', new SVGNumber(o.offset)); + return this; + } +} +registerMethods({ + Gradient: { + // Add a color stop + stop: function (offset, color, opacity) { + return this.put(new Stop()).update(offset, color, opacity); + } + } +}); +register(Stop, 'Stop'); + +function cssRule(selector, rule) { + if (!selector) return ''; + if (!rule) return selector; + let ret = selector + '{'; + for (const i in rule) { + ret += unCamelCase(i) + ':' + rule[i] + ';'; + } + ret += '}'; + return ret; +} +class Style extends Element { + constructor(node, attrs = node) { + super(nodeOrNew('style', node), attrs); + } + addText(w = '') { + this.node.textContent += w; + return this; + } + font(name, src, params = {}) { + return this.rule('@font-face', { + fontFamily: name, + src: src, + ...params + }); + } + rule(selector, obj) { + return this.addText(cssRule(selector, obj)); + } +} +registerMethods('Dom', { + style(selector, obj) { + return this.put(new Style()).rule(selector, obj); + }, + fontface(name, src, params) { + return this.put(new Style()).font(name, src, params); + } +}); +register(Style, 'Style'); + +class TextPath extends Text { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('textPath', node), attrs); + } + + // return the array of the path track element + array() { + const track = this.track(); + return track ? track.array() : null; + } + + // Plot path if any + plot(d) { + const track = this.track(); + let pathArray = null; + if (track) { + pathArray = track.plot(d); + } + return d == null ? pathArray : this; + } + + // Get the path element + track() { + return this.reference('href'); + } +} +registerMethods({ + Container: { + textPath: wrapWithAttrCheck(function (text, path) { + // Convert text to instance if needed + if (!(text instanceof Text)) { + text = this.text(text); + } + return text.path(path); + }) + }, + Text: { + // Create path for text to run on + path: wrapWithAttrCheck(function (track, importNodes = true) { + const textPath = new TextPath(); + + // if track is a path, reuse it + if (!(track instanceof Path)) { + // create path element + track = this.defs().path(track); + } + + // link textPath to path and add content + textPath.attr('href', '#' + track, xlink); + + // Transplant all nodes from text to textPath + let node; + if (importNodes) { + while (node = this.node.firstChild) { + textPath.node.appendChild(node); + } + } + + // add textPath element as child node and return textPath + return this.put(textPath); + }), + // Get the textPath children + textPath() { + return this.findOne('textPath'); + } + }, + Path: { + // creates a textPath from this path + text: wrapWithAttrCheck(function (text) { + // Convert text to instance if needed + if (!(text instanceof Text)) { + text = new Text().addTo(this.parent()).text(text); + } + + // Create textPath from text and path and return + return text.path(this); + }), + targets() { + return baseFind('svg textPath').filter(node => { + return (node.attr('href') || '').includes(this.id()); + }); + + // Does not work in IE11. Use when IE support is dropped + // return baseFind('svg textPath[*|href*=' + this.id() + ']') + } + } +}); +TextPath.prototype.MorphArray = PathArray; +register(TextPath, 'TextPath'); + +class Use extends Shape { + constructor(node, attrs = node) { + super(nodeOrNew('use', node), attrs); + } + + // Use element as a reference + use(element, file) { + // Set lined element + return this.attr('href', (file || '') + '#' + element, xlink); + } +} +registerMethods({ + Container: { + // Create a use element + use: wrapWithAttrCheck(function (element, file) { + return this.put(new Use()).use(element, file); + }) + } +}); +register(Use, 'Use'); + +/* Optional Modules */ +const SVG = makeInstance; +extend([Svg, Symbol, Image, Pattern, Marker], getMethodsFor('viewbox')); +extend([Line, Polyline, Polygon, Path], getMethodsFor('marker')); +extend(Text, getMethodsFor('Text')); +extend(Path, getMethodsFor('Path')); +extend(Defs, getMethodsFor('Defs')); +extend([Text, Tspan], getMethodsFor('Tspan')); +extend([Rect, Ellipse, Gradient, Runner], getMethodsFor('radius')); +extend(EventTarget, getMethodsFor('EventTarget')); +extend(Dom, getMethodsFor('Dom')); +extend(Element, getMethodsFor('Element')); +extend(Shape, getMethodsFor('Shape')); +extend([Container, Fragment], getMethodsFor('Container')); +extend(Gradient, getMethodsFor('Gradient')); +extend(Runner, getMethodsFor('Runner')); +List.extend(getMethodNames()); +registerMorphableType([SVGNumber, Color, Box, Matrix, SVGArray, PointArray, PathArray, Point]); +makeMorphable(); + +exports.A = A; +exports.Animator = Animator; +exports.Array = SVGArray; +exports.Box = Box; +exports.Circle = Circle; +exports.ClipPath = ClipPath; +exports.Color = Color; +exports.Container = Container; +exports.Controller = Controller; +exports.Defs = Defs; +exports.Dom = Dom; +exports.Ease = Ease; +exports.Element = Element; +exports.Ellipse = Ellipse; +exports.EventTarget = EventTarget; +exports.ForeignObject = ForeignObject; +exports.Fragment = Fragment; +exports.G = G; +exports.Gradient = Gradient; +exports.Image = Image; +exports.Line = Line; +exports.List = List; +exports.Marker = Marker; +exports.Mask = Mask; +exports.Matrix = Matrix; +exports.Morphable = Morphable; +exports.NonMorphable = NonMorphable; +exports.Number = SVGNumber; +exports.ObjectBag = ObjectBag; +exports.PID = PID; +exports.Path = Path; +exports.PathArray = PathArray; +exports.Pattern = Pattern; +exports.Point = Point; +exports.PointArray = PointArray; +exports.Polygon = Polygon; +exports.Polyline = Polyline; +exports.Queue = Queue; +exports.Rect = Rect; +exports.Runner = Runner; +exports.SVG = SVG; +exports.Shape = Shape; +exports.Spring = Spring; +exports.Stop = Stop; +exports.Style = Style; +exports.Svg = Svg; +exports.Symbol = Symbol; +exports.Text = Text; +exports.TextPath = TextPath; +exports.Timeline = Timeline; +exports.TransformBag = TransformBag; +exports.Tspan = Tspan; +exports.Use = Use; +exports.adopt = adopt; +exports.assignNewId = assignNewId; +exports.clearEvents = clearEvents; +exports.create = create; +exports.defaults = defaults; +exports.dispatch = dispatch; +exports.easing = easing; +exports.eid = eid; +exports.extend = extend; +exports.find = baseFind; +exports.getClass = getClass; +exports.getEventTarget = getEventTarget; +exports.getEvents = getEvents; +exports.getWindow = getWindow; +exports.makeInstance = makeInstance; +exports.makeMorphable = makeMorphable; +exports.mockAdopt = mockAdopt; +exports.namespaces = namespaces; +exports.nodeOrNew = nodeOrNew; +exports.off = off; +exports.on = on; +exports.parser = parser; +exports.regex = regex; +exports.register = register; +exports.registerMorphableType = registerMorphableType; +exports.registerWindow = registerWindow; +exports.restoreWindow = restoreWindow; +exports.root = root; +exports.saveWindow = saveWindow; +exports.utils = utils; +exports.windowEvents = windowEvents; +exports.withWindow = withWindow; +exports.wrapWithAttrCheck = wrapWithAttrCheck; +//# sourceMappingURL=svg.node.cjs.map diff --git a/node_modules/@svgdotjs/svg.js/dist/svg.node.cjs.map b/node_modules/@svgdotjs/svg.js/dist/svg.node.cjs.map new file mode 100644 index 0000000..343e017 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/dist/svg.node.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"svg.node.cjs","sources":["../src/utils/methods.js","../src/utils/utils.js","../src/modules/core/namespaces.js","../src/utils/window.js","../src/types/Base.js","../src/utils/adopter.js","../src/modules/optional/arrange.js","../src/modules/core/regex.js","../src/modules/optional/class.js","../src/modules/optional/css.js","../src/modules/optional/data.js","../src/modules/optional/memory.js","../src/types/Color.js","../src/types/Point.js","../src/types/Matrix.js","../src/modules/core/parser.js","../src/types/Box.js","../src/types/List.js","../src/modules/core/selector.js","../src/modules/core/event.js","../src/types/EventTarget.js","../src/modules/core/defaults.js","../src/types/SVGArray.js","../src/types/SVGNumber.js","../src/modules/core/attr.js","../src/elements/Dom.js","../src/elements/Element.js","../src/modules/optional/sugar.js","../src/modules/optional/transform.js","../src/elements/Container.js","../src/elements/Defs.js","../src/elements/Shape.js","../src/modules/core/circled.js","../src/elements/Ellipse.js","../src/elements/Fragment.js","../src/modules/core/gradiented.js","../src/elements/Gradient.js","../src/elements/Pattern.js","../src/elements/Image.js","../src/types/PointArray.js","../src/modules/core/pointed.js","../src/elements/Line.js","../src/elements/Marker.js","../src/animation/Controller.js","../src/utils/pathParser.js","../src/types/PathArray.js","../src/animation/Morphable.js","../src/elements/Path.js","../src/modules/core/poly.js","../src/elements/Polygon.js","../src/elements/Polyline.js","../src/elements/Rect.js","../src/animation/Queue.js","../src/animation/Animator.js","../src/animation/Timeline.js","../src/animation/Runner.js","../src/elements/Svg.js","../src/elements/Symbol.js","../src/modules/core/textable.js","../src/elements/Text.js","../src/elements/Tspan.js","../src/elements/Circle.js","../src/elements/ClipPath.js","../src/elements/ForeignObject.js","../src/modules/core/containerGeometry.js","../src/elements/G.js","../src/elements/A.js","../src/elements/Mask.js","../src/elements/Stop.js","../src/elements/Style.js","../src/elements/TextPath.js","../src/elements/Use.js","../src/main.js"],"sourcesContent":["const methods = {}\nconst names = []\n\nexport function registerMethods(name, m) {\n if (Array.isArray(name)) {\n for (const _name of name) {\n registerMethods(_name, m)\n }\n return\n }\n\n if (typeof name === 'object') {\n for (const _name in name) {\n registerMethods(_name, name[_name])\n }\n return\n }\n\n addMethodNames(Object.getOwnPropertyNames(m))\n methods[name] = Object.assign(methods[name] || {}, m)\n}\n\nexport function getMethodsFor(name) {\n return methods[name] || {}\n}\n\nexport function getMethodNames() {\n return [...new Set(names)]\n}\n\nexport function addMethodNames(_names) {\n names.push(..._names)\n}\n","// Map function\nexport function map(array, block) {\n let i\n const il = array.length\n const result = []\n\n for (i = 0; i < il; i++) {\n result.push(block(array[i]))\n }\n\n return result\n}\n\n// Filter function\nexport function filter(array, block) {\n let i\n const il = array.length\n const result = []\n\n for (i = 0; i < il; i++) {\n if (block(array[i])) {\n result.push(array[i])\n }\n }\n\n return result\n}\n\n// Degrees to radians\nexport function radians(d) {\n return ((d % 360) * Math.PI) / 180\n}\n\n// Radians to degrees\nexport function degrees(r) {\n return ((r * 180) / Math.PI) % 360\n}\n\n// Convert camel cased string to dash separated\nexport function unCamelCase(s) {\n return s.replace(/([A-Z])/g, function (m, g) {\n return '-' + g.toLowerCase()\n })\n}\n\n// Capitalize first letter of a string\nexport function capitalize(s) {\n return s.charAt(0).toUpperCase() + s.slice(1)\n}\n\n// Calculate proportional width and height values when necessary\nexport function proportionalSize(element, width, height, box) {\n if (width == null || height == null) {\n box = box || element.bbox()\n\n if (width == null) {\n width = (box.width / box.height) * height\n } else if (height == null) {\n height = (box.height / box.width) * width\n }\n }\n\n return {\n width: width,\n height: height\n }\n}\n\n/**\n * This function adds support for string origins.\n * It searches for an origin in o.origin o.ox and o.originX.\n * This way, origin: {x: 'center', y: 50} can be passed as well as ox: 'center', oy: 50\n **/\nexport function getOrigin(o, element) {\n const origin = o.origin\n // First check if origin is in ox or originX\n let ox = o.ox != null ? o.ox : o.originX != null ? o.originX : 'center'\n let oy = o.oy != null ? o.oy : o.originY != null ? o.originY : 'center'\n\n // Then check if origin was used and overwrite in that case\n if (origin != null) {\n ;[ox, oy] = Array.isArray(origin)\n ? origin\n : typeof origin === 'object'\n ? [origin.x, origin.y]\n : [origin, origin]\n }\n\n // Make sure to only call bbox when actually needed\n const condX = typeof ox === 'string'\n const condY = typeof oy === 'string'\n if (condX || condY) {\n const { height, width, x, y } = element.bbox()\n\n // And only overwrite if string was passed for this specific axis\n if (condX) {\n ox = ox.includes('left')\n ? x\n : ox.includes('right')\n ? x + width\n : x + width / 2\n }\n\n if (condY) {\n oy = oy.includes('top')\n ? y\n : oy.includes('bottom')\n ? y + height\n : y + height / 2\n }\n }\n\n // Return the origin as it is if it wasn't a string\n return [ox, oy]\n}\n\nconst descriptiveElements = new Set(['desc', 'metadata', 'title'])\nexport const isDescriptive = (element) =>\n descriptiveElements.has(element.nodeName)\n\nexport const writeDataToDom = (element, data, defaults = {}) => {\n const cloned = { ...data }\n\n for (const key in cloned) {\n if (cloned[key].valueOf() === defaults[key]) {\n delete cloned[key]\n }\n }\n\n if (Object.keys(cloned).length) {\n element.node.setAttribute('data-svgjs', JSON.stringify(cloned)) // see #428\n } else {\n element.node.removeAttribute('data-svgjs')\n element.node.removeAttribute('svgjs:data')\n }\n}\n","// Default namespaces\nexport const svg = 'http://www.w3.org/2000/svg'\nexport const html = 'http://www.w3.org/1999/xhtml'\nexport const xmlns = 'http://www.w3.org/2000/xmlns/'\nexport const xlink = 'http://www.w3.org/1999/xlink'\n","export const globals = {\n window: typeof window === 'undefined' ? null : window,\n document: typeof document === 'undefined' ? null : document\n}\n\nexport function registerWindow(win = null, doc = null) {\n globals.window = win\n globals.document = doc\n}\n\nconst save = {}\n\nexport function saveWindow() {\n save.window = globals.window\n save.document = globals.document\n}\n\nexport function restoreWindow() {\n globals.window = save.window\n globals.document = save.document\n}\n\nexport function withWindow(win, fn) {\n saveWindow()\n registerWindow(win, win.document)\n fn(win, win.document)\n restoreWindow()\n}\n\nexport function getWindow() {\n return globals.window\n}\n","export default class Base {\n // constructor (node/*, {extensions = []} */) {\n // // this.tags = []\n // //\n // // for (let extension of extensions) {\n // // extension.setup.call(this, node)\n // // this.tags.push(extension.name)\n // // }\n // }\n}\n","import { addMethodNames } from './methods.js'\nimport { capitalize } from './utils.js'\nimport { svg } from '../modules/core/namespaces.js'\nimport { globals } from '../utils/window.js'\nimport Base from '../types/Base.js'\n\nconst elements = {}\nexport const root = '___SYMBOL___ROOT___'\n\n// Method for element creation\nexport function create(name, ns = svg) {\n // create element\n return globals.document.createElementNS(ns, name)\n}\n\nexport function makeInstance(element, isHTML = false) {\n if (element instanceof Base) return element\n\n if (typeof element === 'object') {\n return adopter(element)\n }\n\n if (element == null) {\n return new elements[root]()\n }\n\n if (typeof element === 'string' && element.charAt(0) !== '<') {\n return adopter(globals.document.querySelector(element))\n }\n\n // Make sure, that HTML elements are created with the correct namespace\n const wrapper = isHTML ? globals.document.createElement('div') : create('svg')\n wrapper.innerHTML = element\n\n // We can use firstChild here because we know,\n // that the first char is < and thus an element\n element = adopter(wrapper.firstChild)\n\n // make sure, that element doesn't have its wrapper attached\n wrapper.removeChild(wrapper.firstChild)\n return element\n}\n\nexport function nodeOrNew(name, node) {\n return node &&\n (node instanceof globals.window.Node ||\n (node.ownerDocument &&\n node instanceof node.ownerDocument.defaultView.Node))\n ? node\n : create(name)\n}\n\n// Adopt existing svg elements\nexport function adopt(node) {\n // check for presence of node\n if (!node) return null\n\n // make sure a node isn't already adopted\n if (node.instance instanceof Base) return node.instance\n\n if (node.nodeName === '#document-fragment') {\n return new elements.Fragment(node)\n }\n\n // initialize variables\n let className = capitalize(node.nodeName || 'Dom')\n\n // Make sure that gradients are adopted correctly\n if (className === 'LinearGradient' || className === 'RadialGradient') {\n className = 'Gradient'\n\n // Fallback to Dom if element is not known\n } else if (!elements[className]) {\n className = 'Dom'\n }\n\n return new elements[className](node)\n}\n\nlet adopter = adopt\n\nexport function mockAdopt(mock = adopt) {\n adopter = mock\n}\n\nexport function register(element, name = element.name, asRoot = false) {\n elements[name] = element\n if (asRoot) elements[root] = element\n\n addMethodNames(Object.getOwnPropertyNames(element.prototype))\n\n return element\n}\n\nexport function getClass(name) {\n return elements[name]\n}\n\n// Element id sequence\nlet did = 1000\n\n// Get next named element id\nexport function eid(name) {\n return 'Svgjs' + capitalize(name) + did++\n}\n\n// Deep new id assignment\nexport function assignNewId(node) {\n // do the same for SVG child nodes as well\n for (let i = node.children.length - 1; i >= 0; i--) {\n assignNewId(node.children[i])\n }\n\n if (node.id) {\n node.id = eid(node.nodeName)\n return node\n }\n\n return node\n}\n\n// Method for extending objects\nexport function extend(modules, methods) {\n let key, i\n\n modules = Array.isArray(modules) ? modules : [modules]\n\n for (i = modules.length - 1; i >= 0; i--) {\n for (key in methods) {\n modules[i].prototype[key] = methods[key]\n }\n }\n}\n\nexport function wrapWithAttrCheck(fn) {\n return function (...args) {\n const o = args[args.length - 1]\n\n if (o && o.constructor === Object && !(o instanceof Array)) {\n return fn.apply(this, args.slice(0, -1)).attr(o)\n } else {\n return fn.apply(this, args)\n }\n }\n}\n","import { makeInstance } from '../../utils/adopter.js'\nimport { registerMethods } from '../../utils/methods.js'\n\n// Get all siblings, including myself\nexport function siblings() {\n return this.parent().children()\n}\n\n// Get the current position siblings\nexport function position() {\n return this.parent().index(this)\n}\n\n// Get the next element (will return null if there is none)\nexport function next() {\n return this.siblings()[this.position() + 1]\n}\n\n// Get the next element (will return null if there is none)\nexport function prev() {\n return this.siblings()[this.position() - 1]\n}\n\n// Send given element one step forward\nexport function forward() {\n const i = this.position()\n const p = this.parent()\n\n // move node one step forward\n p.add(this.remove(), i + 1)\n\n return this\n}\n\n// Send given element one step backward\nexport function backward() {\n const i = this.position()\n const p = this.parent()\n\n p.add(this.remove(), i ? i - 1 : 0)\n\n return this\n}\n\n// Send given element all the way to the front\nexport function front() {\n const p = this.parent()\n\n // Move node forward\n p.add(this.remove())\n\n return this\n}\n\n// Send given element all the way to the back\nexport function back() {\n const p = this.parent()\n\n // Move node back\n p.add(this.remove(), 0)\n\n return this\n}\n\n// Inserts a given element before the targeted element\nexport function before(element) {\n element = makeInstance(element)\n element.remove()\n\n const i = this.position()\n\n this.parent().add(element, i)\n\n return this\n}\n\n// Inserts a given element after the targeted element\nexport function after(element) {\n element = makeInstance(element)\n element.remove()\n\n const i = this.position()\n\n this.parent().add(element, i + 1)\n\n return this\n}\n\nexport function insertBefore(element) {\n element = makeInstance(element)\n element.before(this)\n return this\n}\n\nexport function insertAfter(element) {\n element = makeInstance(element)\n element.after(this)\n return this\n}\n\nregisterMethods('Dom', {\n siblings,\n position,\n next,\n prev,\n forward,\n backward,\n front,\n back,\n before,\n after,\n insertBefore,\n insertAfter\n})\n","// Parse unit value\nexport const numberAndUnit =\n /^([+-]?(\\d+(\\.\\d*)?|\\.\\d+)(e[+-]?\\d+)?)([a-z%]*)$/i\n\n// Parse hex value\nexport const hex = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i\n\n// Parse rgb value\nexport const rgb = /rgb\\((\\d+),(\\d+),(\\d+)\\)/\n\n// Parse reference id\nexport const reference = /(#[a-z_][a-z0-9\\-_]*)/i\n\n// splits a transformation chain\nexport const transforms = /\\)\\s*,?\\s*/\n\n// Whitespace\nexport const whitespace = /\\s/g\n\n// Test hex value\nexport const isHex = /^#[a-f0-9]{3}$|^#[a-f0-9]{6}$/i\n\n// Test rgb value\nexport const isRgb = /^rgb\\(/\n\n// Test for blank string\nexport const isBlank = /^(\\s+)?$/\n\n// Test for numeric string\nexport const isNumber = /^[+-]?(\\d+(\\.\\d*)?|\\.\\d+)(e[+-]?\\d+)?$/i\n\n// Test for image url\nexport const isImage = /\\.(jpg|jpeg|png|gif|svg)(\\?[^=]+.*)?/i\n\n// split at whitespace and comma\nexport const delimiter = /[\\s,]+/\n\n// Test for path letter\nexport const isPathLetter = /[MLHVCSQTAZ]/i\n","import { delimiter } from '../core/regex.js'\nimport { registerMethods } from '../../utils/methods.js'\n\n// Return array of classes on the node\nexport function classes() {\n const attr = this.attr('class')\n return attr == null ? [] : attr.trim().split(delimiter)\n}\n\n// Return true if class exists on the node, false otherwise\nexport function hasClass(name) {\n return this.classes().indexOf(name) !== -1\n}\n\n// Add class to the node\nexport function addClass(name) {\n if (!this.hasClass(name)) {\n const array = this.classes()\n array.push(name)\n this.attr('class', array.join(' '))\n }\n\n return this\n}\n\n// Remove class from the node\nexport function removeClass(name) {\n if (this.hasClass(name)) {\n this.attr(\n 'class',\n this.classes()\n .filter(function (c) {\n return c !== name\n })\n .join(' ')\n )\n }\n\n return this\n}\n\n// Toggle the presence of a class on the node\nexport function toggleClass(name) {\n return this.hasClass(name) ? this.removeClass(name) : this.addClass(name)\n}\n\nregisterMethods('Dom', {\n classes,\n hasClass,\n addClass,\n removeClass,\n toggleClass\n})\n","import { isBlank } from '../core/regex.js'\nimport { registerMethods } from '../../utils/methods.js'\n\n// Dynamic style generator\nexport function css(style, val) {\n const ret = {}\n if (arguments.length === 0) {\n // get full style as object\n this.node.style.cssText\n .split(/\\s*;\\s*/)\n .filter(function (el) {\n return !!el.length\n })\n .forEach(function (el) {\n const t = el.split(/\\s*:\\s*/)\n ret[t[0]] = t[1]\n })\n return ret\n }\n\n if (arguments.length < 2) {\n // get style properties as array\n if (Array.isArray(style)) {\n for (const name of style) {\n const cased = name\n ret[name] = this.node.style.getPropertyValue(cased)\n }\n return ret\n }\n\n // get style for property\n if (typeof style === 'string') {\n return this.node.style.getPropertyValue(style)\n }\n\n // set styles in object\n if (typeof style === 'object') {\n for (const name in style) {\n // set empty string if null/undefined/'' was given\n this.node.style.setProperty(\n name,\n style[name] == null || isBlank.test(style[name]) ? '' : style[name]\n )\n }\n }\n }\n\n // set style for property\n if (arguments.length === 2) {\n this.node.style.setProperty(\n style,\n val == null || isBlank.test(val) ? '' : val\n )\n }\n\n return this\n}\n\n// Show element\nexport function show() {\n return this.css('display', '')\n}\n\n// Hide element\nexport function hide() {\n return this.css('display', 'none')\n}\n\n// Is element visible?\nexport function visible() {\n return this.css('display') !== 'none'\n}\n\nregisterMethods('Dom', {\n css,\n show,\n hide,\n visible\n})\n","import { registerMethods } from '../../utils/methods.js'\nimport { filter, map } from '../../utils/utils.js'\n\n// Store data values on svg nodes\nexport function data(a, v, r) {\n if (a == null) {\n // get an object of attributes\n return this.data(\n map(\n filter(\n this.node.attributes,\n (el) => el.nodeName.indexOf('data-') === 0\n ),\n (el) => el.nodeName.slice(5)\n )\n )\n } else if (a instanceof Array) {\n const data = {}\n for (const key of a) {\n data[key] = this.data(key)\n }\n return data\n } else if (typeof a === 'object') {\n for (v in a) {\n this.data(v, a[v])\n }\n } else if (arguments.length < 2) {\n try {\n return JSON.parse(this.attr('data-' + a))\n } catch (e) {\n return this.attr('data-' + a)\n }\n } else {\n this.attr(\n 'data-' + a,\n v === null\n ? null\n : r === true || typeof v === 'string' || typeof v === 'number'\n ? v\n : JSON.stringify(v)\n )\n }\n\n return this\n}\n\nregisterMethods('Dom', { data })\n","import { registerMethods } from '../../utils/methods.js'\n\n// Remember arbitrary data\nexport function remember(k, v) {\n // remember every item in an object individually\n if (typeof arguments[0] === 'object') {\n for (const key in k) {\n this.remember(key, k[key])\n }\n } else if (arguments.length === 1) {\n // retrieve memory\n return this.memory()[k]\n } else {\n // store memory\n this.memory()[k] = v\n }\n\n return this\n}\n\n// Erase a given memory\nexport function forget() {\n if (arguments.length === 0) {\n this._memory = {}\n } else {\n for (let i = arguments.length - 1; i >= 0; i--) {\n delete this.memory()[arguments[i]]\n }\n }\n return this\n}\n\n// This triggers creation of a new hidden class which is not performant\n// However, this function is not rarely used so it will not happen frequently\n// Return local memory object\nexport function memory() {\n return (this._memory = this._memory || {})\n}\n\nregisterMethods('Dom', { remember, forget, memory })\n","import { hex, isHex, isRgb, rgb, whitespace } from '../modules/core/regex.js'\n\nfunction sixDigitHex(hex) {\n return hex.length === 4\n ? [\n '#',\n hex.substring(1, 2),\n hex.substring(1, 2),\n hex.substring(2, 3),\n hex.substring(2, 3),\n hex.substring(3, 4),\n hex.substring(3, 4)\n ].join('')\n : hex\n}\n\nfunction componentHex(component) {\n const integer = Math.round(component)\n const bounded = Math.max(0, Math.min(255, integer))\n const hex = bounded.toString(16)\n return hex.length === 1 ? '0' + hex : hex\n}\n\nfunction is(object, space) {\n for (let i = space.length; i--; ) {\n if (object[space[i]] == null) {\n return false\n }\n }\n return true\n}\n\nfunction getParameters(a, b) {\n const params = is(a, 'rgb')\n ? { _a: a.r, _b: a.g, _c: a.b, _d: 0, space: 'rgb' }\n : is(a, 'xyz')\n ? { _a: a.x, _b: a.y, _c: a.z, _d: 0, space: 'xyz' }\n : is(a, 'hsl')\n ? { _a: a.h, _b: a.s, _c: a.l, _d: 0, space: 'hsl' }\n : is(a, 'lab')\n ? { _a: a.l, _b: a.a, _c: a.b, _d: 0, space: 'lab' }\n : is(a, 'lch')\n ? { _a: a.l, _b: a.c, _c: a.h, _d: 0, space: 'lch' }\n : is(a, 'cmyk')\n ? { _a: a.c, _b: a.m, _c: a.y, _d: a.k, space: 'cmyk' }\n : { _a: 0, _b: 0, _c: 0, space: 'rgb' }\n\n params.space = b || params.space\n return params\n}\n\nfunction cieSpace(space) {\n if (space === 'lab' || space === 'xyz' || space === 'lch') {\n return true\n } else {\n return false\n }\n}\n\nfunction hueToRgb(p, q, t) {\n if (t < 0) t += 1\n if (t > 1) t -= 1\n if (t < 1 / 6) return p + (q - p) * 6 * t\n if (t < 1 / 2) return q\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6\n return p\n}\n\nexport default class Color {\n constructor(...inputs) {\n this.init(...inputs)\n }\n\n // Test if given value is a color\n static isColor(color) {\n return (\n color && (color instanceof Color || this.isRgb(color) || this.test(color))\n )\n }\n\n // Test if given value is an rgb object\n static isRgb(color) {\n return (\n color &&\n typeof color.r === 'number' &&\n typeof color.g === 'number' &&\n typeof color.b === 'number'\n )\n }\n\n /*\n Generating random colors\n */\n static random(mode = 'vibrant', t) {\n // Get the math modules\n const { random, round, sin, PI: pi } = Math\n\n // Run the correct generator\n if (mode === 'vibrant') {\n const l = (81 - 57) * random() + 57\n const c = (83 - 45) * random() + 45\n const h = 360 * random()\n const color = new Color(l, c, h, 'lch')\n return color\n } else if (mode === 'sine') {\n t = t == null ? random() : t\n const r = round(80 * sin((2 * pi * t) / 0.5 + 0.01) + 150)\n const g = round(50 * sin((2 * pi * t) / 0.5 + 4.6) + 200)\n const b = round(100 * sin((2 * pi * t) / 0.5 + 2.3) + 150)\n const color = new Color(r, g, b)\n return color\n } else if (mode === 'pastel') {\n const l = (94 - 86) * random() + 86\n const c = (26 - 9) * random() + 9\n const h = 360 * random()\n const color = new Color(l, c, h, 'lch')\n return color\n } else if (mode === 'dark') {\n const l = 10 + 10 * random()\n const c = (125 - 75) * random() + 86\n const h = 360 * random()\n const color = new Color(l, c, h, 'lch')\n return color\n } else if (mode === 'rgb') {\n const r = 255 * random()\n const g = 255 * random()\n const b = 255 * random()\n const color = new Color(r, g, b)\n return color\n } else if (mode === 'lab') {\n const l = 100 * random()\n const a = 256 * random() - 128\n const b = 256 * random() - 128\n const color = new Color(l, a, b, 'lab')\n return color\n } else if (mode === 'grey') {\n const grey = 255 * random()\n const color = new Color(grey, grey, grey)\n return color\n } else {\n throw new Error('Unsupported random color mode')\n }\n }\n\n // Test if given value is a color string\n static test(color) {\n return typeof color === 'string' && (isHex.test(color) || isRgb.test(color))\n }\n\n cmyk() {\n // Get the rgb values for the current color\n const { _a, _b, _c } = this.rgb()\n const [r, g, b] = [_a, _b, _c].map((v) => v / 255)\n\n // Get the cmyk values in an unbounded format\n const k = Math.min(1 - r, 1 - g, 1 - b)\n\n if (k === 1) {\n // Catch the black case\n return new Color(0, 0, 0, 1, 'cmyk')\n }\n\n const c = (1 - r - k) / (1 - k)\n const m = (1 - g - k) / (1 - k)\n const y = (1 - b - k) / (1 - k)\n\n // Construct the new color\n const color = new Color(c, m, y, k, 'cmyk')\n return color\n }\n\n hsl() {\n // Get the rgb values\n const { _a, _b, _c } = this.rgb()\n const [r, g, b] = [_a, _b, _c].map((v) => v / 255)\n\n // Find the maximum and minimum values to get the lightness\n const max = Math.max(r, g, b)\n const min = Math.min(r, g, b)\n const l = (max + min) / 2\n\n // If the r, g, v values are identical then we are grey\n const isGrey = max === min\n\n // Calculate the hue and saturation\n const delta = max - min\n const s = isGrey\n ? 0\n : l > 0.5\n ? delta / (2 - max - min)\n : delta / (max + min)\n const h = isGrey\n ? 0\n : max === r\n ? ((g - b) / delta + (g < b ? 6 : 0)) / 6\n : max === g\n ? ((b - r) / delta + 2) / 6\n : max === b\n ? ((r - g) / delta + 4) / 6\n : 0\n\n // Construct and return the new color\n const color = new Color(360 * h, 100 * s, 100 * l, 'hsl')\n return color\n }\n\n init(a = 0, b = 0, c = 0, d = 0, space = 'rgb') {\n // This catches the case when a falsy value is passed like ''\n a = !a ? 0 : a\n\n // Reset all values in case the init function is rerun with new color space\n if (this.space) {\n for (const component in this.space) {\n delete this[this.space[component]]\n }\n }\n\n if (typeof a === 'number') {\n // Allow for the case that we don't need d...\n space = typeof d === 'string' ? d : space\n d = typeof d === 'string' ? 0 : d\n\n // Assign the values straight to the color\n Object.assign(this, { _a: a, _b: b, _c: c, _d: d, space })\n // If the user gave us an array, make the color from it\n } else if (a instanceof Array) {\n this.space = b || (typeof a[3] === 'string' ? a[3] : a[4]) || 'rgb'\n Object.assign(this, { _a: a[0], _b: a[1], _c: a[2], _d: a[3] || 0 })\n } else if (a instanceof Object) {\n // Set the object up and assign its values directly\n const values = getParameters(a, b)\n Object.assign(this, values)\n } else if (typeof a === 'string') {\n if (isRgb.test(a)) {\n const noWhitespace = a.replace(whitespace, '')\n const [_a, _b, _c] = rgb\n .exec(noWhitespace)\n .slice(1, 4)\n .map((v) => parseInt(v))\n Object.assign(this, { _a, _b, _c, _d: 0, space: 'rgb' })\n } else if (isHex.test(a)) {\n const hexParse = (v) => parseInt(v, 16)\n const [, _a, _b, _c] = hex.exec(sixDigitHex(a)).map(hexParse)\n Object.assign(this, { _a, _b, _c, _d: 0, space: 'rgb' })\n } else throw Error(\"Unsupported string format, can't construct Color\")\n }\n\n // Now add the components as a convenience\n const { _a, _b, _c, _d } = this\n const components =\n this.space === 'rgb'\n ? { r: _a, g: _b, b: _c }\n : this.space === 'xyz'\n ? { x: _a, y: _b, z: _c }\n : this.space === 'hsl'\n ? { h: _a, s: _b, l: _c }\n : this.space === 'lab'\n ? { l: _a, a: _b, b: _c }\n : this.space === 'lch'\n ? { l: _a, c: _b, h: _c }\n : this.space === 'cmyk'\n ? { c: _a, m: _b, y: _c, k: _d }\n : {}\n Object.assign(this, components)\n }\n\n lab() {\n // Get the xyz color\n const { x, y, z } = this.xyz()\n\n // Get the lab components\n const l = 116 * y - 16\n const a = 500 * (x - y)\n const b = 200 * (y - z)\n\n // Construct and return a new color\n const color = new Color(l, a, b, 'lab')\n return color\n }\n\n lch() {\n // Get the lab color directly\n const { l, a, b } = this.lab()\n\n // Get the chromaticity and the hue using polar coordinates\n const c = Math.sqrt(a ** 2 + b ** 2)\n let h = (180 * Math.atan2(b, a)) / Math.PI\n if (h < 0) {\n h *= -1\n h = 360 - h\n }\n\n // Make a new color and return it\n const color = new Color(l, c, h, 'lch')\n return color\n }\n /*\n Conversion Methods\n */\n\n rgb() {\n if (this.space === 'rgb') {\n return this\n } else if (cieSpace(this.space)) {\n // Convert to the xyz color space\n let { x, y, z } = this\n if (this.space === 'lab' || this.space === 'lch') {\n // Get the values in the lab space\n let { l, a, b } = this\n if (this.space === 'lch') {\n const { c, h } = this\n const dToR = Math.PI / 180\n a = c * Math.cos(dToR * h)\n b = c * Math.sin(dToR * h)\n }\n\n // Undo the nonlinear function\n const yL = (l + 16) / 116\n const xL = a / 500 + yL\n const zL = yL - b / 200\n\n // Get the xyz values\n const ct = 16 / 116\n const mx = 0.008856\n const nm = 7.787\n x = 0.95047 * (xL ** 3 > mx ? xL ** 3 : (xL - ct) / nm)\n y = 1.0 * (yL ** 3 > mx ? yL ** 3 : (yL - ct) / nm)\n z = 1.08883 * (zL ** 3 > mx ? zL ** 3 : (zL - ct) / nm)\n }\n\n // Convert xyz to unbounded rgb values\n const rU = x * 3.2406 + y * -1.5372 + z * -0.4986\n const gU = x * -0.9689 + y * 1.8758 + z * 0.0415\n const bU = x * 0.0557 + y * -0.204 + z * 1.057\n\n // Convert the values to true rgb values\n const pow = Math.pow\n const bd = 0.0031308\n const r = rU > bd ? 1.055 * pow(rU, 1 / 2.4) - 0.055 : 12.92 * rU\n const g = gU > bd ? 1.055 * pow(gU, 1 / 2.4) - 0.055 : 12.92 * gU\n const b = bU > bd ? 1.055 * pow(bU, 1 / 2.4) - 0.055 : 12.92 * bU\n\n // Make and return the color\n const color = new Color(255 * r, 255 * g, 255 * b)\n return color\n } else if (this.space === 'hsl') {\n // https://bgrins.github.io/TinyColor/docs/tinycolor.html\n // Get the current hsl values\n let { h, s, l } = this\n h /= 360\n s /= 100\n l /= 100\n\n // If we are grey, then just make the color directly\n if (s === 0) {\n l *= 255\n const color = new Color(l, l, l)\n return color\n }\n\n // TODO I have no idea what this does :D If you figure it out, tell me!\n const q = l < 0.5 ? l * (1 + s) : l + s - l * s\n const p = 2 * l - q\n\n // Get the rgb values\n const r = 255 * hueToRgb(p, q, h + 1 / 3)\n const g = 255 * hueToRgb(p, q, h)\n const b = 255 * hueToRgb(p, q, h - 1 / 3)\n\n // Make a new color\n const color = new Color(r, g, b)\n return color\n } else if (this.space === 'cmyk') {\n // https://gist.github.com/felipesabino/5066336\n // Get the normalised cmyk values\n const { c, m, y, k } = this\n\n // Get the rgb values\n const r = 255 * (1 - Math.min(1, c * (1 - k) + k))\n const g = 255 * (1 - Math.min(1, m * (1 - k) + k))\n const b = 255 * (1 - Math.min(1, y * (1 - k) + k))\n\n // Form the color and return it\n const color = new Color(r, g, b)\n return color\n } else {\n return this\n }\n }\n\n toArray() {\n const { _a, _b, _c, _d, space } = this\n return [_a, _b, _c, _d, space]\n }\n\n toHex() {\n const [r, g, b] = this._clamped().map(componentHex)\n return `#${r}${g}${b}`\n }\n\n toRgb() {\n const [rV, gV, bV] = this._clamped()\n const string = `rgb(${rV},${gV},${bV})`\n return string\n }\n\n toString() {\n return this.toHex()\n }\n\n xyz() {\n // Normalise the red, green and blue values\n const { _a: r255, _b: g255, _c: b255 } = this.rgb()\n const [r, g, b] = [r255, g255, b255].map((v) => v / 255)\n\n // Convert to the lab rgb space\n const rL = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92\n const gL = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92\n const bL = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92\n\n // Convert to the xyz color space without bounding the values\n const xU = (rL * 0.4124 + gL * 0.3576 + bL * 0.1805) / 0.95047\n const yU = (rL * 0.2126 + gL * 0.7152 + bL * 0.0722) / 1.0\n const zU = (rL * 0.0193 + gL * 0.1192 + bL * 0.9505) / 1.08883\n\n // Get the proper xyz values by applying the bounding\n const x = xU > 0.008856 ? Math.pow(xU, 1 / 3) : 7.787 * xU + 16 / 116\n const y = yU > 0.008856 ? Math.pow(yU, 1 / 3) : 7.787 * yU + 16 / 116\n const z = zU > 0.008856 ? Math.pow(zU, 1 / 3) : 7.787 * zU + 16 / 116\n\n // Make and return the color\n const color = new Color(x, y, z, 'xyz')\n return color\n }\n\n /*\n Input and Output methods\n */\n\n _clamped() {\n const { _a, _b, _c } = this.rgb()\n const { max, min, round } = Math\n const format = (v) => max(0, min(round(v), 255))\n return [_a, _b, _c].map(format)\n }\n\n /*\n Constructing colors\n */\n}\n","import Matrix from './Matrix.js'\n\nexport default class Point {\n // Initialize\n constructor(...args) {\n this.init(...args)\n }\n\n // Clone point\n clone() {\n return new Point(this)\n }\n\n init(x, y) {\n const base = { x: 0, y: 0 }\n\n // ensure source as object\n const source = Array.isArray(x)\n ? { x: x[0], y: x[1] }\n : typeof x === 'object'\n ? { x: x.x, y: x.y }\n : { x: x, y: y }\n\n // merge source\n this.x = source.x == null ? base.x : source.x\n this.y = source.y == null ? base.y : source.y\n\n return this\n }\n\n toArray() {\n return [this.x, this.y]\n }\n\n transform(m) {\n return this.clone().transformO(m)\n }\n\n // Transform point with matrix\n transformO(m) {\n if (!Matrix.isMatrixLike(m)) {\n m = new Matrix(m)\n }\n\n const { x, y } = this\n\n // Perform the matrix multiplication\n this.x = m.a * x + m.c * y + m.e\n this.y = m.b * x + m.d * y + m.f\n\n return this\n }\n}\n\nexport function point(x, y) {\n return new Point(x, y).transformO(this.screenCTM().inverseO())\n}\n","import { delimiter } from '../modules/core/regex.js'\nimport { radians } from '../utils/utils.js'\nimport { register } from '../utils/adopter.js'\nimport Element from '../elements/Element.js'\nimport Point from './Point.js'\n\nfunction closeEnough(a, b, threshold) {\n return Math.abs(b - a) < (threshold || 1e-6)\n}\n\nexport default class Matrix {\n constructor(...args) {\n this.init(...args)\n }\n\n static formatTransforms(o) {\n // Get all of the parameters required to form the matrix\n const flipBoth = o.flip === 'both' || o.flip === true\n const flipX = o.flip && (flipBoth || o.flip === 'x') ? -1 : 1\n const flipY = o.flip && (flipBoth || o.flip === 'y') ? -1 : 1\n const skewX =\n o.skew && o.skew.length\n ? o.skew[0]\n : isFinite(o.skew)\n ? o.skew\n : isFinite(o.skewX)\n ? o.skewX\n : 0\n const skewY =\n o.skew && o.skew.length\n ? o.skew[1]\n : isFinite(o.skew)\n ? o.skew\n : isFinite(o.skewY)\n ? o.skewY\n : 0\n const scaleX =\n o.scale && o.scale.length\n ? o.scale[0] * flipX\n : isFinite(o.scale)\n ? o.scale * flipX\n : isFinite(o.scaleX)\n ? o.scaleX * flipX\n : flipX\n const scaleY =\n o.scale && o.scale.length\n ? o.scale[1] * flipY\n : isFinite(o.scale)\n ? o.scale * flipY\n : isFinite(o.scaleY)\n ? o.scaleY * flipY\n : flipY\n const shear = o.shear || 0\n const theta = o.rotate || o.theta || 0\n const origin = new Point(\n o.origin || o.around || o.ox || o.originX,\n o.oy || o.originY\n )\n const ox = origin.x\n const oy = origin.y\n // We need Point to be invalid if nothing was passed because we cannot default to 0 here. That is why NaN\n const position = new Point(\n o.position || o.px || o.positionX || NaN,\n o.py || o.positionY || NaN\n )\n const px = position.x\n const py = position.y\n const translate = new Point(\n o.translate || o.tx || o.translateX,\n o.ty || o.translateY\n )\n const tx = translate.x\n const ty = translate.y\n const relative = new Point(\n o.relative || o.rx || o.relativeX,\n o.ry || o.relativeY\n )\n const rx = relative.x\n const ry = relative.y\n\n // Populate all of the values\n return {\n scaleX,\n scaleY,\n skewX,\n skewY,\n shear,\n theta,\n rx,\n ry,\n tx,\n ty,\n ox,\n oy,\n px,\n py\n }\n }\n\n static fromArray(a) {\n return { a: a[0], b: a[1], c: a[2], d: a[3], e: a[4], f: a[5] }\n }\n\n static isMatrixLike(o) {\n return (\n o.a != null ||\n o.b != null ||\n o.c != null ||\n o.d != null ||\n o.e != null ||\n o.f != null\n )\n }\n\n // left matrix, right matrix, target matrix which is overwritten\n static matrixMultiply(l, r, o) {\n // Work out the product directly\n const a = l.a * r.a + l.c * r.b\n const b = l.b * r.a + l.d * r.b\n const c = l.a * r.c + l.c * r.d\n const d = l.b * r.c + l.d * r.d\n const e = l.e + l.a * r.e + l.c * r.f\n const f = l.f + l.b * r.e + l.d * r.f\n\n // make sure to use local variables because l/r and o could be the same\n o.a = a\n o.b = b\n o.c = c\n o.d = d\n o.e = e\n o.f = f\n\n return o\n }\n\n around(cx, cy, matrix) {\n return this.clone().aroundO(cx, cy, matrix)\n }\n\n // Transform around a center point\n aroundO(cx, cy, matrix) {\n const dx = cx || 0\n const dy = cy || 0\n return this.translateO(-dx, -dy).lmultiplyO(matrix).translateO(dx, dy)\n }\n\n // Clones this matrix\n clone() {\n return new Matrix(this)\n }\n\n // Decomposes this matrix into its affine parameters\n decompose(cx = 0, cy = 0) {\n // Get the parameters from the matrix\n const a = this.a\n const b = this.b\n const c = this.c\n const d = this.d\n const e = this.e\n const f = this.f\n\n // Figure out if the winding direction is clockwise or counterclockwise\n const determinant = a * d - b * c\n const ccw = determinant > 0 ? 1 : -1\n\n // Since we only shear in x, we can use the x basis to get the x scale\n // and the rotation of the resulting matrix\n const sx = ccw * Math.sqrt(a * a + b * b)\n const thetaRad = Math.atan2(ccw * b, ccw * a)\n const theta = (180 / Math.PI) * thetaRad\n const ct = Math.cos(thetaRad)\n const st = Math.sin(thetaRad)\n\n // We can then solve the y basis vector simultaneously to get the other\n // two affine parameters directly from these parameters\n const lam = (a * c + b * d) / determinant\n const sy = (c * sx) / (lam * a - b) || (d * sx) / (lam * b + a)\n\n // Use the translations\n const tx = e - cx + cx * ct * sx + cy * (lam * ct * sx - st * sy)\n const ty = f - cy + cx * st * sx + cy * (lam * st * sx + ct * sy)\n\n // Construct the decomposition and return it\n return {\n // Return the affine parameters\n scaleX: sx,\n scaleY: sy,\n shear: lam,\n rotate: theta,\n translateX: tx,\n translateY: ty,\n originX: cx,\n originY: cy,\n\n // Return the matrix parameters\n a: this.a,\n b: this.b,\n c: this.c,\n d: this.d,\n e: this.e,\n f: this.f\n }\n }\n\n // Check if two matrices are equal\n equals(other) {\n if (other === this) return true\n const comp = new Matrix(other)\n return (\n closeEnough(this.a, comp.a) &&\n closeEnough(this.b, comp.b) &&\n closeEnough(this.c, comp.c) &&\n closeEnough(this.d, comp.d) &&\n closeEnough(this.e, comp.e) &&\n closeEnough(this.f, comp.f)\n )\n }\n\n // Flip matrix on x or y, at a given offset\n flip(axis, around) {\n return this.clone().flipO(axis, around)\n }\n\n flipO(axis, around) {\n return axis === 'x'\n ? this.scaleO(-1, 1, around, 0)\n : axis === 'y'\n ? this.scaleO(1, -1, 0, around)\n : this.scaleO(-1, -1, axis, around || axis) // Define an x, y flip point\n }\n\n // Initialize\n init(source) {\n const base = Matrix.fromArray([1, 0, 0, 1, 0, 0])\n\n // ensure source as object\n source =\n source instanceof Element\n ? source.matrixify()\n : typeof source === 'string'\n ? Matrix.fromArray(source.split(delimiter).map(parseFloat))\n : Array.isArray(source)\n ? Matrix.fromArray(source)\n : typeof source === 'object' && Matrix.isMatrixLike(source)\n ? source\n : typeof source === 'object'\n ? new Matrix().transform(source)\n : arguments.length === 6\n ? Matrix.fromArray([].slice.call(arguments))\n : base\n\n // Merge the source matrix with the base matrix\n this.a = source.a != null ? source.a : base.a\n this.b = source.b != null ? source.b : base.b\n this.c = source.c != null ? source.c : base.c\n this.d = source.d != null ? source.d : base.d\n this.e = source.e != null ? source.e : base.e\n this.f = source.f != null ? source.f : base.f\n\n return this\n }\n\n inverse() {\n return this.clone().inverseO()\n }\n\n // Inverses matrix\n inverseO() {\n // Get the current parameters out of the matrix\n const a = this.a\n const b = this.b\n const c = this.c\n const d = this.d\n const e = this.e\n const f = this.f\n\n // Invert the 2x2 matrix in the top left\n const det = a * d - b * c\n if (!det) throw new Error('Cannot invert ' + this)\n\n // Calculate the top 2x2 matrix\n const na = d / det\n const nb = -b / det\n const nc = -c / det\n const nd = a / det\n\n // Apply the inverted matrix to the top right\n const ne = -(na * e + nc * f)\n const nf = -(nb * e + nd * f)\n\n // Construct the inverted matrix\n this.a = na\n this.b = nb\n this.c = nc\n this.d = nd\n this.e = ne\n this.f = nf\n\n return this\n }\n\n lmultiply(matrix) {\n return this.clone().lmultiplyO(matrix)\n }\n\n lmultiplyO(matrix) {\n const r = this\n const l = matrix instanceof Matrix ? matrix : new Matrix(matrix)\n\n return Matrix.matrixMultiply(l, r, this)\n }\n\n // Left multiplies by the given matrix\n multiply(matrix) {\n return this.clone().multiplyO(matrix)\n }\n\n multiplyO(matrix) {\n // Get the matrices\n const l = this\n const r = matrix instanceof Matrix ? matrix : new Matrix(matrix)\n\n return Matrix.matrixMultiply(l, r, this)\n }\n\n // Rotate matrix\n rotate(r, cx, cy) {\n return this.clone().rotateO(r, cx, cy)\n }\n\n rotateO(r, cx = 0, cy = 0) {\n // Convert degrees to radians\n r = radians(r)\n\n const cos = Math.cos(r)\n const sin = Math.sin(r)\n\n const { a, b, c, d, e, f } = this\n\n this.a = a * cos - b * sin\n this.b = b * cos + a * sin\n this.c = c * cos - d * sin\n this.d = d * cos + c * sin\n this.e = e * cos - f * sin + cy * sin - cx * cos + cx\n this.f = f * cos + e * sin - cx * sin - cy * cos + cy\n\n return this\n }\n\n // Scale matrix\n scale() {\n return this.clone().scaleO(...arguments)\n }\n\n scaleO(x, y = x, cx = 0, cy = 0) {\n // Support uniform scaling\n if (arguments.length === 3) {\n cy = cx\n cx = y\n y = x\n }\n\n const { a, b, c, d, e, f } = this\n\n this.a = a * x\n this.b = b * y\n this.c = c * x\n this.d = d * y\n this.e = e * x - cx * x + cx\n this.f = f * y - cy * y + cy\n\n return this\n }\n\n // Shear matrix\n shear(a, cx, cy) {\n return this.clone().shearO(a, cx, cy)\n }\n\n // eslint-disable-next-line no-unused-vars\n shearO(lx, cx = 0, cy = 0) {\n const { a, b, c, d, e, f } = this\n\n this.a = a + b * lx\n this.c = c + d * lx\n this.e = e + f * lx - cy * lx\n\n return this\n }\n\n // Skew Matrix\n skew() {\n return this.clone().skewO(...arguments)\n }\n\n skewO(x, y = x, cx = 0, cy = 0) {\n // support uniformal skew\n if (arguments.length === 3) {\n cy = cx\n cx = y\n y = x\n }\n\n // Convert degrees to radians\n x = radians(x)\n y = radians(y)\n\n const lx = Math.tan(x)\n const ly = Math.tan(y)\n\n const { a, b, c, d, e, f } = this\n\n this.a = a + b * lx\n this.b = b + a * ly\n this.c = c + d * lx\n this.d = d + c * ly\n this.e = e + f * lx - cy * lx\n this.f = f + e * ly - cx * ly\n\n return this\n }\n\n // SkewX\n skewX(x, cx, cy) {\n return this.skew(x, 0, cx, cy)\n }\n\n // SkewY\n skewY(y, cx, cy) {\n return this.skew(0, y, cx, cy)\n }\n\n toArray() {\n return [this.a, this.b, this.c, this.d, this.e, this.f]\n }\n\n // Convert matrix to string\n toString() {\n return (\n 'matrix(' +\n this.a +\n ',' +\n this.b +\n ',' +\n this.c +\n ',' +\n this.d +\n ',' +\n this.e +\n ',' +\n this.f +\n ')'\n )\n }\n\n // Transform a matrix into another matrix by manipulating the space\n transform(o) {\n // Check if o is a matrix and then left multiply it directly\n if (Matrix.isMatrixLike(o)) {\n const matrix = new Matrix(o)\n return matrix.multiplyO(this)\n }\n\n // Get the proposed transformations and the current transformations\n const t = Matrix.formatTransforms(o)\n const current = this\n const { x: ox, y: oy } = new Point(t.ox, t.oy).transform(current)\n\n // Construct the resulting matrix\n const transformer = new Matrix()\n .translateO(t.rx, t.ry)\n .lmultiplyO(current)\n .translateO(-ox, -oy)\n .scaleO(t.scaleX, t.scaleY)\n .skewO(t.skewX, t.skewY)\n .shearO(t.shear)\n .rotateO(t.theta)\n .translateO(ox, oy)\n\n // If we want the origin at a particular place, we force it there\n if (isFinite(t.px) || isFinite(t.py)) {\n const origin = new Point(ox, oy).transform(transformer)\n // TODO: Replace t.px with isFinite(t.px)\n // Doesn't work because t.px is also 0 if it wasn't passed\n const dx = isFinite(t.px) ? t.px - origin.x : 0\n const dy = isFinite(t.py) ? t.py - origin.y : 0\n transformer.translateO(dx, dy)\n }\n\n // Translate now after positioning\n transformer.translateO(t.tx, t.ty)\n return transformer\n }\n\n // Translate matrix\n translate(x, y) {\n return this.clone().translateO(x, y)\n }\n\n translateO(x, y) {\n this.e += x || 0\n this.f += y || 0\n return this\n }\n\n valueOf() {\n return {\n a: this.a,\n b: this.b,\n c: this.c,\n d: this.d,\n e: this.e,\n f: this.f\n }\n }\n}\n\nexport function ctm() {\n return new Matrix(this.node.getCTM())\n}\n\nexport function screenCTM() {\n try {\n /* https://bugzilla.mozilla.org/show_bug.cgi?id=1344537\n This is needed because FF does not return the transformation matrix\n for the inner coordinate system when getScreenCTM() is called on nested svgs.\n However all other Browsers do that */\n if (typeof this.isRoot === 'function' && !this.isRoot()) {\n const rect = this.rect(1, 1)\n const m = rect.node.getScreenCTM()\n rect.remove()\n return new Matrix(m)\n }\n return new Matrix(this.node.getScreenCTM())\n } catch (e) {\n console.warn(\n `Cannot get CTM from SVG node ${this.node.nodeName}. Is the element rendered?`\n )\n return new Matrix()\n }\n}\n\nregister(Matrix, 'Matrix')\n","import { globals } from '../../utils/window.js'\nimport { makeInstance } from '../../utils/adopter.js'\n\nexport default function parser() {\n // Reuse cached element if possible\n if (!parser.nodes) {\n const svg = makeInstance().size(2, 0)\n svg.node.style.cssText = [\n 'opacity: 0',\n 'position: absolute',\n 'left: -100%',\n 'top: -100%',\n 'overflow: hidden'\n ].join(';')\n\n svg.attr('focusable', 'false')\n svg.attr('aria-hidden', 'true')\n\n const path = svg.path().node\n\n parser.nodes = { svg, path }\n }\n\n if (!parser.nodes.svg.node.parentNode) {\n const b = globals.document.body || globals.document.documentElement\n parser.nodes.svg.addTo(b)\n }\n\n return parser.nodes\n}\n","import { delimiter } from '../modules/core/regex.js'\nimport { globals } from '../utils/window.js'\nimport { register } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Matrix from './Matrix.js'\nimport Point from './Point.js'\nimport parser from '../modules/core/parser.js'\n\nexport function isNulledBox(box) {\n return !box.width && !box.height && !box.x && !box.y\n}\n\nexport function domContains(node) {\n return (\n node === globals.document ||\n (\n globals.document.documentElement.contains ||\n function (node) {\n // This is IE - it does not support contains() for top-level SVGs\n while (node.parentNode) {\n node = node.parentNode\n }\n return node === globals.document\n }\n ).call(globals.document.documentElement, node)\n )\n}\n\nexport default class Box {\n constructor(...args) {\n this.init(...args)\n }\n\n addOffset() {\n // offset by window scroll position, because getBoundingClientRect changes when window is scrolled\n this.x += globals.window.pageXOffset\n this.y += globals.window.pageYOffset\n return new Box(this)\n }\n\n init(source) {\n const base = [0, 0, 0, 0]\n source =\n typeof source === 'string'\n ? source.split(delimiter).map(parseFloat)\n : Array.isArray(source)\n ? source\n : typeof source === 'object'\n ? [\n source.left != null ? source.left : source.x,\n source.top != null ? source.top : source.y,\n source.width,\n source.height\n ]\n : arguments.length === 4\n ? [].slice.call(arguments)\n : base\n\n this.x = source[0] || 0\n this.y = source[1] || 0\n this.width = this.w = source[2] || 0\n this.height = this.h = source[3] || 0\n\n // Add more bounding box properties\n this.x2 = this.x + this.w\n this.y2 = this.y + this.h\n this.cx = this.x + this.w / 2\n this.cy = this.y + this.h / 2\n\n return this\n }\n\n isNulled() {\n return isNulledBox(this)\n }\n\n // Merge rect box with another, return a new instance\n merge(box) {\n const x = Math.min(this.x, box.x)\n const y = Math.min(this.y, box.y)\n const width = Math.max(this.x + this.width, box.x + box.width) - x\n const height = Math.max(this.y + this.height, box.y + box.height) - y\n\n return new Box(x, y, width, height)\n }\n\n toArray() {\n return [this.x, this.y, this.width, this.height]\n }\n\n toString() {\n return this.x + ' ' + this.y + ' ' + this.width + ' ' + this.height\n }\n\n transform(m) {\n if (!(m instanceof Matrix)) {\n m = new Matrix(m)\n }\n\n let xMin = Infinity\n let xMax = -Infinity\n let yMin = Infinity\n let yMax = -Infinity\n\n const pts = [\n new Point(this.x, this.y),\n new Point(this.x2, this.y),\n new Point(this.x, this.y2),\n new Point(this.x2, this.y2)\n ]\n\n pts.forEach(function (p) {\n p = p.transform(m)\n xMin = Math.min(xMin, p.x)\n xMax = Math.max(xMax, p.x)\n yMin = Math.min(yMin, p.y)\n yMax = Math.max(yMax, p.y)\n })\n\n return new Box(xMin, yMin, xMax - xMin, yMax - yMin)\n }\n}\n\nfunction getBox(el, getBBoxFn, retry) {\n let box\n\n try {\n // Try to get the box with the provided function\n box = getBBoxFn(el.node)\n\n // If the box is worthless and not even in the dom, retry\n // by throwing an error here...\n if (isNulledBox(box) && !domContains(el.node)) {\n throw new Error('Element not in the dom')\n }\n } catch (e) {\n // ... and calling the retry handler here\n box = retry(el)\n }\n\n return box\n}\n\nexport function bbox() {\n // Function to get bbox is getBBox()\n const getBBox = (node) => node.getBBox()\n\n // Take all measures so that a stupid browser renders the element\n // so we can get the bbox from it when we try again\n const retry = (el) => {\n try {\n const clone = el.clone().addTo(parser().svg).show()\n const box = clone.node.getBBox()\n clone.remove()\n return box\n } catch (e) {\n // We give up...\n throw new Error(\n `Getting bbox of element \"${\n el.node.nodeName\n }\" is not possible: ${e.toString()}`\n )\n }\n }\n\n const box = getBox(this, getBBox, retry)\n const bbox = new Box(box)\n\n return bbox\n}\n\nexport function rbox(el) {\n const getRBox = (node) => node.getBoundingClientRect()\n const retry = (el) => {\n // There is no point in trying tricks here because if we insert the element into the dom ourselves\n // it obviously will be at the wrong position\n throw new Error(\n `Getting rbox of element \"${el.node.nodeName}\" is not possible`\n )\n }\n\n const box = getBox(this, getRBox, retry)\n const rbox = new Box(box)\n\n // If an element was passed, we want the bbox in the coordinate system of that element\n if (el) {\n return rbox.transform(el.screenCTM().inverseO())\n }\n\n // Else we want it in absolute screen coordinates\n // Therefore we need to add the scrollOffset\n return rbox.addOffset()\n}\n\n// Checks whether the given point is inside the bounding box\nexport function inside(x, y) {\n const box = this.bbox()\n\n return (\n x > box.x && y > box.y && x < box.x + box.width && y < box.y + box.height\n )\n}\n\nregisterMethods({\n viewbox: {\n viewbox(x, y, width, height) {\n // act as getter\n if (x == null) return new Box(this.attr('viewBox'))\n\n // act as setter\n return this.attr('viewBox', new Box(x, y, width, height))\n },\n\n zoom(level, point) {\n // Its best to rely on the attributes here and here is why:\n // clientXYZ: Doesn't work on non-root svgs because they dont have a CSSBox (silly!)\n // getBoundingClientRect: Doesn't work because Chrome just ignores width and height of nested svgs completely\n // that means, their clientRect is always as big as the content.\n // Furthermore this size is incorrect if the element is further transformed by its parents\n // computedStyle: Only returns meaningful values if css was used with px. We dont go this route here!\n // getBBox: returns the bounding box of its content - that doesn't help!\n let { width, height } = this.attr(['width', 'height'])\n\n // Width and height is a string when a number with a unit is present which we can't use\n // So we try clientXYZ\n if (\n (!width && !height) ||\n typeof width === 'string' ||\n typeof height === 'string'\n ) {\n width = this.node.clientWidth\n height = this.node.clientHeight\n }\n\n // Giving up...\n if (!width || !height) {\n throw new Error(\n 'Impossible to get absolute width and height. Please provide an absolute width and height attribute on the zooming element'\n )\n }\n\n const v = this.viewbox()\n\n const zoomX = width / v.width\n const zoomY = height / v.height\n const zoom = Math.min(zoomX, zoomY)\n\n if (level == null) {\n return zoom\n }\n\n let zoomAmount = zoom / level\n\n // Set the zoomAmount to the highest value which is safe to process and recover from\n // The * 100 is a bit of wiggle room for the matrix transformation\n if (zoomAmount === Infinity) zoomAmount = Number.MAX_SAFE_INTEGER / 100\n\n point =\n point || new Point(width / 2 / zoomX + v.x, height / 2 / zoomY + v.y)\n\n const box = new Box(v).transform(\n new Matrix({ scale: zoomAmount, origin: point })\n )\n\n return this.viewbox(box)\n }\n }\n})\n\nregister(Box, 'Box')\n","import { extend } from '../utils/adopter.js'\n// import { subClassArray } from './ArrayPolyfill.js'\n\nclass List extends Array {\n constructor(arr = [], ...args) {\n super(arr, ...args)\n if (typeof arr === 'number') return this\n this.length = 0\n this.push(...arr)\n }\n}\n\n/* = subClassArray('List', Array, function (arr = []) {\n // This catches the case, that native map tries to create an array with new Array(1)\n if (typeof arr === 'number') return this\n this.length = 0\n this.push(...arr)\n}) */\n\nexport default List\n\nextend([List], {\n each(fnOrMethodName, ...args) {\n if (typeof fnOrMethodName === 'function') {\n return this.map((el, i, arr) => {\n return fnOrMethodName.call(el, el, i, arr)\n })\n } else {\n return this.map((el) => {\n return el[fnOrMethodName](...args)\n })\n }\n },\n\n toArray() {\n return Array.prototype.concat.apply([], this)\n }\n})\n\nconst reserved = ['toArray', 'constructor', 'each']\n\nList.extend = function (methods) {\n methods = methods.reduce((obj, name) => {\n // Don't overwrite own methods\n if (reserved.includes(name)) return obj\n\n // Don't add private methods\n if (name[0] === '_') return obj\n\n // Allow access to original Array methods through a prefix\n if (name in Array.prototype) {\n obj['$' + name] = Array.prototype[name]\n }\n\n // Relay every call to each()\n obj[name] = function (...attrs) {\n return this.each(name, ...attrs)\n }\n return obj\n }, {})\n\n extend([List], methods)\n}\n","import { adopt } from '../../utils/adopter.js'\nimport { globals } from '../../utils/window.js'\nimport { map } from '../../utils/utils.js'\nimport List from '../../types/List.js'\n\nexport default function baseFind(query, parent) {\n return new List(\n map((parent || globals.document).querySelectorAll(query), function (node) {\n return adopt(node)\n })\n )\n}\n\n// Scoped find method\nexport function find(query) {\n return baseFind(query, this.node)\n}\n\nexport function findOne(query) {\n return adopt(this.node.querySelector(query))\n}\n","import { delimiter } from './regex.js'\nimport { makeInstance } from '../../utils/adopter.js'\nimport { globals } from '../../utils/window.js'\n\nlet listenerId = 0\nexport const windowEvents = {}\n\nexport function getEvents(instance) {\n let n = instance.getEventHolder()\n\n // We dont want to save events in global space\n if (n === globals.window) n = windowEvents\n if (!n.events) n.events = {}\n return n.events\n}\n\nexport function getEventTarget(instance) {\n return instance.getEventTarget()\n}\n\nexport function clearEvents(instance) {\n let n = instance.getEventHolder()\n if (n === globals.window) n = windowEvents\n if (n.events) n.events = {}\n}\n\n// Add event binder in the SVG namespace\nexport function on(node, events, listener, binding, options) {\n const l = listener.bind(binding || node)\n const instance = makeInstance(node)\n const bag = getEvents(instance)\n const n = getEventTarget(instance)\n\n // events can be an array of events or a string of events\n events = Array.isArray(events) ? events : events.split(delimiter)\n\n // add id to listener\n if (!listener._svgjsListenerId) {\n listener._svgjsListenerId = ++listenerId\n }\n\n events.forEach(function (event) {\n const ev = event.split('.')[0]\n const ns = event.split('.')[1] || '*'\n\n // ensure valid object\n bag[ev] = bag[ev] || {}\n bag[ev][ns] = bag[ev][ns] || {}\n\n // reference listener\n bag[ev][ns][listener._svgjsListenerId] = l\n\n // add listener\n n.addEventListener(ev, l, options || false)\n })\n}\n\n// Add event unbinder in the SVG namespace\nexport function off(node, events, listener, options) {\n const instance = makeInstance(node)\n const bag = getEvents(instance)\n const n = getEventTarget(instance)\n\n // listener can be a function or a number\n if (typeof listener === 'function') {\n listener = listener._svgjsListenerId\n if (!listener) return\n }\n\n // events can be an array of events or a string or undefined\n events = Array.isArray(events) ? events : (events || '').split(delimiter)\n\n events.forEach(function (event) {\n const ev = event && event.split('.')[0]\n const ns = event && event.split('.')[1]\n let namespace, l\n\n if (listener) {\n // remove listener reference\n if (bag[ev] && bag[ev][ns || '*']) {\n // removeListener\n n.removeEventListener(\n ev,\n bag[ev][ns || '*'][listener],\n options || false\n )\n\n delete bag[ev][ns || '*'][listener]\n }\n } else if (ev && ns) {\n // remove all listeners for a namespaced event\n if (bag[ev] && bag[ev][ns]) {\n for (l in bag[ev][ns]) {\n off(n, [ev, ns].join('.'), l)\n }\n\n delete bag[ev][ns]\n }\n } else if (ns) {\n // remove all listeners for a specific namespace\n for (event in bag) {\n for (namespace in bag[event]) {\n if (ns === namespace) {\n off(n, [event, ns].join('.'))\n }\n }\n }\n } else if (ev) {\n // remove all listeners for the event\n if (bag[ev]) {\n for (namespace in bag[ev]) {\n off(n, [ev, namespace].join('.'))\n }\n\n delete bag[ev]\n }\n } else {\n // remove all listeners on a given node\n for (event in bag) {\n off(n, event)\n }\n\n clearEvents(instance)\n }\n })\n}\n\nexport function dispatch(node, event, data, options) {\n const n = getEventTarget(node)\n\n // Dispatch event\n if (event instanceof globals.window.Event) {\n n.dispatchEvent(event)\n } else {\n event = new globals.window.CustomEvent(event, {\n detail: data,\n cancelable: true,\n ...options\n })\n n.dispatchEvent(event)\n }\n return event\n}\n","import { dispatch, off, on } from '../modules/core/event.js'\nimport { register } from '../utils/adopter.js'\nimport Base from './Base.js'\n\nexport default class EventTarget extends Base {\n addEventListener() {}\n\n dispatch(event, data, options) {\n return dispatch(this, event, data, options)\n }\n\n dispatchEvent(event) {\n const bag = this.getEventHolder().events\n if (!bag) return true\n\n const events = bag[event.type]\n\n for (const i in events) {\n for (const j in events[i]) {\n events[i][j](event)\n }\n }\n\n return !event.defaultPrevented\n }\n\n // Fire given event\n fire(event, data, options) {\n this.dispatch(event, data, options)\n return this\n }\n\n getEventHolder() {\n return this\n }\n\n getEventTarget() {\n return this\n }\n\n // Unbind event from listener\n off(event, listener, options) {\n off(this, event, listener, options)\n return this\n }\n\n // Bind given event to listener\n on(event, listener, binding, options) {\n on(this, event, listener, binding, options)\n return this\n }\n\n removeEventListener() {}\n}\n\nregister(EventTarget, 'EventTarget')\n","export function noop() {}\n\n// Default animation values\nexport const timeline = {\n duration: 400,\n ease: '>',\n delay: 0\n}\n\n// Default attribute values\nexport const attrs = {\n // fill and stroke\n 'fill-opacity': 1,\n 'stroke-opacity': 1,\n 'stroke-width': 0,\n 'stroke-linejoin': 'miter',\n 'stroke-linecap': 'butt',\n fill: '#000000',\n stroke: '#000000',\n opacity: 1,\n\n // position\n x: 0,\n y: 0,\n cx: 0,\n cy: 0,\n\n // size\n width: 0,\n height: 0,\n\n // radius\n r: 0,\n rx: 0,\n ry: 0,\n\n // gradient\n offset: 0,\n 'stop-opacity': 1,\n 'stop-color': '#000000',\n\n // text\n 'text-anchor': 'start'\n}\n","import { delimiter } from '../modules/core/regex.js'\n\nexport default class SVGArray extends Array {\n constructor(...args) {\n super(...args)\n this.init(...args)\n }\n\n clone() {\n return new this.constructor(this)\n }\n\n init(arr) {\n // This catches the case, that native map tries to create an array with new Array(1)\n if (typeof arr === 'number') return this\n this.length = 0\n this.push(...this.parse(arr))\n return this\n }\n\n // Parse whitespace separated string\n parse(array = []) {\n // If already is an array, no need to parse it\n if (array instanceof Array) return array\n\n return array.trim().split(delimiter).map(parseFloat)\n }\n\n toArray() {\n return Array.prototype.concat.apply([], this)\n }\n\n toSet() {\n return new Set(this)\n }\n\n toString() {\n return this.join(' ')\n }\n\n // Flattens the array if needed\n valueOf() {\n const ret = []\n ret.push(...this)\n return ret\n }\n}\n","import { numberAndUnit } from '../modules/core/regex.js'\n\n// Module for unit conversions\nexport default class SVGNumber {\n // Initialize\n constructor(...args) {\n this.init(...args)\n }\n\n convert(unit) {\n return new SVGNumber(this.value, unit)\n }\n\n // Divide number\n divide(number) {\n number = new SVGNumber(number)\n return new SVGNumber(this / number, this.unit || number.unit)\n }\n\n init(value, unit) {\n unit = Array.isArray(value) ? value[1] : unit\n value = Array.isArray(value) ? value[0] : value\n\n // initialize defaults\n this.value = 0\n this.unit = unit || ''\n\n // parse value\n if (typeof value === 'number') {\n // ensure a valid numeric value\n this.value = isNaN(value)\n ? 0\n : !isFinite(value)\n ? value < 0\n ? -3.4e38\n : +3.4e38\n : value\n } else if (typeof value === 'string') {\n unit = value.match(numberAndUnit)\n\n if (unit) {\n // make value numeric\n this.value = parseFloat(unit[1])\n\n // normalize\n if (unit[5] === '%') {\n this.value /= 100\n } else if (unit[5] === 's') {\n this.value *= 1000\n }\n\n // store unit\n this.unit = unit[5]\n }\n } else {\n if (value instanceof SVGNumber) {\n this.value = value.valueOf()\n this.unit = value.unit\n }\n }\n\n return this\n }\n\n // Subtract number\n minus(number) {\n number = new SVGNumber(number)\n return new SVGNumber(this - number, this.unit || number.unit)\n }\n\n // Add number\n plus(number) {\n number = new SVGNumber(number)\n return new SVGNumber(this + number, this.unit || number.unit)\n }\n\n // Multiply number\n times(number) {\n number = new SVGNumber(number)\n return new SVGNumber(this * number, this.unit || number.unit)\n }\n\n toArray() {\n return [this.value, this.unit]\n }\n\n toJSON() {\n return this.toString()\n }\n\n toString() {\n return (\n (this.unit === '%'\n ? ~~(this.value * 1e8) / 1e6\n : this.unit === 's'\n ? this.value / 1e3\n : this.value) + this.unit\n )\n }\n\n valueOf() {\n return this.value\n }\n}\n","import { attrs as defaults } from './defaults.js'\nimport { isNumber } from './regex.js'\nimport Color from '../../types/Color.js'\nimport SVGArray from '../../types/SVGArray.js'\nimport SVGNumber from '../../types/SVGNumber.js'\n\nconst colorAttributes = new Set([\n 'fill',\n 'stroke',\n 'color',\n 'bgcolor',\n 'stop-color',\n 'flood-color',\n 'lighting-color'\n])\n\nconst hooks = []\nexport function registerAttrHook(fn) {\n hooks.push(fn)\n}\n\n// Set svg element attribute\nexport default function attr(attr, val, ns) {\n // act as full getter\n if (attr == null) {\n // get an object of attributes\n attr = {}\n val = this.node.attributes\n\n for (const node of val) {\n attr[node.nodeName] = isNumber.test(node.nodeValue)\n ? parseFloat(node.nodeValue)\n : node.nodeValue\n }\n\n return attr\n } else if (attr instanceof Array) {\n // loop through array and get all values\n return attr.reduce((last, curr) => {\n last[curr] = this.attr(curr)\n return last\n }, {})\n } else if (typeof attr === 'object' && attr.constructor === Object) {\n // apply every attribute individually if an object is passed\n for (val in attr) this.attr(val, attr[val])\n } else if (val === null) {\n // remove value\n this.node.removeAttribute(attr)\n } else if (val == null) {\n // act as a getter if the first and only argument is not an object\n val = this.node.getAttribute(attr)\n return val == null\n ? defaults[attr]\n : isNumber.test(val)\n ? parseFloat(val)\n : val\n } else {\n // Loop through hooks and execute them to convert value\n val = hooks.reduce((_val, hook) => {\n return hook(attr, _val, this)\n }, val)\n\n // ensure correct numeric values (also accepts NaN and Infinity)\n if (typeof val === 'number') {\n val = new SVGNumber(val)\n } else if (colorAttributes.has(attr) && Color.isColor(val)) {\n // ensure full hex color\n val = new Color(val)\n } else if (val.constructor === Array) {\n // Check for plain arrays and parse array values\n val = new SVGArray(val)\n }\n\n // if the passed attribute is leading...\n if (attr === 'leading') {\n // ... call the leading method instead\n if (this.leading) {\n this.leading(val)\n }\n } else {\n // set given attribute on node\n typeof ns === 'string'\n ? this.node.setAttributeNS(ns, attr, val.toString())\n : this.node.setAttribute(attr, val.toString())\n }\n\n // rebuild if required\n if (this.rebuild && (attr === 'font-size' || attr === 'x')) {\n this.rebuild()\n }\n }\n\n return this\n}\n","import {\n adopt,\n assignNewId,\n eid,\n extend,\n makeInstance,\n create,\n register\n} from '../utils/adopter.js'\nimport { find, findOne } from '../modules/core/selector.js'\nimport { globals } from '../utils/window.js'\nimport { map } from '../utils/utils.js'\nimport { svg, html } from '../modules/core/namespaces.js'\nimport EventTarget from '../types/EventTarget.js'\nimport List from '../types/List.js'\nimport attr from '../modules/core/attr.js'\n\nexport default class Dom extends EventTarget {\n constructor(node, attrs) {\n super()\n this.node = node\n this.type = node.nodeName\n\n if (attrs && node !== attrs) {\n this.attr(attrs)\n }\n }\n\n // Add given element at a position\n add(element, i) {\n element = makeInstance(element)\n\n // If non-root svg nodes are added we have to remove their namespaces\n if (\n element.removeNamespace &&\n this.node instanceof globals.window.SVGElement\n ) {\n element.removeNamespace()\n }\n\n if (i == null) {\n this.node.appendChild(element.node)\n } else if (element.node !== this.node.childNodes[i]) {\n this.node.insertBefore(element.node, this.node.childNodes[i])\n }\n\n return this\n }\n\n // Add element to given container and return self\n addTo(parent, i) {\n return makeInstance(parent).put(this, i)\n }\n\n // Returns all child elements\n children() {\n return new List(\n map(this.node.children, function (node) {\n return adopt(node)\n })\n )\n }\n\n // Remove all elements in this container\n clear() {\n // remove children\n while (this.node.hasChildNodes()) {\n this.node.removeChild(this.node.lastChild)\n }\n\n return this\n }\n\n // Clone element\n clone(deep = true, assignNewIds = true) {\n // write dom data to the dom so the clone can pickup the data\n this.writeDataToDom()\n\n // clone element\n let nodeClone = this.node.cloneNode(deep)\n if (assignNewIds) {\n // assign new id\n nodeClone = assignNewId(nodeClone)\n }\n return new this.constructor(nodeClone)\n }\n\n // Iterates over all children and invokes a given block\n each(block, deep) {\n const children = this.children()\n let i, il\n\n for (i = 0, il = children.length; i < il; i++) {\n block.apply(children[i], [i, children])\n\n if (deep) {\n children[i].each(block, deep)\n }\n }\n\n return this\n }\n\n element(nodeName, attrs) {\n return this.put(new Dom(create(nodeName), attrs))\n }\n\n // Get first child\n first() {\n return adopt(this.node.firstChild)\n }\n\n // Get a element at the given index\n get(i) {\n return adopt(this.node.childNodes[i])\n }\n\n getEventHolder() {\n return this.node\n }\n\n getEventTarget() {\n return this.node\n }\n\n // Checks if the given element is a child\n has(element) {\n return this.index(element) >= 0\n }\n\n html(htmlOrFn, outerHTML) {\n return this.xml(htmlOrFn, outerHTML, html)\n }\n\n // Get / set id\n id(id) {\n // generate new id if no id set\n if (typeof id === 'undefined' && !this.node.id) {\n this.node.id = eid(this.type)\n }\n\n // don't set directly with this.node.id to make `null` work correctly\n return this.attr('id', id)\n }\n\n // Gets index of given element\n index(element) {\n return [].slice.call(this.node.childNodes).indexOf(element.node)\n }\n\n // Get the last child\n last() {\n return adopt(this.node.lastChild)\n }\n\n // matches the element vs a css selector\n matches(selector) {\n const el = this.node\n const matcher =\n el.matches ||\n el.matchesSelector ||\n el.msMatchesSelector ||\n el.mozMatchesSelector ||\n el.webkitMatchesSelector ||\n el.oMatchesSelector ||\n null\n return matcher && matcher.call(el, selector)\n }\n\n // Returns the parent element instance\n parent(type) {\n let parent = this\n\n // check for parent\n if (!parent.node.parentNode) return null\n\n // get parent element\n parent = adopt(parent.node.parentNode)\n\n if (!type) return parent\n\n // loop through ancestors if type is given\n do {\n if (\n typeof type === 'string' ? parent.matches(type) : parent instanceof type\n )\n return parent\n } while ((parent = adopt(parent.node.parentNode)))\n\n return parent\n }\n\n // Basically does the same as `add()` but returns the added element instead\n put(element, i) {\n element = makeInstance(element)\n this.add(element, i)\n return element\n }\n\n // Add element to given container and return container\n putIn(parent, i) {\n return makeInstance(parent).add(this, i)\n }\n\n // Remove element\n remove() {\n if (this.parent()) {\n this.parent().removeElement(this)\n }\n\n return this\n }\n\n // Remove a given child\n removeElement(element) {\n this.node.removeChild(element.node)\n\n return this\n }\n\n // Replace this with element\n replace(element) {\n element = makeInstance(element)\n\n if (this.node.parentNode) {\n this.node.parentNode.replaceChild(element.node, this.node)\n }\n\n return element\n }\n\n round(precision = 2, map = null) {\n const factor = 10 ** precision\n const attrs = this.attr(map)\n\n for (const i in attrs) {\n if (typeof attrs[i] === 'number') {\n attrs[i] = Math.round(attrs[i] * factor) / factor\n }\n }\n\n this.attr(attrs)\n return this\n }\n\n // Import / Export raw svg\n svg(svgOrFn, outerSVG) {\n return this.xml(svgOrFn, outerSVG, svg)\n }\n\n // Return id on string conversion\n toString() {\n return this.id()\n }\n\n words(text) {\n // This is faster than removing all children and adding a new one\n this.node.textContent = text\n return this\n }\n\n wrap(node) {\n const parent = this.parent()\n\n if (!parent) {\n return this.addTo(node)\n }\n\n const position = parent.index(this)\n return parent.put(node, position).put(this)\n }\n\n // write svgjs data to the dom\n writeDataToDom() {\n // dump variables recursively\n this.each(function () {\n this.writeDataToDom()\n })\n\n return this\n }\n\n // Import / Export raw svg\n xml(xmlOrFn, outerXML, ns) {\n if (typeof xmlOrFn === 'boolean') {\n ns = outerXML\n outerXML = xmlOrFn\n xmlOrFn = null\n }\n\n // act as getter if no svg string is given\n if (xmlOrFn == null || typeof xmlOrFn === 'function') {\n // The default for exports is, that the outerNode is included\n outerXML = outerXML == null ? true : outerXML\n\n // write svgjs data to the dom\n this.writeDataToDom()\n let current = this\n\n // An export modifier was passed\n if (xmlOrFn != null) {\n current = adopt(current.node.cloneNode(true))\n\n // If the user wants outerHTML we need to process this node, too\n if (outerXML) {\n const result = xmlOrFn(current)\n current = result || current\n\n // The user does not want this node? Well, then he gets nothing\n if (result === false) return ''\n }\n\n // Deep loop through all children and apply modifier\n current.each(function () {\n const result = xmlOrFn(this)\n const _this = result || this\n\n // If modifier returns false, discard node\n if (result === false) {\n this.remove()\n\n // If modifier returns new node, use it\n } else if (result && this !== _this) {\n this.replace(_this)\n }\n }, true)\n }\n\n // Return outer or inner content\n return outerXML ? current.node.outerHTML : current.node.innerHTML\n }\n\n // Act as setter if we got a string\n\n // The default for import is, that the current node is not replaced\n outerXML = outerXML == null ? false : outerXML\n\n // Create temporary holder\n const well = create('wrapper', ns)\n const fragment = globals.document.createDocumentFragment()\n\n // Dump raw svg\n well.innerHTML = xmlOrFn\n\n // Transplant nodes into the fragment\n for (let len = well.children.length; len--; ) {\n fragment.appendChild(well.firstElementChild)\n }\n\n const parent = this.parent()\n\n // Add the whole fragment at once\n return outerXML ? this.replace(fragment) && parent : this.add(fragment)\n }\n}\n\nextend(Dom, { attr, find, findOne })\nregister(Dom, 'Dom')\n","import { bbox, rbox, inside } from '../types/Box.js'\nimport { ctm, screenCTM } from '../types/Matrix.js'\nimport {\n extend,\n getClass,\n makeInstance,\n register,\n root\n} from '../utils/adopter.js'\nimport { globals } from '../utils/window.js'\nimport { point } from '../types/Point.js'\nimport { proportionalSize, writeDataToDom } from '../utils/utils.js'\nimport { reference } from '../modules/core/regex.js'\nimport Dom from './Dom.js'\nimport List from '../types/List.js'\nimport SVGNumber from '../types/SVGNumber.js'\n\nexport default class Element extends Dom {\n constructor(node, attrs) {\n super(node, attrs)\n\n // initialize data object\n this.dom = {}\n\n // create circular reference\n this.node.instance = this\n\n if (node.hasAttribute('data-svgjs') || node.hasAttribute('svgjs:data')) {\n // pull svgjs data from the dom (getAttributeNS doesn't work in html5)\n this.setData(\n JSON.parse(node.getAttribute('data-svgjs')) ??\n JSON.parse(node.getAttribute('svgjs:data')) ??\n {}\n )\n }\n }\n\n // Move element by its center\n center(x, y) {\n return this.cx(x).cy(y)\n }\n\n // Move by center over x-axis\n cx(x) {\n return x == null\n ? this.x() + this.width() / 2\n : this.x(x - this.width() / 2)\n }\n\n // Move by center over y-axis\n cy(y) {\n return y == null\n ? this.y() + this.height() / 2\n : this.y(y - this.height() / 2)\n }\n\n // Get defs\n defs() {\n const root = this.root()\n return root && root.defs()\n }\n\n // Relative move over x and y axes\n dmove(x, y) {\n return this.dx(x).dy(y)\n }\n\n // Relative move over x axis\n dx(x = 0) {\n return this.x(new SVGNumber(x).plus(this.x()))\n }\n\n // Relative move over y axis\n dy(y = 0) {\n return this.y(new SVGNumber(y).plus(this.y()))\n }\n\n getEventHolder() {\n return this\n }\n\n // Set height of element\n height(height) {\n return this.attr('height', height)\n }\n\n // Move element to given x and y values\n move(x, y) {\n return this.x(x).y(y)\n }\n\n // return array of all ancestors of given type up to the root svg\n parents(until = this.root()) {\n const isSelector = typeof until === 'string'\n if (!isSelector) {\n until = makeInstance(until)\n }\n const parents = new List()\n let parent = this\n\n while (\n (parent = parent.parent()) &&\n parent.node !== globals.document &&\n parent.nodeName !== '#document-fragment'\n ) {\n parents.push(parent)\n\n if (!isSelector && parent.node === until.node) {\n break\n }\n if (isSelector && parent.matches(until)) {\n break\n }\n if (parent.node === this.root().node) {\n // We worked our way to the root and didn't match `until`\n return null\n }\n }\n\n return parents\n }\n\n // Get referenced element form attribute value\n reference(attr) {\n attr = this.attr(attr)\n if (!attr) return null\n\n const m = (attr + '').match(reference)\n return m ? makeInstance(m[1]) : null\n }\n\n // Get parent document\n root() {\n const p = this.parent(getClass(root))\n return p && p.root()\n }\n\n // set given data to the elements data property\n setData(o) {\n this.dom = o\n return this\n }\n\n // Set element size to given width and height\n size(width, height) {\n const p = proportionalSize(this, width, height)\n\n return this.width(new SVGNumber(p.width)).height(new SVGNumber(p.height))\n }\n\n // Set width of element\n width(width) {\n return this.attr('width', width)\n }\n\n // write svgjs data to the dom\n writeDataToDom() {\n writeDataToDom(this, this.dom)\n return super.writeDataToDom()\n }\n\n // Move over x-axis\n x(x) {\n return this.attr('x', x)\n }\n\n // Move over y-axis\n y(y) {\n return this.attr('y', y)\n }\n}\n\nextend(Element, {\n bbox,\n rbox,\n inside,\n point,\n ctm,\n screenCTM\n})\n\nregister(Element, 'Element')\n","import { registerMethods } from '../../utils/methods.js'\nimport Color from '../../types/Color.js'\nimport Element from '../../elements/Element.js'\nimport Matrix from '../../types/Matrix.js'\nimport Point from '../../types/Point.js'\nimport SVGNumber from '../../types/SVGNumber.js'\n\n// Define list of available attributes for stroke and fill\nconst sugar = {\n stroke: [\n 'color',\n 'width',\n 'opacity',\n 'linecap',\n 'linejoin',\n 'miterlimit',\n 'dasharray',\n 'dashoffset'\n ],\n fill: ['color', 'opacity', 'rule'],\n prefix: function (t, a) {\n return a === 'color' ? t : t + '-' + a\n }\n}\n\n// Add sugar for fill and stroke\n;['fill', 'stroke'].forEach(function (m) {\n const extension = {}\n let i\n\n extension[m] = function (o) {\n if (typeof o === 'undefined') {\n return this.attr(m)\n }\n if (\n typeof o === 'string' ||\n o instanceof Color ||\n Color.isRgb(o) ||\n o instanceof Element\n ) {\n this.attr(m, o)\n } else {\n // set all attributes from sugar.fill and sugar.stroke list\n for (i = sugar[m].length - 1; i >= 0; i--) {\n if (o[sugar[m][i]] != null) {\n this.attr(sugar.prefix(m, sugar[m][i]), o[sugar[m][i]])\n }\n }\n }\n\n return this\n }\n\n registerMethods(['Element', 'Runner'], extension)\n})\n\nregisterMethods(['Element', 'Runner'], {\n // Let the user set the matrix directly\n matrix: function (mat, b, c, d, e, f) {\n // Act as a getter\n if (mat == null) {\n return new Matrix(this)\n }\n\n // Act as a setter, the user can pass a matrix or a set of numbers\n return this.attr('transform', new Matrix(mat, b, c, d, e, f))\n },\n\n // Map rotation to transform\n rotate: function (angle, cx, cy) {\n return this.transform({ rotate: angle, ox: cx, oy: cy }, true)\n },\n\n // Map skew to transform\n skew: function (x, y, cx, cy) {\n return arguments.length === 1 || arguments.length === 3\n ? this.transform({ skew: x, ox: y, oy: cx }, true)\n : this.transform({ skew: [x, y], ox: cx, oy: cy }, true)\n },\n\n shear: function (lam, cx, cy) {\n return this.transform({ shear: lam, ox: cx, oy: cy }, true)\n },\n\n // Map scale to transform\n scale: function (x, y, cx, cy) {\n return arguments.length === 1 || arguments.length === 3\n ? this.transform({ scale: x, ox: y, oy: cx }, true)\n : this.transform({ scale: [x, y], ox: cx, oy: cy }, true)\n },\n\n // Map translate to transform\n translate: function (x, y) {\n return this.transform({ translate: [x, y] }, true)\n },\n\n // Map relative translations to transform\n relative: function (x, y) {\n return this.transform({ relative: [x, y] }, true)\n },\n\n // Map flip to transform\n flip: function (direction = 'both', origin = 'center') {\n if ('xybothtrue'.indexOf(direction) === -1) {\n origin = direction\n direction = 'both'\n }\n\n return this.transform({ flip: direction, origin: origin }, true)\n },\n\n // Opacity\n opacity: function (value) {\n return this.attr('opacity', value)\n }\n})\n\nregisterMethods('radius', {\n // Add x and y radius\n radius: function (x, y = x) {\n const type = (this._element || this).type\n return type === 'radialGradient'\n ? this.attr('r', new SVGNumber(x))\n : this.rx(x).ry(y)\n }\n})\n\nregisterMethods('Path', {\n // Get path length\n length: function () {\n return this.node.getTotalLength()\n },\n // Get point at length\n pointAt: function (length) {\n return new Point(this.node.getPointAtLength(length))\n }\n})\n\nregisterMethods(['Element', 'Runner'], {\n // Set font\n font: function (a, v) {\n if (typeof a === 'object') {\n for (v in a) this.font(v, a[v])\n return this\n }\n\n return a === 'leading'\n ? this.leading(v)\n : a === 'anchor'\n ? this.attr('text-anchor', v)\n : a === 'size' ||\n a === 'family' ||\n a === 'weight' ||\n a === 'stretch' ||\n a === 'variant' ||\n a === 'style'\n ? this.attr('font-' + a, v)\n : this.attr(a, v)\n }\n})\n\n// Add events to elements\nconst methods = [\n 'click',\n 'dblclick',\n 'mousedown',\n 'mouseup',\n 'mouseover',\n 'mouseout',\n 'mousemove',\n 'mouseenter',\n 'mouseleave',\n 'touchstart',\n 'touchmove',\n 'touchleave',\n 'touchend',\n 'touchcancel',\n 'contextmenu',\n 'wheel',\n 'pointerdown',\n 'pointermove',\n 'pointerup',\n 'pointerleave',\n 'pointercancel'\n].reduce(function (last, event) {\n // add event to Element\n const fn = function (f) {\n if (f === null) {\n this.off(event)\n } else {\n this.on(event, f)\n }\n return this\n }\n\n last[event] = fn\n return last\n}, {})\n\nregisterMethods('Element', methods)\n","import { getOrigin, isDescriptive } from '../../utils/utils.js'\nimport { delimiter, transforms } from '../core/regex.js'\nimport { registerMethods } from '../../utils/methods.js'\nimport Matrix from '../../types/Matrix.js'\n\n// Reset all transformations\nexport function untransform() {\n return this.attr('transform', null)\n}\n\n// merge the whole transformation chain into one matrix and returns it\nexport function matrixify() {\n const matrix = (this.attr('transform') || '')\n // split transformations\n .split(transforms)\n .slice(0, -1)\n .map(function (str) {\n // generate key => value pairs\n const kv = str.trim().split('(')\n return [\n kv[0],\n kv[1].split(delimiter).map(function (str) {\n return parseFloat(str)\n })\n ]\n })\n .reverse()\n // merge every transformation into one matrix\n .reduce(function (matrix, transform) {\n if (transform[0] === 'matrix') {\n return matrix.lmultiply(Matrix.fromArray(transform[1]))\n }\n return matrix[transform[0]].apply(matrix, transform[1])\n }, new Matrix())\n\n return matrix\n}\n\n// add an element to another parent without changing the visual representation on the screen\nexport function toParent(parent, i) {\n if (this === parent) return this\n\n if (isDescriptive(this.node)) return this.addTo(parent, i)\n\n const ctm = this.screenCTM()\n const pCtm = parent.screenCTM().inverse()\n\n this.addTo(parent, i).untransform().transform(pCtm.multiply(ctm))\n\n return this\n}\n\n// same as above with parent equals root-svg\nexport function toRoot(i) {\n return this.toParent(this.root(), i)\n}\n\n// Add transformations\nexport function transform(o, relative) {\n // Act as a getter if no object was passed\n if (o == null || typeof o === 'string') {\n const decomposed = new Matrix(this).decompose()\n return o == null ? decomposed : decomposed[o]\n }\n\n if (!Matrix.isMatrixLike(o)) {\n // Set the origin according to the defined transform\n o = { ...o, origin: getOrigin(o, this) }\n }\n\n // The user can pass a boolean, an Element or an Matrix or nothing\n const cleanRelative = relative === true ? this : relative || false\n const result = new Matrix(cleanRelative).transform(o)\n return this.attr('transform', result)\n}\n\nregisterMethods('Element', {\n untransform,\n matrixify,\n toParent,\n toRoot,\n transform\n})\n","import { register } from '../utils/adopter.js'\nimport Element from './Element.js'\n\nexport default class Container extends Element {\n flatten() {\n this.each(function () {\n if (this instanceof Container) {\n return this.flatten().ungroup()\n }\n })\n\n return this\n }\n\n ungroup(parent = this.parent(), index = parent.index(this)) {\n // when parent != this, we want append all elements to the end\n index = index === -1 ? parent.children().length : index\n\n this.each(function (i, children) {\n // reverse each\n return children[children.length - i - 1].toParent(parent, index)\n })\n\n return this.remove()\n }\n}\n\nregister(Container, 'Container')\n","import { nodeOrNew, register } from '../utils/adopter.js'\nimport Container from './Container.js'\n\nexport default class Defs extends Container {\n constructor(node, attrs = node) {\n super(nodeOrNew('defs', node), attrs)\n }\n\n flatten() {\n return this\n }\n\n ungroup() {\n return this\n }\n}\n\nregister(Defs, 'Defs')\n","import { register } from '../utils/adopter.js'\nimport Element from './Element.js'\n\nexport default class Shape extends Element {}\n\nregister(Shape, 'Shape')\n","import SVGNumber from '../../types/SVGNumber.js'\n\n// Radius x value\nexport function rx(rx) {\n return this.attr('rx', rx)\n}\n\n// Radius y value\nexport function ry(ry) {\n return this.attr('ry', ry)\n}\n\n// Move over x-axis\nexport function x(x) {\n return x == null ? this.cx() - this.rx() : this.cx(x + this.rx())\n}\n\n// Move over y-axis\nexport function y(y) {\n return y == null ? this.cy() - this.ry() : this.cy(y + this.ry())\n}\n\n// Move by center over x-axis\nexport function cx(x) {\n return this.attr('cx', x)\n}\n\n// Move by center over y-axis\nexport function cy(y) {\n return this.attr('cy', y)\n}\n\n// Set width of element\nexport function width(width) {\n return width == null ? this.rx() * 2 : this.rx(new SVGNumber(width).divide(2))\n}\n\n// Set height of element\nexport function height(height) {\n return height == null\n ? this.ry() * 2\n : this.ry(new SVGNumber(height).divide(2))\n}\n","import {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { proportionalSize } from '../utils/utils.js'\nimport { registerMethods } from '../utils/methods.js'\nimport SVGNumber from '../types/SVGNumber.js'\nimport Shape from './Shape.js'\nimport * as circled from '../modules/core/circled.js'\n\nexport default class Ellipse extends Shape {\n constructor(node, attrs = node) {\n super(nodeOrNew('ellipse', node), attrs)\n }\n\n size(width, height) {\n const p = proportionalSize(this, width, height)\n\n return this.rx(new SVGNumber(p.width).divide(2)).ry(\n new SVGNumber(p.height).divide(2)\n )\n }\n}\n\nextend(Ellipse, circled)\n\nregisterMethods('Container', {\n // Create an ellipse\n ellipse: wrapWithAttrCheck(function (width = 0, height = width) {\n return this.put(new Ellipse()).size(width, height).move(0, 0)\n })\n})\n\nregister(Ellipse, 'Ellipse')\n","import Dom from './Dom.js'\nimport { globals } from '../utils/window.js'\nimport { register, create } from '../utils/adopter.js'\n\nclass Fragment extends Dom {\n constructor(node = globals.document.createDocumentFragment()) {\n super(node)\n }\n\n // Import / Export raw xml\n xml(xmlOrFn, outerXML, ns) {\n if (typeof xmlOrFn === 'boolean') {\n ns = outerXML\n outerXML = xmlOrFn\n xmlOrFn = null\n }\n\n // because this is a fragment we have to put all elements into a wrapper first\n // before we can get the innerXML from it\n if (xmlOrFn == null || typeof xmlOrFn === 'function') {\n const wrapper = new Dom(create('wrapper', ns))\n wrapper.add(this.node.cloneNode(true))\n\n return wrapper.xml(false, ns)\n }\n\n // Act as setter if we got a string\n return super.xml(xmlOrFn, false, ns)\n }\n}\n\nregister(Fragment, 'Fragment')\n\nexport default Fragment\n","import SVGNumber from '../../types/SVGNumber.js'\n\nexport function from(x, y) {\n return (this._element || this).type === 'radialGradient'\n ? this.attr({ fx: new SVGNumber(x), fy: new SVGNumber(y) })\n : this.attr({ x1: new SVGNumber(x), y1: new SVGNumber(y) })\n}\n\nexport function to(x, y) {\n return (this._element || this).type === 'radialGradient'\n ? this.attr({ cx: new SVGNumber(x), cy: new SVGNumber(y) })\n : this.attr({ x2: new SVGNumber(x), y2: new SVGNumber(y) })\n}\n","import {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Box from '../types/Box.js'\nimport Container from './Container.js'\nimport baseFind from '../modules/core/selector.js'\nimport * as gradiented from '../modules/core/gradiented.js'\n\nexport default class Gradient extends Container {\n constructor(type, attrs) {\n super(\n nodeOrNew(type + 'Gradient', typeof type === 'string' ? null : type),\n attrs\n )\n }\n\n // custom attr to handle transform\n attr(a, b, c) {\n if (a === 'transform') a = 'gradientTransform'\n return super.attr(a, b, c)\n }\n\n bbox() {\n return new Box()\n }\n\n targets() {\n return baseFind('svg [fill*=' + this.id() + ']')\n }\n\n // Alias string conversion to fill\n toString() {\n return this.url()\n }\n\n // Update gradient\n update(block) {\n // remove all stops\n this.clear()\n\n // invoke passed block\n if (typeof block === 'function') {\n block.call(this, this)\n }\n\n return this\n }\n\n // Return the fill id\n url() {\n return 'url(#' + this.id() + ')'\n }\n}\n\nextend(Gradient, gradiented)\n\nregisterMethods({\n Container: {\n // Create gradient element in defs\n gradient(...args) {\n return this.defs().gradient(...args)\n }\n },\n // define gradient\n Defs: {\n gradient: wrapWithAttrCheck(function (type, block) {\n return this.put(new Gradient(type)).update(block)\n })\n }\n})\n\nregister(Gradient, 'Gradient')\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Box from '../types/Box.js'\nimport Container from './Container.js'\nimport baseFind from '../modules/core/selector.js'\n\nexport default class Pattern extends Container {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('pattern', node), attrs)\n }\n\n // custom attr to handle transform\n attr(a, b, c) {\n if (a === 'transform') a = 'patternTransform'\n return super.attr(a, b, c)\n }\n\n bbox() {\n return new Box()\n }\n\n targets() {\n return baseFind('svg [fill*=' + this.id() + ']')\n }\n\n // Alias string conversion to fill\n toString() {\n return this.url()\n }\n\n // Update pattern by rebuilding\n update(block) {\n // remove content\n this.clear()\n\n // invoke passed block\n if (typeof block === 'function') {\n block.call(this, this)\n }\n\n return this\n }\n\n // Return the fill id\n url() {\n return 'url(#' + this.id() + ')'\n }\n}\n\nregisterMethods({\n Container: {\n // Create pattern element in defs\n pattern(...args) {\n return this.defs().pattern(...args)\n }\n },\n Defs: {\n pattern: wrapWithAttrCheck(function (width, height, block) {\n return this.put(new Pattern()).update(block).attr({\n x: 0,\n y: 0,\n width: width,\n height: height,\n patternUnits: 'userSpaceOnUse'\n })\n })\n }\n})\n\nregister(Pattern, 'Pattern')\n","import { isImage } from '../modules/core/regex.js'\nimport { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { off, on } from '../modules/core/event.js'\nimport { registerAttrHook } from '../modules/core/attr.js'\nimport { registerMethods } from '../utils/methods.js'\nimport { xlink } from '../modules/core/namespaces.js'\nimport Pattern from './Pattern.js'\nimport Shape from './Shape.js'\nimport { globals } from '../utils/window.js'\n\nexport default class Image extends Shape {\n constructor(node, attrs = node) {\n super(nodeOrNew('image', node), attrs)\n }\n\n // (re)load image\n load(url, callback) {\n if (!url) return this\n\n const img = new globals.window.Image()\n\n on(\n img,\n 'load',\n function (e) {\n const p = this.parent(Pattern)\n\n // ensure image size\n if (this.width() === 0 && this.height() === 0) {\n this.size(img.width, img.height)\n }\n\n if (p instanceof Pattern) {\n // ensure pattern size if not set\n if (p.width() === 0 && p.height() === 0) {\n p.size(this.width(), this.height())\n }\n }\n\n if (typeof callback === 'function') {\n callback.call(this, e)\n }\n },\n this\n )\n\n on(img, 'load error', function () {\n // dont forget to unbind memory leaking events\n off(img)\n })\n\n return this.attr('href', (img.src = url), xlink)\n }\n}\n\nregisterAttrHook(function (attr, val, _this) {\n // convert image fill and stroke to patterns\n if (attr === 'fill' || attr === 'stroke') {\n if (isImage.test(val)) {\n val = _this.root().defs().image(val)\n }\n }\n\n if (val instanceof Image) {\n val = _this\n .root()\n .defs()\n .pattern(0, 0, (pattern) => {\n pattern.add(val)\n })\n }\n\n return val\n})\n\nregisterMethods({\n Container: {\n // create image element, load image and set its size\n image: wrapWithAttrCheck(function (source, callback) {\n return this.put(new Image()).size(0, 0).load(source, callback)\n })\n }\n})\n\nregister(Image, 'Image')\n","import { delimiter } from '../modules/core/regex.js'\nimport SVGArray from './SVGArray.js'\nimport Box from './Box.js'\nimport Matrix from './Matrix.js'\n\nexport default class PointArray extends SVGArray {\n // Get bounding box of points\n bbox() {\n let maxX = -Infinity\n let maxY = -Infinity\n let minX = Infinity\n let minY = Infinity\n this.forEach(function (el) {\n maxX = Math.max(el[0], maxX)\n maxY = Math.max(el[1], maxY)\n minX = Math.min(el[0], minX)\n minY = Math.min(el[1], minY)\n })\n return new Box(minX, minY, maxX - minX, maxY - minY)\n }\n\n // Move point string\n move(x, y) {\n const box = this.bbox()\n\n // get relative offset\n x -= box.x\n y -= box.y\n\n // move every point\n if (!isNaN(x) && !isNaN(y)) {\n for (let i = this.length - 1; i >= 0; i--) {\n this[i] = [this[i][0] + x, this[i][1] + y]\n }\n }\n\n return this\n }\n\n // Parse point string and flat array\n parse(array = [0, 0]) {\n const points = []\n\n // if it is an array, we flatten it and therefore clone it to 1 depths\n if (array instanceof Array) {\n array = Array.prototype.concat.apply([], array)\n } else {\n // Else, it is considered as a string\n // parse points\n array = array.trim().split(delimiter).map(parseFloat)\n }\n\n // validate points - https://svgwg.org/svg2-draft/shapes.html#DataTypePoints\n // Odd number of coordinates is an error. In such cases, drop the last odd coordinate.\n if (array.length % 2 !== 0) array.pop()\n\n // wrap points in two-tuples\n for (let i = 0, len = array.length; i < len; i = i + 2) {\n points.push([array[i], array[i + 1]])\n }\n\n return points\n }\n\n // Resize poly string\n size(width, height) {\n let i\n const box = this.bbox()\n\n // recalculate position of all points according to new size\n for (i = this.length - 1; i >= 0; i--) {\n if (box.width)\n this[i][0] = ((this[i][0] - box.x) * width) / box.width + box.x\n if (box.height)\n this[i][1] = ((this[i][1] - box.y) * height) / box.height + box.y\n }\n\n return this\n }\n\n // Convert array to line object\n toLine() {\n return {\n x1: this[0][0],\n y1: this[0][1],\n x2: this[1][0],\n y2: this[1][1]\n }\n }\n\n // Convert array to string\n toString() {\n const array = []\n // convert to a poly point string\n for (let i = 0, il = this.length; i < il; i++) {\n array.push(this[i].join(','))\n }\n\n return array.join(' ')\n }\n\n transform(m) {\n return this.clone().transformO(m)\n }\n\n // transform points with matrix (similar to Point.transform)\n transformO(m) {\n if (!Matrix.isMatrixLike(m)) {\n m = new Matrix(m)\n }\n\n for (let i = this.length; i--; ) {\n // Perform the matrix multiplication\n const [x, y] = this[i]\n this[i][0] = m.a * x + m.c * y + m.e\n this[i][1] = m.b * x + m.d * y + m.f\n }\n\n return this\n }\n}\n","import PointArray from '../../types/PointArray.js'\n\nexport const MorphArray = PointArray\n\n// Move by left top corner over x-axis\nexport function x(x) {\n return x == null ? this.bbox().x : this.move(x, this.bbox().y)\n}\n\n// Move by left top corner over y-axis\nexport function y(y) {\n return y == null ? this.bbox().y : this.move(this.bbox().x, y)\n}\n\n// Set width of element\nexport function width(width) {\n const b = this.bbox()\n return width == null ? b.width : this.size(width, b.height)\n}\n\n// Set height of element\nexport function height(height) {\n const b = this.bbox()\n return height == null ? b.height : this.size(b.width, height)\n}\n","import {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { proportionalSize } from '../utils/utils.js'\nimport { registerMethods } from '../utils/methods.js'\nimport PointArray from '../types/PointArray.js'\nimport Shape from './Shape.js'\nimport * as pointed from '../modules/core/pointed.js'\n\nexport default class Line extends Shape {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('line', node), attrs)\n }\n\n // Get array\n array() {\n return new PointArray([\n [this.attr('x1'), this.attr('y1')],\n [this.attr('x2'), this.attr('y2')]\n ])\n }\n\n // Move by left top corner\n move(x, y) {\n return this.attr(this.array().move(x, y).toLine())\n }\n\n // Overwrite native plot() method\n plot(x1, y1, x2, y2) {\n if (x1 == null) {\n return this.array()\n } else if (typeof y1 !== 'undefined') {\n x1 = { x1, y1, x2, y2 }\n } else {\n x1 = new PointArray(x1).toLine()\n }\n\n return this.attr(x1)\n }\n\n // Set element size to given width and height\n size(width, height) {\n const p = proportionalSize(this, width, height)\n return this.attr(this.array().size(p.width, p.height).toLine())\n }\n}\n\nextend(Line, pointed)\n\nregisterMethods({\n Container: {\n // Create a line element\n line: wrapWithAttrCheck(function (...args) {\n // make sure plot is called as a setter\n // x1 is not necessarily a number, it can also be an array, a string and a PointArray\n return Line.prototype.plot.apply(\n this.put(new Line()),\n args[0] != null ? args : [0, 0, 0, 0]\n )\n })\n }\n})\n\nregister(Line, 'Line')\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Container from './Container.js'\n\nexport default class Marker extends Container {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('marker', node), attrs)\n }\n\n // Set height of element\n height(height) {\n return this.attr('markerHeight', height)\n }\n\n orient(orient) {\n return this.attr('orient', orient)\n }\n\n // Set marker refX and refY\n ref(x, y) {\n return this.attr('refX', x).attr('refY', y)\n }\n\n // Return the fill id\n toString() {\n return 'url(#' + this.id() + ')'\n }\n\n // Update marker\n update(block) {\n // remove all content\n this.clear()\n\n // invoke passed block\n if (typeof block === 'function') {\n block.call(this, this)\n }\n\n return this\n }\n\n // Set width of element\n width(width) {\n return this.attr('markerWidth', width)\n }\n}\n\nregisterMethods({\n Container: {\n marker(...args) {\n // Create marker element in defs\n return this.defs().marker(...args)\n }\n },\n Defs: {\n // Create marker\n marker: wrapWithAttrCheck(function (width, height, block) {\n // Set default viewbox to match the width and height, set ref to cx and cy and set orient to auto\n return this.put(new Marker())\n .size(width, height)\n .ref(width / 2, height / 2)\n .viewbox(0, 0, width, height)\n .attr('orient', 'auto')\n .update(block)\n })\n },\n marker: {\n // Create and attach markers\n marker(marker, width, height, block) {\n let attr = ['marker']\n\n // Build attribute name\n if (marker !== 'all') attr.push(marker)\n attr = attr.join('-')\n\n // Set marker attribute\n marker =\n arguments[1] instanceof Marker\n ? arguments[1]\n : this.defs().marker(width, height, block)\n\n return this.attr(attr, marker)\n }\n }\n})\n\nregister(Marker, 'Marker')\n","import { timeline } from '../modules/core/defaults.js'\nimport { extend } from '../utils/adopter.js'\n\n/***\nBase Class\n==========\nThe base stepper class that will be\n***/\n\nfunction makeSetterGetter(k, f) {\n return function (v) {\n if (v == null) return this[k]\n this[k] = v\n if (f) f.call(this)\n return this\n }\n}\n\nexport const easing = {\n '-': function (pos) {\n return pos\n },\n '<>': function (pos) {\n return -Math.cos(pos * Math.PI) / 2 + 0.5\n },\n '>': function (pos) {\n return Math.sin((pos * Math.PI) / 2)\n },\n '<': function (pos) {\n return -Math.cos((pos * Math.PI) / 2) + 1\n },\n bezier: function (x1, y1, x2, y2) {\n // see https://www.w3.org/TR/css-easing-1/#cubic-bezier-algo\n return function (t) {\n if (t < 0) {\n if (x1 > 0) {\n return (y1 / x1) * t\n } else if (x2 > 0) {\n return (y2 / x2) * t\n } else {\n return 0\n }\n } else if (t > 1) {\n if (x2 < 1) {\n return ((1 - y2) / (1 - x2)) * t + (y2 - x2) / (1 - x2)\n } else if (x1 < 1) {\n return ((1 - y1) / (1 - x1)) * t + (y1 - x1) / (1 - x1)\n } else {\n return 1\n }\n } else {\n return 3 * t * (1 - t) ** 2 * y1 + 3 * t ** 2 * (1 - t) * y2 + t ** 3\n }\n }\n },\n // see https://www.w3.org/TR/css-easing-1/#step-timing-function-algo\n steps: function (steps, stepPosition = 'end') {\n // deal with \"jump-\" prefix\n stepPosition = stepPosition.split('-').reverse()[0]\n\n let jumps = steps\n if (stepPosition === 'none') {\n --jumps\n } else if (stepPosition === 'both') {\n ++jumps\n }\n\n // The beforeFlag is essentially useless\n return (t, beforeFlag = false) => {\n // Step is called currentStep in referenced url\n let step = Math.floor(t * steps)\n const jumping = (t * step) % 1 === 0\n\n if (stepPosition === 'start' || stepPosition === 'both') {\n ++step\n }\n\n if (beforeFlag && jumping) {\n --step\n }\n\n if (t >= 0 && step < 0) {\n step = 0\n }\n\n if (t <= 1 && step > jumps) {\n step = jumps\n }\n\n return step / jumps\n }\n }\n}\n\nexport class Stepper {\n done() {\n return false\n }\n}\n\n/***\nEasing Functions\n================\n***/\n\nexport class Ease extends Stepper {\n constructor(fn = timeline.ease) {\n super()\n this.ease = easing[fn] || fn\n }\n\n step(from, to, pos) {\n if (typeof from !== 'number') {\n return pos < 1 ? from : to\n }\n return from + (to - from) * this.ease(pos)\n }\n}\n\n/***\nController Types\n================\n***/\n\nexport class Controller extends Stepper {\n constructor(fn) {\n super()\n this.stepper = fn\n }\n\n done(c) {\n return c.done\n }\n\n step(current, target, dt, c) {\n return this.stepper(current, target, dt, c)\n }\n}\n\nfunction recalculate() {\n // Apply the default parameters\n const duration = (this._duration || 500) / 1000\n const overshoot = this._overshoot || 0\n\n // Calculate the PID natural response\n const eps = 1e-10\n const pi = Math.PI\n const os = Math.log(overshoot / 100 + eps)\n const zeta = -os / Math.sqrt(pi * pi + os * os)\n const wn = 3.9 / (zeta * duration)\n\n // Calculate the Spring values\n this.d = 2 * zeta * wn\n this.k = wn * wn\n}\n\nexport class Spring extends Controller {\n constructor(duration = 500, overshoot = 0) {\n super()\n this.duration(duration).overshoot(overshoot)\n }\n\n step(current, target, dt, c) {\n if (typeof current === 'string') return current\n c.done = dt === Infinity\n if (dt === Infinity) return target\n if (dt === 0) return current\n\n if (dt > 100) dt = 16\n\n dt /= 1000\n\n // Get the previous velocity\n const velocity = c.velocity || 0\n\n // Apply the control to get the new position and store it\n const acceleration = -this.d * velocity - this.k * (current - target)\n const newPosition = current + velocity * dt + (acceleration * dt * dt) / 2\n\n // Store the velocity\n c.velocity = velocity + acceleration * dt\n\n // Figure out if we have converged, and if so, pass the value\n c.done = Math.abs(target - newPosition) + Math.abs(velocity) < 0.002\n return c.done ? target : newPosition\n }\n}\n\nextend(Spring, {\n duration: makeSetterGetter('_duration', recalculate),\n overshoot: makeSetterGetter('_overshoot', recalculate)\n})\n\nexport class PID extends Controller {\n constructor(p = 0.1, i = 0.01, d = 0, windup = 1000) {\n super()\n this.p(p).i(i).d(d).windup(windup)\n }\n\n step(current, target, dt, c) {\n if (typeof current === 'string') return current\n c.done = dt === Infinity\n\n if (dt === Infinity) return target\n if (dt === 0) return current\n\n const p = target - current\n let i = (c.integral || 0) + p * dt\n const d = (p - (c.error || 0)) / dt\n const windup = this._windup\n\n // antiwindup\n if (windup !== false) {\n i = Math.max(-windup, Math.min(i, windup))\n }\n\n c.error = p\n c.integral = i\n\n c.done = Math.abs(p) < 0.001\n\n return c.done ? target : current + (this.P * p + this.I * i + this.D * d)\n }\n}\n\nextend(PID, {\n windup: makeSetterGetter('_windup'),\n p: makeSetterGetter('P'),\n i: makeSetterGetter('I'),\n d: makeSetterGetter('D')\n})\n","import { isPathLetter } from '../modules/core/regex.js'\nimport Point from '../types/Point.js'\n\nconst segmentParameters = {\n M: 2,\n L: 2,\n H: 1,\n V: 1,\n C: 6,\n S: 4,\n Q: 4,\n T: 2,\n A: 7,\n Z: 0\n}\n\nconst pathHandlers = {\n M: function (c, p, p0) {\n p.x = p0.x = c[0]\n p.y = p0.y = c[1]\n\n return ['M', p.x, p.y]\n },\n L: function (c, p) {\n p.x = c[0]\n p.y = c[1]\n return ['L', c[0], c[1]]\n },\n H: function (c, p) {\n p.x = c[0]\n return ['H', c[0]]\n },\n V: function (c, p) {\n p.y = c[0]\n return ['V', c[0]]\n },\n C: function (c, p) {\n p.x = c[4]\n p.y = c[5]\n return ['C', c[0], c[1], c[2], c[3], c[4], c[5]]\n },\n S: function (c, p) {\n p.x = c[2]\n p.y = c[3]\n return ['S', c[0], c[1], c[2], c[3]]\n },\n Q: function (c, p) {\n p.x = c[2]\n p.y = c[3]\n return ['Q', c[0], c[1], c[2], c[3]]\n },\n T: function (c, p) {\n p.x = c[0]\n p.y = c[1]\n return ['T', c[0], c[1]]\n },\n Z: function (c, p, p0) {\n p.x = p0.x\n p.y = p0.y\n return ['Z']\n },\n A: function (c, p) {\n p.x = c[5]\n p.y = c[6]\n return ['A', c[0], c[1], c[2], c[3], c[4], c[5], c[6]]\n }\n}\n\nconst mlhvqtcsaz = 'mlhvqtcsaz'.split('')\n\nfor (let i = 0, il = mlhvqtcsaz.length; i < il; ++i) {\n pathHandlers[mlhvqtcsaz[i]] = (function (i) {\n return function (c, p, p0) {\n if (i === 'H') c[0] = c[0] + p.x\n else if (i === 'V') c[0] = c[0] + p.y\n else if (i === 'A') {\n c[5] = c[5] + p.x\n c[6] = c[6] + p.y\n } else {\n for (let j = 0, jl = c.length; j < jl; ++j) {\n c[j] = c[j] + (j % 2 ? p.y : p.x)\n }\n }\n\n return pathHandlers[i](c, p, p0)\n }\n })(mlhvqtcsaz[i].toUpperCase())\n}\n\nfunction makeAbsolut(parser) {\n const command = parser.segment[0]\n return pathHandlers[command](parser.segment.slice(1), parser.p, parser.p0)\n}\n\nfunction segmentComplete(parser) {\n return (\n parser.segment.length &&\n parser.segment.length - 1 ===\n segmentParameters[parser.segment[0].toUpperCase()]\n )\n}\n\nfunction startNewSegment(parser, token) {\n parser.inNumber && finalizeNumber(parser, false)\n const pathLetter = isPathLetter.test(token)\n\n if (pathLetter) {\n parser.segment = [token]\n } else {\n const lastCommand = parser.lastCommand\n const small = lastCommand.toLowerCase()\n const isSmall = lastCommand === small\n parser.segment = [small === 'm' ? (isSmall ? 'l' : 'L') : lastCommand]\n }\n\n parser.inSegment = true\n parser.lastCommand = parser.segment[0]\n\n return pathLetter\n}\n\nfunction finalizeNumber(parser, inNumber) {\n if (!parser.inNumber) throw new Error('Parser Error')\n parser.number && parser.segment.push(parseFloat(parser.number))\n parser.inNumber = inNumber\n parser.number = ''\n parser.pointSeen = false\n parser.hasExponent = false\n\n if (segmentComplete(parser)) {\n finalizeSegment(parser)\n }\n}\n\nfunction finalizeSegment(parser) {\n parser.inSegment = false\n if (parser.absolute) {\n parser.segment = makeAbsolut(parser)\n }\n parser.segments.push(parser.segment)\n}\n\nfunction isArcFlag(parser) {\n if (!parser.segment.length) return false\n const isArc = parser.segment[0].toUpperCase() === 'A'\n const length = parser.segment.length\n\n return isArc && (length === 4 || length === 5)\n}\n\nfunction isExponential(parser) {\n return parser.lastToken.toUpperCase() === 'E'\n}\n\nconst pathDelimiters = new Set([' ', ',', '\\t', '\\n', '\\r', '\\f'])\nexport function pathParser(d, toAbsolute = true) {\n let index = 0\n let token = ''\n const parser = {\n segment: [],\n inNumber: false,\n number: '',\n lastToken: '',\n inSegment: false,\n segments: [],\n pointSeen: false,\n hasExponent: false,\n absolute: toAbsolute,\n p0: new Point(),\n p: new Point()\n }\n\n while (((parser.lastToken = token), (token = d.charAt(index++)))) {\n if (!parser.inSegment) {\n if (startNewSegment(parser, token)) {\n continue\n }\n }\n\n if (token === '.') {\n if (parser.pointSeen || parser.hasExponent) {\n finalizeNumber(parser, false)\n --index\n continue\n }\n parser.inNumber = true\n parser.pointSeen = true\n parser.number += token\n continue\n }\n\n if (!isNaN(parseInt(token))) {\n if (parser.number === '0' || isArcFlag(parser)) {\n parser.inNumber = true\n parser.number = token\n finalizeNumber(parser, true)\n continue\n }\n\n parser.inNumber = true\n parser.number += token\n continue\n }\n\n if (pathDelimiters.has(token)) {\n if (parser.inNumber) {\n finalizeNumber(parser, false)\n }\n continue\n }\n\n if (token === '-' || token === '+') {\n if (parser.inNumber && !isExponential(parser)) {\n finalizeNumber(parser, false)\n --index\n continue\n }\n parser.number += token\n parser.inNumber = true\n continue\n }\n\n if (token.toUpperCase() === 'E') {\n parser.number += token\n parser.hasExponent = true\n continue\n }\n\n if (isPathLetter.test(token)) {\n if (parser.inNumber) {\n finalizeNumber(parser, false)\n } else if (!segmentComplete(parser)) {\n throw new Error('parser Error')\n } else {\n finalizeSegment(parser)\n }\n --index\n }\n }\n\n if (parser.inNumber) {\n finalizeNumber(parser, false)\n }\n\n if (parser.inSegment && segmentComplete(parser)) {\n finalizeSegment(parser)\n }\n\n return parser.segments\n}\n","import SVGArray from './SVGArray.js'\nimport parser from '../modules/core/parser.js'\nimport Box from './Box.js'\nimport { pathParser } from '../utils/pathParser.js'\n\nfunction arrayToString(a) {\n let s = ''\n for (let i = 0, il = a.length; i < il; i++) {\n s += a[i][0]\n\n if (a[i][1] != null) {\n s += a[i][1]\n\n if (a[i][2] != null) {\n s += ' '\n s += a[i][2]\n\n if (a[i][3] != null) {\n s += ' '\n s += a[i][3]\n s += ' '\n s += a[i][4]\n\n if (a[i][5] != null) {\n s += ' '\n s += a[i][5]\n s += ' '\n s += a[i][6]\n\n if (a[i][7] != null) {\n s += ' '\n s += a[i][7]\n }\n }\n }\n }\n }\n }\n\n return s + ' '\n}\n\nexport default class PathArray extends SVGArray {\n // Get bounding box of path\n bbox() {\n parser().path.setAttribute('d', this.toString())\n return new Box(parser.nodes.path.getBBox())\n }\n\n // Move path string\n move(x, y) {\n // get bounding box of current situation\n const box = this.bbox()\n\n // get relative offset\n x -= box.x\n y -= box.y\n\n if (!isNaN(x) && !isNaN(y)) {\n // move every point\n for (let l, i = this.length - 1; i >= 0; i--) {\n l = this[i][0]\n\n if (l === 'M' || l === 'L' || l === 'T') {\n this[i][1] += x\n this[i][2] += y\n } else if (l === 'H') {\n this[i][1] += x\n } else if (l === 'V') {\n this[i][1] += y\n } else if (l === 'C' || l === 'S' || l === 'Q') {\n this[i][1] += x\n this[i][2] += y\n this[i][3] += x\n this[i][4] += y\n\n if (l === 'C') {\n this[i][5] += x\n this[i][6] += y\n }\n } else if (l === 'A') {\n this[i][6] += x\n this[i][7] += y\n }\n }\n }\n\n return this\n }\n\n // Absolutize and parse path to array\n parse(d = 'M0 0') {\n if (Array.isArray(d)) {\n d = Array.prototype.concat.apply([], d).toString()\n }\n\n return pathParser(d)\n }\n\n // Resize path string\n size(width, height) {\n // get bounding box of current situation\n const box = this.bbox()\n let i, l\n\n // If the box width or height is 0 then we ignore\n // transformations on the respective axis\n box.width = box.width === 0 ? 1 : box.width\n box.height = box.height === 0 ? 1 : box.height\n\n // recalculate position of all points according to new size\n for (i = this.length - 1; i >= 0; i--) {\n l = this[i][0]\n\n if (l === 'M' || l === 'L' || l === 'T') {\n this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x\n this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y\n } else if (l === 'H') {\n this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x\n } else if (l === 'V') {\n this[i][1] = ((this[i][1] - box.y) * height) / box.height + box.y\n } else if (l === 'C' || l === 'S' || l === 'Q') {\n this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x\n this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y\n this[i][3] = ((this[i][3] - box.x) * width) / box.width + box.x\n this[i][4] = ((this[i][4] - box.y) * height) / box.height + box.y\n\n if (l === 'C') {\n this[i][5] = ((this[i][5] - box.x) * width) / box.width + box.x\n this[i][6] = ((this[i][6] - box.y) * height) / box.height + box.y\n }\n } else if (l === 'A') {\n // resize radii\n this[i][1] = (this[i][1] * width) / box.width\n this[i][2] = (this[i][2] * height) / box.height\n\n // move position values\n this[i][6] = ((this[i][6] - box.x) * width) / box.width + box.x\n this[i][7] = ((this[i][7] - box.y) * height) / box.height + box.y\n }\n }\n\n return this\n }\n\n // Convert array to string\n toString() {\n return arrayToString(this)\n }\n}\n","import { Ease } from './Controller.js'\nimport {\n delimiter,\n numberAndUnit,\n isPathLetter\n} from '../modules/core/regex.js'\nimport { extend } from '../utils/adopter.js'\nimport Color from '../types/Color.js'\nimport PathArray from '../types/PathArray.js'\nimport SVGArray from '../types/SVGArray.js'\nimport SVGNumber from '../types/SVGNumber.js'\n\nconst getClassForType = (value) => {\n const type = typeof value\n\n if (type === 'number') {\n return SVGNumber\n } else if (type === 'string') {\n if (Color.isColor(value)) {\n return Color\n } else if (delimiter.test(value)) {\n return isPathLetter.test(value) ? PathArray : SVGArray\n } else if (numberAndUnit.test(value)) {\n return SVGNumber\n } else {\n return NonMorphable\n }\n } else if (morphableTypes.indexOf(value.constructor) > -1) {\n return value.constructor\n } else if (Array.isArray(value)) {\n return SVGArray\n } else if (type === 'object') {\n return ObjectBag\n } else {\n return NonMorphable\n }\n}\n\nexport default class Morphable {\n constructor(stepper) {\n this._stepper = stepper || new Ease('-')\n\n this._from = null\n this._to = null\n this._type = null\n this._context = null\n this._morphObj = null\n }\n\n at(pos) {\n return this._morphObj.morph(\n this._from,\n this._to,\n pos,\n this._stepper,\n this._context\n )\n }\n\n done() {\n const complete = this._context.map(this._stepper.done).reduce(function (\n last,\n curr\n ) {\n return last && curr\n }, true)\n return complete\n }\n\n from(val) {\n if (val == null) {\n return this._from\n }\n\n this._from = this._set(val)\n return this\n }\n\n stepper(stepper) {\n if (stepper == null) return this._stepper\n this._stepper = stepper\n return this\n }\n\n to(val) {\n if (val == null) {\n return this._to\n }\n\n this._to = this._set(val)\n return this\n }\n\n type(type) {\n // getter\n if (type == null) {\n return this._type\n }\n\n // setter\n this._type = type\n return this\n }\n\n _set(value) {\n if (!this._type) {\n this.type(getClassForType(value))\n }\n\n let result = new this._type(value)\n if (this._type === Color) {\n result = this._to\n ? result[this._to[4]]()\n : this._from\n ? result[this._from[4]]()\n : result\n }\n\n if (this._type === ObjectBag) {\n result = this._to\n ? result.align(this._to)\n : this._from\n ? result.align(this._from)\n : result\n }\n\n result = result.toConsumable()\n\n this._morphObj = this._morphObj || new this._type()\n this._context =\n this._context ||\n Array.apply(null, Array(result.length))\n .map(Object)\n .map(function (o) {\n o.done = true\n return o\n })\n return result\n }\n}\n\nexport class NonMorphable {\n constructor(...args) {\n this.init(...args)\n }\n\n init(val) {\n val = Array.isArray(val) ? val[0] : val\n this.value = val\n return this\n }\n\n toArray() {\n return [this.value]\n }\n\n valueOf() {\n return this.value\n }\n}\n\nexport class TransformBag {\n constructor(...args) {\n this.init(...args)\n }\n\n init(obj) {\n if (Array.isArray(obj)) {\n obj = {\n scaleX: obj[0],\n scaleY: obj[1],\n shear: obj[2],\n rotate: obj[3],\n translateX: obj[4],\n translateY: obj[5],\n originX: obj[6],\n originY: obj[7]\n }\n }\n\n Object.assign(this, TransformBag.defaults, obj)\n return this\n }\n\n toArray() {\n const v = this\n\n return [\n v.scaleX,\n v.scaleY,\n v.shear,\n v.rotate,\n v.translateX,\n v.translateY,\n v.originX,\n v.originY\n ]\n }\n}\n\nTransformBag.defaults = {\n scaleX: 1,\n scaleY: 1,\n shear: 0,\n rotate: 0,\n translateX: 0,\n translateY: 0,\n originX: 0,\n originY: 0\n}\n\nconst sortByKey = (a, b) => {\n return a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0\n}\n\nexport class ObjectBag {\n constructor(...args) {\n this.init(...args)\n }\n\n align(other) {\n const values = this.values\n for (let i = 0, il = values.length; i < il; ++i) {\n // If the type is the same we only need to check if the color is in the correct format\n if (values[i + 1] === other[i + 1]) {\n if (values[i + 1] === Color && other[i + 7] !== values[i + 7]) {\n const space = other[i + 7]\n const color = new Color(this.values.splice(i + 3, 5))\n [space]()\n .toArray()\n this.values.splice(i + 3, 0, ...color)\n }\n\n i += values[i + 2] + 2\n continue\n }\n\n if (!other[i + 1]) {\n return this\n }\n\n // The types differ, so we overwrite the new type with the old one\n // And initialize it with the types default (e.g. black for color or 0 for number)\n const defaultObject = new other[i + 1]().toArray()\n\n // Than we fix the values array\n const toDelete = values[i + 2] + 3\n\n values.splice(\n i,\n toDelete,\n other[i],\n other[i + 1],\n other[i + 2],\n ...defaultObject\n )\n\n i += values[i + 2] + 2\n }\n return this\n }\n\n init(objOrArr) {\n this.values = []\n\n if (Array.isArray(objOrArr)) {\n this.values = objOrArr.slice()\n return\n }\n\n objOrArr = objOrArr || {}\n const entries = []\n\n for (const i in objOrArr) {\n const Type = getClassForType(objOrArr[i])\n const val = new Type(objOrArr[i]).toArray()\n entries.push([i, Type, val.length, ...val])\n }\n\n entries.sort(sortByKey)\n\n this.values = entries.reduce((last, curr) => last.concat(curr), [])\n return this\n }\n\n toArray() {\n return this.values\n }\n\n valueOf() {\n const obj = {}\n const arr = this.values\n\n // for (var i = 0, len = arr.length; i < len; i += 2) {\n while (arr.length) {\n const key = arr.shift()\n const Type = arr.shift()\n const num = arr.shift()\n const values = arr.splice(0, num)\n obj[key] = new Type(values) // .valueOf()\n }\n\n return obj\n }\n}\n\nconst morphableTypes = [NonMorphable, TransformBag, ObjectBag]\n\nexport function registerMorphableType(type = []) {\n morphableTypes.push(...[].concat(type))\n}\n\nexport function makeMorphable() {\n extend(morphableTypes, {\n to(val) {\n return new Morphable()\n .type(this.constructor)\n .from(this.toArray()) // this.valueOf())\n .to(val)\n },\n fromArray(arr) {\n this.init(arr)\n return this\n },\n toConsumable() {\n return this.toArray()\n },\n morph(from, to, pos, stepper, context) {\n const mapper = function (i, index) {\n return stepper.step(i, to[index], pos, context[index], context)\n }\n\n return this.fromArray(from.map(mapper))\n }\n })\n}\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { proportionalSize } from '../utils/utils.js'\nimport { registerMethods } from '../utils/methods.js'\nimport PathArray from '../types/PathArray.js'\nimport Shape from './Shape.js'\n\nexport default class Path extends Shape {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('path', node), attrs)\n }\n\n // Get array\n array() {\n return this._array || (this._array = new PathArray(this.attr('d')))\n }\n\n // Clear array cache\n clear() {\n delete this._array\n return this\n }\n\n // Set height of element\n height(height) {\n return height == null\n ? this.bbox().height\n : this.size(this.bbox().width, height)\n }\n\n // Move by left top corner\n move(x, y) {\n return this.attr('d', this.array().move(x, y))\n }\n\n // Plot new path\n plot(d) {\n return d == null\n ? this.array()\n : this.clear().attr(\n 'd',\n typeof d === 'string' ? d : (this._array = new PathArray(d))\n )\n }\n\n // Set element size to given width and height\n size(width, height) {\n const p = proportionalSize(this, width, height)\n return this.attr('d', this.array().size(p.width, p.height))\n }\n\n // Set width of element\n width(width) {\n return width == null\n ? this.bbox().width\n : this.size(width, this.bbox().height)\n }\n\n // Move by left top corner over x-axis\n x(x) {\n return x == null ? this.bbox().x : this.move(x, this.bbox().y)\n }\n\n // Move by left top corner over y-axis\n y(y) {\n return y == null ? this.bbox().y : this.move(this.bbox().x, y)\n }\n}\n\n// Define morphable array\nPath.prototype.MorphArray = PathArray\n\n// Add parent method\nregisterMethods({\n Container: {\n // Create a wrapped path element\n path: wrapWithAttrCheck(function (d) {\n // make sure plot is called as a setter\n return this.put(new Path()).plot(d || new PathArray())\n })\n }\n})\n\nregister(Path, 'Path')\n","import { proportionalSize } from '../../utils/utils.js'\nimport PointArray from '../../types/PointArray.js'\n\n// Get array\nexport function array() {\n return this._array || (this._array = new PointArray(this.attr('points')))\n}\n\n// Clear array cache\nexport function clear() {\n delete this._array\n return this\n}\n\n// Move by left top corner\nexport function move(x, y) {\n return this.attr('points', this.array().move(x, y))\n}\n\n// Plot new path\nexport function plot(p) {\n return p == null\n ? this.array()\n : this.clear().attr(\n 'points',\n typeof p === 'string' ? p : (this._array = new PointArray(p))\n )\n}\n\n// Set element size to given width and height\nexport function size(width, height) {\n const p = proportionalSize(this, width, height)\n return this.attr('points', this.array().size(p.width, p.height))\n}\n","import {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport PointArray from '../types/PointArray.js'\nimport Shape from './Shape.js'\nimport * as pointed from '../modules/core/pointed.js'\nimport * as poly from '../modules/core/poly.js'\n\nexport default class Polygon extends Shape {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('polygon', node), attrs)\n }\n}\n\nregisterMethods({\n Container: {\n // Create a wrapped polygon element\n polygon: wrapWithAttrCheck(function (p) {\n // make sure plot is called as a setter\n return this.put(new Polygon()).plot(p || new PointArray())\n })\n }\n})\n\nextend(Polygon, pointed)\nextend(Polygon, poly)\nregister(Polygon, 'Polygon')\n","import {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport PointArray from '../types/PointArray.js'\nimport Shape from './Shape.js'\nimport * as pointed from '../modules/core/pointed.js'\nimport * as poly from '../modules/core/poly.js'\n\nexport default class Polyline extends Shape {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('polyline', node), attrs)\n }\n}\n\nregisterMethods({\n Container: {\n // Create a wrapped polygon element\n polyline: wrapWithAttrCheck(function (p) {\n // make sure plot is called as a setter\n return this.put(new Polyline()).plot(p || new PointArray())\n })\n }\n})\n\nextend(Polyline, pointed)\nextend(Polyline, poly)\nregister(Polyline, 'Polyline')\n","import {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport { rx, ry } from '../modules/core/circled.js'\nimport Shape from './Shape.js'\n\nexport default class Rect extends Shape {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('rect', node), attrs)\n }\n}\n\nextend(Rect, { rx, ry })\n\nregisterMethods({\n Container: {\n // Create a rect element\n rect: wrapWithAttrCheck(function (width, height) {\n return this.put(new Rect()).size(width, height)\n })\n }\n})\n\nregister(Rect, 'Rect')\n","export default class Queue {\n constructor() {\n this._first = null\n this._last = null\n }\n\n // Shows us the first item in the list\n first() {\n return this._first && this._first.value\n }\n\n // Shows us the last item in the list\n last() {\n return this._last && this._last.value\n }\n\n push(value) {\n // An item stores an id and the provided value\n const item =\n typeof value.next !== 'undefined'\n ? value\n : { value: value, next: null, prev: null }\n\n // Deal with the queue being empty or populated\n if (this._last) {\n item.prev = this._last\n this._last.next = item\n this._last = item\n } else {\n this._last = item\n this._first = item\n }\n\n // Return the current item\n return item\n }\n\n // Removes the item that was returned from the push\n remove(item) {\n // Relink the previous item\n if (item.prev) item.prev.next = item.next\n if (item.next) item.next.prev = item.prev\n if (item === this._last) this._last = item.prev\n if (item === this._first) this._first = item.next\n\n // Invalidate item\n item.prev = null\n item.next = null\n }\n\n shift() {\n // Check if we have a value\n const remove = this._first\n if (!remove) return null\n\n // If we do, remove it and relink things\n this._first = remove.next\n if (this._first) this._first.prev = null\n this._last = this._first ? this._last : null\n return remove.value\n }\n}\n","import { globals } from '../utils/window.js'\nimport Queue from './Queue.js'\n\nconst Animator = {\n nextDraw: null,\n frames: new Queue(),\n timeouts: new Queue(),\n immediates: new Queue(),\n timer: () => globals.window.performance || globals.window.Date,\n transforms: [],\n\n frame(fn) {\n // Store the node\n const node = Animator.frames.push({ run: fn })\n\n // Request an animation frame if we don't have one\n if (Animator.nextDraw === null) {\n Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw)\n }\n\n // Return the node so we can remove it easily\n return node\n },\n\n timeout(fn, delay) {\n delay = delay || 0\n\n // Work out when the event should fire\n const time = Animator.timer().now() + delay\n\n // Add the timeout to the end of the queue\n const node = Animator.timeouts.push({ run: fn, time: time })\n\n // Request another animation frame if we need one\n if (Animator.nextDraw === null) {\n Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw)\n }\n\n return node\n },\n\n immediate(fn) {\n // Add the immediate fn to the end of the queue\n const node = Animator.immediates.push(fn)\n // Request another animation frame if we need one\n if (Animator.nextDraw === null) {\n Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw)\n }\n\n return node\n },\n\n cancelFrame(node) {\n node != null && Animator.frames.remove(node)\n },\n\n clearTimeout(node) {\n node != null && Animator.timeouts.remove(node)\n },\n\n cancelImmediate(node) {\n node != null && Animator.immediates.remove(node)\n },\n\n _draw(now) {\n // Run all the timeouts we can run, if they are not ready yet, add them\n // to the end of the queue immediately! (bad timeouts!!! [sarcasm])\n let nextTimeout = null\n const lastTimeout = Animator.timeouts.last()\n while ((nextTimeout = Animator.timeouts.shift())) {\n // Run the timeout if its time, or push it to the end\n if (now >= nextTimeout.time) {\n nextTimeout.run()\n } else {\n Animator.timeouts.push(nextTimeout)\n }\n\n // If we hit the last item, we should stop shifting out more items\n if (nextTimeout === lastTimeout) break\n }\n\n // Run all of the animation frames\n let nextFrame = null\n const lastFrame = Animator.frames.last()\n while (nextFrame !== lastFrame && (nextFrame = Animator.frames.shift())) {\n nextFrame.run(now)\n }\n\n let nextImmediate = null\n while ((nextImmediate = Animator.immediates.shift())) {\n nextImmediate()\n }\n\n // If we have remaining timeouts or frames, draw until we don't anymore\n Animator.nextDraw =\n Animator.timeouts.first() || Animator.frames.first()\n ? globals.window.requestAnimationFrame(Animator._draw)\n : null\n }\n}\n\nexport default Animator\n","import { globals } from '../utils/window.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Animator from './Animator.js'\nimport EventTarget from '../types/EventTarget.js'\n\nconst makeSchedule = function (runnerInfo) {\n const start = runnerInfo.start\n const duration = runnerInfo.runner.duration()\n const end = start + duration\n return {\n start: start,\n duration: duration,\n end: end,\n runner: runnerInfo.runner\n }\n}\n\nconst defaultSource = function () {\n const w = globals.window\n return (w.performance || w.Date).now()\n}\n\nexport default class Timeline extends EventTarget {\n // Construct a new timeline on the given element\n constructor(timeSource = defaultSource) {\n super()\n\n this._timeSource = timeSource\n\n // terminate resets all variables to their initial state\n this.terminate()\n }\n\n active() {\n return !!this._nextFrame\n }\n\n finish() {\n // Go to end and pause\n this.time(this.getEndTimeOfTimeline() + 1)\n return this.pause()\n }\n\n // Calculates the end of the timeline\n getEndTime() {\n const lastRunnerInfo = this.getLastRunnerInfo()\n const lastDuration = lastRunnerInfo ? lastRunnerInfo.runner.duration() : 0\n const lastStartTime = lastRunnerInfo ? lastRunnerInfo.start : this._time\n return lastStartTime + lastDuration\n }\n\n getEndTimeOfTimeline() {\n const endTimes = this._runners.map((i) => i.start + i.runner.duration())\n return Math.max(0, ...endTimes)\n }\n\n getLastRunnerInfo() {\n return this.getRunnerInfoById(this._lastRunnerId)\n }\n\n getRunnerInfoById(id) {\n return this._runners[this._runnerIds.indexOf(id)] || null\n }\n\n pause() {\n this._paused = true\n return this._continue()\n }\n\n persist(dtOrForever) {\n if (dtOrForever == null) return this._persist\n this._persist = dtOrForever\n return this\n }\n\n play() {\n // Now make sure we are not paused and continue the animation\n this._paused = false\n return this.updateTime()._continue()\n }\n\n reverse(yes) {\n const currentSpeed = this.speed()\n if (yes == null) return this.speed(-currentSpeed)\n\n const positive = Math.abs(currentSpeed)\n return this.speed(yes ? -positive : positive)\n }\n\n // schedules a runner on the timeline\n schedule(runner, delay, when) {\n if (runner == null) {\n return this._runners.map(makeSchedule)\n }\n\n // The start time for the next animation can either be given explicitly,\n // derived from the current timeline time or it can be relative to the\n // last start time to chain animations directly\n\n let absoluteStartTime = 0\n const endTime = this.getEndTime()\n delay = delay || 0\n\n // Work out when to start the animation\n if (when == null || when === 'last' || when === 'after') {\n // Take the last time and increment\n absoluteStartTime = endTime\n } else if (when === 'absolute' || when === 'start') {\n absoluteStartTime = delay\n delay = 0\n } else if (when === 'now') {\n absoluteStartTime = this._time\n } else if (when === 'relative') {\n const runnerInfo = this.getRunnerInfoById(runner.id)\n if (runnerInfo) {\n absoluteStartTime = runnerInfo.start + delay\n delay = 0\n }\n } else if (when === 'with-last') {\n const lastRunnerInfo = this.getLastRunnerInfo()\n const lastStartTime = lastRunnerInfo ? lastRunnerInfo.start : this._time\n absoluteStartTime = lastStartTime\n } else {\n throw new Error('Invalid value for the \"when\" parameter')\n }\n\n // Manage runner\n runner.unschedule()\n runner.timeline(this)\n\n const persist = runner.persist()\n const runnerInfo = {\n persist: persist === null ? this._persist : persist,\n start: absoluteStartTime + delay,\n runner\n }\n\n this._lastRunnerId = runner.id\n\n this._runners.push(runnerInfo)\n this._runners.sort((a, b) => a.start - b.start)\n this._runnerIds = this._runners.map((info) => info.runner.id)\n\n this.updateTime()._continue()\n return this\n }\n\n seek(dt) {\n return this.time(this._time + dt)\n }\n\n source(fn) {\n if (fn == null) return this._timeSource\n this._timeSource = fn\n return this\n }\n\n speed(speed) {\n if (speed == null) return this._speed\n this._speed = speed\n return this\n }\n\n stop() {\n // Go to start and pause\n this.time(0)\n return this.pause()\n }\n\n time(time) {\n if (time == null) return this._time\n this._time = time\n return this._continue(true)\n }\n\n // Remove the runner from this timeline\n unschedule(runner) {\n const index = this._runnerIds.indexOf(runner.id)\n if (index < 0) return this\n\n this._runners.splice(index, 1)\n this._runnerIds.splice(index, 1)\n\n runner.timeline(null)\n return this\n }\n\n // Makes sure, that after pausing the time doesn't jump\n updateTime() {\n if (!this.active()) {\n this._lastSourceTime = this._timeSource()\n }\n return this\n }\n\n // Checks if we are running and continues the animation\n _continue(immediateStep = false) {\n Animator.cancelFrame(this._nextFrame)\n this._nextFrame = null\n\n if (immediateStep) return this._stepImmediate()\n if (this._paused) return this\n\n this._nextFrame = Animator.frame(this._step)\n return this\n }\n\n _stepFn(immediateStep = false) {\n // Get the time delta from the last time and update the time\n const time = this._timeSource()\n let dtSource = time - this._lastSourceTime\n\n if (immediateStep) dtSource = 0\n\n const dtTime = this._speed * dtSource + (this._time - this._lastStepTime)\n this._lastSourceTime = time\n\n // Only update the time if we use the timeSource.\n // Otherwise use the current time\n if (!immediateStep) {\n // Update the time\n this._time += dtTime\n this._time = this._time < 0 ? 0 : this._time\n }\n this._lastStepTime = this._time\n this.fire('time', this._time)\n\n // This is for the case that the timeline was seeked so that the time\n // is now before the startTime of the runner. That is why we need to set\n // the runner to position 0\n\n // FIXME:\n // However, resetting in insertion order leads to bugs. Considering the case,\n // where 2 runners change the same attribute but in different times,\n // resetting both of them will lead to the case where the later defined\n // runner always wins the reset even if the other runner started earlier\n // and therefore should win the attribute battle\n // this can be solved by resetting them backwards\n for (let k = this._runners.length; k--; ) {\n // Get and run the current runner and ignore it if its inactive\n const runnerInfo = this._runners[k]\n const runner = runnerInfo.runner\n\n // Make sure that we give the actual difference\n // between runner start time and now\n const dtToStart = this._time - runnerInfo.start\n\n // Dont run runner if not started yet\n // and try to reset it\n if (dtToStart <= 0) {\n runner.reset()\n }\n }\n\n // Run all of the runners directly\n let runnersLeft = false\n for (let i = 0, len = this._runners.length; i < len; i++) {\n // Get and run the current runner and ignore it if its inactive\n const runnerInfo = this._runners[i]\n const runner = runnerInfo.runner\n let dt = dtTime\n\n // Make sure that we give the actual difference\n // between runner start time and now\n const dtToStart = this._time - runnerInfo.start\n\n // Dont run runner if not started yet\n if (dtToStart <= 0) {\n runnersLeft = true\n continue\n } else if (dtToStart < dt) {\n // Adjust dt to make sure that animation is on point\n dt = dtToStart\n }\n\n if (!runner.active()) continue\n\n // If this runner is still going, signal that we need another animation\n // frame, otherwise, remove the completed runner\n const finished = runner.step(dt).done\n if (!finished) {\n runnersLeft = true\n // continue\n } else if (runnerInfo.persist !== true) {\n // runner is finished. And runner might get removed\n const endTime = runner.duration() - runner.time() + this._time\n\n if (endTime + runnerInfo.persist < this._time) {\n // Delete runner and correct index\n runner.unschedule()\n --i\n --len\n }\n }\n }\n\n // Basically: we continue when there are runners right from us in time\n // when -->, and when runners are left from us when <--\n if (\n (runnersLeft && !(this._speed < 0 && this._time === 0)) ||\n (this._runnerIds.length && this._speed < 0 && this._time > 0)\n ) {\n this._continue()\n } else {\n this.pause()\n this.fire('finished')\n }\n\n return this\n }\n\n terminate() {\n // cleanup memory\n\n // Store the timing variables\n this._startTime = 0\n this._speed = 1.0\n\n // Determines how long a runner is hold in memory. Can be a dt or true/false\n this._persist = 0\n\n // Keep track of the running animations and their starting parameters\n this._nextFrame = null\n this._paused = true\n this._runners = []\n this._runnerIds = []\n this._lastRunnerId = -1\n this._time = 0\n this._lastSourceTime = 0\n this._lastStepTime = 0\n\n // Make sure that step is always called in class context\n this._step = this._stepFn.bind(this, false)\n this._stepImmediate = this._stepFn.bind(this, true)\n }\n}\n\nregisterMethods({\n Element: {\n timeline: function (timeline) {\n if (timeline == null) {\n this._timeline = this._timeline || new Timeline()\n return this._timeline\n } else {\n this._timeline = timeline\n return this\n }\n }\n }\n})\n","import { Controller, Ease, Stepper } from './Controller.js'\nimport { extend, register } from '../utils/adopter.js'\nimport { from, to } from '../modules/core/gradiented.js'\nimport { getOrigin } from '../utils/utils.js'\nimport { noop, timeline } from '../modules/core/defaults.js'\nimport { registerMethods } from '../utils/methods.js'\nimport { rx, ry } from '../modules/core/circled.js'\nimport Animator from './Animator.js'\nimport Box from '../types/Box.js'\nimport EventTarget from '../types/EventTarget.js'\nimport Matrix from '../types/Matrix.js'\nimport Morphable, { TransformBag, ObjectBag } from './Morphable.js'\nimport Point from '../types/Point.js'\nimport SVGNumber from '../types/SVGNumber.js'\nimport Timeline from './Timeline.js'\n\nexport default class Runner extends EventTarget {\n constructor(options) {\n super()\n\n // Store a unique id on the runner, so that we can identify it later\n this.id = Runner.id++\n\n // Ensure a default value\n options = options == null ? timeline.duration : options\n\n // Ensure that we get a controller\n options = typeof options === 'function' ? new Controller(options) : options\n\n // Declare all of the variables\n this._element = null\n this._timeline = null\n this.done = false\n this._queue = []\n\n // Work out the stepper and the duration\n this._duration = typeof options === 'number' && options\n this._isDeclarative = options instanceof Controller\n this._stepper = this._isDeclarative ? options : new Ease()\n\n // We copy the current values from the timeline because they can change\n this._history = {}\n\n // Store the state of the runner\n this.enabled = true\n this._time = 0\n this._lastTime = 0\n\n // At creation, the runner is in reset state\n this._reseted = true\n\n // Save transforms applied to this runner\n this.transforms = new Matrix()\n this.transformId = 1\n\n // Looping variables\n this._haveReversed = false\n this._reverse = false\n this._loopsDone = 0\n this._swing = false\n this._wait = 0\n this._times = 1\n\n this._frameId = null\n\n // Stores how long a runner is stored after being done\n this._persist = this._isDeclarative ? true : null\n }\n\n static sanitise(duration, delay, when) {\n // Initialise the default parameters\n let times = 1\n let swing = false\n let wait = 0\n duration = duration ?? timeline.duration\n delay = delay ?? timeline.delay\n when = when || 'last'\n\n // If we have an object, unpack the values\n if (typeof duration === 'object' && !(duration instanceof Stepper)) {\n delay = duration.delay ?? delay\n when = duration.when ?? when\n swing = duration.swing || swing\n times = duration.times ?? times\n wait = duration.wait ?? wait\n duration = duration.duration ?? timeline.duration\n }\n\n return {\n duration: duration,\n delay: delay,\n swing: swing,\n times: times,\n wait: wait,\n when: when\n }\n }\n\n active(enabled) {\n if (enabled == null) return this.enabled\n this.enabled = enabled\n return this\n }\n\n /*\n Private Methods\n ===============\n Methods that shouldn't be used externally\n */\n addTransform(transform) {\n this.transforms.lmultiplyO(transform)\n return this\n }\n\n after(fn) {\n return this.on('finished', fn)\n }\n\n animate(duration, delay, when) {\n const o = Runner.sanitise(duration, delay, when)\n const runner = new Runner(o.duration)\n if (this._timeline) runner.timeline(this._timeline)\n if (this._element) runner.element(this._element)\n return runner.loop(o).schedule(o.delay, o.when)\n }\n\n clearTransform() {\n this.transforms = new Matrix()\n return this\n }\n\n // TODO: Keep track of all transformations so that deletion is faster\n clearTransformsFromQueue() {\n if (\n !this.done ||\n !this._timeline ||\n !this._timeline._runnerIds.includes(this.id)\n ) {\n this._queue = this._queue.filter((item) => {\n return !item.isTransform\n })\n }\n }\n\n delay(delay) {\n return this.animate(0, delay)\n }\n\n duration() {\n return this._times * (this._wait + this._duration) - this._wait\n }\n\n during(fn) {\n return this.queue(null, fn)\n }\n\n ease(fn) {\n this._stepper = new Ease(fn)\n return this\n }\n /*\n Runner Definitions\n ==================\n These methods help us define the runtime behaviour of the Runner or they\n help us make new runners from the current runner\n */\n\n element(element) {\n if (element == null) return this._element\n this._element = element\n element._prepareRunner()\n return this\n }\n\n finish() {\n return this.step(Infinity)\n }\n\n loop(times, swing, wait) {\n // Deal with the user passing in an object\n if (typeof times === 'object') {\n swing = times.swing\n wait = times.wait\n times = times.times\n }\n\n // Sanitise the values and store them\n this._times = times || Infinity\n this._swing = swing || false\n this._wait = wait || 0\n\n // Allow true to be passed\n if (this._times === true) {\n this._times = Infinity\n }\n\n return this\n }\n\n loops(p) {\n const loopDuration = this._duration + this._wait\n if (p == null) {\n const loopsDone = Math.floor(this._time / loopDuration)\n const relativeTime = this._time - loopsDone * loopDuration\n const position = relativeTime / this._duration\n return Math.min(loopsDone + position, this._times)\n }\n const whole = Math.floor(p)\n const partial = p % 1\n const time = loopDuration * whole + this._duration * partial\n return this.time(time)\n }\n\n persist(dtOrForever) {\n if (dtOrForever == null) return this._persist\n this._persist = dtOrForever\n return this\n }\n\n position(p) {\n // Get all of the variables we need\n const x = this._time\n const d = this._duration\n const w = this._wait\n const t = this._times\n const s = this._swing\n const r = this._reverse\n let position\n\n if (p == null) {\n /*\n This function converts a time to a position in the range [0, 1]\n The full explanation can be found in this desmos demonstration\n https://www.desmos.com/calculator/u4fbavgche\n The logic is slightly simplified here because we can use booleans\n */\n\n // Figure out the value without thinking about the start or end time\n const f = function (x) {\n const swinging = s * Math.floor((x % (2 * (w + d))) / (w + d))\n const backwards = (swinging && !r) || (!swinging && r)\n const uncliped =\n (Math.pow(-1, backwards) * (x % (w + d))) / d + backwards\n const clipped = Math.max(Math.min(uncliped, 1), 0)\n return clipped\n }\n\n // Figure out the value by incorporating the start time\n const endTime = t * (w + d) - w\n position =\n x <= 0\n ? Math.round(f(1e-5))\n : x < endTime\n ? f(x)\n : Math.round(f(endTime - 1e-5))\n return position\n }\n\n // Work out the loops done and add the position to the loops done\n const loopsDone = Math.floor(this.loops())\n const swingForward = s && loopsDone % 2 === 0\n const forwards = (swingForward && !r) || (r && swingForward)\n position = loopsDone + (forwards ? p : 1 - p)\n return this.loops(position)\n }\n\n progress(p) {\n if (p == null) {\n return Math.min(1, this._time / this.duration())\n }\n return this.time(p * this.duration())\n }\n\n /*\n Basic Functionality\n ===================\n These methods allow us to attach basic functions to the runner directly\n */\n queue(initFn, runFn, retargetFn, isTransform) {\n this._queue.push({\n initialiser: initFn || noop,\n runner: runFn || noop,\n retarget: retargetFn,\n isTransform: isTransform,\n initialised: false,\n finished: false\n })\n const timeline = this.timeline()\n timeline && this.timeline()._continue()\n return this\n }\n\n reset() {\n if (this._reseted) return this\n this.time(0)\n this._reseted = true\n return this\n }\n\n reverse(reverse) {\n this._reverse = reverse == null ? !this._reverse : reverse\n return this\n }\n\n schedule(timeline, delay, when) {\n // The user doesn't need to pass a timeline if we already have one\n if (!(timeline instanceof Timeline)) {\n when = delay\n delay = timeline\n timeline = this.timeline()\n }\n\n // If there is no timeline, yell at the user...\n if (!timeline) {\n throw Error('Runner cannot be scheduled without timeline')\n }\n\n // Schedule the runner on the timeline provided\n timeline.schedule(this, delay, when)\n return this\n }\n\n step(dt) {\n // If we are inactive, this stepper just gets skipped\n if (!this.enabled) return this\n\n // Update the time and get the new position\n dt = dt == null ? 16 : dt\n this._time += dt\n const position = this.position()\n\n // Figure out if we need to run the stepper in this frame\n const running = this._lastPosition !== position && this._time >= 0\n this._lastPosition = position\n\n // Figure out if we just started\n const duration = this.duration()\n const justStarted = this._lastTime <= 0 && this._time > 0\n const justFinished = this._lastTime < duration && this._time >= duration\n\n this._lastTime = this._time\n if (justStarted) {\n this.fire('start', this)\n }\n\n // Work out if the runner is finished set the done flag here so animations\n // know, that they are running in the last step (this is good for\n // transformations which can be merged)\n const declarative = this._isDeclarative\n this.done = !declarative && !justFinished && this._time >= duration\n\n // Runner is running. So its not in reset state anymore\n this._reseted = false\n\n let converged = false\n // Call initialise and the run function\n if (running || declarative) {\n this._initialise(running)\n\n // clear the transforms on this runner so they dont get added again and again\n this.transforms = new Matrix()\n converged = this._run(declarative ? dt : position)\n\n this.fire('step', this)\n }\n // correct the done flag here\n // declarative animations itself know when they converged\n this.done = this.done || (converged && declarative)\n if (justFinished) {\n this.fire('finished', this)\n }\n return this\n }\n\n /*\n Runner animation methods\n ========================\n Control how the animation plays\n */\n time(time) {\n if (time == null) {\n return this._time\n }\n const dt = time - this._time\n this.step(dt)\n return this\n }\n\n timeline(timeline) {\n // check explicitly for undefined so we can set the timeline to null\n if (typeof timeline === 'undefined') return this._timeline\n this._timeline = timeline\n return this\n }\n\n unschedule() {\n const timeline = this.timeline()\n timeline && timeline.unschedule(this)\n return this\n }\n\n // Run each initialise function in the runner if required\n _initialise(running) {\n // If we aren't running, we shouldn't initialise when not declarative\n if (!running && !this._isDeclarative) return\n\n // Loop through all of the initialisers\n for (let i = 0, len = this._queue.length; i < len; ++i) {\n // Get the current initialiser\n const current = this._queue[i]\n\n // Determine whether we need to initialise\n const needsIt = this._isDeclarative || (!current.initialised && running)\n running = !current.finished\n\n // Call the initialiser if we need to\n if (needsIt && running) {\n current.initialiser.call(this)\n current.initialised = true\n }\n }\n }\n\n // Save a morpher to the morpher list so that we can retarget it later\n _rememberMorpher(method, morpher) {\n this._history[method] = {\n morpher: morpher,\n caller: this._queue[this._queue.length - 1]\n }\n\n // We have to resume the timeline in case a controller\n // is already done without being ever run\n // This can happen when e.g. this is done:\n // anim = el.animate(new SVG.Spring)\n // and later\n // anim.move(...)\n if (this._isDeclarative) {\n const timeline = this.timeline()\n timeline && timeline.play()\n }\n }\n\n // Try to set the target for a morpher if the morpher exists, otherwise\n // Run each run function for the position or dt given\n _run(positionOrDt) {\n // Run all of the _queue directly\n let allfinished = true\n for (let i = 0, len = this._queue.length; i < len; ++i) {\n // Get the current function to run\n const current = this._queue[i]\n\n // Run the function if its not finished, we keep track of the finished\n // flag for the sake of declarative _queue\n const converged = current.runner.call(this, positionOrDt)\n current.finished = current.finished || converged === true\n allfinished = allfinished && current.finished\n }\n\n // We report when all of the constructors are finished\n return allfinished\n }\n\n // do nothing and return false\n _tryRetarget(method, target, extra) {\n if (this._history[method]) {\n // if the last method wasn't even initialised, throw it away\n if (!this._history[method].caller.initialised) {\n const index = this._queue.indexOf(this._history[method].caller)\n this._queue.splice(index, 1)\n return false\n }\n\n // for the case of transformations, we use the special retarget function\n // which has access to the outer scope\n if (this._history[method].caller.retarget) {\n this._history[method].caller.retarget.call(this, target, extra)\n // for everything else a simple morpher change is sufficient\n } else {\n this._history[method].morpher.to(target)\n }\n\n this._history[method].caller.finished = false\n const timeline = this.timeline()\n timeline && timeline.play()\n return true\n }\n return false\n }\n}\n\nRunner.id = 0\n\nexport class FakeRunner {\n constructor(transforms = new Matrix(), id = -1, done = true) {\n this.transforms = transforms\n this.id = id\n this.done = done\n }\n\n clearTransformsFromQueue() {}\n}\n\nextend([Runner, FakeRunner], {\n mergeWith(runner) {\n return new FakeRunner(\n runner.transforms.lmultiply(this.transforms),\n runner.id\n )\n }\n})\n\n// FakeRunner.emptyRunner = new FakeRunner()\n\nconst lmultiply = (last, curr) => last.lmultiplyO(curr)\nconst getRunnerTransform = (runner) => runner.transforms\n\nfunction mergeTransforms() {\n // Find the matrix to apply to the element and apply it\n const runners = this._transformationRunners.runners\n const netTransform = runners\n .map(getRunnerTransform)\n .reduce(lmultiply, new Matrix())\n\n this.transform(netTransform)\n\n this._transformationRunners.merge()\n\n if (this._transformationRunners.length() === 1) {\n this._frameId = null\n }\n}\n\nexport class RunnerArray {\n constructor() {\n this.runners = []\n this.ids = []\n }\n\n add(runner) {\n if (this.runners.includes(runner)) return\n const id = runner.id + 1\n\n this.runners.push(runner)\n this.ids.push(id)\n\n return this\n }\n\n clearBefore(id) {\n const deleteCnt = this.ids.indexOf(id + 1) || 1\n this.ids.splice(0, deleteCnt, 0)\n this.runners\n .splice(0, deleteCnt, new FakeRunner())\n .forEach((r) => r.clearTransformsFromQueue())\n return this\n }\n\n edit(id, newRunner) {\n const index = this.ids.indexOf(id + 1)\n this.ids.splice(index, 1, id + 1)\n this.runners.splice(index, 1, newRunner)\n return this\n }\n\n getByID(id) {\n return this.runners[this.ids.indexOf(id + 1)]\n }\n\n length() {\n return this.ids.length\n }\n\n merge() {\n let lastRunner = null\n for (let i = 0; i < this.runners.length; ++i) {\n const runner = this.runners[i]\n\n const condition =\n lastRunner &&\n runner.done &&\n lastRunner.done &&\n // don't merge runner when persisted on timeline\n (!runner._timeline ||\n !runner._timeline._runnerIds.includes(runner.id)) &&\n (!lastRunner._timeline ||\n !lastRunner._timeline._runnerIds.includes(lastRunner.id))\n\n if (condition) {\n // the +1 happens in the function\n this.remove(runner.id)\n const newRunner = runner.mergeWith(lastRunner)\n this.edit(lastRunner.id, newRunner)\n lastRunner = newRunner\n --i\n } else {\n lastRunner = runner\n }\n }\n\n return this\n }\n\n remove(id) {\n const index = this.ids.indexOf(id + 1)\n this.ids.splice(index, 1)\n this.runners.splice(index, 1)\n return this\n }\n}\n\nregisterMethods({\n Element: {\n animate(duration, delay, when) {\n const o = Runner.sanitise(duration, delay, when)\n const timeline = this.timeline()\n return new Runner(o.duration)\n .loop(o)\n .element(this)\n .timeline(timeline.play())\n .schedule(o.delay, o.when)\n },\n\n delay(by, when) {\n return this.animate(0, by, when)\n },\n\n // this function searches for all runners on the element and deletes the ones\n // which run before the current one. This is because absolute transformations\n // overwrite anything anyway so there is no need to waste time computing\n // other runners\n _clearTransformRunnersBefore(currentRunner) {\n this._transformationRunners.clearBefore(currentRunner.id)\n },\n\n _currentTransform(current) {\n return (\n this._transformationRunners.runners\n // we need the equal sign here to make sure, that also transformations\n // on the same runner which execute before the current transformation are\n // taken into account\n .filter((runner) => runner.id <= current.id)\n .map(getRunnerTransform)\n .reduce(lmultiply, new Matrix())\n )\n },\n\n _addRunner(runner) {\n this._transformationRunners.add(runner)\n\n // Make sure that the runner merge is executed at the very end of\n // all Animator functions. That is why we use immediate here to execute\n // the merge right after all frames are run\n Animator.cancelImmediate(this._frameId)\n this._frameId = Animator.immediate(mergeTransforms.bind(this))\n },\n\n _prepareRunner() {\n if (this._frameId == null) {\n this._transformationRunners = new RunnerArray().add(\n new FakeRunner(new Matrix(this))\n )\n }\n }\n }\n})\n\n// Will output the elements from array A that are not in the array B\nconst difference = (a, b) => a.filter((x) => !b.includes(x))\n\nextend(Runner, {\n attr(a, v) {\n return this.styleAttr('attr', a, v)\n },\n\n // Add animatable styles\n css(s, v) {\n return this.styleAttr('css', s, v)\n },\n\n styleAttr(type, nameOrAttrs, val) {\n if (typeof nameOrAttrs === 'string') {\n return this.styleAttr(type, { [nameOrAttrs]: val })\n }\n\n let attrs = nameOrAttrs\n if (this._tryRetarget(type, attrs)) return this\n\n let morpher = new Morphable(this._stepper).to(attrs)\n let keys = Object.keys(attrs)\n\n this.queue(\n function () {\n morpher = morpher.from(this.element()[type](keys))\n },\n function (pos) {\n this.element()[type](morpher.at(pos).valueOf())\n return morpher.done()\n },\n function (newToAttrs) {\n // Check if any new keys were added\n const newKeys = Object.keys(newToAttrs)\n const differences = difference(newKeys, keys)\n\n // If their are new keys, initialize them and add them to morpher\n if (differences.length) {\n // Get the values\n const addedFromAttrs = this.element()[type](differences)\n\n // Get the already initialized values\n const oldFromAttrs = new ObjectBag(morpher.from()).valueOf()\n\n // Merge old and new\n Object.assign(oldFromAttrs, addedFromAttrs)\n morpher.from(oldFromAttrs)\n }\n\n // Get the object from the morpher\n const oldToAttrs = new ObjectBag(morpher.to()).valueOf()\n\n // Merge in new attributes\n Object.assign(oldToAttrs, newToAttrs)\n\n // Change morpher target\n morpher.to(oldToAttrs)\n\n // Make sure that we save the work we did so we don't need it to do again\n keys = newKeys\n attrs = newToAttrs\n }\n )\n\n this._rememberMorpher(type, morpher)\n return this\n },\n\n zoom(level, point) {\n if (this._tryRetarget('zoom', level, point)) return this\n\n let morpher = new Morphable(this._stepper).to(new SVGNumber(level))\n\n this.queue(\n function () {\n morpher = morpher.from(this.element().zoom())\n },\n function (pos) {\n this.element().zoom(morpher.at(pos), point)\n return morpher.done()\n },\n function (newLevel, newPoint) {\n point = newPoint\n morpher.to(newLevel)\n }\n )\n\n this._rememberMorpher('zoom', morpher)\n return this\n },\n\n /**\n ** absolute transformations\n **/\n\n //\n // M v -----|-----(D M v = F v)------|-----> T v\n //\n // 1. define the final state (T) and decompose it (once)\n // t = [tx, ty, the, lam, sy, sx]\n // 2. on every frame: pull the current state of all previous transforms\n // (M - m can change)\n // and then write this as m = [tx0, ty0, the0, lam0, sy0, sx0]\n // 3. Find the interpolated matrix F(pos) = m + pos * (t - m)\n // - Note F(0) = M\n // - Note F(1) = T\n // 4. Now you get the delta matrix as a result: D = F * inv(M)\n\n transform(transforms, relative, affine) {\n // If we have a declarative function, we should retarget it if possible\n relative = transforms.relative || relative\n if (\n this._isDeclarative &&\n !relative &&\n this._tryRetarget('transform', transforms)\n ) {\n return this\n }\n\n // Parse the parameters\n const isMatrix = Matrix.isMatrixLike(transforms)\n affine =\n transforms.affine != null\n ? transforms.affine\n : affine != null\n ? affine\n : !isMatrix\n\n // Create a morpher and set its type\n const morpher = new Morphable(this._stepper).type(\n affine ? TransformBag : Matrix\n )\n\n let origin\n let element\n let current\n let currentAngle\n let startTransform\n\n function setup() {\n // make sure element and origin is defined\n element = element || this.element()\n origin = origin || getOrigin(transforms, element)\n\n startTransform = new Matrix(relative ? undefined : element)\n\n // add the runner to the element so it can merge transformations\n element._addRunner(this)\n\n // Deactivate all transforms that have run so far if we are absolute\n if (!relative) {\n element._clearTransformRunnersBefore(this)\n }\n }\n\n function run(pos) {\n // clear all other transforms before this in case something is saved\n // on this runner. We are absolute. We dont need these!\n if (!relative) this.clearTransform()\n\n const { x, y } = new Point(origin).transform(\n element._currentTransform(this)\n )\n\n let target = new Matrix({ ...transforms, origin: [x, y] })\n let start = this._isDeclarative && current ? current : startTransform\n\n if (affine) {\n target = target.decompose(x, y)\n start = start.decompose(x, y)\n\n // Get the current and target angle as it was set\n const rTarget = target.rotate\n const rCurrent = start.rotate\n\n // Figure out the shortest path to rotate directly\n const possibilities = [rTarget - 360, rTarget, rTarget + 360]\n const distances = possibilities.map((a) => Math.abs(a - rCurrent))\n const shortest = Math.min(...distances)\n const index = distances.indexOf(shortest)\n target.rotate = possibilities[index]\n }\n\n if (relative) {\n // we have to be careful here not to overwrite the rotation\n // with the rotate method of Matrix\n if (!isMatrix) {\n target.rotate = transforms.rotate || 0\n }\n if (this._isDeclarative && currentAngle) {\n start.rotate = currentAngle\n }\n }\n\n morpher.from(start)\n morpher.to(target)\n\n const affineParameters = morpher.at(pos)\n currentAngle = affineParameters.rotate\n current = new Matrix(affineParameters)\n\n this.addTransform(current)\n element._addRunner(this)\n return morpher.done()\n }\n\n function retarget(newTransforms) {\n // only get a new origin if it changed since the last call\n if (\n (newTransforms.origin || 'center').toString() !==\n (transforms.origin || 'center').toString()\n ) {\n origin = getOrigin(newTransforms, element)\n }\n\n // overwrite the old transformations with the new ones\n transforms = { ...newTransforms, origin }\n }\n\n this.queue(setup, run, retarget, true)\n this._isDeclarative && this._rememberMorpher('transform', morpher)\n return this\n },\n\n // Animatable x-axis\n x(x) {\n return this._queueNumber('x', x)\n },\n\n // Animatable y-axis\n y(y) {\n return this._queueNumber('y', y)\n },\n\n ax(x) {\n return this._queueNumber('ax', x)\n },\n\n ay(y) {\n return this._queueNumber('ay', y)\n },\n\n dx(x = 0) {\n return this._queueNumberDelta('x', x)\n },\n\n dy(y = 0) {\n return this._queueNumberDelta('y', y)\n },\n\n dmove(x, y) {\n return this.dx(x).dy(y)\n },\n\n _queueNumberDelta(method, to) {\n to = new SVGNumber(to)\n\n // Try to change the target if we have this method already registered\n if (this._tryRetarget(method, to)) return this\n\n // Make a morpher and queue the animation\n const morpher = new Morphable(this._stepper).to(to)\n let from = null\n this.queue(\n function () {\n from = this.element()[method]()\n morpher.from(from)\n morpher.to(from + to)\n },\n function (pos) {\n this.element()[method](morpher.at(pos))\n return morpher.done()\n },\n function (newTo) {\n morpher.to(from + new SVGNumber(newTo))\n }\n )\n\n // Register the morpher so that if it is changed again, we can retarget it\n this._rememberMorpher(method, morpher)\n return this\n },\n\n _queueObject(method, to) {\n // Try to change the target if we have this method already registered\n if (this._tryRetarget(method, to)) return this\n\n // Make a morpher and queue the animation\n const morpher = new Morphable(this._stepper).to(to)\n this.queue(\n function () {\n morpher.from(this.element()[method]())\n },\n function (pos) {\n this.element()[method](morpher.at(pos))\n return morpher.done()\n }\n )\n\n // Register the morpher so that if it is changed again, we can retarget it\n this._rememberMorpher(method, morpher)\n return this\n },\n\n _queueNumber(method, value) {\n return this._queueObject(method, new SVGNumber(value))\n },\n\n // Animatable center x-axis\n cx(x) {\n return this._queueNumber('cx', x)\n },\n\n // Animatable center y-axis\n cy(y) {\n return this._queueNumber('cy', y)\n },\n\n // Add animatable move\n move(x, y) {\n return this.x(x).y(y)\n },\n\n amove(x, y) {\n return this.ax(x).ay(y)\n },\n\n // Add animatable center\n center(x, y) {\n return this.cx(x).cy(y)\n },\n\n // Add animatable size\n size(width, height) {\n // animate bbox based size for all other elements\n let box\n\n if (!width || !height) {\n box = this._element.bbox()\n }\n\n if (!width) {\n width = (box.width / box.height) * height\n }\n\n if (!height) {\n height = (box.height / box.width) * width\n }\n\n return this.width(width).height(height)\n },\n\n // Add animatable width\n width(width) {\n return this._queueNumber('width', width)\n },\n\n // Add animatable height\n height(height) {\n return this._queueNumber('height', height)\n },\n\n // Add animatable plot\n plot(a, b, c, d) {\n // Lines can be plotted with 4 arguments\n if (arguments.length === 4) {\n return this.plot([a, b, c, d])\n }\n\n if (this._tryRetarget('plot', a)) return this\n\n const morpher = new Morphable(this._stepper)\n .type(this._element.MorphArray)\n .to(a)\n\n this.queue(\n function () {\n morpher.from(this._element.array())\n },\n function (pos) {\n this._element.plot(morpher.at(pos))\n return morpher.done()\n }\n )\n\n this._rememberMorpher('plot', morpher)\n return this\n },\n\n // Add leading method\n leading(value) {\n return this._queueNumber('leading', value)\n },\n\n // Add animatable viewbox\n viewbox(x, y, width, height) {\n return this._queueObject('viewbox', new Box(x, y, width, height))\n },\n\n update(o) {\n if (typeof o !== 'object') {\n return this.update({\n offset: arguments[0],\n color: arguments[1],\n opacity: arguments[2]\n })\n }\n\n if (o.opacity != null) this.attr('stop-opacity', o.opacity)\n if (o.color != null) this.attr('stop-color', o.color)\n if (o.offset != null) this.attr('offset', o.offset)\n\n return this\n }\n})\n\nextend(Runner, { rx, ry, from, to })\nregister(Runner, 'Runner')\n","import {\n adopt,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { svg, xlink, xmlns } from '../modules/core/namespaces.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Container from './Container.js'\nimport Defs from './Defs.js'\nimport { globals } from '../utils/window.js'\n\nexport default class Svg extends Container {\n constructor(node, attrs = node) {\n super(nodeOrNew('svg', node), attrs)\n this.namespace()\n }\n\n // Creates and returns defs element\n defs() {\n if (!this.isRoot()) return this.root().defs()\n\n return adopt(this.node.querySelector('defs')) || this.put(new Defs())\n }\n\n isRoot() {\n return (\n !this.node.parentNode ||\n (!(this.node.parentNode instanceof globals.window.SVGElement) &&\n this.node.parentNode.nodeName !== '#document-fragment')\n )\n }\n\n // Add namespaces\n namespace() {\n if (!this.isRoot()) return this.root().namespace()\n return this.attr({ xmlns: svg, version: '1.1' }).attr(\n 'xmlns:xlink',\n xlink,\n xmlns\n )\n }\n\n removeNamespace() {\n return this.attr({ xmlns: null, version: null })\n .attr('xmlns:xlink', null, xmlns)\n .attr('xmlns:svgjs', null, xmlns)\n }\n\n // Check if this is a root svg\n // If not, call root() from this element\n root() {\n if (this.isRoot()) return this\n return super.root()\n }\n}\n\nregisterMethods({\n Container: {\n // Create nested svg document\n nested: wrapWithAttrCheck(function () {\n return this.put(new Svg())\n })\n }\n})\n\nregister(Svg, 'Svg', true)\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Container from './Container.js'\n\nexport default class Symbol extends Container {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('symbol', node), attrs)\n }\n}\n\nregisterMethods({\n Container: {\n symbol: wrapWithAttrCheck(function () {\n return this.put(new Symbol())\n })\n }\n})\n\nregister(Symbol, 'Symbol')\n","import { globals } from '../../utils/window.js'\n\n// Create plain text node\nexport function plain(text) {\n // clear if build mode is disabled\n if (this._build === false) {\n this.clear()\n }\n\n // create text node\n this.node.appendChild(globals.document.createTextNode(text))\n\n return this\n}\n\n// Get length of text element\nexport function length() {\n return this.node.getComputedTextLength()\n}\n\n// Move over x-axis\n// Text is moved by its bounding box\n// text-anchor does NOT matter\nexport function x(x, box = this.bbox()) {\n if (x == null) {\n return box.x\n }\n\n return this.attr('x', this.attr('x') + x - box.x)\n}\n\n// Move over y-axis\nexport function y(y, box = this.bbox()) {\n if (y == null) {\n return box.y\n }\n\n return this.attr('y', this.attr('y') + y - box.y)\n}\n\nexport function move(x, y, box = this.bbox()) {\n return this.x(x, box).y(y, box)\n}\n\n// Move center over x-axis\nexport function cx(x, box = this.bbox()) {\n if (x == null) {\n return box.cx\n }\n\n return this.attr('x', this.attr('x') + x - box.cx)\n}\n\n// Move center over y-axis\nexport function cy(y, box = this.bbox()) {\n if (y == null) {\n return box.cy\n }\n\n return this.attr('y', this.attr('y') + y - box.cy)\n}\n\nexport function center(x, y, box = this.bbox()) {\n return this.cx(x, box).cy(y, box)\n}\n\nexport function ax(x) {\n return this.attr('x', x)\n}\n\nexport function ay(y) {\n return this.attr('y', y)\n}\n\nexport function amove(x, y) {\n return this.ax(x).ay(y)\n}\n\n// Enable / disable build mode\nexport function build(build) {\n this._build = !!build\n return this\n}\n","import {\n adopt,\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport SVGNumber from '../types/SVGNumber.js'\nimport Shape from './Shape.js'\nimport { globals } from '../utils/window.js'\nimport * as textable from '../modules/core/textable.js'\nimport { isDescriptive, writeDataToDom } from '../utils/utils.js'\n\nexport default class Text extends Shape {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('text', node), attrs)\n\n this.dom.leading = this.dom.leading ?? new SVGNumber(1.3) // store leading value for rebuilding\n this._rebuild = true // enable automatic updating of dy values\n this._build = false // disable build mode for adding multiple lines\n }\n\n // Set / get leading\n leading(value) {\n // act as getter\n if (value == null) {\n return this.dom.leading\n }\n\n // act as setter\n this.dom.leading = new SVGNumber(value)\n\n return this.rebuild()\n }\n\n // Rebuild appearance type\n rebuild(rebuild) {\n // store new rebuild flag if given\n if (typeof rebuild === 'boolean') {\n this._rebuild = rebuild\n }\n\n // define position of all lines\n if (this._rebuild) {\n const self = this\n let blankLineOffset = 0\n const leading = this.dom.leading\n\n this.each(function (i) {\n if (isDescriptive(this.node)) return\n\n const fontSize = globals.window\n .getComputedStyle(this.node)\n .getPropertyValue('font-size')\n\n const dy = leading * new SVGNumber(fontSize)\n\n if (this.dom.newLined) {\n this.attr('x', self.attr('x'))\n\n if (this.text() === '\\n') {\n blankLineOffset += dy\n } else {\n this.attr('dy', i ? dy + blankLineOffset : 0)\n blankLineOffset = 0\n }\n }\n })\n\n this.fire('rebuild')\n }\n\n return this\n }\n\n // overwrite method from parent to set data properly\n setData(o) {\n this.dom = o\n this.dom.leading = new SVGNumber(o.leading || 1.3)\n return this\n }\n\n writeDataToDom() {\n writeDataToDom(this, this.dom, { leading: 1.3 })\n return this\n }\n\n // Set the text content\n text(text) {\n // act as getter\n if (text === undefined) {\n const children = this.node.childNodes\n let firstLine = 0\n text = ''\n\n for (let i = 0, len = children.length; i < len; ++i) {\n // skip textPaths - they are no lines\n if (children[i].nodeName === 'textPath' || isDescriptive(children[i])) {\n if (i === 0) firstLine = i + 1\n continue\n }\n\n // add newline if its not the first child and newLined is set to true\n if (\n i !== firstLine &&\n children[i].nodeType !== 3 &&\n adopt(children[i]).dom.newLined === true\n ) {\n text += '\\n'\n }\n\n // add content of this node\n text += children[i].textContent\n }\n\n return text\n }\n\n // remove existing content\n this.clear().build(true)\n\n if (typeof text === 'function') {\n // call block\n text.call(this, this)\n } else {\n // store text and make sure text is not blank\n text = (text + '').split('\\n')\n\n // build new lines\n for (let j = 0, jl = text.length; j < jl; j++) {\n this.newLine(text[j])\n }\n }\n\n // disable build mode and rebuild lines\n return this.build(false).rebuild()\n }\n}\n\nextend(Text, textable)\n\nregisterMethods({\n Container: {\n // Create text element\n text: wrapWithAttrCheck(function (text = '') {\n return this.put(new Text()).text(text)\n }),\n\n // Create plain text element\n plain: wrapWithAttrCheck(function (text = '') {\n return this.put(new Text()).plain(text)\n })\n }\n})\n\nregister(Text, 'Text')\n","import {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { globals } from '../utils/window.js'\nimport { registerMethods } from '../utils/methods.js'\nimport SVGNumber from '../types/SVGNumber.js'\nimport Shape from './Shape.js'\nimport Text from './Text.js'\nimport * as textable from '../modules/core/textable.js'\n\nexport default class Tspan extends Shape {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('tspan', node), attrs)\n this._build = false // disable build mode for adding multiple lines\n }\n\n // Shortcut dx\n dx(dx) {\n return this.attr('dx', dx)\n }\n\n // Shortcut dy\n dy(dy) {\n return this.attr('dy', dy)\n }\n\n // Create new line\n newLine() {\n // mark new line\n this.dom.newLined = true\n\n // fetch parent\n const text = this.parent()\n\n // early return in case we are not in a text element\n if (!(text instanceof Text)) {\n return this\n }\n\n const i = text.index(this)\n\n const fontSize = globals.window\n .getComputedStyle(this.node)\n .getPropertyValue('font-size')\n const dy = text.dom.leading * new SVGNumber(fontSize)\n\n // apply new position\n return this.dy(i ? dy : 0).attr('x', text.x())\n }\n\n // Set text content\n text(text) {\n if (text == null)\n return this.node.textContent + (this.dom.newLined ? '\\n' : '')\n\n if (typeof text === 'function') {\n this.clear().build(true)\n text.call(this, this)\n this.build(false)\n } else {\n this.plain(text)\n }\n\n return this\n }\n}\n\nextend(Tspan, textable)\n\nregisterMethods({\n Tspan: {\n tspan: wrapWithAttrCheck(function (text = '') {\n const tspan = new Tspan()\n\n // clear if build mode is disabled\n if (!this._build) {\n this.clear()\n }\n\n // add new tspan\n return this.put(tspan).text(text)\n })\n },\n Text: {\n newLine: function (text = '') {\n return this.tspan(text).newLine()\n }\n }\n})\n\nregister(Tspan, 'Tspan')\n","import { cx, cy, height, width, x, y } from '../modules/core/circled.js'\nimport {\n extend,\n nodeOrNew,\n register,\n wrapWithAttrCheck\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport SVGNumber from '../types/SVGNumber.js'\nimport Shape from './Shape.js'\n\nexport default class Circle extends Shape {\n constructor(node, attrs = node) {\n super(nodeOrNew('circle', node), attrs)\n }\n\n radius(r) {\n return this.attr('r', r)\n }\n\n // Radius x value\n rx(rx) {\n return this.attr('r', rx)\n }\n\n // Alias radius x value\n ry(ry) {\n return this.rx(ry)\n }\n\n size(size) {\n return this.radius(new SVGNumber(size).divide(2))\n }\n}\n\nextend(Circle, { x, y, cx, cy, width, height })\n\nregisterMethods({\n Container: {\n // Create circle element\n circle: wrapWithAttrCheck(function (size = 0) {\n return this.put(new Circle()).size(size).move(0, 0)\n })\n }\n})\n\nregister(Circle, 'Circle')\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Container from './Container.js'\nimport baseFind from '../modules/core/selector.js'\n\nexport default class ClipPath extends Container {\n constructor(node, attrs = node) {\n super(nodeOrNew('clipPath', node), attrs)\n }\n\n // Unclip all clipped elements and remove itself\n remove() {\n // unclip all targets\n this.targets().forEach(function (el) {\n el.unclip()\n })\n\n // remove clipPath from parent\n return super.remove()\n }\n\n targets() {\n return baseFind('svg [clip-path*=' + this.id() + ']')\n }\n}\n\nregisterMethods({\n Container: {\n // Create clipping element\n clip: wrapWithAttrCheck(function () {\n return this.defs().put(new ClipPath())\n })\n },\n Element: {\n // Distribute clipPath to svg element\n clipper() {\n return this.reference('clip-path')\n },\n\n clipWith(element) {\n // use given clip or create a new one\n const clipper =\n element instanceof ClipPath\n ? element\n : this.parent().clip().add(element)\n\n // apply mask\n return this.attr('clip-path', 'url(#' + clipper.id() + ')')\n },\n\n // Unclip element\n unclip() {\n return this.attr('clip-path', null)\n }\n }\n})\n\nregister(ClipPath, 'ClipPath')\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Element from './Element.js'\n\nexport default class ForeignObject extends Element {\n constructor(node, attrs = node) {\n super(nodeOrNew('foreignObject', node), attrs)\n }\n}\n\nregisterMethods({\n Container: {\n foreignObject: wrapWithAttrCheck(function (width, height) {\n return this.put(new ForeignObject()).size(width, height)\n })\n }\n})\n\nregister(ForeignObject, 'ForeignObject')\n","import Matrix from '../../types/Matrix.js'\nimport Point from '../../types/Point.js'\nimport Box from '../../types/Box.js'\nimport { proportionalSize } from '../../utils/utils.js'\nimport { getWindow } from '../../utils/window.js'\n\nexport function dmove(dx, dy) {\n this.children().forEach((child) => {\n let bbox\n\n // We have to wrap this for elements that dont have a bbox\n // e.g. title and other descriptive elements\n try {\n // Get the childs bbox\n // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1905039\n // Because bbox for nested svgs returns the contents bbox in the coordinate space of the svg itself (weird!), we cant use bbox for svgs\n // Therefore we have to use getBoundingClientRect. But THAT is broken (as explained in the bug).\n // Funnily enough the broken behavior would work for us but that breaks it in chrome\n // So we have to replicate the broken behavior of FF by just reading the attributes of the svg itself\n bbox =\n child.node instanceof getWindow().SVGSVGElement\n ? new Box(child.attr(['x', 'y', 'width', 'height']))\n : child.bbox()\n } catch (e) {\n return\n }\n\n // Get childs matrix\n const m = new Matrix(child)\n // Translate childs matrix by amount and\n // transform it back into parents space\n const matrix = m.translate(dx, dy).transform(m.inverse())\n // Calculate new x and y from old box\n const p = new Point(bbox.x, bbox.y).transform(matrix)\n // Move element\n child.move(p.x, p.y)\n })\n\n return this\n}\n\nexport function dx(dx) {\n return this.dmove(dx, 0)\n}\n\nexport function dy(dy) {\n return this.dmove(0, dy)\n}\n\nexport function height(height, box = this.bbox()) {\n if (height == null) return box.height\n return this.size(box.width, height, box)\n}\n\nexport function move(x = 0, y = 0, box = this.bbox()) {\n const dx = x - box.x\n const dy = y - box.y\n\n return this.dmove(dx, dy)\n}\n\nexport function size(width, height, box = this.bbox()) {\n const p = proportionalSize(this, width, height, box)\n const scaleX = p.width / box.width\n const scaleY = p.height / box.height\n\n this.children().forEach((child) => {\n const o = new Point(box).transform(new Matrix(child).inverse())\n child.scale(scaleX, scaleY, o.x, o.y)\n })\n\n return this\n}\n\nexport function width(width, box = this.bbox()) {\n if (width == null) return box.width\n return this.size(width, box.height, box)\n}\n\nexport function x(x, box = this.bbox()) {\n if (x == null) return box.x\n return this.move(x, box.y, box)\n}\n\nexport function y(y, box = this.bbox()) {\n if (y == null) return box.y\n return this.move(box.x, y, box)\n}\n","import {\n nodeOrNew,\n register,\n wrapWithAttrCheck,\n extend\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Container from './Container.js'\nimport * as containerGeometry from '../modules/core/containerGeometry.js'\n\nexport default class G extends Container {\n constructor(node, attrs = node) {\n super(nodeOrNew('g', node), attrs)\n }\n}\n\nextend(G, containerGeometry)\n\nregisterMethods({\n Container: {\n // Create a group element\n group: wrapWithAttrCheck(function () {\n return this.put(new G())\n })\n }\n})\n\nregister(G, 'G')\n","import {\n nodeOrNew,\n register,\n wrapWithAttrCheck,\n extend\n} from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport { xlink } from '../modules/core/namespaces.js'\nimport Container from './Container.js'\nimport * as containerGeometry from '../modules/core/containerGeometry.js'\n\nexport default class A extends Container {\n constructor(node, attrs = node) {\n super(nodeOrNew('a', node), attrs)\n }\n\n // Link target attribute\n target(target) {\n return this.attr('target', target)\n }\n\n // Link url\n to(url) {\n return this.attr('href', url, xlink)\n }\n}\n\nextend(A, containerGeometry)\n\nregisterMethods({\n Container: {\n // Create a hyperlink element\n link: wrapWithAttrCheck(function (url) {\n return this.put(new A()).to(url)\n })\n },\n Element: {\n unlink() {\n const link = this.linker()\n\n if (!link) return this\n\n const parent = link.parent()\n\n if (!parent) {\n return this.remove()\n }\n\n const index = parent.index(link)\n parent.add(this, index)\n\n link.remove()\n return this\n },\n linkTo(url) {\n // reuse old link if possible\n let link = this.linker()\n\n if (!link) {\n link = new A()\n this.wrap(link)\n }\n\n if (typeof url === 'function') {\n url.call(link, link)\n } else {\n link.to(url)\n }\n\n return this\n },\n linker() {\n const link = this.parent()\n if (link && link.node.nodeName.toLowerCase() === 'a') {\n return link\n }\n\n return null\n }\n }\n})\n\nregister(A, 'A')\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport Container from './Container.js'\nimport baseFind from '../modules/core/selector.js'\n\nexport default class Mask extends Container {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('mask', node), attrs)\n }\n\n // Unmask all masked elements and remove itself\n remove() {\n // unmask all targets\n this.targets().forEach(function (el) {\n el.unmask()\n })\n\n // remove mask from parent\n return super.remove()\n }\n\n targets() {\n return baseFind('svg [mask*=' + this.id() + ']')\n }\n}\n\nregisterMethods({\n Container: {\n mask: wrapWithAttrCheck(function () {\n return this.defs().put(new Mask())\n })\n },\n Element: {\n // Distribute mask to svg element\n masker() {\n return this.reference('mask')\n },\n\n maskWith(element) {\n // use given mask or create a new one\n const masker =\n element instanceof Mask ? element : this.parent().mask().add(element)\n\n // apply mask\n return this.attr('mask', 'url(#' + masker.id() + ')')\n },\n\n // Unmask element\n unmask() {\n return this.attr('mask', null)\n }\n }\n})\n\nregister(Mask, 'Mask')\n","import { nodeOrNew, register } from '../utils/adopter.js'\nimport Element from './Element.js'\nimport SVGNumber from '../types/SVGNumber.js'\nimport { registerMethods } from '../utils/methods.js'\n\nexport default class Stop extends Element {\n constructor(node, attrs = node) {\n super(nodeOrNew('stop', node), attrs)\n }\n\n // add color stops\n update(o) {\n if (typeof o === 'number' || o instanceof SVGNumber) {\n o = {\n offset: arguments[0],\n color: arguments[1],\n opacity: arguments[2]\n }\n }\n\n // set attributes\n if (o.opacity != null) this.attr('stop-opacity', o.opacity)\n if (o.color != null) this.attr('stop-color', o.color)\n if (o.offset != null) this.attr('offset', new SVGNumber(o.offset))\n\n return this\n }\n}\n\nregisterMethods({\n Gradient: {\n // Add a color stop\n stop: function (offset, color, opacity) {\n return this.put(new Stop()).update(offset, color, opacity)\n }\n }\n})\n\nregister(Stop, 'Stop')\n","import { nodeOrNew, register } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport { unCamelCase } from '../utils/utils.js'\nimport Element from './Element.js'\n\nfunction cssRule(selector, rule) {\n if (!selector) return ''\n if (!rule) return selector\n\n let ret = selector + '{'\n\n for (const i in rule) {\n ret += unCamelCase(i) + ':' + rule[i] + ';'\n }\n\n ret += '}'\n\n return ret\n}\n\nexport default class Style extends Element {\n constructor(node, attrs = node) {\n super(nodeOrNew('style', node), attrs)\n }\n\n addText(w = '') {\n this.node.textContent += w\n return this\n }\n\n font(name, src, params = {}) {\n return this.rule('@font-face', {\n fontFamily: name,\n src: src,\n ...params\n })\n }\n\n rule(selector, obj) {\n return this.addText(cssRule(selector, obj))\n }\n}\n\nregisterMethods('Dom', {\n style(selector, obj) {\n return this.put(new Style()).rule(selector, obj)\n },\n fontface(name, src, params) {\n return this.put(new Style()).font(name, src, params)\n }\n})\n\nregister(Style, 'Style')\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport { xlink } from '../modules/core/namespaces.js'\nimport Path from './Path.js'\nimport PathArray from '../types/PathArray.js'\nimport Text from './Text.js'\nimport baseFind from '../modules/core/selector.js'\n\nexport default class TextPath extends Text {\n // Initialize node\n constructor(node, attrs = node) {\n super(nodeOrNew('textPath', node), attrs)\n }\n\n // return the array of the path track element\n array() {\n const track = this.track()\n\n return track ? track.array() : null\n }\n\n // Plot path if any\n plot(d) {\n const track = this.track()\n let pathArray = null\n\n if (track) {\n pathArray = track.plot(d)\n }\n\n return d == null ? pathArray : this\n }\n\n // Get the path element\n track() {\n return this.reference('href')\n }\n}\n\nregisterMethods({\n Container: {\n textPath: wrapWithAttrCheck(function (text, path) {\n // Convert text to instance if needed\n if (!(text instanceof Text)) {\n text = this.text(text)\n }\n\n return text.path(path)\n })\n },\n Text: {\n // Create path for text to run on\n path: wrapWithAttrCheck(function (track, importNodes = true) {\n const textPath = new TextPath()\n\n // if track is a path, reuse it\n if (!(track instanceof Path)) {\n // create path element\n track = this.defs().path(track)\n }\n\n // link textPath to path and add content\n textPath.attr('href', '#' + track, xlink)\n\n // Transplant all nodes from text to textPath\n let node\n if (importNodes) {\n while ((node = this.node.firstChild)) {\n textPath.node.appendChild(node)\n }\n }\n\n // add textPath element as child node and return textPath\n return this.put(textPath)\n }),\n\n // Get the textPath children\n textPath() {\n return this.findOne('textPath')\n }\n },\n Path: {\n // creates a textPath from this path\n text: wrapWithAttrCheck(function (text) {\n // Convert text to instance if needed\n if (!(text instanceof Text)) {\n text = new Text().addTo(this.parent()).text(text)\n }\n\n // Create textPath from text and path and return\n return text.path(this)\n }),\n\n targets() {\n return baseFind('svg textPath').filter((node) => {\n return (node.attr('href') || '').includes(this.id())\n })\n\n // Does not work in IE11. Use when IE support is dropped\n // return baseFind('svg textPath[*|href*=' + this.id() + ']')\n }\n }\n})\n\nTextPath.prototype.MorphArray = PathArray\nregister(TextPath, 'TextPath')\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\nimport { registerMethods } from '../utils/methods.js'\nimport { xlink } from '../modules/core/namespaces.js'\nimport Shape from './Shape.js'\n\nexport default class Use extends Shape {\n constructor(node, attrs = node) {\n super(nodeOrNew('use', node), attrs)\n }\n\n // Use element as a reference\n use(element, file) {\n // Set lined element\n return this.attr('href', (file || '') + '#' + element, xlink)\n }\n}\n\nregisterMethods({\n Container: {\n // Create a use element\n use: wrapWithAttrCheck(function (element, file) {\n return this.put(new Use()).use(element, file)\n })\n }\n})\n\nregister(Use, 'Use')\n","/* Optional Modules */\nimport './modules/optional/arrange.js'\nimport './modules/optional/class.js'\nimport './modules/optional/css.js'\nimport './modules/optional/data.js'\nimport './modules/optional/memory.js'\nimport './modules/optional/sugar.js'\nimport './modules/optional/transform.js'\n\nimport { extend, makeInstance } from './utils/adopter.js'\nimport { getMethodNames, getMethodsFor } from './utils/methods.js'\nimport Box from './types/Box.js'\nimport Color from './types/Color.js'\nimport Container from './elements/Container.js'\nimport Defs from './elements/Defs.js'\nimport Dom from './elements/Dom.js'\nimport Element from './elements/Element.js'\nimport Ellipse from './elements/Ellipse.js'\nimport EventTarget from './types/EventTarget.js'\nimport Fragment from './elements/Fragment.js'\nimport Gradient from './elements/Gradient.js'\nimport Image from './elements/Image.js'\nimport Line from './elements/Line.js'\nimport List from './types/List.js'\nimport Marker from './elements/Marker.js'\nimport Matrix from './types/Matrix.js'\nimport Morphable, {\n NonMorphable,\n ObjectBag,\n TransformBag,\n makeMorphable,\n registerMorphableType\n} from './animation/Morphable.js'\nimport Path from './elements/Path.js'\nimport PathArray from './types/PathArray.js'\nimport Pattern from './elements/Pattern.js'\nimport PointArray from './types/PointArray.js'\nimport Point from './types/Point.js'\nimport Polygon from './elements/Polygon.js'\nimport Polyline from './elements/Polyline.js'\nimport Rect from './elements/Rect.js'\nimport Runner from './animation/Runner.js'\nimport SVGArray from './types/SVGArray.js'\nimport SVGNumber from './types/SVGNumber.js'\nimport Shape from './elements/Shape.js'\nimport Svg from './elements/Svg.js'\nimport Symbol from './elements/Symbol.js'\nimport Text from './elements/Text.js'\nimport Tspan from './elements/Tspan.js'\nimport * as defaults from './modules/core/defaults.js'\nimport * as utils from './utils/utils.js'\nimport * as namespaces from './modules/core/namespaces.js'\nimport * as regex from './modules/core/regex.js'\n\nexport {\n Morphable,\n registerMorphableType,\n makeMorphable,\n TransformBag,\n ObjectBag,\n NonMorphable\n}\n\nexport { defaults, utils, namespaces, regex }\nexport const SVG = makeInstance\nexport { default as parser } from './modules/core/parser.js'\nexport { default as find } from './modules/core/selector.js'\nexport * from './modules/core/event.js'\nexport * from './utils/adopter.js'\nexport {\n getWindow,\n registerWindow,\n restoreWindow,\n saveWindow,\n withWindow\n} from './utils/window.js'\n\n/* Animation Modules */\nexport { default as Animator } from './animation/Animator.js'\nexport {\n Controller,\n Ease,\n PID,\n Spring,\n easing\n} from './animation/Controller.js'\nexport { default as Queue } from './animation/Queue.js'\nexport { default as Runner } from './animation/Runner.js'\nexport { default as Timeline } from './animation/Timeline.js'\n\n/* Types */\nexport { default as Array } from './types/SVGArray.js'\nexport { default as Box } from './types/Box.js'\nexport { default as Color } from './types/Color.js'\nexport { default as EventTarget } from './types/EventTarget.js'\nexport { default as Matrix } from './types/Matrix.js'\nexport { default as Number } from './types/SVGNumber.js'\nexport { default as PathArray } from './types/PathArray.js'\nexport { default as Point } from './types/Point.js'\nexport { default as PointArray } from './types/PointArray.js'\nexport { default as List } from './types/List.js'\n\n/* Elements */\nexport { default as Circle } from './elements/Circle.js'\nexport { default as ClipPath } from './elements/ClipPath.js'\nexport { default as Container } from './elements/Container.js'\nexport { default as Defs } from './elements/Defs.js'\nexport { default as Dom } from './elements/Dom.js'\nexport { default as Element } from './elements/Element.js'\nexport { default as Ellipse } from './elements/Ellipse.js'\nexport { default as ForeignObject } from './elements/ForeignObject.js'\nexport { default as Fragment } from './elements/Fragment.js'\nexport { default as Gradient } from './elements/Gradient.js'\nexport { default as G } from './elements/G.js'\nexport { default as A } from './elements/A.js'\nexport { default as Image } from './elements/Image.js'\nexport { default as Line } from './elements/Line.js'\nexport { default as Marker } from './elements/Marker.js'\nexport { default as Mask } from './elements/Mask.js'\nexport { default as Path } from './elements/Path.js'\nexport { default as Pattern } from './elements/Pattern.js'\nexport { default as Polygon } from './elements/Polygon.js'\nexport { default as Polyline } from './elements/Polyline.js'\nexport { default as Rect } from './elements/Rect.js'\nexport { default as Shape } from './elements/Shape.js'\nexport { default as Stop } from './elements/Stop.js'\nexport { default as Style } from './elements/Style.js'\nexport { default as Svg } from './elements/Svg.js'\nexport { default as Symbol } from './elements/Symbol.js'\nexport { default as Text } from './elements/Text.js'\nexport { default as TextPath } from './elements/TextPath.js'\nexport { default as Tspan } from './elements/Tspan.js'\nexport { default as Use } from './elements/Use.js'\n\nextend([Svg, Symbol, Image, Pattern, Marker], getMethodsFor('viewbox'))\n\nextend([Line, Polyline, Polygon, Path], getMethodsFor('marker'))\n\nextend(Text, getMethodsFor('Text'))\nextend(Path, getMethodsFor('Path'))\n\nextend(Defs, getMethodsFor('Defs'))\n\nextend([Text, Tspan], getMethodsFor('Tspan'))\n\nextend([Rect, Ellipse, Gradient, Runner], getMethodsFor('radius'))\n\nextend(EventTarget, getMethodsFor('EventTarget'))\nextend(Dom, getMethodsFor('Dom'))\nextend(Element, getMethodsFor('Element'))\nextend(Shape, getMethodsFor('Shape'))\nextend([Container, Fragment], getMethodsFor('Container'))\nextend(Gradient, getMethodsFor('Gradient'))\n\nextend(Runner, getMethodsFor('Runner'))\n\nList.extend(getMethodNames())\n\nregisterMorphableType([\n SVGNumber,\n Color,\n Box,\n Matrix,\n SVGArray,\n PointArray,\n PathArray,\n Point\n])\n\nmakeMorphable()\n"],"names":["methods","names","registerMethods","name","m","Array","isArray","_name","addMethodNames","Object","getOwnPropertyNames","assign","getMethodsFor","getMethodNames","Set","_names","push","map","array","block","i","il","length","result","filter","radians","d","Math","PI","degrees","r","unCamelCase","s","replace","g","toLowerCase","capitalize","charAt","toUpperCase","slice","proportionalSize","element","width","height","box","bbox","getOrigin","o","origin","ox","originX","oy","originY","x","y","condX","condY","includes","descriptiveElements","isDescriptive","has","nodeName","writeDataToDom","data","defaults","cloned","key","valueOf","keys","node","setAttribute","JSON","stringify","removeAttribute","svg","html","xmlns","xlink","globals","window","document","registerWindow","win","doc","save","saveWindow","restoreWindow","withWindow","fn","getWindow","Base","elements","root","create","ns","createElementNS","makeInstance","isHTML","adopter","querySelector","wrapper","createElement","innerHTML","firstChild","removeChild","nodeOrNew","Node","ownerDocument","defaultView","adopt","instance","Fragment","className","mockAdopt","mock","register","asRoot","prototype","getClass","did","eid","assignNewId","children","id","extend","modules","wrapWithAttrCheck","args","constructor","apply","attr","siblings","parent","position","index","next","prev","forward","p","add","remove","backward","front","back","before","after","insertBefore","insertAfter","numberAndUnit","hex","rgb","reference","transforms","whitespace","isHex","isRgb","isBlank","isNumber","isImage","delimiter","isPathLetter","classes","trim","split","hasClass","indexOf","addClass","join","removeClass","c","toggleClass","css","style","val","ret","arguments","cssText","el","forEach","t","cased","getPropertyValue","setProperty","test","show","hide","visible","a","v","attributes","parse","e","remember","k","memory","forget","_memory","sixDigitHex","substring","componentHex","component","integer","round","bounded","max","min","toString","is","object","space","getParameters","b","params","_a","_b","_c","_d","z","h","l","cieSpace","hueToRgb","q","Color","inputs","init","isColor","color","random","mode","sin","pi","grey","Error","cmyk","hsl","isGrey","delta","values","noWhitespace","exec","parseInt","hexParse","components","lab","xyz","lch","sqrt","atan2","dToR","cos","yL","xL","zL","ct","mx","nm","rU","gU","bU","pow","bd","toArray","toHex","_clamped","toRgb","rV","gV","bV","string","r255","g255","b255","rL","gL","bL","xU","yU","zU","format","Point","clone","base","source","transform","transformO","Matrix","isMatrixLike","f","point","screenCTM","inverseO","closeEnough","threshold","abs","formatTransforms","flipBoth","flip","flipX","flipY","skewX","skew","isFinite","skewY","scaleX","scale","scaleY","shear","theta","rotate","around","px","positionX","NaN","py","positionY","translate","tx","translateX","ty","translateY","relative","rx","relativeX","ry","relativeY","fromArray","matrixMultiply","cx","cy","matrix","aroundO","dx","dy","translateO","lmultiplyO","decompose","determinant","ccw","sx","thetaRad","st","lam","sy","equals","other","comp","axis","flipO","scaleO","Element","matrixify","parseFloat","call","inverse","det","na","nb","nc","nd","ne","nf","lmultiply","multiply","multiplyO","rotateO","shearO","lx","skewO","tan","ly","current","transformer","ctm","getCTM","isRoot","rect","getScreenCTM","console","warn","parser","nodes","size","path","parentNode","body","documentElement","addTo","isNulledBox","domContains","contains","Box","addOffset","pageXOffset","pageYOffset","left","top","w","x2","y2","isNulled","merge","xMin","Infinity","xMax","yMin","yMax","pts","getBox","getBBoxFn","retry","getBBox","rbox","getRBox","getBoundingClientRect","inside","viewbox","zoom","level","clientWidth","clientHeight","zoomX","zoomY","zoomAmount","Number","MAX_SAFE_INTEGER","List","arr","each","fnOrMethodName","concat","reserved","reduce","obj","attrs","baseFind","query","querySelectorAll","find","findOne","listenerId","windowEvents","getEvents","n","getEventHolder","events","getEventTarget","clearEvents","on","listener","binding","options","bind","bag","_svgjsListenerId","event","ev","addEventListener","off","namespace","removeEventListener","dispatch","Event","dispatchEvent","CustomEvent","detail","cancelable","EventTarget","type","j","defaultPrevented","fire","noop","timeline","duration","ease","delay","fill","stroke","opacity","offset","SVGArray","toSet","SVGNumber","convert","unit","value","divide","number","isNaN","match","minus","plus","times","toJSON","colorAttributes","hooks","registerAttrHook","nodeValue","last","curr","getAttribute","_val","hook","leading","setAttributeNS","rebuild","Dom","removeNamespace","SVGElement","appendChild","childNodes","put","clear","hasChildNodes","lastChild","deep","assignNewIds","nodeClone","cloneNode","first","get","htmlOrFn","outerHTML","xml","matches","selector","matcher","matchesSelector","msMatchesSelector","mozMatchesSelector","webkitMatchesSelector","oMatchesSelector","putIn","removeElement","replaceChild","precision","factor","svgOrFn","outerSVG","words","text","textContent","wrap","xmlOrFn","outerXML","_this","well","fragment","createDocumentFragment","len","firstElementChild","dom","hasAttribute","setData","center","defs","dmove","move","parents","until","isSelector","sugar","prefix","extension","mat","angle","direction","radius","_element","getTotalLength","pointAt","getPointAtLength","font","untransform","str","kv","reverse","toParent","pCtm","toRoot","decomposed","cleanRelative","Container","flatten","ungroup","Defs","Shape","Ellipse","circled","ellipse","from","fx","fy","x1","y1","to","Gradient","targets","url","update","gradiented","gradient","Pattern","pattern","patternUnits","Image","load","callback","img","src","image","PointArray","maxX","maxY","minX","minY","points","pop","toLine","MorphArray","Line","plot","pointed","line","Marker","orient","ref","marker","makeSetterGetter","easing","pos","bezier","steps","stepPosition","jumps","beforeFlag","step","floor","jumping","Stepper","done","Ease","Controller","stepper","target","dt","recalculate","_duration","overshoot","_overshoot","eps","os","log","zeta","wn","Spring","velocity","acceleration","newPosition","PID","windup","integral","error","_windup","P","I","D","segmentParameters","M","L","H","V","C","S","Q","T","A","Z","pathHandlers","p0","mlhvqtcsaz","jl","makeAbsolut","command","segment","segmentComplete","startNewSegment","token","inNumber","finalizeNumber","pathLetter","lastCommand","small","isSmall","inSegment","pointSeen","hasExponent","finalizeSegment","absolute","segments","isArcFlag","isArc","isExponential","lastToken","pathDelimiters","pathParser","toAbsolute","arrayToString","PathArray","getClassForType","NonMorphable","morphableTypes","ObjectBag","Morphable","_stepper","_from","_to","_type","_context","_morphObj","at","morph","complete","_set","align","toConsumable","TransformBag","sortByKey","splice","defaultObject","toDelete","objOrArr","entries","Type","sort","shift","num","registerMorphableType","makeMorphable","context","mapper","Path","_array","Polygon","polygon","poly","Polyline","polyline","Rect","Queue","_first","_last","item","Animator","nextDraw","frames","timeouts","immediates","timer","performance","Date","frame","run","requestAnimationFrame","_draw","timeout","time","now","immediate","cancelFrame","clearTimeout","cancelImmediate","nextTimeout","lastTimeout","nextFrame","lastFrame","nextImmediate","makeSchedule","runnerInfo","start","runner","end","defaultSource","Timeline","timeSource","_timeSource","terminate","active","_nextFrame","finish","getEndTimeOfTimeline","pause","getEndTime","lastRunnerInfo","getLastRunnerInfo","lastDuration","lastStartTime","_time","endTimes","_runners","getRunnerInfoById","_lastRunnerId","_runnerIds","_paused","_continue","persist","dtOrForever","_persist","play","updateTime","yes","currentSpeed","speed","positive","schedule","when","absoluteStartTime","endTime","unschedule","info","seek","_speed","stop","_lastSourceTime","immediateStep","_stepImmediate","_step","_stepFn","dtSource","dtTime","_lastStepTime","dtToStart","reset","runnersLeft","finished","_startTime","_timeline","Runner","_queue","_isDeclarative","_history","enabled","_lastTime","_reseted","transformId","_haveReversed","_reverse","_loopsDone","_swing","_wait","_times","_frameId","sanitise","swing","wait","addTransform","animate","loop","clearTransform","clearTransformsFromQueue","isTransform","during","queue","_prepareRunner","loops","loopDuration","loopsDone","relativeTime","whole","partial","swinging","backwards","uncliped","clipped","swingForward","forwards","progress","initFn","runFn","retargetFn","initialiser","retarget","initialised","running","_lastPosition","justStarted","justFinished","declarative","converged","_initialise","_run","needsIt","_rememberMorpher","method","morpher","caller","positionOrDt","allfinished","_tryRetarget","extra","FakeRunner","mergeWith","getRunnerTransform","mergeTransforms","runners","_transformationRunners","netTransform","RunnerArray","ids","clearBefore","deleteCnt","edit","newRunner","getByID","lastRunner","condition","by","_clearTransformRunnersBefore","currentRunner","_currentTransform","_addRunner","difference","styleAttr","nameOrAttrs","newToAttrs","newKeys","differences","addedFromAttrs","oldFromAttrs","oldToAttrs","newLevel","newPoint","affine","isMatrix","currentAngle","startTransform","setup","undefined","rTarget","rCurrent","possibilities","distances","shortest","affineParameters","newTransforms","_queueNumber","ax","ay","_queueNumberDelta","newTo","_queueObject","amove","Svg","version","nested","Symbol","symbol","plain","_build","createTextNode","getComputedTextLength","build","Text","_rebuild","self","blankLineOffset","fontSize","getComputedStyle","newLined","firstLine","nodeType","newLine","textable","Tspan","tspan","Circle","circle","ClipPath","unclip","clip","clipper","clipWith","ForeignObject","foreignObject","child","SVGSVGElement","G","containerGeometry","group","link","unlink","linker","linkTo","Mask","unmask","mask","masker","maskWith","Stop","cssRule","rule","Style","addText","fontFamily","fontface","TextPath","track","pathArray","textPath","importNodes","Use","use","file","SVG"],"mappings":";;;;;;;;;;;;AAAA,MAAMA,SAAO,GAAG,EAAE,CAAA;AAClB,MAAMC,KAAK,GAAG,EAAE,CAAA;AAET,SAASC,eAAeA,CAACC,IAAI,EAAEC,CAAC,EAAE;AACvC,EAAA,IAAIC,KAAK,CAACC,OAAO,CAACH,IAAI,CAAC,EAAE;AACvB,IAAA,KAAK,MAAMI,KAAK,IAAIJ,IAAI,EAAE;AACxBD,MAAAA,eAAe,CAACK,KAAK,EAAEH,CAAC,CAAC,CAAA;AAC3B,KAAA;AACA,IAAA,OAAA;AACF,GAAA;AAEA,EAAA,IAAI,OAAOD,IAAI,KAAK,QAAQ,EAAE;AAC5B,IAAA,KAAK,MAAMI,KAAK,IAAIJ,IAAI,EAAE;AACxBD,MAAAA,eAAe,CAACK,KAAK,EAAEJ,IAAI,CAACI,KAAK,CAAC,CAAC,CAAA;AACrC,KAAA;AACA,IAAA,OAAA;AACF,GAAA;AAEAC,EAAAA,cAAc,CAACC,MAAM,CAACC,mBAAmB,CAACN,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/@svgdotjs/svg.js/package.json b/node_modules/@svgdotjs/svg.js/package.json new file mode 100644 index 0000000..8ed1678 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/package.json @@ -0,0 +1,128 @@ +{ + "name": "@svgdotjs/svg.js", + "version": "3.2.4", + "type": "module", + "description": "A lightweight library for manipulating and animating SVG.", + "url": "https://svgjs.dev/", + "homepage": "https://svgjs.dev/", + "keywords": [ + "svg", + "vector", + "graphics", + "animation" + ], + "author": "Wout Fierens ", + "main": "dist/svg.node.cjs", + "unpkg": "dist/svg.min.js", + "jsdelivr": "dist/svg.min.js", + "browser": "dist/svg.esm.js", + "module": "src/main.js", + "exports": { + ".": { + "import": { + "types": "./svg.js.d.ts", + "default": "./src/main.js" + }, + "require": { + "types": "./svg.js.d.ts", + "default": "./dist/svg.node.cjs" + } + } + }, + "files": [ + "/dist", + "/src", + "/svg.js.d.ts", + "/.config" + ], + "maintainers": [ + { + "name": "Wout Fierens", + "email": "wout@mick-wout.com" + }, + { + "name": "Alex Ewerlöf", + "email": "alex@userpixel.com", + "web": "http://www.ewerlof.name" + }, + { + "name": "Ulrich-Matthias Schäfer", + "email": "ulima.ums@googlemail.com", + "web": "https://svgdotjs.github.io/" + }, + { + "name": "Jon Ege Ronnenberg", + "email": "jon@svgjs.dev", + "url": "https://keybase.io/dotnetcarpenter" + } + ], + "licenses": [ + { + "type": "MIT", + "url": "http://www.opensource.org/licenses/mit-license.php" + } + ], + "repository": { + "type": "git", + "url": "https://github.com/svgdotjs/svg.js.git" + }, + "github": "https://github.com/svgdotjs/svg.js", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Fuzzyma" + }, + "typings": "./svg.js.d.ts", + "scripts": { + "build": "npm run format && npm run rollup", + "build:polyfills": "npx rollup -c .config/rollup.polyfills.js", + "build:tests": "npx rollup -c .config/rollup.tests.js", + "fix": "npx eslint ./src --fix", + "lint": "npx eslint ./src", + "prettier": "npx prettier --write .", + "format": "npm run fix && npm run prettier", + "rollup": "npx rollup -c .config/rollup.config.js", + "server": "npx http-server ./ -d", + "test": "npx karma start .config/karma.conf.cjs || true", + "test:ci": "karma start .config/karma.conf.saucelabs.cjs", + "test:svgdom": "node ./spec/runSVGDomTest.js || true", + "zip": "zip -j dist/svg.js.zip -- LICENSE.txt README.md CHANGELOG.md dist/svg.js dist/svg.js.map dist/svg.min.js dist/svg.min.js.map dist/polyfills.js dist/polyfillsIE.js", + "prepublishOnly": "rm -rf ./dist && npm run build && npm run build:polyfills && npm test", + "postpublish": "npm run zip", + "checkTests": "node spec/checkForAllTests.js" + }, + "devDependencies": { + "@babel/core": "^7.24.7", + "@babel/eslint-parser": "^7.24.7", + "@babel/plugin-transform-runtime": "^7.24.7", + "@babel/preset-env": "^7.24.7", + "@rollup/plugin-babel": "^6.0.4", + "@rollup/plugin-commonjs": "^26.0.1", + "@rollup/plugin-node-resolve": "^15.2.3", + "@rollup/plugin-terser": "^0.4.4", + "@target/custom-event-polyfill": "github:Adobe-Marketing-Cloud/custom-event-polyfill", + "@types/jasmine": "^5.1.4", + "babel-plugin-polyfill-corejs3": "^0.10.4", + "core-js": "^3.37.1", + "coveralls": "^3.1.1", + "eslint": "^8.57.0", + "eslint-config-prettier": "^9.1.0", + "eslint-config-standard": "^17.1.0", + "http-server": "^14.1.1", + "jasmine": "^5.1.0", + "jasmine-core": "^5.1.2", + "karma": "^6.4.3", + "karma-chrome-launcher": "^3.2.0", + "karma-coverage": "^2.2.1", + "karma-firefox-launcher": "^2.1.3", + "karma-jasmine": "^5.1.0", + "karma-sauce-launcher": "^4.3.6", + "prettier": "^3.3.2", + "rollup": "^4.18.0", + "rollup-plugin-filesize": "^10.0.0", + "svgdom": "^0.1.19", + "typescript": "^5.4.5", + "yargs": "^17.7.2" + }, + "browserslist": ">0.3%, last 2 version, not dead, not op_mini all" +} diff --git a/node_modules/@svgdotjs/svg.js/src/animation/Animator.js b/node_modules/@svgdotjs/svg.js/src/animation/Animator.js new file mode 100644 index 0000000..11cca54 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/animation/Animator.js @@ -0,0 +1,102 @@ +import { globals } from '../utils/window.js' +import Queue from './Queue.js' + +const Animator = { + nextDraw: null, + frames: new Queue(), + timeouts: new Queue(), + immediates: new Queue(), + timer: () => globals.window.performance || globals.window.Date, + transforms: [], + + frame(fn) { + // Store the node + const node = Animator.frames.push({ run: fn }) + + // Request an animation frame if we don't have one + if (Animator.nextDraw === null) { + Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw) + } + + // Return the node so we can remove it easily + return node + }, + + timeout(fn, delay) { + delay = delay || 0 + + // Work out when the event should fire + const time = Animator.timer().now() + delay + + // Add the timeout to the end of the queue + const node = Animator.timeouts.push({ run: fn, time: time }) + + // Request another animation frame if we need one + if (Animator.nextDraw === null) { + Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw) + } + + return node + }, + + immediate(fn) { + // Add the immediate fn to the end of the queue + const node = Animator.immediates.push(fn) + // Request another animation frame if we need one + if (Animator.nextDraw === null) { + Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw) + } + + return node + }, + + cancelFrame(node) { + node != null && Animator.frames.remove(node) + }, + + clearTimeout(node) { + node != null && Animator.timeouts.remove(node) + }, + + cancelImmediate(node) { + node != null && Animator.immediates.remove(node) + }, + + _draw(now) { + // Run all the timeouts we can run, if they are not ready yet, add them + // to the end of the queue immediately! (bad timeouts!!! [sarcasm]) + let nextTimeout = null + const lastTimeout = Animator.timeouts.last() + while ((nextTimeout = Animator.timeouts.shift())) { + // Run the timeout if its time, or push it to the end + if (now >= nextTimeout.time) { + nextTimeout.run() + } else { + Animator.timeouts.push(nextTimeout) + } + + // If we hit the last item, we should stop shifting out more items + if (nextTimeout === lastTimeout) break + } + + // Run all of the animation frames + let nextFrame = null + const lastFrame = Animator.frames.last() + while (nextFrame !== lastFrame && (nextFrame = Animator.frames.shift())) { + nextFrame.run(now) + } + + let nextImmediate = null + while ((nextImmediate = Animator.immediates.shift())) { + nextImmediate() + } + + // If we have remaining timeouts or frames, draw until we don't anymore + Animator.nextDraw = + Animator.timeouts.first() || Animator.frames.first() + ? globals.window.requestAnimationFrame(Animator._draw) + : null + } +} + +export default Animator diff --git a/node_modules/@svgdotjs/svg.js/src/animation/Controller.js b/node_modules/@svgdotjs/svg.js/src/animation/Controller.js new file mode 100644 index 0000000..1cf879d --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/animation/Controller.js @@ -0,0 +1,231 @@ +import { timeline } from '../modules/core/defaults.js' +import { extend } from '../utils/adopter.js' + +/*** +Base Class +========== +The base stepper class that will be +***/ + +function makeSetterGetter(k, f) { + return function (v) { + if (v == null) return this[k] + this[k] = v + if (f) f.call(this) + return this + } +} + +export const easing = { + '-': function (pos) { + return pos + }, + '<>': function (pos) { + return -Math.cos(pos * Math.PI) / 2 + 0.5 + }, + '>': function (pos) { + return Math.sin((pos * Math.PI) / 2) + }, + '<': function (pos) { + return -Math.cos((pos * Math.PI) / 2) + 1 + }, + bezier: function (x1, y1, x2, y2) { + // see https://www.w3.org/TR/css-easing-1/#cubic-bezier-algo + return function (t) { + if (t < 0) { + if (x1 > 0) { + return (y1 / x1) * t + } else if (x2 > 0) { + return (y2 / x2) * t + } else { + return 0 + } + } else if (t > 1) { + if (x2 < 1) { + return ((1 - y2) / (1 - x2)) * t + (y2 - x2) / (1 - x2) + } else if (x1 < 1) { + return ((1 - y1) / (1 - x1)) * t + (y1 - x1) / (1 - x1) + } else { + return 1 + } + } else { + return 3 * t * (1 - t) ** 2 * y1 + 3 * t ** 2 * (1 - t) * y2 + t ** 3 + } + } + }, + // see https://www.w3.org/TR/css-easing-1/#step-timing-function-algo + steps: function (steps, stepPosition = 'end') { + // deal with "jump-" prefix + stepPosition = stepPosition.split('-').reverse()[0] + + let jumps = steps + if (stepPosition === 'none') { + --jumps + } else if (stepPosition === 'both') { + ++jumps + } + + // The beforeFlag is essentially useless + return (t, beforeFlag = false) => { + // Step is called currentStep in referenced url + let step = Math.floor(t * steps) + const jumping = (t * step) % 1 === 0 + + if (stepPosition === 'start' || stepPosition === 'both') { + ++step + } + + if (beforeFlag && jumping) { + --step + } + + if (t >= 0 && step < 0) { + step = 0 + } + + if (t <= 1 && step > jumps) { + step = jumps + } + + return step / jumps + } + } +} + +export class Stepper { + done() { + return false + } +} + +/*** +Easing Functions +================ +***/ + +export class Ease extends Stepper { + constructor(fn = timeline.ease) { + super() + this.ease = easing[fn] || fn + } + + step(from, to, pos) { + if (typeof from !== 'number') { + return pos < 1 ? from : to + } + return from + (to - from) * this.ease(pos) + } +} + +/*** +Controller Types +================ +***/ + +export class Controller extends Stepper { + constructor(fn) { + super() + this.stepper = fn + } + + done(c) { + return c.done + } + + step(current, target, dt, c) { + return this.stepper(current, target, dt, c) + } +} + +function recalculate() { + // Apply the default parameters + const duration = (this._duration || 500) / 1000 + const overshoot = this._overshoot || 0 + + // Calculate the PID natural response + const eps = 1e-10 + const pi = Math.PI + const os = Math.log(overshoot / 100 + eps) + const zeta = -os / Math.sqrt(pi * pi + os * os) + const wn = 3.9 / (zeta * duration) + + // Calculate the Spring values + this.d = 2 * zeta * wn + this.k = wn * wn +} + +export class Spring extends Controller { + constructor(duration = 500, overshoot = 0) { + super() + this.duration(duration).overshoot(overshoot) + } + + step(current, target, dt, c) { + if (typeof current === 'string') return current + c.done = dt === Infinity + if (dt === Infinity) return target + if (dt === 0) return current + + if (dt > 100) dt = 16 + + dt /= 1000 + + // Get the previous velocity + const velocity = c.velocity || 0 + + // Apply the control to get the new position and store it + const acceleration = -this.d * velocity - this.k * (current - target) + const newPosition = current + velocity * dt + (acceleration * dt * dt) / 2 + + // Store the velocity + c.velocity = velocity + acceleration * dt + + // Figure out if we have converged, and if so, pass the value + c.done = Math.abs(target - newPosition) + Math.abs(velocity) < 0.002 + return c.done ? target : newPosition + } +} + +extend(Spring, { + duration: makeSetterGetter('_duration', recalculate), + overshoot: makeSetterGetter('_overshoot', recalculate) +}) + +export class PID extends Controller { + constructor(p = 0.1, i = 0.01, d = 0, windup = 1000) { + super() + this.p(p).i(i).d(d).windup(windup) + } + + step(current, target, dt, c) { + if (typeof current === 'string') return current + c.done = dt === Infinity + + if (dt === Infinity) return target + if (dt === 0) return current + + const p = target - current + let i = (c.integral || 0) + p * dt + const d = (p - (c.error || 0)) / dt + const windup = this._windup + + // antiwindup + if (windup !== false) { + i = Math.max(-windup, Math.min(i, windup)) + } + + c.error = p + c.integral = i + + c.done = Math.abs(p) < 0.001 + + return c.done ? target : current + (this.P * p + this.I * i + this.D * d) + } +} + +extend(PID, { + windup: makeSetterGetter('_windup'), + p: makeSetterGetter('P'), + i: makeSetterGetter('I'), + d: makeSetterGetter('D') +}) diff --git a/node_modules/@svgdotjs/svg.js/src/animation/Morphable.js b/node_modules/@svgdotjs/svg.js/src/animation/Morphable.js new file mode 100644 index 0000000..9ce05d6 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/animation/Morphable.js @@ -0,0 +1,336 @@ +import { Ease } from './Controller.js' +import { + delimiter, + numberAndUnit, + isPathLetter +} from '../modules/core/regex.js' +import { extend } from '../utils/adopter.js' +import Color from '../types/Color.js' +import PathArray from '../types/PathArray.js' +import SVGArray from '../types/SVGArray.js' +import SVGNumber from '../types/SVGNumber.js' + +const getClassForType = (value) => { + const type = typeof value + + if (type === 'number') { + return SVGNumber + } else if (type === 'string') { + if (Color.isColor(value)) { + return Color + } else if (delimiter.test(value)) { + return isPathLetter.test(value) ? PathArray : SVGArray + } else if (numberAndUnit.test(value)) { + return SVGNumber + } else { + return NonMorphable + } + } else if (morphableTypes.indexOf(value.constructor) > -1) { + return value.constructor + } else if (Array.isArray(value)) { + return SVGArray + } else if (type === 'object') { + return ObjectBag + } else { + return NonMorphable + } +} + +export default class Morphable { + constructor(stepper) { + this._stepper = stepper || new Ease('-') + + this._from = null + this._to = null + this._type = null + this._context = null + this._morphObj = null + } + + at(pos) { + return this._morphObj.morph( + this._from, + this._to, + pos, + this._stepper, + this._context + ) + } + + done() { + const complete = this._context.map(this._stepper.done).reduce(function ( + last, + curr + ) { + return last && curr + }, true) + return complete + } + + from(val) { + if (val == null) { + return this._from + } + + this._from = this._set(val) + return this + } + + stepper(stepper) { + if (stepper == null) return this._stepper + this._stepper = stepper + return this + } + + to(val) { + if (val == null) { + return this._to + } + + this._to = this._set(val) + return this + } + + type(type) { + // getter + if (type == null) { + return this._type + } + + // setter + this._type = type + return this + } + + _set(value) { + if (!this._type) { + this.type(getClassForType(value)) + } + + let result = new this._type(value) + if (this._type === Color) { + result = this._to + ? result[this._to[4]]() + : this._from + ? result[this._from[4]]() + : result + } + + if (this._type === ObjectBag) { + result = this._to + ? result.align(this._to) + : this._from + ? result.align(this._from) + : result + } + + result = result.toConsumable() + + this._morphObj = this._morphObj || new this._type() + this._context = + this._context || + Array.apply(null, Array(result.length)) + .map(Object) + .map(function (o) { + o.done = true + return o + }) + return result + } +} + +export class NonMorphable { + constructor(...args) { + this.init(...args) + } + + init(val) { + val = Array.isArray(val) ? val[0] : val + this.value = val + return this + } + + toArray() { + return [this.value] + } + + valueOf() { + return this.value + } +} + +export class TransformBag { + constructor(...args) { + this.init(...args) + } + + init(obj) { + if (Array.isArray(obj)) { + obj = { + scaleX: obj[0], + scaleY: obj[1], + shear: obj[2], + rotate: obj[3], + translateX: obj[4], + translateY: obj[5], + originX: obj[6], + originY: obj[7] + } + } + + Object.assign(this, TransformBag.defaults, obj) + return this + } + + toArray() { + const v = this + + return [ + v.scaleX, + v.scaleY, + v.shear, + v.rotate, + v.translateX, + v.translateY, + v.originX, + v.originY + ] + } +} + +TransformBag.defaults = { + scaleX: 1, + scaleY: 1, + shear: 0, + rotate: 0, + translateX: 0, + translateY: 0, + originX: 0, + originY: 0 +} + +const sortByKey = (a, b) => { + return a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0 +} + +export class ObjectBag { + constructor(...args) { + this.init(...args) + } + + align(other) { + const values = this.values + for (let i = 0, il = values.length; i < il; ++i) { + // If the type is the same we only need to check if the color is in the correct format + if (values[i + 1] === other[i + 1]) { + if (values[i + 1] === Color && other[i + 7] !== values[i + 7]) { + const space = other[i + 7] + const color = new Color(this.values.splice(i + 3, 5)) + [space]() + .toArray() + this.values.splice(i + 3, 0, ...color) + } + + i += values[i + 2] + 2 + continue + } + + if (!other[i + 1]) { + return this + } + + // The types differ, so we overwrite the new type with the old one + // And initialize it with the types default (e.g. black for color or 0 for number) + const defaultObject = new other[i + 1]().toArray() + + // Than we fix the values array + const toDelete = values[i + 2] + 3 + + values.splice( + i, + toDelete, + other[i], + other[i + 1], + other[i + 2], + ...defaultObject + ) + + i += values[i + 2] + 2 + } + return this + } + + init(objOrArr) { + this.values = [] + + if (Array.isArray(objOrArr)) { + this.values = objOrArr.slice() + return + } + + objOrArr = objOrArr || {} + const entries = [] + + for (const i in objOrArr) { + const Type = getClassForType(objOrArr[i]) + const val = new Type(objOrArr[i]).toArray() + entries.push([i, Type, val.length, ...val]) + } + + entries.sort(sortByKey) + + this.values = entries.reduce((last, curr) => last.concat(curr), []) + return this + } + + toArray() { + return this.values + } + + valueOf() { + const obj = {} + const arr = this.values + + // for (var i = 0, len = arr.length; i < len; i += 2) { + while (arr.length) { + const key = arr.shift() + const Type = arr.shift() + const num = arr.shift() + const values = arr.splice(0, num) + obj[key] = new Type(values) // .valueOf() + } + + return obj + } +} + +const morphableTypes = [NonMorphable, TransformBag, ObjectBag] + +export function registerMorphableType(type = []) { + morphableTypes.push(...[].concat(type)) +} + +export function makeMorphable() { + extend(morphableTypes, { + to(val) { + return new Morphable() + .type(this.constructor) + .from(this.toArray()) // this.valueOf()) + .to(val) + }, + fromArray(arr) { + this.init(arr) + return this + }, + toConsumable() { + return this.toArray() + }, + morph(from, to, pos, stepper, context) { + const mapper = function (i, index) { + return stepper.step(i, to[index], pos, context[index], context) + } + + return this.fromArray(from.map(mapper)) + } + }) +} diff --git a/node_modules/@svgdotjs/svg.js/src/animation/Queue.js b/node_modules/@svgdotjs/svg.js/src/animation/Queue.js new file mode 100644 index 0000000..65108f3 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/animation/Queue.js @@ -0,0 +1,62 @@ +export default class Queue { + constructor() { + this._first = null + this._last = null + } + + // Shows us the first item in the list + first() { + return this._first && this._first.value + } + + // Shows us the last item in the list + last() { + return this._last && this._last.value + } + + push(value) { + // An item stores an id and the provided value + const item = + typeof value.next !== 'undefined' + ? value + : { value: value, next: null, prev: null } + + // Deal with the queue being empty or populated + if (this._last) { + item.prev = this._last + this._last.next = item + this._last = item + } else { + this._last = item + this._first = item + } + + // Return the current item + return item + } + + // Removes the item that was returned from the push + remove(item) { + // Relink the previous item + if (item.prev) item.prev.next = item.next + if (item.next) item.next.prev = item.prev + if (item === this._last) this._last = item.prev + if (item === this._first) this._first = item.next + + // Invalidate item + item.prev = null + item.next = null + } + + shift() { + // Check if we have a value + const remove = this._first + if (!remove) return null + + // If we do, remove it and relink things + this._first = remove.next + if (this._first) this._first.prev = null + this._last = this._first ? this._last : null + return remove.value + } +} diff --git a/node_modules/@svgdotjs/svg.js/src/animation/Runner.js b/node_modules/@svgdotjs/svg.js/src/animation/Runner.js new file mode 100644 index 0000000..be74c7a --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/animation/Runner.js @@ -0,0 +1,1085 @@ +import { Controller, Ease, Stepper } from './Controller.js' +import { extend, register } from '../utils/adopter.js' +import { from, to } from '../modules/core/gradiented.js' +import { getOrigin } from '../utils/utils.js' +import { noop, timeline } from '../modules/core/defaults.js' +import { registerMethods } from '../utils/methods.js' +import { rx, ry } from '../modules/core/circled.js' +import Animator from './Animator.js' +import Box from '../types/Box.js' +import EventTarget from '../types/EventTarget.js' +import Matrix from '../types/Matrix.js' +import Morphable, { TransformBag, ObjectBag } from './Morphable.js' +import Point from '../types/Point.js' +import SVGNumber from '../types/SVGNumber.js' +import Timeline from './Timeline.js' + +export default class Runner extends EventTarget { + constructor(options) { + super() + + // Store a unique id on the runner, so that we can identify it later + this.id = Runner.id++ + + // Ensure a default value + options = options == null ? timeline.duration : options + + // Ensure that we get a controller + options = typeof options === 'function' ? new Controller(options) : options + + // Declare all of the variables + this._element = null + this._timeline = null + this.done = false + this._queue = [] + + // Work out the stepper and the duration + this._duration = typeof options === 'number' && options + this._isDeclarative = options instanceof Controller + this._stepper = this._isDeclarative ? options : new Ease() + + // We copy the current values from the timeline because they can change + this._history = {} + + // Store the state of the runner + this.enabled = true + this._time = 0 + this._lastTime = 0 + + // At creation, the runner is in reset state + this._reseted = true + + // Save transforms applied to this runner + this.transforms = new Matrix() + this.transformId = 1 + + // Looping variables + this._haveReversed = false + this._reverse = false + this._loopsDone = 0 + this._swing = false + this._wait = 0 + this._times = 1 + + this._frameId = null + + // Stores how long a runner is stored after being done + this._persist = this._isDeclarative ? true : null + } + + static sanitise(duration, delay, when) { + // Initialise the default parameters + let times = 1 + let swing = false + let wait = 0 + duration = duration ?? timeline.duration + delay = delay ?? timeline.delay + when = when || 'last' + + // If we have an object, unpack the values + if (typeof duration === 'object' && !(duration instanceof Stepper)) { + delay = duration.delay ?? delay + when = duration.when ?? when + swing = duration.swing || swing + times = duration.times ?? times + wait = duration.wait ?? wait + duration = duration.duration ?? timeline.duration + } + + return { + duration: duration, + delay: delay, + swing: swing, + times: times, + wait: wait, + when: when + } + } + + active(enabled) { + if (enabled == null) return this.enabled + this.enabled = enabled + return this + } + + /* + Private Methods + =============== + Methods that shouldn't be used externally + */ + addTransform(transform) { + this.transforms.lmultiplyO(transform) + return this + } + + after(fn) { + return this.on('finished', fn) + } + + animate(duration, delay, when) { + const o = Runner.sanitise(duration, delay, when) + const runner = new Runner(o.duration) + if (this._timeline) runner.timeline(this._timeline) + if (this._element) runner.element(this._element) + return runner.loop(o).schedule(o.delay, o.when) + } + + clearTransform() { + this.transforms = new Matrix() + return this + } + + // TODO: Keep track of all transformations so that deletion is faster + clearTransformsFromQueue() { + if ( + !this.done || + !this._timeline || + !this._timeline._runnerIds.includes(this.id) + ) { + this._queue = this._queue.filter((item) => { + return !item.isTransform + }) + } + } + + delay(delay) { + return this.animate(0, delay) + } + + duration() { + return this._times * (this._wait + this._duration) - this._wait + } + + during(fn) { + return this.queue(null, fn) + } + + ease(fn) { + this._stepper = new Ease(fn) + return this + } + /* + Runner Definitions + ================== + These methods help us define the runtime behaviour of the Runner or they + help us make new runners from the current runner + */ + + element(element) { + if (element == null) return this._element + this._element = element + element._prepareRunner() + return this + } + + finish() { + return this.step(Infinity) + } + + loop(times, swing, wait) { + // Deal with the user passing in an object + if (typeof times === 'object') { + swing = times.swing + wait = times.wait + times = times.times + } + + // Sanitise the values and store them + this._times = times || Infinity + this._swing = swing || false + this._wait = wait || 0 + + // Allow true to be passed + if (this._times === true) { + this._times = Infinity + } + + return this + } + + loops(p) { + const loopDuration = this._duration + this._wait + if (p == null) { + const loopsDone = Math.floor(this._time / loopDuration) + const relativeTime = this._time - loopsDone * loopDuration + const position = relativeTime / this._duration + return Math.min(loopsDone + position, this._times) + } + const whole = Math.floor(p) + const partial = p % 1 + const time = loopDuration * whole + this._duration * partial + return this.time(time) + } + + persist(dtOrForever) { + if (dtOrForever == null) return this._persist + this._persist = dtOrForever + return this + } + + position(p) { + // Get all of the variables we need + const x = this._time + const d = this._duration + const w = this._wait + const t = this._times + const s = this._swing + const r = this._reverse + let position + + if (p == null) { + /* + This function converts a time to a position in the range [0, 1] + The full explanation can be found in this desmos demonstration + https://www.desmos.com/calculator/u4fbavgche + The logic is slightly simplified here because we can use booleans + */ + + // Figure out the value without thinking about the start or end time + const f = function (x) { + const swinging = s * Math.floor((x % (2 * (w + d))) / (w + d)) + const backwards = (swinging && !r) || (!swinging && r) + const uncliped = + (Math.pow(-1, backwards) * (x % (w + d))) / d + backwards + const clipped = Math.max(Math.min(uncliped, 1), 0) + return clipped + } + + // Figure out the value by incorporating the start time + const endTime = t * (w + d) - w + position = + x <= 0 + ? Math.round(f(1e-5)) + : x < endTime + ? f(x) + : Math.round(f(endTime - 1e-5)) + return position + } + + // Work out the loops done and add the position to the loops done + const loopsDone = Math.floor(this.loops()) + const swingForward = s && loopsDone % 2 === 0 + const forwards = (swingForward && !r) || (r && swingForward) + position = loopsDone + (forwards ? p : 1 - p) + return this.loops(position) + } + + progress(p) { + if (p == null) { + return Math.min(1, this._time / this.duration()) + } + return this.time(p * this.duration()) + } + + /* + Basic Functionality + =================== + These methods allow us to attach basic functions to the runner directly + */ + queue(initFn, runFn, retargetFn, isTransform) { + this._queue.push({ + initialiser: initFn || noop, + runner: runFn || noop, + retarget: retargetFn, + isTransform: isTransform, + initialised: false, + finished: false + }) + const timeline = this.timeline() + timeline && this.timeline()._continue() + return this + } + + reset() { + if (this._reseted) return this + this.time(0) + this._reseted = true + return this + } + + reverse(reverse) { + this._reverse = reverse == null ? !this._reverse : reverse + return this + } + + schedule(timeline, delay, when) { + // The user doesn't need to pass a timeline if we already have one + if (!(timeline instanceof Timeline)) { + when = delay + delay = timeline + timeline = this.timeline() + } + + // If there is no timeline, yell at the user... + if (!timeline) { + throw Error('Runner cannot be scheduled without timeline') + } + + // Schedule the runner on the timeline provided + timeline.schedule(this, delay, when) + return this + } + + step(dt) { + // If we are inactive, this stepper just gets skipped + if (!this.enabled) return this + + // Update the time and get the new position + dt = dt == null ? 16 : dt + this._time += dt + const position = this.position() + + // Figure out if we need to run the stepper in this frame + const running = this._lastPosition !== position && this._time >= 0 + this._lastPosition = position + + // Figure out if we just started + const duration = this.duration() + const justStarted = this._lastTime <= 0 && this._time > 0 + const justFinished = this._lastTime < duration && this._time >= duration + + this._lastTime = this._time + if (justStarted) { + this.fire('start', this) + } + + // Work out if the runner is finished set the done flag here so animations + // know, that they are running in the last step (this is good for + // transformations which can be merged) + const declarative = this._isDeclarative + this.done = !declarative && !justFinished && this._time >= duration + + // Runner is running. So its not in reset state anymore + this._reseted = false + + let converged = false + // Call initialise and the run function + if (running || declarative) { + this._initialise(running) + + // clear the transforms on this runner so they dont get added again and again + this.transforms = new Matrix() + converged = this._run(declarative ? dt : position) + + this.fire('step', this) + } + // correct the done flag here + // declarative animations itself know when they converged + this.done = this.done || (converged && declarative) + if (justFinished) { + this.fire('finished', this) + } + return this + } + + /* + Runner animation methods + ======================== + Control how the animation plays + */ + time(time) { + if (time == null) { + return this._time + } + const dt = time - this._time + this.step(dt) + return this + } + + timeline(timeline) { + // check explicitly for undefined so we can set the timeline to null + if (typeof timeline === 'undefined') return this._timeline + this._timeline = timeline + return this + } + + unschedule() { + const timeline = this.timeline() + timeline && timeline.unschedule(this) + return this + } + + // Run each initialise function in the runner if required + _initialise(running) { + // If we aren't running, we shouldn't initialise when not declarative + if (!running && !this._isDeclarative) return + + // Loop through all of the initialisers + for (let i = 0, len = this._queue.length; i < len; ++i) { + // Get the current initialiser + const current = this._queue[i] + + // Determine whether we need to initialise + const needsIt = this._isDeclarative || (!current.initialised && running) + running = !current.finished + + // Call the initialiser if we need to + if (needsIt && running) { + current.initialiser.call(this) + current.initialised = true + } + } + } + + // Save a morpher to the morpher list so that we can retarget it later + _rememberMorpher(method, morpher) { + this._history[method] = { + morpher: morpher, + caller: this._queue[this._queue.length - 1] + } + + // We have to resume the timeline in case a controller + // is already done without being ever run + // This can happen when e.g. this is done: + // anim = el.animate(new SVG.Spring) + // and later + // anim.move(...) + if (this._isDeclarative) { + const timeline = this.timeline() + timeline && timeline.play() + } + } + + // Try to set the target for a morpher if the morpher exists, otherwise + // Run each run function for the position or dt given + _run(positionOrDt) { + // Run all of the _queue directly + let allfinished = true + for (let i = 0, len = this._queue.length; i < len; ++i) { + // Get the current function to run + const current = this._queue[i] + + // Run the function if its not finished, we keep track of the finished + // flag for the sake of declarative _queue + const converged = current.runner.call(this, positionOrDt) + current.finished = current.finished || converged === true + allfinished = allfinished && current.finished + } + + // We report when all of the constructors are finished + return allfinished + } + + // do nothing and return false + _tryRetarget(method, target, extra) { + if (this._history[method]) { + // if the last method wasn't even initialised, throw it away + if (!this._history[method].caller.initialised) { + const index = this._queue.indexOf(this._history[method].caller) + this._queue.splice(index, 1) + return false + } + + // for the case of transformations, we use the special retarget function + // which has access to the outer scope + if (this._history[method].caller.retarget) { + this._history[method].caller.retarget.call(this, target, extra) + // for everything else a simple morpher change is sufficient + } else { + this._history[method].morpher.to(target) + } + + this._history[method].caller.finished = false + const timeline = this.timeline() + timeline && timeline.play() + return true + } + return false + } +} + +Runner.id = 0 + +export class FakeRunner { + constructor(transforms = new Matrix(), id = -1, done = true) { + this.transforms = transforms + this.id = id + this.done = done + } + + clearTransformsFromQueue() {} +} + +extend([Runner, FakeRunner], { + mergeWith(runner) { + return new FakeRunner( + runner.transforms.lmultiply(this.transforms), + runner.id + ) + } +}) + +// FakeRunner.emptyRunner = new FakeRunner() + +const lmultiply = (last, curr) => last.lmultiplyO(curr) +const getRunnerTransform = (runner) => runner.transforms + +function mergeTransforms() { + // Find the matrix to apply to the element and apply it + const runners = this._transformationRunners.runners + const netTransform = runners + .map(getRunnerTransform) + .reduce(lmultiply, new Matrix()) + + this.transform(netTransform) + + this._transformationRunners.merge() + + if (this._transformationRunners.length() === 1) { + this._frameId = null + } +} + +export class RunnerArray { + constructor() { + this.runners = [] + this.ids = [] + } + + add(runner) { + if (this.runners.includes(runner)) return + const id = runner.id + 1 + + this.runners.push(runner) + this.ids.push(id) + + return this + } + + clearBefore(id) { + const deleteCnt = this.ids.indexOf(id + 1) || 1 + this.ids.splice(0, deleteCnt, 0) + this.runners + .splice(0, deleteCnt, new FakeRunner()) + .forEach((r) => r.clearTransformsFromQueue()) + return this + } + + edit(id, newRunner) { + const index = this.ids.indexOf(id + 1) + this.ids.splice(index, 1, id + 1) + this.runners.splice(index, 1, newRunner) + return this + } + + getByID(id) { + return this.runners[this.ids.indexOf(id + 1)] + } + + length() { + return this.ids.length + } + + merge() { + let lastRunner = null + for (let i = 0; i < this.runners.length; ++i) { + const runner = this.runners[i] + + const condition = + lastRunner && + runner.done && + lastRunner.done && + // don't merge runner when persisted on timeline + (!runner._timeline || + !runner._timeline._runnerIds.includes(runner.id)) && + (!lastRunner._timeline || + !lastRunner._timeline._runnerIds.includes(lastRunner.id)) + + if (condition) { + // the +1 happens in the function + this.remove(runner.id) + const newRunner = runner.mergeWith(lastRunner) + this.edit(lastRunner.id, newRunner) + lastRunner = newRunner + --i + } else { + lastRunner = runner + } + } + + return this + } + + remove(id) { + const index = this.ids.indexOf(id + 1) + this.ids.splice(index, 1) + this.runners.splice(index, 1) + return this + } +} + +registerMethods({ + Element: { + animate(duration, delay, when) { + const o = Runner.sanitise(duration, delay, when) + const timeline = this.timeline() + return new Runner(o.duration) + .loop(o) + .element(this) + .timeline(timeline.play()) + .schedule(o.delay, o.when) + }, + + delay(by, when) { + return this.animate(0, by, when) + }, + + // this function searches for all runners on the element and deletes the ones + // which run before the current one. This is because absolute transformations + // overwrite anything anyway so there is no need to waste time computing + // other runners + _clearTransformRunnersBefore(currentRunner) { + this._transformationRunners.clearBefore(currentRunner.id) + }, + + _currentTransform(current) { + return ( + this._transformationRunners.runners + // we need the equal sign here to make sure, that also transformations + // on the same runner which execute before the current transformation are + // taken into account + .filter((runner) => runner.id <= current.id) + .map(getRunnerTransform) + .reduce(lmultiply, new Matrix()) + ) + }, + + _addRunner(runner) { + this._transformationRunners.add(runner) + + // Make sure that the runner merge is executed at the very end of + // all Animator functions. That is why we use immediate here to execute + // the merge right after all frames are run + Animator.cancelImmediate(this._frameId) + this._frameId = Animator.immediate(mergeTransforms.bind(this)) + }, + + _prepareRunner() { + if (this._frameId == null) { + this._transformationRunners = new RunnerArray().add( + new FakeRunner(new Matrix(this)) + ) + } + } + } +}) + +// Will output the elements from array A that are not in the array B +const difference = (a, b) => a.filter((x) => !b.includes(x)) + +extend(Runner, { + attr(a, v) { + return this.styleAttr('attr', a, v) + }, + + // Add animatable styles + css(s, v) { + return this.styleAttr('css', s, v) + }, + + styleAttr(type, nameOrAttrs, val) { + if (typeof nameOrAttrs === 'string') { + return this.styleAttr(type, { [nameOrAttrs]: val }) + } + + let attrs = nameOrAttrs + if (this._tryRetarget(type, attrs)) return this + + let morpher = new Morphable(this._stepper).to(attrs) + let keys = Object.keys(attrs) + + this.queue( + function () { + morpher = morpher.from(this.element()[type](keys)) + }, + function (pos) { + this.element()[type](morpher.at(pos).valueOf()) + return morpher.done() + }, + function (newToAttrs) { + // Check if any new keys were added + const newKeys = Object.keys(newToAttrs) + const differences = difference(newKeys, keys) + + // If their are new keys, initialize them and add them to morpher + if (differences.length) { + // Get the values + const addedFromAttrs = this.element()[type](differences) + + // Get the already initialized values + const oldFromAttrs = new ObjectBag(morpher.from()).valueOf() + + // Merge old and new + Object.assign(oldFromAttrs, addedFromAttrs) + morpher.from(oldFromAttrs) + } + + // Get the object from the morpher + const oldToAttrs = new ObjectBag(morpher.to()).valueOf() + + // Merge in new attributes + Object.assign(oldToAttrs, newToAttrs) + + // Change morpher target + morpher.to(oldToAttrs) + + // Make sure that we save the work we did so we don't need it to do again + keys = newKeys + attrs = newToAttrs + } + ) + + this._rememberMorpher(type, morpher) + return this + }, + + zoom(level, point) { + if (this._tryRetarget('zoom', level, point)) return this + + let morpher = new Morphable(this._stepper).to(new SVGNumber(level)) + + this.queue( + function () { + morpher = morpher.from(this.element().zoom()) + }, + function (pos) { + this.element().zoom(morpher.at(pos), point) + return morpher.done() + }, + function (newLevel, newPoint) { + point = newPoint + morpher.to(newLevel) + } + ) + + this._rememberMorpher('zoom', morpher) + return this + }, + + /** + ** absolute transformations + **/ + + // + // M v -----|-----(D M v = F v)------|-----> T v + // + // 1. define the final state (T) and decompose it (once) + // t = [tx, ty, the, lam, sy, sx] + // 2. on every frame: pull the current state of all previous transforms + // (M - m can change) + // and then write this as m = [tx0, ty0, the0, lam0, sy0, sx0] + // 3. Find the interpolated matrix F(pos) = m + pos * (t - m) + // - Note F(0) = M + // - Note F(1) = T + // 4. Now you get the delta matrix as a result: D = F * inv(M) + + transform(transforms, relative, affine) { + // If we have a declarative function, we should retarget it if possible + relative = transforms.relative || relative + if ( + this._isDeclarative && + !relative && + this._tryRetarget('transform', transforms) + ) { + return this + } + + // Parse the parameters + const isMatrix = Matrix.isMatrixLike(transforms) + affine = + transforms.affine != null + ? transforms.affine + : affine != null + ? affine + : !isMatrix + + // Create a morpher and set its type + const morpher = new Morphable(this._stepper).type( + affine ? TransformBag : Matrix + ) + + let origin + let element + let current + let currentAngle + let startTransform + + function setup() { + // make sure element and origin is defined + element = element || this.element() + origin = origin || getOrigin(transforms, element) + + startTransform = new Matrix(relative ? undefined : element) + + // add the runner to the element so it can merge transformations + element._addRunner(this) + + // Deactivate all transforms that have run so far if we are absolute + if (!relative) { + element._clearTransformRunnersBefore(this) + } + } + + function run(pos) { + // clear all other transforms before this in case something is saved + // on this runner. We are absolute. We dont need these! + if (!relative) this.clearTransform() + + const { x, y } = new Point(origin).transform( + element._currentTransform(this) + ) + + let target = new Matrix({ ...transforms, origin: [x, y] }) + let start = this._isDeclarative && current ? current : startTransform + + if (affine) { + target = target.decompose(x, y) + start = start.decompose(x, y) + + // Get the current and target angle as it was set + const rTarget = target.rotate + const rCurrent = start.rotate + + // Figure out the shortest path to rotate directly + const possibilities = [rTarget - 360, rTarget, rTarget + 360] + const distances = possibilities.map((a) => Math.abs(a - rCurrent)) + const shortest = Math.min(...distances) + const index = distances.indexOf(shortest) + target.rotate = possibilities[index] + } + + if (relative) { + // we have to be careful here not to overwrite the rotation + // with the rotate method of Matrix + if (!isMatrix) { + target.rotate = transforms.rotate || 0 + } + if (this._isDeclarative && currentAngle) { + start.rotate = currentAngle + } + } + + morpher.from(start) + morpher.to(target) + + const affineParameters = morpher.at(pos) + currentAngle = affineParameters.rotate + current = new Matrix(affineParameters) + + this.addTransform(current) + element._addRunner(this) + return morpher.done() + } + + function retarget(newTransforms) { + // only get a new origin if it changed since the last call + if ( + (newTransforms.origin || 'center').toString() !== + (transforms.origin || 'center').toString() + ) { + origin = getOrigin(newTransforms, element) + } + + // overwrite the old transformations with the new ones + transforms = { ...newTransforms, origin } + } + + this.queue(setup, run, retarget, true) + this._isDeclarative && this._rememberMorpher('transform', morpher) + return this + }, + + // Animatable x-axis + x(x) { + return this._queueNumber('x', x) + }, + + // Animatable y-axis + y(y) { + return this._queueNumber('y', y) + }, + + ax(x) { + return this._queueNumber('ax', x) + }, + + ay(y) { + return this._queueNumber('ay', y) + }, + + dx(x = 0) { + return this._queueNumberDelta('x', x) + }, + + dy(y = 0) { + return this._queueNumberDelta('y', y) + }, + + dmove(x, y) { + return this.dx(x).dy(y) + }, + + _queueNumberDelta(method, to) { + to = new SVGNumber(to) + + // Try to change the target if we have this method already registered + if (this._tryRetarget(method, to)) return this + + // Make a morpher and queue the animation + const morpher = new Morphable(this._stepper).to(to) + let from = null + this.queue( + function () { + from = this.element()[method]() + morpher.from(from) + morpher.to(from + to) + }, + function (pos) { + this.element()[method](morpher.at(pos)) + return morpher.done() + }, + function (newTo) { + morpher.to(from + new SVGNumber(newTo)) + } + ) + + // Register the morpher so that if it is changed again, we can retarget it + this._rememberMorpher(method, morpher) + return this + }, + + _queueObject(method, to) { + // Try to change the target if we have this method already registered + if (this._tryRetarget(method, to)) return this + + // Make a morpher and queue the animation + const morpher = new Morphable(this._stepper).to(to) + this.queue( + function () { + morpher.from(this.element()[method]()) + }, + function (pos) { + this.element()[method](morpher.at(pos)) + return morpher.done() + } + ) + + // Register the morpher so that if it is changed again, we can retarget it + this._rememberMorpher(method, morpher) + return this + }, + + _queueNumber(method, value) { + return this._queueObject(method, new SVGNumber(value)) + }, + + // Animatable center x-axis + cx(x) { + return this._queueNumber('cx', x) + }, + + // Animatable center y-axis + cy(y) { + return this._queueNumber('cy', y) + }, + + // Add animatable move + move(x, y) { + return this.x(x).y(y) + }, + + amove(x, y) { + return this.ax(x).ay(y) + }, + + // Add animatable center + center(x, y) { + return this.cx(x).cy(y) + }, + + // Add animatable size + size(width, height) { + // animate bbox based size for all other elements + let box + + if (!width || !height) { + box = this._element.bbox() + } + + if (!width) { + width = (box.width / box.height) * height + } + + if (!height) { + height = (box.height / box.width) * width + } + + return this.width(width).height(height) + }, + + // Add animatable width + width(width) { + return this._queueNumber('width', width) + }, + + // Add animatable height + height(height) { + return this._queueNumber('height', height) + }, + + // Add animatable plot + plot(a, b, c, d) { + // Lines can be plotted with 4 arguments + if (arguments.length === 4) { + return this.plot([a, b, c, d]) + } + + if (this._tryRetarget('plot', a)) return this + + const morpher = new Morphable(this._stepper) + .type(this._element.MorphArray) + .to(a) + + this.queue( + function () { + morpher.from(this._element.array()) + }, + function (pos) { + this._element.plot(morpher.at(pos)) + return morpher.done() + } + ) + + this._rememberMorpher('plot', morpher) + return this + }, + + // Add leading method + leading(value) { + return this._queueNumber('leading', value) + }, + + // Add animatable viewbox + viewbox(x, y, width, height) { + return this._queueObject('viewbox', new Box(x, y, width, height)) + }, + + update(o) { + if (typeof o !== 'object') { + return this.update({ + offset: arguments[0], + color: arguments[1], + opacity: arguments[2] + }) + } + + if (o.opacity != null) this.attr('stop-opacity', o.opacity) + if (o.color != null) this.attr('stop-color', o.color) + if (o.offset != null) this.attr('offset', o.offset) + + return this + } +}) + +extend(Runner, { rx, ry, from, to }) +register(Runner, 'Runner') diff --git a/node_modules/@svgdotjs/svg.js/src/animation/Timeline.js b/node_modules/@svgdotjs/svg.js/src/animation/Timeline.js new file mode 100644 index 0000000..2f6f5d3 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/animation/Timeline.js @@ -0,0 +1,350 @@ +import { globals } from '../utils/window.js' +import { registerMethods } from '../utils/methods.js' +import Animator from './Animator.js' +import EventTarget from '../types/EventTarget.js' + +const makeSchedule = function (runnerInfo) { + const start = runnerInfo.start + const duration = runnerInfo.runner.duration() + const end = start + duration + return { + start: start, + duration: duration, + end: end, + runner: runnerInfo.runner + } +} + +const defaultSource = function () { + const w = globals.window + return (w.performance || w.Date).now() +} + +export default class Timeline extends EventTarget { + // Construct a new timeline on the given element + constructor(timeSource = defaultSource) { + super() + + this._timeSource = timeSource + + // terminate resets all variables to their initial state + this.terminate() + } + + active() { + return !!this._nextFrame + } + + finish() { + // Go to end and pause + this.time(this.getEndTimeOfTimeline() + 1) + return this.pause() + } + + // Calculates the end of the timeline + getEndTime() { + const lastRunnerInfo = this.getLastRunnerInfo() + const lastDuration = lastRunnerInfo ? lastRunnerInfo.runner.duration() : 0 + const lastStartTime = lastRunnerInfo ? lastRunnerInfo.start : this._time + return lastStartTime + lastDuration + } + + getEndTimeOfTimeline() { + const endTimes = this._runners.map((i) => i.start + i.runner.duration()) + return Math.max(0, ...endTimes) + } + + getLastRunnerInfo() { + return this.getRunnerInfoById(this._lastRunnerId) + } + + getRunnerInfoById(id) { + return this._runners[this._runnerIds.indexOf(id)] || null + } + + pause() { + this._paused = true + return this._continue() + } + + persist(dtOrForever) { + if (dtOrForever == null) return this._persist + this._persist = dtOrForever + return this + } + + play() { + // Now make sure we are not paused and continue the animation + this._paused = false + return this.updateTime()._continue() + } + + reverse(yes) { + const currentSpeed = this.speed() + if (yes == null) return this.speed(-currentSpeed) + + const positive = Math.abs(currentSpeed) + return this.speed(yes ? -positive : positive) + } + + // schedules a runner on the timeline + schedule(runner, delay, when) { + if (runner == null) { + return this._runners.map(makeSchedule) + } + + // The start time for the next animation can either be given explicitly, + // derived from the current timeline time or it can be relative to the + // last start time to chain animations directly + + let absoluteStartTime = 0 + const endTime = this.getEndTime() + delay = delay || 0 + + // Work out when to start the animation + if (when == null || when === 'last' || when === 'after') { + // Take the last time and increment + absoluteStartTime = endTime + } else if (when === 'absolute' || when === 'start') { + absoluteStartTime = delay + delay = 0 + } else if (when === 'now') { + absoluteStartTime = this._time + } else if (when === 'relative') { + const runnerInfo = this.getRunnerInfoById(runner.id) + if (runnerInfo) { + absoluteStartTime = runnerInfo.start + delay + delay = 0 + } + } else if (when === 'with-last') { + const lastRunnerInfo = this.getLastRunnerInfo() + const lastStartTime = lastRunnerInfo ? lastRunnerInfo.start : this._time + absoluteStartTime = lastStartTime + } else { + throw new Error('Invalid value for the "when" parameter') + } + + // Manage runner + runner.unschedule() + runner.timeline(this) + + const persist = runner.persist() + const runnerInfo = { + persist: persist === null ? this._persist : persist, + start: absoluteStartTime + delay, + runner + } + + this._lastRunnerId = runner.id + + this._runners.push(runnerInfo) + this._runners.sort((a, b) => a.start - b.start) + this._runnerIds = this._runners.map((info) => info.runner.id) + + this.updateTime()._continue() + return this + } + + seek(dt) { + return this.time(this._time + dt) + } + + source(fn) { + if (fn == null) return this._timeSource + this._timeSource = fn + return this + } + + speed(speed) { + if (speed == null) return this._speed + this._speed = speed + return this + } + + stop() { + // Go to start and pause + this.time(0) + return this.pause() + } + + time(time) { + if (time == null) return this._time + this._time = time + return this._continue(true) + } + + // Remove the runner from this timeline + unschedule(runner) { + const index = this._runnerIds.indexOf(runner.id) + if (index < 0) return this + + this._runners.splice(index, 1) + this._runnerIds.splice(index, 1) + + runner.timeline(null) + return this + } + + // Makes sure, that after pausing the time doesn't jump + updateTime() { + if (!this.active()) { + this._lastSourceTime = this._timeSource() + } + return this + } + + // Checks if we are running and continues the animation + _continue(immediateStep = false) { + Animator.cancelFrame(this._nextFrame) + this._nextFrame = null + + if (immediateStep) return this._stepImmediate() + if (this._paused) return this + + this._nextFrame = Animator.frame(this._step) + return this + } + + _stepFn(immediateStep = false) { + // Get the time delta from the last time and update the time + const time = this._timeSource() + let dtSource = time - this._lastSourceTime + + if (immediateStep) dtSource = 0 + + const dtTime = this._speed * dtSource + (this._time - this._lastStepTime) + this._lastSourceTime = time + + // Only update the time if we use the timeSource. + // Otherwise use the current time + if (!immediateStep) { + // Update the time + this._time += dtTime + this._time = this._time < 0 ? 0 : this._time + } + this._lastStepTime = this._time + this.fire('time', this._time) + + // This is for the case that the timeline was seeked so that the time + // is now before the startTime of the runner. That is why we need to set + // the runner to position 0 + + // FIXME: + // However, resetting in insertion order leads to bugs. Considering the case, + // where 2 runners change the same attribute but in different times, + // resetting both of them will lead to the case where the later defined + // runner always wins the reset even if the other runner started earlier + // and therefore should win the attribute battle + // this can be solved by resetting them backwards + for (let k = this._runners.length; k--; ) { + // Get and run the current runner and ignore it if its inactive + const runnerInfo = this._runners[k] + const runner = runnerInfo.runner + + // Make sure that we give the actual difference + // between runner start time and now + const dtToStart = this._time - runnerInfo.start + + // Dont run runner if not started yet + // and try to reset it + if (dtToStart <= 0) { + runner.reset() + } + } + + // Run all of the runners directly + let runnersLeft = false + for (let i = 0, len = this._runners.length; i < len; i++) { + // Get and run the current runner and ignore it if its inactive + const runnerInfo = this._runners[i] + const runner = runnerInfo.runner + let dt = dtTime + + // Make sure that we give the actual difference + // between runner start time and now + const dtToStart = this._time - runnerInfo.start + + // Dont run runner if not started yet + if (dtToStart <= 0) { + runnersLeft = true + continue + } else if (dtToStart < dt) { + // Adjust dt to make sure that animation is on point + dt = dtToStart + } + + if (!runner.active()) continue + + // If this runner is still going, signal that we need another animation + // frame, otherwise, remove the completed runner + const finished = runner.step(dt).done + if (!finished) { + runnersLeft = true + // continue + } else if (runnerInfo.persist !== true) { + // runner is finished. And runner might get removed + const endTime = runner.duration() - runner.time() + this._time + + if (endTime + runnerInfo.persist < this._time) { + // Delete runner and correct index + runner.unschedule() + --i + --len + } + } + } + + // Basically: we continue when there are runners right from us in time + // when -->, and when runners are left from us when <-- + if ( + (runnersLeft && !(this._speed < 0 && this._time === 0)) || + (this._runnerIds.length && this._speed < 0 && this._time > 0) + ) { + this._continue() + } else { + this.pause() + this.fire('finished') + } + + return this + } + + terminate() { + // cleanup memory + + // Store the timing variables + this._startTime = 0 + this._speed = 1.0 + + // Determines how long a runner is hold in memory. Can be a dt or true/false + this._persist = 0 + + // Keep track of the running animations and their starting parameters + this._nextFrame = null + this._paused = true + this._runners = [] + this._runnerIds = [] + this._lastRunnerId = -1 + this._time = 0 + this._lastSourceTime = 0 + this._lastStepTime = 0 + + // Make sure that step is always called in class context + this._step = this._stepFn.bind(this, false) + this._stepImmediate = this._stepFn.bind(this, true) + } +} + +registerMethods({ + Element: { + timeline: function (timeline) { + if (timeline == null) { + this._timeline = this._timeline || new Timeline() + return this._timeline + } else { + this._timeline = timeline + return this + } + } + } +}) diff --git a/node_modules/@svgdotjs/svg.js/src/elements/A.js b/node_modules/@svgdotjs/svg.js/src/elements/A.js new file mode 100644 index 0000000..231954f --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/elements/A.js @@ -0,0 +1,83 @@ +import { + nodeOrNew, + register, + wrapWithAttrCheck, + extend +} from '../utils/adopter.js' +import { registerMethods } from '../utils/methods.js' +import { xlink } from '../modules/core/namespaces.js' +import Container from './Container.js' +import * as containerGeometry from '../modules/core/containerGeometry.js' + +export default class A extends Container { + constructor(node, attrs = node) { + super(nodeOrNew('a', node), attrs) + } + + // Link target attribute + target(target) { + return this.attr('target', target) + } + + // Link url + to(url) { + return this.attr('href', url, xlink) + } +} + +extend(A, containerGeometry) + +registerMethods({ + Container: { + // Create a hyperlink element + link: wrapWithAttrCheck(function (url) { + return this.put(new A()).to(url) + }) + }, + Element: { + unlink() { + const link = this.linker() + + if (!link) return this + + const parent = link.parent() + + if (!parent) { + return this.remove() + } + + const index = parent.index(link) + parent.add(this, index) + + link.remove() + return this + }, + linkTo(url) { + // reuse old link if possible + let link = this.linker() + + if (!link) { + link = new A() + this.wrap(link) + } + + if (typeof url === 'function') { + url.call(link, link) + } else { + link.to(url) + } + + return this + }, + linker() { + const link = this.parent() + if (link && link.node.nodeName.toLowerCase() === 'a') { + return link + } + + return null + } + } +}) + +register(A, 'A') diff --git a/node_modules/@svgdotjs/svg.js/src/elements/Circle.js b/node_modules/@svgdotjs/svg.js/src/elements/Circle.js new file mode 100644 index 0000000..5dae51e --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/elements/Circle.js @@ -0,0 +1,47 @@ +import { cx, cy, height, width, x, y } from '../modules/core/circled.js' +import { + extend, + nodeOrNew, + register, + wrapWithAttrCheck +} from '../utils/adopter.js' +import { registerMethods } from '../utils/methods.js' +import SVGNumber from '../types/SVGNumber.js' +import Shape from './Shape.js' + +export default class Circle extends Shape { + constructor(node, attrs = node) { + super(nodeOrNew('circle', node), attrs) + } + + radius(r) { + return this.attr('r', r) + } + + // Radius x value + rx(rx) { + return this.attr('r', rx) + } + + // Alias radius x value + ry(ry) { + return this.rx(ry) + } + + size(size) { + return this.radius(new SVGNumber(size).divide(2)) + } +} + +extend(Circle, { x, y, cx, cy, width, height }) + +registerMethods({ + Container: { + // Create circle element + circle: wrapWithAttrCheck(function (size = 0) { + return this.put(new Circle()).size(size).move(0, 0) + }) + } +}) + +register(Circle, 'Circle') diff --git a/node_modules/@svgdotjs/svg.js/src/elements/ClipPath.js b/node_modules/@svgdotjs/svg.js/src/elements/ClipPath.js new file mode 100644 index 0000000..747059d --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/elements/ClipPath.js @@ -0,0 +1,58 @@ +import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js' +import { registerMethods } from '../utils/methods.js' +import Container from './Container.js' +import baseFind from '../modules/core/selector.js' + +export default class ClipPath extends Container { + constructor(node, attrs = node) { + super(nodeOrNew('clipPath', node), attrs) + } + + // Unclip all clipped elements and remove itself + remove() { + // unclip all targets + this.targets().forEach(function (el) { + el.unclip() + }) + + // remove clipPath from parent + return super.remove() + } + + targets() { + return baseFind('svg [clip-path*=' + this.id() + ']') + } +} + +registerMethods({ + Container: { + // Create clipping element + clip: wrapWithAttrCheck(function () { + return this.defs().put(new ClipPath()) + }) + }, + Element: { + // Distribute clipPath to svg element + clipper() { + return this.reference('clip-path') + }, + + clipWith(element) { + // use given clip or create a new one + const clipper = + element instanceof ClipPath + ? element + : this.parent().clip().add(element) + + // apply mask + return this.attr('clip-path', 'url(#' + clipper.id() + ')') + }, + + // Unclip element + unclip() { + return this.attr('clip-path', null) + } + } +}) + +register(ClipPath, 'ClipPath') diff --git a/node_modules/@svgdotjs/svg.js/src/elements/Container.js b/node_modules/@svgdotjs/svg.js/src/elements/Container.js new file mode 100644 index 0000000..0f45b6d --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/elements/Container.js @@ -0,0 +1,28 @@ +import { register } from '../utils/adopter.js' +import Element from './Element.js' + +export default class Container extends Element { + flatten() { + this.each(function () { + if (this instanceof Container) { + return this.flatten().ungroup() + } + }) + + return this + } + + ungroup(parent = this.parent(), index = parent.index(this)) { + // when parent != this, we want append all elements to the end + index = index === -1 ? parent.children().length : index + + this.each(function (i, children) { + // reverse each + return children[children.length - i - 1].toParent(parent, index) + }) + + return this.remove() + } +} + +register(Container, 'Container') diff --git a/node_modules/@svgdotjs/svg.js/src/elements/Defs.js b/node_modules/@svgdotjs/svg.js/src/elements/Defs.js new file mode 100644 index 0000000..6d9f725 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/elements/Defs.js @@ -0,0 +1,18 @@ +import { nodeOrNew, register } from '../utils/adopter.js' +import Container from './Container.js' + +export default class Defs extends Container { + constructor(node, attrs = node) { + super(nodeOrNew('defs', node), attrs) + } + + flatten() { + return this + } + + ungroup() { + return this + } +} + +register(Defs, 'Defs') diff --git a/node_modules/@svgdotjs/svg.js/src/elements/Dom.js b/node_modules/@svgdotjs/svg.js/src/elements/Dom.js new file mode 100644 index 0000000..604a1ee --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/elements/Dom.js @@ -0,0 +1,358 @@ +import { + adopt, + assignNewId, + eid, + extend, + makeInstance, + create, + register +} from '../utils/adopter.js' +import { find, findOne } from '../modules/core/selector.js' +import { globals } from '../utils/window.js' +import { map } from '../utils/utils.js' +import { svg, html } from '../modules/core/namespaces.js' +import EventTarget from '../types/EventTarget.js' +import List from '../types/List.js' +import attr from '../modules/core/attr.js' + +export default class Dom extends EventTarget { + constructor(node, attrs) { + super() + this.node = node + this.type = node.nodeName + + if (attrs && node !== attrs) { + this.attr(attrs) + } + } + + // Add given element at a position + add(element, i) { + element = makeInstance(element) + + // If non-root svg nodes are added we have to remove their namespaces + if ( + element.removeNamespace && + this.node instanceof globals.window.SVGElement + ) { + element.removeNamespace() + } + + if (i == null) { + this.node.appendChild(element.node) + } else if (element.node !== this.node.childNodes[i]) { + this.node.insertBefore(element.node, this.node.childNodes[i]) + } + + return this + } + + // Add element to given container and return self + addTo(parent, i) { + return makeInstance(parent).put(this, i) + } + + // Returns all child elements + children() { + return new List( + map(this.node.children, function (node) { + return adopt(node) + }) + ) + } + + // Remove all elements in this container + clear() { + // remove children + while (this.node.hasChildNodes()) { + this.node.removeChild(this.node.lastChild) + } + + return this + } + + // Clone element + clone(deep = true, assignNewIds = true) { + // write dom data to the dom so the clone can pickup the data + this.writeDataToDom() + + // clone element + let nodeClone = this.node.cloneNode(deep) + if (assignNewIds) { + // assign new id + nodeClone = assignNewId(nodeClone) + } + return new this.constructor(nodeClone) + } + + // Iterates over all children and invokes a given block + each(block, deep) { + const children = this.children() + let i, il + + for (i = 0, il = children.length; i < il; i++) { + block.apply(children[i], [i, children]) + + if (deep) { + children[i].each(block, deep) + } + } + + return this + } + + element(nodeName, attrs) { + return this.put(new Dom(create(nodeName), attrs)) + } + + // Get first child + first() { + return adopt(this.node.firstChild) + } + + // Get a element at the given index + get(i) { + return adopt(this.node.childNodes[i]) + } + + getEventHolder() { + return this.node + } + + getEventTarget() { + return this.node + } + + // Checks if the given element is a child + has(element) { + return this.index(element) >= 0 + } + + html(htmlOrFn, outerHTML) { + return this.xml(htmlOrFn, outerHTML, html) + } + + // Get / set id + id(id) { + // generate new id if no id set + if (typeof id === 'undefined' && !this.node.id) { + this.node.id = eid(this.type) + } + + // don't set directly with this.node.id to make `null` work correctly + return this.attr('id', id) + } + + // Gets index of given element + index(element) { + return [].slice.call(this.node.childNodes).indexOf(element.node) + } + + // Get the last child + last() { + return adopt(this.node.lastChild) + } + + // matches the element vs a css selector + matches(selector) { + const el = this.node + const matcher = + el.matches || + el.matchesSelector || + el.msMatchesSelector || + el.mozMatchesSelector || + el.webkitMatchesSelector || + el.oMatchesSelector || + null + return matcher && matcher.call(el, selector) + } + + // Returns the parent element instance + parent(type) { + let parent = this + + // check for parent + if (!parent.node.parentNode) return null + + // get parent element + parent = adopt(parent.node.parentNode) + + if (!type) return parent + + // loop through ancestors if type is given + do { + if ( + typeof type === 'string' ? parent.matches(type) : parent instanceof type + ) + return parent + } while ((parent = adopt(parent.node.parentNode))) + + return parent + } + + // Basically does the same as `add()` but returns the added element instead + put(element, i) { + element = makeInstance(element) + this.add(element, i) + return element + } + + // Add element to given container and return container + putIn(parent, i) { + return makeInstance(parent).add(this, i) + } + + // Remove element + remove() { + if (this.parent()) { + this.parent().removeElement(this) + } + + return this + } + + // Remove a given child + removeElement(element) { + this.node.removeChild(element.node) + + return this + } + + // Replace this with element + replace(element) { + element = makeInstance(element) + + if (this.node.parentNode) { + this.node.parentNode.replaceChild(element.node, this.node) + } + + return element + } + + round(precision = 2, map = null) { + const factor = 10 ** precision + const attrs = this.attr(map) + + for (const i in attrs) { + if (typeof attrs[i] === 'number') { + attrs[i] = Math.round(attrs[i] * factor) / factor + } + } + + this.attr(attrs) + return this + } + + // Import / Export raw svg + svg(svgOrFn, outerSVG) { + return this.xml(svgOrFn, outerSVG, svg) + } + + // Return id on string conversion + toString() { + return this.id() + } + + words(text) { + // This is faster than removing all children and adding a new one + this.node.textContent = text + return this + } + + wrap(node) { + const parent = this.parent() + + if (!parent) { + return this.addTo(node) + } + + const position = parent.index(this) + return parent.put(node, position).put(this) + } + + // write svgjs data to the dom + writeDataToDom() { + // dump variables recursively + this.each(function () { + this.writeDataToDom() + }) + + return this + } + + // Import / Export raw svg + xml(xmlOrFn, outerXML, ns) { + if (typeof xmlOrFn === 'boolean') { + ns = outerXML + outerXML = xmlOrFn + xmlOrFn = null + } + + // act as getter if no svg string is given + if (xmlOrFn == null || typeof xmlOrFn === 'function') { + // The default for exports is, that the outerNode is included + outerXML = outerXML == null ? true : outerXML + + // write svgjs data to the dom + this.writeDataToDom() + let current = this + + // An export modifier was passed + if (xmlOrFn != null) { + current = adopt(current.node.cloneNode(true)) + + // If the user wants outerHTML we need to process this node, too + if (outerXML) { + const result = xmlOrFn(current) + current = result || current + + // The user does not want this node? Well, then he gets nothing + if (result === false) return '' + } + + // Deep loop through all children and apply modifier + current.each(function () { + const result = xmlOrFn(this) + const _this = result || this + + // If modifier returns false, discard node + if (result === false) { + this.remove() + + // If modifier returns new node, use it + } else if (result && this !== _this) { + this.replace(_this) + } + }, true) + } + + // Return outer or inner content + return outerXML ? current.node.outerHTML : current.node.innerHTML + } + + // Act as setter if we got a string + + // The default for import is, that the current node is not replaced + outerXML = outerXML == null ? false : outerXML + + // Create temporary holder + const well = create('wrapper', ns) + const fragment = globals.document.createDocumentFragment() + + // Dump raw svg + well.innerHTML = xmlOrFn + + // Transplant nodes into the fragment + for (let len = well.children.length; len--; ) { + fragment.appendChild(well.firstElementChild) + } + + const parent = this.parent() + + // Add the whole fragment at once + return outerXML ? this.replace(fragment) && parent : this.add(fragment) + } +} + +extend(Dom, { attr, find, findOne }) +register(Dom, 'Dom') diff --git a/node_modules/@svgdotjs/svg.js/src/elements/Element.js b/node_modules/@svgdotjs/svg.js/src/elements/Element.js new file mode 100644 index 0000000..e3a4211 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/elements/Element.js @@ -0,0 +1,182 @@ +import { bbox, rbox, inside } from '../types/Box.js' +import { ctm, screenCTM } from '../types/Matrix.js' +import { + extend, + getClass, + makeInstance, + register, + root +} from '../utils/adopter.js' +import { globals } from '../utils/window.js' +import { point } from '../types/Point.js' +import { proportionalSize, writeDataToDom } from '../utils/utils.js' +import { reference } from '../modules/core/regex.js' +import Dom from './Dom.js' +import List from '../types/List.js' +import SVGNumber from '../types/SVGNumber.js' + +export default class Element extends Dom { + constructor(node, attrs) { + super(node, attrs) + + // initialize data object + this.dom = {} + + // create circular reference + this.node.instance = this + + if (node.hasAttribute('data-svgjs') || node.hasAttribute('svgjs:data')) { + // pull svgjs data from the dom (getAttributeNS doesn't work in html5) + this.setData( + JSON.parse(node.getAttribute('data-svgjs')) ?? + JSON.parse(node.getAttribute('svgjs:data')) ?? + {} + ) + } + } + + // Move element by its center + center(x, y) { + return this.cx(x).cy(y) + } + + // Move by center over x-axis + cx(x) { + return x == null + ? this.x() + this.width() / 2 + : this.x(x - this.width() / 2) + } + + // Move by center over y-axis + cy(y) { + return y == null + ? this.y() + this.height() / 2 + : this.y(y - this.height() / 2) + } + + // Get defs + defs() { + const root = this.root() + return root && root.defs() + } + + // Relative move over x and y axes + dmove(x, y) { + return this.dx(x).dy(y) + } + + // Relative move over x axis + dx(x = 0) { + return this.x(new SVGNumber(x).plus(this.x())) + } + + // Relative move over y axis + dy(y = 0) { + return this.y(new SVGNumber(y).plus(this.y())) + } + + getEventHolder() { + return this + } + + // Set height of element + height(height) { + return this.attr('height', height) + } + + // Move element to given x and y values + move(x, y) { + return this.x(x).y(y) + } + + // return array of all ancestors of given type up to the root svg + parents(until = this.root()) { + const isSelector = typeof until === 'string' + if (!isSelector) { + until = makeInstance(until) + } + const parents = new List() + let parent = this + + while ( + (parent = parent.parent()) && + parent.node !== globals.document && + parent.nodeName !== '#document-fragment' + ) { + parents.push(parent) + + if (!isSelector && parent.node === until.node) { + break + } + if (isSelector && parent.matches(until)) { + break + } + if (parent.node === this.root().node) { + // We worked our way to the root and didn't match `until` + return null + } + } + + return parents + } + + // Get referenced element form attribute value + reference(attr) { + attr = this.attr(attr) + if (!attr) return null + + const m = (attr + '').match(reference) + return m ? makeInstance(m[1]) : null + } + + // Get parent document + root() { + const p = this.parent(getClass(root)) + return p && p.root() + } + + // set given data to the elements data property + setData(o) { + this.dom = o + return this + } + + // Set element size to given width and height + size(width, height) { + const p = proportionalSize(this, width, height) + + return this.width(new SVGNumber(p.width)).height(new SVGNumber(p.height)) + } + + // Set width of element + width(width) { + return this.attr('width', width) + } + + // write svgjs data to the dom + writeDataToDom() { + writeDataToDom(this, this.dom) + return super.writeDataToDom() + } + + // Move over x-axis + x(x) { + return this.attr('x', x) + } + + // Move over y-axis + y(y) { + return this.attr('y', y) + } +} + +extend(Element, { + bbox, + rbox, + inside, + point, + ctm, + screenCTM +}) + +register(Element, 'Element') diff --git a/node_modules/@svgdotjs/svg.js/src/elements/Ellipse.js b/node_modules/@svgdotjs/svg.js/src/elements/Ellipse.js new file mode 100644 index 0000000..3f8b04b --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/elements/Ellipse.js @@ -0,0 +1,36 @@ +import { + extend, + nodeOrNew, + register, + wrapWithAttrCheck +} from '../utils/adopter.js' +import { proportionalSize } from '../utils/utils.js' +import { registerMethods } from '../utils/methods.js' +import SVGNumber from '../types/SVGNumber.js' +import Shape from './Shape.js' +import * as circled from '../modules/core/circled.js' + +export default class Ellipse extends Shape { + constructor(node, attrs = node) { + super(nodeOrNew('ellipse', node), attrs) + } + + size(width, height) { + const p = proportionalSize(this, width, height) + + return this.rx(new SVGNumber(p.width).divide(2)).ry( + new SVGNumber(p.height).divide(2) + ) + } +} + +extend(Ellipse, circled) + +registerMethods('Container', { + // Create an ellipse + ellipse: wrapWithAttrCheck(function (width = 0, height = width) { + return this.put(new Ellipse()).size(width, height).move(0, 0) + }) +}) + +register(Ellipse, 'Ellipse') diff --git a/node_modules/@svgdotjs/svg.js/src/elements/ForeignObject.js b/node_modules/@svgdotjs/svg.js/src/elements/ForeignObject.js new file mode 100644 index 0000000..a4148d5 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/elements/ForeignObject.js @@ -0,0 +1,19 @@ +import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js' +import { registerMethods } from '../utils/methods.js' +import Element from './Element.js' + +export default class ForeignObject extends Element { + constructor(node, attrs = node) { + super(nodeOrNew('foreignObject', node), attrs) + } +} + +registerMethods({ + Container: { + foreignObject: wrapWithAttrCheck(function (width, height) { + return this.put(new ForeignObject()).size(width, height) + }) + } +}) + +register(ForeignObject, 'ForeignObject') diff --git a/node_modules/@svgdotjs/svg.js/src/elements/Fragment.js b/node_modules/@svgdotjs/svg.js/src/elements/Fragment.js new file mode 100644 index 0000000..ece3046 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/elements/Fragment.js @@ -0,0 +1,34 @@ +import Dom from './Dom.js' +import { globals } from '../utils/window.js' +import { register, create } from '../utils/adopter.js' + +class Fragment extends Dom { + constructor(node = globals.document.createDocumentFragment()) { + super(node) + } + + // Import / Export raw xml + xml(xmlOrFn, outerXML, ns) { + if (typeof xmlOrFn === 'boolean') { + ns = outerXML + outerXML = xmlOrFn + xmlOrFn = null + } + + // because this is a fragment we have to put all elements into a wrapper first + // before we can get the innerXML from it + if (xmlOrFn == null || typeof xmlOrFn === 'function') { + const wrapper = new Dom(create('wrapper', ns)) + wrapper.add(this.node.cloneNode(true)) + + return wrapper.xml(false, ns) + } + + // Act as setter if we got a string + return super.xml(xmlOrFn, false, ns) + } +} + +register(Fragment, 'Fragment') + +export default Fragment diff --git a/node_modules/@svgdotjs/svg.js/src/elements/G.js b/node_modules/@svgdotjs/svg.js/src/elements/G.js new file mode 100644 index 0000000..4d3b03c --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/elements/G.js @@ -0,0 +1,28 @@ +import { + nodeOrNew, + register, + wrapWithAttrCheck, + extend +} from '../utils/adopter.js' +import { registerMethods } from '../utils/methods.js' +import Container from './Container.js' +import * as containerGeometry from '../modules/core/containerGeometry.js' + +export default class G extends Container { + constructor(node, attrs = node) { + super(nodeOrNew('g', node), attrs) + } +} + +extend(G, containerGeometry) + +registerMethods({ + Container: { + // Create a group element + group: wrapWithAttrCheck(function () { + return this.put(new G()) + }) + } +}) + +register(G, 'G') diff --git a/node_modules/@svgdotjs/svg.js/src/elements/Gradient.js b/node_modules/@svgdotjs/svg.js/src/elements/Gradient.js new file mode 100644 index 0000000..1631c14 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/elements/Gradient.js @@ -0,0 +1,76 @@ +import { + extend, + nodeOrNew, + register, + wrapWithAttrCheck +} from '../utils/adopter.js' +import { registerMethods } from '../utils/methods.js' +import Box from '../types/Box.js' +import Container from './Container.js' +import baseFind from '../modules/core/selector.js' +import * as gradiented from '../modules/core/gradiented.js' + +export default class Gradient extends Container { + constructor(type, attrs) { + super( + nodeOrNew(type + 'Gradient', typeof type === 'string' ? null : type), + attrs + ) + } + + // custom attr to handle transform + attr(a, b, c) { + if (a === 'transform') a = 'gradientTransform' + return super.attr(a, b, c) + } + + bbox() { + return new Box() + } + + targets() { + return baseFind('svg [fill*=' + this.id() + ']') + } + + // Alias string conversion to fill + toString() { + return this.url() + } + + // Update gradient + update(block) { + // remove all stops + this.clear() + + // invoke passed block + if (typeof block === 'function') { + block.call(this, this) + } + + return this + } + + // Return the fill id + url() { + return 'url(#' + this.id() + ')' + } +} + +extend(Gradient, gradiented) + +registerMethods({ + Container: { + // Create gradient element in defs + gradient(...args) { + return this.defs().gradient(...args) + } + }, + // define gradient + Defs: { + gradient: wrapWithAttrCheck(function (type, block) { + return this.put(new Gradient(type)).update(block) + }) + } +}) + +register(Gradient, 'Gradient') diff --git a/node_modules/@svgdotjs/svg.js/src/elements/Image.js b/node_modules/@svgdotjs/svg.js/src/elements/Image.js new file mode 100644 index 0000000..080da16 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/elements/Image.js @@ -0,0 +1,85 @@ +import { isImage } from '../modules/core/regex.js' +import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js' +import { off, on } from '../modules/core/event.js' +import { registerAttrHook } from '../modules/core/attr.js' +import { registerMethods } from '../utils/methods.js' +import { xlink } from '../modules/core/namespaces.js' +import Pattern from './Pattern.js' +import Shape from './Shape.js' +import { globals } from '../utils/window.js' + +export default class Image extends Shape { + constructor(node, attrs = node) { + super(nodeOrNew('image', node), attrs) + } + + // (re)load image + load(url, callback) { + if (!url) return this + + const img = new globals.window.Image() + + on( + img, + 'load', + function (e) { + const p = this.parent(Pattern) + + // ensure image size + if (this.width() === 0 && this.height() === 0) { + this.size(img.width, img.height) + } + + if (p instanceof Pattern) { + // ensure pattern size if not set + if (p.width() === 0 && p.height() === 0) { + p.size(this.width(), this.height()) + } + } + + if (typeof callback === 'function') { + callback.call(this, e) + } + }, + this + ) + + on(img, 'load error', function () { + // dont forget to unbind memory leaking events + off(img) + }) + + return this.attr('href', (img.src = url), xlink) + } +} + +registerAttrHook(function (attr, val, _this) { + // convert image fill and stroke to patterns + if (attr === 'fill' || attr === 'stroke') { + if (isImage.test(val)) { + val = _this.root().defs().image(val) + } + } + + if (val instanceof Image) { + val = _this + .root() + .defs() + .pattern(0, 0, (pattern) => { + pattern.add(val) + }) + } + + return val +}) + +registerMethods({ + Container: { + // create image element, load image and set its size + image: wrapWithAttrCheck(function (source, callback) { + return this.put(new Image()).size(0, 0).load(source, callback) + }) + } +}) + +register(Image, 'Image') diff --git a/node_modules/@svgdotjs/svg.js/src/elements/Line.js b/node_modules/@svgdotjs/svg.js/src/elements/Line.js new file mode 100644 index 0000000..0dab35d --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/elements/Line.js @@ -0,0 +1,68 @@ +import { + extend, + nodeOrNew, + register, + wrapWithAttrCheck +} from '../utils/adopter.js' +import { proportionalSize } from '../utils/utils.js' +import { registerMethods } from '../utils/methods.js' +import PointArray from '../types/PointArray.js' +import Shape from './Shape.js' +import * as pointed from '../modules/core/pointed.js' + +export default class Line extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('line', node), attrs) + } + + // Get array + array() { + return new PointArray([ + [this.attr('x1'), this.attr('y1')], + [this.attr('x2'), this.attr('y2')] + ]) + } + + // Move by left top corner + move(x, y) { + return this.attr(this.array().move(x, y).toLine()) + } + + // Overwrite native plot() method + plot(x1, y1, x2, y2) { + if (x1 == null) { + return this.array() + } else if (typeof y1 !== 'undefined') { + x1 = { x1, y1, x2, y2 } + } else { + x1 = new PointArray(x1).toLine() + } + + return this.attr(x1) + } + + // Set element size to given width and height + size(width, height) { + const p = proportionalSize(this, width, height) + return this.attr(this.array().size(p.width, p.height).toLine()) + } +} + +extend(Line, pointed) + +registerMethods({ + Container: { + // Create a line element + line: wrapWithAttrCheck(function (...args) { + // make sure plot is called as a setter + // x1 is not necessarily a number, it can also be an array, a string and a PointArray + return Line.prototype.plot.apply( + this.put(new Line()), + args[0] != null ? args : [0, 0, 0, 0] + ) + }) + } +}) + +register(Line, 'Line') diff --git a/node_modules/@svgdotjs/svg.js/src/elements/Marker.js b/node_modules/@svgdotjs/svg.js/src/elements/Marker.js new file mode 100644 index 0000000..5ddf802 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/elements/Marker.js @@ -0,0 +1,88 @@ +import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js' +import { registerMethods } from '../utils/methods.js' +import Container from './Container.js' + +export default class Marker extends Container { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('marker', node), attrs) + } + + // Set height of element + height(height) { + return this.attr('markerHeight', height) + } + + orient(orient) { + return this.attr('orient', orient) + } + + // Set marker refX and refY + ref(x, y) { + return this.attr('refX', x).attr('refY', y) + } + + // Return the fill id + toString() { + return 'url(#' + this.id() + ')' + } + + // Update marker + update(block) { + // remove all content + this.clear() + + // invoke passed block + if (typeof block === 'function') { + block.call(this, this) + } + + return this + } + + // Set width of element + width(width) { + return this.attr('markerWidth', width) + } +} + +registerMethods({ + Container: { + marker(...args) { + // Create marker element in defs + return this.defs().marker(...args) + } + }, + Defs: { + // Create marker + marker: wrapWithAttrCheck(function (width, height, block) { + // Set default viewbox to match the width and height, set ref to cx and cy and set orient to auto + return this.put(new Marker()) + .size(width, height) + .ref(width / 2, height / 2) + .viewbox(0, 0, width, height) + .attr('orient', 'auto') + .update(block) + }) + }, + marker: { + // Create and attach markers + marker(marker, width, height, block) { + let attr = ['marker'] + + // Build attribute name + if (marker !== 'all') attr.push(marker) + attr = attr.join('-') + + // Set marker attribute + marker = + arguments[1] instanceof Marker + ? arguments[1] + : this.defs().marker(width, height, block) + + return this.attr(attr, marker) + } + } +}) + +register(Marker, 'Marker') diff --git a/node_modules/@svgdotjs/svg.js/src/elements/Mask.js b/node_modules/@svgdotjs/svg.js/src/elements/Mask.js new file mode 100644 index 0000000..b8a2c99 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/elements/Mask.js @@ -0,0 +1,56 @@ +import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js' +import { registerMethods } from '../utils/methods.js' +import Container from './Container.js' +import baseFind from '../modules/core/selector.js' + +export default class Mask extends Container { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('mask', node), attrs) + } + + // Unmask all masked elements and remove itself + remove() { + // unmask all targets + this.targets().forEach(function (el) { + el.unmask() + }) + + // remove mask from parent + return super.remove() + } + + targets() { + return baseFind('svg [mask*=' + this.id() + ']') + } +} + +registerMethods({ + Container: { + mask: wrapWithAttrCheck(function () { + return this.defs().put(new Mask()) + }) + }, + Element: { + // Distribute mask to svg element + masker() { + return this.reference('mask') + }, + + maskWith(element) { + // use given mask or create a new one + const masker = + element instanceof Mask ? element : this.parent().mask().add(element) + + // apply mask + return this.attr('mask', 'url(#' + masker.id() + ')') + }, + + // Unmask element + unmask() { + return this.attr('mask', null) + } + } +}) + +register(Mask, 'Mask') diff --git a/node_modules/@svgdotjs/svg.js/src/elements/Path.js b/node_modules/@svgdotjs/svg.js/src/elements/Path.js new file mode 100644 index 0000000..ec9a19f --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/elements/Path.js @@ -0,0 +1,84 @@ +import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js' +import { proportionalSize } from '../utils/utils.js' +import { registerMethods } from '../utils/methods.js' +import PathArray from '../types/PathArray.js' +import Shape from './Shape.js' + +export default class Path extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('path', node), attrs) + } + + // Get array + array() { + return this._array || (this._array = new PathArray(this.attr('d'))) + } + + // Clear array cache + clear() { + delete this._array + return this + } + + // Set height of element + height(height) { + return height == null + ? this.bbox().height + : this.size(this.bbox().width, height) + } + + // Move by left top corner + move(x, y) { + return this.attr('d', this.array().move(x, y)) + } + + // Plot new path + plot(d) { + return d == null + ? this.array() + : this.clear().attr( + 'd', + typeof d === 'string' ? d : (this._array = new PathArray(d)) + ) + } + + // Set element size to given width and height + size(width, height) { + const p = proportionalSize(this, width, height) + return this.attr('d', this.array().size(p.width, p.height)) + } + + // Set width of element + width(width) { + return width == null + ? this.bbox().width + : this.size(width, this.bbox().height) + } + + // Move by left top corner over x-axis + x(x) { + return x == null ? this.bbox().x : this.move(x, this.bbox().y) + } + + // Move by left top corner over y-axis + y(y) { + return y == null ? this.bbox().y : this.move(this.bbox().x, y) + } +} + +// Define morphable array +Path.prototype.MorphArray = PathArray + +// Add parent method +registerMethods({ + Container: { + // Create a wrapped path element + path: wrapWithAttrCheck(function (d) { + // make sure plot is called as a setter + return this.put(new Path()).plot(d || new PathArray()) + }) + } +}) + +register(Path, 'Path') diff --git a/node_modules/@svgdotjs/svg.js/src/elements/Pattern.js b/node_modules/@svgdotjs/svg.js/src/elements/Pattern.js new file mode 100644 index 0000000..b42a83a --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/elements/Pattern.js @@ -0,0 +1,71 @@ +import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js' +import { registerMethods } from '../utils/methods.js' +import Box from '../types/Box.js' +import Container from './Container.js' +import baseFind from '../modules/core/selector.js' + +export default class Pattern extends Container { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('pattern', node), attrs) + } + + // custom attr to handle transform + attr(a, b, c) { + if (a === 'transform') a = 'patternTransform' + return super.attr(a, b, c) + } + + bbox() { + return new Box() + } + + targets() { + return baseFind('svg [fill*=' + this.id() + ']') + } + + // Alias string conversion to fill + toString() { + return this.url() + } + + // Update pattern by rebuilding + update(block) { + // remove content + this.clear() + + // invoke passed block + if (typeof block === 'function') { + block.call(this, this) + } + + return this + } + + // Return the fill id + url() { + return 'url(#' + this.id() + ')' + } +} + +registerMethods({ + Container: { + // Create pattern element in defs + pattern(...args) { + return this.defs().pattern(...args) + } + }, + Defs: { + pattern: wrapWithAttrCheck(function (width, height, block) { + return this.put(new Pattern()).update(block).attr({ + x: 0, + y: 0, + width: width, + height: height, + patternUnits: 'userSpaceOnUse' + }) + }) + } +}) + +register(Pattern, 'Pattern') diff --git a/node_modules/@svgdotjs/svg.js/src/elements/Polygon.js b/node_modules/@svgdotjs/svg.js/src/elements/Polygon.js new file mode 100644 index 0000000..d64dcb3 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/elements/Polygon.js @@ -0,0 +1,32 @@ +import { + extend, + nodeOrNew, + register, + wrapWithAttrCheck +} from '../utils/adopter.js' +import { registerMethods } from '../utils/methods.js' +import PointArray from '../types/PointArray.js' +import Shape from './Shape.js' +import * as pointed from '../modules/core/pointed.js' +import * as poly from '../modules/core/poly.js' + +export default class Polygon extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('polygon', node), attrs) + } +} + +registerMethods({ + Container: { + // Create a wrapped polygon element + polygon: wrapWithAttrCheck(function (p) { + // make sure plot is called as a setter + return this.put(new Polygon()).plot(p || new PointArray()) + }) + } +}) + +extend(Polygon, pointed) +extend(Polygon, poly) +register(Polygon, 'Polygon') diff --git a/node_modules/@svgdotjs/svg.js/src/elements/Polyline.js b/node_modules/@svgdotjs/svg.js/src/elements/Polyline.js new file mode 100644 index 0000000..2f063f2 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/elements/Polyline.js @@ -0,0 +1,32 @@ +import { + extend, + nodeOrNew, + register, + wrapWithAttrCheck +} from '../utils/adopter.js' +import { registerMethods } from '../utils/methods.js' +import PointArray from '../types/PointArray.js' +import Shape from './Shape.js' +import * as pointed from '../modules/core/pointed.js' +import * as poly from '../modules/core/poly.js' + +export default class Polyline extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('polyline', node), attrs) + } +} + +registerMethods({ + Container: { + // Create a wrapped polygon element + polyline: wrapWithAttrCheck(function (p) { + // make sure plot is called as a setter + return this.put(new Polyline()).plot(p || new PointArray()) + }) + } +}) + +extend(Polyline, pointed) +extend(Polyline, poly) +register(Polyline, 'Polyline') diff --git a/node_modules/@svgdotjs/svg.js/src/elements/Rect.js b/node_modules/@svgdotjs/svg.js/src/elements/Rect.js new file mode 100644 index 0000000..749cf6d --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/elements/Rect.js @@ -0,0 +1,29 @@ +import { + extend, + nodeOrNew, + register, + wrapWithAttrCheck +} from '../utils/adopter.js' +import { registerMethods } from '../utils/methods.js' +import { rx, ry } from '../modules/core/circled.js' +import Shape from './Shape.js' + +export default class Rect extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('rect', node), attrs) + } +} + +extend(Rect, { rx, ry }) + +registerMethods({ + Container: { + // Create a rect element + rect: wrapWithAttrCheck(function (width, height) { + return this.put(new Rect()).size(width, height) + }) + } +}) + +register(Rect, 'Rect') diff --git a/node_modules/@svgdotjs/svg.js/src/elements/Shape.js b/node_modules/@svgdotjs/svg.js/src/elements/Shape.js new file mode 100644 index 0000000..25ab6cc --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/elements/Shape.js @@ -0,0 +1,6 @@ +import { register } from '../utils/adopter.js' +import Element from './Element.js' + +export default class Shape extends Element {} + +register(Shape, 'Shape') diff --git a/node_modules/@svgdotjs/svg.js/src/elements/Stop.js b/node_modules/@svgdotjs/svg.js/src/elements/Stop.js new file mode 100644 index 0000000..193256e --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/elements/Stop.js @@ -0,0 +1,39 @@ +import { nodeOrNew, register } from '../utils/adopter.js' +import Element from './Element.js' +import SVGNumber from '../types/SVGNumber.js' +import { registerMethods } from '../utils/methods.js' + +export default class Stop extends Element { + constructor(node, attrs = node) { + super(nodeOrNew('stop', node), attrs) + } + + // add color stops + update(o) { + if (typeof o === 'number' || o instanceof SVGNumber) { + o = { + offset: arguments[0], + color: arguments[1], + opacity: arguments[2] + } + } + + // set attributes + if (o.opacity != null) this.attr('stop-opacity', o.opacity) + if (o.color != null) this.attr('stop-color', o.color) + if (o.offset != null) this.attr('offset', new SVGNumber(o.offset)) + + return this + } +} + +registerMethods({ + Gradient: { + // Add a color stop + stop: function (offset, color, opacity) { + return this.put(new Stop()).update(offset, color, opacity) + } + } +}) + +register(Stop, 'Stop') diff --git a/node_modules/@svgdotjs/svg.js/src/elements/Style.js b/node_modules/@svgdotjs/svg.js/src/elements/Style.js new file mode 100644 index 0000000..fc1a27e --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/elements/Style.js @@ -0,0 +1,53 @@ +import { nodeOrNew, register } from '../utils/adopter.js' +import { registerMethods } from '../utils/methods.js' +import { unCamelCase } from '../utils/utils.js' +import Element from './Element.js' + +function cssRule(selector, rule) { + if (!selector) return '' + if (!rule) return selector + + let ret = selector + '{' + + for (const i in rule) { + ret += unCamelCase(i) + ':' + rule[i] + ';' + } + + ret += '}' + + return ret +} + +export default class Style extends Element { + constructor(node, attrs = node) { + super(nodeOrNew('style', node), attrs) + } + + addText(w = '') { + this.node.textContent += w + return this + } + + font(name, src, params = {}) { + return this.rule('@font-face', { + fontFamily: name, + src: src, + ...params + }) + } + + rule(selector, obj) { + return this.addText(cssRule(selector, obj)) + } +} + +registerMethods('Dom', { + style(selector, obj) { + return this.put(new Style()).rule(selector, obj) + }, + fontface(name, src, params) { + return this.put(new Style()).font(name, src, params) + } +}) + +register(Style, 'Style') diff --git a/node_modules/@svgdotjs/svg.js/src/elements/Svg.js b/node_modules/@svgdotjs/svg.js/src/elements/Svg.js new file mode 100644 index 0000000..40d50c9 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/elements/Svg.js @@ -0,0 +1,67 @@ +import { + adopt, + nodeOrNew, + register, + wrapWithAttrCheck +} from '../utils/adopter.js' +import { svg, xlink, xmlns } from '../modules/core/namespaces.js' +import { registerMethods } from '../utils/methods.js' +import Container from './Container.js' +import Defs from './Defs.js' +import { globals } from '../utils/window.js' + +export default class Svg extends Container { + constructor(node, attrs = node) { + super(nodeOrNew('svg', node), attrs) + this.namespace() + } + + // Creates and returns defs element + defs() { + if (!this.isRoot()) return this.root().defs() + + return adopt(this.node.querySelector('defs')) || this.put(new Defs()) + } + + isRoot() { + return ( + !this.node.parentNode || + (!(this.node.parentNode instanceof globals.window.SVGElement) && + this.node.parentNode.nodeName !== '#document-fragment') + ) + } + + // Add namespaces + namespace() { + if (!this.isRoot()) return this.root().namespace() + return this.attr({ xmlns: svg, version: '1.1' }).attr( + 'xmlns:xlink', + xlink, + xmlns + ) + } + + removeNamespace() { + return this.attr({ xmlns: null, version: null }) + .attr('xmlns:xlink', null, xmlns) + .attr('xmlns:svgjs', null, xmlns) + } + + // Check if this is a root svg + // If not, call root() from this element + root() { + if (this.isRoot()) return this + return super.root() + } +} + +registerMethods({ + Container: { + // Create nested svg document + nested: wrapWithAttrCheck(function () { + return this.put(new Svg()) + }) + } +}) + +register(Svg, 'Svg', true) diff --git a/node_modules/@svgdotjs/svg.js/src/elements/Symbol.js b/node_modules/@svgdotjs/svg.js/src/elements/Symbol.js new file mode 100644 index 0000000..28ad206 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/elements/Symbol.js @@ -0,0 +1,20 @@ +import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js' +import { registerMethods } from '../utils/methods.js' +import Container from './Container.js' + +export default class Symbol extends Container { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('symbol', node), attrs) + } +} + +registerMethods({ + Container: { + symbol: wrapWithAttrCheck(function () { + return this.put(new Symbol()) + }) + } +}) + +register(Symbol, 'Symbol') diff --git a/node_modules/@svgdotjs/svg.js/src/elements/Text.js b/node_modules/@svgdotjs/svg.js/src/elements/Text.js new file mode 100644 index 0000000..c703e3b --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/elements/Text.js @@ -0,0 +1,158 @@ +import { + adopt, + extend, + nodeOrNew, + register, + wrapWithAttrCheck +} from '../utils/adopter.js' +import { registerMethods } from '../utils/methods.js' +import SVGNumber from '../types/SVGNumber.js' +import Shape from './Shape.js' +import { globals } from '../utils/window.js' +import * as textable from '../modules/core/textable.js' +import { isDescriptive, writeDataToDom } from '../utils/utils.js' + +export default class Text extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('text', node), attrs) + + this.dom.leading = this.dom.leading ?? new SVGNumber(1.3) // store leading value for rebuilding + this._rebuild = true // enable automatic updating of dy values + this._build = false // disable build mode for adding multiple lines + } + + // Set / get leading + leading(value) { + // act as getter + if (value == null) { + return this.dom.leading + } + + // act as setter + this.dom.leading = new SVGNumber(value) + + return this.rebuild() + } + + // Rebuild appearance type + rebuild(rebuild) { + // store new rebuild flag if given + if (typeof rebuild === 'boolean') { + this._rebuild = rebuild + } + + // define position of all lines + if (this._rebuild) { + const self = this + let blankLineOffset = 0 + const leading = this.dom.leading + + this.each(function (i) { + if (isDescriptive(this.node)) return + + const fontSize = globals.window + .getComputedStyle(this.node) + .getPropertyValue('font-size') + + const dy = leading * new SVGNumber(fontSize) + + if (this.dom.newLined) { + this.attr('x', self.attr('x')) + + if (this.text() === '\n') { + blankLineOffset += dy + } else { + this.attr('dy', i ? dy + blankLineOffset : 0) + blankLineOffset = 0 + } + } + }) + + this.fire('rebuild') + } + + return this + } + + // overwrite method from parent to set data properly + setData(o) { + this.dom = o + this.dom.leading = new SVGNumber(o.leading || 1.3) + return this + } + + writeDataToDom() { + writeDataToDom(this, this.dom, { leading: 1.3 }) + return this + } + + // Set the text content + text(text) { + // act as getter + if (text === undefined) { + const children = this.node.childNodes + let firstLine = 0 + text = '' + + for (let i = 0, len = children.length; i < len; ++i) { + // skip textPaths - they are no lines + if (children[i].nodeName === 'textPath' || isDescriptive(children[i])) { + if (i === 0) firstLine = i + 1 + continue + } + + // add newline if its not the first child and newLined is set to true + if ( + i !== firstLine && + children[i].nodeType !== 3 && + adopt(children[i]).dom.newLined === true + ) { + text += '\n' + } + + // add content of this node + text += children[i].textContent + } + + return text + } + + // remove existing content + this.clear().build(true) + + if (typeof text === 'function') { + // call block + text.call(this, this) + } else { + // store text and make sure text is not blank + text = (text + '').split('\n') + + // build new lines + for (let j = 0, jl = text.length; j < jl; j++) { + this.newLine(text[j]) + } + } + + // disable build mode and rebuild lines + return this.build(false).rebuild() + } +} + +extend(Text, textable) + +registerMethods({ + Container: { + // Create text element + text: wrapWithAttrCheck(function (text = '') { + return this.put(new Text()).text(text) + }), + + // Create plain text element + plain: wrapWithAttrCheck(function (text = '') { + return this.put(new Text()).plain(text) + }) + } +}) + +register(Text, 'Text') diff --git a/node_modules/@svgdotjs/svg.js/src/elements/TextPath.js b/node_modules/@svgdotjs/svg.js/src/elements/TextPath.js new file mode 100644 index 0000000..89c6c42 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/elements/TextPath.js @@ -0,0 +1,106 @@ +import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js' +import { registerMethods } from '../utils/methods.js' +import { xlink } from '../modules/core/namespaces.js' +import Path from './Path.js' +import PathArray from '../types/PathArray.js' +import Text from './Text.js' +import baseFind from '../modules/core/selector.js' + +export default class TextPath extends Text { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('textPath', node), attrs) + } + + // return the array of the path track element + array() { + const track = this.track() + + return track ? track.array() : null + } + + // Plot path if any + plot(d) { + const track = this.track() + let pathArray = null + + if (track) { + pathArray = track.plot(d) + } + + return d == null ? pathArray : this + } + + // Get the path element + track() { + return this.reference('href') + } +} + +registerMethods({ + Container: { + textPath: wrapWithAttrCheck(function (text, path) { + // Convert text to instance if needed + if (!(text instanceof Text)) { + text = this.text(text) + } + + return text.path(path) + }) + }, + Text: { + // Create path for text to run on + path: wrapWithAttrCheck(function (track, importNodes = true) { + const textPath = new TextPath() + + // if track is a path, reuse it + if (!(track instanceof Path)) { + // create path element + track = this.defs().path(track) + } + + // link textPath to path and add content + textPath.attr('href', '#' + track, xlink) + + // Transplant all nodes from text to textPath + let node + if (importNodes) { + while ((node = this.node.firstChild)) { + textPath.node.appendChild(node) + } + } + + // add textPath element as child node and return textPath + return this.put(textPath) + }), + + // Get the textPath children + textPath() { + return this.findOne('textPath') + } + }, + Path: { + // creates a textPath from this path + text: wrapWithAttrCheck(function (text) { + // Convert text to instance if needed + if (!(text instanceof Text)) { + text = new Text().addTo(this.parent()).text(text) + } + + // Create textPath from text and path and return + return text.path(this) + }), + + targets() { + return baseFind('svg textPath').filter((node) => { + return (node.attr('href') || '').includes(this.id()) + }) + + // Does not work in IE11. Use when IE support is dropped + // return baseFind('svg textPath[*|href*=' + this.id() + ']') + } + } +}) + +TextPath.prototype.MorphArray = PathArray +register(TextPath, 'TextPath') diff --git a/node_modules/@svgdotjs/svg.js/src/elements/Tspan.js b/node_modules/@svgdotjs/svg.js/src/elements/Tspan.js new file mode 100644 index 0000000..12b49f8 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/elements/Tspan.js @@ -0,0 +1,95 @@ +import { + extend, + nodeOrNew, + register, + wrapWithAttrCheck +} from '../utils/adopter.js' +import { globals } from '../utils/window.js' +import { registerMethods } from '../utils/methods.js' +import SVGNumber from '../types/SVGNumber.js' +import Shape from './Shape.js' +import Text from './Text.js' +import * as textable from '../modules/core/textable.js' + +export default class Tspan extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('tspan', node), attrs) + this._build = false // disable build mode for adding multiple lines + } + + // Shortcut dx + dx(dx) { + return this.attr('dx', dx) + } + + // Shortcut dy + dy(dy) { + return this.attr('dy', dy) + } + + // Create new line + newLine() { + // mark new line + this.dom.newLined = true + + // fetch parent + const text = this.parent() + + // early return in case we are not in a text element + if (!(text instanceof Text)) { + return this + } + + const i = text.index(this) + + const fontSize = globals.window + .getComputedStyle(this.node) + .getPropertyValue('font-size') + const dy = text.dom.leading * new SVGNumber(fontSize) + + // apply new position + return this.dy(i ? dy : 0).attr('x', text.x()) + } + + // Set text content + text(text) { + if (text == null) + return this.node.textContent + (this.dom.newLined ? '\n' : '') + + if (typeof text === 'function') { + this.clear().build(true) + text.call(this, this) + this.build(false) + } else { + this.plain(text) + } + + return this + } +} + +extend(Tspan, textable) + +registerMethods({ + Tspan: { + tspan: wrapWithAttrCheck(function (text = '') { + const tspan = new Tspan() + + // clear if build mode is disabled + if (!this._build) { + this.clear() + } + + // add new tspan + return this.put(tspan).text(text) + }) + }, + Text: { + newLine: function (text = '') { + return this.tspan(text).newLine() + } + } +}) + +register(Tspan, 'Tspan') diff --git a/node_modules/@svgdotjs/svg.js/src/elements/Use.js b/node_modules/@svgdotjs/svg.js/src/elements/Use.js new file mode 100644 index 0000000..e92dd48 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/elements/Use.js @@ -0,0 +1,27 @@ +import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js' +import { registerMethods } from '../utils/methods.js' +import { xlink } from '../modules/core/namespaces.js' +import Shape from './Shape.js' + +export default class Use extends Shape { + constructor(node, attrs = node) { + super(nodeOrNew('use', node), attrs) + } + + // Use element as a reference + use(element, file) { + // Set lined element + return this.attr('href', (file || '') + '#' + element, xlink) + } +} + +registerMethods({ + Container: { + // Create a use element + use: wrapWithAttrCheck(function (element, file) { + return this.put(new Use()).use(element, file) + }) + } +}) + +register(Use, 'Use') diff --git a/node_modules/@svgdotjs/svg.js/src/main.js b/node_modules/@svgdotjs/svg.js/src/main.js new file mode 100644 index 0000000..5b652c4 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/main.js @@ -0,0 +1,170 @@ +/* Optional Modules */ +import './modules/optional/arrange.js' +import './modules/optional/class.js' +import './modules/optional/css.js' +import './modules/optional/data.js' +import './modules/optional/memory.js' +import './modules/optional/sugar.js' +import './modules/optional/transform.js' + +import { extend, makeInstance } from './utils/adopter.js' +import { getMethodNames, getMethodsFor } from './utils/methods.js' +import Box from './types/Box.js' +import Color from './types/Color.js' +import Container from './elements/Container.js' +import Defs from './elements/Defs.js' +import Dom from './elements/Dom.js' +import Element from './elements/Element.js' +import Ellipse from './elements/Ellipse.js' +import EventTarget from './types/EventTarget.js' +import Fragment from './elements/Fragment.js' +import Gradient from './elements/Gradient.js' +import Image from './elements/Image.js' +import Line from './elements/Line.js' +import List from './types/List.js' +import Marker from './elements/Marker.js' +import Matrix from './types/Matrix.js' +import Morphable, { + NonMorphable, + ObjectBag, + TransformBag, + makeMorphable, + registerMorphableType +} from './animation/Morphable.js' +import Path from './elements/Path.js' +import PathArray from './types/PathArray.js' +import Pattern from './elements/Pattern.js' +import PointArray from './types/PointArray.js' +import Point from './types/Point.js' +import Polygon from './elements/Polygon.js' +import Polyline from './elements/Polyline.js' +import Rect from './elements/Rect.js' +import Runner from './animation/Runner.js' +import SVGArray from './types/SVGArray.js' +import SVGNumber from './types/SVGNumber.js' +import Shape from './elements/Shape.js' +import Svg from './elements/Svg.js' +import Symbol from './elements/Symbol.js' +import Text from './elements/Text.js' +import Tspan from './elements/Tspan.js' +import * as defaults from './modules/core/defaults.js' +import * as utils from './utils/utils.js' +import * as namespaces from './modules/core/namespaces.js' +import * as regex from './modules/core/regex.js' + +export { + Morphable, + registerMorphableType, + makeMorphable, + TransformBag, + ObjectBag, + NonMorphable +} + +export { defaults, utils, namespaces, regex } +export const SVG = makeInstance +export { default as parser } from './modules/core/parser.js' +export { default as find } from './modules/core/selector.js' +export * from './modules/core/event.js' +export * from './utils/adopter.js' +export { + getWindow, + registerWindow, + restoreWindow, + saveWindow, + withWindow +} from './utils/window.js' + +/* Animation Modules */ +export { default as Animator } from './animation/Animator.js' +export { + Controller, + Ease, + PID, + Spring, + easing +} from './animation/Controller.js' +export { default as Queue } from './animation/Queue.js' +export { default as Runner } from './animation/Runner.js' +export { default as Timeline } from './animation/Timeline.js' + +/* Types */ +export { default as Array } from './types/SVGArray.js' +export { default as Box } from './types/Box.js' +export { default as Color } from './types/Color.js' +export { default as EventTarget } from './types/EventTarget.js' +export { default as Matrix } from './types/Matrix.js' +export { default as Number } from './types/SVGNumber.js' +export { default as PathArray } from './types/PathArray.js' +export { default as Point } from './types/Point.js' +export { default as PointArray } from './types/PointArray.js' +export { default as List } from './types/List.js' + +/* Elements */ +export { default as Circle } from './elements/Circle.js' +export { default as ClipPath } from './elements/ClipPath.js' +export { default as Container } from './elements/Container.js' +export { default as Defs } from './elements/Defs.js' +export { default as Dom } from './elements/Dom.js' +export { default as Element } from './elements/Element.js' +export { default as Ellipse } from './elements/Ellipse.js' +export { default as ForeignObject } from './elements/ForeignObject.js' +export { default as Fragment } from './elements/Fragment.js' +export { default as Gradient } from './elements/Gradient.js' +export { default as G } from './elements/G.js' +export { default as A } from './elements/A.js' +export { default as Image } from './elements/Image.js' +export { default as Line } from './elements/Line.js' +export { default as Marker } from './elements/Marker.js' +export { default as Mask } from './elements/Mask.js' +export { default as Path } from './elements/Path.js' +export { default as Pattern } from './elements/Pattern.js' +export { default as Polygon } from './elements/Polygon.js' +export { default as Polyline } from './elements/Polyline.js' +export { default as Rect } from './elements/Rect.js' +export { default as Shape } from './elements/Shape.js' +export { default as Stop } from './elements/Stop.js' +export { default as Style } from './elements/Style.js' +export { default as Svg } from './elements/Svg.js' +export { default as Symbol } from './elements/Symbol.js' +export { default as Text } from './elements/Text.js' +export { default as TextPath } from './elements/TextPath.js' +export { default as Tspan } from './elements/Tspan.js' +export { default as Use } from './elements/Use.js' + +extend([Svg, Symbol, Image, Pattern, Marker], getMethodsFor('viewbox')) + +extend([Line, Polyline, Polygon, Path], getMethodsFor('marker')) + +extend(Text, getMethodsFor('Text')) +extend(Path, getMethodsFor('Path')) + +extend(Defs, getMethodsFor('Defs')) + +extend([Text, Tspan], getMethodsFor('Tspan')) + +extend([Rect, Ellipse, Gradient, Runner], getMethodsFor('radius')) + +extend(EventTarget, getMethodsFor('EventTarget')) +extend(Dom, getMethodsFor('Dom')) +extend(Element, getMethodsFor('Element')) +extend(Shape, getMethodsFor('Shape')) +extend([Container, Fragment], getMethodsFor('Container')) +extend(Gradient, getMethodsFor('Gradient')) + +extend(Runner, getMethodsFor('Runner')) + +List.extend(getMethodNames()) + +registerMorphableType([ + SVGNumber, + Color, + Box, + Matrix, + SVGArray, + PointArray, + PathArray, + Point +]) + +makeMorphable() diff --git a/node_modules/@svgdotjs/svg.js/src/modules/core/attr.js b/node_modules/@svgdotjs/svg.js/src/modules/core/attr.js new file mode 100644 index 0000000..8875c41 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/modules/core/attr.js @@ -0,0 +1,94 @@ +import { attrs as defaults } from './defaults.js' +import { isNumber } from './regex.js' +import Color from '../../types/Color.js' +import SVGArray from '../../types/SVGArray.js' +import SVGNumber from '../../types/SVGNumber.js' + +const colorAttributes = new Set([ + 'fill', + 'stroke', + 'color', + 'bgcolor', + 'stop-color', + 'flood-color', + 'lighting-color' +]) + +const hooks = [] +export function registerAttrHook(fn) { + hooks.push(fn) +} + +// Set svg element attribute +export default function attr(attr, val, ns) { + // act as full getter + if (attr == null) { + // get an object of attributes + attr = {} + val = this.node.attributes + + for (const node of val) { + attr[node.nodeName] = isNumber.test(node.nodeValue) + ? parseFloat(node.nodeValue) + : node.nodeValue + } + + return attr + } else if (attr instanceof Array) { + // loop through array and get all values + return attr.reduce((last, curr) => { + last[curr] = this.attr(curr) + return last + }, {}) + } else if (typeof attr === 'object' && attr.constructor === Object) { + // apply every attribute individually if an object is passed + for (val in attr) this.attr(val, attr[val]) + } else if (val === null) { + // remove value + this.node.removeAttribute(attr) + } else if (val == null) { + // act as a getter if the first and only argument is not an object + val = this.node.getAttribute(attr) + return val == null + ? defaults[attr] + : isNumber.test(val) + ? parseFloat(val) + : val + } else { + // Loop through hooks and execute them to convert value + val = hooks.reduce((_val, hook) => { + return hook(attr, _val, this) + }, val) + + // ensure correct numeric values (also accepts NaN and Infinity) + if (typeof val === 'number') { + val = new SVGNumber(val) + } else if (colorAttributes.has(attr) && Color.isColor(val)) { + // ensure full hex color + val = new Color(val) + } else if (val.constructor === Array) { + // Check for plain arrays and parse array values + val = new SVGArray(val) + } + + // if the passed attribute is leading... + if (attr === 'leading') { + // ... call the leading method instead + if (this.leading) { + this.leading(val) + } + } else { + // set given attribute on node + typeof ns === 'string' + ? this.node.setAttributeNS(ns, attr, val.toString()) + : this.node.setAttribute(attr, val.toString()) + } + + // rebuild if required + if (this.rebuild && (attr === 'font-size' || attr === 'x')) { + this.rebuild() + } + } + + return this +} diff --git a/node_modules/@svgdotjs/svg.js/src/modules/core/circled.js b/node_modules/@svgdotjs/svg.js/src/modules/core/circled.js new file mode 100644 index 0000000..3c3a65f --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/modules/core/circled.js @@ -0,0 +1,43 @@ +import SVGNumber from '../../types/SVGNumber.js' + +// Radius x value +export function rx(rx) { + return this.attr('rx', rx) +} + +// Radius y value +export function ry(ry) { + return this.attr('ry', ry) +} + +// Move over x-axis +export function x(x) { + return x == null ? this.cx() - this.rx() : this.cx(x + this.rx()) +} + +// Move over y-axis +export function y(y) { + return y == null ? this.cy() - this.ry() : this.cy(y + this.ry()) +} + +// Move by center over x-axis +export function cx(x) { + return this.attr('cx', x) +} + +// Move by center over y-axis +export function cy(y) { + return this.attr('cy', y) +} + +// Set width of element +export function width(width) { + return width == null ? this.rx() * 2 : this.rx(new SVGNumber(width).divide(2)) +} + +// Set height of element +export function height(height) { + return height == null + ? this.ry() * 2 + : this.ry(new SVGNumber(height).divide(2)) +} diff --git a/node_modules/@svgdotjs/svg.js/src/modules/core/containerGeometry.js b/node_modules/@svgdotjs/svg.js/src/modules/core/containerGeometry.js new file mode 100644 index 0000000..574581c --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/modules/core/containerGeometry.js @@ -0,0 +1,88 @@ +import Matrix from '../../types/Matrix.js' +import Point from '../../types/Point.js' +import Box from '../../types/Box.js' +import { proportionalSize } from '../../utils/utils.js' +import { getWindow } from '../../utils/window.js' + +export function dmove(dx, dy) { + this.children().forEach((child) => { + let bbox + + // We have to wrap this for elements that dont have a bbox + // e.g. title and other descriptive elements + try { + // Get the childs bbox + // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1905039 + // Because bbox for nested svgs returns the contents bbox in the coordinate space of the svg itself (weird!), we cant use bbox for svgs + // Therefore we have to use getBoundingClientRect. But THAT is broken (as explained in the bug). + // Funnily enough the broken behavior would work for us but that breaks it in chrome + // So we have to replicate the broken behavior of FF by just reading the attributes of the svg itself + bbox = + child.node instanceof getWindow().SVGSVGElement + ? new Box(child.attr(['x', 'y', 'width', 'height'])) + : child.bbox() + } catch (e) { + return + } + + // Get childs matrix + const m = new Matrix(child) + // Translate childs matrix by amount and + // transform it back into parents space + const matrix = m.translate(dx, dy).transform(m.inverse()) + // Calculate new x and y from old box + const p = new Point(bbox.x, bbox.y).transform(matrix) + // Move element + child.move(p.x, p.y) + }) + + return this +} + +export function dx(dx) { + return this.dmove(dx, 0) +} + +export function dy(dy) { + return this.dmove(0, dy) +} + +export function height(height, box = this.bbox()) { + if (height == null) return box.height + return this.size(box.width, height, box) +} + +export function move(x = 0, y = 0, box = this.bbox()) { + const dx = x - box.x + const dy = y - box.y + + return this.dmove(dx, dy) +} + +export function size(width, height, box = this.bbox()) { + const p = proportionalSize(this, width, height, box) + const scaleX = p.width / box.width + const scaleY = p.height / box.height + + this.children().forEach((child) => { + const o = new Point(box).transform(new Matrix(child).inverse()) + child.scale(scaleX, scaleY, o.x, o.y) + }) + + return this +} + +export function width(width, box = this.bbox()) { + if (width == null) return box.width + return this.size(width, box.height, box) +} + +export function x(x, box = this.bbox()) { + if (x == null) return box.x + return this.move(x, box.y, box) +} + +export function y(y, box = this.bbox()) { + if (y == null) return box.y + return this.move(box.x, y, box) +} diff --git a/node_modules/@svgdotjs/svg.js/src/modules/core/defaults.js b/node_modules/@svgdotjs/svg.js/src/modules/core/defaults.js new file mode 100644 index 0000000..2c346a7 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/modules/core/defaults.js @@ -0,0 +1,44 @@ +export function noop() {} + +// Default animation values +export const timeline = { + duration: 400, + ease: '>', + delay: 0 +} + +// Default attribute values +export const attrs = { + // fill and stroke + 'fill-opacity': 1, + 'stroke-opacity': 1, + 'stroke-width': 0, + 'stroke-linejoin': 'miter', + 'stroke-linecap': 'butt', + fill: '#000000', + stroke: '#000000', + opacity: 1, + + // position + x: 0, + y: 0, + cx: 0, + cy: 0, + + // size + width: 0, + height: 0, + + // radius + r: 0, + rx: 0, + ry: 0, + + // gradient + offset: 0, + 'stop-opacity': 1, + 'stop-color': '#000000', + + // text + 'text-anchor': 'start' +} diff --git a/node_modules/@svgdotjs/svg.js/src/modules/core/event.js b/node_modules/@svgdotjs/svg.js/src/modules/core/event.js new file mode 100644 index 0000000..8e08716 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/modules/core/event.js @@ -0,0 +1,143 @@ +import { delimiter } from './regex.js' +import { makeInstance } from '../../utils/adopter.js' +import { globals } from '../../utils/window.js' + +let listenerId = 0 +export const windowEvents = {} + +export function getEvents(instance) { + let n = instance.getEventHolder() + + // We dont want to save events in global space + if (n === globals.window) n = windowEvents + if (!n.events) n.events = {} + return n.events +} + +export function getEventTarget(instance) { + return instance.getEventTarget() +} + +export function clearEvents(instance) { + let n = instance.getEventHolder() + if (n === globals.window) n = windowEvents + if (n.events) n.events = {} +} + +// Add event binder in the SVG namespace +export function on(node, events, listener, binding, options) { + const l = listener.bind(binding || node) + const instance = makeInstance(node) + const bag = getEvents(instance) + const n = getEventTarget(instance) + + // events can be an array of events or a string of events + events = Array.isArray(events) ? events : events.split(delimiter) + + // add id to listener + if (!listener._svgjsListenerId) { + listener._svgjsListenerId = ++listenerId + } + + events.forEach(function (event) { + const ev = event.split('.')[0] + const ns = event.split('.')[1] || '*' + + // ensure valid object + bag[ev] = bag[ev] || {} + bag[ev][ns] = bag[ev][ns] || {} + + // reference listener + bag[ev][ns][listener._svgjsListenerId] = l + + // add listener + n.addEventListener(ev, l, options || false) + }) +} + +// Add event unbinder in the SVG namespace +export function off(node, events, listener, options) { + const instance = makeInstance(node) + const bag = getEvents(instance) + const n = getEventTarget(instance) + + // listener can be a function or a number + if (typeof listener === 'function') { + listener = listener._svgjsListenerId + if (!listener) return + } + + // events can be an array of events or a string or undefined + events = Array.isArray(events) ? events : (events || '').split(delimiter) + + events.forEach(function (event) { + const ev = event && event.split('.')[0] + const ns = event && event.split('.')[1] + let namespace, l + + if (listener) { + // remove listener reference + if (bag[ev] && bag[ev][ns || '*']) { + // removeListener + n.removeEventListener( + ev, + bag[ev][ns || '*'][listener], + options || false + ) + + delete bag[ev][ns || '*'][listener] + } + } else if (ev && ns) { + // remove all listeners for a namespaced event + if (bag[ev] && bag[ev][ns]) { + for (l in bag[ev][ns]) { + off(n, [ev, ns].join('.'), l) + } + + delete bag[ev][ns] + } + } else if (ns) { + // remove all listeners for a specific namespace + for (event in bag) { + for (namespace in bag[event]) { + if (ns === namespace) { + off(n, [event, ns].join('.')) + } + } + } + } else if (ev) { + // remove all listeners for the event + if (bag[ev]) { + for (namespace in bag[ev]) { + off(n, [ev, namespace].join('.')) + } + + delete bag[ev] + } + } else { + // remove all listeners on a given node + for (event in bag) { + off(n, event) + } + + clearEvents(instance) + } + }) +} + +export function dispatch(node, event, data, options) { + const n = getEventTarget(node) + + // Dispatch event + if (event instanceof globals.window.Event) { + n.dispatchEvent(event) + } else { + event = new globals.window.CustomEvent(event, { + detail: data, + cancelable: true, + ...options + }) + n.dispatchEvent(event) + } + return event +} diff --git a/node_modules/@svgdotjs/svg.js/src/modules/core/gradiented.js b/node_modules/@svgdotjs/svg.js/src/modules/core/gradiented.js new file mode 100644 index 0000000..cd0a512 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/modules/core/gradiented.js @@ -0,0 +1,13 @@ +import SVGNumber from '../../types/SVGNumber.js' + +export function from(x, y) { + return (this._element || this).type === 'radialGradient' + ? this.attr({ fx: new SVGNumber(x), fy: new SVGNumber(y) }) + : this.attr({ x1: new SVGNumber(x), y1: new SVGNumber(y) }) +} + +export function to(x, y) { + return (this._element || this).type === 'radialGradient' + ? this.attr({ cx: new SVGNumber(x), cy: new SVGNumber(y) }) + : this.attr({ x2: new SVGNumber(x), y2: new SVGNumber(y) }) +} diff --git a/node_modules/@svgdotjs/svg.js/src/modules/core/namespaces.js b/node_modules/@svgdotjs/svg.js/src/modules/core/namespaces.js new file mode 100644 index 0000000..544efa2 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/modules/core/namespaces.js @@ -0,0 +1,5 @@ +// Default namespaces +export const svg = 'http://www.w3.org/2000/svg' +export const html = 'http://www.w3.org/1999/xhtml' +export const xmlns = 'http://www.w3.org/2000/xmlns/' +export const xlink = 'http://www.w3.org/1999/xlink' diff --git a/node_modules/@svgdotjs/svg.js/src/modules/core/parser.js b/node_modules/@svgdotjs/svg.js/src/modules/core/parser.js new file mode 100644 index 0000000..fc48c3b --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/modules/core/parser.js @@ -0,0 +1,30 @@ +import { globals } from '../../utils/window.js' +import { makeInstance } from '../../utils/adopter.js' + +export default function parser() { + // Reuse cached element if possible + if (!parser.nodes) { + const svg = makeInstance().size(2, 0) + svg.node.style.cssText = [ + 'opacity: 0', + 'position: absolute', + 'left: -100%', + 'top: -100%', + 'overflow: hidden' + ].join(';') + + svg.attr('focusable', 'false') + svg.attr('aria-hidden', 'true') + + const path = svg.path().node + + parser.nodes = { svg, path } + } + + if (!parser.nodes.svg.node.parentNode) { + const b = globals.document.body || globals.document.documentElement + parser.nodes.svg.addTo(b) + } + + return parser.nodes +} diff --git a/node_modules/@svgdotjs/svg.js/src/modules/core/pointed.js b/node_modules/@svgdotjs/svg.js/src/modules/core/pointed.js new file mode 100644 index 0000000..0d4ef7a --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/modules/core/pointed.js @@ -0,0 +1,25 @@ +import PointArray from '../../types/PointArray.js' + +export const MorphArray = PointArray + +// Move by left top corner over x-axis +export function x(x) { + return x == null ? this.bbox().x : this.move(x, this.bbox().y) +} + +// Move by left top corner over y-axis +export function y(y) { + return y == null ? this.bbox().y : this.move(this.bbox().x, y) +} + +// Set width of element +export function width(width) { + const b = this.bbox() + return width == null ? b.width : this.size(width, b.height) +} + +// Set height of element +export function height(height) { + const b = this.bbox() + return height == null ? b.height : this.size(b.width, height) +} diff --git a/node_modules/@svgdotjs/svg.js/src/modules/core/poly.js b/node_modules/@svgdotjs/svg.js/src/modules/core/poly.js new file mode 100644 index 0000000..0640735 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/modules/core/poly.js @@ -0,0 +1,34 @@ +import { proportionalSize } from '../../utils/utils.js' +import PointArray from '../../types/PointArray.js' + +// Get array +export function array() { + return this._array || (this._array = new PointArray(this.attr('points'))) +} + +// Clear array cache +export function clear() { + delete this._array + return this +} + +// Move by left top corner +export function move(x, y) { + return this.attr('points', this.array().move(x, y)) +} + +// Plot new path +export function plot(p) { + return p == null + ? this.array() + : this.clear().attr( + 'points', + typeof p === 'string' ? p : (this._array = new PointArray(p)) + ) +} + +// Set element size to given width and height +export function size(width, height) { + const p = proportionalSize(this, width, height) + return this.attr('points', this.array().size(p.width, p.height)) +} diff --git a/node_modules/@svgdotjs/svg.js/src/modules/core/regex.js b/node_modules/@svgdotjs/svg.js/src/modules/core/regex.js new file mode 100644 index 0000000..03d1fa3 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/modules/core/regex.js @@ -0,0 +1,39 @@ +// Parse unit value +export const numberAndUnit = + /^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i + +// Parse hex value +export const hex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i + +// Parse rgb value +export const rgb = /rgb\((\d+),(\d+),(\d+)\)/ + +// Parse reference id +export const reference = /(#[a-z_][a-z0-9\-_]*)/i + +// splits a transformation chain +export const transforms = /\)\s*,?\s*/ + +// Whitespace +export const whitespace = /\s/g + +// Test hex value +export const isHex = /^#[a-f0-9]{3}$|^#[a-f0-9]{6}$/i + +// Test rgb value +export const isRgb = /^rgb\(/ + +// Test for blank string +export const isBlank = /^(\s+)?$/ + +// Test for numeric string +export const isNumber = /^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i + +// Test for image url +export const isImage = /\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i + +// split at whitespace and comma +export const delimiter = /[\s,]+/ + +// Test for path letter +export const isPathLetter = /[MLHVCSQTAZ]/i diff --git a/node_modules/@svgdotjs/svg.js/src/modules/core/selector.js b/node_modules/@svgdotjs/svg.js/src/modules/core/selector.js new file mode 100644 index 0000000..7dec4e4 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/modules/core/selector.js @@ -0,0 +1,21 @@ +import { adopt } from '../../utils/adopter.js' +import { globals } from '../../utils/window.js' +import { map } from '../../utils/utils.js' +import List from '../../types/List.js' + +export default function baseFind(query, parent) { + return new List( + map((parent || globals.document).querySelectorAll(query), function (node) { + return adopt(node) + }) + ) +} + +// Scoped find method +export function find(query) { + return baseFind(query, this.node) +} + +export function findOne(query) { + return adopt(this.node.querySelector(query)) +} diff --git a/node_modules/@svgdotjs/svg.js/src/modules/core/textable.js b/node_modules/@svgdotjs/svg.js/src/modules/core/textable.js new file mode 100644 index 0000000..44a1ee5 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/modules/core/textable.js @@ -0,0 +1,83 @@ +import { globals } from '../../utils/window.js' + +// Create plain text node +export function plain(text) { + // clear if build mode is disabled + if (this._build === false) { + this.clear() + } + + // create text node + this.node.appendChild(globals.document.createTextNode(text)) + + return this +} + +// Get length of text element +export function length() { + return this.node.getComputedTextLength() +} + +// Move over x-axis +// Text is moved by its bounding box +// text-anchor does NOT matter +export function x(x, box = this.bbox()) { + if (x == null) { + return box.x + } + + return this.attr('x', this.attr('x') + x - box.x) +} + +// Move over y-axis +export function y(y, box = this.bbox()) { + if (y == null) { + return box.y + } + + return this.attr('y', this.attr('y') + y - box.y) +} + +export function move(x, y, box = this.bbox()) { + return this.x(x, box).y(y, box) +} + +// Move center over x-axis +export function cx(x, box = this.bbox()) { + if (x == null) { + return box.cx + } + + return this.attr('x', this.attr('x') + x - box.cx) +} + +// Move center over y-axis +export function cy(y, box = this.bbox()) { + if (y == null) { + return box.cy + } + + return this.attr('y', this.attr('y') + y - box.cy) +} + +export function center(x, y, box = this.bbox()) { + return this.cx(x, box).cy(y, box) +} + +export function ax(x) { + return this.attr('x', x) +} + +export function ay(y) { + return this.attr('y', y) +} + +export function amove(x, y) { + return this.ax(x).ay(y) +} + +// Enable / disable build mode +export function build(build) { + this._build = !!build + return this +} diff --git a/node_modules/@svgdotjs/svg.js/src/modules/optional/arrange.js b/node_modules/@svgdotjs/svg.js/src/modules/optional/arrange.js new file mode 100644 index 0000000..292cd79 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/modules/optional/arrange.js @@ -0,0 +1,114 @@ +import { makeInstance } from '../../utils/adopter.js' +import { registerMethods } from '../../utils/methods.js' + +// Get all siblings, including myself +export function siblings() { + return this.parent().children() +} + +// Get the current position siblings +export function position() { + return this.parent().index(this) +} + +// Get the next element (will return null if there is none) +export function next() { + return this.siblings()[this.position() + 1] +} + +// Get the next element (will return null if there is none) +export function prev() { + return this.siblings()[this.position() - 1] +} + +// Send given element one step forward +export function forward() { + const i = this.position() + const p = this.parent() + + // move node one step forward + p.add(this.remove(), i + 1) + + return this +} + +// Send given element one step backward +export function backward() { + const i = this.position() + const p = this.parent() + + p.add(this.remove(), i ? i - 1 : 0) + + return this +} + +// Send given element all the way to the front +export function front() { + const p = this.parent() + + // Move node forward + p.add(this.remove()) + + return this +} + +// Send given element all the way to the back +export function back() { + const p = this.parent() + + // Move node back + p.add(this.remove(), 0) + + return this +} + +// Inserts a given element before the targeted element +export function before(element) { + element = makeInstance(element) + element.remove() + + const i = this.position() + + this.parent().add(element, i) + + return this +} + +// Inserts a given element after the targeted element +export function after(element) { + element = makeInstance(element) + element.remove() + + const i = this.position() + + this.parent().add(element, i + 1) + + return this +} + +export function insertBefore(element) { + element = makeInstance(element) + element.before(this) + return this +} + +export function insertAfter(element) { + element = makeInstance(element) + element.after(this) + return this +} + +registerMethods('Dom', { + siblings, + position, + next, + prev, + forward, + backward, + front, + back, + before, + after, + insertBefore, + insertAfter +}) diff --git a/node_modules/@svgdotjs/svg.js/src/modules/optional/class.js b/node_modules/@svgdotjs/svg.js/src/modules/optional/class.js new file mode 100644 index 0000000..3141644 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/modules/optional/class.js @@ -0,0 +1,53 @@ +import { delimiter } from '../core/regex.js' +import { registerMethods } from '../../utils/methods.js' + +// Return array of classes on the node +export function classes() { + const attr = this.attr('class') + return attr == null ? [] : attr.trim().split(delimiter) +} + +// Return true if class exists on the node, false otherwise +export function hasClass(name) { + return this.classes().indexOf(name) !== -1 +} + +// Add class to the node +export function addClass(name) { + if (!this.hasClass(name)) { + const array = this.classes() + array.push(name) + this.attr('class', array.join(' ')) + } + + return this +} + +// Remove class from the node +export function removeClass(name) { + if (this.hasClass(name)) { + this.attr( + 'class', + this.classes() + .filter(function (c) { + return c !== name + }) + .join(' ') + ) + } + + return this +} + +// Toggle the presence of a class on the node +export function toggleClass(name) { + return this.hasClass(name) ? this.removeClass(name) : this.addClass(name) +} + +registerMethods('Dom', { + classes, + hasClass, + addClass, + removeClass, + toggleClass +}) diff --git a/node_modules/@svgdotjs/svg.js/src/modules/optional/css.js b/node_modules/@svgdotjs/svg.js/src/modules/optional/css.js new file mode 100644 index 0000000..1c5ed40 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/modules/optional/css.js @@ -0,0 +1,79 @@ +import { isBlank } from '../core/regex.js' +import { registerMethods } from '../../utils/methods.js' + +// Dynamic style generator +export function css(style, val) { + const ret = {} + if (arguments.length === 0) { + // get full style as object + this.node.style.cssText + .split(/\s*;\s*/) + .filter(function (el) { + return !!el.length + }) + .forEach(function (el) { + const t = el.split(/\s*:\s*/) + ret[t[0]] = t[1] + }) + return ret + } + + if (arguments.length < 2) { + // get style properties as array + if (Array.isArray(style)) { + for (const name of style) { + const cased = name + ret[name] = this.node.style.getPropertyValue(cased) + } + return ret + } + + // get style for property + if (typeof style === 'string') { + return this.node.style.getPropertyValue(style) + } + + // set styles in object + if (typeof style === 'object') { + for (const name in style) { + // set empty string if null/undefined/'' was given + this.node.style.setProperty( + name, + style[name] == null || isBlank.test(style[name]) ? '' : style[name] + ) + } + } + } + + // set style for property + if (arguments.length === 2) { + this.node.style.setProperty( + style, + val == null || isBlank.test(val) ? '' : val + ) + } + + return this +} + +// Show element +export function show() { + return this.css('display', '') +} + +// Hide element +export function hide() { + return this.css('display', 'none') +} + +// Is element visible? +export function visible() { + return this.css('display') !== 'none' +} + +registerMethods('Dom', { + css, + show, + hide, + visible +}) diff --git a/node_modules/@svgdotjs/svg.js/src/modules/optional/data.js b/node_modules/@svgdotjs/svg.js/src/modules/optional/data.js new file mode 100644 index 0000000..a9d7ac7 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/modules/optional/data.js @@ -0,0 +1,47 @@ +import { registerMethods } from '../../utils/methods.js' +import { filter, map } from '../../utils/utils.js' + +// Store data values on svg nodes +export function data(a, v, r) { + if (a == null) { + // get an object of attributes + return this.data( + map( + filter( + this.node.attributes, + (el) => el.nodeName.indexOf('data-') === 0 + ), + (el) => el.nodeName.slice(5) + ) + ) + } else if (a instanceof Array) { + const data = {} + for (const key of a) { + data[key] = this.data(key) + } + return data + } else if (typeof a === 'object') { + for (v in a) { + this.data(v, a[v]) + } + } else if (arguments.length < 2) { + try { + return JSON.parse(this.attr('data-' + a)) + } catch (e) { + return this.attr('data-' + a) + } + } else { + this.attr( + 'data-' + a, + v === null + ? null + : r === true || typeof v === 'string' || typeof v === 'number' + ? v + : JSON.stringify(v) + ) + } + + return this +} + +registerMethods('Dom', { data }) diff --git a/node_modules/@svgdotjs/svg.js/src/modules/optional/memory.js b/node_modules/@svgdotjs/svg.js/src/modules/optional/memory.js new file mode 100644 index 0000000..31058c3 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/modules/optional/memory.js @@ -0,0 +1,40 @@ +import { registerMethods } from '../../utils/methods.js' + +// Remember arbitrary data +export function remember(k, v) { + // remember every item in an object individually + if (typeof arguments[0] === 'object') { + for (const key in k) { + this.remember(key, k[key]) + } + } else if (arguments.length === 1) { + // retrieve memory + return this.memory()[k] + } else { + // store memory + this.memory()[k] = v + } + + return this +} + +// Erase a given memory +export function forget() { + if (arguments.length === 0) { + this._memory = {} + } else { + for (let i = arguments.length - 1; i >= 0; i--) { + delete this.memory()[arguments[i]] + } + } + return this +} + +// This triggers creation of a new hidden class which is not performant +// However, this function is not rarely used so it will not happen frequently +// Return local memory object +export function memory() { + return (this._memory = this._memory || {}) +} + +registerMethods('Dom', { remember, forget, memory }) diff --git a/node_modules/@svgdotjs/svg.js/src/modules/optional/sugar.js b/node_modules/@svgdotjs/svg.js/src/modules/optional/sugar.js new file mode 100644 index 0000000..2ee8c96 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/modules/optional/sugar.js @@ -0,0 +1,200 @@ +import { registerMethods } from '../../utils/methods.js' +import Color from '../../types/Color.js' +import Element from '../../elements/Element.js' +import Matrix from '../../types/Matrix.js' +import Point from '../../types/Point.js' +import SVGNumber from '../../types/SVGNumber.js' + +// Define list of available attributes for stroke and fill +const sugar = { + stroke: [ + 'color', + 'width', + 'opacity', + 'linecap', + 'linejoin', + 'miterlimit', + 'dasharray', + 'dashoffset' + ], + fill: ['color', 'opacity', 'rule'], + prefix: function (t, a) { + return a === 'color' ? t : t + '-' + a + } +} + +// Add sugar for fill and stroke +;['fill', 'stroke'].forEach(function (m) { + const extension = {} + let i + + extension[m] = function (o) { + if (typeof o === 'undefined') { + return this.attr(m) + } + if ( + typeof o === 'string' || + o instanceof Color || + Color.isRgb(o) || + o instanceof Element + ) { + this.attr(m, o) + } else { + // set all attributes from sugar.fill and sugar.stroke list + for (i = sugar[m].length - 1; i >= 0; i--) { + if (o[sugar[m][i]] != null) { + this.attr(sugar.prefix(m, sugar[m][i]), o[sugar[m][i]]) + } + } + } + + return this + } + + registerMethods(['Element', 'Runner'], extension) +}) + +registerMethods(['Element', 'Runner'], { + // Let the user set the matrix directly + matrix: function (mat, b, c, d, e, f) { + // Act as a getter + if (mat == null) { + return new Matrix(this) + } + + // Act as a setter, the user can pass a matrix or a set of numbers + return this.attr('transform', new Matrix(mat, b, c, d, e, f)) + }, + + // Map rotation to transform + rotate: function (angle, cx, cy) { + return this.transform({ rotate: angle, ox: cx, oy: cy }, true) + }, + + // Map skew to transform + skew: function (x, y, cx, cy) { + return arguments.length === 1 || arguments.length === 3 + ? this.transform({ skew: x, ox: y, oy: cx }, true) + : this.transform({ skew: [x, y], ox: cx, oy: cy }, true) + }, + + shear: function (lam, cx, cy) { + return this.transform({ shear: lam, ox: cx, oy: cy }, true) + }, + + // Map scale to transform + scale: function (x, y, cx, cy) { + return arguments.length === 1 || arguments.length === 3 + ? this.transform({ scale: x, ox: y, oy: cx }, true) + : this.transform({ scale: [x, y], ox: cx, oy: cy }, true) + }, + + // Map translate to transform + translate: function (x, y) { + return this.transform({ translate: [x, y] }, true) + }, + + // Map relative translations to transform + relative: function (x, y) { + return this.transform({ relative: [x, y] }, true) + }, + + // Map flip to transform + flip: function (direction = 'both', origin = 'center') { + if ('xybothtrue'.indexOf(direction) === -1) { + origin = direction + direction = 'both' + } + + return this.transform({ flip: direction, origin: origin }, true) + }, + + // Opacity + opacity: function (value) { + return this.attr('opacity', value) + } +}) + +registerMethods('radius', { + // Add x and y radius + radius: function (x, y = x) { + const type = (this._element || this).type + return type === 'radialGradient' + ? this.attr('r', new SVGNumber(x)) + : this.rx(x).ry(y) + } +}) + +registerMethods('Path', { + // Get path length + length: function () { + return this.node.getTotalLength() + }, + // Get point at length + pointAt: function (length) { + return new Point(this.node.getPointAtLength(length)) + } +}) + +registerMethods(['Element', 'Runner'], { + // Set font + font: function (a, v) { + if (typeof a === 'object') { + for (v in a) this.font(v, a[v]) + return this + } + + return a === 'leading' + ? this.leading(v) + : a === 'anchor' + ? this.attr('text-anchor', v) + : a === 'size' || + a === 'family' || + a === 'weight' || + a === 'stretch' || + a === 'variant' || + a === 'style' + ? this.attr('font-' + a, v) + : this.attr(a, v) + } +}) + +// Add events to elements +const methods = [ + 'click', + 'dblclick', + 'mousedown', + 'mouseup', + 'mouseover', + 'mouseout', + 'mousemove', + 'mouseenter', + 'mouseleave', + 'touchstart', + 'touchmove', + 'touchleave', + 'touchend', + 'touchcancel', + 'contextmenu', + 'wheel', + 'pointerdown', + 'pointermove', + 'pointerup', + 'pointerleave', + 'pointercancel' +].reduce(function (last, event) { + // add event to Element + const fn = function (f) { + if (f === null) { + this.off(event) + } else { + this.on(event, f) + } + return this + } + + last[event] = fn + return last +}, {}) + +registerMethods('Element', methods) diff --git a/node_modules/@svgdotjs/svg.js/src/modules/optional/transform.js b/node_modules/@svgdotjs/svg.js/src/modules/optional/transform.js new file mode 100644 index 0000000..b8ba46a --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/modules/optional/transform.js @@ -0,0 +1,83 @@ +import { getOrigin, isDescriptive } from '../../utils/utils.js' +import { delimiter, transforms } from '../core/regex.js' +import { registerMethods } from '../../utils/methods.js' +import Matrix from '../../types/Matrix.js' + +// Reset all transformations +export function untransform() { + return this.attr('transform', null) +} + +// merge the whole transformation chain into one matrix and returns it +export function matrixify() { + const matrix = (this.attr('transform') || '') + // split transformations + .split(transforms) + .slice(0, -1) + .map(function (str) { + // generate key => value pairs + const kv = str.trim().split('(') + return [ + kv[0], + kv[1].split(delimiter).map(function (str) { + return parseFloat(str) + }) + ] + }) + .reverse() + // merge every transformation into one matrix + .reduce(function (matrix, transform) { + if (transform[0] === 'matrix') { + return matrix.lmultiply(Matrix.fromArray(transform[1])) + } + return matrix[transform[0]].apply(matrix, transform[1]) + }, new Matrix()) + + return matrix +} + +// add an element to another parent without changing the visual representation on the screen +export function toParent(parent, i) { + if (this === parent) return this + + if (isDescriptive(this.node)) return this.addTo(parent, i) + + const ctm = this.screenCTM() + const pCtm = parent.screenCTM().inverse() + + this.addTo(parent, i).untransform().transform(pCtm.multiply(ctm)) + + return this +} + +// same as above with parent equals root-svg +export function toRoot(i) { + return this.toParent(this.root(), i) +} + +// Add transformations +export function transform(o, relative) { + // Act as a getter if no object was passed + if (o == null || typeof o === 'string') { + const decomposed = new Matrix(this).decompose() + return o == null ? decomposed : decomposed[o] + } + + if (!Matrix.isMatrixLike(o)) { + // Set the origin according to the defined transform + o = { ...o, origin: getOrigin(o, this) } + } + + // The user can pass a boolean, an Element or an Matrix or nothing + const cleanRelative = relative === true ? this : relative || false + const result = new Matrix(cleanRelative).transform(o) + return this.attr('transform', result) +} + +registerMethods('Element', { + untransform, + matrixify, + toParent, + toRoot, + transform +}) diff --git a/node_modules/@svgdotjs/svg.js/src/polyfills/children.js b/node_modules/@svgdotjs/svg.js/src/polyfills/children.js new file mode 100644 index 0000000..690e23a --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/polyfills/children.js @@ -0,0 +1,8 @@ +import { filter } from '../utils/utils.js' + +// IE11: children does not work for svg nodes +export default function children(node) { + return filter(node.childNodes, function (child) { + return child.nodeType === 1 + }) +} diff --git a/node_modules/@svgdotjs/svg.js/src/polyfills/innerHTML.js b/node_modules/@svgdotjs/svg.js/src/polyfills/innerHTML.js new file mode 100644 index 0000000..51632af --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/polyfills/innerHTML.js @@ -0,0 +1,115 @@ +;(function () { + try { + if (SVGElement.prototype.innerHTML) return + } catch (e) { + return + } + + const serializeXML = function (node, output) { + const nodeType = node.nodeType + if (nodeType === 3) { + output.push( + node.textContent + .replace(/&/, '&') + .replace(/', '>') + ) + } else if (nodeType === 1) { + output.push('<', node.tagName) + if (node.hasAttributes()) { + ;[].forEach.call(node.attributes, function (attrNode) { + output.push(' ', attrNode.name, '="', attrNode.value, '"') + }) + } + output.push('>') + if (node.hasChildNodes()) { + ;[].forEach.call(node.childNodes, function (childNode) { + serializeXML(childNode, output) + }) + } else { + // output.push('/>') + } + output.push('') + } else if (nodeType === 8) { + output.push('') + } + } + + Object.defineProperty(SVGElement.prototype, 'innerHTML', { + get: function () { + const output = [] + let childNode = this.firstChild + while (childNode) { + serializeXML(childNode, output) + childNode = childNode.nextSibling + } + return output.join('') + }, + set: function (markupText) { + while (this.firstChild) { + this.removeChild(this.firstChild) + } + + try { + const dXML = new DOMParser() + dXML.async = false + + const sXML = + "" + + markupText + + '' + const svgDocElement = dXML.parseFromString( + sXML, + 'text/xml' + ).documentElement + + let childNode = svgDocElement.firstChild + while (childNode) { + this.appendChild(this.ownerDocument.importNode(childNode, true)) + childNode = childNode.nextSibling + } + } catch (e) { + throw new Error('Can not set innerHTML on node') + } + } + }) + + Object.defineProperty(SVGElement.prototype, 'outerHTML', { + get: function () { + const output = [] + serializeXML(this, output) + return output.join('') + }, + set: function (markupText) { + while (this.firstChild) { + this.removeChild(this.firstChild) + } + + try { + const dXML = new DOMParser() + dXML.async = false + + const sXML = + "" + + markupText + + '' + const svgDocElement = dXML.parseFromString( + sXML, + 'text/xml' + ).documentElement + + let childNode = svgDocElement.firstChild + while (childNode) { + this.parentNode.insertBefore( + this.ownerDocument.importNode(childNode, true), + this + ) + // this.appendChild(this.ownerDocument.importNode(childNode, true)); + childNode = childNode.nextSibling + } + } catch (e) { + throw new Error('Can not set outerHTML on node') + } + } + }) +})() diff --git a/node_modules/@svgdotjs/svg.js/src/svg.js b/node_modules/@svgdotjs/svg.js/src/svg.js new file mode 100644 index 0000000..69e4161 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/svg.js @@ -0,0 +1,9 @@ +import * as svgMembers from './main.js' +import { makeInstance } from './utils/adopter.js' + +// The main wrapping element +export default function SVG(element, isHTML) { + return makeInstance(element, isHTML) +} + +Object.assign(SVG, svgMembers) diff --git a/node_modules/@svgdotjs/svg.js/src/types/Base.js b/node_modules/@svgdotjs/svg.js/src/types/Base.js new file mode 100644 index 0000000..d2897a1 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/types/Base.js @@ -0,0 +1,10 @@ +export default class Base { + // constructor (node/*, {extensions = []} */) { + // // this.tags = [] + // // + // // for (let extension of extensions) { + // // extension.setup.call(this, node) + // // this.tags.push(extension.name) + // // } + // } +} diff --git a/node_modules/@svgdotjs/svg.js/src/types/Box.js b/node_modules/@svgdotjs/svg.js/src/types/Box.js new file mode 100644 index 0000000..4e90acf --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/types/Box.js @@ -0,0 +1,270 @@ +import { delimiter } from '../modules/core/regex.js' +import { globals } from '../utils/window.js' +import { register } from '../utils/adopter.js' +import { registerMethods } from '../utils/methods.js' +import Matrix from './Matrix.js' +import Point from './Point.js' +import parser from '../modules/core/parser.js' + +export function isNulledBox(box) { + return !box.width && !box.height && !box.x && !box.y +} + +export function domContains(node) { + return ( + node === globals.document || + ( + globals.document.documentElement.contains || + function (node) { + // This is IE - it does not support contains() for top-level SVGs + while (node.parentNode) { + node = node.parentNode + } + return node === globals.document + } + ).call(globals.document.documentElement, node) + ) +} + +export default class Box { + constructor(...args) { + this.init(...args) + } + + addOffset() { + // offset by window scroll position, because getBoundingClientRect changes when window is scrolled + this.x += globals.window.pageXOffset + this.y += globals.window.pageYOffset + return new Box(this) + } + + init(source) { + const base = [0, 0, 0, 0] + source = + typeof source === 'string' + ? source.split(delimiter).map(parseFloat) + : Array.isArray(source) + ? source + : typeof source === 'object' + ? [ + source.left != null ? source.left : source.x, + source.top != null ? source.top : source.y, + source.width, + source.height + ] + : arguments.length === 4 + ? [].slice.call(arguments) + : base + + this.x = source[0] || 0 + this.y = source[1] || 0 + this.width = this.w = source[2] || 0 + this.height = this.h = source[3] || 0 + + // Add more bounding box properties + this.x2 = this.x + this.w + this.y2 = this.y + this.h + this.cx = this.x + this.w / 2 + this.cy = this.y + this.h / 2 + + return this + } + + isNulled() { + return isNulledBox(this) + } + + // Merge rect box with another, return a new instance + merge(box) { + const x = Math.min(this.x, box.x) + const y = Math.min(this.y, box.y) + const width = Math.max(this.x + this.width, box.x + box.width) - x + const height = Math.max(this.y + this.height, box.y + box.height) - y + + return new Box(x, y, width, height) + } + + toArray() { + return [this.x, this.y, this.width, this.height] + } + + toString() { + return this.x + ' ' + this.y + ' ' + this.width + ' ' + this.height + } + + transform(m) { + if (!(m instanceof Matrix)) { + m = new Matrix(m) + } + + let xMin = Infinity + let xMax = -Infinity + let yMin = Infinity + let yMax = -Infinity + + const pts = [ + new Point(this.x, this.y), + new Point(this.x2, this.y), + new Point(this.x, this.y2), + new Point(this.x2, this.y2) + ] + + pts.forEach(function (p) { + p = p.transform(m) + xMin = Math.min(xMin, p.x) + xMax = Math.max(xMax, p.x) + yMin = Math.min(yMin, p.y) + yMax = Math.max(yMax, p.y) + }) + + return new Box(xMin, yMin, xMax - xMin, yMax - yMin) + } +} + +function getBox(el, getBBoxFn, retry) { + let box + + try { + // Try to get the box with the provided function + box = getBBoxFn(el.node) + + // If the box is worthless and not even in the dom, retry + // by throwing an error here... + if (isNulledBox(box) && !domContains(el.node)) { + throw new Error('Element not in the dom') + } + } catch (e) { + // ... and calling the retry handler here + box = retry(el) + } + + return box +} + +export function bbox() { + // Function to get bbox is getBBox() + const getBBox = (node) => node.getBBox() + + // Take all measures so that a stupid browser renders the element + // so we can get the bbox from it when we try again + const retry = (el) => { + try { + const clone = el.clone().addTo(parser().svg).show() + const box = clone.node.getBBox() + clone.remove() + return box + } catch (e) { + // We give up... + throw new Error( + `Getting bbox of element "${ + el.node.nodeName + }" is not possible: ${e.toString()}` + ) + } + } + + const box = getBox(this, getBBox, retry) + const bbox = new Box(box) + + return bbox +} + +export function rbox(el) { + const getRBox = (node) => node.getBoundingClientRect() + const retry = (el) => { + // There is no point in trying tricks here because if we insert the element into the dom ourselves + // it obviously will be at the wrong position + throw new Error( + `Getting rbox of element "${el.node.nodeName}" is not possible` + ) + } + + const box = getBox(this, getRBox, retry) + const rbox = new Box(box) + + // If an element was passed, we want the bbox in the coordinate system of that element + if (el) { + return rbox.transform(el.screenCTM().inverseO()) + } + + // Else we want it in absolute screen coordinates + // Therefore we need to add the scrollOffset + return rbox.addOffset() +} + +// Checks whether the given point is inside the bounding box +export function inside(x, y) { + const box = this.bbox() + + return ( + x > box.x && y > box.y && x < box.x + box.width && y < box.y + box.height + ) +} + +registerMethods({ + viewbox: { + viewbox(x, y, width, height) { + // act as getter + if (x == null) return new Box(this.attr('viewBox')) + + // act as setter + return this.attr('viewBox', new Box(x, y, width, height)) + }, + + zoom(level, point) { + // Its best to rely on the attributes here and here is why: + // clientXYZ: Doesn't work on non-root svgs because they dont have a CSSBox (silly!) + // getBoundingClientRect: Doesn't work because Chrome just ignores width and height of nested svgs completely + // that means, their clientRect is always as big as the content. + // Furthermore this size is incorrect if the element is further transformed by its parents + // computedStyle: Only returns meaningful values if css was used with px. We dont go this route here! + // getBBox: returns the bounding box of its content - that doesn't help! + let { width, height } = this.attr(['width', 'height']) + + // Width and height is a string when a number with a unit is present which we can't use + // So we try clientXYZ + if ( + (!width && !height) || + typeof width === 'string' || + typeof height === 'string' + ) { + width = this.node.clientWidth + height = this.node.clientHeight + } + + // Giving up... + if (!width || !height) { + throw new Error( + 'Impossible to get absolute width and height. Please provide an absolute width and height attribute on the zooming element' + ) + } + + const v = this.viewbox() + + const zoomX = width / v.width + const zoomY = height / v.height + const zoom = Math.min(zoomX, zoomY) + + if (level == null) { + return zoom + } + + let zoomAmount = zoom / level + + // Set the zoomAmount to the highest value which is safe to process and recover from + // The * 100 is a bit of wiggle room for the matrix transformation + if (zoomAmount === Infinity) zoomAmount = Number.MAX_SAFE_INTEGER / 100 + + point = + point || new Point(width / 2 / zoomX + v.x, height / 2 / zoomY + v.y) + + const box = new Box(v).transform( + new Matrix({ scale: zoomAmount, origin: point }) + ) + + return this.viewbox(box) + } + } +}) + +register(Box, 'Box') diff --git a/node_modules/@svgdotjs/svg.js/src/types/Color.js b/node_modules/@svgdotjs/svg.js/src/types/Color.js new file mode 100644 index 0000000..2f61b5a --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/types/Color.js @@ -0,0 +1,450 @@ +import { hex, isHex, isRgb, rgb, whitespace } from '../modules/core/regex.js' + +function sixDigitHex(hex) { + return hex.length === 4 + ? [ + '#', + hex.substring(1, 2), + hex.substring(1, 2), + hex.substring(2, 3), + hex.substring(2, 3), + hex.substring(3, 4), + hex.substring(3, 4) + ].join('') + : hex +} + +function componentHex(component) { + const integer = Math.round(component) + const bounded = Math.max(0, Math.min(255, integer)) + const hex = bounded.toString(16) + return hex.length === 1 ? '0' + hex : hex +} + +function is(object, space) { + for (let i = space.length; i--; ) { + if (object[space[i]] == null) { + return false + } + } + return true +} + +function getParameters(a, b) { + const params = is(a, 'rgb') + ? { _a: a.r, _b: a.g, _c: a.b, _d: 0, space: 'rgb' } + : is(a, 'xyz') + ? { _a: a.x, _b: a.y, _c: a.z, _d: 0, space: 'xyz' } + : is(a, 'hsl') + ? { _a: a.h, _b: a.s, _c: a.l, _d: 0, space: 'hsl' } + : is(a, 'lab') + ? { _a: a.l, _b: a.a, _c: a.b, _d: 0, space: 'lab' } + : is(a, 'lch') + ? { _a: a.l, _b: a.c, _c: a.h, _d: 0, space: 'lch' } + : is(a, 'cmyk') + ? { _a: a.c, _b: a.m, _c: a.y, _d: a.k, space: 'cmyk' } + : { _a: 0, _b: 0, _c: 0, space: 'rgb' } + + params.space = b || params.space + return params +} + +function cieSpace(space) { + if (space === 'lab' || space === 'xyz' || space === 'lch') { + return true + } else { + return false + } +} + +function hueToRgb(p, q, t) { + if (t < 0) t += 1 + if (t > 1) t -= 1 + if (t < 1 / 6) return p + (q - p) * 6 * t + if (t < 1 / 2) return q + if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6 + return p +} + +export default class Color { + constructor(...inputs) { + this.init(...inputs) + } + + // Test if given value is a color + static isColor(color) { + return ( + color && (color instanceof Color || this.isRgb(color) || this.test(color)) + ) + } + + // Test if given value is an rgb object + static isRgb(color) { + return ( + color && + typeof color.r === 'number' && + typeof color.g === 'number' && + typeof color.b === 'number' + ) + } + + /* + Generating random colors + */ + static random(mode = 'vibrant', t) { + // Get the math modules + const { random, round, sin, PI: pi } = Math + + // Run the correct generator + if (mode === 'vibrant') { + const l = (81 - 57) * random() + 57 + const c = (83 - 45) * random() + 45 + const h = 360 * random() + const color = new Color(l, c, h, 'lch') + return color + } else if (mode === 'sine') { + t = t == null ? random() : t + const r = round(80 * sin((2 * pi * t) / 0.5 + 0.01) + 150) + const g = round(50 * sin((2 * pi * t) / 0.5 + 4.6) + 200) + const b = round(100 * sin((2 * pi * t) / 0.5 + 2.3) + 150) + const color = new Color(r, g, b) + return color + } else if (mode === 'pastel') { + const l = (94 - 86) * random() + 86 + const c = (26 - 9) * random() + 9 + const h = 360 * random() + const color = new Color(l, c, h, 'lch') + return color + } else if (mode === 'dark') { + const l = 10 + 10 * random() + const c = (125 - 75) * random() + 86 + const h = 360 * random() + const color = new Color(l, c, h, 'lch') + return color + } else if (mode === 'rgb') { + const r = 255 * random() + const g = 255 * random() + const b = 255 * random() + const color = new Color(r, g, b) + return color + } else if (mode === 'lab') { + const l = 100 * random() + const a = 256 * random() - 128 + const b = 256 * random() - 128 + const color = new Color(l, a, b, 'lab') + return color + } else if (mode === 'grey') { + const grey = 255 * random() + const color = new Color(grey, grey, grey) + return color + } else { + throw new Error('Unsupported random color mode') + } + } + + // Test if given value is a color string + static test(color) { + return typeof color === 'string' && (isHex.test(color) || isRgb.test(color)) + } + + cmyk() { + // Get the rgb values for the current color + const { _a, _b, _c } = this.rgb() + const [r, g, b] = [_a, _b, _c].map((v) => v / 255) + + // Get the cmyk values in an unbounded format + const k = Math.min(1 - r, 1 - g, 1 - b) + + if (k === 1) { + // Catch the black case + return new Color(0, 0, 0, 1, 'cmyk') + } + + const c = (1 - r - k) / (1 - k) + const m = (1 - g - k) / (1 - k) + const y = (1 - b - k) / (1 - k) + + // Construct the new color + const color = new Color(c, m, y, k, 'cmyk') + return color + } + + hsl() { + // Get the rgb values + const { _a, _b, _c } = this.rgb() + const [r, g, b] = [_a, _b, _c].map((v) => v / 255) + + // Find the maximum and minimum values to get the lightness + const max = Math.max(r, g, b) + const min = Math.min(r, g, b) + const l = (max + min) / 2 + + // If the r, g, v values are identical then we are grey + const isGrey = max === min + + // Calculate the hue and saturation + const delta = max - min + const s = isGrey + ? 0 + : l > 0.5 + ? delta / (2 - max - min) + : delta / (max + min) + const h = isGrey + ? 0 + : max === r + ? ((g - b) / delta + (g < b ? 6 : 0)) / 6 + : max === g + ? ((b - r) / delta + 2) / 6 + : max === b + ? ((r - g) / delta + 4) / 6 + : 0 + + // Construct and return the new color + const color = new Color(360 * h, 100 * s, 100 * l, 'hsl') + return color + } + + init(a = 0, b = 0, c = 0, d = 0, space = 'rgb') { + // This catches the case when a falsy value is passed like '' + a = !a ? 0 : a + + // Reset all values in case the init function is rerun with new color space + if (this.space) { + for (const component in this.space) { + delete this[this.space[component]] + } + } + + if (typeof a === 'number') { + // Allow for the case that we don't need d... + space = typeof d === 'string' ? d : space + d = typeof d === 'string' ? 0 : d + + // Assign the values straight to the color + Object.assign(this, { _a: a, _b: b, _c: c, _d: d, space }) + // If the user gave us an array, make the color from it + } else if (a instanceof Array) { + this.space = b || (typeof a[3] === 'string' ? a[3] : a[4]) || 'rgb' + Object.assign(this, { _a: a[0], _b: a[1], _c: a[2], _d: a[3] || 0 }) + } else if (a instanceof Object) { + // Set the object up and assign its values directly + const values = getParameters(a, b) + Object.assign(this, values) + } else if (typeof a === 'string') { + if (isRgb.test(a)) { + const noWhitespace = a.replace(whitespace, '') + const [_a, _b, _c] = rgb + .exec(noWhitespace) + .slice(1, 4) + .map((v) => parseInt(v)) + Object.assign(this, { _a, _b, _c, _d: 0, space: 'rgb' }) + } else if (isHex.test(a)) { + const hexParse = (v) => parseInt(v, 16) + const [, _a, _b, _c] = hex.exec(sixDigitHex(a)).map(hexParse) + Object.assign(this, { _a, _b, _c, _d: 0, space: 'rgb' }) + } else throw Error("Unsupported string format, can't construct Color") + } + + // Now add the components as a convenience + const { _a, _b, _c, _d } = this + const components = + this.space === 'rgb' + ? { r: _a, g: _b, b: _c } + : this.space === 'xyz' + ? { x: _a, y: _b, z: _c } + : this.space === 'hsl' + ? { h: _a, s: _b, l: _c } + : this.space === 'lab' + ? { l: _a, a: _b, b: _c } + : this.space === 'lch' + ? { l: _a, c: _b, h: _c } + : this.space === 'cmyk' + ? { c: _a, m: _b, y: _c, k: _d } + : {} + Object.assign(this, components) + } + + lab() { + // Get the xyz color + const { x, y, z } = this.xyz() + + // Get the lab components + const l = 116 * y - 16 + const a = 500 * (x - y) + const b = 200 * (y - z) + + // Construct and return a new color + const color = new Color(l, a, b, 'lab') + return color + } + + lch() { + // Get the lab color directly + const { l, a, b } = this.lab() + + // Get the chromaticity and the hue using polar coordinates + const c = Math.sqrt(a ** 2 + b ** 2) + let h = (180 * Math.atan2(b, a)) / Math.PI + if (h < 0) { + h *= -1 + h = 360 - h + } + + // Make a new color and return it + const color = new Color(l, c, h, 'lch') + return color + } + /* + Conversion Methods + */ + + rgb() { + if (this.space === 'rgb') { + return this + } else if (cieSpace(this.space)) { + // Convert to the xyz color space + let { x, y, z } = this + if (this.space === 'lab' || this.space === 'lch') { + // Get the values in the lab space + let { l, a, b } = this + if (this.space === 'lch') { + const { c, h } = this + const dToR = Math.PI / 180 + a = c * Math.cos(dToR * h) + b = c * Math.sin(dToR * h) + } + + // Undo the nonlinear function + const yL = (l + 16) / 116 + const xL = a / 500 + yL + const zL = yL - b / 200 + + // Get the xyz values + const ct = 16 / 116 + const mx = 0.008856 + const nm = 7.787 + x = 0.95047 * (xL ** 3 > mx ? xL ** 3 : (xL - ct) / nm) + y = 1.0 * (yL ** 3 > mx ? yL ** 3 : (yL - ct) / nm) + z = 1.08883 * (zL ** 3 > mx ? zL ** 3 : (zL - ct) / nm) + } + + // Convert xyz to unbounded rgb values + const rU = x * 3.2406 + y * -1.5372 + z * -0.4986 + const gU = x * -0.9689 + y * 1.8758 + z * 0.0415 + const bU = x * 0.0557 + y * -0.204 + z * 1.057 + + // Convert the values to true rgb values + const pow = Math.pow + const bd = 0.0031308 + const r = rU > bd ? 1.055 * pow(rU, 1 / 2.4) - 0.055 : 12.92 * rU + const g = gU > bd ? 1.055 * pow(gU, 1 / 2.4) - 0.055 : 12.92 * gU + const b = bU > bd ? 1.055 * pow(bU, 1 / 2.4) - 0.055 : 12.92 * bU + + // Make and return the color + const color = new Color(255 * r, 255 * g, 255 * b) + return color + } else if (this.space === 'hsl') { + // https://bgrins.github.io/TinyColor/docs/tinycolor.html + // Get the current hsl values + let { h, s, l } = this + h /= 360 + s /= 100 + l /= 100 + + // If we are grey, then just make the color directly + if (s === 0) { + l *= 255 + const color = new Color(l, l, l) + return color + } + + // TODO I have no idea what this does :D If you figure it out, tell me! + const q = l < 0.5 ? l * (1 + s) : l + s - l * s + const p = 2 * l - q + + // Get the rgb values + const r = 255 * hueToRgb(p, q, h + 1 / 3) + const g = 255 * hueToRgb(p, q, h) + const b = 255 * hueToRgb(p, q, h - 1 / 3) + + // Make a new color + const color = new Color(r, g, b) + return color + } else if (this.space === 'cmyk') { + // https://gist.github.com/felipesabino/5066336 + // Get the normalised cmyk values + const { c, m, y, k } = this + + // Get the rgb values + const r = 255 * (1 - Math.min(1, c * (1 - k) + k)) + const g = 255 * (1 - Math.min(1, m * (1 - k) + k)) + const b = 255 * (1 - Math.min(1, y * (1 - k) + k)) + + // Form the color and return it + const color = new Color(r, g, b) + return color + } else { + return this + } + } + + toArray() { + const { _a, _b, _c, _d, space } = this + return [_a, _b, _c, _d, space] + } + + toHex() { + const [r, g, b] = this._clamped().map(componentHex) + return `#${r}${g}${b}` + } + + toRgb() { + const [rV, gV, bV] = this._clamped() + const string = `rgb(${rV},${gV},${bV})` + return string + } + + toString() { + return this.toHex() + } + + xyz() { + // Normalise the red, green and blue values + const { _a: r255, _b: g255, _c: b255 } = this.rgb() + const [r, g, b] = [r255, g255, b255].map((v) => v / 255) + + // Convert to the lab rgb space + const rL = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92 + const gL = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92 + const bL = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92 + + // Convert to the xyz color space without bounding the values + const xU = (rL * 0.4124 + gL * 0.3576 + bL * 0.1805) / 0.95047 + const yU = (rL * 0.2126 + gL * 0.7152 + bL * 0.0722) / 1.0 + const zU = (rL * 0.0193 + gL * 0.1192 + bL * 0.9505) / 1.08883 + + // Get the proper xyz values by applying the bounding + const x = xU > 0.008856 ? Math.pow(xU, 1 / 3) : 7.787 * xU + 16 / 116 + const y = yU > 0.008856 ? Math.pow(yU, 1 / 3) : 7.787 * yU + 16 / 116 + const z = zU > 0.008856 ? Math.pow(zU, 1 / 3) : 7.787 * zU + 16 / 116 + + // Make and return the color + const color = new Color(x, y, z, 'xyz') + return color + } + + /* + Input and Output methods + */ + + _clamped() { + const { _a, _b, _c } = this.rgb() + const { max, min, round } = Math + const format = (v) => max(0, min(round(v), 255)) + return [_a, _b, _c].map(format) + } + + /* + Constructing colors + */ +} diff --git a/node_modules/@svgdotjs/svg.js/src/types/EventTarget.js b/node_modules/@svgdotjs/svg.js/src/types/EventTarget.js new file mode 100644 index 0000000..de13a5f --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/types/EventTarget.js @@ -0,0 +1,56 @@ +import { dispatch, off, on } from '../modules/core/event.js' +import { register } from '../utils/adopter.js' +import Base from './Base.js' + +export default class EventTarget extends Base { + addEventListener() {} + + dispatch(event, data, options) { + return dispatch(this, event, data, options) + } + + dispatchEvent(event) { + const bag = this.getEventHolder().events + if (!bag) return true + + const events = bag[event.type] + + for (const i in events) { + for (const j in events[i]) { + events[i][j](event) + } + } + + return !event.defaultPrevented + } + + // Fire given event + fire(event, data, options) { + this.dispatch(event, data, options) + return this + } + + getEventHolder() { + return this + } + + getEventTarget() { + return this + } + + // Unbind event from listener + off(event, listener, options) { + off(this, event, listener, options) + return this + } + + // Bind given event to listener + on(event, listener, binding, options) { + on(this, event, listener, binding, options) + return this + } + + removeEventListener() {} +} + +register(EventTarget, 'EventTarget') diff --git a/node_modules/@svgdotjs/svg.js/src/types/List.js b/node_modules/@svgdotjs/svg.js/src/types/List.js new file mode 100644 index 0000000..22b9027 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/types/List.js @@ -0,0 +1,63 @@ +import { extend } from '../utils/adopter.js' +// import { subClassArray } from './ArrayPolyfill.js' + +class List extends Array { + constructor(arr = [], ...args) { + super(arr, ...args) + if (typeof arr === 'number') return this + this.length = 0 + this.push(...arr) + } +} + +/* = subClassArray('List', Array, function (arr = []) { + // This catches the case, that native map tries to create an array with new Array(1) + if (typeof arr === 'number') return this + this.length = 0 + this.push(...arr) +}) */ + +export default List + +extend([List], { + each(fnOrMethodName, ...args) { + if (typeof fnOrMethodName === 'function') { + return this.map((el, i, arr) => { + return fnOrMethodName.call(el, el, i, arr) + }) + } else { + return this.map((el) => { + return el[fnOrMethodName](...args) + }) + } + }, + + toArray() { + return Array.prototype.concat.apply([], this) + } +}) + +const reserved = ['toArray', 'constructor', 'each'] + +List.extend = function (methods) { + methods = methods.reduce((obj, name) => { + // Don't overwrite own methods + if (reserved.includes(name)) return obj + + // Don't add private methods + if (name[0] === '_') return obj + + // Allow access to original Array methods through a prefix + if (name in Array.prototype) { + obj['$' + name] = Array.prototype[name] + } + + // Relay every call to each() + obj[name] = function (...attrs) { + return this.each(name, ...attrs) + } + return obj + }, {}) + + extend([List], methods) +} diff --git a/node_modules/@svgdotjs/svg.js/src/types/Matrix.js b/node_modules/@svgdotjs/svg.js/src/types/Matrix.js new file mode 100644 index 0000000..803ec37 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/types/Matrix.js @@ -0,0 +1,543 @@ +import { delimiter } from '../modules/core/regex.js' +import { radians } from '../utils/utils.js' +import { register } from '../utils/adopter.js' +import Element from '../elements/Element.js' +import Point from './Point.js' + +function closeEnough(a, b, threshold) { + return Math.abs(b - a) < (threshold || 1e-6) +} + +export default class Matrix { + constructor(...args) { + this.init(...args) + } + + static formatTransforms(o) { + // Get all of the parameters required to form the matrix + const flipBoth = o.flip === 'both' || o.flip === true + const flipX = o.flip && (flipBoth || o.flip === 'x') ? -1 : 1 + const flipY = o.flip && (flipBoth || o.flip === 'y') ? -1 : 1 + const skewX = + o.skew && o.skew.length + ? o.skew[0] + : isFinite(o.skew) + ? o.skew + : isFinite(o.skewX) + ? o.skewX + : 0 + const skewY = + o.skew && o.skew.length + ? o.skew[1] + : isFinite(o.skew) + ? o.skew + : isFinite(o.skewY) + ? o.skewY + : 0 + const scaleX = + o.scale && o.scale.length + ? o.scale[0] * flipX + : isFinite(o.scale) + ? o.scale * flipX + : isFinite(o.scaleX) + ? o.scaleX * flipX + : flipX + const scaleY = + o.scale && o.scale.length + ? o.scale[1] * flipY + : isFinite(o.scale) + ? o.scale * flipY + : isFinite(o.scaleY) + ? o.scaleY * flipY + : flipY + const shear = o.shear || 0 + const theta = o.rotate || o.theta || 0 + const origin = new Point( + o.origin || o.around || o.ox || o.originX, + o.oy || o.originY + ) + const ox = origin.x + const oy = origin.y + // We need Point to be invalid if nothing was passed because we cannot default to 0 here. That is why NaN + const position = new Point( + o.position || o.px || o.positionX || NaN, + o.py || o.positionY || NaN + ) + const px = position.x + const py = position.y + const translate = new Point( + o.translate || o.tx || o.translateX, + o.ty || o.translateY + ) + const tx = translate.x + const ty = translate.y + const relative = new Point( + o.relative || o.rx || o.relativeX, + o.ry || o.relativeY + ) + const rx = relative.x + const ry = relative.y + + // Populate all of the values + return { + scaleX, + scaleY, + skewX, + skewY, + shear, + theta, + rx, + ry, + tx, + ty, + ox, + oy, + px, + py + } + } + + static fromArray(a) { + return { a: a[0], b: a[1], c: a[2], d: a[3], e: a[4], f: a[5] } + } + + static isMatrixLike(o) { + return ( + o.a != null || + o.b != null || + o.c != null || + o.d != null || + o.e != null || + o.f != null + ) + } + + // left matrix, right matrix, target matrix which is overwritten + static matrixMultiply(l, r, o) { + // Work out the product directly + const a = l.a * r.a + l.c * r.b + const b = l.b * r.a + l.d * r.b + const c = l.a * r.c + l.c * r.d + const d = l.b * r.c + l.d * r.d + const e = l.e + l.a * r.e + l.c * r.f + const f = l.f + l.b * r.e + l.d * r.f + + // make sure to use local variables because l/r and o could be the same + o.a = a + o.b = b + o.c = c + o.d = d + o.e = e + o.f = f + + return o + } + + around(cx, cy, matrix) { + return this.clone().aroundO(cx, cy, matrix) + } + + // Transform around a center point + aroundO(cx, cy, matrix) { + const dx = cx || 0 + const dy = cy || 0 + return this.translateO(-dx, -dy).lmultiplyO(matrix).translateO(dx, dy) + } + + // Clones this matrix + clone() { + return new Matrix(this) + } + + // Decomposes this matrix into its affine parameters + decompose(cx = 0, cy = 0) { + // Get the parameters from the matrix + const a = this.a + const b = this.b + const c = this.c + const d = this.d + const e = this.e + const f = this.f + + // Figure out if the winding direction is clockwise or counterclockwise + const determinant = a * d - b * c + const ccw = determinant > 0 ? 1 : -1 + + // Since we only shear in x, we can use the x basis to get the x scale + // and the rotation of the resulting matrix + const sx = ccw * Math.sqrt(a * a + b * b) + const thetaRad = Math.atan2(ccw * b, ccw * a) + const theta = (180 / Math.PI) * thetaRad + const ct = Math.cos(thetaRad) + const st = Math.sin(thetaRad) + + // We can then solve the y basis vector simultaneously to get the other + // two affine parameters directly from these parameters + const lam = (a * c + b * d) / determinant + const sy = (c * sx) / (lam * a - b) || (d * sx) / (lam * b + a) + + // Use the translations + const tx = e - cx + cx * ct * sx + cy * (lam * ct * sx - st * sy) + const ty = f - cy + cx * st * sx + cy * (lam * st * sx + ct * sy) + + // Construct the decomposition and return it + return { + // Return the affine parameters + scaleX: sx, + scaleY: sy, + shear: lam, + rotate: theta, + translateX: tx, + translateY: ty, + originX: cx, + originY: cy, + + // Return the matrix parameters + a: this.a, + b: this.b, + c: this.c, + d: this.d, + e: this.e, + f: this.f + } + } + + // Check if two matrices are equal + equals(other) { + if (other === this) return true + const comp = new Matrix(other) + return ( + closeEnough(this.a, comp.a) && + closeEnough(this.b, comp.b) && + closeEnough(this.c, comp.c) && + closeEnough(this.d, comp.d) && + closeEnough(this.e, comp.e) && + closeEnough(this.f, comp.f) + ) + } + + // Flip matrix on x or y, at a given offset + flip(axis, around) { + return this.clone().flipO(axis, around) + } + + flipO(axis, around) { + return axis === 'x' + ? this.scaleO(-1, 1, around, 0) + : axis === 'y' + ? this.scaleO(1, -1, 0, around) + : this.scaleO(-1, -1, axis, around || axis) // Define an x, y flip point + } + + // Initialize + init(source) { + const base = Matrix.fromArray([1, 0, 0, 1, 0, 0]) + + // ensure source as object + source = + source instanceof Element + ? source.matrixify() + : typeof source === 'string' + ? Matrix.fromArray(source.split(delimiter).map(parseFloat)) + : Array.isArray(source) + ? Matrix.fromArray(source) + : typeof source === 'object' && Matrix.isMatrixLike(source) + ? source + : typeof source === 'object' + ? new Matrix().transform(source) + : arguments.length === 6 + ? Matrix.fromArray([].slice.call(arguments)) + : base + + // Merge the source matrix with the base matrix + this.a = source.a != null ? source.a : base.a + this.b = source.b != null ? source.b : base.b + this.c = source.c != null ? source.c : base.c + this.d = source.d != null ? source.d : base.d + this.e = source.e != null ? source.e : base.e + this.f = source.f != null ? source.f : base.f + + return this + } + + inverse() { + return this.clone().inverseO() + } + + // Inverses matrix + inverseO() { + // Get the current parameters out of the matrix + const a = this.a + const b = this.b + const c = this.c + const d = this.d + const e = this.e + const f = this.f + + // Invert the 2x2 matrix in the top left + const det = a * d - b * c + if (!det) throw new Error('Cannot invert ' + this) + + // Calculate the top 2x2 matrix + const na = d / det + const nb = -b / det + const nc = -c / det + const nd = a / det + + // Apply the inverted matrix to the top right + const ne = -(na * e + nc * f) + const nf = -(nb * e + nd * f) + + // Construct the inverted matrix + this.a = na + this.b = nb + this.c = nc + this.d = nd + this.e = ne + this.f = nf + + return this + } + + lmultiply(matrix) { + return this.clone().lmultiplyO(matrix) + } + + lmultiplyO(matrix) { + const r = this + const l = matrix instanceof Matrix ? matrix : new Matrix(matrix) + + return Matrix.matrixMultiply(l, r, this) + } + + // Left multiplies by the given matrix + multiply(matrix) { + return this.clone().multiplyO(matrix) + } + + multiplyO(matrix) { + // Get the matrices + const l = this + const r = matrix instanceof Matrix ? matrix : new Matrix(matrix) + + return Matrix.matrixMultiply(l, r, this) + } + + // Rotate matrix + rotate(r, cx, cy) { + return this.clone().rotateO(r, cx, cy) + } + + rotateO(r, cx = 0, cy = 0) { + // Convert degrees to radians + r = radians(r) + + const cos = Math.cos(r) + const sin = Math.sin(r) + + const { a, b, c, d, e, f } = this + + this.a = a * cos - b * sin + this.b = b * cos + a * sin + this.c = c * cos - d * sin + this.d = d * cos + c * sin + this.e = e * cos - f * sin + cy * sin - cx * cos + cx + this.f = f * cos + e * sin - cx * sin - cy * cos + cy + + return this + } + + // Scale matrix + scale() { + return this.clone().scaleO(...arguments) + } + + scaleO(x, y = x, cx = 0, cy = 0) { + // Support uniform scaling + if (arguments.length === 3) { + cy = cx + cx = y + y = x + } + + const { a, b, c, d, e, f } = this + + this.a = a * x + this.b = b * y + this.c = c * x + this.d = d * y + this.e = e * x - cx * x + cx + this.f = f * y - cy * y + cy + + return this + } + + // Shear matrix + shear(a, cx, cy) { + return this.clone().shearO(a, cx, cy) + } + + // eslint-disable-next-line no-unused-vars + shearO(lx, cx = 0, cy = 0) { + const { a, b, c, d, e, f } = this + + this.a = a + b * lx + this.c = c + d * lx + this.e = e + f * lx - cy * lx + + return this + } + + // Skew Matrix + skew() { + return this.clone().skewO(...arguments) + } + + skewO(x, y = x, cx = 0, cy = 0) { + // support uniformal skew + if (arguments.length === 3) { + cy = cx + cx = y + y = x + } + + // Convert degrees to radians + x = radians(x) + y = radians(y) + + const lx = Math.tan(x) + const ly = Math.tan(y) + + const { a, b, c, d, e, f } = this + + this.a = a + b * lx + this.b = b + a * ly + this.c = c + d * lx + this.d = d + c * ly + this.e = e + f * lx - cy * lx + this.f = f + e * ly - cx * ly + + return this + } + + // SkewX + skewX(x, cx, cy) { + return this.skew(x, 0, cx, cy) + } + + // SkewY + skewY(y, cx, cy) { + return this.skew(0, y, cx, cy) + } + + toArray() { + return [this.a, this.b, this.c, this.d, this.e, this.f] + } + + // Convert matrix to string + toString() { + return ( + 'matrix(' + + this.a + + ',' + + this.b + + ',' + + this.c + + ',' + + this.d + + ',' + + this.e + + ',' + + this.f + + ')' + ) + } + + // Transform a matrix into another matrix by manipulating the space + transform(o) { + // Check if o is a matrix and then left multiply it directly + if (Matrix.isMatrixLike(o)) { + const matrix = new Matrix(o) + return matrix.multiplyO(this) + } + + // Get the proposed transformations and the current transformations + const t = Matrix.formatTransforms(o) + const current = this + const { x: ox, y: oy } = new Point(t.ox, t.oy).transform(current) + + // Construct the resulting matrix + const transformer = new Matrix() + .translateO(t.rx, t.ry) + .lmultiplyO(current) + .translateO(-ox, -oy) + .scaleO(t.scaleX, t.scaleY) + .skewO(t.skewX, t.skewY) + .shearO(t.shear) + .rotateO(t.theta) + .translateO(ox, oy) + + // If we want the origin at a particular place, we force it there + if (isFinite(t.px) || isFinite(t.py)) { + const origin = new Point(ox, oy).transform(transformer) + // TODO: Replace t.px with isFinite(t.px) + // Doesn't work because t.px is also 0 if it wasn't passed + const dx = isFinite(t.px) ? t.px - origin.x : 0 + const dy = isFinite(t.py) ? t.py - origin.y : 0 + transformer.translateO(dx, dy) + } + + // Translate now after positioning + transformer.translateO(t.tx, t.ty) + return transformer + } + + // Translate matrix + translate(x, y) { + return this.clone().translateO(x, y) + } + + translateO(x, y) { + this.e += x || 0 + this.f += y || 0 + return this + } + + valueOf() { + return { + a: this.a, + b: this.b, + c: this.c, + d: this.d, + e: this.e, + f: this.f + } + } +} + +export function ctm() { + return new Matrix(this.node.getCTM()) +} + +export function screenCTM() { + try { + /* https://bugzilla.mozilla.org/show_bug.cgi?id=1344537 + This is needed because FF does not return the transformation matrix + for the inner coordinate system when getScreenCTM() is called on nested svgs. + However all other Browsers do that */ + if (typeof this.isRoot === 'function' && !this.isRoot()) { + const rect = this.rect(1, 1) + const m = rect.node.getScreenCTM() + rect.remove() + return new Matrix(m) + } + return new Matrix(this.node.getScreenCTM()) + } catch (e) { + console.warn( + `Cannot get CTM from SVG node ${this.node.nodeName}. Is the element rendered?` + ) + return new Matrix() + } +} + +register(Matrix, 'Matrix') diff --git a/node_modules/@svgdotjs/svg.js/src/types/PathArray.js b/node_modules/@svgdotjs/svg.js/src/types/PathArray.js new file mode 100644 index 0000000..9e59ed7 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/types/PathArray.js @@ -0,0 +1,150 @@ +import SVGArray from './SVGArray.js' +import parser from '../modules/core/parser.js' +import Box from './Box.js' +import { pathParser } from '../utils/pathParser.js' + +function arrayToString(a) { + let s = '' + for (let i = 0, il = a.length; i < il; i++) { + s += a[i][0] + + if (a[i][1] != null) { + s += a[i][1] + + if (a[i][2] != null) { + s += ' ' + s += a[i][2] + + if (a[i][3] != null) { + s += ' ' + s += a[i][3] + s += ' ' + s += a[i][4] + + if (a[i][5] != null) { + s += ' ' + s += a[i][5] + s += ' ' + s += a[i][6] + + if (a[i][7] != null) { + s += ' ' + s += a[i][7] + } + } + } + } + } + } + + return s + ' ' +} + +export default class PathArray extends SVGArray { + // Get bounding box of path + bbox() { + parser().path.setAttribute('d', this.toString()) + return new Box(parser.nodes.path.getBBox()) + } + + // Move path string + move(x, y) { + // get bounding box of current situation + const box = this.bbox() + + // get relative offset + x -= box.x + y -= box.y + + if (!isNaN(x) && !isNaN(y)) { + // move every point + for (let l, i = this.length - 1; i >= 0; i--) { + l = this[i][0] + + if (l === 'M' || l === 'L' || l === 'T') { + this[i][1] += x + this[i][2] += y + } else if (l === 'H') { + this[i][1] += x + } else if (l === 'V') { + this[i][1] += y + } else if (l === 'C' || l === 'S' || l === 'Q') { + this[i][1] += x + this[i][2] += y + this[i][3] += x + this[i][4] += y + + if (l === 'C') { + this[i][5] += x + this[i][6] += y + } + } else if (l === 'A') { + this[i][6] += x + this[i][7] += y + } + } + } + + return this + } + + // Absolutize and parse path to array + parse(d = 'M0 0') { + if (Array.isArray(d)) { + d = Array.prototype.concat.apply([], d).toString() + } + + return pathParser(d) + } + + // Resize path string + size(width, height) { + // get bounding box of current situation + const box = this.bbox() + let i, l + + // If the box width or height is 0 then we ignore + // transformations on the respective axis + box.width = box.width === 0 ? 1 : box.width + box.height = box.height === 0 ? 1 : box.height + + // recalculate position of all points according to new size + for (i = this.length - 1; i >= 0; i--) { + l = this[i][0] + + if (l === 'M' || l === 'L' || l === 'T') { + this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x + this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y + } else if (l === 'H') { + this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x + } else if (l === 'V') { + this[i][1] = ((this[i][1] - box.y) * height) / box.height + box.y + } else if (l === 'C' || l === 'S' || l === 'Q') { + this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x + this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y + this[i][3] = ((this[i][3] - box.x) * width) / box.width + box.x + this[i][4] = ((this[i][4] - box.y) * height) / box.height + box.y + + if (l === 'C') { + this[i][5] = ((this[i][5] - box.x) * width) / box.width + box.x + this[i][6] = ((this[i][6] - box.y) * height) / box.height + box.y + } + } else if (l === 'A') { + // resize radii + this[i][1] = (this[i][1] * width) / box.width + this[i][2] = (this[i][2] * height) / box.height + + // move position values + this[i][6] = ((this[i][6] - box.x) * width) / box.width + box.x + this[i][7] = ((this[i][7] - box.y) * height) / box.height + box.y + } + } + + return this + } + + // Convert array to string + toString() { + return arrayToString(this) + } +} diff --git a/node_modules/@svgdotjs/svg.js/src/types/Point.js b/node_modules/@svgdotjs/svg.js/src/types/Point.js new file mode 100644 index 0000000..cfd204e --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/types/Point.js @@ -0,0 +1,57 @@ +import Matrix from './Matrix.js' + +export default class Point { + // Initialize + constructor(...args) { + this.init(...args) + } + + // Clone point + clone() { + return new Point(this) + } + + init(x, y) { + const base = { x: 0, y: 0 } + + // ensure source as object + const source = Array.isArray(x) + ? { x: x[0], y: x[1] } + : typeof x === 'object' + ? { x: x.x, y: x.y } + : { x: x, y: y } + + // merge source + this.x = source.x == null ? base.x : source.x + this.y = source.y == null ? base.y : source.y + + return this + } + + toArray() { + return [this.x, this.y] + } + + transform(m) { + return this.clone().transformO(m) + } + + // Transform point with matrix + transformO(m) { + if (!Matrix.isMatrixLike(m)) { + m = new Matrix(m) + } + + const { x, y } = this + + // Perform the matrix multiplication + this.x = m.a * x + m.c * y + m.e + this.y = m.b * x + m.d * y + m.f + + return this + } +} + +export function point(x, y) { + return new Point(x, y).transformO(this.screenCTM().inverseO()) +} diff --git a/node_modules/@svgdotjs/svg.js/src/types/PointArray.js b/node_modules/@svgdotjs/svg.js/src/types/PointArray.js new file mode 100644 index 0000000..f72c2bc --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/types/PointArray.js @@ -0,0 +1,121 @@ +import { delimiter } from '../modules/core/regex.js' +import SVGArray from './SVGArray.js' +import Box from './Box.js' +import Matrix from './Matrix.js' + +export default class PointArray extends SVGArray { + // Get bounding box of points + bbox() { + let maxX = -Infinity + let maxY = -Infinity + let minX = Infinity + let minY = Infinity + this.forEach(function (el) { + maxX = Math.max(el[0], maxX) + maxY = Math.max(el[1], maxY) + minX = Math.min(el[0], minX) + minY = Math.min(el[1], minY) + }) + return new Box(minX, minY, maxX - minX, maxY - minY) + } + + // Move point string + move(x, y) { + const box = this.bbox() + + // get relative offset + x -= box.x + y -= box.y + + // move every point + if (!isNaN(x) && !isNaN(y)) { + for (let i = this.length - 1; i >= 0; i--) { + this[i] = [this[i][0] + x, this[i][1] + y] + } + } + + return this + } + + // Parse point string and flat array + parse(array = [0, 0]) { + const points = [] + + // if it is an array, we flatten it and therefore clone it to 1 depths + if (array instanceof Array) { + array = Array.prototype.concat.apply([], array) + } else { + // Else, it is considered as a string + // parse points + array = array.trim().split(delimiter).map(parseFloat) + } + + // validate points - https://svgwg.org/svg2-draft/shapes.html#DataTypePoints + // Odd number of coordinates is an error. In such cases, drop the last odd coordinate. + if (array.length % 2 !== 0) array.pop() + + // wrap points in two-tuples + for (let i = 0, len = array.length; i < len; i = i + 2) { + points.push([array[i], array[i + 1]]) + } + + return points + } + + // Resize poly string + size(width, height) { + let i + const box = this.bbox() + + // recalculate position of all points according to new size + for (i = this.length - 1; i >= 0; i--) { + if (box.width) + this[i][0] = ((this[i][0] - box.x) * width) / box.width + box.x + if (box.height) + this[i][1] = ((this[i][1] - box.y) * height) / box.height + box.y + } + + return this + } + + // Convert array to line object + toLine() { + return { + x1: this[0][0], + y1: this[0][1], + x2: this[1][0], + y2: this[1][1] + } + } + + // Convert array to string + toString() { + const array = [] + // convert to a poly point string + for (let i = 0, il = this.length; i < il; i++) { + array.push(this[i].join(',')) + } + + return array.join(' ') + } + + transform(m) { + return this.clone().transformO(m) + } + + // transform points with matrix (similar to Point.transform) + transformO(m) { + if (!Matrix.isMatrixLike(m)) { + m = new Matrix(m) + } + + for (let i = this.length; i--; ) { + // Perform the matrix multiplication + const [x, y] = this[i] + this[i][0] = m.a * x + m.c * y + m.e + this[i][1] = m.b * x + m.d * y + m.f + } + + return this + } +} diff --git a/node_modules/@svgdotjs/svg.js/src/types/SVGArray.js b/node_modules/@svgdotjs/svg.js/src/types/SVGArray.js new file mode 100644 index 0000000..5826406 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/types/SVGArray.js @@ -0,0 +1,47 @@ +import { delimiter } from '../modules/core/regex.js' + +export default class SVGArray extends Array { + constructor(...args) { + super(...args) + this.init(...args) + } + + clone() { + return new this.constructor(this) + } + + init(arr) { + // This catches the case, that native map tries to create an array with new Array(1) + if (typeof arr === 'number') return this + this.length = 0 + this.push(...this.parse(arr)) + return this + } + + // Parse whitespace separated string + parse(array = []) { + // If already is an array, no need to parse it + if (array instanceof Array) return array + + return array.trim().split(delimiter).map(parseFloat) + } + + toArray() { + return Array.prototype.concat.apply([], this) + } + + toSet() { + return new Set(this) + } + + toString() { + return this.join(' ') + } + + // Flattens the array if needed + valueOf() { + const ret = [] + ret.push(...this) + return ret + } +} diff --git a/node_modules/@svgdotjs/svg.js/src/types/SVGNumber.js b/node_modules/@svgdotjs/svg.js/src/types/SVGNumber.js new file mode 100644 index 0000000..2770f67 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/types/SVGNumber.js @@ -0,0 +1,104 @@ +import { numberAndUnit } from '../modules/core/regex.js' + +// Module for unit conversions +export default class SVGNumber { + // Initialize + constructor(...args) { + this.init(...args) + } + + convert(unit) { + return new SVGNumber(this.value, unit) + } + + // Divide number + divide(number) { + number = new SVGNumber(number) + return new SVGNumber(this / number, this.unit || number.unit) + } + + init(value, unit) { + unit = Array.isArray(value) ? value[1] : unit + value = Array.isArray(value) ? value[0] : value + + // initialize defaults + this.value = 0 + this.unit = unit || '' + + // parse value + if (typeof value === 'number') { + // ensure a valid numeric value + this.value = isNaN(value) + ? 0 + : !isFinite(value) + ? value < 0 + ? -3.4e38 + : +3.4e38 + : value + } else if (typeof value === 'string') { + unit = value.match(numberAndUnit) + + if (unit) { + // make value numeric + this.value = parseFloat(unit[1]) + + // normalize + if (unit[5] === '%') { + this.value /= 100 + } else if (unit[5] === 's') { + this.value *= 1000 + } + + // store unit + this.unit = unit[5] + } + } else { + if (value instanceof SVGNumber) { + this.value = value.valueOf() + this.unit = value.unit + } + } + + return this + } + + // Subtract number + minus(number) { + number = new SVGNumber(number) + return new SVGNumber(this - number, this.unit || number.unit) + } + + // Add number + plus(number) { + number = new SVGNumber(number) + return new SVGNumber(this + number, this.unit || number.unit) + } + + // Multiply number + times(number) { + number = new SVGNumber(number) + return new SVGNumber(this * number, this.unit || number.unit) + } + + toArray() { + return [this.value, this.unit] + } + + toJSON() { + return this.toString() + } + + toString() { + return ( + (this.unit === '%' + ? ~~(this.value * 1e8) / 1e6 + : this.unit === 's' + ? this.value / 1e3 + : this.value) + this.unit + ) + } + + valueOf() { + return this.value + } +} diff --git a/node_modules/@svgdotjs/svg.js/src/utils/adopter.js b/node_modules/@svgdotjs/svg.js/src/utils/adopter.js new file mode 100644 index 0000000..962412f --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/utils/adopter.js @@ -0,0 +1,145 @@ +import { addMethodNames } from './methods.js' +import { capitalize } from './utils.js' +import { svg } from '../modules/core/namespaces.js' +import { globals } from '../utils/window.js' +import Base from '../types/Base.js' + +const elements = {} +export const root = '___SYMBOL___ROOT___' + +// Method for element creation +export function create(name, ns = svg) { + // create element + return globals.document.createElementNS(ns, name) +} + +export function makeInstance(element, isHTML = false) { + if (element instanceof Base) return element + + if (typeof element === 'object') { + return adopter(element) + } + + if (element == null) { + return new elements[root]() + } + + if (typeof element === 'string' && element.charAt(0) !== '<') { + return adopter(globals.document.querySelector(element)) + } + + // Make sure, that HTML elements are created with the correct namespace + const wrapper = isHTML ? globals.document.createElement('div') : create('svg') + wrapper.innerHTML = element + + // We can use firstChild here because we know, + // that the first char is < and thus an element + element = adopter(wrapper.firstChild) + + // make sure, that element doesn't have its wrapper attached + wrapper.removeChild(wrapper.firstChild) + return element +} + +export function nodeOrNew(name, node) { + return node && + (node instanceof globals.window.Node || + (node.ownerDocument && + node instanceof node.ownerDocument.defaultView.Node)) + ? node + : create(name) +} + +// Adopt existing svg elements +export function adopt(node) { + // check for presence of node + if (!node) return null + + // make sure a node isn't already adopted + if (node.instance instanceof Base) return node.instance + + if (node.nodeName === '#document-fragment') { + return new elements.Fragment(node) + } + + // initialize variables + let className = capitalize(node.nodeName || 'Dom') + + // Make sure that gradients are adopted correctly + if (className === 'LinearGradient' || className === 'RadialGradient') { + className = 'Gradient' + + // Fallback to Dom if element is not known + } else if (!elements[className]) { + className = 'Dom' + } + + return new elements[className](node) +} + +let adopter = adopt + +export function mockAdopt(mock = adopt) { + adopter = mock +} + +export function register(element, name = element.name, asRoot = false) { + elements[name] = element + if (asRoot) elements[root] = element + + addMethodNames(Object.getOwnPropertyNames(element.prototype)) + + return element +} + +export function getClass(name) { + return elements[name] +} + +// Element id sequence +let did = 1000 + +// Get next named element id +export function eid(name) { + return 'Svgjs' + capitalize(name) + did++ +} + +// Deep new id assignment +export function assignNewId(node) { + // do the same for SVG child nodes as well + for (let i = node.children.length - 1; i >= 0; i--) { + assignNewId(node.children[i]) + } + + if (node.id) { + node.id = eid(node.nodeName) + return node + } + + return node +} + +// Method for extending objects +export function extend(modules, methods) { + let key, i + + modules = Array.isArray(modules) ? modules : [modules] + + for (i = modules.length - 1; i >= 0; i--) { + for (key in methods) { + modules[i].prototype[key] = methods[key] + } + } +} + +export function wrapWithAttrCheck(fn) { + return function (...args) { + const o = args[args.length - 1] + + if (o && o.constructor === Object && !(o instanceof Array)) { + return fn.apply(this, args.slice(0, -1)).attr(o) + } else { + return fn.apply(this, args) + } + } +} diff --git a/node_modules/@svgdotjs/svg.js/src/utils/methods.js b/node_modules/@svgdotjs/svg.js/src/utils/methods.js new file mode 100644 index 0000000..9f61f91 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/utils/methods.js @@ -0,0 +1,33 @@ +const methods = {} +const names = [] + +export function registerMethods(name, m) { + if (Array.isArray(name)) { + for (const _name of name) { + registerMethods(_name, m) + } + return + } + + if (typeof name === 'object') { + for (const _name in name) { + registerMethods(_name, name[_name]) + } + return + } + + addMethodNames(Object.getOwnPropertyNames(m)) + methods[name] = Object.assign(methods[name] || {}, m) +} + +export function getMethodsFor(name) { + return methods[name] || {} +} + +export function getMethodNames() { + return [...new Set(names)] +} + +export function addMethodNames(_names) { + names.push(..._names) +} diff --git a/node_modules/@svgdotjs/svg.js/src/utils/pathParser.js b/node_modules/@svgdotjs/svg.js/src/utils/pathParser.js new file mode 100644 index 0000000..2b97add --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/utils/pathParser.js @@ -0,0 +1,250 @@ +import { isPathLetter } from '../modules/core/regex.js' +import Point from '../types/Point.js' + +const segmentParameters = { + M: 2, + L: 2, + H: 1, + V: 1, + C: 6, + S: 4, + Q: 4, + T: 2, + A: 7, + Z: 0 +} + +const pathHandlers = { + M: function (c, p, p0) { + p.x = p0.x = c[0] + p.y = p0.y = c[1] + + return ['M', p.x, p.y] + }, + L: function (c, p) { + p.x = c[0] + p.y = c[1] + return ['L', c[0], c[1]] + }, + H: function (c, p) { + p.x = c[0] + return ['H', c[0]] + }, + V: function (c, p) { + p.y = c[0] + return ['V', c[0]] + }, + C: function (c, p) { + p.x = c[4] + p.y = c[5] + return ['C', c[0], c[1], c[2], c[3], c[4], c[5]] + }, + S: function (c, p) { + p.x = c[2] + p.y = c[3] + return ['S', c[0], c[1], c[2], c[3]] + }, + Q: function (c, p) { + p.x = c[2] + p.y = c[3] + return ['Q', c[0], c[1], c[2], c[3]] + }, + T: function (c, p) { + p.x = c[0] + p.y = c[1] + return ['T', c[0], c[1]] + }, + Z: function (c, p, p0) { + p.x = p0.x + p.y = p0.y + return ['Z'] + }, + A: function (c, p) { + p.x = c[5] + p.y = c[6] + return ['A', c[0], c[1], c[2], c[3], c[4], c[5], c[6]] + } +} + +const mlhvqtcsaz = 'mlhvqtcsaz'.split('') + +for (let i = 0, il = mlhvqtcsaz.length; i < il; ++i) { + pathHandlers[mlhvqtcsaz[i]] = (function (i) { + return function (c, p, p0) { + if (i === 'H') c[0] = c[0] + p.x + else if (i === 'V') c[0] = c[0] + p.y + else if (i === 'A') { + c[5] = c[5] + p.x + c[6] = c[6] + p.y + } else { + for (let j = 0, jl = c.length; j < jl; ++j) { + c[j] = c[j] + (j % 2 ? p.y : p.x) + } + } + + return pathHandlers[i](c, p, p0) + } + })(mlhvqtcsaz[i].toUpperCase()) +} + +function makeAbsolut(parser) { + const command = parser.segment[0] + return pathHandlers[command](parser.segment.slice(1), parser.p, parser.p0) +} + +function segmentComplete(parser) { + return ( + parser.segment.length && + parser.segment.length - 1 === + segmentParameters[parser.segment[0].toUpperCase()] + ) +} + +function startNewSegment(parser, token) { + parser.inNumber && finalizeNumber(parser, false) + const pathLetter = isPathLetter.test(token) + + if (pathLetter) { + parser.segment = [token] + } else { + const lastCommand = parser.lastCommand + const small = lastCommand.toLowerCase() + const isSmall = lastCommand === small + parser.segment = [small === 'm' ? (isSmall ? 'l' : 'L') : lastCommand] + } + + parser.inSegment = true + parser.lastCommand = parser.segment[0] + + return pathLetter +} + +function finalizeNumber(parser, inNumber) { + if (!parser.inNumber) throw new Error('Parser Error') + parser.number && parser.segment.push(parseFloat(parser.number)) + parser.inNumber = inNumber + parser.number = '' + parser.pointSeen = false + parser.hasExponent = false + + if (segmentComplete(parser)) { + finalizeSegment(parser) + } +} + +function finalizeSegment(parser) { + parser.inSegment = false + if (parser.absolute) { + parser.segment = makeAbsolut(parser) + } + parser.segments.push(parser.segment) +} + +function isArcFlag(parser) { + if (!parser.segment.length) return false + const isArc = parser.segment[0].toUpperCase() === 'A' + const length = parser.segment.length + + return isArc && (length === 4 || length === 5) +} + +function isExponential(parser) { + return parser.lastToken.toUpperCase() === 'E' +} + +const pathDelimiters = new Set([' ', ',', '\t', '\n', '\r', '\f']) +export function pathParser(d, toAbsolute = true) { + let index = 0 + let token = '' + const parser = { + segment: [], + inNumber: false, + number: '', + lastToken: '', + inSegment: false, + segments: [], + pointSeen: false, + hasExponent: false, + absolute: toAbsolute, + p0: new Point(), + p: new Point() + } + + while (((parser.lastToken = token), (token = d.charAt(index++)))) { + if (!parser.inSegment) { + if (startNewSegment(parser, token)) { + continue + } + } + + if (token === '.') { + if (parser.pointSeen || parser.hasExponent) { + finalizeNumber(parser, false) + --index + continue + } + parser.inNumber = true + parser.pointSeen = true + parser.number += token + continue + } + + if (!isNaN(parseInt(token))) { + if (parser.number === '0' || isArcFlag(parser)) { + parser.inNumber = true + parser.number = token + finalizeNumber(parser, true) + continue + } + + parser.inNumber = true + parser.number += token + continue + } + + if (pathDelimiters.has(token)) { + if (parser.inNumber) { + finalizeNumber(parser, false) + } + continue + } + + if (token === '-' || token === '+') { + if (parser.inNumber && !isExponential(parser)) { + finalizeNumber(parser, false) + --index + continue + } + parser.number += token + parser.inNumber = true + continue + } + + if (token.toUpperCase() === 'E') { + parser.number += token + parser.hasExponent = true + continue + } + + if (isPathLetter.test(token)) { + if (parser.inNumber) { + finalizeNumber(parser, false) + } else if (!segmentComplete(parser)) { + throw new Error('parser Error') + } else { + finalizeSegment(parser) + } + --index + } + } + + if (parser.inNumber) { + finalizeNumber(parser, false) + } + + if (parser.inSegment && segmentComplete(parser)) { + finalizeSegment(parser) + } + + return parser.segments +} diff --git a/node_modules/@svgdotjs/svg.js/src/utils/utils.js b/node_modules/@svgdotjs/svg.js/src/utils/utils.js new file mode 100644 index 0000000..ab0fda0 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/utils/utils.js @@ -0,0 +1,136 @@ +// Map function +export function map(array, block) { + let i + const il = array.length + const result = [] + + for (i = 0; i < il; i++) { + result.push(block(array[i])) + } + + return result +} + +// Filter function +export function filter(array, block) { + let i + const il = array.length + const result = [] + + for (i = 0; i < il; i++) { + if (block(array[i])) { + result.push(array[i]) + } + } + + return result +} + +// Degrees to radians +export function radians(d) { + return ((d % 360) * Math.PI) / 180 +} + +// Radians to degrees +export function degrees(r) { + return ((r * 180) / Math.PI) % 360 +} + +// Convert camel cased string to dash separated +export function unCamelCase(s) { + return s.replace(/([A-Z])/g, function (m, g) { + return '-' + g.toLowerCase() + }) +} + +// Capitalize first letter of a string +export function capitalize(s) { + return s.charAt(0).toUpperCase() + s.slice(1) +} + +// Calculate proportional width and height values when necessary +export function proportionalSize(element, width, height, box) { + if (width == null || height == null) { + box = box || element.bbox() + + if (width == null) { + width = (box.width / box.height) * height + } else if (height == null) { + height = (box.height / box.width) * width + } + } + + return { + width: width, + height: height + } +} + +/** + * This function adds support for string origins. + * It searches for an origin in o.origin o.ox and o.originX. + * This way, origin: {x: 'center', y: 50} can be passed as well as ox: 'center', oy: 50 + **/ +export function getOrigin(o, element) { + const origin = o.origin + // First check if origin is in ox or originX + let ox = o.ox != null ? o.ox : o.originX != null ? o.originX : 'center' + let oy = o.oy != null ? o.oy : o.originY != null ? o.originY : 'center' + + // Then check if origin was used and overwrite in that case + if (origin != null) { + ;[ox, oy] = Array.isArray(origin) + ? origin + : typeof origin === 'object' + ? [origin.x, origin.y] + : [origin, origin] + } + + // Make sure to only call bbox when actually needed + const condX = typeof ox === 'string' + const condY = typeof oy === 'string' + if (condX || condY) { + const { height, width, x, y } = element.bbox() + + // And only overwrite if string was passed for this specific axis + if (condX) { + ox = ox.includes('left') + ? x + : ox.includes('right') + ? x + width + : x + width / 2 + } + + if (condY) { + oy = oy.includes('top') + ? y + : oy.includes('bottom') + ? y + height + : y + height / 2 + } + } + + // Return the origin as it is if it wasn't a string + return [ox, oy] +} + +const descriptiveElements = new Set(['desc', 'metadata', 'title']) +export const isDescriptive = (element) => + descriptiveElements.has(element.nodeName) + +export const writeDataToDom = (element, data, defaults = {}) => { + const cloned = { ...data } + + for (const key in cloned) { + if (cloned[key].valueOf() === defaults[key]) { + delete cloned[key] + } + } + + if (Object.keys(cloned).length) { + element.node.setAttribute('data-svgjs', JSON.stringify(cloned)) // see #428 + } else { + element.node.removeAttribute('data-svgjs') + element.node.removeAttribute('svgjs:data') + } +} diff --git a/node_modules/@svgdotjs/svg.js/src/utils/window.js b/node_modules/@svgdotjs/svg.js/src/utils/window.js new file mode 100644 index 0000000..5009c77 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/src/utils/window.js @@ -0,0 +1,32 @@ +export const globals = { + window: typeof window === 'undefined' ? null : window, + document: typeof document === 'undefined' ? null : document +} + +export function registerWindow(win = null, doc = null) { + globals.window = win + globals.document = doc +} + +const save = {} + +export function saveWindow() { + save.window = globals.window + save.document = globals.document +} + +export function restoreWindow() { + globals.window = save.window + globals.document = save.document +} + +export function withWindow(win, fn) { + saveWindow() + registerWindow(win, win.document) + fn(win, win.document) + restoreWindow() +} + +export function getWindow() { + return globals.window +} diff --git a/node_modules/@svgdotjs/svg.js/svg.js.d.ts b/node_modules/@svgdotjs/svg.js/svg.js.d.ts new file mode 100644 index 0000000..5fd0513 --- /dev/null +++ b/node_modules/@svgdotjs/svg.js/svg.js.d.ts @@ -0,0 +1,1982 @@ +// Type definitions for @svgdotjs version 3.x +// Project: @svgdotjs/svg.js + +// trick to keep reference to Array build-in type +declare class BuiltInArray extends Array {} + +// trick to have nice attribute list for CSS +declare type CSSStyleName = Exclude< + keyof CSSStyleDeclaration, + 'parentRule' | 'length' +> + +// create our own style declaration that includes css vars +interface CSSStyleDeclarationWithVars extends CSSStyleDeclaration { + [key: `--${string}`]: string +} + +declare module '@svgdotjs/svg.js' { + function SVG(): Svg + /** + * @param selectorOrHtml pass in a css selector or an html/svg string + * @param isHTML only used if first argument is an html string. Will treat the svg/html as html and not svg + */ + function SVG(selectorOrHtml: QuerySelector, isHTML?: boolean): Element + function SVG(el: T): SVGTypeMapping + function SVG(domElement: HTMLElement): Element + + function eid(name: string): string + function get(id: string): Element + + function create(name: string): any + function extend(parent: object, obj: object): void + function invent(config: object): any + function adopt(node: HTMLElement): Element + function prepare(element: HTMLElement): void + function getClass(name: string): Element + + function on( + el: Node | Window, + events: string, + cb: EventListener, + binbind?: any, + options?: AddEventListenerOptions + ): void + function on( + el: Node | Window, + events: Event[], + cb: EventListener, + binbind?: any, + options?: AddEventListenerOptions + ): void + + function off( + el: Node | Window, + events?: string, + cb?: EventListener | number, + options?: AddEventListenerOptions + ): void + function off( + el: Node | Window, + events?: Event[], + cb?: EventListener | number, + options?: AddEventListenerOptions + ): void + + function dispatch( + node: Node | Window, + event: Event, + data?: object, + options?: object + ): Event + + function find(query: QuerySelector): List + function findOne(query: QuerySelector): Element | null + + function getWindow(): Window + function registerWindow(win: Window, doc: Document): void + function restoreWindow(): void + function saveWindow(): void + function withWindow( + win: Window, + fn: (win: Window, doc: Document) => void + ): void + + let utils: { + map(array: any[], block: Function): any + filter(array: any[], block: Function): any + radians(d: number): number + degrees(r: number): number + camelCase(s: string): string + unCamelCase(s: string): string + capitalize(s: string): string + // proportionalSize + // getOrigin + } + + let defaults: { + attrs: { + 'fill-opacity': number + 'stroke-opacity': number + 'stroke-width': number + 'stroke-linejoin': string + 'stroke-linecap': string + fill: string + stroke: string + opacity: number + x: number + y: number + cx: number + cy: number + width: number + height: number + r: number + rx: number + ry: number + offset: number + 'stop-opacity': number + 'stop-color': string + 'font-size': number + 'font-family': string + 'text-anchor': string + } + timeline: { + duration: number + ease: string + delay: number + } + } + + // let easing: { + // '-'(pos: number): number; + // '<>'(pos: number): number; + // '>'(pos: number): number; + // '<'(pos: number): number; + // bezier(x1: number, y1: number, x2: number, y2: number): (t: number) => number; + // steps(steps: number, stepPosition?: "jump-start"|"jump-end"|"jump-none"|"jump-both"|"start"|"end"): (t: number, beforeFlag?: boolean) => number; + // } + + let regex: { + delimiter: RegExp + dots: RegExp + hex: RegExp + hyphen: RegExp + isBlank: RegExp + isHex: RegExp + isImage: RegExp + isNumber: RegExp + isPathLetter: RegExp + isRgb: RegExp + numberAndUnit: RegExp + numbersWithDots: RegExp + pathLetters: RegExp + reference: RegExp + rgb: RegExp + transforms: RegExp + whitespace: RegExp + } + + let namespaces: { + ns: string + xmlns: string + xlink: string + svgjs: string + } + + interface LinkedHTMLElement extends HTMLElement { + instance: Element + } + + // ************ Standard object/option/properties declaration ************ + + type AttrNumberValue = number | 'auto' + + /** + * The SVG core attributes are all the common attributes that can be specified on any SVG element. + * More information see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/Core + */ + interface CoreAttr { + id?: string + lang?: string + tabindex?: number + 'xml:lang'?: string + } + + /** + * The SVG styling attributes are all the attributes that can be specified on any SVG element to apply CSS styling effects. + * More information see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/Styling + */ + interface StylingAttr { + /** + * a valid HTML class name + */ + class?: string + /** + * SVG css style string format. It all can be find here https://www.w3.org/TR/SVG/styling.html#StyleAttribute + */ + style?: string + } + + /** + * A global attribute that can be use with any svg element + */ + interface GlobalAttr extends CoreAttr, StylingAttr {} + + // TODO: implement SVG Presentation Attributes. See https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/Presentation + + interface PathBaseAttr { + pathLength?: number + } + + interface RadiusAxisAttr { + rx?: AttrNumberValue + ry?: AttrNumberValue + } + + /** + * SVG Rectangle attribute, more information see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/rect + */ + interface RectAttr extends RadiusAxisAttr, PathBaseAttr, GlobalAttr { + x?: number + y?: number + width: AttrNumberValue + height: AttrNumberValue + } + + /** + * SVG Line attribute, more information see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/line + */ + interface LineAttr extends PathBaseAttr, GlobalAttr { + x1?: number + y1?: number + x2?: number + y2?: number + } + + /** + * SVG Circle attribute, more information see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/circle + */ + interface CircleAttr extends PathBaseAttr, GlobalAttr { + cx?: number | string + cy?: number | string + r?: number | string + } + + /** + * SVG Ellipse attribute, more information see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/ellipse + */ + interface EllipseAttr extends PathBaseAttr, GlobalAttr { + cx?: number | string + cy?: number | string + rx?: number | string + ry?: number | string + } + + /** + * SVG Path attribute, more information see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/path + */ + interface PathAttr extends PathBaseAttr, GlobalAttr { + d?: string + } + + /** + * SVG Path attribute, more information see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/polygon + * or https://developer.mozilla.org/en-US/docs/Web/SVG/Element/polyline + */ + interface PolyAttr extends PathBaseAttr, GlobalAttr { + points?: string + } + + /** + * SVG Text attribute, more information see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/text + */ + interface TextAttr extends GlobalAttr { + x?: number | string + y?: number | string + dx?: number | string + dy?: number | string + lengthAdjust?: 'spacing' | 'spacingAndGlyphs' + textLength?: number | string + // see https://developer.mozilla.org/en-US/docs/Web/API/SVGNumberList + // or https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#List-of-Ts + // TODO: tbd + // rotate?: string + } + + /** + * SVG TextPath attribute, more information see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/textPath + */ + interface TextPathAttr extends GlobalAttr { + href?: string + lengthAdjust?: 'spacing' | 'spacingAndGlyphs' + method?: 'align' | 'stretch' + side?: 'left' | 'right' + spacing?: 'auto' | 'exact' + startOffset?: number | string + textLength?: number | string + // See https://developer.mozilla.org/en-US/docs/Web/SVG/Element/textPath + // TODO: tbd as there is no reference to see the detail of how it would look like + // path?: string + } + + /** + * A generic Dom Box object. + * Notice: DOMRect is still in experiment state and document is not complete (Draft) + * See https://developer.mozilla.org/en-US/docs/Web/API/DOMRect + */ + interface DOMRect { + x?: number + y?: number + width?: number + height?: number + top?: number + right?: number + bottom?: number + left?: number + } + + // ************ SVG.JS generic Conditional Types declaration ************ + + type SVGTypeMapping = T extends HTMLElement + ? Dom + : T extends SVGSVGElement + ? Svg + : T extends SVGRectElement + ? Rect + : T extends SVGCircleElement + ? Circle + : T extends SVGPathElement + ? Path + : T extends SVGTextElement + ? Text + : T extends SVGTextPathElement + ? TextPath + : T extends SVGGElement + ? G + : T extends SVGLineElement + ? Line + : T extends SVGPolylineElement + ? Polyline + : T extends SVGPolygonElement + ? Polygon + : T extends SVGGradientElement + ? Gradient + : T extends SVGImageElement + ? Image + : T extends SVGEllipseElement + ? Ellipse + : T extends SVGMaskElement + ? Mask + : T extends SVGMarkerElement + ? Marker + : T extends SVGClipPathElement + ? ClipPath + : T extends SVGTSpanElement + ? Tspan + : T extends SVGSymbolElement + ? Symbol + : T extends SVGUseElement + ? Use + : Element + + // element type as string + type SvgType = 'svg' + type ClipPathType = 'clipPath' + type TextType = 'text' + type GType = 'g' + type AType = 'a' + + type ParentElement = SvgType | GType | AType + + type AttrTypeMapping = T extends Rect ? RectAttr : GlobalAttr + + type ElementAlias = + | Dom + | Svg + | Rect + | Line + | Polygon + | Polyline + | Ellipse + | ClipPath + | Use + | Text + | Path + | TextPath + | Circle + | G + | Gradient + | Image + | Element + + type ElementTypeAlias = + | typeof Dom + | typeof Svg + | typeof Rect + | typeof Line + | typeof Polygon + | typeof Polyline + | typeof Ellipse + | typeof ClipPath + | typeof Use + | typeof Text + | typeof Path + | typeof TextPath + | typeof Circle + | typeof G + | typeof Gradient + | typeof Image + | typeof Element + + type AttributeReference = + | 'href' + | 'marker-start' + | 'marker-mid' + | 'marker-end' + | 'mask' + | 'clip-path' + | 'filter' + | 'fill' + + // ************* SVG.JS Type Declaration ************* + // ********** Locate in directory src/types ********** + + // SVGArray.js + // Notice: below class is defined the name as `Array` rather than `SVGArray`. + // The purpose of giving the name as `Array` is to allow it to be aligned with SVG.JS export type + // as SVG.JS export it as `Array` (to be precise `SVG.Array`) so reading through JS documentation + // should be more straightforward. + /** + * Type alias to native array. + * + * **Caution**: If argument is a string, generic type must be a number or array of number and + * the string is format as a concatenate of number separate by comma. + * This is expensive to build runtime type check for such as case so please use it carefully. + */ + type ArrayAlias = BuiltInArray | T[] | string + + class Array extends BuiltInArray { + constructor(array?: ArrayAlias) + + /** + * Return array of generic T however it's flatten array by 1 level as it using `apply` function. + * For example: if T is a `number[]` which is the number of 2 dimension `Array` the result will be `number[]` + */ + toArray(): any[] + /** + * return a concatenated string of each element separated by space + */ + toString(): string + valueOf(): T[] + clone(): Array + toSet(): Set + parse(a?: ArrayAlias): T[] + to(a: any): Morphable + } + + // point.js + class Point { + x: number + y: number + constructor() + constructor(position: CoordinateXY) + constructor(point: Point) + constructor(x: number, y?: number) + clone(): Point + transform(matrix: Matrix): this + transformO(matrix: Matrix): this + toArray(): ArrayXY + } + + // pointArray.js + class PointArray extends Array { + constructor() + constructor(array?: ArrayAlias | number[]) + + toLine(): LineAttr + transform(m: Matrix | MatrixLike): PointArray + move(x: number, y: number): this + size(width: number, height: number): this + bbox(): Box + to(a: any): Morphable + toString(): string + } + + // SVGNumber.js + type NumberUnit = [number, string] + + class Number { + constructor() + constructor(value: Number) + constructor(value: string) + constructor(value: number, unit?: any) + constructor(n: NumberUnit) + + value: number + unit: any + + toString(): string + toJSON(): object // same as toString + toArray(): NumberUnit + valueOf(): number + plus(number: NumberAlias): Number + minus(number: NumberAlias): Number + times(number: NumberAlias): Number + divide(number: NumberAlias): Number + convert(unit: string): Number + to(a: any): Morphable + } + + type NumberAlias = Number | number | string + + // PathArray.js + + type LineCommand = + | ['M' | 'm' | 'L' | 'l', number, number] + | ['H' | 'h' | 'V' | 'v', number] + | ['Z' | 'z'] + + type CurveCommand = + // Bezier Curves + | ['C' | 'c', number, number, number, number, number, number] + | ['S' | 's' | 'Q' | 'q', number, number, number, number] + | ['T' | 't', number, number] + // Arcs + | ['A' | 'a', number, number, number, number, number, number, number] + + type PathCommand = LineCommand | CurveCommand + + type PathArrayAlias = PathArray | PathCommand[] | (string | number)[] | string + + class PathArray extends Array { + constructor() + constructor(d: ArrayAlias | PathArrayAlias) + + move(x: number, y: number): this + size(width: number, height: number): this + equalCommands(other: PathArray): boolean + morph(pa: PathArray): this + parse(array?: ArrayAlias | PathArrayAlias): PathCommand[] + bbox(): Box + to(a: any): Morphable + } + + // Matrix.js + interface TransformData { + origin?: number[] + scaleX?: number + scaleY?: number + shear?: number + rotate?: number + translateX?: number + translateY?: number + originX?: number + originY?: number + } + + interface MatrixLike { + a?: number + b?: number + c?: number + d?: number + e?: number + f?: number + } + + interface MatrixExtract extends TransformData, MatrixLike {} + + type FlipType = 'both' | 'x' | 'y' | boolean + type ArrayXY = [number, number] + type CoordinateXY = ArrayXY | { x: number; y: number } + + interface MatrixTransformParam { + rotate?: number + flip?: FlipType + skew?: ArrayXY | number + skewX?: number + skewY?: number + scale?: ArrayXY | number + scaleX?: number + scaleY?: number + shear?: number + theta?: number + origin?: CoordinateXY | string + around?: CoordinateXY + ox?: number + originX?: number + oy?: number + originY?: number + position?: CoordinateXY + px?: number + positionX?: number + py?: number + positionY?: number + translate?: CoordinateXY + tx?: number + translateX?: number + ty?: number + translateY?: number + relative?: CoordinateXY + rx?: number + relativeX?: number + ry?: number + relativeY?: number + } + + type MatrixAlias = + | MatrixLike + | TransformData + | MatrixTransformParam + | number[] + | Element + | string + + class Matrix implements MatrixLike { + constructor() + constructor(source: MatrixAlias) + constructor( + a: number, + b: number, + c: number, + d: number, + e: number, + f: number + ) + + a: number + b: number + c: number + d: number + e: number + f: number; + + // *** To Be use by Test Only in restrict mode *** + [key: string]: any + + clone(): Matrix + transform(o: MatrixLike | MatrixTransformParam): Matrix + compose(o: MatrixExtract): Matrix + decompose(cx?: number, cy?: number): MatrixExtract + multiply(m: MatrixAlias | Matrix): Matrix + multiplyO(m: MatrixAlias | Matrix): this + lmultiply(m: MatrixAlias | Matrix): Matrix + lmultiplyO(m: MatrixAlias | Matrix): this + inverse(): Matrix + inverseO(): this + translate(x?: number, y?: number): Matrix + translateO(x?: number, y?: number): this + scale(x: number, y?: number, cx?: number, cy?: number): Matrix + scaleO(x: number, y?: number, cx?: number, cy?: number): this + rotate(r: number, cx?: number, cy?: number): Matrix + rotateO(r: number, cx?: number, cy?: number): this + flip(a: NumberAlias, offset?: number): Matrix + flipO(a: NumberAlias, offset?: number): this + flip(offset?: number): Matrix + shear(a: number, cx?: number, cy?: number): Matrix + shearO(a: number, cx?: number, cy?: number): this + skew(y?: number, cx?: number, cy?: number): Matrix + skewO(y?: number, cx?: number, cy?: number): this + skew(x: number, y?: number, cx?: number, cy?: number): Matrix + skewX(x: number, cx?: number, cy?: number): Matrix + skewY(y: number, cx?: number, cy?: number): Matrix + around(cx?: number, cy?: number, matrix?: Matrix): Matrix + aroundO(cx?: number, cy?: number, matrix?: Matrix): this + equals(m: Matrix): boolean + toString(): string + toArray(): number[] + valueOf(): MatrixLike + to(a: any): Morphable + } + + type ListEachCallback = (el: T, index: number, list: List) => any + + // List.js + class List extends BuiltInArray { + each(fn: ListEachCallback): List + each(name: string, ...args: any[]): List + toArray(): T[] + } + + class Eventobject { + [key: string]: Eventobject + } + + // EventTarget.js + class EventTarget { + events: Eventobject + + addEventListener(): void + dispatch(event: Event | string, data?: object): Event + dispatchEvent(event: Event): boolean + fire(event: Event | string, data?: object): this + getEventHolder(): this | Node + getEventTarget(): this | Node + + on( + events: string | Event[], + cb: EventListener, + binbind?: any, + options?: AddEventListenerOptions + ): this + off( + events?: string | Event[], + cb?: EventListener | number, + options?: AddEventListenerOptions + ): this + + removeEventListener(): void + } + + // Color.js + interface ColorLike { + r: number + g: number + b: number + + x: number + y: number + z: number + + h: number + s: number + l: number + a: number + c: number + + m: number + k: number + + space: string + } + + type ColorAlias = string | ColorLike + + class Color implements ColorLike { + r: number + g: number + b: number + + x: number + y: number + z: number + + h: number + s: number + l: number + a: number + c: number + + m: number + k: number + + space: string + constructor() + constructor(color: ColorAlias, space?: string) + constructor(a: number, b: number, c: number, space?: string) + constructor(a: number, b: number, c: number, d: number, space?: string) + constructor(a: number[], space?: string) + + rgb(): Color + lab(): Color + xyz(): Color + lch(): Color + hsl(): Color + cmyk(): Color + toHex(): string + toString(): string + toRgb(): string + toArray(): any[] + + to(a: any): Morphable + fromArray(a: any): this + + static random(mode: 'sine', time?: number): Color + static random(mode?: string): Color + } + + // Box.js + interface BoxLike { + height: number + width: number + y: number + x: number + cx?: number + cy?: number + w?: number + h?: number + x2?: number + y2?: number + } + + class Box implements BoxLike { + height: number + width: number + y: number + x: number + cx: number + cy: number + w: number + h: number + x2: number + y2: number + + constructor() + constructor(source: string) + constructor(source: number[]) + constructor(source: DOMRect) + constructor(x: number, y: number, width: number, height: number) + + merge(box: BoxLike): Box + transform(m: Matrix): Box + addOffset(): this + toString(): string + toArray(): number[] + isNulled(): boolean + to(v: MorphValueLike): Morphable + } + + // Morphable.js + type MorphValueLike = + | string + | number + | objectBag + | NonMorphable + | MatrixExtract + | Array + | any[] + + class Morphable { + constructor() + constructor(st: Stepper) + + from(): MorphValueLike + from(v: MorphValueLike): this + to(): MorphValueLike + to(v: MorphValueLike): this + type(): any + type(t: any): this + stepper(): Stepper + stepper(st: Stepper): this + done(): boolean + at(pos: number): any + } + + class objectBag { + constructor() + constructor(a: object) + valueOf(): object + toArray(): object[] + + to(a: object): Morphable + fromArray(a: any[]): this + } + + class NonMorphable { + constructor(a: object) + valueOf(): object + toArray(): object[] + + to(a: object): Morphable + fromArray(a: object): this + } + + class TransformBag { + constructor() + constructor(a: number[]) + constructor(a: TransformData) + defaults: TransformData + toArray(): number[] + to(t: TransformData): Morphable + fromArray(t: number[]): this + } + + interface Stepper { + done(c?: object): boolean + } + + class Ease implements Stepper { + constructor() + constructor(fn: string) + constructor(fn: Function) + + step(from: number, to: number, pos: number): number + done(): boolean + } + + class Controller implements Stepper { + constructor(fn?: Function) + step(current: number, target: number, dt: number, c: number): number + done(c?: object): boolean + } + + // Queue.js + interface QueueParam { + value: any + next?: any + prev?: any + } + + class Queue { + constructor() + + push(value: any): QueueParam + shift(): any + first(): number + last(): number + remove(item: QueueParam): void + } + + // Timeline.js + interface ScheduledRunnerInfo { + start: number + duration: number + end: number + runner: Runner + } + + class Timeline extends EventTarget { + constructor() + constructor(fn: Function) + + active(): boolean + schedule(runner: Runner, delay?: number, when?: string): this + schedule(): ScheduledRunnerInfo[] + unschedule(runner: Runner): this + getEndTime(): number + updateTime(): this + persist(dtOrForever?: number | boolean): this + play(): this + pause(): this + stop(): this + finish(): this + speed(speed: number): this + reverse(yes: boolean): this + seek(dt: number): this + time(): number + time(time: number): this + source(): Function + source(fn: Function): this + } + + // Runner.js + interface TimesParam { + duration: number + delay: number + when: number | string + swing: boolean + wait: number + times: number + } + + type TimeLike = number | TimesParam | Stepper + + type EasingCallback = (...any: any) => number + type EasingLiteral = '<>' | '-' | '<' | '>' + + class Runner { + constructor() + constructor(options: Function) + constructor(options: number) + constructor(options: Controller) + + static sanitise: ( + duration?: TimeLike, + delay?: number, + when?: string + ) => object + + element(): Element + element(el: Element): this + timeline(): Timeline + timeline(timeline: Timeline): this + animate(duration?: TimeLike, delay?: number, when?: string): this + schedule(delay: number, when?: string): this + schedule(timeline: Timeline, delay?: number, when?: string): this + unschedule(): this + loop(times?: number, swing?: boolean, wait?: number): this + loop(times: TimesParam): this + delay(delay: number): this + + during(fn: Function): this + queue( + initFn: Function, + runFn: Function, + retargetFn?: boolean | Function, + isTransform?: boolean + ): this + after(fn: EventListener): this + time(): number + time(time: number): this + duration(): number + loops(): number + loops(p: number): this + persist(dtOrForever?: number | boolean): this + position(): number + position(p: number): this + progress(): number + progress(p: number): this + step(deta?: number): this + reset(): this + finish(): this + reverse(r?: boolean): this + ease(fn: EasingCallback): this + ease(kind: EasingLiteral): this + active(): boolean + active(a: boolean): this + addTransform(m: Matrix): this + clearTransform(): this + clearTransformsFromQueue(): void + + // extends prototypes + attr(a: string | object, v?: string): this + css(s: string | object, v?: string): this + styleAttr(type: string, name: string | object, val?: string): this + zoom(level: NumberAlias, point?: Point): this + transform( + transforms: MatrixTransformParam, + relative?: boolean, + affine?: boolean + ): this + x(x: number): this + y(y: number): this + ax(x: number): this + ay(y: number): this + dx(dx: number): this + dy(dy: number): this + cx(x: number): this + cy(y: number): this + dmove(dx: number, dy: number): this + move(x: number, y: number): this + amove(x: number, y: number): this + center(x: number, y: number): this + size(width: number, height: number): this + width(width: number): this + height(height: number): this + plot(a: object): this + plot(a: number, b: number, c: number, d: number): this + leading(value: number): this + viewbox(x: number, y: number, width: number, height: number): this + update(offset: number, color: number, opacity: number): this + update(o: StopProperties): this + rx(): number + rx(rx: number): this + ry(): number + ry(ry: number): this + from(x: NumberAlias, y: NumberAlias): this + to(x: NumberAlias, y: NumberAlias): this + + fill(): string + fill(fill: FillData): this + fill(color: string): this + fill(pattern: Element): this + fill(image: Image): this + stroke(): string + stroke(stroke: StrokeData): this + stroke(color: string): this + matrix(): Matrix + matrix( + a: number, + b: number, + c: number, + d: number, + e: number, + f: number + ): this + matrix(mat: MatrixAlias): this + rotate(degrees: number, cx?: number, cy?: number): this + skew(skewX?: number, skewY?: number, cx?: number, cy?: number): this + scale(scaleX?: number, scaleY?: number, cx?: number, cy?: number): this + translate(x: number, y: number): this + shear(lam: number, cx: number, cy: number): this + relative(x: number, y: number): this + flip(direction?: string, around?: number): this + flip(around: number): this + opacity(): number + opacity(value: number): this + font(a: string): string + font(a: string, v: string | number): this + font(a: object): this + } + + // Animator.js + let Animator: { + nextDraw: any + frames: Queue + timeouts: Queue + immediates: Queue + + timer(): boolean + frame(fn: Function): object + timeout(fn: Function, delay?: number): object + immediate(fn: Function): object + cancelFrame(o: object): void + clearTimeout(o: object): void + cancelImmediate(o: object): void + } + + /** + * Just fancy type alias to refer to css query selector. + */ + type QuerySelector = string + + class Dom extends EventTarget { + node: HTMLElement | SVGElement + type: string + + constructor(node?: HTMLElement, attr?: object) + constructor(att: object) + add(element: Element, i?: number): this + addTo(parent: Dom | HTMLElement | string, i?: number): this + children(): List + clear(): this + clone(deep?: boolean, assignNewIds?: boolean): this + each( + block: (index: number, children: Element[]) => void, + deep?: boolean + ): this + element(element: string, inherit?: object): this + first(): Element + get(i: number): Element + getEventHolder(): LinkedHTMLElement + getEventTarget(): LinkedHTMLElement + has(element: Element): boolean + id(): string + id(id: string): this + index(element: Element): number + last(): Element + matches(selector: string): boolean + /** + * Finds the closest ancestor which matches the string or is of passed type. If nothing is passed, the parent is returned + * @param type can be either string, svg.js object or undefined. + */ + parent(type?: ElementTypeAlias | QuerySelector): Dom | null + put(element: Element, i?: number): Element + /** + * Put the element into the given parent element and returns the parent element + * @param parent The parent in which the current element is inserted + */ + putIn(parent: ElementAlias | Node | QuerySelector): Dom + + remove(): this + removeElement(element: Element): this + replace(element: T): T + round(precision?: number, map?: string[]): this + svg(): string + svg(a: string, outer: true): Element + svg(a: string, outer?: false): this + svg(a: boolean, outer?: boolean): string + svg(a: null | Function, outer?: boolean): string + + toString(): string + words(text: string): this + writeDataToDom(): this + + // prototype extend Attribute in attr.js + /** + * Get the attribute object of SVG Element. The return object will be vary based on + * the instance itself. For example, G element will only return GlobalAttr where Rect + * will return RectAttr instead. + */ + attr(): any + /** + * Add or update the attribute from the SVG Element. To remove the attribute from the element set value to null + * @param name name of attribute + * @param value value of attribute can be string or number or null + * @param namespace optional string that define namespace + */ + attr(name: string, value: any, namespace?: string): this + attr(name: string): any + attr(obj: object): this + attr(obj: string[]): object + + // prototype extend Selector in selector.js + find(query: string): List + findOne(query: string): Dom | null + + // prototype method register in data.js + data(a: string): object | string | number + data(a: string, v: object, substain?: boolean): this + data(a: object): this + + // prototype method register in arrange.js + siblings(): List + position(): number + next(): Element + prev(): Element + forward(): this + backward(): this + front(): this + back(): this + before(el: Element): Element + after(el: Element): Element + insertBefore(el: Element): this + insertAfter(el: Element): this + + // prototype method register in class.js + classes(): string[] + hasClass(name: string): boolean + addClass(name: string): this + removeClass(name: string): this + toggleClass(name: string): this + + // prototype method register in css.js + css(): Partial + css(style: T): CSSStyleDeclarationWithVars[T] + css( + style: T + ): Partial + css( + style: T, + val: CSSStyleDeclarationWithVars[T] + ): this + css(style: Partial): this + show(): this + hide(): this + visible(): boolean + + // memory.js + remember(name: string, value: any): this + remember(name: string): any + remember(obj: object): this + forget(...keys: string[]): this + forget(): this + memory(): object + + addEventListener(): void + dispatch(event: Event | string, data?: object): Event + dispatchEvent(event: Event): boolean + fire(event: Event | string, data?: object): this + getEventHolder(): this | Node + getEventTarget(): this | Node + + // on(events: string | Event[], cb: EventListener, binbind?: any, options?: AddEventListenerOptions): this; + // off(events?: string | Event[], cb?: EventListener | number): this; + removeEventListener(): void + } + + // clip.js + class ClipPath extends Container { + constructor() + constructor(node?: SVGClipPathElement) + constructor(attr: object) + node: SVGClipPathElement + + targets(): List + remove(): this + } + + // container.js + interface ViewBoxLike { + x: number + y: number + width: number + height: number + } + + class Containable { + circle(size?: NumberAlias): Circle + clip(): ClipPath + ellipse(width?: number, height?: number): Ellipse + foreignObject(width: number, height: number): ForeignObject + gradient(type: string, block?: (stop: Gradient) => void): Gradient + group(): G + + image(): Image + image(href?: string, callback?: (e: Event) => void): Image + line(points?: PointArrayAlias): Line + line(x1: number, y1: number, x2: number, y2: number): Line + link(url: string): A + marker( + width?: number, + height?: number, + block?: (marker: Marker) => void + ): Marker + mask(): Mask + nested(): Svg + path(): Path + path(d: PathArrayAlias): Path + pattern( + width?: number, + height?: number, + block?: (pattern: Pattern) => void + ): Pattern + plain(text: string): Text + polygon(points?: PointArrayAlias): Polygon + polyline(points?: PointArrayAlias): Polyline + rect(width?: NumberAlias, height?: NumberAlias): Rect + style(): Style + text(block: (tspan: Tspan) => void): Text + text(text: string): Text + use(element: Element | string, file?: string): Use + viewbox(): Box + viewbox(viewbox: ViewBoxLike | string): this + viewbox(x: number, y: number, width: number, height: number): this + textPath(text: string | Text, path: string | Path): TextPath + symbol(): Symbol + zoom(): number + zoom(level: NumberAlias, point?: Point): this + } + + type DynamicExtends = { + new (...args: any[]): Containable & T + } + + /** + * only for declaration purpose. actually cannot be used. + */ + let ContainableDom: DynamicExtends + class Fragment extends ContainableDom { + constructor(node?: Node) + } + + /** + * only for declaration purpose. actually cannot be used. + */ + let ContainableElement: DynamicExtends + class Container extends ContainableElement { + constructor() + flatten(parent: Dom, depth?: number): this + ungroup(parent: Dom, depth?: number): this + } + + class Defs extends Container { + constructor(node?: SVGDefsElement) + node: SVGDefsElement + marker( + width?: number, + height?: number, + block?: (marker: Marker) => void + ): Marker + } + + class Svg extends Container { + constructor(svgElement?: SVGSVGElement) + constructor(id: string) + node: SVGSVGElement + namespace(): this + defs(): Defs + remove(): this + isRoot(): boolean + } + + type EventHandler = (event: T) => void + + interface Sugar { + fill(): string + fill(fill: FillData): this + fill(color: string): this + fill(pattern: Element): this + fill(image: Image): this + stroke(): string + stroke(stroke: StrokeData): this + stroke(color: string): this + matrix(): Matrix + matrix( + a: number, + b: number, + c: number, + d: number, + e: number, + f: number + ): this + matrix(mat: MatrixAlias): this + rotate(degrees: number, cx?: number, cy?: number): this + skew(skewX?: number, skewY?: number, cx?: number, cy?: number): this + scale(scaleX?: number, scaleY?: number, cx?: number, cy?: number): this + translate(x: number, y: number): this + shear(lam: number, cx: number, cy: number): this + relative(x: number, y: number): this + flip(direction?: string, around?: number): this + flip(around: number): this + opacity(): number + opacity(value: number): this + font(a: string): string + font(a: string, v: string | number): this + font(a: object): this + + click(cb: EventHandler): this + dblclick(cb: EventHandler): this + mousedown(cb: EventHandler): this + mouseup(cb: EventHandler): this + mouseover(cb: EventHandler): this + mouseout(cb: EventHandler): this + mousemove(cb: EventHandler): this + mouseenter(cb: EventHandler): this + mouseleave(cb: EventHandler): this + touchstart(cb: EventHandler): this + touchmove(cb: EventHandler): this + touchleave(cb: EventHandler): this + touchend(cb: EventHandler): this + touchcancel(cb: EventHandler): this + contextmenu(cb: EventHandler): this + wheel(cb: EventHandler): this + pointerdown(cb: EventHandler): this + pointermove(cb: EventHandler): this + pointerup(cb: EventHandler): this + pointerleave(cb: EventHandler): this + pointercancel(cb: EventHandler): this + } + + // Symbol.js + class Symbol extends Container { + constructor(svgElement?: SVGSymbolElement) + constructor(attr: object) + node: SVGSymbolElement + } + + class Element extends Dom implements Sugar { + constructor(node?: SVGElement) + constructor(attr: object) + node: SVGElement + type: string + dom: any + + addClass(name: string): this + after(element: Element): Element + animate(duration?: TimeLike, delay?: number, when?: string): Runner + delay(by: number, when?: string): Runner + attr(): any + attr(name: string, value: any, namespace?: string): this + attr(name: string): any + attr(obj: string[]): object + attr(obj: object): this + back(): this + backward(): this + bbox(): Box + before(element: Element): Element + center(x: number, y: number): this + classes(): string[] + clipper(): ClipPath + clipWith(element: Element): this + clone(deep?: boolean, assignNewIds?: boolean): this + ctm(): Matrix + cx(): number + cx(x: number): this + cy(): number + cy(y: number): this + data(name: string, value: any, sustain?: boolean): this + data(name: string): any + data(val: object): this + defs(): Defs + dmove(x: NumberAlias, y: NumberAlias): this + dx(x: NumberAlias): this + dy(y: NumberAlias): this + event(): Event | CustomEvent + + fire(event: Event): this + fire(event: string, data?: any): this + forget(...keys: string[]): this + forget(): this + forward(): this + front(): this + hasClass(name: string): boolean + height(): NumberAlias + height(height: NumberAlias): this + hide(): this + hide(): this + id(): string + id(id: string): this + inside(x: number, y: number): boolean + is(cls: any): boolean + linkTo(url: (link: A) => void): A + linkTo(url: string): A + masker(): Mask + maskWith(element: Element): this + maskWith(mask: Mask): this + matches(selector: string): boolean + matrixify(): Matrix + memory(): object + move(x: NumberAlias, y: NumberAlias): this + native(): LinkedHTMLElement + next(): Element + // off(events?: string | Event[], cb?: EventListener | number): this; + // on(event: string, cb: Function, context?: object): this; + toRoot(): Svg + /** + * By default parents will return a list of elements up until the root svg. + */ + parents(): List + /** + * List the parent by hierarchy until the given parent type or matcher. If the given value is null + * then the result is only provided the list up until Svg root element which mean no Dom parent element is included. + * @param util a parent type + */ + parents(util: QuerySelector | T | null): List + /** + * Get reference svg element based on the given attribute. + * @param attr a svg attribute + */ + reference(attr: AttributeReference): R | null + + point(): Point + point(position: CoordinateXY): Point + point(point: Point): Point + point(x: number, y: number): Point + position(): number + prev(): Element + rbox(element?: Element): Box + reference(type: string): Element + remember(name: string, value: any): this + remember(name: string): any + remember(obj: object): this + remove(): this + removeClass(name: string): this + root(): Svg + screenCTM(): Matrix + setData(data: object): this + show(): this + show(): this + size(width?: NumberAlias, height?: NumberAlias): this + stop(jumpToEnd: boolean, clearQueue: boolean): Animation + stop( + offset?: NumberAlias | string, + color?: NumberAlias, + opacity?: NumberAlias + ): Stop + stop(val: { + offset?: NumberAlias | string + color?: NumberAlias + opacity?: NumberAlias + }): Stop + timeline(): Timeline + timeline(tl: Timeline): this + toggleClass(name: string): this + toParent(parent: Dom): this + toParent(parent: Dom, i: number): this + toSvg(): this + transform(): MatrixExtract + transform(t: MatrixAlias, relative?: boolean): this + unclip(): this + unmask(): this + untransform(): this + visible(): boolean + width(): NumberAlias + width(width: NumberAlias): this + x(): NumberAlias + x(x: NumberAlias): this + y(): NumberAlias + y(y: NumberAlias): this + + fill(): string + fill(fill: FillData): this + fill(color: string): this + fill(pattern: Element): this + fill(image: Image): this + stroke(): string + stroke(stroke: StrokeData): this + stroke(color: string): this + matrix(): Matrix + matrix( + a: number, + b: number, + c: number, + d: number, + e: number, + f: number + ): this + matrix(mat: MatrixAlias): this + rotate(degrees: number, cx?: number, cy?: number): this + skew(skewX?: number, skewY?: number, cx?: number, cy?: number): this + scale(scaleX?: number, scaleY?: number, cx?: number, cy?: number): this + translate(x: number, y: number): this + shear(lam: number, cx: number, cy: number): this + relative(x: number, y: number): this + flip(direction?: string, around?: number): this + flip(around: number): this + opacity(): number + opacity(value: number): this + font(a: string): string + font(a: string, v: string | number): this + font(a: object): this + + click(cb: EventHandler): this + dblclick(cb: EventHandler): this + mousedown(cb: EventHandler): this + mouseup(cb: EventHandler): this + mouseover(cb: EventHandler): this + mouseout(cb: EventHandler): this + mousemove(cb: EventHandler): this + mouseenter(cb: EventHandler): this + mouseleave(cb: EventHandler): this + touchstart(cb: EventHandler): this + touchmove(cb: EventHandler): this + touchleave(cb: EventHandler): this + touchend(cb: EventHandler): this + touchcancel(cb: EventHandler): this + contextmenu(cb: EventHandler): this + wheel(cb: EventHandler): this + pointerdown(cb: EventHandler): this + pointermove(cb: EventHandler): this + pointerup(cb: EventHandler): this + pointerleave(cb: EventHandler): this + pointercancel(cb: EventHandler): this + } + + // ellipse.js + interface CircleMethods extends Shape { + rx(rx: number): this + rx(): this + ry(ry: number): this + ry(): this + radius(x: number, y?: number): this + } + class Circle extends Shape implements CircleMethods { + constructor(node?: SVGCircleElement) + constructor(attr: CircleAttr) + + node: SVGCircleElement + + rx(rx: number): this + rx(): this + ry(ry: number): this + ry(): this + radius(x: number, y?: number): this + } + class Ellipse extends Shape implements CircleMethods { + node: SVGEllipseElement + constructor(attr: EllipseAttr) + constructor(node?: SVGEllipseElement) + + rx(rx: number): this + rx(): this + ry(ry: number): this + ry(): this + radius(x: number, y?: number): this + } + + interface StopProperties { + color?: ColorAlias + offset?: number | string + opacity?: number + } + + // gradient.js + class Stop extends Element { + update(offset?: number, color?: ColorAlias, opacity?: number): this + update(opts: StopProperties): this + } + class Gradient extends Container { + constructor(node?: SVGGradientElement) + constructor(attr: object) + constructor(type: string) + node: SVGGradientElement + + at(offset?: number, color?: ColorAlias, opacity?: number): Stop + at(opts: StopProperties): Stop + url(): string + toString(): string + targets(): List + bbox(): Box + + // gradiented.js + from(x: number, y: number): this + to(x: number, y: number): this + + // TODO: check with main.js + radius(x: number, y?: number): this + targets(): List + bbox(): Box + update(block?: (gradient: Gradient) => void): this + } + + // group.js + class G extends Container { + constructor(node?: SVGGElement) + constructor(attr: object) + node: SVGGElement + gbox(): Box + } + + // hyperlink.js + class A extends Container { + constructor(node?: SVGAElement) + constructor(attr: object) + node: SVGAElement + to(url: string): this + to(): string + target(target: string): this + target(): string + } + + // ForeignObject.js + class ForeignObject extends Element { + constructor(node?: SVGForeignObjectElement, attrs?: object) + constructor(attrs?: object) + add(element: Dom, i?: number): this + } + + // image.js + class Image extends Shape { + constructor(node?: SVGImageElement) + constructor(attr: object) + node: SVGImageElement + load(url?: string, callback?: (event: Event) => void): this + } + + // line.js + type PointArrayAlias = number[] | ArrayXY[] | PointArray | string + + class Line extends Shape { + constructor(attr: LineAttr) + constructor(node?: SVGLineElement) + + node: SVGLineElement + + array(): PointArray + plot(): PointArray + plot(points?: PointArrayAlias): this + plot(x1: number, y1: number, x2: number, y2: number): this + move(x: number, y: number): this + size(width?: number, height?: number): this + marker( + position: string, + width?: number, + height?: number, + block?: (marker: Marker) => void + ): Marker + marker(position: string, marker: Marker): Marker + } + + // marker.js + // TODO: check register method marker + class Marker extends Container { + constructor() + + node: SVGMarkerElement + + ref(x: string | number, y: string | number): this + update(block: (marker: Marker) => void): this + toString(): string + orient(orientation: 'auto' | 'auto-start-reverse' | number | Number): this + orient(): string + } + // mask.js + class Mask extends Container { + constructor(node?: SVGMaskElement) + constructor(attr: object) + node: SVGMaskElement + remove(): this + targets(): List + } + + // path.js + class Path extends Shape { + constructor(attr: PathAttr) + constructor(node?: SVGPathElement) + + node: SVGPathElement + + morphArray: PathArray + array(): PathArray + plot(): PathArray + plot(d: PathArrayAlias): this + marker( + position: string, + width?: number, + height?: number, + block?: (marker: Marker) => void + ): this + marker(position: string, marker: Marker): this + + // sugar.js + length(): number + pointAt(length: number): { x: number; y: number } + text(text: string): TextPath + text(text: Text): TextPath + targets(): List + } + + // pattern.js + class Pattern extends Container { + url(): string + url(...rest: any[]): never + update(block: (pattern: Pattern) => void): this + toString(): string + } + + // poly.js + interface poly { + array(): PointArray + plot(): PointArray + plot(p: PointArrayAlias): this + clear(): this + move(x: number, y: number): this + size(width: number, height?: number): this + } + + // pointed.js + interface pointed { + x(): number + x(x: number): this + y(): number + y(y: number): this + height(): number + height(h: number): this + width(): number + width(w: number): this + } + + class Polyline extends Shape implements poly, pointed { + constructor(node?: SVGPolylineElement) + constructor(attr: PolyAttr) + + node: SVGPolylineElement + + array(): PointArray + plot(): PointArray + plot(p: PointArrayAlias): this + x(): number + x(x: number): this + y(): number + y(y: number): this + height(): number + height(h: number): this + width(): number + width(w: number): this + move(x: number, y: number): this + size(width: number, height?: number): this + marker( + position: string, + width?: number, + height?: number, + block?: (marker: Marker) => void + ): Marker + marker(position: string, marker: Marker): Marker + } + + class Polygon extends Shape implements poly, pointed { + constructor(node?: SVGPolygonElement) + constructor(attr: PolyAttr) + + node: SVGPolygonElement + array(): PointArray + plot(): PointArray + plot(p: PointArrayAlias): this + x(): number + x(x: number): this + y(): number + y(y: number): this + height(): number + height(h: number): this + width(): number + width(w: number): this + move(x: number, y: number): this + size(width: number, height?: number): this + marker( + position: string, + width?: number, + height?: number, + block?: (marker: Marker) => void + ): Marker + marker(position: string, marker: Marker): Marker + } + + class Rect extends Shape { + constructor(node?: SVGRectElement) + constructor(attr: RectAttr) + node: SVGRectElement + radius(x: number, y?: number): this + } + + // shape.js + class Shape extends Element {} + + // sugar.js + interface StrokeData { + color?: string + width?: number + opacity?: number + linecap?: string + linejoin?: string + miterlimit?: number + dasharray?: string + dashoffset?: number + } + + interface FillData { + color?: string + opacity?: number + rule?: string + } + + interface FontData { + family?: string + size?: NumberAlias + anchor?: string + leading?: NumberAlias + weight?: string + style?: string + } + // textable.js + interface Textable { + plain(text: string): this + length(): number + } + + // text.js + class Text extends Shape implements Textable { + constructor(node?: SVGElement) + constructor(attr: TextAttr) + + clone(): this + text(): string + text(text: string): this + text(block: (text: this) => void): this + leading(): Number + leading(leading: NumberAlias): this + rebuild(enabled: boolean): this + build(enabled: boolean): this + clear(): this + plain(text: string): this + length(): number + get(i: number): Tspan + path(): TextPath + path(d: PathArrayAlias | Path): TextPath + track(): Element + ax(): string + ax(x: string): this + ay(): string + ay(y: string): this + amove(x: number, y: number): this + textPath(): TextPath + + // main.js, from extend/copy prototypes from Tspan + tspan(text: string): Tspan + tspan(block: (tspan: Tspan) => void): this + } + + class Tspan extends Text implements Textable { + constructor(node?: SVGElement) + constructor(attr: TextAttr) + dx(): number + dx(x: NumberAlias): this + dy(): number + dy(y: NumberAlias): this + newLine(): this + tspan(text: string): Tspan + tspan(block: (tspan: Tspan) => void): this + length(): number + text(): string + text(text: string): this + text(block: (text: this) => void): this + plain(text: string): this + } + + // textpath.js + class TextPath extends Text { + constructor() + constructor(attr: TextPathAttr) + + array(): Array + plot(): PathArray + plot(d: string): this + track(): Path + } + + // style.js + class Style extends Element { + constructor(node: SVGElement, attr?: StylingAttr) + addText(text: string): this + font(a: object): this + font(a: string, v: string | number): this + font(a: string): string + rule(selector: string, obj: any): this + } + + // use.js + class Use extends Shape { + use(element: string, file?: string): this + } + + // viewbox.js + type ViewBoxAlias = ViewBoxLike | number[] | string | Element + + interface ViewBox { + x: number + y: number + width: number + height: number + toString(): string + at(pos: number): ViewBox + } +} diff --git a/node_modules/@svgdotjs/svg.resize.js/LICENSE b/node_modules/@svgdotjs/svg.resize.js/LICENSE new file mode 100644 index 0000000..0bf6940 --- /dev/null +++ b/node_modules/@svgdotjs/svg.resize.js/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2017 Ulrich-Matthias Schäfer + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/node_modules/@svgdotjs/svg.resize.js/README.md b/node_modules/@svgdotjs/svg.resize.js/README.md new file mode 100644 index 0000000..4e263b3 --- /dev/null +++ b/node_modules/@svgdotjs/svg.resize.js/README.md @@ -0,0 +1,89 @@ +# svg.resize.js + +An extension of [svg.js](https://github.com/svgdotjs/svg.js) which allows to resize elements which are selected with [svg.select.js](https://github.com/svgdotjs/svg.select.js) + +# Demo + +For a demo see http://svgdotjs.github.io/svg.resize.js/ + +# Get Started + +Install `svg.js`, `svg.select.js` and `svg.resize.js` using npm: + +```bash +npm i @svgdotjs/svg.js @svgdotjs/svg.select.js @svgdotjs/svg.resize.js +``` + +Or get it from a cnd: + +```html + + + + + +``` + +Select and resize a rectangle using this simple piece of code: + +```ts +var canvas = new SVG().addTo('body').size(500, 500) +canvas.rect(50, 50).fill('red').select().resize() +``` + +# Usage + +Activate resizing + +```ts +rect.select().resize() +``` + +Deactivate resizing + +```ts +rect.resize(false) +``` + +Preserve aspect ratio, resize around center and snap to grid: + +```ts +rect.resize({ preserveAspectRatio: true, aroundCenter: true, grid: 10, degree: 0.1 }) +``` + +# Options + +- `preserveAspectRatio`: Preserve the aspect ratio of the element while resizing +- `aroundCenter`: Resize around the center of the element +- `grid`: Snaps the shape to a virtual grid while resizing +- `degree`: Snaps to an angle when rotating + +# Events + +While resizing, a `resize` event is fired. It contains the following properties (in `event.detail`): + +- `box`: The resulting bounding box after the resize operation +- `angle`: The resulting rotation angle after the resize operation +- `eventType`: The type of resize operation (the event fired by the select plugin) +- `event`: The original event +- `handler`: The resize handler + +```ts +rect.on('resize', (event) => { + console.log(event.detail) +}) +``` + +# Contributing + +```bash +git clone https://github.com/svgdotjs/svg.resize.js.git +cd svg.resize.js +npm install +npm run dev +``` + +# Migration from svg.js v2 + +- The option naming changed a bit. Please double check +- The former events were removed. The resize event now serves the same purpose diff --git a/node_modules/@svgdotjs/svg.resize.js/dist/svg.resize.css b/node_modules/@svgdotjs/svg.resize.js/dist/svg.resize.css new file mode 100644 index 0000000..23270a4 --- /dev/null +++ b/node_modules/@svgdotjs/svg.resize.js/dist/svg.resize.css @@ -0,0 +1 @@ +.svg_select_shape{stroke-width:1;stroke-dasharray:10 10;stroke:#000;stroke-opacity:.1;pointer-events:none;fill:none}.svg_select_shape_pointSelect{stroke-width:1;fill:none;stroke-dasharray:10 10;stroke:#000;stroke-opacity:.8;pointer-events:none}.svg_select_handle{stroke-width:3;stroke:#000;fill:none}.svg_select_handle_rot{fill:#fff;stroke:#000;stroke-width:1;cursor:move}.svg_select_handle_lt{cursor:nw-resize}.svg_select_handle_rt{cursor:ne-resize}.svg_select_handle_rb{cursor:se-resize}.svg_select_handle_lb{cursor:sw-resize}.svg_select_handle_t{cursor:n-resize}.svg_select_handle_r{cursor:e-resize}.svg_select_handle_b{cursor:s-resize}.svg_select_handle_l{cursor:w-resize}.svg_select_handle_point{stroke:#000;stroke-width:1;cursor:move;fill:#fff} diff --git a/node_modules/@svgdotjs/svg.resize.js/dist/svg.resize.iife.js b/node_modules/@svgdotjs/svg.resize.js/dist/svg.resize.iife.js new file mode 100644 index 0000000..e7de103 --- /dev/null +++ b/node_modules/@svgdotjs/svg.resize.js/dist/svg.resize.iife.js @@ -0,0 +1,3 @@ +/*! @svgdotjs/svg.resize.js v2.0.5 MIT*/; +this.svg=this.svg||{},this.svg.resize=this.svg.resize||{},this.svg.resize.js=function(e,t,i){"use strict";const s=e=>(e.changedTouches&&(e=e.changedTouches[0]),{x:e.clientX,y:e.clientY}),h=e=>{let t=1/0,s=1/0,h=-1/0,n=-1/0;for(let i=0;i{const h=e-t[0],n=(s-t[1])*i;return[h*i+t[0],n+t[1]]}));return h(s)}(this.box,n,o)}this.el.dispatch("resize",{box:new i.Box(x),angle:0,eventType:this.eventType,event:e,handler:this}).defaultPrevented||this.el.size(x.width,x.height).move(x.x,x.y)}movePoint(e){this.lastEvent=e;const{x:t,y:i}=this.snapToGrid(this.el.point(s(e))),n=this.el.array().slice();n[this.index]=[t,i],this.el.dispatch("resize",{box:h(n),angle:0,eventType:this.eventType,event:e,handler:this}).defaultPrevented||this.el.plot(n)}rotate(e){this.lastEvent=e;const t=this.startPoint,h=this.el.point(s(e)),{cx:n,cy:o}=this.box,r=t.x-n,a=t.y-o,l=h.x-n,d=h.y-o,x=Math.sqrt(r*r+a*a)*Math.sqrt(l*l+d*d);if(0===x)return;let p=Math.acos((r*l+a*d)/x)/Math.PI*180;if(!p)return;h.x {\n if (ev.changedTouches) {\n ev = ev.changedTouches[0]\n }\n return { x: ev.clientX, y: ev.clientY }\n}\n\nconst maxBoxFromPoints = (points) => {\n let x = Infinity\n let y = Infinity\n let x2 = -Infinity\n let y2 = -Infinity\n\n for (let i = 0; i < points.length; i++) {\n const p = points[i]\n x = Math.min(x, p[0])\n y = Math.min(y, p[1])\n x2 = Math.max(x2, p[0])\n y2 = Math.max(y2, p[1])\n }\n\n return new Box(x, y, x2 - x, y2 - y)\n}\n\nfunction scaleBox(box, origin, scale) {\n const points = [\n [box.x, box.y],\n [box.x + box.width, box.y],\n [box.x + box.width, box.y + box.height],\n [box.x, box.y + box.height],\n ]\n\n const newPoints = points.map(([x, y]) => {\n // Translate to origin\n const translatedX = x - origin[0]\n const translatedY = y - origin[1]\n\n // Scale\n const scaledX = translatedX * scale\n const scaledY = translatedY * scale\n\n // Translate back\n return [scaledX + origin[0], scaledY + origin[1]]\n })\n\n return maxBoxFromPoints(newPoints)\n}\n\nexport class ResizeHandler {\n constructor(el) {\n this.el = el\n el.remember('_ResizeHandler', this)\n this.lastCoordinates = null\n this.eventType = ''\n this.lastEvent = null\n this.handleResize = this.handleResize.bind(this)\n this.resize = this.resize.bind(this)\n this.endResize = this.endResize.bind(this)\n this.rotate = this.rotate.bind(this)\n this.movePoint = this.movePoint.bind(this)\n }\n\n active(value, options) {\n this.preserveAspectRatio = options.preserveAspectRatio ?? false\n this.aroundCenter = options.aroundCenter ?? false\n this.grid = options.grid ?? 0\n this.degree = options.degree ?? 0\n\n // remove all resize events\n this.el.off('.resize')\n\n if (!value) return\n\n this.el.on(\n [\n 'lt.resize',\n 'rt.resize',\n 'rb.resize',\n 'lb.resize',\n 't.resize',\n 'r.resize',\n 'b.resize',\n 'l.resize',\n 'rot.resize',\n 'point.resize',\n ],\n this.handleResize\n )\n\n // in case the options were changed mid-resize,\n // we have to replay the last event to see the immediate effect of the option change\n if (this.lastEvent) {\n if (this.eventType === 'rot') {\n this.rotate(this.lastEvent)\n } else if (this.eventType === 'point') {\n this.movePoint(this.lastEvent)\n } else {\n this.resize(this.lastEvent)\n }\n }\n }\n\n // This is called when a user clicks on one of the resize points\n handleResize(e) {\n this.eventType = e.type\n const { event, index, points } = e.detail\n const isMouse = !event.type.indexOf('mouse')\n\n // Check for left button\n if (isMouse && (event.which || event.buttons) !== 1) {\n return\n }\n\n // Fire beforedrag event\n if (this.el.dispatch('beforeresize', { event: e, handler: this }).defaultPrevented) {\n return\n }\n\n this.box = this.el.bbox()\n this.startPoint = this.el.point(getCoordsFromEvent(event))\n this.index = index\n this.points = points.slice()\n\n // We consider the resize done, when a touch is canceled, too\n const eventMove = (isMouse ? 'mousemove' : 'touchmove') + '.resize'\n const eventEnd = (isMouse ? 'mouseup' : 'touchcancel.resize touchend') + '.resize'\n\n if (e.type === 'point') {\n on(window, eventMove, this.movePoint)\n } else if (e.type === 'rot') {\n on(window, eventMove, this.rotate)\n } else {\n on(window, eventMove, this.resize)\n }\n on(window, eventEnd, this.endResize)\n }\n\n resize(e) {\n this.lastEvent = e\n\n const endPoint = this.snapToGrid(this.el.point(getCoordsFromEvent(e)))\n\n let dx = endPoint.x - this.startPoint.x\n let dy = endPoint.y - this.startPoint.y\n\n if (this.preserveAspectRatio && this.aroundCenter) {\n dx *= 2\n dy *= 2\n }\n\n const x = this.box.x + dx\n const y = this.box.y + dy\n const x2 = this.box.x2 + dx\n const y2 = this.box.y2 + dy\n\n let box = new Box(this.box)\n\n if (this.eventType.includes('l')) {\n box.x = Math.min(x, this.box.x2)\n box.x2 = Math.max(x, this.box.x2)\n }\n\n if (this.eventType.includes('r')) {\n box.x = Math.min(x2, this.box.x)\n box.x2 = Math.max(x2, this.box.x)\n }\n\n if (this.eventType.includes('t')) {\n box.y = Math.min(y, this.box.y2)\n box.y2 = Math.max(y, this.box.y2)\n }\n\n if (this.eventType.includes('b')) {\n box.y = Math.min(y2, this.box.y)\n box.y2 = Math.max(y2, this.box.y)\n }\n\n box.width = box.x2 - box.x\n box.height = box.y2 - box.y\n\n // after figuring out the resulting box,\n // we have to check if the aspect ratio should be preserved\n // if so, we have to find the correct scaling factor and scale the box around a fixed point (usually the opposite of the handle)\n // in case aroundCenter is active, the fixed point is the center of the box\n if (this.preserveAspectRatio) {\n const scaleX = box.width / this.box.width\n const scaleY = box.height / this.box.height\n\n const order = ['lt', 't', 'rt', 'r', 'rb', 'b', 'lb', 'l']\n\n const origin = (order.indexOf(this.eventType) + 4) % order.length\n const constantPoint = this.aroundCenter ? [this.box.cx, this.box.cy] : this.points[origin]\n\n let scale = this.eventType.includes('t') || this.eventType.includes('b') ? scaleY : scaleX\n scale = this.eventType.length === 2 ? Math.max(scaleX, scaleY) : scale\n\n box = scaleBox(this.box, constantPoint, scale)\n }\n\n if (\n this.el.dispatch('resize', {\n box: new Box(box),\n angle: 0,\n eventType: this.eventType,\n event: e,\n handler: this,\n }).defaultPrevented\n ) {\n return\n }\n\n this.el.size(box.width, box.height).move(box.x, box.y)\n }\n\n movePoint(e) {\n this.lastEvent = e\n const { x, y } = this.snapToGrid(this.el.point(getCoordsFromEvent(e)))\n const pointArr = this.el.array().slice()\n pointArr[this.index] = [x, y]\n\n if (\n this.el.dispatch('resize', {\n box: maxBoxFromPoints(pointArr),\n angle: 0,\n eventType: this.eventType,\n event: e,\n handler: this,\n }).defaultPrevented\n ) {\n return\n }\n\n this.el.plot(pointArr)\n }\n\n rotate(e) {\n this.lastEvent = e\n\n const startPoint = this.startPoint\n const endPoint = this.el.point(getCoordsFromEvent(e))\n\n const { cx, cy } = this.box\n\n const dx1 = startPoint.x - cx\n const dy1 = startPoint.y - cy\n\n const dx2 = endPoint.x - cx\n const dy2 = endPoint.y - cy\n\n const c = Math.sqrt(dx1 * dx1 + dy1 * dy1) * Math.sqrt(dx2 * dx2 + dy2 * dy2)\n\n if (c === 0) {\n return\n }\n let angle = (Math.acos((dx1 * dx2 + dy1 * dy2) / c) / Math.PI) * 180\n\n // catches 0 angle and NaN angle that are zero as well (but numerically instable)\n if (!angle) return\n\n if (endPoint.x < startPoint.x) {\n angle = -angle\n }\n\n const matrix = new Matrix(this.el)\n const { x: ox, y: oy } = new Point(cx, cy).transformO(matrix)\n\n const { rotate } = matrix.decompose()\n const resultAngle = this.snapToAngle(rotate + angle) - rotate\n\n if (\n this.el.dispatch('resize', {\n box: this.box,\n angle: resultAngle,\n eventType: this.eventType,\n event: e,\n handler: this,\n }).defaultPrevented\n ) {\n return\n }\n\n this.el.transform(matrix.rotateO(resultAngle, ox, oy))\n }\n\n endResize(ev) {\n // Unbind resize and end events to window\n if (this.eventType !== 'rot' && this.eventType !== 'point') {\n this.resize(ev)\n }\n\n this.lastEvent = null\n\n this.eventType = ''\n off(window, 'mousemove.resize touchmove.resize')\n off(window, 'mouseup.resize touchend.resize')\n }\n\n snapToGrid(point) {\n if (this.grid) {\n point.x = Math.round(point.x / this.grid) * this.grid\n point.y = Math.round(point.y / this.grid) * this.grid\n }\n\n return point\n }\n\n snapToAngle(angle) {\n if (this.degree) {\n angle = Math.round(angle / this.degree) * this.degree\n }\n\n return angle\n }\n}\n","import { extend, Element } from '@svgdotjs/svg.js'\nimport { ResizeHandler } from './ResizeHandler'\n\nextend(Element, {\n // Resize element with mouse\n resize: function (enabled = true, options = {}) {\n if (typeof enabled === 'object') {\n options = enabled\n enabled = true\n }\n\n let resizeHandler = this.remember('_ResizeHandler')\n\n if (!resizeHandler) {\n if (enabled.prototype instanceof ResizeHandler) {\n /* eslint new-cap: [\"error\", { \"newIsCap\": false }] */\n resizeHandler = new enabled(this)\n enabled = true\n } else {\n resizeHandler = new ResizeHandler(this)\n }\n\n this.remember('_resizeHandler', resizeHandler)\n }\n\n resizeHandler.active(enabled, options)\n\n return this\n },\n})\n\nexport { ResizeHandler }\n"],"names":["getCoordsFromEvent","ev","changedTouches","x","clientX","y","clientY","maxBoxFromPoints","points","Infinity","x2","y2","i","length","p","Math","min","max","Box","ResizeHandler","constructor","el","this","remember","lastCoordinates","eventType","lastEvent","handleResize","bind","resize","endResize","rotate","movePoint","active","value","options","preserveAspectRatio","aroundCenter","grid","degree","off","on","e","type","event","index","detail","isMouse","indexOf","which","buttons","dispatch","handler","defaultPrevented","box","bbox","startPoint","point","slice","eventMove","eventEnd","window","endPoint","snapToGrid","dx","dy","includes","width","height","scaleX","scaleY","order","origin","constantPoint","cx","cy","scale","newPoints","map","translatedX","scaledY","scaleBox","angle","size","move","pointArr","array","plot","dx1","dy1","dx2","dy2","c","sqrt","acos","PI","matrix","Matrix","ox","oy","Point","transformO","decompose","resultAngle","snapToAngle","transform","rotateO","svg_js","round","extend","Element","enabled","resizeHandler","prototype"],"mappings":";0GAIM,MAAAA,EAAsBC,IACtBA,EAAGC,iBACAD,EAAAA,EAAGC,eAAe,IAElB,CAAEC,EAAGF,EAAGG,QAASC,EAAGJ,EAAGK,UAG1BC,EAAoBC,IACxB,IAAIL,EAAIM,IACJJ,EAAII,IACJC,GAAKD,IACLE,GAAKF,IAET,I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B,EAAApD,EAAIU,KAAK6F,MAAMnD,EAAMpD,EAAIiB,KAAKgB,MAAQhB,KAAKgB,MAG5CmB,CACR,CAED,WAAA+C,CAAYtB,GAKH,OAJH5D,KAAKiB,SACP2C,EAAQnE,KAAK6F,MAAM1B,EAAQ5D,KAAKiB,QAAUjB,KAAKiB,QAG1C2C,CACR,SCzTGyB,EAAAE,OAACC,UAAS,CAEdjF,OAAQ,SAAUkF,GAAU,EAAM5E,EAAU,CAAA,GACnB,iBAAZ4E,IACC5E,EAAA4E,EACAA,GAAA,GAGR,IAAAC,EAAgB1F,KAAKC,SAAS,kBAgB3B,OAdFyF,IACCD,EAAQE,qBAAqB9F,GAEf6F,EAAA,IAAID,EAAQzF,MAClByF,GAAA,GAEMC,EAAA,IAAI7F,EAAcG,MAG/BA,KAAAC,SAAS,iBAAkByF,IAGpBA,EAAA/E,OAAO8E,EAAS5E,GAEvBb,IACR"} \ No newline at end of file diff --git a/node_modules/@svgdotjs/svg.resize.js/dist/svg.resize.js b/node_modules/@svgdotjs/svg.resize.js/dist/svg.resize.js new file mode 100644 index 0000000..7de0bd4 --- /dev/null +++ b/node_modules/@svgdotjs/svg.resize.js/dist/svg.resize.js @@ -0,0 +1,270 @@ +/*! +* @svgdotjs/svg.resize.js - An extension for svg.js which allows to resize elements which are selected +* @version 2.0.5 +* https://github.com/svgdotjs/svg.resize.js +* +* @copyright [object Object] +* @license MIT +* +* BUILT: Wed Nov 20 2024 23:15:57 GMT+0100 (Central European Standard Time) +*/ +; +import "@svgdotjs/svg.select.js"; +import { on, Box, Matrix, Point, off, extend, Element } from "@svgdotjs/svg.js"; +const getCoordsFromEvent = (ev) => { + if (ev.changedTouches) { + ev = ev.changedTouches[0]; + } + return { x: ev.clientX, y: ev.clientY }; +}; +const maxBoxFromPoints = (points) => { + let x = Infinity; + let y = Infinity; + let x2 = -Infinity; + let y2 = -Infinity; + for (let i = 0; i < points.length; i++) { + const p = points[i]; + x = Math.min(x, p[0]); + y = Math.min(y, p[1]); + x2 = Math.max(x2, p[0]); + y2 = Math.max(y2, p[1]); + } + return new Box(x, y, x2 - x, y2 - y); +}; +function scaleBox(box, origin, scale) { + const points = [ + [box.x, box.y], + [box.x + box.width, box.y], + [box.x + box.width, box.y + box.height], + [box.x, box.y + box.height] + ]; + const newPoints = points.map(([x, y]) => { + const translatedX = x - origin[0]; + const translatedY = y - origin[1]; + const scaledX = translatedX * scale; + const scaledY = translatedY * scale; + return [scaledX + origin[0], scaledY + origin[1]]; + }); + return maxBoxFromPoints(newPoints); +} +class ResizeHandler { + constructor(el) { + this.el = el; + el.remember("_ResizeHandler", this); + this.lastCoordinates = null; + this.eventType = ""; + this.lastEvent = null; + this.handleResize = this.handleResize.bind(this); + this.resize = this.resize.bind(this); + this.endResize = this.endResize.bind(this); + this.rotate = this.rotate.bind(this); + this.movePoint = this.movePoint.bind(this); + } + active(value, options) { + this.preserveAspectRatio = options.preserveAspectRatio ?? false; + this.aroundCenter = options.aroundCenter ?? false; + this.grid = options.grid ?? 0; + this.degree = options.degree ?? 0; + this.el.off(".resize"); + if (!value) return; + this.el.on( + [ + "lt.resize", + "rt.resize", + "rb.resize", + "lb.resize", + "t.resize", + "r.resize", + "b.resize", + "l.resize", + "rot.resize", + "point.resize" + ], + this.handleResize + ); + if (this.lastEvent) { + if (this.eventType === "rot") { + this.rotate(this.lastEvent); + } else if (this.eventType === "point") { + this.movePoint(this.lastEvent); + } else { + this.resize(this.lastEvent); + } + } + } + // This is called when a user clicks on one of the resize points + handleResize(e) { + this.eventType = e.type; + const { event, index, points } = e.detail; + const isMouse = !event.type.indexOf("mouse"); + if (isMouse && (event.which || event.buttons) !== 1) { + return; + } + if (this.el.dispatch("beforeresize", { event: e, handler: this }).defaultPrevented) { + return; + } + this.box = this.el.bbox(); + this.startPoint = this.el.point(getCoordsFromEvent(event)); + this.index = index; + this.points = points.slice(); + const eventMove = (isMouse ? "mousemove" : "touchmove") + ".resize"; + const eventEnd = (isMouse ? "mouseup" : "touchcancel.resize touchend") + ".resize"; + if (e.type === "point") { + on(window, eventMove, this.movePoint); + } else if (e.type === "rot") { + on(window, eventMove, this.rotate); + } else { + on(window, eventMove, this.resize); + } + on(window, eventEnd, this.endResize); + } + resize(e) { + this.lastEvent = e; + const endPoint = this.snapToGrid(this.el.point(getCoordsFromEvent(e))); + let dx = endPoint.x - this.startPoint.x; + let dy = endPoint.y - this.startPoint.y; + if (this.preserveAspectRatio && this.aroundCenter) { + dx *= 2; + dy *= 2; + } + const x = this.box.x + dx; + const y = this.box.y + dy; + const x2 = this.box.x2 + dx; + const y2 = this.box.y2 + dy; + let box = new Box(this.box); + if (this.eventType.includes("l")) { + box.x = Math.min(x, this.box.x2); + box.x2 = Math.max(x, this.box.x2); + } + if (this.eventType.includes("r")) { + box.x = Math.min(x2, this.box.x); + box.x2 = Math.max(x2, this.box.x); + } + if (this.eventType.includes("t")) { + box.y = Math.min(y, this.box.y2); + box.y2 = Math.max(y, this.box.y2); + } + if (this.eventType.includes("b")) { + box.y = Math.min(y2, this.box.y); + box.y2 = Math.max(y2, this.box.y); + } + box.width = box.x2 - box.x; + box.height = box.y2 - box.y; + if (this.preserveAspectRatio) { + const scaleX = box.width / this.box.width; + const scaleY = box.height / this.box.height; + const order = ["lt", "t", "rt", "r", "rb", "b", "lb", "l"]; + const origin = (order.indexOf(this.eventType) + 4) % order.length; + const constantPoint = this.aroundCenter ? [this.box.cx, this.box.cy] : this.points[origin]; + let scale = this.eventType.includes("t") || this.eventType.includes("b") ? scaleY : scaleX; + scale = this.eventType.length === 2 ? Math.max(scaleX, scaleY) : scale; + box = scaleBox(this.box, constantPoint, scale); + } + if (this.el.dispatch("resize", { + box: new Box(box), + angle: 0, + eventType: this.eventType, + event: e, + handler: this + }).defaultPrevented) { + return; + } + this.el.size(box.width, box.height).move(box.x, box.y); + } + movePoint(e) { + this.lastEvent = e; + const { x, y } = this.snapToGrid(this.el.point(getCoordsFromEvent(e))); + const pointArr = this.el.array().slice(); + pointArr[this.index] = [x, y]; + if (this.el.dispatch("resize", { + box: maxBoxFromPoints(pointArr), + angle: 0, + eventType: this.eventType, + event: e, + handler: this + }).defaultPrevented) { + return; + } + this.el.plot(pointArr); + } + rotate(e) { + this.lastEvent = e; + const startPoint = this.startPoint; + const endPoint = this.el.point(getCoordsFromEvent(e)); + const { cx, cy } = this.box; + const dx1 = startPoint.x - cx; + const dy1 = startPoint.y - cy; + const dx2 = endPoint.x - cx; + const dy2 = endPoint.y - cy; + const c = Math.sqrt(dx1 * dx1 + dy1 * dy1) * Math.sqrt(dx2 * dx2 + dy2 * dy2); + if (c === 0) { + return; + } + let angle = Math.acos((dx1 * dx2 + dy1 * dy2) / c) / Math.PI * 180; + if (!angle) return; + if (endPoint.x < startPoint.x) { + angle = -angle; + } + const matrix = new Matrix(this.el); + const { x: ox, y: oy } = new Point(cx, cy).transformO(matrix); + const { rotate } = matrix.decompose(); + const resultAngle = this.snapToAngle(rotate + angle) - rotate; + if (this.el.dispatch("resize", { + box: this.box, + angle: resultAngle, + eventType: this.eventType, + event: e, + handler: this + }).defaultPrevented) { + return; + } + this.el.transform(matrix.rotateO(resultAngle, ox, oy)); + } + endResize(ev) { + if (this.eventType !== "rot" && this.eventType !== "point") { + this.resize(ev); + } + this.lastEvent = null; + this.eventType = ""; + off(window, "mousemove.resize touchmove.resize"); + off(window, "mouseup.resize touchend.resize"); + } + snapToGrid(point) { + if (this.grid) { + point.x = Math.round(point.x / this.grid) * this.grid; + point.y = Math.round(point.y / this.grid) * this.grid; + } + return point; + } + snapToAngle(angle) { + if (this.degree) { + angle = Math.round(angle / this.degree) * this.degree; + } + return angle; + } +} +extend(Element, { + // Resize element with mouse + resize: function(enabled = true, options = {}) { + if (typeof enabled === "object") { + options = enabled; + enabled = true; + } + let resizeHandler = this.remember("_ResizeHandler"); + if (!resizeHandler) { + if (enabled.prototype instanceof ResizeHandler) { + resizeHandler = new enabled(this); + enabled = true; + } else { + resizeHandler = new ResizeHandler(this); + } + this.remember("_resizeHandler", resizeHandler); + } + resizeHandler.active(enabled, options); + return this; + } +}); +export { + ResizeHandler +}; +//# sourceMappingURL=svg.resize.js.map diff --git a/node_modules/@svgdotjs/svg.resize.js/dist/svg.resize.js.map b/node_modules/@svgdotjs/svg.resize.js/dist/svg.resize.js.map new file mode 100644 index 0000000..ec38a3c --- /dev/null +++ b/node_modules/@svgdotjs/svg.resize.js/dist/svg.resize.js.map @@ -0,0 +1 @@ +{"version":3,"file":"svg.resize.js","sources":["../src/ResizeHandler.js","../src/svg.resize.js"],"sourcesContent":["import { Point } from '@svgdotjs/svg.js'\nimport { Matrix } from '@svgdotjs/svg.js'\nimport { on, off, Box } from '@svgdotjs/svg.js'\n\nconst getCoordsFromEvent = (ev) => {\n if (ev.changedTouches) {\n ev = ev.changedTouches[0]\n }\n return { x: ev.clientX, y: ev.clientY }\n}\n\nconst maxBoxFromPoints = (points) => {\n let x = Infinity\n let y = Infinity\n let x2 = -Infinity\n let y2 = -Infinity\n\n for (let i = 0; i < points.length; i++) {\n const p = points[i]\n x = Math.min(x, p[0])\n y = Math.min(y, p[1])\n x2 = Math.max(x2, p[0])\n y2 = Math.max(y2, p[1])\n }\n\n return new Box(x, y, x2 - x, y2 - y)\n}\n\nfunction scaleBox(box, origin, scale) {\n const points = [\n [box.x, box.y],\n [box.x + box.width, box.y],\n [box.x + box.width, box.y + box.height],\n [box.x, box.y + box.height],\n ]\n\n const newPoints = points.map(([x, y]) => {\n // Translate to origin\n const translatedX = x - origin[0]\n const translatedY = y - origin[1]\n\n // Scale\n const scaledX = translatedX * scale\n const scaledY = translatedY * scale\n\n // Translate back\n return [scaledX + origin[0], scaledY + origin[1]]\n })\n\n return maxBoxFromPoints(newPoints)\n}\n\nexport class ResizeHandler {\n constructor(el) {\n this.el = el\n el.remember('_ResizeHandler', this)\n this.lastCoordinates = null\n this.eventType = ''\n this.lastEvent = null\n this.handleResize = this.handleResize.bind(this)\n this.resize = this.resize.bind(this)\n this.endResize = this.endResize.bind(this)\n this.rotate = this.rotate.bind(this)\n this.movePoint = this.movePoint.bind(this)\n }\n\n active(value, options) {\n this.preserveAspectRatio = options.preserveAspectRatio ?? false\n this.aroundCenter = options.aroundCenter ?? false\n this.grid = options.grid ?? 0\n this.degree = options.degree ?? 0\n\n // remove all resize events\n this.el.off('.resize')\n\n if (!value) return\n\n this.el.on(\n [\n 'lt.resize',\n 'rt.resize',\n 'rb.resize',\n 'lb.resize',\n 't.resize',\n 'r.resize',\n 'b.resize',\n 'l.resize',\n 'rot.resize',\n 'point.resize',\n ],\n this.handleResize\n )\n\n // in case the options were changed mid-resize,\n // we have to replay the last event to see the immediate effect of the option change\n if (this.lastEvent) {\n if (this.eventType === 'rot') {\n this.rotate(this.lastEvent)\n } else if (this.eventType === 'point') {\n this.movePoint(this.lastEvent)\n } else {\n this.resize(this.lastEvent)\n }\n }\n }\n\n // This is called when a user clicks on one of the resize points\n handleResize(e) {\n this.eventType = e.type\n const { event, index, points } = e.detail\n const isMouse = !event.type.indexOf('mouse')\n\n // Check for left button\n if (isMouse && (event.which || event.buttons) !== 1) {\n return\n }\n\n // Fire beforedrag event\n if (this.el.dispatch('beforeresize', { event: e, handler: this }).defaultPrevented) {\n return\n }\n\n this.box = this.el.bbox()\n this.startPoint = this.el.point(getCoordsFromEvent(event))\n this.index = index\n this.points = points.slice()\n\n // We consider the resize done, when a touch is canceled, too\n const eventMove = (isMouse ? 'mousemove' : 'touchmove') + '.resize'\n const eventEnd = (isMouse ? 'mouseup' : 'touchcancel.resize touchend') + '.resize'\n\n if (e.type === 'point') {\n on(window, eventMove, this.movePoint)\n } else if (e.type === 'rot') {\n on(window, eventMove, this.rotate)\n } else {\n on(window, eventMove, this.resize)\n }\n on(window, eventEnd, this.endResize)\n }\n\n resize(e) {\n this.lastEvent = e\n\n const endPoint = this.snapToGrid(this.el.point(getCoordsFromEvent(e)))\n\n let dx = endPoint.x - this.startPoint.x\n let dy = endPoint.y - this.startPoint.y\n\n if (this.preserveAspectRatio && this.aroundCenter) {\n dx *= 2\n dy *= 2\n }\n\n const x = this.box.x + dx\n const y = this.box.y + dy\n const x2 = this.box.x2 + dx\n const y2 = this.box.y2 + dy\n\n let box = new Box(this.box)\n\n if (this.eventType.includes('l')) {\n box.x = Math.min(x, this.box.x2)\n box.x2 = Math.max(x, this.box.x2)\n }\n\n if (this.eventType.includes('r')) {\n box.x = Math.min(x2, this.box.x)\n box.x2 = Math.max(x2, this.box.x)\n }\n\n if (this.eventType.includes('t')) {\n box.y = Math.min(y, this.box.y2)\n box.y2 = Math.max(y, this.box.y2)\n }\n\n if (this.eventType.includes('b')) {\n box.y = Math.min(y2, this.box.y)\n box.y2 = Math.max(y2, this.box.y)\n }\n\n box.width = box.x2 - box.x\n box.height = box.y2 - box.y\n\n // after figuring out the resulting box,\n // we have to check if the aspect ratio should be preserved\n // if so, we have to find the correct scaling factor and scale the box around a fixed point (usually the opposite of the handle)\n // in case aroundCenter is active, the fixed point is the center of the box\n if (this.preserveAspectRatio) {\n const scaleX = box.width / this.box.width\n const scaleY = box.height / this.box.height\n\n const order = ['lt', 't', 'rt', 'r', 'rb', 'b', 'lb', 'l']\n\n const origin = (order.indexOf(this.eventType) + 4) % order.length\n const constantPoint = this.aroundCenter ? [this.box.cx, this.box.cy] : this.points[origin]\n\n let scale = this.eventType.includes('t') || this.eventType.includes('b') ? scaleY : scaleX\n scale = this.eventType.length === 2 ? Math.max(scaleX, scaleY) : scale\n\n box = scaleBox(this.box, constantPoint, scale)\n }\n\n if (\n this.el.dispatch('resize', {\n box: new Box(box),\n angle: 0,\n eventType: this.eventType,\n event: e,\n handler: this,\n }).defaultPrevented\n ) {\n return\n }\n\n this.el.size(box.width, box.height).move(box.x, box.y)\n }\n\n movePoint(e) {\n this.lastEvent = e\n const { x, y } = this.snapToGrid(this.el.point(getCoordsFromEvent(e)))\n const pointArr = this.el.array().slice()\n pointArr[this.index] = [x, y]\n\n if (\n this.el.dispatch('resize', {\n box: maxBoxFromPoints(pointArr),\n angle: 0,\n eventType: this.eventType,\n event: e,\n handler: this,\n }).defaultPrevented\n ) {\n return\n }\n\n this.el.plot(pointArr)\n }\n\n rotate(e) {\n this.lastEvent = e\n\n const startPoint = this.startPoint\n const endPoint = this.el.point(getCoordsFromEvent(e))\n\n const { cx, cy } = this.box\n\n const dx1 = startPoint.x - cx\n const dy1 = startPoint.y - cy\n\n const dx2 = endPoint.x - cx\n const dy2 = endPoint.y - cy\n\n const c = Math.sqrt(dx1 * dx1 + dy1 * dy1) * Math.sqrt(dx2 * dx2 + dy2 * dy2)\n\n if (c === 0) {\n return\n }\n let angle = (Math.acos((dx1 * dx2 + dy1 * dy2) / c) / Math.PI) * 180\n\n // catches 0 angle and NaN angle that are zero as well (but numerically instable)\n if (!angle) return\n\n if (endPoint.x < startPoint.x) {\n angle = -angle\n }\n\n const matrix = new Matrix(this.el)\n const { x: ox, y: oy } = new Point(cx, cy).transformO(matrix)\n\n const { rotate } = matrix.decompose()\n const resultAngle = this.snapToAngle(rotate + angle) - rotate\n\n if (\n this.el.dispatch('resize', {\n box: this.box,\n angle: resultAngle,\n eventType: this.eventType,\n event: e,\n handler: this,\n }).defaultPrevented\n ) {\n return\n }\n\n this.el.transform(matrix.rotateO(resultAngle, ox, oy))\n }\n\n endResize(ev) {\n // Unbind resize and end events to window\n if (this.eventType !== 'rot' && this.eventType !== 'point') {\n this.resize(ev)\n }\n\n this.lastEvent = null\n\n this.eventType = ''\n off(window, 'mousemove.resize touchmove.resize')\n off(window, 'mouseup.resize touchend.resize')\n }\n\n snapToGrid(point) {\n if (this.grid) {\n point.x = Math.round(point.x / this.grid) * this.grid\n point.y = Math.round(point.y / this.grid) * this.grid\n }\n\n return point\n }\n\n snapToAngle(angle) {\n if (this.degree) {\n angle = Math.round(angle / this.degree) * this.degree\n }\n\n return angle\n }\n}\n","import { extend, Element } from '@svgdotjs/svg.js'\nimport { ResizeHandler } from './ResizeHandler'\n\nextend(Element, {\n // Resize element with mouse\n resize: function (enabled = true, options = {}) {\n if (typeof enabled === 'object') {\n options = enabled\n enabled = true\n }\n\n let resizeHandler = this.remember('_ResizeHandler')\n\n if (!resizeHandler) {\n if (enabled.prototype instanceof ResizeHandler) {\n /* eslint new-cap: [\"error\", { \"newIsCap\": false }] */\n resizeHandler = new enabled(this)\n enabled = true\n } else {\n resizeHandler = new ResizeHandler(this)\n }\n\n this.remember('_resizeHandler', resizeHandler)\n }\n\n resizeHandler.active(enabled, options)\n\n return this\n },\n})\n\nexport { ResizeHandler }\n"],"names":[],"mappings":";;;;;;;;;;;;;AAIA,MAAM,qBAAqB,CAAC,OAAO;AACjC,MAAI,GAAG,gBAAgB;AACrB,SAAK,GAAG,eAAe,CAAC;AAAA,EACzB;AACD,SAAO,EAAE,GAAG,GAAG,SAAS,GAAG,GAAG,QAAS;AACzC;AAEA,MAAM,mBAAmB,CAAC,WAAW;AACnC,MAAI,IAAI;AACR,MAAI,IAAI;AACR,MAAI,KAAK;AACT,MAAI,KAAK;AAET,WAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;AACtC,UAAM,IAAI,OAAO,CAAC;AAClB,QAAI,KAAK,IAAI,GAAG,EAAE,CAAC,CAAC;AACpB,QAAI,KAAK,IAAI,GAAG,EAAE,CAAC,CAAC;AACpB,SAAK,KAAK,IAAI,IAAI,EAAE,CAAC,CAAC;AACtB,SAAK,KAAK,IAAI,IAAI,EAAE,CAAC,CAAC;AAAA,EACvB;AAED,SAAO,IAAI,IAAI,GAAG,GAAG,KAAK,GAAG,KAAK,CAAC;AACrC;AAEA,SAAS,SAAS,KAAK,QAAQ,OAAO;AACpC,QAAM,SAAS;AAAA,IACb,CAAC,IAAI,GAAG,IAAI,CAAC;AAAA,IACb,CAAC,IAAI,IAAI,IAAI,OAAO,IAAI,CAAC;AAAA,IACzB,CAAC,IAAI,IAAI,IAAI,OAAO,IAAI,IAAI,IAAI,MAAM;AAAA,IACtC,CAAC,IAAI,GAAG,IAAI,IAAI,IAAI,MAAM;AAAA,EAC3B;AAED,QAAM,YAAY,OA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AM,IAAI,KAAK;AAAA,IAChD;AAED,WAAO;AAAA,EACR;AACH;AC1TA,OAAO,SAAS;AAAA;AAAA,EAEd,QAAQ,SAAU,UAAU,MAAM,UAAU,CAAA,GAAI;AAC9C,QAAI,OAAO,YAAY,UAAU;AAC/B,gBAAU;AACV,gBAAU;AAAA,IACX;AAED,QAAI,gBAAgB,KAAK,SAAS,gBAAgB;AAElD,QAAI,CAAC,eAAe;AAClB,UAAI,QAAQ,qBAAqB,eAAe;AAE9C,wBAAgB,IAAI,QAAQ,IAAI;AAChC,kBAAU;AAAA,MAClB,OAAa;AACL,wBAAgB,IAAI,cAAc,IAAI;AAAA,MACvC;AAED,WAAK,SAAS,kBAAkB,aAAa;AAAA,IAC9C;AAED,kBAAc,OAAO,SAAS,OAAO;AAErC,WAAO;AAAA,EACR;AACH,CAAC;"} \ No newline at end of file diff --git a/node_modules/@svgdotjs/svg.resize.js/dist/svg.resize.umd.cjs b/node_modules/@svgdotjs/svg.resize.js/dist/svg.resize.umd.cjs new file mode 100644 index 0000000..1270491 --- /dev/null +++ b/node_modules/@svgdotjs/svg.resize.js/dist/svg.resize.umd.cjs @@ -0,0 +1,3 @@ +/*! @svgdotjs/svg.resize.js v2.0.5 MIT*/; +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@svgdotjs/svg.select.js"),require("@svgdotjs/svg.js")):"function"==typeof define&&define.amd?define(["exports","@svgdotjs/svg.select.js","@svgdotjs/svg.js"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).svg=e.svg||{},e.svg.resize=e.svg.resize||{},e.svg.resize.js={}),null,e.SVG)}(this,(function(e,t,i){"use strict";const s=e=>(e.changedTouches&&(e=e.changedTouches[0]),{x:e.clientX,y:e.clientY}),n=e=>{let t=1/0,s=1/0,n=-1/0,h=-1/0;for(let i=0;i{const n=e-t[0],h=(s-t[1])*i;return[n*i+t[0],h+t[1]]}));return n(s)}(this.box,h,o)}this.el.dispatch("resize",{box:new i.Box(x),angle:0,eventType:this.eventType,event:e,handler:this}).defaultPrevented||this.el.size(x.width,x.height).move(x.x,x.y)}movePoint(e){this.lastEvent=e;const{x:t,y:i}=this.snapToGrid(this.el.point(s(e))),h=this.el.array().slice();h[this.index]=[t,i],this.el.dispatch("resize",{box:n(h),angle:0,eventType:this.eventType,event:e,handler:this}).defaultPrevented||this.el.plot(h)}rotate(e){this.lastEvent=e;const t=this.startPoint,n=this.el.point(s(e)),{cx:h,cy:o}=this.box,r=t.x-h,a=t.y-o,d=n.x-h,l=n.y-o,x=Math.sqrt(r*r+a*a)*Math.sqrt(d*d+l*l);if(0===x)return;let p=Math.acos((r*d+a*l)/x)/Math.PI*180;if(!p)return;n.x {\n if (ev.changedTouches) {\n ev = ev.changedTouches[0]\n }\n return { x: ev.clientX, y: ev.clientY }\n}\n\nconst maxBoxFromPoints = (points) => {\n let x = Infinity\n let y = Infinity\n let x2 = -Infinity\n let y2 = -Infinity\n\n for (let i = 0; i < points.length; i++) {\n const p = points[i]\n x = Math.min(x, p[0])\n y = Math.min(y, p[1])\n x2 = Math.max(x2, p[0])\n y2 = Math.max(y2, p[1])\n }\n\n return new Box(x, y, x2 - x, y2 - y)\n}\n\nfunction scaleBox(box, origin, scale) {\n const points = [\n [box.x, box.y],\n [box.x + box.width, box.y],\n [box.x + box.width, box.y + box.height],\n [box.x, box.y + box.height],\n ]\n\n const newPoints = points.map(([x, y]) => {\n // Translate to origin\n const translatedX = x - origin[0]\n const translatedY = y - origin[1]\n\n // Scale\n const scaledX = translatedX * scale\n const scaledY = translatedY * scale\n\n // Translate back\n return [scaledX + origin[0], scaledY + origin[1]]\n })\n\n return maxBoxFromPoints(newPoints)\n}\n\nexport class ResizeHandler {\n constructor(el) {\n this.el = el\n el.remember('_ResizeHandler', this)\n this.lastCoordinates = null\n this.eventType = ''\n this.lastEvent = null\n this.handleResize = this.handleResize.bind(this)\n this.resize = this.resize.bind(this)\n this.endResize = this.endResize.bind(this)\n this.rotate = this.rotate.bind(this)\n this.movePoint = this.movePoint.bind(this)\n }\n\n active(value, options) {\n this.preserveAspectRatio = options.preserveAspectRatio ?? false\n this.aroundCenter = options.aroundCenter ?? false\n this.grid = options.grid ?? 0\n this.degree = options.degree ?? 0\n\n // remove all resize events\n this.el.off('.resize')\n\n if (!value) return\n\n this.el.on(\n [\n 'lt.resize',\n 'rt.resize',\n 'rb.resize',\n 'lb.resize',\n 't.resize',\n 'r.resize',\n 'b.resize',\n 'l.resize',\n 'rot.resize',\n 'point.resize',\n ],\n this.handleResize\n )\n\n // in case the options were changed mid-resize,\n // we have to replay the last event to see the immediate effect of the option change\n if (this.lastEvent) {\n if (this.eventType === 'rot') {\n this.rotate(this.lastEvent)\n } else if (this.eventType === 'point') {\n this.movePoint(this.lastEvent)\n } else {\n this.resize(this.lastEvent)\n }\n }\n }\n\n // This is called when a user clicks on one of the resize points\n handleResize(e) {\n this.eventType = e.type\n const { event, index, points } = e.detail\n const isMouse = !event.type.indexOf('mouse')\n\n // Check for left button\n if (isMouse && (event.which || event.buttons) !== 1) {\n return\n }\n\n // Fire beforedrag event\n if (this.el.dispatch('beforeresize', { event: e, handler: this }).defaultPrevented) {\n return\n }\n\n this.box = this.el.bbox()\n this.startPoint = this.el.point(getCoordsFromEvent(event))\n this.index = index\n this.points = points.slice()\n\n // We consider the resize done, when a touch is canceled, too\n const eventMove = (isMouse ? 'mousemove' : 'touchmove') + '.resize'\n const eventEnd = (isMouse ? 'mouseup' : 'touchcancel.resize touchend') + '.resize'\n\n if (e.type === 'point') {\n on(window, eventMove, this.movePoint)\n } else if (e.type === 'rot') {\n on(window, eventMove, this.rotate)\n } else {\n on(window, eventMove, this.resize)\n }\n on(window, eventEnd, this.endResize)\n }\n\n resize(e) {\n this.lastEvent = e\n\n const endPoint = this.snapToGrid(this.el.point(getCoordsFromEvent(e)))\n\n let dx = endPoint.x - this.startPoint.x\n let dy = endPoint.y - this.startPoint.y\n\n if (this.preserveAspectRatio && this.aroundCenter) {\n dx *= 2\n dy *= 2\n }\n\n const x = this.box.x + dx\n const y = this.box.y + dy\n const x2 = this.box.x2 + dx\n const y2 = this.box.y2 + dy\n\n let box = new Box(this.box)\n\n if (this.eventType.includes('l')) {\n box.x = Math.min(x, this.box.x2)\n box.x2 = Math.max(x, this.box.x2)\n }\n\n if (this.eventType.includes('r')) {\n box.x = Math.min(x2, this.box.x)\n box.x2 = Math.max(x2, this.box.x)\n }\n\n if (this.eventType.includes('t')) {\n box.y = Math.min(y, this.box.y2)\n box.y2 = Math.max(y, this.box.y2)\n }\n\n if (this.eventType.includes('b')) {\n box.y = Math.min(y2, this.box.y)\n box.y2 = Math.max(y2, this.box.y)\n }\n\n box.width = box.x2 - box.x\n box.height = box.y2 - box.y\n\n // after figuring out the resulting box,\n // we have to check if the aspect ratio should be preserved\n // if so, we have to find the correct scaling factor and scale the box around a fixed point (usually the opposite of the handle)\n // in case aroundCenter is active, the fixed point is the center of the box\n if (this.preserveAspectRatio) {\n const scaleX = box.width / this.box.width\n const scaleY = box.height / this.box.height\n\n const order = ['lt', 't', 'rt', 'r', 'rb', 'b', 'lb', 'l']\n\n const origin = (order.indexOf(this.eventType) + 4) % order.length\n const constantPoint = this.aroundCenter ? [this.box.cx, this.box.cy] : this.points[origin]\n\n let scale = this.eventType.includes('t') || this.eventType.includes('b') ? scaleY : scaleX\n scale = this.eventType.length === 2 ? Math.max(scaleX, scaleY) : scale\n\n box = scaleBox(this.box, constantPoint, scale)\n }\n\n if (\n this.el.dispatch('resize', {\n box: new Box(box),\n angle: 0,\n eventType: this.eventType,\n event: e,\n handler: this,\n }).defaultPrevented\n ) {\n return\n }\n\n this.el.size(box.width, box.height).move(box.x, box.y)\n }\n\n movePoint(e) {\n this.lastEvent = e\n const { x, y } = this.snapToGrid(this.el.point(getCoordsFromEvent(e)))\n const pointArr = this.el.array().slice()\n pointArr[this.index] = [x, y]\n\n if (\n this.el.dispatch('resize', {\n box: maxBoxFromPoints(pointArr),\n angle: 0,\n eventType: this.eventType,\n event: e,\n handler: this,\n }).defaultPrevented\n ) {\n return\n }\n\n this.el.plot(pointArr)\n }\n\n rotate(e) {\n this.lastEvent = e\n\n const startPoint = this.startPoint\n const endPoint = this.el.point(getCoordsFromEvent(e))\n\n const { cx, cy } = this.box\n\n const dx1 = startPoint.x - cx\n const dy1 = startPoint.y - cy\n\n const dx2 = endPoint.x - cx\n const dy2 = endPoint.y - cy\n\n const c = Math.sqrt(dx1 * dx1 + dy1 * dy1) * Math.sqrt(dx2 * dx2 + dy2 * dy2)\n\n if (c === 0) {\n return\n }\n let angle = (Math.acos((dx1 * dx2 + dy1 * dy2) / c) / Math.PI) * 180\n\n // catches 0 angle and NaN angle that are zero as well (but numerically instable)\n if (!angle) return\n\n if (endPoint.x < startPoint.x) {\n angle = -angle\n }\n\n const matrix = new Matrix(this.el)\n const { x: ox, y: oy } = new Point(cx, cy).transformO(matrix)\n\n const { rotate } = matrix.decompose()\n const resultAngle = this.snapToAngle(rotate + angle) - rotate\n\n if (\n this.el.dispatch('resize', {\n box: this.box,\n angle: resultAngle,\n eventType: this.eventType,\n event: e,\n handler: this,\n }).defaultPrevented\n ) {\n return\n }\n\n this.el.transform(matrix.rotateO(resultAngle, ox, oy))\n }\n\n endResize(ev) {\n // Unbind resize and end events to window\n if (this.eventType !== 'rot' && this.eventType !== 'point') {\n this.resize(ev)\n }\n\n this.lastEvent = null\n\n this.eventType = ''\n off(window, 'mousemove.resize touchmove.resize')\n off(window, 'mouseup.resize touchend.resize')\n }\n\n snapToGrid(point) {\n if (this.grid) {\n point.x = Math.round(point.x / this.grid) * this.grid\n point.y = Math.round(point.y / this.grid) * this.grid\n }\n\n return point\n }\n\n snapToAngle(angle) {\n if (this.degree) {\n angle = Math.round(angle / this.degree) * this.degree\n }\n\n return angle\n }\n}\n","import { extend, Element } from '@svgdotjs/svg.js'\nimport { ResizeHandler } from './ResizeHandler'\n\nextend(Element, {\n // Resize element with mouse\n resize: function (enabled = true, options = {}) {\n if (typeof enabled === 'object') {\n options = enabled\n enabled = true\n }\n\n let resizeHandler = this.remember('_ResizeHandler')\n\n if (!resizeHandler) {\n if (enabled.prototype instanceof ResizeHandler) {\n /* eslint new-cap: [\"error\", { \"newIsCap\": false }] */\n resizeHandler = new enabled(this)\n enabled = true\n } else {\n resizeHandler = new ResizeHandler(this)\n }\n\n this.remember('_resizeHandler', resizeHandler)\n }\n\n resizeHandler.active(enabled, options)\n\n return this\n },\n})\n\nexport { ResizeHandler }\n"],"names":["getCoordsFromEvent","ev","changedTouches","x","clientX","y","clientY","maxBoxFromPoints","points","Infinity","x2","y2","i","length","p","Math","min","max","Box","ResizeHandler","constructor","el","this","remember","lastCoordinates","eventType","lastEvent","handleResize","bind","resize","endResize","rotate","movePoint","active","value","options","preserveAspectRatio","aroundCenter","grid","degree","off","on","e","type","event","index","detail","isMouse","indexOf","which","buttons","dispatch","handler","defaultPrevented","box","bbox","startPoint","point","slice","eventMove","eventEnd","window","endPoint","snapToGrid","dx","dy","includes","width","height","scaleX","scaleY","order","origin","constantPoint","cx","cy","scale","newPoints","map","translatedX","scaledY","scaleBox","angle","size","move","pointArr","array","plot","dx1","dy1","dx2","dy2","c","sqrt","acos","PI","matrix","Matrix","ox","oy","Point","transformO","decompose","resultAngle","snapToAngle","transform","rotateO","svg_js","round","extend","Element","enabled","resizeHandler","prototype"],"mappings":";gaAIM,MAAAA,EAAsBC,IACtBA,EAAGC,iBACAD,EAAAA,EAAGC,eAAe,IAElB,CAAEC,EAAGF,EAAGG,QAASC,EAAGJ,EAAGK,UAG1BC,EAAoBC,IACxB,IAAIL,EAAIM,IACJJ,EAAII,IACJC,GAAKD,IACLE,GAAKF,IAET,IAAA,IAASG,EAAI,EAAGA,EAAIJ,EAAOK,OAAQD,IAAK,CAChC,MAAAE,EAAIN,EAAOI,GACjBT,EAAIY,KAAKC,IAAIb,EAAGW,EAAE,IAClBT,EAAIU,KAAKC,IAAIX,EAAGS,EAAE,IAClBJ,EAAKK,KAAKE,IAAIP,EAAII,EAAE,IACpBH,EAAK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zTGyB,EAAAE,OAACC,UAAS,CAEdjF,OAAQ,SAAUkF,GAAU,EAAM5E,EAAU,CAAA,GACnB,iBAAZ4E,IACC5E,EAAA4E,EACAA,GAAA,GAGR,IAAAC,EAAgB1F,KAAKC,SAAS,kBAgB3B,OAdFyF,IACCD,EAAQE,qBAAqB9F,GAEf6F,EAAA,IAAID,EAAQzF,MAClByF,GAAA,GAEMC,EAAA,IAAI7F,EAAcG,MAG/BA,KAAAC,SAAS,iBAAkByF,IAGpBA,EAAA/E,OAAO8E,EAAS5E,GAEvBb,IACR"} \ No newline at end of file diff --git a/node_modules/@svgdotjs/svg.resize.js/package.json b/node_modules/@svgdotjs/svg.resize.js/package.json new file mode 100644 index 0000000..71e756b --- /dev/null +++ b/node_modules/@svgdotjs/svg.resize.js/package.json @@ -0,0 +1,70 @@ +{ + "name": "@svgdotjs/svg.resize.js", + "version": "2.0.5", + "description": "An extension for svg.js which allows to resize elements which are selected", + "type": "module", + "keywords": [ + "svg.js", + "resize", + "mouse" + ], + "bugs": "https://github.com/svgdotjs/svg.resize.js/issues", + "license": "MIT", + "author": { + "name": "Ulrich-Matthias Schäfer" + }, + "homepage": "https://github.com/svgdotjs/svg.resize.js", + "main": "dist/svg.resize.umd.cjs", + "unpkg": "dist/svg.resize.iife.js", + "jsdelivr": "dist/svg.resize.iife.js", + "module": "dist/svg.resize.js", + "typings": "./svg.resize.js.d.ts", + "exports": { + ".": { + "import": { + "types": "./svg.resize.js.d.ts", + "default": "./dist/svg.resize.js" + }, + "require": { + "types": "./svg.resize.js.d.cts", + "default": "./dist/svg.resize.umd.cjs" + }, + "browser": { + "types": "./svg.resize.js.d.ts", + "default": "./dist/svg.resize.js" + } + } + }, + "files": [ + "/dist", + "/src", + "/svg.resize.js.d.ts" + ], + "scripts": { + "dev": "vite", + "build": "tsc && prettier --write . && eslint ./src && vite build", + "zip": "zip -j dist/svg.resize.js.zip -- LICENSE README.md dist/svg.resize.iife.js dist/svg.resize.iife.js.map dist/svg.resize.js dist/svg.resize.js.map dist/svg.resize.umd.cjs dist/svg.resize.umd.cjs.map", + "prepublishOnly": "rm -rf ./dist && npm run build", + "postpublish": "npm run zip" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/svgdotjs/svg.resize.js.git" + }, + "engines": { + "node": ">= 14.18" + }, + "devDependencies": { + "@types/node": "^20.14.10", + "eslint": "^9.7.0", + "eslint-plugin-import-x": "^3.0.1", + "prettier": "^3.3.3", + "terser": "^5.31.2", + "typescript": "^5.5.3", + "vite": "^5.3.4" + }, + "peerDependencies": { + "@svgdotjs/svg.js": "^3.2.4", + "@svgdotjs/svg.select.js": "^4.0.1" + } +} diff --git a/node_modules/@svgdotjs/svg.resize.js/src/ResizeHandler.js b/node_modules/@svgdotjs/svg.resize.js/src/ResizeHandler.js new file mode 100644 index 0000000..4a6532e --- /dev/null +++ b/node_modules/@svgdotjs/svg.resize.js/src/ResizeHandler.js @@ -0,0 +1,318 @@ +import { Point } from '@svgdotjs/svg.js' +import { Matrix } from '@svgdotjs/svg.js' +import { on, off, Box } from '@svgdotjs/svg.js' + +const getCoordsFromEvent = (ev) => { + if (ev.changedTouches) { + ev = ev.changedTouches[0] + } + return { x: ev.clientX, y: ev.clientY } +} + +const maxBoxFromPoints = (points) => { + let x = Infinity + let y = Infinity + let x2 = -Infinity + let y2 = -Infinity + + for (let i = 0; i < points.length; i++) { + const p = points[i] + x = Math.min(x, p[0]) + y = Math.min(y, p[1]) + x2 = Math.max(x2, p[0]) + y2 = Math.max(y2, p[1]) + } + + return new Box(x, y, x2 - x, y2 - y) +} + +function scaleBox(box, origin, scale) { + const points = [ + [box.x, box.y], + [box.x + box.width, box.y], + [box.x + box.width, box.y + box.height], + [box.x, box.y + box.height], + ] + + const newPoints = points.map(([x, y]) => { + // Translate to origin + const translatedX = x - origin[0] + const translatedY = y - origin[1] + + // Scale + const scaledX = translatedX * scale + const scaledY = translatedY * scale + + // Translate back + return [scaledX + origin[0], scaledY + origin[1]] + }) + + return maxBoxFromPoints(newPoints) +} + +export class ResizeHandler { + constructor(el) { + this.el = el + el.remember('_ResizeHandler', this) + this.lastCoordinates = null + this.eventType = '' + this.lastEvent = null + this.handleResize = this.handleResize.bind(this) + this.resize = this.resize.bind(this) + this.endResize = this.endResize.bind(this) + this.rotate = this.rotate.bind(this) + this.movePoint = this.movePoint.bind(this) + } + + active(value, options) { + this.preserveAspectRatio = options.preserveAspectRatio ?? false + this.aroundCenter = options.aroundCenter ?? false + this.grid = options.grid ?? 0 + this.degree = options.degree ?? 0 + + // remove all resize events + this.el.off('.resize') + + if (!value) return + + this.el.on( + [ + 'lt.resize', + 'rt.resize', + 'rb.resize', + 'lb.resize', + 't.resize', + 'r.resize', + 'b.resize', + 'l.resize', + 'rot.resize', + 'point.resize', + ], + this.handleResize + ) + + // in case the options were changed mid-resize, + // we have to replay the last event to see the immediate effect of the option change + if (this.lastEvent) { + if (this.eventType === 'rot') { + this.rotate(this.lastEvent) + } else if (this.eventType === 'point') { + this.movePoint(this.lastEvent) + } else { + this.resize(this.lastEvent) + } + } + } + + // This is called when a user clicks on one of the resize points + handleResize(e) { + this.eventType = e.type + const { event, index, points } = e.detail + const isMouse = !event.type.indexOf('mouse') + + // Check for left button + if (isMouse && (event.which || event.buttons) !== 1) { + return + } + + // Fire beforedrag event + if (this.el.dispatch('beforeresize', { event: e, handler: this }).defaultPrevented) { + return + } + + this.box = this.el.bbox() + this.startPoint = this.el.point(getCoordsFromEvent(event)) + this.index = index + this.points = points.slice() + + // We consider the resize done, when a touch is canceled, too + const eventMove = (isMouse ? 'mousemove' : 'touchmove') + '.resize' + const eventEnd = (isMouse ? 'mouseup' : 'touchcancel.resize touchend') + '.resize' + + if (e.type === 'point') { + on(window, eventMove, this.movePoint) + } else if (e.type === 'rot') { + on(window, eventMove, this.rotate) + } else { + on(window, eventMove, this.resize) + } + on(window, eventEnd, this.endResize) + } + + resize(e) { + this.lastEvent = e + + const endPoint = this.snapToGrid(this.el.point(getCoordsFromEvent(e))) + + let dx = endPoint.x - this.startPoint.x + let dy = endPoint.y - this.startPoint.y + + if (this.preserveAspectRatio && this.aroundCenter) { + dx *= 2 + dy *= 2 + } + + const x = this.box.x + dx + const y = this.box.y + dy + const x2 = this.box.x2 + dx + const y2 = this.box.y2 + dy + + let box = new Box(this.box) + + if (this.eventType.includes('l')) { + box.x = Math.min(x, this.box.x2) + box.x2 = Math.max(x, this.box.x2) + } + + if (this.eventType.includes('r')) { + box.x = Math.min(x2, this.box.x) + box.x2 = Math.max(x2, this.box.x) + } + + if (this.eventType.includes('t')) { + box.y = Math.min(y, this.box.y2) + box.y2 = Math.max(y, this.box.y2) + } + + if (this.eventType.includes('b')) { + box.y = Math.min(y2, this.box.y) + box.y2 = Math.max(y2, this.box.y) + } + + box.width = box.x2 - box.x + box.height = box.y2 - box.y + + // after figuring out the resulting box, + // we have to check if the aspect ratio should be preserved + // if so, we have to find the correct scaling factor and scale the box around a fixed point (usually the opposite of the handle) + // in case aroundCenter is active, the fixed point is the center of the box + if (this.preserveAspectRatio) { + const scaleX = box.width / this.box.width + const scaleY = box.height / this.box.height + + const order = ['lt', 't', 'rt', 'r', 'rb', 'b', 'lb', 'l'] + + const origin = (order.indexOf(this.eventType) + 4) % order.length + const constantPoint = this.aroundCenter ? [this.box.cx, this.box.cy] : this.points[origin] + + let scale = this.eventType.includes('t') || this.eventType.includes('b') ? scaleY : scaleX + scale = this.eventType.length === 2 ? Math.max(scaleX, scaleY) : scale + + box = scaleBox(this.box, constantPoint, scale) + } + + if ( + this.el.dispatch('resize', { + box: new Box(box), + angle: 0, + eventType: this.eventType, + event: e, + handler: this, + }).defaultPrevented + ) { + return + } + + this.el.size(box.width, box.height).move(box.x, box.y) + } + + movePoint(e) { + this.lastEvent = e + const { x, y } = this.snapToGrid(this.el.point(getCoordsFromEvent(e))) + const pointArr = this.el.array().slice() + pointArr[this.index] = [x, y] + + if ( + this.el.dispatch('resize', { + box: maxBoxFromPoints(pointArr), + angle: 0, + eventType: this.eventType, + event: e, + handler: this, + }).defaultPrevented + ) { + return + } + + this.el.plot(pointArr) + } + + rotate(e) { + this.lastEvent = e + + const startPoint = this.startPoint + const endPoint = this.el.point(getCoordsFromEvent(e)) + + const { cx, cy } = this.box + + const dx1 = startPoint.x - cx + const dy1 = startPoint.y - cy + + const dx2 = endPoint.x - cx + const dy2 = endPoint.y - cy + + const c = Math.sqrt(dx1 * dx1 + dy1 * dy1) * Math.sqrt(dx2 * dx2 + dy2 * dy2) + + if (c === 0) { + return + } + let angle = (Math.acos((dx1 * dx2 + dy1 * dy2) / c) / Math.PI) * 180 + + // catches 0 angle and NaN angle that are zero as well (but numerically instable) + if (!angle) return + + if (endPoint.x < startPoint.x) { + angle = -angle + } + + const matrix = new Matrix(this.el) + const { x: ox, y: oy } = new Point(cx, cy).transformO(matrix) + + const { rotate } = matrix.decompose() + const resultAngle = this.snapToAngle(rotate + angle) - rotate + + if ( + this.el.dispatch('resize', { + box: this.box, + angle: resultAngle, + eventType: this.eventType, + event: e, + handler: this, + }).defaultPrevented + ) { + return + } + + this.el.transform(matrix.rotateO(resultAngle, ox, oy)) + } + + endResize(ev) { + // Unbind resize and end events to window + if (this.eventType !== 'rot' && this.eventType !== 'point') { + this.resize(ev) + } + + this.lastEvent = null + + this.eventType = '' + off(window, 'mousemove.resize touchmove.resize') + off(window, 'mouseup.resize touchend.resize') + } + + snapToGrid(point) { + if (this.grid) { + point.x = Math.round(point.x / this.grid) * this.grid + point.y = Math.round(point.y / this.grid) * this.grid + } + + return point + } + + snapToAngle(angle) { + if (this.degree) { + angle = Math.round(angle / this.degree) * this.degree + } + + return angle + } +} diff --git a/node_modules/@svgdotjs/svg.resize.js/src/main.js b/node_modules/@svgdotjs/svg.resize.js/src/main.js new file mode 100644 index 0000000..833a9e9 --- /dev/null +++ b/node_modules/@svgdotjs/svg.resize.js/src/main.js @@ -0,0 +1,4 @@ +import '@svgdotjs/svg.select.js' +import '@svgdotjs/svg.select.js/src/svg.select.css' + +export * from './svg.resize' diff --git a/node_modules/@svgdotjs/svg.resize.js/src/svg.resize.js b/node_modules/@svgdotjs/svg.resize.js/src/svg.resize.js new file mode 100644 index 0000000..f6b33db --- /dev/null +++ b/node_modules/@svgdotjs/svg.resize.js/src/svg.resize.js @@ -0,0 +1,32 @@ +import { extend, Element } from '@svgdotjs/svg.js' +import { ResizeHandler } from './ResizeHandler' + +extend(Element, { + // Resize element with mouse + resize: function (enabled = true, options = {}) { + if (typeof enabled === 'object') { + options = enabled + enabled = true + } + + let resizeHandler = this.remember('_ResizeHandler') + + if (!resizeHandler) { + if (enabled.prototype instanceof ResizeHandler) { + /* eslint new-cap: ["error", { "newIsCap": false }] */ + resizeHandler = new enabled(this) + enabled = true + } else { + resizeHandler = new ResizeHandler(this) + } + + this.remember('_resizeHandler', resizeHandler) + } + + resizeHandler.active(enabled, options) + + return this + }, +}) + +export { ResizeHandler } diff --git a/node_modules/@svgdotjs/svg.resize.js/svg.resize.js.d.ts b/node_modules/@svgdotjs/svg.resize.js/svg.resize.js.d.ts new file mode 100644 index 0000000..4aa150b --- /dev/null +++ b/node_modules/@svgdotjs/svg.resize.js/svg.resize.js.d.ts @@ -0,0 +1,19 @@ +import { ResizeHandler } from './src/ResizeHandler.js' + +interface ResizeOptions { + preserveAspectRatio: boolean + aroundCenter: boolean + grid: number + degree: number +} + +declare module '@svgdotjs/svg.js' { + interface Element { + resize(): this + + resize(enable: boolean): this + resize(options: ResizeOptions): this + resize(handler: ResizeHandler): this + resize(attr?: ResizeHandler | ResizeOptions | boolean): this + } +} diff --git a/node_modules/@svgdotjs/svg.select.js/LICENSE b/node_modules/@svgdotjs/svg.select.js/LICENSE new file mode 100644 index 0000000..ca43f86 --- /dev/null +++ b/node_modules/@svgdotjs/svg.select.js/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Fuzzy + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/node_modules/@svgdotjs/svg.select.js/README.md b/node_modules/@svgdotjs/svg.select.js/README.md new file mode 100644 index 0000000..3c7c3a4 --- /dev/null +++ b/node_modules/@svgdotjs/svg.select.js/README.md @@ -0,0 +1,105 @@ +# svg.select.js + +An extension of [svg.js](https://github.com/svgdotjs/svg.js) which allows to select elements with mouse + +## Demo + +For a demo see http://svgjs.dev/svg.resize.js/ + +## Get Started + +- Install `svg.js` and `svg.select.js` using npm: + + ```bash + npm i @svgdotjs/svg.js @svgdotjs/svg.select.js + ``` + +- Or get it from a cnd: + + ```html + + + ``` + +- Select a rectangle using this simple piece of code: + + ```ts + var canvas = new SVG().addTo('body').size(500, 500) + canvas.rect(50, 50).fill('red').select() + ``` + +## Usage + +Select + +```ts +var canvas = SVG().addTo('body') +var rect = canvas.rect(100, 100) +var polygon = canvas.polygon([ + [100, 100], + [200, 100], + [200, 200], + [100, 200], +]) +rect.select() +polygon.pointSelect() + +// both also works +polygon.select().pointSelect() +``` + +Unselect + +```ts +rect.select(false) +``` + +## Adaptation + +Sometimes, the default shape is not to your liking. Therefore, you can create your own handles by passing in a create and update function: + +```ts +rect.select({ + createHandle: (group, p, index, pointArr, handleName) => group.circle(10).css({ stroke: '#666', fill: 'blue' }), + updateHandle: (group, p, index, pointArr, handleName) => group.center(p[0], p[1]), + createRot: (group) => group.circle(10).css({ stroke: '#666', fill: 'blue' }), + updateRot: (group, rotPoint, handlePoints) => group.center(p[0], p[1]), +}) + +polygon.pointSelect({ + createHandle: (group, p, index, pointArr, handleName) => group.circle(10).css({ stroke: '#666', fill: 'blue' }), + updateHandle: (group, p, index, pointArr, handleName) => group.center(p[0], p[1]), +}) +``` + +You can style the selection with the classes + +- `svg_select_shape` - _normal selection_ +- `svg_select_shape_pointSelection` - _point selection_ +- `svg_select_handle`- _any normal selection handles_ +- `svg_select_handle_lt` - _left top_ +- `svg_select_handle_rt` - _right top_ +- `svg_select_handle_rb` - _right bottom_ +- `svg_select_handle_lb` - _left bottom_ +- `svg_select_handle_t` - _top_ +- `svg_select_handle_r` - _right_ +- `svg_select_handle_b` - _bottom_ +- `svg_select_handle_l` - _left_ +- `svg_select_handle_rot` - _rotation point_ +- `svg_select_handle_point` - _point select point_ + +## Contributing + +```bash +git clone https://github.com/svgdotjs/svg.select.js.git +cd svg.select.js +npm install +npm run dev +``` + +## Migration from svg.js v2 + +- The css classes changed. In case you used your own styling, you'll need to adapt +- A lot of options got dropped in favor of the `create` and `update` functions + - In case you want to hide certain handles, just create an element without any size and pass a noop to update +- the deepSelect option was moved to its own function and renamed to `pointSelect` diff --git a/node_modules/@svgdotjs/svg.select.js/dist/svg.select.css b/node_modules/@svgdotjs/svg.select.js/dist/svg.select.css new file mode 100644 index 0000000..23270a4 --- /dev/null +++ b/node_modules/@svgdotjs/svg.select.js/dist/svg.select.css @@ -0,0 +1 @@ +.svg_select_shape{stroke-width:1;stroke-dasharray:10 10;stroke:#000;stroke-opacity:.1;pointer-events:none;fill:none}.svg_select_shape_pointSelect{stroke-width:1;fill:none;stroke-dasharray:10 10;stroke:#000;stroke-opacity:.8;pointer-events:none}.svg_select_handle{stroke-width:3;stroke:#000;fill:none}.svg_select_handle_rot{fill:#fff;stroke:#000;stroke-width:1;cursor:move}.svg_select_handle_lt{cursor:nw-resize}.svg_select_handle_rt{cursor:ne-resize}.svg_select_handle_rb{cursor:se-resize}.svg_select_handle_lb{cursor:sw-resize}.svg_select_handle_t{cursor:n-resize}.svg_select_handle_r{cursor:e-resize}.svg_select_handle_b{cursor:s-resize}.svg_select_handle_l{cursor:w-resize}.svg_select_handle_point{stroke:#000;stroke-width:1;cursor:move;fill:#fff} diff --git a/node_modules/@svgdotjs/svg.select.js/dist/svg.select.iife.js b/node_modules/@svgdotjs/svg.select.js/dist/svg.select.iife.js new file mode 100644 index 0000000..e4167eb --- /dev/null +++ b/node_modules/@svgdotjs/svg.select.js/dist/svg.select.iife.js @@ -0,0 +1,3 @@ +/*! @svgdotjs/svg.select.js v4.0.2 MIT*/; +this.svg=this.svg||{},this.svg.select=this.svg.select||{},this.svg.select.js=function(t,e){"use strict";function s(t,e,s,i=null){return function(n){n.preventDefault(),n.stopPropagation();var o=n.pageX||n.touches[0].pageX,a=n.pageY||n.touches[0].pageY;e.fire(t,{x:o,y:a,event:n,index:i,points:s})}}function i([t,e],{a:s,b:i,c:n,d:o,e:a,f:l}){return[t*s+e*n+a,t*i+e*o+l]}class n{constructor(t){this.el=t,t.remember("_selectHandler",this),this.selection=new e.G,this.order=["lt","t","rt","r","rb","b","lb","l","rot"],this.mutationHandler=this.mutationHandler.bind(this);const s=e.getWindow();this.observer=new s.MutationObserver(this.mutationHandler)}init(t){this.createHandle=t.createHandle||this.createHandleFn,this.createRot=t.createRot||this.createRotFn,this.updateHandle=t.updateHandle||this.updateHandleFn,this.updateRot=t.updateRot||this.updateRotFn,this.el.root().put(this.selection),this.updatePoints(),this.createSelection(),this.createResizeHandles(),this.updateResizeHandles(),this.createRotationHandle(),this.updateRotationHandle(),this.observer.observe(this.el.node,{attributes:!0})}active(t,e){if(!t)return this.selection.clear().remove(),void this.observer.disconnect();this.init(e)}createSelection(){this.selection.polygon(this.handlePoints).addClass("svg_select_shape")}updateSelection(){this.selection.get(0).plot(this.handlePoints)}createResizeHandles(){this.handlePoints.forEach(((t,e,i)=>{const n=this.order[e];this.createHandle.call(this,this.selection,t,e,i,n),this.selection.get(e+1).addClass("svg_select_handle svg_select_handle_"+n).on("mousedown.selection touchstart.selection",s(n,this.el,this.handlePoints,e))}))}createHandleFn(t){t.polyline()}updateHandleFn(t,e,s,i){const n=i.at(s-1),o=i[(s+1)%i.length],a=e,l=[a[0]-n[0],a[1]-n[1]],h=[a[0]-o[0],a[1]-o[1]],r=Math.sqrt(l[0]*l[0]+l[1]*l[1]),c=Math.sqrt(h[0]*h[0]+h[1]*h[1]),d=[l[0]/r,l[1]/r],u=[h[0]/c,h[1]/c],p=[a[0]-10*d[0],a[1]-10*d[1]],H=[a[0]-10*u[0],a[1]-10*u[1]];t.plot([p,a,H])}updateResizeHandles(){this.handlePoints.forEach(((t,e,s)=>{const i=this.order[e];this.updateHandle.call(this,this.selection.get(e+1),t,e,s,i)}))}createRotFn(t){t.line(),t.circle(5)}getPoint(t){return this.handlePoints[this.order.indexOf(t)]}getPointHandle(t){return this.selection.get(this.order.indexOf(t)+1)}updateRotFn(t,e){const s=this.getPoint("t");t.get(0).plot(s[0],s[1],e[0],e[1]),t.get(1).center(e[0],e[1])}createRotationHandle(){const t=this.selection.group().addClass("svg_select_handle_rot").on("mousedown.selection touchstart.selection",s("rot",this.el,this.handlePoints));this.createRot.call(this,t)}updateRotationHandle(){const t=this.selection.findOne("g.svg_select_handle_rot");this.updateRot(t,this.rotationPoint,this.handlePoints)}updatePoints(){const t=this.el.bbox(),e=this.el.root().screenCTM().inverseO().multiplyO(this.el.screenCTM());this.handlePoints=this.getHandlePoints(t).map((t=>i(t,e))),this.rotationPoint=i(this.getRotationPoint(t),e)}getHandlePoints({x:t,x2:e,y:s,y2:i,cx:n,cy:o}=this.el.bbox()){return[[t,s],[n,s],[e,s],[e,o],[e,i],[n,i],[t,i],[t,o]]}getRotationPoint({y:t,cx:e}=this.el.bbox()){return[e,t-20]}mutationHandler(){this.updatePoints(),this.updateSelection(),this.updateResizeHandles(),this.updateRotationHandle()}}class o{constructor(t){this.el=t,t.remember("_pointSelectHandler",this),this.selection=new e.G,this.order=["lt","t","rt","r","rb","b","lb","l","rot"],this.mutationHandler=this.mutationHandler.bind(this);const s=e.getWindow();this.observer=new s.MutationObserver(this.mutationHandler)}init(t){this.createHandle=t.createHandle||this.createHandleFn,this.updateHandle=t.updateHandle||this.updateHandleFn,this.el.root().put(this.selection),this.updatePoints(),this.createSelection(),this.createPointHandles(),this.updatePointHandles(),this.observer.observe(this.el.node,{attributes:!0})}active(t,e){if(!t)return this.selection.clear().remove(),void this.observer.disconnect();this.init(e)}createSelection(){this.selection.polygon(this.points).addClass("svg_select_shape_pointSelect")}updateSelection(){this.selection.get(0).plot(this.points)}createPointHandles(){this.points.forEach(((t,e,i)=>{this.createHandle.call(this,this.selection,t,e,i),this.selection.get(e+1).addClass("svg_select_handle_point").on("mousedown.selection touchstart.selection",s("point",this.el,this.points,e))}))}createHandleFn(t){t.circle(5)}updateHandleFn(t,e){t.center(e[0],e[1])}updatePointHandles(){this.points.forEach(((t,e,s)=>{this.updateHandle.call(this,this.selection.get(e+1),t,e,s)}))}updatePoints(){const t=this.el.parent().screenCTM().inverseO().multiplyO(this.el.screenCTM());this.points=this.el.array().map((e=>i(e,t)))}mutationHandler(){this.updatePoints(),this.updateSelection(),this.updatePointHandles()}}const a=t=>function(e=!0,s={}){"object"==typeof e&&(s=e,e=!0);let i=this.remember("_"+t.name);return i||(e.prototype instanceof n?(i=new e(this),e=!0):i=new t(this),this.remember("_"+t.name,i)),i.active(e,s),this};return e.extend(e.Element,{select:a(n)}),e.extend([e.Polygon,e.Polyline,e.Line],{pointSelect:a(o)}),t.PointSelectHandler=o,t.SelectHandler=n,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),t}({},SVG); +//# sourceMappingURL=svg.select.iife.js.map diff --git a/node_modules/@svgdotjs/svg.select.js/dist/svg.select.iife.js.map b/node_modules/@svgdotjs/svg.select.js/dist/svg.select.iife.js.map new file mode 100644 index 0000000..3a4e577 --- /dev/null +++ b/node_modules/@svgdotjs/svg.select.js/dist/svg.select.iife.js.map @@ -0,0 +1 @@ +{"version":3,"file":"svg.select.iife.js","sources":["../src/utils.js","../src/SelectHandler.js","../src/PointSelectHandler.js","../src/svg.select.js"],"sourcesContent":["/**\n *\n * @param {string} eventName\n * @param {import('@svgdotjs/svg.js').Element} el\n * @param {number | null} index\n */\nexport function getMoseDownFunc(eventName, el, points, index = null) {\n return function (ev) {\n ev.preventDefault()\n ev.stopPropagation()\n\n var x = ev.pageX || ev.touches[0].pageX\n var y = ev.pageY || ev.touches[0].pageY\n el.fire(eventName, { x: x, y: y, event: ev, index, points })\n }\n}\n\nexport function transformPoint([x, y], { a, b, c, d, e, f }) {\n return [x * a + y * c + e, x * b + y * d + f]\n}\n","import { G, getWindow } from '@svgdotjs/svg.js'\nimport { getMoseDownFunc, transformPoint } from './utils'\n\nexport class SelectHandler {\n constructor(el) {\n this.el = el\n el.remember('_selectHandler', this)\n this.selection = new G()\n this.order = ['lt', 't', 'rt', 'r', 'rb', 'b', 'lb', 'l', 'rot']\n this.mutationHandler = this.mutationHandler.bind(this)\n\n const win = getWindow()\n this.observer = new win.MutationObserver(this.mutationHandler)\n }\n\n init(options) {\n this.createHandle = options.createHandle || this.createHandleFn\n this.createRot = options.createRot || this.createRotFn\n\n this.updateHandle = options.updateHandle || this.updateHandleFn\n this.updateRot = options.updateRot || this.updateRotFn\n\n // mount group\n this.el.root().put(this.selection)\n\n this.updatePoints()\n this.createSelection()\n this.createResizeHandles()\n this.updateResizeHandles()\n this.createRotationHandle()\n this.updateRotationHandle()\n this.observer.observe(this.el.node, { attributes: true })\n }\n\n active(val, options) {\n // Disable selection\n if (!val) {\n this.selection.clear().remove()\n this.observer.disconnect()\n return\n }\n\n // Enable selection\n this.init(options)\n }\n\n createSelection() {\n this.selection.polygon(this.handlePoints).addClass('svg_select_shape')\n }\n\n updateSelection() {\n this.selection.get(0).plot(this.handlePoints)\n }\n\n createResizeHandles() {\n this.handlePoints.forEach((p, index, arr) => {\n const name = this.order[index]\n this.createHandle.call(this, this.selection, p, index, arr, name)\n\n this.selection\n .get(index + 1)\n .addClass('svg_select_handle svg_select_handle_' + name)\n .on('mousedown.selection touchstart.selection', getMoseDownFunc(name, this.el, this.handlePoints, index))\n })\n }\n\n createHandleFn(group) {\n group.polyline()\n }\n\n updateHandleFn(shape, point, index, arr) {\n const before = arr.at(index - 1)\n const next = arr[(index + 1) % arr.length]\n const p = point\n\n const diff1 = [p[0] - before[0], p[1] - before[1]]\n const diff2 = [p[0] - next[0], p[1] - next[1]]\n\n const len1 = Math.sqrt(diff1[0] * diff1[0] + diff1[1] * diff1[1])\n const len2 = Math.sqrt(diff2[0] * diff2[0] + diff2[1] * diff2[1])\n\n const normalized1 = [diff1[0] / len1, diff1[1] / len1]\n const normalized2 = [diff2[0] / len2, diff2[1] / len2]\n\n const beforeNew = [p[0] - normalized1[0] * 10, p[1] - normalized1[1] * 10]\n const nextNew = [p[0] - normalized2[0] * 10, p[1] - normalized2[1] * 10]\n\n shape.plot([beforeNew, p, nextNew])\n }\n\n updateResizeHandles() {\n this.handlePoints.forEach((p, index, arr) => {\n const name = this.order[index]\n this.updateHandle.call(this, this.selection.get(index + 1), p, index, arr, name)\n })\n }\n\n createRotFn(group) {\n group.line()\n group.circle(5)\n }\n\n getPoint(name) {\n return this.handlePoints[this.order.indexOf(name)]\n }\n\n getPointHandle(name) {\n return this.selection.get(this.order.indexOf(name) + 1)\n }\n\n updateRotFn(group, rotPoint) {\n const topPoint = this.getPoint('t')\n group.get(0).plot(topPoint[0], topPoint[1], rotPoint[0], rotPoint[1])\n group.get(1).center(rotPoint[0], rotPoint[1])\n }\n\n createRotationHandle() {\n const handle = this.selection\n .group()\n .addClass('svg_select_handle_rot')\n .on('mousedown.selection touchstart.selection', getMoseDownFunc('rot', this.el, this.handlePoints))\n\n this.createRot.call(this, handle)\n }\n\n updateRotationHandle() {\n const group = this.selection.findOne('g.svg_select_handle_rot')\n this.updateRot(group, this.rotationPoint, this.handlePoints)\n }\n\n // gets new bounding box points and transform them into the elements space\n updatePoints() {\n const bbox = this.el.bbox()\n const fromShapeToUiMatrix = this.el.root().screenCTM().inverseO().multiplyO(this.el.screenCTM())\n\n this.handlePoints = this.getHandlePoints(bbox).map((p) => transformPoint(p, fromShapeToUiMatrix))\n this.rotationPoint = transformPoint(this.getRotationPoint(bbox), fromShapeToUiMatrix)\n }\n\n // A collection of all the points we need to draw our ui\n getHandlePoints({ x, x2, y, y2, cx, cy } = this.el.bbox()) {\n return [\n [x, y],\n [cx, y],\n [x2, y],\n [x2, cy],\n [x2, y2],\n [cx, y2],\n [x, y2],\n [x, cy],\n ]\n }\n\n // A collection of all the points we need to draw our ui\n getRotationPoint({ y, cx } = this.el.bbox()) {\n return [cx, y - 20]\n }\n\n mutationHandler() {\n this.updatePoints()\n\n this.updateSelection()\n this.updateResizeHandles()\n this.updateRotationHandle()\n }\n}\n","import { G, getWindow } from '@svgdotjs/svg.js'\nimport { getMoseDownFunc, transformPoint } from './utils'\n\nexport class PointSelectHandler {\n constructor(el) {\n this.el = el\n el.remember('_pointSelectHandler', this)\n this.selection = new G()\n this.order = ['lt', 't', 'rt', 'r', 'rb', 'b', 'lb', 'l', 'rot']\n this.mutationHandler = this.mutationHandler.bind(this)\n\n const win = getWindow()\n this.observer = new win.MutationObserver(this.mutationHandler)\n }\n\n init(options) {\n this.createHandle = options.createHandle || this.createHandleFn\n this.updateHandle = options.updateHandle || this.updateHandleFn\n\n // mount group\n this.el.root().put(this.selection)\n\n this.updatePoints()\n this.createSelection()\n this.createPointHandles()\n this.updatePointHandles()\n this.observer.observe(this.el.node, { attributes: true })\n }\n\n active(val, options) {\n // Disable selection\n if (!val) {\n this.selection.clear().remove()\n this.observer.disconnect()\n return\n }\n\n // Enable selection\n this.init(options)\n }\n\n createSelection() {\n this.selection.polygon(this.points).addClass('svg_select_shape_pointSelect')\n }\n\n updateSelection() {\n this.selection.get(0).plot(this.points)\n }\n\n createPointHandles() {\n this.points.forEach((p, index, arr) => {\n this.createHandle.call(this, this.selection, p, index, arr)\n\n this.selection\n .get(index + 1)\n .addClass('svg_select_handle_point')\n .on('mousedown.selection touchstart.selection', getMoseDownFunc('point', this.el, this.points, index))\n })\n }\n\n createHandleFn(group) {\n group.circle(5)\n }\n\n updateHandleFn(shape, point) {\n shape.center(point[0], point[1])\n }\n\n updatePointHandles() {\n this.points.forEach((p, index, arr) => {\n this.updateHandle.call(this, this.selection.get(index + 1), p, index, arr)\n })\n }\n\n // gets new bounding box points and transform them into the elements space\n updatePoints() {\n const fromShapeToUiMatrix = this.el.parent().screenCTM().inverseO().multiplyO(this.el.screenCTM())\n this.points = this.el.array().map((p) => transformPoint(p, fromShapeToUiMatrix))\n }\n\n mutationHandler() {\n this.updatePoints()\n\n this.updateSelection()\n this.updatePointHandles()\n }\n}\n","import { Element, Line, Polygon, Polyline, extend } from '@svgdotjs/svg.js'\nimport { SelectHandler } from './SelectHandler'\nimport { PointSelectHandler } from './PointSelectHandler'\n\nconst getSelectFn = (handleClass) => {\n return function (enabled = true, options = {}) {\n if (typeof enabled === 'object') {\n options = enabled\n enabled = true\n }\n\n let selectHandler = this.remember('_' + handleClass.name)\n\n if (!selectHandler) {\n if (enabled.prototype instanceof SelectHandler) {\n selectHandler = new enabled(this)\n enabled = true\n } else {\n selectHandler = new handleClass(this)\n }\n\n this.remember('_' + handleClass.name, selectHandler)\n }\n\n selectHandler.active(enabled, options)\n\n return this\n }\n}\n\nextend(Element, {\n select: getSelectFn(SelectHandler),\n})\n\nextend([Polygon, Polyline, Line], {\n pointSelect: getSelectFn(PointSelectHandler),\n})\n\nexport { SelectHandler, PointSelectHandler }\n"],"names":["getMoseDownFunc","eventName","el","points","index","ev","preventDefault","stopPropagation","x","pageX","touches","y","pageY","fire","event","transformPoint","a","b","c","d","e","f","SelectHandler","constructor","this","remember","selection","G","order","mutationHandler","bind","win","getWindow","observer","MutationObserver","init","options","createHandle","createHandleFn","createRot","createRotFn","updateHandle","updateHandleFn","updateRot","updateRotFn","root","put","updatePoints","createSelection","createResizeHandles","updateResizeHandles","createRotationHandle","updateRotationHandle","observe","node","attributes","active","val","clear","remove","disconnect","polygon","handlePoints","addClass","updateSelection","get","plot","forEach","p","arr","name","call","on","group","polyline","shape","point","before","at","next","length","diff1","diff2","len1","Math","sqrt","len2","normalized1","normalized2","beforeNew","nextNew","line","circle","getPoint","indexOf","getPointHandle","rotPoint","topPoint","center","handle","findOne","rotationPoint","bbox","fromShapeToUiMatrix","screenCTM","inverseO","multiplyO","getHandlePoints","map","getRotationPoint","x2","y2","cx","cy","PointSelectHandler","createPointHandles","updatePointHandles","parent","array","getSelectFn","handleClass","enabled","selectHandler","prototype","svg_js","extend","Element","select","Polygon","Polyline","Line","pointSelect"],"mappings":";wGAMO,SAASA,EAAgBC,EAAWC,EAAIC,EAAQC,EAAQ,MAC7D,OAAO,SAAUC,GACfA,EAAGC,iBACHD,EAAGE,kBAEH,IAAIC,EAAIH,EAAGI,OAASJ,EAAGK,QAAQ,GAAGD,MAC9BE,EAAIN,EAAGO,OAASP,EAAGK,QAAQ,GAAGE,MAC/BV,EAAAW,KAAKZ,EAAW,CAAEO,IAAMG,IAAMG,MAAOT,EAAID,QAAOD,UACpD,CACH,CAEO,SAASY,GAAgBP,EAAGG,IAAIK,EAAEA,EAAGC,EAAAA,EAAAC,EAAGA,EAAGC,EAAAA,EAAAC,EAAGA,EAAGC,EAAAA,IAC/C,MAAA,CAACb,EAAIQ,EAAIL,EAAIO,EAAIE,EAAGZ,EAAIS,EAAIN,EAAIQ,EAAIE,EAC7C,CChBO,MAAMC,EACX,WAAAC,CAAYrB,GACVsB,KAAKtB,GAAKA,EACPA,EAAAuB,SAAS,iBAAkBD,MACzBA,KAAAE,UAAY,IAAIC,IAChBH,KAAAI,MAAQ,CAAC,KAAM,IAAK,KAAM,IAAK,KAAM,IA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AAKrB,OAAQC,GAAM,GAE1G,CAED,cAAAkC,CAAemC,GACbA,EAAMmB,OAAO,EACd,CAED,cAAAlD,CAAeiC,EAAOC,GACpBD,EAAMuB,OAAOtB,EAAM,GAAIA,EAAM,GAC9B,CAED,kBAAAwC,GACE5F,KAAKrB,OAAOgE,SAAQ,CAACC,EAAGhE,EAAOiE,KACxB7C,KAAAiB,aAAa8B,KAAK/C,KAAMA,KAAKE,UAAUuC,IAAI7D,EAAQ,GAAIgE,EAAGhE,EAAOiE,EAAG,GAE5E,CAGD,YAAAtB,GACE,MAAMwD,EAAsB/E,KAAKtB,GAAGmH,SAASb,YAAYC,WAAWC,UAAUlF,KAAKtB,GAAGsG,aACjFhF,KAAArB,OAASqB,KAAKtB,GAAGoH,QAAQV,KAAKxC,GAAMrD,EAAeqD,EAAGmC,IAC5D,CAED,eAAA1E,GACEL,KAAKuB,eAELvB,KAAKwC,kBACLxC,KAAK4F,oBACN,ECjFG,MAAAG,EAAeC,GACZ,SAAUC,GAAU,EAAMrF,EAAU,CAAA,GAClB,iBAAZqF,IACCrF,EAAAqF,EACAA,GAAA,GAGZ,IAAIC,EAAgBlG,KAAKC,SAAS,IAAM+F,EAAYlD,MAe7C,OAbFoD,IACCD,EAAQE,qBAAqBrG,GACfoG,EAAA,IAAID,EAAQjG,MAClBiG,GAAA,GAEMC,EAAA,IAAIF,EAAYhG,MAGlCA,KAAKC,SAAS,IAAM+F,EAAYlD,KAAMoD,IAG1BA,EAAAlE,OAAOiE,EAASrF,GAEvBZ,IACR,SAGGoG,EAAAC,OAACC,UAAS,CACdC,OAAQR,EAAYjG,KAGhBsG,EAAAC,OAAC,CAACG,EAAOA,QAAEC,WAAUC,EAAAA,MAAO,CAChCC,YAAaZ,EAAYL"} \ No newline at end of file diff --git a/node_modules/@svgdotjs/svg.select.js/dist/svg.select.js b/node_modules/@svgdotjs/svg.select.js/dist/svg.select.js new file mode 100644 index 0000000..391f21f --- /dev/null +++ b/node_modules/@svgdotjs/svg.select.js/dist/svg.select.js @@ -0,0 +1,239 @@ +/*! +* @svgdotjs/svg.select.js - An extension of svg.js which allows to select elements with mouse +* @version 4.0.2 +* https://github.com/svgdotjs/svg.select.js +* +* @copyright Ulrich-Matthias Schäfer +* @license MIT +* +* BUILT: Wed Nov 20 2024 23:17:23 GMT+0100 (Central European Standard Time) +*/ +; +import { G, getWindow, extend, Element, Polygon, Polyline, Line } from "@svgdotjs/svg.js"; +function getMoseDownFunc(eventName, el, points, index = null) { + return function(ev) { + ev.preventDefault(); + ev.stopPropagation(); + var x = ev.pageX || ev.touches[0].pageX; + var y = ev.pageY || ev.touches[0].pageY; + el.fire(eventName, { x, y, event: ev, index, points }); + }; +} +function transformPoint([x, y], { a, b, c, d, e, f }) { + return [x * a + y * c + e, x * b + y * d + f]; +} +class SelectHandler { + constructor(el) { + this.el = el; + el.remember("_selectHandler", this); + this.selection = new G(); + this.order = ["lt", "t", "rt", "r", "rb", "b", "lb", "l", "rot"]; + this.mutationHandler = this.mutationHandler.bind(this); + const win = getWindow(); + this.observer = new win.MutationObserver(this.mutationHandler); + } + init(options) { + this.createHandle = options.createHandle || this.createHandleFn; + this.createRot = options.createRot || this.createRotFn; + this.updateHandle = options.updateHandle || this.updateHandleFn; + this.updateRot = options.updateRot || this.updateRotFn; + this.el.root().put(this.selection); + this.updatePoints(); + this.createSelection(); + this.createResizeHandles(); + this.updateResizeHandles(); + this.createRotationHandle(); + this.updateRotationHandle(); + this.observer.observe(this.el.node, { attributes: true }); + } + active(val, options) { + if (!val) { + this.selection.clear().remove(); + this.observer.disconnect(); + return; + } + this.init(options); + } + createSelection() { + this.selection.polygon(this.handlePoints).addClass("svg_select_shape"); + } + updateSelection() { + this.selection.get(0).plot(this.handlePoints); + } + createResizeHandles() { + this.handlePoints.forEach((p, index, arr) => { + const name = this.order[index]; + this.createHandle.call(this, this.selection, p, index, arr, name); + this.selection.get(index + 1).addClass("svg_select_handle svg_select_handle_" + name).on("mousedown.selection touchstart.selection", getMoseDownFunc(name, this.el, this.handlePoints, index)); + }); + } + createHandleFn(group) { + group.polyline(); + } + updateHandleFn(shape, point, index, arr) { + const before = arr.at(index - 1); + const next = arr[(index + 1) % arr.length]; + const p = point; + const diff1 = [p[0] - before[0], p[1] - before[1]]; + const diff2 = [p[0] - next[0], p[1] - next[1]]; + const len1 = Math.sqrt(diff1[0] * diff1[0] + diff1[1] * diff1[1]); + const len2 = Math.sqrt(diff2[0] * diff2[0] + diff2[1] * diff2[1]); + const normalized1 = [diff1[0] / len1, diff1[1] / len1]; + const normalized2 = [diff2[0] / len2, diff2[1] / len2]; + const beforeNew = [p[0] - normalized1[0] * 10, p[1] - normalized1[1] * 10]; + const nextNew = [p[0] - normalized2[0] * 10, p[1] - normalized2[1] * 10]; + shape.plot([beforeNew, p, nextNew]); + } + updateResizeHandles() { + this.handlePoints.forEach((p, index, arr) => { + const name = this.order[index]; + this.updateHandle.call(this, this.selection.get(index + 1), p, index, arr, name); + }); + } + createRotFn(group) { + group.line(); + group.circle(5); + } + getPoint(name) { + return this.handlePoints[this.order.indexOf(name)]; + } + getPointHandle(name) { + return this.selection.get(this.order.indexOf(name) + 1); + } + updateRotFn(group, rotPoint) { + const topPoint = this.getPoint("t"); + group.get(0).plot(topPoint[0], topPoint[1], rotPoint[0], rotPoint[1]); + group.get(1).center(rotPoint[0], rotPoint[1]); + } + createRotationHandle() { + const handle = this.selection.group().addClass("svg_select_handle_rot").on("mousedown.selection touchstart.selection", getMoseDownFunc("rot", this.el, this.handlePoints)); + this.createRot.call(this, handle); + } + updateRotationHandle() { + const group = this.selection.findOne("g.svg_select_handle_rot"); + this.updateRot(group, this.rotationPoint, this.handlePoints); + } + // gets new bounding box points and transform them into the elements space + updatePoints() { + const bbox = this.el.bbox(); + const fromShapeToUiMatrix = this.el.root().screenCTM().inverseO().multiplyO(this.el.screenCTM()); + this.handlePoints = this.getHandlePoints(bbox).map((p) => transformPoint(p, fromShapeToUiMatrix)); + this.rotationPoint = transformPoint(this.getRotationPoint(bbox), fromShapeToUiMatrix); + } + // A collection of all the points we need to draw our ui + getHandlePoints({ x, x2, y, y2, cx, cy } = this.el.bbox()) { + return [ + [x, y], + [cx, y], + [x2, y], + [x2, cy], + [x2, y2], + [cx, y2], + [x, y2], + [x, cy] + ]; + } + // A collection of all the points we need to draw our ui + getRotationPoint({ y, cx } = this.el.bbox()) { + return [cx, y - 20]; + } + mutationHandler() { + this.updatePoints(); + this.updateSelection(); + this.updateResizeHandles(); + this.updateRotationHandle(); + } +} +class PointSelectHandler { + constructor(el) { + this.el = el; + el.remember("_pointSelectHandler", this); + this.selection = new G(); + this.order = ["lt", "t", "rt", "r", "rb", "b", "lb", "l", "rot"]; + this.mutationHandler = this.mutationHandler.bind(this); + const win = getWindow(); + this.observer = new win.MutationObserver(this.mutationHandler); + } + init(options) { + this.createHandle = options.createHandle || this.createHandleFn; + this.updateHandle = options.updateHandle || this.updateHandleFn; + this.el.root().put(this.selection); + this.updatePoints(); + this.createSelection(); + this.createPointHandles(); + this.updatePointHandles(); + this.observer.observe(this.el.node, { attributes: true }); + } + active(val, options) { + if (!val) { + this.selection.clear().remove(); + this.observer.disconnect(); + return; + } + this.init(options); + } + createSelection() { + this.selection.polygon(this.points).addClass("svg_select_shape_pointSelect"); + } + updateSelection() { + this.selection.get(0).plot(this.points); + } + createPointHandles() { + this.points.forEach((p, index, arr) => { + this.createHandle.call(this, this.selection, p, index, arr); + this.selection.get(index + 1).addClass("svg_select_handle_point").on("mousedown.selection touchstart.selection", getMoseDownFunc("point", this.el, this.points, index)); + }); + } + createHandleFn(group) { + group.circle(5); + } + updateHandleFn(shape, point) { + shape.center(point[0], point[1]); + } + updatePointHandles() { + this.points.forEach((p, index, arr) => { + this.updateHandle.call(this, this.selection.get(index + 1), p, index, arr); + }); + } + // gets new bounding box points and transform them into the elements space + updatePoints() { + const fromShapeToUiMatrix = this.el.parent().screenCTM().inverseO().multiplyO(this.el.screenCTM()); + this.points = this.el.array().map((p) => transformPoint(p, fromShapeToUiMatrix)); + } + mutationHandler() { + this.updatePoints(); + this.updateSelection(); + this.updatePointHandles(); + } +} +const getSelectFn = (handleClass) => { + return function(enabled = true, options = {}) { + if (typeof enabled === "object") { + options = enabled; + enabled = true; + } + let selectHandler = this.remember("_" + handleClass.name); + if (!selectHandler) { + if (enabled.prototype instanceof SelectHandler) { + selectHandler = new enabled(this); + enabled = true; + } else { + selectHandler = new handleClass(this); + } + this.remember("_" + handleClass.name, selectHandler); + } + selectHandler.active(enabled, options); + return this; + }; +}; +extend(Element, { + select: getSelectFn(SelectHandler) +}); +extend([Polygon, Polyline, Line], { + pointSelect: getSelectFn(PointSelectHandler) +}); +export { + PointSelectHandler, + SelectHandler +}; +//# sourceMappingURL=svg.select.js.map diff --git a/node_modules/@svgdotjs/svg.select.js/dist/svg.select.js.map b/node_modules/@svgdotjs/svg.select.js/dist/svg.select.js.map new file mode 100644 index 0000000..7da2860 --- /dev/null +++ b/node_modules/@svgdotjs/svg.select.js/dist/svg.select.js.map @@ -0,0 +1 @@ +{"version":3,"file":"svg.select.js","sources":["../src/utils.js","../src/SelectHandler.js","../src/PointSelectHandler.js","../src/svg.select.js"],"sourcesContent":["/**\n *\n * @param {string} eventName\n * @param {import('@svgdotjs/svg.js').Element} el\n * @param {number | null} index\n */\nexport function getMoseDownFunc(eventName, el, points, index = null) {\n return function (ev) {\n ev.preventDefault()\n ev.stopPropagation()\n\n var x = ev.pageX || ev.touches[0].pageX\n var y = ev.pageY || ev.touches[0].pageY\n el.fire(eventName, { x: x, y: y, event: ev, index, points })\n }\n}\n\nexport function transformPoint([x, y], { a, b, c, d, e, f }) {\n return [x * a + y * c + e, x * b + y * d + f]\n}\n","import { G, getWindow } from '@svgdotjs/svg.js'\nimport { getMoseDownFunc, transformPoint } from './utils'\n\nexport class SelectHandler {\n constructor(el) {\n this.el = el\n el.remember('_selectHandler', this)\n this.selection = new G()\n this.order = ['lt', 't', 'rt', 'r', 'rb', 'b', 'lb', 'l', 'rot']\n this.mutationHandler = this.mutationHandler.bind(this)\n\n const win = getWindow()\n this.observer = new win.MutationObserver(this.mutationHandler)\n }\n\n init(options) {\n this.createHandle = options.createHandle || this.createHandleFn\n this.createRot = options.createRot || this.createRotFn\n\n this.updateHandle = options.updateHandle || this.updateHandleFn\n this.updateRot = options.updateRot || this.updateRotFn\n\n // mount group\n this.el.root().put(this.selection)\n\n this.updatePoints()\n this.createSelection()\n this.createResizeHandles()\n this.updateResizeHandles()\n this.createRotationHandle()\n this.updateRotationHandle()\n this.observer.observe(this.el.node, { attributes: true })\n }\n\n active(val, options) {\n // Disable selection\n if (!val) {\n this.selection.clear().remove()\n this.observer.disconnect()\n return\n }\n\n // Enable selection\n this.init(options)\n }\n\n createSelection() {\n this.selection.polygon(this.handlePoints).addClass('svg_select_shape')\n }\n\n updateSelection() {\n this.selection.get(0).plot(this.handlePoints)\n }\n\n createResizeHandles() {\n this.handlePoints.forEach((p, index, arr) => {\n const name = this.order[index]\n this.createHandle.call(this, this.selection, p, index, arr, name)\n\n this.selection\n .get(index + 1)\n .addClass('svg_select_handle svg_select_handle_' + name)\n .on('mousedown.selection touchstart.selection', getMoseDownFunc(name, this.el, this.handlePoints, index))\n })\n }\n\n createHandleFn(group) {\n group.polyline()\n }\n\n updateHandleFn(shape, point, index, arr) {\n const before = arr.at(index - 1)\n const next = arr[(index + 1) % arr.length]\n const p = point\n\n const diff1 = [p[0] - before[0], p[1] - before[1]]\n const diff2 = [p[0] - next[0], p[1] - next[1]]\n\n const len1 = Math.sqrt(diff1[0] * diff1[0] + diff1[1] * diff1[1])\n const len2 = Math.sqrt(diff2[0] * diff2[0] + diff2[1] * diff2[1])\n\n const normalized1 = [diff1[0] / len1, diff1[1] / len1]\n const normalized2 = [diff2[0] / len2, diff2[1] / len2]\n\n const beforeNew = [p[0] - normalized1[0] * 10, p[1] - normalized1[1] * 10]\n const nextNew = [p[0] - normalized2[0] * 10, p[1] - normalized2[1] * 10]\n\n shape.plot([beforeNew, p, nextNew])\n }\n\n updateResizeHandles() {\n this.handlePoints.forEach((p, index, arr) => {\n const name = this.order[index]\n this.updateHandle.call(this, this.selection.get(index + 1), p, index, arr, name)\n })\n }\n\n createRotFn(group) {\n group.line()\n group.circle(5)\n }\n\n getPoint(name) {\n return this.handlePoints[this.order.indexOf(name)]\n }\n\n getPointHandle(name) {\n return this.selection.get(this.order.indexOf(name) + 1)\n }\n\n updateRotFn(group, rotPoint) {\n const topPoint = this.getPoint('t')\n group.get(0).plot(topPoint[0], topPoint[1], rotPoint[0], rotPoint[1])\n group.get(1).center(rotPoint[0], rotPoint[1])\n }\n\n createRotationHandle() {\n const handle = this.selection\n .group()\n .addClass('svg_select_handle_rot')\n .on('mousedown.selection touchstart.selection', getMoseDownFunc('rot', this.el, this.handlePoints))\n\n this.createRot.call(this, handle)\n }\n\n updateRotationHandle() {\n const group = this.selection.findOne('g.svg_select_handle_rot')\n this.updateRot(group, this.rotationPoint, this.handlePoints)\n }\n\n // gets new bounding box points and transform them into the elements space\n updatePoints() {\n const bbox = this.el.bbox()\n const fromShapeToUiMatrix = this.el.root().screenCTM().inverseO().multiplyO(this.el.screenCTM())\n\n this.handlePoints = this.getHandlePoints(bbox).map((p) => transformPoint(p, fromShapeToUiMatrix))\n this.rotationPoint = transformPoint(this.getRotationPoint(bbox), fromShapeToUiMatrix)\n }\n\n // A collection of all the points we need to draw our ui\n getHandlePoints({ x, x2, y, y2, cx, cy } = this.el.bbox()) {\n return [\n [x, y],\n [cx, y],\n [x2, y],\n [x2, cy],\n [x2, y2],\n [cx, y2],\n [x, y2],\n [x, cy],\n ]\n }\n\n // A collection of all the points we need to draw our ui\n getRotationPoint({ y, cx } = this.el.bbox()) {\n return [cx, y - 20]\n }\n\n mutationHandler() {\n this.updatePoints()\n\n this.updateSelection()\n this.updateResizeHandles()\n this.updateRotationHandle()\n }\n}\n","import { G, getWindow } from '@svgdotjs/svg.js'\nimport { getMoseDownFunc, transformPoint } from './utils'\n\nexport class PointSelectHandler {\n constructor(el) {\n this.el = el\n el.remember('_pointSelectHandler', this)\n this.selection = new G()\n this.order = ['lt', 't', 'rt', 'r', 'rb', 'b', 'lb', 'l', 'rot']\n this.mutationHandler = this.mutationHandler.bind(this)\n\n const win = getWindow()\n this.observer = new win.MutationObserver(this.mutationHandler)\n }\n\n init(options) {\n this.createHandle = options.createHandle || this.createHandleFn\n this.updateHandle = options.updateHandle || this.updateHandleFn\n\n // mount group\n this.el.root().put(this.selection)\n\n this.updatePoints()\n this.createSelection()\n this.createPointHandles()\n this.updatePointHandles()\n this.observer.observe(this.el.node, { attributes: true })\n }\n\n active(val, options) {\n // Disable selection\n if (!val) {\n this.selection.clear().remove()\n this.observer.disconnect()\n return\n }\n\n // Enable selection\n this.init(options)\n }\n\n createSelection() {\n this.selection.polygon(this.points).addClass('svg_select_shape_pointSelect')\n }\n\n updateSelection() {\n this.selection.get(0).plot(this.points)\n }\n\n createPointHandles() {\n this.points.forEach((p, index, arr) => {\n this.createHandle.call(this, this.selection, p, index, arr)\n\n this.selection\n .get(index + 1)\n .addClass('svg_select_handle_point')\n .on('mousedown.selection touchstart.selection', getMoseDownFunc('point', this.el, this.points, index))\n })\n }\n\n createHandleFn(group) {\n group.circle(5)\n }\n\n updateHandleFn(shape, point) {\n shape.center(point[0], point[1])\n }\n\n updatePointHandles() {\n this.points.forEach((p, index, arr) => {\n this.updateHandle.call(this, this.selection.get(index + 1), p, index, arr)\n })\n }\n\n // gets new bounding box points and transform them into the elements space\n updatePoints() {\n const fromShapeToUiMatrix = this.el.parent().screenCTM().inverseO().multiplyO(this.el.screenCTM())\n this.points = this.el.array().map((p) => transformPoint(p, fromShapeToUiMatrix))\n }\n\n mutationHandler() {\n this.updatePoints()\n\n this.updateSelection()\n this.updatePointHandles()\n }\n}\n","import { Element, Line, Polygon, Polyline, extend } from '@svgdotjs/svg.js'\nimport { SelectHandler } from './SelectHandler'\nimport { PointSelectHandler } from './PointSelectHandler'\n\nconst getSelectFn = (handleClass) => {\n return function (enabled = true, options = {}) {\n if (typeof enabled === 'object') {\n options = enabled\n enabled = true\n }\n\n let selectHandler = this.remember('_' + handleClass.name)\n\n if (!selectHandler) {\n if (enabled.prototype instanceof SelectHandler) {\n selectHandler = new enabled(this)\n enabled = true\n } else {\n selectHandler = new handleClass(this)\n }\n\n this.remember('_' + handleClass.name, selectHandler)\n }\n\n selectHandler.active(enabled, options)\n\n return this\n }\n}\n\nextend(Element, {\n select: getSelectFn(SelectHandler),\n})\n\nextend([Polygon, Polyline, Line], {\n pointSelect: getSelectFn(PointSelectHandler),\n})\n\nexport { SelectHandler, PointSelectHandler }\n"],"names":[],"mappings":";;;;;;;;;;;;AAMO,SAAS,gBAAgB,WAAW,IAAI,QAAQ,QAAQ,MAAM;AACnE,SAAO,SAAU,IAAI;AACnB,OAAG,eAAgB;AACnB,OAAG,gBAAiB;AAEpB,QAAI,IAAI,GAAG,SAAS,GAAG,QAAQ,CAAC,EAAE;AAClC,QAAI,IAAI,GAAG,SAAS,GAAG,QAAQ,CAAC,EAAE;AAClC,OAAG,KAAK,WAAW,EAAE,GAAM,GAAM,OAAO,IAAI,OAAO,OAAM,CAAE;AAAA,EAC5D;AACH;AAEO,SAAS,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,EAAC,GAAI;AAC3D,SAAO,CAAC,IAAI,IAAI,IAAI,IAAI,GAAG,IAAI,IAAI,IAAI,IAAI,CAAC;AAC9C;AChBO,MAAM,cAAc;AAAA,EACzB,YAAY,IAAI;AACd,SAAK,KAAK;AACV,OAAG,SAAS,kBAAkB,IAAI;AAClC,SAAK,YAAY,IAAI,EAAG;AACxB,SAAK,QAAQ,CAAC,MAAM,KAAK,MAAM,KAAK,MAAM,KAAK,MAAM,KAAK,KAAK;AAC/D,SAAK,kBAAkB,KAAK,gBAAgB,KAAK,IAAI;AAErD,UAAM,MAAM,UAAW;AACvB,SAAK,WAAW,IAAI,IAAI,iBAAiB,KAAK,eAAe;AAAA,EAC9D;AAAA,EA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,YAAY,UAAU;AAC/B,gBAAU;AACV,gBAAU;AAAA,IACX;AAED,QAAI,gBAAgB,KAAK,SAAS,MAAM,YAAY,IAAI;AAExD,QAAI,CAAC,eAAe;AAClB,UAAI,QAAQ,qBAAqB,eAAe;AAC9C,wBAAgB,IAAI,QAAQ,IAAI;AAChC,kBAAU;AAAA,MAClB,OAAa;AACL,wBAAgB,IAAI,YAAY,IAAI;AAAA,MACrC;AAED,WAAK,SAAS,MAAM,YAAY,MAAM,aAAa;AAAA,IACpD;AAED,kBAAc,OAAO,SAAS,OAAO;AAErC,WAAO;AAAA,EACR;AACH;AAEA,OAAO,SAAS;AAAA,EACd,QAAQ,YAAY,aAAa;AACnC,CAAC;AAED,OAAO,CAAC,SAAS,UAAU,IAAI,GAAG;AAAA,EAChC,aAAa,YAAY,kBAAkB;AAC7C,CAAC;"} \ No newline at end of file diff --git a/node_modules/@svgdotjs/svg.select.js/dist/svg.select.umd.cjs b/node_modules/@svgdotjs/svg.select.js/dist/svg.select.umd.cjs new file mode 100644 index 0000000..326d1e5 --- /dev/null +++ b/node_modules/@svgdotjs/svg.select.js/dist/svg.select.umd.cjs @@ -0,0 +1,3 @@ +/*! @svgdotjs/svg.select.js v4.0.2 MIT*/; +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@svgdotjs/svg.js")):"function"==typeof define&&define.amd?define(["exports","@svgdotjs/svg.js"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).svg=t.svg||{},t.svg.select=t.svg.select||{},t.svg.select.js={}),t.SVG)}(this,(function(t,e){"use strict";function s(t,e,s,i=null){return function(n){n.preventDefault(),n.stopPropagation();var o=n.pageX||n.touches[0].pageX,a=n.pageY||n.touches[0].pageY;e.fire(t,{x:o,y:a,event:n,index:i,points:s})}}function i([t,e],{a:s,b:i,c:n,d:o,e:a,f:l}){return[t*s+e*n+a,t*i+e*o+l]}class n{constructor(t){this.el=t,t.remember("_selectHandler",this),this.selection=new e.G,this.order=["lt","t","rt","r","rb","b","lb","l","rot"],this.mutationHandler=this.mutationHandler.bind(this);const s=e.getWindow();this.observer=new s.MutationObserver(this.mutationHandler)}init(t){this.createHandle=t.createHandle||this.createHandleFn,this.createRot=t.createRot||this.createRotFn,this.updateHandle=t.updateHandle||this.updateHandleFn,this.updateRot=t.updateRot||this.updateRotFn,this.el.root().put(this.selection),this.updatePoints(),this.createSelection(),this.createResizeHandles(),this.updateResizeHandles(),this.createRotationHandle(),this.updateRotationHandle(),this.observer.observe(this.el.node,{attributes:!0})}active(t,e){if(!t)return this.selection.clear().remove(),void this.observer.disconnect();this.init(e)}createSelection(){this.selection.polygon(this.handlePoints).addClass("svg_select_shape")}updateSelection(){this.selection.get(0).plot(this.handlePoints)}createResizeHandles(){this.handlePoints.forEach(((t,e,i)=>{const n=this.order[e];this.createHandle.call(this,this.selection,t,e,i,n),this.selection.get(e+1).addClass("svg_select_handle svg_select_handle_"+n).on("mousedown.selection touchstart.selection",s(n,this.el,this.handlePoints,e))}))}createHandleFn(t){t.polyline()}updateHandleFn(t,e,s,i){const n=i.at(s-1),o=i[(s+1)%i.length],a=e,l=[a[0]-n[0],a[1]-n[1]],h=[a[0]-o[0],a[1]-o[1]],r=Math.sqrt(l[0]*l[0]+l[1]*l[1]),d=Math.sqrt(h[0]*h[0]+h[1]*h[1]),c=[l[0]/r,l[1]/r],u=[h[0]/d,h[1]/d],p=[a[0]-10*c[0],a[1]-10*c[1]],H=[a[0]-10*u[0],a[1]-10*u[1]];t.plot([p,a,H])}updateResizeHandles(){this.handlePoints.forEach(((t,e,s)=>{const i=this.order[e];this.updateHandle.call(this,this.selection.get(e+1),t,e,s,i)}))}createRotFn(t){t.line(),t.circle(5)}getPoint(t){return this.handlePoints[this.order.indexOf(t)]}getPointHandle(t){return this.selection.get(this.order.indexOf(t)+1)}updateRotFn(t,e){const s=this.getPoint("t");t.get(0).plot(s[0],s[1],e[0],e[1]),t.get(1).center(e[0],e[1])}createRotationHandle(){const t=this.selection.group().addClass("svg_select_handle_rot").on("mousedown.selection touchstart.selection",s("rot",this.el,this.handlePoints));this.createRot.call(this,t)}updateRotationHandle(){const t=this.selection.findOne("g.svg_select_handle_rot");this.updateRot(t,this.rotationPoint,this.handlePoints)}updatePoints(){const t=this.el.bbox(),e=this.el.root().screenCTM().inverseO().multiplyO(this.el.screenCTM());this.handlePoints=this.getHandlePoints(t).map((t=>i(t,e))),this.rotationPoint=i(this.getRotationPoint(t),e)}getHandlePoints({x:t,x2:e,y:s,y2:i,cx:n,cy:o}=this.el.bbox()){return[[t,s],[n,s],[e,s],[e,o],[e,i],[n,i],[t,i],[t,o]]}getRotationPoint({y:t,cx:e}=this.el.bbox()){return[e,t-20]}mutationHandler(){this.updatePoints(),this.updateSelection(),this.updateResizeHandles(),this.updateRotationHandle()}}class o{constructor(t){this.el=t,t.remember("_pointSelectHandler",this),this.selection=new e.G,this.order=["lt","t","rt","r","rb","b","lb","l","rot"],this.mutationHandler=this.mutationHandler.bind(this);const s=e.getWindow();this.observer=new s.MutationObserver(this.mutationHandler)}init(t){this.createHandle=t.createHandle||this.createHandleFn,this.updateHandle=t.updateHandle||this.updateHandleFn,this.el.root().put(this.selection),this.updatePoints(),this.createSelection(),this.createPointHandles(),this.updatePointHandles(),this.observer.observe(this.el.node,{attributes:!0})}active(t,e){if(!t)return this.selection.clear().remove(),void this.observer.disconnect();this.init(e)}createSelection(){this.selection.polygon(this.points).addClass("svg_select_shape_pointSelect")}updateSelection(){this.selection.get(0).plot(this.points)}createPointHandles(){this.points.forEach(((t,e,i)=>{this.createHandle.call(this,this.selection,t,e,i),this.selection.get(e+1).addClass("svg_select_handle_point").on("mousedown.selection touchstart.selection",s("point",this.el,this.points,e))}))}createHandleFn(t){t.circle(5)}updateHandleFn(t,e){t.center(e[0],e[1])}updatePointHandles(){this.points.forEach(((t,e,s)=>{this.updateHandle.call(this,this.selection.get(e+1),t,e,s)}))}updatePoints(){const t=this.el.parent().screenCTM().inverseO().multiplyO(this.el.screenCTM());this.points=this.el.array().map((e=>i(e,t)))}mutationHandler(){this.updatePoints(),this.updateSelection(),this.updatePointHandles()}}const a=t=>function(e=!0,s={}){"object"==typeof e&&(s=e,e=!0);let i=this.remember("_"+t.name);return i||(e.prototype instanceof n?(i=new e(this),e=!0):i=new t(this),this.remember("_"+t.name,i)),i.active(e,s),this};e.extend(e.Element,{select:a(n)}),e.extend([e.Polygon,e.Polyline,e.Line],{pointSelect:a(o)}),t.PointSelectHandler=o,t.SelectHandler=n,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})})); +//# sourceMappingURL=svg.select.umd.cjs.map diff --git a/node_modules/@svgdotjs/svg.select.js/dist/svg.select.umd.cjs.map b/node_modules/@svgdotjs/svg.select.js/dist/svg.select.umd.cjs.map new file mode 100644 index 0000000..c00dce9 --- /dev/null +++ b/node_modules/@svgdotjs/svg.select.js/dist/svg.select.umd.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"svg.select.umd.cjs","sources":["../src/utils.js","../src/SelectHandler.js","../src/PointSelectHandler.js","../src/svg.select.js"],"sourcesContent":["/**\n *\n * @param {string} eventName\n * @param {import('@svgdotjs/svg.js').Element} el\n * @param {number | null} index\n */\nexport function getMoseDownFunc(eventName, el, points, index = null) {\n return function (ev) {\n ev.preventDefault()\n ev.stopPropagation()\n\n var x = ev.pageX || ev.touches[0].pageX\n var y = ev.pageY || ev.touches[0].pageY\n el.fire(eventName, { x: x, y: y, event: ev, index, points })\n }\n}\n\nexport function transformPoint([x, y], { a, b, c, d, e, f }) {\n return [x * a + y * c + e, x * b + y * d + f]\n}\n","import { G, getWindow } from '@svgdotjs/svg.js'\nimport { getMoseDownFunc, transformPoint } from './utils'\n\nexport class SelectHandler {\n constructor(el) {\n this.el = el\n el.remember('_selectHandler', this)\n this.selection = new G()\n this.order = ['lt', 't', 'rt', 'r', 'rb', 'b', 'lb', 'l', 'rot']\n this.mutationHandler = this.mutationHandler.bind(this)\n\n const win = getWindow()\n this.observer = new win.MutationObserver(this.mutationHandler)\n }\n\n init(options) {\n this.createHandle = options.createHandle || this.createHandleFn\n this.createRot = options.createRot || this.createRotFn\n\n this.updateHandle = options.updateHandle || this.updateHandleFn\n this.updateRot = options.updateRot || this.updateRotFn\n\n // mount group\n this.el.root().put(this.selection)\n\n this.updatePoints()\n this.createSelection()\n this.createResizeHandles()\n this.updateResizeHandles()\n this.createRotationHandle()\n this.updateRotationHandle()\n this.observer.observe(this.el.node, { attributes: true })\n }\n\n active(val, options) {\n // Disable selection\n if (!val) {\n this.selection.clear().remove()\n this.observer.disconnect()\n return\n }\n\n // Enable selection\n this.init(options)\n }\n\n createSelection() {\n this.selection.polygon(this.handlePoints).addClass('svg_select_shape')\n }\n\n updateSelection() {\n this.selection.get(0).plot(this.handlePoints)\n }\n\n createResizeHandles() {\n this.handlePoints.forEach((p, index, arr) => {\n const name = this.order[index]\n this.createHandle.call(this, this.selection, p, index, arr, name)\n\n this.selection\n .get(index + 1)\n .addClass('svg_select_handle svg_select_handle_' + name)\n .on('mousedown.selection touchstart.selection', getMoseDownFunc(name, this.el, this.handlePoints, index))\n })\n }\n\n createHandleFn(group) {\n group.polyline()\n }\n\n updateHandleFn(shape, point, index, arr) {\n const before = arr.at(index - 1)\n const next = arr[(index + 1) % arr.length]\n const p = point\n\n const diff1 = [p[0] - before[0], p[1] - before[1]]\n const diff2 = [p[0] - next[0], p[1] - next[1]]\n\n const len1 = Math.sqrt(diff1[0] * diff1[0] + diff1[1] * diff1[1])\n const len2 = Math.sqrt(diff2[0] * diff2[0] + diff2[1] * diff2[1])\n\n const normalized1 = [diff1[0] / len1, diff1[1] / len1]\n const normalized2 = [diff2[0] / len2, diff2[1] / len2]\n\n const beforeNew = [p[0] - normalized1[0] * 10, p[1] - normalized1[1] * 10]\n const nextNew = [p[0] - normalized2[0] * 10, p[1] - normalized2[1] * 10]\n\n shape.plot([beforeNew, p, nextNew])\n }\n\n updateResizeHandles() {\n this.handlePoints.forEach((p, index, arr) => {\n const name = this.order[index]\n this.updateHandle.call(this, this.selection.get(index + 1), p, index, arr, name)\n })\n }\n\n createRotFn(group) {\n group.line()\n group.circle(5)\n }\n\n getPoint(name) {\n return this.handlePoints[this.order.indexOf(name)]\n }\n\n getPointHandle(name) {\n return this.selection.get(this.order.indexOf(name) + 1)\n }\n\n updateRotFn(group, rotPoint) {\n const topPoint = this.getPoint('t')\n group.get(0).plot(topPoint[0], topPoint[1], rotPoint[0], rotPoint[1])\n group.get(1).center(rotPoint[0], rotPoint[1])\n }\n\n createRotationHandle() {\n const handle = this.selection\n .group()\n .addClass('svg_select_handle_rot')\n .on('mousedown.selection touchstart.selection', getMoseDownFunc('rot', this.el, this.handlePoints))\n\n this.createRot.call(this, handle)\n }\n\n updateRotationHandle() {\n const group = this.selection.findOne('g.svg_select_handle_rot')\n this.updateRot(group, this.rotationPoint, this.handlePoints)\n }\n\n // gets new bounding box points and transform them into the elements space\n updatePoints() {\n const bbox = this.el.bbox()\n const fromShapeToUiMatrix = this.el.root().screenCTM().inverseO().multiplyO(this.el.screenCTM())\n\n this.handlePoints = this.getHandlePoints(bbox).map((p) => transformPoint(p, fromShapeToUiMatrix))\n this.rotationPoint = transformPoint(this.getRotationPoint(bbox), fromShapeToUiMatrix)\n }\n\n // A collection of all the points we need to draw our ui\n getHandlePoints({ x, x2, y, y2, cx, cy } = this.el.bbox()) {\n return [\n [x, y],\n [cx, y],\n [x2, y],\n [x2, cy],\n [x2, y2],\n [cx, y2],\n [x, y2],\n [x, cy],\n ]\n }\n\n // A collection of all the points we need to draw our ui\n getRotationPoint({ y, cx } = this.el.bbox()) {\n return [cx, y - 20]\n }\n\n mutationHandler() {\n this.updatePoints()\n\n this.updateSelection()\n this.updateResizeHandles()\n this.updateRotationHandle()\n }\n}\n","import { G, getWindow } from '@svgdotjs/svg.js'\nimport { getMoseDownFunc, transformPoint } from './utils'\n\nexport class PointSelectHandler {\n constructor(el) {\n this.el = el\n el.remember('_pointSelectHandler', this)\n this.selection = new G()\n this.order = ['lt', 't', 'rt', 'r', 'rb', 'b', 'lb', 'l', 'rot']\n this.mutationHandler = this.mutationHandler.bind(this)\n\n const win = getWindow()\n this.observer = new win.MutationObserver(this.mutationHandler)\n }\n\n init(options) {\n this.createHandle = options.createHandle || this.createHandleFn\n this.updateHandle = options.updateHandle || this.updateHandleFn\n\n // mount group\n this.el.root().put(this.selection)\n\n this.updatePoints()\n this.createSelection()\n this.createPointHandles()\n this.updatePointHandles()\n this.observer.observe(this.el.node, { attributes: true })\n }\n\n active(val, options) {\n // Disable selection\n if (!val) {\n this.selection.clear().remove()\n this.observer.disconnect()\n return\n }\n\n // Enable selection\n this.init(options)\n }\n\n createSelection() {\n this.selection.polygon(this.points).addClass('svg_select_shape_pointSelect')\n }\n\n updateSelection() {\n this.selection.get(0).plot(this.points)\n }\n\n createPointHandles() {\n this.points.forEach((p, index, arr) => {\n this.createHandle.call(this, this.selection, p, index, arr)\n\n this.selection\n .get(index + 1)\n .addClass('svg_select_handle_point')\n .on('mousedown.selection touchstart.selection', getMoseDownFunc('point', this.el, this.points, index))\n })\n }\n\n createHandleFn(group) {\n group.circle(5)\n }\n\n updateHandleFn(shape, point) {\n shape.center(point[0], point[1])\n }\n\n updatePointHandles() {\n this.points.forEach((p, index, arr) => {\n this.updateHandle.call(this, this.selection.get(index + 1), p, index, arr)\n })\n }\n\n // gets new bounding box points and transform them into the elements space\n updatePoints() {\n const fromShapeToUiMatrix = this.el.parent().screenCTM().inverseO().multiplyO(this.el.screenCTM())\n this.points = this.el.array().map((p) => transformPoint(p, fromShapeToUiMatrix))\n }\n\n mutationHandler() {\n this.updatePoints()\n\n this.updateSelection()\n this.updatePointHandles()\n }\n}\n","import { Element, Line, Polygon, Polyline, extend } from '@svgdotjs/svg.js'\nimport { SelectHandler } from './SelectHandler'\nimport { PointSelectHandler } from './PointSelectHandler'\n\nconst getSelectFn = (handleClass) => {\n return function (enabled = true, options = {}) {\n if (typeof enabled === 'object') {\n options = enabled\n enabled = true\n }\n\n let selectHandler = this.remember('_' + handleClass.name)\n\n if (!selectHandler) {\n if (enabled.prototype instanceof SelectHandler) {\n selectHandler = new enabled(this)\n enabled = true\n } else {\n selectHandler = new handleClass(this)\n }\n\n this.remember('_' + handleClass.name, selectHandler)\n }\n\n selectHandler.active(enabled, options)\n\n return this\n }\n}\n\nextend(Element, {\n select: getSelectFn(SelectHandler),\n})\n\nextend([Polygon, Polyline, Line], {\n pointSelect: getSelectFn(PointSelectHandler),\n})\n\nexport { SelectHandler, PointSelectHandler }\n"],"names":["getMoseDownFunc","eventName","el","points","index","ev","preventDefault","stopPropagation","x","pageX","touches","y","pageY","fire","event","transformPoint","a","b","c","d","e","f","SelectHandler","constructor","this","remember","selection","G","order","mutationHandler","bind","win","getWindow","observer","MutationObserver","init","options","createHandle","createHandleFn","createRot","createRotFn","updateHandle","updateHandleFn","updateRot","updateRotFn","root","put","updatePoints","createSelection","createResizeHandles","updateResizeHandles","createRotationHandle","updateRotationHandle","observe","node","attributes","active","val","clear","remove","disconnect","polygon","handlePoints","addClass","updateSelection","get","plot","forEach","p","arr","name","call","on","group","polyline","shape","point","before","at","next","length","diff1","diff2","len1","Math","sqrt","len2","normalized1","normalized2","beforeNew","nextNew","line","circle","getPoint","indexOf","getPointHandle","rotPoint","topPoint","center","handle","findOne","rotationPoint","bbox","fromShapeToUiMatrix","screenCTM","inverseO","multiplyO","getHandlePoints","map","getRotationPoint","x2","y2","cx","cy","PointSelectHandler","createPointHandles","updatePointHandles","parent","array","getSelectFn","handleClass","enabled","selectHandler","prototype","svg_js","extend","Element","select","Polygon","Polyline","Line","pointSelect"],"mappings":";4VAMO,SAASA,EAAgBC,EAAWC,EAAIC,EAAQC,EAAQ,MAC7D,OAAO,SAAUC,GACfA,EAAGC,iBACHD,EAAGE,kBAEH,IAAIC,EAAIH,EAAGI,OAASJ,EAAGK,QAAQ,GAAGD,MAC9BE,EAAIN,EAAGO,OAASP,EAAGK,QAAQ,GAAGE,MAC/BV,EAAAW,KAAKZ,EAAW,CAAEO,IAAMG,IAA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AClBiG,GAAA,GAEMC,EAAA,IAAIF,EAAYhG,MAGlCA,KAAKC,SAAS,IAAM+F,EAAYlD,KAAMoD,IAG1BA,EAAAlE,OAAOiE,EAASrF,GAEvBZ,IACR,EAGGoG,EAAAC,OAACC,UAAS,CACdC,OAAQR,EAAYjG,KAGhBsG,EAAAC,OAAC,CAACG,EAAOA,QAAEC,WAAUC,EAAAA,MAAO,CAChCC,YAAaZ,EAAYL"} \ No newline at end of file diff --git a/node_modules/@svgdotjs/svg.select.js/package.json b/node_modules/@svgdotjs/svg.select.js/package.json new file mode 100644 index 0000000..9f36959 --- /dev/null +++ b/node_modules/@svgdotjs/svg.select.js/package.json @@ -0,0 +1,61 @@ +{ + "name": "@svgdotjs/svg.select.js", + "version": "4.0.2", + "description": "An extension of svg.js which allows to select elements with mouse", + "type": "module", + "keywords": [ + "svg.js", + "select", + "mouse" + ], + "bugs": "https://github.com/svgdotjs/svg.select.js/issues", + "license": "MIT", + "author": "Ulrich-Matthias Schäfer", + "homepage": "https://github.com/svgdotjs/svg.select.js", + "main": "dist/svg.select.umd.cjs", + "unpkg": "dist/svg.select.iife.js", + "jsdelivr": "dist/svg.select.iife.js", + "browser": "dist/svg.select.js", + "module": "dist/svg.select.js", + "typings": "./svg.select.js.d.ts", + "exports": { + ".": { + "types": "./svg.select.js.d.ts", + "import": "./dist/svg.select.js", + "require": "./dist/svg.select.umd.cjs" + }, + "./src/*": "./src/" + }, + "files": [ + "/dist", + "/src", + "/svg.select.js.d.ts" + ], + "scripts": { + "dev": "vite", + "build": "tsc && prettier --write . && eslint ./src && vite build", + "zip": "zip -j dist/svg.select.js.zip -- LICENSE README.md dist/svg.select.css dist/svg.select.iife.js dist/svg.select.iife.js.map dist/svg.select.js dist/svg.select.js.map dist/svg.select.umd.cjs dist/svg.select.umd.cjs.map", + "prepublishOnly": "rm -rf ./dist && npm run build", + "postpublish": "npm run zip" + }, + "repository": { + "type": "git", + "url": "https://github.com/svgdotjs/svg.select.js.git" + }, + "engines": { + "node": ">= 14.18" + }, + "devDependencies": { + "@types/node": "^20.14.7", + "@vitejs/plugin-vue": "^5.0.5", + "eslint-plugin-import-x": "^0.5.2", + "prettier": "^3.3.2", + "terser": "^5.31.1", + "typescript": "^5.2.2", + "vite": "^5.2.0", + "eslint": "^9.6.0" + }, + "peerDependencies": { + "@svgdotjs/svg.js": "^3.2.4" + } +} diff --git a/node_modules/@svgdotjs/svg.select.js/src/PointSelectHandler.js b/node_modules/@svgdotjs/svg.select.js/src/PointSelectHandler.js new file mode 100644 index 0000000..285fef5 --- /dev/null +++ b/node_modules/@svgdotjs/svg.select.js/src/PointSelectHandler.js @@ -0,0 +1,87 @@ +import { G, getWindow } from '@svgdotjs/svg.js' +import { getMoseDownFunc, transformPoint } from './utils' + +export class PointSelectHandler { + constructor(el) { + this.el = el + el.remember('_pointSelectHandler', this) + this.selection = new G() + this.order = ['lt', 't', 'rt', 'r', 'rb', 'b', 'lb', 'l', 'rot'] + this.mutationHandler = this.mutationHandler.bind(this) + + const win = getWindow() + this.observer = new win.MutationObserver(this.mutationHandler) + } + + init(options) { + this.createHandle = options.createHandle || this.createHandleFn + this.updateHandle = options.updateHandle || this.updateHandleFn + + // mount group + this.el.root().put(this.selection) + + this.updatePoints() + this.createSelection() + this.createPointHandles() + this.updatePointHandles() + this.observer.observe(this.el.node, { attributes: true }) + } + + active(val, options) { + // Disable selection + if (!val) { + this.selection.clear().remove() + this.observer.disconnect() + return + } + + // Enable selection + this.init(options) + } + + createSelection() { + this.selection.polygon(this.points).addClass('svg_select_shape_pointSelect') + } + + updateSelection() { + this.selection.get(0).plot(this.points) + } + + createPointHandles() { + this.points.forEach((p, index, arr) => { + this.createHandle.call(this, this.selection, p, index, arr) + + this.selection + .get(index + 1) + .addClass('svg_select_handle_point') + .on('mousedown.selection touchstart.selection', getMoseDownFunc('point', this.el, this.points, index)) + }) + } + + createHandleFn(group) { + group.circle(5) + } + + updateHandleFn(shape, point) { + shape.center(point[0], point[1]) + } + + updatePointHandles() { + this.points.forEach((p, index, arr) => { + this.updateHandle.call(this, this.selection.get(index + 1), p, index, arr) + }) + } + + // gets new bounding box points and transform them into the elements space + updatePoints() { + const fromShapeToUiMatrix = this.el.parent().screenCTM().inverseO().multiplyO(this.el.screenCTM()) + this.points = this.el.array().map((p) => transformPoint(p, fromShapeToUiMatrix)) + } + + mutationHandler() { + this.updatePoints() + + this.updateSelection() + this.updatePointHandles() + } +} diff --git a/node_modules/@svgdotjs/svg.select.js/src/SelectHandler.js b/node_modules/@svgdotjs/svg.select.js/src/SelectHandler.js new file mode 100644 index 0000000..23fd15f --- /dev/null +++ b/node_modules/@svgdotjs/svg.select.js/src/SelectHandler.js @@ -0,0 +1,166 @@ +import { G, getWindow } from '@svgdotjs/svg.js' +import { getMoseDownFunc, transformPoint } from './utils' + +export class SelectHandler { + constructor(el) { + this.el = el + el.remember('_selectHandler', this) + this.selection = new G() + this.order = ['lt', 't', 'rt', 'r', 'rb', 'b', 'lb', 'l', 'rot'] + this.mutationHandler = this.mutationHandler.bind(this) + + const win = getWindow() + this.observer = new win.MutationObserver(this.mutationHandler) + } + + init(options) { + this.createHandle = options.createHandle || this.createHandleFn + this.createRot = options.createRot || this.createRotFn + + this.updateHandle = options.updateHandle || this.updateHandleFn + this.updateRot = options.updateRot || this.updateRotFn + + // mount group + this.el.root().put(this.selection) + + this.updatePoints() + this.createSelection() + this.createResizeHandles() + this.updateResizeHandles() + this.createRotationHandle() + this.updateRotationHandle() + this.observer.observe(this.el.node, { attributes: true }) + } + + active(val, options) { + // Disable selection + if (!val) { + this.selection.clear().remove() + this.observer.disconnect() + return + } + + // Enable selection + this.init(options) + } + + createSelection() { + this.selection.polygon(this.handlePoints).addClass('svg_select_shape') + } + + updateSelection() { + this.selection.get(0).plot(this.handlePoints) + } + + createResizeHandles() { + this.handlePoints.forEach((p, index, arr) => { + const name = this.order[index] + this.createHandle.call(this, this.selection, p, index, arr, name) + + this.selection + .get(index + 1) + .addClass('svg_select_handle svg_select_handle_' + name) + .on('mousedown.selection touchstart.selection', getMoseDownFunc(name, this.el, this.handlePoints, index)) + }) + } + + createHandleFn(group) { + group.polyline() + } + + updateHandleFn(shape, point, index, arr) { + const before = arr.at(index - 1) + const next = arr[(index + 1) % arr.length] + const p = point + + const diff1 = [p[0] - before[0], p[1] - before[1]] + const diff2 = [p[0] - next[0], p[1] - next[1]] + + const len1 = Math.sqrt(diff1[0] * diff1[0] + diff1[1] * diff1[1]) + const len2 = Math.sqrt(diff2[0] * diff2[0] + diff2[1] * diff2[1]) + + const normalized1 = [diff1[0] / len1, diff1[1] / len1] + const normalized2 = [diff2[0] / len2, diff2[1] / len2] + + const beforeNew = [p[0] - normalized1[0] * 10, p[1] - normalized1[1] * 10] + const nextNew = [p[0] - normalized2[0] * 10, p[1] - normalized2[1] * 10] + + shape.plot([beforeNew, p, nextNew]) + } + + updateResizeHandles() { + this.handlePoints.forEach((p, index, arr) => { + const name = this.order[index] + this.updateHandle.call(this, this.selection.get(index + 1), p, index, arr, name) + }) + } + + createRotFn(group) { + group.line() + group.circle(5) + } + + getPoint(name) { + return this.handlePoints[this.order.indexOf(name)] + } + + getPointHandle(name) { + return this.selection.get(this.order.indexOf(name) + 1) + } + + updateRotFn(group, rotPoint) { + const topPoint = this.getPoint('t') + group.get(0).plot(topPoint[0], topPoint[1], rotPoint[0], rotPoint[1]) + group.get(1).center(rotPoint[0], rotPoint[1]) + } + + createRotationHandle() { + const handle = this.selection + .group() + .addClass('svg_select_handle_rot') + .on('mousedown.selection touchstart.selection', getMoseDownFunc('rot', this.el, this.handlePoints)) + + this.createRot.call(this, handle) + } + + updateRotationHandle() { + const group = this.selection.findOne('g.svg_select_handle_rot') + this.updateRot(group, this.rotationPoint, this.handlePoints) + } + + // gets new bounding box points and transform them into the elements space + updatePoints() { + const bbox = this.el.bbox() + const fromShapeToUiMatrix = this.el.root().screenCTM().inverseO().multiplyO(this.el.screenCTM()) + + this.handlePoints = this.getHandlePoints(bbox).map((p) => transformPoint(p, fromShapeToUiMatrix)) + this.rotationPoint = transformPoint(this.getRotationPoint(bbox), fromShapeToUiMatrix) + } + + // A collection of all the points we need to draw our ui + getHandlePoints({ x, x2, y, y2, cx, cy } = this.el.bbox()) { + return [ + [x, y], + [cx, y], + [x2, y], + [x2, cy], + [x2, y2], + [cx, y2], + [x, y2], + [x, cy], + ] + } + + // A collection of all the points we need to draw our ui + getRotationPoint({ y, cx } = this.el.bbox()) { + return [cx, y - 20] + } + + mutationHandler() { + this.updatePoints() + + this.updateSelection() + this.updateResizeHandles() + this.updateRotationHandle() + } +} diff --git a/node_modules/@svgdotjs/svg.select.js/src/main.js b/node_modules/@svgdotjs/svg.select.js/src/main.js new file mode 100644 index 0000000..cba33e3 --- /dev/null +++ b/node_modules/@svgdotjs/svg.select.js/src/main.js @@ -0,0 +1,2 @@ +import './svg.select.css' +export * from './svg.select.js' diff --git a/node_modules/@svgdotjs/svg.select.js/src/svg.select.css b/node_modules/@svgdotjs/svg.select.js/src/svg.select.css new file mode 100644 index 0000000..44842f7 --- /dev/null +++ b/node_modules/@svgdotjs/svg.select.js/src/svg.select.css @@ -0,0 +1,62 @@ +.svg_select_shape { + stroke-width: 1; + stroke-dasharray: 10 10; + stroke: black; + stroke-opacity: 0.1; + pointer-events: none; + fill: none; +} + +.svg_select_shape_pointSelect { + stroke-width: 1; + fill: none; + stroke-dasharray: 10 10; + stroke: black; + stroke-opacity: 0.8; + pointer-events: none; +} + +.svg_select_handle { + stroke-width: 3; + stroke: black; + fill: none; +} + +.svg_select_handle_rot { + fill: white; + stroke: black; + stroke-width: 1; + cursor: move; +} + +.svg_select_handle_lt { + cursor: nw-resize; +} +.svg_select_handle_rt { + cursor: ne-resize; +} +.svg_select_handle_rb { + cursor: se-resize; +} +.svg_select_handle_lb { + cursor: sw-resize; +} +.svg_select_handle_t { + cursor: n-resize; +} +.svg_select_handle_r { + cursor: e-resize; +} +.svg_select_handle_b { + cursor: s-resize; +} +.svg_select_handle_l { + cursor: w-resize; +} + +.svg_select_handle_point { + stroke: black; + stroke-width: 1; + cursor: move; + fill: white; +} diff --git a/node_modules/@svgdotjs/svg.select.js/src/svg.select.js b/node_modules/@svgdotjs/svg.select.js/src/svg.select.js new file mode 100644 index 0000000..9af7cb2 --- /dev/null +++ b/node_modules/@svgdotjs/svg.select.js/src/svg.select.js @@ -0,0 +1,39 @@ +import { Element, Line, Polygon, Polyline, extend } from '@svgdotjs/svg.js' +import { SelectHandler } from './SelectHandler' +import { PointSelectHandler } from './PointSelectHandler' + +const getSelectFn = (handleClass) => { + return function (enabled = true, options = {}) { + if (typeof enabled === 'object') { + options = enabled + enabled = true + } + + let selectHandler = this.remember('_' + handleClass.name) + + if (!selectHandler) { + if (enabled.prototype instanceof SelectHandler) { + selectHandler = new enabled(this) + enabled = true + } else { + selectHandler = new handleClass(this) + } + + this.remember('_' + handleClass.name, selectHandler) + } + + selectHandler.active(enabled, options) + + return this + } +} + +extend(Element, { + select: getSelectFn(SelectHandler), +}) + +extend([Polygon, Polyline, Line], { + pointSelect: getSelectFn(PointSelectHandler), +}) + +export { SelectHandler, PointSelectHandler } diff --git a/node_modules/@svgdotjs/svg.select.js/src/utils.js b/node_modules/@svgdotjs/svg.select.js/src/utils.js new file mode 100644 index 0000000..5be8ee0 --- /dev/null +++ b/node_modules/@svgdotjs/svg.select.js/src/utils.js @@ -0,0 +1,20 @@ +/** + * + * @param {string} eventName + * @param {import('@svgdotjs/svg.js').Element} el + * @param {number | null} index + */ +export function getMoseDownFunc(eventName, el, points, index = null) { + return function (ev) { + ev.preventDefault() + ev.stopPropagation() + + var x = ev.pageX || ev.touches[0].pageX + var y = ev.pageY || ev.touches[0].pageY + el.fire(eventName, { x: x, y: y, event: ev, index, points }) + } +} + +export function transformPoint([x, y], { a, b, c, d, e, f }) { + return [x * a + y * c + e, x * b + y * d + f] +} diff --git a/node_modules/@svgdotjs/svg.select.js/svg.select.js.d.ts b/node_modules/@svgdotjs/svg.select.js/svg.select.js.d.ts new file mode 100644 index 0000000..2e635bd --- /dev/null +++ b/node_modules/@svgdotjs/svg.select.js/svg.select.js.d.ts @@ -0,0 +1,40 @@ +import { SelectHandler, PointSelectHandler } from './src/SelectHandler.js' + +interface SelectionOptions { + createHandle?: (el: Element) => Element + updateHandle?: (el: Element, point: number[]) => void + createRot?: (el: Element) => Element + updateRot?: (el: Element, rotPoint: number[], handlePoints: number[][]) => void +} + +declare module '@svgdotjs/svg.js' { + interface Element { + select(): this + select(enable: boolean): this + select(options: SelectionOptions): this + select(handler: SelectHandler): this + select(attr?: SelectHandler | SelectionOptions | boolean): this + } + + interface Polygon { + pointSelect(): this + pointSelect(enable: boolean): this + pointSelect(options: SelectionOptions): this + pointSelect(handler: PointSelectHandler): this + pointSelect(attr?: PointSelectHandler | SelectionOptions | boolean): this + } + interface Polyline { + pointSelect(): this + pointSelect(enable: boolean): this + pointSelect(options: SelectionOptions): this + pointSelect(handler: PointSelectHandler): this + pointSelect(attr?: PointSelectHandler | SelectionOptions | boolean): this + } + interface Line { + pointSelect(): this + pointSelect(enable: boolean): this + pointSelect(options: SelectionOptions): this + pointSelect(handler: PointSelectHandler): this + pointSelect(attr?: PointSelectHandler | SelectionOptions | boolean): this + } +} diff --git a/node_modules/@yr/monotone-cubic-spline/.npmignore b/node_modules/@yr/monotone-cubic-spline/.npmignore new file mode 100644 index 0000000..b6096f8 --- /dev/null +++ b/node_modules/@yr/monotone-cubic-spline/.npmignore @@ -0,0 +1,4 @@ +.DS_Store +.git* +test +package-lock.json \ No newline at end of file diff --git a/node_modules/@yr/monotone-cubic-spline/.travis.yml b/node_modules/@yr/monotone-cubic-spline/.travis.yml new file mode 100644 index 0000000..d1b70a7 --- /dev/null +++ b/node_modules/@yr/monotone-cubic-spline/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +node_js: + - "4" + - "6" +sudo: false \ No newline at end of file diff --git a/node_modules/@yr/monotone-cubic-spline/LICENSE b/node_modules/@yr/monotone-cubic-spline/LICENSE new file mode 100644 index 0000000..f78a32d --- /dev/null +++ b/node_modules/@yr/monotone-cubic-spline/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2015 yr.no + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/@yr/monotone-cubic-spline/README.md b/node_modules/@yr/monotone-cubic-spline/README.md new file mode 100644 index 0000000..077063b --- /dev/null +++ b/node_modules/@yr/monotone-cubic-spline/README.md @@ -0,0 +1,23 @@ +[![NPM Version](https://img.shields.io/npm/v/@yr/monotone-cubic-spline.svg?style=flat)](https://npmjs.org/package/@yr/monotone-cubic-spline) +[![Build Status](https://img.shields.io/travis/YR/monotone-cubic-spline.svg?style=flat)](https://travis-ci.org/YR/monotone-cubic-spline?branch=master) + +Convert a series of points to a monotone cubic spline (based on D3.js implementation) + +## Usage + +```js +const spline = require('@yr/monotone-cubic-spline'); +const points = spline.points([[0,0], [1,1], [2,1], [3,0], [4,0]]); +const svgPath = spline.svgPath(points); + +console.log(svgPath); +// => 'M0 0C0.08333333333333333, 0.08333333333333333, ...' +``` + +## API + +**points(points)**: convert array of points (x,y) to array of bezier points (c1x,c1y,c2x,c2y,x,y) + +**slice(points, start, end)**: slice a segment of converted points + +**svgPath(points)**: convert array of bezier points to svg path (`d`) string \ No newline at end of file diff --git a/node_modules/@yr/monotone-cubic-spline/index.js b/node_modules/@yr/monotone-cubic-spline/index.js new file mode 100644 index 0000000..f221664 --- /dev/null +++ b/node_modules/@yr/monotone-cubic-spline/index.js @@ -0,0 +1,166 @@ +'use strict'; + +/** + * Convert a series of points to a monotone cubic spline + * Algorithm based on https://github.com/mbostock/d3 + * https://github.com/yr/monotone-cubic-spline + * @copyright Yr + * @license MIT + */ + +var ε = 1e-6; + +module.exports = { + /** + * Convert 'points' to bezier + * @param {Array} points + * @returns {Array} + */ + points: function points(_points) { + var tgts = tangents(_points); + + var p = _points[1]; + var p0 = _points[0]; + var pts = []; + var t = tgts[1]; + var t0 = tgts[0]; + + // Add starting 'M' and 'C' points + pts.push(p0, [p0[0] + t0[0], p0[1] + t0[1], p[0] - t[0], p[1] - t[1], p[0], p[1]]); + + // Add 'S' points + for (var i = 2, n = tgts.length; i < n; i++) { + var _p = _points[i]; + var _t = tgts[i]; + + pts.push([_p[0] - _t[0], _p[1] - _t[1], _p[0], _p[1]]); + } + + return pts; + }, + + + /** + * Slice out a segment of 'points' + * @param {Array} points + * @param {Number} start + * @param {Number} end + * @returns {Array} + */ + slice: function slice(points, start, end) { + var pts = points.slice(start, end); + + if (start) { + // Add additional 'C' points + if (pts[1].length < 6) { + var n = pts[0].length; + + pts[1] = [pts[0][n - 2] * 2 - pts[0][n - 4], pts[0][n - 1] * 2 - pts[0][n - 3]].concat(pts[1]); + } + // Remove control points for 'M' + pts[0] = pts[0].slice(-2); + } + + return pts; + }, + + + /** + * Convert 'points' to svg path + * @param {Array} points + * @returns {String} + */ + svgPath: function svgPath(points) { + var p = ''; + + for (var i = 0; i < points.length; i++) { + var point = points[i]; + var n = point.length; + + if (!i) { + p += 'M' + point[n - 2] + ' ' + point[n - 1]; + } else if (n > 4) { + p += 'C' + point[0] + ', ' + point[1]; + p += ', ' + point[2] + ', ' + point[3]; + p += ', ' + point[4] + ', ' + point[5]; + } else { + p += 'S' + point[0] + ', ' + point[1]; + p += ', ' + point[2] + ', ' + point[3]; + } + } + + return p; + } +}; + +/** + * Generate tangents for 'points' + * @param {Array} points + * @returns {Array} + */ +function tangents(points) { + var m = finiteDifferences(points); + var n = points.length - 1; + + var tgts = []; + var a = void 0, + b = void 0, + d = void 0, + s = void 0; + + for (var i = 0; i < n; i++) { + d = slope(points[i], points[i + 1]); + + if (Math.abs(d) < ε) { + m[i] = m[i + 1] = 0; + } else { + a = m[i] / d; + b = m[i + 1] / d; + s = a * a + b * b; + if (s > 9) { + s = d * 3 / Math.sqrt(s); + m[i] = s * a; + m[i + 1] = s * b; + } + } + } + + for (var _i = 0; _i <= n; _i++) { + s = (points[Math.min(n, _i + 1)][0] - points[Math.max(0, _i - 1)][0]) / (6 * (1 + m[_i] * m[_i])); + tgts.push([s || 0, m[_i] * s || 0]); + } + + return tgts; +} + +/** + * Compute slope from point 'p0' to 'p1' + * @param {Array} p0 + * @param {Array} p1 + * @returns {Number} + */ +function slope(p0, p1) { + return (p1[1] - p0[1]) / (p1[0] - p0[0]); +} + +/** + * Compute three-point differences for 'points' + * @param {Array} points + * @returns {Array} + */ +function finiteDifferences(points) { + var m = []; + var p0 = points[0]; + var p1 = points[1]; + var d = m[0] = slope(p0, p1); + var i = 1; + + for (var n = points.length - 1; i < n; i++) { + p0 = p1; + p1 = points[i + 1]; + m[i] = (d + (d = slope(p0, p1))) * 0.5; + } + m[i] = d; + + return m; +} \ No newline at end of file diff --git a/node_modules/@yr/monotone-cubic-spline/package.json b/node_modules/@yr/monotone-cubic-spline/package.json new file mode 100644 index 0000000..5b7efdd --- /dev/null +++ b/node_modules/@yr/monotone-cubic-spline/package.json @@ -0,0 +1,57 @@ +{ + "name": "@yr/monotone-cubic-spline", + "description": "Convert a series of points to a monotone cubic spline", + "version": "1.0.3", + "author": "Alexander Pope ", + "dependencies": {}, + "devDependencies": { + "babel-plugin-syntax-trailing-function-commas": "6.22.0", + "babel-plugin-transform-async-generator-functions": "6.24.1", + "babel-plugin-transform-async-to-generator": "6.24.1", + "babel-plugin-transform-es2015-arrow-functions": "6.22.0", + "babel-plugin-transform-es2015-block-scoped-functions": "6.22.0", + "babel-plugin-transform-es2015-block-scoping": "6.24.1", + "babel-plugin-transform-es2015-classes": "6.24.1", + "babel-plugin-transform-es2015-computed-properties": "6.24.1", + "babel-plugin-transform-es2015-destructuring": "6.23.0", + "babel-plugin-transform-es2015-duplicate-keys": "6.24.1", + "babel-plugin-transform-es2015-for-of": "6.23.0", + "babel-plugin-transform-es2015-function-name": "6.24.1", + "babel-plugin-transform-es2015-literals": "6.22.0", + "babel-plugin-transform-es2015-object-super": "6.24.1", + "babel-plugin-transform-es2015-parameters": "6.24.1", + "babel-plugin-transform-es2015-shorthand-properties": "6.24.1", + "babel-plugin-transform-es2015-spread": "6.22.0", + "babel-plugin-transform-es2015-sticky-regex": "6.24.1", + "babel-plugin-transform-es2015-template-literals": "6.22.0", + "babel-plugin-transform-es2015-unicode-regex": "6.24.1", + "babel-plugin-transform-es5-property-mutators": "6.24.1", + "babel-plugin-transform-exponentiation-operator": "6.24.1", + "babel-plugin-transform-object-rest-spread": "6.23.0", + "buddy": "6.x.x", + "expect.js": "*", + "mocha": "*" + }, + "main": "src/index.js", + "repository": "https://github.com/YR/monotone-cubic-spline.git", + "license": "MIT", + "scripts": { + "prepublish": "buddy build", + "test": "NODE_ENV=test mocha test/lib-test.js --reporter spec" + }, + "browser": "index.js", + "buddy": { + "build": [ + { + "input": "src/", + "output": ".", + "bundle": false, + "version": "es5" + }, + { + "input": "src/index.js", + "output": "test/lib.js" + } + ] + } +} diff --git a/node_modules/@yr/monotone-cubic-spline/src/index.js b/node_modules/@yr/monotone-cubic-spline/src/index.js new file mode 100644 index 0000000..23ab4fb --- /dev/null +++ b/node_modules/@yr/monotone-cubic-spline/src/index.js @@ -0,0 +1,161 @@ +'use strict'; + +/** + * Convert a series of points to a monotone cubic spline + * Algorithm based on https://github.com/mbostock/d3 + * https://github.com/yr/monotone-cubic-spline + * @copyright Yr + * @license MIT + */ + +const ε = 1e-6; + +module.exports = { + /** + * Convert 'points' to bezier + * @param {Array} points + * @returns {Array} + */ + points(points) { + const tgts = tangents(points); + + const p = points[1]; + const p0 = points[0]; + const pts = []; + const t = tgts[1]; + const t0 = tgts[0]; + + // Add starting 'M' and 'C' points + pts.push(p0, [p0[0] + t0[0], p0[1] + t0[1], p[0] - t[0], p[1] - t[1], p[0], p[1]]); + + // Add 'S' points + for (let i = 2, n = tgts.length; i < n; i++) { + const p = points[i]; + const t = tgts[i]; + + pts.push([p[0] - t[0], p[1] - t[1], p[0], p[1]]); + } + + return pts; + }, + + /** + * Slice out a segment of 'points' + * @param {Array} points + * @param {Number} start + * @param {Number} end + * @returns {Array} + */ + slice(points, start, end) { + const pts = points.slice(start, end); + + if (start) { + // Add additional 'C' points + if (pts[1].length < 6) { + const n = pts[0].length; + + pts[1] = [pts[0][n - 2] * 2 - pts[0][n - 4], pts[0][n - 1] * 2 - pts[0][n - 3]].concat(pts[1]); + } + // Remove control points for 'M' + pts[0] = pts[0].slice(-2); + } + + return pts; + }, + + /** + * Convert 'points' to svg path + * @param {Array} points + * @returns {String} + */ + svgPath(points) { + let p = ''; + + for (let i = 0; i < points.length; i++) { + const point = points[i]; + const n = point.length; + + if (!i) { + p += `M${point[n - 2]} ${point[n - 1]}`; + } else if (n > 4) { + p += `C${point[0]}, ${point[1]}`; + p += `, ${point[2]}, ${point[3]}`; + p += `, ${point[4]}, ${point[5]}`; + } else { + p += `S${point[0]}, ${point[1]}`; + p += `, ${point[2]}, ${point[3]}`; + } + } + + return p; + } +}; + +/** + * Generate tangents for 'points' + * @param {Array} points + * @returns {Array} + */ +function tangents(points) { + const m = finiteDifferences(points); + const n = points.length - 1; + + const tgts = []; + let a, b, d, s; + + for (let i = 0; i < n; i++) { + d = slope(points[i], points[i + 1]); + + if (Math.abs(d) < ε) { + m[i] = m[i + 1] = 0; + } else { + a = m[i] / d; + b = m[i + 1] / d; + s = a * a + b * b; + if (s > 9) { + s = d * 3 / Math.sqrt(s); + m[i] = s * a; + m[i + 1] = s * b; + } + } + } + + for (let i = 0; i <= n; i++) { + s = (points[Math.min(n, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i])); + tgts.push([s || 0, m[i] * s || 0]); + } + + return tgts; +} + +/** + * Compute slope from point 'p0' to 'p1' + * @param {Array} p0 + * @param {Array} p1 + * @returns {Number} + */ +function slope(p0, p1) { + return (p1[1] - p0[1]) / (p1[0] - p0[0]); +} + +/** + * Compute three-point differences for 'points' + * @param {Array} points + * @returns {Array} + */ +function finiteDifferences(points) { + const m = []; + let p0 = points[0]; + let p1 = points[1]; + let d = (m[0] = slope(p0, p1)); + let i = 1; + + for (let n = points.length - 1; i < n; i++) { + p0 = p1; + p1 = points[i + 1]; + m[i] = (d + (d = slope(p0, p1))) * 0.5; + } + m[i] = d; + + return m; +} diff --git a/node_modules/apexcharts/LICENSE b/node_modules/apexcharts/LICENSE new file mode 100644 index 0000000..1702793 --- /dev/null +++ b/node_modules/apexcharts/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2018 ApexCharts + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/apexcharts/README.md b/node_modules/apexcharts/README.md new file mode 100644 index 0000000..d1ae0c0 --- /dev/null +++ b/node_modules/apexcharts/README.md @@ -0,0 +1,214 @@ +

+ +

+ License + build + downloads + ver + size + + prettier + jsdelivr + + +

+ +

+ +

+ +

A modern JavaScript charting library that allows you to build interactive data visualizations with simple API and 100+ ready-to-use samples. Packed with the features that you expect, ApexCharts includes over a dozen chart types that deliver beautiful, responsive visualizations in your apps and dashboards. ApexCharts is an MIT-licensed open-source project that can be used in commercial and non-commercial projects.

+ +

+ +
+ +## Download and Installation + +##### Installing via npm + +```bash +npm install apexcharts --save +``` + +##### Direct <script> include + +```html + +``` + +## Wrappers for Vue/React/Angular/Stencil + +Integrate easily with 3rd party frameworks + +- [vue-apexcharts](https://github.com/apexcharts/vue-apexcharts) +- [react-apexcharts](https://github.com/apexcharts/react-apexcharts) +- [ng-apexcharts](https://github.com/apexcharts/ng-apexcharts) - Plugin by [Morris Janatzek](https://morrisj.net/) +- [stencil-apexcharts](https://github.com/apexcharts/stencil-apexcharts) + +### Unofficial Wrappers + +Useful links to wrappers other than the popular frameworks mentioned above + +- [apexcharter](https://github.com/dreamRs/apexcharter) - Htmlwidget for ApexCharts +- [apexcharts.rb](https://github.com/styd/apexcharts.rb) - Ruby wrapper for ApexCharts +- [larapex-charts](https://github.com/ArielMejiaDev/larapex-charts) - Laravel wrapper for ApexCharts +- [blazor-apexcharts](https://github.com/apexcharts/Blazor-ApexCharts) - Blazor wrapper for ApexCharts [demo](https://apexcharts.github.io/Blazor-ApexCharts/) +- [svelte-apexcharts](https://github.com/galkatz373/svelte-apexcharts) - Svelte wrapper for ApexCharts + + +## Usage + +```js +import ApexCharts from 'apexcharts' +``` + +To create a basic bar chart with minimal configuration, write as follows: + +```js +var options = { + chart: { + type: 'bar' + }, + series: [ + { + name: 'sales', + data: [30, 40, 35, 50, 49, 60, 70, 91, 125] + } + ], + xaxis: { + categories: [1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999] + } +} + +var chart = new ApexCharts(document.querySelector('#chart'), options) +chart.render() +``` + +This will render the following chart + +

+ +### A little more than the basic + +You can create a combination of different charts, sync them and give your desired look with unlimited possibilities. +Below is an example of synchronized charts with github style. + +

+ +## Interactivity + +Zoom, Pan, and Scroll through data. Make selections and load other charts using those selections. +An example showing some interactivity + +

interactive chart

+ +## Dynamic Series Update + +Another approach is to Drill down charts where one selection updates the data of other charts. +An example of loading dynamic series into charts is shown below + +

dynamic-loading-chart

+ +## Annotations + +Annotations allow you to write custom text on specific values or on axes values. Valuable to expand the visual appeal of your chart and make it more informative. + +

annotations

+ +## Mixed Charts + +You can combine more than one chart type to create a combo/mixed chart. Possible combinations can be line/area/column together in a single chart. Each chart type can have its own y-axis. + +

annotations

+ +## Candlestick + +Use a candlestick chart (a common financial chart) to describe price changes of a security, derivative, or currency. The below image shows how you can use another chart as a brush/preview pane which acts as a handle to browse the main candlestick chart. + +

candlestick

+ +## Heatmaps + +Use Heatmaps to represent data through colors and shades. Frequently used with bigger data collections, they are valuable for recognizing patterns and areas of focus. + +

heatmap

+ +## Gauges + +The tiny gauges are an important part of a dashboard and are useful in displaying single-series data. A demo of these gauges: + +

radialbar-chart

+ +## Sparklines + +Utilize sparklines to indicate trends in data, for example, occasional increments or declines, monetary cycles, or to feature the most extreme and least values: + +

sparkline-chart

+ + +## Need Advanced Data Grid for your next project? +We partnered with Infragistics, creators of the fastest data grids on the planet! Ignite UI Grids can handle unlimited rows and columns of data while providing access to custom templates and real-time data updates. + +

+ +Featuring an intuitive API for easy theming and branding, you can quickly bind to data with minimal hand-on coding. The grid is available in most of your favorite frameworks: + +Angular Data Grid | React Data Grid | Blazor Data Grid | Web Components DataGrid | jQuery Data Grid + +## What's included + +The download bundle includes the following files and directories providing a minified single file in the dist folder. Every asset including icon/css is bundled in the js itself to avoid loading multiple files. + +``` +apexcharts/ +├── dist/ +│ └── apexcharts.min.js +├── src/ +│ ├── assets/ +│ ├── charts/ +│ ├── modules/ +│ ├── utils/ +│ └── apexcharts.js +└── samples/ +``` + +## Development + +#### Install dependencies and run the project + +```bash +npm install +npm run dev +``` + +This will start the webpack watch and any changes you make to `src` folder will auto-compile and output will be produced in the `dist` folder. + +More details in [Contributing Guidelines](CONTRIBUTING.md). + +#### Minifying the src + +```bash +npm run build +``` + +## Where do I go next? + +Head over to the documentation section to read more about how to use different kinds of charts and explore all options. + +## Contacts + +Email: info@apexcharts.com + +Twitter: @apexcharts + +Facebook: fb.com/apexcharts + +## Dependency + +ApexCharts uses SVG.js for drawing shapes, animations, applying svg filters, and a lot more under the hood. The library is bundled in the final build file, so you don't need to include it. + +## License + +ApexCharts is released under MIT license. You are free to use, modify and distribute this software, as long as the copyright header is left intact. diff --git a/node_modules/apexcharts/dist/apexcharts.amd.js b/node_modules/apexcharts/dist/apexcharts.amd.js new file mode 100644 index 0000000..0a4a045 --- /dev/null +++ b/node_modules/apexcharts/dist/apexcharts.amd.js @@ -0,0 +1,2 @@ +/*! For license information please see apexcharts.amd.js.LICENSE.txt */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ApexCharts=e():t.ApexCharts=e()}(self,(()=>(()=>{var t={532:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var r="",i=void 0!==e[5];return e[4]&&(r+="@supports (".concat(e[4],") {")),e[2]&&(r+="@media ".concat(e[2]," {")),i&&(r+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),r+=t(e),i&&(r+="}"),e[2]&&(r+="}"),e[4]&&(r+="}"),r})).join("")},e.i=function(t,r,i,n,o){"string"==typeof t&&(t=[[null,t,void 0]]);var a={};if(i)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=o),r&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=r):u[2]=r),n&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=n):u[4]="".concat(n)),e.push(u))}},e}},547:t=>{"use strict";t.exports=function(t){return t[1]}},521:()=>{window.TreemapSquared={},function(){"use strict";window.TreemapSquared.generate=function(){function t(e,r,i,n){this.xoffset=e,this.yoffset=r,this.height=n,this.width=i,this.shortestEdge=function(){return Math.min(this.height,this.width)},this.getCoordinates=function(t){var e,r=[],i=this.xoffset,n=this.yoffset,a=o(t)/this.height,s=o(t)/this.width;if(this.width>=this.height)for(e=0;e=this.height){var i=e/this.height,n=this.width-i;r=new t(this.xoffset+i,this.yoffset,n,this.height)}else{var o=e/this.width,a=this.height-o;r=new t(this.xoffset,this.yoffset+o,this.width,a)}return r}}function e(e,i,n,a,s){a=void 0===a?0:a,s=void 0===s?0:s;var l=r(function(t,e){var r,i=[],n=e/o(t);for(r=0;r=i(n,r))}(e,l=t[0],s)?(e.push(l),r(t.slice(1),e,n,a)):(c=n.cutArea(o(e),a),a.push(n.getCoordinates(e)),r(t,[],c,a)),a;a.push(n.getCoordinates(e))}function i(t,e){var r=Math.min.apply(Math,t),i=Math.max.apply(Math,t),n=o(t);return Math.max(Math.pow(e,2)*i/Math.pow(n,2),Math.pow(n,2)/(Math.pow(e,2)*r))}function n(t){return t&&t.constructor===Array}function o(t){var e,r=0;for(e=0;e{"use strict";r.r(e),r.d(e,{default:()=>s});var i=r(547),n=r.n(i),o=r(532),a=r.n(o)()(n());a.push([t.id,'@keyframes opaque {\n 0% {\n opacity: 0\n }\n\n to {\n opacity: 1\n }\n}\n\n@keyframes resizeanim {\n\n 0%,\n to {\n opacity: 0\n }\n}\n\n.apexcharts-canvas {\n position: relative;\n direction: ltr !important;\n user-select: none\n}\n\n.apexcharts-canvas ::-webkit-scrollbar {\n -webkit-appearance: none;\n width: 6px\n}\n\n.apexcharts-canvas ::-webkit-scrollbar-thumb {\n border-radius: 4px;\n background-color: rgba(0, 0, 0, .5);\n box-shadow: 0 0 1px rgba(255, 255, 255, .5);\n -webkit-box-shadow: 0 0 1px rgba(255, 255, 255, .5)\n}\n\n.apexcharts-inner {\n position: relative\n}\n\n.apexcharts-text tspan {\n font-family: inherit\n}\n\nrect.legend-mouseover-inactive,\n.legend-mouseover-inactive rect,\n.legend-mouseover-inactive path,\n.legend-mouseover-inactive circle,\n.legend-mouseover-inactive line,\n.legend-mouseover-inactive text.apexcharts-yaxis-title-text,\n.legend-mouseover-inactive text.apexcharts-yaxis-label {\n transition: .15s ease all;\n opacity: .2\n}\n\n.apexcharts-legend-text {\n padding-left: 15px;\n margin-left: -15px;\n}\n\n.apexcharts-series-collapsed {\n opacity: 0\n}\n\n.apexcharts-tooltip {\n border-radius: 5px;\n box-shadow: 2px 2px 6px -4px #999;\n cursor: default;\n font-size: 14px;\n left: 62px;\n opacity: 0;\n pointer-events: none;\n position: absolute;\n top: 20px;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n white-space: nowrap;\n z-index: 12;\n transition: .15s ease all\n}\n\n.apexcharts-tooltip.apexcharts-active {\n opacity: 1;\n transition: .15s ease all\n}\n\n.apexcharts-tooltip.apexcharts-theme-light {\n border: 1px solid #e3e3e3;\n background: rgba(255, 255, 255, .96)\n}\n\n.apexcharts-tooltip.apexcharts-theme-dark {\n color: #fff;\n background: rgba(30, 30, 30, .8)\n}\n\n.apexcharts-tooltip * {\n font-family: inherit\n}\n\n.apexcharts-tooltip-title {\n padding: 6px;\n font-size: 15px;\n margin-bottom: 4px\n}\n\n.apexcharts-tooltip.apexcharts-theme-light .apexcharts-tooltip-title {\n background: #eceff1;\n border-bottom: 1px solid #ddd\n}\n\n.apexcharts-tooltip.apexcharts-theme-dark .apexcharts-tooltip-title {\n background: rgba(0, 0, 0, .7);\n border-bottom: 1px solid #333\n}\n\n.apexcharts-tooltip-text-goals-value,\n.apexcharts-tooltip-text-y-value,\n.apexcharts-tooltip-text-z-value {\n display: inline-block;\n margin-left: 5px;\n font-weight: 600\n}\n\n.apexcharts-tooltip-text-goals-label:empty,\n.apexcharts-tooltip-text-goals-value:empty,\n.apexcharts-tooltip-text-y-label:empty,\n.apexcharts-tooltip-text-y-value:empty,\n.apexcharts-tooltip-text-z-value:empty,\n.apexcharts-tooltip-title:empty {\n display: none\n}\n\n.apexcharts-tooltip-text-goals-label,\n.apexcharts-tooltip-text-goals-value {\n padding: 6px 0 5px\n}\n\n.apexcharts-tooltip-goals-group,\n.apexcharts-tooltip-text-goals-label,\n.apexcharts-tooltip-text-goals-value {\n display: flex\n}\n\n.apexcharts-tooltip-text-goals-label:not(:empty),\n.apexcharts-tooltip-text-goals-value:not(:empty) {\n margin-top: -6px\n}\n\n.apexcharts-tooltip-marker {\n display: inline-block;\n position: relative;\n width: 16px;\n height: 16px;\n font-size: 16px;\n line-height: 16px;\n margin-right: 4px;\n text-align: center;\n vertical-align: middle;\n color: inherit;\n}\n\n.apexcharts-tooltip-marker::before {\n content: "";\n display: inline-block;\n width: 100%;\n text-align: center;\n color: currentcolor;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n font-size: 26px;\n font-family: Arial, Helvetica, sans-serif;\n line-height: 14px;\n font-weight: 900;\n}\n\n.apexcharts-tooltip-marker[shape="circle"]::before {\n content: "\\25CF";\n}\n\n.apexcharts-tooltip-marker[shape="square"]::before,\n.apexcharts-tooltip-marker[shape="rect"]::before {\n content: "\\25A0";\n transform: translate(-1px, -2px);\n}\n\n.apexcharts-tooltip-marker[shape="line"]::before {\n content: "\\2500";\n}\n\n.apexcharts-tooltip-marker[shape="diamond"]::before {\n content: "\\25C6";\n font-size: 28px;\n}\n\n.apexcharts-tooltip-marker[shape="triangle"]::before {\n content: "\\25B2";\n font-size: 22px;\n}\n\n.apexcharts-tooltip-marker[shape="cross"]::before {\n content: "\\2715";\n font-size: 18px;\n}\n\n.apexcharts-tooltip-marker[shape="plus"]::before {\n content: "\\2715";\n transform: rotate(45deg) translate(-1px, -1px);\n font-size: 18px;\n}\n\n.apexcharts-tooltip-marker[shape="star"]::before {\n content: "\\2605";\n font-size: 18px;\n}\n\n.apexcharts-tooltip-marker[shape="sparkle"]::before {\n content: "\\2726";\n font-size: 20px;\n}\n\n.apexcharts-tooltip-series-group {\n padding: 0 10px;\n display: none;\n text-align: left;\n justify-content: left;\n align-items: center\n}\n\n.apexcharts-tooltip-series-group.apexcharts-active .apexcharts-tooltip-marker {\n opacity: 1\n}\n\n.apexcharts-tooltip-series-group.apexcharts-active,\n.apexcharts-tooltip-series-group:last-child {\n padding-bottom: 4px\n}\n\n.apexcharts-tooltip-y-group {\n padding: 6px 0 5px\n}\n\n.apexcharts-custom-tooltip,\n.apexcharts-tooltip-box {\n padding: 4px 8px\n}\n\n.apexcharts-tooltip-boxPlot {\n display: flex;\n flex-direction: column-reverse\n}\n\n.apexcharts-tooltip-box>div {\n margin: 4px 0\n}\n\n.apexcharts-tooltip-box span.value {\n font-weight: 700\n}\n\n.apexcharts-tooltip-rangebar {\n padding: 5px 8px\n}\n\n.apexcharts-tooltip-rangebar .category {\n font-weight: 600;\n color: #777\n}\n\n.apexcharts-tooltip-rangebar .series-name {\n font-weight: 700;\n display: block;\n margin-bottom: 5px\n}\n\n.apexcharts-xaxistooltip,\n.apexcharts-yaxistooltip {\n opacity: 0;\n pointer-events: none;\n color: #373d3f;\n font-size: 13px;\n text-align: center;\n border-radius: 2px;\n position: absolute;\n z-index: 10;\n background: #eceff1;\n border: 1px solid #90a4ae\n}\n\n.apexcharts-xaxistooltip {\n padding: 9px 10px;\n transition: .15s ease all\n}\n\n.apexcharts-xaxistooltip.apexcharts-theme-dark {\n background: rgba(0, 0, 0, .7);\n border: 1px solid rgba(0, 0, 0, .5);\n color: #fff\n}\n\n.apexcharts-xaxistooltip:after,\n.apexcharts-xaxistooltip:before {\n left: 50%;\n border: solid transparent;\n content: " ";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none\n}\n\n.apexcharts-xaxistooltip:after {\n border-color: transparent;\n border-width: 6px;\n margin-left: -6px\n}\n\n.apexcharts-xaxistooltip:before {\n border-color: transparent;\n border-width: 7px;\n margin-left: -7px\n}\n\n.apexcharts-xaxistooltip-bottom:after,\n.apexcharts-xaxistooltip-bottom:before {\n bottom: 100%\n}\n\n.apexcharts-xaxistooltip-top:after,\n.apexcharts-xaxistooltip-top:before {\n top: 100%\n}\n\n.apexcharts-xaxistooltip-bottom:after {\n border-bottom-color: #eceff1\n}\n\n.apexcharts-xaxistooltip-bottom:before {\n border-bottom-color: #90a4ae\n}\n\n.apexcharts-xaxistooltip-bottom.apexcharts-theme-dark:after,\n.apexcharts-xaxistooltip-bottom.apexcharts-theme-dark:before {\n border-bottom-color: rgba(0, 0, 0, .5)\n}\n\n.apexcharts-xaxistooltip-top:after {\n border-top-color: #eceff1\n}\n\n.apexcharts-xaxistooltip-top:before {\n border-top-color: #90a4ae\n}\n\n.apexcharts-xaxistooltip-top.apexcharts-theme-dark:after,\n.apexcharts-xaxistooltip-top.apexcharts-theme-dark:before {\n border-top-color: rgba(0, 0, 0, .5)\n}\n\n.apexcharts-xaxistooltip.apexcharts-active {\n opacity: 1;\n transition: .15s ease all\n}\n\n.apexcharts-yaxistooltip {\n padding: 4px 10px\n}\n\n.apexcharts-yaxistooltip.apexcharts-theme-dark {\n background: rgba(0, 0, 0, .7);\n border: 1px solid rgba(0, 0, 0, .5);\n color: #fff\n}\n\n.apexcharts-yaxistooltip:after,\n.apexcharts-yaxistooltip:before {\n top: 50%;\n border: solid transparent;\n content: " ";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none\n}\n\n.apexcharts-yaxistooltip:after {\n border-color: transparent;\n border-width: 6px;\n margin-top: -6px\n}\n\n.apexcharts-yaxistooltip:before {\n border-color: transparent;\n border-width: 7px;\n margin-top: -7px\n}\n\n.apexcharts-yaxistooltip-left:after,\n.apexcharts-yaxistooltip-left:before {\n left: 100%\n}\n\n.apexcharts-yaxistooltip-right:after,\n.apexcharts-yaxistooltip-right:before {\n right: 100%\n}\n\n.apexcharts-yaxistooltip-left:after {\n border-left-color: #eceff1\n}\n\n.apexcharts-yaxistooltip-left:before {\n border-left-color: #90a4ae\n}\n\n.apexcharts-yaxistooltip-left.apexcharts-theme-dark:after,\n.apexcharts-yaxistooltip-left.apexcharts-theme-dark:before {\n border-left-color: rgba(0, 0, 0, .5)\n}\n\n.apexcharts-yaxistooltip-right:after {\n border-right-color: #eceff1\n}\n\n.apexcharts-yaxistooltip-right:before {\n border-right-color: #90a4ae\n}\n\n.apexcharts-yaxistooltip-right.apexcharts-theme-dark:after,\n.apexcharts-yaxistooltip-right.apexcharts-theme-dark:before {\n border-right-color: rgba(0, 0, 0, .5)\n}\n\n.apexcharts-yaxistooltip.apexcharts-active {\n opacity: 1\n}\n\n.apexcharts-yaxistooltip-hidden {\n display: none\n}\n\n.apexcharts-xcrosshairs,\n.apexcharts-ycrosshairs {\n pointer-events: none;\n opacity: 0;\n transition: .15s ease all\n}\n\n.apexcharts-xcrosshairs.apexcharts-active,\n.apexcharts-ycrosshairs.apexcharts-active {\n opacity: 1;\n transition: .15s ease all\n}\n\n.apexcharts-ycrosshairs-hidden {\n opacity: 0\n}\n\n.apexcharts-selection-rect {\n cursor: move\n}\n\n.svg_select_shape {\n stroke-width: 1;\n stroke-dasharray: 10 10;\n stroke: black;\n stroke-opacity: 0.1;\n pointer-events: none;\n fill: none;\n}\n\n.svg_select_handle {\n stroke-width: 3;\n stroke: black;\n fill: none;\n}\n\n.svg_select_handle_r {\n cursor: e-resize;\n}\n\n.svg_select_handle_l {\n cursor: w-resize;\n}\n\n.apexcharts-svg.apexcharts-zoomable.hovering-zoom {\n cursor: crosshair\n}\n\n.apexcharts-svg.apexcharts-zoomable.hovering-pan {\n cursor: move\n}\n\n.apexcharts-menu-icon,\n.apexcharts-pan-icon,\n.apexcharts-reset-icon,\n.apexcharts-selection-icon,\n.apexcharts-toolbar-custom-icon,\n.apexcharts-zoom-icon,\n.apexcharts-zoomin-icon,\n.apexcharts-zoomout-icon {\n cursor: pointer;\n width: 20px;\n height: 20px;\n line-height: 24px;\n color: #6e8192;\n text-align: center\n}\n\n.apexcharts-menu-icon svg,\n.apexcharts-reset-icon svg,\n.apexcharts-zoom-icon svg,\n.apexcharts-zoomin-icon svg,\n.apexcharts-zoomout-icon svg {\n fill: #6e8192\n}\n\n.apexcharts-selection-icon svg {\n fill: #444;\n transform: scale(.76)\n}\n\n.apexcharts-theme-dark .apexcharts-menu-icon svg,\n.apexcharts-theme-dark .apexcharts-pan-icon svg,\n.apexcharts-theme-dark .apexcharts-reset-icon svg,\n.apexcharts-theme-dark .apexcharts-selection-icon svg,\n.apexcharts-theme-dark .apexcharts-toolbar-custom-icon svg,\n.apexcharts-theme-dark .apexcharts-zoom-icon svg,\n.apexcharts-theme-dark .apexcharts-zoomin-icon svg,\n.apexcharts-theme-dark .apexcharts-zoomout-icon svg {\n fill: #f3f4f5\n}\n\n.apexcharts-canvas .apexcharts-reset-zoom-icon.apexcharts-selected svg,\n.apexcharts-canvas .apexcharts-selection-icon.apexcharts-selected svg,\n.apexcharts-canvas .apexcharts-zoom-icon.apexcharts-selected svg {\n fill: #008ffb\n}\n\n.apexcharts-theme-light .apexcharts-menu-icon:hover svg,\n.apexcharts-theme-light .apexcharts-reset-icon:hover svg,\n.apexcharts-theme-light .apexcharts-selection-icon:not(.apexcharts-selected):hover svg,\n.apexcharts-theme-light .apexcharts-zoom-icon:not(.apexcharts-selected):hover svg,\n.apexcharts-theme-light .apexcharts-zoomin-icon:hover svg,\n.apexcharts-theme-light .apexcharts-zoomout-icon:hover svg {\n fill: #333\n}\n\n.apexcharts-menu-icon,\n.apexcharts-selection-icon {\n position: relative\n}\n\n.apexcharts-reset-icon {\n margin-left: 5px\n}\n\n.apexcharts-menu-icon,\n.apexcharts-reset-icon,\n.apexcharts-zoom-icon {\n transform: scale(.85)\n}\n\n.apexcharts-zoomin-icon,\n.apexcharts-zoomout-icon {\n transform: scale(.7)\n}\n\n.apexcharts-zoomout-icon {\n margin-right: 3px\n}\n\n.apexcharts-pan-icon {\n transform: scale(.62);\n position: relative;\n left: 1px;\n top: 0\n}\n\n.apexcharts-pan-icon svg {\n fill: #fff;\n stroke: #6e8192;\n stroke-width: 2\n}\n\n.apexcharts-pan-icon.apexcharts-selected svg {\n stroke: #008ffb\n}\n\n.apexcharts-pan-icon:not(.apexcharts-selected):hover svg {\n stroke: #333\n}\n\n.apexcharts-toolbar {\n position: absolute;\n z-index: 11;\n max-width: 176px;\n text-align: right;\n border-radius: 3px;\n padding: 0 6px 2px;\n display: flex;\n justify-content: space-between;\n align-items: center\n}\n\n.apexcharts-menu {\n background: #fff;\n position: absolute;\n top: 100%;\n border: 1px solid #ddd;\n border-radius: 3px;\n padding: 3px;\n right: 10px;\n opacity: 0;\n min-width: 110px;\n transition: .15s ease all;\n pointer-events: none\n}\n\n.apexcharts-menu.apexcharts-menu-open {\n opacity: 1;\n pointer-events: all;\n transition: .15s ease all\n}\n\n.apexcharts-menu-item {\n padding: 6px 7px;\n font-size: 12px;\n cursor: pointer\n}\n\n.apexcharts-theme-light .apexcharts-menu-item:hover {\n background: #eee\n}\n\n.apexcharts-theme-dark .apexcharts-menu {\n background: rgba(0, 0, 0, .7);\n color: #fff\n}\n\n@media screen and (min-width:768px) {\n .apexcharts-canvas:hover .apexcharts-toolbar {\n opacity: 1\n }\n}\n\n.apexcharts-canvas .apexcharts-element-hidden,\n.apexcharts-datalabel.apexcharts-element-hidden,\n.apexcharts-hide .apexcharts-series-points {\n opacity: 0;\n}\n\n.apexcharts-hidden-element-shown {\n opacity: 1;\n transition: 0.25s ease all;\n}\n\n.apexcharts-datalabel,\n.apexcharts-datalabel-label,\n.apexcharts-datalabel-value,\n.apexcharts-datalabels,\n.apexcharts-pie-label {\n cursor: default;\n pointer-events: none\n}\n\n.apexcharts-pie-label-delay {\n opacity: 0;\n animation-name: opaque;\n animation-duration: .3s;\n animation-fill-mode: forwards;\n animation-timing-function: ease\n}\n\n.apexcharts-radialbar-label {\n cursor: pointer;\n}\n\n.apexcharts-annotation-rect,\n.apexcharts-area-series .apexcharts-area,\n.apexcharts-gridline,\n.apexcharts-line,\n.apexcharts-point-annotation-label,\n.apexcharts-radar-series path:not(.apexcharts-marker),\n.apexcharts-radar-series polygon,\n.apexcharts-toolbar svg,\n.apexcharts-tooltip .apexcharts-marker,\n.apexcharts-xaxis-annotation-label,\n.apexcharts-yaxis-annotation-label,\n.apexcharts-zoom-rect,\n.no-pointer-events {\n pointer-events: none\n}\n\n.apexcharts-tooltip-active .apexcharts-marker {\n transition: .15s ease all\n}\n\n.apexcharts-radar-series .apexcharts-yaxis {\n pointer-events: none;\n}\n\n.resize-triggers {\n animation: 1ms resizeanim;\n visibility: hidden;\n opacity: 0;\n height: 100%;\n width: 100%;\n overflow: hidden\n}\n\n.contract-trigger:before,\n.resize-triggers,\n.resize-triggers>div {\n content: " ";\n display: block;\n position: absolute;\n top: 0;\n left: 0\n}\n\n.resize-triggers>div {\n height: 100%;\n width: 100%;\n background: #eee;\n overflow: auto\n}\n\n.contract-trigger:before {\n overflow: hidden;\n width: 200%;\n height: 200%\n}\n\n.apexcharts-bar-goals-markers {\n pointer-events: none\n}\n\n.apexcharts-bar-shadows {\n pointer-events: none\n}\n\n.apexcharts-rangebar-goals-markers {\n pointer-events: none\n}',""]);const s=a},161:(t,e,r)=>{var i=r(72),n=r(2);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[t.id,n,""]]);var o=(i(t.id,n,{insert:"head",singleton:!1}),n.locals?n.locals:{});t.exports=o},72:(t,e,r)=>{"use strict";var i,n=function(){var t={};return function(e){if(void 0===t[e]){var r=document.querySelector(e);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(t){r=null}t[e]=r}return t[e]}}(),o={};function a(t,e,r){for(var i=0;i{t.exports=''},627:t=>{t.exports=''},606:t=>{t.exports=''},75:t=>{t.exports=''},646:t=>{t.exports=''},802:t=>{t.exports=''},541:t=>{t.exports=''}},e={};function r(i){var n=e[i];if(void 0!==n)return n.exports;var o=e[i]={id:i,exports:{}};return t[i](o,o.exports,r),o.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var i in e)r.o(e,i)&&!r.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nc=void 0;var i={};return(()=>{"use strict";r.r(i),r.d(i,{default:()=>Fy});var t={};r.r(t),r.d(t,{cx:()=>Yr,cy:()=>Hr,height:()=>Br,rx:()=>_r,ry:()=>zr,width:()=>Fr,x:()=>Xr,y:()=>Dr});var e={};r.r(e),r.d(e,{from:()=>si,to:()=>li});var n={};r.r(n),r.d(n,{MorphArray:()=>Vi,height:()=>$i,width:()=>Zi,x:()=>Ui,y:()=>qi});var o={};r.r(o),r.d(o,{array:()=>xo,clear:()=>wo,move:()=>So,plot:()=>ko,size:()=>Ao});var a={};r.r(a),r.d(a,{amove:()=>$a,ax:()=>qa,ay:()=>Za,build:()=>Ja,center:()=>Ua,cx:()=>Ga,cy:()=>Va,length:()=>Fa,move:()=>Wa,plain:()=>Ha,x:()=>Ba,y:()=>Na});var s={};function l(t){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(t)}function c(t,e){for(var r=0;rXs,dx:()=>Ds,dy:()=>Ys,height:()=>Hs,move:()=>Fs,size:()=>Bs,width:()=>Ns,x:()=>Ws,y:()=>Gs});var h=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,r,i;return e=t,r=[{key:"shadeRGBColor",value:function(t,e){var r=e.split(","),i=t<0?0:255,n=t<0?-1*t:t,o=parseInt(r[0].slice(4),10),a=parseInt(r[1],10),s=parseInt(r[2],10);return"rgb("+(Math.round((i-o)*n)+o)+","+(Math.round((i-a)*n)+a)+","+(Math.round((i-s)*n)+s)+")"}},{key:"shadeHexColor",value:function(t,e){var r=parseInt(e.slice(1),16),i=t<0?0:255,n=t<0?-1*t:t,o=r>>16,a=r>>8&255,s=255&r;return"#"+(16777216+65536*(Math.round((i-o)*n)+o)+256*(Math.round((i-a)*n)+a)+(Math.round((i-s)*n)+s)).toString(16).slice(1)}},{key:"shadeColor",value:function(e,r){return t.isColorHex(r)?this.shadeHexColor(e,r):this.shadeRGBColor(e,r)}}],i=[{key:"bind",value:function(t,e){return function(){return t.apply(e,arguments)}}},{key:"isObject",value:function(t){return t&&"object"===l(t)&&!Array.isArray(t)&&null!=t}},{key:"is",value:function(t,e){return Object.prototype.toString.call(e)==="[object "+t+"]"}},{key:"listToArray",value:function(t){var e,r=[];for(e=0;e1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if(null===t||"object"!==l(t))return t;if(r.has(t))return r.get(t);if(Array.isArray(t)){e=[],r.set(t,e);for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:2;return Number.isInteger(t)?t:parseFloat(t.toPrecision(e))}},{key:"randomId",value:function(){return(Math.random()+1).toString(36).substring(4)}},{key:"noExponents",value:function(t){return t.toString().includes("e")?Math.round(t):t}},{key:"elementExists",value:function(t){return!(!t||!t.isConnected)}},{key:"getDimensions",value:function(t){var e=getComputedStyle(t,null),r=t.clientHeight,i=t.clientWidth;return r-=parseFloat(e.paddingTop)+parseFloat(e.paddingBottom),[i-=parseFloat(e.paddingLeft)+parseFloat(e.paddingRight),r]}},{key:"getBoundingClientRect",value:function(t){var e=t.getBoundingClientRect();return{top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:t.clientWidth,height:t.clientHeight,x:e.left,y:e.top}}},{key:"getLargestStringFromArr",value:function(t){return t.reduce((function(t,e){return Array.isArray(e)&&(e=e.reduce((function(t,e){return t.length>e.length?t:e}))),t.length>e.length?t:e}),0)}},{key:"hexToRgba",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"#999999",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.6;"#"!==t.substring(0,1)&&(t="#999999");var r=t.replace("#","");r=r.match(new RegExp("(.{"+r.length/3+"})","g"));for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:"x",r=t.toString().slice();return r.replace(/[` ~!@#$%^&*()|+\=?;:'",.<>{}[\]\\/]/gi,e)}},{key:"negToZero",value:function(t){return t<0?0:t}},{key:"moveIndexInArray",value:function(t,e,r){if(r>=t.length)for(var i=r-t.length+1;i--;)t.push(void 0);return t.splice(r,0,t.splice(e,1)[0]),t}},{key:"extractNumber",value:function(t){return parseFloat(t.replace(/[^\d.]*/g,""))}},{key:"findAncestor",value:function(t,e){for(;(t=t.parentElement)&&!t.classList.contains(e););return t}},{key:"setELstyles",value:function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t.style.key=e[r])}},{key:"preciseAddition",value:function(t,e){var r=(String(t).split(".")[1]||"").length,i=(String(e).split(".")[1]||"").length,n=Math.pow(10,Math.max(r,i));return(Math.round(t*n)+Math.round(e*n))/n}},{key:"isNumber",value:function(t){return!isNaN(t)&&parseFloat(Number(t))===t&&!isNaN(parseInt(t,10))}},{key:"isFloat",value:function(t){return Number(t)===t&&t%1!=0}},{key:"isMsEdge",value:function(){var t=window.navigator.userAgent,e=t.indexOf("Edge/");return e>0&&parseInt(t.substring(e+5,t.indexOf(".",e)),10)}},{key:"getGCD",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:7,i=Math.pow(10,r-Math.floor(Math.log10(Math.max(t,e))));for(t=Math.round(Math.abs(t)*i),e=Math.round(Math.abs(e)*i);e;){var n=e;e=t%e,t=n}return t/i}},{key:"getPrimeFactors",value:function(t){for(var e=[],r=2;t>=2;)t%r==0?(e.push(r),t/=r):r++;return e}},{key:"mod",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:7,i=Math.pow(10,r-Math.floor(Math.log10(Math.max(t,e))));return(t=Math.round(Math.abs(t)*i))%(e=Math.round(Math.abs(e)*i))/i}}],r&&c(e.prototype,r),i&&c(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();const f=h;function d(t){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d(t)}function p(t,e){for(var r=0;r-1||n.indexOf("NaN")>-1)&&(n=u()),(!o.trim()||o.indexOf("undefined")>-1||o.indexOf("NaN")>-1)&&(o=u()),c.globals.shouldAnimate||(a=1),t.plot(n).animate(1,s).plot(n).animate(a,s).plot(o).after((function(){f.isNumber(r)?r===c.globals.series[c.globals.maxValsInArrayIndex].length-2&&c.globals.shouldAnimate&&l.animationCompleted(t):"none"!==i&&c.globals.shouldAnimate&&(!c.globals.comboCharts&&e===c.globals.series.length-1||c.globals.comboCharts)&&l.animationCompleted(t),l.showDelayedElements()}))}}],r&&p(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function y(t){return function(t){if(Array.isArray(t))return x(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||m(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function m(t,e){if(t){if("string"==typeof t)return x(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?x(t,e):void 0}}function x(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,o=!0,a=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return o=t.done,t},e:function(t){a=!0,n=t},f:function(){try{o||null==e.return||e.return()}finally{if(a)throw n}}}}(t);try{for(i.s();!(r=i.n()).done;)k(r.value,e)}catch(t){i.e(t)}finally{i.f()}}else if("object"!==v(t))O(Object.getOwnPropertyNames(e)),w[t]=Object.assign(w[t]||{},e);else for(var n in t)k(n,t[n])}function A(t){return w[t]||{}}function O(t){S.push.apply(S,y(t))}function P(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function C(t,e,r){return(e=function(t){var e=function(t){if("object"!=T(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=T(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==T(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function T(t){return T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},T(t)}function E(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r2&&void 0!==arguments[2]?arguments[2]:{},i=function(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:Y;return B.document.createElementNS(e,t)}function Z(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t instanceof W)return t;if("object"===G(t))return Q(t);if(null==t)return new V[U];if("string"==typeof t&&"<"!==t.charAt(0))return Q(B.document.querySelector(t));var r=e?B.document.createElement("div"):q("svg");return r.innerHTML=t,t=Q(r.firstChild),r.removeChild(r.firstChild),t}function $(t,e){return e&&(e instanceof B.window.Node||e.ownerDocument&&e instanceof e.ownerDocument.defaultView.Node)?e:q(t)}function J(t){if(!t)return null;if(t.instance instanceof W)return t.instance;if("#document-fragment"===t.nodeName)return new V.Fragment(t);var e=I(t.nodeName||"Dom");return"LinearGradient"===e||"RadialGradient"===e?e="Gradient":V[e]||(e="Dom"),new V[e](t)}var Q=J;function K(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.name,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return V[e]=t,r&&(V[U]=t),O(Object.getOwnPropertyNames(t.prototype)),t}var tt=1e3;function et(t){return"Svgjs"+I(t)+tt++}function rt(t){for(var e=t.children.length-1;e>=0;e--)rt(t.children[e]);return t.id?(t.id=et(t.nodeName),t):t}function it(t,e){var r,i;for(i=(t=Array.isArray(t)?t:[t]).length-1;i>=0;i--)for(r in e)t[i].prototype[r]=e[r]}function nt(t){return function(){for(var e=arguments.length,r=new Array(e),i=0;it.length)&&(e=t.length);for(var r=0,i=Array(e);rt.length)&&(e=t.length);for(var r=0,i=Array(e);rt.length)&&(e=t.length);for(var r=0,i=Array(e);r1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}k("Dom",{classes:function(){var t=this.attr("class");return null==t?[]:t.trim().split(bt)},hasClass:function(t){return-1!==this.classes().indexOf(t)},addClass:function(t){if(!this.hasClass(t)){var e=this.classes();e.push(t),this.attr("class",e.join(" "))}return this},removeClass:function(t){return this.hasClass(t)&&this.attr("class",this.classes().filter((function(e){return e!==t})).join(" ")),this},toggleClass:function(t){return this.hasClass(t)?this.removeClass(t):this.addClass(t)}}),k("Dom",{css:function(t,e){var r={};if(0===arguments.length)return this.node.style.cssText.split(/\s*;\s*/).filter((function(t){return!!t.length})).forEach((function(t){var e=t.split(/\s*:\s*/);r[e[0]]=e[1]})),r;if(arguments.length<2){if(Array.isArray(t)){var i,n=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return mt(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?mt(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0,n=function(){};return{s:n,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}(t);try{for(n.s();!(i=n.n()).done;){var o=i.value,a=o;r[o]=this.node.style.getPropertyValue(a)}}catch(t){n.e(t)}finally{n.f()}return r}if("string"==typeof t)return this.node.style.getPropertyValue(t);if("object"===vt(t))for(var s in t)this.node.style.setProperty(s,null==t[s]||dt.test(t[s])?"":t[s])}return 2===arguments.length&&this.node.style.setProperty(t,null==e||dt.test(e)?"":e),this},show:function(){return this.css("display","")},hide:function(){return this.css("display","none")},visible:function(){return"none"!==this.css("display")}}),k("Dom",{data:function(t,e,r){if(null==t)return this.data(M(function(t){var e,r=t.length,i=[];for(e=0;e=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}(t);try{for(o.s();!(i=o.n()).done;){var a=i.value;n[a]=this.data(a)}}catch(t){o.e(t)}finally{o.f()}return n}if("object"===xt(t))for(e in t)this.data(e,t[e]);else if(arguments.length<2)try{return JSON.parse(this.attr("data-"+t))}catch(e){return this.attr("data-"+t)}else this.attr("data-"+t,null===e?null:!0===r||"string"==typeof e||"number"==typeof e?e:JSON.stringify(e));return this}}),k("Dom",{remember:function(t,e){if("object"===St(arguments[0]))for(var r in t)this.remember(r,t[r]);else{if(1===arguments.length)return this.memory()[t];this.memory()[t]=e}return this},forget:function(){if(0===arguments.length)this._memory={};else for(var t=arguments.length-1;t>=0;t--)delete this.memory()[arguments[t]];return this},memory:function(){return this._memory=this._memory||{}}});var Mt=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.init.apply(this,arguments)}var e,r,i;return e=t,r=[{key:"cmyk",value:function(){var e=this.rgb(),r=At([e._a,e._b,e._c].map((function(t){return t/255})),3),i=r[0],n=r[1],o=r[2],a=Math.min(1-i,1-n,1-o);return 1===a?new t(0,0,0,1,"cmyk"):new t((1-i-a)/(1-a),(1-n-a)/(1-a),(1-o-a)/(1-a),a,"cmyk")}},{key:"hsl",value:function(){var e=this.rgb(),r=At([e._a,e._b,e._c].map((function(t){return t/255})),3),i=r[0],n=r[1],o=r[2],a=Math.max(i,n,o),s=Math.min(i,n,o),l=(a+s)/2,c=a===s,u=a-s;return new t(360*(c?0:a===i?((n-o)/u+(n.5?u/(2-a-s):u/(a+s)),100*l,"hsl")}},{key:"init",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"rgb";if(t=t||0,this.space)for(var o in this.space)delete this[this.space[o]];if("number"==typeof t)n="string"==typeof i?i:n,i="string"==typeof i?0:i,Object.assign(this,{_a:t,_b:e,_c:r,_d:i,space:n});else if(t instanceof Array)this.space=e||("string"==typeof t[3]?t[3]:t[4])||"rgb",Object.assign(this,{_a:t[0],_b:t[1],_c:t[2],_d:t[3]||0});else if(t instanceof Object){var a=function(t,e){var r=Tt(t,"rgb")?{_a:t.r,_b:t.g,_c:t.b,_d:0,space:"rgb"}:Tt(t,"xyz")?{_a:t.x,_b:t.y,_c:t.z,_d:0,space:"xyz"}:Tt(t,"hsl")?{_a:t.h,_b:t.s,_c:t.l,_d:0,space:"hsl"}:Tt(t,"lab")?{_a:t.l,_b:t.a,_c:t.b,_d:0,space:"lab"}:Tt(t,"lch")?{_a:t.l,_b:t.c,_c:t.h,_d:0,space:"lch"}:Tt(t,"cmyk")?{_a:t.c,_b:t.m,_c:t.y,_d:t.k,space:"cmyk"}:{_a:0,_b:0,_c:0,space:"rgb"};return r.space=e||r.space,r}(t,e);Object.assign(this,a)}else if("string"==typeof t)if(ft.test(t)){var s=t.replace(ut,""),l=At(st.exec(s).slice(1,4).map((function(t){return parseInt(t)})),3),c=l[0],u=l[1],h=l[2];Object.assign(this,{_a:c,_b:u,_c:h,_d:0,space:"rgb"})}else{if(!ht.test(t))throw Error("Unsupported string format, can't construct Color");var f=at.exec(function(t){return 4===t.length?["#",t.substring(1,2),t.substring(1,2),t.substring(2,3),t.substring(2,3),t.substring(3,4),t.substring(3,4)].join(""):t}(t)).map((function(t){return parseInt(t,16)})),d=At(f,4),p=d[1],g=d[2],b=d[3];Object.assign(this,{_a:p,_b:g,_c:b,_d:0,space:"rgb"})}var y=this._a,v=this._b,m=this._c,x=this._d,w="rgb"===this.space?{r:y,g:v,b:m}:"xyz"===this.space?{x:y,y:v,z:m}:"hsl"===this.space?{h:y,s:v,l:m}:"lab"===this.space?{l:y,a:v,b:m}:"lch"===this.space?{l:y,c:v,h:m}:"cmyk"===this.space?{c:y,m:v,y:m,k:x}:{};Object.assign(this,w)}},{key:"lab",value:function(){var e=this.xyz(),r=e.x,i=e.y;return new t(116*i-16,500*(r-i),200*(i-e.z),"lab")}},{key:"lch",value:function(){var e=this.lab(),r=e.l,i=e.a,n=e.b,o=Math.sqrt(Math.pow(i,2)+Math.pow(n,2)),a=180*Math.atan2(n,i)/Math.PI;return a<0&&(a=360-(a*=-1)),new t(r,o,a,"lch")}},{key:"rgb",value:function(){if("rgb"===this.space)return this;if("lab"===(E=this.space)||"xyz"===E||"lch"===E){var e=this.x,r=this.y,i=this.z;if("lab"===this.space||"lch"===this.space){var n=this.l,o=this.a,a=this.b;if("lch"===this.space){var s=this.c,l=this.h,c=Math.PI/180;o=s*Math.cos(c*l),a=s*Math.sin(c*l)}var u=(n+16)/116,h=o/500+u,f=u-a/200,d=16/116,p=.008856,g=7.787;e=.95047*(Math.pow(h,3)>p?Math.pow(h,3):(h-d)/g),r=1*(Math.pow(u,3)>p?Math.pow(u,3):(u-d)/g),i=1.08883*(Math.pow(f,3)>p?Math.pow(f,3):(f-d)/g)}var b=3.2406*e+-1.5372*r+-.4986*i,y=-.9689*e+1.8758*r+.0415*i,v=.0557*e+-.204*r+1.057*i,m=Math.pow,x=.0031308;return new t(255*(b>x?1.055*m(b,1/2.4)-.055:12.92*b),255*(y>x?1.055*m(y,1/2.4)-.055:12.92*y),255*(v>x?1.055*m(v,1/2.4)-.055:12.92*v))}if("hsl"===this.space){var w=this.h,S=this.s,k=this.l;if(w/=360,k/=100,0==(S/=100))return new t(k*=255,k,k);var A=k<.5?k*(1+S):k+S-k*S,O=2*k-A;return new t(255*Et(O,A,w+1/3),255*Et(O,A,w),255*Et(O,A,w-1/3))}if("cmyk"===this.space){var P=this.c,C=this.m,j=this.y,T=this.k;return new t(255*(1-Math.min(1,P*(1-T)+T)),255*(1-Math.min(1,C*(1-T)+T)),255*(1-Math.min(1,j*(1-T)+T)))}return this;var E}},{key:"toArray",value:function(){return[this._a,this._b,this._c,this._d,this.space]}},{key:"toHex",value:function(){var t=At(this._clamped().map(jt),3),e=t[0],r=t[1],i=t[2];return"#".concat(e).concat(r).concat(i)}},{key:"toRgb",value:function(){var t=At(this._clamped(),3),e=t[0],r=t[1],i=t[2];return"rgb(".concat(e,",").concat(r,",").concat(i,")")}},{key:"toString",value:function(){return this.toHex()}},{key:"xyz",value:function(){var e=this.rgb(),r=At([e._a,e._b,e._c].map((function(t){return t/255})),3),i=r[0],n=r[1],o=r[2],a=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92,s=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92,l=o>.04045?Math.pow((o+.055)/1.055,2.4):o/12.92,c=(.4124*a+.3576*s+.1805*l)/.95047,u=(.2126*a+.7152*s+.0722*l)/1,h=(.0193*a+.1192*s+.9505*l)/1.08883;return new t(c>.008856?Math.pow(c,1/3):7.787*c+16/116,u>.008856?Math.pow(u,1/3):7.787*u+16/116,h>.008856?Math.pow(h,1/3):7.787*h+16/116,"xyz")}},{key:"_clamped",value:function(){var t=this.rgb(),e=t._a,r=t._b,i=t._c,n=Math.max,o=Math.min,a=Math.round;return[e,r,i].map((function(t){return n(0,o(a(t),255))}))}}],i=[{key:"isColor",value:function(e){return e&&(e instanceof t||this.isRgb(e)||this.test(e))}},{key:"isRgb",value:function(t){return t&&"number"==typeof t.r&&"number"==typeof t.g&&"number"==typeof t.b}},{key:"random",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"vibrant",r=arguments.length>1?arguments[1]:void 0,i=Math.random,n=Math.round,o=Math.sin,a=Math.PI;if("vibrant"===e)return new t(24*i()+57,38*i()+45,360*i(),"lch");if("sine"===e)return new t(n(80*o(2*a*(r=null==r?i():r)/.5+.01)+150),n(50*o(2*a*r/.5+4.6)+200),n(100*o(2*a*r/.5+2.3)+150));if("pastel"===e)return new t(8*i()+86,17*i()+9,360*i(),"lch");if("dark"===e)return new t(10+10*i(),50*i()+86,360*i(),"lch");if("rgb"===e)return new t(255*i(),255*i(),255*i());if("lab"===e)return new t(100*i(),256*i()-128,256*i()-128,"lab");if("grey"===e){var s=255*i();return new t(s,s,s)}throw new Error("Unsupported random color mode")}},{key:"test",value:function(t){return"string"==typeof t&&(ht.test(t)||ft.test(t))}}],r&&Pt(e.prototype,r),i&&Pt(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Lt(t){return Lt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lt(t)}function It(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.a,i=this.b,n=this.c,o=this.d,a=this.e,s=this.f,l=r*o-i*n,c=l>0?1:-1,u=c*Math.sqrt(r*r+i*i),h=Math.atan2(c*i,c*r),f=180/Math.PI*h,d=Math.cos(h),p=Math.sin(h),g=(r*n+i*o)/l,b=n*u/(g*r-i)||o*u/(g*i+r);return{scaleX:u,scaleY:b,shear:g,rotate:f,translateX:a-t+t*d*u+e*(g*d*u-p*b),translateY:s-e+t*p*u+e*(g*p*u+d*b),originX:t,originY:e,a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}},{key:"equals",value:function(e){if(e===this)return!0;var r=new t(e);return Yt(this.a,r.a)&&Yt(this.b,r.b)&&Yt(this.c,r.c)&&Yt(this.d,r.d)&&Yt(this.e,r.e)&&Yt(this.f,r.f)}},{key:"flip",value:function(t,e){return this.clone().flipO(t,e)}},{key:"flipO",value:function(t,e){return"x"===t?this.scaleO(-1,1,e,0):"y"===t?this.scaleO(1,-1,0,e):this.scaleO(-1,-1,t,e||t)}},{key:"init",value:function(e){var r=t.fromArray([1,0,0,1,0,0]);return e=e instanceof ar?e.matrixify():"string"==typeof e?t.fromArray(e.split(bt).map(parseFloat)):Array.isArray(e)?t.fromArray(e):"object"===zt(e)&&t.isMatrixLike(e)?e:"object"===zt(e)?(new t).transform(e):6===arguments.length?t.fromArray([].slice.call(arguments)):r,this.a=null!=e.a?e.a:r.a,this.b=null!=e.b?e.b:r.b,this.c=null!=e.c?e.c:r.c,this.d=null!=e.d?e.d:r.d,this.e=null!=e.e?e.e:r.e,this.f=null!=e.f?e.f:r.f,this}},{key:"inverse",value:function(){return this.clone().inverseO()}},{key:"inverseO",value:function(){var t=this.a,e=this.b,r=this.c,i=this.d,n=this.e,o=this.f,a=t*i-e*r;if(!a)throw new Error("Cannot invert "+this);var s=i/a,l=-e/a,c=-r/a,u=t/a,h=-(s*n+c*o),f=-(l*n+u*o);return this.a=s,this.b=l,this.c=c,this.d=u,this.e=h,this.f=f,this}},{key:"lmultiply",value:function(t){return this.clone().lmultiplyO(t)}},{key:"lmultiplyO",value:function(e){var r=e instanceof t?e:new t(e);return t.matrixMultiply(r,this,this)}},{key:"multiply",value:function(t){return this.clone().multiplyO(t)}},{key:"multiplyO",value:function(e){var r=e instanceof t?e:new t(e);return t.matrixMultiply(this,r,this)}},{key:"rotate",value:function(t,e,r){return this.clone().rotateO(t,e,r)}},{key:"rotateO",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;t=L(t);var i=Math.cos(t),n=Math.sin(t),o=this.a,a=this.b,s=this.c,l=this.d,c=this.e,u=this.f;return this.a=o*i-a*n,this.b=a*i+o*n,this.c=s*i-l*n,this.d=l*i+s*n,this.e=c*i-u*n+r*n-e*i+e,this.f=u*i+c*n-e*n-r*i+r,this}},{key:"scale",value:function(){var t;return(t=this.clone()).scaleO.apply(t,arguments)}},{key:"scaleO",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;3===arguments.length&&(i=r,r=e,e=t);var n=this.a,o=this.b,a=this.c,s=this.d,l=this.e,c=this.f;return this.a=n*t,this.b=o*e,this.c=a*t,this.d=s*e,this.e=l*t-r*t+r,this.f=c*e-i*e+i,this}},{key:"shear",value:function(t,e,r){return this.clone().shearO(t,e,r)}},{key:"shearO",value:function(t){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=this.a,i=this.b,n=this.c,o=this.d,a=this.e,s=this.f;return this.a=r+i*t,this.c=n+o*t,this.e=a+s*t-e*t,this}},{key:"skew",value:function(){var t;return(t=this.clone()).skewO.apply(t,arguments)}},{key:"skewO",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;3===arguments.length&&(i=r,r=e,e=t),t=L(t),e=L(e);var n=Math.tan(t),o=Math.tan(e),a=this.a,s=this.b,l=this.c,c=this.d,u=this.e,h=this.f;return this.a=a+s*n,this.b=s+a*o,this.c=l+c*n,this.d=c+l*o,this.e=u+h*n-i*n,this.f=h+u*o-r*o,this}},{key:"skewX",value:function(t,e,r){return this.skew(t,0,e,r)}},{key:"skewY",value:function(t,e,r){return this.skew(0,t,e,r)}},{key:"toArray",value:function(){return[this.a,this.b,this.c,this.d,this.e,this.f]}},{key:"toString",value:function(){return"matrix("+this.a+","+this.b+","+this.c+","+this.d+","+this.e+","+this.f+")"}},{key:"transform",value:function(e){if(t.isMatrixLike(e))return new t(e).multiplyO(this);var r=t.formatTransforms(e),i=new _t(r.ox,r.oy).transform(this),n=i.x,o=i.y,a=(new t).translateO(r.rx,r.ry).lmultiplyO(this).translateO(-n,-o).scaleO(r.scaleX,r.scaleY).skewO(r.skewX,r.skewY).shearO(r.shear).rotateO(r.theta).translateO(n,o);if(isFinite(r.px)||isFinite(r.py)){var s=new _t(n,o).transform(a),l=isFinite(r.px)?r.px-s.x:0,c=isFinite(r.py)?r.py-s.y:0;a.translateO(l,c)}return a.translateO(r.tx,r.ty),a}},{key:"translate",value:function(t,e){return this.clone().translateO(t,e)}},{key:"translateO",value:function(t,e){return this.e+=t||0,this.f+=e||0,this}},{key:"valueOf",value:function(){return{a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}}],i=[{key:"formatTransforms",value:function(t){var e="both"===t.flip||!0===t.flip,r=t.flip&&(e||"x"===t.flip)?-1:1,i=t.flip&&(e||"y"===t.flip)?-1:1,n=t.skew&&t.skew.length?t.skew[0]:isFinite(t.skew)?t.skew:isFinite(t.skewX)?t.skewX:0,o=t.skew&&t.skew.length?t.skew[1]:isFinite(t.skew)?t.skew:isFinite(t.skewY)?t.skewY:0,a=t.scale&&t.scale.length?t.scale[0]*r:isFinite(t.scale)?t.scale*r:isFinite(t.scaleX)?t.scaleX*r:r,s=t.scale&&t.scale.length?t.scale[1]*i:isFinite(t.scale)?t.scale*i:isFinite(t.scaleY)?t.scaleY*i:i,l=t.shear||0,c=t.rotate||t.theta||0,u=new _t(t.origin||t.around||t.ox||t.originX,t.oy||t.originY),h=u.x,f=u.y,d=new _t(t.position||t.px||t.positionX||NaN,t.py||t.positionY||NaN),p=d.x,g=d.y,b=new _t(t.translate||t.tx||t.translateX,t.ty||t.translateY),y=b.x,v=b.y,m=new _t(t.relative||t.rx||t.relativeX,t.ry||t.relativeY);return{scaleX:a,scaleY:s,skewX:n,skewY:o,shear:l,theta:c,rx:m.x,ry:m.y,tx:y,ty:v,ox:h,oy:f,px:p,py:g}}},{key:"fromArray",value:function(t){return{a:t[0],b:t[1],c:t[2],d:t[3],e:t[4],f:t[5]}}},{key:"isMatrixLike",value:function(t){return null!=t.a||null!=t.b||null!=t.c||null!=t.d||null!=t.e||null!=t.f}},{key:"matrixMultiply",value:function(t,e,r){var i=t.a*e.a+t.c*e.b,n=t.b*e.a+t.d*e.b,o=t.a*e.c+t.c*e.d,a=t.b*e.c+t.d*e.d,s=t.e+t.a*e.e+t.c*e.f,l=t.f+t.b*e.e+t.d*e.f;return r.a=i,r.b=n,r.c=o,r.d=a,r.e=s,r.f=l,r}}],r&&Xt(e.prototype,r),i&&Xt(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Ft(){if(!Ft.nodes){var t=Z().size(2,0);t.node.style.cssText=["opacity: 0","position: absolute","left: -100%","top: -100%","overflow: hidden"].join(";"),t.attr("focusable","false"),t.attr("aria-hidden","true");var e=t.path().node;Ft.nodes={svg:t,path:e}}if(!Ft.nodes.svg.node.parentNode){var r=B.document.body||B.document.documentElement;Ft.nodes.svg.addTo(r)}return Ft.nodes}function Bt(t){return Bt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bt(t)}function Nt(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,i=Array(e);r0&&void 0!==arguments[0]?arguments[0]:[];!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n);for(var o=arguments.length,a=new Array(o>1?o-1:0),s=1;s1?e-1:0),i=1;it.length)&&(e=t.length);for(var r=0,i=Array(e);r0&&void 0!==arguments[0]?arguments[0]:[];return t instanceof Array?t:t.trim().split(bt).map(parseFloat)}},{key:"toArray",value:function(){return Array.prototype.concat.apply([],this)}},{key:"toSet",value:function(){return new Set(this)}},{key:"toString",value:function(){return this.join(" ")}},{key:"valueOf",value:function(){var t=[];return t.push.apply(t,Pe(this)),t}}],r&&je(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),n}(Ee(Array));function _e(t){return _e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_e(t)}function ze(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,i=Array(e);r0&&void 0!==arguments[0])||arguments[0],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.writeDataToDom();var r=this.node.cloneNode(t);return e&&(r=rt(r)),new this.constructor(r)}},{key:"each",value:function(t,e){var r,i,n=this.children();for(r=0,i=n.length;r=0}},{key:"html",value:function(t,e){return this.xml(t,e,"http://www.w3.org/1999/xhtml")}},{key:"id",value:function(t){return void 0!==t||this.node.id||(this.node.id=et(this.type)),this.attr("id",t)}},{key:"index",value:function(t){return[].slice.call(this.node.childNodes).indexOf(t.node)}},{key:"last",value:function(){return J(this.node.lastChild)}},{key:"matches",value:function(t){var e=this.node,r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector||null;return r&&r.call(e,t)}},{key:"parent",value:function(t){var e=this;if(!e.node.parentNode)return null;if(e=J(e.node.parentNode),!t)return e;do{if("string"==typeof t?e.matches(t):e instanceof t)return e}while(e=J(e.node.parentNode));return e}},{key:"put",value:function(t,e){return t=Z(t),this.add(t,e),t}},{key:"putIn",value:function(t,e){return Z(t).add(this,e)}},{key:"remove",value:function(){return this.parent()&&this.parent().removeElement(this),this}},{key:"removeElement",value:function(t){return this.node.removeChild(t.node),this}},{key:"replace",value:function(t){return t=Z(t),this.node.parentNode&&this.node.parentNode.replaceChild(t.node,this.node),t}},{key:"round",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=Math.pow(10,t),i=this.attr(e);for(var n in i)"number"==typeof i[n]&&(i[n]=Math.round(i[n]*r)/r);return this.attr(i),this}},{key:"svg",value:function(t,e){return this.xml(t,e,Y)}},{key:"toString",value:function(){return this.id()}},{key:"words",value:function(t){return this.node.textContent=t,this}},{key:"wrap",value:function(t){var e=this.parent();if(!e)return this.addTo(t);var r=e.index(this);return e.put(t,r).put(this)}},{key:"writeDataToDom",value:function(){return this.each((function(){this.writeDataToDom()})),this}},{key:"xml",value:function(t,e,r){if("boolean"==typeof t&&(r=e,e=t,t=null),null==t||"function"==typeof t){e=null==e||e,this.writeDataToDom();var i=this;if(null!=t){if(i=J(i.node.cloneNode(!0)),e){var n=t(i);if(i=n||i,!1===n)return""}i.each((function(){var e=t(this),r=e||this;!1===e?this.remove():e&&this!==r&&this.replace(r)}),!0)}return e?i.node.outerHTML:i.node.innerHTML}e=null!=e&&e;var o=q("wrapper",r),a=B.document.createDocumentFragment();o.innerHTML=t;for(var s=o.children.length;s--;)a.appendChild(o.firstElementChild);var l=this.parent();return e?this.replace(a)&&l:this.add(a)}}],r&&We(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),n}(Se);function Je(t){return Je="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Je(t)}function Qe(t,e){for(var r=0;r=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}(e=this.node.attributes);try{for(o.s();!(n=o.n()).done;){var a=n.value;t[a.nodeName]=pt.test(a.nodeValue)?parseFloat(a.nodeValue):a.nodeValue}}catch(t){o.e(t)}finally{o.f()}return t}if(t instanceof Array)return t.reduce((function(t,e){return t[e]=i.attr(e),t}),{});if("object"===Ye(t)&&t.constructor===Object)for(e in t)this.attr(e,t[e]);else if(null===e)this.node.removeAttribute(t);else{if(null==e)return null==(e=this.node.getAttribute(t))?Ae[t]:pt.test(e)?parseFloat(e):e;"number"==typeof(e=Be.reduce((function(e,r){return r(t,e,i)}),e))?e=new De(e):Fe.has(t)&&Mt.isColor(e)?e=new Mt(e):e.constructor===Array&&(e=new Re(e)),"leading"===t?this.leading&&this.leading(e):"string"==typeof r?this.node.setAttributeNS(r,t,e.toString()):this.node.setAttribute(t,e.toString()),!this.rebuild||"font-size"!==t&&"x"!==t||this.rebuild()}return this},find:function(t){return oe(t,this.node)},findOne:function(t){return J(this.node.querySelector(t))}}),K($e,"Dom");var ar=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&er(t,e)}(n,t);var e,r,i=rr(n);function n(t,e){var r,o,a;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(r=i.call(this,t,e)).dom={},r.node.instance=ir(r),(t.hasAttribute("data-svgjs")||t.hasAttribute("svgjs:data"))&&r.setData(null!==(o=null!==(a=JSON.parse(t.getAttribute("data-svgjs")))&&void 0!==a?a:JSON.parse(t.getAttribute("svgjs:data")))&&void 0!==o?o:{}),r}return e=n,r=[{key:"center",value:function(t,e){return this.cx(t).cy(e)}},{key:"cx",value:function(t){return null==t?this.x()+this.width()/2:this.x(t-this.width()/2)}},{key:"cy",value:function(t){return null==t?this.y()+this.height()/2:this.y(t-this.height()/2)}},{key:"defs",value:function(){var t=this.root();return t&&t.defs()}},{key:"dmove",value:function(t,e){return this.dx(t).dy(e)}},{key:"dx",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x(new De(t).plus(this.x()))}},{key:"dy",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y(new De(t).plus(this.y()))}},{key:"getEventHolder",value:function(){return this}},{key:"height",value:function(t){return this.attr("height",t)}},{key:"move",value:function(t,e){return this.x(t).y(e)}},{key:"parents",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.root(),e="string"==typeof t;e||(t=Z(t));for(var r=new ie,i=this;(i=i.parent())&&i.node!==B.document&&"#document-fragment"!==i.nodeName&&(r.push(i),e||i.node!==t.node)&&(!e||!i.matches(t));)if(i.node===this.root().node)return null;return r}},{key:"reference",value:function(t){if(!(t=this.attr(t)))return null;var e=(t+"").match(lt);return e?Z(e[1]):null}},{key:"root",value:function(){var t=this.parent(V[U]);return t&&t.root()}},{key:"setData",value:function(t){return this.dom=t,this}},{key:"size",value:function(t,e){var r=R(this,t,e);return this.width(new De(r.width)).height(new De(r.height))}},{key:"width",value:function(t){return this.attr("width",t)}},{key:"writeDataToDom",value:function(){return D(this,this.dom),tr(or(n.prototype),"writeDataToDom",this).call(this)}},{key:"x",value:function(t){return this.attr("x",t)}},{key:"y",value:function(t){return this.attr("y",t)}}],r&&Qe(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),n}($e);function sr(t){return sr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sr(t)}it(ar,{bbox:function(){var t=Ut(this,(function(t){return t.getBBox()}),(function(t){try{var e=t.clone().addTo(Ft().svg).show(),r=e.node.getBBox();return e.remove(),r}catch(e){throw new Error('Getting bbox of element "'.concat(t.node.nodeName,'" is not possible: ').concat(e.toString()))}}));return new Vt(t)},rbox:function(t){var e=Ut(this,(function(t){return t.getBoundingClientRect()}),(function(t){throw new Error('Getting rbox of element "'.concat(t.node.nodeName,'" is not possible'))})),r=new Vt(e);return t?r.transform(t.screenCTM().inverseO()):r.addOffset()},inside:function(t,e){var r=this.bbox();return t>r.x&&e>r.y&&t=0;e--)null!=r[lr[t][e]]&&this.attr(lr.prefix(t,lr[t][e]),r[lr[t][e]]);return this},k(["Element","Runner"],r)})),k(["Element","Runner"],{matrix:function(t,e,r,i,n,o){return null==t?new Ht(this):this.attr("transform",new Ht(t,e,r,i,n,o))},rotate:function(t,e,r){return this.transform({rotate:t,ox:e,oy:r},!0)},skew:function(t,e,r,i){return 1===arguments.length||3===arguments.length?this.transform({skew:t,ox:e,oy:r},!0):this.transform({skew:[t,e],ox:r,oy:i},!0)},shear:function(t,e,r){return this.transform({shear:t,ox:e,oy:r},!0)},scale:function(t,e,r,i){return 1===arguments.length||3===arguments.length?this.transform({scale:t,ox:e,oy:r},!0):this.transform({scale:[t,e],ox:r,oy:i},!0)},translate:function(t,e){return this.transform({translate:[t,e]},!0)},relative:function(t,e){return this.transform({relative:[t,e]},!0)},flip:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"both",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"center";return-1==="xybothtrue".indexOf(t)&&(e=t,t="both"),this.transform({flip:t,origin:e},!0)},opacity:function(t){return this.attr("opacity",t)}}),k("radius",{radius:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return"radialGradient"===(this._element||this).type?this.attr("r",new De(t)):this.rx(t).ry(e)}}),k("Path",{length:function(){return this.node.getTotalLength()},pointAt:function(t){return new _t(this.node.getPointAtLength(t))}}),k(["Element","Runner"],{font:function(t,e){if("object"===sr(t)){for(e in t)this.font(e,t[e]);return this}return"leading"===t?this.leading(e):"anchor"===t?this.attr("text-anchor",e):"size"===t||"family"===t||"weight"===t||"stretch"===t||"variant"===t||"style"===t?this.attr("font-"+t,e):this.attr(t,e)}}),k("Element",["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","mouseenter","mouseleave","touchstart","touchmove","touchleave","touchend","touchcancel","contextmenu","wheel","pointerdown","pointermove","pointerup","pointerleave","pointercancel"].reduce((function(t,e){return t[e]=function(t){return null===t?this.off(e):this.on(e,t),this},t}),{})),k("Element",{untransform:function(){return this.attr("transform",null)},matrixify:function(){return(this.attr("transform")||"").split(ct).slice(0,-1).map((function(t){var e=t.trim().split("(");return[e[0],e[1].split(bt).map((function(t){return parseFloat(t)}))]})).reverse().reduce((function(t,e){return"matrix"===e[0]?t.lmultiply(Ht.fromArray(e[1])):t[e[0]].apply(t,e[1])}),new Ht)},toParent:function(t,e){if(this===t)return this;if(X(this.node))return this.addTo(t,e);var r=this.screenCTM(),i=t.screenCTM().inverse();return this.addTo(t,e).untransform().transform(i.multiply(r)),this},toRoot:function(t){return this.toParent(this.root(),t)},transform:function(t,e){if(null==t||"string"==typeof t){var r=new Ht(this).decompose();return null==t?r:r[t]}Ht.isMatrixLike(t)||(t=hr(hr({},t),{},{origin:_(t,this)}));var i=new Ht(!0===e?this:e||!1).transform(t);return this.attr("transform",i)}});var xr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&br(t,e)}(n,t);var e,r,i=yr(n);function n(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),i.apply(this,arguments)}return e=n,r=[{key:"flatten",value:function(){return this.each((function(){if(this instanceof n)return this.flatten().ungroup()})),this}},{key:"ungroup",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.parent(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.index(this);return e=-1===e?t.children().length:e,this.each((function(r,i){return i[i.length-r-1].toParent(t,e)})),this.remove()}}],r&&pr(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),n}(ar);function wr(t){return wr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wr(t)}function Sr(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),i.call(this,$("defs",t),e)}return e=n,(r=[{key:"flatten",value:function(){return this}},{key:"ungroup",value:function(){return this}}])&&Sr(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),n}(xr);function Tr(t){return Tr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tr(t)}function Er(t,e){return Er=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Er(t,e)}function Mr(t){var e=Lr();return function(){var r,i=Ir(t);if(e){var n=Ir(this).constructor;r=Reflect.construct(i,arguments,n)}else r=i.apply(this,arguments);return function(t,e){if(e&&("object"==Tr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,r)}}function Lr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Lr=function(){return!!t})()}function Ir(t){return Ir=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ir(t)}K(jr,"Defs");var Rr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Er(t,e)}(r,t);var e=Mr(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),e.apply(this,arguments)}return r}(ar);function _r(t){return this.attr("rx",t)}function zr(t){return this.attr("ry",t)}function Xr(t){return null==t?this.cx()-this.rx():this.cx(t+this.rx())}function Dr(t){return null==t?this.cy()-this.ry():this.cy(t+this.ry())}function Yr(t){return this.attr("cx",t)}function Hr(t){return this.attr("cy",t)}function Fr(t){return null==t?2*this.rx():this.rx(new De(t).divide(2))}function Br(t){return null==t?2*this.ry():this.ry(new De(t).divide(2))}function Nr(t){return Nr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nr(t)}function Wr(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),i.call(this,$("ellipse",t),e)}return e=n,r=[{key:"size",value:function(t,e){var r=R(this,t,e);return this.rx(new De(r.width).divide(2)).ry(new De(r.height).divide(2))}}],r&&Wr(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),n}(Rr);function Jr(t){return Jr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jr(t)}function Qr(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return this.put(new $r).size(t,e).move(0,0)}))}),K($r,"Ellipse");var oi=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ei(t,e)}(n,t);var e,r,i=ri(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:B.document.createDocumentFragment();return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),i.call(this,t)}return e=n,(r=[{key:"xml",value:function(t,e,r){if("boolean"==typeof t&&(r=e,e=t,t=null),null==t||"function"==typeof t){var i=new $e(q("wrapper",r));return i.add(this.node.cloneNode(!0)),i.xml(!1,r)}return ti(ni(n.prototype),"xml",this).call(this,t,!1,r)}}])&&Qr(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),n}($e);K(oi,"Fragment");const ai=oi;function si(t,e){return"radialGradient"===(this._element||this).type?this.attr({fx:new De(t),fy:new De(e)}):this.attr({x1:new De(t),y1:new De(e)})}function li(t,e){return"radialGradient"===(this._element||this).type?this.attr({cx:new De(t),cy:new De(e)}):this.attr({x2:new De(t),y2:new De(e)})}function ci(t){return ci="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ci(t)}function ui(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),i.call(this,$("pattern",t),e)}return e=n,(r=[{key:"attr",value:function(t,e,r){return"transform"===t&&(t="patternTransform"),wi(Oi(n.prototype),"attr",this).call(this,t,e,r)}},{key:"bbox",value:function(){return new Vt}},{key:"targets",value:function(){return oe("svg [fill*="+this.id()+"]")}},{key:"toString",value:function(){return this.url()}},{key:"update",value:function(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}},{key:"url",value:function(){return"url(#"+this.id()+")"}}])&&mi(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),n}(xr);function Ci(t){return Ci="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ci(t)}function ji(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),i.call(this,$("image",t),e)}return e=n,r=[{key:"load",value:function(t,e){if(!t)return this;var r=new B.window.Image;return de(r,"load",(function(t){var i=this.parent(Pi);0===this.width()&&0===this.height()&&this.size(r.width,r.height),i instanceof Pi&&0===i.width()&&0===i.height()&&i.size(this.width(),this.height()),"function"==typeof e&&e.call(this,t)}),this),de(r,"load error",(function(){pe(r)})),this.attr("href",r.src=t,F)}}],r&&ji(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),n}(Rr);function zi(t){return zi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zi(t)}function Xi(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var i,n,o,a,s=[],l=!0,c=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(i=o.call(r)).done)&&(s.push(i.value),s.length!==e);l=!0);}catch(t){c=!0,n=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw n}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Di(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Di(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Di(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r=0;i--)this[i]=[this[i][0]+t,this[i][1]+e];return this}},{key:"parse",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0],e=[];(t=t instanceof Array?Array.prototype.concat.apply([],t):t.trim().split(bt).map(parseFloat)).length%2!=0&&t.pop();for(var r=0,i=t.length;r=0;r--)i.width&&(this[r][0]=(this[r][0]-i.x)*t/i.width+i.x),i.height&&(this[r][1]=(this[r][1]-i.y)*e/i.height+i.y);return this}},{key:"toLine",value:function(){return{x1:this[0][0],y1:this[0][1],x2:this[1][0],y2:this[1][1]}}},{key:"toString",value:function(){for(var t=[],e=0,r=this.length;e1&&void 0!==arguments[1]?arguments[1]:t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),i.call(this,$("line",t),e)}return e=n,r=[{key:"array",value:function(){return new Gi([[this.attr("x1"),this.attr("y1")],[this.attr("x2"),this.attr("y2")]])}},{key:"move",value:function(t,e){return this.attr(this.array().move(t,e).toLine())}},{key:"plot",value:function(t,e,r,i){return null==t?this.array():(t=void 0!==e?{x1:t,y1:e,x2:r,y2:i}:new Gi(t).toLine(),this.attr(t))}},{key:"size",value:function(t,e){var r=R(this,t,e);return this.attr(this.array().size(r.width,r.height).toLine())}}],r&&Qi(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),n}(Rr);function an(t){return an="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},an(t)}function sn(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),i.call(this,$("marker",t),e)}return e=n,r=[{key:"height",value:function(t){return this.attr("markerHeight",t)}},{key:"orient",value:function(t){return this.attr("orient",t)}},{key:"ref",value:function(t,e){return this.attr("refX",t).attr("refY",e)}},{key:"toString",value:function(){return"url(#"+this.id()+")"}},{key:"update",value:function(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}},{key:"width",value:function(t){return this.attr("markerWidth",t)}}],r&&sn(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),n}(xr);function pn(t){return pn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pn(t)}function gn(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&bn(t,e)}function bn(t,e){return bn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},bn(t,e)}function yn(t){var e=vn();return function(){var r,i=mn(t);if(e){var n=mn(this).constructor;r=Reflect.construct(i,arguments,n)}else r=i.apply(this,arguments);return function(t,e){if(e&&("object"==pn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,r)}}function vn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(vn=function(){return!!t})()}function mn(t){return mn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},mn(t)}function xn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function wn(t,e){for(var r=0;r":function(t){return-Math.cos(t*Math.PI)/2+.5},">":function(t){return Math.sin(t*Math.PI/2)},"<":function(t){return 1-Math.cos(t*Math.PI/2)},bezier:function(t,e,r,i){return function(n){return n<0?t>0?e/t*n:r>0?i/r*n:0:n>1?r<1?(1-i)/(1-r)*n+(i-r)/(1-r):t<1?(1-e)/(1-t)*n+(e-t)/(1-t):1:3*n*Math.pow(1-n,2)*e+3*Math.pow(n,2)*(1-n)*i+Math.pow(n,3)}},steps:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"end";e=e.split("-").reverse()[0];var r=t;return"none"===e?--r:"both"===e&&++r,function(i){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=Math.floor(i*t),a=i*o%1==0;return"start"!==e&&"both"!==e||++o,n&&a&&--o,i>=0&&o<0&&(o=0),i<=1&&o>r&&(o=r),o/r}}},Pn=function(){function t(){xn(this,t)}return Sn(t,[{key:"done",value:function(){return!1}}]),t}(),Cn=function(t){gn(r,t);var e=yn(r);function r(){var t,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:">";return xn(this,r),(t=e.call(this)).ease=On[i]||i,t}return Sn(r,[{key:"step",value:function(t,e,r){return"number"!=typeof t?r<1?t:e:t+(e-t)*this.ease(r)}}]),r}(Pn),jn=function(t){gn(r,t);var e=yn(r);function r(t){var i;return xn(this,r),(i=e.call(this)).stepper=t,i}return Sn(r,[{key:"done",value:function(t){return t.done}},{key:"step",value:function(t,e,r,i){return this.stepper(t,e,r,i)}}]),r}(Pn);function Tn(){var t=(this._duration||500)/1e3,e=this._overshoot||0,r=Math.PI,i=Math.log(e/100+1e-10),n=-i/Math.sqrt(r*r+i*i),o=3.9/(n*t);this.d=2*n*o,this.k=o*o}it(function(t){gn(r,t);var e=yn(r);function r(){var t,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:500,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return xn(this,r),(t=e.call(this)).duration(i).overshoot(n),t}return Sn(r,[{key:"step",value:function(t,e,r,i){if("string"==typeof t)return t;if(i.done=r===1/0,r===1/0)return e;if(0===r)return t;r>100&&(r=16),r/=1e3;var n=i.velocity||0,o=-this.d*n-this.k*(t-e),a=t+n*r+o*r*r/2;return i.velocity=n+o*r,i.done=Math.abs(e-a)+Math.abs(n)<.002,i.done?e:a}}]),r}(jn),{duration:An("_duration",Tn),overshoot:An("_overshoot",Tn)});var En=function(t){gn(r,t);var e=yn(r);function r(){var t,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.01,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e3;return xn(this,r),(t=e.call(this)).p(i).i(n).d(o).windup(a),t}return Sn(r,[{key:"step",value:function(t,e,r,i){if("string"==typeof t)return t;if(i.done=r===1/0,r===1/0)return e;if(0===r)return t;var n=e-t,o=(i.integral||0)+n*r,a=(n-(i.error||0))/r,s=this._windup;return!1!==s&&(o=Math.max(-s,Math.min(o,s))),i.error=n,i.integral=o,i.done=Math.abs(n)<.001,i.done?e:t+(this.P*n+this.I*o+this.D*a)}}]),r}(jn);it(En,{windup:An("_windup"),p:An("P"),i:An("I"),d:An("D")});for(var Mn={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0},Ln={M:function(t,e,r){return e.x=r.x=t[0],e.y=r.y=t[1],["M",e.x,e.y]},L:function(t,e){return e.x=t[0],e.y=t[1],["L",t[0],t[1]]},H:function(t,e){return e.x=t[0],["H",t[0]]},V:function(t,e){return e.y=t[0],["V",t[0]]},C:function(t,e){return e.x=t[4],e.y=t[5],["C",t[0],t[1],t[2],t[3],t[4],t[5]]},S:function(t,e){return e.x=t[2],e.y=t[3],["S",t[0],t[1],t[2],t[3]]},Q:function(t,e){return e.x=t[2],e.y=t[3],["Q",t[0],t[1],t[2],t[3]]},T:function(t,e){return e.x=t[0],e.y=t[1],["T",t[0],t[1]]},Z:function(t,e,r){return e.x=r.x,e.y=r.y,["Z"]},A:function(t,e){return e.x=t[5],e.y=t[6],["A",t[0],t[1],t[2],t[3],t[4],t[5],t[6]]}},In="mlhvqtcsaz".split(""),Rn=0,_n=In.length;Rn<_n;++Rn)Ln[In[Rn]]=function(t){return function(e,r,i){if("H"===t)e[0]=e[0]+r.x;else if("V"===t)e[0]=e[0]+r.y;else if("A"===t)e[5]=e[5]+r.x,e[6]=e[6]+r.y;else for(var n=0,o=e.length;n=0;n--)"M"===(i=this[n][0])||"L"===i||"T"===i?(this[n][1]+=t,this[n][2]+=e):"H"===i?this[n][1]+=t:"V"===i?this[n][1]+=e:"C"===i||"S"===i||"Q"===i?(this[n][1]+=t,this[n][2]+=e,this[n][3]+=t,this[n][4]+=e,"C"===i&&(this[n][5]+=t,this[n][6]+=e)):"A"===i&&(this[n][6]+=t,this[n][7]+=e);return this}},{key:"parse",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"M0 0";return Array.isArray(t)&&(t=Array.prototype.concat.apply([],t).toString()),function(t){for(var e=0,r="",i={segment:[],inNumber:!1,number:"",lastToken:"",inSegment:!1,segments:[],pointSeen:!1,hasExponent:!1,absolute:!(arguments.length>1&&void 0!==arguments[1])||arguments[1],p0:new _t,p:new _t};i.lastToken=r,r=t.charAt(e++);)if(i.inSegment||!Xn(i,r))if("."!==r)if(isNaN(parseInt(r)))if(Bn.has(r))i.inNumber&&Dn(i,!1);else if("-"!==r&&"+"!==r)if("E"!==r.toUpperCase()){if(yt.test(r)){if(i.inNumber)Dn(i,!1);else{if(!zn(i))throw new Error("parser Error");Yn(i)}--e}}else i.number+=r,i.hasExponent=!0;else{if(i.inNumber&&!Fn(i)){Dn(i,!1),--e;continue}i.number+=r,i.inNumber=!0}else{if("0"===i.number||Hn(i)){i.inNumber=!0,i.number=r,Dn(i,!0);continue}i.inNumber=!0,i.number+=r}else{if(i.pointSeen||i.hasExponent){Dn(i,!1),--e;continue}i.inNumber=!0,i.pointSeen=!0,i.number+=r}return i.inNumber&&Dn(i,!1),i.inSegment&&zn(i)&&Yn(i),i.segments}(t)}},{key:"size",value:function(t,e){var r,i,n=this.bbox();for(n.width=0===n.width?1:n.width,n.height=0===n.height?1:n.height,r=this.length-1;r>=0;r--)"M"===(i=this[r][0])||"L"===i||"T"===i?(this[r][1]=(this[r][1]-n.x)*t/n.width+n.x,this[r][2]=(this[r][2]-n.y)*e/n.height+n.y):"H"===i?this[r][1]=(this[r][1]-n.x)*t/n.width+n.x:"V"===i?this[r][1]=(this[r][1]-n.y)*e/n.height+n.y:"C"===i||"S"===i||"Q"===i?(this[r][1]=(this[r][1]-n.x)*t/n.width+n.x,this[r][2]=(this[r][2]-n.y)*e/n.height+n.y,this[r][3]=(this[r][3]-n.x)*t/n.width+n.x,this[r][4]=(this[r][4]-n.y)*e/n.height+n.y,"C"===i&&(this[r][5]=(this[r][5]-n.x)*t/n.width+n.x,this[r][6]=(this[r][6]-n.y)*e/n.height+n.y)):"A"===i&&(this[r][1]=this[r][1]*t/n.width,this[r][2]=this[r][2]*e/n.height,this[r][6]=(this[r][6]-n.x)*t/n.width+n.x,this[r][7]=(this[r][7]-n.y)*e/n.height+n.y);return this}},{key:"toString",value:function(){return function(t){for(var e="",r=0,i=t.length;rt.length)&&(e=t.length);for(var r=0,i=Array(e);r-1?t.constructor:Array.isArray(t)?Re:"object"===e?co:ao},oo=function(){function t(e){Kn(this,t),this._stepper=e||new Cn("-"),this._from=null,this._to=null,this._type=null,this._context=null,this._morphObj=null}return eo(t,[{key:"at",value:function(t){return this._morphObj.morph(this._from,this._to,t,this._stepper,this._context)}},{key:"done",value:function(){return this._context.map(this._stepper.done).reduce((function(t,e){return t&&e}),!0)}},{key:"from",value:function(t){return null==t?this._from:(this._from=this._set(t),this)}},{key:"stepper",value:function(t){return null==t?this._stepper:(this._stepper=t,this)}},{key:"to",value:function(t){return null==t?this._to:(this._to=this._set(t),this)}},{key:"type",value:function(t){return null==t?this._type:(this._type=t,this)}},{key:"_set",value:function(t){this._type||this.type(no(t));var e=new this._type(t);return this._type===Mt&&(e=this._to?e[this._to[4]]():this._from?e[this._from[4]]():e),this._type===co&&(e=this._to?e.align(this._to):this._from?e.align(this._from):e),e=e.toConsumable(),this._morphObj=this._morphObj||new this._type,this._context=this._context||Array.apply(null,Array(e.length)).map(Object).map((function(t){return t.done=!0,t})),e}}]),t}(),ao=function(){function t(){Kn(this,t),this.init.apply(this,arguments)}return eo(t,[{key:"init",value:function(t){return t=Array.isArray(t)?t[0]:t,this.value=t,this}},{key:"toArray",value:function(){return[this.value]}},{key:"valueOf",value:function(){return this.value}}]),t}(),so=function(){function t(){Kn(this,t),this.init.apply(this,arguments)}return eo(t,[{key:"init",value:function(e){return Array.isArray(e)&&(e={scaleX:e[0],scaleY:e[1],shear:e[2],rotate:e[3],translateX:e[4],translateY:e[5],originX:e[6],originY:e[7]}),Object.assign(this,t.defaults,e),this}},{key:"toArray",value:function(){var t=this;return[t.scaleX,t.scaleY,t.shear,t.rotate,t.translateX,t.translateY,t.originX,t.originY]}}]),t}();so.defaults={scaleX:1,scaleY:1,shear:0,rotate:0,translateX:0,translateY:0,originX:0,originY:0};var lo=function(t,e){return t[0]e[0]?1:0},co=function(){function t(){Kn(this,t),this.init.apply(this,arguments)}return eo(t,[{key:"align",value:function(t){for(var e=this.values,r=0,i=e.length;r1&&void 0!==arguments[1]?arguments[1]:t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),i.call(this,$("path",t),e)}return e=n,r=[{key:"array",value:function(){return this._array||(this._array=new $n(this.attr("d")))}},{key:"clear",value:function(){return delete this._array,this}},{key:"height",value:function(t){return null==t?this.bbox().height:this.size(this.bbox().width,t)}},{key:"move",value:function(t,e){return this.attr("d",this.array().move(t,e))}},{key:"plot",value:function(t){return null==t?this.array():this.clear().attr("d","string"==typeof t?t:this._array=new $n(t))}},{key:"size",value:function(t,e){var r=R(this,t,e);return this.attr("d",this.array().size(r.width,r.height))}},{key:"width",value:function(t){return null==t?this.bbox().width:this.size(t,this.bbox().height)}},{key:"x",value:function(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)}},{key:"y",value:function(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)}}],r&&fo(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),n}(Rr);function xo(){return this._array||(this._array=new Gi(this.attr("points")))}function wo(){return delete this._array,this}function So(t,e){return this.attr("points",this.array().move(t,e))}function ko(t){return null==t?this.array():this.clear().attr("points","string"==typeof t?t:this._array=new Gi(t))}function Ao(t,e){var r=R(this,t,e);return this.attr("points",this.array().size(r.width,r.height))}function Oo(t){return Oo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Oo(t)}function Po(t,e){return Po=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Po(t,e)}function Co(t){var e=jo();return function(){var r,i=To(t);if(e){var n=To(this).constructor;r=Reflect.construct(i,arguments,n)}else r=i.apply(this,arguments);return function(t,e){if(e&&("object"==Oo(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,r)}}function jo(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(jo=function(){return!!t})()}function To(t){return To=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},To(t)}mo.prototype.MorphArray=$n,k({Container:{path:nt((function(t){return this.put(new mo).plot(t||new $n)}))}}),K(mo,"Path");var Eo=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Po(t,e)}(r,t);var e=Co(r);function r(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),e.call(this,$("polygon",t),i)}return r}(Rr);function Mo(t){return Mo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mo(t)}function Lo(t,e){return Lo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Lo(t,e)}function Io(t){var e=Ro();return function(){var r,i=_o(t);if(e){var n=_o(this).constructor;r=Reflect.construct(i,arguments,n)}else r=i.apply(this,arguments);return function(t,e){if(e&&("object"==Mo(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,r)}}function Ro(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ro=function(){return!!t})()}function _o(t){return _o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_o(t)}k({Container:{polygon:nt((function(t){return this.put(new Eo).plot(t||new Gi)}))}}),it(Eo,n),it(Eo,o),K(Eo,"Polygon");var zo=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Lo(t,e)}(r,t);var e=Io(r);function r(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),e.call(this,$("polyline",t),i)}return r}(Rr);function Xo(t){return Xo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xo(t)}function Do(t,e){return Do=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Do(t,e)}function Yo(t){var e=Ho();return function(){var r,i=Fo(t);if(e){var n=Fo(this).constructor;r=Reflect.construct(i,arguments,n)}else r=i.apply(this,arguments);return function(t,e){if(e&&("object"==Xo(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,r)}}function Ho(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ho=function(){return!!t})()}function Fo(t){return Fo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Fo(t)}k({Container:{polyline:nt((function(t){return this.put(new zo).plot(t||new Gi)}))}}),it(zo,n),it(zo,o),K(zo,"Polyline");var Bo=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Do(t,e)}(r,t);var e=Yo(r);function r(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),e.call(this,$("rect",t),i)}return r}(Rr);function No(t){return No="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},No(t)}function Wo(t,e){for(var r=0;r=e.time?e.run():Uo.timeouts.push(e),e!==r););for(var i=null,n=Uo.frames.last();i!==n&&(i=Uo.frames.shift());)i.run(t);for(var o=null;o=Uo.immediates.shift();)o();Uo.nextDraw=Uo.timeouts.first()||Uo.frames.first()?B.window.requestAnimationFrame(Uo._draw):null}};const qo=Uo;function Zo(t){return Zo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zo(t)}function $o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r0&&void 0!==arguments[0]?arguments[0]:na;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(t=i.call(this))._timeSource=e,t.terminate(),t}return e=n,r=[{key:"active",value:function(){return!!this._nextFrame}},{key:"finish",value:function(){return this.time(this.getEndTimeOfTimeline()+1),this.pause()}},{key:"getEndTime",value:function(){var t=this.getLastRunnerInfo(),e=t?t.runner.duration():0;return(t?t.start:this._time)+e}},{key:"getEndTimeOfTimeline",value:function(){var t=this._runners.map((function(t){return t.start+t.runner.duration()}));return Math.max.apply(Math,[0].concat(function(t){return function(t){if(Array.isArray(t))return $o(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return $o(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?$o(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t)))}},{key:"getLastRunnerInfo",value:function(){return this.getRunnerInfoById(this._lastRunnerId)}},{key:"getRunnerInfoById",value:function(t){return this._runners[this._runnerIds.indexOf(t)]||null}},{key:"pause",value:function(){return this._paused=!0,this._continue()}},{key:"persist",value:function(t){return null==t?this._persist:(this._persist=t,this)}},{key:"play",value:function(){return this._paused=!1,this.updateTime()._continue()}},{key:"reverse",value:function(t){var e=this.speed();if(null==t)return this.speed(-e);var r=Math.abs(e);return this.speed(t?-r:r)}},{key:"schedule",value:function(t,e,r){if(null==t)return this._runners.map(ia);var i=0,n=this.getEndTime();if(e=e||0,null==r||"last"===r||"after"===r)i=n;else if("absolute"===r||"start"===r)i=e,e=0;else if("now"===r)i=this._time;else if("relative"===r){var o=this.getRunnerInfoById(t.id);o&&(i=o.start+e,e=0)}else{if("with-last"!==r)throw new Error('Invalid value for the "when" parameter');var a=this.getLastRunnerInfo();i=a?a.start:this._time}t.unschedule(),t.timeline(this);var s=t.persist(),l={persist:null===s?this._persist:s,start:i+e,runner:t};return this._lastRunnerId=t.id,this._runners.push(l),this._runners.sort((function(t,e){return t.start-e.start})),this._runnerIds=this._runners.map((function(t){return t.runner.id})),this.updateTime()._continue(),this}},{key:"seek",value:function(t){return this.time(this._time+t)}},{key:"source",value:function(t){return null==t?this._timeSource:(this._timeSource=t,this)}},{key:"speed",value:function(t){return null==t?this._speed:(this._speed=t,this)}},{key:"stop",value:function(){return this.time(0),this.pause()}},{key:"time",value:function(t){return null==t?this._time:(this._time=t,this._continue(!0))}},{key:"unschedule",value:function(t){var e=this._runnerIds.indexOf(t.id);return e<0||(this._runners.splice(e,1),this._runnerIds.splice(e,1),t.timeline(null)),this}},{key:"updateTime",value:function(){return this.active()||(this._lastSourceTime=this._timeSource()),this}},{key:"_continue",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return qo.cancelFrame(this._nextFrame),this._nextFrame=null,t?this._stepImmediate():(this._paused||(this._nextFrame=qo.frame(this._step)),this)}},{key:"_stepFn",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this._timeSource(),r=e-this._lastSourceTime;t&&(r=0);var i=this._speed*r+(this._time-this._lastStepTime);this._lastSourceTime=e,t||(this._time+=i,this._time=this._time<0?0:this._time),this._lastStepTime=this._time,this.fire("time",this._time);for(var n=this._runners.length;n--;){var o=this._runners[n],a=o.runner;this._time-o.start<=0&&a.reset()}for(var s=!1,l=0,c=this._runners.length;l0?this._continue():(this.pause(),this.fire("finished")),this}},{key:"terminate",value:function(){this._startTime=0,this._speed=1,this._persist=0,this._nextFrame=null,this._paused=!0,this._runners=[],this._runnerIds=[],this._lastRunnerId=-1,this._time=0,this._lastSourceTime=0,this._lastStepTime=0,this._step=this._stepFn.bind(this,!1),this._stepImmediate=this._stepFn.bind(this,!0)}}],r&&Jo(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),n}(Se);function aa(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r=0;this._lastPosition=e;var i=this.duration(),n=this._lastTime<=0&&this._time>0,o=this._lastTime=i;this._lastTime=this._time,n&&this.fire("start",this);var a=this._isDeclarative;this.done=!a&&!o&&this._time>=i,this._reseted=!1;var s=!1;return(r||a)&&(this._initialise(r),this.transforms=new Ht,s=this._run(a?t:e),this.fire("step",this)),this.done=this.done||s&&a,o&&this.fire("finished",this),this}},{key:"time",value:function(t){if(null==t)return this._time;var e=t-this._time;return this.step(e),this}},{key:"timeline",value:function(t){return void 0===t?this._timeline:(this._timeline=t,this)}},{key:"unschedule",value:function(){var t=this.timeline();return t&&t.unschedule(this),this}},{key:"_initialise",value:function(t){if(t||this._isDeclarative)for(var e=0,r=this._queue.length;e0&&void 0!==arguments[0]?arguments[0]:new Ht,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];ha(this,t),this.transforms=e,this.id=r,this.done=i}return da(t,[{key:"clearTransformsFromQueue",value:function(){}}]),t}();it([ma,xa],{mergeWith:function(t){return new xa(t.transforms.lmultiply(this.transforms),t.id)}});var wa=function(t,e){return t.lmultiplyO(e)},Sa=function(t){return t.transforms};function ka(){var t=this._transformationRunners.runners.map(Sa).reduce(wa,new Ht);this.transform(t),this._transformationRunners.merge(),1===this._transformationRunners.length()&&(this._frameId=null)}var Aa=function(){function t(){ha(this,t),this.runners=[],this.ids=[]}return da(t,[{key:"add",value:function(t){if(!this.runners.includes(t)){var e=t.id+1;return this.runners.push(t),this.ids.push(e),this}}},{key:"clearBefore",value:function(t){var e=this.ids.indexOf(t+1)||1;return this.ids.splice(0,e,0),this.runners.splice(0,e,new xa).forEach((function(t){return t.clearTransformsFromQueue()})),this}},{key:"edit",value:function(t,e){var r=this.ids.indexOf(t+1);return this.ids.splice(r,1,t+1),this.runners.splice(r,1,e),this}},{key:"getByID",value:function(t){return this.runners[this.ids.indexOf(t+1)]}},{key:"length",value:function(){return this.ids.length}},{key:"merge",value:function(){for(var t=null,e=0;e0&&void 0!==arguments[0]?arguments[0]:0;return this._queueNumberDelta("x",t)},dy:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this._queueNumberDelta("y",t)},dmove:function(t,e){return this.dx(t).dy(e)},_queueNumberDelta:function(t,e){if(e=new De(e),this._tryRetarget(t,e))return this;var r=new oo(this._stepper).to(e),i=null;return this.queue((function(){i=this.element()[t](),r.from(i),r.to(i+e)}),(function(e){return this.element()[t](r.at(e)),r.done()}),(function(t){r.to(i+new De(t))})),this._rememberMorpher(t,r),this},_queueObject:function(t,e){if(this._tryRetarget(t,e))return this;var r=new oo(this._stepper).to(e);return this.queue((function(){r.from(this.element()[t]())}),(function(e){return this.element()[t](r.at(e)),r.done()})),this._rememberMorpher(t,r),this},_queueNumber:function(t,e){return this._queueObject(t,new De(e))},cx:function(t){return this._queueNumber("cx",t)},cy:function(t){return this._queueNumber("cy",t)},move:function(t,e){return this.x(t).y(e)},amove:function(t,e){return this.ax(t).ay(e)},center:function(t,e){return this.cx(t).cy(e)},size:function(t,e){var r;return t&&e||(r=this._element.bbox()),t||(t=r.width/r.height*e),e||(e=r.height/r.width*t),this.width(t).height(e)},width:function(t){return this._queueNumber("width",t)},height:function(t){return this._queueNumber("height",t)},plot:function(t,e,r,i){if(4===arguments.length)return this.plot([t,e,r,i]);if(this._tryRetarget("plot",t))return this;var n=new oo(this._stepper).type(this._element.MorphArray).to(t);return this.queue((function(){n.from(this._element.array())}),(function(t){return this._element.plot(n.at(t)),n.done()})),this._rememberMorpher("plot",n),this},leading:function(t){return this._queueNumber("leading",t)},viewbox:function(t,e,r,i){return this._queueObject("viewbox",new Vt(t,e,r,i))},update:function(t){return"object"!==ua(t)?this.update({offset:arguments[0],color:arguments[1],opacity:arguments[2]}):(null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",t.offset),this)}}),it(ma,{rx:_r,ry:zr,from:si,to:li}),K(ma,"Runner");var Ia=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ta(t,e)}(n,t);var e,r,i=Ea(n);function n(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(e=i.call(this,$("svg",t),r)).namespace(),e}return e=n,(r=[{key:"defs",value:function(){return this.isRoot()?J(this.node.querySelector("defs"))||this.put(new jr):this.root().defs()}},{key:"isRoot",value:function(){return!this.node.parentNode||!(this.node.parentNode instanceof B.window.SVGElement)&&"#document-fragment"!==this.node.parentNode.nodeName}},{key:"namespace",value:function(){return this.isRoot()?this.attr({xmlns:Y,version:"1.1"}).attr("xmlns:xlink",F,H):this.root().namespace()}},{key:"removeNamespace",value:function(){return this.attr({xmlns:null,version:null}).attr("xmlns:xlink",null,H).attr("xmlns:svgjs",null,H)}},{key:"root",value:function(){return this.isRoot()?this:ja(La(n.prototype),"root",this).call(this)}}])&&Pa(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),n}(xr);function Ra(t){return Ra="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ra(t)}function _a(t,e){return _a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_a(t,e)}function za(t){var e=Xa();return function(){var r,i=Da(t);if(e){var n=Da(this).constructor;r=Reflect.construct(i,arguments,n)}else r=i.apply(this,arguments);return function(t,e){if(e&&("object"==Ra(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,r)}}function Xa(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Xa=function(){return!!t})()}function Da(t){return Da=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Da(t)}k({Container:{nested:nt((function(){return this.put(new Ia)}))}}),K(Ia,"Svg",!0);var Ya=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_a(t,e)}(r,t);var e=za(r);function r(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),e.call(this,$("symbol",t),i)}return r}(xr);function Ha(t){return!1===this._build&&this.clear(),this.node.appendChild(B.document.createTextNode(t)),this}function Fa(){return this.node.getComputedTextLength()}function Ba(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.bbox();return null==t?e.x:this.attr("x",this.attr("x")+t-e.x)}function Na(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.bbox();return null==t?e.y:this.attr("y",this.attr("y")+t-e.y)}function Wa(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.bbox();return this.x(t,r).y(e,r)}function Ga(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.bbox();return null==t?e.cx:this.attr("x",this.attr("x")+t-e.cx)}function Va(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.bbox();return null==t?e.cy:this.attr("y",this.attr("y")+t-e.cy)}function Ua(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.bbox();return this.cx(t,r).cy(e,r)}function qa(t){return this.attr("x",t)}function Za(t){return this.attr("y",t)}function $a(t,e){return this.ax(t).ay(e)}function Ja(t){return this._build=!!t,this}function Qa(t){return Qa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qa(t)}function Ka(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(r=i.call(this,$("text",t),o)).dom.leading=null!==(e=r.dom.leading)&&void 0!==e?e:new De(1.3),r._rebuild=!0,r._build=!1,r}return e=n,r=[{key:"leading",value:function(t){return null==t?this.dom.leading:(this.dom.leading=new De(t),this.rebuild())}},{key:"rebuild",value:function(t){if("boolean"==typeof t&&(this._rebuild=t),this._rebuild){var e=this,r=0,i=this.dom.leading;this.each((function(t){if(!X(this.node)){var n=B.window.getComputedStyle(this.node).getPropertyValue("font-size"),o=i*new De(n);this.dom.newLined&&(this.attr("x",e.attr("x")),"\n"===this.text()?r+=o:(this.attr("dy",t?o+r:0),r=0))}})),this.fire("rebuild")}return this}},{key:"setData",value:function(t){return this.dom=t,this.dom.leading=new De(t.leading||1.3),this}},{key:"writeDataToDom",value:function(){return D(this,this.dom,{leading:1.3}),this}},{key:"text",value:function(t){if(void 0===t){var e=this.node.childNodes,r=0;t="";for(var i=0,n=e.length;i0&&void 0!==arguments[0]?arguments[0]:"";return this.put(new os).text(t)})),plain:nt((function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return this.put(new os).plain(t)}))}}),K(os,"Text");var ds=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&cs(t,e)}(n,t);var e,r,i=us(n);function n(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(e=i.call(this,$("tspan",t),r))._build=!1,e}return e=n,r=[{key:"dx",value:function(t){return this.attr("dx",t)}},{key:"dy",value:function(t){return this.attr("dy",t)}},{key:"newLine",value:function(){this.dom.newLined=!0;var t=this.parent();if(!(t instanceof os))return this;var e=t.index(this),r=B.window.getComputedStyle(this.node).getPropertyValue("font-size"),i=t.dom.leading*new De(r);return this.dy(e?i:0).attr("x",t.x())}},{key:"text",value:function(t){return null==t?this.node.textContent+(this.dom.newLined?"\n":""):("function"==typeof t?(this.clear().build(!0),t.call(this,this),this.build(!1)):this.plain(t),this)}}],r&&ss(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),n}(Rr);function ps(t){return ps="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ps(t)}function gs(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:"",e=new ds;return this._build||this.clear(),this.put(e).text(t)}))},Text:{newLine:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return this.tspan(t).newLine()}}}),K(ds,"Tspan");var ws=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ys(t,e)}(n,t);var e,r,i=vs(n);function n(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),i.call(this,$("circle",t),e)}return e=n,(r=[{key:"radius",value:function(t){return this.attr("r",t)}},{key:"rx",value:function(t){return this.attr("r",t)}},{key:"ry",value:function(t){return this.rx(t)}},{key:"size",value:function(t){return this.radius(new De(t).divide(2))}}])&&gs(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),n}(Rr);function Ss(t){return Ss="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ss(t)}function ks(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:0;return this.put(new ws).size(t).move(0,0)}))}}),K(ws,"Circle");var Es=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ps(t,e)}(n,t);var e,r,i=Cs(n);function n(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),i.call(this,$("clipPath",t),e)}return e=n,(r=[{key:"remove",value:function(){return this.targets().forEach((function(t){t.unclip()})),Os(Ts(n.prototype),"remove",this).call(this)}},{key:"targets",value:function(){return oe("svg [clip-path*="+this.id()+"]")}}])&&ks(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),n}(xr);function Ms(t){return Ms="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ms(t)}function Ls(t,e){return Ls=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ls(t,e)}function Is(t){var e=Rs();return function(){var r,i=_s(t);if(e){var n=_s(this).constructor;r=Reflect.construct(i,arguments,n)}else r=i.apply(this,arguments);return function(t,e){if(e&&("object"==Ms(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,r)}}function Rs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Rs=function(){return!!t})()}function _s(t){return _s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_s(t)}k({Container:{clip:nt((function(){return this.defs().put(new Es)}))},Element:{clipper:function(){return this.reference("clip-path")},clipWith:function(t){var e=t instanceof Es?t:this.parent().clip().add(t);return this.attr("clip-path","url(#"+e.id()+")")},unclip:function(){return this.attr("clip-path",null)}}}),K(Es,"ClipPath");var zs=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ls(t,e)}(r,t);var e=Is(r);function r(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),e.call(this,$("foreignObject",t),i)}return r}(ar);function Xs(t,e){return this.children().forEach((function(r){var i;try{i=r.node instanceof N().SVGSVGElement?new Vt(r.attr(["x","y","width","height"])):r.bbox()}catch(t){return}var n=new Ht(r),o=n.translate(t,e).transform(n.inverse()),a=new _t(i.x,i.y).transform(o);r.move(a.x,a.y)})),this}function Ds(t){return this.dmove(t,0)}function Ys(t){return this.dmove(0,t)}function Hs(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.bbox();return null==t?e.height:this.size(e.width,t,e)}function Fs(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.bbox(),i=t-r.x,n=e-r.y;return this.dmove(i,n)}function Bs(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.bbox(),i=R(this,t,e,r),n=i.width/r.width,o=i.height/r.height;return this.children().forEach((function(t){var e=new _t(r).transform(new Ht(t).inverse());t.scale(n,o,e.x,e.y)})),this}function Ns(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.bbox();return null==t?e.width:this.size(t,e.height,e)}function Ws(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.bbox();return null==t?e.x:this.move(t,e.y,e)}function Gs(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.bbox();return null==t?e.y:this.move(e.x,t,e)}function Vs(t){return Vs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vs(t)}function Us(t,e){return Us=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Us(t,e)}function qs(t){var e=Zs();return function(){var r,i=$s(t);if(e){var n=$s(this).constructor;r=Reflect.construct(i,arguments,n)}else r=i.apply(this,arguments);return function(t,e){if(e&&("object"==Vs(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,r)}}function Zs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Zs=function(){return!!t})()}function $s(t){return $s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$s(t)}k({Container:{foreignObject:nt((function(t,e){return this.put(new zs).size(t,e)}))}}),K(zs,"ForeignObject");var Js=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Us(t,e)}(r,t);var e=qs(r);function r(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),e.call(this,$("g",t),i)}return r}(xr);function Qs(t){return Qs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qs(t)}function Ks(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),i.call(this,$("a",t),e)}return e=n,(r=[{key:"target",value:function(t){return this.attr("target",t)}},{key:"to",value:function(t){return this.attr("href",t,F)}}])&&Ks(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),n}(xr);function al(t){return al="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},al(t)}function sl(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),i.call(this,$("mask",t),e)}return e=n,(r=[{key:"remove",value:function(){return this.targets().forEach((function(t){t.unmask()})),cl(dl(n.prototype),"remove",this).call(this)}},{key:"targets",value:function(){return oe("svg [mask*="+this.id()+"]")}}])&&sl(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),n}(xr);function gl(t){return gl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gl(t)}function bl(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),i.call(this,$("stop",t),e)}return e=n,r=[{key:"update",value:function(t){return("number"==typeof t||t instanceof De)&&(t={offset:arguments[0],color:arguments[1],opacity:arguments[2]}),null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",new De(t.offset)),this}}],r&&bl(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),n}(ar);function kl(t){return kl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kl(t)}function Al(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function Ol(t,e,r){return(e=Cl(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Pl(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),i.call(this,$("style",t),e)}return e=n,r=[{key:"addText",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return this.node.textContent+=t,this}},{key:"font",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.rule("@font-face",function(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),i.call(this,$("textPath",t),e)}return e=n,(r=[{key:"array",value:function(){var t=this.track();return t?t.array():null}},{key:"plot",value:function(t){var e=this.track(),r=null;return e&&(r=e.plot(t)),null==t?r:this}},{key:"track",value:function(){return this.reference("href")}}])&&Rl(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),n}(os);function Fl(t){return Fl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fl(t)}function Bl(t,e){for(var r=0;r1&&void 0!==arguments[1])||arguments[1],i=new Hl;if(t instanceof mo||(t=this.defs().path(t)),i.attr("href","#"+t,F),r)for(;e=this.node.firstChild;)i.node.appendChild(e);return this.put(i)})),textPath:function(){return this.findOne("textPath")}},Path:{text:nt((function(t){return t instanceof os||(t=(new os).addTo(this.parent()).text(t)),t.path(this)})),targets:function(){var t=this;return oe("svg textPath").filter((function(e){return(e.attr("href")||"").includes(t.id())}))}}}),Hl.prototype.MorphArray=$n,K(Hl,"TextPath");var ql=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Wl(t,e)}(n,t);var e,r,i=Gl(n);function n(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),i.call(this,$("use",t),e)}return e=n,(r=[{key:"use",value:function(t,e){return this.attr("href",(e||"")+"#"+t,F)}}])&&Bl(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),n}(Rr);k({Container:{use:nt((function(t,e){return this.put(new ql).use(t,e)}))}}),K(ql,"Use");var Zl=Z;function $l(t){return $l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$l(t)}function Jl(t){return function(t){if(Array.isArray(t))return Ql(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Ql(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ql(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ql(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r0&&void 0!==arguments[0]?arguments[0]:[];uo.push.apply(uo,Jn([].concat(t)))}([De,Mt,Vt,Ht,Re,Gi,$n,_t]),it(uo,{to:function(t){return(new oo).type(this.constructor).from(this.toArray()).to(t)},fromArray:function(t){return this.init(t),this},toConsumable:function(){return this.toArray()},morph:function(t,e,r,i,n){return this.fromArray(t.map((function(t,o){return i.step(t,e[o],r,n[o],n)})))}});var cc=function(t){nc(r,t);var e=ac(r);function r(t){var i;return Kl(this,r),(i=e.call(this,$("filter",t),t)).$source="SourceGraphic",i.$sourceAlpha="SourceAlpha",i.$background="BackgroundImage",i.$backgroundAlpha="BackgroundAlpha",i.$fill="FillPaint",i.$stroke="StrokePaint",i.$autoSetIn=!0,i}return ec(r,[{key:"put",value:function(t,e){return!(t=ic(lc(r.prototype),"put",this).call(this,t,e)).attr("in")&&this.$autoSetIn&&t.attr("in",this.$source),t.attr("result")||t.attr("result",t.id()),t}},{key:"remove",value:function(){return this.targets().each("unfilter"),ic(lc(r.prototype),"remove",this).call(this)}},{key:"targets",value:function(){return oe('svg [filter*="'+this.id()+'"]')}},{key:"toString",value:function(){return"url(#"+this.id()+")"}}]),r}(ar),uc=function(t){nc(r,t);var e=ac(r);function r(t,i){var n;return Kl(this,r),(n=e.call(this,t,i)).result(n.id()),n}return ec(r,[{key:"in",value:function(t){if(null==t){var e=this.attr("in");return this.parent()&&this.parent().find('[result="'.concat(e,'"]'))[0]||e}return this.attr("in",t)}},{key:"result",value:function(t){return this.attr("result",t)}},{key:"toString",value:function(){return this.result()}}]),r}(ar),hc=function(t){return function(){for(var e=arguments.length,r=new Array(e),i=0;i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;this.attr("stdDeviation",t+" "+e)},image:function(t){this.attr("href",t,F)},morphology:hc(["operator","radius"]),offset:hc(["dx","dy"]),specularLighting:hc(["surfaceScale","lightingColor","diffuseConstant","specularExponent","kernelUnitLength"]),tile:hc([]),turbulence:hc(["baseFrequency","numOctaves","seed","stitchTiles","type"])};["blend","colorMatrix","componentTransfer","composite","convolveMatrix","diffuseLighting","displacementMap","dropShadow","flood","gaussianBlur","image","merge","morphology","offset","specularLighting","tile","turbulence"].forEach((function(t){var e=I(t),r=fc[t];cc[e+"Effect"]=function(t){nc(n,t);var i=ac(n);function n(t){return Kl(this,n),i.call(this,$("fe"+e,t),t)}return ec(n,[{key:"update",value:function(t){return r.apply(this,t),this}}]),n}(uc),cc.prototype[t]=nt((function(t){var r=new cc[e+"Effect"];if(null==t)return this.put(r);for(var i=arguments.length,n=new Array(i>1?i-1:0),o=1;o0&&void 0!==arguments[0]?arguments[0]:{},e=this.put(new cc.ComponentTransferEffect);if("function"==typeof t)return t.call(e,e),e;for(var r in t.r||t.g||t.b||t.a||(t={r:t,g:t,b:t,a:t}),t)e.add(new(cc["Func"+r.toUpperCase()])(t[r]));return e}}),["distantLight","pointLight","spotLight","mergeNode","FuncR","FuncG","FuncB","FuncA"].forEach((function(t){var e=I(t);cc[e]=function(t){nc(i,t);var r=ac(i);function i(t){return Kl(this,i),r.call(this,$("fe"+e,t),t)}return i}(uc)})),["funcR","funcG","funcB","funcA"].forEach((function(t){var e=cc[I(t)],r=nt((function(){return this.put(new e)}));cc.ComponentTransferEffect.prototype[t]=r})),["distantLight","pointLight","spotLight"].forEach((function(t){var e=cc[I(t)],r=nt((function(){return this.put(new e)}));cc.DiffuseLightingEffect.prototype[t]=r,cc.SpecularLightingEffect.prototype[t]=r})),it(cc.MergeEffect,{mergeNode:function(t){return this.put(new cc.MergeNode).attr("in",t)}}),it(jr,{filter:function(t){var e=this.put(new cc);return"function"==typeof t&&t.call(e,e),e}}),it(xr,{filter:function(t){return this.defs().filter(t)}}),it(ar,{filterWith:function(t){var e=t instanceof cc?t:this.defs().filter(t);return this.attr("filter",e)},unfilter:function(t){return this.attr("filter",null)},filterer:function(){return this.reference("filter")}});var dc={blend:function(t,e){return this.parent()&&this.parent().blend(this,t,e)},colorMatrix:function(t,e){return this.parent()&&this.parent().colorMatrix(t,e).in(this)},componentTransfer:function(t){return this.parent()&&this.parent().componentTransfer(t).in(this)},composite:function(t,e){return this.parent()&&this.parent().composite(this,t,e)},convolveMatrix:function(t){return this.parent()&&this.parent().convolveMatrix(t).in(this)},diffuseLighting:function(t,e,r,i){return this.parent()&&this.parent().diffuseLighting(t,r,i).in(this)},displacementMap:function(t,e,r,i){return this.parent()&&this.parent().displacementMap(this,t,e,r,i)},dropShadow:function(t,e,r){return this.parent()&&this.parent().dropShadow(this,t,e,r).in(this)},flood:function(t,e){return this.parent()&&this.parent().flood(t,e)},gaussianBlur:function(t,e){return this.parent()&&this.parent().gaussianBlur(t,e).in(this)},image:function(t){return this.parent()&&this.parent().image(t)},merge:function(t){var e;return t=t instanceof Array?t:Jl(t),this.parent()&&(e=this.parent()).merge.apply(e,[this].concat(Jl(t)))},morphology:function(t,e){return this.parent()&&this.parent().morphology(t,e).in(this)},offset:function(t,e){return this.parent()&&this.parent().offset(t,e).in(this)},specularLighting:function(t,e,r,i,n){return this.parent()&&this.parent().specularLighting(t,r,i,n).in(this)},tile:function(){return this.parent()&&this.parent().tile().in(this)},turbulence:function(t,e,r,i,n){return this.parent()&&this.parent().turbulence(t,e,r,i,n).in(this)}};function pc(t){return pc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pc(t)}function gc(t,e){for(var r=0;r0&&-1===o.config.chart.dropShadow.enabledOnSeries.indexOf(e))return t;t.offset({in:i,dx:l,dy:s,result:"offset"}),t.gaussianBlur({in:"offset",stdDeviation:a,result:"blur"}),t.flood({"flood-color":c,"flood-opacity":u,result:"flood"}),t.composite({in:"flood",in2:"blur",operator:"in",result:"shadow"}),t.merge(["shadow",i])}},{key:"dropShadow",value:function(t,e){var r,i,n,o,a,s=this,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,c=this.w;return t.unfilter(!0),f.isMsEdge()&&"radialBar"===c.config.chart.type||(null===(r=c.config.chart.dropShadow.enabledOnSeries)||void 0===r?void 0:r.length)>0&&-1===(null===(n=c.config.chart.dropShadow.enabledOnSeries)||void 0===n?void 0:n.indexOf(l))||(t.filterWith((function(t){s.addShadow(t,l,e,"SourceGraphic")})),e.noUserSpaceOnUse||null===(o=t.filterer())||void 0===o||null===(a=o.node)||void 0===a||a.setAttribute("filterUnits","userSpaceOnUse"),this._scaleFilterSize(null===(i=t.filterer())||void 0===i?void 0:i.node)),t}},{key:"setSelectionFilter",value:function(t,e,r){var i=this.w;if(void 0!==i.globals.selectedDataPoints[e]&&i.globals.selectedDataPoints[e].indexOf(r)>-1){t.node.setAttribute("selected",!0);var n=i.config.states.active.filter;"none"!==n&&this.applyFilter(t,e,n.type)}}},{key:"_scaleFilterSize",value:function(t){t&&function(e){for(var r in e)e.hasOwnProperty(r)&&t.setAttribute(r,e[r])}({width:"200%",height:"200%",x:"-50%",y:"-50%"})}}],r&&gc(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();const vc=yc;function mc(t){return mc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mc(t)}function xc(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function wc(t){for(var e=1;e2&&(t[t.length-2]=e.x,t[t.length-1]=e.y)}function o(t){return{x:parseFloat(t[t.length-2]),y:parseFloat(t[t.length-1])}}t.indexOf("NaN")>-1&&(t="");var a=t.split(/[,\s]/).reduce((function(t,e){var r=e.match("([a-zA-Z])(.+)");return r?(t.push(r[1]),t.push(r[2])):t.push(e),t}),[]).reduce((function(t,e){return parseFloat(e)==e&&t.length?t[t.length-1].push(e):t.push([e]),t}),[]),s=[];if(a.length>1){var l=o(a[0]),c=null;"Z"==a[a.length-1][0]&&a[0].length>2&&(c=["L",l.x,l.y],a[a.length-1]=c),s.push(a[0]);for(var u=1;u2&&"L"==f[0]&&d.length>2&&"L"==d[0]){var p,g,b=o(h),y=o(f),v=o(d);p=r(y,b,e),g=r(y,v,e),n(f,p),f.origPoint=y,s.push(f);var m=i(p,y,.5),x=i(y,g,.5),w=["C",m.x,m.y,x.x,x.y,g.x,g.y];w.origPoint=y,s.push(w)}else s.push(f)}if(c){var S=o(s[s.length-1]);s.push(["Z"]),n(s[0],S)}}else s=a;return s.reduce((function(t,e){return t+e.join(" ")+" "}),"")}},{key:"drawLine",value:function(t,e,r,i){var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"#a8a8a8",o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"butt";return this.w.globals.dom.Paper.line().attr({x1:t,y1:e,x2:r,y2:i,stroke:n,"stroke-dasharray":o,"stroke-width":a,"stroke-linecap":s})}},{key:"drawRect",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"#fefefe",a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1,s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null,l=arguments.length>8&&void 0!==arguments[8]?arguments[8]:null,c=arguments.length>9&&void 0!==arguments[9]?arguments[9]:0,u=this.w.globals.dom.Paper.rect();return u.attr({x:t,y:e,width:r>0?r:0,height:i>0?i:0,rx:n,ry:n,opacity:a,"stroke-width":null!==s?s:0,stroke:null!==l?l:"none","stroke-dasharray":c}),u.node.setAttribute("fill",o),u}},{key:"drawPolygon",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#e1e1e1",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"none";return this.w.globals.dom.Paper.polygon(t).attr({fill:i,stroke:e,"stroke-width":r})}},{key:"drawCircle",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;t<0&&(t=0);var r=this.w.globals.dom.Paper.circle(2*t);return null!==e&&r.attr(e),r}},{key:"drawPath",value:function(t){var e=t.d,r=void 0===e?"":e,i=t.stroke,n=void 0===i?"#a8a8a8":i,o=t.strokeWidth,a=void 0===o?1:o,s=t.fill,l=t.fillOpacity,c=void 0===l?1:l,u=t.strokeOpacity,h=void 0===u?1:u,f=t.classes,d=t.strokeLinecap,p=void 0===d?null:d,g=t.strokeDashArray,b=void 0===g?0:g,y=this.w;return null===p&&(p=y.config.stroke.lineCap),(r.indexOf("undefined")>-1||r.indexOf("NaN")>-1)&&(r="M 0 ".concat(y.globals.gridHeight)),y.globals.dom.Paper.path(r).attr({fill:s,"fill-opacity":c,stroke:n,"stroke-opacity":h,"stroke-linecap":p,"stroke-width":a,"stroke-dasharray":b,class:f})}},{key:"group",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=this.w.globals.dom.Paper.group();return null!==t&&e.attr(t),e}},{key:"move",value:function(t,e){return["M",t,e].join(" ")}},{key:"line",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=null;return null===r?i=[" L",t,e].join(" "):"H"===r?i=[" H",t].join(" "):"V"===r&&(i=[" V",e].join(" ")),i}},{key:"curve",value:function(t,e,r,i,n,o){return["C",t,e,r,i,n,o].join(" ")}},{key:"quadraticCurve",value:function(t,e,r,i){return["Q",t,e,r,i].join(" ")}},{key:"arc",value:function(t,e,r,i,n,o,a){var s="A";return arguments.length>7&&void 0!==arguments[7]&&arguments[7]&&(s="a"),[s,t,e,r,i,n,o,a].join(" ")}},{key:"renderPaths",value:function(t){var e,r=t.j,i=t.realIndex,n=t.pathFrom,o=t.pathTo,a=t.stroke,s=t.strokeWidth,l=t.strokeLinecap,c=t.fill,u=t.animationDelay,h=t.initialSpeed,f=t.dataChangeSpeed,d=t.className,p=t.chartType,g=t.shouldClipToGrid,y=void 0===g||g,v=t.bindEventsOnPaths,m=void 0===v||v,x=t.drawShadow,w=void 0===x||x,S=this.w,k=new vc(this.ctx),A=new b(this.ctx),O=this.w.config.chart.animations.enabled,P=O&&this.w.config.chart.animations.dynamicAnimation.enabled,C=!!(O&&!S.globals.resized||P&&S.globals.dataChanged&&S.globals.shouldAnimate);C?e=n:(e=o,S.globals.animationEnded=!0);var j,T=S.config.stroke.dashArray;j=Array.isArray(T)?T[i]:S.config.stroke.dashArray;var E=this.drawPath({d:e,stroke:a,strokeWidth:s,fill:c,fillOpacity:1,classes:d,strokeLinecap:l,strokeDashArray:j});E.attr("index",i),y&&("bar"===p&&!S.globals.isHorizontal||S.globals.comboCharts?E.attr({"clip-path":"url(#gridRectBarMask".concat(S.globals.cuid,")")}):E.attr({"clip-path":"url(#gridRectMask".concat(S.globals.cuid,")")})),S.config.chart.dropShadow.enabled&&w&&k.dropShadow(E,S.config.chart.dropShadow,i),m&&(E.node.addEventListener("mouseenter",this.pathMouseEnter.bind(this,E)),E.node.addEventListener("mouseleave",this.pathMouseLeave.bind(this,E)),E.node.addEventListener("mousedown",this.pathMouseDown.bind(this,E))),E.attr({pathTo:o,pathFrom:n});var M={el:E,j:r,realIndex:i,pathFrom:n,pathTo:o,fill:c,strokeWidth:s,delay:u};return!O||S.globals.resized||S.globals.dataChanged?!S.globals.resized&&S.globals.dataChanged||A.showDelayedElements():A.animatePathsGradually(wc(wc({},M),{},{speed:h})),S.globals.dataChanged&&P&&C&&A.animatePathsGradually(wc(wc({},M),{},{speed:f})),E}},{key:"drawPattern",value:function(t,e,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"#a8a8a8",n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return this.w.globals.dom.Paper.pattern(e,r,(function(o){"horizontalLines"===t?o.line(0,0,r,0).stroke({color:i,width:n+1}):"verticalLines"===t?o.line(0,0,0,e).stroke({color:i,width:n+1}):"slantedLines"===t?o.line(0,0,e,r).stroke({color:i,width:n}):"squares"===t?o.rect(e,r).fill("none").stroke({color:i,width:n}):"circles"===t&&o.circle(e).fill("none").stroke({color:i,width:n})}))}},{key:"drawGradient",value:function(t,e,r,i,n){var o,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:[],c=arguments.length>8&&void 0!==arguments[8]?arguments[8]:0,u=this.w;e.length<9&&0===e.indexOf("#")&&(e=f.hexToRgba(e,i)),r.length<9&&0===r.indexOf("#")&&(r=f.hexToRgba(r,n));var h=0,d=1,p=1,g=null;null!==s&&(h=void 0!==s[0]?s[0]/100:0,d=void 0!==s[1]?s[1]/100:1,p=void 0!==s[2]?s[2]/100:1,g=void 0!==s[3]?s[3]/100:null);var b=!("donut"!==u.config.chart.type&&"pie"!==u.config.chart.type&&"polarArea"!==u.config.chart.type&&"bubble"!==u.config.chart.type);if(o=l&&0!==l.length?u.globals.dom.Paper.gradient(b?"radial":"linear",(function(t){(Array.isArray(l[c])?l[c]:l).forEach((function(e){t.stop(e.offset/100,e.color,e.opacity)}))})):u.globals.dom.Paper.gradient(b?"radial":"linear",(function(t){t.stop(h,e,i),t.stop(d,r,n),t.stop(p,r,n),null!==g&&t.stop(g,e,i)})),b){var y=u.globals.gridWidth/2,v=u.globals.gridHeight/2;"bubble"!==u.config.chart.type?o.attr({gradientUnits:"userSpaceOnUse",cx:y,cy:v,r:a}):o.attr({cx:.5,cy:.5,r:.8,fx:.2,fy:.2})}else"vertical"===t?o.from(0,0).to(0,1):"diagonal"===t?o.from(0,0).to(1,1):"horizontal"===t?o.from(0,1).to(1,1):"diagonal2"===t&&o.from(1,0).to(0,1);return o}},{key:"getTextBasedOnMaxWidth",value:function(t){var e=t.text,r=t.maxWidth,i=t.fontSize,n=t.fontFamily,o=this.getTextRects(e,i,n),a=o.width/e.length,s=Math.floor(r/a);return r-1){var s=r.globals.selectedDataPoints[n].indexOf(o);r.globals.selectedDataPoints[n].splice(s,1)}}else{if(!r.config.states.active.allowMultipleDataPointsSelection&&r.globals.selectedDataPoints.length>0){r.globals.selectedDataPoints=[];var l=r.globals.dom.Paper.find(".apexcharts-series path:not(.apexcharts-decoration-element)"),c=r.globals.dom.Paper.find(".apexcharts-series circle:not(.apexcharts-decoration-element), .apexcharts-series rect:not(.apexcharts-decoration-element)"),u=function(t){Array.prototype.forEach.call(t,(function(t){t.node.setAttribute("selected","false"),i.getDefaultFilter(t,n)}))};u(l),u(c)}t.node.setAttribute("selected","true"),a="true",void 0===r.globals.selectedDataPoints[n]&&(r.globals.selectedDataPoints[n]=[]),r.globals.selectedDataPoints[n].push(o)}if("true"===a){var h=r.config.states.active.filter;if("none"!==h)i.applyFilter(t,n,h.type);else if("none"!==r.config.states.hover.filter&&!r.globals.isTouchDevice){var f=r.config.states.hover.filter;i.applyFilter(t,n,f.type)}}else"none"!==r.config.states.active.filter.type&&("none"===r.config.states.hover.filter.type||r.globals.isTouchDevice?i.getDefaultFilter(t,n):(f=r.config.states.hover.filter,i.applyFilter(t,n,f.type)));"function"==typeof r.config.chart.events.dataPointSelection&&r.config.chart.events.dataPointSelection(e,this.ctx,{selectedDataPoints:r.globals.selectedDataPoints,seriesIndex:n,dataPointIndex:o,w:r}),e&&this.ctx.events.fireEvent("dataPointSelection",[e,this.ctx,{selectedDataPoints:r.globals.selectedDataPoints,seriesIndex:n,dataPointIndex:o,w:r}])}},{key:"rotateAroundCenter",value:function(t){var e={};return t&&"function"==typeof t.getBBox&&(e=t.getBBox()),{x:e.x+e.width/2,y:e.y+e.height/2}}},{key:"getTextRects",value:function(t,e,r,i){var n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=this.w,a=this.drawText({x:-200,y:-200,text:t,textAnchor:"start",fontSize:e,fontFamily:r,foreColor:"#fff",opacity:0});i&&a.attr("transform",i),o.globals.dom.Paper.add(a);var s=a.bbox();return n||(s=a.node.getBoundingClientRect()),a.remove(),{width:s.width,height:s.height}}},{key:"placeTextWithEllipsis",value:function(t,e,r){if("function"==typeof t.getComputedTextLength&&(t.textContent=e,e.length>0&&t.getComputedTextLength()>=r/1.1)){for(var i=e.length-3;i>0;i-=3)if(t.getSubStringLength(0,i)<=r/1.1)return void(t.textContent=e.substring(0,i)+"...");t.textContent="."}}}],i=[{key:"setAttrs",value:function(t,e){for(var r in e)e.hasOwnProperty(r)&&t.setAttribute(r,e[r])}}],r&&kc(e.prototype,r),i&&kc(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();const Pc=Oc;function Cc(t){return Cc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Cc(t)}function jc(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:[],e=this.w,r=[];if(0===e.globals.series.length)return r;for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:null;return null===t?this.w.config.series.reduce((function(t,e){return t+e}),0):this.w.globals.series[t].reduce((function(t,e){return t+e}),0)}},{key:"getStackedSeriesTotalsByGroups",value:function(){var t=this,e=this.w,r=[];return e.globals.seriesGroups.forEach((function(i){var n=[];e.config.series.forEach((function(t,r){i.indexOf(e.globals.seriesNames[r])>-1&&n.push(r)}));var o=e.globals.series.map((function(t,e){return-1===n.indexOf(e)?e:-1})).filter((function(t){return-1!==t}));r.push(t.getStackedSeriesTotals(o))})),r}},{key:"setSeriesYAxisMappings",value:function(){var t=this.w.globals,e=this.w.config,r=[],i=[],n=[],o=t.series.length>e.yaxis.length||e.yaxis.some((function(t){return Array.isArray(t.seriesName)}));e.series.forEach((function(t,e){n.push(e),i.push(null)})),e.yaxis.forEach((function(t,e){r[e]=[]}));var a=[];e.yaxis.forEach((function(t,i){var s=!1;if(t.seriesName){var l=[];Array.isArray(t.seriesName)?l=t.seriesName:l.push(t.seriesName),l.forEach((function(t){e.series.forEach((function(e,a){if(e.name===t){var l=a;i===a||o?!o||n.indexOf(a)>-1?r[i].push([i,a]):console.warn("Series '"+e.name+"' referenced more than once in what looks like the new style. That is, when using either seriesName: [], or when there are more series than yaxes."):(r[a].push([a,i]),l=i),s=!0,-1!==(l=n.indexOf(l))&&n.splice(l,1)}}))}))}s||a.push(i)})),r=r.map((function(t,e){var r=[];return t.forEach((function(t){i[t[1]]=t[0],r.push(t[1])})),r}));for(var s=e.yaxis.length-1,l=0;l0&&void 0!==arguments[0]?arguments[0]:null;return 0===(null===t?this.w.config.series.filter((function(t){return null!==t})):this.w.config.series[t].data.filter((function(t){return null!==t}))).length}},{key:"seriesHaveSameValues",value:function(t){return this.w.globals.series[t].every((function(t,e,r){return t===r[0]}))}},{key:"getCategoryLabels",value:function(t){var e=this.w,r=t.slice();return e.config.xaxis.convertedCatToNumeric&&(r=t.map((function(t,r){return e.config.xaxis.labels.formatter(t-e.globals.minX+1)}))),r}},{key:"getLargestSeries",value:function(){var t=this.w;t.globals.maxValsInArrayIndex=t.globals.series.map((function(t){return t.length})).indexOf(Math.max.apply(Math,t.globals.series.map((function(t){return t.length}))))}},{key:"getLargestMarkerSize",value:function(){var t=this.w,e=0;return t.globals.markers.size.forEach((function(t){e=Math.max(e,t)})),t.config.markers.discrete&&t.config.markers.discrete.length&&t.config.markers.discrete.forEach((function(t){e=Math.max(e,t.size)})),e>0&&(t.config.markers.hover.size>0?e=t.config.markers.hover.size:e+=t.config.markers.hover.sizeOffset),t.globals.markers.largestSize=e,e}},{key:"getSeriesTotals",value:function(){var t=this.w;t.globals.seriesTotals=t.globals.series.map((function(t,e){var r=0;if(Array.isArray(t))for(var i=0;it&&r.globals.seriesX[n][a]0){var d=function(t,e){var r=n.config.yaxis[n.globals.seriesYAxisReverseMap[e]],o=t<0?-1:1;return t=Math.abs(t),r.logarithmic&&(t=i.getBaseLog(r.logBase,t)),-o*t/a[e]};if(o.isMultipleYAxis){l=[];for(var p=0;p0&&e.forEach((function(e){var a=[],s=[];t.i.forEach((function(r,i){n.config.series[r].group===e&&(a.push(t.series[i]),s.push(r))})),a.length>0&&o.push(i.draw(a,r,s))})),o}}],i=[{key:"checkComboSeries",value:function(t,e){var r=!1,i=0,n=0;return void 0===e&&(e="line"),t.length&&void 0!==t[0].type&&t.forEach((function(t){"bar"!==t.type&&"column"!==t.type&&"candlestick"!==t.type&&"boxPlot"!==t.type||i++,void 0!==t.type&&t.type!==e&&n++})),n>0&&(r=!0),{comboBarCount:i,comboCharts:r}}},{key:"extendArrayProps",value:function(t,e,r){var i,n,o,a,s,l;return null!==(i=e)&&void 0!==i&&i.yaxis&&(e=t.extendYAxis(e,r)),null!==(n=e)&&void 0!==n&&n.annotations&&(e.annotations.yaxis&&(e=t.extendYAxisAnnotations(e)),null!==(o=e)&&void 0!==o&&null!==(a=o.annotations)&&void 0!==a&&a.xaxis&&(e=t.extendXAxisAnnotations(e)),null!==(s=e)&&void 0!==s&&null!==(l=s.annotations)&&void 0!==l&&l.points&&(e=t.extendPointAnnotations(e))),e}}],r&&jc(e.prototype,r),i&&jc(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();const Mc=Ec;function Lc(t){return Lc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lc(t)}function Ic(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:null,r=this.w;if("vertical"===t.label.orientation){var i=null!==e?e:0,n=r.globals.dom.baseEl.querySelector(".apexcharts-xaxis-annotations .apexcharts-xaxis-annotation-label[rel='".concat(i,"']"));if(null!==n){var o=n.getBoundingClientRect();n.setAttribute("x",parseFloat(n.getAttribute("x"))-o.height+4);var a="top"===t.label.position?o.width:-o.width;n.setAttribute("y",parseFloat(n.getAttribute("y"))+a);var s=this.annoCtx.graphics.rotateAroundCenter(n),l=s.x,c=s.y;n.setAttribute("transform","rotate(-90 ".concat(l," ").concat(c,")"))}}}},{key:"addBackgroundToAnno",value:function(t,e){var r=this.w;if(!t||!e.label.text||!String(e.label.text).trim())return null;var i=r.globals.dom.baseEl.querySelector(".apexcharts-grid").getBoundingClientRect(),n=t.getBoundingClientRect(),o=e.label.style.padding,a=o.left,s=o.right,l=o.top,c=o.bottom;if("vertical"===e.label.orientation){var u=[a,s,l,c];l=u[0],c=u[1],a=u[2],s=u[3]}var h=n.left-i.left-a,f=n.top-i.top-l,d=this.annoCtx.graphics.drawRect(h-r.globals.barPadForNumericAxis,f,n.width+a+s,n.height+l+c,e.label.borderRadius,e.label.style.background,1,e.label.borderWidth,e.label.borderColor,0);return e.id&&d.node.classList.add(e.id),d}},{key:"annotationsBackground",value:function(){var t=this,e=this.w,r=function(r,i,n){var o=e.globals.dom.baseEl.querySelector(".apexcharts-".concat(n,"-annotations .apexcharts-").concat(n,"-annotation-label[rel='").concat(i,"']"));if(o){var a=o.parentNode,s=t.addBackgroundToAnno(o,r);s&&(a.insertBefore(s.node,o),r.label.mouseEnter&&s.node.addEventListener("mouseenter",r.label.mouseEnter.bind(t,r)),r.label.mouseLeave&&s.node.addEventListener("mouseleave",r.label.mouseLeave.bind(t,r)),r.label.click&&s.node.addEventListener("click",r.label.click.bind(t,r)))}};e.config.annotations.xaxis.forEach((function(t,e){return r(t,e,"xaxis")})),e.config.annotations.yaxis.forEach((function(t,e){return r(t,e,"yaxis")})),e.config.annotations.points.forEach((function(t,e){return r(t,e,"point")}))}},{key:"getY1Y2",value:function(t,e){var r,i=this.w,n="y1"===t?e.y:e.y2,o=!1;if(this.annoCtx.invertAxis){var a=i.config.xaxis.convertedCatToNumeric?i.globals.categoryLabels:i.globals.labels,s=a.indexOf(n),l=i.globals.dom.baseEl.querySelector(".apexcharts-yaxis-texts-g text:nth-child(".concat(s+1,")"));r=l?parseFloat(l.getAttribute("y")):(i.globals.gridHeight/a.length-1)*(s+1)-i.globals.barHeight,void 0!==e.seriesIndex&&i.globals.barHeight&&(r-=i.globals.barHeight/2*(i.globals.series.length-1)-i.globals.barHeight*e.seriesIndex)}else{var c,u=i.globals.seriesYAxisMap[e.yAxisIndex][0],h=i.config.yaxis[e.yAxisIndex].logarithmic?new Mc(this.annoCtx.ctx).getLogVal(i.config.yaxis[e.yAxisIndex].logBase,n,u)/i.globals.yLogRatio[u]:(n-i.globals.minYArr[u])/(i.globals.yRange[u]/i.globals.gridHeight);r=i.globals.gridHeight-Math.min(Math.max(h,0),i.globals.gridHeight),o=h>i.globals.gridHeight||h<0,!e.marker||void 0!==e.y&&null!==e.y||(r=0),null!==(c=i.config.yaxis[e.yAxisIndex])&&void 0!==c&&c.reversed&&(r=h)}return"string"==typeof n&&n.includes("px")&&(r=parseFloat(n)),{yP:r,clipped:o}}},{key:"getX1X2",value:function(t,e){var r=this.w,i="x1"===t?e.x:e.x2,n=this.annoCtx.invertAxis?r.globals.minY:r.globals.minX,o=this.annoCtx.invertAxis?r.globals.maxY:r.globals.maxX,a=this.annoCtx.invertAxis?r.globals.yRange[0]:r.globals.xRange,s=!1,l=this.annoCtx.inversedReversedAxis?(o-i)/(a/r.globals.gridWidth):(i-n)/(a/r.globals.gridWidth);return"category"!==r.config.xaxis.type&&!r.config.xaxis.convertedCatToNumeric||this.annoCtx.invertAxis||r.globals.dataFormatXNumeric||r.config.chart.sparkline.enabled||(l=this.getStringX(i)),"string"==typeof i&&i.includes("px")&&(l=parseFloat(i)),null==i&&e.marker&&(l=r.globals.gridWidth),void 0!==e.seriesIndex&&r.globals.barWidth&&!this.annoCtx.invertAxis&&(l-=r.globals.barWidth/2*(r.globals.series.length-1)-r.globals.barWidth*e.seriesIndex),l>r.globals.gridWidth?(l=r.globals.gridWidth,s=!0):l<0&&(l=0,s=!0),{x:l,clipped:s}}},{key:"getStringX",value:function(t){var e=this.w,r=t;e.config.xaxis.convertedCatToNumeric&&e.globals.categoryLabels.length&&(t=e.globals.categoryLabels.indexOf(t)+1);var i=e.globals.labels.map((function(t){return Array.isArray(t)?t.join(" "):t})).indexOf(t),n=e.globals.dom.baseEl.querySelector(".apexcharts-xaxis-texts-g text:nth-child(".concat(i+1,")"));return n&&(r=parseFloat(n.getAttribute("x"))),r}}],r&&Ic(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function zc(t){return zc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zc(t)}function Xc(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,i=Array(e);r12?f-12:0===f?12:f;e=(e=(e=(e=e.replace(/(^|[^\\])HH+/g,"$1"+l(f))).replace(/(^|[^\\])H/g,"$1"+f)).replace(/(^|[^\\])hh+/g,"$1"+l(d))).replace(/(^|[^\\])h/g,"$1"+d);var p=i?t.getUTCMinutes():t.getMinutes();e=(e=e.replace(/(^|[^\\])mm+/g,"$1"+l(p))).replace(/(^|[^\\])m/g,"$1"+p);var g=i?t.getUTCSeconds():t.getSeconds();e=(e=e.replace(/(^|[^\\])ss+/g,"$1"+l(g))).replace(/(^|[^\\])s/g,"$1"+g);var b=i?t.getUTCMilliseconds():t.getMilliseconds();e=e.replace(/(^|[^\\])fff+/g,"$1"+l(b,3)),b=Math.round(b/10),e=e.replace(/(^|[^\\])ff/g,"$1"+l(b)),b=Math.round(b/10);var y=f<12?"AM":"PM";e=(e=(e=e.replace(/(^|[^\\])f/g,"$1"+b)).replace(/(^|[^\\])TT+/g,"$1"+y)).replace(/(^|[^\\])T/g,"$1"+y.charAt(0));var v=y.toLowerCase();e=(e=e.replace(/(^|[^\\])tt+/g,"$1"+v)).replace(/(^|[^\\])t/g,"$1"+v.charAt(0));var m=-t.getTimezoneOffset(),x=i||!m?"Z":m>0?"+":"-";if(!i){var w=(m=Math.abs(m))%60;x+=l(Math.floor(m/60))+":"+l(w)}e=e.replace(/(^|[^\\])K/g,"$1"+x);var S=(i?t.getUTCDay():t.getDay())+1;return(e=(e=(e=(e=e.replace(new RegExp(a[0],"g"),a[S])).replace(new RegExp(s[0],"g"),s[S])).replace(new RegExp(n[0],"g"),n[u])).replace(new RegExp(o[0],"g"),o[u])).replace(/\\(.)/g,"$1")}},{key:"getTimeUnitsfromTimestamp",value:function(t,e,r){var i=this.w;void 0!==i.config.xaxis.min&&(t=i.config.xaxis.min),void 0!==i.config.xaxis.max&&(e=i.config.xaxis.max);var n=this.getDate(t),o=this.getDate(e),a=this.formatDate(n,"yyyy MM dd HH mm ss fff").split(" "),s=this.formatDate(o,"yyyy MM dd HH mm ss fff").split(" ");return{minMillisecond:parseInt(a[6],10),maxMillisecond:parseInt(s[6],10),minSecond:parseInt(a[5],10),maxSecond:parseInt(s[5],10),minMinute:parseInt(a[4],10),maxMinute:parseInt(s[4],10),minHour:parseInt(a[3],10),maxHour:parseInt(s[3],10),minDate:parseInt(a[2],10),maxDate:parseInt(s[2],10),minMonth:parseInt(a[1],10)-1,maxMonth:parseInt(s[1],10)-1,minYear:parseInt(a[0],10),maxYear:parseInt(s[0],10)}}},{key:"isLeapYear",value:function(t){return t%4==0&&t%100!=0||t%400==0}},{key:"calculcateLastDaysOfMonth",value:function(t,e,r){return this.determineDaysOfMonths(t,e)-r}},{key:"determineDaysOfYear",value:function(t){var e=365;return this.isLeapYear(t)&&(e=366),e}},{key:"determineRemainingDaysOfYear",value:function(t,e,r){var i=this.daysCntOfYear[e]+r;return e>1&&this.isLeapYear()&&i++,i}},{key:"determineDaysOfMonths",value:function(t,e){var r=30;switch(t=f.monthMod(t),!0){case this.months30.indexOf(t)>-1:2===t&&(r=this.isLeapYear(e)?29:28);break;case this.months31.indexOf(t)>-1:default:r=31}return r}}],r&&Nc(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();const Vc=Gc;function Uc(t){return Uc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Uc(t)}function qc(t,e){for(var r=0;r0&&r<100?t.toFixed(1):t.toFixed(0)}return e.globals.isBarHorizontal&&e.globals.maxY-e.globals.minYArr<4?t.toFixed(1):t.toFixed(0)}return t},"function"==typeof e.config.tooltip.x.formatter?e.globals.ttKeyFormatter=e.config.tooltip.x.formatter:e.globals.ttKeyFormatter=e.globals.xLabelFormatter,"function"==typeof e.config.xaxis.tooltip.formatter&&(e.globals.xaxisTooltipFormatter=e.config.xaxis.tooltip.formatter),(Array.isArray(e.config.tooltip.y)||void 0!==e.config.tooltip.y.formatter)&&(e.globals.ttVal=e.config.tooltip.y),void 0!==e.config.tooltip.z.formatter&&(e.globals.ttZFormatter=e.config.tooltip.z.formatter),void 0!==e.config.legend.formatter&&(e.globals.legendFormatter=e.config.legend.formatter),e.config.yaxis.forEach((function(r,i){void 0!==r.labels.formatter?e.globals.yLabelFormatters[i]=r.labels.formatter:e.globals.yLabelFormatters[i]=function(n){return e.globals.xyCharts?Array.isArray(n)?n.map((function(e){return t.defaultYFormatter(e,r,i)})):t.defaultYFormatter(n,r,i):n}})),e.globals}},{key:"heatmapLabelFormatters",value:function(){var t=this.w;if("heatmap"===t.config.chart.type){t.globals.yAxisScale[0].result=t.globals.seriesNames.slice();var e=t.globals.seriesNames.reduce((function(t,e){return t.length>e.length?t:e}),0);t.globals.yAxisScale[0].niceMax=e,t.globals.yAxisScale[0].niceMin=e}}}],r&&qc(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();const Jc=$c;function Qc(t){return Qc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qc(t)}function Kc(t,e){for(var r=0;r4&&void 0!==arguments[4]?arguments[4]:[],s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"12px",l=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],c=this.w,u=void 0===t[i]?"":t[i],h=u,f=c.globals.xLabelFormatter,d=c.config.xaxis.labels.formatter,p=!1,g=new Jc(this.ctx),b=u;l&&(h=g.xLabelFormat(f,u,b,{i,dateFormatter:new Vc(this.ctx).formatDate,w:c}),void 0!==d&&(h=d(u,t[i],{i,dateFormatter:new Vc(this.ctx).formatDate,w:c}))),e.length>0?(n=e[i].unit,o=null,e.forEach((function(t){"month"===t.unit?o="year":"day"===t.unit?o="month":"hour"===t.unit?o="day":"minute"===t.unit&&(o="hour")})),p=o===n,r=e[i].position,h=e[i].value):"datetime"===c.config.xaxis.type&&void 0===d&&(h=""),void 0===h&&(h=""),h=Array.isArray(h)?h:h.toString();var y,v=new Pc(this.ctx);y=c.globals.rotateXLabels&&l?v.getTextRects(h,parseInt(s,10),null,"rotate(".concat(c.config.xaxis.labels.rotate," 0 0)"),!1):v.getTextRects(h,parseInt(s,10));var m=!c.config.xaxis.labels.showDuplicates&&this.ctx.timeScale;return!Array.isArray(h)&&("NaN"===String(h)||a.indexOf(h)>=0&&m)&&(h=""),{x:r,text:h,textRect:y,isBold:p}}},{key:"checkLabelBasedOnTickamount",value:function(t,e,r){var i=this.w,n=i.config.xaxis.tickAmount;return"dataPoints"===n&&(n=Math.round(i.globals.gridWidth/120)),n>r||t%Math.round(r/(n+1))==0||(e.text=""),e}},{key:"checkForOverflowingLabels",value:function(t,e,r,i,n){var o=this.w;if(0===t&&o.globals.skipFirstTimelinelabel&&(e.text=""),t===r-1&&o.globals.skipLastTimelinelabel&&(e.text=""),o.config.xaxis.labels.hideOverlappingLabels&&i.length>0){var a=n[n.length-1];e.xi.length||i.some((function(t){return Array.isArray(t.seriesName)}))?t:r.seriesYAxisReverseMap[t]}},{key:"isYAxisHidden",value:function(t){var e=this.w,r=e.config.yaxis[t];if(!r.show||this.yAxisAllSeriesCollapsed(t))return!0;if(!r.showForNullSeries){var i=e.globals.seriesYAxisMap[t],n=new Mc(this.ctx);return i.every((function(t){return n.isSeriesNull(t)}))}return!1}},{key:"getYAxisForeColor",value:function(t,e){var r=this.w;return Array.isArray(t)&&r.globals.yAxisScale[e]&&this.ctx.theme.pushExtraColors(t,r.globals.yAxisScale[e].result.length,!1),t}},{key:"drawYAxisTicks",value:function(t,e,r,i,n,o,a){var s=this.w,l=new Pc(this.ctx),c=s.globals.translateY+s.config.yaxis[n].labels.offsetY;if(s.globals.isBarHorizontal?c=0:"heatmap"===s.config.chart.type&&(c+=o/2),i.show&&e>0){!0===s.config.yaxis[n].opposite&&(t+=i.width);for(var u=e;u>=0;u--){var h=l.drawLine(t+r.offsetX-i.width+i.offsetX,c+i.offsetY,t+r.offsetX+i.offsetX,c+i.offsetY,i.color);a.add(h),c+=o}}}}],r&&Kc(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function ru(t){return ru="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ru(t)}function iu(t,e){for(var r=0;rs){var d=s;s=i,i=d}if(!l||!c){u=!0;var p=this.annoCtx.graphics.drawRect(0+t.offsetX,i+t.offsetY,this._getYAxisAnnotationWidth(t),s-i,0,t.fillColor,t.opacity,1,t.borderColor,o);p.node.classList.add("apexcharts-annotation-rect"),p.attr("clip-path","url(#gridRectMask".concat(n.globals.cuid,")")),e.appendChild(p.node),t.id&&p.node.classList.add(t.id)}}if(u){var g="right"===t.label.position?n.globals.gridWidth:"center"===t.label.position?n.globals.gridWidth/2:0,b=this.annoCtx.graphics.drawText({x:g+t.label.offsetX,y:(null!=i?i:s)+t.label.offsetY-3,text:h,textAnchor:t.label.textAnchor,fontSize:t.label.style.fontSize,fontFamily:t.label.style.fontFamily,fontWeight:t.label.style.fontWeight,foreColor:t.label.style.color,cssClass:"apexcharts-yaxis-annotation-label ".concat(t.label.style.cssClass," ").concat(t.id?t.id:"")});b.attr({rel:r}),e.appendChild(b.node)}}},{key:"_getYAxisAnnotationWidth",value:function(t){var e=this.w;return e.globals.gridWidth,(t.width.indexOf("%")>-1?e.globals.gridWidth*parseInt(t.width,10)/100:parseInt(t.width,10))+t.offsetX}},{key:"drawYAxisAnnotations",value:function(){var t=this,e=this.w,r=this.annoCtx.graphics.group({class:"apexcharts-yaxis-annotations"});return e.config.annotations.yaxis.forEach((function(e,i){e.yAxisIndex=t.axesUtils.translateYAxisIndex(e.yAxisIndex),t.axesUtils.isYAxisHidden(e.yAxisIndex)&&t.axesUtils.yAxisAllSeriesCollapsed(e.yAxisIndex)||t.addYaxisAnnotation(e,r.node,i)})),r}}])&&iu(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function au(t){return au="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},au(t)}function su(t,e){for(var r=0;r-1)){var i=this.helpers.getX1X2("x1",t),n=i.x,o=i.clipped,a=(i=this.helpers.getY1Y2("y1",t)).yP,s=i.clipped;if(f.isNumber(n)&&!s&&!o){var l={pSize:t.marker.size,pointStrokeWidth:t.marker.strokeWidth,pointFillColor:t.marker.fillColor,pointStrokeColor:t.marker.strokeColor,shape:t.marker.shape,pRadius:t.marker.radius,class:"apexcharts-point-annotation-marker ".concat(t.marker.cssClass," ").concat(t.id?t.id:"")},c=this.annoCtx.graphics.drawMarker(n+t.marker.offsetX,a+t.marker.offsetY,l);e.appendChild(c.node);var u=t.label.text?t.label.text:"",h=this.annoCtx.graphics.drawText({x:n+t.label.offsetX,y:a+t.label.offsetY-t.marker.size-parseFloat(t.label.style.fontSize)/1.6,text:u,textAnchor:t.label.textAnchor,fontSize:t.label.style.fontSize,fontFamily:t.label.style.fontFamily,fontWeight:t.label.style.fontWeight,foreColor:t.label.style.color,cssClass:"apexcharts-point-annotation-label ".concat(t.label.style.cssClass," ").concat(t.id?t.id:"")});if(h.attr({rel:r}),e.appendChild(h.node),t.customSVG.SVG){var d=this.annoCtx.graphics.group({class:"apexcharts-point-annotations-custom-svg "+t.customSVG.cssClass});d.attr({transform:"translate(".concat(n+t.customSVG.offsetX,", ").concat(a+t.customSVG.offsetY,")")}),d.node.innerHTML=t.customSVG.SVG,e.appendChild(d.node)}if(t.image.path){var p=t.image.width?t.image.width:20,g=t.image.height?t.image.height:20;c=this.annoCtx.addImage({x:n+t.image.offsetX-p/2,y:a+t.image.offsetY-g/2,width:p,height:g,path:t.image.path,appendTo:".apexcharts-point-annotations"})}t.mouseEnter&&c.node.addEventListener("mouseenter",t.mouseEnter.bind(this,t)),t.mouseLeave&&c.node.addEventListener("mouseleave",t.mouseLeave.bind(this,t)),t.click&&c.node.addEventListener("click",t.click.bind(this,t))}}}},{key:"drawPointAnnotations",value:function(){var t=this,e=this.w,r=this.annoCtx.graphics.group({class:"apexcharts-point-annotations"});return e.config.annotations.points.map((function(e,i){t.addPointAnnotation(e,r.node,i)})),r}}],r&&su(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();const uu=JSON.parse('{"name":"en","options":{"months":["January","February","March","April","May","June","July","August","September","October","November","December"],"shortMonths":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],"days":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"shortDays":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"toolbar":{"exportToSVG":"Download SVG","exportToPNG":"Download PNG","exportToCSV":"Download CSV","menu":"Menu","selection":"Selection","selectionZoom":"Selection Zoom","zoomIn":"Zoom In","zoomOut":"Zoom Out","pan":"Panning","reset":"Reset Zoom"}}}');function hu(t){return hu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hu(t)}function fu(t,e){for(var r=0;r1&&a[s].classList.add("apexcharts-element-hidden"),t.globals.delayedElements.push({el:a[s],index:0});this.helpers.annotationsBackground()}}},{key:"drawImageAnnos",value:function(){var t=this;this.w.config.annotations.images.map((function(e,r){t.addImage(e,r)}))}},{key:"drawTextAnnos",value:function(){var t=this;this.w.config.annotations.texts.map((function(e,r){t.addText(e,r)}))}},{key:"addXaxisAnnotation",value:function(t,e,r){this.xAxisAnnotations.addXaxisAnnotation(t,e,r)}},{key:"addYaxisAnnotation",value:function(t,e,r){this.yAxisAnnotations.addYaxisAnnotation(t,e,r)}},{key:"addPointAnnotation",value:function(t,e,r){this.pointsAnnotations.addPointAnnotation(t,e,r)}},{key:"addText",value:function(t,e){var r=t.x,i=t.y,n=t.text,o=t.textAnchor,a=t.foreColor,s=t.fontSize,l=t.fontFamily,c=t.fontWeight,u=t.cssClass,h=t.backgroundColor,f=t.borderWidth,d=t.strokeDashArray,p=t.borderRadius,g=t.borderColor,b=t.appendTo,y=void 0===b?".apexcharts-svg":b,v=t.paddingLeft,m=void 0===v?4:v,x=t.paddingRight,w=void 0===x?4:x,S=t.paddingBottom,k=void 0===S?2:S,A=t.paddingTop,O=void 0===A?2:A,P=this.w,C=this.graphics.drawText({x:r,y:i,text:n,textAnchor:o||"start",fontSize:s||"12px",fontWeight:c||"regular",fontFamily:l||P.config.chart.fontFamily,foreColor:a||P.config.chart.foreColor,cssClass:u}),j=P.globals.dom.baseEl.querySelector(y);j&&j.appendChild(C.node);var T=C.bbox();if(n){var E=this.graphics.drawRect(T.x-m,T.y-O,T.width+m+w,T.height+k+O,p,h||"transparent",1,f,g,d);j.insertBefore(E.node,C.node)}}},{key:"addImage",value:function(t,e){var r=this.w,i=t.path,n=t.x,o=void 0===n?0:n,a=t.y,s=void 0===a?0:a,l=t.width,c=void 0===l?20:l,u=t.height,h=void 0===u?20:u,f=t.appendTo,d=void 0===f?".apexcharts-svg":f,p=r.globals.dom.Paper.image(i);p.size(c,h).move(o,s);var g=r.globals.dom.baseEl.querySelector(d);return g&&g.appendChild(p.node),p}},{key:"addXaxisAnnotationExternal",value:function(t,e,r){return this.addAnnotationExternal({params:t,pushToMemory:e,context:r,type:"xaxis",contextMethod:r.addXaxisAnnotation}),r}},{key:"addYaxisAnnotationExternal",value:function(t,e,r){return this.addAnnotationExternal({params:t,pushToMemory:e,context:r,type:"yaxis",contextMethod:r.addYaxisAnnotation}),r}},{key:"addPointAnnotationExternal",value:function(t,e,r){return void 0===this.invertAxis&&(this.invertAxis=r.w.globals.isBarHorizontal),this.addAnnotationExternal({params:t,pushToMemory:e,context:r,type:"point",contextMethod:r.addPointAnnotation}),r}},{key:"addAnnotationExternal",value:function(t){var e=t.params,r=t.pushToMemory,i=t.context,n=t.type,o=t.contextMethod,a=i,s=a.w,l=s.globals.dom.baseEl.querySelector(".apexcharts-".concat(n,"-annotations")),c=l.childNodes.length+1,u=new pu,h=Object.assign({},"xaxis"===n?u.xAxisAnnotation:"yaxis"===n?u.yAxisAnnotation:u.pointAnnotation),d=f.extend(h,e);switch(n){case"xaxis":this.addXaxisAnnotation(d,l,c);break;case"yaxis":this.addYaxisAnnotation(d,l,c);break;case"point":this.addPointAnnotation(d,l,c)}var p=s.globals.dom.baseEl.querySelector(".apexcharts-".concat(n,"-annotations .apexcharts-").concat(n,"-annotation-label[rel='").concat(c,"']")),g=this.helpers.addBackgroundToAnno(p,d);return g&&l.insertBefore(g.node,p),r&&s.globals.memory.methodsToExec.push({context:a,id:d.id?d.id:f.randomId(),method:o,label:"addAnnotation",params:e}),i}},{key:"clearAnnotations",value:function(t){for(var e=t.w,r=e.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxis-annotations, .apexcharts-xaxis-annotations, .apexcharts-point-annotations"),i=e.globals.memory.methodsToExec.length-1;i>=0;i--)"addText"!==e.globals.memory.methodsToExec[i].label&&"addAnnotation"!==e.globals.memory.methodsToExec[i].label||e.globals.memory.methodsToExec.splice(i,1);r=f.listToArray(r),Array.prototype.forEach.call(r,(function(t){for(;t.firstChild;)t.removeChild(t.firstChild)}))}},{key:"removeAnnotation",value:function(t,e){var r=t.w,i=r.globals.dom.baseEl.querySelectorAll(".".concat(e));i&&(r.globals.memory.methodsToExec.map((function(t,i){t.id===e&&r.globals.memory.methodsToExec.splice(i,1)})),Array.prototype.forEach.call(i,(function(t){t.parentElement.removeChild(t)})))}}],r&&bu(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function mu(t){return mu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mu(t)}function xu(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function wu(t){for(var e=1;e\n '.concat(n,'\n - \n ').concat(o,"\n ");return'
'+(r||"")+'
'+i+": "+(t.w.globals.comboCharts?"rangeArea"===t.w.config.series[a].type||"rangeBar"===t.w.config.series[a].type?u:"".concat(c,""):u)+"
"},Cu=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.opts=e}var e,r;return e=t,(r=[{key:"hideYAxis",value:function(){this.opts.yaxis[0].show=!1,this.opts.yaxis[0].title.text="",this.opts.yaxis[0].axisBorder.show=!1,this.opts.yaxis[0].axisTicks.show=!1,this.opts.yaxis[0].floating=!0}},{key:"line",value:function(){return{dataLabels:{enabled:!1},stroke:{width:5,curve:"straight"},markers:{size:0,hover:{sizeOffset:6}},xaxis:{crosshairs:{width:1}}}}},{key:"sparkline",value:function(t){return this.hideYAxis(),f.extend(t,{grid:{show:!1,padding:{left:0,right:0,top:0,bottom:0}},legend:{show:!1},xaxis:{labels:{show:!1},tooltip:{enabled:!1},axisBorder:{show:!1},axisTicks:{show:!1}},chart:{toolbar:{show:!1},zoom:{enabled:!1}},dataLabels:{enabled:!1}})}},{key:"slope",value:function(){return this.hideYAxis(),{chart:{toolbar:{show:!1},zoom:{enabled:!1}},dataLabels:{enabled:!0,formatter:function(t,e){var r=e.w.config.series[e.seriesIndex].name;return null!==t?r+": "+t:""},background:{enabled:!1},offsetX:-5},grid:{xaxis:{lines:{show:!0}},yaxis:{lines:{show:!1}}},xaxis:{position:"top",labels:{style:{fontSize:14,fontWeight:900}},tooltip:{enabled:!1},crosshairs:{show:!1}},markers:{size:8,hover:{sizeOffset:1}},legend:{show:!1},tooltip:{shared:!1,intersect:!0,followCursor:!0},stroke:{width:5,curve:"straight"}}}},{key:"bar",value:function(){return{chart:{stacked:!1},plotOptions:{bar:{dataLabels:{position:"center"}}},dataLabels:{style:{colors:["#fff"]},background:{enabled:!1}},stroke:{width:0,lineCap:"square"},fill:{opacity:.85},legend:{markers:{shape:"square"}},tooltip:{shared:!1,intersect:!0},xaxis:{tooltip:{enabled:!1},tickPlacement:"between",crosshairs:{width:"barWidth",position:"back",fill:{type:"gradient"},dropShadow:{enabled:!1},stroke:{width:0}}}}}},{key:"funnel",value:function(){return this.hideYAxis(),wu(wu({},this.bar()),{},{chart:{animations:{speed:800,animateGradually:{enabled:!1}}},plotOptions:{bar:{horizontal:!0,borderRadiusApplication:"around",borderRadius:0,dataLabels:{position:"center"}}},grid:{show:!1,padding:{left:0,right:0}},xaxis:{labels:{show:!1},tooltip:{enabled:!1},axisBorder:{show:!1},axisTicks:{show:!1}}})}},{key:"candlestick",value:function(){var t=this;return{stroke:{width:1,colors:["#333"]},fill:{opacity:1},dataLabels:{enabled:!1},tooltip:{shared:!0,custom:function(e){var r=e.seriesIndex,i=e.dataPointIndex,n=e.w;return t._getBoxTooltip(n,r,i,["Open","High","","Low","Close"],"candlestick")}},states:{active:{filter:{type:"none"}}},xaxis:{crosshairs:{width:1}}}}},{key:"boxPlot",value:function(){var t=this;return{chart:{animations:{dynamicAnimation:{enabled:!1}}},stroke:{width:1,colors:["#24292e"]},dataLabels:{enabled:!1},tooltip:{shared:!0,custom:function(e){var r=e.seriesIndex,i=e.dataPointIndex,n=e.w;return t._getBoxTooltip(n,r,i,["Minimum","Q1","Median","Q3","Maximum"],"boxPlot")}},markers:{size:7,strokeWidth:1,strokeColors:"#111"},xaxis:{crosshairs:{width:1}}}}},{key:"rangeBar",value:function(){return{chart:{animations:{animateGradually:!1}},stroke:{width:0,lineCap:"square"},plotOptions:{bar:{borderRadius:0,dataLabels:{position:"center"}}},dataLabels:{enabled:!1,formatter:function(t,e){e.ctx;var r=e.seriesIndex,i=e.dataPointIndex,n=e.w,o=function(){var t=n.globals.seriesRangeStart[r][i];return n.globals.seriesRangeEnd[r][i]-t};return n.globals.comboCharts?"rangeBar"===n.config.series[r].type||"rangeArea"===n.config.series[r].type?o():t:o()},background:{enabled:!1},style:{colors:["#fff"]}},markers:{size:10},tooltip:{shared:!1,followCursor:!0,custom:function(t){return t.w.config.plotOptions&&t.w.config.plotOptions.bar&&t.w.config.plotOptions.bar.horizontal?function(t){var e=Ou(wu(wu({},t),{},{isTimeline:!0})),r=e.color,i=e.seriesName,n=e.ylabel,o=e.startVal,a=e.endVal;return Pu(wu(wu({},t),{},{color:r,seriesName:i,ylabel:n,start:o,end:a}))}(t):function(t){var e=Ou(t),r=e.color,i=e.seriesName,n=e.ylabel,o=e.start,a=e.end;return Pu(wu(wu({},t),{},{color:r,seriesName:i,ylabel:n,start:o,end:a}))}(t)}},xaxis:{tickPlacement:"between",tooltip:{enabled:!1},crosshairs:{stroke:{width:0}}}}}},{key:"dumbbell",value:function(t){var e,r;return null!==(e=t.plotOptions.bar)&&void 0!==e&&e.barHeight||(t.plotOptions.bar.barHeight=2),null!==(r=t.plotOptions.bar)&&void 0!==r&&r.columnWidth||(t.plotOptions.bar.columnWidth=2),t}},{key:"area",value:function(){return{stroke:{width:4,fill:{type:"solid",gradient:{inverseColors:!1,shade:"light",type:"vertical",opacityFrom:.65,opacityTo:.5,stops:[0,100,100]}}},fill:{type:"gradient",gradient:{inverseColors:!1,shade:"light",type:"vertical",opacityFrom:.65,opacityTo:.5,stops:[0,100,100]}},markers:{size:0,hover:{sizeOffset:6}},tooltip:{followCursor:!1}}}},{key:"rangeArea",value:function(){return{stroke:{curve:"straight",width:0},fill:{type:"solid",opacity:.6},markers:{size:0},states:{hover:{filter:{type:"none"}},active:{filter:{type:"none"}}},tooltip:{intersect:!1,shared:!0,followCursor:!0,custom:function(t){return function(t){var e=Ou(t),r=e.color,i=e.seriesName,n=e.ylabel,o=e.start,a=e.end;return Pu(wu(wu({},t),{},{color:r,seriesName:i,ylabel:n,start:o,end:a}))}(t)}}}}},{key:"brush",value:function(t){return f.extend(t,{chart:{toolbar:{autoSelected:"selection",show:!1},zoom:{enabled:!1}},dataLabels:{enabled:!1},stroke:{width:1},tooltip:{enabled:!1},xaxis:{tooltip:{enabled:!1}}})}},{key:"stacked100",value:function(t){t.dataLabels=t.dataLabels||{},t.dataLabels.formatter=t.dataLabels.formatter||void 0;var e=t.dataLabels.formatter;return t.yaxis.forEach((function(e,r){t.yaxis[r].min=0,t.yaxis[r].max=100})),"bar"===t.chart.type&&(t.dataLabels.formatter=e||function(t){return"number"==typeof t&&t?t.toFixed(0)+"%":t}),t}},{key:"stackedBars",value:function(){var t=this.bar();return wu(wu({},t),{},{plotOptions:wu(wu({},t.plotOptions),{},{bar:wu(wu({},t.plotOptions.bar),{},{borderRadiusApplication:"end",borderRadiusWhenStacked:"last"})})})}},{key:"convertCatToNumeric",value:function(t){return t.xaxis.convertedCatToNumeric=!0,t}},{key:"convertCatToNumericXaxis",value:function(t,e,r){t.xaxis.type="numeric",t.xaxis.labels=t.xaxis.labels||{},t.xaxis.labels.formatter=t.xaxis.labels.formatter||function(t){return f.isNumber(t)?Math.floor(t):t};var i=t.xaxis.labels.formatter,n=t.xaxis.categories&&t.xaxis.categories.length?t.xaxis.categories:t.labels;return r&&r.length&&(n=r.map((function(t){return Array.isArray(t)?t:String(t)}))),n&&n.length&&(t.xaxis.labels.formatter=function(t){return f.isNumber(t)?i(n[Math.floor(t)-1]):i(t)}),t.xaxis.categories=[],t.labels=[],t.xaxis.tickAmount=t.xaxis.tickAmount||"dataPoints",t}},{key:"bubble",value:function(){return{dataLabels:{style:{colors:["#fff"]}},tooltip:{shared:!1,intersect:!0},xaxis:{crosshairs:{width:0}},fill:{type:"solid",gradient:{shade:"light",inverse:!0,shadeIntensity:.55,opacityFrom:.4,opacityTo:.8}}}}},{key:"scatter",value:function(){return{dataLabels:{enabled:!1},tooltip:{shared:!1,intersect:!0},markers:{size:6,strokeWidth:1,hover:{sizeOffset:2}}}}},{key:"heatmap",value:function(){return{chart:{stacked:!1},fill:{opacity:1},dataLabels:{style:{colors:["#fff"]}},stroke:{colors:["#fff"]},tooltip:{followCursor:!0,marker:{show:!1},x:{show:!1}},legend:{position:"top",markers:{shape:"square"}},grid:{padding:{right:20}}}}},{key:"treemap",value:function(){return{chart:{zoom:{enabled:!1}},dataLabels:{style:{fontSize:14,fontWeight:600,colors:["#fff"]}},stroke:{show:!0,width:2,colors:["#fff"]},legend:{show:!1},fill:{opacity:1,gradient:{stops:[0,100]}},tooltip:{followCursor:!0,x:{show:!1}},grid:{padding:{left:0,right:0}},xaxis:{crosshairs:{show:!1},tooltip:{enabled:!1}}}}},{key:"pie",value:function(){return{chart:{toolbar:{show:!1}},plotOptions:{pie:{donut:{labels:{show:!1}}}},dataLabels:{formatter:function(t){return t.toFixed(1)+"%"},style:{colors:["#fff"]},background:{enabled:!1},dropShadow:{enabled:!0}},stroke:{colors:["#fff"]},fill:{opacity:1,gradient:{shade:"light",stops:[0,100]}},tooltip:{theme:"dark",fillSeriesColor:!0},legend:{position:"right"},grid:{padding:{left:0,right:0,top:0,bottom:0}}}}},{key:"donut",value:function(){return{chart:{toolbar:{show:!1}},dataLabels:{formatter:function(t){return t.toFixed(1)+"%"},style:{colors:["#fff"]},background:{enabled:!1},dropShadow:{enabled:!0}},stroke:{colors:["#fff"]},fill:{opacity:1,gradient:{shade:"light",shadeIntensity:.35,stops:[80,100],opacityFrom:1,opacityTo:1}},tooltip:{theme:"dark",fillSeriesColor:!0},legend:{position:"right"},grid:{padding:{left:0,right:0,top:0,bottom:0}}}}},{key:"polarArea",value:function(){return{chart:{toolbar:{show:!1}},dataLabels:{formatter:function(t){return t.toFixed(1)+"%"},enabled:!1},stroke:{show:!0,width:2},fill:{opacity:.7},tooltip:{theme:"dark",fillSeriesColor:!0},legend:{position:"right"},grid:{padding:{left:0,right:0,top:0,bottom:0}}}}},{key:"radar",value:function(){return this.opts.yaxis[0].labels.offsetY=this.opts.yaxis[0].labels.offsetY?this.opts.yaxis[0].labels.offsetY:6,{dataLabels:{enabled:!1,style:{fontSize:"11px"}},stroke:{width:2},markers:{size:5,strokeWidth:1,strokeOpacity:1},fill:{opacity:.2},tooltip:{shared:!1,intersect:!0,followCursor:!0},grid:{show:!1,padding:{left:0,right:0,top:0,bottom:0}},xaxis:{labels:{formatter:function(t){return t},style:{colors:["#a8a8a8"],fontSize:"11px"}},tooltip:{enabled:!1},crosshairs:{show:!1}}}}},{key:"radialBar",value:function(){return{chart:{animations:{dynamicAnimation:{enabled:!0,speed:800}},toolbar:{show:!1}},fill:{gradient:{shade:"dark",shadeIntensity:.4,inverseColors:!1,type:"diagonal2",opacityFrom:1,opacityTo:1,stops:[70,98,100]}},legend:{show:!1,position:"right"},tooltip:{enabled:!1,fillSeriesColor:!0},grid:{padding:{left:0,right:0,top:0,bottom:0}}}}},{key:"_getBoxTooltip",value:function(t,e,r,i,n){var o=t.globals.seriesCandleO[e][r],a=t.globals.seriesCandleH[e][r],s=t.globals.seriesCandleM[e][r],l=t.globals.seriesCandleL[e][r],c=t.globals.seriesCandleC[e][r];return t.config.series[e].type&&t.config.series[e].type!==n?'
\n '.concat(t.config.series[e].name?t.config.series[e].name:"series-"+(e+1),": ").concat(t.globals.series[e][r],"\n
"):'
')+"
".concat(i[0],': ')+o+"
"+"
".concat(i[1],': ')+a+"
"+(s?"
".concat(i[2],': ')+s+"
":"")+"
".concat(i[3],': ')+l+"
"+"
".concat(i[4],': ')+c+"
"}}])&&ku(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function ju(t){return ju="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ju(t)}function Tu(t,e){for(var r=0;r1&&n.length!==t.yaxis.length&&console.warn("A multi-series logarithmic chart should have equal number of series and y-axes"),t}},{key:"extendAnnotations",value:function(t){return void 0===t.annotations&&(t.annotations={},t.annotations.yaxis=[],t.annotations.xaxis=[],t.annotations.points=[]),t=this.extendYAxisAnnotations(t),t=this.extendXAxisAnnotations(t),this.extendPointAnnotations(t)}},{key:"extendYAxisAnnotations",value:function(t){var e=new pu;return t.annotations.yaxis=f.extendArray(void 0!==t.annotations.yaxis?t.annotations.yaxis:[],e.yAxisAnnotation),t}},{key:"extendXAxisAnnotations",value:function(t){var e=new pu;return t.annotations.xaxis=f.extendArray(void 0!==t.annotations.xaxis?t.annotations.xaxis:[],e.xAxisAnnotation),t}},{key:"extendPointAnnotations",value:function(t){var e=new pu;return t.annotations.points=f.extendArray(void 0!==t.annotations.points?t.annotations.points:[],e.pointAnnotation),t}},{key:"checkForDarkTheme",value:function(t){t.theme&&"dark"===t.theme.mode&&(t.tooltip||(t.tooltip={}),"light"!==t.tooltip.theme&&(t.tooltip.theme="dark"),t.chart.foreColor||(t.chart.foreColor="#f6f7f8"),t.theme.palette||(t.theme.palette="palette4"))}},{key:"handleUserInputErrors",value:function(t){var e=t;if(e.tooltip.shared&&e.tooltip.intersect)throw new Error("tooltip.shared cannot be enabled when tooltip.intersect is true. Turn off any other option by setting it to false.");if("bar"===e.chart.type&&e.plotOptions.bar.horizontal){if(e.yaxis.length>1)throw new Error("Multiple Y Axis for bars are not supported. Switch to column chart by setting plotOptions.bar.horizontal=false");e.yaxis[0].reversed&&(e.yaxis[0].opposite=!0),e.xaxis.tooltip.enabled=!1,e.yaxis[0].tooltip.enabled=!1,e.chart.zoom.enabled=!1}return"bar"!==e.chart.type&&"rangeBar"!==e.chart.type||e.tooltip.shared&&"barWidth"===e.xaxis.crosshairs.width&&e.series.length>1&&(e.xaxis.crosshairs.width="tickWidth"),"candlestick"!==e.chart.type&&"boxPlot"!==e.chart.type||e.yaxis[0].reversed&&(console.warn("Reversed y-axis in ".concat(e.chart.type," chart is not supported.")),e.yaxis[0].reversed=!1),e}}],r&&Tu(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Lu(t){return Lu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lu(t)}function Iu(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,i=Array(e);rn?i:n,a=t.image,s=0,l=0;void 0===t.width&&void 0===t.height?void 0!==r.fill.image.width&&void 0!==r.fill.image.height?(s=r.fill.image.width+1,l=r.fill.image.height):(s=o+1,l=o):(s=t.width,l=t.height);var c=document.createElementNS(e.globals.SVGNS,"pattern");Pc.setAttrs(c,{id:t.patternID,patternUnits:t.patternUnits?t.patternUnits:"userSpaceOnUse",width:s+"px",height:l+"px"});var u=document.createElementNS(e.globals.SVGNS,"image");c.appendChild(u),u.setAttributeNS(window.SVG.xlink,"href",a),Pc.setAttrs(u,{x:0,y:0,preserveAspectRatio:"none",width:s+"px",height:l+"px"}),u.style.opacity=t.opacity,e.globals.dom.elDefs.node.appendChild(c)}},{key:"getSeriesIndex",value:function(t){var e=this.w,r=e.config.chart.type;return("bar"===r||"rangeBar"===r)&&e.config.plotOptions.bar.distributed||"heatmap"===r||"treemap"===r?this.seriesIndex=t.seriesNumber:this.seriesIndex=t.seriesNumber%e.globals.series.length,this.seriesIndex}},{key:"computeColorStops",value:function(t,e){var r,i=this.w,n=null,o=null,a=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=Wu(t))){e&&(t=e);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,o=!0,a=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return o=t.done,t},e:function(t){a=!0,n=t},f:function(){try{o||null==e.return||e.return()}finally{if(a)throw n}}}}(t);try{for(a.s();!(r=a.n()).done;){var s=r.value;s>=e.threshold?(null===n||s>n)&&(n=s):(null===o||s-1?b=f.getOpacityFromRGBA(u):v=f.hexToRgba(f.rgb2hex(u),b),t.opacity&&(b=t.opacity),"pattern"===g&&(a=this.handlePatternFill({fillConfig:t.fillConfig,patternFill:a,fillColor:u,fillOpacity:b,defaultColor:v})),y){var m=function(t){return function(t){if(Array.isArray(t))return Gu(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Wu(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(l.fill.gradient.colorStops)||[],x=l.fill.gradient.type;c&&(m[this.seriesIndex]=this.computeColorStops(n.globals.series[this.seriesIndex],l.plotOptions.line.colors),x="vertical"),s=this.handleGradientFill({type:x,fillConfig:t.fillConfig,fillColor:u,fillOpacity:b,colorStops:m,i:this.seriesIndex})}if("image"===g){var w=l.fill.image.src,S=t.patternID?t.patternID:"",k="pattern".concat(n.globals.cuid).concat(t.seriesNumber+1).concat(S);-1===this.patternIDs.indexOf(k)&&(this.clippedImgArea({opacity:b,image:Array.isArray(w)?t.seriesNumber-1&&(p=f.getOpacityFromRGBA(d));var g=void 0===s.gradient.opacityTo?i:Array.isArray(s.gradient.opacityTo)?s.gradient.opacityTo[a]:s.gradient.opacityTo;if(void 0===s.gradient.gradientToColors||0===s.gradient.gradientToColors.length)h="dark"===s.gradient.shade?u.shadeColor(-1*parseFloat(s.gradient.shadeIntensity),r.indexOf("rgb")>-1?f.rgb2hex(r):r):u.shadeColor(parseFloat(s.gradient.shadeIntensity),r.indexOf("rgb")>-1?f.rgb2hex(r):r);else if(s.gradient.gradientToColors[l.seriesNumber]){var b=s.gradient.gradientToColors[l.seriesNumber];h=b,b.indexOf("rgba")>-1&&(g=f.getOpacityFromRGBA(b))}else h=r;if(s.gradient.gradientFrom&&(d=s.gradient.gradientFrom),s.gradient.gradientTo&&(h=s.gradient.gradientTo),s.gradient.inverseColors){var y=d;d=h,h=y}return d.indexOf("rgb")>-1&&(d=f.rgb2hex(d)),h.indexOf("rgb")>-1&&(h=f.rgb2hex(h)),c.drawGradient(e,d,h,p,g,l.size,s.gradient.stops,o,a)}}],r&&Vu(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();const Zu=qu;function $u(t){return $u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$u(t)}function Ju(t,e){for(var r=0;r0){if(t.globals.markers.size.length0:c.config.markers.size>0)||a||g){m||(x+=" w".concat(f.randomId()));var w=this.getMarkerConfig({cssClass:x,seriesIndex:r,dataPointIndex:v});c.config.series[u].data[v]&&(c.config.series[u].data[v].fillColor&&(w.pointFillColor=c.config.series[u].data[v].fillColor),c.config.series[u].data[v].strokeColor&&(w.pointStrokeColor=c.config.series[u].data[v].strokeColor)),void 0!==n&&(w.pSize=n),(h.x[b]<-c.globals.markers.largestSize||h.x[b]>c.globals.gridWidth+c.globals.markers.largestSize||h.y[b]<-c.globals.markers.largestSize||h.y[b]>c.globals.gridHeight+c.globals.markers.largestSize)&&(w.pSize=0),m||((c.globals.markers.size[r]>0||a||g)&&!d&&(d=p.group({class:a||g?"":"apexcharts-series-markers"})).attr("clip-path","url(#gridRectMarkerMask".concat(c.globals.cuid,")")),(y=p.drawMarker(h.x[b],h.y[b],w)).attr("rel",v),y.attr("j",v),y.attr("index",r),y.node.setAttribute("default-marker-size",w.pSize),new vc(this.ctx).setSelectionFilter(y,r,v),this.addEvents(y),d&&d.add(y))}else void 0===c.globals.pointsArray[r]&&(c.globals.pointsArray[r]=[]),c.globals.pointsArray[r].push([h.x[b],h.y[b]])}return d}},{key:"getMarkerConfig",value:function(t){var e=t.cssClass,r=t.seriesIndex,i=t.dataPointIndex,n=void 0===i?null:i,o=t.radius,a=void 0===o?null:o,s=t.size,l=void 0===s?null:s,c=t.strokeWidth,u=void 0===c?null:c,h=this.w,f=this.getMarkerStyle(r),d=null===l?h.globals.markers.size[r]:l,p=h.config.markers;return null!==n&&p.discrete.length&&p.discrete.map((function(t){t.seriesIndex===r&&t.dataPointIndex===n&&(f.pointStrokeColor=t.strokeColor,f.pointFillColor=t.fillColor,d=t.size,f.pointShape=t.shape)})),{pSize:null===a?d:a,pRadius:null!==a?a:p.radius,pointStrokeWidth:null!==u?u:Array.isArray(p.strokeWidth)?p.strokeWidth[r]:p.strokeWidth,pointStrokeColor:f.pointStrokeColor,pointFillColor:f.pointFillColor,shape:f.pointShape||(Array.isArray(p.shape)?p.shape[r]:p.shape),class:e,pointStrokeOpacity:Array.isArray(p.strokeOpacity)?p.strokeOpacity[r]:p.strokeOpacity,pointStrokeDashArray:Array.isArray(p.strokeDashArray)?p.strokeDashArray[r]:p.strokeDashArray,pointFillOpacity:Array.isArray(p.fillOpacity)?p.fillOpacity[r]:p.fillOpacity,seriesIndex:r}}},{key:"addEvents",value:function(t){var e=this.w,r=new Pc(this.ctx);t.node.addEventListener("mouseenter",r.pathMouseEnter.bind(this.ctx,t)),t.node.addEventListener("mouseleave",r.pathMouseLeave.bind(this.ctx,t)),t.node.addEventListener("mousedown",r.pathMouseDown.bind(this.ctx,t)),t.node.addEventListener("click",e.config.markers.onClick),t.node.addEventListener("dblclick",e.config.markers.onDblClick),t.node.addEventListener("touchstart",r.pathMouseDown.bind(this.ctx,t),{passive:!0})}},{key:"getMarkerStyle",value:function(t){var e=this.w,r=e.globals.markers.colors,i=e.config.markers.strokeColor||e.config.markers.strokeColors;return{pointStrokeColor:Array.isArray(i)?i[t]:i,pointFillColor:Array.isArray(r)?r[t]:r}}}],r&&Ju(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function th(t){return th="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},th(t)}function eh(t,e){for(var r=0;rp.maxBubbleRadius&&(d=p.maxBubbleRadius)}var g=a.x[u],b=a.y[u];if(d=d||0,null!==b&&void 0!==i.globals.series[o][h]||(f=!1),f){var y=this.drawPoint(g,b,d,o,h,e);c.add(y)}l.add(c)}}},{key:"drawPoint",value:function(t,e,r,i,n,o){var a=this.w,s=i,l=new b(this.ctx),c=new vc(this.ctx),u=new Zu(this.ctx),h=new Ku(this.ctx),f=new Pc(this.ctx),d=h.getMarkerConfig({cssClass:"apexcharts-marker",seriesIndex:s,dataPointIndex:n,radius:"bubble"===a.config.chart.type||a.globals.comboCharts&&a.config.series[i]&&"bubble"===a.config.series[i].type?r:null}),p=u.fillPath({seriesNumber:i,dataPointIndex:n,color:d.pointFillColor,patternUnits:"objectBoundingBox",value:a.globals.series[i][o]}),g=f.drawMarker(t,e,d);if(a.config.series[s].data[n]&&a.config.series[s].data[n].fillColor&&(p=a.config.series[s].data[n].fillColor),g.attr({fill:p}),a.config.chart.dropShadow.enabled){var y=a.config.chart.dropShadow;c.dropShadow(g,y,i)}if(!this.initialAnim||a.globals.dataChanged||a.globals.resized)a.globals.animationEnded=!0;else{var v=a.config.chart.animations.speed;l.animateMarker(g,v,a.globals.easing,(function(){window.setTimeout((function(){l.animationCompleted(g)}),100)}))}return g.attr({rel:n,j:n,index:i,"default-marker-size":d.pSize}),c.setSelectionFilter(g,i,n),h.addEvents(g),g.node.classList.add("apexcharts-marker"),g}},{key:"centerTextInBubble",value:function(t){var e=this.w;return{y:t+=parseInt(e.config.dataLabels.style.fontSize,10)/4}}}],r&&eh(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function nh(t){return nh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nh(t)}function oh(t,e){for(var r=0;rs.globals.gridHeight+h&&(e=s.globals.gridHeight+h/2),void 0===s.globals.dataLabelsRects[i]&&(s.globals.dataLabelsRects[i]=[]),s.globals.dataLabelsRects[i].push({x:t,y:e,width:u,height:h});var f=s.globals.dataLabelsRects[i].length-2,d=void 0!==s.globals.lastDrawnDataLabelsIndexes[i]?s.globals.lastDrawnDataLabelsIndexes[i][s.globals.lastDrawnDataLabelsIndexes[i].length-1]:0;if(void 0!==s.globals.dataLabelsRects[i][f]){var p=s.globals.dataLabelsRects[i][d];(t>p.x+p.width||e>p.y+p.height||e+he.globals.gridWidth+y.textRects.width+30)&&(s="");var v=e.globals.dataLabels.style.colors[o];(("bar"===e.config.chart.type||"rangeBar"===e.config.chart.type)&&e.config.plotOptions.bar.distributed||e.config.dataLabels.distributed)&&(v=e.globals.dataLabels.style.colors[a]),"function"==typeof v&&(v=v({series:e.globals.series,seriesIndex:o,dataPointIndex:a,w:e})),f&&(v=f);var m=h.offsetX,x=h.offsetY;if("bar"!==e.config.chart.type&&"rangeBar"!==e.config.chart.type||(m=0,x=0),e.globals.isSlopeChart&&(0!==a&&(m=-2*h.offsetX+5),0!==a&&a!==e.config.series[o].data.length-1&&(m=0)),y.drawnextLabel){if((b=r.drawText({width:100,height:parseInt(h.style.fontSize,10),x:i+m,y:n+x,foreColor:v,textAnchor:l||h.textAnchor,text:s,fontSize:c||h.style.fontSize,fontFamily:h.style.fontFamily,fontWeight:h.style.fontWeight||"normal"})).attr({class:g||"apexcharts-datalabel",cx:i,cy:n}),h.dropShadow.enabled){var w=h.dropShadow;new vc(this.ctx).dropShadow(b,w)}u.add(b),void 0===e.globals.lastDrawnDataLabelsIndexes[o]&&(e.globals.lastDrawnDataLabelsIndexes[o]=[]),e.globals.lastDrawnDataLabelsIndexes[o].push(a)}return b}},{key:"addBackgroundToDataLabel",value:function(t,e){var r=this.w,i=r.config.dataLabels.background,n=i.padding,o=i.padding/2,a=e.width,s=e.height,l=new Pc(this.ctx).drawRect(e.x-n,e.y-o/2,a+2*n,s+o,i.borderRadius,"transparent"!==r.config.chart.background&&r.config.chart.background?r.config.chart.background:"#fff",i.opacity,i.borderWidth,i.borderColor);return i.dropShadow.enabled&&new vc(this.ctx).dropShadow(l,i.dropShadow),l}},{key:"dataLabelsBackground",value:function(){var t=this.w;if("bubble"!==t.config.chart.type)for(var e=t.globals.dom.baseEl.querySelectorAll(".apexcharts-datalabels text"),r=0;r0&&void 0!==arguments[0])||arguments[0],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=this.w,n=f.clone(i.globals.initialSeries);i.globals.previousPaths=[],r?(i.globals.collapsedSeries=[],i.globals.ancillaryCollapsedSeries=[],i.globals.collapsedSeriesIndices=[],i.globals.ancillaryCollapsedSeriesIndices=[]):n=this.emptyCollapsedSeries(n),i.config.series=n,t&&(e&&(i.globals.zoomed=!1,this.ctx.updateHelpers.revertDefaultAxisMinMax()),this.ctx.updateHelpers._updateSeries(n,i.config.chart.animations.dynamicAnimation.enabled))}},{key:"emptyCollapsedSeries",value:function(t){for(var e=this.w,r=0;r-1&&(t[r].data=[]);return t}},{key:"highlightSeries",value:function(t){var e=this.w,r=this.getSeriesByName(t),i=parseInt(null==r?void 0:r.getAttribute("data:realIndex"),10),n=e.globals.dom.baseEl.querySelectorAll(".apexcharts-series, .apexcharts-datalabels, .apexcharts-yaxis"),o=null,a=null,s=null;if(e.globals.axisCharts||"radialBar"===e.config.chart.type)if(e.globals.axisCharts){o=e.globals.dom.baseEl.querySelector(".apexcharts-series[data\\:realIndex='".concat(i,"']")),a=e.globals.dom.baseEl.querySelector(".apexcharts-datalabels[data\\:realIndex='".concat(i,"']"));var l=e.globals.seriesYAxisReverseMap[i];s=e.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(l,"']"))}else o=e.globals.dom.baseEl.querySelector(".apexcharts-series[rel='".concat(i+1,"']"));else o=e.globals.dom.baseEl.querySelector(".apexcharts-series[rel='".concat(i+1,"'] path"));for(var c=0;c=t.from&&(o0&&void 0!==arguments[0]?arguments[0]:"asc",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=this.w,i=0;if(r.config.series.length>1)for(var n=r.config.series.map((function(t,i){return t.data&&t.data.length>0&&-1===r.globals.collapsedSeriesIndices.indexOf(i)&&(!r.globals.comboCharts||0===e.length||e.length&&e.indexOf(r.config.series[i].type)>-1)?i:-1})),o="asc"===t?0:n.length-1;"asc"===t?o=0;"asc"===t?o++:o--)if(-1!==n[o]){i=n[o];break}return i}},{key:"getBarSeriesIndices",value:function(){return this.w.globals.comboCharts?this.w.config.series.map((function(t,e){return"bar"===t.type||"column"===t.type?e:-1})).filter((function(t){return-1!==t})):this.w.config.series.map((function(t,e){return e}))}},{key:"getPreviousPaths",value:function(){var t=this.w;function e(e,r,i){for(var n=e[r].childNodes,o={type:i,paths:[],realIndex:e[r].getAttribute("data:realIndex")},a=0;a0)for(var i=function(e){for(var r=t.globals.dom.baseEl.querySelectorAll(".apexcharts-".concat(t.config.chart.type," .apexcharts-series[data\\:realIndex='").concat(e,"'] rect")),i=[],n=function(t){var e=function(e){return r[t].getAttribute(e)},n={x:parseFloat(e("x")),y:parseFloat(e("y")),width:parseFloat(e("width")),height:parseFloat(e("height"))};i.push({rect:n,color:r[t].getAttribute("color")})},o=0;o0?t:[]}))}}],r&&uh(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function dh(t){return dh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dh(t)}function ph(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r0&&null!==t[this.activeSeriesIndex].data[0]&&void 0!==t[this.activeSeriesIndex].data[0].x&&null!==t[this.activeSeriesIndex].data[0])return!0}},{key:"isFormat2DArray",value:function(){var t=this.w.config.series.slice(),e=new fh(this.ctx);if(this.activeSeriesIndex=e.getActiveConfigSeriesIndex(),void 0!==t[this.activeSeriesIndex].data&&t[this.activeSeriesIndex].data.length>0&&void 0!==t[this.activeSeriesIndex].data[0]&&null!==t[this.activeSeriesIndex].data[0]&&t[this.activeSeriesIndex].data[0].constructor===Array)return!0}},{key:"handleFormat2DArray",value:function(t,e){for(var r=this.w.config,i=this.w.globals,n="boxPlot"===r.chart.type||"boxPlot"===r.series[e].type,o=0;o=5?this.twoDSeries.push(f.parseNumber(t[e].data[o][4])):this.twoDSeries.push(f.parseNumber(t[e].data[o][1])),i.dataFormatXNumeric=!0),"datetime"===r.xaxis.type){var a=new Date(t[e].data[o][0]);a=new Date(a).getTime(),this.twoDSeriesX.push(a)}else this.twoDSeriesX.push(t[e].data[o][0]);for(var s=0;s-1&&(o=this.activeSeriesIndex);for(var a=0;a1&&void 0!==arguments[1]?arguments[1]:this.ctx,i=this.w.config,n=this.w.globals,o=new Vc(r),a=i.labels.length>0?i.labels.slice():i.xaxis.categories.slice();n.isRangeBar="rangeBar"===i.chart.type&&n.isBarHorizontal,n.hasXaxisGroups="category"===i.xaxis.type&&i.xaxis.group.groups.length>0,n.hasXaxisGroups&&(n.groups=i.xaxis.group.groups),t.forEach((function(t,e){void 0!==t.name?n.seriesNames.push(t.name):n.seriesNames.push("series-"+parseInt(e+1,10))})),this.coreUtils.setSeriesYAxisMappings();var s=[],l=function(t){return function(t){if(Array.isArray(t))return ph(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return ph(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ph(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(new Set(i.series.map((function(t){return t.group}))));i.series.forEach((function(t,e){var r=l.indexOf(t.group);s[r]||(s[r]=[]),s[r].push(n.seriesNames[e])})),n.seriesGroups=s;for(var c=function(){for(var t=0;t0&&(this.twoDSeriesX=a,n.seriesX.push(this.twoDSeriesX))),n.labels.push(this.twoDSeriesX);var h=t[u].data.map((function(t){return f.parseNumber(t)}));n.series.push(h)}n.seriesZ.push(this.threeDSeries),void 0!==t[u].color?n.seriesColors.push(t[u].color):n.seriesColors.push(void 0)}return this.w}},{key:"parseDataNonAxisCharts",value:function(t){var e=this.w.globals,r=this.w.config;e.series=t.slice(),e.seriesNames=r.labels.slice();for(var i=0;i0?r.labels=e.xaxis.categories:e.labels.length>0?r.labels=e.labels.slice():this.fallbackToCategory?(r.labels=r.labels[0],r.seriesRange.length&&(r.seriesRange.map((function(t){t.forEach((function(t){r.labels.indexOf(t.x)<0&&t.x&&r.labels.push(t.x)}))})),r.labels=Array.from(new Set(r.labels.map(JSON.stringify)),JSON.parse)),e.xaxis.convertedCatToNumeric&&(new Cu(e).convertCatToNumericXaxis(e,this.ctx,r.seriesX[0]),this._generateExternalLabels(t))):this._generateExternalLabels(t)}},{key:"_generateExternalLabels",value:function(t){var e=this.w.globals,r=this.w.config,i=[];if(e.axisCharts){if(e.series.length>0)if(this.isFormatXY())for(var n=r.series.map((function(t,e){return t.data.filter((function(t,e,r){return r.findIndex((function(e){return e.x===t.x}))===e}))})),o=n.reduce((function(t,e,r,i){return i[t].length>e.length?t:r}),0),a=0;a0&&n==r.length&&e.push(i)})),t.globals.ignoreYAxisIndexes=e.map((function(t){return t}))}}],r&&gh(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function vh(t){return vh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vh(t)}function mh(t){return function(t){if(Array.isArray(t))return xh(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return xh(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?xh(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function xh(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r\n \n
\n \n ').concat(l,"\n
\n
\n \n "),u=e.svgStringToNode(c);1!==n&&e.scaleSvgNode(u,n),e.convertImagesToBase64(u).then((function(){c=(new XMLSerializer).serializeToString(u),r(c.replace(/ /g," "))}))}))}},{key:"convertImagesToBase64",value:function(t){var e=this,r=t.getElementsByTagName("image"),i=Array.from(r).map((function(t){var r=t.getAttributeNS("http://www.w3.org/1999/xlink","href");return r&&!r.startsWith("data:")?e.getBase64FromUrl(r).then((function(e){t.setAttributeNS("http://www.w3.org/1999/xlink","href",e)})).catch((function(t){console.error("Error converting image to base64:",t)})):Promise.resolve()}));return Promise.all(i)}},{key:"getBase64FromUrl",value:function(t){return new Promise((function(e,r){var i=new Image;i.crossOrigin="Anonymous",i.onload=function(){var t=document.createElement("canvas");t.width=i.width,t.height=i.height,t.getContext("2d").drawImage(i,0,0),e(t.toDataURL())},i.onerror=r,i.src=t}))}},{key:"svgUrl",value:function(){var t=this;return new Promise((function(e){t.getSvgString().then((function(t){var r=new Blob([t],{type:"image/svg+xml;charset=utf-8"});e(URL.createObjectURL(r))}))}))}},{key:"dataURI",value:function(t){var e=this;return new Promise((function(r){var i=e.w,n=t?t.scale||t.width/i.globals.svgWidth:1,o=document.createElement("canvas");o.width=i.globals.svgWidth*n,o.height=parseInt(i.globals.dom.elWrap.style.height,10)*n;var a="transparent"!==i.config.chart.background&&i.config.chart.background?i.config.chart.background:"#fff",s=o.getContext("2d");s.fillStyle=a,s.fillRect(0,0,o.width*n,o.height*n),e.getSvgString(n).then((function(t){var e="data:image/svg+xml,"+encodeURIComponent(t),i=new Image;i.crossOrigin="anonymous",i.onload=function(){if(s.drawImage(i,0,0),o.msToBlob){var t=o.msToBlob();r({blob:t})}else{var e=o.toDataURL("image/png");r({imgURI:e})}},i.src=e}))}))}},{key:"exportToSVG",value:function(){var t=this;this.svgUrl().then((function(e){t.triggerDownload(e,t.w.config.chart.toolbar.export.svg.filename,".svg")}))}},{key:"exportToPng",value:function(){var t=this,e=this.w.config.chart.toolbar.export.scale,r=this.w.config.chart.toolbar.export.width,i=e?{scale:e}:r?{width:r}:void 0;this.dataURI(i).then((function(e){var r=e.imgURI,i=e.blob;i?navigator.msSaveOrOpenBlob(i,t.w.globals.chartID+".png"):t.triggerDownload(r,t.w.config.chart.toolbar.export.png.filename,".png")}))}},{key:"exportToCSV",value:function(t){var e=this,r=t.series,i=t.fileName,n=t.columnDelimiter,o=void 0===n?",":n,a=t.lineDelimiter,s=void 0===a?"\n":a,l=this.w;r||(r=l.config.series);var c,u,h=[],d=[],p="",g=l.globals.series.map((function(t,e){return-1===l.globals.collapsedSeriesIndices.indexOf(e)?t:[]})),b=function(t){return"function"==typeof l.config.chart.toolbar.export.csv.categoryFormatter?l.config.chart.toolbar.export.csv.categoryFormatter(t):"datetime"===l.config.xaxis.type&&String(t).length>=10?new Date(t).toDateString():f.isNumber(t)?t:t.split(o).join("")},y=function(t){return"function"==typeof l.config.chart.toolbar.export.csv.valueFormatter?l.config.chart.toolbar.export.csv.valueFormatter(t):t},v=Math.max.apply(Math,mh(r.map((function(t){return t.data?t.data.length:0})))),m=new yh(this.ctx),x=new eu(this.ctx),w=function(t){var r="";if(l.globals.axisCharts){if("category"===l.config.xaxis.type||l.config.xaxis.convertedCatToNumeric)if(l.globals.isBarHorizontal){var i=l.globals.yLabelFormatters[0],n=new fh(e.ctx).getActiveConfigSeriesIndex();r=i(l.globals.labels[t],{seriesIndex:n,dataPointIndex:t,w:l})}else r=x.getLabel(l.globals.labels,l.globals.timescaleLabels,0,t).text;"datetime"===l.config.xaxis.type&&(l.config.xaxis.categories.length?r=l.config.xaxis.categories[t]:l.config.labels.length&&(r=l.config.labels[t]))}else r=l.config.labels[t];return null===r?"nullvalue":(Array.isArray(r)&&(r=r.join(" ")),f.isNumber(r)?r:r.split(o).join(""))};h.push(l.config.chart.toolbar.export.csv.headerCategory),"boxPlot"===l.config.chart.type?(h.push("minimum"),h.push("q1"),h.push("median"),h.push("q3"),h.push("maximum")):"candlestick"===l.config.chart.type?(h.push("open"),h.push("high"),h.push("low"),h.push("close")):"rangeBar"===l.config.chart.type?(h.push("minimum"),h.push("maximum")):r.map((function(t,e){var r=(t.name?t.name:"series-".concat(e))+"";l.globals.axisCharts&&h.push(r.split(o).join("")?r.split(o).join(""):"series-".concat(e))})),l.globals.axisCharts||(h.push(l.config.chart.toolbar.export.csv.headerValue),d.push(h.join(o))),l.globals.allSeriesHasEqualX||!l.globals.axisCharts||l.config.xaxis.categories.length||l.config.labels.length?r.map((function(t,e){l.globals.axisCharts?function(t,e){if(h.length&&0===e&&d.push(h.join(o)),t.data){t.data=t.data.length&&t.data||mh(Array(v)).map((function(){return""}));for(var i=0;i0&&!i.globals.isBarHorizontal&&(this.xaxisLabels=i.globals.timescaleLabels.slice()),i.config.xaxis.overwriteCategories&&(this.xaxisLabels=i.config.xaxis.overwriteCategories),this.drawnLabels=[],this.drawnLabelsRects=[],"top"===i.config.xaxis.position?this.offY=0:this.offY=i.globals.gridHeight,this.offY=this.offY+i.config.xaxis.axisBorder.offsetY,this.isCategoryBarHorizontal="bar"===i.config.chart.type&&i.config.plotOptions.bar.horizontal,this.xaxisFontSize=i.config.xaxis.labels.style.fontSize,this.xaxisFontFamily=i.config.xaxis.labels.style.fontFamily,this.xaxisForeColors=i.config.xaxis.labels.style.colors,this.xaxisBorderWidth=i.config.xaxis.axisBorder.width,this.isCategoryBarHorizontal&&(this.xaxisBorderWidth=i.config.yaxis[0].axisBorder.width.toString()),this.xaxisBorderWidth.indexOf("%")>-1?this.xaxisBorderWidth=i.globals.gridWidth*parseInt(this.xaxisBorderWidth,10)/100:this.xaxisBorderWidth=parseInt(this.xaxisBorderWidth,10),this.xaxisBorderHeight=i.config.xaxis.axisBorder.height,this.yaxis=i.config.yaxis[0]}var e,r;return e=t,r=[{key:"drawXaxis",value:function(){var t=this.w,e=new Pc(this.ctx),r=e.group({class:"apexcharts-xaxis",transform:"translate(".concat(t.config.xaxis.offsetX,", ").concat(t.config.xaxis.offsetY,")")}),i=e.group({class:"apexcharts-xaxis-texts-g",transform:"translate(".concat(t.globals.translateXAxisX,", ").concat(t.globals.translateXAxisY,")")});r.add(i);for(var n=[],o=0;o6&&void 0!==arguments[6]?arguments[6]:{},c=[],u=[],h=this.w,f=l.xaxisFontSize||this.xaxisFontSize,d=l.xaxisFontFamily||this.xaxisFontFamily,p=l.xaxisForeColors||this.xaxisForeColors,g=l.fontWeight||h.config.xaxis.labels.style.fontWeight,b=l.cssClass||h.config.xaxis.labels.style.cssClass,y=h.globals.padHorizontal,v=i.length,m="category"===h.config.xaxis.type?h.globals.dataPoints:v;if(0===m&&v>m&&(m=v),n){var x=Math.max(Number(h.config.xaxis.tickAmount)||1,m>1?m-1:m);a=h.globals.gridWidth/Math.min(x,v-1),y=y+o(0,a)/2+h.config.xaxis.labels.offsetX}else a=h.globals.gridWidth/m,y=y+o(0,a)+h.config.xaxis.labels.offsetX;for(var w=function(n){var l=y-o(n,a)/2+h.config.xaxis.labels.offsetX;0===n&&1===v&&a/2===y&&1===m&&(l=h.globals.gridWidth/2);var x=s.axesUtils.getLabel(i,h.globals.timescaleLabels,l,n,c,f,t),w=28;if(h.globals.rotateXLabels&&t&&(w=22),h.config.xaxis.title.text&&"top"===h.config.xaxis.position&&(w+=parseFloat(h.config.xaxis.title.style.fontSize)+2),t||(w=w+parseFloat(f)+(h.globals.xAxisLabelsHeight-h.globals.xAxisGroupLabelsHeight)+(h.globals.rotateXLabels?10:0)),x=void 0!==h.config.xaxis.tickAmount&&"dataPoints"!==h.config.xaxis.tickAmount&&"datetime"!==h.config.xaxis.type?s.axesUtils.checkLabelBasedOnTickamount(n,x,v):s.axesUtils.checkForOverflowingLabels(n,x,v,c,u),h.config.xaxis.labels.show){var S=e.drawText({x:x.x,y:s.offY+h.config.xaxis.labels.offsetY+w-("top"===h.config.xaxis.position?h.globals.xAxisHeight+h.config.xaxis.axisTicks.height-2:0),text:x.text,textAnchor:"middle",fontWeight:x.isBold?600:g,fontSize:f,fontFamily:d,foreColor:Array.isArray(p)?t&&h.config.xaxis.convertedCatToNumeric?p[h.globals.minX+n-1]:p[n]:p,isPlainText:!1,cssClass:(t?"apexcharts-xaxis-label ":"apexcharts-xaxis-group-label ")+b});if(r.add(S),S.on("click",(function(t){if("function"==typeof h.config.chart.events.xAxisLabelClick){var e=Object.assign({},h,{labelIndex:n});h.config.chart.events.xAxisLabelClick(t,s.ctx,e)}})),t){var k=document.createElementNS(h.globals.SVGNS,"title");k.textContent=Array.isArray(x.text)?x.text.join(" "):x.text,S.node.appendChild(k),""!==x.text&&(c.push(x.text),u.push(x))}}ni.globals.gridWidth)){var o=this.offY+i.config.xaxis.axisTicks.offsetY;if(e=e+o+i.config.xaxis.axisTicks.height,"top"===i.config.xaxis.position&&(e=o-i.config.xaxis.axisTicks.height),i.config.xaxis.axisTicks.show){var a=new Pc(this.ctx).drawLine(t+i.config.xaxis.axisTicks.offsetX,o+i.config.xaxis.offsetY,n+i.config.xaxis.axisTicks.offsetX,e+i.config.xaxis.offsetY,i.config.xaxis.axisTicks.color);r.add(a),a.node.classList.add("apexcharts-xaxis-tick")}}}},{key:"getXAxisTicksPositions",value:function(){var t=this.w,e=[],r=this.xaxisLabels.length,i=t.globals.padHorizontal;if(t.globals.timescaleLabels.length>0)for(var n=0;n0){var c=n[n.length-1].getBBox(),u=n[0].getBBox();c.x<-20&&n[n.length-1].parentNode.removeChild(n[n.length-1]),u.x+u.width>t.globals.gridWidth&&!t.globals.isBarHorizontal&&n[0].parentNode.removeChild(n[0]);for(var h=0;ht.length)&&(e=t.length);for(var r=0,i=Array(e);r0&&(this.xaxisLabels=r.globals.timescaleLabels.slice())}var e,r;return e=t,r=[{key:"drawGridArea",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=this.w,r=new Pc(this.ctx);t||(t=r.group({class:"apexcharts-grid"}));var i=r.drawLine(e.globals.padHorizontal,1,e.globals.padHorizontal,e.globals.gridHeight,"transparent"),n=r.drawLine(e.globals.padHorizontal,e.globals.gridHeight,e.globals.gridWidth,e.globals.gridHeight,"transparent");return t.add(n),t.add(i),t}},{key:"drawGrid",value:function(){if(this.w.globals.axisCharts){var t=this.renderGrid();return this.drawGridArea(t.el),t}return null}},{key:"createGridMask",value:function(){var t=this.w,e=t.globals,r=new Pc(this.ctx),i=Array.isArray(t.config.stroke.width)?Math.max.apply(Math,function(t){return function(t){if(Array.isArray(t))return Eh(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Eh(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Eh(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t.config.stroke.width)):t.config.stroke.width,n=function(t){var r=document.createElementNS(e.SVGNS,"clipPath");return r.setAttribute("id",t),r};e.dom.elGridRectMask=n("gridRectMask".concat(e.cuid)),e.dom.elGridRectBarMask=n("gridRectBarMask".concat(e.cuid)),e.dom.elGridRectMarkerMask=n("gridRectMarkerMask".concat(e.cuid)),e.dom.elForecastMask=n("forecastMask".concat(e.cuid)),e.dom.elNonForecastMask=n("nonForecastMask".concat(e.cuid));var o=0,a=0;(["bar","rangeBar","candlestick","boxPlot"].includes(t.config.chart.type)||t.globals.comboBarCount>0)&&t.globals.isXNumeric&&!t.globals.isBarHorizontal&&(o=Math.max(t.config.grid.padding.left,e.barPadForNumericAxis),a=Math.max(t.config.grid.padding.right,e.barPadForNumericAxis)),e.dom.elGridRect=r.drawRect(-i/2-2,-i/2-2,e.gridWidth+i+4,e.gridHeight+i+4,0,"#fff"),e.dom.elGridRectBar=r.drawRect(-i/2-o-2,-i/2-2,e.gridWidth+i+a+o+4,e.gridHeight+i+4,0,"#fff");var s=t.globals.markers.largestSize;e.dom.elGridRectMarker=r.drawRect(-s,-s,e.gridWidth+2*s,e.gridHeight+2*s,0,"#fff"),e.dom.elGridRectMask.appendChild(e.dom.elGridRect.node),e.dom.elGridRectBarMask.appendChild(e.dom.elGridRectBar.node),e.dom.elGridRectMarkerMask.appendChild(e.dom.elGridRectMarker.node);var l=e.dom.baseEl.querySelector("defs");l.appendChild(e.dom.elGridRectMask),l.appendChild(e.dom.elGridRectBarMask),l.appendChild(e.dom.elGridRectMarkerMask),l.appendChild(e.dom.elForecastMask),l.appendChild(e.dom.elNonForecastMask)}},{key:"_drawGridLines",value:function(t){var e=t.i,r=t.x1,i=t.y1,n=t.x2,o=t.y2,a=t.xCount,s=t.parent,l=this.w;if(!(0===e&&l.globals.skipFirstTimelinelabel||e===a-1&&l.globals.skipLastTimelinelabel&&!l.config.xaxis.labels.formatter||"radar"===l.config.chart.type)){l.config.grid.xaxis.lines.show&&this._drawGridLine({i:e,x1:r,y1:i,x2:n,y2:o,xCount:a,parent:s});var c=0;if(l.globals.hasXaxisGroups&&"between"===l.config.xaxis.tickPlacement){var u=l.globals.groups;if(u){for(var h=0,f=0;h0&&"datetime"!==t.config.xaxis.type&&(n=e.yAxisScale[i].result.length-1)),this._drawXYLines({xCount:n,tickAmount:l})):(n=l,l=e.xTickAmount,this._drawInvertedXYLines({xCount:n,tickAmount:l})),this.drawGridBands(n,l),{el:this.elg,elGridBorders:this.elGridBorders,xAxisTickWidth:e.gridWidth/n}}},{key:"drawGridBands",value:function(t,e){var r,i,n=this,o=this.w;if((null===(r=o.config.grid.row.colors)||void 0===r?void 0:r.length)>0&&function(t,r,i,a,s,l){for(var c=0,u=0;c=o.config.grid.row.colors.length&&(u=0),n._drawGridBandRect({c:u,x1:0,y1:a,x2:s,y2:l,type:"row"}),a+=o.globals.gridHeight/e}(0,e,0,0,o.globals.gridWidth,o.globals.gridHeight/e),(null===(i=o.config.grid.column.colors)||void 0===i?void 0:i.length)>0){var a=o.globals.isBarHorizontal||"on"!==o.config.xaxis.tickPlacement||"category"!==o.config.xaxis.type&&!o.config.xaxis.convertedCatToNumeric?t:t-1;o.globals.isXNumeric&&(a=o.globals.xAxisScale.result.length-1);for(var s=o.globals.padHorizontal,l=o.globals.padHorizontal+o.globals.gridWidth/a,c=o.globals.gridHeight,u=0,h=0;u=o.config.grid.column.colors.length&&(h=0),"datetime"===o.config.xaxis.type&&(s=this.xaxisLabels[u].position,l=((null===(f=this.xaxisLabels[u+1])||void 0===f?void 0:f.position)||o.globals.gridWidth)-this.xaxisLabels[u].position),this._drawGridBandRect({c:h,x1:s,y1:0,x2:l,y2:c,type:"column"}),s+=o.globals.gridWidth/a}}}}],r&&Mh(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();const Rh=Ih;function _h(t){return _h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_h(t)}function zh(t,e){for(var r=0;r2&&void 0!==arguments[2]?arguments[2]:0,s=1e-11,l=this.w,c=l.globals;c.isBarHorizontal?(r=l.config.xaxis,i=Math.max((c.svgWidth-100)/25,2)):(r=l.config.yaxis[a],i=Math.max((c.svgHeight-100)/15,2)),f.isNumber(i)||(i=10),n=void 0!==r.min&&null!==r.min,o=void 0!==r.max&&null!==r.min;var u=void 0!==r.stepSize&&null!==r.stepSize,h=void 0!==r.tickAmount&&null!==r.tickAmount,d=h?r.tickAmount:c.niceScaleDefaultTicks[Math.min(Math.round(i/2),c.niceScaleDefaultTicks.length-1)];if(c.isMultipleYAxis&&!h&&c.multiAxisTickAmount>0&&(d=c.multiAxisTickAmount,h=!0),d="dataPoints"===d?c.dataPoints-1:Math.abs(Math.round(d)),(t===Number.MIN_VALUE&&0===e||!f.isNumber(t)&&!f.isNumber(e)||t===Number.MIN_VALUE&&e===-Number.MAX_VALUE)&&(t=f.isNumber(r.min)?r.min:0,e=f.isNumber(r.max)?r.max:t+d,c.allSeriesCollapsed=!1),t>e){console.warn("axis.min cannot be greater than axis.max: swapping min and max");var p=e;e=t,t=p}else t===e&&(t=0===t?0:t-1,e=0===e?2:e+1);var g=[];d<1&&(d=1);var b=d,y=Math.abs(e-t);!n&&t>0&&t/y<.15&&(t=0,n=!0),!o&&e<0&&-e/y<.15&&(e=0,o=!0);var v=(y=Math.abs(e-t))/b,m=v,x=Math.floor(Math.log10(m)),w=Math.pow(10,x),S=Math.ceil(m/w);if(v=m=(S=c.niceScaleAllowedMagMsd[0===c.yValueDecimal?0:1][S])*w,c.isBarHorizontal&&r.stepSize&&"datetime"!==r.type?(v=r.stepSize,u=!0):u&&(v=r.stepSize),u&&r.forceNiceScale){var k=Math.floor(Math.log10(v));v*=Math.pow(10,x-k)}if(n&&o){var A=y/b;if(h)if(u)if(0!=f.mod(y,v)){var O=f.getGCD(v,A);v=A/O<10?O:A}else 0==f.mod(v,A)?v=A:(A=v,h=!1);else v=A;else if(u)0==f.mod(y,v)?A=v:v=A;else if(0==f.mod(y,v))A=v;else{A=y/(b=Math.ceil(y/v));var P=f.getGCD(y,v);y/Pi&&(t=e-v*d,t+=v*Math.floor((C-t)/v))}else if(n)if(h)e=t+v*b;else{var j=e;e=v*Math.ceil(e/v),Math.abs(e-t)/f.getGCD(y,v)>i&&(e=t+v*d,e+=v*Math.ceil((j-e)/v))}}else if(c.isMultipleYAxis&&h){var T=v*Math.floor(t/v),E=T+v*b;E0&&t16&&f.getPrimeFactors(b).length<2&&b++,!h&&r.forceNiceScale&&0===c.yValueDecimal&&b>y&&(b=y,v=Math.round(y/b)),b>i&&(!h&&!u||r.forceNiceScale)){var M=f.getPrimeFactors(b),L=M.length-1,I=b;t:for(var R=0;RF);return{result:g,niceMin:g[0],niceMax:g[g.length-1]}}},{key:"linearScale",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0,o=Math.abs(e-t),a=[];if(t===e)return{result:a=[t],niceMin:a[0],niceMax:a[a.length-1]};"dataPoints"===(r=this._adjustTicksForSmallRange(r,i,o))&&(r=this.w.globals.dataPoints-1),n||(n=o/r),n=Math.round(100*(n+Number.EPSILON))/100,r===Number.MAX_VALUE&&(r=5,n=1);for(var s=t;r>=0;)a.push(s),s=f.preciseAddition(s,n),r-=1;return{result:a,niceMin:a[0],niceMax:a[a.length-1]}}},{key:"logarithmicScaleNice",value:function(t,e,r){e<=0&&(e=Math.max(t,r)),t<=0&&(t=Math.min(e,r));for(var i=[],n=Math.ceil(Math.log(e)/Math.log(r)+1),o=Math.floor(Math.log(t)/Math.log(r));o5?(i.allSeriesCollapsed=!1,i.yAxisScale[t]=o.forceNiceScale?this.logarithmicScaleNice(e,r,o.logBase):this.logarithmicScale(e,r,o.logBase)):r!==-Number.MAX_VALUE&&f.isNumber(r)&&e!==Number.MAX_VALUE&&f.isNumber(e)?(i.allSeriesCollapsed=!1,i.yAxisScale[t]=this.niceScale(e,r,t)):i.yAxisScale[t]=this.niceScale(Number.MIN_VALUE,0,t)}},{key:"setXScale",value:function(t,e){var r=this.w,i=r.globals;if(Math.round(Math.abs(e-t)),e!==-Number.MAX_VALUE&&f.isNumber(e)){var n=i.xTickAmount;i.xAxisScale=this.linearScale(t,e,n,0,r.config.xaxis.stepSize)}else i.xAxisScale=this.linearScale(0,10,10);return i.xAxisScale}},{key:"scaleMultipleYAxes",value:function(){var t=this,e=this.w.config,r=this.w.globals;this.coreUtils.setSeriesYAxisMappings();var i=r.seriesYAxisMap,n=r.minYArr,o=r.maxYArr;r.allSeriesCollapsed=!0,r.barGroups=[],i.forEach((function(i,a){var s=[];i.forEach((function(t){var r,i=null===(r=e.series[t])||void 0===r?void 0:r.group;s.indexOf(i)<0&&s.push(i)})),i.length>0?function(){var l,c,u=Number.MAX_VALUE,h=-Number.MAX_VALUE,f=u,d=h;if(e.chart.stacked)!function(){var t=new Array(r.dataPoints).fill(0),n=[],o=[],p=[];s.forEach((function(){n.push(t.map((function(){return Number.MIN_VALUE}))),o.push(t.map((function(){return Number.MIN_VALUE}))),p.push(t.map((function(){return Number.MIN_VALUE})))}));for(var g=function(t){!l&&e.series[i[t]].type&&(l=e.series[i[t]].type);var u=i[t];c=e.series[u].group?e.series[u].group:"axis-".concat(a),!(r.collapsedSeriesIndices.indexOf(u)<0&&r.ancillaryCollapsedSeriesIndices.indexOf(u)<0)||(r.allSeriesCollapsed=!1,s.forEach((function(t,i){if(e.series[u].group===t)for(var a=0;a=0?o[i][a]+=s:p[i][a]+=s,n[i][a]+=s,f=Math.min(f,s),d=Math.max(d,s)}}))),"bar"!==l&&"column"!==l||r.barGroups.push(c)},b=0;bt.length)&&(e=t.length);for(var r=0,i=Array(e);r1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-Number.MAX_VALUE,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,n=this.w.config,o=this.w.globals,a=-Number.MAX_VALUE,s=Number.MIN_VALUE;null===i&&(i=t+1);var l=o.series,c=l,u=l;"candlestick"===n.chart.type?(c=o.seriesCandleL,u=o.seriesCandleH):"boxPlot"===n.chart.type?(c=o.seriesCandleO,u=o.seriesCandleC):o.isRangeData&&(c=o.seriesRangeStart,u=o.seriesRangeEnd);var h=!1;if(o.seriesX.length>=i){var d,p=null===(d=o.brushSource)||void 0===d?void 0:d.w.config.chart.brush;(n.chart.zoom.enabled&&n.chart.zoom.autoScaleYaxis||null!=p&&p.enabled&&null!=p&&p.autoScaleYaxis)&&(h=!0)}for(var g=t;gy&&o.seriesX[g][v]>n.xaxis.max;v--);}for(var m=y;m<=v&&mc[g][m]&&c[g][m]<0&&(s=c[g][m])}else o.hasNullValues=!0}"bar"!==b&&"column"!==b||(s<0&&a<0&&(a=0,r=Math.max(r,0)),s===Number.MIN_VALUE&&(s=0,e=Math.min(e,0)))}return"rangeBar"===n.chart.type&&o.seriesRangeStart.length&&o.isBarHorizontal&&(s=e),"bar"===n.chart.type&&(s<0&&a<0&&(a=0),s===Number.MIN_VALUE&&(s=0)),{minY:s,maxY:a,lowestY:e,highestY:r}}},{key:"setYRange",value:function(){var t=this.w.globals,e=this.w.config;t.maxY=-Number.MAX_VALUE,t.minY=Number.MIN_VALUE;var r,i=Number.MAX_VALUE;if(t.isMultipleYAxis){i=Number.MAX_VALUE;for(var n=0;nt.dataPoints&&0!==t.dataPoints&&(i=t.dataPoints-1);else if("dataPoints"===e.xaxis.tickAmount){if(t.series.length>1&&(i=t.series[t.maxValsInArrayIndex].length-1),t.isXNumeric){var n=Math.round(t.maxX-t.minX);n<30&&(i=n-1)}}else i=e.xaxis.tickAmount;if(t.xTickAmount=i,void 0!==e.xaxis.max&&"number"==typeof e.xaxis.max&&(t.maxX=e.xaxis.max),void 0!==e.xaxis.min&&"number"==typeof e.xaxis.min&&(t.minX=e.xaxis.min),void 0!==e.xaxis.range&&(t.minX=t.maxX-e.xaxis.range),t.minX!==Number.MAX_VALUE&&t.maxX!==-Number.MAX_VALUE)if(e.xaxis.convertedCatToNumeric&&!t.dataFormatXNumeric){for(var o=[],a=t.minX-1;a0&&(t.xAxisScale=this.scales.linearScale(1,t.labels.length,i-1,0,e.xaxis.stepSize),t.seriesX=t.labels.slice());r&&(t.labels=t.xAxisScale.result.slice())}return t.isBarHorizontal&&t.labels.length&&(t.xTickAmount=t.labels.length),this._handleSingleDataPoint(),this._getMinXDiff(),{minX:t.minX,maxX:t.maxX}}},{key:"setZRange",value:function(){var t=this.w.globals;if(t.isDataXYZ)for(var e=0;e0){var n=e-i[r-1];n>0&&(t.minXDiff=Math.min(n,t.minXDiff))}})),1!==t.dataPoints&&t.minXDiff!==Number.MAX_VALUE||(t.minXDiff=.5)}}))}},{key:"_setStackedMinMax",value:function(){var t=this,e=this.w.globals;if(e.series.length){var r=e.seriesGroups;r.length||(r=[this.w.globals.seriesNames.map((function(t){return t}))]);var i={},n={};r.forEach((function(r){i[r]=[],n[r]=[],t.w.config.series.map((function(t,i){return r.indexOf(e.seriesNames[i])>-1?i:null})).filter((function(t){return null!==t})).forEach((function(o){for(var a=0;a0?i[r][a]+=parseFloat(e.series[o][a])+1e-4:n[r][a]+=parseFloat(e.series[o][a]))}}))})),Object.entries(i).forEach((function(t){var r=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var i,n,o,a,s=[],l=!0,c=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(i=o.call(r)).done)&&(s.push(i.value),s.length!==e);l=!0);}catch(t){c=!0,n=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw n}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Hh(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Hh(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t,1)[0];i[r].forEach((function(t,o){e.maxY=Math.max(e.maxY,i[r][o]),e.minY=Math.min(e.minY,n[r][o])}))}))}}}],r&&Fh(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();const Wh=Nh;function Gh(t){return Gh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gh(t)}function Vh(t,e){for(var r=0;r=0;g--){var b=h(d[g],g,e),y=e.config.yaxis[t].labels.padding;e.config.yaxis[t].opposite&&0!==e.config.yaxis.length&&(y*=-1);var v=this.getTextAnchor(e.config.yaxis[t].labels.align,e.config.yaxis[t].opposite),m=this.axesUtils.getYAxisForeColor(i.colors,t),x=Array.isArray(m)?m[g]:m,w=f.listToArray(e.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxis[rel='".concat(t,"'] .apexcharts-yaxis-label tspan"))).map((function(t){return t.textContent})),S=r.drawText({x:y,y:p,text:w.includes(b)&&!e.config.yaxis[t].labels.showDuplicates?"":b,textAnchor:v,fontSize:n,fontFamily:o,fontWeight:a,maxWidth:e.config.yaxis[t].labels.maxWidth,foreColor:x,isPlainText:!1,cssClass:"apexcharts-yaxis-label ".concat(i.cssClass)});l.add(S),this.addTooltip(S,b),0!==e.config.yaxis[t].labels.rotate&&this.rotateLabel(r,S,firstLabel,e.config.yaxis[t].labels.rotate),p+=u}}return this.addYAxisTitle(r,s,t),this.addAxisBorder(r,s,t,c,u),s}},{key:"getTextAnchor",value:function(t,e){return"left"===t?"start":"center"===t?"middle":"right"===t?"end":e?"start":"end"}},{key:"addTooltip",value:function(t,e){var r=document.createElementNS(this.w.globals.SVGNS,"title");r.textContent=Array.isArray(e)?e.join(" "):e,t.node.appendChild(r)}},{key:"rotateLabel",value:function(t,e,r,i){var n=t.rotateAroundCenter(r.node),o=t.rotateAroundCenter(e.node);e.node.setAttribute("transform","rotate(".concat(i," ").concat(n.x," ").concat(o.y,")"))}},{key:"addYAxisTitle",value:function(t,e,r){var i=this.w;if(void 0!==i.config.yaxis[r].title.text){var n=t.group({class:"apexcharts-yaxis-title"}),o=i.config.yaxis[r].opposite?i.globals.translateYAxisX[r]:0,a=t.drawText({x:o,y:i.globals.gridHeight/2+i.globals.translateY+i.config.yaxis[r].title.offsetY,text:i.config.yaxis[r].title.text,textAnchor:"end",foreColor:i.config.yaxis[r].title.style.color,fontSize:i.config.yaxis[r].title.style.fontSize,fontWeight:i.config.yaxis[r].title.style.fontWeight,fontFamily:i.config.yaxis[r].title.style.fontFamily,cssClass:"apexcharts-yaxis-title-text ".concat(i.config.yaxis[r].title.style.cssClass)});n.add(a),e.add(n)}}},{key:"addAxisBorder",value:function(t,e,r,i,n){var o=this.w,a=o.config.yaxis[r].axisBorder,s=31+a.offsetX;if(o.config.yaxis[r].opposite&&(s=-31-a.offsetX),a.show){var l=t.drawLine(s,o.globals.translateY+a.offsetY-2,s,o.globals.gridHeight+o.globals.translateY+a.offsetY+2,a.color,0,a.width);e.add(l)}o.config.yaxis[r].axisTicks.show&&this.axesUtils.drawYAxisTicks(s,i,a,o.config.yaxis[r].axisTicks,r,n,e)}},{key:"drawYaxisInversed",value:function(t){var e=this.w,r=new Pc(this.ctx),i=r.group({class:"apexcharts-xaxis apexcharts-yaxis-inversed"}),n=r.group({class:"apexcharts-xaxis-texts-g",transform:"translate(".concat(e.globals.translateXAxisX,", ").concat(e.globals.translateXAxisY,")")});i.add(n);var o=e.globals.yAxisScale[t].result.length-1,a=e.globals.gridWidth/o+.1,s=a+e.config.xaxis.labels.offsetX,l=e.globals.xLabelFormatter,c=this.axesUtils.checkForReversedLabels(t,e.globals.yAxisScale[t].result.slice()),u=e.globals.timescaleLabels;if(u.length>0&&(this.xaxisLabels=u.slice(),o=(c=u.slice()).length),e.config.xaxis.labels.show)for(var h=u.length?0:o;u.length?h=0;u.length?h++:h--){var f=l(c[h],h,e),d=e.globals.gridWidth+e.globals.padHorizontal-(s-a+e.config.xaxis.labels.offsetX);if(u.length){var p=this.axesUtils.getLabel(c,u,d,h,this.drawnLabels,this.xaxisFontSize);d=p.x,f=p.text,this.drawnLabels.push(p.text),0===h&&e.globals.skipFirstTimelinelabel&&(f=""),h===c.length-1&&e.globals.skipLastTimelinelabel&&(f="")}var g=r.drawText({x:d,y:this.xAxisoffX+e.config.xaxis.labels.offsetY+30-("top"===e.config.xaxis.position?e.globals.xAxisHeight+e.config.xaxis.axisTicks.height-2:0),text:f,textAnchor:"middle",foreColor:Array.isArray(this.xaxisForeColors)?this.xaxisForeColors[t]:this.xaxisForeColors,fontSize:this.xaxisFontSize,fontFamily:this.xaxisFontFamily,fontWeight:e.config.xaxis.labels.style.fontWeight,isPlainText:!1,cssClass:"apexcharts-xaxis-label ".concat(e.config.xaxis.labels.style.cssClass)});n.add(g),g.tspan(f),this.addTooltip(g,f),s+=a}return this.inversedYAxisTitleText(i),this.inversedYAxisBorder(i),i}},{key:"inversedYAxisBorder",value:function(t){var e=this.w,r=new Pc(this.ctx),i=e.config.xaxis.axisBorder;if(i.show){var n=0;"bar"===e.config.chart.type&&e.globals.isXNumeric&&(n-=15);var o=r.drawLine(e.globals.padHorizontal+n+i.offsetX,this.xAxisoffX,e.globals.gridWidth,this.xAxisoffX,i.color,0,i.height);this.elgrid&&this.elgrid.elGridBorders&&e.config.grid.show?this.elgrid.elGridBorders.add(o):t.add(o)}}},{key:"inversedYAxisTitleText",value:function(t){var e=this.w,r=new Pc(this.ctx);if(void 0!==e.config.xaxis.title.text){var i=r.group({class:"apexcharts-xaxis-title apexcharts-yaxis-title-inversed"}),n=r.drawText({x:e.globals.gridWidth/2+e.config.xaxis.title.offsetX,y:this.xAxisoffX+parseFloat(this.xaxisFontSize)+parseFloat(e.config.xaxis.title.style.fontSize)+e.config.xaxis.title.offsetY+20,text:e.config.xaxis.title.text,textAnchor:"middle",fontSize:e.config.xaxis.title.style.fontSize,fontFamily:e.config.xaxis.title.style.fontFamily,fontWeight:e.config.xaxis.title.style.fontWeight,foreColor:e.config.xaxis.title.style.color,cssClass:"apexcharts-xaxis-title-text ".concat(e.config.xaxis.title.style.cssClass)});i.add(n),t.add(i)}}},{key:"yAxisTitleRotate",value:function(t,e){var r=this.w,i=new Pc(this.ctx),n=r.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(t,"'] .apexcharts-yaxis-texts-g")),o=n?n.getBoundingClientRect():{width:0,height:0},a=r.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(t,"'] .apexcharts-yaxis-title text")),s=a?a.getBoundingClientRect():{width:0,height:0};if(a){var l=this.xPaddingForYAxisTitle(t,o,s,e);a.setAttribute("x",l.xPos-(e?10:0));var c=i.rotateAroundCenter(a);a.setAttribute("transform","rotate(".concat(e?-1*r.config.yaxis[t].title.rotate:r.config.yaxis[t].title.rotate," ").concat(c.x," ").concat(c.y,")"))}}},{key:"xPaddingForYAxisTitle",value:function(t,e,r,i){var n=this.w,o=0,a=10;return void 0===n.config.yaxis[t].title.text||t<0?{xPos:o,padd:0}:(i?o=e.width+n.config.yaxis[t].title.offsetX+r.width/2+a/2:(o=-1*e.width+n.config.yaxis[t].title.offsetX+a/2+r.width/2,n.globals.isBarHorizontal&&(a=25,o=-1*e.width-n.config.yaxis[t].title.offsetX-a)),{xPos:o,padd:a})}},{key:"setYAxisXPosition",value:function(t,e){var r=this.w,i=0,n=0,o=18,a=1;r.config.yaxis.length>1&&(this.multipleYs=!0),r.config.yaxis.forEach((function(s,l){var c=r.globals.ignoreYAxisIndexes.includes(l)||!s.show||s.floating||0===t[l].width,u=t[l].width+e[l].width;s.opposite?r.globals.isBarHorizontal?(n=r.globals.gridWidth+r.globals.translateX-1,r.globals.translateYAxisX[l]=n-s.labels.offsetX):(n=r.globals.gridWidth+r.globals.translateX+a,c||(a+=u+20),r.globals.translateYAxisX[l]=n-s.labels.offsetX+20):(i=r.globals.translateX-o,c||(o+=u+20),r.globals.translateYAxisX[l]=i+s.labels.offsetX)}))}},{key:"setYAxisTextAlignments",value:function(){var t=this.w;f.listToArray(t.globals.dom.baseEl.getElementsByClassName("apexcharts-yaxis")).forEach((function(e,r){var i=t.config.yaxis[r];if(i&&!i.floating&&void 0!==i.labels.align){var n=t.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(r,"'] .apexcharts-yaxis-texts-g")),o=f.listToArray(t.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxis[rel='".concat(r,"'] .apexcharts-yaxis-label"))),a=n.getBoundingClientRect();o.forEach((function(t){t.setAttribute("text-anchor",i.labels.align)})),"left"!==i.labels.align||i.opposite?"center"===i.labels.align?n.setAttribute("transform","translate(".concat(a.width/2*(i.opposite?1:-1),", 0)")):"right"===i.labels.align&&i.opposite&&n.setAttribute("transform","translate(".concat(a.width,", 0)")):n.setAttribute("transform","translate(-".concat(a.width,", 0)"))}}))}}],r&&Vh(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Zh(t){return Zh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zh(t)}function $h(t,e){for(var r=0;r0&&(e=this.w.config.chart.locales.concat(window.Apex.chart.locales));var r=e.filter((function(e){return e.name===t}))[0];if(!r)throw new Error("Wrong locale name provided. Please make sure you set the correct locale name in options");var i=f.extend(uu,r);this.w.globals.locale=i.options}}])&&tf(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function nf(t){return nf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nf(t)}function of(t,e){for(var r=0;re.breakpoint?1:e.breakpoint>t.breakpoint?-1:0})).reverse();var o=new Mu({}),a=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=n[0].breakpoint,a=window.innerWidth>0?window.innerWidth:screen.width;if(a>i){var s=f.clone(r.globals.initialConfig);s.series=f.clone(r.config.series);var l=Mc.extendArrayProps(o,s,r);t=f.extend(l,t),t=f.extend(r.config,t),e.overrideResponsiveOptions(t)}else for(var c=0;ct.length)&&(e=t.length);for(var r=0,i=Array(e);r0&&"function"==typeof t[0]?(this.isColorFn=!0,r.config.series.map((function(i,n){var o=t[n]||t[0];return"function"==typeof o?o({value:r.globals.axisCharts?r.globals.series[n][0]||0:r.globals.series[n],seriesIndex:n,dataPointIndex:n,w:e.w}):o}))):t:this.predefined()}},{key:"applySeriesColors",value:function(t,e){t.forEach((function(t,r){t&&(e[r]=t)}))}},{key:"getMonochromeColors",value:function(t,e,r){var i=t.color,n=t.shadeIntensity,o=t.shadeTo,a=this.isBarDistributed||this.isHeatmapDistributed?e[0].length*e.length:e.length,s=1/(a/n),l=0;return Array.from({length:a},(function(){var t="dark"===o?r.shadeColor(-1*l,i):r.shadeColor(l,i);return l+=s,t}))}},{key:"applyColorTypes",value:function(t,e){var r=this,i=this.w;t.forEach((function(t){i.globals[t].colors=void 0===i.config[t].colors?r.isColorFn?i.config.colors:e:i.config[t].colors.slice(),r.pushExtraColors(i.globals[t].colors)}))}},{key:"applyDataLabelsColors",value:function(t){var e=this.w;e.globals.dataLabels.style.colors=void 0===e.config.dataLabels.style.colors?t:e.config.dataLabels.style.colors.slice(),this.pushExtraColors(e.globals.dataLabels.style.colors,50)}},{key:"applyRadarPolygonsColors",value:function(){var t=this.w;t.globals.radarPolygons.fill.colors=void 0===t.config.plotOptions.radar.polygons.fill.colors?["dark"===t.config.theme.mode?"#424242":"none"]:t.config.plotOptions.radar.polygons.fill.colors.slice(),this.pushExtraColors(t.globals.radarPolygons.fill.colors,20)}},{key:"applyMarkersColors",value:function(t){var e=this.w;e.globals.markers.colors=void 0===e.config.markers.colors?t:e.config.markers.colors.slice(),this.pushExtraColors(e.globals.markers.colors)}},{key:"pushExtraColors",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=this.w,n=e||i.globals.series.length;if(null===r&&(r=this.isBarDistributed||this.isHeatmapDistributed||"heatmap"===i.config.chart.type&&i.config.plotOptions.heatmap&&i.config.plotOptions.heatmap.colorScale.inverse),r&&i.globals.series.length&&(n=i.globals.series[i.globals.maxValsInArrayIndex].length*i.globals.series.length),t.lengtht.length)&&(e=t.length);for(var r=0,i=Array(e);rt.globals.svgWidth&&(this.dCtx.lgRect.width=t.globals.svgWidth/1.5),this.dCtx.lgRect}},{key:"getDatalabelsRect",value:function(){var t=this,e=this.w,r=[];e.config.series.forEach((function(n,o){n.data.forEach((function(n,a){var s;s=e.globals.series[o][a],i=e.config.dataLabels.formatter(s,{ctx:t.dCtx.ctx,seriesIndex:o,dataPointIndex:a,w:e}),r.push(i)}))}));var i=f.getLargestStringFromArr(r),n=new Pc(this.dCtx.ctx),o=e.config.dataLabels.style,a=n.getTextRects(i,parseInt(o.fontSize),o.fontFamily);return{width:1.05*a.width,height:a.height}}},{key:"getLargestStringFromMultiArr",value:function(t,e){var r=t;if(this.w.globals.isMultiLineX){var i=e.map((function(t,e){return Array.isArray(t)?t.length:1})),n=Math.max.apply(Math,function(t){return function(t){if(Array.isArray(t))return Pf(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Pf(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Pf(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(i));r=e[i.indexOf(n)]}return r}}],r&&Cf(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Ef(t){return Ef="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ef(t)}function Mf(t,e){for(var r=0;r0){var i=this.getxAxisTimeScaleLabelsCoords();t={width:i.width,height:i.height},e.globals.rotateXLabels=!1}else{this.dCtx.lgWidthForSideLegends="left"!==e.config.legend.position&&"right"!==e.config.legend.position||e.config.legend.floating?0:this.dCtx.lgRect.width;var n=e.globals.xLabelFormatter,o=f.getLargestStringFromArr(r),a=this.dCtx.dimHelpers.getLargestStringFromMultiArr(o,r);e.globals.isBarHorizontal&&(a=o=e.globals.yAxisScale[0].result.reduce((function(t,e){return t.length>e.length?t:e}),0));var s=new Jc(this.dCtx.ctx),l=o;o=s.xLabelFormat(n,o,l,{i:void 0,dateFormatter:new Vc(this.dCtx.ctx).formatDate,w:e}),a=s.xLabelFormat(n,a,l,{i:void 0,dateFormatter:new Vc(this.dCtx.ctx).formatDate,w:e}),(e.config.xaxis.convertedCatToNumeric&&void 0===o||""===String(o).trim())&&(a=o="1");var c=new Pc(this.dCtx.ctx),u=c.getTextRects(o,e.config.xaxis.labels.style.fontSize),h=u;if(o!==a&&(h=c.getTextRects(a,e.config.xaxis.labels.style.fontSize)),(t={width:u.width>=h.width?u.width:h.width,height:u.height>=h.height?u.height:h.height}).width*r.length>e.globals.svgWidth-this.dCtx.lgWidthForSideLegends-this.dCtx.yAxisWidth-this.dCtx.gridPad.left-this.dCtx.gridPad.right&&0!==e.config.xaxis.labels.rotate||e.config.xaxis.labels.rotateAlways){if(!e.globals.isBarHorizontal){e.globals.rotateXLabels=!0;var d=function(t){return c.getTextRects(t,e.config.xaxis.labels.style.fontSize,e.config.xaxis.labels.style.fontFamily,"rotate(".concat(e.config.xaxis.labels.rotate," 0 0)"),!1)};u=d(o),o!==a&&(h=d(a)),t.height=(u.height>h.height?u.height:h.height)/1.5,t.width=u.width>h.width?u.width:h.width}}else e.globals.rotateXLabels=!1}return e.config.xaxis.labels.show||(t={width:0,height:0}),{width:t.width,height:t.height}}},{key:"getxAxisGroupLabelsCoords",value:function(){var t,e=this.w;if(!e.globals.hasXaxisGroups)return{width:0,height:0};var r,i=(null===(t=e.config.xaxis.group.style)||void 0===t?void 0:t.fontSize)||e.config.xaxis.labels.style.fontSize,n=e.globals.groups.map((function(t){return t.title})),o=f.getLargestStringFromArr(n),a=this.dCtx.dimHelpers.getLargestStringFromMultiArr(o,n),s=new Pc(this.dCtx.ctx),l=s.getTextRects(o,i),c=l;return o!==a&&(c=s.getTextRects(a,i)),r={width:l.width>=c.width?l.width:c.width,height:l.height>=c.height?l.height:c.height},e.config.xaxis.labels.show||(r={width:0,height:0}),{width:r.width,height:r.height}}},{key:"getxAxisTitleCoords",value:function(){var t=this.w,e=0,r=0;if(void 0!==t.config.xaxis.title.text){var i=new Pc(this.dCtx.ctx).getTextRects(t.config.xaxis.title.text,t.config.xaxis.title.style.fontSize);e=i.width,r=i.height}return{width:e,height:r}}},{key:"getxAxisTimeScaleLabelsCoords",value:function(){var t,e=this.w;this.dCtx.timescaleLabels=e.globals.timescaleLabels.slice();var r=this.dCtx.timescaleLabels.map((function(t){return t.value})),i=r.reduce((function(t,e){return void 0===t?(console.error("You have possibly supplied invalid Date format. Please supply a valid JavaScript Date"),0):t.length>e.length?t:e}),0);return 1.05*(t=new Pc(this.dCtx.ctx).getTextRects(i,e.config.xaxis.labels.style.fontSize)).width*r.length>e.globals.gridWidth&&0!==e.config.xaxis.labels.rotate&&(e.globals.overlappingXLabels=!0),t}},{key:"additionalPaddingXLabels",value:function(t){var e=this,r=this.w,i=r.globals,n=r.config,o=n.xaxis.type,a=t.width;i.skipLastTimelinelabel=!1,i.skipFirstTimelinelabel=!1;var s=r.config.yaxis[0].opposite&&r.globals.isBarHorizontal;n.yaxis.forEach((function(t,l){s?(e.dCtx.gridPad.left1&&function(t){return-1!==i.collapsedSeriesIndices.indexOf(t)}(s)||function(t){if(e.dCtx.timescaleLabels&&e.dCtx.timescaleLabels.length){var s=e.dCtx.timescaleLabels[0],l=e.dCtx.timescaleLabels[e.dCtx.timescaleLabels.length-1].position+a/1.75-e.dCtx.yAxisWidthRight,c=s.position-a/1.75+e.dCtx.yAxisWidthLeft,u="right"===r.config.legend.position&&e.dCtx.lgRect.width>0?e.dCtx.lgRect.width:0;l>i.svgWidth-i.translateX-u&&(i.skipLastTimelinelabel=!0),c<-(t.show&&!t.floating||"bar"!==n.chart.type&&"candlestick"!==n.chart.type&&"rangeBar"!==n.chart.type&&"boxPlot"!==n.chart.type?10:a/1.75)&&(i.skipFirstTimelinelabel=!0)}else"datetime"===o?e.dCtx.gridPad.right(null===(i=String(u(e,s)))||void 0===i?void 0:i.length)?t:e}),h),p=d=u(d,s);if(void 0!==d&&0!==d.length||(d=l.niceMax),e.globals.isBarHorizontal){i=0;var g=e.globals.labels.slice();d=f.getLargestStringFromArr(g),d=u(d,{seriesIndex:a,dataPointIndex:-1,w:e}),p=t.dCtx.dimHelpers.getLargestStringFromMultiArr(d,g)}var b=new Pc(t.dCtx.ctx),y="rotate(".concat(o.labels.rotate," 0 0)"),v=b.getTextRects(d,o.labels.style.fontSize,o.labels.style.fontFamily,y,!1),m=v;d!==p&&(m=b.getTextRects(p,o.labels.style.fontSize,o.labels.style.fontFamily,y,!1)),r.push({width:(c>m.width||c>v.width?c:m.width>v.width?m.width:v.width)+i,height:m.height>v.height?m.height:v.height})}else r.push({width:0,height:0})})),r}},{key:"getyAxisTitleCoords",value:function(){var t=this,e=this.w,r=[];return e.config.yaxis.map((function(e,i){if(e.show&&void 0!==e.title.text){var n=new Pc(t.dCtx.ctx),o="rotate(".concat(e.title.rotate," 0 0)"),a=n.getTextRects(e.title.text,e.title.style.fontSize,e.title.style.fontFamily,o,!1);r.push({width:a.width,height:a.height})}else r.push({width:0,height:0})})),r}},{key:"getTotalYAxisWidth",value:function(){var t=this.w,e=0,r=0,i=0,n=t.globals.yAxisScale.length>1?10:0,o=new eu(this.dCtx.ctx),a=function(a,s){var l=t.config.yaxis[s].floating,c=0;a.width>0&&!l?(c=a.width+n,function(e){return t.globals.ignoreYAxisIndexes.indexOf(e)>-1}(s)&&(c=c-a.width-n)):c=l||o.isYAxisHidden(s)?0:5,t.config.yaxis[s].opposite?i+=c:r+=c,e+=c};return t.globals.yLabelsCoords.map((function(t,e){a(t,e)})),t.globals.yTitleCoords.map((function(t,e){a(t,e)})),t.globals.isBarHorizontal&&!t.config.yaxis[0].floating&&(e=t.globals.yLabelsCoords[0].width+t.globals.yTitleCoords[0].width+15),this.dCtx.yAxisWidthLeft=r,this.dCtx.yAxisWidthRight=i,e}}],r&&_f(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Df(t){return Df="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Df(t)}function Yf(t,e){for(var r=0;r0&&(s=i.comboBarCount),i.collapsedSeries.forEach((function(t){n(t.type)&&(s-=1)})),r.chart.stacked&&(s=1);var l=n(o)||i.comboBarCount>0,c=Math.abs(i.initialMaxX-i.initialMinX);if(l&&i.isXNumeric&&!i.isBarHorizontal&&s>0&&0!==c){c<=3&&(c=i.dataPoints);var u=c/t,h=i.minXDiff&&i.minXDiff/u>0?i.minXDiff/u:0;h>t/2&&(h/=2),(a=h*parseInt(r.plotOptions.bar.columnWidth,10)/100)<1&&(a=1),i.barPadForNumericAxis=a}return a}},{key:"gridPadFortitleSubtitle",value:function(){var t=this,e=this.w,r=e.globals,i=this.dCtx.isSparkline||!r.axisCharts?0:10;["title","subtitle"].forEach((function(n){void 0!==e.config[n].text?i+=e.config[n].margin:i+=t.dCtx.isSparkline||!r.axisCharts?0:5})),!e.config.legend.show||"bottom"!==e.config.legend.position||e.config.legend.floating||r.axisCharts||(i+=10);var n=this.dCtx.dimHelpers.getTitleSubtitleCoords("title"),o=this.dCtx.dimHelpers.getTitleSubtitleCoords("subtitle");r.gridHeight-=n.height+o.height+i,r.translateY+=n.height+o.height+i}},{key:"setGridXPosForDualYAxis",value:function(t,e){var r=this.w,i=new eu(this.dCtx.ctx);r.config.yaxis.forEach((function(n,o){-1!==r.globals.ignoreYAxisIndexes.indexOf(o)||n.floating||i.isYAxisHidden(o)||(n.opposite&&(r.globals.translateX-=e[o].width+t[o].width+parseInt(n.labels.style.fontSize,10)/1.2+12),r.globals.translateX<2&&(r.globals.translateX=2))}))}}],r&&Yf(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Bf(t){return Bf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bf(t)}function Nf(t,e){if(t){if("string"==typeof t)return Wf(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Wf(t,e):void 0}}function Wf(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r0||e.config.markers.size>0)&&Object.entries(this.gridPad).forEach((function(e){var r=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var i,n,o,a,s=[],l=!0,c=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(i=o.call(r)).done)&&(s.push(i.value),s.length!==e);l=!0);}catch(t){c=!0,n=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw n}}return s}}(t,e)||Nf(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(e,2),i=r[0],n=r[1];t.gridPad[i]=Math.max(n,t.w.globals.markers.largestSize/1.5)})),this.gridPad.top=Math.max(i/2,this.gridPad.top),this.gridPad.bottom=Math.max(i/2,this.gridPad.bottom)),r.axisCharts?this.setDimensionsForAxisCharts():this.setDimensionsForNonAxisCharts(),this.dimGrid.gridPadFortitleSubtitle(),r.gridHeight=r.gridHeight-this.gridPad.top-this.gridPad.bottom,r.gridWidth=r.gridWidth-this.gridPad.left-this.gridPad.right-this.xPadRight-this.xPadLeft;var n=this.dimGrid.gridPadForColumnsInNumericAxis(r.gridWidth);r.gridWidth=r.gridWidth-2*n,r.translateX=r.translateX+this.gridPad.left+this.xPadLeft+(n>0?n:0),r.translateY=r.translateY+this.gridPad.top}},{key:"setDimensionsForAxisCharts",value:function(){var t=this,e=this.w,r=e.globals,i=this.dimYAxis.getyAxisLabelsCoords(),n=this.dimYAxis.getyAxisTitleCoords();r.isSlopeChart&&(this.datalabelsCoords=this.dimHelpers.getDatalabelsRect()),e.globals.yLabelsCoords=[],e.globals.yTitleCoords=[],e.config.yaxis.map((function(t,r){e.globals.yLabelsCoords.push({width:i[r].width,index:r}),e.globals.yTitleCoords.push({width:n[r].width,index:r})})),this.yAxisWidth=this.dimYAxis.getTotalYAxisWidth();var o=this.dimXAxis.getxAxisLabelsCoords(),a=this.dimXAxis.getxAxisGroupLabelsCoords(),s=this.dimXAxis.getxAxisTitleCoords();this.conditionalChecksForAxisCoords(o,s,a),r.translateXAxisY=e.globals.rotateXLabels?this.xAxisHeight/8:-4,r.translateXAxisX=e.globals.rotateXLabels&&e.globals.isXNumeric&&e.config.xaxis.labels.rotate<=-45?-this.xAxisWidth/4:0,e.globals.isBarHorizontal&&(r.rotateXLabels=!1,r.translateXAxisY=parseInt(e.config.xaxis.labels.style.fontSize,10)/1.5*-1),r.translateXAxisY=r.translateXAxisY+e.config.xaxis.labels.offsetY,r.translateXAxisX=r.translateXAxisX+e.config.xaxis.labels.offsetX;var l=this.yAxisWidth,c=this.xAxisHeight;r.xAxisLabelsHeight=this.xAxisHeight-s.height,r.xAxisGroupLabelsHeight=r.xAxisLabelsHeight-o.height,r.xAxisLabelsWidth=this.xAxisWidth,r.xAxisHeight=this.xAxisHeight;var u=10;("radar"===e.config.chart.type||this.isSparkline)&&(l=0,c=0),this.isSparkline&&(this.lgRect={height:0,width:0}),(this.isSparkline||"treemap"===e.config.chart.type)&&(l=0,c=0,u=0),this.isSparkline||"treemap"===e.config.chart.type||this.dimXAxis.additionalPaddingXLabels(o);var h=function(){r.translateX=l+t.datalabelsCoords.width,r.gridHeight=r.svgHeight-t.lgRect.height-c-(t.isSparkline||"treemap"===e.config.chart.type?0:e.globals.rotateXLabels?10:15),r.gridWidth=r.svgWidth-l-2*t.datalabelsCoords.width};switch("top"===e.config.xaxis.position&&(u=r.xAxisHeight-e.config.xaxis.axisTicks.height-5),e.config.legend.position){case"bottom":r.translateY=u,h();break;case"top":r.translateY=this.lgRect.height+u,h();break;case"left":r.translateY=u,r.translateX=this.lgRect.width+l+this.datalabelsCoords.width,r.gridHeight=r.svgHeight-c-12,r.gridWidth=r.svgWidth-this.lgRect.width-l-2*this.datalabelsCoords.width;break;case"right":r.translateY=u,r.translateX=l+this.datalabelsCoords.width,r.gridHeight=r.svgHeight-c-12,r.gridWidth=r.svgWidth-this.lgRect.width-l-2*this.datalabelsCoords.width-5;break;default:throw new Error("Legend position not supported")}this.dimGrid.setGridXPosForDualYAxis(n,i),new qh(this.ctx).setYAxisXPosition(i,n)}},{key:"setDimensionsForNonAxisCharts",value:function(){var t=this.w,e=t.globals,r=t.config,i=0;t.config.legend.show&&!t.config.legend.floating&&(i=20);var n="pie"===r.chart.type||"polarArea"===r.chart.type||"donut"===r.chart.type?"pie":"radialBar",o=r.plotOptions[n].offsetY,a=r.plotOptions[n].offsetX;if(!r.legend.show||r.legend.floating){e.gridHeight=e.svgHeight;var s=e.dom.elWrap.getBoundingClientRect().width;return e.gridWidth=Math.min(s,e.gridHeight),e.translateY=o,void(e.translateX=a+(e.svgWidth-e.gridWidth)/2)}switch(r.legend.position){case"bottom":e.gridHeight=e.svgHeight-this.lgRect.height,e.gridWidth=e.svgWidth,e.translateY=o-10,e.translateX=a+(e.svgWidth-e.gridWidth)/2;break;case"top":e.gridHeight=e.svgHeight-this.lgRect.height,e.gridWidth=e.svgWidth,e.translateY=this.lgRect.height+o+10,e.translateX=a+(e.svgWidth-e.gridWidth)/2;break;case"left":e.gridWidth=e.svgWidth-this.lgRect.width-i,e.gridHeight="auto"!==r.chart.height?e.svgHeight:e.gridWidth,e.translateY=o,e.translateX=a+this.lgRect.width+i;break;case"right":e.gridWidth=e.svgWidth-this.lgRect.width-i-5,e.gridHeight="auto"!==r.chart.height?e.svgHeight:e.gridWidth,e.translateY=o,e.translateX=a+10;break;default:throw new Error("Legend position not supported")}}},{key:"conditionalChecksForAxisCoords",value:function(t,e,r){var i=this.w,n=i.globals.hasXaxisGroups?2:1,o=r.height+t.height+e.height,a=i.globals.isMultiLineX?1.2:i.globals.LINE_HEIGHT_RATIO,s=i.globals.rotateXLabels?22:10,l=i.globals.rotateXLabels&&"bottom"===i.config.legend.position?10:0;this.xAxisHeight=o*a+n*s+l,this.xAxisWidth=t.width,this.xAxisHeight-e.height>i.config.xaxis.labels.maxHeight&&(this.xAxisHeight=i.config.xaxis.labels.maxHeight),i.config.xaxis.labels.minHeight&&this.xAxisHeightu&&(this.yAxisWidth=u)}}],r&&Gf(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function qf(t){return qf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qf(t)}function Zf(t,e){for(var r=0;r0){for(var o=0;o1;if(this.legendHelpers.appendToForeignObject(),(i||!e.axisCharts)&&r.legend.show){for(;e.dom.elLegendWrap.firstChild;)e.dom.elLegendWrap.removeChild(e.dom.elLegendWrap.firstChild);this.drawLegends(),"bottom"===r.legend.position||"top"===r.legend.position?this.legendAlignHorizontal():"right"!==r.legend.position&&"left"!==r.legend.position||this.legendAlignVertical()}}},{key:"createLegendMarker",value:function(t){var e=t.i,r=t.fillcolor,i=this.w,n=document.createElement("span");n.classList.add("apexcharts-legend-marker");var o=i.config.legend.markers.shape||i.config.markers.shape,a=o;Array.isArray(o)&&(a=o[e]);var s=Array.isArray(i.config.legend.markers.size)?parseFloat(i.config.legend.markers.size[e]):parseFloat(i.config.legend.markers.size),l=Array.isArray(i.config.legend.markers.offsetX)?parseFloat(i.config.legend.markers.offsetX[e]):parseFloat(i.config.legend.markers.offsetX),c=Array.isArray(i.config.legend.markers.offsetY)?parseFloat(i.config.legend.markers.offsetY[e]):parseFloat(i.config.legend.markers.offsetY),u=Array.isArray(i.config.legend.markers.strokeWidth)?parseFloat(i.config.legend.markers.strokeWidth[e]):parseFloat(i.config.legend.markers.strokeWidth),h=n.style;if(h.height=2*(s+u)+"px",h.width=2*(s+u)+"px",h.left=l+"px",h.top=c+"px",i.config.legend.markers.customHTML)h.background="transparent",h.color=r[e],Array.isArray(i.config.legend.markers.customHTML)?i.config.legend.markers.customHTML[e]&&(n.innerHTML=i.config.legend.markers.customHTML[e]()):n.innerHTML=i.config.legend.markers.customHTML();else{var f=new Ku(this.ctx).getMarkerConfig({cssClass:"apexcharts-legend-marker apexcharts-marker apexcharts-marker-".concat(a),seriesIndex:e,strokeWidth:u,size:s}),d=window.SVG().addTo(n).size("100%","100%"),p=new Pc(this.ctx).drawMarker(0,0,td(td({},f),{},{pointFillColor:Array.isArray(r)?r[e]:f.pointFillColor,shape:a}));i.globals.dom.Paper.find(".apexcharts-legend-marker.apexcharts-marker").forEach((function(t){t.node.classList.contains("apexcharts-marker-triangle")?t.node.style.transform="translate(50%, 45%)":t.node.style.transform="translate(50%, 50%)"})),d.add(p)}return n}},{key:"drawLegends",value:function(){var t=this,e=this,r=this.w,i=r.config.legend.fontFamily,n=r.globals.seriesNames,o=r.config.legend.markers.fillColors?r.config.legend.markers.fillColors.slice():r.globals.colors.slice();if("heatmap"===r.config.chart.type){var a=r.config.plotOptions.heatmap.colorScale.ranges;n=a.map((function(t){return t.name?t.name:t.from+" - "+t.to})),o=a.map((function(t){return t.color}))}else this.isBarsDistributed&&(n=r.globals.labels.slice());r.config.legend.customLegendItems.length&&(n=r.config.legend.customLegendItems);var s=r.globals.legendFormatter,l=r.config.legend.inverseOrder,c=[];r.globals.seriesGroups.length>1&&r.config.legend.clusterGroupedSeries&&r.globals.seriesGroups.forEach((function(t,e){c[e]=document.createElement("div"),c[e].classList.add("apexcharts-legend-group","apexcharts-legend-group-".concat(e)),"horizontal"===r.config.legend.clusterGroupedSeriesOrientation?r.globals.dom.elLegendWrap.classList.add("apexcharts-legend-group-horizontal"):c[e].classList.add("apexcharts-legend-group-vertical")}));for(var u=function(e){var a,l=s(n[e],{seriesIndex:e,w:r}),u=!1,h=!1;if(r.globals.collapsedSeries.length>0)for(var d=0;d0)for(var p=0;p=0:h<=n.length-1;l?h--:h++)u(h);r.globals.dom.elWrap.addEventListener("click",e.onLegendClick,!0),r.config.legend.onItemHover.highlightDataSeries&&0===r.config.legend.customLegendItems.length&&(r.globals.dom.elWrap.addEventListener("mousemove",e.onLegendHovered,!0),r.globals.dom.elWrap.addEventListener("mouseout",e.onLegendHovered,!0))}},{key:"setLegendWrapXY",value:function(t,e){var r=this.w,i=r.globals.dom.elLegendWrap,n=i.clientHeight,o=0,a=0;if("bottom"===r.config.legend.position)a=r.globals.svgHeight-Math.min(n,r.globals.svgHeight/2)-5;else if("top"===r.config.legend.position){var s=new Uf(this.ctx),l=s.dimHelpers.getTitleSubtitleCoords("title").height,c=s.dimHelpers.getTitleSubtitleCoords("subtitle").height;a=(l>0?l-10:0)+(c>0?c-10:0)}i.style.position="absolute",o=o+t+r.config.legend.offsetX,a=a+e+r.config.legend.offsetY,i.style.left=o+"px",i.style.top=a+"px","right"===r.config.legend.position&&(i.style.left="auto",i.style.right=25+r.config.legend.offsetX+"px"),["width","height"].forEach((function(t){i.style[t]&&(i.style[t]=parseInt(r.config.legend[t],10)+"px")}))}},{key:"legendAlignHorizontal",value:function(){var t=this.w;t.globals.dom.elLegendWrap.style.right=0;var e=new Uf(this.ctx),r=e.dimHelpers.getTitleSubtitleCoords("title"),i=e.dimHelpers.getTitleSubtitleCoords("subtitle"),n=0;"top"===t.config.legend.position&&(n=r.height+i.height+t.config.title.margin+t.config.subtitle.margin-10),this.setLegendWrapXY(20,n)}},{key:"legendAlignVertical",value:function(){var t=this.w,e=this.legendHelpers.getLegendDimensions(),r=0;"left"===t.config.legend.position&&(r=20),"right"===t.config.legend.position&&(r=t.globals.svgWidth-e.clww-10),this.setLegendWrapXY(r,20)}},{key:"onLegendHovered",value:function(t){var e=this.w,r=t.target.classList.contains("apexcharts-legend-series")||t.target.classList.contains("apexcharts-legend-text")||t.target.classList.contains("apexcharts-legend-marker");if("heatmap"===e.config.chart.type||this.isBarsDistributed){if(r){var i=parseInt(t.target.getAttribute("rel"),10)-1;this.ctx.events.fireEvent("legendHover",[this.ctx,i,this.w]),new fh(this.ctx).highlightRangeInSeries(t,t.target)}}else!t.target.classList.contains("apexcharts-inactive-legend")&&r&&new fh(this.ctx).toggleSeriesOnHover(t,t.target)}},{key:"onLegendClick",value:function(t){var e=this.w;if(!e.config.legend.customLegendItems.length&&(t.target.classList.contains("apexcharts-legend-series")||t.target.classList.contains("apexcharts-legend-text")||t.target.classList.contains("apexcharts-legend-marker"))){var r=parseInt(t.target.getAttribute("rel"),10)-1,i="true"===t.target.getAttribute("data:collapsed"),n=this.w.config.chart.events.legendClick;"function"==typeof n&&n(this.ctx,r,this.w),this.ctx.events.fireEvent("legendClick",[this.ctx,r,this.w]);var o=this.w.config.legend.markers.onClick;"function"==typeof o&&t.target.classList.contains("apexcharts-legend-marker")&&(o(this.ctx,r,this.w),this.ctx.events.fireEvent("legendMarkerClick",[this.ctx,r,this.w])),"treemap"!==e.config.chart.type&&"heatmap"!==e.config.chart.type&&!this.isBarsDistributed&&e.config.legend.onItemClick.toggleDataSeries&&this.legendHelpers.toggleDataSeries(r,i)}}}],r&&rd(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();const od=nd;var ad=r(75),sd=r.n(ad),ld=r(541),cd=r.n(ld),ud=r(955),hd=r.n(ud),fd=r(646),dd=r.n(fd),pd=r(606),gd=r.n(pd),bd=r(802),yd=r.n(bd),vd=r(627),md=r.n(vd);function xd(t){return xd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xd(t)}function wd(t,e){for(var r=0;rthis.wheelDelay&&(this.executeMouseWheelZoom(t),r.globals.lastWheelExecution=i),this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout((function(){i-r.globals.lastWheelExecution>e.wheelDelay&&(e.executeMouseWheelZoom(t),r.globals.lastWheelExecution=i)}),this.debounceDelay)}},{key:"executeMouseWheelZoom",value:function(t){var e,r=this.w;this.minX=r.globals.isRangeBar?r.globals.minY:r.globals.minX,this.maxX=r.globals.isRangeBar?r.globals.maxY:r.globals.maxX;var i=null===(e=this.gridRect)||void 0===e?void 0:e.getBoundingClientRect();if(i){var n,o,a,s=(t.clientX-i.left)/i.width,l=this.minX,c=this.maxX,u=c-l;if(t.deltaY<0){var h=l+s*u;o=h-(n=.5*u)/2,a=h+n/2}else o=l-(n=1.5*u)/2,a=c+n/2;if(!r.globals.isRangeBar){o=Math.max(o,r.globals.initialMinX),a=Math.min(a,r.globals.initialMaxX);var f=.01*(r.globals.initialMaxX-r.globals.initialMinX);if(a-o0&&r.height>0&&(this.selectionRect.select(!1).resize(!1),this.selectionRect.select({createRot:function(){},updateRot:function(){},createHandle:function(t,e,r,i,n){return"l"===n||"r"===n?t.circle(8).css({"stroke-width":1,stroke:"#333",fill:"#fff"}):t.circle(0)},updateHandle:function(t,e){return t.center(e[0],e[1])}}).resize().on("resize",(function(){var r=e.globals.zoomEnabled?e.config.chart.zoom.type:e.config.chart.selection.type;t.handleMouseUp({zoomtype:r,isResized:!0})})))}}},{key:"preselectedSelection",value:function(){var t=this.w,e=this.xyRatios;if(!t.globals.zoomEnabled)if(void 0!==t.globals.selection&&null!==t.globals.selection)this.drawSelectionRect(Pd(Pd({},t.globals.selection),{},{translateX:t.globals.translateX,translateY:t.globals.translateY}));else if(void 0!==t.config.chart.selection.xaxis.min&&void 0!==t.config.chart.selection.xaxis.max){var r=(t.config.chart.selection.xaxis.min-t.globals.minX)/e.xRatio,i=t.globals.gridWidth-(t.globals.maxX-t.config.chart.selection.xaxis.max)/e.xRatio-r;t.globals.isRangeBar&&(r=(t.config.chart.selection.xaxis.min-t.globals.yAxisScale[0].niceMin)/e.invertedYRatio,i=(t.config.chart.selection.xaxis.max-t.config.chart.selection.xaxis.min)/e.invertedYRatio);var n={x:r,y:0,width:i,height:t.globals.gridHeight,translateX:t.globals.translateX,translateY:t.globals.translateY,selectionEnabled:!0};this.drawSelectionRect(n),this.makeSelectionRectDraggable(),"function"==typeof t.config.chart.events.selection&&t.config.chart.events.selection(this.ctx,{xaxis:{min:t.config.chart.selection.xaxis.min,max:t.config.chart.selection.xaxis.max},yaxis:{}})}}},{key:"drawSelectionRect",value:function(t){var e=t.x,r=t.y,i=t.width,n=t.height,o=t.translateX,a=void 0===o?0:o,s=t.translateY,l=void 0===s?0:s,c=this.w,u=this.zoomRect,h=this.selectionRect;if(this.dragged||null!==c.globals.selection){var f={transform:"translate("+a+", "+l+")"};c.globals.zoomEnabled&&this.dragged&&(i<0&&(i=1),u.attr({x:e,y:r,width:i,height:n,fill:c.config.chart.zoom.zoomedArea.fill.color,"fill-opacity":c.config.chart.zoom.zoomedArea.fill.opacity,stroke:c.config.chart.zoom.zoomedArea.stroke.color,"stroke-width":c.config.chart.zoom.zoomedArea.stroke.width,"stroke-opacity":c.config.chart.zoom.zoomedArea.stroke.opacity}),Pc.setAttrs(u.node,f)),c.globals.selectionEnabled&&(h.attr({x:e,y:r,width:i>0?i:0,height:n>0?n:0,fill:c.config.chart.selection.fill.color,"fill-opacity":c.config.chart.selection.fill.opacity,stroke:c.config.chart.selection.stroke.color,"stroke-width":c.config.chart.selection.stroke.width,"stroke-dasharray":c.config.chart.selection.stroke.dashArray,"stroke-opacity":c.config.chart.selection.stroke.opacity}),Pc.setAttrs(h.node,f))}}},{key:"hideSelectionRect",value:function(t){t&&t.attr({x:0,y:0,width:0,height:0})}},{key:"selectionDrawing",value:function(t){var e=t.context,r=t.zoomtype,i=this.w,n=e,o=this.gridRect.getBoundingClientRect(),a=n.startX-1,s=n.startY,l=!1,c=!1,u=n.clientX-o.left-i.globals.barPadForNumericAxis,h=n.clientY-o.top,f=u-a,d=h-s,p={translateX:i.globals.translateX,translateY:i.globals.translateY};return Math.abs(f+a)>i.globals.gridWidth?f=i.globals.gridWidth-a:u<0&&(f=a),a>u&&(l=!0,f=Math.abs(f)),s>h&&(c=!0,d=Math.abs(d)),p=Pd(Pd({},p="x"===r?{x:l?a-f:a,y:0,width:f,height:i.globals.gridHeight}:"y"===r?{x:0,y:c?s-d:s,width:i.globals.gridWidth,height:d}:{x:l?a-f:a,y:c?s-d:s,width:f,height:d}),{},{translateX:i.globals.translateX,translateY:i.globals.translateY}),n.drawSelectionRect(p),n.selectionDragging("resizing"),p}},{key:"selectionDragging",value:function(t,e){var r=this,i=this.w;if(e){e.preventDefault();var n=e.detail,o=n.handler,a=n.box,s=a.x,l=a.y;sthis.constraints.x2&&(s=this.constraints.x2-a.w),a.y2>this.constraints.y2&&(l=this.constraints.y2-a.h),o.move(s,l);var c=this.xyRatios,u=this.selectionRect,h=0;"resizing"===t&&(h=30);var f=function(t){return parseFloat(u.node.getAttribute(t))},d={x:f("x"),y:f("y"),width:f("width"),height:f("height")};i.globals.selection=d,"function"==typeof i.config.chart.events.selection&&i.globals.selectionEnabled&&(clearTimeout(this.w.globals.selectionResizeTimer),this.w.globals.selectionResizeTimer=window.setTimeout((function(){var t,e,n,o,a=r.gridRect.getBoundingClientRect(),s=u.node.getBoundingClientRect();i.globals.isRangeBar?(t=i.globals.yAxisScale[0].niceMin+(s.left-a.left)*c.invertedYRatio,e=i.globals.yAxisScale[0].niceMin+(s.right-a.left)*c.invertedYRatio,n=0,o=1):(t=i.globals.xAxisScale.niceMin+(s.left-a.left)*c.xRatio,e=i.globals.xAxisScale.niceMin+(s.right-a.left)*c.xRatio,n=i.globals.yAxisScale[0].niceMin+(a.bottom-s.bottom)*c.yRatio[0],o=i.globals.yAxisScale[0].niceMax-(s.top-a.top)*c.yRatio[0]);var l={xaxis:{min:t,max:e},yaxis:{min:n,max:o}};i.config.chart.events.selection(r.ctx,l),i.config.chart.brush.enabled&&void 0!==i.config.chart.events.brushScrolled&&i.config.chart.events.brushScrolled(r.ctx,l)}),h))}}},{key:"selectionDrawn",value:function(t){var e,r,i=t.context,n=t.zoomtype,o=this.w,a=i,s=this.xyRatios,l=this.ctx.toolbar,c=o.globals.zoomEnabled?a.zoomRect.node.getBoundingClientRect():a.selectionRect.node.getBoundingClientRect(),u=a.gridRect.getBoundingClientRect(),h=c.left-u.left-o.globals.barPadForNumericAxis,d=c.right-u.left-o.globals.barPadForNumericAxis,p=c.top-u.top,g=c.bottom-u.top;o.globals.isRangeBar?(e=o.globals.yAxisScale[0].niceMin+h*s.invertedYRatio,r=o.globals.yAxisScale[0].niceMin+d*s.invertedYRatio):(e=o.globals.xAxisScale.niceMin+h*s.xRatio,r=o.globals.xAxisScale.niceMin+d*s.xRatio);var b=[],y=[];if(o.config.yaxis.forEach((function(t,e){var r=o.globals.seriesYAxisMap[e][0],i=o.globals.yAxisScale[e].niceMax-s.yRatio[r]*p,n=o.globals.yAxisScale[e].niceMax-s.yRatio[r]*g;b.push(i),y.push(n)})),a.dragged&&(a.dragX>10||a.dragY>10)&&e!==r)if(o.globals.zoomEnabled){var v=f.clone(o.globals.initialConfig.yaxis),m=f.clone(o.globals.initialConfig.xaxis);if(o.globals.zoomed=!0,o.config.xaxis.convertedCatToNumeric&&(e=Math.floor(e),r=Math.floor(r),e<1&&(e=1,r=o.globals.dataPoints),r-e<2&&(r=e+1)),"xy"!==n&&"x"!==n||(m={min:e,max:r}),"xy"!==n&&"y"!==n||v.forEach((function(t,e){v[e].min=y[e],v[e].max=b[e]})),l){var x=l.getBeforeZoomRange(m,v);x&&(m=x.xaxis?x.xaxis:m,v=x.yaxis?x.yaxis:v)}var w={xaxis:m};o.config.chart.group||(w.yaxis=v),a.ctx.updateHelpers._updateOptions(w,!1,a.w.config.chart.animations.dynamicAnimation.enabled),"function"==typeof o.config.chart.events.zoomed&&l.zoomCallback(m,v)}else if(o.globals.selectionEnabled){var S,k=null;S={min:e,max:r},"xy"!==n&&"y"!==n||(k=f.clone(o.config.yaxis)).forEach((function(t,e){k[e].min=y[e],k[e].max=b[e]})),o.globals.selection=a.selection,"function"==typeof o.config.chart.events.selection&&o.config.chart.events.selection(a.ctx,{xaxis:S,yaxis:k})}}},{key:"panDragging",value:function(t){var e=t.context,r=this.w,i=e;if(void 0!==r.globals.lastClientPosition.x){var n=r.globals.lastClientPosition.x-i.clientX,o=r.globals.lastClientPosition.y-i.clientY;Math.abs(n)>Math.abs(o)&&n>0?this.moveDirection="left":Math.abs(n)>Math.abs(o)&&n<0?this.moveDirection="right":Math.abs(o)>Math.abs(n)&&o>0?this.moveDirection="up":Math.abs(o)>Math.abs(n)&&o<0&&(this.moveDirection="down")}r.globals.lastClientPosition={x:i.clientX,y:i.clientY};var a=r.globals.isRangeBar?r.globals.minY:r.globals.minX,s=r.globals.isRangeBar?r.globals.maxY:r.globals.maxX;r.config.xaxis.convertedCatToNumeric||i.panScrolled(a,s)}},{key:"delayedPanScrolled",value:function(){var t=this.w,e=t.globals.minX,r=t.globals.maxX,i=(t.globals.maxX-t.globals.minX)/2;"left"===this.moveDirection?(e=t.globals.minX+i,r=t.globals.maxX+i):"right"===this.moveDirection&&(e=t.globals.minX-i,r=t.globals.maxX-i),e=Math.floor(e),r=Math.floor(r),this.updateScrolledChart({xaxis:{min:e,max:r}},e,r)}},{key:"panScrolled",value:function(t,e){var r=this.w,i=this.xyRatios,n=f.clone(r.globals.initialConfig.yaxis),o=i.xRatio,a=r.globals.minX,s=r.globals.maxX;r.globals.isRangeBar&&(o=i.invertedYRatio,a=r.globals.minY,s=r.globals.maxY),"left"===this.moveDirection?(t=a+r.globals.gridWidth/15*o,e=s+r.globals.gridWidth/15*o):"right"===this.moveDirection&&(t=a-r.globals.gridWidth/15*o,e=s-r.globals.gridWidth/15*o),r.globals.isRangeBar||(tr.globals.initialMaxX)&&(t=a,e=s);var l={xaxis:{min:t,max:e}};r.config.chart.group||(l.yaxis=n),this.updateScrolledChart(l,t,e)}},{key:"updateScrolledChart",value:function(t,e,r){var i=this.w;this.ctx.updateHelpers._updateOptions(t,!1,!1),"function"==typeof i.config.chart.events.scrolled&&i.config.chart.events.scrolled(this.ctx,{xaxis:{min:e,max:r}})}}],r&&jd(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),n}(kd);function _d(t){return _d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_d(t)}function zd(t){return function(t){if(Array.isArray(t))return Xd(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Xd(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Xd(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Xd(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);rs||p>l?(e.classList.remove("hovering-zoom"),e.classList.remove("hovering-pan")):o.globals.zoomEnabled?(e.classList.remove("hovering-pan"),e.classList.add("hovering-zoom")):o.globals.panEnabled&&(e.classList.remove("hovering-zoom"),e.classList.add("hovering-pan"));var g=Math.round(d/c),b=Math.floor(p/u);h&&!o.config.xaxis.convertedCatToNumeric&&(g=Math.ceil(d/c),g-=1);var y=null,v=null,m=o.globals.seriesXvalues.map((function(t){return t.filter((function(t){return f.isNumber(t)}))})),x=o.globals.seriesYvalues.map((function(t){return t.filter((function(t){return f.isNumber(t)}))}));if(o.globals.isXNumeric){var w=this.ttCtx.getElGrid().getBoundingClientRect(),S=d*(w.width/s),k=p*(w.height/l);y=(v=this.closestInMultiArray(S,k,m,x)).index,g=v.j,null!==y&&o.globals.hasNullValues&&(m=o.globals.seriesXvalues[y],g=(v=this.closestInArray(S,m)).j)}return o.globals.capturedSeriesIndex=null===y?-1:y,(!g||g<1)&&(g=0),o.globals.isBarHorizontal?o.globals.capturedDataPointIndex=b:o.globals.capturedDataPointIndex=g,{capturedSeries:y,j:o.globals.isBarHorizontal?b:g,hoverX:d,hoverY:p}}},{key:"getFirstActiveXArray",value:function(t){for(var e=this.w,r=0,i=t.map((function(t,e){return t.length>0?e:-1})),n=0;n0)for(var i=0;i *")):this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-series-markers-wrap > *")}},{key:"getAllMarkers",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-series-markers-wrap");r=zd(r),e&&(r=r.filter((function(e){var r=Number(e.getAttribute("data:realIndex"));return-1===t.w.globals.collapsedSeriesIndices.indexOf(r)}))),r.sort((function(t,e){var r=Number(t.getAttribute("data:realIndex")),i=Number(e.getAttribute("data:realIndex"));return ir?-1:0}));var i=[];return r.forEach((function(t){i.push(t.querySelector(".apexcharts-marker"))})),i}},{key:"hasMarkers",value:function(t){return this.getElMarkers(t).length>0}},{key:"getPathFromPoint",value:function(t,e){var r=Number(t.getAttribute("cx")),i=Number(t.getAttribute("cy")),n=t.getAttribute("shape");return new Pc(this.ctx).getMarkerPath(r,i,n,e)}},{key:"getElBars",value:function(){return this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-bar-series, .apexcharts-candlestick-series, .apexcharts-boxPlot-series, .apexcharts-rangebar-series")}},{key:"hasBars",value:function(){return this.getElBars().length>0}},{key:"getHoverMarkerSize",value:function(t){var e=this.w,r=e.config.markers.hover.size;return void 0===r&&(r=e.globals.markers.size[t]+e.config.markers.hover.sizeOffset),r}},{key:"toggleAllTooltipSeriesGroups",value:function(t){var e=this.w,r=this.ttCtx;0===r.allTooltipSeriesGroups.length&&(r.allTooltipSeriesGroups=e.globals.dom.baseEl.querySelectorAll(".apexcharts-tooltip-series-group"));for(var i=r.allTooltipSeriesGroups,n=0;n ').concat(r.attrs.name,""),e+="
".concat(r.val,"
")})),v.innerHTML=t+"",m.innerHTML=e+""};a?l.globals.seriesGoals[e][r]&&Array.isArray(l.globals.seriesGoals[e][r])?x():(v.innerHTML="",m.innerHTML=""):x()}else v.innerHTML="",m.innerHTML="";if(null!==p&&(i[e].querySelector(".apexcharts-tooltip-text-z-label").innerHTML=l.config.tooltip.z.title,i[e].querySelector(".apexcharts-tooltip-text-z-value").innerHTML=void 0!==p?p:""),a&&g[0]){if(l.config.tooltip.hideEmptySeries){var w=i[e].querySelector(".apexcharts-tooltip-marker"),S=i[e].querySelector(".apexcharts-tooltip-text");0==parseFloat(u)?(w.style.display="none",S.style.display="none"):(w.style.display="block",S.style.display="block")}null==u||l.globals.ancillaryCollapsedSeriesIndices.indexOf(e)>-1||l.globals.collapsedSeriesIndices.indexOf(e)>-1||Array.isArray(c.tConfig.enabledOnSeries)&&-1===c.tConfig.enabledOnSeries.indexOf(e)?g[0].parentNode.style.display="none":g[0].parentNode.style.display=l.config.tooltip.items.display}else Array.isArray(c.tConfig.enabledOnSeries)&&-1===c.tConfig.enabledOnSeries.indexOf(e)&&(g[0].parentNode.style.display="none")}},{key:"toggleActiveInactiveSeries",value:function(t,e){var r=this.w;if(t)this.tooltipUtil.toggleAllTooltipSeriesGroups("enable");else{this.tooltipUtil.toggleAllTooltipSeriesGroups("disable");var i=r.globals.dom.baseEl.querySelector(".apexcharts-tooltip-series-group-".concat(e));i&&(i.classList.add("apexcharts-active"),i.style.display=r.config.tooltip.items.display)}}},{key:"getValuesToPrint",value:function(t){var e=t.i,r=t.j,i=this.w,n=this.ctx.series.filteredSeriesX(),o="",a="",s=null,l=null,c={series:i.globals.series,seriesIndex:e,dataPointIndex:r,w:i},u=i.globals.ttZFormatter;null===r?l=i.globals.series[e]:i.globals.isXNumeric&&"treemap"!==i.config.chart.type?(o=n[e][r],0===n[e].length&&(o=n[this.tooltipUtil.getFirstActiveXArray(n)][r])):o=new yh(this.ctx).isFormatXY()?void 0!==i.config.series[e].data[r]?i.config.series[e].data[r].x:"":void 0!==i.globals.labels[r]?i.globals.labels[r]:"";var h=o;return o=i.globals.isXNumeric&&"datetime"===i.config.xaxis.type?new Jc(this.ctx).xLabelFormat(i.globals.ttKeyFormatter,h,h,{i:void 0,dateFormatter:new Vc(this.ctx).formatDate,w:this.w}):i.globals.isBarHorizontal?i.globals.yLabelFormatters[0](h,c):i.globals.xLabelFormatter(h,c),void 0!==i.config.tooltip.x.formatter&&(o=i.globals.ttKeyFormatter(h,c)),i.globals.seriesZ.length>0&&i.globals.seriesZ[e].length>0&&(s=u(i.globals.seriesZ[e][r],i)),a="function"==typeof i.config.xaxis.tooltip.formatter?i.globals.xaxisTooltipFormatter(h,c):o,{val:Array.isArray(l)?l.join(" "):l,xVal:Array.isArray(o)?o.join(" "):o,xAxisTTVal:Array.isArray(a)?a.join(" "):a,zVal:s}}},{key:"handleCustomTooltip",value:function(t){var e=t.i,r=t.j,i=t.y1,n=t.y2,o=t.w,a=this.ttCtx.getElTooltip(),s=o.config.tooltip.custom;Array.isArray(s)&&s[e]&&(s=s[e]);var l=s({ctx:this.ctx,series:o.globals.series,seriesIndex:e,dataPointIndex:r,y1:i,y2:n,w:o});"string"==typeof l?a.innerHTML=l:(l instanceof Element||"string"==typeof l.nodeName)&&(a.innerHTML="",a.appendChild(l.cloneNode(!0)))}}],r&&Gd(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function qd(t){return qd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qd(t)}function Zd(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:null,r=this.ttCtx,i=this.w,n=r.getElXCrosshairs(),o=t-r.xcrosshairsWidth/2,a=i.globals.labels.slice().length;if(null!==e&&(o=i.globals.gridWidth/a*e),null===n||i.globals.isBarHorizontal||(n.setAttribute("x",o),n.setAttribute("x1",o),n.setAttribute("x2",o),n.setAttribute("y2",i.globals.gridHeight),n.classList.add("apexcharts-active")),o<0&&(o=0),o>i.globals.gridWidth&&(o=i.globals.gridWidth),r.isXAxisTooltipEnabled){var s=o;"tickWidth"!==i.config.xaxis.crosshairs.width&&"barWidth"!==i.config.xaxis.crosshairs.width||(s=o+r.xcrosshairsWidth/2),this.moveXAxisTooltip(s)}}},{key:"moveYCrosshairs",value:function(t){var e=this.ttCtx;null!==e.ycrosshairs&&Pc.setAttrs(e.ycrosshairs,{y1:t,y2:t}),null!==e.ycrosshairsHidden&&Pc.setAttrs(e.ycrosshairsHidden,{y1:t,y2:t})}},{key:"moveXAxisTooltip",value:function(t){var e=this.w,r=this.ttCtx;if(null!==r.xaxisTooltip&&0!==r.xcrosshairsWidth){r.xaxisTooltip.classList.add("apexcharts-active");var i,n=r.xaxisOffY+e.config.xaxis.tooltip.offsetY+e.globals.translateY+1+e.config.xaxis.offsetY;t-=r.xaxisTooltip.getBoundingClientRect().width/2,isNaN(t)||(t+=e.globals.translateX,i=new Pc(this.ctx).getTextRects(r.xaxisTooltipText.innerHTML),r.xaxisTooltipText.style.minWidth=i.width+"px",r.xaxisTooltip.style.left=t+"px",r.xaxisTooltip.style.top=n+"px")}}},{key:"moveYAxisTooltip",value:function(t){var e=this.w,r=this.ttCtx;null===r.yaxisTTEls&&(r.yaxisTTEls=e.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxistooltip"));var i=parseInt(r.ycrosshairsHidden.getAttribute("y1"),10),n=e.globals.translateY+i,o=r.yaxisTTEls[t].getBoundingClientRect().height,a=e.globals.translateYAxisX[t]-2;e.config.yaxis[t].opposite&&(a-=26),n-=o/2,-1===e.globals.ignoreYAxisIndexes.indexOf(t)?(r.yaxisTTEls[t].classList.add("apexcharts-active"),r.yaxisTTEls[t].style.top=n+"px",r.yaxisTTEls[t].style.left=a+e.config.yaxis[t].tooltip.offsetX+"px"):r.yaxisTTEls[t].classList.remove("apexcharts-active")}},{key:"moveTooltip",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=this.w,n=this.ttCtx,o=n.getElTooltip(),a=n.tooltipRect,s=null!==r?parseFloat(r):1,l=parseFloat(t)+s+5,c=parseFloat(e)+s/2;if(l>i.globals.gridWidth/2&&(l=l-a.ttWidth-s-10),l>i.globals.gridWidth-a.ttWidth-10&&(l=i.globals.gridWidth-a.ttWidth),l<-20&&(l=-20),i.config.tooltip.followCursor){var u=n.getElGrid().getBoundingClientRect();(l=n.e.clientX-u.left)>i.globals.gridWidth/2&&(l-=n.tooltipRect.ttWidth),(c=n.e.clientY+i.globals.translateY-u.top)>i.globals.gridHeight/2&&(c-=n.tooltipRect.ttHeight)}else i.globals.isBarHorizontal||a.ttHeight/2+c>i.globals.gridHeight&&(c=i.globals.gridHeight-a.ttHeight+i.globals.translateY);isNaN(l)||(l+=i.globals.translateX,o.style.left=l+"px",o.style.top=c+"px")}},{key:"moveMarkers",value:function(t,e){var r=this.w,i=this.ttCtx;if(r.globals.markers.size[t]>0)for(var n=r.globals.dom.baseEl.querySelectorAll(" .apexcharts-series[data\\:realIndex='".concat(t,"'] .apexcharts-marker")),o=0;o0){var d=f.getAttribute("shape"),p=l.getMarkerPath(n,o,d,1.5*u);f.setAttribute("d",p)}this.moveXCrosshairs(n),s.fixedTooltip||this.moveTooltip(n,o,u)}}},{key:"moveDynamicPointsOnHover",value:function(t){var e,r=this.ttCtx,i=r.w,n=0,o=0,a=i.globals.pointsArray,s=new fh(this.ctx),l=new Pc(this.ctx);e=s.getActiveConfigSeriesIndex("asc",["line","area","scatter","bubble"]);var c=r.tooltipUtil.getHoverMarkerSize(e);if(a[e]&&(n=a[e][t][0],o=a[e][t][1]),!isNaN(n)){var u=r.tooltipUtil.getAllMarkers();if(u.length)for(var h=0;h0){var y=l.getMarkerPath(n,d,g,c);u[h].setAttribute("d",y)}else u[h].setAttribute("d","")}}this.moveXCrosshairs(n),r.fixedTooltip||this.moveTooltip(n,o||i.globals.gridHeight,c)}}},{key:"moveStickyTooltipOverBars",value:function(t,e){var r=this.w,i=this.ttCtx,n=r.globals.columnSeries?r.globals.columnSeries.length:r.globals.series.length;r.config.chart.stacked&&(n=r.globals.barGroups.length);var o=n>=2&&n%2==0?Math.floor(n/2):Math.floor(n/2)+1;r.globals.isBarHorizontal&&(o=new fh(this.ctx).getActiveConfigSeriesIndex("desc")+1);var a=r.globals.dom.baseEl.querySelector(".apexcharts-bar-series .apexcharts-series[rel='".concat(o,"'] path[j='").concat(t,"'], .apexcharts-candlestick-series .apexcharts-series[rel='").concat(o,"'] path[j='").concat(t,"'], .apexcharts-boxPlot-series .apexcharts-series[rel='").concat(o,"'] path[j='").concat(t,"'], .apexcharts-rangebar-series .apexcharts-series[rel='").concat(o,"'] path[j='").concat(t,"']"));a||"number"!=typeof e||(a=r.globals.dom.baseEl.querySelector(".apexcharts-bar-series .apexcharts-series[data\\:realIndex='".concat(e,"'] path[j='").concat(t,"'],\n .apexcharts-candlestick-series .apexcharts-series[data\\:realIndex='").concat(e,"'] path[j='").concat(t,"'],\n .apexcharts-boxPlot-series .apexcharts-series[data\\:realIndex='").concat(e,"'] path[j='").concat(t,"'],\n .apexcharts-rangebar-series .apexcharts-series[data\\:realIndex='").concat(e,"'] path[j='").concat(t,"']")));var s=a?parseFloat(a.getAttribute("cx")):0,l=a?parseFloat(a.getAttribute("cy")):0,c=a?parseFloat(a.getAttribute("barWidth")):0,u=i.getElGrid().getBoundingClientRect(),h=a&&(a.classList.contains("apexcharts-candlestick-area")||a.classList.contains("apexcharts-boxPlot-area"));r.globals.isXNumeric?(a&&!h&&(s-=n%2!=0?c/2:0),a&&h&&(s-=c/2)):r.globals.isBarHorizontal||(s=i.xAxisTicksPositions[t-1]+i.dataPointsDividedWidth/2,isNaN(s)&&(s=i.xAxisTicksPositions[t]-i.dataPointsDividedWidth/2)),r.globals.isBarHorizontal?l-=i.tooltipRect.ttHeight:r.config.tooltip.followCursor?l=i.e.clientY-u.top-i.tooltipRect.ttHeight/2:l+i.tooltipRect.ttHeight+15>r.globals.gridHeight&&(l=r.globals.gridHeight),r.globals.isBarHorizontal||this.moveXCrosshairs(s),i.fixedTooltip||this.moveTooltip(s,l||r.globals.gridHeight)}}],r&&Zd(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Qd(t){return Qd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qd(t)}function Kd(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,n=this.w;"bubble"!==n.config.chart.type&&this.newPointSize(t,e);var o=e.getAttribute("cx"),a=e.getAttribute("cy");if(null!==r&&null!==i&&(o=r,a=i),this.tooltipPosition.moveXCrosshairs(o),!this.fixedTooltip){if("radar"===n.config.chart.type){var s=this.ttCtx.getElGrid().getBoundingClientRect();o=this.ttCtx.e.clientX-s.left}this.tooltipPosition.moveTooltip(o,a,n.config.markers.hover.size)}}},{key:"enlargePoints",value:function(t){for(var e=this.w,r=this,i=this.ttCtx,n=t,o=e.globals.dom.baseEl.querySelectorAll(".apexcharts-series:not(.apexcharts-series-collapsed) .apexcharts-marker"),a=e.config.markers.hover.size,s=0;s0){var i=this.ttCtx.tooltipUtil.getPathFromPoint(t[e],r);t[e].setAttribute("d",i)}else t[e].setAttribute("d","M0,0")}}}],r&&tp(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function ip(t){return ip="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ip(t)}function np(t,e){for(var r=0;rs.globals.gridWidth/2&&(i=u-a.tooltipRect.ttWidth/2+f),a.w.config.tooltip.followCursor){var p=s.globals.dom.elWrap.getBoundingClientRect();i=s.globals.clientX-p.left-(i>s.globals.gridWidth/2?a.tooltipRect.ttWidth:0),n=s.globals.clientY-p.top-(n>s.globals.gridHeight/2?a.tooltipRect.ttHeight:0)}}return{x:i,y:n}}},{key:"handleMarkerTooltip",value:function(t){var e,r,i=t.e,n=t.opt,o=t.x,a=t.y,s=this.w,l=this.ttCtx;if(i.target.classList.contains("apexcharts-marker")){var c=parseInt(n.paths.getAttribute("cx"),10),u=parseInt(n.paths.getAttribute("cy"),10),h=parseFloat(n.paths.getAttribute("val"));if(r=parseInt(n.paths.getAttribute("rel"),10),e=parseInt(n.paths.parentNode.parentNode.parentNode.getAttribute("rel"),10)-1,l.intersect){var d=f.findAncestor(n.paths,"apexcharts-series");d&&(e=parseInt(d.getAttribute("data:realIndex"),10))}if(l.tooltipLabels.drawSeriesTexts({ttItems:n.ttItems,i:e,j:r,shared:!l.showOnIntersect&&s.config.tooltip.shared,e:i}),"mouseup"===i.type&&l.markerClick(i,e,r),s.globals.capturedSeriesIndex=e,s.globals.capturedDataPointIndex=r,o=c,a=u+s.globals.translateY-1.4*l.tooltipRect.ttHeight,l.w.config.tooltip.followCursor){var p=l.getElGrid().getBoundingClientRect();a=l.e.clientY+s.globals.translateY-p.top}h<0&&(a=u),l.marker.enlargeCurrentPoint(r,n.paths,o,a)}return{x:o,y:a}}},{key:"handleBarTooltip",value:function(t){var e,r,i=t.e,n=t.opt,o=this.w,a=this.ttCtx,s=a.getElTooltip(),l=0,c=0,u=0,h=this.getBarTooltipXY({e:i,opt:n});if(null!==h.j||0!==h.barHeight||0!==h.barWidth){e=h.i;var f=h.j;if(o.globals.capturedSeriesIndex=e,o.globals.capturedDataPointIndex=f,o.globals.isBarHorizontal&&a.tooltipUtil.hasBars()||!o.config.tooltip.shared?(c=h.x,u=h.y,r=Array.isArray(o.config.stroke.width)?o.config.stroke.width[e]:o.config.stroke.width,l=c):o.globals.comboCharts||o.config.tooltip.shared||(l/=2),isNaN(u)&&(u=o.globals.svgHeight-a.tooltipRect.ttHeight),parseInt(n.paths.parentNode.getAttribute("data:realIndex"),10),c+a.tooltipRect.ttWidth>o.globals.gridWidth?c-=a.tooltipRect.ttWidth:c<0&&(c=0),a.w.config.tooltip.followCursor){var d=a.getElGrid().getBoundingClientRect();u=a.e.clientY-d.top}null===a.tooltip&&(a.tooltip=o.globals.dom.baseEl.querySelector(".apexcharts-tooltip")),o.config.tooltip.shared||(o.globals.comboBarCount>0?a.tooltipPosition.moveXCrosshairs(l+r/2):a.tooltipPosition.moveXCrosshairs(l)),!a.fixedTooltip&&(!o.config.tooltip.shared||o.globals.isBarHorizontal&&a.tooltipUtil.hasBars())&&(u=u+o.globals.translateY-a.tooltipRect.ttHeight/2,s.style.left=c+o.globals.translateX+"px",s.style.top=u+"px")}}},{key:"getBarTooltipXY",value:function(t){var e=this,r=t.e,i=t.opt,n=this.w,o=null,a=this.ttCtx,s=0,l=0,c=0,u=0,h=0,f=r.target.classList;if(f.contains("apexcharts-bar-area")||f.contains("apexcharts-candlestick-area")||f.contains("apexcharts-boxPlot-area")||f.contains("apexcharts-rangebar-area")){var d=r.target,p=d.getBoundingClientRect(),g=i.elGrid.getBoundingClientRect(),b=p.height;h=p.height;var y=p.width,v=parseInt(d.getAttribute("cx"),10),m=parseInt(d.getAttribute("cy"),10);u=parseFloat(d.getAttribute("barWidth"));var x="touchmove"===r.type?r.touches[0].clientX:r.clientX;o=parseInt(d.getAttribute("j"),10),s=parseInt(d.parentNode.getAttribute("rel"),10)-1;var w=d.getAttribute("data-range-y1"),S=d.getAttribute("data-range-y2");n.globals.comboCharts&&(s=parseInt(d.parentNode.getAttribute("data:realIndex"),10));var k=function(t){return n.globals.isXNumeric?v-y/2:e.isVerticalGroupedRangeBar?v+y/2:v-a.dataPointsDividedWidth+y/2},A=function(){return m-a.dataPointsDividedHeight+b/2-a.tooltipRect.ttHeight/2};a.tooltipLabels.drawSeriesTexts({ttItems:i.ttItems,i:s,j:o,y1:w?parseInt(w,10):null,y2:S?parseInt(S,10):null,shared:!a.showOnIntersect&&n.config.tooltip.shared,e:r}),n.config.tooltip.followCursor?n.globals.isBarHorizontal?(l=x-g.left+15,c=A()):(l=k(),c=r.clientY-g.top-a.tooltipRect.ttHeight/2-15):n.globals.isBarHorizontal?((l=v)0&&r.setAttribute("width",e.xcrosshairsWidth)}},{key:"handleYCrosshair",value:function(){var t=this.w,e=this.ttCtx;e.ycrosshairs=t.globals.dom.baseEl.querySelector(".apexcharts-ycrosshairs"),e.ycrosshairsHidden=t.globals.dom.baseEl.querySelector(".apexcharts-ycrosshairs-hidden")}},{key:"drawYaxisTooltipText",value:function(t,e,r){var i=this.ttCtx,n=this.w,o=n.globals,a=o.seriesYAxisMap[t];if(i.yaxisTooltips[t]&&a.length>0){var s=o.yLabelFormatters[t],l=i.getElGrid().getBoundingClientRect(),c=a[0],u=0;r.yRatio.length>1&&(u=c);var h=(e-l.top)*r.yRatio[u],f=o.maxYArr[c]-o.minYArr[c],d=o.minYArr[c]+(f-h);n.config.yaxis[t].reversed&&(d=o.maxYArr[c]-(f-h)),i.tooltipPosition.moveYCrosshairs(e-l.top),i.yaxisTooltipText[t].innerHTML=s(d),i.tooltipPosition.moveYAxisTooltip(t)}}}],r&&cp(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();const fp=hp;function dp(t){return dp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dp(t)}function pp(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function gp(t){for(var e=1;e0&&this.addPathsEventListeners(d,u),this.tooltipUtil.hasBars()&&!this.tConfig.shared&&this.addDatapointEventsListeners(u)}}},{key:"drawFixedTooltipRect",value:function(){var t=this.w,e=this.getElTooltip(),r=e.getBoundingClientRect(),i=r.width+10,n=r.height+10,o=this.tConfig.fixed.offsetX,a=this.tConfig.fixed.offsetY,s=this.tConfig.fixed.position.toLowerCase();return s.indexOf("right")>-1&&(o=o+t.globals.svgWidth-i+10),s.indexOf("bottom")>-1&&(a=a+t.globals.svgHeight-n-10),e.style.left=o+"px",e.style.top=a+"px",{x:o,y:a,ttWidth:i,ttHeight:n}}},{key:"addDatapointEventsListeners",value:function(t){var e=this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-series-markers .apexcharts-marker, .apexcharts-bar-area, .apexcharts-candlestick-area, .apexcharts-boxPlot-area, .apexcharts-rangebar-area");this.addPathsEventListeners(e,t)}},{key:"addPathsEventListeners",value:function(t,e){for(var r=this,i=function(i){var n={paths:t[i],tooltipEl:e.tooltipEl,tooltipY:e.tooltipY,tooltipX:e.tooltipX,elGrid:e.elGrid,hoverArea:e.hoverArea,ttItems:e.ttItems};["mousemove","mouseup","touchmove","mouseout","touchend"].map((function(e){return t[i].addEventListener(e,r.onSeriesHover.bind(r,n),{capture:!1,passive:!0})}))},n=0;n=20?this.seriesHover(t,e):(clearTimeout(this.seriesHoverTimeout),this.seriesHoverTimeout=setTimeout((function(){r.seriesHover(t,e)}),20-i))}},{key:"seriesHover",value:function(t,e){var r=this;this.lastHoverTime=Date.now();var i=[],n=this.w;n.config.chart.group&&(i=this.ctx.getGroupedCharts()),n.globals.axisCharts&&(n.globals.minX===-1/0&&n.globals.maxX===1/0||0===n.globals.dataPoints)||(i.length?i.forEach((function(i){var n=r.getElTooltip(i),o={paths:t.paths,tooltipEl:n,tooltipY:t.tooltipY,tooltipX:t.tooltipX,elGrid:t.elGrid,hoverArea:t.hoverArea,ttItems:i.w.globals.tooltip.ttItems};i.w.globals.minX===r.w.globals.minX&&i.w.globals.maxX===r.w.globals.maxX&&i.w.globals.tooltip.seriesHoverByContext({chartCtx:i,ttCtx:i.w.globals.tooltip,opt:o,e})})):this.seriesHoverByContext({chartCtx:this.ctx,ttCtx:this.w.globals.tooltip,opt:t,e}))}},{key:"seriesHoverByContext",value:function(t){var e=t.chartCtx,r=t.ttCtx,i=t.opt,n=t.e,o=e.w,a=this.getElTooltip(e);a&&(r.tooltipRect={x:0,y:0,ttWidth:a.getBoundingClientRect().width,ttHeight:a.getBoundingClientRect().height},r.e=n,!r.tooltipUtil.hasBars()||o.globals.comboCharts||r.isBarShared||this.tConfig.onDatasetHover.highlightDataSeries&&new fh(e).toggleSeriesOnHover(n,n.target.parentNode),r.fixedTooltip&&r.drawFixedTooltipRect(),o.globals.axisCharts?r.axisChartsTooltips({e:n,opt:i,tooltipRect:r.tooltipRect}):r.nonAxisChartsTooltips({e:n,opt:i,tooltipRect:r.tooltipRect}))}},{key:"axisChartsTooltips",value:function(t){var e,r,i=t.e,n=t.opt,o=this.w,a=n.elGrid.getBoundingClientRect(),s="touchmove"===i.type?i.touches[0].clientX:i.clientX,l="touchmove"===i.type?i.touches[0].clientY:i.clientY;if(this.clientY=l,this.clientX=s,o.globals.capturedSeriesIndex=-1,o.globals.capturedDataPointIndex=-1,la.top+a.height)this.handleMouseOut(n);else{if(Array.isArray(this.tConfig.enabledOnSeries)&&!o.config.tooltip.shared){var c=parseInt(n.paths.getAttribute("index"),10);if(this.tConfig.enabledOnSeries.indexOf(c)<0)return void this.handleMouseOut(n)}var u=this.getElTooltip(),h=this.getElXCrosshairs(),f=[];o.config.chart.group&&(f=this.ctx.getSyncedCharts());var d=o.globals.xyCharts||"bar"===o.config.chart.type&&!o.globals.isBarHorizontal&&this.tooltipUtil.hasBars()&&this.tConfig.shared||o.globals.comboCharts&&this.tooltipUtil.hasBars();if("mousemove"===i.type||"touchmove"===i.type||"mouseup"===i.type){if(o.globals.collapsedSeries.length+o.globals.ancillaryCollapsedSeries.length===o.globals.series.length)return;null!==h&&h.classList.add("apexcharts-active");var p=this.yaxisTooltips.filter((function(t){return!0===t}));if(null!==this.ycrosshairs&&p.length&&this.ycrosshairs.classList.add("apexcharts-active"),d&&!this.showOnIntersect||f.length>1)this.handleStickyTooltip(i,s,l,n);else if("heatmap"===o.config.chart.type||"treemap"===o.config.chart.type){var g=this.intersect.handleHeatTreeTooltip({e:i,opt:n,x:e,y:r,type:o.config.chart.type});e=g.x,r=g.y,u.style.left=e+"px",u.style.top=r+"px"}else this.tooltipUtil.hasBars()&&this.intersect.handleBarTooltip({e:i,opt:n}),this.tooltipUtil.hasMarkers()&&this.intersect.handleMarkerTooltip({e:i,opt:n,x:e,y:r});if(this.yaxisTooltips.length)for(var b=0;bl.width)this.handleMouseOut(i);else if(null!==s)this.handleStickyCapturedSeries(t,s,i,a);else if(this.tooltipUtil.isXoverlap(a)||n.globals.isBarHorizontal){var c=n.globals.series.findIndex((function(t,e){return!n.globals.collapsedSeriesIndices.includes(e)}));this.create(t,this,c,a,i.ttItems)}}},{key:"handleStickyCapturedSeries",value:function(t,e,r,i){var n=this.w;if(this.tConfig.shared||null!==n.globals.series[e][i]){if(void 0!==n.globals.series[e][i])this.tConfig.shared&&this.tooltipUtil.isXoverlap(i)&&this.tooltipUtil.isInitialSeriesSameLen()?this.create(t,this,e,i,r.ttItems):this.create(t,this,e,i,r.ttItems,!1);else if(this.tooltipUtil.isXoverlap(i)){var o=n.globals.series.findIndex((function(t,e){return!n.globals.collapsedSeriesIndices.includes(e)}));this.create(t,this,o,i,r.ttItems)}}else this.handleMouseOut(r)}},{key:"deactivateHoverFilter",value:function(){for(var t=this.w,e=new Pc(this.ctx),r=t.globals.dom.Paper.find(".apexcharts-bar-area"),i=0;i5&&void 0!==arguments[5]?arguments[5]:null,S=this.w,k=e;"mouseup"===t.type&&this.markerClick(t,r,i),null===w&&(w=this.tConfig.shared);var A=this.tooltipUtil.hasMarkers(r),O=this.tooltipUtil.getElBars(),P=function(){S.globals.markers.largestSize>0?k.marker.enlargePoints(i):k.tooltipPosition.moveDynamicPointsOnHover(i)};if(S.config.legend.tooltipHoverFormatter){var C=S.config.legend.tooltipHoverFormatter,j=Array.from(this.legendLabels);j.forEach((function(t){var e=t.getAttribute("data:default-text");t.innerHTML=decodeURIComponent(e)}));for(var T=0;T0)){var _=new Pc(this.ctx),z=S.globals.dom.Paper.find(".apexcharts-bar-area[j='".concat(i,"']"));this.deactivateHoverFilter(),k.tooltipPosition.moveStickyTooltipOverBars(i,r),k.tooltipUtil.getAllMarkers(!0).length&&P();for(var X=0;X0&&n.config.plotOptions.bar.hideZeroBarsWhenGrouped&&(d-=u*k)),S&&(d=d+f.height/2-v/2-2);var O=n.globals.series[o][a]<0,P=l;switch(this.barCtx.isReversed&&(P=l+(O?h:-h)),b.position){case"center":p=S?O?P-h/2+x:P+h/2-x:O?P-h/2+f.height/2+x:P+h/2+f.height/2-x;break;case"bottom":p=S?O?P-h+x:P+h-x:O?P-h+f.height+v+x:P+h-f.height/2+v-x;break;case"top":p=S?O?P+x:P-x:O?P-f.height/2-x:P+f.height+x}var C=P;if(n.globals.seriesGroups.forEach((function(t){var e;null===(e=i.barCtx[t.join(",")])||void 0===e||e.prevY.forEach((function(t){C=O?Math.max(t[a],C):Math.min(t[a],C)}))})),this.barCtx.lastActiveBarSerieIndex===s&&y.enabled){var j=new Pc(this.barCtx.ctx).getTextRects(this.getStackedTotalDataLabel({realIndex:s,j:a}),g.fontSize);e=O?C-j.height/2-x-y.offsetY+18:C+j.height+x+y.offsetY-18;var T=A;r=w+(n.globals.isXNumeric?-u*n.globals.barGroups.length/2:n.globals.barGroups.length*u/2-(n.globals.barGroups.length-1)*u-T)+y.offsetX}return n.config.chart.stacked||(p<0?p=0+v:p+f.height/3>n.globals.gridHeight&&(p=n.globals.gridHeight-v)),{bcx:c,bcy:l,dataLabelsX:d,dataLabelsY:p,totalDataLabelsX:r,totalDataLabelsY:e,totalDataLabelsAnchor:"middle"}}},{key:"calculateBarsDataLabelsPosition",value:function(t){var e=this,r=this.w,i=t.x,n=t.i,o=t.j,a=t.realIndex,s=t.bcy,l=t.barHeight,c=t.barWidth,u=t.textRects,h=t.dataLabelsX,f=t.strokeWidth,d=t.dataLabelsConfig,p=t.barDataLabelsConfig,g=t.barTotalDataLabelsConfig,b=t.offX,y=t.offY,v=r.globals.gridHeight/r.globals.dataPoints,m=this.barCtx.barHelpers.getZeroValueEncounters({i:n,j:o}).zeroEncounters;c=Math.abs(c);var x,w,S=s-(this.barCtx.isRangeBar?0:v)+l/2+u.height/2+y-3;!r.config.chart.stacked&&m>0&&r.config.plotOptions.bar.hideZeroBarsWhenGrouped&&(S-=l*m);var k="start",A=r.globals.series[n][o]<0,O=i;switch(this.barCtx.isReversed&&(O=i+(A?-c:c),k=A?"start":"end"),p.position){case"center":h=A?O+c/2-b:Math.max(u.width/2,O-c/2)+b;break;case"bottom":h=A?O+c-f-b:O-c+f+b;break;case"top":h=A?O-f-b:O-f+b}var P=O;if(r.globals.seriesGroups.forEach((function(t){var r;null===(r=e.barCtx[t.join(",")])||void 0===r||r.prevX.forEach((function(t){P=A?Math.min(t[o],P):Math.max(t[o],P)}))})),this.barCtx.lastActiveBarSerieIndex===a&&g.enabled){var C=new Pc(this.barCtx.ctx).getTextRects(this.getStackedTotalDataLabel({realIndex:a,j:o}),d.fontSize);A?(x=P-f-b-g.offsetX,k="end"):x=P+b+g.offsetX+(this.barCtx.isReversed?-(c+f):f),w=S-u.height/2+C.height/2+g.offsetY+f,r.globals.barGroups.length>1&&(w-=r.globals.barGroups.length/2*(l/2))}return r.config.chart.stacked||("start"===d.textAnchor?h-u.width<0?h=A?u.width+f:f:h+u.width>r.globals.gridWidth&&(h=A?r.globals.gridWidth-f:r.globals.gridWidth-u.width-f):"middle"===d.textAnchor?h-u.width/2<0?h=u.width/2+f:h+u.width/2>r.globals.gridWidth&&(h=r.globals.gridWidth-u.width/2-f):"end"===d.textAnchor&&(h<1?h=u.width+f:h+1>r.globals.gridWidth&&(h=r.globals.gridWidth-u.width-f))),{bcx:i,bcy:s,dataLabelsX:h,dataLabelsY:S,totalDataLabelsX:x,totalDataLabelsY:w,totalDataLabelsAnchor:k}}},{key:"drawCalculatedDataLabels",value:function(t){var e=t.x,r=t.y,i=t.val,n=t.i,o=t.j,a=t.textRects,s=t.barHeight,l=t.barWidth,c=t.dataLabelsConfig,u=this.w,h="rotate(0)";"vertical"===u.config.plotOptions.bar.dataLabels.orientation&&(h="rotate(-90, ".concat(e,", ").concat(r,")"));var f=new lh(this.barCtx.ctx),d=new Pc(this.barCtx.ctx),p=c.formatter,g=null,b=u.globals.collapsedSeriesIndices.indexOf(n)>-1;if(c.enabled&&!b){g=d.group({class:"apexcharts-data-labels",transform:h});var y="";void 0!==i&&(y=p(i,Sp(Sp({},u),{},{seriesIndex:n,dataPointIndex:o,w:u}))),!i&&u.config.plotOptions.bar.hideZeroBarsWhenGrouped&&(y="");var v=u.globals.series[n][o]<0,m=u.config.plotOptions.bar.dataLabels.position;"vertical"===u.config.plotOptions.bar.dataLabels.orientation&&("top"===m&&(c.textAnchor=v?"end":"start"),"center"===m&&(c.textAnchor="middle"),"bottom"===m&&(c.textAnchor=v?"end":"start")),this.barCtx.isRangeBar&&this.barCtx.barOptions.dataLabels.hideOverflowingLabels&&lMath.abs(l)&&(y=""):a.height/1.6>Math.abs(s)&&(y=""));var x=Sp({},c);this.barCtx.isHorizontal&&i<0&&("start"===c.textAnchor?x.textAnchor="end":"end"===c.textAnchor&&(x.textAnchor="start")),f.plotDataLabelsText({x:e,y:r,text:y,i:n,j:o,parent:g,dataLabelsConfig:x,alwaysDrawDataLabel:!0,offsetCorrection:!0})}return g}},{key:"drawTotalDataLabels",value:function(t){var e,r=t.x,i=t.y,n=t.val,o=t.realIndex,a=t.textAnchor,s=t.barTotalDataLabelsConfig,l=(this.w,new Pc(this.barCtx.ctx));return s.enabled&&void 0!==r&&void 0!==i&&this.barCtx.lastActiveBarSerieIndex===o&&(e=l.drawText({x:r,y:i,foreColor:s.style.color,text:n,textAnchor:a,fontFamily:s.style.fontFamily,fontSize:s.style.fontSize,fontWeight:s.style.fontWeight})),e}}],r&&Ap(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Cp(t){return Cp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Cp(t)}function jp(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function Tp(t){for(var e=1;e=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function Lp(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r0&&(this.barCtx.seriesLen=this.barCtx.seriesLen+1,this.barCtx.totalItems+=t[r].length),e.globals.isXNumeric)for(var i=0;ie.globals.minX&&e.globals.seriesX[r][i]0&&(n=c.globals.minXDiff/d),(a=n/h*parseInt(this.barCtx.barOptions.columnWidth,10)/100)<1&&(a=1)}-1===String(this.barCtx.barOptions.columnWidth).indexOf("%")&&(a=parseInt(this.barCtx.barOptions.columnWidth,10)),s=c.globals.gridHeight-this.barCtx.baseLineY[this.barCtx.translationsIndex]-(this.barCtx.isReversed?c.globals.gridHeight:0)+(this.barCtx.isReversed?2*this.barCtx.baseLineY[this.barCtx.translationsIndex]:0),e=c.globals.isXNumeric?this.barCtx.getBarXForNumericXAxis({x:e,j:0,realIndex:t,barWidth:a}).x:c.globals.padHorizontal+f.noExponents(n-a*this.barCtx.seriesLen)/2}return c.globals.barHeight=o,c.globals.barWidth=a,{x:e,y:r,yDivision:i,xDivision:n,barHeight:o,barWidth:a,zeroH:s,zeroW:l}}},{key:"initializeStackedPrevVars",value:function(t){t.w.globals.seriesGroups.forEach((function(e){t[e]||(t[e]={}),t[e].prevY=[],t[e].prevX=[],t[e].prevYF=[],t[e].prevXF=[],t[e].prevYVal=[],t[e].prevXVal=[]}))}},{key:"initializeStackedXYVars",value:function(t){t.w.globals.seriesGroups.forEach((function(e){t[e]||(t[e]={}),t[e].xArrj=[],t[e].xArrjF=[],t[e].xArrjVal=[],t[e].yArrj=[],t[e].yArrjF=[],t[e].yArrjVal=[]}))}},{key:"getPathFillColor",value:function(t,e,r,i){var n,o,a,s,l=this.w,c=this.barCtx.ctx.fill,u=null,h=this.barCtx.barOptions.distributed?r:e,f=!1;return this.barCtx.barOptions.colors.ranges.length>0&&this.barCtx.barOptions.colors.ranges.map((function(i){t[e][r]>=i.from&&t[e][r]<=i.to&&(u=i.color,f=!0)})),{color:c.fillPath({seriesNumber:this.barCtx.barOptions.distributed?h:i,dataPointIndex:r,color:u,value:t[e][r],fillConfig:null===(n=l.config.series[e].data[r])||void 0===n?void 0:n.fill,fillType:null!==(o=l.config.series[e].data[r])&&void 0!==o&&null!==(a=o.fill)&&void 0!==a&&a.type?null===(s=l.config.series[e].data[r])||void 0===s?void 0:s.fill.type:Array.isArray(l.config.fill.type)?l.config.fill.type[i]:l.config.fill.type}),useRangeColor:f}}},{key:"getStrokeWidth",value:function(t,e,r){var i=0,n=this.w;return this.barCtx.series[t][e]?this.barCtx.isNullValue=!1:this.barCtx.isNullValue=!0,n.config.stroke.show&&(this.barCtx.isNullValue||(i=Array.isArray(this.barCtx.strokeWidth)?this.barCtx.strokeWidth[r]:this.barCtx.strokeWidth)),i}},{key:"createBorderRadiusArr",value:function(t){var e,r=this.w,i=!this.w.config.chart.stacked||r.config.plotOptions.bar.borderRadius<=0,n=t.length,o=0|(null===(e=t[0])||void 0===e?void 0:e.length),a=Array.from({length:n},(function(){return Array(o).fill(i?"top":"none")}));if(i)return a;for(var s=0;s0?(l.push(h),u++):f<0&&(c.push(h),u++)}if(l.length>0&&0===c.length)if(1===l.length)a[l[0]][s]="both";else{var d,p=l[0],g=l[l.length-1],b=Mp(l);try{for(b.s();!(d=b.n()).done;){var y=d.value;a[y][s]=y===p?"bottom":y===g?"top":"none"}}catch(t){b.e(t)}finally{b.f()}}else if(c.length>0&&0===l.length)if(1===c.length)a[c[0]][s]="both";else{var v,m=Math.max.apply(Math,c),x=Math.min.apply(Math,c),w=Mp(c);try{for(w.s();!(v=w.n()).done;){var S=v.value;a[S][s]=S===m?"bottom":S===x?"top":"none"}}catch(t){w.e(t)}finally{w.f()}}else if(l.length>0&&c.length>0){var k,A=l[l.length-1],O=Mp(l);try{for(O.s();!(k=O.n()).done;){var P=k.value;a[P][s]=P===A?"top":"none"}}catch(t){O.e(t)}finally{O.f()}var C,j=Math.max.apply(Math,c),T=Mp(c);try{for(T.s();!(C=T.n()).done;){var E=C.value;a[E][s]=E===j?"bottom":"none"}}catch(t){T.e(t)}finally{T.f()}}else 1===u&&(a[l[0]||c[0]][s]="both")}return a}},{key:"barBackground",value:function(t){var e=t.j,r=t.i,i=t.x1,n=t.x2,o=t.y1,a=t.y2,s=t.elSeries,l=this.w,c=new Pc(this.barCtx.ctx),u=new fh(this.barCtx.ctx).getActiveConfigSeriesIndex();if(this.barCtx.barOptions.colors.backgroundBarColors.length>0&&u===r){e>=this.barCtx.barOptions.colors.backgroundBarColors.length&&(e%=this.barCtx.barOptions.colors.backgroundBarColors.length);var h=this.barCtx.barOptions.colors.backgroundBarColors[e],f=c.drawRect(void 0!==i?i:0,void 0!==o?o:0,void 0!==n?n:l.globals.gridWidth,void 0!==a?a:l.globals.gridHeight,this.barCtx.barOptions.colors.backgroundBarRadius,h,this.barCtx.barOptions.colors.backgroundBarOpacity);s.add(f),f.node.classList.add("apexcharts-backgroundBar")}}},{key:"getColumnPaths",value:function(t){var e,r=t.barWidth,i=t.barXPosition,n=t.y1,o=t.y2,a=t.strokeWidth,s=t.isReversed,l=t.series,c=t.seriesGroup,u=t.realIndex,h=t.i,f=t.j,d=t.w,p=new Pc(this.barCtx.ctx);(a=Array.isArray(a)?a[u]:a)||(a=0);var g=r,b=i;null!==(e=d.config.series[u].data[f])&&void 0!==e&&e.columnWidthOffset&&(b=i-d.config.series[u].data[f].columnWidthOffset/2,g=r+d.config.series[u].data[f].columnWidthOffset);var y=a/2,v=b+y,m=b+g-y,x=(l[h][f]>=0?1:-1)*(s?-1:1);n+=.001-y*x,o+=.001+y*x;var w=p.move(v,n),S=p.move(v,n),k=p.line(m,n);if(d.globals.previousPaths.length>0&&(S=this.barCtx.getPreviousPath(u,f,!1)),w=w+p.line(v,o)+p.line(m,o)+k+("around"===d.config.plotOptions.bar.borderRadiusApplication||"both"===this.arrBorderRadius[u][f]?" Z":" z"),S=S+p.line(v,n)+k+k+k+k+k+p.line(v,n)+("around"===d.config.plotOptions.bar.borderRadiusApplication||"both"===this.arrBorderRadius[u][f]?" Z":" z"),"none"!==this.arrBorderRadius[u][f]&&(w=p.roundPathCorners(w,d.config.plotOptions.bar.borderRadius)),d.config.chart.stacked){var A=this.barCtx;(A=this.barCtx[c]).yArrj.push(o-y*x),A.yArrjF.push(Math.abs(n-o+a*x)),A.yArrjVal.push(this.barCtx.series[h][f])}return{pathTo:w,pathFrom:S}}},{key:"getBarpaths",value:function(t){var e,r=t.barYPosition,i=t.barHeight,n=t.x1,o=t.x2,a=t.strokeWidth,s=t.isReversed,l=t.series,c=t.seriesGroup,u=t.realIndex,h=t.i,f=t.j,d=t.w,p=new Pc(this.barCtx.ctx);(a=Array.isArray(a)?a[u]:a)||(a=0);var g=r,b=i;null!==(e=d.config.series[u].data[f])&&void 0!==e&&e.barHeightOffset&&(g=r-d.config.series[u].data[f].barHeightOffset/2,b=i+d.config.series[u].data[f].barHeightOffset);var y=a/2,v=g+y,m=g+b-y,x=(l[h][f]>=0?1:-1)*(s?-1:1);n+=.001+y*x,o+=.001-y*x;var w=p.move(n,v),S=p.move(n,v);d.globals.previousPaths.length>0&&(S=this.barCtx.getPreviousPath(u,f,!1));var k=p.line(n,m);if(w=w+p.line(o,v)+p.line(o,m)+k+("around"===d.config.plotOptions.bar.borderRadiusApplication||"both"===this.arrBorderRadius[u][f]?" Z":" z"),S=S+p.line(n,v)+k+k+k+k+k+p.line(n,v)+("around"===d.config.plotOptions.bar.borderRadiusApplication||"both"===this.arrBorderRadius[u][f]?" Z":" z"),"none"!==this.arrBorderRadius[u][f]&&(w=p.roundPathCorners(w,d.config.plotOptions.bar.borderRadius)),d.config.chart.stacked){var A=this.barCtx;(A=this.barCtx[c]).xArrj.push(o+y*x),A.xArrjF.push(Math.abs(n-o-a*x)),A.xArrjVal.push(this.barCtx.series[h][f])}return{pathTo:w,pathFrom:S}}},{key:"checkZeroSeries",value:function(t){for(var e=t.series,r=this.w,i=0;i2&&void 0!==arguments[2]&&!arguments[2]?null:e;return null!=t&&(r=e+t/this.barCtx.invertedYRatio-2*(this.barCtx.isReversed?t/this.barCtx.invertedYRatio:0)),r}},{key:"getYForValue",value:function(t,e,r){var i=arguments.length>3&&void 0!==arguments[3]&&!arguments[3]?null:e;return null!=t&&(i=e-t/this.barCtx.yRatio[r]+2*(this.barCtx.isReversed?t/this.barCtx.yRatio[r]:0)),i}},{key:"getGoalValues",value:function(t,e,r,i,n,o){var a=this,s=this.w,l=[],c=function(i,n){var s;l.push((Ep(s={},t,"x"===t?a.getXForValue(i,e,!1):a.getYForValue(i,r,o,!1)),Ep(s,"attrs",n),s))};if(s.globals.seriesGoals[i]&&s.globals.seriesGoals[i][n]&&Array.isArray(s.globals.seriesGoals[i][n])&&s.globals.seriesGoals[i][n].forEach((function(t){c(t.value,t)})),this.barCtx.barOptions.isDumbbell&&s.globals.seriesRange.length){var u=this.barCtx.barOptions.dumbbellColors?this.barCtx.barOptions.dumbbellColors:s.globals.colors,h={strokeHeight:"x"===t?0:s.globals.markers.size[i],strokeWidth:"x"===t?s.globals.markers.size[i]:0,strokeDashArray:0,strokeLineCap:"round",strokeColor:Array.isArray(u[i])?u[i][0]:u[i]};c(s.globals.seriesRangeStart[i][n],h),c(s.globals.seriesRangeEnd[i][n],Tp(Tp({},h),{},{strokeColor:Array.isArray(u[i])?u[i][1]:u[i]}))}return l}},{key:"drawGoalLine",value:function(t){var e=t.barXPosition,r=t.barYPosition,i=t.goalX,n=t.goalY,o=t.barWidth,a=t.barHeight,s=new Pc(this.barCtx.ctx),l=s.group({className:"apexcharts-bar-goals-groups"});l.node.classList.add("apexcharts-element-hidden"),this.barCtx.w.globals.delayedElements.push({el:l.node}),l.attr("clip-path","url(#gridRectMarkerMask".concat(this.barCtx.w.globals.cuid,")"));var c=null;return this.barCtx.isHorizontal?Array.isArray(i)&&i.forEach((function(t){if(t.x>=-1&&t.x<=s.w.globals.gridWidth+1){var e=void 0!==t.attrs.strokeHeight?t.attrs.strokeHeight:a/2,i=r+e+a/2;c=s.drawLine(t.x,i-2*e,t.x,i,t.attrs.strokeColor?t.attrs.strokeColor:void 0,t.attrs.strokeDashArray,t.attrs.strokeWidth?t.attrs.strokeWidth:2,t.attrs.strokeLineCap),l.add(c)}})):Array.isArray(n)&&n.forEach((function(t){if(t.y>=-1&&t.y<=s.w.globals.gridHeight+1){var r=void 0!==t.attrs.strokeWidth?t.attrs.strokeWidth:o/2,i=e+r+o/2;c=s.drawLine(i-2*r,t.y,i,t.y,t.attrs.strokeColor?t.attrs.strokeColor:void 0,t.attrs.strokeDashArray,t.attrs.strokeHeight?t.attrs.strokeHeight:2,t.attrs.strokeLineCap),l.add(c)}})),l}},{key:"drawBarShadow",value:function(t){var e=t.prevPaths,r=t.currPaths,i=t.color,n=this.w,o=e.x,a=e.x1,s=e.barYPosition,l=r.x,c=r.x1,u=r.barYPosition,h=s+r.barHeight,d=new Pc(this.barCtx.ctx),p=new f,g=d.move(a,h)+d.line(o,h)+d.line(l,u)+d.line(c,u)+d.line(a,h)+("around"===n.config.plotOptions.bar.borderRadiusApplication||"both"===this.arrBorderRadius[realIndex][j]?" Z":" z");return d.drawPath({d:g,fill:p.shadeColor(.5,f.rgb2hex(i)),stroke:"none",strokeWidth:0,fillOpacity:1,classes:"apexcharts-bar-shadow apexcharts-decoration-element"})}},{key:"getZeroValueEncounters",value:function(t){var e,r=t.i,i=t.j,n=this.w,o=0,a=0;return(n.config.plotOptions.bar.horizontal?n.globals.series.map((function(t,e){return e})):(null===(e=n.globals.columnSeries)||void 0===e?void 0:e.i.map((function(t){return t})))||[]).forEach((function(t){var e=n.globals.seriesPercent[t][i];e&&o++,t-1})),i=this.barCtx.columnGroupIndices,n=i.indexOf(r);return n<0&&(i.push(r),n=i.length-1),{groupIndex:r,columnGroupIndex:n}}}],r&&Ip(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function zp(t){return zp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zp(t)}function Xp(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function Dp(t){for(var e=1;ethis.barOptions.dataLabels.maxItems&&console.warn("WARNING: DataLabels are enabled but there are too many to display. This may cause performance issue when rendering - ApexCharts");for(var a=0,s=0;a0&&(this.visibleI=this.visibleI+1);var x=0,w=0;this.yRatio.length>1&&(this.yaxisIndex=r.globals.seriesYAxisReverseMap[y],this.translationsIndex=y);var S=this.translationsIndex;this.isReversed=r.config.yaxis[this.yaxisIndex]&&r.config.yaxis[this.yaxisIndex].reversed;var k=this.barHelpers.initialPositions(y);p=k.y,x=k.barHeight,c=k.yDivision,h=k.zeroW,d=k.x,w=k.barWidth,l=k.xDivision,u=k.zeroH,this.isHorizontal||b.push(d+w/2);var A=i.group({class:"apexcharts-datalabels","data:realIndex":y});r.globals.delayedElements.push({el:A.node}),A.node.classList.add("apexcharts-element-hidden");var O=i.group({class:"apexcharts-bar-goals-markers"}),P=i.group({class:"apexcharts-bar-shadows"});r.globals.delayedElements.push({el:P.node}),P.node.classList.add("apexcharts-element-hidden");for(var C=0;C0){var L,I=this.barHelpers.drawBarShadow({color:"string"==typeof M.color&&-1===(null===(L=M.color)||void 0===L?void 0:L.indexOf("url"))?M.color:f.hexToRgba(r.globals.colors[a]),prevPaths:this.pathArr[this.pathArr.length-1],currPaths:T});P.add(I),r.config.chart.dropShadow.enabled&&new vc(this.ctx).dropShadow(I,r.config.chart.dropShadow,y)}this.pathArr.push(T);var R=this.barHelpers.drawGoalLine({barXPosition:T.barXPosition,barYPosition:T.barYPosition,goalX:T.goalX,goalY:T.goalY,barHeight:x,barWidth:w});R&&O.add(R),p=T.y,d=T.x,C>0&&b.push(d+w/2),g.push(p),this.renderSeries(Dp(Dp({realIndex:y,pathFill:M.color},M.useRangeColor?{lineFill:M.color}:{}),{},{j:C,i:a,columnGroupIndex:v,pathFrom:T.pathFrom,pathTo:T.pathTo,strokeWidth:j,elSeries:m,x:d,y:p,series:t,barHeight:Math.abs(T.barHeight?T.barHeight:x),barWidth:Math.abs(T.barWidth?T.barWidth:w),elDataLabelsWrap:A,elGoalsMarkers:O,elBarShadows:P,visibleSeries:this.visibleI,type:"bar"}))}r.globals.seriesXvalues[y]=b,r.globals.seriesYvalues[y]=g,o.add(m)}return o}},{key:"renderSeries",value:function(t){var e=t.realIndex,r=t.pathFill,i=t.lineFill,n=t.j,o=t.i,a=t.columnGroupIndex,s=t.pathFrom,l=t.pathTo,c=t.strokeWidth,u=t.elSeries,h=t.x,f=t.y,d=t.y1,p=t.y2,g=t.series,b=t.barHeight,y=t.barWidth,v=t.barXPosition,m=t.barYPosition,x=t.elDataLabelsWrap,w=t.elGoalsMarkers,S=t.elBarShadows,k=t.visibleSeries,A=t.type,O=t.classes,P=this.w,C=new Pc(this.ctx);if(!i){var j="function"==typeof P.globals.stroke.colors[e]?function(t){var e,r=P.config.stroke.colors;return Array.isArray(r)&&r.length>0&&((e=r[t])||(e=""),"function"==typeof e)?e({value:P.globals.series[t][n],dataPointIndex:n,w:P}):e}(e):P.globals.stroke.colors[e];i=this.barOptions.distributed?P.globals.stroke.colors[n]:j}P.config.series[o].data[n]&&P.config.series[o].data[n].strokeColor&&(i=P.config.series[o].data[n].strokeColor),this.isNullValue&&(r="none");var T=n/P.config.chart.animations.animateGradually.delay*(P.config.chart.animations.speed/P.globals.dataPoints)/2.4,E=C.renderPaths({i:o,j:n,realIndex:e,pathFrom:s,pathTo:l,stroke:i,strokeWidth:c,strokeLineCap:P.config.stroke.lineCap,fill:r,animationDelay:T,initialSpeed:P.config.chart.animations.speed,dataChangeSpeed:P.config.chart.animations.dynamicAnimation.speed,className:"apexcharts-".concat(A,"-area ").concat(O),chartType:A});E.attr("clip-path","url(#gridRectBarMask".concat(P.globals.cuid,")"));var M=P.config.forecastDataPoints;M.count>0&&n>=P.globals.dataPoints-M.count&&(E.node.setAttribute("stroke-dasharray",M.dashArray),E.node.setAttribute("stroke-width",M.strokeWidth),E.node.setAttribute("fill-opacity",M.fillOpacity)),void 0!==d&&void 0!==p&&(E.attr("data-range-y1",d),E.attr("data-range-y2",p)),new vc(this.ctx).setSelectionFilter(E,e,n),u.add(E);var L=new Pp(this).handleBarDataLabels({x:h,y:f,y1:d,y2:p,i:o,j:n,series:g,realIndex:e,columnGroupIndex:a,barHeight:b,barWidth:y,barXPosition:v,barYPosition:m,renderedPath:E,visibleSeries:k});return null!==L.dataLabels&&x.add(L.dataLabels),L.totalDataLabels&&x.add(L.totalDataLabels),u.add(x),w&&u.add(w),S&&u.add(S),u}},{key:"drawBarPaths",value:function(t){var e,r=t.indexes,i=t.barHeight,n=t.strokeWidth,o=t.zeroW,a=t.x,s=t.y,l=t.yDivision,c=t.elSeries,u=this.w,h=r.i,f=r.j;if(u.globals.isXNumeric)e=(s=(u.globals.seriesX[h][f]-u.globals.minX)/this.invertedXRatio-i)+i*this.visibleI;else if(u.config.plotOptions.bar.hideZeroBarsWhenGrouped){var d=this.barHelpers.getZeroValueEncounters({i:h,j:f}),p=d.nonZeroColumns,g=d.zeroEncounters;p>0&&(i=this.seriesLen*i/p),e=s+i*this.visibleI,e-=i*g}else e=s+i*this.visibleI;this.isFunnel&&(o-=(this.barHelpers.getXForValue(this.series[h][f],o)-o)/2),a=this.barHelpers.getXForValue(this.series[h][f],o);var b=this.barHelpers.getBarpaths({barYPosition:e,barHeight:i,x1:o,x2:a,strokeWidth:n,isReversed:this.isReversed,series:this.series,realIndex:r.realIndex,i:h,j:f,w:u});return u.globals.isXNumeric||(s+=l),this.barHelpers.barBackground({j:f,i:h,y1:e-i*this.visibleI,y2:i*this.seriesLen,elSeries:c}),{pathTo:b.pathTo,pathFrom:b.pathFrom,x1:o,x:a,y:s,goalX:this.barHelpers.getGoalValues("x",o,null,h,f),barYPosition:e,barHeight:i}}},{key:"drawColumnPaths",value:function(t){var e,r=t.indexes,i=t.x,n=t.y,o=t.xDivision,a=t.barWidth,s=t.zeroH,l=t.strokeWidth,c=t.elSeries,u=this.w,h=r.realIndex,f=r.translationsIndex,d=r.i,p=r.j,g=r.bc;if(u.globals.isXNumeric){var b=this.getBarXForNumericXAxis({x:i,j:p,realIndex:h,barWidth:a});i=b.x,e=b.barXPosition}else if(u.config.plotOptions.bar.hideZeroBarsWhenGrouped){var y=this.barHelpers.getZeroValueEncounters({i:d,j:p}),v=y.nonZeroColumns,m=y.zeroEncounters;v>0&&(a=this.seriesLen*a/v),e=i+a*this.visibleI,e-=a*m}else e=i+a*this.visibleI;n=this.barHelpers.getYForValue(this.series[d][p],s,f);var x=this.barHelpers.getColumnPaths({barXPosition:e,barWidth:a,y1:s,y2:n,strokeWidth:l,isReversed:this.isReversed,series:this.series,realIndex:h,i:d,j:p,w:u});return u.globals.isXNumeric||(i+=o),this.barHelpers.barBackground({bc:g,j:p,i:d,x1:e-l/2-a*this.visibleI,x2:a*this.seriesLen+l/2,elSeries:c}),{pathTo:x.pathTo,pathFrom:x.pathFrom,x:i,y:n,goalY:this.barHelpers.getGoalValues("y",null,s,d,p,f),barXPosition:e,barWidth:a}}},{key:"getBarXForNumericXAxis",value:function(t){var e=t.x,r=t.barWidth,i=t.realIndex,n=t.j,o=this.w,a=i;return o.globals.seriesX[i].length||(a=o.globals.maxValsInArrayIndex),f.isNumber(o.globals.seriesX[a][n])&&(e=(o.globals.seriesX[a][n]-o.globals.minX)/this.xRatio-r*this.seriesLen/2),{barXPosition:e+r*this.visibleI,x:e}}},{key:"getPreviousPath",value:function(t,e){for(var r,i=this.w,n=0;n0&&parseInt(o.realIndex,10)===parseInt(t,10)&&void 0!==i.globals.previousPaths[n].paths[e]&&(r=i.globals.previousPaths[n].paths[e].d)}return r}}],r&&Hp(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();const Np=Bp;function Wp(t){return Wp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wp(t)}function Gp(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function Vp(t){for(var e=1;e1&&(r.yaxisIndex=i.globals.seriesYAxisReverseMap[p][0],x=p),r.isReversed=i.config.yaxis[r.yaxisIndex]&&i.config.yaxis[r.yaxisIndex].reversed;var w=r.graphics.group({class:"apexcharts-series",seriesName:f.escapeString(i.globals.seriesNames[p]),rel:n+1,"data:realIndex":p});r.ctx.series.addCollapsedClassToSeries(w,p);var S=r.graphics.group({class:"apexcharts-datalabels","data:realIndex":p}),k=r.graphics.group({class:"apexcharts-bar-goals-markers"}),A=0,O=0,P=r.initialPositions(a,s,c,u,h,d,x);s=P.y,A=P.barHeight,u=P.yDivision,d=P.zeroW,a=P.x,O=P.barWidth,c=P.xDivision,h=P.zeroH,i.globals.barHeight=A,i.globals.barWidth=O,r.barHelpers.initializeStackedXYVars(r),1===r.groupCtx.prevY.length&&r.groupCtx.prevY[0].every((function(t){return isNaN(t)}))&&(r.groupCtx.prevY[0]=r.groupCtx.prevY[0].map((function(){return h})),r.groupCtx.prevYF[0]=r.groupCtx.prevYF[0].map((function(){return 0})));for(var C=0;C0||"top"===r.barHelpers.arrBorderRadius[p][C]&&i.globals.series[p][C]<0)&&(I=R),w=r.renderSeries(Vp(Vp({realIndex:p,pathFill:L.color},L.useRangeColor?{lineFill:L.color}:{}),{},{j:C,i:n,columnGroupIndex:y,pathFrom:E.pathFrom,pathTo:E.pathTo,strokeWidth:j,elSeries:w,x:a,y:s,series:t,barHeight:A,barWidth:O,elDataLabelsWrap:S,elGoalsMarkers:k,type:"bar",visibleSeries:y,classes:I}))}i.globals.seriesXvalues[p]=v,i.globals.seriesYvalues[p]=m,r.groupCtx.prevY.push(r.groupCtx.yArrj),r.groupCtx.prevYF.push(r.groupCtx.yArrjF),r.groupCtx.prevYVal.push(r.groupCtx.yArrjVal),r.groupCtx.prevX.push(r.groupCtx.xArrj),r.groupCtx.prevXF.push(r.groupCtx.xArrjF),r.groupCtx.prevXVal.push(r.groupCtx.xArrjVal),o.add(w)},c=0,u=0;c1?l=(r=c.globals.minXDiff/this.xRatio)*parseInt(this.barOptions.columnWidth,10)/100:-1===String(h).indexOf("%")?l=parseInt(h,10):l*=parseInt(h,10)/100,n=this.isReversed?this.baseLineY[a]:c.globals.gridHeight-this.baseLineY[a],t=c.globals.padHorizontal+(r-l)/2}var f=c.globals.barGroups.length||1;return{x:t,y:e,yDivision:i,xDivision:r,barHeight:s/f,barWidth:l/f,zeroH:n,zeroW:o}}},{key:"drawStackedBarPaths",value:function(t){for(var e,r=t.indexes,i=t.barHeight,n=t.strokeWidth,o=t.zeroW,a=t.x,s=t.y,l=t.columnGroupIndex,c=t.seriesGroup,u=t.yDivision,h=t.elSeries,f=this.w,d=s+l*i,p=r.i,g=r.j,b=r.realIndex,y=r.translationsIndex,v=0,m=0;m0){var w=o;this.groupCtx.prevXVal[x-1][g]<0?w=this.series[p][g]>=0?this.groupCtx.prevX[x-1][g]+v-2*(this.isReversed?v:0):this.groupCtx.prevX[x-1][g]:this.groupCtx.prevXVal[x-1][g]>=0&&(w=this.series[p][g]>=0?this.groupCtx.prevX[x-1][g]:this.groupCtx.prevX[x-1][g]-v+2*(this.isReversed?v:0)),e=w}else e=o;a=null===this.series[p][g]?e:e+this.series[p][g]/this.invertedYRatio-2*(this.isReversed?this.series[p][g]/this.invertedYRatio:0);var S=this.barHelpers.getBarpaths({barYPosition:d,barHeight:i,x1:e,x2:a,strokeWidth:n,isReversed:this.isReversed,series:this.series,realIndex:r.realIndex,seriesGroup:c,i:p,j:g,w:f});return this.barHelpers.barBackground({j:g,i:p,y1:d,y2:i,elSeries:h}),s+=u,{pathTo:S.pathTo,pathFrom:S.pathFrom,goalX:this.barHelpers.getGoalValues("x",o,null,p,g,y),barXPosition:e,barYPosition:d,x:a,y:s}}},{key:"drawStackedColumnPaths",value:function(t){var e=t.indexes,r=t.x,i=t.y,n=t.xDivision,o=t.barWidth,a=t.zeroH,s=t.columnGroupIndex,l=t.seriesGroup,c=t.elSeries,u=this.w,h=e.i,f=e.j,d=e.bc,p=e.realIndex,g=e.translationsIndex;if(u.globals.isXNumeric){var b=u.globals.seriesX[p][f];b||(b=0),r=(b-u.globals.minX)/this.xRatio-o/2*u.globals.barGroups.length}for(var y,v=r+s*o,m=0,x=0;x0&&!u.globals.isXNumeric||w>0&&u.globals.isXNumeric&&u.globals.seriesX[p-1][f]===u.globals.seriesX[p][f]){var S,k,A,O=Math.min(this.yRatio.length+1,p+1);if(void 0!==this.groupCtx.prevY[w-1]&&this.groupCtx.prevY[w-1].length)for(var P=1;P=0?A-m+2*(this.isReversed?m:0):A;break}if((null===(E=this.groupCtx.prevYVal[w-j])||void 0===E?void 0:E[f])>=0){k=this.series[h][f]>=0?A:A+m-2*(this.isReversed?m:0);break}}void 0===k&&(k=u.globals.gridHeight),y=null!==(S=this.groupCtx.prevYF[0])&&void 0!==S&&S.every((function(t){return 0===t}))&&this.groupCtx.prevYF.slice(1,w).every((function(t){return t.every((function(t){return isNaN(t)}))}))?a:k}else y=a;i=this.series[h][f]?y-this.series[h][f]/this.yRatio[g]+2*(this.isReversed?this.series[h][f]/this.yRatio[g]:0):y;var M=this.barHelpers.getColumnPaths({barXPosition:v,barWidth:o,y1:y,y2:i,yRatio:this.yRatio[g],strokeWidth:this.strokeWidth,isReversed:this.isReversed,series:this.series,seriesGroup:l,realIndex:e.realIndex,i:h,j:f,w:u});return this.barHelpers.barBackground({bc:d,j:f,i:h,x1:v,x2:o,elSeries:c}),{pathTo:M.pathTo,pathFrom:M.pathFrom,goalY:this.barHelpers.getGoalValues("y",null,a,h,f),barXPosition:v,x:u.globals.isXNumeric?r:r+n,y:i}}}],r&&qp(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),n}(Np);const eg=tg;function rg(t){return rg="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rg(t)}function ig(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function ng(t){for(var e=1;e0&&(i.visibleI=i.visibleI+1);var x,w,S=0;i.yRatio.length>1&&(i.yaxisIndex=n.globals.seriesYAxisReverseMap[y][0],S=y);var k=i.barHelpers.initialPositions(y);p=k.y,x=k.barHeight,l=k.yDivision,h=k.zeroW,d=k.x,w=k.barWidth,a=k.xDivision,u=k.zeroH,b.push(d+w/2);for(var A=o.group({class:"apexcharts-datalabels","data:realIndex":y}),O=o.group({class:"apexcharts-bar-goals-markers"}),P=function(r){var o=i.barHelpers.getStrokeWidth(e,r,y),c=null,f={indexes:{i:e,j:r,realIndex:y,translationsIndex:S},x:d,y:p,strokeWidth:o,elSeries:m};c=i.isHorizontal?i.drawHorizontalBoxPaths(ng(ng({},f),{},{yDivision:l,barHeight:x,zeroW:h})):i.drawVerticalBoxPaths(ng(ng({},f),{},{xDivision:a,barWidth:w,zeroH:u})),p=c.y,d=c.x;var k=i.barHelpers.drawGoalLine({barXPosition:c.barXPosition,barYPosition:c.barYPosition,goalX:c.goalX,goalY:c.goalY,barHeight:x,barWidth:w});k&&O.add(k),r>0&&b.push(d+w/2),g.push(p),c.pathTo.forEach((function(a,l){var u=!i.isBoxPlot&&i.candlestickOptions.wick.useFillColor?c.color[l]:n.globals.stroke.colors[e],h=s.fillPath({seriesNumber:y,dataPointIndex:r,color:c.color[l],value:t[e][r]});i.renderSeries({realIndex:y,pathFill:h,lineFill:u,j:r,i:e,pathFrom:c.pathFrom,pathTo:a,strokeWidth:o,elSeries:m,x:d,y:p,series:t,columnGroupIndex:v,barHeight:x,barWidth:w,elDataLabelsWrap:A,elGoalsMarkers:O,visibleSeries:i.visibleI,type:n.config.chart.type})}))},C=0;C0&&(C=this.getPreviousPath(d,u,!0)),P=this.isBoxPlot?[l.move(O,S)+l.line(O+n/2,S)+l.line(O+n/2,m)+l.line(O+n/4,m)+l.line(O+n-n/4,m)+l.line(O+n/2,m)+l.line(O+n/2,S)+l.line(O+n,S)+l.line(O+n,A)+l.line(O,A)+l.line(O,S+a/2),l.move(O,A)+l.line(O+n,A)+l.line(O+n,k)+l.line(O+n/2,k)+l.line(O+n/2,x)+l.line(O+n-n/4,x)+l.line(O+n/4,x)+l.line(O+n/2,x)+l.line(O+n/2,k)+l.line(O,k)+l.line(O,A)+"z"]:[l.move(O,k)+l.line(O+n/2,k)+l.line(O+n/2,m)+l.line(O+n/2,k)+l.line(O+n,k)+l.line(O+n,S)+l.line(O+n/2,S)+l.line(O+n/2,x)+l.line(O+n/2,S)+l.line(O,S)+l.line(O,k-a/2)],C+=l.move(O,S),s.globals.isXNumeric||(r+=i),{pathTo:P,pathFrom:C,x:r,y:k,goalY:this.barHelpers.getGoalValues("y",null,o,c,u,e.translationsIndex),barXPosition:O,color:w}}},{key:"drawHorizontalBoxPaths",value:function(t){var e=t.indexes,r=(t.x,t.y),i=t.yDivision,n=t.barHeight,o=t.zeroW,a=t.strokeWidth,s=this.w,l=new Pc(this.ctx),c=e.i,u=e.j,h=this.boxOptions.colors.lower;this.isBoxPlot&&(h=[this.boxOptions.colors.lower,this.boxOptions.colors.upper]);var f=this.invertedYRatio,d=e.realIndex,p=this.getOHLCValue(d,u),g=o,b=o,y=Math.min(p.o,p.c),v=Math.max(p.o,p.c),m=p.m;s.globals.isXNumeric&&(r=(s.globals.seriesX[d][u]-s.globals.minX)/this.invertedXRatio-n/2);var x=r+n*this.visibleI;void 0===this.series[c][u]||null===this.series[c][u]?(y=o,v=o):(y=o+y/f,v=o+v/f,g=o+p.h/f,b=o+p.l/f,m=o+p.m/f);var w=l.move(o,x),S=l.move(y,x+n/2);return s.globals.previousPaths.length>0&&(S=this.getPreviousPath(d,u,!0)),w=[l.move(y,x)+l.line(y,x+n/2)+l.line(g,x+n/2)+l.line(g,x+n/2-n/4)+l.line(g,x+n/2+n/4)+l.line(g,x+n/2)+l.line(y,x+n/2)+l.line(y,x+n)+l.line(m,x+n)+l.line(m,x)+l.line(y+a/2,x),l.move(m,x)+l.line(m,x+n)+l.line(v,x+n)+l.line(v,x+n/2)+l.line(b,x+n/2)+l.line(b,x+n-n/4)+l.line(b,x+n/4)+l.line(b,x+n/2)+l.line(v,x+n/2)+l.line(v,x)+l.line(m,x)+"z"],S+=l.move(y,x),s.globals.isXNumeric||(r+=i),{pathTo:w,pathFrom:S,x:v,y:r,goalX:this.barHelpers.getGoalValues("x",o,null,c,u),barYPosition:x,color:h}}},{key:"getOHLCValue",value:function(t,e){var r=this.w,i=new Mc(this.ctx,r),n=i.getLogValAtSeriesIndex(r.globals.seriesCandleH[t][e],t),o=i.getLogValAtSeriesIndex(r.globals.seriesCandleO[t][e],t),a=i.getLogValAtSeriesIndex(r.globals.seriesCandleM[t][e],t),s=i.getLogValAtSeriesIndex(r.globals.seriesCandleC[t][e],t),l=i.getLogValAtSeriesIndex(r.globals.seriesCandleL[t][e],t);return{o:this.isBoxPlot?n:o,h:this.isBoxPlot?o:n,m:a,l:this.isBoxPlot?s:l,c:this.isBoxPlot?l:s}}}],r&&ag(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),n}(Np);const dg=fg;function pg(t){return pg="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pg(t)}function gg(t){return function(t){if(Array.isArray(t))return bg(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return bg(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?bg(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function bg(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r0&&r.colorScale.ranges.map((function(t,r){t.from<=0&&(e=!0)})),e}},{key:"getShadeColor",value:function(t,e,r,i){var n=this.w,o=1,a=n.config.plotOptions[t].shadeIntensity,s=this.determineColor(t,e,r);n.globals.hasNegs||i?o=n.config.plotOptions[t].reverseNegativeShade?s.percent<0?s.percent/100*(1.25*a):(1-s.percent/100)*(1.25*a):s.percent<=0?1-(1+s.percent/100)*a:(1-s.percent/100)*a:(o=1-s.percent/100,"treemap"===t&&(o=(1-s.percent/100)*(1.25*a)));var l=s.color,c=new f;if(n.config.plotOptions[t].enableShades)if("dark"===this.w.config.theme.mode){var u=c.shadeColor(-1*o,s.color);l=f.hexToRgba(f.isColorHex(u)?u:f.rgb2hex(u),n.config.fill.opacity)}else{var h=c.shadeColor(o,s.color);l=f.hexToRgba(f.isColorHex(h)?h:f.rgb2hex(h),n.config.fill.opacity)}return{color:l,colorProps:s}}},{key:"determineColor",value:function(t,e,r){var i=this.w,n=i.globals.series[e][r],o=i.config.plotOptions[t],a=o.colorScale.inverse?r:e;o.distributed&&"treemap"===i.config.chart.type&&(a=r);var s=i.globals.colors[a],l=null,c=Math.min.apply(Math,gg(i.globals.series[e])),u=Math.max.apply(Math,gg(i.globals.series[e]));o.distributed||"heatmap"!==t||(c=i.globals.minY,u=i.globals.maxY),void 0!==o.colorScale.min&&(c=o.colorScale.mini.globals.maxY?o.colorScale.max:i.globals.maxY);var h=Math.abs(u)+Math.abs(c),f=100*n/(0===h?h-1e-6:h);return o.colorScale.ranges.length>0&&o.colorScale.ranges.map((function(t,e){if(n>=t.from&&n<=t.to){s=t.color,l=t.foreColor?t.foreColor:null,c=t.from,u=t.to;var r=Math.abs(u)+Math.abs(c);f=100*n/(0===r?r-1e-6:r)}})),{color:s,foreColor:l,percent:f}}},{key:"calculateDataLabels",value:function(t){var e=t.text,r=t.x,i=t.y,n=t.i,o=t.j,a=t.colorProps,s=t.fontSize,l=this.w.config.dataLabels,c=new Pc(this.ctx),u=new lh(this.ctx),h=null;if(l.enabled){h=c.group({class:"apexcharts-data-labels"});var f=l.offsetX,d=l.offsetY,p=r+f,g=i+parseFloat(l.style.fontSize)/3+d;u.plotDataLabelsText({x:p,y:g,text:e,i:n,j:o,color:a.foreColor,parent:h,fontSize:s,dataLabelsConfig:l})}return h}},{key:"addListeners",value:function(t){var e=new Pc(this.ctx);t.node.addEventListener("mouseenter",e.pathMouseEnter.bind(this,t)),t.node.addEventListener("mouseleave",e.pathMouseLeave.bind(this,t)),t.node.addEventListener("mousedown",e.pathMouseDown.bind(this,t))}}],r&&yg(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function xg(t){return xg="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xg(t)}function wg(t,e){for(var r=0;r=0;s?c++:c--){var u=r.group({class:"apexcharts-series apexcharts-heatmap-series",seriesName:f.escapeString(e.globals.seriesNames[c]),rel:c+1,"data:realIndex":c});if(this.ctx.series.addCollapsedClassToSeries(u,c),e.config.chart.dropShadow.enabled){var h=e.config.chart.dropShadow;new vc(this.ctx).dropShadow(u,h,c)}for(var d=0,p=e.config.plotOptions.heatmap.shadeIntensity,g=0,b=0;b=l[c].length)break;var y=this.helpers.getShadeColor(e.config.chart.type,c,g,this.negRange),v=y.color,m=y.colorProps;"image"===e.config.fill.type&&(v=new Zu(this.ctx).fillPath({seriesNumber:c,dataPointIndex:g,opacity:e.globals.hasNegs?m.percent<0?1-(1+m.percent/100):p+m.percent/100:m.percent/100,patternID:f.randomId(),width:e.config.fill.image.width?e.config.fill.image.width:n,height:e.config.fill.image.height?e.config.fill.image.height:o}));var x=this.rectRadius,w=r.drawRect(d,a,n,o,x);if(w.attr({cx:d,cy:a}),w.node.classList.add("apexcharts-heatmap-rect"),u.add(w),w.attr({fill:v,i:c,index:c,j:g,val:t[c][g],"stroke-width":this.strokeWidth,stroke:e.config.plotOptions.heatmap.useFillColorAsStroke?v:e.globals.stroke.colors[0],color:v}),this.helpers.addListeners(w),e.config.chart.animations.enabled&&!e.globals.dataChanged){var S=1;e.globals.resized||(S=e.config.chart.animations.speed),this.animateHeatMap(w,d,a,n,o,S)}if(e.globals.dataChanged){var k=1;if(this.dynamicAnim.enabled&&e.globals.shouldAnimate){k=this.dynamicAnim.speed;var A=e.globals.previousPaths[c]&&e.globals.previousPaths[c][g]&&e.globals.previousPaths[c][g].color;A||(A="rgba(255, 255, 255, 0)"),this.animateHeatColor(w,f.isColorHex(A)?A:f.rgb2hex(A),f.isColorHex(v)?v:f.rgb2hex(v),k)}}var O=(0,e.config.dataLabels.formatter)(e.globals.series[c][g],{value:e.globals.series[c][g],seriesIndex:c,dataPointIndex:g,w:e}),P=this.helpers.calculateDataLabels({text:O,x:d+n/2,y:a+o/2,i:c,j:g,colorProps:m,series:l});null!==P&&u.add(P),d+=n,g++}a+=o,i.add(u)}var C=e.globals.yAxisScale[0].result.slice();return e.config.yaxis[0].reversed?C.unshift(""):C.push(""),e.globals.yAxisScale[0].result=C,i}},{key:"animateHeatMap",value:function(t,e,r,i,n,o){var a=new b(this.ctx);a.animateRect(t,{x:e+i/2,y:r+n/2,width:0,height:0},{x:e,y:r,width:i,height:n},o,(function(){a.animationCompleted(t)}))}},{key:"animateHeatColor",value:function(t,e,r,i){t.attr({fill:e}).animate(i).attr({fill:r})}}],r&&wg(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Ag(t){return Ag="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ag(t)}function Og(t,e){for(var r=0;r-1&&this.pieClicked(h),r.config.dataLabels.enabled){var w=m.x,S=m.y,k=100*p/this.fullAngle+"%";if(0!==p&&r.config.plotOptions.pie.dataLabels.minAngleToShowLabelthis.fullAngle?e.endAngle=e.endAngle-(i+a):i+a=this.fullAngle+this.w.config.plotOptions.pie.startAngle%this.fullAngle&&(c=this.fullAngle+this.w.config.plotOptions.pie.startAngle%this.fullAngle-.01),Math.ceil(c)>this.fullAngle&&(c-=this.fullAngle);var u=Math.PI*(c-90)/180,h=r.centerX+o*Math.cos(l),d=r.centerY+o*Math.sin(l),p=r.centerX+o*Math.cos(u),g=r.centerY+o*Math.sin(u),b=f.polarToCartesian(r.centerX,r.centerY,r.donutSize,c),y=f.polarToCartesian(r.centerX,r.centerY,r.donutSize,s),v=n>180?1:0,m=["M",h,d,"A",o,o,0,v,1,p,g];return e="donut"===r.chartType?[].concat(m,["L",b.x,b.y,"A",r.donutSize,r.donutSize,0,v,0,y.x,y.y,"L",h,d,"z"]).join(" "):"pie"===r.chartType||"polarArea"===r.chartType?[].concat(m,["L",r.centerX,r.centerY,"L",h,d]).join(" "):[].concat(m).join(" "),a.roundPathCorners(e,2*this.strokeWidth)}},{key:"drawPolarElements",value:function(t){var e=this.w,r=new Dh(this.ctx),i=new Pc(this.ctx),n=new Cg(this.ctx),o=i.group(),a=i.group(),s=r.niceScale(0,Math.ceil(this.maxY),0),l=s.result.reverse(),c=s.result.length;this.maxY=s.niceMax;for(var u=e.globals.radialSize,h=u/(c-1),f=0;f1&&t.total.show&&(n=t.total.color);var a=o.globals.dom.baseEl.querySelector(".apexcharts-datalabel-label"),s=o.globals.dom.baseEl.querySelector(".apexcharts-datalabel-value");r=(0,t.value.formatter)(r,o),i||"function"!=typeof t.total.formatter||(r=t.total.formatter(o));var l=e===t.total.label;e=this.donutDataLabels.total.label?t.name.formatter(e,l,o):"",null!==a&&(a.textContent=e),null!==s&&(s.textContent=r),null!==a&&(a.style.fill=n)}},{key:"printDataLabelsInner",value:function(t,e){var r=this.w,i=t.getAttribute("data:value"),n=r.globals.seriesNames[parseInt(t.parentNode.getAttribute("rel"),10)-1];r.globals.series.length>1&&this.printInnerLabels(e,n,i,t);var o=r.globals.dom.baseEl.querySelector(".apexcharts-datalabels-group");null!==o&&(o.style.opacity=1)}},{key:"drawSpokes",value:function(t){var e=this,r=this.w,i=new Pc(this.ctx),n=r.config.plotOptions.polarArea.spokes;if(0!==n.strokeWidth){for(var o=[],a=360/r.globals.series.length,s=0;s0&&(g=e.getPreviousPath(a));for(var b=0;b=10?t.x>0?(r="start",i+=10):t.x<0&&(r="end",i-=10):r="middle",Math.abs(t.y)>=e-10&&(t.y<0?n-=10:t.y>0&&(n+=10)),{textAnchor:r,newX:i,newY:n}}},{key:"getPreviousPath",value:function(t){for(var e=this.w,r=null,i=0;i0&&parseInt(n.realIndex,10)===parseInt(t,10)&&void 0!==e.globals.previousPaths[i].paths[0]&&(r=e.globals.previousPaths[i].paths[0].d)}return r}},{key:"getDataPointsPos",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dataPointsLen;t=t||[],e=e||[];for(var i=[],n=0;n=360&&(f=360-Math.abs(this.startAngle)-.1);var d=r.drawPath({d:"",stroke:u,strokeWidth:a*parseInt(c.strokeWidth,10)/100,fill:"none",strokeOpacity:c.opacity,classes:"apexcharts-radialbar-area"});if(c.dropShadow.enabled){var p=c.dropShadow;n.dropShadow(d,p)}l.add(d),d.attr("id","apexcharts-radialbarTrack-"+s),this.animatePaths(d,{centerX:t.centerX,centerY:t.centerY,endAngle:f,startAngle:h,size:t.size,i:s,totalItems:2,animBeginArr:0,dur:0,isTrack:!0})}return i}},{key:"drawArcs",value:function(t){var e=this.w,r=new Pc(this.ctx),i=new Zu(this.ctx),n=new vc(this.ctx),o=r.group(),a=this.getStrokeWidth(t);t.size=t.size-a/2;var s=e.config.plotOptions.radialBar.hollow.background,l=t.size-a*t.series.length-this.margin*t.series.length-a*parseInt(e.config.plotOptions.radialBar.track.strokeWidth,10)/100/2,c=l-e.config.plotOptions.radialBar.hollow.margin;void 0!==e.config.plotOptions.radialBar.hollow.image&&(s=this.drawHollowImage(t,o,l,s));var u=this.drawHollow({size:c,centerX:t.centerX,centerY:t.centerY,fill:s||"transparent"});if(e.config.plotOptions.radialBar.hollow.dropShadow.enabled){var h=e.config.plotOptions.radialBar.hollow.dropShadow;n.dropShadow(u,h)}var d=1;!this.radialDataLabels.total.show&&e.globals.series.length>1&&(d=0);var p=null;if(this.radialDataLabels.show){var g=e.globals.dom.Paper.findOne(".apexcharts-datalabels-group");p=this.renderInnerDataLabels(g,this.radialDataLabels,{hollowSize:l,centerX:t.centerX,centerY:t.centerY,opacity:d})}"back"===e.config.plotOptions.radialBar.hollow.position&&(o.add(u),p&&o.add(p));var b=!1;e.config.plotOptions.radialBar.inverseOrder&&(b=!0);for(var y=b?t.series.length-1:0;b?y>=0:y100?100:t.series[y])/100,k=Math.round(this.totalAngle*S)+this.startAngle,A=void 0;e.globals.dataChanged&&(w=this.startAngle,A=Math.round(this.totalAngle*f.negToZero(e.globals.previousPaths[y])/100)+w),Math.abs(k)+Math.abs(x)>360&&(k-=.01),Math.abs(A)+Math.abs(w)>360&&(A-=.01);var O=k-x,P=Array.isArray(e.config.stroke.dashArray)?e.config.stroke.dashArray[y]:e.config.stroke.dashArray,C=r.drawPath({d:"",stroke:m,strokeWidth:a,fill:"none",fillOpacity:e.config.fill.opacity,classes:"apexcharts-radialbar-area apexcharts-radialbar-slice-"+y,strokeDashArray:P});if(Pc.setAttrs(C.node,{"data:angle":O,"data:value":t.series[y]}),e.config.chart.dropShadow.enabled){var j=e.config.chart.dropShadow;n.dropShadow(C,j,y)}if(n.setSelectionFilter(C,0,y),this.addListeners(C,this.radialDataLabels),v.add(C),C.attr({index:0,j:y}),this.barLabels.enabled){var T=f.polarToCartesian(t.centerX,t.centerY,t.size,x),E=this.barLabels.formatter(e.globals.seriesNames[y],{seriesIndex:y,w:e}),M=["apexcharts-radialbar-label"];this.barLabels.onClick||M.push("apexcharts-no-click");var L=this.barLabels.useSeriesColors?e.globals.colors[y]:e.config.chart.foreColor;L||(L=e.config.chart.foreColor);var I=T.x+this.barLabels.offsetX,R=T.y+this.barLabels.offsetY,_=r.drawText({x:I,y:R,text:E,textAnchor:"end",dominantBaseline:"middle",fontFamily:this.barLabels.fontFamily,fontWeight:this.barLabels.fontWeight,fontSize:this.barLabels.fontSize,foreColor:L,cssClass:M.join(" ")});_.on("click",this.onBarLabelClick),_.attr({rel:y+1}),0!==x&&_.attr({"transform-origin":"".concat(I," ").concat(R),transform:"rotate(".concat(x," 0 0)")}),v.add(_)}var z=0;!this.initialAnim||e.globals.resized||e.globals.dataChanged||(z=e.config.chart.animations.speed),e.globals.dataChanged&&(z=e.config.chart.animations.dynamicAnimation.speed),this.animDur=z/(1.2*t.series.length)+this.animDur,this.animBeginArr.push(this.animDur),this.animatePaths(C,{centerX:t.centerX,centerY:t.centerY,endAngle:k,startAngle:x,prevEndAngle:A,prevStartAngle:w,size:t.size,i:y,totalItems:2,animBeginArr:this.animBeginArr,dur:z,shouldSetPrevPaths:!0})}return{g:o,elHollow:u,dataLabels:p}}},{key:"drawHollow",value:function(t){var e=new Pc(this.ctx).drawCircle(2*t.size);return e.attr({class:"apexcharts-radialbar-hollow",cx:t.centerX,cy:t.centerY,r:t.size,fill:t.fill}),e}},{key:"drawHollowImage",value:function(t,e,r,i){var n=this.w,o=new Zu(this.ctx),a=f.randomId(),s=n.config.plotOptions.radialBar.hollow.image;if(n.config.plotOptions.radialBar.hollow.imageClipped)o.clippedImgArea({width:r,height:r,image:s,patternID:"pattern".concat(n.globals.cuid).concat(a)}),i="url(#pattern".concat(n.globals.cuid).concat(a,")");else{var l=n.config.plotOptions.radialBar.hollow.imageWidth,c=n.config.plotOptions.radialBar.hollow.imageHeight;if(void 0===l&&void 0===c){var u=n.globals.dom.Paper.image(s,(function(e){this.move(t.centerX-e.width/2+n.config.plotOptions.radialBar.hollow.imageOffsetX,t.centerY-e.height/2+n.config.plotOptions.radialBar.hollow.imageOffsetY)}));e.add(u)}else{var h=n.globals.dom.Paper.image(s,(function(e){this.move(t.centerX-l/2+n.config.plotOptions.radialBar.hollow.imageOffsetX,t.centerY-c/2+n.config.plotOptions.radialBar.hollow.imageOffsetY),this.size(l,c)}));e.add(h)}}return i}},{key:"getStrokeWidth",value:function(t){var e=this.w;return t.size*(100-parseInt(e.config.plotOptions.radialBar.hollow.size,10))/100/(t.series.length+1)-this.margin}},{key:"onBarLabelClick",value:function(t){var e=parseInt(t.target.getAttribute("rel"),10)-1,r=this.barLabels.onClick,i=this.w;r&&r(i.globals.seriesNames[e],{w:i,seriesIndex:e})}}],r&&Bg(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),n}(Lg);const $g=Zg;function Jg(t){return Jg="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jg(t)}function Qg(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function Kg(t){for(var e=1;e0&&(this.visibleI=this.visibleI+1);var b=0,y=0,v=0;this.yRatio.length>1&&(this.yaxisIndex=r.globals.seriesYAxisReverseMap[d][0],v=d);var m=this.barHelpers.initialPositions(d);h=m.y,c=m.zeroW,u=m.x,y=m.barWidth,b=m.barHeight,a=m.xDivision,s=m.yDivision,l=m.zeroH;for(var x=i.group({class:"apexcharts-datalabels","data:realIndex":d}),w=i.group({class:"apexcharts-rangebar-goals-markers"}),S=0;S0}));return this.isHorizontal?(i=f.config.plotOptions.bar.rangeBarGroupRows?o+c*y:o+s*this.visibleI+c*y,v>-1&&!f.config.plotOptions.bar.rangeBarOverlap&&(d=f.globals.seriesRange[e][v].overlaps).indexOf(p)>-1&&(i=(s=h.barHeight/d.length)*this.visibleI+c*(100-parseInt(this.barOptions.barHeight,10))/100/2+s*(this.visibleI+d.indexOf(p))+c*y)):(y>-1&&!f.globals.timescaleLabels.length&&(n=f.config.plotOptions.bar.rangeBarGroupRows?a+u*y:a+l*this.visibleI+u*y),v>-1&&!f.config.plotOptions.bar.rangeBarOverlap&&(d=f.globals.seriesRange[e][v].overlaps).indexOf(p)>-1&&(n=(l=h.barWidth/d.length)*this.visibleI+u*(100-parseInt(this.barOptions.barWidth,10))/100/2+l*(this.visibleI+d.indexOf(p))+u*y)),{barYPosition:i,barXPosition:n,barHeight:s,barWidth:l}}},{key:"drawRangeColumnPaths",value:function(t){var e=t.indexes,r=t.x,i=t.xDivision,n=t.barWidth,o=t.barXPosition,a=t.zeroH,s=this.w,l=e.i,c=e.j,u=e.realIndex,h=e.translationsIndex,f=this.yRatio[h],d=this.getRangeValue(u,c),p=Math.min(d.start,d.end),g=Math.max(d.start,d.end);void 0===this.series[l][c]||null===this.series[l][c]?p=a:(p=a-p/f,g=a-g/f);var b=Math.abs(g-p),y=this.barHelpers.getColumnPaths({barXPosition:o,barWidth:n,y1:p,y2:g,strokeWidth:this.strokeWidth,series:this.seriesRangeEnd,realIndex:u,i:u,j:c,w:s});if(s.globals.isXNumeric){var v=this.getBarXForNumericXAxis({x:r,j:c,realIndex:u,barWidth:n});r=v.x,o=v.barXPosition}else r+=i;return{pathTo:y.pathTo,pathFrom:y.pathFrom,barHeight:b,x:r,y:d.start<0&&d.end<0?p:g,goalY:this.barHelpers.getGoalValues("y",null,a,l,c,h),barXPosition:o}}},{key:"preventBarOverflow",value:function(t){var e=this.w;return t<0&&(t=0),t>e.globals.gridWidth&&(t=e.globals.gridWidth),t}},{key:"drawRangeBarPaths",value:function(t){var e=t.indexes,r=t.y,i=t.y1,n=t.y2,o=t.yDivision,a=t.barHeight,s=t.barYPosition,l=t.zeroW,c=this.w,u=e.realIndex,h=e.j,f=this.preventBarOverflow(l+i/this.invertedYRatio),d=this.preventBarOverflow(l+n/this.invertedYRatio),p=this.getRangeValue(u,h),g=Math.abs(d-f),b=this.barHelpers.getBarpaths({barYPosition:s,barHeight:a,x1:f,x2:d,strokeWidth:this.strokeWidth,series:this.seriesRangeEnd,i:u,realIndex:u,j:h,w:c});return c.globals.isXNumeric||(r+=o),{pathTo:b.pathTo,pathFrom:b.pathFrom,barWidth:g,x:p.start<0&&p.end<0?f:d,goalX:this.barHelpers.getGoalValues("x",l,null,u,h),y:r}}},{key:"getRangeValue",value:function(t,e){var r=this.w;return{start:r.globals.seriesRangeStart[t][e],end:r.globals.seriesRangeEnd[t][e]}}}],r&&eb(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),n}(Np);const lb=sb;function cb(t){return cb="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cb(t)}function ub(t,e){for(var r=0;r0&&parseInt(a.realIndex,10)===parseInt(i,10)&&("line"===a.type?(this.lineCtx.appendPathFrom=!1,e=n.globals.previousPaths[o].paths[0].d):"area"===a.type&&(this.lineCtx.appendPathFrom=!1,r=n.globals.previousPaths[o].paths[0].d,n.config.stroke.show&&n.globals.previousPaths[o].paths[1]&&(e=n.globals.previousPaths[o].paths[1].d)))}return{pathFromLine:e,pathFromArea:r}}},{key:"determineFirstPrevY",value:function(t){var e,r,i,n=t.i,o=t.realIndex,a=t.series,s=t.prevY,l=t.lineYPosition,c=t.translationsIndex,u=this.w,h=u.config.chart.stacked&&!u.globals.comboCharts||u.config.chart.stacked&&u.globals.comboCharts&&(!this.w.config.chart.stackOnlyBar||"bar"===(null===(e=this.w.config.series[o])||void 0===e?void 0:e.type)||"column"===(null===(r=this.w.config.series[o])||void 0===r?void 0:r.type));if(void 0!==(null===(i=a[n])||void 0===i?void 0:i[0]))s=(l=h&&n>0?this.lineCtx.prevSeriesY[n-1][0]:this.lineCtx.zeroY)-a[n][0]/this.lineCtx.yRatio[c]+2*(this.lineCtx.isReversed?a[n][0]/this.lineCtx.yRatio[c]:0);else if(h&&n>0&&void 0===a[n][0])for(var f=n-1;f>=0;f--)if(null!==a[f][0]&&void 0!==a[f][0]){s=l=this.lineCtx.prevSeriesY[f][0];break}return{prevY:s,lineYPosition:l}}}],r&&ub(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}(),db=function(t){var e=function(t){for(var e,r,i,n,o=function(t){for(var e=[],r=t[0],i=t[1],n=e[0]=gb(r,i),o=1,a=t.length-1;o9&&(n=3*i/Math.sqrt(n),o[l]=n*e,o[l+1]=n*r);for(var c=0;c<=a;c++)n=(t[Math.min(a,c+1)][0]-t[Math.max(0,c-1)][0])/(6*(1+o[c]*o[c])),s.push([n||0,o[c]*n||0]);return s}(t),r=t[1],i=t[0],n=[],o=e[1],a=e[0];n.push(i,[i[0]+a[0],i[1]+a[1],r[0]-o[0],r[1]-o[1],r[0],r[1]]);for(var s=2,l=e.length;s1&&i[1].length<6){var n=i[0].length;i[1]=[2*i[0][n-2]-i[0][n-4],2*i[0][n-1]-i[0][n-3]].concat(i[1])}i[0]=i[0].slice(-2)}return i};function gb(t,e){return(e[1]-t[1])/(e[0]-t[0])}function bb(t){return bb="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bb(t)}function yb(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function vb(t){for(var e=1;e1?f:0;this._initSerieVariables(t,h,f);var p=[],g=[],b=[],y=o.globals.padHorizontal+this.categoryAxisCorrection;this.ctx.series.addCollapsedClassToSeries(this.elSeries,f),o.globals.isXNumeric&&o.globals.seriesX.length>0&&(y=(o.globals.seriesX[f][0]-o.globals.minX)/this.xRatio),b.push(y);var v,m=y,x=void 0,w=m,S=this.zeroY,k=this.zeroY;S=this.lineHelpers.determineFirstPrevY({i:h,realIndex:f,series:t,prevY:S,lineYPosition:0,translationsIndex:d}).prevY,"monotoneCubic"===o.config.stroke.curve&&null===t[h][0]?p.push(null):p.push(S),v=S,"rangeArea"===s&&(x=k=this.lineHelpers.determineFirstPrevY({i:h,realIndex:f,series:i,prevY:k,lineYPosition:0,translationsIndex:d}).prevY,g.push(null!==p[0]?k:null));var A=this._calculatePathsFrom({type:s,series:t,i:h,realIndex:f,translationsIndex:d,prevX:w,prevY:S,prevY2:k}),O=[p[0]],P=[g[0]],C={type:s,series:t,realIndex:f,translationsIndex:d,i:h,x:y,y:1,pX:m,pY:v,pathsFrom:A,linePaths:[],areaPaths:[],seriesIndex:r,lineYPosition:0,xArrj:b,yArrj:p,y2Arrj:g,seriesRangeEnd:i},j=this._iterateOverDataPoints(vb(vb({},C),{},{iterations:"rangeArea"===s?t[h].length-1:void 0,isRangeStart:!0}));if("rangeArea"===s){for(var T=this._calculatePathsFrom({series:i,i:h,realIndex:f,prevX:w,prevY:k}),E=this._iterateOverDataPoints(vb(vb({},C),{},{series:i,xArrj:[y],yArrj:O,y2Arrj:P,pY:x,areaPaths:j.areaPaths,pathsFrom:T,iterations:i[h].length-1,isRangeStart:!1})),M=j.linePaths.length/2,L=0;L=0;I--)l.add(u[I]);else for(var R=0;R1&&(this.yaxisIndex=i.globals.seriesYAxisReverseMap[r],o=r),this.isReversed=i.config.yaxis[this.yaxisIndex]&&i.config.yaxis[this.yaxisIndex].reversed,this.zeroY=i.globals.gridHeight-this.baseLineY[o]-(this.isReversed?i.globals.gridHeight:0)+(this.isReversed?2*this.baseLineY[o]:0),this.areaBottomY=this.zeroY,(this.zeroY>i.globals.gridHeight||"end"===i.config.plotOptions.area.fillTo)&&(this.areaBottomY=i.globals.gridHeight),this.categoryAxisCorrection=this.xDivision/2,this.elSeries=n.group({class:"apexcharts-series",zIndex:void 0!==i.config.series[r].zIndex?i.config.series[r].zIndex:r,seriesName:f.escapeString(i.globals.seriesNames[r])}),this.elPointsMain=n.group({class:"apexcharts-series-markers-wrap","data:realIndex":r}),i.globals.hasNullValues){var a=this.markers.plotChartMarkers({pointsPos:{x:[0],y:[i.globals.gridHeight+i.globals.markers.largestSize]},seriesIndex:e,j:0,pSize:.1,alwaysDrawMarker:!0,isVirtualPoint:!0});null!==a&&this.elPointsMain.add(a)}this.elDataLabelsWrap=n.group({class:"apexcharts-datalabels","data:realIndex":r});var s=t[e].length===i.globals.dataPoints;this.elSeries.attr({"data:longestSeries":s,rel:e+1,"data:realIndex":r}),this.appendPathFrom=!0}},{key:"_calculatePathsFrom",value:function(t){var e,r,i,n,o=t.type,a=t.series,s=t.i,l=t.realIndex,c=t.translationsIndex,u=t.prevX,h=t.prevY,f=t.prevY2,d=this.w,p=new Pc(this.ctx);if(null===a[s][0]){for(var g=0;g0){var b=this.lineHelpers.checkPreviousPaths({pathFromLine:i,pathFromArea:n,realIndex:l});i=b.pathFromLine,n=b.pathFromArea}return{prevX:u,prevY:h,linePath:e,areaPath:r,pathFromLine:i,pathFromArea:n}}},{key:"_handlePaths",value:function(t){var e=t.type,r=t.realIndex,i=t.i,n=t.paths,o=this.w,a=new Pc(this.ctx),s=new Zu(this.ctx);this.prevSeriesY.push(n.yArrj),o.globals.seriesXvalues[r]=n.xArrj,o.globals.seriesYvalues[r]=n.yArrj;var l=o.config.forecastDataPoints;if(l.count>0&&"rangeArea"!==e){var c=o.globals.seriesXvalues[r][o.globals.seriesXvalues[r].length-l.count-1],u=a.drawRect(c,0,o.globals.gridWidth,o.globals.gridHeight,0);o.globals.dom.elForecastMask.appendChild(u.node);var h=a.drawRect(0,0,c,o.globals.gridHeight,0);o.globals.dom.elNonForecastMask.appendChild(h.node)}this.pointsChart||o.globals.delayedElements.push({el:this.elPointsMain.node,index:r});var f={i,realIndex:r,animationDelay:i,initialSpeed:o.config.chart.animations.speed,dataChangeSpeed:o.config.chart.animations.dynamicAnimation.speed,className:"apexcharts-".concat(e)};if("area"===e)for(var d=s.fillPath({seriesNumber:r}),p=0;p0&&"rangeArea"!==e){var S=a.renderPaths(x);S.node.setAttribute("stroke-dasharray",l.dashArray),l.strokeWidth&&S.node.setAttribute("stroke-width",l.strokeWidth),this.elSeries.add(S),S.attr("clip-path","url(#forecastMask".concat(o.globals.cuid,")")),w.attr("clip-path","url(#nonForecastMask".concat(o.globals.cuid,")"))}}}}},{key:"_iterateOverDataPoints",value:function(t){var e,r,i=this,n=t.type,o=t.series,a=t.iterations,s=t.realIndex,l=t.translationsIndex,c=t.i,u=t.x,h=t.y,d=t.pX,p=t.pY,g=t.pathsFrom,b=t.linePaths,y=t.areaPaths,v=t.seriesIndex,m=t.lineYPosition,x=t.xArrj,w=t.yArrj,S=t.y2Arrj,k=t.isRangeStart,A=t.seriesRangeEnd,O=this.w,P=new Pc(this.ctx),C=this.yRatio,j=g.prevY,T=g.linePath,E=g.areaPath,M=g.pathFromLine,L=g.pathFromArea,I=f.isNumber(O.globals.minYArr[s])?O.globals.minYArr[s]:O.globals.minY;a||(a=O.globals.dataPoints>1?O.globals.dataPoints-1:O.globals.dataPoints);var R=function(t,e){return e-t/C[l]+2*(i.isReversed?t/C[l]:0)},_=h,z=O.config.chart.stacked&&!O.globals.comboCharts||O.config.chart.stacked&&O.globals.comboCharts&&(!this.w.config.chart.stackOnlyBar||"bar"===(null===(e=this.w.config.series[s])||void 0===e?void 0:e.type)||"column"===(null===(r=this.w.config.series[s])||void 0===r?void 0:r.type)),X=O.config.stroke.curve;Array.isArray(X)&&(X=Array.isArray(v)?X[v[c]]:X[c]);for(var D,Y=0,H=0;H0&&O.globals.collapsedSeries.length0;e--){if(!(O.globals.collapsedSeriesIndices.indexOf((null==v?void 0:v[e])||e)>-1))return e;e--}return 0}(c-1)][H+1]:this.zeroY,F?h=R(I,m):(h=R(o[c][H+1],m),"rangeArea"===n&&(_=R(A[c][H+1],m))),x.push(null===o[c][H+1]?null:u),!F||"smooth"!==O.config.stroke.curve&&"monotoneCubic"!==O.config.stroke.curve?(w.push(h),S.push(_)):(w.push(null),S.push(null));var N=this.lineHelpers.calculatePoints({series:o,x:u,y:h,realIndex:s,i:c,j:H,prevY:j}),W=this._createPaths({type:n,series:o,i:c,realIndex:s,j:H,x:u,y:h,y2:_,xArrj:x,yArrj:w,y2Arrj:S,pX:d,pY:p,pathState:Y,segmentStartX:D,linePath:T,areaPath:E,linePaths:b,areaPaths:y,curve:X,isRangeStart:k});y=W.areaPaths,b=W.linePaths,d=W.pX,p=W.pY,Y=W.pathState,D=W.segmentStartX,E=W.areaPath,T=W.linePath,!this.appendPathFrom||O.globals.hasNullValues||"monotoneCubic"===X&&"rangeArea"===n||(M+=P.line(u,this.areaBottomY),L+=P.line(u,this.areaBottomY)),this.handleNullDataPoints(o,N,c,H,s),this._handleMarkersAndLabels({type:n,pointsPos:N,i:c,j:H,realIndex:s,isRangeStart:k})}return{yArrj:w,xArrj:x,pathFromArea:L,areaPaths:y,pathFromLine:M,linePaths:b,linePath:T,areaPath:E}}},{key:"_handleMarkersAndLabels",value:function(t){var e=t.type,r=t.pointsPos,i=t.isRangeStart,n=t.i,o=t.j,a=t.realIndex,s=this.w,l=new lh(this.ctx);if(this.pointsChart)this.scatter.draw(this.elSeries,o,{realIndex:a,pointsPos:r,zRatio:this.zRatio,elParent:this.elPointsMain});else{s.globals.series[n].length>1&&this.elPointsMain.node.classList.add("apexcharts-element-hidden");var c=this.markers.plotChartMarkers({pointsPos:r,seriesIndex:a,j:o+1});null!==c&&this.elPointsMain.add(c)}var u=l.drawDataLabel({type:e,isRangeStart:i,pos:r,i:a,j:o+1});null!==u&&this.elDataLabelsWrap.add(u)}},{key:"_createPaths",value:function(t){var e,r=t.type,i=t.series,n=t.i,o=(t.realIndex,t.j),a=t.x,s=t.y,l=t.xArrj,c=t.yArrj,u=t.y2,h=t.y2Arrj,f=t.pX,d=t.pY,p=t.pathState,g=t.segmentStartX,b=t.linePath,y=t.areaPath,v=t.linePaths,m=t.areaPaths,x=t.curve,w=t.isRangeStart,S=new Pc(this.ctx),k=this.areaBottomY,A="rangeArea"===r,O="rangeArea"===r&&w;switch(x){case"monotoneCubic":var P=w?c:h;switch(p){case 0:if(null===P[o+1])break;p=1;case 1:if(!(A?l.length===i[n].length:o===i[n].length-2))break;case 2:var C=w?l:l.slice().reverse(),j=w?P:P.slice().reverse(),T=(e=j,C.map((function(t,r){return[t,e[r]]})).filter((function(t){return null!==t[1]}))),E=T.length>1?db(T):T,M=[];A&&(O?m=T:M=m.reverse());var L=0,I=0;if(function(t,e){for(var r=function(t){var e=[],r=0;return t.forEach((function(t){null!==t?r++:r>0&&(e.push(r),r=0)})),r>0&&e.push(r),e}(t),i=[],n=0,o=0;n4?(e+="C".concat(i[0],", ").concat(i[1]),e+=", ".concat(i[2],", ").concat(i[3]),e+=", ".concat(i[4],", ").concat(i[5])):n>2&&(e+="S".concat(i[0],", ").concat(i[1]),e+=", ".concat(i[2],", ").concat(i[3]))}return e}(t),r=I,i=(I+=t.length)-1;O?b=S.move(T[r][0],T[r][1])+e:A?b=S.move(M[r][0],M[r][1])+S.line(T[r][0],T[r][1])+e+S.line(M[i][0],M[i][1]):(b=S.move(T[r][0],T[r][1])+e,y=b+S.line(T[i][0],k)+S.line(T[r][0],k)+"z",m.push(y)),v.push(b)})),A&&L>1&&!O){var R=v.slice(L).reverse();v.splice(L),R.forEach((function(t){return v.push(t)}))}p=0}break;case"smooth":var _=.35*(a-f);if(null===i[n][o])p=0;else switch(p){case 0:if(g=f,b=O?S.move(f,h[o])+S.line(f,d):S.move(f,d),y=S.move(f,d),null===i[n][o+1]||void 0===i[n][o+1]){v.push(b),m.push(y);break}if(p=1,o=i[n].length-2&&(O&&(b+=S.curve(a,s,a,s,a,u)+S.move(a,u)),y+=S.curve(a,s,a,s,a,k)+S.line(g,k)+"z",v.push(b),m.push(y),p=-1)}}f=a,d=s;break;default:var D=function(t,e,r){var i=[];switch(t){case"stepline":i=S.line(e,null,"H")+S.line(null,r,"V");break;case"linestep":i=S.line(null,r,"V")+S.line(e,null,"H");break;case"straight":i=S.line(e,r)}return i};if(null===i[n][o])p=0;else switch(p){case 0:if(g=f,b=O?S.move(f,h[o])+S.line(f,d):S.move(f,d),y=S.move(f,d),null===i[n][o+1]||void 0===i[n][o+1]){v.push(b),m.push(y);break}if(p=1,o=i[n].length-2&&(O&&(b+=S.line(a,u)),y+=S.line(a,k)+S.line(g,k)+"z",v.push(b),m.push(y),p=-1)}}f=a,d=s}return{linePaths:v,areaPaths:m,pX:f,pY:d,pathState:p,segmentStartX:g,linePath:b,areaPath:y}}},{key:"handleNullDataPoints",value:function(t,e,r,i,n){var o=this.w;if(null===t[r][i]&&o.config.markers.showNullDataPoints||1===t[r].length){var a=this.strokeWidth-o.config.markers.strokeWidth/2;a>0||(a=0);var s=this.markers.plotChartMarkers({pointsPos:e,seriesIndex:n,j:i+1,pSize:a,alwaysDrawMarker:!0});null!==s&&this.elPointsMain.add(s)}}}],r&&xb(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();const kb=Sb;function Ab(t){return Ab="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ab(t)}function Ob(t,e){for(var r=0;r1&&d&&d.show){var p=r.config.series[s].name||"";if(p&&h.xMin<1/0&&h.yMin<1/0){var g=d.offsetX,b=d.offsetY,y=d.borderColor,v=d.borderWidth,m=d.borderRadius,x=d.style,w=x.color||r.config.chart.foreColor,S={left:x.padding.left,right:x.padding.right,top:x.padding.top,bottom:x.padding.bottom},k=i.getTextRects(p,x.fontSize,x.fontFamily),A=k.width+S.left+S.right,O=k.height+S.top+S.bottom,P=h.xMin+(g||0),C=h.yMin+(b||0),j=i.drawRect(P,C,A,O,m,x.background,1,v,y),T=i.drawText({x:P+S.left,y:C+S.top+.75*k.height,text:p,fontSize:x.fontSize,fontFamily:x.fontFamily,fontWeight:x.fontWeight,foreColor:w,cssClass:x.cssClass||""});l.add(j),l.add(T)}}l.add(u),o.add(l)})),o}},{key:"getFontSize",value:function(t){var e=this.w,r=function t(e){var r,i=0;if(Array.isArray(e[0]))for(r=0;ro-i&&l.width<=a-n){var c=s.rotateAroundCenter(t.node);t.node.setAttribute("transform","rotate(-90 ".concat(c.x," ").concat(c.y,") translate(").concat(l.height/3,")"))}}},{key:"truncateLabels",value:function(t,e,r,i,n,o){var a=new Pc(this.ctx),s=a.getTextRects(t,e).width+this.w.config.stroke.width+5>n-r&&o-i>n-r?o-i:n-r,l=a.getTextBasedOnMaxWidth({text:t,maxWidth:s,fontSize:e});return t.length!==l.length&&s/e<5?"":l}},{key:"animateTreemap",value:function(t,e,r,i){var n=new b(this.ctx);n.animateRect(t,e,r,i,(function(){n.animationCompleted(t)}))}}],r&&Ob(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function jb(t){return jb="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jb(t)}function Tb(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function Eb(t){for(var e=1;e5e4&&(i.globals.disableZoomOut=!0);var a=n.getTimeUnitsfromTimestamp(t,e,this.utc),s=i.globals.gridWidth/o,l=s/24,c=l/60,u=c/60,h=Math.floor(24*o),f=Math.floor(1440*o),d=Math.floor(86400*o),p=Math.floor(o),g=Math.floor(o/30),b=Math.floor(o/365),y={minMillisecond:a.minMillisecond,minSecond:a.minSecond,minMinute:a.minMinute,minHour:a.minHour,minDate:a.minDate,minMonth:a.minMonth,minYear:a.minYear},v={firstVal:y,currentMillisecond:y.minMillisecond,currentSecond:y.minSecond,currentMinute:y.minMinute,currentHour:y.minHour,currentMonthDate:y.minDate,currentDate:y.minDate,currentMonth:y.minMonth,currentYear:y.minYear,daysWidthOnXAxis:s,hoursWidthOnXAxis:l,minutesWidthOnXAxis:c,secondsWidthOnXAxis:u,numberOfSeconds:d,numberOfMinutes:f,numberOfHours:h,numberOfDays:p,numberOfMonths:g,numberOfYears:b};switch(this.tickInterval){case"years":this.generateYearScale(v);break;case"months":case"half_year":this.generateMonthScale(v);break;case"months_days":case"months_fortnight":case"days":case"week_days":this.generateDayScale(v);break;case"hours":this.generateHourScale(v);break;case"minutes_fives":case"minutes":this.generateMinuteScale(v);break;case"seconds_tens":case"seconds_fives":case"seconds":this.generateSecondScale(v)}var m=this.timeScaleArray.map((function(t){var e={position:t.position,unit:t.unit,year:t.year,day:t.day?t.day:1,hour:t.hour?t.hour:0,month:t.month+1};return"month"===t.unit?Eb(Eb({},e),{},{day:1,value:t.value+1}):"day"===t.unit||"hour"===t.unit?Eb(Eb({},e),{},{value:t.value}):"minute"===t.unit?Eb(Eb({},e),{},{value:t.value,minute:t.value}):"second"===t.unit?Eb(Eb({},e),{},{value:t.value,minute:t.minute,second:t.second}):t}));return m.filter((function(t){var e=1,n=Math.ceil(i.globals.gridWidth/120),o=t.value;void 0!==i.config.xaxis.tickAmount&&(n=i.config.xaxis.tickAmount),m.length>n&&(e=Math.floor(m.length/n));var a=!1,s=!1;switch(r.tickInterval){case"years":"year"===t.unit&&(a=!0);break;case"half_year":e=7,"year"===t.unit&&(a=!0);break;case"months":e=1,"year"===t.unit&&(a=!0);break;case"months_fortnight":e=15,"year"!==t.unit&&"month"!==t.unit||(a=!0),30===o&&(s=!0);break;case"months_days":e=10,"month"===t.unit&&(a=!0),30===o&&(s=!0);break;case"week_days":e=8,"month"===t.unit&&(a=!0);break;case"days":e=1,"month"===t.unit&&(a=!0);break;case"hours":"day"===t.unit&&(a=!0);break;case"minutes_fives":case"seconds_fives":o%5!=0&&(s=!0);break;case"seconds_tens":o%10!=0&&(s=!0)}if("hours"===r.tickInterval||"minutes_fives"===r.tickInterval||"seconds_tens"===r.tickInterval||"seconds_fives"===r.tickInterval){if(!s)return!0}else if((o%e==0||a)&&!s)return!0}))}},{key:"recalcDimensionsBasedOnFormat",value:function(t,e){var r=this.w,i=this.formatDates(t),n=this.removeOverlappingTS(i);r.globals.timescaleLabels=n.slice(),new Uf(this.ctx).plotCoords()}},{key:"determineInterval",value:function(t){var e=24*t,r=60*e;switch(!0){case t/365>5:this.tickInterval="years";break;case t>800:this.tickInterval="half_year";break;case t>180:this.tickInterval="months";break;case t>90:this.tickInterval="months_fortnight";break;case t>60:this.tickInterval="months_days";break;case t>30:this.tickInterval="week_days";break;case t>2:this.tickInterval="days";break;case e>2.4:this.tickInterval="hours";break;case r>15:this.tickInterval="minutes_fives";break;case r>5:this.tickInterval="minutes";break;case r>1:this.tickInterval="seconds_tens";break;case 60*r>20:this.tickInterval="seconds_fives";break;default:this.tickInterval="seconds"}}},{key:"generateYearScale",value:function(t){var e=t.firstVal,r=t.currentMonth,i=t.currentYear,n=t.daysWidthOnXAxis,o=t.numberOfYears,a=e.minYear,s=0,l=new Vc(this.ctx),c="year";if(e.minDate>1||e.minMonth>0){var u=l.determineRemainingDaysOfYear(e.minYear,e.minMonth,e.minDate);s=(l.determineDaysOfYear(e.minYear)-u+1)*n,a=e.minYear+1,this.timeScaleArray.push({position:s,value:a,unit:c,year:a,month:f.monthMod(r+1)})}else 1===e.minDate&&0===e.minMonth&&this.timeScaleArray.push({position:s,value:a,unit:c,year:i,month:f.monthMod(r+1)});for(var h=a,d=s,p=0;p1){l=(c.determineDaysOfMonths(i+1,e.minYear)-r+1)*o,s=f.monthMod(i+1);var d=n+h,p=f.monthMod(s),g=s;0===s&&(u="year",g=d,p=1,d+=h+=1),this.timeScaleArray.push({position:l,value:g,unit:u,year:d,month:p})}else this.timeScaleArray.push({position:l,value:s,unit:u,year:n,month:f.monthMod(i)});for(var b=s+1,y=l,v=0,m=1;va.determineDaysOfMonths(e+1,r)?(c=1,s="month",d=e+=1,e):e},h=(24-e.minHour)*n,d=l,p=u(c,r,i);0===e.minHour&&1===e.minDate?(h=0,d=f.monthMod(e.minMonth),s="month",c=e.minDate):1!==e.minDate&&0===e.minHour&&0===e.minMinute&&(h=0,l=e.minDate,d=l,p=u(c=l,r,i),1!==d&&(s="day")),this.timeScaleArray.push({position:h,value:d,unit:s,year:this._getYear(i,p,0),month:f.monthMod(p),day:c});for(var g=h,b=0;bs.determineDaysOfMonths(e+1,n)&&(b=1,e+=1),{month:e,date:b}},u=function(t,e){return t>s.determineDaysOfMonths(e+1,n)?e+=1:e},h=60-(e.minMinute+e.minSecond/60),d=h*o,p=e.minHour+1,g=p;60===h&&(d=0,g=p=e.minHour);var b=r;g>=24&&(g=0,l="day",p=b+=1);var y=c(b,i).month;y=u(b,y),p>31&&(p=b=1),this.timeScaleArray.push({position:d,value:p,unit:l,day:b,hour:g,year:n,month:f.monthMod(y)}),g++;for(var v=d,m=0;m=24&&(g=0,l="day",y=c(b+=1,y).month,y=u(b,y));var x=this._getYear(n,y,0);v=60*o+v;var w=0===g?b:g;this.timeScaleArray.push({position:v,value:w,unit:l,hour:g,day:b,year:x,month:f.monthMod(y)}),g++}}},{key:"generateMinuteScale",value:function(t){for(var e=t.currentMillisecond,r=t.currentSecond,i=t.currentMinute,n=t.currentHour,o=t.currentDate,a=t.currentMonth,s=t.currentYear,l=t.minutesWidthOnXAxis,c=t.secondsWidthOnXAxis,u=t.numberOfMinutes,h=i+1,d=o,p=a,g=s,b=n,y=(60-r-e/1e3)*c,v=0;v=60&&(h=0,24===(b+=1)&&(b=0)),this.timeScaleArray.push({position:y,value:h,unit:"minute",hour:b,minute:h,day:d,year:this._getYear(g,p,0),month:f.monthMod(p)}),y+=l,h++}},{key:"generateSecondScale",value:function(t){for(var e=t.currentMillisecond,r=t.currentSecond,i=t.currentMinute,n=t.currentHour,o=t.currentDate,a=t.currentMonth,s=t.currentYear,l=t.secondsWidthOnXAxis,c=t.numberOfSeconds,u=r+1,h=i,d=o,p=a,g=s,b=n,y=(1e3-e)/1e3*l,v=0;v=60&&(u=0,++h>=60&&(h=0,24==++b&&(b=0))),this.timeScaleArray.push({position:y,value:u,unit:"second",hour:b,minute:h,second:u,day:d,year:this._getYear(g,p,0),month:f.monthMod(p)}),y+=l,u++}},{key:"createRawDateString",value:function(t,e){var r=t.year;return 0===t.month&&(t.month=1),r+="-"+("0"+t.month.toString()).slice(-2),"day"===t.unit?r+="day"===t.unit?"-"+("0"+e).slice(-2):"-01":r+="-"+("0"+(t.day?t.day:"1")).slice(-2),"hour"===t.unit?r+="hour"===t.unit?"T"+("0"+e).slice(-2):"T00":r+="T"+("0"+(t.hour?t.hour:"0")).slice(-2),"minute"===t.unit?r+=":"+("0"+e).slice(-2):r+=":"+(t.minute?("0"+t.minute).slice(-2):"00"),"second"===t.unit?r+=":"+("0"+e).slice(-2):r+=":00",this.utc&&(r+=".000Z"),r}},{key:"formatDates",value:function(t){var e=this,r=this.w;return t.map((function(t){var i=t.value.toString(),n=new Vc(e.ctx),o=e.createRawDateString(t,i),a=n.getDate(n.parseDate(o));if(e.utc||(a=n.getDate(n.parseDateWithTimezone(o))),void 0===r.config.xaxis.labels.format){var s="dd MMM",l=r.config.xaxis.labels.datetimeFormatter;"year"===t.unit&&(s=l.year),"month"===t.unit&&(s=l.month),"day"===t.unit&&(s=l.day),"hour"===t.unit&&(s=l.hour),"minute"===t.unit&&(s=l.minute),"second"===t.unit&&(s=l.second),i=n.formatDate(a,s)}else i=n.formatDate(a,r.config.xaxis.labels.format);return{dateString:o,position:t.position,value:i,unit:t.unit,year:t.year,month:t.month}}))}},{key:"removeOverlappingTS",value:function(t){var e,r=this,i=new Pc(this.ctx),n=!1;t.length>0&&t[0].value&&t.every((function(e){return e.value.length===t[0].value.length}))&&(n=!0,e=i.getTextRects(t[0].value).width);var o=0,a=t.map((function(a,s){if(s>0&&r.w.config.xaxis.labels.hideOverlappingLabels){var l=n?e:i.getTextRects(t[o].value).width,c=t[o].position;return a.position>c+l+10?(o=s,a):null}return a}));return a.filter((function(t){return null!==t}))}},{key:"_getYear",value:function(t,e,r){return t+Math.floor(e/12)+r}}],r&&Lb(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();const zb=_b;function Xb(t){return Xb="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xb(t)}function Db(t){return function(t){if(Array.isArray(t))return Yb(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Yb(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Yb(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Yb(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r0&&(l&&console.warn("Chart or series type ".concat(l," cannot appear with other chart or series types.")),a.bar.series.length>0&&n.plotOptions.bar.horizontal&&(c-=a.bar.series.length,a.bar={series:[],i:[]},r.globals.columnSeries={series:[],i:[]},console.warn("Horizontal bars are not supported in a mixed/combo chart. Please turn off `plotOptions.bar.horizontal`"))),o.comboCharts||(o.comboCharts=c>0);var u=new kb(i,e),h=new dg(i,e);i.pie=new Lg(i);var f=new $g(i);i.rangeBar=new lb(i,e);var d=new Hg(i),p=[];if(o.comboCharts){var g,b,y=new Mc(i);if(a.area.series.length>0&&(g=p).push.apply(g,Db(y.drawSeriesByGroup(a.area,o.areaGroups,"area",u))),a.bar.series.length>0)if(n.chart.stacked){var v=new eg(i,e);p.push(v.draw(a.bar.series,a.bar.i))}else i.bar=new Np(i,e),p.push(i.bar.draw(a.bar.series,a.bar.i));if(a.rangeArea.series.length>0&&p.push(u.draw(a.rangeArea.series,"rangeArea",a.rangeArea.i,a.rangeArea.seriesRangeEnd)),a.line.series.length>0&&(b=p).push.apply(b,Db(y.drawSeriesByGroup(a.line,o.lineGroups,"line",u))),a.candlestick.series.length>0&&p.push(h.draw(a.candlestick.series,"candlestick",a.candlestick.i)),a.boxPlot.series.length>0&&p.push(h.draw(a.boxPlot.series,"boxPlot",a.boxPlot.i)),a.rangeBar.series.length>0&&p.push(i.rangeBar.draw(a.rangeBar.series,a.rangeBar.i)),a.scatter.series.length>0){var m=new kb(i,e,!0);p.push(m.draw(a.scatter.series,"scatter",a.scatter.i))}if(a.bubble.series.length>0){var x=new kb(i,e,!0);p.push(x.draw(a.bubble.series,"bubble",a.bubble.i))}}else switch(n.chart.type){case"line":p=u.draw(o.series,"line");break;case"area":p=u.draw(o.series,"area");break;case"bar":n.chart.stacked?p=new eg(i,e).draw(o.series):(i.bar=new Np(i,e),p=i.bar.draw(o.series));break;case"candlestick":p=new dg(i,e).draw(o.series,"candlestick");break;case"boxPlot":p=new dg(i,e).draw(o.series,n.chart.type);break;case"rangeBar":p=i.rangeBar.draw(o.series);break;case"rangeArea":p=u.draw(o.seriesRangeStart,"rangeArea",void 0,o.seriesRangeEnd);break;case"heatmap":p=new kg(i,e).draw(o.series);break;case"treemap":p=new Cb(i,e).draw(o.series);break;case"pie":case"donut":case"polarArea":p=i.pie.draw(o.series);break;case"radialBar":p=f.draw(o.series);break;case"radar":p=d.draw(o.series);break;default:p=u.draw(o.series)}return p}},{key:"setSVGDimensions",value:function(){var t=this.w,e=t.globals,r=t.config;r.chart.width=r.chart.width||"100%",r.chart.height=r.chart.height||"auto",e.svgWidth=r.chart.width,e.svgHeight=r.chart.height;var i=f.getDimensions(this.el),n=r.chart.width.toString().split(/[0-9]+/g).pop();"%"===n?f.isNumber(i[0])&&(0===i[0].width&&(i=f.getDimensions(this.el.parentNode)),e.svgWidth=i[0]*parseInt(r.chart.width,10)/100):"px"!==n&&""!==n||(e.svgWidth=parseInt(r.chart.width,10));var o=String(r.chart.height).toString().split(/[0-9]+/g).pop();if("auto"!==e.svgHeight&&""!==e.svgHeight)if("%"===o){var a=f.getDimensions(this.el.parentNode);e.svgHeight=a[1]*parseInt(r.chart.height,10)/100}else e.svgHeight=parseInt(r.chart.height,10);else e.svgHeight=e.axisCharts?e.svgWidth/1.61:e.svgWidth/1.2;if(e.svgWidth=Math.max(e.svgWidth,0),e.svgHeight=Math.max(e.svgHeight,0),Pc.setAttrs(e.dom.Paper.node,{width:e.svgWidth,height:e.svgHeight}),"%"!==o){var s=r.chart.sparkline.enabled?0:e.axisCharts?r.chart.parentHeightOffset:0;e.dom.Paper.node.parentNode.parentNode.style.minHeight="".concat(e.svgHeight+s,"px")}e.dom.elWrap.style.width="".concat(e.svgWidth,"px"),e.dom.elWrap.style.height="".concat(e.svgHeight,"px")}},{key:"shiftGraphPosition",value:function(){var t=this.w.globals,e=t.translateY,r=t.translateX;Pc.setAttrs(t.dom.elGraphical.node,{transform:"translate(".concat(r,", ").concat(e,")")})}},{key:"resizeNonAxisCharts",value:function(){var t=this.w,e=t.globals,r=0,i=t.config.chart.sparkline.enabled?1:15;i+=t.config.grid.padding.bottom,["top","bottom"].includes(t.config.legend.position)&&t.config.legend.show&&!t.config.legend.floating&&(r=new od(this.ctx).legendHelpers.getLegendDimensions().clwh+7);var n=t.globals.dom.baseEl.querySelector(".apexcharts-radialbar, .apexcharts-pie"),o=2.05*t.globals.radialSize;if(n&&!t.config.chart.sparkline.enabled&&0!==t.config.plotOptions.radialBar.startAngle){var a=f.getBoundingClientRect(n);o=a.bottom;var s=a.bottom-a.top;o=Math.max(2.05*t.globals.radialSize,s)}var l=Math.ceil(o+e.translateY+r+i);e.dom.elLegendForeign&&e.dom.elLegendForeign.setAttribute("height",l),t.config.chart.height&&String(t.config.chart.height).includes("%")||(e.dom.elWrap.style.height="".concat(l,"px"),Pc.setAttrs(e.dom.Paper.node,{height:l}),e.dom.Paper.node.parentNode.parentNode.style.minHeight="".concat(l,"px"))}},{key:"coreCalculations",value:function(){new Wh(this.ctx).init()}},{key:"resetGlobals",value:function(){var t=this,e=function(){return t.w.config.series.map((function(){return[]}))},r=new _u,i=this.w.globals;r.initGlobalVars(i),i.seriesXvalues=e(),i.seriesYvalues=e()}},{key:"isMultipleY",value:function(){return!!(Array.isArray(this.w.config.yaxis)&&this.w.config.yaxis.length>1)&&(this.w.globals.isMultipleYAxis=!0,!0)}},{key:"xySettings",value:function(){var t=this.w,e=null;if(t.globals.axisCharts){if("back"===t.config.xaxis.crosshairs.position&&new hf(this.ctx).drawXCrosshairs(),"back"===t.config.yaxis[0].crosshairs.position&&new hf(this.ctx).drawYCrosshairs(),"datetime"===t.config.xaxis.type&&void 0===t.config.xaxis.labels.formatter){this.ctx.timeScale=new zb(this.ctx);var r=[];isFinite(t.globals.minX)&&isFinite(t.globals.maxX)&&!t.globals.isBarHorizontal?r=this.ctx.timeScale.calculateTimeScaleTicks(t.globals.minX,t.globals.maxX):t.globals.isBarHorizontal&&(r=this.ctx.timeScale.calculateTimeScaleTicks(t.globals.minY,t.globals.maxY)),this.ctx.timeScale.recalcDimensionsBasedOnFormat(r)}e=new Mc(this.ctx).getCalculatedRatios()}return e}},{key:"updateSourceChart",value:function(t){this.ctx.w.globals.selection=void 0,this.ctx.updateHelpers._updateOptions({chart:{selection:{xaxis:{min:t.w.globals.minX,max:t.w.globals.maxX}}}},!1,!1)}},{key:"setupBrushHandler",value:function(){var t=this,e=this.ctx,r=this.w;if(r.config.chart.brush.enabled&&"function"!=typeof r.config.chart.events.selection){var i=Array.isArray(r.config.chart.brush.targets)?r.config.chart.brush.targets:[r.config.chart.brush.target];i.forEach((function(r){var i=e.constructor.getChartByID(r);i.w.globals.brushSource=t.ctx,"function"!=typeof i.w.config.chart.events.zoomed&&(i.w.config.chart.events.zoomed=function(){return t.updateSourceChart(i)}),"function"!=typeof i.w.config.chart.events.scrolled&&(i.w.config.chart.events.scrolled=function(){return t.updateSourceChart(i)})})),r.config.chart.events.selection=function(t,r){i.forEach((function(t){e.constructor.getChartByID(t).ctx.updateHelpers._updateOptions({xaxis:{min:r.xaxis.min,max:r.xaxis.max}},!1,!1,!1,!1)}))}}}}],r&&Hb(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Nb(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function Wb(t){for(var e=1;e1&&void 0!==arguments[1]&&arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return new Promise((function(a){var s=[e.ctx];n&&(s=e.ctx.getSyncedCharts()),e.ctx.w.globals.isExecCalled&&(s=[e.ctx],e.ctx.w.globals.isExecCalled=!1),s.forEach((function(n,l){var c=n.w;if(c.globals.shouldAnimate=i,r||(c.globals.resized=!0,c.globals.dataChanged=!0,i&&n.series.getPreviousPaths()),t&&"object"===Vb(t)&&(n.config=new Mu(t),t=Mc.extendArrayProps(n.config,t,c),n.w.globals.chartID!==e.ctx.w.globals.chartID&&delete t.series,c.config=f.extend(c.config,t),o&&(c.globals.lastXAxis=t.xaxis?f.clone(t.xaxis):[],c.globals.lastYAxis=t.yaxis?f.clone(t.yaxis):[],c.globals.initialConfig=f.extend({},c.config),c.globals.initialSeries=f.clone(c.config.series),t.series))){for(var u=0;u2&&void 0!==arguments[2]&&arguments[2];return new Promise((function(n){var o,a=r.w;return a.globals.shouldAnimate=e,a.globals.dataChanged=!0,e&&r.ctx.series.getPreviousPaths(),a.globals.axisCharts?(o=t.map((function(t,e){return r._extendSeries(t,e)})),0===o.length&&(o=[{data:[]}]),a.config.series=o):a.config.series=t.slice(),i&&(a.globals.initialConfig.series=f.clone(a.config.series),a.globals.initialSeries=f.clone(a.config.series)),r.ctx.update().then((function(){n(r.ctx)}))}))}},{key:"_extendSeries",value:function(t,e){var r=this.w,i=r.config.series[e];return Wb(Wb({},r.config.series[e]),{},{name:t.name?t.name:null==i?void 0:i.name,color:t.color?t.color:null==i?void 0:i.color,type:t.type?t.type:null==i?void 0:i.type,group:t.group?t.group:null==i?void 0:i.group,hidden:void 0!==t.hidden?t.hidden:null==i?void 0:i.hidden,data:t.data?t.data:null==i?void 0:i.data,zIndex:void 0!==t.zIndex?t.zIndex:e})}},{key:"toggleDataPointSelection",value:function(t,e){var r=this.w,i=null,n=".apexcharts-series[data\\:realIndex='".concat(t,"']");return r.globals.axisCharts?i=r.globals.dom.Paper.findOne("".concat(n," path[j='").concat(e,"'], ").concat(n," circle[j='").concat(e,"'], ").concat(n," rect[j='").concat(e,"']")):void 0===e&&(i=r.globals.dom.Paper.findOne("".concat(n," path[j='").concat(t,"']")),"pie"!==r.config.chart.type&&"polarArea"!==r.config.chart.type&&"donut"!==r.config.chart.type||this.ctx.pie.pieClicked(t)),i?(new Pc(this.ctx).pathMouseDown(i,null),i.node?i.node:null):(console.warn("toggleDataPointSelection: Element not found"),null)}},{key:"forceXAxisUpdate",value:function(t){var e=this.w;if(["min","max"].forEach((function(r){void 0!==t.xaxis[r]&&(e.config.xaxis[r]=t.xaxis[r],e.globals.lastXAxis[r]=t.xaxis[r])})),t.xaxis.categories&&t.xaxis.categories.length&&(e.config.xaxis.categories=t.xaxis.categories),e.config.xaxis.convertedCatToNumeric){var r=new Cu(t);t=r.convertCatToNumericXaxis(t,this.ctx)}return t}},{key:"forceYAxisUpdate",value:function(t){return t.chart&&t.chart.stacked&&"100%"===t.chart.stackType&&(Array.isArray(t.yaxis)?t.yaxis.forEach((function(e,r){t.yaxis[r].min=0,t.yaxis[r].max=100})):(t.yaxis.min=0,t.yaxis.max=100)),t}},{key:"revertDefaultAxisMinMax",value:function(t){var e=this,r=this.w,i=r.globals.lastXAxis,n=r.globals.lastYAxis;t&&t.xaxis&&(i=t.xaxis),t&&t.yaxis&&(n=t.yaxis),r.config.xaxis.min=i.min,r.config.xaxis.max=i.max;r.config.yaxis.map((function(t,i){r.globals.zoomed||void 0!==n[i]?function(t){void 0!==n[t]&&(r.config.yaxis[t].min=n[t].min,r.config.yaxis[t].max=n[t].max)}(i):void 0!==e.ctx.opts.yaxis[i]&&(t.min=e.ctx.opts.yaxis[i].min,t.max=e.ctx.opts.yaxis[i].max)}))}}],r&&Ub(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function $b(t){return $b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$b(t)}function Jb(t,e){for(var r=0;r0&&arguments[0]!==c?arguments[0]:[],n=arguments.length>1?arguments[1]:c,o=arguments.length>2?arguments[2]:c,a=arguments.length>3?arguments[3]:c,s=arguments.length>4?arguments[4]:c,l=arguments.length>5?arguments[5]:c,c=arguments.length>6?arguments[6]:c,u=t.slice(n,o||c),h=a.slice(s,l||c),f=0,d={pos:[0,0],start:[0,0]},p={pos:[0,0],start:[0,0]};u[f]=e.call(d,u[f]),h[f]=e.call(p,h[f]),u[f][0]!=h[f][0]||"M"==u[f][0]||"A"==u[f][0]&&(u[f][4]!=h[f][4]||u[f][5]!=h[f][5])?(Array.prototype.splice.apply(u,[f,1].concat(i.call(d,u[f]))),Array.prototype.splice.apply(h,[f,1].concat(i.call(p,h[f])))):(u[f]=r.call(d,u[f]),h[f]=r.call(p,h[f])),++f!=u.length||f!=h.length;)f==u.length&&u.push(["C",d.pos[0],d.pos[1],d.pos[0],d.pos[1],d.pos[0],d.pos[1]]),f==h.length&&h.push(["C",p.pos[0],p.pos[1],p.pos[0],p.pos[1],p.pos[0],p.pos[1]]);return{start:u,dest:h}}function e(t){switch(t[0]){case"z":case"Z":t[0]="L",t[1]=this.start[0],t[2]=this.start[1];break;case"H":t[0]="L",t[2]=this.pos[1];break;case"V":t[0]="L",t[2]=t[1],t[1]=this.pos[0];break;case"T":t[0]="Q",t[3]=t[1],t[4]=t[2],t[1]=this.reflection[1],t[2]=this.reflection[0];break;case"S":t[0]="C",t[6]=t[4],t[5]=t[3],t[4]=t[2],t[3]=t[1],t[2]=this.reflection[1],t[1]=this.reflection[0]}return t}function r(t){var e=t.length;return this.pos=[t[e-2],t[e-1]],-1!="SCQT".indexOf(t[0])&&(this.reflection=[2*this.pos[0]-t[e-4],2*this.pos[1]-t[e-3]]),t}function i(t){var e=[t];switch(t[0]){case"M":return this.pos=this.start=[t[1],t[2]],e;case"L":t[5]=t[3]=t[1],t[6]=t[4]=t[2],t[1]=this.pos[0],t[2]=this.pos[1];break;case"Q":t[6]=t[4],t[5]=t[3],t[4]=1*t[4]/3+2*t[2]/3,t[3]=1*t[3]/3+2*t[1]/3,t[2]=1*this.pos[1]/3+2*t[2]/3,t[1]=1*this.pos[0]/3+2*t[1]/3;break;case"A":e=function(t,e){var r,i,n,o,a,s,l,c,u,h,f,d,p,g,b,y,v,m,x,w,S,k,A,O,P,C,j=Math.abs(e[1]),T=Math.abs(e[2]),E=e[3]%360,M=e[4],L=e[5],I=e[6],R=e[7],_=new _t(t),z=new _t(I,R),X=[];if(0===j||0===T||_.x===z.x&&_.y===z.y)return[["C",_.x,_.y,z.x,z.y,z.x,z.y]];for((i=(r=new _t((_.x-z.x)/2,(_.y-z.y)/2).transform((new Ht).rotate(E))).x*r.x/(j*j)+r.y*r.y/(T*T))>1&&(j*=i=Math.sqrt(i),T*=i),n=(new Ht).rotate(E).scale(1/j,1/T).rotate(-E),_=_.transform(n),s=(o=[(z=z.transform(n)).x-_.x,z.y-_.y])[0]*o[0]+o[1]*o[1],a=Math.sqrt(s),o[0]/=a,o[1]/=a,l=s<4?Math.sqrt(1-s/4):0,M===L&&(l*=-1),c=new _t((z.x+_.x)/2+l*-o[1],(z.y+_.y)/2+l*o[0]),u=new _t(_.x-c.x,_.y-c.y),h=new _t(z.x-c.x,z.y-c.y),f=Math.acos(u.x/Math.sqrt(u.x*u.x+u.y*u.y)),u.y<0&&(f*=-1),d=Math.acos(h.x/Math.sqrt(h.x*h.x+h.y*h.y)),h.y<0&&(d*=-1),L&&f>d&&(d+=2*Math.PI),!L&&f0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1?arguments[1]:void 0;if(!1===e)return!1;for(var r=e,i=t.length;rt.length)&&(e=t.length);for(var r=0,i=Array(e);r3&&void 0!==arguments[3]?arguments[3]:null;return function(n){n.preventDefault(),n.stopPropagation();var o=n.pageX||n.touches[0].pageX,a=n.pageY||n.touches[0].pageY;e.fire(t,{x:o,y:a,event:n,index:i,points:r})}}function ly(t,e){var r,i,n=(i=2,function(t){if(Array.isArray(t))return t}(r=t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var i,n,o,a,s=[],l=!0,c=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(i=o.call(r)).done)&&(s.push(i.value),s.length!==e);l=!0);}catch(t){c=!0,n=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw n}}return s}}(r,i)||function(t,e){if(t){if("string"==typeof t)return ay(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ay(t,e):void 0}}(r,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=n[0],a=n[1],s=e.a,l=e.b,c=e.c,u=e.d;return[o*s+a*c+e.e,o*l+a*u+e.f]}it(ar,{draggable:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return(this.remember("_draggable")||new ty(this)).init(t),this}});var cy=function(){function t(e){ry(this,t),this.el=e,e.remember("_selectHandler",this),this.selection=new Js,this.order=["lt","t","rt","r","rb","b","lb","l","rot"],this.mutationHandler=this.mutationHandler.bind(this);var r=N();this.observer=new r.MutationObserver(this.mutationHandler)}return ny(t,[{key:"init",value:function(t){this.createHandle=t.createHandle||this.createHandleFn,this.createRot=t.createRot||this.createRotFn,this.updateHandle=t.updateHandle||this.updateHandleFn,this.updateRot=t.updateRot||this.updateRotFn,this.el.root().put(this.selection),this.updatePoints(),this.createSelection(),this.createResizeHandles(),this.updateResizeHandles(),this.createRotationHandle(),this.updateRotationHandle(),this.observer.observe(this.el.node,{attributes:!0})}},{key:"active",value:function(t,e){if(!t)return this.selection.clear().remove(),void this.observer.disconnect();this.init(e)}},{key:"createSelection",value:function(){this.selection.polygon(this.handlePoints).addClass("svg_select_shape")}},{key:"updateSelection",value:function(){this.selection.get(0).plot(this.handlePoints)}},{key:"createResizeHandles",value:function(){var t=this;this.handlePoints.forEach((function(e,r,i){var n=t.order[r];t.createHandle.call(t,t.selection,e,r,i,n),t.selection.get(r+1).addClass("svg_select_handle svg_select_handle_"+n).on("mousedown.selection touchstart.selection",sy(n,t.el,t.handlePoints,r))}))}},{key:"createHandleFn",value:function(t){t.polyline()}},{key:"updateHandleFn",value:function(t,e,r,i){var n=i.at(r-1),o=i[(r+1)%i.length],a=e,s=[a[0]-n[0],a[1]-n[1]],l=[a[0]-o[0],a[1]-o[1]],c=Math.sqrt(s[0]*s[0]+s[1]*s[1]),u=Math.sqrt(l[0]*l[0]+l[1]*l[1]),h=[s[0]/c,s[1]/c],f=[l[0]/u,l[1]/u],d=[a[0]-10*h[0],a[1]-10*h[1]],p=[a[0]-10*f[0],a[1]-10*f[1]];t.plot([d,a,p])}},{key:"updateResizeHandles",value:function(){var t=this;this.handlePoints.forEach((function(e,r,i){var n=t.order[r];t.updateHandle.call(t,t.selection.get(r+1),e,r,i,n)}))}},{key:"createRotFn",value:function(t){t.line(),t.circle(5)}},{key:"getPoint",value:function(t){return this.handlePoints[this.order.indexOf(t)]}},{key:"getPointHandle",value:function(t){return this.selection.get(this.order.indexOf(t)+1)}},{key:"updateRotFn",value:function(t,e){var r=this.getPoint("t");t.get(0).plot(r[0],r[1],e[0],e[1]),t.get(1).center(e[0],e[1])}},{key:"createRotationHandle",value:function(){var t=this.selection.group().addClass("svg_select_handle_rot").on("mousedown.selection touchstart.selection",sy("rot",this.el,this.handlePoints));this.createRot.call(this,t)}},{key:"updateRotationHandle",value:function(){var t=this.selection.findOne("g.svg_select_handle_rot");this.updateRot(t,this.rotationPoint,this.handlePoints)}},{key:"updatePoints",value:function(){var t=this.el.bbox(),e=this.el.parent().screenCTM().inverseO().multiplyO(this.el.screenCTM());this.handlePoints=this.getHandlePoints(t).map((function(t){return ly(t,e)})),this.rotationPoint=ly(this.getRotationPoint(t),e)}},{key:"getHandlePoints",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.el.bbox(),e=t.x,r=t.x2,i=t.y,n=t.y2,o=t.cx,a=t.cy;return[[e,i],[o,i],[r,i],[r,a],[r,n],[o,n],[e,n],[e,a]]}},{key:"getRotationPoint",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.el.bbox(),e=t.y;return[t.cx,e-20]}},{key:"mutationHandler",value:function(){this.updatePoints(),this.updateSelection(),this.updateResizeHandles(),this.updateRotationHandle()}}]),t}(),uy=function(){function t(e){ry(this,t),this.el=e,e.remember("_pointSelectHandler",this),this.selection=new Js,this.order=["lt","t","rt","r","rb","b","lb","l","rot"],this.mutationHandler=this.mutationHandler.bind(this);var r=N();this.observer=new r.MutationObserver(this.mutationHandler)}return ny(t,[{key:"init",value:function(t){this.createHandle=t.createHandle||this.createHandleFn,this.updateHandle=t.updateHandle||this.updateHandleFn,this.el.root().put(this.selection),this.updatePoints(),this.createSelection(),this.createPointHandles(),this.updatePointHandles(),this.observer.observe(this.el.node,{attributes:!0})}},{key:"active",value:function(t,e){if(!t)return this.selection.clear().remove(),void this.observer.disconnect();this.init(e)}},{key:"createSelection",value:function(){this.selection.polygon(this.points).addClass("svg_select_shape_pointSelect")}},{key:"updateSelection",value:function(){this.selection.get(0).plot(this.points)}},{key:"createPointHandles",value:function(){var t=this;this.points.forEach((function(e,r,i){t.createHandle.call(t,t.selection,e,r,i),t.selection.get(r+1).addClass("svg_select_handle_point").on("mousedown.selection touchstart.selection",sy("point",t.el,t.points,r))}))}},{key:"createHandleFn",value:function(t){t.circle(5)}},{key:"updateHandleFn",value:function(t,e){t.center(e[0],e[1])}},{key:"updatePointHandles",value:function(){var t=this;this.points.forEach((function(e,r,i){t.updateHandle.call(t,t.selection.get(r+1),e,r,i)}))}},{key:"updatePoints",value:function(){var t=this.el.parent().screenCTM().inverseO().multiplyO(this.el.screenCTM());this.points=this.el.array().map((function(e){return ly(e,t)}))}},{key:"mutationHandler",value:function(){this.updatePoints(),this.updateSelection(),this.updatePointHandles()}}]),t}(),hy=function(t){return function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"object"===ey(e)&&(r=e,e=!0);var i=this.remember("_"+t.name);return i||(e.prototype instanceof cy?(i=new e(this),e=!0):i=new t(this),this.remember("_"+t.name,i)),i.active(e,r),this}};function fy(t){return fy="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fy(t)}function dy(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function py(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,i=Array(e);r3&&void 0!==arguments[3]?arguments[3]:null;return function(n){n.preventDefault(),n.stopPropagation();var o=n.pageX||n.touches[0].pageX,a=n.pageY||n.touches[0].pageY;e.fire(t,{x:o,y:a,event:n,index:i,points:r})}}function xy(t,e){var r=yy(t,2),i=r[0],n=r[1],o=e.a,a=e.b,s=e.c,l=e.d;return[i*o+n*s+e.e,i*a+n*l+e.f]}it(ar,{select:hy(cy)}),it([Eo,zo,on],{pointSelect:hy(uy)});var wy=function(){function t(e){dy(this,t),this.el=e,e.remember("_selectHandler",this),this.selection=new Js,this.order=["lt","t","rt","r","rb","b","lb","l","rot"],this.mutationHandler=this.mutationHandler.bind(this);var r=N();this.observer=new r.MutationObserver(this.mutationHandler)}return gy(t,[{key:"init",value:function(t){this.createHandle=t.createHandle||this.createHandleFn,this.createRot=t.createRot||this.createRotFn,this.updateHandle=t.updateHandle||this.updateHandleFn,this.updateRot=t.updateRot||this.updateRotFn,this.el.root().put(this.selection),this.updatePoints(),this.createSelection(),this.createResizeHandles(),this.updateResizeHandles(),this.createRotationHandle(),this.updateRotationHandle(),this.observer.observe(this.el.node,{attributes:!0})}},{key:"active",value:function(t,e){if(!t)return this.selection.clear().remove(),void this.observer.disconnect();this.init(e)}},{key:"createSelection",value:function(){this.selection.polygon(this.handlePoints).addClass("svg_select_shape")}},{key:"updateSelection",value:function(){this.selection.get(0).plot(this.handlePoints)}},{key:"createResizeHandles",value:function(){var t=this;this.handlePoints.forEach((function(e,r,i){var n=t.order[r];t.createHandle.call(t,t.selection,e,r,i,n),t.selection.get(r+1).addClass("svg_select_handle svg_select_handle_"+n).on("mousedown.selection touchstart.selection",my(n,t.el,t.handlePoints,r))}))}},{key:"createHandleFn",value:function(t){t.polyline()}},{key:"updateHandleFn",value:function(t,e,r,i){var n=i.at(r-1),o=i[(r+1)%i.length],a=e,s=[a[0]-n[0],a[1]-n[1]],l=[a[0]-o[0],a[1]-o[1]],c=Math.sqrt(s[0]*s[0]+s[1]*s[1]),u=Math.sqrt(l[0]*l[0]+l[1]*l[1]),h=[s[0]/c,s[1]/c],f=[l[0]/u,l[1]/u],d=[a[0]-10*h[0],a[1]-10*h[1]],p=[a[0]-10*f[0],a[1]-10*f[1]];t.plot([d,a,p])}},{key:"updateResizeHandles",value:function(){var t=this;this.handlePoints.forEach((function(e,r,i){var n=t.order[r];t.updateHandle.call(t,t.selection.get(r+1),e,r,i,n)}))}},{key:"createRotFn",value:function(t){t.line(),t.circle(5)}},{key:"getPoint",value:function(t){return this.handlePoints[this.order.indexOf(t)]}},{key:"getPointHandle",value:function(t){return this.selection.get(this.order.indexOf(t)+1)}},{key:"updateRotFn",value:function(t,e){var r=this.getPoint("t");t.get(0).plot(r[0],r[1],e[0],e[1]),t.get(1).center(e[0],e[1])}},{key:"createRotationHandle",value:function(){var t=this.selection.group().addClass("svg_select_handle_rot").on("mousedown.selection touchstart.selection",my("rot",this.el,this.handlePoints));this.createRot.call(this,t)}},{key:"updateRotationHandle",value:function(){var t=this.selection.findOne("g.svg_select_handle_rot");this.updateRot(t,this.rotationPoint,this.handlePoints)}},{key:"updatePoints",value:function(){var t=this.el.bbox(),e=this.el.parent().screenCTM().inverseO().multiplyO(this.el.screenCTM());this.handlePoints=this.getHandlePoints(t).map((function(t){return xy(t,e)})),this.rotationPoint=xy(this.getRotationPoint(t),e)}},{key:"getHandlePoints",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.el.bbox(),e=t.x,r=t.x2,i=t.y,n=t.y2,o=t.cx,a=t.cy;return[[e,i],[o,i],[r,i],[r,a],[r,n],[o,n],[e,n],[e,a]]}},{key:"getRotationPoint",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.el.bbox(),e=t.y;return[t.cx,e-20]}},{key:"mutationHandler",value:function(){this.updatePoints(),this.updateSelection(),this.updateResizeHandles(),this.updateRotationHandle()}}]),t}(),Sy=function(){function t(e){dy(this,t),this.el=e,e.remember("_pointSelectHandler",this),this.selection=new Js,this.order=["lt","t","rt","r","rb","b","lb","l","rot"],this.mutationHandler=this.mutationHandler.bind(this);var r=N();this.observer=new r.MutationObserver(this.mutationHandler)}return gy(t,[{key:"init",value:function(t){this.createHandle=t.createHandle||this.createHandleFn,this.updateHandle=t.updateHandle||this.updateHandleFn,this.el.root().put(this.selection),this.updatePoints(),this.createSelection(),this.createPointHandles(),this.updatePointHandles(),this.observer.observe(this.el.node,{attributes:!0})}},{key:"active",value:function(t,e){if(!t)return this.selection.clear().remove(),void this.observer.disconnect();this.init(e)}},{key:"createSelection",value:function(){this.selection.polygon(this.points).addClass("svg_select_shape_pointSelect")}},{key:"updateSelection",value:function(){this.selection.get(0).plot(this.points)}},{key:"createPointHandles",value:function(){var t=this;this.points.forEach((function(e,r,i){t.createHandle.call(t,t.selection,e,r,i),t.selection.get(r+1).addClass("svg_select_handle_point").on("mousedown.selection touchstart.selection",my("point",t.el,t.points,r))}))}},{key:"createHandleFn",value:function(t){t.circle(5)}},{key:"updateHandleFn",value:function(t,e){t.center(e[0],e[1])}},{key:"updatePointHandles",value:function(){var t=this;this.points.forEach((function(e,r,i){t.updateHandle.call(t,t.selection.get(r+1),e,r,i)}))}},{key:"updatePoints",value:function(){var t=this.el.parent().screenCTM().inverseO().multiplyO(this.el.screenCTM());this.points=this.el.array().map((function(e){return xy(e,t)}))}},{key:"mutationHandler",value:function(){this.updatePoints(),this.updateSelection(),this.updatePointHandles()}}]),t}(),ky=function(t){return function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"object"===fy(e)&&(r=e,e=!0);var i=this.remember("_"+t.name);return i||(e.prototype instanceof wy?(i=new e(this),e=!0):i=new t(this),this.remember("_"+t.name,i)),i.active(e,r),this}};it(ar,{select:ky(wy)}),it([Eo,zo,on],{pointSelect:ky(Sy)});var Ay=function(t){return t.changedTouches&&(t=t.changedTouches[0]),{x:t.clientX,y:t.clientY}},Oy=function(t){for(var e=1/0,r=1/0,i=-1/0,n=-1/0,o=0;o0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"object"===fy(t)&&(e=t,t=!0);var r=this.remember("_ResizeHandler");return r||(t.prototype instanceof Py?(r=new t(this),t=!0):r=new Py(this),this.remember("_resizeHandler",r)),r.active(t,e),this}}),void 0===window.SVG&&(window.SVG=Zl),void 0===window.Apex&&(window.Apex={});var Ey=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.ctx=e,this.w=e.w}var e,r;return e=t,(r=[{key:"initModules",value:function(){this.ctx.publicMethods=["updateOptions","updateSeries","appendData","appendSeries","isSeriesHidden","highlightSeries","toggleSeries","showSeries","hideSeries","setLocale","resetSeries","zoomX","toggleDataPointSelection","dataURI","exportToCSV","addXaxisAnnotation","addYaxisAnnotation","addPointAnnotation","clearAnnotations","removeAnnotation","paper","destroy"],this.ctx.eventList=["click","mousedown","mousemove","mouseleave","touchstart","touchmove","touchleave","mouseup","touchend"],this.ctx.animations=new b(this.ctx),this.ctx.axes=new sf(this.ctx),this.ctx.core=new Bb(this.ctx.el,this.ctx),this.ctx.config=new Mu({}),this.ctx.data=new yh(this.ctx),this.ctx.grid=new Rh(this.ctx),this.ctx.graphics=new Pc(this.ctx),this.ctx.coreUtils=new Mc(this.ctx),this.ctx.crosshairs=new hf(this.ctx),this.ctx.events=new Qh(this.ctx),this.ctx.exports=new Ah(this.ctx),this.ctx.fill=new Zu(this.ctx),this.ctx.localization=new rf(this.ctx),this.ctx.options=new pu,this.ctx.responsive=new gf(this.ctx),this.ctx.series=new fh(this.ctx),this.ctx.theme=new xf(this.ctx),this.ctx.formatters=new Jc(this.ctx),this.ctx.titleSubtitle=new Af(this.ctx),this.ctx.legend=new od(this.ctx),this.ctx.toolbar=new kd(this.ctx),this.ctx.tooltip=new mp(this.ctx),this.ctx.dimensions=new Uf(this.ctx),this.ctx.updateHelpers=new Zb(this.ctx),this.ctx.zoomPanSelection=new Rd(this.ctx),this.ctx.w.globals.tooltip=new mp(this.ctx)}}])&&jy(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function My(t){return My="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},My(t)}function Ly(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:null,r=this,i=r.w;return new Promise((function(n,o){if(null===r.el)return o(new Error("Not enough data to display or target element not found"));(null===e||i.globals.allSeriesCollapsed)&&r.series.handleNoData(),r.grid=new Rh(r);var a,s,l=r.grid.drawGrid();if(r.annotations=new vu(r),r.annotations.drawImageAnnos(),r.annotations.drawTextAnnos(),"back"===i.config.grid.position&&(l&&i.globals.dom.elGraphical.add(l.el),null!=l&&null!==(a=l.elGridBorders)&&void 0!==a&&a.node&&i.globals.dom.elGraphical.add(l.elGridBorders)),Array.isArray(e.elGraph))for(var c=0;c0&&i.globals.memory.methodsToExec.forEach((function(t){t.method(t.params,!1,t.context)})),i.globals.axisCharts||i.globals.noData||r.core.resizeNonAxisCharts(),n(r)}))}},{key:"destroy",value:function(){window.removeEventListener("resize",this.windowResizeHandler),function(t,e){var r=_y.get(e);r&&(r.disconnect(),_y.delete(e))}(this.el.parentNode,this.parentResizeHandler);var t=this.w.config.chart.id;t&&Apex._chartInstances.forEach((function(e,r){e.id===f.escapeString(t)&&Apex._chartInstances.splice(r,1)})),new Ry(this.ctx).clear({isUpdating:!1})}},{key:"updateOptions",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=this.w;return a.globals.selection=void 0,t.series&&(this.series.resetSeries(!1,!0,!1),t.series.length&&t.series[0].data&&(t.series=t.series.map((function(t,r){return e.updateHelpers._extendSeries(t,r)}))),this.updateHelpers.revertDefaultAxisMinMax()),t.xaxis&&(t=this.updateHelpers.forceXAxisUpdate(t)),t.yaxis&&(t=this.updateHelpers.forceYAxisUpdate(t)),a.globals.collapsedSeriesIndices.length>0&&this.series.clearPreviousPaths(),t.theme&&(t=this.theme.updateThemeOptions(t)),this.updateHelpers._updateOptions(t,r,i,n,o)}},{key:"updateSeries",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return this.series.resetSeries(!1),this.updateHelpers.revertDefaultAxisMinMax(),this.updateHelpers._updateSeries(t,e,r)}},{key:"appendSeries",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=this.w.config.series.slice();return i.push(t),this.series.resetSeries(!1),this.updateHelpers.revertDefaultAxisMinMax(),this.updateHelpers._updateSeries(i,e,r)}},{key:"appendData",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=this;r.w.globals.dataChanged=!0,r.series.getPreviousPaths();for(var i=r.w.config.series.slice(),n=0;n0&&void 0!==arguments[0])||arguments[0],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.series.resetSeries(t,e)}},{key:"addEventListener",value:function(t,e){this.events.addEventListener(t,e)}},{key:"removeEventListener",value:function(t,e){this.events.removeEventListener(t,e)}},{key:"addXaxisAnnotation",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,i=this;r&&(i=r),i.annotations.addXaxisAnnotationExternal(t,e,i)}},{key:"addYaxisAnnotation",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,i=this;r&&(i=r),i.annotations.addYaxisAnnotationExternal(t,e,i)}},{key:"addPointAnnotation",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,i=this;r&&(i=r),i.annotations.addPointAnnotationExternal(t,e,i)}},{key:"clearAnnotations",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,e=this;t&&(e=t),e.annotations.clearAnnotations(e)}},{key:"removeAnnotation",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,r=this;e&&(r=e),r.annotations.removeAnnotation(r,t)}},{key:"getChartArea",value:function(){return this.w.globals.dom.baseEl.querySelector(".apexcharts-inner")}},{key:"getSeriesTotalXRange",value:function(t,e){return this.coreUtils.getSeriesTotalsXRange(t,e)}},{key:"getHighestValueInSeries",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Wh(this.ctx).getMinYMaxY(t).highestY}},{key:"getLowestValueInSeries",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Wh(this.ctx).getMinYMaxY(t).lowestY}},{key:"getSeriesTotal",value:function(){return this.w.globals.seriesTotals}},{key:"toggleDataPointSelection",value:function(t,e){return this.updateHelpers.toggleDataPointSelection(t,e)}},{key:"zoomX",value:function(t,e){this.ctx.toolbar.zoomUpdateOptions(t,e)}},{key:"setLocale",value:function(t){this.localization.setCurrentLocaleValues(t)}},{key:"dataURI",value:function(t){return new Ah(this.ctx).dataURI(t)}},{key:"getSvgString",value:function(t){return new Ah(this.ctx).getSvgString(t)}},{key:"exportToCSV",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Ah(this.ctx).exportToCSV(t)}},{key:"paper",value:function(){return this.w.globals.dom.Paper}},{key:"_parentResizeCallback",value:function(){this.w.globals.animationEnded&&this.w.config.chart.redrawOnParentResize&&this._windowResize()}},{key:"_windowResize",value:function(){var t=this;clearTimeout(this.w.globals.resizeTimer),this.w.globals.resizeTimer=window.setTimeout((function(){t.w.globals.resized=!0,t.w.globals.dataChanged=!1,t.ctx.update()}),150)}},{key:"_windowResizeHandler",value:function(){var t=this.w.config.chart.redrawOnWindowResize;"function"==typeof t&&(t=t()),t&&this._windowResize()}}],i=[{key:"getChartByID",value:function(t){var e=f.escapeString(t);if(Apex._chartInstances){var r=Apex._chartInstances.filter((function(t){return t.id===e}))[0];return r&&r.chart}}},{key:"initOnLoad",value:function(){for(var e=document.querySelectorAll("[data-apexcharts]"),r=0;r2?n-2:0),a=2;at.length)&&(e=t.length);for(var i=0,a=Array(e);i=t.length?{done:!0}:{done:!1,value:t[a++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,n=!0,o=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return n=t.done,t},e:function(t){o=!0,r=t},f:function(){try{n||null==i.return||i.return()}finally{if(o)throw r}}}}function n(t){var i=c();return function(){var a,s=l(t);if(i){var r=l(this).constructor;a=Reflect.construct(s,arguments,r)}else a=s.apply(this,arguments);return function(t,i){if(i&&("object"==typeof i||"function"==typeof i))return i;if(void 0!==i)throw new TypeError("Derived constructors may only return object or undefined");return e(t)}(this,a)}}function o(t,e,i){return(e=x(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function l(t){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},l(t)}function h(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&g(t,e)}function c(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(c=function(){return!!t})()}function d(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,a)}return i}function u(t){for(var e=1;e>16,n=i>>8&255,o=255&i;return"#"+(16777216+65536*(Math.round((a-r)*s)+r)+256*(Math.round((a-n)*s)+n)+(Math.round((a-o)*s)+o)).toString(16).slice(1)}},{key:"shadeColor",value:function(e,i){return t.isColorHex(i)?this.shadeHexColor(e,i):this.shadeRGBColor(e,i)}}],[{key:"bind",value:function(t,e){return function(){return t.apply(e,arguments)}}},{key:"isObject",value:function(t){return t&&"object"===b(t)&&!Array.isArray(t)&&null!=t}},{key:"is",value:function(t,e){return Object.prototype.toString.call(e)==="[object "+t+"]"}},{key:"listToArray",value:function(t){var e,i=[];for(e=0;e1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if(null===t||"object"!==b(t))return t;if(i.has(t))return i.get(t);if(Array.isArray(t)){e=[],i.set(t,e);for(var a=0;a1&&void 0!==arguments[1]?arguments[1]:2;return Number.isInteger(t)?t:parseFloat(t.toPrecision(e))}},{key:"randomId",value:function(){return(Math.random()+1).toString(36).substring(4)}},{key:"noExponents",value:function(t){return t.toString().includes("e")?Math.round(t):t}},{key:"elementExists",value:function(t){return!(!t||!t.isConnected)}},{key:"getDimensions",value:function(t){var e=getComputedStyle(t,null),i=t.clientHeight,a=t.clientWidth;return i-=parseFloat(e.paddingTop)+parseFloat(e.paddingBottom),[a-=parseFloat(e.paddingLeft)+parseFloat(e.paddingRight),i]}},{key:"getBoundingClientRect",value:function(t){var e=t.getBoundingClientRect();return{top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:t.clientWidth,height:t.clientHeight,x:e.left,y:e.top}}},{key:"getLargestStringFromArr",value:function(t){return t.reduce((function(t,e){return Array.isArray(e)&&(e=e.reduce((function(t,e){return t.length>e.length?t:e}))),t.length>e.length?t:e}),0)}},{key:"hexToRgba",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"#999999",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.6;"#"!==t.substring(0,1)&&(t="#999999");var i=t.replace("#","");i=i.match(new RegExp("(.{"+i.length/3+"})","g"));for(var a=0;a1&&void 0!==arguments[1]?arguments[1]:"x",i=t.toString().slice();return i=i.replace(/[` ~!@#$%^&*()|+\=?;:'",.<>{}[\]\\/]/gi,e)}},{key:"negToZero",value:function(t){return t<0?0:t}},{key:"moveIndexInArray",value:function(t,e,i){if(i>=t.length)for(var a=i-t.length+1;a--;)t.push(void 0);return t.splice(i,0,t.splice(e,1)[0]),t}},{key:"extractNumber",value:function(t){return parseFloat(t.replace(/[^\d.]*/g,""))}},{key:"findAncestor",value:function(t,e){for(;(t=t.parentElement)&&!t.classList.contains(e););return t}},{key:"setELstyles",value:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t.style.key=e[i])}},{key:"preciseAddition",value:function(t,e){var i=(String(t).split(".")[1]||"").length,a=(String(e).split(".")[1]||"").length,s=Math.pow(10,Math.max(i,a));return(Math.round(t*s)+Math.round(e*s))/s}},{key:"isNumber",value:function(t){return!isNaN(t)&&parseFloat(Number(t))===t&&!isNaN(parseInt(t,10))}},{key:"isFloat",value:function(t){return Number(t)===t&&t%1!=0}},{key:"isMsEdge",value:function(){var t=window.navigator.userAgent,e=t.indexOf("Edge/");return e>0&&parseInt(t.substring(e+5,t.indexOf(".",e)),10)}},{key:"getGCD",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:7,a=Math.pow(10,i-Math.floor(Math.log10(Math.max(t,e))));for(t=Math.round(Math.abs(t)*a),e=Math.round(Math.abs(e)*a);e;){var s=e;e=t%e,t=s}return t/a}},{key:"getPrimeFactors",value:function(t){for(var e=[],i=2;t>=2;)t%i==0?(e.push(i),t/=i):i++;return e}},{key:"mod",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:7,a=Math.pow(10,i-Math.floor(Math.log10(Math.max(t,e))));return(t=Math.round(Math.abs(t)*a))%(e=Math.round(Math.abs(e)*a))/a}}]),t}(),y=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"animateLine",value:function(t,e,i,a){t.attr(e).animate(a).attr(i)}},{key:"animateMarker",value:function(t,e,i,a){t.attr({opacity:0}).animate(e).attr({opacity:1}).after((function(){a()}))}},{key:"animateRect",value:function(t,e,i,a,s){t.attr(e).animate(a).attr(i).after((function(){return s()}))}},{key:"animatePathsGradually",value:function(t){var e=t.el,i=t.realIndex,a=t.j,s=t.fill,r=t.pathFrom,n=t.pathTo,o=t.speed,l=t.delay,h=this.w,c=0;h.config.chart.animations.animateGradually.enabled&&(c=h.config.chart.animations.animateGradually.delay),h.config.chart.animations.dynamicAnimation.enabled&&h.globals.dataChanged&&"bar"!==h.config.chart.type&&(c=0),this.morphSVG(e,i,a,"line"!==h.config.chart.type||h.globals.comboCharts?s:"stroke",r,n,o,l*c)}},{key:"showDelayedElements",value:function(){this.w.globals.delayedElements.forEach((function(t){var e=t.el;e.classList.remove("apexcharts-element-hidden"),e.classList.add("apexcharts-hidden-element-shown")}))}},{key:"animationCompleted",value:function(t){var e=this.w;e.globals.animationEnded||(e.globals.animationEnded=!0,this.showDelayedElements(),"function"==typeof e.config.chart.events.animationEnd&&e.config.chart.events.animationEnd(this.ctx,{el:t,w:e}))}},{key:"morphSVG",value:function(t,e,i,a,s,r,n,o){var l=this,h=this.w;s||(s=t.attr("pathFrom")),r||(r=t.attr("pathTo"));var c=function(t){return"radar"===h.config.chart.type&&(n=1),"M 0 ".concat(h.globals.gridHeight)};(!s||s.indexOf("undefined")>-1||s.indexOf("NaN")>-1)&&(s=c()),(!r.trim()||r.indexOf("undefined")>-1||r.indexOf("NaN")>-1)&&(r=c()),h.globals.shouldAnimate||(n=1),t.plot(s).animate(1,o).plot(s).animate(n,o).plot(r).after((function(){v.isNumber(i)?i===h.globals.series[h.globals.maxValsInArrayIndex].length-2&&h.globals.shouldAnimate&&l.animationCompleted(t):"none"!==a&&h.globals.shouldAnimate&&(!h.globals.comboCharts&&e===h.globals.series.length-1||h.globals.comboCharts)&&l.animationCompleted(t),l.showDelayedElements()}))}}]),t}();const w={},k=[];function A(t,e){if(Array.isArray(t))for(const i of t)A(i,e);else if("object"!=typeof t)S(Object.getOwnPropertyNames(e)),w[t]=Object.assign(w[t]||{},e);else for(const e in t)A(e,t[e])}function C(t){return w[t]||{}}function S(t){k.push(...t)}function L(t,e){let i;const a=t.length,s=[];for(i=0;iz.has(t.nodeName),R=(t,e,i={})=>{const a={...e};for(const t in a)a[t].valueOf()===i[t]&&delete a[t];Object.keys(a).length?t.node.setAttribute("data-svgjs",JSON.stringify(a)):(t.node.removeAttribute("data-svgjs"),t.node.removeAttribute("svgjs:data"))},E="http://www.w3.org/2000/svg",Y="http://www.w3.org/2000/xmlns/",H="http://www.w3.org/1999/xlink",O={window:"undefined"==typeof window?null:window,document:"undefined"==typeof document?null:document};function F(){return O.window}let D=class{};const _={},N="___SYMBOL___ROOT___";function W(t,e=E){return O.document.createElementNS(e,t)}function B(t,e=!1){if(t instanceof D)return t;if("object"==typeof t)return U(t);if(null==t)return new _[N];if("string"==typeof t&&"<"!==t.charAt(0))return U(O.document.querySelector(t));const i=e?O.document.createElement("div"):W("svg");return i.innerHTML=t,t=U(i.firstChild),i.removeChild(i.firstChild),t}function G(t,e){return e&&(e instanceof O.window.Node||e.ownerDocument&&e instanceof e.ownerDocument.defaultView.Node)?e:W(t)}function V(t){if(!t)return null;if(t.instance instanceof D)return t.instance;if("#document-fragment"===t.nodeName)return new _.Fragment(t);let e=P(t.nodeName||"Dom");return"LinearGradient"===e||"RadialGradient"===e?e="Gradient":_[e]||(e="Dom"),new _[e](t)}let U=V;function q(t,e=t.name,i=!1){return _[e]=t,i&&(_[N]=t),S(Object.getOwnPropertyNames(t.prototype)),t}let Z=1e3;function $(t){return"Svgjs"+P(t)+Z++}function J(t){for(let e=t.children.length-1;e>=0;e--)J(t.children[e]);return t.id?(t.id=$(t.nodeName),t):t}function Q(t,e){let i,a;for(a=(t=Array.isArray(t)?t:[t]).length-1;a>=0;a--)for(i in e)t[a].prototype[i]=e[i]}function K(t){return function(...e){const i=e[e.length-1];return!i||i.constructor!==Object||i instanceof Array?t.apply(this,e):t.apply(this,e.slice(0,-1)).attr(i)}}A("Dom",{siblings:function(){return this.parent().children()},position:function(){return this.parent().index(this)},next:function(){return this.siblings()[this.position()+1]},prev:function(){return this.siblings()[this.position()-1]},forward:function(){const t=this.position();return this.parent().add(this.remove(),t+1),this},backward:function(){const t=this.position();return this.parent().add(this.remove(),t?t-1:0),this},front:function(){return this.parent().add(this.remove()),this},back:function(){return this.parent().add(this.remove(),0),this},before:function(t){(t=B(t)).remove();const e=this.position();return this.parent().add(t,e),this},after:function(t){(t=B(t)).remove();const e=this.position();return this.parent().add(t,e+1),this},insertBefore:function(t){return(t=B(t)).before(this),this},insertAfter:function(t){return(t=B(t)).after(this),this}});const tt=/^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i,et=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,it=/rgb\((\d+),(\d+),(\d+)\)/,at=/(#[a-z_][a-z0-9\-_]*)/i,st=/\)\s*,?\s*/,rt=/\s/g,nt=/^#[a-f0-9]{3}$|^#[a-f0-9]{6}$/i,ot=/^rgb\(/,lt=/^(\s+)?$/,ht=/^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ct=/\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i,dt=/[\s,]+/,ut=/[MLHVCSQTAZ]/i;function gt(t){const e=Math.round(t),i=Math.max(0,Math.min(255,e)).toString(16);return 1===i.length?"0"+i:i}function pt(t,e){for(let i=e.length;i--;)if(null==t[e[i]])return!1;return!0}function ft(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}A("Dom",{classes:function(){const t=this.attr("class");return null==t?[]:t.trim().split(dt)},hasClass:function(t){return-1!==this.classes().indexOf(t)},addClass:function(t){if(!this.hasClass(t)){const e=this.classes();e.push(t),this.attr("class",e.join(" "))}return this},removeClass:function(t){return this.hasClass(t)&&this.attr("class",this.classes().filter((function(e){return e!==t})).join(" ")),this},toggleClass:function(t){return this.hasClass(t)?this.removeClass(t):this.addClass(t)}}),A("Dom",{css:function(t,e){const i={};if(0===arguments.length)return this.node.style.cssText.split(/\s*;\s*/).filter((function(t){return!!t.length})).forEach((function(t){const e=t.split(/\s*:\s*/);i[e[0]]=e[1]})),i;if(arguments.length<2){if(Array.isArray(t)){for(const e of t){const t=e;i[e]=this.node.style.getPropertyValue(t)}return i}if("string"==typeof t)return this.node.style.getPropertyValue(t);if("object"==typeof t)for(const e in t)this.node.style.setProperty(e,null==t[e]||lt.test(t[e])?"":t[e])}return 2===arguments.length&&this.node.style.setProperty(t,null==e||lt.test(e)?"":e),this},show:function(){return this.css("display","")},hide:function(){return this.css("display","none")},visible:function(){return"none"!==this.css("display")}}),A("Dom",{data:function(t,e,i){if(null==t)return this.data(L(function(t,e){let i;const a=t.length,s=[];for(i=0;i0===t.nodeName.indexOf("data-"))),(t=>t.nodeName.slice(5))));if(t instanceof Array){const e={};for(const i of t)e[i]=this.data(i);return e}if("object"==typeof t)for(e in t)this.data(e,t[e]);else if(arguments.length<2)try{return JSON.parse(this.attr("data-"+t))}catch(e){return this.attr("data-"+t)}else this.attr("data-"+t,null===e?null:!0===i||"string"==typeof e||"number"==typeof e?e:JSON.stringify(e));return this}}),A("Dom",{remember:function(t,e){if("object"==typeof arguments[0])for(const e in t)this.remember(e,t[e]);else{if(1===arguments.length)return this.memory()[t];this.memory()[t]=e}return this},forget:function(){if(0===arguments.length)this._memory={};else for(let t=arguments.length-1;t>=0;t--)delete this.memory()[arguments[t]];return this},memory:function(){return this._memory=this._memory||{}}});class xt{constructor(...t){this.init(...t)}static isColor(t){return t&&(t instanceof xt||this.isRgb(t)||this.test(t))}static isRgb(t){return t&&"number"==typeof t.r&&"number"==typeof t.g&&"number"==typeof t.b}static random(t="vibrant",e){const{random:i,round:a,sin:s,PI:r}=Math;if("vibrant"===t){const t=24*i()+57,e=38*i()+45,a=360*i();return new xt(t,e,a,"lch")}if("sine"===t){const t=a(80*s(2*r*(e=null==e?i():e)/.5+.01)+150),n=a(50*s(2*r*e/.5+4.6)+200),o=a(100*s(2*r*e/.5+2.3)+150);return new xt(t,n,o)}if("pastel"===t){const t=8*i()+86,e=17*i()+9,a=360*i();return new xt(t,e,a,"lch")}if("dark"===t){const t=10+10*i(),e=50*i()+86,a=360*i();return new xt(t,e,a,"lch")}if("rgb"===t){const t=255*i(),e=255*i(),a=255*i();return new xt(t,e,a)}if("lab"===t){const t=100*i(),e=256*i()-128,a=256*i()-128;return new xt(t,e,a,"lab")}if("grey"===t){const t=255*i();return new xt(t,t,t)}throw new Error("Unsupported random color mode")}static test(t){return"string"==typeof t&&(nt.test(t)||ot.test(t))}cmyk(){const{_a:t,_b:e,_c:i}=this.rgb(),[a,s,r]=[t,e,i].map((t=>t/255)),n=Math.min(1-a,1-s,1-r);if(1===n)return new xt(0,0,0,1,"cmyk");return new xt((1-a-n)/(1-n),(1-s-n)/(1-n),(1-r-n)/(1-n),n,"cmyk")}hsl(){const{_a:t,_b:e,_c:i}=this.rgb(),[a,s,r]=[t,e,i].map((t=>t/255)),n=Math.max(a,s,r),o=Math.min(a,s,r),l=(n+o)/2,h=n===o,c=n-o;return new xt(360*(h?0:n===a?((s-r)/c+(s.5?c/(2-n-o):c/(n+o)),100*l,"hsl")}init(t=0,e=0,i=0,a=0,s="rgb"){if(t=t||0,this.space)for(const t in this.space)delete this[this.space[t]];if("number"==typeof t)s="string"==typeof a?a:s,a="string"==typeof a?0:a,Object.assign(this,{_a:t,_b:e,_c:i,_d:a,space:s});else if(t instanceof Array)this.space=e||("string"==typeof t[3]?t[3]:t[4])||"rgb",Object.assign(this,{_a:t[0],_b:t[1],_c:t[2],_d:t[3]||0});else if(t instanceof Object){const i=function(t,e){const i=pt(t,"rgb")?{_a:t.r,_b:t.g,_c:t.b,_d:0,space:"rgb"}:pt(t,"xyz")?{_a:t.x,_b:t.y,_c:t.z,_d:0,space:"xyz"}:pt(t,"hsl")?{_a:t.h,_b:t.s,_c:t.l,_d:0,space:"hsl"}:pt(t,"lab")?{_a:t.l,_b:t.a,_c:t.b,_d:0,space:"lab"}:pt(t,"lch")?{_a:t.l,_b:t.c,_c:t.h,_d:0,space:"lch"}:pt(t,"cmyk")?{_a:t.c,_b:t.m,_c:t.y,_d:t.k,space:"cmyk"}:{_a:0,_b:0,_c:0,space:"rgb"};return i.space=e||i.space,i}(t,e);Object.assign(this,i)}else if("string"==typeof t)if(ot.test(t)){const e=t.replace(rt,""),[i,a,s]=it.exec(e).slice(1,4).map((t=>parseInt(t)));Object.assign(this,{_a:i,_b:a,_c:s,_d:0,space:"rgb"})}else{if(!nt.test(t))throw Error("Unsupported string format, can't construct Color");{const e=t=>parseInt(t,16),[,i,a,s]=et.exec(function(t){return 4===t.length?["#",t.substring(1,2),t.substring(1,2),t.substring(2,3),t.substring(2,3),t.substring(3,4),t.substring(3,4)].join(""):t}(t)).map(e);Object.assign(this,{_a:i,_b:a,_c:s,_d:0,space:"rgb"})}}const{_a:r,_b:n,_c:o,_d:l}=this,h="rgb"===this.space?{r:r,g:n,b:o}:"xyz"===this.space?{x:r,y:n,z:o}:"hsl"===this.space?{h:r,s:n,l:o}:"lab"===this.space?{l:r,a:n,b:o}:"lch"===this.space?{l:r,c:n,h:o}:"cmyk"===this.space?{c:r,m:n,y:o,k:l}:{};Object.assign(this,h)}lab(){const{x:t,y:e,z:i}=this.xyz();return new xt(116*e-16,500*(t-e),200*(e-i),"lab")}lch(){const{l:t,a:e,b:i}=this.lab(),a=Math.sqrt(e**2+i**2);let s=180*Math.atan2(i,e)/Math.PI;s<0&&(s*=-1,s=360-s);return new xt(t,a,s,"lch")}rgb(){if("rgb"===this.space)return this;if("lab"===(t=this.space)||"xyz"===t||"lch"===t){let{x:t,y:e,z:i}=this;if("lab"===this.space||"lch"===this.space){let{l:a,a:s,b:r}=this;if("lch"===this.space){const{c:t,h:e}=this,i=Math.PI/180;s=t*Math.cos(i*e),r=t*Math.sin(i*e)}const n=(a+16)/116,o=s/500+n,l=n-r/200,h=16/116,c=.008856,d=7.787;t=.95047*(o**3>c?o**3:(o-h)/d),e=1*(n**3>c?n**3:(n-h)/d),i=1.08883*(l**3>c?l**3:(l-h)/d)}const a=3.2406*t+-1.5372*e+-.4986*i,s=-.9689*t+1.8758*e+.0415*i,r=.0557*t+-.204*e+1.057*i,n=Math.pow,o=.0031308,l=a>o?1.055*n(a,1/2.4)-.055:12.92*a,h=s>o?1.055*n(s,1/2.4)-.055:12.92*s,c=r>o?1.055*n(r,1/2.4)-.055:12.92*r;return new xt(255*l,255*h,255*c)}if("hsl"===this.space){let{h:t,s:e,l:i}=this;if(t/=360,e/=100,i/=100,0===e){i*=255;return new xt(i,i,i)}const a=i<.5?i*(1+e):i+e-i*e,s=2*i-a,r=255*ft(s,a,t+1/3),n=255*ft(s,a,t),o=255*ft(s,a,t-1/3);return new xt(r,n,o)}if("cmyk"===this.space){const{c:t,m:e,y:i,k:a}=this,s=255*(1-Math.min(1,t*(1-a)+a)),r=255*(1-Math.min(1,e*(1-a)+a)),n=255*(1-Math.min(1,i*(1-a)+a));return new xt(s,r,n)}return this;var t}toArray(){const{_a:t,_b:e,_c:i,_d:a,space:s}=this;return[t,e,i,a,s]}toHex(){const[t,e,i]=this._clamped().map(gt);return`#${t}${e}${i}`}toRgb(){const[t,e,i]=this._clamped();return`rgb(${t},${e},${i})`}toString(){return this.toHex()}xyz(){const{_a:t,_b:e,_c:i}=this.rgb(),[a,s,r]=[t,e,i].map((t=>t/255)),n=a>.04045?Math.pow((a+.055)/1.055,2.4):a/12.92,o=s>.04045?Math.pow((s+.055)/1.055,2.4):s/12.92,l=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92,h=(.4124*n+.3576*o+.1805*l)/.95047,c=(.2126*n+.7152*o+.0722*l)/1,d=(.0193*n+.1192*o+.9505*l)/1.08883,u=h>.008856?Math.pow(h,1/3):7.787*h+16/116,g=c>.008856?Math.pow(c,1/3):7.787*c+16/116,p=d>.008856?Math.pow(d,1/3):7.787*d+16/116;return new xt(u,g,p,"xyz")}_clamped(){const{_a:t,_b:e,_c:i}=this.rgb(),{max:a,min:s,round:r}=Math;return[t,e,i].map((t=>a(0,s(r(t),255))))}}class bt{constructor(...t){this.init(...t)}clone(){return new bt(this)}init(t,e){const i=0,a=0,s=Array.isArray(t)?{x:t[0],y:t[1]}:"object"==typeof t?{x:t.x,y:t.y}:{x:t,y:e};return this.x=null==s.x?i:s.x,this.y=null==s.y?a:s.y,this}toArray(){return[this.x,this.y]}transform(t){return this.clone().transformO(t)}transformO(t){vt.isMatrixLike(t)||(t=new vt(t));const{x:e,y:i}=this;return this.x=t.a*e+t.c*i+t.e,this.y=t.b*e+t.d*i+t.f,this}}function mt(t,e,i){return Math.abs(e-t)<(i||1e-6)}class vt{constructor(...t){this.init(...t)}static formatTransforms(t){const e="both"===t.flip||!0===t.flip,i=t.flip&&(e||"x"===t.flip)?-1:1,a=t.flip&&(e||"y"===t.flip)?-1:1,s=t.skew&&t.skew.length?t.skew[0]:isFinite(t.skew)?t.skew:isFinite(t.skewX)?t.skewX:0,r=t.skew&&t.skew.length?t.skew[1]:isFinite(t.skew)?t.skew:isFinite(t.skewY)?t.skewY:0,n=t.scale&&t.scale.length?t.scale[0]*i:isFinite(t.scale)?t.scale*i:isFinite(t.scaleX)?t.scaleX*i:i,o=t.scale&&t.scale.length?t.scale[1]*a:isFinite(t.scale)?t.scale*a:isFinite(t.scaleY)?t.scaleY*a:a,l=t.shear||0,h=t.rotate||t.theta||0,c=new bt(t.origin||t.around||t.ox||t.originX,t.oy||t.originY),d=c.x,u=c.y,g=new bt(t.position||t.px||t.positionX||NaN,t.py||t.positionY||NaN),p=g.x,f=g.y,x=new bt(t.translate||t.tx||t.translateX,t.ty||t.translateY),b=x.x,m=x.y,v=new bt(t.relative||t.rx||t.relativeX,t.ry||t.relativeY);return{scaleX:n,scaleY:o,skewX:s,skewY:r,shear:l,theta:h,rx:v.x,ry:v.y,tx:b,ty:m,ox:d,oy:u,px:p,py:f}}static fromArray(t){return{a:t[0],b:t[1],c:t[2],d:t[3],e:t[4],f:t[5]}}static isMatrixLike(t){return null!=t.a||null!=t.b||null!=t.c||null!=t.d||null!=t.e||null!=t.f}static matrixMultiply(t,e,i){const a=t.a*e.a+t.c*e.b,s=t.b*e.a+t.d*e.b,r=t.a*e.c+t.c*e.d,n=t.b*e.c+t.d*e.d,o=t.e+t.a*e.e+t.c*e.f,l=t.f+t.b*e.e+t.d*e.f;return i.a=a,i.b=s,i.c=r,i.d=n,i.e=o,i.f=l,i}around(t,e,i){return this.clone().aroundO(t,e,i)}aroundO(t,e,i){const a=t||0,s=e||0;return this.translateO(-a,-s).lmultiplyO(i).translateO(a,s)}clone(){return new vt(this)}decompose(t=0,e=0){const i=this.a,a=this.b,s=this.c,r=this.d,n=this.e,o=this.f,l=i*r-a*s,h=l>0?1:-1,c=h*Math.sqrt(i*i+a*a),d=Math.atan2(h*a,h*i),u=180/Math.PI*d,g=Math.cos(d),p=Math.sin(d),f=(i*s+a*r)/l,x=s*c/(f*i-a)||r*c/(f*a+i);return{scaleX:c,scaleY:x,shear:f,rotate:u,translateX:n-t+t*g*c+e*(f*g*c-p*x),translateY:o-e+t*p*c+e*(f*p*c+g*x),originX:t,originY:e,a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}equals(t){if(t===this)return!0;const e=new vt(t);return mt(this.a,e.a)&&mt(this.b,e.b)&&mt(this.c,e.c)&&mt(this.d,e.d)&&mt(this.e,e.e)&&mt(this.f,e.f)}flip(t,e){return this.clone().flipO(t,e)}flipO(t,e){return"x"===t?this.scaleO(-1,1,e,0):"y"===t?this.scaleO(1,-1,0,e):this.scaleO(-1,-1,t,e||t)}init(t){const e=vt.fromArray([1,0,0,1,0,0]);return t=t instanceof Gt?t.matrixify():"string"==typeof t?vt.fromArray(t.split(dt).map(parseFloat)):Array.isArray(t)?vt.fromArray(t):"object"==typeof t&&vt.isMatrixLike(t)?t:"object"==typeof t?(new vt).transform(t):6===arguments.length?vt.fromArray([].slice.call(arguments)):e,this.a=null!=t.a?t.a:e.a,this.b=null!=t.b?t.b:e.b,this.c=null!=t.c?t.c:e.c,this.d=null!=t.d?t.d:e.d,this.e=null!=t.e?t.e:e.e,this.f=null!=t.f?t.f:e.f,this}inverse(){return this.clone().inverseO()}inverseO(){const t=this.a,e=this.b,i=this.c,a=this.d,s=this.e,r=this.f,n=t*a-e*i;if(!n)throw new Error("Cannot invert "+this);const o=a/n,l=-e/n,h=-i/n,c=t/n,d=-(o*s+h*r),u=-(l*s+c*r);return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}lmultiply(t){return this.clone().lmultiplyO(t)}lmultiplyO(t){const e=t instanceof vt?t:new vt(t);return vt.matrixMultiply(e,this,this)}multiply(t){return this.clone().multiplyO(t)}multiplyO(t){const e=t instanceof vt?t:new vt(t);return vt.matrixMultiply(this,e,this)}rotate(t,e,i){return this.clone().rotateO(t,e,i)}rotateO(t,e=0,i=0){t=M(t);const a=Math.cos(t),s=Math.sin(t),{a:r,b:n,c:o,d:l,e:h,f:c}=this;return this.a=r*a-n*s,this.b=n*a+r*s,this.c=o*a-l*s,this.d=l*a+o*s,this.e=h*a-c*s+i*s-e*a+e,this.f=c*a+h*s-e*s-i*a+i,this}scale(){return this.clone().scaleO(...arguments)}scaleO(t,e=t,i=0,a=0){3===arguments.length&&(a=i,i=e,e=t);const{a:s,b:r,c:n,d:o,e:l,f:h}=this;return this.a=s*t,this.b=r*e,this.c=n*t,this.d=o*e,this.e=l*t-i*t+i,this.f=h*e-a*e+a,this}shear(t,e,i){return this.clone().shearO(t,e,i)}shearO(t,e=0,i=0){const{a:a,b:s,c:r,d:n,e:o,f:l}=this;return this.a=a+s*t,this.c=r+n*t,this.e=o+l*t-i*t,this}skew(){return this.clone().skewO(...arguments)}skewO(t,e=t,i=0,a=0){3===arguments.length&&(a=i,i=e,e=t),t=M(t),e=M(e);const s=Math.tan(t),r=Math.tan(e),{a:n,b:o,c:l,d:h,e:c,f:d}=this;return this.a=n+o*s,this.b=o+n*r,this.c=l+h*s,this.d=h+l*r,this.e=c+d*s-a*s,this.f=d+c*r-i*r,this}skewX(t,e,i){return this.skew(t,0,e,i)}skewY(t,e,i){return this.skew(0,t,e,i)}toArray(){return[this.a,this.b,this.c,this.d,this.e,this.f]}toString(){return"matrix("+this.a+","+this.b+","+this.c+","+this.d+","+this.e+","+this.f+")"}transform(t){if(vt.isMatrixLike(t)){return new vt(t).multiplyO(this)}const e=vt.formatTransforms(t),{x:i,y:a}=new bt(e.ox,e.oy).transform(this),s=(new vt).translateO(e.rx,e.ry).lmultiplyO(this).translateO(-i,-a).scaleO(e.scaleX,e.scaleY).skewO(e.skewX,e.skewY).shearO(e.shear).rotateO(e.theta).translateO(i,a);if(isFinite(e.px)||isFinite(e.py)){const t=new bt(i,a).transform(s),r=isFinite(e.px)?e.px-t.x:0,n=isFinite(e.py)?e.py-t.y:0;s.translateO(r,n)}return s.translateO(e.tx,e.ty),s}translate(t,e){return this.clone().translateO(t,e)}translateO(t,e){return this.e+=t||0,this.f+=e||0,this}valueOf(){return{a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}}function yt(){if(!yt.nodes){const t=B().size(2,0);t.node.style.cssText=["opacity: 0","position: absolute","left: -100%","top: -100%","overflow: hidden"].join(";"),t.attr("focusable","false"),t.attr("aria-hidden","true");const e=t.path().node;yt.nodes={svg:t,path:e}}if(!yt.nodes.svg.node.parentNode){const t=O.document.body||O.document.documentElement;yt.nodes.svg.addTo(t)}return yt.nodes}function wt(t){return!(t.width||t.height||t.x||t.y)}q(vt,"Matrix");class kt{constructor(...t){this.init(...t)}addOffset(){return this.x+=O.window.pageXOffset,this.y+=O.window.pageYOffset,new kt(this)}init(t){return t="string"==typeof t?t.split(dt).map(parseFloat):Array.isArray(t)?t:"object"==typeof t?[null!=t.left?t.left:t.x,null!=t.top?t.top:t.y,t.width,t.height]:4===arguments.length?[].slice.call(arguments):[0,0,0,0],this.x=t[0]||0,this.y=t[1]||0,this.width=this.w=t[2]||0,this.height=this.h=t[3]||0,this.x2=this.x+this.w,this.y2=this.y+this.h,this.cx=this.x+this.w/2,this.cy=this.y+this.h/2,this}isNulled(){return wt(this)}merge(t){const e=Math.min(this.x,t.x),i=Math.min(this.y,t.y),a=Math.max(this.x+this.width,t.x+t.width)-e,s=Math.max(this.y+this.height,t.y+t.height)-i;return new kt(e,i,a,s)}toArray(){return[this.x,this.y,this.width,this.height]}toString(){return this.x+" "+this.y+" "+this.width+" "+this.height}transform(t){t instanceof vt||(t=new vt(t));let e=1/0,i=-1/0,a=1/0,s=-1/0;return[new bt(this.x,this.y),new bt(this.x2,this.y),new bt(this.x,this.y2),new bt(this.x2,this.y2)].forEach((function(r){r=r.transform(t),e=Math.min(e,r.x),i=Math.max(i,r.x),a=Math.min(a,r.y),s=Math.max(s,r.y)})),new kt(e,a,i-e,s-a)}}function At(t,e,i){let a;try{if(a=e(t.node),wt(a)&&((s=t.node)!==O.document&&!(O.document.documentElement.contains||function(t){for(;t.parentNode;)t=t.parentNode;return t===O.document}).call(O.document.documentElement,s)))throw new Error("Element not in the dom")}catch(e){a=i(t)}var s;return a}A({viewbox:{viewbox(t,e,i,a){return null==t?new kt(this.attr("viewBox")):this.attr("viewBox",new kt(t,e,i,a))},zoom(t,e){let{width:i,height:a}=this.attr(["width","height"]);if((i||a)&&"string"!=typeof i&&"string"!=typeof a||(i=this.node.clientWidth,a=this.node.clientHeight),!i||!a)throw new Error("Impossible to get absolute width and height. Please provide an absolute width and height attribute on the zooming element");const s=this.viewbox(),r=i/s.width,n=a/s.height,o=Math.min(r,n);if(null==t)return o;let l=o/t;l===1/0&&(l=Number.MAX_SAFE_INTEGER/100),e=e||new bt(i/2/r+s.x,a/2/n+s.y);const h=new kt(s).transform(new vt({scale:l,origin:e}));return this.viewbox(h)}}}),q(kt,"Box");class Ct extends Array{constructor(t=[],...e){if(super(t,...e),"number"==typeof t)return this;this.length=0,this.push(...t)}}Q([Ct],{each(t,...e){return"function"==typeof t?this.map(((e,i,a)=>t.call(e,e,i,a))):this.map((i=>i[t](...e)))},toArray(){return Array.prototype.concat.apply([],this)}});const St=["toArray","constructor","each"];function Lt(t,e){return new Ct(L((e||O.document).querySelectorAll(t),(function(t){return V(t)})))}Ct.extend=function(t){t=t.reduce(((t,e)=>(St.includes(e)||"_"===e[0]||(e in Array.prototype&&(t["$"+e]=Array.prototype[e]),t[e]=function(...t){return this.each(e,...t)}),t)),{}),Q([Ct],t)};let Mt=0;const Pt={};function It(t){let e=t.getEventHolder();return e===O.window&&(e=Pt),e.events||(e.events={}),e.events}function Tt(t){return t.getEventTarget()}function zt(t,e,i,a,s){const r=i.bind(a||t),n=B(t),o=It(n),l=Tt(n);e=Array.isArray(e)?e:e.split(dt),i._svgjsListenerId||(i._svgjsListenerId=++Mt),e.forEach((function(t){const e=t.split(".")[0],a=t.split(".")[1]||"*";o[e]=o[e]||{},o[e][a]=o[e][a]||{},o[e][a][i._svgjsListenerId]=r,l.addEventListener(e,r,s||!1)}))}function Xt(t,e,i,a){const s=B(t),r=It(s),n=Tt(s);("function"!=typeof i||(i=i._svgjsListenerId))&&(e=Array.isArray(e)?e:(e||"").split(dt)).forEach((function(t){const e=t&&t.split(".")[0],o=t&&t.split(".")[1];let l,h;if(i)r[e]&&r[e][o||"*"]&&(n.removeEventListener(e,r[e][o||"*"][i],a||!1),delete r[e][o||"*"][i]);else if(e&&o){if(r[e]&&r[e][o]){for(h in r[e][o])Xt(n,[e,o].join("."),h);delete r[e][o]}}else if(o)for(t in r)for(l in r[t])o===l&&Xt(n,[t,o].join("."));else if(e){if(r[e]){for(l in r[e])Xt(n,[e,l].join("."));delete r[e]}}else{for(t in r)Xt(n,t);!function(t){let e=t.getEventHolder();e===O.window&&(e=Pt),e.events&&(e.events={})}(s)}}))}class Rt extends D{addEventListener(){}dispatch(t,e,i){return function(t,e,i,a){const s=Tt(t);return e instanceof O.window.Event||(e=new O.window.CustomEvent(e,{detail:i,cancelable:!0,...a})),s.dispatchEvent(e),e}(this,t,e,i)}dispatchEvent(t){const e=this.getEventHolder().events;if(!e)return!0;const i=e[t.type];for(const e in i)for(const a in i[e])i[e][a](t);return!t.defaultPrevented}fire(t,e,i){return this.dispatch(t,e,i),this}getEventHolder(){return this}getEventTarget(){return this}off(t,e,i){return Xt(this,t,e,i),this}on(t,e,i,a){return zt(this,t,e,i,a),this}removeEventListener(){}}function Et(){}q(Rt,"EventTarget");const Yt=400,Ht=">",Ot=0,Ft={"fill-opacity":1,"stroke-opacity":1,"stroke-width":0,"stroke-linejoin":"miter","stroke-linecap":"butt",fill:"#000000",stroke:"#000000",opacity:1,x:0,y:0,cx:0,cy:0,width:0,height:0,r:0,rx:0,ry:0,offset:0,"stop-opacity":1,"stop-color":"#000000","text-anchor":"start"};class Dt extends Array{constructor(...t){super(...t),this.init(...t)}clone(){return new this.constructor(this)}init(t){return"number"==typeof t||(this.length=0,this.push(...this.parse(t))),this}parse(t=[]){return t instanceof Array?t:t.trim().split(dt).map(parseFloat)}toArray(){return Array.prototype.concat.apply([],this)}toSet(){return new Set(this)}toString(){return this.join(" ")}valueOf(){const t=[];return t.push(...this),t}}class _t{constructor(...t){this.init(...t)}convert(t){return new _t(this.value,t)}divide(t){return t=new _t(t),new _t(this/t,this.unit||t.unit)}init(t,e){return e=Array.isArray(t)?t[1]:e,t=Array.isArray(t)?t[0]:t,this.value=0,this.unit=e||"","number"==typeof t?this.value=isNaN(t)?0:isFinite(t)?t:t<0?-34e37:34e37:"string"==typeof t?(e=t.match(tt))&&(this.value=parseFloat(e[1]),"%"===e[5]?this.value/=100:"s"===e[5]&&(this.value*=1e3),this.unit=e[5]):t instanceof _t&&(this.value=t.valueOf(),this.unit=t.unit),this}minus(t){return t=new _t(t),new _t(this-t,this.unit||t.unit)}plus(t){return t=new _t(t),new _t(this+t,this.unit||t.unit)}times(t){return t=new _t(t),new _t(this*t,this.unit||t.unit)}toArray(){return[this.value,this.unit]}toJSON(){return this.toString()}toString(){return("%"===this.unit?~~(1e8*this.value)/1e6:"s"===this.unit?this.value/1e3:this.value)+this.unit}valueOf(){return this.value}}const Nt=new Set(["fill","stroke","color","bgcolor","stop-color","flood-color","lighting-color"]),Wt=[];class Bt extends Rt{constructor(t,e){super(),this.node=t,this.type=t.nodeName,e&&t!==e&&this.attr(e)}add(t,e){return(t=B(t)).removeNamespace&&this.node instanceof O.window.SVGElement&&t.removeNamespace(),null==e?this.node.appendChild(t.node):t.node!==this.node.childNodes[e]&&this.node.insertBefore(t.node,this.node.childNodes[e]),this}addTo(t,e){return B(t).put(this,e)}children(){return new Ct(L(this.node.children,(function(t){return V(t)})))}clear(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return this}clone(t=!0,e=!0){this.writeDataToDom();let i=this.node.cloneNode(t);return e&&(i=J(i)),new this.constructor(i)}each(t,e){const i=this.children();let a,s;for(a=0,s=i.length;a=0}html(t,e){return this.xml(t,e,"http://www.w3.org/1999/xhtml")}id(t){return void 0!==t||this.node.id||(this.node.id=$(this.type)),this.attr("id",t)}index(t){return[].slice.call(this.node.childNodes).indexOf(t.node)}last(){return V(this.node.lastChild)}matches(t){const e=this.node,i=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector||null;return i&&i.call(e,t)}parent(t){let e=this;if(!e.node.parentNode)return null;if(e=V(e.node.parentNode),!t)return e;do{if("string"==typeof t?e.matches(t):e instanceof t)return e}while(e=V(e.node.parentNode));return e}put(t,e){return t=B(t),this.add(t,e),t}putIn(t,e){return B(t).add(this,e)}remove(){return this.parent()&&this.parent().removeElement(this),this}removeElement(t){return this.node.removeChild(t.node),this}replace(t){return t=B(t),this.node.parentNode&&this.node.parentNode.replaceChild(t.node,this.node),t}round(t=2,e=null){const i=10**t,a=this.attr(e);for(const t in a)"number"==typeof a[t]&&(a[t]=Math.round(a[t]*i)/i);return this.attr(a),this}svg(t,e){return this.xml(t,e,E)}toString(){return this.id()}words(t){return this.node.textContent=t,this}wrap(t){const e=this.parent();if(!e)return this.addTo(t);const i=e.index(this);return e.put(t,i).put(this)}writeDataToDom(){return this.each((function(){this.writeDataToDom()})),this}xml(t,e,i){if("boolean"==typeof t&&(i=e,e=t,t=null),null==t||"function"==typeof t){e=null==e||e,this.writeDataToDom();let i=this;if(null!=t){if(i=V(i.node.cloneNode(!0)),e){const e=t(i);if(i=e||i,!1===e)return""}i.each((function(){const e=t(this),i=e||this;!1===e?this.remove():e&&this!==i&&this.replace(i)}),!0)}return e?i.node.outerHTML:i.node.innerHTML}e=null!=e&&e;const a=W("wrapper",i),s=O.document.createDocumentFragment();a.innerHTML=t;for(let t=a.children.length;t--;)s.appendChild(a.firstElementChild);const r=this.parent();return e?this.replace(s)&&r:this.add(s)}}Q(Bt,{attr:function(t,e,i){if(null==t){t={},e=this.node.attributes;for(const i of e)t[i.nodeName]=ht.test(i.nodeValue)?parseFloat(i.nodeValue):i.nodeValue;return t}if(t instanceof Array)return t.reduce(((t,e)=>(t[e]=this.attr(e),t)),{});if("object"==typeof t&&t.constructor===Object)for(e in t)this.attr(e,t[e]);else if(null===e)this.node.removeAttribute(t);else{if(null==e)return null==(e=this.node.getAttribute(t))?Ft[t]:ht.test(e)?parseFloat(e):e;"number"==typeof(e=Wt.reduce(((e,i)=>i(t,e,this)),e))?e=new _t(e):Nt.has(t)&&xt.isColor(e)?e=new xt(e):e.constructor===Array&&(e=new Dt(e)),"leading"===t?this.leading&&this.leading(e):"string"==typeof i?this.node.setAttributeNS(i,t,e.toString()):this.node.setAttribute(t,e.toString()),!this.rebuild||"font-size"!==t&&"x"!==t||this.rebuild()}return this},find:function(t){return Lt(t,this.node)},findOne:function(t){return V(this.node.querySelector(t))}}),q(Bt,"Dom");let Gt=class extends Bt{constructor(t,e){super(t,e),this.dom={},this.node.instance=this,(t.hasAttribute("data-svgjs")||t.hasAttribute("svgjs:data"))&&this.setData(JSON.parse(t.getAttribute("data-svgjs"))??JSON.parse(t.getAttribute("svgjs:data"))??{})}center(t,e){return this.cx(t).cy(e)}cx(t){return null==t?this.x()+this.width()/2:this.x(t-this.width()/2)}cy(t){return null==t?this.y()+this.height()/2:this.y(t-this.height()/2)}defs(){const t=this.root();return t&&t.defs()}dmove(t,e){return this.dx(t).dy(e)}dx(t=0){return this.x(new _t(t).plus(this.x()))}dy(t=0){return this.y(new _t(t).plus(this.y()))}getEventHolder(){return this}height(t){return this.attr("height",t)}move(t,e){return this.x(t).y(e)}parents(t=this.root()){const e="string"==typeof t;e||(t=B(t));const i=new Ct;let a=this;for(;(a=a.parent())&&a.node!==O.document&&"#document-fragment"!==a.nodeName&&(i.push(a),e||a.node!==t.node)&&(!e||!a.matches(t));)if(a.node===this.root().node)return null;return i}reference(t){if(!(t=this.attr(t)))return null;const e=(t+"").match(at);return e?B(e[1]):null}root(){const t=this.parent(function(t){return _[t]}(N));return t&&t.root()}setData(t){return this.dom=t,this}size(t,e){const i=I(this,t,e);return this.width(new _t(i.width)).height(new _t(i.height))}width(t){return this.attr("width",t)}writeDataToDom(){return R(this,this.dom),super.writeDataToDom()}x(t){return this.attr("x",t)}y(t){return this.attr("y",t)}};Q(Gt,{bbox:function(){const t=At(this,(t=>t.getBBox()),(t=>{try{const e=t.clone().addTo(yt().svg).show(),i=e.node.getBBox();return e.remove(),i}catch(e){throw new Error(`Getting bbox of element "${t.node.nodeName}" is not possible: ${e.toString()}`)}}));return new kt(t)},rbox:function(t){const e=At(this,(t=>t.getBoundingClientRect()),(t=>{throw new Error(`Getting rbox of element "${t.node.nodeName}" is not possible`)})),i=new kt(e);return t?i.transform(t.screenCTM().inverseO()):i.addOffset()},inside:function(t,e){const i=this.bbox();return t>i.x&&e>i.y&&t=0;i--)null!=e[jt[t][i]]&&this.attr(jt.prefix(t,jt[t][i]),e[jt[t][i]]);return this},A(["Element","Runner"],e)})),A(["Element","Runner"],{matrix:function(t,e,i,a,s,r){return null==t?new vt(this):this.attr("transform",new vt(t,e,i,a,s,r))},rotate:function(t,e,i){return this.transform({rotate:t,ox:e,oy:i},!0)},skew:function(t,e,i,a){return 1===arguments.length||3===arguments.length?this.transform({skew:t,ox:e,oy:i},!0):this.transform({skew:[t,e],ox:i,oy:a},!0)},shear:function(t,e,i){return this.transform({shear:t,ox:e,oy:i},!0)},scale:function(t,e,i,a){return 1===arguments.length||3===arguments.length?this.transform({scale:t,ox:e,oy:i},!0):this.transform({scale:[t,e],ox:i,oy:a},!0)},translate:function(t,e){return this.transform({translate:[t,e]},!0)},relative:function(t,e){return this.transform({relative:[t,e]},!0)},flip:function(t="both",e="center"){return-1==="xybothtrue".indexOf(t)&&(e=t,t="both"),this.transform({flip:t,origin:e},!0)},opacity:function(t){return this.attr("opacity",t)}}),A("radius",{radius:function(t,e=t){return"radialGradient"===(this._element||this).type?this.attr("r",new _t(t)):this.rx(t).ry(e)}}),A("Path",{length:function(){return this.node.getTotalLength()},pointAt:function(t){return new bt(this.node.getPointAtLength(t))}}),A(["Element","Runner"],{font:function(t,e){if("object"==typeof t){for(e in t)this.font(e,t[e]);return this}return"leading"===t?this.leading(e):"anchor"===t?this.attr("text-anchor",e):"size"===t||"family"===t||"weight"===t||"stretch"===t||"variant"===t||"style"===t?this.attr("font-"+t,e):this.attr(t,e)}});A("Element",["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","mouseenter","mouseleave","touchstart","touchmove","touchleave","touchend","touchcancel","contextmenu","wheel","pointerdown","pointermove","pointerup","pointerleave","pointercancel"].reduce((function(t,e){return t[e]=function(t){return null===t?this.off(e):this.on(e,t),this},t}),{})),A("Element",{untransform:function(){return this.attr("transform",null)},matrixify:function(){const t=(this.attr("transform")||"").split(st).slice(0,-1).map((function(t){const e=t.trim().split("(");return[e[0],e[1].split(dt).map((function(t){return parseFloat(t)}))]})).reverse().reduce((function(t,e){return"matrix"===e[0]?t.lmultiply(vt.fromArray(e[1])):t[e[0]].apply(t,e[1])}),new vt);return t},toParent:function(t,e){if(this===t)return this;if(X(this.node))return this.addTo(t,e);const i=this.screenCTM(),a=t.screenCTM().inverse();return this.addTo(t,e).untransform().transform(a.multiply(i)),this},toRoot:function(t){return this.toParent(this.root(),t)},transform:function(t,e){if(null==t||"string"==typeof t){const e=new vt(this).decompose();return null==t?e:e[t]}vt.isMatrixLike(t)||(t={...t,origin:T(t,this)});const i=new vt(!0===e?this:e||!1).transform(t);return this.attr("transform",i)}});class Vt extends Gt{flatten(){return this.each((function(){if(this instanceof Vt)return this.flatten().ungroup()})),this}ungroup(t=this.parent(),e=t.index(this)){return e=-1===e?t.children().length:e,this.each((function(i,a){return a[a.length-i-1].toParent(t,e)})),this.remove()}}q(Vt,"Container");class Ut extends Vt{constructor(t,e=t){super(G("defs",t),e)}flatten(){return this}ungroup(){return this}}q(Ut,"Defs");class qt extends Gt{}function Zt(t){return this.attr("rx",t)}function $t(t){return this.attr("ry",t)}function Jt(t){return null==t?this.cx()-this.rx():this.cx(t+this.rx())}function Qt(t){return null==t?this.cy()-this.ry():this.cy(t+this.ry())}function Kt(t){return this.attr("cx",t)}function te(t){return this.attr("cy",t)}function ee(t){return null==t?2*this.rx():this.rx(new _t(t).divide(2))}function ie(t){return null==t?2*this.ry():this.ry(new _t(t).divide(2))}q(qt,"Shape");var ae=Object.freeze({__proto__:null,cx:Kt,cy:te,height:ie,rx:Zt,ry:$t,width:ee,x:Jt,y:Qt});class se extends qt{constructor(t,e=t){super(G("ellipse",t),e)}size(t,e){const i=I(this,t,e);return this.rx(new _t(i.width).divide(2)).ry(new _t(i.height).divide(2))}}Q(se,ae),A("Container",{ellipse:K((function(t=0,e=t){return this.put(new se).size(t,e).move(0,0)}))}),q(se,"Ellipse");class re extends Bt{constructor(t=O.document.createDocumentFragment()){super(t)}xml(t,e,i){if("boolean"==typeof t&&(i=e,e=t,t=null),null==t||"function"==typeof t){const t=new Bt(W("wrapper",i));return t.add(this.node.cloneNode(!0)),t.xml(!1,i)}return super.xml(t,!1,i)}}function ne(t,e){return"radialGradient"===(this._element||this).type?this.attr({fx:new _t(t),fy:new _t(e)}):this.attr({x1:new _t(t),y1:new _t(e)})}function oe(t,e){return"radialGradient"===(this._element||this).type?this.attr({cx:new _t(t),cy:new _t(e)}):this.attr({x2:new _t(t),y2:new _t(e)})}q(re,"Fragment");var le=Object.freeze({__proto__:null,from:ne,to:oe});class he extends Vt{constructor(t,e){super(G(t+"Gradient","string"==typeof t?null:t),e)}attr(t,e,i){return"transform"===t&&(t="gradientTransform"),super.attr(t,e,i)}bbox(){return new kt}targets(){return Lt("svg [fill*="+this.id()+"]")}toString(){return this.url()}update(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}url(){return"url(#"+this.id()+")"}}Q(he,le),A({Container:{gradient(...t){return this.defs().gradient(...t)}},Defs:{gradient:K((function(t,e){return this.put(new he(t)).update(e)}))}}),q(he,"Gradient");class ce extends Vt{constructor(t,e=t){super(G("pattern",t),e)}attr(t,e,i){return"transform"===t&&(t="patternTransform"),super.attr(t,e,i)}bbox(){return new kt}targets(){return Lt("svg [fill*="+this.id()+"]")}toString(){return this.url()}update(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}url(){return"url(#"+this.id()+")"}}A({Container:{pattern(...t){return this.defs().pattern(...t)}},Defs:{pattern:K((function(t,e,i){return this.put(new ce).update(i).attr({x:0,y:0,width:t,height:e,patternUnits:"userSpaceOnUse"})}))}}),q(ce,"Pattern");let de=class extends qt{constructor(t,e=t){super(G("image",t),e)}load(t,e){if(!t)return this;const i=new O.window.Image;return zt(i,"load",(function(t){const a=this.parent(ce);0===this.width()&&0===this.height()&&this.size(i.width,i.height),a instanceof ce&&0===a.width()&&0===a.height()&&a.size(this.width(),this.height()),"function"==typeof e&&e.call(this,t)}),this),zt(i,"load error",(function(){Xt(i)})),this.attr("href",i.src=t,H)}};var ue;ue=function(t,e,i){return"fill"!==t&&"stroke"!==t||ct.test(e)&&(e=i.root().defs().image(e)),e instanceof de&&(e=i.root().defs().pattern(0,0,(t=>{t.add(e)}))),e},Wt.push(ue),A({Container:{image:K((function(t,e){return this.put(new de).size(0,0).load(t,e)}))}}),q(de,"Image");class ge extends Dt{bbox(){let t=-1/0,e=-1/0,i=1/0,a=1/0;return this.forEach((function(s){t=Math.max(s[0],t),e=Math.max(s[1],e),i=Math.min(s[0],i),a=Math.min(s[1],a)})),new kt(i,a,t-i,e-a)}move(t,e){const i=this.bbox();if(t-=i.x,e-=i.y,!isNaN(t)&&!isNaN(e))for(let i=this.length-1;i>=0;i--)this[i]=[this[i][0]+t,this[i][1]+e];return this}parse(t=[0,0]){const e=[];(t=t instanceof Array?Array.prototype.concat.apply([],t):t.trim().split(dt).map(parseFloat)).length%2!=0&&t.pop();for(let i=0,a=t.length;i=0;i--)a.width&&(this[i][0]=(this[i][0]-a.x)*t/a.width+a.x),a.height&&(this[i][1]=(this[i][1]-a.y)*e/a.height+a.y);return this}toLine(){return{x1:this[0][0],y1:this[0][1],x2:this[1][0],y2:this[1][1]}}toString(){const t=[];for(let e=0,i=this.length;e":function(t){return-Math.cos(t*Math.PI)/2+.5},">":function(t){return Math.sin(t*Math.PI/2)},"<":function(t){return 1-Math.cos(t*Math.PI/2)},bezier:function(t,e,i,a){return function(s){return s<0?t>0?e/t*s:i>0?a/i*s:0:s>1?i<1?(1-a)/(1-i)*s+(a-i)/(1-i):t<1?(1-e)/(1-t)*s+(e-t)/(1-t):1:3*s*(1-s)**2*e+3*s**2*(1-s)*a+s**3}},steps:function(t,e="end"){e=e.split("-").reverse()[0];let i=t;return"none"===e?--i:"both"===e&&++i,(a,s=!1)=>{let r=Math.floor(a*t);const n=a*r%1==0;return"start"!==e&&"both"!==e||++r,s&&n&&--r,a>=0&&r<0&&(r=0),a<=1&&r>i&&(r=i),r/i}}};class ye{done(){return!1}}class we extends ye{constructor(t=Ht){super(),this.ease=ve[t]||t}step(t,e,i){return"number"!=typeof t?i<1?t:e:t+(e-t)*this.ease(i)}}class ke extends ye{constructor(t){super(),this.stepper=t}done(t){return t.done}step(t,e,i,a){return this.stepper(t,e,i,a)}}function Ae(){const t=(this._duration||500)/1e3,e=this._overshoot||0,i=Math.PI,a=Math.log(e/100+1e-10),s=-a/Math.sqrt(i*i+a*a),r=3.9/(s*t);this.d=2*s*r,this.k=r*r}Q(class extends ke{constructor(t=500,e=0){super(),this.duration(t).overshoot(e)}step(t,e,i,a){if("string"==typeof t)return t;if(a.done=i===1/0,i===1/0)return e;if(0===i)return t;i>100&&(i=16),i/=1e3;const s=a.velocity||0,r=-this.d*s-this.k*(t-e),n=t+s*i+r*i*i/2;return a.velocity=s+r*i,a.done=Math.abs(e-n)+Math.abs(s)<.002,a.done?e:n}},{duration:me("_duration",Ae),overshoot:me("_overshoot",Ae)});Q(class extends ke{constructor(t=.1,e=.01,i=0,a=1e3){super(),this.p(t).i(e).d(i).windup(a)}step(t,e,i,a){if("string"==typeof t)return t;if(a.done=i===1/0,i===1/0)return e;if(0===i)return t;const s=e-t;let r=(a.integral||0)+s*i;const n=(s-(a.error||0))/i,o=this._windup;return!1!==o&&(r=Math.max(-o,Math.min(r,o))),a.error=s,a.integral=r,a.done=Math.abs(s)<.001,a.done?e:t+(this.P*s+this.I*r+this.D*n)}},{windup:me("_windup"),p:me("P"),i:me("I"),d:me("D")});const Ce={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0},Se={M:function(t,e,i){return e.x=i.x=t[0],e.y=i.y=t[1],["M",e.x,e.y]},L:function(t,e){return e.x=t[0],e.y=t[1],["L",t[0],t[1]]},H:function(t,e){return e.x=t[0],["H",t[0]]},V:function(t,e){return e.y=t[0],["V",t[0]]},C:function(t,e){return e.x=t[4],e.y=t[5],["C",t[0],t[1],t[2],t[3],t[4],t[5]]},S:function(t,e){return e.x=t[2],e.y=t[3],["S",t[0],t[1],t[2],t[3]]},Q:function(t,e){return e.x=t[2],e.y=t[3],["Q",t[0],t[1],t[2],t[3]]},T:function(t,e){return e.x=t[0],e.y=t[1],["T",t[0],t[1]]},Z:function(t,e,i){return e.x=i.x,e.y=i.y,["Z"]},A:function(t,e){return e.x=t[5],e.y=t[6],["A",t[0],t[1],t[2],t[3],t[4],t[5],t[6]]}},Le="mlhvqtcsaz".split("");for(let t=0,e=Le.length;t=0;a--)i=this[a][0],"M"===i||"L"===i||"T"===i?(this[a][1]+=t,this[a][2]+=e):"H"===i?this[a][1]+=t:"V"===i?this[a][1]+=e:"C"===i||"S"===i||"Q"===i?(this[a][1]+=t,this[a][2]+=e,this[a][3]+=t,this[a][4]+=e,"C"===i&&(this[a][5]+=t,this[a][6]+=e)):"A"===i&&(this[a][6]+=t,this[a][7]+=e);return this}parse(t="M0 0"){return Array.isArray(t)&&(t=Array.prototype.concat.apply([],t).toString()),function(t,e=!0){let i=0,a="";const s={segment:[],inNumber:!1,number:"",lastToken:"",inSegment:!1,segments:[],pointSeen:!1,hasExponent:!1,absolute:e,p0:new bt,p:new bt};for(;s.lastToken=a,a=t.charAt(i++);)if(s.inSegment||!Pe(s,a))if("."!==a)if(isNaN(parseInt(a)))if(Re.has(a))s.inNumber&&Ie(s,!1);else if("-"!==a&&"+"!==a)if("E"!==a.toUpperCase()){if(ut.test(a)){if(s.inNumber)Ie(s,!1);else{if(!Me(s))throw new Error("parser Error");Te(s)}--i}}else s.number+=a,s.hasExponent=!0;else{if(s.inNumber&&!Xe(s)){Ie(s,!1),--i;continue}s.number+=a,s.inNumber=!0}else{if("0"===s.number||ze(s)){s.inNumber=!0,s.number=a,Ie(s,!0);continue}s.inNumber=!0,s.number+=a}else{if(s.pointSeen||s.hasExponent){Ie(s,!1),--i;continue}s.inNumber=!0,s.pointSeen=!0,s.number+=a}return s.inNumber&&Ie(s,!1),s.inSegment&&Me(s)&&Te(s),s.segments}(t)}size(t,e){const i=this.bbox();let a,s;for(i.width=0===i.width?1:i.width,i.height=0===i.height?1:i.height,a=this.length-1;a>=0;a--)s=this[a][0],"M"===s||"L"===s||"T"===s?(this[a][1]=(this[a][1]-i.x)*t/i.width+i.x,this[a][2]=(this[a][2]-i.y)*e/i.height+i.y):"H"===s?this[a][1]=(this[a][1]-i.x)*t/i.width+i.x:"V"===s?this[a][1]=(this[a][1]-i.y)*e/i.height+i.y:"C"===s||"S"===s||"Q"===s?(this[a][1]=(this[a][1]-i.x)*t/i.width+i.x,this[a][2]=(this[a][2]-i.y)*e/i.height+i.y,this[a][3]=(this[a][3]-i.x)*t/i.width+i.x,this[a][4]=(this[a][4]-i.y)*e/i.height+i.y,"C"===s&&(this[a][5]=(this[a][5]-i.x)*t/i.width+i.x,this[a][6]=(this[a][6]-i.y)*e/i.height+i.y)):"A"===s&&(this[a][1]=this[a][1]*t/i.width,this[a][2]=this[a][2]*e/i.height,this[a][6]=(this[a][6]-i.x)*t/i.width+i.x,this[a][7]=(this[a][7]-i.y)*e/i.height+i.y);return this}toString(){return function(t){let e="";for(let i=0,a=t.length;i{const e=typeof t;return"number"===e?_t:"string"===e?xt.isColor(t)?xt:dt.test(t)?ut.test(t)?Ee:Dt:tt.test(t)?_t:Oe:Ne.indexOf(t.constructor)>-1?t.constructor:Array.isArray(t)?Dt:"object"===e?_e:Oe};class He{constructor(t){this._stepper=t||new we("-"),this._from=null,this._to=null,this._type=null,this._context=null,this._morphObj=null}at(t){return this._morphObj.morph(this._from,this._to,t,this._stepper,this._context)}done(){return this._context.map(this._stepper.done).reduce((function(t,e){return t&&e}),!0)}from(t){return null==t?this._from:(this._from=this._set(t),this)}stepper(t){return null==t?this._stepper:(this._stepper=t,this)}to(t){return null==t?this._to:(this._to=this._set(t),this)}type(t){return null==t?this._type:(this._type=t,this)}_set(t){this._type||this.type(Ye(t));let e=new this._type(t);return this._type===xt&&(e=this._to?e[this._to[4]]():this._from?e[this._from[4]]():e),this._type===_e&&(e=this._to?e.align(this._to):this._from?e.align(this._from):e),e=e.toConsumable(),this._morphObj=this._morphObj||new this._type,this._context=this._context||Array.apply(null,Array(e.length)).map(Object).map((function(t){return t.done=!0,t})),e}}class Oe{constructor(...t){this.init(...t)}init(t){return t=Array.isArray(t)?t[0]:t,this.value=t,this}toArray(){return[this.value]}valueOf(){return this.value}}class Fe{constructor(...t){this.init(...t)}init(t){return Array.isArray(t)&&(t={scaleX:t[0],scaleY:t[1],shear:t[2],rotate:t[3],translateX:t[4],translateY:t[5],originX:t[6],originY:t[7]}),Object.assign(this,Fe.defaults,t),this}toArray(){const t=this;return[t.scaleX,t.scaleY,t.shear,t.rotate,t.translateX,t.translateY,t.originX,t.originY]}}Fe.defaults={scaleX:1,scaleY:1,shear:0,rotate:0,translateX:0,translateY:0,originX:0,originY:0};const De=(t,e)=>t[0]e[0]?1:0;class _e{constructor(...t){this.init(...t)}align(t){const e=this.values;for(let i=0,a=e.length;it.concat(e)),[]),this}toArray(){return this.values}valueOf(){const t={},e=this.values;for(;e.length;){const i=e.shift(),a=e.shift(),s=e.shift(),r=e.splice(0,s);t[i]=new a(r)}return t}}const Ne=[Oe,Fe,_e];class We extends qt{constructor(t,e=t){super(G("path",t),e)}array(){return this._array||(this._array=new Ee(this.attr("d")))}clear(){return delete this._array,this}height(t){return null==t?this.bbox().height:this.size(this.bbox().width,t)}move(t,e){return this.attr("d",this.array().move(t,e))}plot(t){return null==t?this.array():this.clear().attr("d","string"==typeof t?t:this._array=new Ee(t))}size(t,e){const i=I(this,t,e);return this.attr("d",this.array().size(i.width,i.height))}width(t){return null==t?this.bbox().width:this.size(t,this.bbox().height)}x(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)}y(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)}}We.prototype.MorphArray=Ee,A({Container:{path:K((function(t){return this.put(new We).plot(t||new Ee)}))}}),q(We,"Path");var Be=Object.freeze({__proto__:null,array:function(){return this._array||(this._array=new ge(this.attr("points")))},clear:function(){return delete this._array,this},move:function(t,e){return this.attr("points",this.array().move(t,e))},plot:function(t){return null==t?this.array():this.clear().attr("points","string"==typeof t?t:this._array=new ge(t))},size:function(t,e){const i=I(this,t,e);return this.attr("points",this.array().size(i.width,i.height))}});class Ge extends qt{constructor(t,e=t){super(G("polygon",t),e)}}A({Container:{polygon:K((function(t){return this.put(new Ge).plot(t||new ge)}))}}),Q(Ge,fe),Q(Ge,Be),q(Ge,"Polygon");class je extends qt{constructor(t,e=t){super(G("polyline",t),e)}}A({Container:{polyline:K((function(t){return this.put(new je).plot(t||new ge)}))}}),Q(je,fe),Q(je,Be),q(je,"Polyline");class Ve extends qt{constructor(t,e=t){super(G("rect",t),e)}}Q(Ve,{rx:Zt,ry:$t}),A({Container:{rect:K((function(t,e){return this.put(new Ve).size(t,e)}))}}),q(Ve,"Rect");class Ue{constructor(){this._first=null,this._last=null}first(){return this._first&&this._first.value}last(){return this._last&&this._last.value}push(t){const e=void 0!==t.next?t:{value:t,next:null,prev:null};return this._last?(e.prev=this._last,this._last.next=e,this._last=e):(this._last=e,this._first=e),e}remove(t){t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t===this._last&&(this._last=t.prev),t===this._first&&(this._first=t.next),t.prev=null,t.next=null}shift(){const t=this._first;return t?(this._first=t.next,this._first&&(this._first.prev=null),this._last=this._first?this._last:null,t.value):null}}const qe={nextDraw:null,frames:new Ue,timeouts:new Ue,immediates:new Ue,timer:()=>O.window.performance||O.window.Date,transforms:[],frame(t){const e=qe.frames.push({run:t});return null===qe.nextDraw&&(qe.nextDraw=O.window.requestAnimationFrame(qe._draw)),e},timeout(t,e){e=e||0;const i=qe.timer().now()+e,a=qe.timeouts.push({run:t,time:i});return null===qe.nextDraw&&(qe.nextDraw=O.window.requestAnimationFrame(qe._draw)),a},immediate(t){const e=qe.immediates.push(t);return null===qe.nextDraw&&(qe.nextDraw=O.window.requestAnimationFrame(qe._draw)),e},cancelFrame(t){null!=t&&qe.frames.remove(t)},clearTimeout(t){null!=t&&qe.timeouts.remove(t)},cancelImmediate(t){null!=t&&qe.immediates.remove(t)},_draw(t){let e=null;const i=qe.timeouts.last();for(;(e=qe.timeouts.shift())&&(t>=e.time?e.run():qe.timeouts.push(e),e!==i););let a=null;const s=qe.frames.last();for(;a!==s&&(a=qe.frames.shift());)a.run(t);let r=null;for(;r=qe.immediates.shift();)r();qe.nextDraw=qe.timeouts.first()||qe.frames.first()?O.window.requestAnimationFrame(qe._draw):null}},Ze=function(t){const e=t.start,i=t.runner.duration();return{start:e,duration:i,end:e+i,runner:t.runner}},$e=function(){const t=O.window;return(t.performance||t.Date).now()};class Je extends Rt{constructor(t=$e){super(),this._timeSource=t,this.terminate()}active(){return!!this._nextFrame}finish(){return this.time(this.getEndTimeOfTimeline()+1),this.pause()}getEndTime(){const t=this.getLastRunnerInfo(),e=t?t.runner.duration():0;return(t?t.start:this._time)+e}getEndTimeOfTimeline(){const t=this._runners.map((t=>t.start+t.runner.duration()));return Math.max(0,...t)}getLastRunnerInfo(){return this.getRunnerInfoById(this._lastRunnerId)}getRunnerInfoById(t){return this._runners[this._runnerIds.indexOf(t)]||null}pause(){return this._paused=!0,this._continue()}persist(t){return null==t?this._persist:(this._persist=t,this)}play(){return this._paused=!1,this.updateTime()._continue()}reverse(t){const e=this.speed();if(null==t)return this.speed(-e);const i=Math.abs(e);return this.speed(t?-i:i)}schedule(t,e,i){if(null==t)return this._runners.map(Ze);let a=0;const s=this.getEndTime();if(e=e||0,null==i||"last"===i||"after"===i)a=s;else if("absolute"===i||"start"===i)a=e,e=0;else if("now"===i)a=this._time;else if("relative"===i){const i=this.getRunnerInfoById(t.id);i&&(a=i.start+e,e=0)}else{if("with-last"!==i)throw new Error('Invalid value for the "when" parameter');{const t=this.getLastRunnerInfo();a=t?t.start:this._time}}t.unschedule(),t.timeline(this);const r=t.persist(),n={persist:null===r?this._persist:r,start:a+e,runner:t};return this._lastRunnerId=t.id,this._runners.push(n),this._runners.sort(((t,e)=>t.start-e.start)),this._runnerIds=this._runners.map((t=>t.runner.id)),this.updateTime()._continue(),this}seek(t){return this.time(this._time+t)}source(t){return null==t?this._timeSource:(this._timeSource=t,this)}speed(t){return null==t?this._speed:(this._speed=t,this)}stop(){return this.time(0),this.pause()}time(t){return null==t?this._time:(this._time=t,this._continue(!0))}unschedule(t){const e=this._runnerIds.indexOf(t.id);return e<0||(this._runners.splice(e,1),this._runnerIds.splice(e,1),t.timeline(null)),this}updateTime(){return this.active()||(this._lastSourceTime=this._timeSource()),this}_continue(t=!1){return qe.cancelFrame(this._nextFrame),this._nextFrame=null,t?this._stepImmediate():(this._paused||(this._nextFrame=qe.frame(this._step)),this)}_stepFn(t=!1){const e=this._timeSource();let i=e-this._lastSourceTime;t&&(i=0);const a=this._speed*i+(this._time-this._lastStepTime);this._lastSourceTime=e,t||(this._time+=a,this._time=this._time<0?0:this._time),this._lastStepTime=this._time,this.fire("time",this._time);for(let t=this._runners.length;t--;){const e=this._runners[t],i=e.runner;this._time-e.start<=0&&i.reset()}let s=!1;for(let t=0,e=this._runners.length;t0?this._continue():(this.pause(),this.fire("finished")),this}terminate(){this._startTime=0,this._speed=1,this._persist=0,this._nextFrame=null,this._paused=!0,this._runners=[],this._runnerIds=[],this._lastRunnerId=-1,this._time=0,this._lastSourceTime=0,this._lastStepTime=0,this._step=this._stepFn.bind(this,!1),this._stepImmediate=this._stepFn.bind(this,!0)}}A({Element:{timeline:function(t){return null==t?(this._timeline=this._timeline||new Je,this._timeline):(this._timeline=t,this)}}});class Qe extends Rt{constructor(t){super(),this.id=Qe.id++,t="function"==typeof(t=null==t?Yt:t)?new ke(t):t,this._element=null,this._timeline=null,this.done=!1,this._queue=[],this._duration="number"==typeof t&&t,this._isDeclarative=t instanceof ke,this._stepper=this._isDeclarative?t:new we,this._history={},this.enabled=!0,this._time=0,this._lastTime=0,this._reseted=!0,this.transforms=new vt,this.transformId=1,this._haveReversed=!1,this._reverse=!1,this._loopsDone=0,this._swing=!1,this._wait=0,this._times=1,this._frameId=null,this._persist=!!this._isDeclarative||null}static sanitise(t,e,i){let a=1,s=!1,r=0;return e=e??Ot,i=i||"last","object"!=typeof(t=t??Yt)||t instanceof ye||(e=t.delay??e,i=t.when??i,s=t.swing||s,a=t.times??a,r=t.wait??r,t=t.duration??Yt),{duration:t,delay:e,swing:s,times:a,wait:r,when:i}}active(t){return null==t?this.enabled:(this.enabled=t,this)}addTransform(t){return this.transforms.lmultiplyO(t),this}after(t){return this.on("finished",t)}animate(t,e,i){const a=Qe.sanitise(t,e,i),s=new Qe(a.duration);return this._timeline&&s.timeline(this._timeline),this._element&&s.element(this._element),s.loop(a).schedule(a.delay,a.when)}clearTransform(){return this.transforms=new vt,this}clearTransformsFromQueue(){this.done&&this._timeline&&this._timeline._runnerIds.includes(this.id)||(this._queue=this._queue.filter((t=>!t.isTransform)))}delay(t){return this.animate(0,t)}duration(){return this._times*(this._wait+this._duration)-this._wait}during(t){return this.queue(null,t)}ease(t){return this._stepper=new we(t),this}element(t){return null==t?this._element:(this._element=t,t._prepareRunner(),this)}finish(){return this.step(1/0)}loop(t,e,i){return"object"==typeof t&&(e=t.swing,i=t.wait,t=t.times),this._times=t||1/0,this._swing=e||!1,this._wait=i||0,!0===this._times&&(this._times=1/0),this}loops(t){const e=this._duration+this._wait;if(null==t){const t=Math.floor(this._time/e),i=(this._time-t*e)/this._duration;return Math.min(t+i,this._times)}const i=t%1,a=e*Math.floor(t)+this._duration*i;return this.time(a)}persist(t){return null==t?this._persist:(this._persist=t,this)}position(t){const e=this._time,i=this._duration,a=this._wait,s=this._times,r=this._swing,n=this._reverse;let o;if(null==t){const t=function(t){const e=r*Math.floor(t%(2*(a+i))/(a+i)),s=e&&!n||!e&&n,o=Math.pow(-1,s)*(t%(a+i))/i+s;return Math.max(Math.min(o,1),0)},l=s*(a+i)-a;return o=e<=0?Math.round(t(1e-5)):e=0;this._lastPosition=e;const a=this.duration(),s=this._lastTime<=0&&this._time>0,r=this._lastTime=a;this._lastTime=this._time,s&&this.fire("start",this);const n=this._isDeclarative;this.done=!n&&!r&&this._time>=a,this._reseted=!1;let o=!1;return(i||n)&&(this._initialise(i),this.transforms=new vt,o=this._run(n?t:e),this.fire("step",this)),this.done=this.done||o&&n,r&&this.fire("finished",this),this}time(t){if(null==t)return this._time;const e=t-this._time;return this.step(e),this}timeline(t){return void 0===t?this._timeline:(this._timeline=t,this)}unschedule(){const t=this.timeline();return t&&t.unschedule(this),this}_initialise(t){if(t||this._isDeclarative)for(let e=0,i=this._queue.length;et.lmultiplyO(e),ei=t=>t.transforms;function ii(){const t=this._transformationRunners.runners.map(ei).reduce(ti,new vt);this.transform(t),this._transformationRunners.merge(),1===this._transformationRunners.length()&&(this._frameId=null)}class ai{constructor(){this.runners=[],this.ids=[]}add(t){if(this.runners.includes(t))return;const e=t.id+1;return this.runners.push(t),this.ids.push(e),this}clearBefore(t){const e=this.ids.indexOf(t+1)||1;return this.ids.splice(0,e,0),this.runners.splice(0,e,new Ke).forEach((t=>t.clearTransformsFromQueue())),this}edit(t,e){const i=this.ids.indexOf(t+1);return this.ids.splice(i,1,t+1),this.runners.splice(i,1,e),this}getByID(t){return this.runners[this.ids.indexOf(t+1)]}length(){return this.ids.length}merge(){let t=null;for(let e=0;ee.id<=t.id)).map(ei).reduce(ti,new vt)},_addRunner(t){this._transformationRunners.add(t),qe.cancelImmediate(this._frameId),this._frameId=qe.immediate(ii.bind(this))},_prepareRunner(){null==this._frameId&&(this._transformationRunners=(new ai).add(new Ke(new vt(this))))}}});Q(Qe,{attr(t,e){return this.styleAttr("attr",t,e)},css(t,e){return this.styleAttr("css",t,e)},styleAttr(t,e,i){if("string"==typeof e)return this.styleAttr(t,{[e]:i});let a=e;if(this._tryRetarget(t,a))return this;let s=new He(this._stepper).to(a),r=Object.keys(a);return this.queue((function(){s=s.from(this.element()[t](r))}),(function(e){return this.element()[t](s.at(e).valueOf()),s.done()}),(function(e){const i=Object.keys(e),n=(o=r,i.filter((t=>!o.includes(t))));var o;if(n.length){const e=this.element()[t](n),i=new _e(s.from()).valueOf();Object.assign(i,e),s.from(i)}const l=new _e(s.to()).valueOf();Object.assign(l,e),s.to(l),r=i,a=e})),this._rememberMorpher(t,s),this},zoom(t,e){if(this._tryRetarget("zoom",t,e))return this;let i=new He(this._stepper).to(new _t(t));return this.queue((function(){i=i.from(this.element().zoom())}),(function(t){return this.element().zoom(i.at(t),e),i.done()}),(function(t,a){e=a,i.to(t)})),this._rememberMorpher("zoom",i),this},transform(t,e,i){if(e=t.relative||e,this._isDeclarative&&!e&&this._tryRetarget("transform",t))return this;const a=vt.isMatrixLike(t);i=null!=t.affine?t.affine:null!=i?i:!a;const s=new He(this._stepper).type(i?Fe:vt);let r,n,o,l,h;return this.queue((function(){n=n||this.element(),r=r||T(t,n),h=new vt(e?void 0:n),n._addRunner(this),e||n._clearTransformRunnersBefore(this)}),(function(c){e||this.clearTransform();const{x:d,y:u}=new bt(r).transform(n._currentTransform(this));let g=new vt({...t,origin:[d,u]}),p=this._isDeclarative&&o?o:h;if(i){g=g.decompose(d,u),p=p.decompose(d,u);const t=g.rotate,e=p.rotate,i=[t-360,t,t+360],a=i.map((t=>Math.abs(t-e))),s=Math.min(...a),r=a.indexOf(s);g.rotate=i[r]}e&&(a||(g.rotate=t.rotate||0),this._isDeclarative&&l&&(p.rotate=l)),s.from(p),s.to(g);const f=s.at(c);return l=f.rotate,o=new vt(f),this.addTransform(o),n._addRunner(this),s.done()}),(function(e){(e.origin||"center").toString()!==(t.origin||"center").toString()&&(r=T(e,n)),t={...e,origin:r}}),!0),this._isDeclarative&&this._rememberMorpher("transform",s),this},x(t){return this._queueNumber("x",t)},y(t){return this._queueNumber("y",t)},ax(t){return this._queueNumber("ax",t)},ay(t){return this._queueNumber("ay",t)},dx(t=0){return this._queueNumberDelta("x",t)},dy(t=0){return this._queueNumberDelta("y",t)},dmove(t,e){return this.dx(t).dy(e)},_queueNumberDelta(t,e){if(e=new _t(e),this._tryRetarget(t,e))return this;const i=new He(this._stepper).to(e);let a=null;return this.queue((function(){a=this.element()[t](),i.from(a),i.to(a+e)}),(function(e){return this.element()[t](i.at(e)),i.done()}),(function(t){i.to(a+new _t(t))})),this._rememberMorpher(t,i),this},_queueObject(t,e){if(this._tryRetarget(t,e))return this;const i=new He(this._stepper).to(e);return this.queue((function(){i.from(this.element()[t]())}),(function(e){return this.element()[t](i.at(e)),i.done()})),this._rememberMorpher(t,i),this},_queueNumber(t,e){return this._queueObject(t,new _t(e))},cx(t){return this._queueNumber("cx",t)},cy(t){return this._queueNumber("cy",t)},move(t,e){return this.x(t).y(e)},amove(t,e){return this.ax(t).ay(e)},center(t,e){return this.cx(t).cy(e)},size(t,e){let i;return t&&e||(i=this._element.bbox()),t||(t=i.width/i.height*e),e||(e=i.height/i.width*t),this.width(t).height(e)},width(t){return this._queueNumber("width",t)},height(t){return this._queueNumber("height",t)},plot(t,e,i,a){if(4===arguments.length)return this.plot([t,e,i,a]);if(this._tryRetarget("plot",t))return this;const s=new He(this._stepper).type(this._element.MorphArray).to(t);return this.queue((function(){s.from(this._element.array())}),(function(t){return this._element.plot(s.at(t)),s.done()})),this._rememberMorpher("plot",s),this},leading(t){return this._queueNumber("leading",t)},viewbox(t,e,i,a){return this._queueObject("viewbox",new kt(t,e,i,a))},update(t){return"object"!=typeof t?this.update({offset:arguments[0],color:arguments[1],opacity:arguments[2]}):(null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",t.offset),this)}}),Q(Qe,{rx:Zt,ry:$t,from:ne,to:oe}),q(Qe,"Runner");class si extends Vt{constructor(t,e=t){super(G("svg",t),e),this.namespace()}defs(){return this.isRoot()?V(this.node.querySelector("defs"))||this.put(new Ut):this.root().defs()}isRoot(){return!this.node.parentNode||!(this.node.parentNode instanceof O.window.SVGElement)&&"#document-fragment"!==this.node.parentNode.nodeName}namespace(){return this.isRoot()?this.attr({xmlns:E,version:"1.1"}).attr("xmlns:xlink",H,Y):this.root().namespace()}removeNamespace(){return this.attr({xmlns:null,version:null}).attr("xmlns:xlink",null,Y).attr("xmlns:svgjs",null,Y)}root(){return this.isRoot()?this:super.root()}}A({Container:{nested:K((function(){return this.put(new si)}))}}),q(si,"Svg",!0);let ri=class extends Vt{constructor(t,e=t){super(G("symbol",t),e)}};A({Container:{symbol:K((function(){return this.put(new ri)}))}}),q(ri,"Symbol");var ni=Object.freeze({__proto__:null,amove:function(t,e){return this.ax(t).ay(e)},ax:function(t){return this.attr("x",t)},ay:function(t){return this.attr("y",t)},build:function(t){return this._build=!!t,this},center:function(t,e,i=this.bbox()){return this.cx(t,i).cy(e,i)},cx:function(t,e=this.bbox()){return null==t?e.cx:this.attr("x",this.attr("x")+t-e.cx)},cy:function(t,e=this.bbox()){return null==t?e.cy:this.attr("y",this.attr("y")+t-e.cy)},length:function(){return this.node.getComputedTextLength()},move:function(t,e,i=this.bbox()){return this.x(t,i).y(e,i)},plain:function(t){return!1===this._build&&this.clear(),this.node.appendChild(O.document.createTextNode(t)),this},x:function(t,e=this.bbox()){return null==t?e.x:this.attr("x",this.attr("x")+t-e.x)},y:function(t,e=this.bbox()){return null==t?e.y:this.attr("y",this.attr("y")+t-e.y)}});class oi extends qt{constructor(t,e=t){super(G("text",t),e),this.dom.leading=this.dom.leading??new _t(1.3),this._rebuild=!0,this._build=!1}leading(t){return null==t?this.dom.leading:(this.dom.leading=new _t(t),this.rebuild())}rebuild(t){if("boolean"==typeof t&&(this._rebuild=t),this._rebuild){const t=this;let e=0;const i=this.dom.leading;this.each((function(a){if(X(this.node))return;const s=O.window.getComputedStyle(this.node).getPropertyValue("font-size"),r=i*new _t(s);this.dom.newLined&&(this.attr("x",t.attr("x")),"\n"===this.text()?e+=r:(this.attr("dy",a?r+e:0),e=0))})),this.fire("rebuild")}return this}setData(t){return this.dom=t,this.dom.leading=new _t(t.leading||1.3),this}writeDataToDom(){return R(this,this.dom,{leading:1.3}),this}text(t){if(void 0===t){const e=this.node.childNodes;let i=0;t="";for(let a=0,s=e.length;a{let a;try{a=i.node instanceof F().SVGSVGElement?new kt(i.attr(["x","y","width","height"])):i.bbox()}catch(t){return}const s=new vt(i),r=s.translate(t,e).transform(s.inverse()),n=new bt(a.x,a.y).transform(r);i.move(n.x,n.y)})),this},dx:function(t){return this.dmove(t,0)},dy:function(t){return this.dmove(0,t)},height:function(t,e=this.bbox()){return null==t?e.height:this.size(e.width,t,e)},move:function(t=0,e=0,i=this.bbox()){const a=t-i.x,s=e-i.y;return this.dmove(a,s)},size:function(t,e,i=this.bbox()){const a=I(this,t,e,i),s=a.width/i.width,r=a.height/i.height;return this.children().forEach((t=>{const e=new bt(i).transform(new vt(t).inverse());t.scale(s,r,e.x,e.y)})),this},width:function(t,e=this.bbox()){return null==t?e.width:this.size(t,e.height,e)},x:function(t,e=this.bbox()){return null==t?e.x:this.move(t,e.y,e)},y:function(t,e=this.bbox()){return null==t?e.y:this.move(e.x,t,e)}});class gi extends Vt{constructor(t,e=t){super(G("g",t),e)}}Q(gi,ui),A({Container:{group:K((function(){return this.put(new gi)}))}}),q(gi,"G");class pi extends Vt{constructor(t,e=t){super(G("a",t),e)}target(t){return this.attr("target",t)}to(t){return this.attr("href",t,H)}}Q(pi,ui),A({Container:{link:K((function(t){return this.put(new pi).to(t)}))},Element:{unlink(){const t=this.linker();if(!t)return this;const e=t.parent();if(!e)return this.remove();const i=e.index(t);return e.add(this,i),t.remove(),this},linkTo(t){let e=this.linker();return e||(e=new pi,this.wrap(e)),"function"==typeof t?t.call(e,e):e.to(t),this},linker(){const t=this.parent();return t&&"a"===t.node.nodeName.toLowerCase()?t:null}}}),q(pi,"A");class fi extends Vt{constructor(t,e=t){super(G("mask",t),e)}remove(){return this.targets().forEach((function(t){t.unmask()})),super.remove()}targets(){return Lt("svg [mask*="+this.id()+"]")}}A({Container:{mask:K((function(){return this.defs().put(new fi)}))},Element:{masker(){return this.reference("mask")},maskWith(t){const e=t instanceof fi?t:this.parent().mask().add(t);return this.attr("mask","url(#"+e.id()+")")},unmask(){return this.attr("mask",null)}}}),q(fi,"Mask");class xi extends Gt{constructor(t,e=t){super(G("stop",t),e)}update(t){return("number"==typeof t||t instanceof _t)&&(t={offset:arguments[0],color:arguments[1],opacity:arguments[2]}),null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",new _t(t.offset)),this}}A({Gradient:{stop:function(t,e,i){return this.put(new xi).update(t,e,i)}}}),q(xi,"Stop");class bi extends Gt{constructor(t,e=t){super(G("style",t),e)}addText(t=""){return this.node.textContent+=t,this}font(t,e,i={}){return this.rule("@font-face",{fontFamily:t,src:e,...i})}rule(t,e){return this.addText(function(t,e){if(!t)return"";if(!e)return t;let i=t+"{";for(const t in e)i+=t.replace(/([A-Z])/g,(function(t,e){return"-"+e.toLowerCase()}))+":"+e[t]+";";return i+="}",i}(t,e))}}A("Dom",{style(t,e){return this.put(new bi).rule(t,e)},fontface(t,e,i){return this.put(new bi).font(t,e,i)}}),q(bi,"Style");class mi extends oi{constructor(t,e=t){super(G("textPath",t),e)}array(){const t=this.track();return t?t.array():null}plot(t){const e=this.track();let i=null;return e&&(i=e.plot(t)),null==t?i:this}track(){return this.reference("href")}}A({Container:{textPath:K((function(t,e){return t instanceof oi||(t=this.text(t)),t.path(e)}))},Text:{path:K((function(t,e=!0){const i=new mi;let a;if(t instanceof We||(t=this.defs().path(t)),i.attr("href","#"+t,H),e)for(;a=this.node.firstChild;)i.node.appendChild(a);return this.put(i)})),textPath(){return this.findOne("textPath")}},Path:{text:K((function(t){return t instanceof oi||(t=(new oi).addTo(this.parent()).text(t)),t.path(this)})),targets(){return Lt("svg textPath").filter((t=>(t.attr("href")||"").includes(this.id())))}}}),mi.prototype.MorphArray=Ee,q(mi,"TextPath");class vi extends qt{constructor(t,e=t){super(G("use",t),e)}use(t,e){return this.attr("href",(e||"")+"#"+t,H)}}A({Container:{use:K((function(t,e){return this.put(new vi).use(t,e)}))}}),q(vi,"Use");const yi=B;Q([si,ri,de,ce,be],C("viewbox")),Q([xe,je,Ge,We],C("marker")),Q(oi,C("Text")),Q(We,C("Path")),Q(Ut,C("Defs")),Q([oi,li],C("Tspan")),Q([Ve,se,he,Qe],C("radius")),Q(Rt,C("EventTarget")),Q(Bt,C("Dom")),Q(Gt,C("Element")),Q(qt,C("Shape")),Q([Vt,re],C("Container")),Q(he,C("Gradient")),Q(Qe,C("Runner")),Ct.extend([...new Set(k)]),function(t=[]){Ne.push(...[].concat(t))}([_t,xt,kt,vt,Dt,ge,Ee,bt]),Q(Ne,{to(t){return(new He).type(this.constructor).from(this.toArray()).to(t)},fromArray(t){return this.init(t),this},toConsumable(){return this.toArray()},morph(t,e,i,a,s){return this.fromArray(t.map((function(t,r){return a.step(t,e[r],i,s[r],s)})))}});class wi extends Gt{constructor(t){super(G("filter",t),t),this.$source="SourceGraphic",this.$sourceAlpha="SourceAlpha",this.$background="BackgroundImage",this.$backgroundAlpha="BackgroundAlpha",this.$fill="FillPaint",this.$stroke="StrokePaint",this.$autoSetIn=!0}put(t,e){return!(t=super.put(t,e)).attr("in")&&this.$autoSetIn&&t.attr("in",this.$source),t.attr("result")||t.attr("result",t.id()),t}remove(){return this.targets().each("unfilter"),super.remove()}targets(){return Lt('svg [filter*="'+this.id()+'"]')}toString(){return"url(#"+this.id()+")"}}class ki extends Gt{constructor(t,e){super(t,e),this.result(this.id())}in(t){if(null==t){const t=this.attr("in");return this.parent()&&this.parent().find(`[result="${t}"]`)[0]||t}return this.attr("in",t)}result(t){return this.attr("result",t)}toString(){return this.result()}}const Ai=t=>function(...e){for(let i=t.length;i--;)null!=e[i]&&this.attr(t[i],e[i])},Ci={blend:Ai(["in","in2","mode"]),colorMatrix:Ai(["type","values"]),composite:Ai(["in","in2","operator"]),convolveMatrix:function(t){t=new Dt(t).toString(),this.attr({order:Math.sqrt(t.split(" ").length),kernelMatrix:t})},diffuseLighting:Ai(["surfaceScale","lightingColor","diffuseConstant","kernelUnitLength"]),displacementMap:Ai(["in","in2","scale","xChannelSelector","yChannelSelector"]),dropShadow:Ai(["in","dx","dy","stdDeviation"]),flood:Ai(["flood-color","flood-opacity"]),gaussianBlur:function(t=0,e=t){this.attr("stdDeviation",t+" "+e)},image:function(t){this.attr("href",t,H)},morphology:Ai(["operator","radius"]),offset:Ai(["dx","dy"]),specularLighting:Ai(["surfaceScale","lightingColor","diffuseConstant","specularExponent","kernelUnitLength"]),tile:Ai([]),turbulence:Ai(["baseFrequency","numOctaves","seed","stitchTiles","type"])};["blend","colorMatrix","componentTransfer","composite","convolveMatrix","diffuseLighting","displacementMap","dropShadow","flood","gaussianBlur","image","merge","morphology","offset","specularLighting","tile","turbulence"].forEach((t=>{const e=P(t),i=Ci[t];wi[e+"Effect"]=class extends ki{constructor(t){super(G("fe"+e,t),t)}update(t){return i.apply(this,t),this}},wi.prototype[t]=K((function(t,...i){const a=new wi[e+"Effect"];return null==t?this.put(a):("function"==typeof t?t.call(a,a):i.unshift(t),this.put(a).update(i))}))})),Q(wi,{merge(t){const e=this.put(new wi.MergeEffect);if("function"==typeof t)return t.call(e,e),e;return(t instanceof Array?t:[...arguments]).forEach((t=>{t instanceof wi.MergeNode?e.put(t):e.mergeNode(t)})),e},componentTransfer(t={}){const e=this.put(new wi.ComponentTransferEffect);if("function"==typeof t)return t.call(e,e),e;if(!(t.r||t.g||t.b||t.a)){t={r:t,g:t,b:t,a:t}}for(const i in t)e.add(new(wi["Func"+i.toUpperCase()])(t[i]));return e}});["distantLight","pointLight","spotLight","mergeNode","FuncR","FuncG","FuncB","FuncA"].forEach((t=>{const e=P(t);wi[e]=class extends ki{constructor(t){super(G("fe"+e,t),t)}}}));["funcR","funcG","funcB","funcA"].forEach((function(t){const e=wi[P(t)],i=K((function(){return this.put(new e)}));wi.ComponentTransferEffect.prototype[t]=i}));["distantLight","pointLight","spotLight"].forEach((t=>{const e=wi[P(t)],i=K((function(){return this.put(new e)}));wi.DiffuseLightingEffect.prototype[t]=i,wi.SpecularLightingEffect.prototype[t]=i})),Q(wi.MergeEffect,{mergeNode(t){return this.put(new wi.MergeNode).attr("in",t)}}),Q(Ut,{filter:function(t){const e=this.put(new wi);return"function"==typeof t&&t.call(e,e),e}}),Q(Vt,{filter:function(t){return this.defs().filter(t)}}),Q(Gt,{filterWith:function(t){const e=t instanceof wi?t:this.defs().filter(t);return this.attr("filter",e)},unfilter:function(t){return this.attr("filter",null)},filterer(){return this.reference("filter")}});const Si={blend:function(t,e){return this.parent()&&this.parent().blend(this,t,e)},colorMatrix:function(t,e){return this.parent()&&this.parent().colorMatrix(t,e).in(this)},componentTransfer:function(t){return this.parent()&&this.parent().componentTransfer(t).in(this)},composite:function(t,e){return this.parent()&&this.parent().composite(this,t,e)},convolveMatrix:function(t){return this.parent()&&this.parent().convolveMatrix(t).in(this)},diffuseLighting:function(t,e,i,a){return this.parent()&&this.parent().diffuseLighting(t,i,a).in(this)},displacementMap:function(t,e,i,a){return this.parent()&&this.parent().displacementMap(this,t,e,i,a)},dropShadow:function(t,e,i){return this.parent()&&this.parent().dropShadow(this,t,e,i).in(this)},flood:function(t,e){return this.parent()&&this.parent().flood(t,e)},gaussianBlur:function(t,e){return this.parent()&&this.parent().gaussianBlur(t,e).in(this)},image:function(t){return this.parent()&&this.parent().image(t)},merge:function(t){return t=t instanceof Array?t:[...t],this.parent()&&this.parent().merge(this,...t)},morphology:function(t,e){return this.parent()&&this.parent().morphology(t,e).in(this)},offset:function(t,e){return this.parent()&&this.parent().offset(t,e).in(this)},specularLighting:function(t,e,i,a,s){return this.parent()&&this.parent().specularLighting(t,i,a,s).in(this)},tile:function(){return this.parent()&&this.parent().tile().in(this)},turbulence:function(t,e,i,a,s){return this.parent()&&this.parent().turbulence(t,e,i,a,s).in(this)}};Q(ki,Si),Q(wi.MergeEffect,{in:function(t){return t instanceof wi.MergeNode?this.add(t,0):this.add((new wi.MergeNode).in(t),0),this}}),Q([wi.CompositeEffect,wi.BlendEffect,wi.DisplacementMapEffect],{in2:function(t){if(null==t){const t=this.attr("in2");return this.parent()&&this.parent().find(`[result="${t}"]`)[0]||t}return this.attr("in2",t)}}),wi.filter={sepiatone:[.343,.669,.119,0,0,.249,.626,.13,0,0,.172,.334,.111,0,0,0,0,0,1,0]};var Li=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"getDefaultFilter",value:function(t,e){var i=this.w;t.unfilter(!0),(new wi).size("120%","180%","-5%","-40%"),i.config.chart.dropShadow.enabled&&this.dropShadow(t,i.config.chart.dropShadow,e)}},{key:"applyFilter",value:function(t,e,i){var a,s=this,r=this.w;if(t.unfilter(!0),"none"!==i){var n,o,l=r.config.chart.dropShadow,h="lighten"===i?2:.3;if(t.filterWith((function(t){t.colorMatrix({type:"matrix",values:"\n ".concat(h," 0 0 0 0\n 0 ").concat(h," 0 0 0\n 0 0 ").concat(h," 0 0\n 0 0 0 1 0\n "),in:"SourceGraphic",result:"brightness"}),l.enabled&&s.addShadow(t,e,l,"brightness")})),!l.noUserSpaceOnUse)null===(n=t.filterer())||void 0===n||null===(o=n.node)||void 0===o||o.setAttribute("filterUnits","userSpaceOnUse");this._scaleFilterSize(null===(a=t.filterer())||void 0===a?void 0:a.node)}else this.getDefaultFilter(t,e)}},{key:"addShadow",value:function(t,e,i,a){var s,r=this.w,n=i.blur,o=i.top,l=i.left,h=i.color,c=i.opacity;if(h=Array.isArray(h)?h[e]:h,(null===(s=r.config.chart.dropShadow.enabledOnSeries)||void 0===s?void 0:s.length)>0&&-1===r.config.chart.dropShadow.enabledOnSeries.indexOf(e))return t;t.offset({in:a,dx:l,dy:o,result:"offset"}),t.gaussianBlur({in:"offset",stdDeviation:n,result:"blur"}),t.flood({"flood-color":h,"flood-opacity":c,result:"flood"}),t.composite({in:"flood",in2:"blur",operator:"in",result:"shadow"}),t.merge(["shadow",a])}},{key:"dropShadow",value:function(t,e){var i,a,s,r,n,o=this,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,h=this.w;if(t.unfilter(!0),v.isMsEdge()&&"radialBar"===h.config.chart.type)return t;if((null===(i=h.config.chart.dropShadow.enabledOnSeries)||void 0===i?void 0:i.length)>0&&-1===(null===(s=h.config.chart.dropShadow.enabledOnSeries)||void 0===s?void 0:s.indexOf(l)))return t;(t.filterWith((function(t){o.addShadow(t,l,e,"SourceGraphic")})),e.noUserSpaceOnUse)||(null===(r=t.filterer())||void 0===r||null===(n=r.node)||void 0===n||n.setAttribute("filterUnits","userSpaceOnUse"));return this._scaleFilterSize(null===(a=t.filterer())||void 0===a?void 0:a.node),t}},{key:"setSelectionFilter",value:function(t,e,i){var a=this.w;if(void 0!==a.globals.selectedDataPoints[e]&&a.globals.selectedDataPoints[e].indexOf(i)>-1){t.node.setAttribute("selected",!0);var s=a.config.states.active.filter;"none"!==s&&this.applyFilter(t,e,s.type)}}},{key:"_scaleFilterSize",value:function(t){if(t){!function(e){for(var i in e)e.hasOwnProperty(i)&&t.setAttribute(i,e[i])}({width:"200%",height:"200%",x:"-50%",y:"-50%"})}}}]),t}(),Mi=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"roundPathCorners",value:function(t,e){function i(t,e,i){var s=e.x-t.x,r=e.y-t.y,n=Math.sqrt(s*s+r*r);return a(t,e,Math.min(1,i/n))}function a(t,e,i){return{x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i}}function s(t,e){t.length>2&&(t[t.length-2]=e.x,t[t.length-1]=e.y)}function r(t){return{x:parseFloat(t[t.length-2]),y:parseFloat(t[t.length-1])}}t.indexOf("NaN")>-1&&(t="");var n=t.split(/[,\s]/).reduce((function(t,e){var i=e.match("([a-zA-Z])(.+)");return i?(t.push(i[1]),t.push(i[2])):t.push(e),t}),[]).reduce((function(t,e){return parseFloat(e)==e&&t.length?t[t.length-1].push(e):t.push([e]),t}),[]),o=[];if(n.length>1){var l=r(n[0]),h=null;"Z"==n[n.length-1][0]&&n[0].length>2&&(h=["L",l.x,l.y],n[n.length-1]=h),o.push(n[0]);for(var c=1;c2&&"L"==u[0]&&g.length>2&&"L"==g[0]){var p,f,x=r(d),b=r(u),m=r(g);p=i(b,x,e),f=i(b,m,e),s(u,p),u.origPoint=b,o.push(u);var v=a(p,b,.5),y=a(b,f,.5),w=["C",v.x,v.y,y.x,y.y,f.x,f.y];w.origPoint=b,o.push(w)}else o.push(u)}if(h){var k=r(o[o.length-1]);o.push(["Z"]),s(o[0],k)}}else o=n;return o.reduce((function(t,e){return t+e.join(" ")+" "}),"")}},{key:"drawLine",value:function(t,e,i,a){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"#a8a8a8",r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,n=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"butt";return this.w.globals.dom.Paper.line().attr({x1:t,y1:e,x2:i,y2:a,stroke:s,"stroke-dasharray":r,"stroke-width":n,"stroke-linecap":o})}},{key:"drawRect",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"#fefefe",n=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null,l=arguments.length>8&&void 0!==arguments[8]?arguments[8]:null,h=arguments.length>9&&void 0!==arguments[9]?arguments[9]:0,c=this.w.globals.dom.Paper.rect();return c.attr({x:t,y:e,width:i>0?i:0,height:a>0?a:0,rx:s,ry:s,opacity:n,"stroke-width":null!==o?o:0,stroke:null!==l?l:"none","stroke-dasharray":h}),c.node.setAttribute("fill",r),c}},{key:"drawPolygon",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#e1e1e1",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"none";return this.w.globals.dom.Paper.polygon(t).attr({fill:a,stroke:e,"stroke-width":i})}},{key:"drawCircle",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;t<0&&(t=0);var i=this.w.globals.dom.Paper.circle(2*t);return null!==e&&i.attr(e),i}},{key:"drawPath",value:function(t){var e=t.d,i=void 0===e?"":e,a=t.stroke,s=void 0===a?"#a8a8a8":a,r=t.strokeWidth,n=void 0===r?1:r,o=t.fill,l=t.fillOpacity,h=void 0===l?1:l,c=t.strokeOpacity,d=void 0===c?1:c,u=t.classes,g=t.strokeLinecap,p=void 0===g?null:g,f=t.strokeDashArray,x=void 0===f?0:f,b=this.w;return null===p&&(p=b.config.stroke.lineCap),(i.indexOf("undefined")>-1||i.indexOf("NaN")>-1)&&(i="M 0 ".concat(b.globals.gridHeight)),b.globals.dom.Paper.path(i).attr({fill:o,"fill-opacity":h,stroke:s,"stroke-opacity":d,"stroke-linecap":p,"stroke-width":n,"stroke-dasharray":x,class:u})}},{key:"group",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=this.w.globals.dom.Paper.group();return null!==t&&e.attr(t),e}},{key:"move",value:function(t,e){var i=["M",t,e].join(" ");return i}},{key:"line",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=null;return null===i?a=[" L",t,e].join(" "):"H"===i?a=[" H",t].join(" "):"V"===i&&(a=[" V",e].join(" ")),a}},{key:"curve",value:function(t,e,i,a,s,r){var n=["C",t,e,i,a,s,r].join(" ");return n}},{key:"quadraticCurve",value:function(t,e,i,a){return["Q",t,e,i,a].join(" ")}},{key:"arc",value:function(t,e,i,a,s,r,n){var o="A";arguments.length>7&&void 0!==arguments[7]&&arguments[7]&&(o="a");var l=[o,t,e,i,a,s,r,n].join(" ");return l}},{key:"renderPaths",value:function(t){var e,i=t.j,a=t.realIndex,s=t.pathFrom,r=t.pathTo,n=t.stroke,o=t.strokeWidth,l=t.strokeLinecap,h=t.fill,c=t.animationDelay,d=t.initialSpeed,g=t.dataChangeSpeed,p=t.className,f=t.chartType,x=t.shouldClipToGrid,b=void 0===x||x,m=t.bindEventsOnPaths,v=void 0===m||m,w=t.drawShadow,k=void 0===w||w,A=this.w,C=new Li(this.ctx),S=new y(this.ctx),L=this.w.config.chart.animations.enabled,M=L&&this.w.config.chart.animations.dynamicAnimation.enabled,P=!!(L&&!A.globals.resized||M&&A.globals.dataChanged&&A.globals.shouldAnimate);P?e=s:(e=r,A.globals.animationEnded=!0);var I=A.config.stroke.dashArray,T=0;T=Array.isArray(I)?I[a]:A.config.stroke.dashArray;var z=this.drawPath({d:e,stroke:n,strokeWidth:o,fill:h,fillOpacity:1,classes:p,strokeLinecap:l,strokeDashArray:T});z.attr("index",a),b&&("bar"===f&&!A.globals.isHorizontal||A.globals.comboCharts?z.attr({"clip-path":"url(#gridRectBarMask".concat(A.globals.cuid,")")}):z.attr({"clip-path":"url(#gridRectMask".concat(A.globals.cuid,")")})),A.config.chart.dropShadow.enabled&&k&&C.dropShadow(z,A.config.chart.dropShadow,a),v&&(z.node.addEventListener("mouseenter",this.pathMouseEnter.bind(this,z)),z.node.addEventListener("mouseleave",this.pathMouseLeave.bind(this,z)),z.node.addEventListener("mousedown",this.pathMouseDown.bind(this,z))),z.attr({pathTo:r,pathFrom:s});var X={el:z,j:i,realIndex:a,pathFrom:s,pathTo:r,fill:h,strokeWidth:o,delay:c};return!L||A.globals.resized||A.globals.dataChanged?!A.globals.resized&&A.globals.dataChanged||S.showDelayedElements():S.animatePathsGradually(u(u({},X),{},{speed:d})),A.globals.dataChanged&&M&&P&&S.animatePathsGradually(u(u({},X),{},{speed:g})),z}},{key:"drawPattern",value:function(t,e,i){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"#a8a8a8",s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return this.w.globals.dom.Paper.pattern(e,i,(function(r){"horizontalLines"===t?r.line(0,0,i,0).stroke({color:a,width:s+1}):"verticalLines"===t?r.line(0,0,0,e).stroke({color:a,width:s+1}):"slantedLines"===t?r.line(0,0,e,i).stroke({color:a,width:s}):"squares"===t?r.rect(e,i).fill("none").stroke({color:a,width:s}):"circles"===t&&r.circle(e).fill("none").stroke({color:a,width:s})}))}},{key:"drawGradient",value:function(t,e,i,a,s){var r,n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:[],h=arguments.length>8&&void 0!==arguments[8]?arguments[8]:0,c=this.w;e.length<9&&0===e.indexOf("#")&&(e=v.hexToRgba(e,a)),i.length<9&&0===i.indexOf("#")&&(i=v.hexToRgba(i,s));var d=0,u=1,g=1,p=null;null!==o&&(d=void 0!==o[0]?o[0]/100:0,u=void 0!==o[1]?o[1]/100:1,g=void 0!==o[2]?o[2]/100:1,p=void 0!==o[3]?o[3]/100:null);var f=!("donut"!==c.config.chart.type&&"pie"!==c.config.chart.type&&"polarArea"!==c.config.chart.type&&"bubble"!==c.config.chart.type);if(r=l&&0!==l.length?c.globals.dom.Paper.gradient(f?"radial":"linear",(function(t){(Array.isArray(l[h])?l[h]:l).forEach((function(e){t.stop(e.offset/100,e.color,e.opacity)}))})):c.globals.dom.Paper.gradient(f?"radial":"linear",(function(t){t.stop(d,e,a),t.stop(u,i,s),t.stop(g,i,s),null!==p&&t.stop(p,e,a)})),f){var x=c.globals.gridWidth/2,b=c.globals.gridHeight/2;"bubble"!==c.config.chart.type?r.attr({gradientUnits:"userSpaceOnUse",cx:x,cy:b,r:n}):r.attr({cx:.5,cy:.5,r:.8,fx:.2,fy:.2})}else"vertical"===t?r.from(0,0).to(0,1):"diagonal"===t?r.from(0,0).to(1,1):"horizontal"===t?r.from(0,1).to(1,1):"diagonal2"===t&&r.from(1,0).to(0,1);return r}},{key:"getTextBasedOnMaxWidth",value:function(t){var e=t.text,i=t.maxWidth,a=t.fontSize,s=t.fontFamily,r=this.getTextRects(e,a,s),n=r.width/e.length,o=Math.floor(i/n);return i-1){var o=i.globals.selectedDataPoints[s].indexOf(r);i.globals.selectedDataPoints[s].splice(o,1)}}else{if(!i.config.states.active.allowMultipleDataPointsSelection&&i.globals.selectedDataPoints.length>0){i.globals.selectedDataPoints=[];var l=i.globals.dom.Paper.find(".apexcharts-series path:not(.apexcharts-decoration-element)"),h=i.globals.dom.Paper.find(".apexcharts-series circle:not(.apexcharts-decoration-element), .apexcharts-series rect:not(.apexcharts-decoration-element)"),c=function(t){Array.prototype.forEach.call(t,(function(t){t.node.setAttribute("selected","false"),a.getDefaultFilter(t,s)}))};c(l),c(h)}t.node.setAttribute("selected","true"),n="true",void 0===i.globals.selectedDataPoints[s]&&(i.globals.selectedDataPoints[s]=[]),i.globals.selectedDataPoints[s].push(r)}if("true"===n){var d=i.config.states.active.filter;if("none"!==d)a.applyFilter(t,s,d.type);else if("none"!==i.config.states.hover.filter&&!i.globals.isTouchDevice){var u=i.config.states.hover.filter;a.applyFilter(t,s,u.type)}}else if("none"!==i.config.states.active.filter.type)if("none"===i.config.states.hover.filter.type||i.globals.isTouchDevice)a.getDefaultFilter(t,s);else{u=i.config.states.hover.filter;a.applyFilter(t,s,u.type)}"function"==typeof i.config.chart.events.dataPointSelection&&i.config.chart.events.dataPointSelection(e,this.ctx,{selectedDataPoints:i.globals.selectedDataPoints,seriesIndex:s,dataPointIndex:r,w:i}),e&&this.ctx.events.fireEvent("dataPointSelection",[e,this.ctx,{selectedDataPoints:i.globals.selectedDataPoints,seriesIndex:s,dataPointIndex:r,w:i}])}},{key:"rotateAroundCenter",value:function(t){var e={};return t&&"function"==typeof t.getBBox&&(e=t.getBBox()),{x:e.x+e.width/2,y:e.y+e.height/2}}},{key:"getTextRects",value:function(t,e,i,a){var s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],r=this.w,n=this.drawText({x:-200,y:-200,text:t,textAnchor:"start",fontSize:e,fontFamily:i,foreColor:"#fff",opacity:0});a&&n.attr("transform",a),r.globals.dom.Paper.add(n);var o=n.bbox();return s||(o=n.node.getBoundingClientRect()),n.remove(),{width:o.width,height:o.height}}},{key:"placeTextWithEllipsis",value:function(t,e,i){if("function"==typeof t.getComputedTextLength&&(t.textContent=e,e.length>0&&t.getComputedTextLength()>=i/1.1)){for(var a=e.length-3;a>0;a-=3)if(t.getSubStringLength(0,a)<=i/1.1)return void(t.textContent=e.substring(0,a)+"...");t.textContent="."}}}],[{key:"setAttrs",value:function(t,e){for(var i in e)e.hasOwnProperty(i)&&t.setAttribute(i,e[i])}}]),t}(),Pi=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"getStackedSeriesTotals",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=this.w,i=[];if(0===e.globals.series.length)return i;for(var a=0;a0&&void 0!==arguments[0]?arguments[0]:null;return null===t?this.w.config.series.reduce((function(t,e){return t+e}),0):this.w.globals.series[t].reduce((function(t,e){return t+e}),0)}},{key:"getStackedSeriesTotalsByGroups",value:function(){var t=this,e=this.w,i=[];return e.globals.seriesGroups.forEach((function(a){var s=[];e.config.series.forEach((function(t,i){a.indexOf(e.globals.seriesNames[i])>-1&&s.push(i)}));var r=e.globals.series.map((function(t,e){return-1===s.indexOf(e)?e:-1})).filter((function(t){return-1!==t}));i.push(t.getStackedSeriesTotals(r))})),i}},{key:"setSeriesYAxisMappings",value:function(){var t=this.w.globals,e=this.w.config,i=[],a=[],s=[],r=t.series.length>e.yaxis.length||e.yaxis.some((function(t){return Array.isArray(t.seriesName)}));e.series.forEach((function(t,e){s.push(e),a.push(null)})),e.yaxis.forEach((function(t,e){i[e]=[]}));var n=[];e.yaxis.forEach((function(t,a){var o=!1;if(t.seriesName){var l=[];Array.isArray(t.seriesName)?l=t.seriesName:l.push(t.seriesName),l.forEach((function(t){e.series.forEach((function(e,n){if(e.name===t){var l=n;a===n||r?!r||s.indexOf(n)>-1?i[a].push([a,n]):console.warn("Series '"+e.name+"' referenced more than once in what looks like the new style. That is, when using either seriesName: [], or when there are more series than yaxes."):(i[n].push([n,a]),l=a),o=!0,-1!==(l=s.indexOf(l))&&s.splice(l,1)}}))}))}o||n.push(a)})),i=i.map((function(t,e){var i=[];return t.forEach((function(t){a[t[1]]=t[0],i.push(t[1])})),i}));for(var o=e.yaxis.length-1,l=0;l0&&void 0!==arguments[0]?arguments[0]:null;return 0===(null===t?this.w.config.series.filter((function(t){return null!==t})):this.w.config.series[t].data.filter((function(t){return null!==t}))).length}},{key:"seriesHaveSameValues",value:function(t){return this.w.globals.series[t].every((function(t,e,i){return t===i[0]}))}},{key:"getCategoryLabels",value:function(t){var e=this.w,i=t.slice();return e.config.xaxis.convertedCatToNumeric&&(i=t.map((function(t,i){return e.config.xaxis.labels.formatter(t-e.globals.minX+1)}))),i}},{key:"getLargestSeries",value:function(){var t=this.w;t.globals.maxValsInArrayIndex=t.globals.series.map((function(t){return t.length})).indexOf(Math.max.apply(Math,t.globals.series.map((function(t){return t.length}))))}},{key:"getLargestMarkerSize",value:function(){var t=this.w,e=0;return t.globals.markers.size.forEach((function(t){e=Math.max(e,t)})),t.config.markers.discrete&&t.config.markers.discrete.length&&t.config.markers.discrete.forEach((function(t){e=Math.max(e,t.size)})),e>0&&(t.config.markers.hover.size>0?e=t.config.markers.hover.size:e+=t.config.markers.hover.sizeOffset),t.globals.markers.largestSize=e,e}},{key:"getSeriesTotals",value:function(){var t=this.w;t.globals.seriesTotals=t.globals.series.map((function(t,e){var i=0;if(Array.isArray(t))for(var a=0;at&&i.globals.seriesX[s][n]0){var g=function(t,e){var i=s.config.yaxis[s.globals.seriesYAxisReverseMap[e]],r=t<0?-1:1;return t=Math.abs(t),i.logarithmic&&(t=a.getBaseLog(i.logBase,t)),-r*t/n[e]};if(r.isMultipleYAxis){l=[];for(var p=0;p0&&e.forEach((function(e){var n=[],o=[];t.i.forEach((function(i,a){s.config.series[i].group===e&&(n.push(t.series[a]),o.push(i))})),n.length>0&&r.push(a.draw(n,i,o))})),r}}],[{key:"checkComboSeries",value:function(t,e){var i=!1,a=0,s=0;return void 0===e&&(e="line"),t.length&&void 0!==t[0].type&&t.forEach((function(t){"bar"!==t.type&&"column"!==t.type&&"candlestick"!==t.type&&"boxPlot"!==t.type||a++,void 0!==t.type&&t.type!==e&&s++})),s>0&&(i=!0),{comboBarCount:a,comboCharts:i}}},{key:"extendArrayProps",value:function(t,e,i){var a,s,r,n,o,l;(null!==(a=e)&&void 0!==a&&a.yaxis&&(e=t.extendYAxis(e,i)),null!==(s=e)&&void 0!==s&&s.annotations)&&(e.annotations.yaxis&&(e=t.extendYAxisAnnotations(e)),null!==(r=e)&&void 0!==r&&null!==(n=r.annotations)&&void 0!==n&&n.xaxis&&(e=t.extendXAxisAnnotations(e)),null!==(o=e)&&void 0!==o&&null!==(l=o.annotations)&&void 0!==l&&l.points&&(e=t.extendPointAnnotations(e)));return e}}]),t}(),Ii=function(){function t(e){i(this,t),this.w=e.w,this.annoCtx=e}return s(t,[{key:"setOrientations",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=this.w;if("vertical"===t.label.orientation){var a=null!==e?e:0,s=i.globals.dom.baseEl.querySelector(".apexcharts-xaxis-annotations .apexcharts-xaxis-annotation-label[rel='".concat(a,"']"));if(null!==s){var r=s.getBoundingClientRect();s.setAttribute("x",parseFloat(s.getAttribute("x"))-r.height+4);var n="top"===t.label.position?r.width:-r.width;s.setAttribute("y",parseFloat(s.getAttribute("y"))+n);var o=this.annoCtx.graphics.rotateAroundCenter(s),l=o.x,h=o.y;s.setAttribute("transform","rotate(-90 ".concat(l," ").concat(h,")"))}}}},{key:"addBackgroundToAnno",value:function(t,e){var i=this.w;if(!t||!e.label.text||!String(e.label.text).trim())return null;var a=i.globals.dom.baseEl.querySelector(".apexcharts-grid").getBoundingClientRect(),s=t.getBoundingClientRect(),r=e.label.style.padding,n=r.left,o=r.right,l=r.top,h=r.bottom;if("vertical"===e.label.orientation){var c=[n,o,l,h];l=c[0],h=c[1],n=c[2],o=c[3]}var d=s.left-a.left-n,u=s.top-a.top-l,g=this.annoCtx.graphics.drawRect(d-i.globals.barPadForNumericAxis,u,s.width+n+o,s.height+l+h,e.label.borderRadius,e.label.style.background,1,e.label.borderWidth,e.label.borderColor,0);return e.id&&g.node.classList.add(e.id),g}},{key:"annotationsBackground",value:function(){var t=this,e=this.w,i=function(i,a,s){var r=e.globals.dom.baseEl.querySelector(".apexcharts-".concat(s,"-annotations .apexcharts-").concat(s,"-annotation-label[rel='").concat(a,"']"));if(r){var n=r.parentNode,o=t.addBackgroundToAnno(r,i);o&&(n.insertBefore(o.node,r),i.label.mouseEnter&&o.node.addEventListener("mouseenter",i.label.mouseEnter.bind(t,i)),i.label.mouseLeave&&o.node.addEventListener("mouseleave",i.label.mouseLeave.bind(t,i)),i.label.click&&o.node.addEventListener("click",i.label.click.bind(t,i)))}};e.config.annotations.xaxis.forEach((function(t,e){return i(t,e,"xaxis")})),e.config.annotations.yaxis.forEach((function(t,e){return i(t,e,"yaxis")})),e.config.annotations.points.forEach((function(t,e){return i(t,e,"point")}))}},{key:"getY1Y2",value:function(t,e){var i,a=this.w,s="y1"===t?e.y:e.y2,r=!1;if(this.annoCtx.invertAxis){var n=a.config.xaxis.convertedCatToNumeric?a.globals.categoryLabels:a.globals.labels,o=n.indexOf(s),l=a.globals.dom.baseEl.querySelector(".apexcharts-yaxis-texts-g text:nth-child(".concat(o+1,")"));i=l?parseFloat(l.getAttribute("y")):(a.globals.gridHeight/n.length-1)*(o+1)-a.globals.barHeight,void 0!==e.seriesIndex&&a.globals.barHeight&&(i-=a.globals.barHeight/2*(a.globals.series.length-1)-a.globals.barHeight*e.seriesIndex)}else{var h,c=a.globals.seriesYAxisMap[e.yAxisIndex][0],d=a.config.yaxis[e.yAxisIndex].logarithmic?new Pi(this.annoCtx.ctx).getLogVal(a.config.yaxis[e.yAxisIndex].logBase,s,c)/a.globals.yLogRatio[c]:(s-a.globals.minYArr[c])/(a.globals.yRange[c]/a.globals.gridHeight);i=a.globals.gridHeight-Math.min(Math.max(d,0),a.globals.gridHeight),r=d>a.globals.gridHeight||d<0,!e.marker||void 0!==e.y&&null!==e.y||(i=0),null!==(h=a.config.yaxis[e.yAxisIndex])&&void 0!==h&&h.reversed&&(i=d)}return"string"==typeof s&&s.includes("px")&&(i=parseFloat(s)),{yP:i,clipped:r}}},{key:"getX1X2",value:function(t,e){var i=this.w,a="x1"===t?e.x:e.x2,s=this.annoCtx.invertAxis?i.globals.minY:i.globals.minX,r=this.annoCtx.invertAxis?i.globals.maxY:i.globals.maxX,n=this.annoCtx.invertAxis?i.globals.yRange[0]:i.globals.xRange,o=!1,l=this.annoCtx.inversedReversedAxis?(r-a)/(n/i.globals.gridWidth):(a-s)/(n/i.globals.gridWidth);return"category"!==i.config.xaxis.type&&!i.config.xaxis.convertedCatToNumeric||this.annoCtx.invertAxis||i.globals.dataFormatXNumeric||i.config.chart.sparkline.enabled||(l=this.getStringX(a)),"string"==typeof a&&a.includes("px")&&(l=parseFloat(a)),null==a&&e.marker&&(l=i.globals.gridWidth),void 0!==e.seriesIndex&&i.globals.barWidth&&!this.annoCtx.invertAxis&&(l-=i.globals.barWidth/2*(i.globals.series.length-1)-i.globals.barWidth*e.seriesIndex),l>i.globals.gridWidth?(l=i.globals.gridWidth,o=!0):l<0&&(l=0,o=!0),{x:l,clipped:o}}},{key:"getStringX",value:function(t){var e=this.w,i=t;e.config.xaxis.convertedCatToNumeric&&e.globals.categoryLabels.length&&(t=e.globals.categoryLabels.indexOf(t)+1);var a=e.globals.labels.map((function(t){return Array.isArray(t)?t.join(" "):t})).indexOf(t),s=e.globals.dom.baseEl.querySelector(".apexcharts-xaxis-texts-g text:nth-child(".concat(a+1,")"));return s&&(i=parseFloat(s.getAttribute("x"))),i}}]),t}(),Ti=function(){function t(e){i(this,t),this.w=e.w,this.annoCtx=e,this.invertAxis=this.annoCtx.invertAxis,this.helpers=new Ii(this.annoCtx)}return s(t,[{key:"addXaxisAnnotation",value:function(t,e,i){var a,s=this.w,r=this.helpers.getX1X2("x1",t),n=r.x,o=r.clipped,l=!0,h=t.label.text,c=t.strokeDashArray;if(v.isNumber(n)){if(null===t.x2||void 0===t.x2){if(!o){var d=this.annoCtx.graphics.drawLine(n+t.offsetX,0+t.offsetY,n+t.offsetX,s.globals.gridHeight+t.offsetY,t.borderColor,c,t.borderWidth);e.appendChild(d.node),t.id&&d.node.classList.add(t.id)}}else{var u=this.helpers.getX1X2("x2",t);if(a=u.x,l=u.clipped,a12?u-12:0===u?12:u;e=(e=(e=(e=e.replace(/(^|[^\\])HH+/g,"$1"+l(u))).replace(/(^|[^\\])H/g,"$1"+u)).replace(/(^|[^\\])hh+/g,"$1"+l(g))).replace(/(^|[^\\])h/g,"$1"+g);var p=a?t.getUTCMinutes():t.getMinutes();e=(e=e.replace(/(^|[^\\])mm+/g,"$1"+l(p))).replace(/(^|[^\\])m/g,"$1"+p);var x=a?t.getUTCSeconds():t.getSeconds();e=(e=e.replace(/(^|[^\\])ss+/g,"$1"+l(x))).replace(/(^|[^\\])s/g,"$1"+x);var b=a?t.getUTCMilliseconds():t.getMilliseconds();e=e.replace(/(^|[^\\])fff+/g,"$1"+l(b,3)),b=Math.round(b/10),e=e.replace(/(^|[^\\])ff/g,"$1"+l(b)),b=Math.round(b/10);var m=u<12?"AM":"PM";e=(e=(e=e.replace(/(^|[^\\])f/g,"$1"+b)).replace(/(^|[^\\])TT+/g,"$1"+m)).replace(/(^|[^\\])T/g,"$1"+m.charAt(0));var v=m.toLowerCase();e=(e=e.replace(/(^|[^\\])tt+/g,"$1"+v)).replace(/(^|[^\\])t/g,"$1"+v.charAt(0));var y=-t.getTimezoneOffset(),w=a||!y?"Z":y>0?"+":"-";if(!a){var k=(y=Math.abs(y))%60;w+=l(Math.floor(y/60))+":"+l(k)}e=e.replace(/(^|[^\\])K/g,"$1"+w);var A=(a?t.getUTCDay():t.getDay())+1;return e=(e=(e=(e=(e=e.replace(new RegExp(n[0],"g"),n[A])).replace(new RegExp(o[0],"g"),o[A])).replace(new RegExp(s[0],"g"),s[c])).replace(new RegExp(r[0],"g"),r[c])).replace(/\\(.)/g,"$1")}},{key:"getTimeUnitsfromTimestamp",value:function(t,e,i){var a=this.w;void 0!==a.config.xaxis.min&&(t=a.config.xaxis.min),void 0!==a.config.xaxis.max&&(e=a.config.xaxis.max);var s=this.getDate(t),r=this.getDate(e),n=this.formatDate(s,"yyyy MM dd HH mm ss fff").split(" "),o=this.formatDate(r,"yyyy MM dd HH mm ss fff").split(" ");return{minMillisecond:parseInt(n[6],10),maxMillisecond:parseInt(o[6],10),minSecond:parseInt(n[5],10),maxSecond:parseInt(o[5],10),minMinute:parseInt(n[4],10),maxMinute:parseInt(o[4],10),minHour:parseInt(n[3],10),maxHour:parseInt(o[3],10),minDate:parseInt(n[2],10),maxDate:parseInt(o[2],10),minMonth:parseInt(n[1],10)-1,maxMonth:parseInt(o[1],10)-1,minYear:parseInt(n[0],10),maxYear:parseInt(o[0],10)}}},{key:"isLeapYear",value:function(t){return t%4==0&&t%100!=0||t%400==0}},{key:"calculcateLastDaysOfMonth",value:function(t,e,i){return this.determineDaysOfMonths(t,e)-i}},{key:"determineDaysOfYear",value:function(t){var e=365;return this.isLeapYear(t)&&(e=366),e}},{key:"determineRemainingDaysOfYear",value:function(t,e,i){var a=this.daysCntOfYear[e]+i;return e>1&&this.isLeapYear()&&a++,a}},{key:"determineDaysOfMonths",value:function(t,e){var i=30;switch(t=v.monthMod(t),!0){case this.months30.indexOf(t)>-1:2===t&&(i=this.isLeapYear(e)?29:28);break;case this.months31.indexOf(t)>-1:default:i=31}return i}}]),t}(),Xi=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.tooltipKeyFormat="dd MMM"}return s(t,[{key:"xLabelFormat",value:function(t,e,i,a){var s=this.w;if("datetime"===s.config.xaxis.type&&void 0===s.config.xaxis.labels.formatter&&void 0===s.config.tooltip.x.formatter){var r=new zi(this.ctx);return r.formatDate(r.getDate(e),s.config.tooltip.x.format)}return t(e,i,a)}},{key:"defaultGeneralFormatter",value:function(t){return Array.isArray(t)?t.map((function(t){return t})):t}},{key:"defaultYFormatter",value:function(t,e,i){var a=this.w;if(v.isNumber(t))if(0!==a.globals.yValueDecimal)t=t.toFixed(void 0!==e.decimalsInFloat?e.decimalsInFloat:a.globals.yValueDecimal);else{var s=t.toFixed(0);t=t==s?s:t.toFixed(1)}return t}},{key:"setLabelFormatters",value:function(){var t=this,e=this.w;return e.globals.xaxisTooltipFormatter=function(e){return t.defaultGeneralFormatter(e)},e.globals.ttKeyFormatter=function(e){return t.defaultGeneralFormatter(e)},e.globals.ttZFormatter=function(t){return t},e.globals.legendFormatter=function(e){return t.defaultGeneralFormatter(e)},void 0!==e.config.xaxis.labels.formatter?e.globals.xLabelFormatter=e.config.xaxis.labels.formatter:e.globals.xLabelFormatter=function(t){if(v.isNumber(t)){if(!e.config.xaxis.convertedCatToNumeric&&"numeric"===e.config.xaxis.type){if(v.isNumber(e.config.xaxis.decimalsInFloat))return t.toFixed(e.config.xaxis.decimalsInFloat);var i=e.globals.maxX-e.globals.minX;return i>0&&i<100?t.toFixed(1):t.toFixed(0)}if(e.globals.isBarHorizontal)if(e.globals.maxY-e.globals.minYArr<4)return t.toFixed(1);return t.toFixed(0)}return t},"function"==typeof e.config.tooltip.x.formatter?e.globals.ttKeyFormatter=e.config.tooltip.x.formatter:e.globals.ttKeyFormatter=e.globals.xLabelFormatter,"function"==typeof e.config.xaxis.tooltip.formatter&&(e.globals.xaxisTooltipFormatter=e.config.xaxis.tooltip.formatter),(Array.isArray(e.config.tooltip.y)||void 0!==e.config.tooltip.y.formatter)&&(e.globals.ttVal=e.config.tooltip.y),void 0!==e.config.tooltip.z.formatter&&(e.globals.ttZFormatter=e.config.tooltip.z.formatter),void 0!==e.config.legend.formatter&&(e.globals.legendFormatter=e.config.legend.formatter),e.config.yaxis.forEach((function(i,a){void 0!==i.labels.formatter?e.globals.yLabelFormatters[a]=i.labels.formatter:e.globals.yLabelFormatters[a]=function(s){return e.globals.xyCharts?Array.isArray(s)?s.map((function(e){return t.defaultYFormatter(e,i,a)})):t.defaultYFormatter(s,i,a):s}})),e.globals}},{key:"heatmapLabelFormatters",value:function(){var t=this.w;if("heatmap"===t.config.chart.type){t.globals.yAxisScale[0].result=t.globals.seriesNames.slice();var e=t.globals.seriesNames.reduce((function(t,e){return t.length>e.length?t:e}),0);t.globals.yAxisScale[0].niceMax=e,t.globals.yAxisScale[0].niceMin=e}}}]),t}(),Ri=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"getLabel",value:function(t,e,i,a){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"12px",n=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=this.w,l=void 0===t[a]?"":t[a],h=l,c=o.globals.xLabelFormatter,d=o.config.xaxis.labels.formatter,u=!1,g=new Xi(this.ctx),p=l;n&&(h=g.xLabelFormat(c,l,p,{i:a,dateFormatter:new zi(this.ctx).formatDate,w:o}),void 0!==d&&(h=d(l,t[a],{i:a,dateFormatter:new zi(this.ctx).formatDate,w:o})));var f,x;e.length>0?(f=e[a].unit,x=null,e.forEach((function(t){"month"===t.unit?x="year":"day"===t.unit?x="month":"hour"===t.unit?x="day":"minute"===t.unit&&(x="hour")})),u=x===f,i=e[a].position,h=e[a].value):"datetime"===o.config.xaxis.type&&void 0===d&&(h=""),void 0===h&&(h=""),h=Array.isArray(h)?h:h.toString();var b=new Mi(this.ctx),m={};m=o.globals.rotateXLabels&&n?b.getTextRects(h,parseInt(r,10),null,"rotate(".concat(o.config.xaxis.labels.rotate," 0 0)"),!1):b.getTextRects(h,parseInt(r,10));var v=!o.config.xaxis.labels.showDuplicates&&this.ctx.timeScale;return!Array.isArray(h)&&("NaN"===String(h)||s.indexOf(h)>=0&&v)&&(h=""),{x:i,text:h,textRect:m,isBold:u}}},{key:"checkLabelBasedOnTickamount",value:function(t,e,i){var a=this.w,s=a.config.xaxis.tickAmount;return"dataPoints"===s&&(s=Math.round(a.globals.gridWidth/120)),s>i||t%Math.round(i/(s+1))==0||(e.text=""),e}},{key:"checkForOverflowingLabels",value:function(t,e,i,a,s){var r=this.w;if(0===t&&r.globals.skipFirstTimelinelabel&&(e.text=""),t===i-1&&r.globals.skipLastTimelinelabel&&(e.text=""),r.config.xaxis.labels.hideOverlappingLabels&&a.length>0){var n=s[s.length-1];e.xa.length||a.some((function(t){return Array.isArray(t.seriesName)}))?t:i.seriesYAxisReverseMap[t]}},{key:"isYAxisHidden",value:function(t){var e=this.w,i=e.config.yaxis[t];if(!i.show||this.yAxisAllSeriesCollapsed(t))return!0;if(!i.showForNullSeries){var a=e.globals.seriesYAxisMap[t],s=new Pi(this.ctx);return a.every((function(t){return s.isSeriesNull(t)}))}return!1}},{key:"getYAxisForeColor",value:function(t,e){var i=this.w;return Array.isArray(t)&&i.globals.yAxisScale[e]&&this.ctx.theme.pushExtraColors(t,i.globals.yAxisScale[e].result.length,!1),t}},{key:"drawYAxisTicks",value:function(t,e,i,a,s,r,n){var o=this.w,l=new Mi(this.ctx),h=o.globals.translateY+o.config.yaxis[s].labels.offsetY;if(o.globals.isBarHorizontal?h=0:"heatmap"===o.config.chart.type&&(h+=r/2),a.show&&e>0){!0===o.config.yaxis[s].opposite&&(t+=a.width);for(var c=e;c>=0;c--){var d=l.drawLine(t+i.offsetX-a.width+a.offsetX,h+a.offsetY,t+i.offsetX+a.offsetX,h+a.offsetY,a.color);n.add(d),h+=r}}}}]),t}(),Ei=function(){function t(e){i(this,t),this.w=e.w,this.annoCtx=e,this.helpers=new Ii(this.annoCtx),this.axesUtils=new Ri(this.annoCtx)}return s(t,[{key:"addYaxisAnnotation",value:function(t,e,i){var a,s=this.w,r=t.strokeDashArray,n=this.helpers.getY1Y2("y1",t),o=n.yP,l=n.clipped,h=!0,c=!1,d=t.label.text;if(null===t.y2||void 0===t.y2){if(!l){c=!0;var u=this.annoCtx.graphics.drawLine(0+t.offsetX,o+t.offsetY,this._getYAxisAnnotationWidth(t),o+t.offsetY,t.borderColor,r,t.borderWidth);e.appendChild(u.node),t.id&&u.node.classList.add(t.id)}}else{if(a=(n=this.helpers.getY1Y2("y2",t)).yP,h=n.clipped,a>o){var g=o;o=a,a=g}if(!l||!h){c=!0;var p=this.annoCtx.graphics.drawRect(0+t.offsetX,a+t.offsetY,this._getYAxisAnnotationWidth(t),o-a,0,t.fillColor,t.opacity,1,t.borderColor,r);p.node.classList.add("apexcharts-annotation-rect"),p.attr("clip-path","url(#gridRectMask".concat(s.globals.cuid,")")),e.appendChild(p.node),t.id&&p.node.classList.add(t.id)}}if(c){var f="right"===t.label.position?s.globals.gridWidth:"center"===t.label.position?s.globals.gridWidth/2:0,x=this.annoCtx.graphics.drawText({x:f+t.label.offsetX,y:(null!=a?a:o)+t.label.offsetY-3,text:d,textAnchor:t.label.textAnchor,fontSize:t.label.style.fontSize,fontFamily:t.label.style.fontFamily,fontWeight:t.label.style.fontWeight,foreColor:t.label.style.color,cssClass:"apexcharts-yaxis-annotation-label ".concat(t.label.style.cssClass," ").concat(t.id?t.id:"")});x.attr({rel:i}),e.appendChild(x.node)}}},{key:"_getYAxisAnnotationWidth",value:function(t){var e=this.w;e.globals.gridWidth;return(t.width.indexOf("%")>-1?e.globals.gridWidth*parseInt(t.width,10)/100:parseInt(t.width,10))+t.offsetX}},{key:"drawYAxisAnnotations",value:function(){var t=this,e=this.w,i=this.annoCtx.graphics.group({class:"apexcharts-yaxis-annotations"});return e.config.annotations.yaxis.forEach((function(e,a){e.yAxisIndex=t.axesUtils.translateYAxisIndex(e.yAxisIndex),t.axesUtils.isYAxisHidden(e.yAxisIndex)&&t.axesUtils.yAxisAllSeriesCollapsed(e.yAxisIndex)||t.addYaxisAnnotation(e,i.node,a)})),i}}]),t}(),Yi=function(){function t(e){i(this,t),this.w=e.w,this.annoCtx=e,this.helpers=new Ii(this.annoCtx)}return s(t,[{key:"addPointAnnotation",value:function(t,e,i){if(!(this.w.globals.collapsedSeriesIndices.indexOf(t.seriesIndex)>-1)){var a=this.helpers.getX1X2("x1",t),s=a.x,r=a.clipped,n=(a=this.helpers.getY1Y2("y1",t)).yP,o=a.clipped;if(v.isNumber(s)&&!o&&!r){var l={pSize:t.marker.size,pointStrokeWidth:t.marker.strokeWidth,pointFillColor:t.marker.fillColor,pointStrokeColor:t.marker.strokeColor,shape:t.marker.shape,pRadius:t.marker.radius,class:"apexcharts-point-annotation-marker ".concat(t.marker.cssClass," ").concat(t.id?t.id:"")},h=this.annoCtx.graphics.drawMarker(s+t.marker.offsetX,n+t.marker.offsetY,l);e.appendChild(h.node);var c=t.label.text?t.label.text:"",d=this.annoCtx.graphics.drawText({x:s+t.label.offsetX,y:n+t.label.offsetY-t.marker.size-parseFloat(t.label.style.fontSize)/1.6,text:c,textAnchor:t.label.textAnchor,fontSize:t.label.style.fontSize,fontFamily:t.label.style.fontFamily,fontWeight:t.label.style.fontWeight,foreColor:t.label.style.color,cssClass:"apexcharts-point-annotation-label ".concat(t.label.style.cssClass," ").concat(t.id?t.id:"")});if(d.attr({rel:i}),e.appendChild(d.node),t.customSVG.SVG){var u=this.annoCtx.graphics.group({class:"apexcharts-point-annotations-custom-svg "+t.customSVG.cssClass});u.attr({transform:"translate(".concat(s+t.customSVG.offsetX,", ").concat(n+t.customSVG.offsetY,")")}),u.node.innerHTML=t.customSVG.SVG,e.appendChild(u.node)}if(t.image.path){var g=t.image.width?t.image.width:20,p=t.image.height?t.image.height:20;h=this.annoCtx.addImage({x:s+t.image.offsetX-g/2,y:n+t.image.offsetY-p/2,width:g,height:p,path:t.image.path,appendTo:".apexcharts-point-annotations"})}t.mouseEnter&&h.node.addEventListener("mouseenter",t.mouseEnter.bind(this,t)),t.mouseLeave&&h.node.addEventListener("mouseleave",t.mouseLeave.bind(this,t)),t.click&&h.node.addEventListener("click",t.click.bind(this,t))}}}},{key:"drawPointAnnotations",value:function(){var t=this,e=this.w,i=this.annoCtx.graphics.group({class:"apexcharts-point-annotations"});return e.config.annotations.points.map((function(e,a){t.addPointAnnotation(e,i.node,a)})),i}}]),t}();var Hi={name:"en",options:{months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],toolbar:{exportToSVG:"Download SVG",exportToPNG:"Download PNG",exportToCSV:"Download CSV",menu:"Menu",selection:"Selection",selectionZoom:"Selection Zoom",zoomIn:"Zoom In",zoomOut:"Zoom Out",pan:"Panning",reset:"Reset Zoom"}}},Oi=function(){function t(){i(this,t),this.yAxis={show:!0,showAlways:!1,showForNullSeries:!0,seriesName:void 0,opposite:!1,reversed:!1,logarithmic:!1,logBase:10,tickAmount:void 0,stepSize:void 0,forceNiceScale:!1,max:void 0,min:void 0,floating:!1,decimalsInFloat:void 0,labels:{show:!0,showDuplicates:!1,minWidth:0,maxWidth:160,offsetX:0,offsetY:0,align:void 0,rotate:0,padding:20,style:{colors:[],fontSize:"11px",fontWeight:400,fontFamily:void 0,cssClass:""},formatter:void 0},axisBorder:{show:!1,color:"#e0e0e0",width:1,offsetX:0,offsetY:0},axisTicks:{show:!1,color:"#e0e0e0",width:6,offsetX:0,offsetY:0},title:{text:void 0,rotate:-90,offsetY:0,offsetX:0,style:{color:void 0,fontSize:"11px",fontWeight:900,fontFamily:void 0,cssClass:""}},tooltip:{enabled:!1,offsetX:0},crosshairs:{show:!0,position:"front",stroke:{color:"#b6b6b6",width:1,dashArray:0}}},this.pointAnnotation={id:void 0,x:0,y:null,yAxisIndex:0,seriesIndex:void 0,mouseEnter:void 0,mouseLeave:void 0,click:void 0,marker:{size:4,fillColor:"#fff",strokeWidth:2,strokeColor:"#333",shape:"circle",offsetX:0,offsetY:0,cssClass:""},label:{borderColor:"#c2c2c2",borderWidth:1,borderRadius:2,text:void 0,textAnchor:"middle",offsetX:0,offsetY:0,mouseEnter:void 0,mouseLeave:void 0,click:void 0,style:{background:"#fff",color:void 0,fontSize:"11px",fontFamily:void 0,fontWeight:400,cssClass:"",padding:{left:5,right:5,top:2,bottom:2}}},customSVG:{SVG:void 0,cssClass:void 0,offsetX:0,offsetY:0},image:{path:void 0,width:20,height:20,offsetX:0,offsetY:0}},this.yAxisAnnotation={id:void 0,y:0,y2:null,strokeDashArray:1,fillColor:"#c2c2c2",borderColor:"#c2c2c2",borderWidth:1,opacity:.3,offsetX:0,offsetY:0,width:"100%",yAxisIndex:0,label:{borderColor:"#c2c2c2",borderWidth:1,borderRadius:2,text:void 0,textAnchor:"end",position:"right",offsetX:0,offsetY:-3,mouseEnter:void 0,mouseLeave:void 0,click:void 0,style:{background:"#fff",color:void 0,fontSize:"11px",fontFamily:void 0,fontWeight:400,cssClass:"",padding:{left:5,right:5,top:2,bottom:2}}}},this.xAxisAnnotation={id:void 0,x:0,x2:null,strokeDashArray:1,fillColor:"#c2c2c2",borderColor:"#c2c2c2",borderWidth:1,opacity:.3,offsetX:0,offsetY:0,label:{borderColor:"#c2c2c2",borderWidth:1,borderRadius:2,text:void 0,textAnchor:"middle",orientation:"vertical",position:"top",offsetX:0,offsetY:0,mouseEnter:void 0,mouseLeave:void 0,click:void 0,style:{background:"#fff",color:void 0,fontSize:"11px",fontFamily:void 0,fontWeight:400,cssClass:"",padding:{left:5,right:5,top:2,bottom:2}}}},this.text={x:0,y:0,text:"",textAnchor:"start",foreColor:void 0,fontSize:"13px",fontFamily:void 0,fontWeight:400,appendTo:".apexcharts-annotations",backgroundColor:"transparent",borderColor:"#c2c2c2",borderRadius:0,borderWidth:0,paddingLeft:4,paddingRight:4,paddingTop:2,paddingBottom:2}}return s(t,[{key:"init",value:function(){return{annotations:{yaxis:[this.yAxisAnnotation],xaxis:[this.xAxisAnnotation],points:[this.pointAnnotation],texts:[],images:[],shapes:[]},chart:{animations:{enabled:!0,speed:800,animateGradually:{delay:150,enabled:!0},dynamicAnimation:{enabled:!0,speed:350}},background:"",locales:[Hi],defaultLocale:"en",dropShadow:{enabled:!1,enabledOnSeries:void 0,top:2,left:2,blur:4,color:"#000",opacity:.7},events:{animationEnd:void 0,beforeMount:void 0,mounted:void 0,updated:void 0,click:void 0,mouseMove:void 0,mouseLeave:void 0,xAxisLabelClick:void 0,legendClick:void 0,markerClick:void 0,selection:void 0,dataPointSelection:void 0,dataPointMouseEnter:void 0,dataPointMouseLeave:void 0,beforeZoom:void 0,beforeResetZoom:void 0,zoomed:void 0,scrolled:void 0,brushScrolled:void 0},foreColor:"#373d3f",fontFamily:"Helvetica, Arial, sans-serif",height:"auto",parentHeightOffset:15,redrawOnParentResize:!0,redrawOnWindowResize:!0,id:void 0,group:void 0,nonce:void 0,offsetX:0,offsetY:0,selection:{enabled:!1,type:"x",fill:{color:"#24292e",opacity:.1},stroke:{width:1,color:"#24292e",opacity:.4,dashArray:3},xaxis:{min:void 0,max:void 0},yaxis:{min:void 0,max:void 0}},sparkline:{enabled:!1},brush:{enabled:!1,autoScaleYaxis:!0,target:void 0,targets:void 0},stacked:!1,stackOnlyBar:!0,stackType:"normal",toolbar:{show:!0,offsetX:0,offsetY:0,tools:{download:!0,selection:!0,zoom:!0,zoomin:!0,zoomout:!0,pan:!0,reset:!0,customIcons:[]},export:{csv:{filename:void 0,columnDelimiter:",",headerCategory:"category",headerValue:"value",categoryFormatter:void 0,valueFormatter:void 0},png:{filename:void 0},svg:{filename:void 0},scale:void 0,width:void 0},autoSelected:"zoom"},type:"line",width:"100%",zoom:{enabled:!0,type:"x",autoScaleYaxis:!1,allowMouseWheelZoom:!0,zoomedArea:{fill:{color:"#90CAF9",opacity:.4},stroke:{color:"#0D47A1",opacity:.4,width:1}}}},plotOptions:{line:{isSlopeChart:!1,colors:{threshold:0,colorAboveThreshold:void 0,colorBelowThreshold:void 0}},area:{fillTo:"origin"},bar:{horizontal:!1,columnWidth:"70%",barHeight:"70%",distributed:!1,borderRadius:0,borderRadiusApplication:"around",borderRadiusWhenStacked:"last",rangeBarOverlap:!0,rangeBarGroupRows:!1,hideZeroBarsWhenGrouped:!1,isDumbbell:!1,dumbbellColors:void 0,isFunnel:!1,isFunnel3d:!0,colors:{ranges:[],backgroundBarColors:[],backgroundBarOpacity:1,backgroundBarRadius:0},dataLabels:{position:"top",maxItems:100,hideOverflowingLabels:!0,orientation:"horizontal",total:{enabled:!1,formatter:void 0,offsetX:0,offsetY:0,style:{color:"#373d3f",fontSize:"12px",fontFamily:void 0,fontWeight:600}}}},bubble:{zScaling:!0,minBubbleRadius:void 0,maxBubbleRadius:void 0},candlestick:{colors:{upward:"#00B746",downward:"#EF403C"},wick:{useFillColor:!0}},boxPlot:{colors:{upper:"#00E396",lower:"#008FFB"}},heatmap:{radius:2,enableShades:!0,shadeIntensity:.5,reverseNegativeShade:!1,distributed:!1,useFillColorAsStroke:!1,colorScale:{inverse:!1,ranges:[],min:void 0,max:void 0}},treemap:{enableShades:!0,shadeIntensity:.5,distributed:!1,reverseNegativeShade:!1,useFillColorAsStroke:!1,borderRadius:4,dataLabels:{format:"scale"},colorScale:{inverse:!1,ranges:[],min:void 0,max:void 0},seriesTitle:{show:!0,offsetY:1,offsetX:1,borderColor:"#000",borderWidth:1,borderRadius:2,style:{background:"rgba(0, 0, 0, 0.6)",color:"#fff",fontSize:"12px",fontFamily:void 0,fontWeight:400,cssClass:"",padding:{left:6,right:6,top:2,bottom:2}}}},radialBar:{inverseOrder:!1,startAngle:0,endAngle:360,offsetX:0,offsetY:0,hollow:{margin:5,size:"50%",background:"transparent",image:void 0,imageWidth:150,imageHeight:150,imageOffsetX:0,imageOffsetY:0,imageClipped:!0,position:"front",dropShadow:{enabled:!1,top:0,left:0,blur:3,color:"#000",opacity:.5}},track:{show:!0,startAngle:void 0,endAngle:void 0,background:"#f2f2f2",strokeWidth:"97%",opacity:1,margin:5,dropShadow:{enabled:!1,top:0,left:0,blur:3,color:"#000",opacity:.5}},dataLabels:{show:!0,name:{show:!0,fontSize:"16px",fontFamily:void 0,fontWeight:600,color:void 0,offsetY:0,formatter:function(t){return t}},value:{show:!0,fontSize:"14px",fontFamily:void 0,fontWeight:400,color:void 0,offsetY:16,formatter:function(t){return t+"%"}},total:{show:!1,label:"Total",fontSize:"16px",fontWeight:600,fontFamily:void 0,color:void 0,formatter:function(t){return t.globals.seriesTotals.reduce((function(t,e){return t+e}),0)/t.globals.series.length+"%"}}},barLabels:{enabled:!1,offsetX:0,offsetY:0,useSeriesColors:!0,fontFamily:void 0,fontWeight:600,fontSize:"16px",formatter:function(t){return t},onClick:void 0}},pie:{customScale:1,offsetX:0,offsetY:0,startAngle:0,endAngle:360,expandOnClick:!0,dataLabels:{offset:0,minAngleToShowLabel:10},donut:{size:"65%",background:"transparent",labels:{show:!1,name:{show:!0,fontSize:"16px",fontFamily:void 0,fontWeight:600,color:void 0,offsetY:-10,formatter:function(t){return t}},value:{show:!0,fontSize:"20px",fontFamily:void 0,fontWeight:400,color:void 0,offsetY:10,formatter:function(t){return t}},total:{show:!1,showAlways:!1,label:"Total",fontSize:"16px",fontWeight:400,fontFamily:void 0,color:void 0,formatter:function(t){return t.globals.seriesTotals.reduce((function(t,e){return t+e}),0)}}}}},polarArea:{rings:{strokeWidth:1,strokeColor:"#e8e8e8"},spokes:{strokeWidth:1,connectorColors:"#e8e8e8"}},radar:{size:void 0,offsetX:0,offsetY:0,polygons:{strokeWidth:1,strokeColors:"#e8e8e8",connectorColors:"#e8e8e8",fill:{colors:void 0}}}},colors:void 0,dataLabels:{enabled:!0,enabledOnSeries:void 0,formatter:function(t){return null!==t?t:""},textAnchor:"middle",distributed:!1,offsetX:0,offsetY:0,style:{fontSize:"12px",fontFamily:void 0,fontWeight:600,colors:void 0},background:{enabled:!0,foreColor:"#fff",borderRadius:2,padding:4,opacity:.9,borderWidth:1,borderColor:"#fff",dropShadow:{enabled:!1,top:1,left:1,blur:1,color:"#000",opacity:.8}},dropShadow:{enabled:!1,top:1,left:1,blur:1,color:"#000",opacity:.8}},fill:{type:"solid",colors:void 0,opacity:.85,gradient:{shade:"dark",type:"horizontal",shadeIntensity:.5,gradientToColors:void 0,inverseColors:!0,opacityFrom:1,opacityTo:1,stops:[0,50,100],colorStops:[]},image:{src:[],width:void 0,height:void 0},pattern:{style:"squares",width:6,height:6,strokeWidth:2}},forecastDataPoints:{count:0,fillOpacity:.5,strokeWidth:void 0,dashArray:4},grid:{show:!0,borderColor:"#e0e0e0",strokeDashArray:0,position:"back",xaxis:{lines:{show:!1}},yaxis:{lines:{show:!0}},row:{colors:void 0,opacity:.5},column:{colors:void 0,opacity:.5},padding:{top:0,right:10,bottom:0,left:12}},labels:[],legend:{show:!0,showForSingleSeries:!1,showForNullSeries:!0,showForZeroSeries:!0,floating:!1,position:"bottom",horizontalAlign:"center",inverseOrder:!1,fontSize:"12px",fontFamily:void 0,fontWeight:400,width:void 0,height:void 0,formatter:void 0,tooltipHoverFormatter:void 0,offsetX:-20,offsetY:4,customLegendItems:[],clusterGroupedSeries:!0,clusterGroupedSeriesOrientation:"vertical",labels:{colors:void 0,useSeriesColors:!1},markers:{size:7,fillColors:void 0,strokeWidth:1,shape:void 0,offsetX:0,offsetY:0,customHTML:void 0,onClick:void 0},itemMargin:{horizontal:5,vertical:4},onItemClick:{toggleDataSeries:!0},onItemHover:{highlightDataSeries:!0}},markers:{discrete:[],size:0,colors:void 0,strokeColors:"#fff",strokeWidth:2,strokeOpacity:.9,strokeDashArray:0,fillOpacity:1,shape:"circle",offsetX:0,offsetY:0,showNullDataPoints:!0,onClick:void 0,onDblClick:void 0,hover:{size:void 0,sizeOffset:3}},noData:{text:void 0,align:"center",verticalAlign:"middle",offsetX:0,offsetY:0,style:{color:void 0,fontSize:"14px",fontFamily:void 0}},responsive:[],series:void 0,states:{hover:{filter:{type:"lighten"}},active:{allowMultipleDataPointsSelection:!1,filter:{type:"darken"}}},title:{text:void 0,align:"left",margin:5,offsetX:0,offsetY:0,floating:!1,style:{fontSize:"14px",fontWeight:900,fontFamily:void 0,color:void 0}},subtitle:{text:void 0,align:"left",margin:5,offsetX:0,offsetY:30,floating:!1,style:{fontSize:"12px",fontWeight:400,fontFamily:void 0,color:void 0}},stroke:{show:!0,curve:"smooth",lineCap:"butt",width:2,colors:void 0,dashArray:0,fill:{type:"solid",colors:void 0,opacity:.85,gradient:{shade:"dark",type:"horizontal",shadeIntensity:.5,gradientToColors:void 0,inverseColors:!0,opacityFrom:1,opacityTo:1,stops:[0,50,100],colorStops:[]}}},tooltip:{enabled:!0,enabledOnSeries:void 0,shared:!0,hideEmptySeries:!1,followCursor:!1,intersect:!1,inverseOrder:!1,custom:void 0,fillSeriesColor:!1,theme:"light",cssClass:"",style:{fontSize:"12px",fontFamily:void 0},onDatasetHover:{highlightDataSeries:!1},x:{show:!0,format:"dd MMM",formatter:void 0},y:{formatter:void 0,title:{formatter:function(t){return t?t+": ":""}}},z:{formatter:void 0,title:"Size: "},marker:{show:!0,fillColors:void 0},items:{display:"flex"},fixed:{enabled:!1,position:"topRight",offsetX:0,offsetY:0}},xaxis:{type:"category",categories:[],convertedCatToNumeric:!1,offsetX:0,offsetY:0,overwriteCategories:void 0,labels:{show:!0,rotate:-45,rotateAlways:!1,hideOverlappingLabels:!0,trim:!1,minHeight:void 0,maxHeight:120,showDuplicates:!0,style:{colors:[],fontSize:"12px",fontWeight:400,fontFamily:void 0,cssClass:""},offsetX:0,offsetY:0,format:void 0,formatter:void 0,datetimeUTC:!0,datetimeFormatter:{year:"yyyy",month:"MMM 'yy",day:"dd MMM",hour:"HH:mm",minute:"HH:mm:ss",second:"HH:mm:ss"}},group:{groups:[],style:{colors:[],fontSize:"12px",fontWeight:400,fontFamily:void 0,cssClass:""}},axisBorder:{show:!0,color:"#e0e0e0",width:"100%",height:1,offsetX:0,offsetY:0},axisTicks:{show:!0,color:"#e0e0e0",height:6,offsetX:0,offsetY:0},stepSize:void 0,tickAmount:void 0,tickPlacement:"on",min:void 0,max:void 0,range:void 0,floating:!1,decimalsInFloat:void 0,position:"bottom",title:{text:void 0,offsetX:0,offsetY:0,style:{color:void 0,fontSize:"12px",fontWeight:900,fontFamily:void 0,cssClass:""}},crosshairs:{show:!0,width:1,position:"back",opacity:.9,stroke:{color:"#b6b6b6",width:1,dashArray:3},fill:{type:"solid",color:"#B1B9C4",gradient:{colorFrom:"#D8E3F0",colorTo:"#BED1E6",stops:[0,100],opacityFrom:.4,opacityTo:.5}},dropShadow:{enabled:!1,left:0,top:0,blur:1,opacity:.8}},tooltip:{enabled:!0,offsetY:0,formatter:void 0,style:{fontSize:"12px",fontFamily:void 0}}},yaxis:this.yAxis,theme:{mode:"",palette:"palette1",monochrome:{enabled:!1,color:"#008FFB",shadeTo:"light",shadeIntensity:.65}}}}}]),t}(),Fi=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.graphics=new Mi(this.ctx),this.w.globals.isBarHorizontal&&(this.invertAxis=!0),this.helpers=new Ii(this),this.xAxisAnnotations=new Ti(this),this.yAxisAnnotations=new Ei(this),this.pointsAnnotations=new Yi(this),this.w.globals.isBarHorizontal&&this.w.config.yaxis[0].reversed&&(this.inversedReversedAxis=!0),this.xDivision=this.w.globals.gridWidth/this.w.globals.dataPoints}return s(t,[{key:"drawAxesAnnotations",value:function(){var t=this.w;if(t.globals.axisCharts&&t.globals.dataPoints){for(var e=this.yAxisAnnotations.drawYAxisAnnotations(),i=this.xAxisAnnotations.drawXAxisAnnotations(),a=this.pointsAnnotations.drawPointAnnotations(),s=t.config.chart.animations.enabled,r=[e,i,a],n=[i.node,e.node,a.node],o=0;o<3;o++)t.globals.dom.elGraphical.add(r[o]),!s||t.globals.resized||t.globals.dataChanged||"scatter"!==t.config.chart.type&&"bubble"!==t.config.chart.type&&t.globals.dataPoints>1&&n[o].classList.add("apexcharts-element-hidden"),t.globals.delayedElements.push({el:n[o],index:0});this.helpers.annotationsBackground()}}},{key:"drawImageAnnos",value:function(){var t=this;this.w.config.annotations.images.map((function(e,i){t.addImage(e,i)}))}},{key:"drawTextAnnos",value:function(){var t=this;this.w.config.annotations.texts.map((function(e,i){t.addText(e,i)}))}},{key:"addXaxisAnnotation",value:function(t,e,i){this.xAxisAnnotations.addXaxisAnnotation(t,e,i)}},{key:"addYaxisAnnotation",value:function(t,e,i){this.yAxisAnnotations.addYaxisAnnotation(t,e,i)}},{key:"addPointAnnotation",value:function(t,e,i){this.pointsAnnotations.addPointAnnotation(t,e,i)}},{key:"addText",value:function(t,e){var i=t.x,a=t.y,s=t.text,r=t.textAnchor,n=t.foreColor,o=t.fontSize,l=t.fontFamily,h=t.fontWeight,c=t.cssClass,d=t.backgroundColor,u=t.borderWidth,g=t.strokeDashArray,p=t.borderRadius,f=t.borderColor,x=t.appendTo,b=void 0===x?".apexcharts-svg":x,m=t.paddingLeft,v=void 0===m?4:m,y=t.paddingRight,w=void 0===y?4:y,k=t.paddingBottom,A=void 0===k?2:k,C=t.paddingTop,S=void 0===C?2:C,L=this.w,M=this.graphics.drawText({x:i,y:a,text:s,textAnchor:r||"start",fontSize:o||"12px",fontWeight:h||"regular",fontFamily:l||L.config.chart.fontFamily,foreColor:n||L.config.chart.foreColor,cssClass:c}),P=L.globals.dom.baseEl.querySelector(b);P&&P.appendChild(M.node);var I=M.bbox();if(s){var T=this.graphics.drawRect(I.x-v,I.y-S,I.width+v+w,I.height+A+S,p,d||"transparent",1,u,f,g);P.insertBefore(T.node,M.node)}}},{key:"addImage",value:function(t,e){var i=this.w,a=t.path,s=t.x,r=void 0===s?0:s,n=t.y,o=void 0===n?0:n,l=t.width,h=void 0===l?20:l,c=t.height,d=void 0===c?20:c,u=t.appendTo,g=void 0===u?".apexcharts-svg":u,p=i.globals.dom.Paper.image(a);p.size(h,d).move(r,o);var f=i.globals.dom.baseEl.querySelector(g);return f&&f.appendChild(p.node),p}},{key:"addXaxisAnnotationExternal",value:function(t,e,i){return this.addAnnotationExternal({params:t,pushToMemory:e,context:i,type:"xaxis",contextMethod:i.addXaxisAnnotation}),i}},{key:"addYaxisAnnotationExternal",value:function(t,e,i){return this.addAnnotationExternal({params:t,pushToMemory:e,context:i,type:"yaxis",contextMethod:i.addYaxisAnnotation}),i}},{key:"addPointAnnotationExternal",value:function(t,e,i){return void 0===this.invertAxis&&(this.invertAxis=i.w.globals.isBarHorizontal),this.addAnnotationExternal({params:t,pushToMemory:e,context:i,type:"point",contextMethod:i.addPointAnnotation}),i}},{key:"addAnnotationExternal",value:function(t){var e=t.params,i=t.pushToMemory,a=t.context,s=t.type,r=t.contextMethod,n=a,o=n.w,l=o.globals.dom.baseEl.querySelector(".apexcharts-".concat(s,"-annotations")),h=l.childNodes.length+1,c=new Oi,d=Object.assign({},"xaxis"===s?c.xAxisAnnotation:"yaxis"===s?c.yAxisAnnotation:c.pointAnnotation),u=v.extend(d,e);switch(s){case"xaxis":this.addXaxisAnnotation(u,l,h);break;case"yaxis":this.addYaxisAnnotation(u,l,h);break;case"point":this.addPointAnnotation(u,l,h)}var g=o.globals.dom.baseEl.querySelector(".apexcharts-".concat(s,"-annotations .apexcharts-").concat(s,"-annotation-label[rel='").concat(h,"']")),p=this.helpers.addBackgroundToAnno(g,u);return p&&l.insertBefore(p.node,g),i&&o.globals.memory.methodsToExec.push({context:n,id:u.id?u.id:v.randomId(),method:r,label:"addAnnotation",params:e}),a}},{key:"clearAnnotations",value:function(t){for(var e=t.w,i=e.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxis-annotations, .apexcharts-xaxis-annotations, .apexcharts-point-annotations"),a=e.globals.memory.methodsToExec.length-1;a>=0;a--)"addText"!==e.globals.memory.methodsToExec[a].label&&"addAnnotation"!==e.globals.memory.methodsToExec[a].label||e.globals.memory.methodsToExec.splice(a,1);i=v.listToArray(i),Array.prototype.forEach.call(i,(function(t){for(;t.firstChild;)t.removeChild(t.firstChild)}))}},{key:"removeAnnotation",value:function(t,e){var i=t.w,a=i.globals.dom.baseEl.querySelectorAll(".".concat(e));a&&(i.globals.memory.methodsToExec.map((function(t,a){t.id===e&&i.globals.memory.methodsToExec.splice(a,1)})),Array.prototype.forEach.call(a,(function(t){t.parentElement.removeChild(t)})))}}]),t}(),Di=function(t){var e,i=t.isTimeline,a=t.ctx,s=t.seriesIndex,r=t.dataPointIndex,n=t.y1,o=t.y2,l=t.w,h=l.globals.seriesRangeStart[s][r],c=l.globals.seriesRangeEnd[s][r],d=l.globals.labels[r],u=l.config.series[s].name?l.config.series[s].name:"",g=l.globals.ttKeyFormatter,p=l.config.tooltip.y.title.formatter,f={w:l,seriesIndex:s,dataPointIndex:r,start:h,end:c};("function"==typeof p&&(u=p(u,f)),null!==(e=l.config.series[s].data[r])&&void 0!==e&&e.x&&(d=l.config.series[s].data[r].x),i)||"datetime"===l.config.xaxis.type&&(d=new Xi(a).xLabelFormat(l.globals.ttKeyFormatter,d,d,{i:void 0,dateFormatter:new zi(a).formatDate,w:l}));"function"==typeof g&&(d=g(d,f)),Number.isFinite(n)&&Number.isFinite(o)&&(h=n,c=o);var x="",b="",m=l.globals.colors[s];if(void 0===l.config.tooltip.x.formatter)if("datetime"===l.config.xaxis.type){var v=new zi(a);x=v.formatDate(v.getDate(h),l.config.tooltip.x.format),b=v.formatDate(v.getDate(c),l.config.tooltip.x.format)}else x=h,b=c;else x=l.config.tooltip.x.formatter(h),b=l.config.tooltip.x.formatter(c);return{start:h,end:c,startVal:x,endVal:b,ylabel:d,color:m,seriesName:u}},_i=function(t){var e=t.color,i=t.seriesName,a=t.ylabel,s=t.start,r=t.end,n=t.seriesIndex,o=t.dataPointIndex,l=t.ctx.tooltip.tooltipLabels.getFormatters(n);s=l.yLbFormatter(s),r=l.yLbFormatter(r);var h=l.yLbFormatter(t.w.globals.series[n][o]),c='\n '.concat(s,'\n - \n ').concat(r,"\n ");return'
'+(i||"")+'
'+a+": "+(t.w.globals.comboCharts?"rangeArea"===t.w.config.series[n].type||"rangeBar"===t.w.config.series[n].type?c:"".concat(h,""):c)+"
"},Ni=function(){function t(e){i(this,t),this.opts=e}return s(t,[{key:"hideYAxis",value:function(){this.opts.yaxis[0].show=!1,this.opts.yaxis[0].title.text="",this.opts.yaxis[0].axisBorder.show=!1,this.opts.yaxis[0].axisTicks.show=!1,this.opts.yaxis[0].floating=!0}},{key:"line",value:function(){return{dataLabels:{enabled:!1},stroke:{width:5,curve:"straight"},markers:{size:0,hover:{sizeOffset:6}},xaxis:{crosshairs:{width:1}}}}},{key:"sparkline",value:function(t){this.hideYAxis();return v.extend(t,{grid:{show:!1,padding:{left:0,right:0,top:0,bottom:0}},legend:{show:!1},xaxis:{labels:{show:!1},tooltip:{enabled:!1},axisBorder:{show:!1},axisTicks:{show:!1}},chart:{toolbar:{show:!1},zoom:{enabled:!1}},dataLabels:{enabled:!1}})}},{key:"slope",value:function(){return this.hideYAxis(),{chart:{toolbar:{show:!1},zoom:{enabled:!1}},dataLabels:{enabled:!0,formatter:function(t,e){var i=e.w.config.series[e.seriesIndex].name;return null!==t?i+": "+t:""},background:{enabled:!1},offsetX:-5},grid:{xaxis:{lines:{show:!0}},yaxis:{lines:{show:!1}}},xaxis:{position:"top",labels:{style:{fontSize:14,fontWeight:900}},tooltip:{enabled:!1},crosshairs:{show:!1}},markers:{size:8,hover:{sizeOffset:1}},legend:{show:!1},tooltip:{shared:!1,intersect:!0,followCursor:!0},stroke:{width:5,curve:"straight"}}}},{key:"bar",value:function(){return{chart:{stacked:!1},plotOptions:{bar:{dataLabels:{position:"center"}}},dataLabels:{style:{colors:["#fff"]},background:{enabled:!1}},stroke:{width:0,lineCap:"square"},fill:{opacity:.85},legend:{markers:{shape:"square"}},tooltip:{shared:!1,intersect:!0},xaxis:{tooltip:{enabled:!1},tickPlacement:"between",crosshairs:{width:"barWidth",position:"back",fill:{type:"gradient"},dropShadow:{enabled:!1},stroke:{width:0}}}}}},{key:"funnel",value:function(){return this.hideYAxis(),u(u({},this.bar()),{},{chart:{animations:{speed:800,animateGradually:{enabled:!1}}},plotOptions:{bar:{horizontal:!0,borderRadiusApplication:"around",borderRadius:0,dataLabels:{position:"center"}}},grid:{show:!1,padding:{left:0,right:0}},xaxis:{labels:{show:!1},tooltip:{enabled:!1},axisBorder:{show:!1},axisTicks:{show:!1}}})}},{key:"candlestick",value:function(){var t=this;return{stroke:{width:1,colors:["#333"]},fill:{opacity:1},dataLabels:{enabled:!1},tooltip:{shared:!0,custom:function(e){var i=e.seriesIndex,a=e.dataPointIndex,s=e.w;return t._getBoxTooltip(s,i,a,["Open","High","","Low","Close"],"candlestick")}},states:{active:{filter:{type:"none"}}},xaxis:{crosshairs:{width:1}}}}},{key:"boxPlot",value:function(){var t=this;return{chart:{animations:{dynamicAnimation:{enabled:!1}}},stroke:{width:1,colors:["#24292e"]},dataLabels:{enabled:!1},tooltip:{shared:!0,custom:function(e){var i=e.seriesIndex,a=e.dataPointIndex,s=e.w;return t._getBoxTooltip(s,i,a,["Minimum","Q1","Median","Q3","Maximum"],"boxPlot")}},markers:{size:7,strokeWidth:1,strokeColors:"#111"},xaxis:{crosshairs:{width:1}}}}},{key:"rangeBar",value:function(){return{chart:{animations:{animateGradually:!1}},stroke:{width:0,lineCap:"square"},plotOptions:{bar:{borderRadius:0,dataLabels:{position:"center"}}},dataLabels:{enabled:!1,formatter:function(t,e){e.ctx;var i=e.seriesIndex,a=e.dataPointIndex,s=e.w,r=function(){var t=s.globals.seriesRangeStart[i][a];return s.globals.seriesRangeEnd[i][a]-t};return s.globals.comboCharts?"rangeBar"===s.config.series[i].type||"rangeArea"===s.config.series[i].type?r():t:r()},background:{enabled:!1},style:{colors:["#fff"]}},markers:{size:10},tooltip:{shared:!1,followCursor:!0,custom:function(t){return t.w.config.plotOptions&&t.w.config.plotOptions.bar&&t.w.config.plotOptions.bar.horizontal?function(t){var e=Di(u(u({},t),{},{isTimeline:!0})),i=e.color,a=e.seriesName,s=e.ylabel,r=e.startVal,n=e.endVal;return _i(u(u({},t),{},{color:i,seriesName:a,ylabel:s,start:r,end:n}))}(t):function(t){var e=Di(t),i=e.color,a=e.seriesName,s=e.ylabel,r=e.start,n=e.end;return _i(u(u({},t),{},{color:i,seriesName:a,ylabel:s,start:r,end:n}))}(t)}},xaxis:{tickPlacement:"between",tooltip:{enabled:!1},crosshairs:{stroke:{width:0}}}}}},{key:"dumbbell",value:function(t){var e,i;return null!==(e=t.plotOptions.bar)&&void 0!==e&&e.barHeight||(t.plotOptions.bar.barHeight=2),null!==(i=t.plotOptions.bar)&&void 0!==i&&i.columnWidth||(t.plotOptions.bar.columnWidth=2),t}},{key:"area",value:function(){return{stroke:{width:4,fill:{type:"solid",gradient:{inverseColors:!1,shade:"light",type:"vertical",opacityFrom:.65,opacityTo:.5,stops:[0,100,100]}}},fill:{type:"gradient",gradient:{inverseColors:!1,shade:"light",type:"vertical",opacityFrom:.65,opacityTo:.5,stops:[0,100,100]}},markers:{size:0,hover:{sizeOffset:6}},tooltip:{followCursor:!1}}}},{key:"rangeArea",value:function(){return{stroke:{curve:"straight",width:0},fill:{type:"solid",opacity:.6},markers:{size:0},states:{hover:{filter:{type:"none"}},active:{filter:{type:"none"}}},tooltip:{intersect:!1,shared:!0,followCursor:!0,custom:function(t){return function(t){var e=Di(t),i=e.color,a=e.seriesName,s=e.ylabel,r=e.start,n=e.end;return _i(u(u({},t),{},{color:i,seriesName:a,ylabel:s,start:r,end:n}))}(t)}}}}},{key:"brush",value:function(t){return v.extend(t,{chart:{toolbar:{autoSelected:"selection",show:!1},zoom:{enabled:!1}},dataLabels:{enabled:!1},stroke:{width:1},tooltip:{enabled:!1},xaxis:{tooltip:{enabled:!1}}})}},{key:"stacked100",value:function(t){t.dataLabels=t.dataLabels||{},t.dataLabels.formatter=t.dataLabels.formatter||void 0;var e=t.dataLabels.formatter;return t.yaxis.forEach((function(e,i){t.yaxis[i].min=0,t.yaxis[i].max=100})),"bar"===t.chart.type&&(t.dataLabels.formatter=e||function(t){return"number"==typeof t&&t?t.toFixed(0)+"%":t}),t}},{key:"stackedBars",value:function(){var t=this.bar();return u(u({},t),{},{plotOptions:u(u({},t.plotOptions),{},{bar:u(u({},t.plotOptions.bar),{},{borderRadiusApplication:"end",borderRadiusWhenStacked:"last"})})})}},{key:"convertCatToNumeric",value:function(t){return t.xaxis.convertedCatToNumeric=!0,t}},{key:"convertCatToNumericXaxis",value:function(t,e,i){t.xaxis.type="numeric",t.xaxis.labels=t.xaxis.labels||{},t.xaxis.labels.formatter=t.xaxis.labels.formatter||function(t){return v.isNumber(t)?Math.floor(t):t};var a=t.xaxis.labels.formatter,s=t.xaxis.categories&&t.xaxis.categories.length?t.xaxis.categories:t.labels;return i&&i.length&&(s=i.map((function(t){return Array.isArray(t)?t:String(t)}))),s&&s.length&&(t.xaxis.labels.formatter=function(t){return v.isNumber(t)?a(s[Math.floor(t)-1]):a(t)}),t.xaxis.categories=[],t.labels=[],t.xaxis.tickAmount=t.xaxis.tickAmount||"dataPoints",t}},{key:"bubble",value:function(){return{dataLabels:{style:{colors:["#fff"]}},tooltip:{shared:!1,intersect:!0},xaxis:{crosshairs:{width:0}},fill:{type:"solid",gradient:{shade:"light",inverse:!0,shadeIntensity:.55,opacityFrom:.4,opacityTo:.8}}}}},{key:"scatter",value:function(){return{dataLabels:{enabled:!1},tooltip:{shared:!1,intersect:!0},markers:{size:6,strokeWidth:1,hover:{sizeOffset:2}}}}},{key:"heatmap",value:function(){return{chart:{stacked:!1},fill:{opacity:1},dataLabels:{style:{colors:["#fff"]}},stroke:{colors:["#fff"]},tooltip:{followCursor:!0,marker:{show:!1},x:{show:!1}},legend:{position:"top",markers:{shape:"square"}},grid:{padding:{right:20}}}}},{key:"treemap",value:function(){return{chart:{zoom:{enabled:!1}},dataLabels:{style:{fontSize:14,fontWeight:600,colors:["#fff"]}},stroke:{show:!0,width:2,colors:["#fff"]},legend:{show:!1},fill:{opacity:1,gradient:{stops:[0,100]}},tooltip:{followCursor:!0,x:{show:!1}},grid:{padding:{left:0,right:0}},xaxis:{crosshairs:{show:!1},tooltip:{enabled:!1}}}}},{key:"pie",value:function(){return{chart:{toolbar:{show:!1}},plotOptions:{pie:{donut:{labels:{show:!1}}}},dataLabels:{formatter:function(t){return t.toFixed(1)+"%"},style:{colors:["#fff"]},background:{enabled:!1},dropShadow:{enabled:!0}},stroke:{colors:["#fff"]},fill:{opacity:1,gradient:{shade:"light",stops:[0,100]}},tooltip:{theme:"dark",fillSeriesColor:!0},legend:{position:"right"},grid:{padding:{left:0,right:0,top:0,bottom:0}}}}},{key:"donut",value:function(){return{chart:{toolbar:{show:!1}},dataLabels:{formatter:function(t){return t.toFixed(1)+"%"},style:{colors:["#fff"]},background:{enabled:!1},dropShadow:{enabled:!0}},stroke:{colors:["#fff"]},fill:{opacity:1,gradient:{shade:"light",shadeIntensity:.35,stops:[80,100],opacityFrom:1,opacityTo:1}},tooltip:{theme:"dark",fillSeriesColor:!0},legend:{position:"right"},grid:{padding:{left:0,right:0,top:0,bottom:0}}}}},{key:"polarArea",value:function(){return{chart:{toolbar:{show:!1}},dataLabels:{formatter:function(t){return t.toFixed(1)+"%"},enabled:!1},stroke:{show:!0,width:2},fill:{opacity:.7},tooltip:{theme:"dark",fillSeriesColor:!0},legend:{position:"right"},grid:{padding:{left:0,right:0,top:0,bottom:0}}}}},{key:"radar",value:function(){return this.opts.yaxis[0].labels.offsetY=this.opts.yaxis[0].labels.offsetY?this.opts.yaxis[0].labels.offsetY:6,{dataLabels:{enabled:!1,style:{fontSize:"11px"}},stroke:{width:2},markers:{size:5,strokeWidth:1,strokeOpacity:1},fill:{opacity:.2},tooltip:{shared:!1,intersect:!0,followCursor:!0},grid:{show:!1,padding:{left:0,right:0,top:0,bottom:0}},xaxis:{labels:{formatter:function(t){return t},style:{colors:["#a8a8a8"],fontSize:"11px"}},tooltip:{enabled:!1},crosshairs:{show:!1}}}}},{key:"radialBar",value:function(){return{chart:{animations:{dynamicAnimation:{enabled:!0,speed:800}},toolbar:{show:!1}},fill:{gradient:{shade:"dark",shadeIntensity:.4,inverseColors:!1,type:"diagonal2",opacityFrom:1,opacityTo:1,stops:[70,98,100]}},legend:{show:!1,position:"right"},tooltip:{enabled:!1,fillSeriesColor:!0},grid:{padding:{left:0,right:0,top:0,bottom:0}}}}},{key:"_getBoxTooltip",value:function(t,e,i,a,s){var r=t.globals.seriesCandleO[e][i],n=t.globals.seriesCandleH[e][i],o=t.globals.seriesCandleM[e][i],l=t.globals.seriesCandleL[e][i],h=t.globals.seriesCandleC[e][i];return t.config.series[e].type&&t.config.series[e].type!==s?'
\n '.concat(t.config.series[e].name?t.config.series[e].name:"series-"+(e+1),": ").concat(t.globals.series[e][i],"\n
"):'
')+"
".concat(a[0],': ')+r+"
"+"
".concat(a[1],': ')+n+"
"+(o?"
".concat(a[2],': ')+o+"
":"")+"
".concat(a[3],': ')+l+"
"+"
".concat(a[4],': ')+h+"
"}}]),t}(),Wi=function(){function t(e){i(this,t),this.opts=e}return s(t,[{key:"init",value:function(t){var e=t.responsiveOverride,i=this.opts,a=new Oi,s=new Ni(i);this.chartType=i.chart.type,i=this.extendYAxis(i),i=this.extendAnnotations(i);var r=a.init(),n={};if(i&&"object"===b(i)){var o,l,h,c,d,u,g,p,f,x,m={};m=-1!==["line","area","bar","candlestick","boxPlot","rangeBar","rangeArea","bubble","scatter","heatmap","treemap","pie","polarArea","donut","radar","radialBar"].indexOf(i.chart.type)?s[i.chart.type]():s.line(),null!==(o=i.plotOptions)&&void 0!==o&&null!==(l=o.bar)&&void 0!==l&&l.isFunnel&&(m=s.funnel()),i.chart.stacked&&"bar"===i.chart.type&&(m=s.stackedBars()),null!==(h=i.chart.brush)&&void 0!==h&&h.enabled&&(m=s.brush(m)),null!==(c=i.plotOptions)&&void 0!==c&&null!==(d=c.line)&&void 0!==d&&d.isSlopeChart&&(m=s.slope()),i.chart.stacked&&"100%"===i.chart.stackType&&(i=s.stacked100(i)),null!==(u=i.plotOptions)&&void 0!==u&&null!==(g=u.bar)&&void 0!==g&&g.isDumbbell&&(i=s.dumbbell(i)),this.checkForDarkTheme(window.Apex),this.checkForDarkTheme(i),i.xaxis=i.xaxis||window.Apex.xaxis||{},e||(i.xaxis.convertedCatToNumeric=!1),(null!==(p=(i=this.checkForCatToNumericXAxis(this.chartType,m,i)).chart.sparkline)&&void 0!==p&&p.enabled||null!==(f=window.Apex.chart)&&void 0!==f&&null!==(x=f.sparkline)&&void 0!==x&&x.enabled)&&(m=s.sparkline(m)),n=v.extend(r,m)}var y=v.extend(n,window.Apex);return r=v.extend(y,i),r=this.handleUserInputErrors(r)}},{key:"checkForCatToNumericXAxis",value:function(t,e,i){var a,s,r=new Ni(i),n=("bar"===t||"boxPlot"===t)&&(null===(a=i.plotOptions)||void 0===a||null===(s=a.bar)||void 0===s?void 0:s.horizontal),o="pie"===t||"polarArea"===t||"donut"===t||"radar"===t||"radialBar"===t||"heatmap"===t,l="datetime"!==i.xaxis.type&&"numeric"!==i.xaxis.type,h=i.xaxis.tickPlacement?i.xaxis.tickPlacement:e.xaxis&&e.xaxis.tickPlacement;return n||o||!l||"between"===h||(i=r.convertCatToNumeric(i)),i}},{key:"extendYAxis",value:function(t,e){var i=new Oi;(void 0===t.yaxis||!t.yaxis||Array.isArray(t.yaxis)&&0===t.yaxis.length)&&(t.yaxis={}),t.yaxis.constructor!==Array&&window.Apex.yaxis&&window.Apex.yaxis.constructor!==Array&&(t.yaxis=v.extend(t.yaxis,window.Apex.yaxis)),t.yaxis.constructor!==Array?t.yaxis=[v.extend(i.yAxis,t.yaxis)]:t.yaxis=v.extendArray(t.yaxis,i.yAxis);var a=!1;t.yaxis.forEach((function(t){t.logarithmic&&(a=!0)}));var s=t.series;return e&&!s&&(s=e.config.series),a&&s.length!==t.yaxis.length&&s.length&&(t.yaxis=s.map((function(e,a){if(e.name||(s[a].name="series-".concat(a+1)),t.yaxis[a])return t.yaxis[a].seriesName=s[a].name,t.yaxis[a];var r=v.extend(i.yAxis,t.yaxis[0]);return r.show=!1,r}))),a&&s.length>1&&s.length!==t.yaxis.length&&console.warn("A multi-series logarithmic chart should have equal number of series and y-axes"),t}},{key:"extendAnnotations",value:function(t){return void 0===t.annotations&&(t.annotations={},t.annotations.yaxis=[],t.annotations.xaxis=[],t.annotations.points=[]),t=this.extendYAxisAnnotations(t),t=this.extendXAxisAnnotations(t),t=this.extendPointAnnotations(t)}},{key:"extendYAxisAnnotations",value:function(t){var e=new Oi;return t.annotations.yaxis=v.extendArray(void 0!==t.annotations.yaxis?t.annotations.yaxis:[],e.yAxisAnnotation),t}},{key:"extendXAxisAnnotations",value:function(t){var e=new Oi;return t.annotations.xaxis=v.extendArray(void 0!==t.annotations.xaxis?t.annotations.xaxis:[],e.xAxisAnnotation),t}},{key:"extendPointAnnotations",value:function(t){var e=new Oi;return t.annotations.points=v.extendArray(void 0!==t.annotations.points?t.annotations.points:[],e.pointAnnotation),t}},{key:"checkForDarkTheme",value:function(t){t.theme&&"dark"===t.theme.mode&&(t.tooltip||(t.tooltip={}),"light"!==t.tooltip.theme&&(t.tooltip.theme="dark"),t.chart.foreColor||(t.chart.foreColor="#f6f7f8"),t.theme.palette||(t.theme.palette="palette4"))}},{key:"handleUserInputErrors",value:function(t){var e=t;if(e.tooltip.shared&&e.tooltip.intersect)throw new Error("tooltip.shared cannot be enabled when tooltip.intersect is true. Turn off any other option by setting it to false.");if("bar"===e.chart.type&&e.plotOptions.bar.horizontal){if(e.yaxis.length>1)throw new Error("Multiple Y Axis for bars are not supported. Switch to column chart by setting plotOptions.bar.horizontal=false");e.yaxis[0].reversed&&(e.yaxis[0].opposite=!0),e.xaxis.tooltip.enabled=!1,e.yaxis[0].tooltip.enabled=!1,e.chart.zoom.enabled=!1}return"bar"!==e.chart.type&&"rangeBar"!==e.chart.type||e.tooltip.shared&&"barWidth"===e.xaxis.crosshairs.width&&e.series.length>1&&(e.xaxis.crosshairs.width="tickWidth"),"candlestick"!==e.chart.type&&"boxPlot"!==e.chart.type||e.yaxis[0].reversed&&(console.warn("Reversed y-axis in ".concat(e.chart.type," chart is not supported.")),e.yaxis[0].reversed=!1),e}}]),t}(),Bi=function(){function t(){i(this,t)}return s(t,[{key:"initGlobalVars",value:function(t){t.series=[],t.seriesCandleO=[],t.seriesCandleH=[],t.seriesCandleM=[],t.seriesCandleL=[],t.seriesCandleC=[],t.seriesRangeStart=[],t.seriesRangeEnd=[],t.seriesRange=[],t.seriesPercent=[],t.seriesGoals=[],t.seriesX=[],t.seriesZ=[],t.seriesNames=[],t.seriesTotals=[],t.seriesLog=[],t.seriesColors=[],t.stackedSeriesTotals=[],t.seriesXvalues=[],t.seriesYvalues=[],t.labels=[],t.hasXaxisGroups=!1,t.groups=[],t.barGroups=[],t.lineGroups=[],t.areaGroups=[],t.hasSeriesGroups=!1,t.seriesGroups=[],t.categoryLabels=[],t.timescaleLabels=[],t.noLabelsProvided=!1,t.resizeTimer=null,t.selectionResizeTimer=null,t.lastWheelExecution=0,t.delayedElements=[],t.pointsArray=[],t.dataLabelsRects=[],t.isXNumeric=!1,t.skipLastTimelinelabel=!1,t.skipFirstTimelinelabel=!1,t.isDataXYZ=!1,t.isMultiLineX=!1,t.isMultipleYAxis=!1,t.maxY=-Number.MAX_VALUE,t.minY=Number.MIN_VALUE,t.minYArr=[],t.maxYArr=[],t.maxX=-Number.MAX_VALUE,t.minX=Number.MAX_VALUE,t.initialMaxX=-Number.MAX_VALUE,t.initialMinX=Number.MAX_VALUE,t.maxDate=0,t.minDate=Number.MAX_VALUE,t.minZ=Number.MAX_VALUE,t.maxZ=-Number.MAX_VALUE,t.minXDiff=Number.MAX_VALUE,t.yAxisScale=[],t.xAxisScale=null,t.xAxisTicksPositions=[],t.yLabelsCoords=[],t.yTitleCoords=[],t.barPadForNumericAxis=0,t.padHorizontal=0,t.xRange=0,t.yRange=[],t.zRange=0,t.dataPoints=0,t.xTickAmount=0,t.multiAxisTickAmount=0}},{key:"globalVars",value:function(t){return{chartID:null,cuid:null,events:{beforeMount:[],mounted:[],updated:[],clicked:[],selection:[],dataPointSelection:[],zoomed:[],scrolled:[]},colors:[],clientX:null,clientY:null,fill:{colors:[]},stroke:{colors:[]},dataLabels:{style:{colors:[]}},radarPolygons:{fill:{colors:[]}},markers:{colors:[],size:t.markers.size,largestSize:0},animationEnded:!1,isTouchDevice:"ontouchstart"in window||navigator.msMaxTouchPoints,isDirty:!1,isExecCalled:!1,initialConfig:null,initialSeries:[],lastXAxis:[],lastYAxis:[],columnSeries:null,labels:[],timescaleLabels:[],noLabelsProvided:!1,allSeriesCollapsed:!1,collapsedSeries:[],collapsedSeriesIndices:[],ancillaryCollapsedSeries:[],ancillaryCollapsedSeriesIndices:[],risingSeries:[],dataFormatXNumeric:!1,capturedSeriesIndex:-1,capturedDataPointIndex:-1,selectedDataPoints:[],invalidLogScale:!1,ignoreYAxisIndexes:[],maxValsInArrayIndex:0,radialSize:0,selection:void 0,zoomEnabled:"zoom"===t.chart.toolbar.autoSelected&&t.chart.toolbar.tools.zoom&&t.chart.zoom.enabled,panEnabled:"pan"===t.chart.toolbar.autoSelected&&t.chart.toolbar.tools.pan,selectionEnabled:"selection"===t.chart.toolbar.autoSelected&&t.chart.toolbar.tools.selection,yaxis:null,mousedown:!1,lastClientPosition:{},visibleXRange:void 0,yValueDecimal:0,total:0,SVGNS:"http://www.w3.org/2000/svg",svgWidth:0,svgHeight:0,noData:!1,locale:{},dom:{},memory:{methodsToExec:[]},shouldAnimate:!0,skipLastTimelinelabel:!1,skipFirstTimelinelabel:!1,delayedElements:[],axisCharts:!0,isDataXYZ:!1,isSlopeChart:t.plotOptions.line.isSlopeChart,resized:!1,resizeTimer:null,comboCharts:!1,dataChanged:!1,previousPaths:[],allSeriesHasEqualX:!0,pointsArray:[],dataLabelsRects:[],lastDrawnDataLabelsIndexes:[],hasNullValues:!1,zoomed:!1,gridWidth:0,gridHeight:0,rotateXLabels:!1,defaultLabels:!1,xLabelFormatter:void 0,yLabelFormatters:[],xaxisTooltipFormatter:void 0,ttKeyFormatter:void 0,ttVal:void 0,ttZFormatter:void 0,LINE_HEIGHT_RATIO:1.618,xAxisLabelsHeight:0,xAxisGroupLabelsHeight:0,xAxisLabelsWidth:0,yAxisLabelsWidth:0,scaleX:1,scaleY:1,translateX:0,translateY:0,translateYAxisX:[],yAxisWidths:[],translateXAxisY:0,translateXAxisX:0,tooltip:null,niceScaleAllowedMagMsd:[[1,1,2,5,5,5,10,10,10,10,10],[1,1,2,5,5,5,10,10,10,10,10]],niceScaleDefaultTicks:[1,2,4,4,6,6,6,6,6,6,6,6,6,6,6,6,6,6,12,12,12,12,12,12,12,12,12,24],seriesYAxisMap:[],seriesYAxisReverseMap:[]}}},{key:"init",value:function(t){var e=this.globalVars(t);return this.initGlobalVars(e),e.initialConfig=v.extend({},t),e.initialSeries=v.clone(t.series),e.lastXAxis=v.clone(e.initialConfig.xaxis),e.lastYAxis=v.clone(e.initialConfig.yaxis),e}}]),t}(),Gi=function(){function t(e){i(this,t),this.opts=e}return s(t,[{key:"init",value:function(){var t=new Wi(this.opts).init({responsiveOverride:!1});return{config:t,globals:(new Bi).init(t)}}}]),t}(),ji=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.opts=null,this.seriesIndex=0,this.patternIDs=[]}return s(t,[{key:"clippedImgArea",value:function(t){var e=this.w,i=e.config,a=parseInt(e.globals.gridWidth,10),s=parseInt(e.globals.gridHeight,10),r=a>s?a:s,n=t.image,o=0,l=0;void 0===t.width&&void 0===t.height?void 0!==i.fill.image.width&&void 0!==i.fill.image.height?(o=i.fill.image.width+1,l=i.fill.image.height):(o=r+1,l=r):(o=t.width,l=t.height);var h=document.createElementNS(e.globals.SVGNS,"pattern");Mi.setAttrs(h,{id:t.patternID,patternUnits:t.patternUnits?t.patternUnits:"userSpaceOnUse",width:o+"px",height:l+"px"});var c=document.createElementNS(e.globals.SVGNS,"image");h.appendChild(c),c.setAttributeNS(window.SVG.xlink,"href",n),Mi.setAttrs(c,{x:0,y:0,preserveAspectRatio:"none",width:o+"px",height:l+"px"}),c.style.opacity=t.opacity,e.globals.dom.elDefs.node.appendChild(h)}},{key:"getSeriesIndex",value:function(t){var e=this.w,i=e.config.chart.type;return("bar"===i||"rangeBar"===i)&&e.config.plotOptions.bar.distributed||"heatmap"===i||"treemap"===i?this.seriesIndex=t.seriesNumber:this.seriesIndex=t.seriesNumber%e.globals.series.length,this.seriesIndex}},{key:"computeColorStops",value:function(t,e){var i,a=this.w,s=null,n=null,o=r(t);try{for(o.s();!(i=o.n()).done;){var l=i.value;l>=e.threshold?(null===s||l>s)&&(s=l):(null===n||l-1?x=v.getOpacityFromRGBA(c):m=v.hexToRgba(v.rgb2hex(c),x),t.opacity&&(x=t.opacity),"pattern"===p&&(n=this.handlePatternFill({fillConfig:t.fillConfig,patternFill:n,fillColor:c,fillOpacity:x,defaultColor:m})),b){var y=f(l.fill.gradient.colorStops)||[],w=l.fill.gradient.type;h&&(y[this.seriesIndex]=this.computeColorStops(s.globals.series[this.seriesIndex],l.plotOptions.line.colors),w="vertical"),o=this.handleGradientFill({type:w,fillConfig:t.fillConfig,fillColor:c,fillOpacity:x,colorStops:y,i:this.seriesIndex})}if("image"===p){var k=l.fill.image.src,A=t.patternID?t.patternID:"",C="pattern".concat(s.globals.cuid).concat(t.seriesNumber+1).concat(A);-1===this.patternIDs.indexOf(C)&&(this.clippedImgArea({opacity:x,image:Array.isArray(k)?t.seriesNumber-1&&(p=v.getOpacityFromRGBA(g));var f=void 0===o.gradient.opacityTo?a:Array.isArray(o.gradient.opacityTo)?o.gradient.opacityTo[n]:o.gradient.opacityTo;if(void 0===o.gradient.gradientToColors||0===o.gradient.gradientToColors.length)d="dark"===o.gradient.shade?c.shadeColor(-1*parseFloat(o.gradient.shadeIntensity),i.indexOf("rgb")>-1?v.rgb2hex(i):i):c.shadeColor(parseFloat(o.gradient.shadeIntensity),i.indexOf("rgb")>-1?v.rgb2hex(i):i);else if(o.gradient.gradientToColors[l.seriesNumber]){var x=o.gradient.gradientToColors[l.seriesNumber];d=x,x.indexOf("rgba")>-1&&(f=v.getOpacityFromRGBA(x))}else d=i;if(o.gradient.gradientFrom&&(g=o.gradient.gradientFrom),o.gradient.gradientTo&&(d=o.gradient.gradientTo),o.gradient.inverseColors){var b=g;g=d,d=b}return g.indexOf("rgb")>-1&&(g=v.rgb2hex(g)),d.indexOf("rgb")>-1&&(d=v.rgb2hex(d)),h.drawGradient(e,g,d,p,f,l.size,o.gradient.stops,r,n)}}]),t}(),Vi=function(){function t(e,a){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"setGlobalMarkerSize",value:function(){var t=this.w;if(t.globals.markers.size=Array.isArray(t.config.markers.size)?t.config.markers.size:[t.config.markers.size],t.globals.markers.size.length>0){if(t.globals.markers.size.length0:h.config.markers.size>0)||n||p){m||(y+=" w".concat(v.randomId()));var w=this.getMarkerConfig({cssClass:y,seriesIndex:i,dataPointIndex:b});if(h.config.series[c].data[b]&&(h.config.series[c].data[b].fillColor&&(w.pointFillColor=h.config.series[c].data[b].fillColor),h.config.series[c].data[b].strokeColor&&(w.pointStrokeColor=h.config.series[c].data[b].strokeColor)),void 0!==s&&(w.pSize=s),(d.x[f]<-h.globals.markers.largestSize||d.x[f]>h.globals.gridWidth+h.globals.markers.largestSize||d.y[f]<-h.globals.markers.largestSize||d.y[f]>h.globals.gridHeight+h.globals.markers.largestSize)&&(w.pSize=0),!m)(h.globals.markers.size[i]>0||n||p)&&!u&&(u=g.group({class:n||p?"":"apexcharts-series-markers"})).attr("clip-path","url(#gridRectMarkerMask".concat(h.globals.cuid,")")),(x=g.drawMarker(d.x[f],d.y[f],w)).attr("rel",b),x.attr("j",b),x.attr("index",i),x.node.setAttribute("default-marker-size",w.pSize),new Li(this.ctx).setSelectionFilter(x,i,b),this.addEvents(x),u&&u.add(x)}else void 0===h.globals.pointsArray[i]&&(h.globals.pointsArray[i]=[]),h.globals.pointsArray[i].push([d.x[f],d.y[f]])}return u}},{key:"getMarkerConfig",value:function(t){var e=t.cssClass,i=t.seriesIndex,a=t.dataPointIndex,s=void 0===a?null:a,r=t.radius,n=void 0===r?null:r,o=t.size,l=void 0===o?null:o,h=t.strokeWidth,c=void 0===h?null:h,d=this.w,u=this.getMarkerStyle(i),g=null===l?d.globals.markers.size[i]:l,p=d.config.markers;return null!==s&&p.discrete.length&&p.discrete.map((function(t){t.seriesIndex===i&&t.dataPointIndex===s&&(u.pointStrokeColor=t.strokeColor,u.pointFillColor=t.fillColor,g=t.size,u.pointShape=t.shape)})),{pSize:null===n?g:n,pRadius:null!==n?n:p.radius,pointStrokeWidth:null!==c?c:Array.isArray(p.strokeWidth)?p.strokeWidth[i]:p.strokeWidth,pointStrokeColor:u.pointStrokeColor,pointFillColor:u.pointFillColor,shape:u.pointShape||(Array.isArray(p.shape)?p.shape[i]:p.shape),class:e,pointStrokeOpacity:Array.isArray(p.strokeOpacity)?p.strokeOpacity[i]:p.strokeOpacity,pointStrokeDashArray:Array.isArray(p.strokeDashArray)?p.strokeDashArray[i]:p.strokeDashArray,pointFillOpacity:Array.isArray(p.fillOpacity)?p.fillOpacity[i]:p.fillOpacity,seriesIndex:i}}},{key:"addEvents",value:function(t){var e=this.w,i=new Mi(this.ctx);t.node.addEventListener("mouseenter",i.pathMouseEnter.bind(this.ctx,t)),t.node.addEventListener("mouseleave",i.pathMouseLeave.bind(this.ctx,t)),t.node.addEventListener("mousedown",i.pathMouseDown.bind(this.ctx,t)),t.node.addEventListener("click",e.config.markers.onClick),t.node.addEventListener("dblclick",e.config.markers.onDblClick),t.node.addEventListener("touchstart",i.pathMouseDown.bind(this.ctx,t),{passive:!0})}},{key:"getMarkerStyle",value:function(t){var e=this.w,i=e.globals.markers.colors,a=e.config.markers.strokeColor||e.config.markers.strokeColors;return{pointStrokeColor:Array.isArray(a)?a[t]:a,pointFillColor:Array.isArray(i)?i[t]:i}}}]),t}(),Ui=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.initialAnim=this.w.config.chart.animations.enabled}return s(t,[{key:"draw",value:function(t,e,i){var a=this.w,s=new Mi(this.ctx),r=i.realIndex,n=i.pointsPos,o=i.zRatio,l=i.elParent,h=s.group({class:"apexcharts-series-markers apexcharts-series-".concat(a.config.chart.type)});if(h.attr("clip-path","url(#gridRectMarkerMask".concat(a.globals.cuid,")")),Array.isArray(n.x))for(var c=0;cp.maxBubbleRadius&&(g=p.maxBubbleRadius)}var f=n.x[c],x=n.y[c];if(g=g||0,null!==x&&void 0!==a.globals.series[r][d]||(u=!1),u){var b=this.drawPoint(f,x,g,r,d,e);h.add(b)}l.add(h)}}},{key:"drawPoint",value:function(t,e,i,a,s,r){var n=this.w,o=a,l=new y(this.ctx),h=new Li(this.ctx),c=new ji(this.ctx),d=new Vi(this.ctx),u=new Mi(this.ctx),g=d.getMarkerConfig({cssClass:"apexcharts-marker",seriesIndex:o,dataPointIndex:s,radius:"bubble"===n.config.chart.type||n.globals.comboCharts&&n.config.series[a]&&"bubble"===n.config.series[a].type?i:null}),p=c.fillPath({seriesNumber:a,dataPointIndex:s,color:g.pointFillColor,patternUnits:"objectBoundingBox",value:n.globals.series[a][r]}),f=u.drawMarker(t,e,g);if(n.config.series[o].data[s]&&n.config.series[o].data[s].fillColor&&(p=n.config.series[o].data[s].fillColor),f.attr({fill:p}),n.config.chart.dropShadow.enabled){var x=n.config.chart.dropShadow;h.dropShadow(f,x,a)}if(!this.initialAnim||n.globals.dataChanged||n.globals.resized)n.globals.animationEnded=!0;else{var b=n.config.chart.animations.speed;l.animateMarker(f,b,n.globals.easing,(function(){window.setTimeout((function(){l.animationCompleted(f)}),100)}))}return f.attr({rel:s,j:s,index:a,"default-marker-size":g.pSize}),h.setSelectionFilter(f,a,s),d.addEvents(f),f.node.classList.add("apexcharts-marker"),f}},{key:"centerTextInBubble",value:function(t){var e=this.w;return{y:t+=parseInt(e.config.dataLabels.style.fontSize,10)/4}}}]),t}(),qi=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"dataLabelsCorrection",value:function(t,e,i,a,s,r,n){var o=this.w,l=!1,h=new Mi(this.ctx).getTextRects(i,n),c=h.width,d=h.height;e<0&&(e=0),e>o.globals.gridHeight+d&&(e=o.globals.gridHeight+d/2),void 0===o.globals.dataLabelsRects[a]&&(o.globals.dataLabelsRects[a]=[]),o.globals.dataLabelsRects[a].push({x:t,y:e,width:c,height:d});var u=o.globals.dataLabelsRects[a].length-2,g=void 0!==o.globals.lastDrawnDataLabelsIndexes[a]?o.globals.lastDrawnDataLabelsIndexes[a][o.globals.lastDrawnDataLabelsIndexes[a].length-1]:0;if(void 0!==o.globals.dataLabelsRects[a][u]){var p=o.globals.dataLabelsRects[a][g];(t>p.x+p.width||e>p.y+p.height||e+de.globals.gridWidth+b.textRects.width+30)&&(o="");var m=e.globals.dataLabels.style.colors[r];(("bar"===e.config.chart.type||"rangeBar"===e.config.chart.type)&&e.config.plotOptions.bar.distributed||e.config.dataLabels.distributed)&&(m=e.globals.dataLabels.style.colors[n]),"function"==typeof m&&(m=m({series:e.globals.series,seriesIndex:r,dataPointIndex:n,w:e})),u&&(m=u);var v=d.offsetX,y=d.offsetY;if("bar"!==e.config.chart.type&&"rangeBar"!==e.config.chart.type||(v=0,y=0),e.globals.isSlopeChart&&(0!==n&&(v=-2*d.offsetX+5),0!==n&&n!==e.config.series[r].data.length-1&&(v=0)),b.drawnextLabel){if((x=i.drawText({width:100,height:parseInt(d.style.fontSize,10),x:a+v,y:s+y,foreColor:m,textAnchor:l||d.textAnchor,text:o,fontSize:h||d.style.fontSize,fontFamily:d.style.fontFamily,fontWeight:d.style.fontWeight||"normal"})).attr({class:f||"apexcharts-datalabel",cx:a,cy:s}),d.dropShadow.enabled){var w=d.dropShadow;new Li(this.ctx).dropShadow(x,w)}c.add(x),void 0===e.globals.lastDrawnDataLabelsIndexes[r]&&(e.globals.lastDrawnDataLabelsIndexes[r]=[]),e.globals.lastDrawnDataLabelsIndexes[r].push(n)}return x}},{key:"addBackgroundToDataLabel",value:function(t,e){var i=this.w,a=i.config.dataLabels.background,s=a.padding,r=a.padding/2,n=e.width,o=e.height,l=new Mi(this.ctx).drawRect(e.x-s,e.y-r/2,n+2*s,o+r,a.borderRadius,"transparent"!==i.config.chart.background&&i.config.chart.background?i.config.chart.background:"#fff",a.opacity,a.borderWidth,a.borderColor);a.dropShadow.enabled&&new Li(this.ctx).dropShadow(l,a.dropShadow);return l}},{key:"dataLabelsBackground",value:function(){var t=this.w;if("bubble"!==t.config.chart.type)for(var e=t.globals.dom.baseEl.querySelectorAll(".apexcharts-datalabels text"),i=0;i0&&void 0!==arguments[0])||arguments[0],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=this.w,s=v.clone(a.globals.initialSeries);a.globals.previousPaths=[],i?(a.globals.collapsedSeries=[],a.globals.ancillaryCollapsedSeries=[],a.globals.collapsedSeriesIndices=[],a.globals.ancillaryCollapsedSeriesIndices=[]):s=this.emptyCollapsedSeries(s),a.config.series=s,t&&(e&&(a.globals.zoomed=!1,this.ctx.updateHelpers.revertDefaultAxisMinMax()),this.ctx.updateHelpers._updateSeries(s,a.config.chart.animations.dynamicAnimation.enabled))}},{key:"emptyCollapsedSeries",value:function(t){for(var e=this.w,i=0;i-1&&(t[i].data=[]);return t}},{key:"highlightSeries",value:function(t){var e=this.w,i=this.getSeriesByName(t),a=parseInt(null==i?void 0:i.getAttribute("data:realIndex"),10),s=e.globals.dom.baseEl.querySelectorAll(".apexcharts-series, .apexcharts-datalabels, .apexcharts-yaxis"),r=null,n=null,o=null;if(e.globals.axisCharts||"radialBar"===e.config.chart.type)if(e.globals.axisCharts){r=e.globals.dom.baseEl.querySelector(".apexcharts-series[data\\:realIndex='".concat(a,"']")),n=e.globals.dom.baseEl.querySelector(".apexcharts-datalabels[data\\:realIndex='".concat(a,"']"));var l=e.globals.seriesYAxisReverseMap[a];o=e.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(l,"']"))}else r=e.globals.dom.baseEl.querySelector(".apexcharts-series[rel='".concat(a+1,"']"));else r=e.globals.dom.baseEl.querySelector(".apexcharts-series[rel='".concat(a+1,"'] path"));for(var h=0;h=t.from&&(r0&&void 0!==arguments[0]?arguments[0]:"asc",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=this.w,a=0;if(i.config.series.length>1)for(var s=i.config.series.map((function(t,a){return t.data&&t.data.length>0&&-1===i.globals.collapsedSeriesIndices.indexOf(a)&&(!i.globals.comboCharts||0===e.length||e.length&&e.indexOf(i.config.series[a].type)>-1)?a:-1})),r="asc"===t?0:s.length-1;"asc"===t?r=0;"asc"===t?r++:r--)if(-1!==s[r]){a=s[r];break}return a}},{key:"getBarSeriesIndices",value:function(){return this.w.globals.comboCharts?this.w.config.series.map((function(t,e){return"bar"===t.type||"column"===t.type?e:-1})).filter((function(t){return-1!==t})):this.w.config.series.map((function(t,e){return e}))}},{key:"getPreviousPaths",value:function(){var t=this.w;function e(e,i,a){for(var s=e[i].childNodes,r={type:a,paths:[],realIndex:e[i].getAttribute("data:realIndex")},n=0;n0)for(var a=function(e){for(var i=t.globals.dom.baseEl.querySelectorAll(".apexcharts-".concat(t.config.chart.type," .apexcharts-series[data\\:realIndex='").concat(e,"'] rect")),a=[],s=function(t){var e=function(e){return i[t].getAttribute(e)},s={x:parseFloat(e("x")),y:parseFloat(e("y")),width:parseFloat(e("width")),height:parseFloat(e("height"))};a.push({rect:s,color:i[t].getAttribute("color")})},r=0;r0?t:[]}));return t}}]),t}(),$i=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.twoDSeries=[],this.threeDSeries=[],this.twoDSeriesX=[],this.seriesGoals=[],this.coreUtils=new Pi(this.ctx)}return s(t,[{key:"isMultiFormat",value:function(){return this.isFormatXY()||this.isFormat2DArray()}},{key:"isFormatXY",value:function(){var t=this.w.config.series.slice(),e=new Zi(this.ctx);if(this.activeSeriesIndex=e.getActiveConfigSeriesIndex(),void 0!==t[this.activeSeriesIndex].data&&t[this.activeSeriesIndex].data.length>0&&null!==t[this.activeSeriesIndex].data[0]&&void 0!==t[this.activeSeriesIndex].data[0].x&&null!==t[this.activeSeriesIndex].data[0])return!0}},{key:"isFormat2DArray",value:function(){var t=this.w.config.series.slice(),e=new Zi(this.ctx);if(this.activeSeriesIndex=e.getActiveConfigSeriesIndex(),void 0!==t[this.activeSeriesIndex].data&&t[this.activeSeriesIndex].data.length>0&&void 0!==t[this.activeSeriesIndex].data[0]&&null!==t[this.activeSeriesIndex].data[0]&&t[this.activeSeriesIndex].data[0].constructor===Array)return!0}},{key:"handleFormat2DArray",value:function(t,e){for(var i=this.w.config,a=this.w.globals,s="boxPlot"===i.chart.type||"boxPlot"===i.series[e].type,r=0;r=5?this.twoDSeries.push(v.parseNumber(t[e].data[r][4])):this.twoDSeries.push(v.parseNumber(t[e].data[r][1])),a.dataFormatXNumeric=!0),"datetime"===i.xaxis.type){var n=new Date(t[e].data[r][0]);n=new Date(n).getTime(),this.twoDSeriesX.push(n)}else this.twoDSeriesX.push(t[e].data[r][0]);for(var o=0;o-1&&(r=this.activeSeriesIndex);for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:this.ctx,a=this.w.config,s=this.w.globals,r=new zi(i),n=a.labels.length>0?a.labels.slice():a.xaxis.categories.slice();s.isRangeBar="rangeBar"===a.chart.type&&s.isBarHorizontal,s.hasXaxisGroups="category"===a.xaxis.type&&a.xaxis.group.groups.length>0,s.hasXaxisGroups&&(s.groups=a.xaxis.group.groups),t.forEach((function(t,e){void 0!==t.name?s.seriesNames.push(t.name):s.seriesNames.push("series-"+parseInt(e+1,10))})),this.coreUtils.setSeriesYAxisMappings();var o=[],l=f(new Set(a.series.map((function(t){return t.group}))));a.series.forEach((function(t,e){var i=l.indexOf(t.group);o[i]||(o[i]=[]),o[i].push(s.seriesNames[e])})),s.seriesGroups=o;for(var h=function(){for(var t=0;t0&&(this.twoDSeriesX=n,s.seriesX.push(this.twoDSeriesX))),s.labels.push(this.twoDSeriesX);var d=t[c].data.map((function(t){return v.parseNumber(t)}));s.series.push(d)}s.seriesZ.push(this.threeDSeries),void 0!==t[c].color?s.seriesColors.push(t[c].color):s.seriesColors.push(void 0)}return this.w}},{key:"parseDataNonAxisCharts",value:function(t){var e=this.w.globals,i=this.w.config;e.series=t.slice(),e.seriesNames=i.labels.slice();for(var a=0;a0)i.labels=e.xaxis.categories;else if(e.labels.length>0)i.labels=e.labels.slice();else if(this.fallbackToCategory){if(i.labels=i.labels[0],i.seriesRange.length&&(i.seriesRange.map((function(t){t.forEach((function(t){i.labels.indexOf(t.x)<0&&t.x&&i.labels.push(t.x)}))})),i.labels=Array.from(new Set(i.labels.map(JSON.stringify)),JSON.parse)),e.xaxis.convertedCatToNumeric)new Ni(e).convertCatToNumericXaxis(e,this.ctx,i.seriesX[0]),this._generateExternalLabels(t)}else this._generateExternalLabels(t)}},{key:"_generateExternalLabels",value:function(t){var e=this.w.globals,i=this.w.config,a=[];if(e.axisCharts){if(e.series.length>0)if(this.isFormatXY())for(var s=i.series.map((function(t,e){return t.data.filter((function(t,e,i){return i.findIndex((function(e){return e.x===t.x}))===e}))})),r=s.reduce((function(t,e,i,a){return a[t].length>e.length?t:i}),0),n=0;n0&&s==i.length&&e.push(a)})),t.globals.ignoreYAxisIndexes=e.map((function(t){return t}))}}]),t}(),Ji=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"svgStringToNode",value:function(t){return(new DOMParser).parseFromString(t,"image/svg+xml").documentElement}},{key:"scaleSvgNode",value:function(t,e){var i=parseFloat(t.getAttributeNS(null,"width")),a=parseFloat(t.getAttributeNS(null,"height"));t.setAttributeNS(null,"width",i*e),t.setAttributeNS(null,"height",a*e),t.setAttributeNS(null,"viewBox","0 0 "+i+" "+a)}},{key:"getSvgString",value:function(t){var e=this;return new Promise((function(i){var a=e.w,s=t||a.config.chart.toolbar.export.scale||a.config.chart.toolbar.export.width/a.globals.svgWidth;s||(s=1);var r=a.globals.svgWidth*s,n=a.globals.svgHeight*s,o=a.globals.dom.elWrap.cloneNode(!0);o.style.width=r+"px",o.style.height=n+"px";var l=(new XMLSerializer).serializeToString(o),h='\n \n \n
\n \n ').concat(l,"\n
\n
\n
\n "),c=e.svgStringToNode(h);1!==s&&e.scaleSvgNode(c,s),e.convertImagesToBase64(c).then((function(){h=(new XMLSerializer).serializeToString(c),i(h.replace(/ /g," "))}))}))}},{key:"convertImagesToBase64",value:function(t){var e=this,i=t.getElementsByTagName("image"),a=Array.from(i).map((function(t){var i=t.getAttributeNS("http://www.w3.org/1999/xlink","href");return i&&!i.startsWith("data:")?e.getBase64FromUrl(i).then((function(e){t.setAttributeNS("http://www.w3.org/1999/xlink","href",e)})).catch((function(t){console.error("Error converting image to base64:",t)})):Promise.resolve()}));return Promise.all(a)}},{key:"getBase64FromUrl",value:function(t){return new Promise((function(e,i){var a=new Image;a.crossOrigin="Anonymous",a.onload=function(){var t=document.createElement("canvas");t.width=a.width,t.height=a.height,t.getContext("2d").drawImage(a,0,0),e(t.toDataURL())},a.onerror=i,a.src=t}))}},{key:"svgUrl",value:function(){var t=this;return new Promise((function(e){t.getSvgString().then((function(t){var i=new Blob([t],{type:"image/svg+xml;charset=utf-8"});e(URL.createObjectURL(i))}))}))}},{key:"dataURI",value:function(t){var e=this;return new Promise((function(i){var a=e.w,s=t?t.scale||t.width/a.globals.svgWidth:1,r=document.createElement("canvas");r.width=a.globals.svgWidth*s,r.height=parseInt(a.globals.dom.elWrap.style.height,10)*s;var n="transparent"!==a.config.chart.background&&a.config.chart.background?a.config.chart.background:"#fff",o=r.getContext("2d");o.fillStyle=n,o.fillRect(0,0,r.width*s,r.height*s),e.getSvgString(s).then((function(t){var e="data:image/svg+xml,"+encodeURIComponent(t),a=new Image;a.crossOrigin="anonymous",a.onload=function(){if(o.drawImage(a,0,0),r.msToBlob){var t=r.msToBlob();i({blob:t})}else{var e=r.toDataURL("image/png");i({imgURI:e})}},a.src=e}))}))}},{key:"exportToSVG",value:function(){var t=this;this.svgUrl().then((function(e){t.triggerDownload(e,t.w.config.chart.toolbar.export.svg.filename,".svg")}))}},{key:"exportToPng",value:function(){var t=this,e=this.w.config.chart.toolbar.export.scale,i=this.w.config.chart.toolbar.export.width,a=e?{scale:e}:i?{width:i}:void 0;this.dataURI(a).then((function(e){var i=e.imgURI,a=e.blob;a?navigator.msSaveOrOpenBlob(a,t.w.globals.chartID+".png"):t.triggerDownload(i,t.w.config.chart.toolbar.export.png.filename,".png")}))}},{key:"exportToCSV",value:function(t){var e=this,i=t.series,a=t.fileName,s=t.columnDelimiter,r=void 0===s?",":s,n=t.lineDelimiter,o=void 0===n?"\n":n,l=this.w;i||(i=l.config.series);var h=[],c=[],d="",u=l.globals.series.map((function(t,e){return-1===l.globals.collapsedSeriesIndices.indexOf(e)?t:[]})),g=function(t){return"function"==typeof l.config.chart.toolbar.export.csv.categoryFormatter?l.config.chart.toolbar.export.csv.categoryFormatter(t):"datetime"===l.config.xaxis.type&&String(t).length>=10?new Date(t).toDateString():v.isNumber(t)?t:t.split(r).join("")},p=function(t){return"function"==typeof l.config.chart.toolbar.export.csv.valueFormatter?l.config.chart.toolbar.export.csv.valueFormatter(t):t},x=Math.max.apply(Math,f(i.map((function(t){return t.data?t.data.length:0})))),b=new $i(this.ctx),m=new Ri(this.ctx),y=function(t){var i="";if(l.globals.axisCharts){if("category"===l.config.xaxis.type||l.config.xaxis.convertedCatToNumeric)if(l.globals.isBarHorizontal){var a=l.globals.yLabelFormatters[0],s=new Zi(e.ctx).getActiveConfigSeriesIndex();i=a(l.globals.labels[t],{seriesIndex:s,dataPointIndex:t,w:l})}else i=m.getLabel(l.globals.labels,l.globals.timescaleLabels,0,t).text;"datetime"===l.config.xaxis.type&&(l.config.xaxis.categories.length?i=l.config.xaxis.categories[t]:l.config.labels.length&&(i=l.config.labels[t]))}else i=l.config.labels[t];return null===i?"nullvalue":(Array.isArray(i)&&(i=i.join(" ")),v.isNumber(i)?i:i.split(r).join(""))},w=function(t,e){if(h.length&&0===e&&c.push(h.join(r)),t.data){t.data=t.data.length&&t.data||f(Array(x)).map((function(){return""}));for(var a=0;a0&&!s.globals.isBarHorizontal&&(this.xaxisLabels=s.globals.timescaleLabels.slice()),s.config.xaxis.overwriteCategories&&(this.xaxisLabels=s.config.xaxis.overwriteCategories),this.drawnLabels=[],this.drawnLabelsRects=[],"top"===s.config.xaxis.position?this.offY=0:this.offY=s.globals.gridHeight,this.offY=this.offY+s.config.xaxis.axisBorder.offsetY,this.isCategoryBarHorizontal="bar"===s.config.chart.type&&s.config.plotOptions.bar.horizontal,this.xaxisFontSize=s.config.xaxis.labels.style.fontSize,this.xaxisFontFamily=s.config.xaxis.labels.style.fontFamily,this.xaxisForeColors=s.config.xaxis.labels.style.colors,this.xaxisBorderWidth=s.config.xaxis.axisBorder.width,this.isCategoryBarHorizontal&&(this.xaxisBorderWidth=s.config.yaxis[0].axisBorder.width.toString()),this.xaxisBorderWidth.indexOf("%")>-1?this.xaxisBorderWidth=s.globals.gridWidth*parseInt(this.xaxisBorderWidth,10)/100:this.xaxisBorderWidth=parseInt(this.xaxisBorderWidth,10),this.xaxisBorderHeight=s.config.xaxis.axisBorder.height,this.yaxis=s.config.yaxis[0]}return s(t,[{key:"drawXaxis",value:function(){var t=this.w,e=new Mi(this.ctx),i=e.group({class:"apexcharts-xaxis",transform:"translate(".concat(t.config.xaxis.offsetX,", ").concat(t.config.xaxis.offsetY,")")}),a=e.group({class:"apexcharts-xaxis-texts-g",transform:"translate(".concat(t.globals.translateXAxisX,", ").concat(t.globals.translateXAxisY,")")});i.add(a);for(var s=[],r=0;r6&&void 0!==arguments[6]?arguments[6]:{},h=[],c=[],d=this.w,u=l.xaxisFontSize||this.xaxisFontSize,g=l.xaxisFontFamily||this.xaxisFontFamily,p=l.xaxisForeColors||this.xaxisForeColors,f=l.fontWeight||d.config.xaxis.labels.style.fontWeight,x=l.cssClass||d.config.xaxis.labels.style.cssClass,b=d.globals.padHorizontal,m=a.length,v="category"===d.config.xaxis.type?d.globals.dataPoints:m;if(0===v&&m>v&&(v=m),s){var y=Math.max(Number(d.config.xaxis.tickAmount)||1,v>1?v-1:v);n=d.globals.gridWidth/Math.min(y,m-1),b=b+r(0,n)/2+d.config.xaxis.labels.offsetX}else n=d.globals.gridWidth/v,b=b+r(0,n)+d.config.xaxis.labels.offsetX;for(var w=function(s){var l=b-r(s,n)/2+d.config.xaxis.labels.offsetX;0===s&&1===m&&n/2===b&&1===v&&(l=d.globals.gridWidth/2);var y=o.axesUtils.getLabel(a,d.globals.timescaleLabels,l,s,h,u,t),w=28;d.globals.rotateXLabels&&t&&(w=22),d.config.xaxis.title.text&&"top"===d.config.xaxis.position&&(w+=parseFloat(d.config.xaxis.title.style.fontSize)+2),t||(w=w+parseFloat(u)+(d.globals.xAxisLabelsHeight-d.globals.xAxisGroupLabelsHeight)+(d.globals.rotateXLabels?10:0)),y=void 0!==d.config.xaxis.tickAmount&&"dataPoints"!==d.config.xaxis.tickAmount&&"datetime"!==d.config.xaxis.type?o.axesUtils.checkLabelBasedOnTickamount(s,y,m):o.axesUtils.checkForOverflowingLabels(s,y,m,h,c);if(d.config.xaxis.labels.show){var k=e.drawText({x:y.x,y:o.offY+d.config.xaxis.labels.offsetY+w-("top"===d.config.xaxis.position?d.globals.xAxisHeight+d.config.xaxis.axisTicks.height-2:0),text:y.text,textAnchor:"middle",fontWeight:y.isBold?600:f,fontSize:u,fontFamily:g,foreColor:Array.isArray(p)?t&&d.config.xaxis.convertedCatToNumeric?p[d.globals.minX+s-1]:p[s]:p,isPlainText:!1,cssClass:(t?"apexcharts-xaxis-label ":"apexcharts-xaxis-group-label ")+x});if(i.add(k),k.on("click",(function(t){if("function"==typeof d.config.chart.events.xAxisLabelClick){var e=Object.assign({},d,{labelIndex:s});d.config.chart.events.xAxisLabelClick(t,o.ctx,e)}})),t){var A=document.createElementNS(d.globals.SVGNS,"title");A.textContent=Array.isArray(y.text)?y.text.join(" "):y.text,k.node.appendChild(A),""!==y.text&&(h.push(y.text),c.push(y))}}sa.globals.gridWidth)){var r=this.offY+a.config.xaxis.axisTicks.offsetY;if(e=e+r+a.config.xaxis.axisTicks.height,"top"===a.config.xaxis.position&&(e=r-a.config.xaxis.axisTicks.height),a.config.xaxis.axisTicks.show){var n=new Mi(this.ctx).drawLine(t+a.config.xaxis.axisTicks.offsetX,r+a.config.xaxis.offsetY,s+a.config.xaxis.axisTicks.offsetX,e+a.config.xaxis.offsetY,a.config.xaxis.axisTicks.color);i.add(n),n.node.classList.add("apexcharts-xaxis-tick")}}}},{key:"getXAxisTicksPositions",value:function(){var t=this.w,e=[],i=this.xaxisLabels.length,a=t.globals.padHorizontal;if(t.globals.timescaleLabels.length>0)for(var s=0;s0){var h=s[s.length-1].getBBox(),c=s[0].getBBox();h.x<-20&&s[s.length-1].parentNode.removeChild(s[s.length-1]),c.x+c.width>t.globals.gridWidth&&!t.globals.isBarHorizontal&&s[0].parentNode.removeChild(s[0]);for(var d=0;d0&&(this.xaxisLabels=a.globals.timescaleLabels.slice())}return s(t,[{key:"drawGridArea",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=this.w,i=new Mi(this.ctx);t||(t=i.group({class:"apexcharts-grid"}));var a=i.drawLine(e.globals.padHorizontal,1,e.globals.padHorizontal,e.globals.gridHeight,"transparent"),s=i.drawLine(e.globals.padHorizontal,e.globals.gridHeight,e.globals.gridWidth,e.globals.gridHeight,"transparent");return t.add(s),t.add(a),t}},{key:"drawGrid",value:function(){if(this.w.globals.axisCharts){var t=this.renderGrid();return this.drawGridArea(t.el),t}return null}},{key:"createGridMask",value:function(){var t=this.w,e=t.globals,i=new Mi(this.ctx),a=Array.isArray(t.config.stroke.width)?Math.max.apply(Math,f(t.config.stroke.width)):t.config.stroke.width,s=function(t){var i=document.createElementNS(e.SVGNS,"clipPath");return i.setAttribute("id",t),i};e.dom.elGridRectMask=s("gridRectMask".concat(e.cuid)),e.dom.elGridRectBarMask=s("gridRectBarMask".concat(e.cuid)),e.dom.elGridRectMarkerMask=s("gridRectMarkerMask".concat(e.cuid)),e.dom.elForecastMask=s("forecastMask".concat(e.cuid)),e.dom.elNonForecastMask=s("nonForecastMask".concat(e.cuid));var r=0,n=0;(["bar","rangeBar","candlestick","boxPlot"].includes(t.config.chart.type)||t.globals.comboBarCount>0)&&t.globals.isXNumeric&&!t.globals.isBarHorizontal&&(r=Math.max(t.config.grid.padding.left,e.barPadForNumericAxis),n=Math.max(t.config.grid.padding.right,e.barPadForNumericAxis)),e.dom.elGridRect=i.drawRect(-a/2-2,-a/2-2,e.gridWidth+a+4,e.gridHeight+a+4,0,"#fff"),e.dom.elGridRectBar=i.drawRect(-a/2-r-2,-a/2-2,e.gridWidth+a+n+r+4,e.gridHeight+a+4,0,"#fff");var o=t.globals.markers.largestSize;e.dom.elGridRectMarker=i.drawRect(-o,-o,e.gridWidth+2*o,e.gridHeight+2*o,0,"#fff"),e.dom.elGridRectMask.appendChild(e.dom.elGridRect.node),e.dom.elGridRectBarMask.appendChild(e.dom.elGridRectBar.node),e.dom.elGridRectMarkerMask.appendChild(e.dom.elGridRectMarker.node);var l=e.dom.baseEl.querySelector("defs");l.appendChild(e.dom.elGridRectMask),l.appendChild(e.dom.elGridRectBarMask),l.appendChild(e.dom.elGridRectMarkerMask),l.appendChild(e.dom.elForecastMask),l.appendChild(e.dom.elNonForecastMask)}},{key:"_drawGridLines",value:function(t){var e=t.i,i=t.x1,a=t.y1,s=t.x2,r=t.y2,n=t.xCount,o=t.parent,l=this.w;if(!(0===e&&l.globals.skipFirstTimelinelabel||e===n-1&&l.globals.skipLastTimelinelabel&&!l.config.xaxis.labels.formatter||"radar"===l.config.chart.type)){l.config.grid.xaxis.lines.show&&this._drawGridLine({i:e,x1:i,y1:a,x2:s,y2:r,xCount:n,parent:o});var h=0;if(l.globals.hasXaxisGroups&&"between"===l.config.xaxis.tickPlacement){var c=l.globals.groups;if(c){for(var d=0,u=0;d0&&"datetime"!==t.config.xaxis.type&&(s=e.yAxisScale[a].result.length-1);this._drawXYLines({xCount:s,tickAmount:r})}else s=r,r=e.xTickAmount,this._drawInvertedXYLines({xCount:s,tickAmount:r});return this.drawGridBands(s,r),{el:this.elg,elGridBorders:this.elGridBorders,xAxisTickWidth:e.gridWidth/s}}},{key:"drawGridBands",value:function(t,e){var i,a,s=this,r=this.w;if((null===(i=r.config.grid.row.colors)||void 0===i?void 0:i.length)>0&&function(t,i,a,n,o,l){for(var h=0,c=0;h=r.config.grid[t].colors.length&&(c=0),s._drawGridBandRect({c:c,x1:a,y1:n,x2:o,y2:l,type:t}),n+=r.globals.gridHeight/e}("row",e,0,0,r.globals.gridWidth,r.globals.gridHeight/e),(null===(a=r.config.grid.column.colors)||void 0===a?void 0:a.length)>0){var n=r.globals.isBarHorizontal||"on"!==r.config.xaxis.tickPlacement||"category"!==r.config.xaxis.type&&!r.config.xaxis.convertedCatToNumeric?t:t-1;r.globals.isXNumeric&&(n=r.globals.xAxisScale.result.length-1);for(var o=r.globals.padHorizontal,l=r.globals.padHorizontal+r.globals.gridWidth/n,h=r.globals.gridHeight,c=0,d=0;c=r.config.grid.column.colors.length&&(d=0),"datetime"===r.config.xaxis.type)o=this.xaxisLabels[c].position,l=((null===(u=this.xaxisLabels[c+1])||void 0===u?void 0:u.position)||r.globals.gridWidth)-this.xaxisLabels[c].position;this._drawGridBandRect({c:d,x1:o,y1:0,x2:l,y2:h,type:"column"}),o+=r.globals.gridWidth/n}}}}]),t}(),ta=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.coreUtils=new Pi(this.ctx)}return s(t,[{key:"niceScale",value:function(t,e){var i,a,s,r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=1e-11,l=this.w,h=l.globals;h.isBarHorizontal?(i=l.config.xaxis,a=Math.max((h.svgWidth-100)/25,2)):(i=l.config.yaxis[n],a=Math.max((h.svgHeight-100)/15,2)),v.isNumber(a)||(a=10),s=void 0!==i.min&&null!==i.min,r=void 0!==i.max&&null!==i.min;var c=void 0!==i.stepSize&&null!==i.stepSize,d=void 0!==i.tickAmount&&null!==i.tickAmount,u=d?i.tickAmount:h.niceScaleDefaultTicks[Math.min(Math.round(a/2),h.niceScaleDefaultTicks.length-1)];if(h.isMultipleYAxis&&!d&&h.multiAxisTickAmount>0&&(u=h.multiAxisTickAmount,d=!0),u="dataPoints"===u?h.dataPoints-1:Math.abs(Math.round(u)),(t===Number.MIN_VALUE&&0===e||!v.isNumber(t)&&!v.isNumber(e)||t===Number.MIN_VALUE&&e===-Number.MAX_VALUE)&&(t=v.isNumber(i.min)?i.min:0,e=v.isNumber(i.max)?i.max:t+u,h.allSeriesCollapsed=!1),t>e){console.warn("axis.min cannot be greater than axis.max: swapping min and max");var g=e;e=t,t=g}else t===e&&(t=0===t?0:t-1,e=0===e?2:e+1);var p=[];u<1&&(u=1);var f=u,x=Math.abs(e-t);!s&&t>0&&t/x<.15&&(t=0,s=!0),!r&&e<0&&-e/x<.15&&(e=0,r=!0);var b=(x=Math.abs(e-t))/f,m=b,y=Math.floor(Math.log10(m)),w=Math.pow(10,y),k=Math.ceil(m/w);if(b=m=(k=h.niceScaleAllowedMagMsd[0===h.yValueDecimal?0:1][k])*w,h.isBarHorizontal&&i.stepSize&&"datetime"!==i.type?(b=i.stepSize,c=!0):c&&(b=i.stepSize),c&&i.forceNiceScale){var A=Math.floor(Math.log10(b));b*=Math.pow(10,y-A)}if(s&&r){var C=x/f;if(d)if(c)if(0!=v.mod(x,b)){var S=v.getGCD(b,C);b=C/S<10?S:C}else 0==v.mod(b,C)?b=C:(C=b,d=!1);else b=C;else if(c)0==v.mod(x,b)?C=b:b=C;else if(0==v.mod(x,b))C=b;else{C=x/(f=Math.ceil(x/b));var L=v.getGCD(x,b);x/La&&(t=e-b*u,t+=b*Math.floor((M-t)/b))}else if(s)if(d)e=t+b*f;else{var P=e;e=b*Math.ceil(e/b),Math.abs(e-t)/v.getGCD(x,b)>a&&(e=t+b*u,e+=b*Math.ceil((P-e)/b))}}else if(h.isMultipleYAxis&&d){var I=b*Math.floor(t/b),T=I+b*f;T0&&t16&&v.getPrimeFactors(f).length<2&&f++,!d&&i.forceNiceScale&&0===h.yValueDecimal&&f>x&&(f=x,b=Math.round(x/f)),f>a&&(!d&&!c||i.forceNiceScale)){var z=v.getPrimeFactors(f),X=z.length-1,R=f;t:for(var E=0;EN);return{result:p,niceMin:p[0],niceMax:p[p.length-1]}}},{key:"linearScale",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0,r=Math.abs(e-t),n=[];if(t===e)return{result:n=[t],niceMin:n[0],niceMax:n[n.length-1]};"dataPoints"===(i=this._adjustTicksForSmallRange(i,a,r))&&(i=this.w.globals.dataPoints-1),s||(s=r/i),s=Math.round(100*(s+Number.EPSILON))/100,i===Number.MAX_VALUE&&(i=5,s=1);for(var o=t;i>=0;)n.push(o),o=v.preciseAddition(o,s),i-=1;return{result:n,niceMin:n[0],niceMax:n[n.length-1]}}},{key:"logarithmicScaleNice",value:function(t,e,i){e<=0&&(e=Math.max(t,i)),t<=0&&(t=Math.min(e,i));for(var a=[],s=Math.ceil(Math.log(e)/Math.log(i)+1),r=Math.floor(Math.log(t)/Math.log(i));r5?(a.allSeriesCollapsed=!1,a.yAxisScale[t]=r.forceNiceScale?this.logarithmicScaleNice(e,i,r.logBase):this.logarithmicScale(e,i,r.logBase)):i!==-Number.MAX_VALUE&&v.isNumber(i)&&e!==Number.MAX_VALUE&&v.isNumber(e)?(a.allSeriesCollapsed=!1,a.yAxisScale[t]=this.niceScale(e,i,t)):a.yAxisScale[t]=this.niceScale(Number.MIN_VALUE,0,t)}},{key:"setXScale",value:function(t,e){var i=this.w,a=i.globals;if(e!==-Number.MAX_VALUE&&v.isNumber(e)){var s=a.xTickAmount;a.xAxisScale=this.linearScale(t,e,s,0,i.config.xaxis.stepSize)}else a.xAxisScale=this.linearScale(0,10,10);return a.xAxisScale}},{key:"scaleMultipleYAxes",value:function(){var t=this,e=this.w.config,i=this.w.globals;this.coreUtils.setSeriesYAxisMappings();var a=i.seriesYAxisMap,s=i.minYArr,r=i.maxYArr;i.allSeriesCollapsed=!0,i.barGroups=[],a.forEach((function(a,n){var o=[];a.forEach((function(t){var i,a=null===(i=e.series[t])||void 0===i?void 0:i.group;o.indexOf(a)<0&&o.push(a)})),a.length>0?function(){var l,h,c=Number.MAX_VALUE,d=-Number.MAX_VALUE,u=c,g=d;if(e.chart.stacked)!function(){var t=new Array(i.dataPoints).fill(0),s=[],r=[],p=[];o.forEach((function(){s.push(t.map((function(){return Number.MIN_VALUE}))),r.push(t.map((function(){return Number.MIN_VALUE}))),p.push(t.map((function(){return Number.MIN_VALUE})))}));for(var f=function(t){!l&&e.series[a[t]].type&&(l=e.series[a[t]].type);var c=a[t];h=e.series[c].group?e.series[c].group:"axis-".concat(n),!(i.collapsedSeriesIndices.indexOf(c)<0&&i.ancillaryCollapsedSeriesIndices.indexOf(c)<0)||(i.allSeriesCollapsed=!1,o.forEach((function(t,a){if(e.series[c].group===t)for(var n=0;n=0?r[a][n]+=o:p[a][n]+=o,s[a][n]+=o,u=Math.min(u,o),g=Math.max(g,o)}}))),"bar"!==l&&"column"!==l||i.barGroups.push(h)},x=0;x1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-Number.MAX_VALUE,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,s=this.w.config,r=this.w.globals,n=-Number.MAX_VALUE,o=Number.MIN_VALUE;null===a&&(a=t+1);var l=r.series,h=l,c=l;"candlestick"===s.chart.type?(h=r.seriesCandleL,c=r.seriesCandleH):"boxPlot"===s.chart.type?(h=r.seriesCandleO,c=r.seriesCandleC):r.isRangeData&&(h=r.seriesRangeStart,c=r.seriesRangeEnd);var d=!1;if(r.seriesX.length>=a){var u,g=null===(u=r.brushSource)||void 0===u?void 0:u.w.config.chart.brush;(s.chart.zoom.enabled&&s.chart.zoom.autoScaleYaxis||null!=g&&g.enabled&&null!=g&&g.autoScaleYaxis)&&(d=!0)}for(var p=t;px&&r.seriesX[p][b]>s.xaxis.max;b--);}for(var m=x;m<=b&&mh[p][m]&&h[p][m]<0&&(o=h[p][m])}else r.hasNullValues=!0}"bar"!==f&&"column"!==f||(o<0&&n<0&&(n=0,i=Math.max(i,0)),o===Number.MIN_VALUE&&(o=0,e=Math.min(e,0)))}return"rangeBar"===s.chart.type&&r.seriesRangeStart.length&&r.isBarHorizontal&&(o=e),"bar"===s.chart.type&&(o<0&&n<0&&(n=0),o===Number.MIN_VALUE&&(o=0)),{minY:o,maxY:n,lowestY:e,highestY:i}}},{key:"setYRange",value:function(){var t=this.w.globals,e=this.w.config;t.maxY=-Number.MAX_VALUE,t.minY=Number.MIN_VALUE;var i,a=Number.MAX_VALUE;if(t.isMultipleYAxis){a=Number.MAX_VALUE;for(var s=0;st.dataPoints&&0!==t.dataPoints&&(a=t.dataPoints-1);else if("dataPoints"===e.xaxis.tickAmount){if(t.series.length>1&&(a=t.series[t.maxValsInArrayIndex].length-1),t.isXNumeric){var s=Math.round(t.maxX-t.minX);s<30&&(a=s-1)}}else a=e.xaxis.tickAmount;if(t.xTickAmount=a,void 0!==e.xaxis.max&&"number"==typeof e.xaxis.max&&(t.maxX=e.xaxis.max),void 0!==e.xaxis.min&&"number"==typeof e.xaxis.min&&(t.minX=e.xaxis.min),void 0!==e.xaxis.range&&(t.minX=t.maxX-e.xaxis.range),t.minX!==Number.MAX_VALUE&&t.maxX!==-Number.MAX_VALUE)if(e.xaxis.convertedCatToNumeric&&!t.dataFormatXNumeric){for(var r=[],n=t.minX-1;n0&&(t.xAxisScale=this.scales.linearScale(1,t.labels.length,a-1,0,e.xaxis.stepSize),t.seriesX=t.labels.slice());i&&(t.labels=t.xAxisScale.result.slice())}return t.isBarHorizontal&&t.labels.length&&(t.xTickAmount=t.labels.length),this._handleSingleDataPoint(),this._getMinXDiff(),{minX:t.minX,maxX:t.maxX}}},{key:"setZRange",value:function(){var t=this.w.globals;if(t.isDataXYZ)for(var e=0;e0){var s=e-a[i-1];s>0&&(t.minXDiff=Math.min(s,t.minXDiff))}})),1!==t.dataPoints&&t.minXDiff!==Number.MAX_VALUE||(t.minXDiff=.5)}}))}},{key:"_setStackedMinMax",value:function(){var t=this,e=this.w.globals;if(e.series.length){var i=e.seriesGroups;i.length||(i=[this.w.globals.seriesNames.map((function(t){return t}))]);var a={},s={};i.forEach((function(i){a[i]=[],s[i]=[],t.w.config.series.map((function(t,a){return i.indexOf(e.seriesNames[a])>-1?a:null})).filter((function(t){return null!==t})).forEach((function(r){for(var n=0;n0?a[i][n]+=parseFloat(e.series[r][n])+1e-4:s[i][n]+=parseFloat(e.series[r][n]))}}))})),Object.entries(a).forEach((function(t){var i=p(t,1)[0];a[i].forEach((function(t,r){e.maxY=Math.max(e.maxY,a[i][r]),e.minY=Math.min(e.minY,s[i][r])}))}))}}}]),t}(),ia=function(){function t(e,a){i(this,t),this.ctx=e,this.elgrid=a,this.w=e.w;var s=this.w;this.xaxisFontSize=s.config.xaxis.labels.style.fontSize,this.axisFontFamily=s.config.xaxis.labels.style.fontFamily,this.xaxisForeColors=s.config.xaxis.labels.style.colors,this.isCategoryBarHorizontal="bar"===s.config.chart.type&&s.config.plotOptions.bar.horizontal,this.xAxisoffX="bottom"===s.config.xaxis.position?s.globals.gridHeight:0,this.drawnLabels=[],this.axesUtils=new Ri(e)}return s(t,[{key:"drawYaxis",value:function(t){var e=this.w,i=new Mi(this.ctx),a=e.config.yaxis[t].labels.style,s=a.fontSize,r=a.fontFamily,n=a.fontWeight,o=i.group({class:"apexcharts-yaxis",rel:t,transform:"translate(".concat(e.globals.translateYAxisX[t],", 0)")});if(this.axesUtils.isYAxisHidden(t))return o;var l=i.group({class:"apexcharts-yaxis-texts-g"});o.add(l);var h=e.globals.yAxisScale[t].result.length-1,c=e.globals.gridHeight/h,d=e.globals.yLabelFormatters[t],u=this.axesUtils.checkForReversedLabels(t,e.globals.yAxisScale[t].result.slice());if(e.config.yaxis[t].labels.show){var g=e.globals.translateY+e.config.yaxis[t].labels.offsetY;e.globals.isBarHorizontal?g=0:"heatmap"===e.config.chart.type&&(g-=c/2),g+=parseInt(s,10)/3;for(var p=h;p>=0;p--){var f=d(u[p],p,e),x=e.config.yaxis[t].labels.padding;e.config.yaxis[t].opposite&&0!==e.config.yaxis.length&&(x*=-1);var b=this.getTextAnchor(e.config.yaxis[t].labels.align,e.config.yaxis[t].opposite),m=this.axesUtils.getYAxisForeColor(a.colors,t),y=Array.isArray(m)?m[p]:m,w=v.listToArray(e.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxis[rel='".concat(t,"'] .apexcharts-yaxis-label tspan"))).map((function(t){return t.textContent})),k=i.drawText({x:x,y:g,text:w.includes(f)&&!e.config.yaxis[t].labels.showDuplicates?"":f,textAnchor:b,fontSize:s,fontFamily:r,fontWeight:n,maxWidth:e.config.yaxis[t].labels.maxWidth,foreColor:y,isPlainText:!1,cssClass:"apexcharts-yaxis-label ".concat(a.cssClass)});l.add(k),this.addTooltip(k,f),0!==e.config.yaxis[t].labels.rotate&&this.rotateLabel(i,k,firstLabel,e.config.yaxis[t].labels.rotate),g+=c}}return this.addYAxisTitle(i,o,t),this.addAxisBorder(i,o,t,h,c),o}},{key:"getTextAnchor",value:function(t,e){return"left"===t?"start":"center"===t?"middle":"right"===t?"end":e?"start":"end"}},{key:"addTooltip",value:function(t,e){var i=document.createElementNS(this.w.globals.SVGNS,"title");i.textContent=Array.isArray(e)?e.join(" "):e,t.node.appendChild(i)}},{key:"rotateLabel",value:function(t,e,i,a){var s=t.rotateAroundCenter(i.node),r=t.rotateAroundCenter(e.node);e.node.setAttribute("transform","rotate(".concat(a," ").concat(s.x," ").concat(r.y,")"))}},{key:"addYAxisTitle",value:function(t,e,i){var a=this.w;if(void 0!==a.config.yaxis[i].title.text){var s=t.group({class:"apexcharts-yaxis-title"}),r=a.config.yaxis[i].opposite?a.globals.translateYAxisX[i]:0,n=t.drawText({x:r,y:a.globals.gridHeight/2+a.globals.translateY+a.config.yaxis[i].title.offsetY,text:a.config.yaxis[i].title.text,textAnchor:"end",foreColor:a.config.yaxis[i].title.style.color,fontSize:a.config.yaxis[i].title.style.fontSize,fontWeight:a.config.yaxis[i].title.style.fontWeight,fontFamily:a.config.yaxis[i].title.style.fontFamily,cssClass:"apexcharts-yaxis-title-text ".concat(a.config.yaxis[i].title.style.cssClass)});s.add(n),e.add(s)}}},{key:"addAxisBorder",value:function(t,e,i,a,s){var r=this.w,n=r.config.yaxis[i].axisBorder,o=31+n.offsetX;if(r.config.yaxis[i].opposite&&(o=-31-n.offsetX),n.show){var l=t.drawLine(o,r.globals.translateY+n.offsetY-2,o,r.globals.gridHeight+r.globals.translateY+n.offsetY+2,n.color,0,n.width);e.add(l)}r.config.yaxis[i].axisTicks.show&&this.axesUtils.drawYAxisTicks(o,a,n,r.config.yaxis[i].axisTicks,i,s,e)}},{key:"drawYaxisInversed",value:function(t){var e=this.w,i=new Mi(this.ctx),a=i.group({class:"apexcharts-xaxis apexcharts-yaxis-inversed"}),s=i.group({class:"apexcharts-xaxis-texts-g",transform:"translate(".concat(e.globals.translateXAxisX,", ").concat(e.globals.translateXAxisY,")")});a.add(s);var r=e.globals.yAxisScale[t].result.length-1,n=e.globals.gridWidth/r+.1,o=n+e.config.xaxis.labels.offsetX,l=e.globals.xLabelFormatter,h=this.axesUtils.checkForReversedLabels(t,e.globals.yAxisScale[t].result.slice()),c=e.globals.timescaleLabels;if(c.length>0&&(this.xaxisLabels=c.slice(),r=(h=c.slice()).length),e.config.xaxis.labels.show)for(var d=c.length?0:r;c.length?d=0;c.length?d++:d--){var u=l(h[d],d,e),g=e.globals.gridWidth+e.globals.padHorizontal-(o-n+e.config.xaxis.labels.offsetX);if(c.length){var p=this.axesUtils.getLabel(h,c,g,d,this.drawnLabels,this.xaxisFontSize);g=p.x,u=p.text,this.drawnLabels.push(p.text),0===d&&e.globals.skipFirstTimelinelabel&&(u=""),d===h.length-1&&e.globals.skipLastTimelinelabel&&(u="")}var f=i.drawText({x:g,y:this.xAxisoffX+e.config.xaxis.labels.offsetY+30-("top"===e.config.xaxis.position?e.globals.xAxisHeight+e.config.xaxis.axisTicks.height-2:0),text:u,textAnchor:"middle",foreColor:Array.isArray(this.xaxisForeColors)?this.xaxisForeColors[t]:this.xaxisForeColors,fontSize:this.xaxisFontSize,fontFamily:this.xaxisFontFamily,fontWeight:e.config.xaxis.labels.style.fontWeight,isPlainText:!1,cssClass:"apexcharts-xaxis-label ".concat(e.config.xaxis.labels.style.cssClass)});s.add(f),f.tspan(u),this.addTooltip(f,u),o+=n}return this.inversedYAxisTitleText(a),this.inversedYAxisBorder(a),a}},{key:"inversedYAxisBorder",value:function(t){var e=this.w,i=new Mi(this.ctx),a=e.config.xaxis.axisBorder;if(a.show){var s=0;"bar"===e.config.chart.type&&e.globals.isXNumeric&&(s-=15);var r=i.drawLine(e.globals.padHorizontal+s+a.offsetX,this.xAxisoffX,e.globals.gridWidth,this.xAxisoffX,a.color,0,a.height);this.elgrid&&this.elgrid.elGridBorders&&e.config.grid.show?this.elgrid.elGridBorders.add(r):t.add(r)}}},{key:"inversedYAxisTitleText",value:function(t){var e=this.w,i=new Mi(this.ctx);if(void 0!==e.config.xaxis.title.text){var a=i.group({class:"apexcharts-xaxis-title apexcharts-yaxis-title-inversed"}),s=i.drawText({x:e.globals.gridWidth/2+e.config.xaxis.title.offsetX,y:this.xAxisoffX+parseFloat(this.xaxisFontSize)+parseFloat(e.config.xaxis.title.style.fontSize)+e.config.xaxis.title.offsetY+20,text:e.config.xaxis.title.text,textAnchor:"middle",fontSize:e.config.xaxis.title.style.fontSize,fontFamily:e.config.xaxis.title.style.fontFamily,fontWeight:e.config.xaxis.title.style.fontWeight,foreColor:e.config.xaxis.title.style.color,cssClass:"apexcharts-xaxis-title-text ".concat(e.config.xaxis.title.style.cssClass)});a.add(s),t.add(a)}}},{key:"yAxisTitleRotate",value:function(t,e){var i=this.w,a=new Mi(this.ctx),s=i.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(t,"'] .apexcharts-yaxis-texts-g")),r=s?s.getBoundingClientRect():{width:0,height:0},n=i.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(t,"'] .apexcharts-yaxis-title text")),o=n?n.getBoundingClientRect():{width:0,height:0};if(n){var l=this.xPaddingForYAxisTitle(t,r,o,e);n.setAttribute("x",l.xPos-(e?10:0));var h=a.rotateAroundCenter(n);n.setAttribute("transform","rotate(".concat(e?-1*i.config.yaxis[t].title.rotate:i.config.yaxis[t].title.rotate," ").concat(h.x," ").concat(h.y,")"))}}},{key:"xPaddingForYAxisTitle",value:function(t,e,i,a){var s=this.w,r=0,n=10;return void 0===s.config.yaxis[t].title.text||t<0?{xPos:r,padd:0}:(a?r=e.width+s.config.yaxis[t].title.offsetX+i.width/2+n/2:(r=-1*e.width+s.config.yaxis[t].title.offsetX+n/2+i.width/2,s.globals.isBarHorizontal&&(n=25,r=-1*e.width-s.config.yaxis[t].title.offsetX-n)),{xPos:r,padd:n})}},{key:"setYAxisXPosition",value:function(t,e){var i=this.w,a=0,s=0,r=18,n=1;i.config.yaxis.length>1&&(this.multipleYs=!0),i.config.yaxis.forEach((function(o,l){var h=i.globals.ignoreYAxisIndexes.includes(l)||!o.show||o.floating||0===t[l].width,c=t[l].width+e[l].width;o.opposite?i.globals.isBarHorizontal?(s=i.globals.gridWidth+i.globals.translateX-1,i.globals.translateYAxisX[l]=s-o.labels.offsetX):(s=i.globals.gridWidth+i.globals.translateX+n,h||(n+=c+20),i.globals.translateYAxisX[l]=s-o.labels.offsetX+20):(a=i.globals.translateX-r,h||(r+=c+20),i.globals.translateYAxisX[l]=a+o.labels.offsetX)}))}},{key:"setYAxisTextAlignments",value:function(){var t=this.w;v.listToArray(t.globals.dom.baseEl.getElementsByClassName("apexcharts-yaxis")).forEach((function(e,i){var a=t.config.yaxis[i];if(a&&!a.floating&&void 0!==a.labels.align){var s=t.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(i,"'] .apexcharts-yaxis-texts-g")),r=v.listToArray(t.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxis[rel='".concat(i,"'] .apexcharts-yaxis-label"))),n=s.getBoundingClientRect();r.forEach((function(t){t.setAttribute("text-anchor",a.labels.align)})),"left"!==a.labels.align||a.opposite?"center"===a.labels.align?s.setAttribute("transform","translate(".concat(n.width/2*(a.opposite?1:-1),", 0)")):"right"===a.labels.align&&a.opposite&&s.setAttribute("transform","translate(".concat(n.width,", 0)")):s.setAttribute("transform","translate(-".concat(n.width,", 0)"))}}))}}]),t}(),aa=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.documentEvent=v.bind(this.documentEvent,this)}return s(t,[{key:"addEventListener",value:function(t,e){var i=this.w;i.globals.events.hasOwnProperty(t)?i.globals.events[t].push(e):i.globals.events[t]=[e]}},{key:"removeEventListener",value:function(t,e){var i=this.w;if(i.globals.events.hasOwnProperty(t)){var a=i.globals.events[t].indexOf(e);-1!==a&&i.globals.events[t].splice(a,1)}}},{key:"fireEvent",value:function(t,e){var i=this.w;if(i.globals.events.hasOwnProperty(t)){e&&e.length||(e=[]);for(var a=i.globals.events[t],s=a.length,r=0;r0&&(e=this.w.config.chart.locales.concat(window.Apex.chart.locales));var i=e.filter((function(e){return e.name===t}))[0];if(!i)throw new Error("Wrong locale name provided. Please make sure you set the correct locale name in options");var a=v.extend(Hi,i);this.w.globals.locale=a.options}}]),t}(),ra=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"drawAxis",value:function(t,e){var i,a,s=this,r=this.w.globals,n=this.w.config,o=new Qi(this.ctx,e),l=new ia(this.ctx,e);r.axisCharts&&"radar"!==t&&(r.isBarHorizontal?(a=l.drawYaxisInversed(0),i=o.drawXaxisInversed(0),r.dom.elGraphical.add(i),r.dom.elGraphical.add(a)):(i=o.drawXaxis(),r.dom.elGraphical.add(i),n.yaxis.map((function(t,e){if(-1===r.ignoreYAxisIndexes.indexOf(e)&&(a=l.drawYaxis(e),r.dom.Paper.add(a),"back"===s.w.config.grid.position)){var i=r.dom.Paper.children()[1];i.remove(),r.dom.Paper.add(i)}}))))}}]),t}(),na=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"drawXCrosshairs",value:function(){var t=this.w,e=new Mi(this.ctx),i=new Li(this.ctx),a=t.config.xaxis.crosshairs.fill.gradient,s=t.config.xaxis.crosshairs.dropShadow,r=t.config.xaxis.crosshairs.fill.type,n=a.colorFrom,o=a.colorTo,l=a.opacityFrom,h=a.opacityTo,c=a.stops,d=s.enabled,u=s.left,g=s.top,p=s.blur,f=s.color,x=s.opacity,b=t.config.xaxis.crosshairs.fill.color;if(t.config.xaxis.crosshairs.show){"gradient"===r&&(b=e.drawGradient("vertical",n,o,l,h,null,c,null));var m=e.drawRect();1===t.config.xaxis.crosshairs.width&&(m=e.drawLine());var y=t.globals.gridHeight;(!v.isNumber(y)||y<0)&&(y=0);var w=t.config.xaxis.crosshairs.width;(!v.isNumber(w)||w<0)&&(w=0),m.attr({class:"apexcharts-xcrosshairs",x:0,y:0,y2:y,width:w,height:y,fill:b,filter:"none","fill-opacity":t.config.xaxis.crosshairs.opacity,stroke:t.config.xaxis.crosshairs.stroke.color,"stroke-width":t.config.xaxis.crosshairs.stroke.width,"stroke-dasharray":t.config.xaxis.crosshairs.stroke.dashArray}),d&&(m=i.dropShadow(m,{left:u,top:g,blur:p,color:f,opacity:x})),t.globals.dom.elGraphical.add(m)}}},{key:"drawYCrosshairs",value:function(){var t=this.w,e=new Mi(this.ctx),i=t.config.yaxis[0].crosshairs,a=t.globals.barPadForNumericAxis;if(t.config.yaxis[0].crosshairs.show){var s=e.drawLine(-a,0,t.globals.gridWidth+a,0,i.stroke.color,i.stroke.dashArray,i.stroke.width);s.attr({class:"apexcharts-ycrosshairs"}),t.globals.dom.elGraphical.add(s)}var r=e.drawLine(-a,0,t.globals.gridWidth+a,0,i.stroke.color,0,0);r.attr({class:"apexcharts-ycrosshairs-hidden"}),t.globals.dom.elGraphical.add(r)}}]),t}(),oa=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"checkResponsiveConfig",value:function(t){var e=this,i=this.w,a=i.config;if(0!==a.responsive.length){var s=a.responsive.slice();s.sort((function(t,e){return t.breakpoint>e.breakpoint?1:e.breakpoint>t.breakpoint?-1:0})).reverse();var r=new Wi({}),n=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=s[0].breakpoint,n=window.innerWidth>0?window.innerWidth:screen.width;if(n>a){var o=v.clone(i.globals.initialConfig);o.series=v.clone(i.config.series);var l=Pi.extendArrayProps(r,o,i);t=v.extend(l,t),t=v.extend(i.config,t),e.overrideResponsiveOptions(t)}else for(var h=0;h0&&"function"==typeof t[0]?(this.isColorFn=!0,i.config.series.map((function(a,s){var r=t[s]||t[0];return"function"==typeof r?r({value:i.globals.axisCharts?i.globals.series[s][0]||0:i.globals.series[s],seriesIndex:s,dataPointIndex:s,w:e.w}):r}))):t:this.predefined()}},{key:"applySeriesColors",value:function(t,e){t.forEach((function(t,i){t&&(e[i]=t)}))}},{key:"getMonochromeColors",value:function(t,e,i){var a=t.color,s=t.shadeIntensity,r=t.shadeTo,n=this.isBarDistributed||this.isHeatmapDistributed?e[0].length*e.length:e.length,o=1/(n/s),l=0;return Array.from({length:n},(function(){var t="dark"===r?i.shadeColor(-1*l,a):i.shadeColor(l,a);return l+=o,t}))}},{key:"applyColorTypes",value:function(t,e){var i=this,a=this.w;t.forEach((function(t){a.globals[t].colors=void 0===a.config[t].colors?i.isColorFn?a.config.colors:e:a.config[t].colors.slice(),i.pushExtraColors(a.globals[t].colors)}))}},{key:"applyDataLabelsColors",value:function(t){var e=this.w;e.globals.dataLabels.style.colors=void 0===e.config.dataLabels.style.colors?t:e.config.dataLabels.style.colors.slice(),this.pushExtraColors(e.globals.dataLabels.style.colors,50)}},{key:"applyRadarPolygonsColors",value:function(){var t=this.w;t.globals.radarPolygons.fill.colors=void 0===t.config.plotOptions.radar.polygons.fill.colors?["dark"===t.config.theme.mode?"#424242":"none"]:t.config.plotOptions.radar.polygons.fill.colors.slice(),this.pushExtraColors(t.globals.radarPolygons.fill.colors,20)}},{key:"applyMarkersColors",value:function(t){var e=this.w;e.globals.markers.colors=void 0===e.config.markers.colors?t:e.config.markers.colors.slice(),this.pushExtraColors(e.globals.markers.colors)}},{key:"pushExtraColors",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=this.w,s=e||a.globals.series.length;if(null===i&&(i=this.isBarDistributed||this.isHeatmapDistributed||"heatmap"===a.config.chart.type&&a.config.plotOptions.heatmap&&a.config.plotOptions.heatmap.colorScale.inverse),i&&a.globals.series.length&&(s=a.globals.series[a.globals.maxValsInArrayIndex].length*a.globals.series.length),t.lengtht.globals.svgWidth&&(this.dCtx.lgRect.width=t.globals.svgWidth/1.5),this.dCtx.lgRect}},{key:"getDatalabelsRect",value:function(){var t=this,e=this.w,i=[];e.config.series.forEach((function(s,r){s.data.forEach((function(s,n){var o;o=e.globals.series[r][n],a=e.config.dataLabels.formatter(o,{ctx:t.dCtx.ctx,seriesIndex:r,dataPointIndex:n,w:e}),i.push(a)}))}));var a=v.getLargestStringFromArr(i),s=new Mi(this.dCtx.ctx),r=e.config.dataLabels.style,n=s.getTextRects(a,parseInt(r.fontSize),r.fontFamily);return{width:1.05*n.width,height:n.height}}},{key:"getLargestStringFromMultiArr",value:function(t,e){var i=t;if(this.w.globals.isMultiLineX){var a=e.map((function(t,e){return Array.isArray(t)?t.length:1})),s=Math.max.apply(Math,f(a));i=e[a.indexOf(s)]}return i}}]),t}(),da=function(){function t(e){i(this,t),this.w=e.w,this.dCtx=e}return s(t,[{key:"getxAxisLabelsCoords",value:function(){var t,e=this.w,i=e.globals.labels.slice();if(e.config.xaxis.convertedCatToNumeric&&0===i.length&&(i=e.globals.categoryLabels),e.globals.timescaleLabels.length>0){var a=this.getxAxisTimeScaleLabelsCoords();t={width:a.width,height:a.height},e.globals.rotateXLabels=!1}else{this.dCtx.lgWidthForSideLegends="left"!==e.config.legend.position&&"right"!==e.config.legend.position||e.config.legend.floating?0:this.dCtx.lgRect.width;var s=e.globals.xLabelFormatter,r=v.getLargestStringFromArr(i),n=this.dCtx.dimHelpers.getLargestStringFromMultiArr(r,i);e.globals.isBarHorizontal&&(n=r=e.globals.yAxisScale[0].result.reduce((function(t,e){return t.length>e.length?t:e}),0));var o=new Xi(this.dCtx.ctx),l=r;r=o.xLabelFormat(s,r,l,{i:void 0,dateFormatter:new zi(this.dCtx.ctx).formatDate,w:e}),n=o.xLabelFormat(s,n,l,{i:void 0,dateFormatter:new zi(this.dCtx.ctx).formatDate,w:e}),(e.config.xaxis.convertedCatToNumeric&&void 0===r||""===String(r).trim())&&(n=r="1");var h=new Mi(this.dCtx.ctx),c=h.getTextRects(r,e.config.xaxis.labels.style.fontSize),d=c;if(r!==n&&(d=h.getTextRects(n,e.config.xaxis.labels.style.fontSize)),(t={width:c.width>=d.width?c.width:d.width,height:c.height>=d.height?c.height:d.height}).width*i.length>e.globals.svgWidth-this.dCtx.lgWidthForSideLegends-this.dCtx.yAxisWidth-this.dCtx.gridPad.left-this.dCtx.gridPad.right&&0!==e.config.xaxis.labels.rotate||e.config.xaxis.labels.rotateAlways){if(!e.globals.isBarHorizontal){e.globals.rotateXLabels=!0;var u=function(t){return h.getTextRects(t,e.config.xaxis.labels.style.fontSize,e.config.xaxis.labels.style.fontFamily,"rotate(".concat(e.config.xaxis.labels.rotate," 0 0)"),!1)};c=u(r),r!==n&&(d=u(n)),t.height=(c.height>d.height?c.height:d.height)/1.5,t.width=c.width>d.width?c.width:d.width}}else e.globals.rotateXLabels=!1}return e.config.xaxis.labels.show||(t={width:0,height:0}),{width:t.width,height:t.height}}},{key:"getxAxisGroupLabelsCoords",value:function(){var t,e=this.w;if(!e.globals.hasXaxisGroups)return{width:0,height:0};var i,a=(null===(t=e.config.xaxis.group.style)||void 0===t?void 0:t.fontSize)||e.config.xaxis.labels.style.fontSize,s=e.globals.groups.map((function(t){return t.title})),r=v.getLargestStringFromArr(s),n=this.dCtx.dimHelpers.getLargestStringFromMultiArr(r,s),o=new Mi(this.dCtx.ctx),l=o.getTextRects(r,a),h=l;return r!==n&&(h=o.getTextRects(n,a)),i={width:l.width>=h.width?l.width:h.width,height:l.height>=h.height?l.height:h.height},e.config.xaxis.labels.show||(i={width:0,height:0}),{width:i.width,height:i.height}}},{key:"getxAxisTitleCoords",value:function(){var t=this.w,e=0,i=0;if(void 0!==t.config.xaxis.title.text){var a=new Mi(this.dCtx.ctx).getTextRects(t.config.xaxis.title.text,t.config.xaxis.title.style.fontSize);e=a.width,i=a.height}return{width:e,height:i}}},{key:"getxAxisTimeScaleLabelsCoords",value:function(){var t,e=this.w;this.dCtx.timescaleLabels=e.globals.timescaleLabels.slice();var i=this.dCtx.timescaleLabels.map((function(t){return t.value})),a=i.reduce((function(t,e){return void 0===t?(console.error("You have possibly supplied invalid Date format. Please supply a valid JavaScript Date"),0):t.length>e.length?t:e}),0);return 1.05*(t=new Mi(this.dCtx.ctx).getTextRects(a,e.config.xaxis.labels.style.fontSize)).width*i.length>e.globals.gridWidth&&0!==e.config.xaxis.labels.rotate&&(e.globals.overlappingXLabels=!0),t}},{key:"additionalPaddingXLabels",value:function(t){var e=this,i=this.w,a=i.globals,s=i.config,r=s.xaxis.type,n=t.width;a.skipLastTimelinelabel=!1,a.skipFirstTimelinelabel=!1;var o=i.config.yaxis[0].opposite&&i.globals.isBarHorizontal,l=function(t,o){s.yaxis.length>1&&function(t){return-1!==a.collapsedSeriesIndices.indexOf(t)}(o)||function(t){if(e.dCtx.timescaleLabels&&e.dCtx.timescaleLabels.length){var o=e.dCtx.timescaleLabels[0],l=e.dCtx.timescaleLabels[e.dCtx.timescaleLabels.length-1].position+n/1.75-e.dCtx.yAxisWidthRight,h=o.position-n/1.75+e.dCtx.yAxisWidthLeft,c="right"===i.config.legend.position&&e.dCtx.lgRect.width>0?e.dCtx.lgRect.width:0;l>a.svgWidth-a.translateX-c&&(a.skipLastTimelinelabel=!0),h<-(t.show&&!t.floating||"bar"!==s.chart.type&&"candlestick"!==s.chart.type&&"rangeBar"!==s.chart.type&&"boxPlot"!==s.chart.type?10:n/1.75)&&(a.skipFirstTimelinelabel=!0)}else"datetime"===r?e.dCtx.gridPad.right(null===(a=String(c(e,o)))||void 0===a?void 0:a.length)?t:e}),d),g=u=c(u,o);if(void 0!==u&&0!==u.length||(u=l.niceMax),e.globals.isBarHorizontal){a=0;var p=e.globals.labels.slice();u=v.getLargestStringFromArr(p),u=c(u,{seriesIndex:n,dataPointIndex:-1,w:e}),g=t.dCtx.dimHelpers.getLargestStringFromMultiArr(u,p)}var f=new Mi(t.dCtx.ctx),x="rotate(".concat(r.labels.rotate," 0 0)"),b=f.getTextRects(u,r.labels.style.fontSize,r.labels.style.fontFamily,x,!1),m=b;u!==g&&(m=f.getTextRects(g,r.labels.style.fontSize,r.labels.style.fontFamily,x,!1)),i.push({width:(h>m.width||h>b.width?h:m.width>b.width?m.width:b.width)+a,height:m.height>b.height?m.height:b.height})}else i.push({width:0,height:0})})),i}},{key:"getyAxisTitleCoords",value:function(){var t=this,e=this.w,i=[];return e.config.yaxis.map((function(e,a){if(e.show&&void 0!==e.title.text){var s=new Mi(t.dCtx.ctx),r="rotate(".concat(e.title.rotate," 0 0)"),n=s.getTextRects(e.title.text,e.title.style.fontSize,e.title.style.fontFamily,r,!1);i.push({width:n.width,height:n.height})}else i.push({width:0,height:0})})),i}},{key:"getTotalYAxisWidth",value:function(){var t=this.w,e=0,i=0,a=0,s=t.globals.yAxisScale.length>1?10:0,r=new Ri(this.dCtx.ctx),n=function(n,o){var l=t.config.yaxis[o].floating,h=0;n.width>0&&!l?(h=n.width+s,function(e){return t.globals.ignoreYAxisIndexes.indexOf(e)>-1}(o)&&(h=h-n.width-s)):h=l||r.isYAxisHidden(o)?0:5,t.config.yaxis[o].opposite?a+=h:i+=h,e+=h};return t.globals.yLabelsCoords.map((function(t,e){n(t,e)})),t.globals.yTitleCoords.map((function(t,e){n(t,e)})),t.globals.isBarHorizontal&&!t.config.yaxis[0].floating&&(e=t.globals.yLabelsCoords[0].width+t.globals.yTitleCoords[0].width+15),this.dCtx.yAxisWidthLeft=i,this.dCtx.yAxisWidthRight=a,e}}]),t}(),ga=function(){function t(e){i(this,t),this.w=e.w,this.dCtx=e}return s(t,[{key:"gridPadForColumnsInNumericAxis",value:function(t){var e=this.w,i=e.config,a=e.globals;if(a.noData||a.collapsedSeries.length+a.ancillaryCollapsedSeries.length===i.series.length)return 0;var s=function(t){return["bar","rangeBar","candlestick","boxPlot"].includes(t)},r=i.chart.type,n=0,o=s(r)?i.series.length:1;a.comboBarCount>0&&(o=a.comboBarCount),a.collapsedSeries.forEach((function(t){s(t.type)&&(o-=1)})),i.chart.stacked&&(o=1);var l=s(r)||a.comboBarCount>0,h=Math.abs(a.initialMaxX-a.initialMinX);if(l&&a.isXNumeric&&!a.isBarHorizontal&&o>0&&0!==h){h<=3&&(h=a.dataPoints);var c=h/t,d=a.minXDiff&&a.minXDiff/c>0?a.minXDiff/c:0;d>t/2&&(d/=2),(n=d*parseInt(i.plotOptions.bar.columnWidth,10)/100)<1&&(n=1),a.barPadForNumericAxis=n}return n}},{key:"gridPadFortitleSubtitle",value:function(){var t=this,e=this.w,i=e.globals,a=this.dCtx.isSparkline||!i.axisCharts?0:10;["title","subtitle"].forEach((function(s){void 0!==e.config[s].text?a+=e.config[s].margin:a+=t.dCtx.isSparkline||!i.axisCharts?0:5})),!e.config.legend.show||"bottom"!==e.config.legend.position||e.config.legend.floating||i.axisCharts||(a+=10);var s=this.dCtx.dimHelpers.getTitleSubtitleCoords("title"),r=this.dCtx.dimHelpers.getTitleSubtitleCoords("subtitle");i.gridHeight-=s.height+r.height+a,i.translateY+=s.height+r.height+a}},{key:"setGridXPosForDualYAxis",value:function(t,e){var i=this.w,a=new Ri(this.dCtx.ctx);i.config.yaxis.forEach((function(s,r){-1!==i.globals.ignoreYAxisIndexes.indexOf(r)||s.floating||a.isYAxisHidden(r)||(s.opposite&&(i.globals.translateX-=e[r].width+t[r].width+parseInt(s.labels.style.fontSize,10)/1.2+12),i.globals.translateX<2&&(i.globals.translateX=2))}))}}]),t}(),pa=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.lgRect={},this.yAxisWidth=0,this.yAxisWidthLeft=0,this.yAxisWidthRight=0,this.xAxisHeight=0,this.isSparkline=this.w.config.chart.sparkline.enabled,this.dimHelpers=new ca(this),this.dimYAxis=new ua(this),this.dimXAxis=new da(this),this.dimGrid=new ga(this),this.lgWidthForSideLegends=0,this.gridPad=this.w.config.grid.padding,this.xPadRight=0,this.xPadLeft=0}return s(t,[{key:"plotCoords",value:function(){var t=this,e=this.w,i=e.globals;this.lgRect=this.dimHelpers.getLegendsRect(),this.datalabelsCoords={width:0,height:0};var a=Array.isArray(e.config.stroke.width)?Math.max.apply(Math,f(e.config.stroke.width)):e.config.stroke.width;this.isSparkline&&((e.config.markers.discrete.length>0||e.config.markers.size>0)&&Object.entries(this.gridPad).forEach((function(e){var i=p(e,2),a=i[0],s=i[1];t.gridPad[a]=Math.max(s,t.w.globals.markers.largestSize/1.5)})),this.gridPad.top=Math.max(a/2,this.gridPad.top),this.gridPad.bottom=Math.max(a/2,this.gridPad.bottom)),i.axisCharts?this.setDimensionsForAxisCharts():this.setDimensionsForNonAxisCharts(),this.dimGrid.gridPadFortitleSubtitle(),i.gridHeight=i.gridHeight-this.gridPad.top-this.gridPad.bottom,i.gridWidth=i.gridWidth-this.gridPad.left-this.gridPad.right-this.xPadRight-this.xPadLeft;var s=this.dimGrid.gridPadForColumnsInNumericAxis(i.gridWidth);i.gridWidth=i.gridWidth-2*s,i.translateX=i.translateX+this.gridPad.left+this.xPadLeft+(s>0?s:0),i.translateY=i.translateY+this.gridPad.top}},{key:"setDimensionsForAxisCharts",value:function(){var t=this,e=this.w,i=e.globals,a=this.dimYAxis.getyAxisLabelsCoords(),s=this.dimYAxis.getyAxisTitleCoords();i.isSlopeChart&&(this.datalabelsCoords=this.dimHelpers.getDatalabelsRect()),e.globals.yLabelsCoords=[],e.globals.yTitleCoords=[],e.config.yaxis.map((function(t,i){e.globals.yLabelsCoords.push({width:a[i].width,index:i}),e.globals.yTitleCoords.push({width:s[i].width,index:i})})),this.yAxisWidth=this.dimYAxis.getTotalYAxisWidth();var r=this.dimXAxis.getxAxisLabelsCoords(),n=this.dimXAxis.getxAxisGroupLabelsCoords(),o=this.dimXAxis.getxAxisTitleCoords();this.conditionalChecksForAxisCoords(r,o,n),i.translateXAxisY=e.globals.rotateXLabels?this.xAxisHeight/8:-4,i.translateXAxisX=e.globals.rotateXLabels&&e.globals.isXNumeric&&e.config.xaxis.labels.rotate<=-45?-this.xAxisWidth/4:0,e.globals.isBarHorizontal&&(i.rotateXLabels=!1,i.translateXAxisY=parseInt(e.config.xaxis.labels.style.fontSize,10)/1.5*-1),i.translateXAxisY=i.translateXAxisY+e.config.xaxis.labels.offsetY,i.translateXAxisX=i.translateXAxisX+e.config.xaxis.labels.offsetX;var l=this.yAxisWidth,h=this.xAxisHeight;i.xAxisLabelsHeight=this.xAxisHeight-o.height,i.xAxisGroupLabelsHeight=i.xAxisLabelsHeight-r.height,i.xAxisLabelsWidth=this.xAxisWidth,i.xAxisHeight=this.xAxisHeight;var c=10;("radar"===e.config.chart.type||this.isSparkline)&&(l=0,h=0),this.isSparkline&&(this.lgRect={height:0,width:0}),(this.isSparkline||"treemap"===e.config.chart.type)&&(l=0,h=0,c=0),this.isSparkline||"treemap"===e.config.chart.type||this.dimXAxis.additionalPaddingXLabels(r);var d=function(){i.translateX=l+t.datalabelsCoords.width,i.gridHeight=i.svgHeight-t.lgRect.height-h-(t.isSparkline||"treemap"===e.config.chart.type?0:e.globals.rotateXLabels?10:15),i.gridWidth=i.svgWidth-l-2*t.datalabelsCoords.width};switch("top"===e.config.xaxis.position&&(c=i.xAxisHeight-e.config.xaxis.axisTicks.height-5),e.config.legend.position){case"bottom":i.translateY=c,d();break;case"top":i.translateY=this.lgRect.height+c,d();break;case"left":i.translateY=c,i.translateX=this.lgRect.width+l+this.datalabelsCoords.width,i.gridHeight=i.svgHeight-h-12,i.gridWidth=i.svgWidth-this.lgRect.width-l-2*this.datalabelsCoords.width;break;case"right":i.translateY=c,i.translateX=l+this.datalabelsCoords.width,i.gridHeight=i.svgHeight-h-12,i.gridWidth=i.svgWidth-this.lgRect.width-l-2*this.datalabelsCoords.width-5;break;default:throw new Error("Legend position not supported")}this.dimGrid.setGridXPosForDualYAxis(s,a),new ia(this.ctx).setYAxisXPosition(a,s)}},{key:"setDimensionsForNonAxisCharts",value:function(){var t=this.w,e=t.globals,i=t.config,a=0;t.config.legend.show&&!t.config.legend.floating&&(a=20);var s="pie"===i.chart.type||"polarArea"===i.chart.type||"donut"===i.chart.type?"pie":"radialBar",r=i.plotOptions[s].offsetY,n=i.plotOptions[s].offsetX;if(!i.legend.show||i.legend.floating){e.gridHeight=e.svgHeight;var o=e.dom.elWrap.getBoundingClientRect().width;return e.gridWidth=Math.min(o,e.gridHeight),e.translateY=r,void(e.translateX=n+(e.svgWidth-e.gridWidth)/2)}switch(i.legend.position){case"bottom":e.gridHeight=e.svgHeight-this.lgRect.height,e.gridWidth=e.svgWidth,e.translateY=r-10,e.translateX=n+(e.svgWidth-e.gridWidth)/2;break;case"top":e.gridHeight=e.svgHeight-this.lgRect.height,e.gridWidth=e.svgWidth,e.translateY=this.lgRect.height+r+10,e.translateX=n+(e.svgWidth-e.gridWidth)/2;break;case"left":e.gridWidth=e.svgWidth-this.lgRect.width-a,e.gridHeight="auto"!==i.chart.height?e.svgHeight:e.gridWidth,e.translateY=r,e.translateX=n+this.lgRect.width+a;break;case"right":e.gridWidth=e.svgWidth-this.lgRect.width-a-5,e.gridHeight="auto"!==i.chart.height?e.svgHeight:e.gridWidth,e.translateY=r,e.translateX=n+10;break;default:throw new Error("Legend position not supported")}}},{key:"conditionalChecksForAxisCoords",value:function(t,e,i){var a=this.w,s=a.globals.hasXaxisGroups?2:1,r=i.height+t.height+e.height,n=a.globals.isMultiLineX?1.2:a.globals.LINE_HEIGHT_RATIO,o=a.globals.rotateXLabels?22:10,l=a.globals.rotateXLabels&&"bottom"===a.config.legend.position?10:0;this.xAxisHeight=r*n+s*o+l,this.xAxisWidth=t.width,this.xAxisHeight-e.height>a.config.xaxis.labels.maxHeight&&(this.xAxisHeight=a.config.xaxis.labels.maxHeight),a.config.xaxis.labels.minHeight&&this.xAxisHeightc&&(this.yAxisWidth=c)}}]),t}(),fa=function(){function t(e){i(this,t),this.w=e.w,this.lgCtx=e}return s(t,[{key:"getLegendStyles",value:function(){var t,e,i,a=document.createElement("style");a.setAttribute("type","text/css");var s=(null===(t=this.lgCtx.ctx)||void 0===t||null===(e=t.opts)||void 0===e||null===(i=e.chart)||void 0===i?void 0:i.nonce)||this.w.config.chart.nonce;s&&a.setAttribute("nonce",s);var r=document.createTextNode("\n .apexcharts-flip-y {\n transform: scaleY(-1) translateY(-100%);\n transform-origin: top;\n transform-box: fill-box;\n }\n .apexcharts-flip-x {\n transform: scaleX(-1);\n transform-origin: center;\n transform-box: fill-box;\n }\n .apexcharts-legend {\n display: flex;\n overflow: auto;\n padding: 0 10px;\n }\n .apexcharts-legend.apexcharts-legend-group-horizontal {\n flex-direction: column;\n }\n .apexcharts-legend-group {\n display: flex;\n }\n .apexcharts-legend-group-vertical {\n flex-direction: column-reverse;\n }\n .apexcharts-legend.apx-legend-position-bottom, .apexcharts-legend.apx-legend-position-top {\n flex-wrap: wrap\n }\n .apexcharts-legend.apx-legend-position-right, .apexcharts-legend.apx-legend-position-left {\n flex-direction: column;\n bottom: 0;\n }\n .apexcharts-legend.apx-legend-position-bottom.apexcharts-align-left, .apexcharts-legend.apx-legend-position-top.apexcharts-align-left, .apexcharts-legend.apx-legend-position-right, .apexcharts-legend.apx-legend-position-left {\n justify-content: flex-start;\n align-items: flex-start;\n }\n .apexcharts-legend.apx-legend-position-bottom.apexcharts-align-center, .apexcharts-legend.apx-legend-position-top.apexcharts-align-center {\n justify-content: center;\n align-items: center;\n }\n .apexcharts-legend.apx-legend-position-bottom.apexcharts-align-right, .apexcharts-legend.apx-legend-position-top.apexcharts-align-right {\n justify-content: flex-end;\n align-items: flex-end;\n }\n .apexcharts-legend-series {\n cursor: pointer;\n line-height: normal;\n display: flex;\n align-items: center;\n }\n .apexcharts-legend-text {\n position: relative;\n font-size: 14px;\n }\n .apexcharts-legend-text *, .apexcharts-legend-marker * {\n pointer-events: none;\n }\n .apexcharts-legend-marker {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n margin-right: 1px;\n }\n\n .apexcharts-legend-series.apexcharts-no-click {\n cursor: auto;\n }\n .apexcharts-legend .apexcharts-hidden-zero-series, .apexcharts-legend .apexcharts-hidden-null-series {\n display: none !important;\n }\n .apexcharts-inactive-legend {\n opacity: 0.45;\n }\n\n ");return a.appendChild(r),a}},{key:"getLegendDimensions",value:function(){var t=this.w.globals.dom.baseEl.querySelector(".apexcharts-legend").getBoundingClientRect(),e=t.width;return{clwh:t.height,clww:e}}},{key:"appendToForeignObject",value:function(){this.w.globals.dom.elLegendForeign.appendChild(this.getLegendStyles())}},{key:"toggleDataSeries",value:function(t,e){var i=this,a=this.w;if(a.globals.axisCharts||"radialBar"===a.config.chart.type){a.globals.resized=!0;var s=null,r=null;if(a.globals.risingSeries=[],a.globals.axisCharts?(s=a.globals.dom.baseEl.querySelector(".apexcharts-series[data\\:realIndex='".concat(t,"']")),r=parseInt(s.getAttribute("data:realIndex"),10)):(s=a.globals.dom.baseEl.querySelector(".apexcharts-series[rel='".concat(t+1,"']")),r=parseInt(s.getAttribute("rel"),10)-1),e)[{cs:a.globals.collapsedSeries,csi:a.globals.collapsedSeriesIndices},{cs:a.globals.ancillaryCollapsedSeries,csi:a.globals.ancillaryCollapsedSeriesIndices}].forEach((function(t){i.riseCollapsedSeries(t.cs,t.csi,r)}));else this.hideSeries({seriesEl:s,realIndex:r})}else{var n=a.globals.dom.Paper.findOne(" .apexcharts-series[rel='".concat(t+1,"'] path")),o=a.config.chart.type;if("pie"===o||"polarArea"===o||"donut"===o){var l=a.config.plotOptions.pie.donut.labels;new Mi(this.lgCtx.ctx).pathMouseDown(n,null),this.lgCtx.ctx.pie.printDataLabelsInner(n.node,l)}n.fire("click")}}},{key:"getSeriesAfterCollapsing",value:function(t){var e=t.realIndex,i=this.w,a=i.globals,s=v.clone(i.config.series);if(a.axisCharts){var r=i.config.yaxis[a.seriesYAxisReverseMap[e]],n={index:e,data:s[e].data.slice(),type:s[e].type||i.config.chart.type};if(r&&r.show&&r.showAlways)a.ancillaryCollapsedSeriesIndices.indexOf(e)<0&&(a.ancillaryCollapsedSeries.push(n),a.ancillaryCollapsedSeriesIndices.push(e));else if(a.collapsedSeriesIndices.indexOf(e)<0){a.collapsedSeries.push(n),a.collapsedSeriesIndices.push(e);var o=a.risingSeries.indexOf(e);a.risingSeries.splice(o,1)}}else a.collapsedSeries.push({index:e,data:s[e]}),a.collapsedSeriesIndices.push(e);return a.allSeriesCollapsed=a.collapsedSeries.length+a.ancillaryCollapsedSeries.length===i.config.series.length,this._getSeriesBasedOnCollapsedState(s)}},{key:"hideSeries",value:function(t){for(var e=t.seriesEl,i=t.realIndex,a=this.w,s=this.getSeriesAfterCollapsing({realIndex:i}),r=e.childNodes,n=0;n0){for(var r=0;r1;if(this.legendHelpers.appendToForeignObject(),(a||!e.axisCharts)&&i.legend.show){for(;e.dom.elLegendWrap.firstChild;)e.dom.elLegendWrap.removeChild(e.dom.elLegendWrap.firstChild);this.drawLegends(),"bottom"===i.legend.position||"top"===i.legend.position?this.legendAlignHorizontal():"right"!==i.legend.position&&"left"!==i.legend.position||this.legendAlignVertical()}}},{key:"createLegendMarker",value:function(t){var e=t.i,i=t.fillcolor,a=this.w,s=document.createElement("span");s.classList.add("apexcharts-legend-marker");var r=a.config.legend.markers.shape||a.config.markers.shape,n=r;Array.isArray(r)&&(n=r[e]);var o=Array.isArray(a.config.legend.markers.size)?parseFloat(a.config.legend.markers.size[e]):parseFloat(a.config.legend.markers.size),l=Array.isArray(a.config.legend.markers.offsetX)?parseFloat(a.config.legend.markers.offsetX[e]):parseFloat(a.config.legend.markers.offsetX),h=Array.isArray(a.config.legend.markers.offsetY)?parseFloat(a.config.legend.markers.offsetY[e]):parseFloat(a.config.legend.markers.offsetY),c=Array.isArray(a.config.legend.markers.strokeWidth)?parseFloat(a.config.legend.markers.strokeWidth[e]):parseFloat(a.config.legend.markers.strokeWidth),d=s.style;if(d.height=2*(o+c)+"px",d.width=2*(o+c)+"px",d.left=l+"px",d.top=h+"px",a.config.legend.markers.customHTML)d.background="transparent",d.color=i[e],Array.isArray(a.config.legend.markers.customHTML)?a.config.legend.markers.customHTML[e]&&(s.innerHTML=a.config.legend.markers.customHTML[e]()):s.innerHTML=a.config.legend.markers.customHTML();else{var g=new Vi(this.ctx).getMarkerConfig({cssClass:"apexcharts-legend-marker apexcharts-marker apexcharts-marker-".concat(n),seriesIndex:e,strokeWidth:c,size:o}),p=window.SVG().addTo(s).size("100%","100%"),f=new Mi(this.ctx).drawMarker(0,0,u(u({},g),{},{pointFillColor:Array.isArray(i)?i[e]:g.pointFillColor,shape:n}));a.globals.dom.Paper.find(".apexcharts-legend-marker.apexcharts-marker").forEach((function(t){t.node.classList.contains("apexcharts-marker-triangle")?t.node.style.transform="translate(50%, 45%)":t.node.style.transform="translate(50%, 50%)"})),p.add(f)}return s}},{key:"drawLegends",value:function(){var t=this,e=this,i=this.w,a=i.config.legend.fontFamily,s=i.globals.seriesNames,r=i.config.legend.markers.fillColors?i.config.legend.markers.fillColors.slice():i.globals.colors.slice();if("heatmap"===i.config.chart.type){var n=i.config.plotOptions.heatmap.colorScale.ranges;s=n.map((function(t){return t.name?t.name:t.from+" - "+t.to})),r=n.map((function(t){return t.color}))}else this.isBarsDistributed&&(s=i.globals.labels.slice());i.config.legend.customLegendItems.length&&(s=i.config.legend.customLegendItems);var o=i.globals.legendFormatter,l=i.config.legend.inverseOrder,h=[];i.globals.seriesGroups.length>1&&i.config.legend.clusterGroupedSeries&&i.globals.seriesGroups.forEach((function(t,e){h[e]=document.createElement("div"),h[e].classList.add("apexcharts-legend-group","apexcharts-legend-group-".concat(e)),"horizontal"===i.config.legend.clusterGroupedSeriesOrientation?i.globals.dom.elLegendWrap.classList.add("apexcharts-legend-group-horizontal"):h[e].classList.add("apexcharts-legend-group-vertical")}));for(var c=function(e){var n,l=o(s[e],{seriesIndex:e,w:i}),c=!1,d=!1;if(i.globals.collapsedSeries.length>0)for(var u=0;u0)for(var g=0;g=0:d<=s.length-1;l?d--:d++)c(d);i.globals.dom.elWrap.addEventListener("click",e.onLegendClick,!0),i.config.legend.onItemHover.highlightDataSeries&&0===i.config.legend.customLegendItems.length&&(i.globals.dom.elWrap.addEventListener("mousemove",e.onLegendHovered,!0),i.globals.dom.elWrap.addEventListener("mouseout",e.onLegendHovered,!0))}},{key:"setLegendWrapXY",value:function(t,e){var i=this.w,a=i.globals.dom.elLegendWrap,s=a.clientHeight,r=0,n=0;if("bottom"===i.config.legend.position)n=i.globals.svgHeight-Math.min(s,i.globals.svgHeight/2)-5;else if("top"===i.config.legend.position){var o=new pa(this.ctx),l=o.dimHelpers.getTitleSubtitleCoords("title").height,h=o.dimHelpers.getTitleSubtitleCoords("subtitle").height;n=(l>0?l-10:0)+(h>0?h-10:0)}a.style.position="absolute",r=r+t+i.config.legend.offsetX,n=n+e+i.config.legend.offsetY,a.style.left=r+"px",a.style.top=n+"px","right"===i.config.legend.position&&(a.style.left="auto",a.style.right=25+i.config.legend.offsetX+"px");["width","height"].forEach((function(t){a.style[t]&&(a.style[t]=parseInt(i.config.legend[t],10)+"px")}))}},{key:"legendAlignHorizontal",value:function(){var t=this.w;t.globals.dom.elLegendWrap.style.right=0;var e=new pa(this.ctx),i=e.dimHelpers.getTitleSubtitleCoords("title"),a=e.dimHelpers.getTitleSubtitleCoords("subtitle"),s=0;"top"===t.config.legend.position&&(s=i.height+a.height+t.config.title.margin+t.config.subtitle.margin-10),this.setLegendWrapXY(20,s)}},{key:"legendAlignVertical",value:function(){var t=this.w,e=this.legendHelpers.getLegendDimensions(),i=0;"left"===t.config.legend.position&&(i=20),"right"===t.config.legend.position&&(i=t.globals.svgWidth-e.clww-10),this.setLegendWrapXY(i,20)}},{key:"onLegendHovered",value:function(t){var e=this.w,i=t.target.classList.contains("apexcharts-legend-series")||t.target.classList.contains("apexcharts-legend-text")||t.target.classList.contains("apexcharts-legend-marker");if("heatmap"===e.config.chart.type||this.isBarsDistributed){if(i){var a=parseInt(t.target.getAttribute("rel"),10)-1;this.ctx.events.fireEvent("legendHover",[this.ctx,a,this.w]),new Zi(this.ctx).highlightRangeInSeries(t,t.target)}}else!t.target.classList.contains("apexcharts-inactive-legend")&&i&&new Zi(this.ctx).toggleSeriesOnHover(t,t.target)}},{key:"onLegendClick",value:function(t){var e=this.w;if(!e.config.legend.customLegendItems.length&&(t.target.classList.contains("apexcharts-legend-series")||t.target.classList.contains("apexcharts-legend-text")||t.target.classList.contains("apexcharts-legend-marker"))){var i=parseInt(t.target.getAttribute("rel"),10)-1,a="true"===t.target.getAttribute("data:collapsed"),s=this.w.config.chart.events.legendClick;"function"==typeof s&&s(this.ctx,i,this.w),this.ctx.events.fireEvent("legendClick",[this.ctx,i,this.w]);var r=this.w.config.legend.markers.onClick;"function"==typeof r&&t.target.classList.contains("apexcharts-legend-marker")&&(r(this.ctx,i,this.w),this.ctx.events.fireEvent("legendMarkerClick",[this.ctx,i,this.w])),"treemap"!==e.config.chart.type&&"heatmap"!==e.config.chart.type&&!this.isBarsDistributed&&e.config.legend.onItemClick.toggleDataSeries&&this.legendHelpers.toggleDataSeries(i,a)}}}]),t}(),ba=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w;var a=this.w;this.ev=this.w.config.chart.events,this.selectedClass="apexcharts-selected",this.localeValues=this.w.globals.locale.toolbar,this.minX=a.globals.minX,this.maxX=a.globals.maxX}return s(t,[{key:"createToolbar",value:function(){var t=this,e=this.w,i=function(){return document.createElement("div")},a=i();if(a.setAttribute("class","apexcharts-toolbar"),a.style.top=e.config.chart.toolbar.offsetY+"px",a.style.right=3-e.config.chart.toolbar.offsetX+"px",e.globals.dom.elWrap.appendChild(a),this.elZoom=i(),this.elZoomIn=i(),this.elZoomOut=i(),this.elPan=i(),this.elSelection=i(),this.elZoomReset=i(),this.elMenuIcon=i(),this.elMenu=i(),this.elCustomIcons=[],this.t=e.config.chart.toolbar.tools,Array.isArray(this.t.customIcons))for(var s=0;s\n \n \n\n'),n("zoomOut",this.elZoomOut,'\n \n \n\n');var o=function(i){t.t[i]&&e.config.chart[i].enabled&&r.push({el:"zoom"===i?t.elZoom:t.elSelection,icon:"string"==typeof t.t[i]?t.t[i]:"zoom"===i?'\n \n \n \n':'\n \n \n',title:t.localeValues["zoom"===i?"selectionZoom":"selection"],class:e.globals.isTouchDevice?"apexcharts-element-hidden":"apexcharts-".concat(i,"-icon")})};o("zoom"),o("selection"),this.t.pan&&e.config.chart.zoom.enabled&&r.push({el:this.elPan,icon:"string"==typeof this.t.pan?this.t.pan:'\n \n \n \n \n \n \n \n',title:this.localeValues.pan,class:e.globals.isTouchDevice?"apexcharts-element-hidden":"apexcharts-pan-icon"}),n("reset",this.elZoomReset,'\n \n \n'),this.t.download&&r.push({el:this.elMenuIcon,icon:"string"==typeof this.t.download?this.t.download:'',title:this.localeValues.menu,class:"apexcharts-menu-icon"});for(var l=0;lthis.wheelDelay&&(this.executeMouseWheelZoom(t),i.globals.lastWheelExecution=a),this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout((function(){a-i.globals.lastWheelExecution>e.wheelDelay&&(e.executeMouseWheelZoom(t),i.globals.lastWheelExecution=a)}),this.debounceDelay)}},{key:"executeMouseWheelZoom",value:function(t){var e,i=this.w;this.minX=i.globals.isRangeBar?i.globals.minY:i.globals.minX,this.maxX=i.globals.isRangeBar?i.globals.maxY:i.globals.maxX;var a=null===(e=this.gridRect)||void 0===e?void 0:e.getBoundingClientRect();if(a){var s,r,n,o=(t.clientX-a.left)/a.width,l=this.minX,h=this.maxX,c=h-l;if(t.deltaY<0){var d=l+o*c;r=d-(s=.5*c)/2,n=d+s/2}else r=l-(s=1.5*c)/2,n=h+s/2;if(!i.globals.isRangeBar){r=Math.max(r,i.globals.initialMinX),n=Math.min(n,i.globals.initialMaxX);var u=.01*(i.globals.initialMaxX-i.globals.initialMinX);if(n-r0&&i.height>0&&(this.selectionRect.select(!1).resize(!1),this.selectionRect.select({createRot:function(){},updateRot:function(){},createHandle:function(t,e,i,a,s){return"l"===s||"r"===s?t.circle(8).css({"stroke-width":1,stroke:"#333",fill:"#fff"}):t.circle(0)},updateHandle:function(t,e){return t.center(e[0],e[1])}}).resize().on("resize",(function(){var i=e.globals.zoomEnabled?e.config.chart.zoom.type:e.config.chart.selection.type;t.handleMouseUp({zoomtype:i,isResized:!0})})))}}},{key:"preselectedSelection",value:function(){var t=this.w,e=this.xyRatios;if(!t.globals.zoomEnabled)if(void 0!==t.globals.selection&&null!==t.globals.selection)this.drawSelectionRect(u(u({},t.globals.selection),{},{translateX:t.globals.translateX,translateY:t.globals.translateY}));else if(void 0!==t.config.chart.selection.xaxis.min&&void 0!==t.config.chart.selection.xaxis.max){var i=(t.config.chart.selection.xaxis.min-t.globals.minX)/e.xRatio,a=t.globals.gridWidth-(t.globals.maxX-t.config.chart.selection.xaxis.max)/e.xRatio-i;t.globals.isRangeBar&&(i=(t.config.chart.selection.xaxis.min-t.globals.yAxisScale[0].niceMin)/e.invertedYRatio,a=(t.config.chart.selection.xaxis.max-t.config.chart.selection.xaxis.min)/e.invertedYRatio);var s={x:i,y:0,width:a,height:t.globals.gridHeight,translateX:t.globals.translateX,translateY:t.globals.translateY,selectionEnabled:!0};this.drawSelectionRect(s),this.makeSelectionRectDraggable(),"function"==typeof t.config.chart.events.selection&&t.config.chart.events.selection(this.ctx,{xaxis:{min:t.config.chart.selection.xaxis.min,max:t.config.chart.selection.xaxis.max},yaxis:{}})}}},{key:"drawSelectionRect",value:function(t){var e=t.x,i=t.y,a=t.width,s=t.height,r=t.translateX,n=void 0===r?0:r,o=t.translateY,l=void 0===o?0:o,h=this.w,c=this.zoomRect,d=this.selectionRect;if(this.dragged||null!==h.globals.selection){var u={transform:"translate("+n+", "+l+")"};h.globals.zoomEnabled&&this.dragged&&(a<0&&(a=1),c.attr({x:e,y:i,width:a,height:s,fill:h.config.chart.zoom.zoomedArea.fill.color,"fill-opacity":h.config.chart.zoom.zoomedArea.fill.opacity,stroke:h.config.chart.zoom.zoomedArea.stroke.color,"stroke-width":h.config.chart.zoom.zoomedArea.stroke.width,"stroke-opacity":h.config.chart.zoom.zoomedArea.stroke.opacity}),Mi.setAttrs(c.node,u)),h.globals.selectionEnabled&&(d.attr({x:e,y:i,width:a>0?a:0,height:s>0?s:0,fill:h.config.chart.selection.fill.color,"fill-opacity":h.config.chart.selection.fill.opacity,stroke:h.config.chart.selection.stroke.color,"stroke-width":h.config.chart.selection.stroke.width,"stroke-dasharray":h.config.chart.selection.stroke.dashArray,"stroke-opacity":h.config.chart.selection.stroke.opacity}),Mi.setAttrs(d.node,u))}}},{key:"hideSelectionRect",value:function(t){t&&t.attr({x:0,y:0,width:0,height:0})}},{key:"selectionDrawing",value:function(t){var e=t.context,i=t.zoomtype,a=this.w,s=e,r=this.gridRect.getBoundingClientRect(),n=s.startX-1,o=s.startY,l=!1,h=!1,c=s.clientX-r.left-a.globals.barPadForNumericAxis,d=s.clientY-r.top,g=c-n,p=d-o,f={translateX:a.globals.translateX,translateY:a.globals.translateY};return Math.abs(g+n)>a.globals.gridWidth?g=a.globals.gridWidth-n:c<0&&(g=n),n>c&&(l=!0,g=Math.abs(g)),o>d&&(h=!0,p=Math.abs(p)),f=u(u({},f="x"===i?{x:l?n-g:n,y:0,width:g,height:a.globals.gridHeight}:"y"===i?{x:0,y:h?o-p:o,width:a.globals.gridWidth,height:p}:{x:l?n-g:n,y:h?o-p:o,width:g,height:p}),{},{translateX:a.globals.translateX,translateY:a.globals.translateY}),s.drawSelectionRect(f),s.selectionDragging("resizing"),f}},{key:"selectionDragging",value:function(t,e){var i=this,a=this.w;if(e){e.preventDefault();var s=e.detail,r=s.handler,n=s.box,o=n.x,l=n.y;othis.constraints.x2&&(o=this.constraints.x2-n.w),n.y2>this.constraints.y2&&(l=this.constraints.y2-n.h),r.move(o,l);var h=this.xyRatios,c=this.selectionRect,d=0;"resizing"===t&&(d=30);var u=function(t){return parseFloat(c.node.getAttribute(t))},g={x:u("x"),y:u("y"),width:u("width"),height:u("height")};a.globals.selection=g,"function"==typeof a.config.chart.events.selection&&a.globals.selectionEnabled&&(clearTimeout(this.w.globals.selectionResizeTimer),this.w.globals.selectionResizeTimer=window.setTimeout((function(){var t,e,s,r,n=i.gridRect.getBoundingClientRect(),o=c.node.getBoundingClientRect();a.globals.isRangeBar?(t=a.globals.yAxisScale[0].niceMin+(o.left-n.left)*h.invertedYRatio,e=a.globals.yAxisScale[0].niceMin+(o.right-n.left)*h.invertedYRatio,s=0,r=1):(t=a.globals.xAxisScale.niceMin+(o.left-n.left)*h.xRatio,e=a.globals.xAxisScale.niceMin+(o.right-n.left)*h.xRatio,s=a.globals.yAxisScale[0].niceMin+(n.bottom-o.bottom)*h.yRatio[0],r=a.globals.yAxisScale[0].niceMax-(o.top-n.top)*h.yRatio[0]);var l={xaxis:{min:t,max:e},yaxis:{min:s,max:r}};a.config.chart.events.selection(i.ctx,l),a.config.chart.brush.enabled&&void 0!==a.config.chart.events.brushScrolled&&a.config.chart.events.brushScrolled(i.ctx,l)}),d))}}},{key:"selectionDrawn",value:function(t){var e,i,a=t.context,s=t.zoomtype,r=this.w,n=a,o=this.xyRatios,l=this.ctx.toolbar,h=r.globals.zoomEnabled?n.zoomRect.node.getBoundingClientRect():n.selectionRect.node.getBoundingClientRect(),c=n.gridRect.getBoundingClientRect(),d=h.left-c.left-r.globals.barPadForNumericAxis,u=h.right-c.left-r.globals.barPadForNumericAxis,g=h.top-c.top,p=h.bottom-c.top;r.globals.isRangeBar?(e=r.globals.yAxisScale[0].niceMin+d*o.invertedYRatio,i=r.globals.yAxisScale[0].niceMin+u*o.invertedYRatio):(e=r.globals.xAxisScale.niceMin+d*o.xRatio,i=r.globals.xAxisScale.niceMin+u*o.xRatio);var f=[],x=[];if(r.config.yaxis.forEach((function(t,e){var i=r.globals.seriesYAxisMap[e][0],a=r.globals.yAxisScale[e].niceMax-o.yRatio[i]*g,s=r.globals.yAxisScale[e].niceMax-o.yRatio[i]*p;f.push(a),x.push(s)})),n.dragged&&(n.dragX>10||n.dragY>10)&&e!==i)if(r.globals.zoomEnabled){var b=v.clone(r.globals.initialConfig.yaxis),m=v.clone(r.globals.initialConfig.xaxis);if(r.globals.zoomed=!0,r.config.xaxis.convertedCatToNumeric&&(e=Math.floor(e),i=Math.floor(i),e<1&&(e=1,i=r.globals.dataPoints),i-e<2&&(i=e+1)),"xy"!==s&&"x"!==s||(m={min:e,max:i}),"xy"!==s&&"y"!==s||b.forEach((function(t,e){b[e].min=x[e],b[e].max=f[e]})),l){var y=l.getBeforeZoomRange(m,b);y&&(m=y.xaxis?y.xaxis:m,b=y.yaxis?y.yaxis:b)}var w={xaxis:m};r.config.chart.group||(w.yaxis=b),n.ctx.updateHelpers._updateOptions(w,!1,n.w.config.chart.animations.dynamicAnimation.enabled),"function"==typeof r.config.chart.events.zoomed&&l.zoomCallback(m,b)}else if(r.globals.selectionEnabled){var k,A=null;k={min:e,max:i},"xy"!==s&&"y"!==s||(A=v.clone(r.config.yaxis)).forEach((function(t,e){A[e].min=x[e],A[e].max=f[e]})),r.globals.selection=n.selection,"function"==typeof r.config.chart.events.selection&&r.config.chart.events.selection(n.ctx,{xaxis:k,yaxis:A})}}},{key:"panDragging",value:function(t){var e=t.context,i=this.w,a=e;if(void 0!==i.globals.lastClientPosition.x){var s=i.globals.lastClientPosition.x-a.clientX,r=i.globals.lastClientPosition.y-a.clientY;Math.abs(s)>Math.abs(r)&&s>0?this.moveDirection="left":Math.abs(s)>Math.abs(r)&&s<0?this.moveDirection="right":Math.abs(r)>Math.abs(s)&&r>0?this.moveDirection="up":Math.abs(r)>Math.abs(s)&&r<0&&(this.moveDirection="down")}i.globals.lastClientPosition={x:a.clientX,y:a.clientY};var n=i.globals.isRangeBar?i.globals.minY:i.globals.minX,o=i.globals.isRangeBar?i.globals.maxY:i.globals.maxX;i.config.xaxis.convertedCatToNumeric||a.panScrolled(n,o)}},{key:"delayedPanScrolled",value:function(){var t=this.w,e=t.globals.minX,i=t.globals.maxX,a=(t.globals.maxX-t.globals.minX)/2;"left"===this.moveDirection?(e=t.globals.minX+a,i=t.globals.maxX+a):"right"===this.moveDirection&&(e=t.globals.minX-a,i=t.globals.maxX-a),e=Math.floor(e),i=Math.floor(i),this.updateScrolledChart({xaxis:{min:e,max:i}},e,i)}},{key:"panScrolled",value:function(t,e){var i=this.w,a=this.xyRatios,s=v.clone(i.globals.initialConfig.yaxis),r=a.xRatio,n=i.globals.minX,o=i.globals.maxX;i.globals.isRangeBar&&(r=a.invertedYRatio,n=i.globals.minY,o=i.globals.maxY),"left"===this.moveDirection?(t=n+i.globals.gridWidth/15*r,e=o+i.globals.gridWidth/15*r):"right"===this.moveDirection&&(t=n-i.globals.gridWidth/15*r,e=o-i.globals.gridWidth/15*r),i.globals.isRangeBar||(ti.globals.initialMaxX)&&(t=n,e=o);var l={xaxis:{min:t,max:e}};i.config.chart.group||(l.yaxis=s),this.updateScrolledChart(l,t,e)}},{key:"updateScrolledChart",value:function(t,e,i){var a=this.w;this.ctx.updateHelpers._updateOptions(t,!1,!1),"function"==typeof a.config.chart.events.scrolled&&a.config.chart.events.scrolled(this.ctx,{xaxis:{min:e,max:i}})}}]),a}(),va=function(){function t(e){i(this,t),this.w=e.w,this.ttCtx=e,this.ctx=e.ctx}return s(t,[{key:"getNearestValues",value:function(t){var e=t.hoverArea,i=t.elGrid,a=t.clientX,s=t.clientY,r=this.w,n=i.getBoundingClientRect(),o=n.width,l=n.height,h=o/(r.globals.dataPoints-1),c=l/r.globals.dataPoints,d=this.hasBars();!r.globals.comboCharts&&!d||r.config.xaxis.convertedCatToNumeric||(h=o/r.globals.dataPoints);var u=a-n.left-r.globals.barPadForNumericAxis,g=s-n.top;u<0||g<0||u>o||g>l?(e.classList.remove("hovering-zoom"),e.classList.remove("hovering-pan")):r.globals.zoomEnabled?(e.classList.remove("hovering-pan"),e.classList.add("hovering-zoom")):r.globals.panEnabled&&(e.classList.remove("hovering-zoom"),e.classList.add("hovering-pan"));var p=Math.round(u/h),f=Math.floor(g/c);d&&!r.config.xaxis.convertedCatToNumeric&&(p=Math.ceil(u/h),p-=1);var x=null,b=null,m=r.globals.seriesXvalues.map((function(t){return t.filter((function(t){return v.isNumber(t)}))})),y=r.globals.seriesYvalues.map((function(t){return t.filter((function(t){return v.isNumber(t)}))}));if(r.globals.isXNumeric){var w=this.ttCtx.getElGrid().getBoundingClientRect(),k=u*(w.width/o),A=g*(w.height/l);x=(b=this.closestInMultiArray(k,A,m,y)).index,p=b.j,null!==x&&r.globals.hasNullValues&&(m=r.globals.seriesXvalues[x],p=(b=this.closestInArray(k,m)).j)}return r.globals.capturedSeriesIndex=null===x?-1:x,(!p||p<1)&&(p=0),r.globals.isBarHorizontal?r.globals.capturedDataPointIndex=f:r.globals.capturedDataPointIndex=p,{capturedSeries:x,j:r.globals.isBarHorizontal?f:p,hoverX:u,hoverY:g}}},{key:"getFirstActiveXArray",value:function(t){for(var e=this.w,i=0,a=t.map((function(t,e){return t.length>0?e:-1})),s=0;s0)for(var a=0;a *")):this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-series-markers-wrap > *")}},{key:"getAllMarkers",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-series-markers-wrap");i=f(i),e&&(i=i.filter((function(e){var i=Number(e.getAttribute("data:realIndex"));return-1===t.w.globals.collapsedSeriesIndices.indexOf(i)}))),i.sort((function(t,e){var i=Number(t.getAttribute("data:realIndex")),a=Number(e.getAttribute("data:realIndex"));return ai?-1:0}));var a=[];return i.forEach((function(t){a.push(t.querySelector(".apexcharts-marker"))})),a}},{key:"hasMarkers",value:function(t){return this.getElMarkers(t).length>0}},{key:"getPathFromPoint",value:function(t,e){var i=Number(t.getAttribute("cx")),a=Number(t.getAttribute("cy")),s=t.getAttribute("shape");return new Mi(this.ctx).getMarkerPath(i,a,s,e)}},{key:"getElBars",value:function(){return this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-bar-series, .apexcharts-candlestick-series, .apexcharts-boxPlot-series, .apexcharts-rangebar-series")}},{key:"hasBars",value:function(){return this.getElBars().length>0}},{key:"getHoverMarkerSize",value:function(t){var e=this.w,i=e.config.markers.hover.size;return void 0===i&&(i=e.globals.markers.size[t]+e.config.markers.hover.sizeOffset),i}},{key:"toggleAllTooltipSeriesGroups",value:function(t){var e=this.w,i=this.ttCtx;0===i.allTooltipSeriesGroups.length&&(i.allTooltipSeriesGroups=e.globals.dom.baseEl.querySelectorAll(".apexcharts-tooltip-series-group"));for(var a=i.allTooltipSeriesGroups,s=0;s ').concat(i.attrs.name,""),e+="
".concat(i.val,"
")})),m.innerHTML=t+"",v.innerHTML=e+""};n?l.globals.seriesGoals[e][i]&&Array.isArray(l.globals.seriesGoals[e][i])?y():(m.innerHTML="",v.innerHTML=""):y()}else m.innerHTML="",v.innerHTML="";null!==p&&(a[e].querySelector(".apexcharts-tooltip-text-z-label").innerHTML=l.config.tooltip.z.title,a[e].querySelector(".apexcharts-tooltip-text-z-value").innerHTML=void 0!==p?p:"");if(n&&f[0]){if(l.config.tooltip.hideEmptySeries){var w=a[e].querySelector(".apexcharts-tooltip-marker"),k=a[e].querySelector(".apexcharts-tooltip-text");0==parseFloat(c)?(w.style.display="none",k.style.display="none"):(w.style.display="block",k.style.display="block")}null==c||l.globals.ancillaryCollapsedSeriesIndices.indexOf(e)>-1||l.globals.collapsedSeriesIndices.indexOf(e)>-1||Array.isArray(h.tConfig.enabledOnSeries)&&-1===h.tConfig.enabledOnSeries.indexOf(e)?f[0].parentNode.style.display="none":f[0].parentNode.style.display=l.config.tooltip.items.display}else Array.isArray(h.tConfig.enabledOnSeries)&&-1===h.tConfig.enabledOnSeries.indexOf(e)&&(f[0].parentNode.style.display="none")}},{key:"toggleActiveInactiveSeries",value:function(t,e){var i=this.w;if(t)this.tooltipUtil.toggleAllTooltipSeriesGroups("enable");else{this.tooltipUtil.toggleAllTooltipSeriesGroups("disable");var a=i.globals.dom.baseEl.querySelector(".apexcharts-tooltip-series-group-".concat(e));a&&(a.classList.add("apexcharts-active"),a.style.display=i.config.tooltip.items.display)}}},{key:"getValuesToPrint",value:function(t){var e=t.i,i=t.j,a=this.w,s=this.ctx.series.filteredSeriesX(),r="",n="",o=null,l=null,h={series:a.globals.series,seriesIndex:e,dataPointIndex:i,w:a},c=a.globals.ttZFormatter;null===i?l=a.globals.series[e]:a.globals.isXNumeric&&"treemap"!==a.config.chart.type?(r=s[e][i],0===s[e].length&&(r=s[this.tooltipUtil.getFirstActiveXArray(s)][i])):r=new $i(this.ctx).isFormatXY()?void 0!==a.config.series[e].data[i]?a.config.series[e].data[i].x:"":void 0!==a.globals.labels[i]?a.globals.labels[i]:"";var d=r;a.globals.isXNumeric&&"datetime"===a.config.xaxis.type?r=new Xi(this.ctx).xLabelFormat(a.globals.ttKeyFormatter,d,d,{i:void 0,dateFormatter:new zi(this.ctx).formatDate,w:this.w}):r=a.globals.isBarHorizontal?a.globals.yLabelFormatters[0](d,h):a.globals.xLabelFormatter(d,h);return void 0!==a.config.tooltip.x.formatter&&(r=a.globals.ttKeyFormatter(d,h)),a.globals.seriesZ.length>0&&a.globals.seriesZ[e].length>0&&(o=c(a.globals.seriesZ[e][i],a)),n="function"==typeof a.config.xaxis.tooltip.formatter?a.globals.xaxisTooltipFormatter(d,h):r,{val:Array.isArray(l)?l.join(" "):l,xVal:Array.isArray(r)?r.join(" "):r,xAxisTTVal:Array.isArray(n)?n.join(" "):n,zVal:o}}},{key:"handleCustomTooltip",value:function(t){var e=t.i,i=t.j,a=t.y1,s=t.y2,r=t.w,n=this.ttCtx.getElTooltip(),o=r.config.tooltip.custom;Array.isArray(o)&&o[e]&&(o=o[e]);var l=o({ctx:this.ctx,series:r.globals.series,seriesIndex:e,dataPointIndex:i,y1:a,y2:s,w:r});"string"==typeof l?n.innerHTML=l:(l instanceof Element||"string"==typeof l.nodeName)&&(n.innerHTML="",n.appendChild(l.cloneNode(!0)))}}]),t}(),wa=function(){function t(e){i(this,t),this.ttCtx=e,this.ctx=e.ctx,this.w=e.w}return s(t,[{key:"moveXCrosshairs",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=this.ttCtx,a=this.w,s=i.getElXCrosshairs(),r=t-i.xcrosshairsWidth/2,n=a.globals.labels.slice().length;if(null!==e&&(r=a.globals.gridWidth/n*e),null===s||a.globals.isBarHorizontal||(s.setAttribute("x",r),s.setAttribute("x1",r),s.setAttribute("x2",r),s.setAttribute("y2",a.globals.gridHeight),s.classList.add("apexcharts-active")),r<0&&(r=0),r>a.globals.gridWidth&&(r=a.globals.gridWidth),i.isXAxisTooltipEnabled){var o=r;"tickWidth"!==a.config.xaxis.crosshairs.width&&"barWidth"!==a.config.xaxis.crosshairs.width||(o=r+i.xcrosshairsWidth/2),this.moveXAxisTooltip(o)}}},{key:"moveYCrosshairs",value:function(t){var e=this.ttCtx;null!==e.ycrosshairs&&Mi.setAttrs(e.ycrosshairs,{y1:t,y2:t}),null!==e.ycrosshairsHidden&&Mi.setAttrs(e.ycrosshairsHidden,{y1:t,y2:t})}},{key:"moveXAxisTooltip",value:function(t){var e=this.w,i=this.ttCtx;if(null!==i.xaxisTooltip&&0!==i.xcrosshairsWidth){i.xaxisTooltip.classList.add("apexcharts-active");var a=i.xaxisOffY+e.config.xaxis.tooltip.offsetY+e.globals.translateY+1+e.config.xaxis.offsetY;if(t-=i.xaxisTooltip.getBoundingClientRect().width/2,!isNaN(t)){t+=e.globals.translateX;var s;s=new Mi(this.ctx).getTextRects(i.xaxisTooltipText.innerHTML),i.xaxisTooltipText.style.minWidth=s.width+"px",i.xaxisTooltip.style.left=t+"px",i.xaxisTooltip.style.top=a+"px"}}}},{key:"moveYAxisTooltip",value:function(t){var e=this.w,i=this.ttCtx;null===i.yaxisTTEls&&(i.yaxisTTEls=e.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxistooltip"));var a=parseInt(i.ycrosshairsHidden.getAttribute("y1"),10),s=e.globals.translateY+a,r=i.yaxisTTEls[t].getBoundingClientRect().height,n=e.globals.translateYAxisX[t]-2;e.config.yaxis[t].opposite&&(n-=26),s-=r/2,-1===e.globals.ignoreYAxisIndexes.indexOf(t)?(i.yaxisTTEls[t].classList.add("apexcharts-active"),i.yaxisTTEls[t].style.top=s+"px",i.yaxisTTEls[t].style.left=n+e.config.yaxis[t].tooltip.offsetX+"px"):i.yaxisTTEls[t].classList.remove("apexcharts-active")}},{key:"moveTooltip",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=this.w,s=this.ttCtx,r=s.getElTooltip(),n=s.tooltipRect,o=null!==i?parseFloat(i):1,l=parseFloat(t)+o+5,h=parseFloat(e)+o/2;if(l>a.globals.gridWidth/2&&(l=l-n.ttWidth-o-10),l>a.globals.gridWidth-n.ttWidth-10&&(l=a.globals.gridWidth-n.ttWidth),l<-20&&(l=-20),a.config.tooltip.followCursor){var c=s.getElGrid().getBoundingClientRect();(l=s.e.clientX-c.left)>a.globals.gridWidth/2&&(l-=s.tooltipRect.ttWidth),(h=s.e.clientY+a.globals.translateY-c.top)>a.globals.gridHeight/2&&(h-=s.tooltipRect.ttHeight)}else a.globals.isBarHorizontal||n.ttHeight/2+h>a.globals.gridHeight&&(h=a.globals.gridHeight-n.ttHeight+a.globals.translateY);isNaN(l)||(l+=a.globals.translateX,r.style.left=l+"px",r.style.top=h+"px")}},{key:"moveMarkers",value:function(t,e){var i=this.w,a=this.ttCtx;if(i.globals.markers.size[t]>0)for(var s=i.globals.dom.baseEl.querySelectorAll(" .apexcharts-series[data\\:realIndex='".concat(t,"'] .apexcharts-marker")),r=0;r0){var g=u.getAttribute("shape"),p=l.getMarkerPath(s,r,g,1.5*c);u.setAttribute("d",p)}this.moveXCrosshairs(s),o.fixedTooltip||this.moveTooltip(s,r,c)}}},{key:"moveDynamicPointsOnHover",value:function(t){var e,i=this.ttCtx,a=i.w,s=0,r=0,n=a.globals.pointsArray,o=new Zi(this.ctx),l=new Mi(this.ctx);e=o.getActiveConfigSeriesIndex("asc",["line","area","scatter","bubble"]);var h=i.tooltipUtil.getHoverMarkerSize(e);if(n[e]&&(s=n[e][t][0],r=n[e][t][1]),!isNaN(s)){var c=i.tooltipUtil.getAllMarkers();if(c.length)for(var d=0;d0){var b=l.getMarkerPath(s,g,f,h);c[d].setAttribute("d",b)}else c[d].setAttribute("d","")}}this.moveXCrosshairs(s),i.fixedTooltip||this.moveTooltip(s,r||a.globals.gridHeight,h)}}},{key:"moveStickyTooltipOverBars",value:function(t,e){var i=this.w,a=this.ttCtx,s=i.globals.columnSeries?i.globals.columnSeries.length:i.globals.series.length;i.config.chart.stacked&&(s=i.globals.barGroups.length);var r=s>=2&&s%2==0?Math.floor(s/2):Math.floor(s/2)+1;i.globals.isBarHorizontal&&(r=new Zi(this.ctx).getActiveConfigSeriesIndex("desc")+1);var n=i.globals.dom.baseEl.querySelector(".apexcharts-bar-series .apexcharts-series[rel='".concat(r,"'] path[j='").concat(t,"'], .apexcharts-candlestick-series .apexcharts-series[rel='").concat(r,"'] path[j='").concat(t,"'], .apexcharts-boxPlot-series .apexcharts-series[rel='").concat(r,"'] path[j='").concat(t,"'], .apexcharts-rangebar-series .apexcharts-series[rel='").concat(r,"'] path[j='").concat(t,"']"));n||"number"!=typeof e||(n=i.globals.dom.baseEl.querySelector(".apexcharts-bar-series .apexcharts-series[data\\:realIndex='".concat(e,"'] path[j='").concat(t,"'],\n .apexcharts-candlestick-series .apexcharts-series[data\\:realIndex='").concat(e,"'] path[j='").concat(t,"'],\n .apexcharts-boxPlot-series .apexcharts-series[data\\:realIndex='").concat(e,"'] path[j='").concat(t,"'],\n .apexcharts-rangebar-series .apexcharts-series[data\\:realIndex='").concat(e,"'] path[j='").concat(t,"']")));var o=n?parseFloat(n.getAttribute("cx")):0,l=n?parseFloat(n.getAttribute("cy")):0,h=n?parseFloat(n.getAttribute("barWidth")):0,c=a.getElGrid().getBoundingClientRect(),d=n&&(n.classList.contains("apexcharts-candlestick-area")||n.classList.contains("apexcharts-boxPlot-area"));i.globals.isXNumeric?(n&&!d&&(o-=s%2!=0?h/2:0),n&&d&&(o-=h/2)):i.globals.isBarHorizontal||(o=a.xAxisTicksPositions[t-1]+a.dataPointsDividedWidth/2,isNaN(o)&&(o=a.xAxisTicksPositions[t]-a.dataPointsDividedWidth/2)),i.globals.isBarHorizontal?l-=a.tooltipRect.ttHeight:i.config.tooltip.followCursor?l=a.e.clientY-c.top-a.tooltipRect.ttHeight/2:l+a.tooltipRect.ttHeight+15>i.globals.gridHeight&&(l=i.globals.gridHeight),i.globals.isBarHorizontal||this.moveXCrosshairs(o),a.fixedTooltip||this.moveTooltip(o,l||i.globals.gridHeight)}}]),t}(),ka=function(){function t(e){i(this,t),this.w=e.w,this.ttCtx=e,this.ctx=e.ctx,this.tooltipPosition=new wa(e)}return s(t,[{key:"drawDynamicPoints",value:function(){var t=this.w,e=new Mi(this.ctx),i=new Vi(this.ctx),a=t.globals.dom.baseEl.querySelectorAll(".apexcharts-series");a=f(a),t.config.chart.stacked&&a.sort((function(t,e){return parseFloat(t.getAttribute("data:realIndex"))-parseFloat(e.getAttribute("data:realIndex"))}));for(var s=0;s2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,s=this.w;"bubble"!==s.config.chart.type&&this.newPointSize(t,e);var r=e.getAttribute("cx"),n=e.getAttribute("cy");if(null!==i&&null!==a&&(r=i,n=a),this.tooltipPosition.moveXCrosshairs(r),!this.fixedTooltip){if("radar"===s.config.chart.type){var o=this.ttCtx.getElGrid().getBoundingClientRect();r=this.ttCtx.e.clientX-o.left}this.tooltipPosition.moveTooltip(r,n,s.config.markers.hover.size)}}},{key:"enlargePoints",value:function(t){for(var e=this.w,i=this,a=this.ttCtx,s=t,r=e.globals.dom.baseEl.querySelectorAll(".apexcharts-series:not(.apexcharts-series-collapsed) .apexcharts-marker"),n=e.config.markers.hover.size,o=0;o0){var a=this.ttCtx.tooltipUtil.getPathFromPoint(t[e],i);t[e].setAttribute("d",a)}else t[e].setAttribute("d","M0,0")}}}]),t}(),Aa=function(){function t(e){i(this,t),this.w=e.w;var a=this.w;this.ttCtx=e,this.isVerticalGroupedRangeBar=!a.globals.isBarHorizontal&&"rangeBar"===a.config.chart.type&&a.config.plotOptions.bar.rangeBarGroupRows}return s(t,[{key:"getAttr",value:function(t,e){return parseFloat(t.target.getAttribute(e))}},{key:"handleHeatTreeTooltip",value:function(t){var e=t.e,i=t.opt,a=t.x,s=t.y,r=t.type,n=this.ttCtx,o=this.w;if(e.target.classList.contains("apexcharts-".concat(r,"-rect"))){var l=this.getAttr(e,"i"),h=this.getAttr(e,"j"),c=this.getAttr(e,"cx"),d=this.getAttr(e,"cy"),u=this.getAttr(e,"width"),g=this.getAttr(e,"height");if(n.tooltipLabels.drawSeriesTexts({ttItems:i.ttItems,i:l,j:h,shared:!1,e:e}),o.globals.capturedSeriesIndex=l,o.globals.capturedDataPointIndex=h,a=c+n.tooltipRect.ttWidth/2+u,s=d+n.tooltipRect.ttHeight/2-g/2,n.tooltipPosition.moveXCrosshairs(c+u/2),a>o.globals.gridWidth/2&&(a=c-n.tooltipRect.ttWidth/2+u),n.w.config.tooltip.followCursor){var p=o.globals.dom.elWrap.getBoundingClientRect();a=o.globals.clientX-p.left-(a>o.globals.gridWidth/2?n.tooltipRect.ttWidth:0),s=o.globals.clientY-p.top-(s>o.globals.gridHeight/2?n.tooltipRect.ttHeight:0)}}return{x:a,y:s}}},{key:"handleMarkerTooltip",value:function(t){var e,i,a=t.e,s=t.opt,r=t.x,n=t.y,o=this.w,l=this.ttCtx;if(a.target.classList.contains("apexcharts-marker")){var h=parseInt(s.paths.getAttribute("cx"),10),c=parseInt(s.paths.getAttribute("cy"),10),d=parseFloat(s.paths.getAttribute("val"));if(i=parseInt(s.paths.getAttribute("rel"),10),e=parseInt(s.paths.parentNode.parentNode.parentNode.getAttribute("rel"),10)-1,l.intersect){var u=v.findAncestor(s.paths,"apexcharts-series");u&&(e=parseInt(u.getAttribute("data:realIndex"),10))}if(l.tooltipLabels.drawSeriesTexts({ttItems:s.ttItems,i:e,j:i,shared:!l.showOnIntersect&&o.config.tooltip.shared,e:a}),"mouseup"===a.type&&l.markerClick(a,e,i),o.globals.capturedSeriesIndex=e,o.globals.capturedDataPointIndex=i,r=h,n=c+o.globals.translateY-1.4*l.tooltipRect.ttHeight,l.w.config.tooltip.followCursor){var g=l.getElGrid().getBoundingClientRect();n=l.e.clientY+o.globals.translateY-g.top}d<0&&(n=c),l.marker.enlargeCurrentPoint(i,s.paths,r,n)}return{x:r,y:n}}},{key:"handleBarTooltip",value:function(t){var e,i,a=t.e,s=t.opt,r=this.w,n=this.ttCtx,o=n.getElTooltip(),l=0,h=0,c=0,d=this.getBarTooltipXY({e:a,opt:s});if(null!==d.j||0!==d.barHeight||0!==d.barWidth){e=d.i;var u=d.j;if(r.globals.capturedSeriesIndex=e,r.globals.capturedDataPointIndex=u,r.globals.isBarHorizontal&&n.tooltipUtil.hasBars()||!r.config.tooltip.shared?(h=d.x,c=d.y,i=Array.isArray(r.config.stroke.width)?r.config.stroke.width[e]:r.config.stroke.width,l=h):r.globals.comboCharts||r.config.tooltip.shared||(l/=2),isNaN(c)&&(c=r.globals.svgHeight-n.tooltipRect.ttHeight),parseInt(s.paths.parentNode.getAttribute("data:realIndex"),10),h+n.tooltipRect.ttWidth>r.globals.gridWidth?h-=n.tooltipRect.ttWidth:h<0&&(h=0),n.w.config.tooltip.followCursor){var g=n.getElGrid().getBoundingClientRect();c=n.e.clientY-g.top}null===n.tooltip&&(n.tooltip=r.globals.dom.baseEl.querySelector(".apexcharts-tooltip")),r.config.tooltip.shared||(r.globals.comboBarCount>0?n.tooltipPosition.moveXCrosshairs(l+i/2):n.tooltipPosition.moveXCrosshairs(l)),!n.fixedTooltip&&(!r.config.tooltip.shared||r.globals.isBarHorizontal&&n.tooltipUtil.hasBars())&&(c=c+r.globals.translateY-n.tooltipRect.ttHeight/2,o.style.left=h+r.globals.translateX+"px",o.style.top=c+"px")}}},{key:"getBarTooltipXY",value:function(t){var e=this,i=t.e,a=t.opt,s=this.w,r=null,n=this.ttCtx,o=0,l=0,h=0,c=0,d=0,u=i.target.classList;if(u.contains("apexcharts-bar-area")||u.contains("apexcharts-candlestick-area")||u.contains("apexcharts-boxPlot-area")||u.contains("apexcharts-rangebar-area")){var g=i.target,p=g.getBoundingClientRect(),f=a.elGrid.getBoundingClientRect(),x=p.height;d=p.height;var b=p.width,m=parseInt(g.getAttribute("cx"),10),v=parseInt(g.getAttribute("cy"),10);c=parseFloat(g.getAttribute("barWidth"));var y="touchmove"===i.type?i.touches[0].clientX:i.clientX;r=parseInt(g.getAttribute("j"),10),o=parseInt(g.parentNode.getAttribute("rel"),10)-1;var w=g.getAttribute("data-range-y1"),k=g.getAttribute("data-range-y2");s.globals.comboCharts&&(o=parseInt(g.parentNode.getAttribute("data:realIndex"),10));var A=function(t){return s.globals.isXNumeric?m-b/2:e.isVerticalGroupedRangeBar?m+b/2:m-n.dataPointsDividedWidth+b/2},C=function(){return v-n.dataPointsDividedHeight+x/2-n.tooltipRect.ttHeight/2};n.tooltipLabels.drawSeriesTexts({ttItems:a.ttItems,i:o,j:r,y1:w?parseInt(w,10):null,y2:k?parseInt(k,10):null,shared:!n.showOnIntersect&&s.config.tooltip.shared,e:i}),s.config.tooltip.followCursor?s.globals.isBarHorizontal?(l=y-f.left+15,h=C()):(l=A(),h=i.clientY-f.top-n.tooltipRect.ttHeight/2-15):s.globals.isBarHorizontal?((l=m)0&&i.setAttribute("width",e.xcrosshairsWidth)}},{key:"handleYCrosshair",value:function(){var t=this.w,e=this.ttCtx;e.ycrosshairs=t.globals.dom.baseEl.querySelector(".apexcharts-ycrosshairs"),e.ycrosshairsHidden=t.globals.dom.baseEl.querySelector(".apexcharts-ycrosshairs-hidden")}},{key:"drawYaxisTooltipText",value:function(t,e,i){var a=this.ttCtx,s=this.w,r=s.globals,n=r.seriesYAxisMap[t];if(a.yaxisTooltips[t]&&n.length>0){var o=r.yLabelFormatters[t],l=a.getElGrid().getBoundingClientRect(),h=n[0],c=0;i.yRatio.length>1&&(c=h);var d=(e-l.top)*i.yRatio[c],u=r.maxYArr[h]-r.minYArr[h],g=r.minYArr[h]+(u-d);s.config.yaxis[t].reversed&&(g=r.maxYArr[h]-(u-d)),a.tooltipPosition.moveYCrosshairs(e-l.top),a.yaxisTooltipText[t].innerHTML=o(g),a.tooltipPosition.moveYAxisTooltip(t)}}}]),t}(),Sa=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w;var a=this.w;this.tConfig=a.config.tooltip,this.tooltipUtil=new va(this),this.tooltipLabels=new ya(this),this.tooltipPosition=new wa(this),this.marker=new ka(this),this.intersect=new Aa(this),this.axesTooltip=new Ca(this),this.showOnIntersect=this.tConfig.intersect,this.showTooltipTitle=this.tConfig.x.show,this.fixedTooltip=this.tConfig.fixed.enabled,this.xaxisTooltip=null,this.yaxisTTEls=null,this.isBarShared=!a.globals.isBarHorizontal&&this.tConfig.shared,this.lastHoverTime=Date.now()}return s(t,[{key:"getElTooltip",value:function(t){return t||(t=this),t.w.globals.dom.baseEl?t.w.globals.dom.baseEl.querySelector(".apexcharts-tooltip"):null}},{key:"getElXCrosshairs",value:function(){return this.w.globals.dom.baseEl.querySelector(".apexcharts-xcrosshairs")}},{key:"getElGrid",value:function(){return this.w.globals.dom.baseEl.querySelector(".apexcharts-grid")}},{key:"drawTooltip",value:function(t){var e=this.w;this.xyRatios=t,this.isXAxisTooltipEnabled=e.config.xaxis.tooltip.enabled&&e.globals.axisCharts,this.yaxisTooltips=e.config.yaxis.map((function(t,i){return!!(t.show&&t.tooltip.enabled&&e.globals.axisCharts)})),this.allTooltipSeriesGroups=[],e.globals.axisCharts||(this.showTooltipTitle=!1);var i=document.createElement("div");if(i.classList.add("apexcharts-tooltip"),e.config.tooltip.cssClass&&i.classList.add(e.config.tooltip.cssClass),i.classList.add("apexcharts-theme-".concat(this.tConfig.theme)),e.globals.dom.elWrap.appendChild(i),e.globals.axisCharts){this.axesTooltip.drawXaxisTooltip(),this.axesTooltip.drawYaxisTooltip(),this.axesTooltip.setXCrosshairWidth(),this.axesTooltip.handleYCrosshair();var a=new Qi(this.ctx);this.xAxisTicksPositions=a.getXAxisTicksPositions()}if(!e.globals.comboCharts&&!this.tConfig.intersect&&"rangeBar"!==e.config.chart.type||this.tConfig.shared||(this.showOnIntersect=!0),0!==e.config.markers.size&&0!==e.globals.markers.largestSize||this.marker.drawDynamicPoints(this),e.globals.collapsedSeries.length!==e.globals.series.length){this.dataPointsDividedHeight=e.globals.gridHeight/e.globals.dataPoints,this.dataPointsDividedWidth=e.globals.gridWidth/e.globals.dataPoints,this.showTooltipTitle&&(this.tooltipTitle=document.createElement("div"),this.tooltipTitle.classList.add("apexcharts-tooltip-title"),this.tooltipTitle.style.fontFamily=this.tConfig.style.fontFamily||e.config.chart.fontFamily,this.tooltipTitle.style.fontSize=this.tConfig.style.fontSize,i.appendChild(this.tooltipTitle));var s=e.globals.series.length;(e.globals.xyCharts||e.globals.comboCharts)&&this.tConfig.shared&&(s=this.showOnIntersect?1:e.globals.series.length),this.legendLabels=e.globals.dom.baseEl.querySelectorAll(".apexcharts-legend-text"),this.ttItems=this.createTTElements(s),this.addSVGEvents()}}},{key:"createTTElements",value:function(t){for(var e=this,i=this.w,a=[],s=this.getElTooltip(),r=function(r){var n=document.createElement("div");n.classList.add("apexcharts-tooltip-series-group","apexcharts-tooltip-series-group-".concat(r)),n.style.order=i.config.tooltip.inverseOrder?t-r:r+1;var o=document.createElement("span");o.classList.add("apexcharts-tooltip-marker"),i.config.tooltip.fillSeriesColor?o.style.backgroundColor=i.globals.colors[r]:o.style.color=i.globals.colors[r];var l=i.config.markers.shape,h=l;Array.isArray(l)&&(h=l[r]),o.setAttribute("shape",h),n.appendChild(o);var c=document.createElement("div");c.classList.add("apexcharts-tooltip-text"),c.style.fontFamily=e.tConfig.style.fontFamily||i.config.chart.fontFamily,c.style.fontSize=e.tConfig.style.fontSize,["y","goals","z"].forEach((function(t){var e=document.createElement("div");e.classList.add("apexcharts-tooltip-".concat(t,"-group"));var i=document.createElement("span");i.classList.add("apexcharts-tooltip-text-".concat(t,"-label")),e.appendChild(i);var a=document.createElement("span");a.classList.add("apexcharts-tooltip-text-".concat(t,"-value")),e.appendChild(a),c.appendChild(e)})),n.appendChild(c),s.appendChild(n),a.push(n)},n=0;n0&&this.addPathsEventListeners(g,c),this.tooltipUtil.hasBars()&&!this.tConfig.shared&&this.addDatapointEventsListeners(c)}}},{key:"drawFixedTooltipRect",value:function(){var t=this.w,e=this.getElTooltip(),i=e.getBoundingClientRect(),a=i.width+10,s=i.height+10,r=this.tConfig.fixed.offsetX,n=this.tConfig.fixed.offsetY,o=this.tConfig.fixed.position.toLowerCase();return o.indexOf("right")>-1&&(r=r+t.globals.svgWidth-a+10),o.indexOf("bottom")>-1&&(n=n+t.globals.svgHeight-s-10),e.style.left=r+"px",e.style.top=n+"px",{x:r,y:n,ttWidth:a,ttHeight:s}}},{key:"addDatapointEventsListeners",value:function(t){var e=this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-series-markers .apexcharts-marker, .apexcharts-bar-area, .apexcharts-candlestick-area, .apexcharts-boxPlot-area, .apexcharts-rangebar-area");this.addPathsEventListeners(e,t)}},{key:"addPathsEventListeners",value:function(t,e){for(var i=this,a=function(a){var s={paths:t[a],tooltipEl:e.tooltipEl,tooltipY:e.tooltipY,tooltipX:e.tooltipX,elGrid:e.elGrid,hoverArea:e.hoverArea,ttItems:e.ttItems};["mousemove","mouseup","touchmove","mouseout","touchend"].map((function(e){return t[a].addEventListener(e,i.onSeriesHover.bind(i,s),{capture:!1,passive:!0})}))},s=0;s=20?this.seriesHover(t,e):(clearTimeout(this.seriesHoverTimeout),this.seriesHoverTimeout=setTimeout((function(){i.seriesHover(t,e)}),20-a))}},{key:"seriesHover",value:function(t,e){var i=this;this.lastHoverTime=Date.now();var a=[],s=this.w;s.config.chart.group&&(a=this.ctx.getGroupedCharts()),s.globals.axisCharts&&(s.globals.minX===-1/0&&s.globals.maxX===1/0||0===s.globals.dataPoints)||(a.length?a.forEach((function(a){var s=i.getElTooltip(a),r={paths:t.paths,tooltipEl:s,tooltipY:t.tooltipY,tooltipX:t.tooltipX,elGrid:t.elGrid,hoverArea:t.hoverArea,ttItems:a.w.globals.tooltip.ttItems};a.w.globals.minX===i.w.globals.minX&&a.w.globals.maxX===i.w.globals.maxX&&a.w.globals.tooltip.seriesHoverByContext({chartCtx:a,ttCtx:a.w.globals.tooltip,opt:r,e:e})})):this.seriesHoverByContext({chartCtx:this.ctx,ttCtx:this.w.globals.tooltip,opt:t,e:e}))}},{key:"seriesHoverByContext",value:function(t){var e=t.chartCtx,i=t.ttCtx,a=t.opt,s=t.e,r=e.w,n=this.getElTooltip(e);if(n){if(i.tooltipRect={x:0,y:0,ttWidth:n.getBoundingClientRect().width,ttHeight:n.getBoundingClientRect().height},i.e=s,i.tooltipUtil.hasBars()&&!r.globals.comboCharts&&!i.isBarShared)if(this.tConfig.onDatasetHover.highlightDataSeries)new Zi(e).toggleSeriesOnHover(s,s.target.parentNode);i.fixedTooltip&&i.drawFixedTooltipRect(),r.globals.axisCharts?i.axisChartsTooltips({e:s,opt:a,tooltipRect:i.tooltipRect}):i.nonAxisChartsTooltips({e:s,opt:a,tooltipRect:i.tooltipRect})}}},{key:"axisChartsTooltips",value:function(t){var e,i,a=t.e,s=t.opt,r=this.w,n=s.elGrid.getBoundingClientRect(),o="touchmove"===a.type?a.touches[0].clientX:a.clientX,l="touchmove"===a.type?a.touches[0].clientY:a.clientY;if(this.clientY=l,this.clientX=o,r.globals.capturedSeriesIndex=-1,r.globals.capturedDataPointIndex=-1,ln.top+n.height)this.handleMouseOut(s);else{if(Array.isArray(this.tConfig.enabledOnSeries)&&!r.config.tooltip.shared){var h=parseInt(s.paths.getAttribute("index"),10);if(this.tConfig.enabledOnSeries.indexOf(h)<0)return void this.handleMouseOut(s)}var c=this.getElTooltip(),d=this.getElXCrosshairs(),u=[];r.config.chart.group&&(u=this.ctx.getSyncedCharts());var g=r.globals.xyCharts||"bar"===r.config.chart.type&&!r.globals.isBarHorizontal&&this.tooltipUtil.hasBars()&&this.tConfig.shared||r.globals.comboCharts&&this.tooltipUtil.hasBars();if("mousemove"===a.type||"touchmove"===a.type||"mouseup"===a.type){if(r.globals.collapsedSeries.length+r.globals.ancillaryCollapsedSeries.length===r.globals.series.length)return;null!==d&&d.classList.add("apexcharts-active");var p=this.yaxisTooltips.filter((function(t){return!0===t}));if(null!==this.ycrosshairs&&p.length&&this.ycrosshairs.classList.add("apexcharts-active"),g&&!this.showOnIntersect||u.length>1)this.handleStickyTooltip(a,o,l,s);else if("heatmap"===r.config.chart.type||"treemap"===r.config.chart.type){var f=this.intersect.handleHeatTreeTooltip({e:a,opt:s,x:e,y:i,type:r.config.chart.type});e=f.x,i=f.y,c.style.left=e+"px",c.style.top=i+"px"}else this.tooltipUtil.hasBars()&&this.intersect.handleBarTooltip({e:a,opt:s}),this.tooltipUtil.hasMarkers()&&this.intersect.handleMarkerTooltip({e:a,opt:s,x:e,y:i});if(this.yaxisTooltips.length)for(var x=0;xl.width)this.handleMouseOut(a);else if(null!==o)this.handleStickyCapturedSeries(t,o,a,n);else if(this.tooltipUtil.isXoverlap(n)||s.globals.isBarHorizontal){var h=s.globals.series.findIndex((function(t,e){return!s.globals.collapsedSeriesIndices.includes(e)}));this.create(t,this,h,n,a.ttItems)}}},{key:"handleStickyCapturedSeries",value:function(t,e,i,a){var s=this.w;if(!this.tConfig.shared&&null===s.globals.series[e][a])return void this.handleMouseOut(i);if(void 0!==s.globals.series[e][a])this.tConfig.shared&&this.tooltipUtil.isXoverlap(a)&&this.tooltipUtil.isInitialSeriesSameLen()?this.create(t,this,e,a,i.ttItems):this.create(t,this,e,a,i.ttItems,!1);else if(this.tooltipUtil.isXoverlap(a)){var r=s.globals.series.findIndex((function(t,e){return!s.globals.collapsedSeriesIndices.includes(e)}));this.create(t,this,r,a,i.ttItems)}}},{key:"deactivateHoverFilter",value:function(){for(var t=this.w,e=new Mi(this.ctx),i=t.globals.dom.Paper.find(".apexcharts-bar-area"),a=0;a5&&void 0!==arguments[5]?arguments[5]:null,A=this.w,C=e;"mouseup"===t.type&&this.markerClick(t,i,a),null===k&&(k=this.tConfig.shared);var S=this.tooltipUtil.hasMarkers(i),L=this.tooltipUtil.getElBars(),M=function(){A.globals.markers.largestSize>0?C.marker.enlargePoints(a):C.tooltipPosition.moveDynamicPointsOnHover(a)};if(A.config.legend.tooltipHoverFormatter){var P=A.config.legend.tooltipHoverFormatter,I=Array.from(this.legendLabels);I.forEach((function(t){var e=t.getAttribute("data:default-text");t.innerHTML=decodeURIComponent(e)}));for(var T=0;T0)){var H=new Mi(this.ctx),O=A.globals.dom.Paper.find(".apexcharts-bar-area[j='".concat(a,"']"));this.deactivateHoverFilter(),C.tooltipPosition.moveStickyTooltipOverBars(a,i),C.tooltipUtil.getAllMarkers(!0).length&&M();for(var F=0;F0&&i.config.plotOptions.bar.hideZeroBarsWhenGrouped&&(g-=c*A)),k){g=g+u.height/2-m/2-2}var S=i.globals.series[a][s]<0,L=l;switch(this.barCtx.isReversed&&(L=l+(S?d:-d)),x.position){case"center":p=k?S?L-d/2+y:L+d/2-y:S?L-d/2+u.height/2+y:L+d/2+u.height/2-y;break;case"bottom":p=k?S?L-d+y:L+d-y:S?L-d+u.height+m+y:L+d-u.height/2+m-y;break;case"top":p=k?S?L+y:L-y:S?L-u.height/2-y:L+u.height+y}var M=L;if(i.globals.seriesGroups.forEach((function(t){var i;null===(i=e.barCtx[t.join(",")])||void 0===i||i.prevY.forEach((function(t){M=S?Math.max(t[s],M):Math.min(t[s],M)}))})),this.barCtx.lastActiveBarSerieIndex===r&&b.enabled){var P=new Mi(this.barCtx.ctx).getTextRects(this.getStackedTotalDataLabel({realIndex:r,j:s}),f.fontSize);n=S?M-P.height/2-y-b.offsetY+18:M+P.height+y+b.offsetY-18;var I=C;o=w+(i.globals.isXNumeric?-c*i.globals.barGroups.length/2:i.globals.barGroups.length*c/2-(i.globals.barGroups.length-1)*c-I)+b.offsetX}return i.config.chart.stacked||(p<0?p=0+m:p+u.height/3>i.globals.gridHeight&&(p=i.globals.gridHeight-m)),{bcx:h,bcy:l,dataLabelsX:g,dataLabelsY:p,totalDataLabelsX:o,totalDataLabelsY:n,totalDataLabelsAnchor:"middle"}}},{key:"calculateBarsDataLabelsPosition",value:function(t){var e=this,i=this.w,a=t.x,s=t.i,r=t.j,n=t.realIndex,o=t.bcy,l=t.barHeight,h=t.barWidth,c=t.textRects,d=t.dataLabelsX,u=t.strokeWidth,g=t.dataLabelsConfig,p=t.barDataLabelsConfig,f=t.barTotalDataLabelsConfig,x=t.offX,b=t.offY,m=i.globals.gridHeight/i.globals.dataPoints,v=this.barCtx.barHelpers.getZeroValueEncounters({i:s,j:r}).zeroEncounters;h=Math.abs(h);var y,w,k=o-(this.barCtx.isRangeBar?0:m)+l/2+c.height/2+b-3;!i.config.chart.stacked&&v>0&&i.config.plotOptions.bar.hideZeroBarsWhenGrouped&&(k-=l*v);var A="start",C=i.globals.series[s][r]<0,S=a;switch(this.barCtx.isReversed&&(S=a+(C?-h:h),A=C?"start":"end"),p.position){case"center":d=C?S+h/2-x:Math.max(c.width/2,S-h/2)+x;break;case"bottom":d=C?S+h-u-x:S-h+u+x;break;case"top":d=C?S-u-x:S-u+x}var L=S;if(i.globals.seriesGroups.forEach((function(t){var i;null===(i=e.barCtx[t.join(",")])||void 0===i||i.prevX.forEach((function(t){L=C?Math.min(t[r],L):Math.max(t[r],L)}))})),this.barCtx.lastActiveBarSerieIndex===n&&f.enabled){var M=new Mi(this.barCtx.ctx).getTextRects(this.getStackedTotalDataLabel({realIndex:n,j:r}),g.fontSize);C?(y=L-u-x-f.offsetX,A="end"):y=L+x+f.offsetX+(this.barCtx.isReversed?-(h+u):u),w=k-c.height/2+M.height/2+f.offsetY+u,i.globals.barGroups.length>1&&(w-=i.globals.barGroups.length/2*(l/2))}return i.config.chart.stacked||("start"===g.textAnchor?d-c.width<0?d=C?c.width+u:u:d+c.width>i.globals.gridWidth&&(d=C?i.globals.gridWidth-u:i.globals.gridWidth-c.width-u):"middle"===g.textAnchor?d-c.width/2<0?d=c.width/2+u:d+c.width/2>i.globals.gridWidth&&(d=i.globals.gridWidth-c.width/2-u):"end"===g.textAnchor&&(d<1?d=c.width+u:d+1>i.globals.gridWidth&&(d=i.globals.gridWidth-c.width-u))),{bcx:a,bcy:o,dataLabelsX:d,dataLabelsY:k,totalDataLabelsX:y,totalDataLabelsY:w,totalDataLabelsAnchor:A}}},{key:"drawCalculatedDataLabels",value:function(t){var e=t.x,i=t.y,a=t.val,s=t.i,r=t.j,n=t.textRects,o=t.barHeight,l=t.barWidth,h=t.dataLabelsConfig,c=this.w,d="rotate(0)";"vertical"===c.config.plotOptions.bar.dataLabels.orientation&&(d="rotate(-90, ".concat(e,", ").concat(i,")"));var g=new qi(this.barCtx.ctx),p=new Mi(this.barCtx.ctx),f=h.formatter,x=null,b=c.globals.collapsedSeriesIndices.indexOf(s)>-1;if(h.enabled&&!b){x=p.group({class:"apexcharts-data-labels",transform:d});var m="";void 0!==a&&(m=f(a,u(u({},c),{},{seriesIndex:s,dataPointIndex:r,w:c}))),!a&&c.config.plotOptions.bar.hideZeroBarsWhenGrouped&&(m="");var v=c.globals.series[s][r]<0,y=c.config.plotOptions.bar.dataLabels.position;if("vertical"===c.config.plotOptions.bar.dataLabels.orientation&&("top"===y&&(h.textAnchor=v?"end":"start"),"center"===y&&(h.textAnchor="middle"),"bottom"===y&&(h.textAnchor=v?"end":"start")),this.barCtx.isRangeBar&&this.barCtx.barOptions.dataLabels.hideOverflowingLabels)lMath.abs(l)&&(m=""):n.height/1.6>Math.abs(o)&&(m=""));var w=u({},h);this.barCtx.isHorizontal&&a<0&&("start"===h.textAnchor?w.textAnchor="end":"end"===h.textAnchor&&(w.textAnchor="start")),g.plotDataLabelsText({x:e,y:i,text:m,i:s,j:r,parent:x,dataLabelsConfig:w,alwaysDrawDataLabel:!0,offsetCorrection:!0})}return x}},{key:"drawTotalDataLabels",value:function(t){var e=t.x,i=t.y,a=t.val,s=t.realIndex,r=t.textAnchor,n=t.barTotalDataLabelsConfig;this.w;var o,l=new Mi(this.barCtx.ctx);return n.enabled&&void 0!==e&&void 0!==i&&this.barCtx.lastActiveBarSerieIndex===s&&(o=l.drawText({x:e,y:i,foreColor:n.style.color,text:a,textAnchor:r,fontFamily:n.style.fontFamily,fontSize:n.style.fontSize,fontWeight:n.style.fontWeight})),o}}]),t}(),Ma=function(){function t(e){i(this,t),this.w=e.w,this.barCtx=e}return s(t,[{key:"initVariables",value:function(t){var e=this.w;this.barCtx.series=t,this.barCtx.totalItems=0,this.barCtx.seriesLen=0,this.barCtx.visibleI=-1,this.barCtx.visibleItems=1;for(var i=0;i0&&(this.barCtx.seriesLen=this.barCtx.seriesLen+1,this.barCtx.totalItems+=t[i].length),e.globals.isXNumeric)for(var a=0;ae.globals.minX&&e.globals.seriesX[i][a]0&&(s=h.globals.minXDiff/u),(n=s/d*parseInt(this.barCtx.barOptions.columnWidth,10)/100)<1&&(n=1)}if(-1===String(this.barCtx.barOptions.columnWidth).indexOf("%")&&(n=parseInt(this.barCtx.barOptions.columnWidth,10)),o=h.globals.gridHeight-this.barCtx.baseLineY[this.barCtx.translationsIndex]-(this.barCtx.isReversed?h.globals.gridHeight:0)+(this.barCtx.isReversed?2*this.barCtx.baseLineY[this.barCtx.translationsIndex]:0),h.globals.isXNumeric)e=this.barCtx.getBarXForNumericXAxis({x:e,j:0,realIndex:t,barWidth:n}).x;else e=h.globals.padHorizontal+v.noExponents(s-n*this.barCtx.seriesLen)/2}return h.globals.barHeight=r,h.globals.barWidth=n,{x:e,y:i,yDivision:a,xDivision:s,barHeight:r,barWidth:n,zeroH:o,zeroW:l}}},{key:"initializeStackedPrevVars",value:function(t){t.w.globals.seriesGroups.forEach((function(e){t[e]||(t[e]={}),t[e].prevY=[],t[e].prevX=[],t[e].prevYF=[],t[e].prevXF=[],t[e].prevYVal=[],t[e].prevXVal=[]}))}},{key:"initializeStackedXYVars",value:function(t){t.w.globals.seriesGroups.forEach((function(e){t[e]||(t[e]={}),t[e].xArrj=[],t[e].xArrjF=[],t[e].xArrjVal=[],t[e].yArrj=[],t[e].yArrjF=[],t[e].yArrjVal=[]}))}},{key:"getPathFillColor",value:function(t,e,i,a){var s,r,n,o,l=this.w,h=this.barCtx.ctx.fill,c=null,d=this.barCtx.barOptions.distributed?i:e,u=!1;this.barCtx.barOptions.colors.ranges.length>0&&this.barCtx.barOptions.colors.ranges.map((function(a){t[e][i]>=a.from&&t[e][i]<=a.to&&(c=a.color,u=!0)}));return{color:h.fillPath({seriesNumber:this.barCtx.barOptions.distributed?d:a,dataPointIndex:i,color:c,value:t[e][i],fillConfig:null===(s=l.config.series[e].data[i])||void 0===s?void 0:s.fill,fillType:null!==(r=l.config.series[e].data[i])&&void 0!==r&&null!==(n=r.fill)&&void 0!==n&&n.type?null===(o=l.config.series[e].data[i])||void 0===o?void 0:o.fill.type:Array.isArray(l.config.fill.type)?l.config.fill.type[a]:l.config.fill.type}),useRangeColor:u}}},{key:"getStrokeWidth",value:function(t,e,i){var a=0,s=this.w;return this.barCtx.series[t][e]?this.barCtx.isNullValue=!1:this.barCtx.isNullValue=!0,s.config.stroke.show&&(this.barCtx.isNullValue||(a=Array.isArray(this.barCtx.strokeWidth)?this.barCtx.strokeWidth[i]:this.barCtx.strokeWidth)),a}},{key:"createBorderRadiusArr",value:function(t){var e,i=this.w,a=!this.w.config.chart.stacked||i.config.plotOptions.bar.borderRadius<=0,s=t.length,n=0|(null===(e=t[0])||void 0===e?void 0:e.length),o=Array.from({length:s},(function(){return Array(n).fill(a?"top":"none")}));if(a)return o;for(var l=0;l0?(h.push(u),d++):g<0&&(c.push(u),d++)}if(h.length>0&&0===c.length)if(1===h.length)o[h[0]][l]="both";else{var p,f=h[0],x=h[h.length-1],b=r(h);try{for(b.s();!(p=b.n()).done;){var m=p.value;o[m][l]=m===f?"bottom":m===x?"top":"none"}}catch(t){b.e(t)}finally{b.f()}}else if(c.length>0&&0===h.length)if(1===c.length)o[c[0]][l]="both";else{var v,y=Math.max.apply(Math,c),w=Math.min.apply(Math,c),k=r(c);try{for(k.s();!(v=k.n()).done;){var A=v.value;o[A][l]=A===y?"bottom":A===w?"top":"none"}}catch(t){k.e(t)}finally{k.f()}}else if(h.length>0&&c.length>0){var C,S=h[h.length-1],L=r(h);try{for(L.s();!(C=L.n()).done;){var M=C.value;o[M][l]=M===S?"top":"none"}}catch(t){L.e(t)}finally{L.f()}var P,I=Math.max.apply(Math,c),T=r(c);try{for(T.s();!(P=T.n()).done;){var z=P.value;o[z][l]=z===I?"bottom":"none"}}catch(t){T.e(t)}finally{T.f()}}else if(1===d){o[h[0]||c[0]][l]="both"}}return o}},{key:"barBackground",value:function(t){var e=t.j,i=t.i,a=t.x1,s=t.x2,r=t.y1,n=t.y2,o=t.elSeries,l=this.w,h=new Mi(this.barCtx.ctx),c=new Zi(this.barCtx.ctx).getActiveConfigSeriesIndex();if(this.barCtx.barOptions.colors.backgroundBarColors.length>0&&c===i){e>=this.barCtx.barOptions.colors.backgroundBarColors.length&&(e%=this.barCtx.barOptions.colors.backgroundBarColors.length);var d=this.barCtx.barOptions.colors.backgroundBarColors[e],u=h.drawRect(void 0!==a?a:0,void 0!==r?r:0,void 0!==s?s:l.globals.gridWidth,void 0!==n?n:l.globals.gridHeight,this.barCtx.barOptions.colors.backgroundBarRadius,d,this.barCtx.barOptions.colors.backgroundBarOpacity);o.add(u),u.node.classList.add("apexcharts-backgroundBar")}}},{key:"getColumnPaths",value:function(t){var e,i=t.barWidth,a=t.barXPosition,s=t.y1,r=t.y2,n=t.strokeWidth,o=t.isReversed,l=t.series,h=t.seriesGroup,c=t.realIndex,d=t.i,u=t.j,g=t.w,p=new Mi(this.barCtx.ctx);(n=Array.isArray(n)?n[c]:n)||(n=0);var f=i,x=a;null!==(e=g.config.series[c].data[u])&&void 0!==e&&e.columnWidthOffset&&(x=a-g.config.series[c].data[u].columnWidthOffset/2,f=i+g.config.series[c].data[u].columnWidthOffset);var b=n/2,m=x+b,v=x+f-b,y=(l[d][u]>=0?1:-1)*(o?-1:1);s+=.001-b*y,r+=.001+b*y;var w=p.move(m,s),k=p.move(m,s),A=p.line(v,s);if(g.globals.previousPaths.length>0&&(k=this.barCtx.getPreviousPath(c,u,!1)),w=w+p.line(m,r)+p.line(v,r)+A+("around"===g.config.plotOptions.bar.borderRadiusApplication||"both"===this.arrBorderRadius[c][u]?" Z":" z"),k=k+p.line(m,s)+A+A+A+A+A+p.line(m,s)+("around"===g.config.plotOptions.bar.borderRadiusApplication||"both"===this.arrBorderRadius[c][u]?" Z":" z"),"none"!==this.arrBorderRadius[c][u]&&(w=p.roundPathCorners(w,g.config.plotOptions.bar.borderRadius)),g.config.chart.stacked){var C=this.barCtx;(C=this.barCtx[h]).yArrj.push(r-b*y),C.yArrjF.push(Math.abs(s-r+n*y)),C.yArrjVal.push(this.barCtx.series[d][u])}return{pathTo:w,pathFrom:k}}},{key:"getBarpaths",value:function(t){var e,i=t.barYPosition,a=t.barHeight,s=t.x1,r=t.x2,n=t.strokeWidth,o=t.isReversed,l=t.series,h=t.seriesGroup,c=t.realIndex,d=t.i,u=t.j,g=t.w,p=new Mi(this.barCtx.ctx);(n=Array.isArray(n)?n[c]:n)||(n=0);var f=i,x=a;null!==(e=g.config.series[c].data[u])&&void 0!==e&&e.barHeightOffset&&(f=i-g.config.series[c].data[u].barHeightOffset/2,x=a+g.config.series[c].data[u].barHeightOffset);var b=n/2,m=f+b,v=f+x-b,y=(l[d][u]>=0?1:-1)*(o?-1:1);s+=.001+b*y,r+=.001-b*y;var w=p.move(s,m),k=p.move(s,m);g.globals.previousPaths.length>0&&(k=this.barCtx.getPreviousPath(c,u,!1));var A=p.line(s,v);if(w=w+p.line(r,m)+p.line(r,v)+A+("around"===g.config.plotOptions.bar.borderRadiusApplication||"both"===this.arrBorderRadius[c][u]?" Z":" z"),k=k+p.line(s,m)+A+A+A+A+A+p.line(s,m)+("around"===g.config.plotOptions.bar.borderRadiusApplication||"both"===this.arrBorderRadius[c][u]?" Z":" z"),"none"!==this.arrBorderRadius[c][u]&&(w=p.roundPathCorners(w,g.config.plotOptions.bar.borderRadius)),g.config.chart.stacked){var C=this.barCtx;(C=this.barCtx[h]).xArrj.push(r+b*y),C.xArrjF.push(Math.abs(s-r-n*y)),C.xArrjVal.push(this.barCtx.series[d][u])}return{pathTo:w,pathFrom:k}}},{key:"checkZeroSeries",value:function(t){for(var e=t.series,i=this.w,a=0;a2&&void 0!==arguments[2])||arguments[2]?e:null;return null!=t&&(i=e+t/this.barCtx.invertedYRatio-2*(this.barCtx.isReversed?t/this.barCtx.invertedYRatio:0)),i}},{key:"getYForValue",value:function(t,e,i){var a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3]?e:null;return null!=t&&(a=e-t/this.barCtx.yRatio[i]+2*(this.barCtx.isReversed?t/this.barCtx.yRatio[i]:0)),a}},{key:"getGoalValues",value:function(t,e,i,a,s,r){var n=this,l=this.w,h=[],c=function(a,s){var l;h.push((o(l={},t,"x"===t?n.getXForValue(a,e,!1):n.getYForValue(a,i,r,!1)),o(l,"attrs",s),l))};if(l.globals.seriesGoals[a]&&l.globals.seriesGoals[a][s]&&Array.isArray(l.globals.seriesGoals[a][s])&&l.globals.seriesGoals[a][s].forEach((function(t){c(t.value,t)})),this.barCtx.barOptions.isDumbbell&&l.globals.seriesRange.length){var d=this.barCtx.barOptions.dumbbellColors?this.barCtx.barOptions.dumbbellColors:l.globals.colors,g={strokeHeight:"x"===t?0:l.globals.markers.size[a],strokeWidth:"x"===t?l.globals.markers.size[a]:0,strokeDashArray:0,strokeLineCap:"round",strokeColor:Array.isArray(d[a])?d[a][0]:d[a]};c(l.globals.seriesRangeStart[a][s],g),c(l.globals.seriesRangeEnd[a][s],u(u({},g),{},{strokeColor:Array.isArray(d[a])?d[a][1]:d[a]}))}return h}},{key:"drawGoalLine",value:function(t){var e=t.barXPosition,i=t.barYPosition,a=t.goalX,s=t.goalY,r=t.barWidth,n=t.barHeight,o=new Mi(this.barCtx.ctx),l=o.group({className:"apexcharts-bar-goals-groups"});l.node.classList.add("apexcharts-element-hidden"),this.barCtx.w.globals.delayedElements.push({el:l.node}),l.attr("clip-path","url(#gridRectMarkerMask".concat(this.barCtx.w.globals.cuid,")"));var h=null;return this.barCtx.isHorizontal?Array.isArray(a)&&a.forEach((function(t){if(t.x>=-1&&t.x<=o.w.globals.gridWidth+1){var e=void 0!==t.attrs.strokeHeight?t.attrs.strokeHeight:n/2,a=i+e+n/2;h=o.drawLine(t.x,a-2*e,t.x,a,t.attrs.strokeColor?t.attrs.strokeColor:void 0,t.attrs.strokeDashArray,t.attrs.strokeWidth?t.attrs.strokeWidth:2,t.attrs.strokeLineCap),l.add(h)}})):Array.isArray(s)&&s.forEach((function(t){if(t.y>=-1&&t.y<=o.w.globals.gridHeight+1){var i=void 0!==t.attrs.strokeWidth?t.attrs.strokeWidth:r/2,a=e+i+r/2;h=o.drawLine(a-2*i,t.y,a,t.y,t.attrs.strokeColor?t.attrs.strokeColor:void 0,t.attrs.strokeDashArray,t.attrs.strokeHeight?t.attrs.strokeHeight:2,t.attrs.strokeLineCap),l.add(h)}})),l}},{key:"drawBarShadow",value:function(t){var e=t.prevPaths,i=t.currPaths,a=t.color,s=this.w,r=e.x,n=e.x1,o=e.barYPosition,l=i.x,h=i.x1,c=i.barYPosition,d=o+i.barHeight,u=new Mi(this.barCtx.ctx),g=new v,p=u.move(n,d)+u.line(r,d)+u.line(l,c)+u.line(h,c)+u.line(n,d)+("around"===s.config.plotOptions.bar.borderRadiusApplication||"both"===this.arrBorderRadius[realIndex][j]?" Z":" z");return u.drawPath({d:p,fill:g.shadeColor(.5,v.rgb2hex(a)),stroke:"none",strokeWidth:0,fillOpacity:1,classes:"apexcharts-bar-shadow apexcharts-decoration-element"})}},{key:"getZeroValueEncounters",value:function(t){var e,i=t.i,a=t.j,s=this.w,r=0,n=0;return(s.config.plotOptions.bar.horizontal?s.globals.series.map((function(t,e){return e})):(null===(e=s.globals.columnSeries)||void 0===e?void 0:e.i.map((function(t){return t})))||[]).forEach((function(t){var e=s.globals.seriesPercent[t][a];e&&r++,t-1})),a=this.barCtx.columnGroupIndices,s=a.indexOf(i);return s<0&&(a.push(i),s=a.length-1),{groupIndex:i,columnGroupIndex:s}}}]),t}(),Pa=function(){function t(e,a){i(this,t),this.ctx=e,this.w=e.w;var s=this.w;this.barOptions=s.config.plotOptions.bar,this.isHorizontal=this.barOptions.horizontal,this.strokeWidth=s.config.stroke.width,this.isNullValue=!1,this.isRangeBar=s.globals.seriesRange.length&&this.isHorizontal,this.isVerticalGroupedRangeBar=!s.globals.isBarHorizontal&&s.globals.seriesRange.length&&s.config.plotOptions.bar.rangeBarGroupRows,this.isFunnel=this.barOptions.isFunnel,this.xyRatios=a,null!==this.xyRatios&&(this.xRatio=a.xRatio,this.yRatio=a.yRatio,this.invertedXRatio=a.invertedXRatio,this.invertedYRatio=a.invertedYRatio,this.baseLineY=a.baseLineY,this.baseLineInvertedY=a.baseLineInvertedY),this.yaxisIndex=0,this.translationsIndex=0,this.seriesLen=0,this.pathArr=[];var r=new Zi(this.ctx);this.lastActiveBarSerieIndex=r.getActiveConfigSeriesIndex("desc",["bar","column"]),this.columnGroupIndices=[];var n=r.getBarSeriesIndices(),o=new Pi(this.ctx);this.stackedSeriesTotals=o.getStackedSeriesTotals(this.w.config.series.map((function(t,e){return-1===n.indexOf(e)?e:-1})).filter((function(t){return-1!==t}))),this.barHelpers=new Ma(this)}return s(t,[{key:"draw",value:function(t,e){var i=this.w,a=new Mi(this.ctx),s=new Pi(this.ctx,i);t=s.getLogSeries(t),this.series=t,this.yRatio=s.getLogYRatios(this.yRatio),this.barHelpers.initVariables(t);var r=a.group({class:"apexcharts-bar-series apexcharts-plot-series"});i.config.dataLabels.enabled&&this.totalItems>this.barOptions.dataLabels.maxItems&&console.warn("WARNING: DataLabels are enabled but there are too many to display. This may cause performance issue when rendering - ApexCharts");for(var n=0,o=0;n0&&(this.visibleI=this.visibleI+1);var w=0,k=0;this.yRatio.length>1&&(this.yaxisIndex=i.globals.seriesYAxisReverseMap[b],this.translationsIndex=b);var A=this.translationsIndex;this.isReversed=i.config.yaxis[this.yaxisIndex]&&i.config.yaxis[this.yaxisIndex].reversed;var C=this.barHelpers.initialPositions(b);p=C.y,w=C.barHeight,h=C.yDivision,d=C.zeroW,g=C.x,k=C.barWidth,l=C.xDivision,c=C.zeroH,this.isHorizontal||x.push(g+k/2);var S=a.group({class:"apexcharts-datalabels","data:realIndex":b});i.globals.delayedElements.push({el:S.node}),S.node.classList.add("apexcharts-element-hidden");var L=a.group({class:"apexcharts-bar-goals-markers"}),M=a.group({class:"apexcharts-bar-shadows"});i.globals.delayedElements.push({el:M.node}),M.node.classList.add("apexcharts-element-hidden");for(var P=0;P0){var R,E=this.barHelpers.drawBarShadow({color:"string"==typeof X.color&&-1===(null===(R=X.color)||void 0===R?void 0:R.indexOf("url"))?X.color:v.hexToRgba(i.globals.colors[n]),prevPaths:this.pathArr[this.pathArr.length-1],currPaths:T});if(M.add(E),i.config.chart.dropShadow.enabled)new Li(this.ctx).dropShadow(E,i.config.chart.dropShadow,b)}this.pathArr.push(T);var Y=this.barHelpers.drawGoalLine({barXPosition:T.barXPosition,barYPosition:T.barYPosition,goalX:T.goalX,goalY:T.goalY,barHeight:w,barWidth:k});Y&&L.add(Y),p=T.y,g=T.x,P>0&&x.push(g+k/2),f.push(p),this.renderSeries(u(u({realIndex:b,pathFill:X.color},X.useRangeColor?{lineFill:X.color}:{}),{},{j:P,i:n,columnGroupIndex:m,pathFrom:T.pathFrom,pathTo:T.pathTo,strokeWidth:I,elSeries:y,x:g,y:p,series:t,barHeight:Math.abs(T.barHeight?T.barHeight:w),barWidth:Math.abs(T.barWidth?T.barWidth:k),elDataLabelsWrap:S,elGoalsMarkers:L,elBarShadows:M,visibleSeries:this.visibleI,type:"bar"}))}i.globals.seriesXvalues[b]=x,i.globals.seriesYvalues[b]=f,r.add(y)}return r}},{key:"renderSeries",value:function(t){var e=t.realIndex,i=t.pathFill,a=t.lineFill,s=t.j,r=t.i,n=t.columnGroupIndex,o=t.pathFrom,l=t.pathTo,h=t.strokeWidth,c=t.elSeries,d=t.x,u=t.y,g=t.y1,p=t.y2,f=t.series,x=t.barHeight,b=t.barWidth,m=t.barXPosition,v=t.barYPosition,y=t.elDataLabelsWrap,w=t.elGoalsMarkers,k=t.elBarShadows,A=t.visibleSeries,C=t.type,S=t.classes,L=this.w,M=new Mi(this.ctx);if(!a){var P="function"==typeof L.globals.stroke.colors[e]?function(t){var e,i=L.config.stroke.colors;return Array.isArray(i)&&i.length>0&&((e=i[t])||(e=""),"function"==typeof e)?e({value:L.globals.series[t][s],dataPointIndex:s,w:L}):e}(e):L.globals.stroke.colors[e];a=this.barOptions.distributed?L.globals.stroke.colors[s]:P}L.config.series[r].data[s]&&L.config.series[r].data[s].strokeColor&&(a=L.config.series[r].data[s].strokeColor),this.isNullValue&&(i="none");var I=s/L.config.chart.animations.animateGradually.delay*(L.config.chart.animations.speed/L.globals.dataPoints)/2.4,T=M.renderPaths({i:r,j:s,realIndex:e,pathFrom:o,pathTo:l,stroke:a,strokeWidth:h,strokeLineCap:L.config.stroke.lineCap,fill:i,animationDelay:I,initialSpeed:L.config.chart.animations.speed,dataChangeSpeed:L.config.chart.animations.dynamicAnimation.speed,className:"apexcharts-".concat(C,"-area ").concat(S),chartType:C});T.attr("clip-path","url(#gridRectBarMask".concat(L.globals.cuid,")"));var z=L.config.forecastDataPoints;z.count>0&&s>=L.globals.dataPoints-z.count&&(T.node.setAttribute("stroke-dasharray",z.dashArray),T.node.setAttribute("stroke-width",z.strokeWidth),T.node.setAttribute("fill-opacity",z.fillOpacity)),void 0!==g&&void 0!==p&&(T.attr("data-range-y1",g),T.attr("data-range-y2",p)),new Li(this.ctx).setSelectionFilter(T,e,s),c.add(T);var X=new La(this).handleBarDataLabels({x:d,y:u,y1:g,y2:p,i:r,j:s,series:f,realIndex:e,columnGroupIndex:n,barHeight:x,barWidth:b,barXPosition:m,barYPosition:v,renderedPath:T,visibleSeries:A});return null!==X.dataLabels&&y.add(X.dataLabels),X.totalDataLabels&&y.add(X.totalDataLabels),c.add(y),w&&c.add(w),k&&c.add(k),c}},{key:"drawBarPaths",value:function(t){var e,i=t.indexes,a=t.barHeight,s=t.strokeWidth,r=t.zeroW,n=t.x,o=t.y,l=t.yDivision,h=t.elSeries,c=this.w,d=i.i,u=i.j;if(c.globals.isXNumeric)e=(o=(c.globals.seriesX[d][u]-c.globals.minX)/this.invertedXRatio-a)+a*this.visibleI;else if(c.config.plotOptions.bar.hideZeroBarsWhenGrouped){var g=this.barHelpers.getZeroValueEncounters({i:d,j:u}),p=g.nonZeroColumns,f=g.zeroEncounters;p>0&&(a=this.seriesLen*a/p),e=o+a*this.visibleI,e-=a*f}else e=o+a*this.visibleI;this.isFunnel&&(r-=(this.barHelpers.getXForValue(this.series[d][u],r)-r)/2),n=this.barHelpers.getXForValue(this.series[d][u],r);var x=this.barHelpers.getBarpaths({barYPosition:e,barHeight:a,x1:r,x2:n,strokeWidth:s,isReversed:this.isReversed,series:this.series,realIndex:i.realIndex,i:d,j:u,w:c});return c.globals.isXNumeric||(o+=l),this.barHelpers.barBackground({j:u,i:d,y1:e-a*this.visibleI,y2:a*this.seriesLen,elSeries:h}),{pathTo:x.pathTo,pathFrom:x.pathFrom,x1:r,x:n,y:o,goalX:this.barHelpers.getGoalValues("x",r,null,d,u),barYPosition:e,barHeight:a}}},{key:"drawColumnPaths",value:function(t){var e,i=t.indexes,a=t.x,s=t.y,r=t.xDivision,n=t.barWidth,o=t.zeroH,l=t.strokeWidth,h=t.elSeries,c=this.w,d=i.realIndex,u=i.translationsIndex,g=i.i,p=i.j,f=i.bc;if(c.globals.isXNumeric){var x=this.getBarXForNumericXAxis({x:a,j:p,realIndex:d,barWidth:n});a=x.x,e=x.barXPosition}else if(c.config.plotOptions.bar.hideZeroBarsWhenGrouped){var b=this.barHelpers.getZeroValueEncounters({i:g,j:p}),m=b.nonZeroColumns,v=b.zeroEncounters;m>0&&(n=this.seriesLen*n/m),e=a+n*this.visibleI,e-=n*v}else e=a+n*this.visibleI;s=this.barHelpers.getYForValue(this.series[g][p],o,u);var y=this.barHelpers.getColumnPaths({barXPosition:e,barWidth:n,y1:o,y2:s,strokeWidth:l,isReversed:this.isReversed,series:this.series,realIndex:d,i:g,j:p,w:c});return c.globals.isXNumeric||(a+=r),this.barHelpers.barBackground({bc:f,j:p,i:g,x1:e-l/2-n*this.visibleI,x2:n*this.seriesLen+l/2,elSeries:h}),{pathTo:y.pathTo,pathFrom:y.pathFrom,x:a,y:s,goalY:this.barHelpers.getGoalValues("y",null,o,g,p,u),barXPosition:e,barWidth:n}}},{key:"getBarXForNumericXAxis",value:function(t){var e=t.x,i=t.barWidth,a=t.realIndex,s=t.j,r=this.w,n=a;return r.globals.seriesX[a].length||(n=r.globals.maxValsInArrayIndex),v.isNumber(r.globals.seriesX[n][s])&&(e=(r.globals.seriesX[n][s]-r.globals.minX)/this.xRatio-i*this.seriesLen/2),{barXPosition:e+i*this.visibleI,x:e}}},{key:"getPreviousPath",value:function(t,e){for(var i,a=this.w,s=0;s0&&parseInt(r.realIndex,10)===parseInt(t,10)&&void 0!==a.globals.previousPaths[s].paths[e]&&(i=a.globals.previousPaths[s].paths[e].d)}return i}}]),t}(),Ia=function(t){h(a,Pa);var e=n(a);function a(){return i(this,a),e.apply(this,arguments)}return s(a,[{key:"draw",value:function(t,e){var i=this,a=this.w;this.graphics=new Mi(this.ctx),this.bar=new Pa(this.ctx,this.xyRatios);var s=new Pi(this.ctx,a);t=s.getLogSeries(t),this.yRatio=s.getLogYRatios(this.yRatio),this.barHelpers.initVariables(t),"100%"===a.config.chart.stackType&&(t=a.globals.comboCharts?e.map((function(t){return a.globals.seriesPercent[t]})):a.globals.seriesPercent.slice()),this.series=t,this.barHelpers.initializeStackedPrevVars(this);for(var r=this.graphics.group({class:"apexcharts-bar-series apexcharts-plot-series"}),n=0,o=0,l=function(s,l){var h=void 0,c=void 0,d=void 0,g=void 0,p=a.globals.comboCharts?e[s]:s,f=i.barHelpers.getGroupIndex(p),x=f.groupIndex,b=f.columnGroupIndex;i.groupCtx=i[a.globals.seriesGroups[x]];var m=[],y=[],w=0;i.yRatio.length>1&&(i.yaxisIndex=a.globals.seriesYAxisReverseMap[p][0],w=p),i.isReversed=a.config.yaxis[i.yaxisIndex]&&a.config.yaxis[i.yaxisIndex].reversed;var k=i.graphics.group({class:"apexcharts-series",seriesName:v.escapeString(a.globals.seriesNames[p]),rel:s+1,"data:realIndex":p});i.ctx.series.addCollapsedClassToSeries(k,p);var A=i.graphics.group({class:"apexcharts-datalabels","data:realIndex":p}),C=i.graphics.group({class:"apexcharts-bar-goals-markers"}),S=0,L=0,M=i.initialPositions(n,o,h,c,d,g,w);o=M.y,S=M.barHeight,c=M.yDivision,g=M.zeroW,n=M.x,L=M.barWidth,h=M.xDivision,d=M.zeroH,a.globals.barHeight=S,a.globals.barWidth=L,i.barHelpers.initializeStackedXYVars(i),1===i.groupCtx.prevY.length&&i.groupCtx.prevY[0].every((function(t){return isNaN(t)}))&&(i.groupCtx.prevY[0]=i.groupCtx.prevY[0].map((function(){return d})),i.groupCtx.prevYF[0]=i.groupCtx.prevYF[0].map((function(){return 0})));for(var P=0;P0||"top"===i.barHelpers.arrBorderRadius[p][P]&&a.globals.series[p][P]<0)&&(E=Y),k=i.renderSeries(u(u({realIndex:p,pathFill:R.color},R.useRangeColor?{lineFill:R.color}:{}),{},{j:P,i:s,columnGroupIndex:b,pathFrom:z.pathFrom,pathTo:z.pathTo,strokeWidth:I,elSeries:k,x:n,y:o,series:t,barHeight:S,barWidth:L,elDataLabelsWrap:A,elGoalsMarkers:C,type:"bar",visibleSeries:b,classes:E}))}a.globals.seriesXvalues[p]=m,a.globals.seriesYvalues[p]=y,i.groupCtx.prevY.push(i.groupCtx.yArrj),i.groupCtx.prevYF.push(i.groupCtx.yArrjF),i.groupCtx.prevYVal.push(i.groupCtx.yArrjVal),i.groupCtx.prevX.push(i.groupCtx.xArrj),i.groupCtx.prevXF.push(i.groupCtx.xArrjF),i.groupCtx.prevXVal.push(i.groupCtx.xArrjVal),r.add(k)},h=0,c=0;h1?l=(i=h.globals.minXDiff/this.xRatio)*parseInt(this.barOptions.columnWidth,10)/100:-1===String(d).indexOf("%")?l=parseInt(d,10):l*=parseInt(d,10)/100,s=this.isReversed?this.baseLineY[n]:h.globals.gridHeight-this.baseLineY[n],t=h.globals.padHorizontal+(i-l)/2}var u=h.globals.barGroups.length||1;return{x:t,y:e,yDivision:a,xDivision:i,barHeight:o/u,barWidth:l/u,zeroH:s,zeroW:r}}},{key:"drawStackedBarPaths",value:function(t){for(var e,i=t.indexes,a=t.barHeight,s=t.strokeWidth,r=t.zeroW,n=t.x,o=t.y,l=t.columnGroupIndex,h=t.seriesGroup,c=t.yDivision,d=t.elSeries,u=this.w,g=o+l*a,p=i.i,f=i.j,x=i.realIndex,b=i.translationsIndex,m=0,v=0;v0){var w=r;this.groupCtx.prevXVal[y-1][f]<0?w=this.series[p][f]>=0?this.groupCtx.prevX[y-1][f]+m-2*(this.isReversed?m:0):this.groupCtx.prevX[y-1][f]:this.groupCtx.prevXVal[y-1][f]>=0&&(w=this.series[p][f]>=0?this.groupCtx.prevX[y-1][f]:this.groupCtx.prevX[y-1][f]-m+2*(this.isReversed?m:0)),e=w}else e=r;n=null===this.series[p][f]?e:e+this.series[p][f]/this.invertedYRatio-2*(this.isReversed?this.series[p][f]/this.invertedYRatio:0);var k=this.barHelpers.getBarpaths({barYPosition:g,barHeight:a,x1:e,x2:n,strokeWidth:s,isReversed:this.isReversed,series:this.series,realIndex:i.realIndex,seriesGroup:h,i:p,j:f,w:u});return this.barHelpers.barBackground({j:f,i:p,y1:g,y2:a,elSeries:d}),o+=c,{pathTo:k.pathTo,pathFrom:k.pathFrom,goalX:this.barHelpers.getGoalValues("x",r,null,p,f,b),barXPosition:e,barYPosition:g,x:n,y:o}}},{key:"drawStackedColumnPaths",value:function(t){var e=t.indexes,i=t.x,a=t.y,s=t.xDivision,r=t.barWidth,n=t.zeroH,o=t.columnGroupIndex,l=t.seriesGroup,h=t.elSeries,c=this.w,d=e.i,u=e.j,g=e.bc,p=e.realIndex,f=e.translationsIndex;if(c.globals.isXNumeric){var x=c.globals.seriesX[p][u];x||(x=0),i=(x-c.globals.minX)/this.xRatio-r/2*c.globals.barGroups.length}for(var b,m=i+o*r,v=0,y=0;y0&&!c.globals.isXNumeric||w>0&&c.globals.isXNumeric&&c.globals.seriesX[p-1][u]===c.globals.seriesX[p][u]){var k,A,C,S=Math.min(this.yRatio.length+1,p+1);if(void 0!==this.groupCtx.prevY[w-1]&&this.groupCtx.prevY[w-1].length)for(var L=1;L=0?C-v+2*(this.isReversed?v:0):C;break}if((null===(T=this.groupCtx.prevYVal[w-P])||void 0===T?void 0:T[u])>=0){A=this.series[d][u]>=0?C:C+v-2*(this.isReversed?v:0);break}}void 0===A&&(A=c.globals.gridHeight),b=null!==(k=this.groupCtx.prevYF[0])&&void 0!==k&&k.every((function(t){return 0===t}))&&this.groupCtx.prevYF.slice(1,w).every((function(t){return t.every((function(t){return isNaN(t)}))}))?n:A}else b=n;a=this.series[d][u]?b-this.series[d][u]/this.yRatio[f]+2*(this.isReversed?this.series[d][u]/this.yRatio[f]:0):b;var z=this.barHelpers.getColumnPaths({barXPosition:m,barWidth:r,y1:b,y2:a,yRatio:this.yRatio[f],strokeWidth:this.strokeWidth,isReversed:this.isReversed,series:this.series,seriesGroup:l,realIndex:e.realIndex,i:d,j:u,w:c});return this.barHelpers.barBackground({bc:g,j:u,i:d,x1:m,x2:r,elSeries:h}),{pathTo:z.pathTo,pathFrom:z.pathFrom,goalY:this.barHelpers.getGoalValues("y",null,n,d,u),barXPosition:m,x:c.globals.isXNumeric?i:i+s,y:a}}}]),a}(),Ta=function(t){h(a,Pa);var e=n(a);function a(){return i(this,a),e.apply(this,arguments)}return s(a,[{key:"draw",value:function(t,e,i){var a=this,s=this.w,r=new Mi(this.ctx),n=s.globals.comboCharts?e:s.config.chart.type,o=new ji(this.ctx);this.candlestickOptions=this.w.config.plotOptions.candlestick,this.boxOptions=this.w.config.plotOptions.boxPlot,this.isHorizontal=s.config.plotOptions.bar.horizontal;var l=new Pi(this.ctx,s);t=l.getLogSeries(t),this.series=t,this.yRatio=l.getLogYRatios(this.yRatio),this.barHelpers.initVariables(t);for(var h=r.group({class:"apexcharts-".concat(n,"-series apexcharts-plot-series")}),c=function(e){a.isBoxPlot="boxPlot"===s.config.chart.type||"boxPlot"===s.config.series[e].type;var n,l,c,d,g=void 0,p=void 0,f=[],x=[],b=s.globals.comboCharts?i[e]:e,m=a.barHelpers.getGroupIndex(b).columnGroupIndex,y=r.group({class:"apexcharts-series",seriesName:v.escapeString(s.globals.seriesNames[b]),rel:e+1,"data:realIndex":b});a.ctx.series.addCollapsedClassToSeries(y,b),t[e].length>0&&(a.visibleI=a.visibleI+1);var w,k,A=0;a.yRatio.length>1&&(a.yaxisIndex=s.globals.seriesYAxisReverseMap[b][0],A=b);var C=a.barHelpers.initialPositions(b);p=C.y,w=C.barHeight,l=C.yDivision,d=C.zeroW,g=C.x,k=C.barWidth,n=C.xDivision,c=C.zeroH,x.push(g+k/2);for(var S=r.group({class:"apexcharts-datalabels","data:realIndex":b}),L=r.group({class:"apexcharts-bar-goals-markers"}),M=function(i){var r=a.barHelpers.getStrokeWidth(e,i,b),h=null,v={indexes:{i:e,j:i,realIndex:b,translationsIndex:A},x:g,y:p,strokeWidth:r,elSeries:y};h=a.isHorizontal?a.drawHorizontalBoxPaths(u(u({},v),{},{yDivision:l,barHeight:w,zeroW:d})):a.drawVerticalBoxPaths(u(u({},v),{},{xDivision:n,barWidth:k,zeroH:c})),p=h.y,g=h.x;var C=a.barHelpers.drawGoalLine({barXPosition:h.barXPosition,barYPosition:h.barYPosition,goalX:h.goalX,goalY:h.goalY,barHeight:w,barWidth:k});C&&L.add(C),i>0&&x.push(g+k/2),f.push(p),h.pathTo.forEach((function(n,l){var c=!a.isBoxPlot&&a.candlestickOptions.wick.useFillColor?h.color[l]:s.globals.stroke.colors[e],d=o.fillPath({seriesNumber:b,dataPointIndex:i,color:h.color[l],value:t[e][i]});a.renderSeries({realIndex:b,pathFill:d,lineFill:c,j:i,i:e,pathFrom:h.pathFrom,pathTo:n,strokeWidth:r,elSeries:y,x:g,y:p,series:t,columnGroupIndex:m,barHeight:w,barWidth:k,elDataLabelsWrap:S,elGoalsMarkers:L,visibleSeries:a.visibleI,type:s.config.chart.type})}))},P=0;P0&&(M=this.getPreviousPath(g,c,!0)),L=this.isBoxPlot?[l.move(S,k)+l.line(S+s/2,k)+l.line(S+s/2,v)+l.line(S+s/4,v)+l.line(S+s-s/4,v)+l.line(S+s/2,v)+l.line(S+s/2,k)+l.line(S+s,k)+l.line(S+s,C)+l.line(S,C)+l.line(S,k+n/2),l.move(S,C)+l.line(S+s,C)+l.line(S+s,A)+l.line(S+s/2,A)+l.line(S+s/2,y)+l.line(S+s-s/4,y)+l.line(S+s/4,y)+l.line(S+s/2,y)+l.line(S+s/2,A)+l.line(S,A)+l.line(S,C)+"z"]:[l.move(S,A)+l.line(S+s/2,A)+l.line(S+s/2,v)+l.line(S+s/2,A)+l.line(S+s,A)+l.line(S+s,k)+l.line(S+s/2,k)+l.line(S+s/2,y)+l.line(S+s/2,k)+l.line(S,k)+l.line(S,A-n/2)],M+=l.move(S,k),o.globals.isXNumeric||(i+=a),{pathTo:L,pathFrom:M,x:i,y:A,goalY:this.barHelpers.getGoalValues("y",null,r,h,c,e.translationsIndex),barXPosition:S,color:w}}},{key:"drawHorizontalBoxPaths",value:function(t){var e=t.indexes;t.x;var i=t.y,a=t.yDivision,s=t.barHeight,r=t.zeroW,n=t.strokeWidth,o=this.w,l=new Mi(this.ctx),h=e.i,c=e.j,d=this.boxOptions.colors.lower;this.isBoxPlot&&(d=[this.boxOptions.colors.lower,this.boxOptions.colors.upper]);var u=this.invertedYRatio,g=e.realIndex,p=this.getOHLCValue(g,c),f=r,x=r,b=Math.min(p.o,p.c),m=Math.max(p.o,p.c),v=p.m;o.globals.isXNumeric&&(i=(o.globals.seriesX[g][c]-o.globals.minX)/this.invertedXRatio-s/2);var y=i+s*this.visibleI;void 0===this.series[h][c]||null===this.series[h][c]?(b=r,m=r):(b=r+b/u,m=r+m/u,f=r+p.h/u,x=r+p.l/u,v=r+p.m/u);var w=l.move(r,y),k=l.move(b,y+s/2);return o.globals.previousPaths.length>0&&(k=this.getPreviousPath(g,c,!0)),w=[l.move(b,y)+l.line(b,y+s/2)+l.line(f,y+s/2)+l.line(f,y+s/2-s/4)+l.line(f,y+s/2+s/4)+l.line(f,y+s/2)+l.line(b,y+s/2)+l.line(b,y+s)+l.line(v,y+s)+l.line(v,y)+l.line(b+n/2,y),l.move(v,y)+l.line(v,y+s)+l.line(m,y+s)+l.line(m,y+s/2)+l.line(x,y+s/2)+l.line(x,y+s-s/4)+l.line(x,y+s/4)+l.line(x,y+s/2)+l.line(m,y+s/2)+l.line(m,y)+l.line(v,y)+"z"],k+=l.move(b,y),o.globals.isXNumeric||(i+=a),{pathTo:w,pathFrom:k,x:m,y:i,goalX:this.barHelpers.getGoalValues("x",r,null,h,c),barYPosition:y,color:d}}},{key:"getOHLCValue",value:function(t,e){var i=this.w,a=new Pi(this.ctx,i),s=a.getLogValAtSeriesIndex(i.globals.seriesCandleH[t][e],t),r=a.getLogValAtSeriesIndex(i.globals.seriesCandleO[t][e],t),n=a.getLogValAtSeriesIndex(i.globals.seriesCandleM[t][e],t),o=a.getLogValAtSeriesIndex(i.globals.seriesCandleC[t][e],t),l=a.getLogValAtSeriesIndex(i.globals.seriesCandleL[t][e],t);return{o:this.isBoxPlot?s:r,h:this.isBoxPlot?r:s,m:n,l:this.isBoxPlot?o:l,c:this.isBoxPlot?l:o}}}]),a}(),za=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"checkColorRange",value:function(){var t=this.w,e=!1,i=t.config.plotOptions[t.config.chart.type];return i.colorScale.ranges.length>0&&i.colorScale.ranges.map((function(t,i){t.from<=0&&(e=!0)})),e}},{key:"getShadeColor",value:function(t,e,i,a){var s=this.w,r=1,n=s.config.plotOptions[t].shadeIntensity,o=this.determineColor(t,e,i);s.globals.hasNegs||a?r=s.config.plotOptions[t].reverseNegativeShade?o.percent<0?o.percent/100*(1.25*n):(1-o.percent/100)*(1.25*n):o.percent<=0?1-(1+o.percent/100)*n:(1-o.percent/100)*n:(r=1-o.percent/100,"treemap"===t&&(r=(1-o.percent/100)*(1.25*n)));var l=o.color,h=new v;if(s.config.plotOptions[t].enableShades)if("dark"===this.w.config.theme.mode){var c=h.shadeColor(-1*r,o.color);l=v.hexToRgba(v.isColorHex(c)?c:v.rgb2hex(c),s.config.fill.opacity)}else{var d=h.shadeColor(r,o.color);l=v.hexToRgba(v.isColorHex(d)?d:v.rgb2hex(d),s.config.fill.opacity)}return{color:l,colorProps:o}}},{key:"determineColor",value:function(t,e,i){var a=this.w,s=a.globals.series[e][i],r=a.config.plotOptions[t],n=r.colorScale.inverse?i:e;r.distributed&&"treemap"===a.config.chart.type&&(n=i);var o=a.globals.colors[n],l=null,h=Math.min.apply(Math,f(a.globals.series[e])),c=Math.max.apply(Math,f(a.globals.series[e]));r.distributed||"heatmap"!==t||(h=a.globals.minY,c=a.globals.maxY),void 0!==r.colorScale.min&&(h=r.colorScale.mina.globals.maxY?r.colorScale.max:a.globals.maxY);var d=Math.abs(c)+Math.abs(h),u=100*s/(0===d?d-1e-6:d);r.colorScale.ranges.length>0&&r.colorScale.ranges.map((function(t,e){if(s>=t.from&&s<=t.to){o=t.color,l=t.foreColor?t.foreColor:null,h=t.from,c=t.to;var i=Math.abs(c)+Math.abs(h);u=100*s/(0===i?i-1e-6:i)}}));return{color:o,foreColor:l,percent:u}}},{key:"calculateDataLabels",value:function(t){var e=t.text,i=t.x,a=t.y,s=t.i,r=t.j,n=t.colorProps,o=t.fontSize,l=this.w.config.dataLabels,h=new Mi(this.ctx),c=new qi(this.ctx),d=null;if(l.enabled){d=h.group({class:"apexcharts-data-labels"});var u=l.offsetX,g=l.offsetY,p=i+u,f=a+parseFloat(l.style.fontSize)/3+g;c.plotDataLabelsText({x:p,y:f,text:e,i:s,j:r,color:n.foreColor,parent:d,fontSize:o,dataLabelsConfig:l})}return d}},{key:"addListeners",value:function(t){var e=new Mi(this.ctx);t.node.addEventListener("mouseenter",e.pathMouseEnter.bind(this,t)),t.node.addEventListener("mouseleave",e.pathMouseLeave.bind(this,t)),t.node.addEventListener("mousedown",e.pathMouseDown.bind(this,t))}}]),t}(),Xa=function(){function t(e,a){i(this,t),this.ctx=e,this.w=e.w,this.xRatio=a.xRatio,this.yRatio=a.yRatio,this.dynamicAnim=this.w.config.chart.animations.dynamicAnimation,this.helpers=new za(e),this.rectRadius=this.w.config.plotOptions.heatmap.radius,this.strokeWidth=this.w.config.stroke.show?this.w.config.stroke.width:0}return s(t,[{key:"draw",value:function(t){var e=this.w,i=new Mi(this.ctx),a=i.group({class:"apexcharts-heatmap"});a.attr("clip-path","url(#gridRectMask".concat(e.globals.cuid,")"));var s=e.globals.gridWidth/e.globals.dataPoints,r=e.globals.gridHeight/e.globals.series.length,n=0,o=!1;this.negRange=this.helpers.checkColorRange();var l=t.slice();e.config.yaxis[0].reversed&&(o=!0,l.reverse());for(var h=o?0:l.length-1;o?h=0;o?h++:h--){var c=i.group({class:"apexcharts-series apexcharts-heatmap-series",seriesName:v.escapeString(e.globals.seriesNames[h]),rel:h+1,"data:realIndex":h});if(this.ctx.series.addCollapsedClassToSeries(c,h),e.config.chart.dropShadow.enabled){var d=e.config.chart.dropShadow;new Li(this.ctx).dropShadow(c,d,h)}for(var u=0,g=e.config.plotOptions.heatmap.shadeIntensity,p=0,f=0;f=l[h].length)break;var x=this.helpers.getShadeColor(e.config.chart.type,h,p,this.negRange),b=x.color,m=x.colorProps;if("image"===e.config.fill.type)b=new ji(this.ctx).fillPath({seriesNumber:h,dataPointIndex:p,opacity:e.globals.hasNegs?m.percent<0?1-(1+m.percent/100):g+m.percent/100:m.percent/100,patternID:v.randomId(),width:e.config.fill.image.width?e.config.fill.image.width:s,height:e.config.fill.image.height?e.config.fill.image.height:r});var y=this.rectRadius,w=i.drawRect(u,n,s,r,y);if(w.attr({cx:u,cy:n}),w.node.classList.add("apexcharts-heatmap-rect"),c.add(w),w.attr({fill:b,i:h,index:h,j:p,val:t[h][p],"stroke-width":this.strokeWidth,stroke:e.config.plotOptions.heatmap.useFillColorAsStroke?b:e.globals.stroke.colors[0],color:b}),this.helpers.addListeners(w),e.config.chart.animations.enabled&&!e.globals.dataChanged){var k=1;e.globals.resized||(k=e.config.chart.animations.speed),this.animateHeatMap(w,u,n,s,r,k)}if(e.globals.dataChanged){var A=1;if(this.dynamicAnim.enabled&&e.globals.shouldAnimate){A=this.dynamicAnim.speed;var C=e.globals.previousPaths[h]&&e.globals.previousPaths[h][p]&&e.globals.previousPaths[h][p].color;C||(C="rgba(255, 255, 255, 0)"),this.animateHeatColor(w,v.isColorHex(C)?C:v.rgb2hex(C),v.isColorHex(b)?b:v.rgb2hex(b),A)}}var S=(0,e.config.dataLabels.formatter)(e.globals.series[h][p],{value:e.globals.series[h][p],seriesIndex:h,dataPointIndex:p,w:e}),L=this.helpers.calculateDataLabels({text:S,x:u+s/2,y:n+r/2,i:h,j:p,colorProps:m,series:l});null!==L&&c.add(L),u+=s,p++}n+=r,a.add(c)}var M=e.globals.yAxisScale[0].result.slice();return e.config.yaxis[0].reversed?M.unshift(""):M.push(""),e.globals.yAxisScale[0].result=M,a}},{key:"animateHeatMap",value:function(t,e,i,a,s,r){var n=new y(this.ctx);n.animateRect(t,{x:e+a/2,y:i+s/2,width:0,height:0},{x:e,y:i,width:a,height:s},r,(function(){n.animationCompleted(t)}))}},{key:"animateHeatColor",value:function(t,e,i,a){t.attr({fill:e}).animate(a).attr({fill:i})}}]),t}(),Ra=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"drawYAxisTexts",value:function(t,e,i,a){var s=this.w,r=s.config.yaxis[0],n=s.globals.yLabelFormatters[0];return new Mi(this.ctx).drawText({x:t+r.labels.offsetX,y:e+r.labels.offsetY,text:n(a,i),textAnchor:"middle",fontSize:r.labels.style.fontSize,fontFamily:r.labels.style.fontFamily,foreColor:Array.isArray(r.labels.style.colors)?r.labels.style.colors[i]:r.labels.style.colors})}}]),t}(),Ea=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w;var a=this.w;this.chartType=this.w.config.chart.type,this.initialAnim=this.w.config.chart.animations.enabled,this.dynamicAnim=this.initialAnim&&this.w.config.chart.animations.dynamicAnimation.enabled,this.animBeginArr=[0],this.animDur=0,this.donutDataLabels=this.w.config.plotOptions.pie.donut.labels,this.lineColorArr=void 0!==a.globals.stroke.colors?a.globals.stroke.colors:a.globals.colors,this.defaultSize=Math.min(a.globals.gridWidth,a.globals.gridHeight),this.centerY=this.defaultSize/2,this.centerX=a.globals.gridWidth/2,"radialBar"===a.config.chart.type?this.fullAngle=360:this.fullAngle=Math.abs(a.config.plotOptions.pie.endAngle-a.config.plotOptions.pie.startAngle),this.initialAngle=a.config.plotOptions.pie.startAngle%this.fullAngle,a.globals.radialSize=this.defaultSize/2.05-a.config.stroke.width-(a.config.chart.sparkline.enabled?0:a.config.chart.dropShadow.blur),this.donutSize=a.globals.radialSize*parseInt(a.config.plotOptions.pie.donut.size,10)/100;var s=a.config.plotOptions.pie.customScale,r=a.globals.gridWidth/2,n=a.globals.gridHeight/2;this.translateX=r-r*s,this.translateY=n-n*s,this.dataLabelsGroup=new Mi(this.ctx).group({class:"apexcharts-datalabels-group",transform:"translate(".concat(this.translateX,", ").concat(this.translateY,") scale(").concat(s,")")}),this.maxY=0,this.sliceLabels=[],this.sliceSizes=[],this.prevSectorAngleArr=[]}return s(t,[{key:"draw",value:function(t){var e=this,i=this.w,a=new Mi(this.ctx),s=a.group({class:"apexcharts-pie"});if(i.globals.noData)return s;for(var r=0,n=0;n-1&&this.pieClicked(d),i.config.dataLabels.enabled){var w=m.x,k=m.y,A=100*g/this.fullAngle+"%";if(0!==g&&i.config.plotOptions.pie.dataLabels.minAngleToShowLabelthis.fullAngle?e.endAngle=e.endAngle-(a+n):a+n=this.fullAngle+this.w.config.plotOptions.pie.startAngle%this.fullAngle&&(h=this.fullAngle+this.w.config.plotOptions.pie.startAngle%this.fullAngle-.01),Math.ceil(h)>this.fullAngle&&(h-=this.fullAngle);var c=Math.PI*(h-90)/180,d=i.centerX+r*Math.cos(l),u=i.centerY+r*Math.sin(l),g=i.centerX+r*Math.cos(c),p=i.centerY+r*Math.sin(c),f=v.polarToCartesian(i.centerX,i.centerY,i.donutSize,h),x=v.polarToCartesian(i.centerX,i.centerY,i.donutSize,o),b=s>180?1:0,m=["M",d,u,"A",r,r,0,b,1,g,p];return e="donut"===i.chartType?[].concat(m,["L",f.x,f.y,"A",i.donutSize,i.donutSize,0,b,0,x.x,x.y,"L",d,u,"z"]).join(" "):"pie"===i.chartType||"polarArea"===i.chartType?[].concat(m,["L",i.centerX,i.centerY,"L",d,u]).join(" "):[].concat(m).join(" "),n.roundPathCorners(e,2*this.strokeWidth)}},{key:"drawPolarElements",value:function(t){var e=this.w,i=new ta(this.ctx),a=new Mi(this.ctx),s=new Ra(this.ctx),r=a.group(),n=a.group(),o=i.niceScale(0,Math.ceil(this.maxY),0),l=o.result.reverse(),h=o.result.length;this.maxY=o.niceMax;for(var c=e.globals.radialSize,d=c/(h-1),u=0;u1&&t.total.show&&(s=t.total.color);var n=r.globals.dom.baseEl.querySelector(".apexcharts-datalabel-label"),o=r.globals.dom.baseEl.querySelector(".apexcharts-datalabel-value");i=(0,t.value.formatter)(i,r),a||"function"!=typeof t.total.formatter||(i=t.total.formatter(r));var l=e===t.total.label;e=this.donutDataLabels.total.label?t.name.formatter(e,l,r):"",null!==n&&(n.textContent=e),null!==o&&(o.textContent=i),null!==n&&(n.style.fill=s)}},{key:"printDataLabelsInner",value:function(t,e){var i=this.w,a=t.getAttribute("data:value"),s=i.globals.seriesNames[parseInt(t.parentNode.getAttribute("rel"),10)-1];i.globals.series.length>1&&this.printInnerLabels(e,s,a,t);var r=i.globals.dom.baseEl.querySelector(".apexcharts-datalabels-group");null!==r&&(r.style.opacity=1)}},{key:"drawSpokes",value:function(t){var e=this,i=this.w,a=new Mi(this.ctx),s=i.config.plotOptions.polarArea.spokes;if(0!==s.strokeWidth){for(var r=[],n=360/i.globals.series.length,o=0;o0&&(f=e.getPreviousPath(n));for(var x=0;x=10?t.x>0?(i="start",a+=10):t.x<0&&(i="end",a-=10):i="middle",Math.abs(t.y)>=e-10&&(t.y<0?s-=10:t.y>0&&(s+=10)),{textAnchor:i,newX:a,newY:s}}},{key:"getPreviousPath",value:function(t){for(var e=this.w,i=null,a=0;a0&&parseInt(s.realIndex,10)===parseInt(t,10)&&void 0!==e.globals.previousPaths[a].paths[0]&&(i=e.globals.previousPaths[a].paths[0].d)}return i}},{key:"getDataPointsPos",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dataPointsLen;t=t||[],e=e||[];for(var a=[],s=0;s=360&&(u=360-Math.abs(this.startAngle)-.1);var g=i.drawPath({d:"",stroke:c,strokeWidth:n*parseInt(h.strokeWidth,10)/100,fill:"none",strokeOpacity:h.opacity,classes:"apexcharts-radialbar-area"});if(h.dropShadow.enabled){var p=h.dropShadow;s.dropShadow(g,p)}l.add(g),g.attr("id","apexcharts-radialbarTrack-"+o),this.animatePaths(g,{centerX:t.centerX,centerY:t.centerY,endAngle:u,startAngle:d,size:t.size,i:o,totalItems:2,animBeginArr:0,dur:0,isTrack:!0})}return a}},{key:"drawArcs",value:function(t){var e=this.w,i=new Mi(this.ctx),a=new ji(this.ctx),s=new Li(this.ctx),r=i.group(),n=this.getStrokeWidth(t);t.size=t.size-n/2;var o=e.config.plotOptions.radialBar.hollow.background,l=t.size-n*t.series.length-this.margin*t.series.length-n*parseInt(e.config.plotOptions.radialBar.track.strokeWidth,10)/100/2,h=l-e.config.plotOptions.radialBar.hollow.margin;void 0!==e.config.plotOptions.radialBar.hollow.image&&(o=this.drawHollowImage(t,r,l,o));var c=this.drawHollow({size:h,centerX:t.centerX,centerY:t.centerY,fill:o||"transparent"});if(e.config.plotOptions.radialBar.hollow.dropShadow.enabled){var d=e.config.plotOptions.radialBar.hollow.dropShadow;s.dropShadow(c,d)}var u=1;!this.radialDataLabels.total.show&&e.globals.series.length>1&&(u=0);var g=null;if(this.radialDataLabels.show){var p=e.globals.dom.Paper.findOne(".apexcharts-datalabels-group");g=this.renderInnerDataLabels(p,this.radialDataLabels,{hollowSize:l,centerX:t.centerX,centerY:t.centerY,opacity:u})}"back"===e.config.plotOptions.radialBar.hollow.position&&(r.add(c),g&&r.add(g));var f=!1;e.config.plotOptions.radialBar.inverseOrder&&(f=!0);for(var x=f?t.series.length-1:0;f?x>=0:x100?100:t.series[x])/100,A=Math.round(this.totalAngle*k)+this.startAngle,C=void 0;e.globals.dataChanged&&(w=this.startAngle,C=Math.round(this.totalAngle*v.negToZero(e.globals.previousPaths[x])/100)+w),Math.abs(A)+Math.abs(y)>360&&(A-=.01),Math.abs(C)+Math.abs(w)>360&&(C-=.01);var S=A-y,L=Array.isArray(e.config.stroke.dashArray)?e.config.stroke.dashArray[x]:e.config.stroke.dashArray,M=i.drawPath({d:"",stroke:m,strokeWidth:n,fill:"none",fillOpacity:e.config.fill.opacity,classes:"apexcharts-radialbar-area apexcharts-radialbar-slice-"+x,strokeDashArray:L});if(Mi.setAttrs(M.node,{"data:angle":S,"data:value":t.series[x]}),e.config.chart.dropShadow.enabled){var P=e.config.chart.dropShadow;s.dropShadow(M,P,x)}if(s.setSelectionFilter(M,0,x),this.addListeners(M,this.radialDataLabels),b.add(M),M.attr({index:0,j:x}),this.barLabels.enabled){var I=v.polarToCartesian(t.centerX,t.centerY,t.size,y),T=this.barLabels.formatter(e.globals.seriesNames[x],{seriesIndex:x,w:e}),z=["apexcharts-radialbar-label"];this.barLabels.onClick||z.push("apexcharts-no-click");var X=this.barLabels.useSeriesColors?e.globals.colors[x]:e.config.chart.foreColor;X||(X=e.config.chart.foreColor);var R=I.x+this.barLabels.offsetX,E=I.y+this.barLabels.offsetY,Y=i.drawText({x:R,y:E,text:T,textAnchor:"end",dominantBaseline:"middle",fontFamily:this.barLabels.fontFamily,fontWeight:this.barLabels.fontWeight,fontSize:this.barLabels.fontSize,foreColor:X,cssClass:z.join(" ")});Y.on("click",this.onBarLabelClick),Y.attr({rel:x+1}),0!==y&&Y.attr({"transform-origin":"".concat(R," ").concat(E),transform:"rotate(".concat(y," 0 0)")}),b.add(Y)}var H=0;!this.initialAnim||e.globals.resized||e.globals.dataChanged||(H=e.config.chart.animations.speed),e.globals.dataChanged&&(H=e.config.chart.animations.dynamicAnimation.speed),this.animDur=H/(1.2*t.series.length)+this.animDur,this.animBeginArr.push(this.animDur),this.animatePaths(M,{centerX:t.centerX,centerY:t.centerY,endAngle:A,startAngle:y,prevEndAngle:C,prevStartAngle:w,size:t.size,i:x,totalItems:2,animBeginArr:this.animBeginArr,dur:H,shouldSetPrevPaths:!0})}return{g:r,elHollow:c,dataLabels:g}}},{key:"drawHollow",value:function(t){var e=new Mi(this.ctx).drawCircle(2*t.size);return e.attr({class:"apexcharts-radialbar-hollow",cx:t.centerX,cy:t.centerY,r:t.size,fill:t.fill}),e}},{key:"drawHollowImage",value:function(t,e,i,a){var s=this.w,r=new ji(this.ctx),n=v.randomId(),o=s.config.plotOptions.radialBar.hollow.image;if(s.config.plotOptions.radialBar.hollow.imageClipped)r.clippedImgArea({width:i,height:i,image:o,patternID:"pattern".concat(s.globals.cuid).concat(n)}),a="url(#pattern".concat(s.globals.cuid).concat(n,")");else{var l=s.config.plotOptions.radialBar.hollow.imageWidth,h=s.config.plotOptions.radialBar.hollow.imageHeight;if(void 0===l&&void 0===h){var c=s.globals.dom.Paper.image(o,(function(e){this.move(t.centerX-e.width/2+s.config.plotOptions.radialBar.hollow.imageOffsetX,t.centerY-e.height/2+s.config.plotOptions.radialBar.hollow.imageOffsetY)}));e.add(c)}else{var d=s.globals.dom.Paper.image(o,(function(e){this.move(t.centerX-l/2+s.config.plotOptions.radialBar.hollow.imageOffsetX,t.centerY-h/2+s.config.plotOptions.radialBar.hollow.imageOffsetY),this.size(l,h)}));e.add(d)}}return a}},{key:"getStrokeWidth",value:function(t){var e=this.w;return t.size*(100-parseInt(e.config.plotOptions.radialBar.hollow.size,10))/100/(t.series.length+1)-this.margin}},{key:"onBarLabelClick",value:function(t){var e=parseInt(t.target.getAttribute("rel"),10)-1,i=this.barLabels.onClick,a=this.w;i&&i(a.globals.seriesNames[e],{w:a,seriesIndex:e})}}]),r}(),Oa=function(t){h(a,Pa);var e=n(a);function a(){return i(this,a),e.apply(this,arguments)}return s(a,[{key:"draw",value:function(t,e){var i=this.w,a=new Mi(this.ctx);this.rangeBarOptions=this.w.config.plotOptions.rangeBar,this.series=t,this.seriesRangeStart=i.globals.seriesRangeStart,this.seriesRangeEnd=i.globals.seriesRangeEnd,this.barHelpers.initVariables(t);for(var s=a.group({class:"apexcharts-rangebar-series apexcharts-plot-series"}),r=0;r0&&(this.visibleI=this.visibleI+1);var x=0,b=0,m=0;this.yRatio.length>1&&(this.yaxisIndex=i.globals.seriesYAxisReverseMap[g][0],m=g);var y=this.barHelpers.initialPositions(g);d=y.y,h=y.zeroW,c=y.x,b=y.barWidth,x=y.barHeight,n=y.xDivision,o=y.yDivision,l=y.zeroH;for(var w=a.group({class:"apexcharts-datalabels","data:realIndex":g}),k=a.group({class:"apexcharts-rangebar-goals-markers"}),A=0;A0}));return this.isHorizontal?(a=u.config.plotOptions.bar.rangeBarGroupRows?r+h*b:r+o*this.visibleI+h*b,m>-1&&!u.config.plotOptions.bar.rangeBarOverlap&&(g=u.globals.seriesRange[e][m].overlaps).indexOf(p)>-1&&(a=(o=d.barHeight/g.length)*this.visibleI+h*(100-parseInt(this.barOptions.barHeight,10))/100/2+o*(this.visibleI+g.indexOf(p))+h*b)):(b>-1&&!u.globals.timescaleLabels.length&&(s=u.config.plotOptions.bar.rangeBarGroupRows?n+c*b:n+l*this.visibleI+c*b),m>-1&&!u.config.plotOptions.bar.rangeBarOverlap&&(g=u.globals.seriesRange[e][m].overlaps).indexOf(p)>-1&&(s=(l=d.barWidth/g.length)*this.visibleI+c*(100-parseInt(this.barOptions.barWidth,10))/100/2+l*(this.visibleI+g.indexOf(p))+c*b)),{barYPosition:a,barXPosition:s,barHeight:o,barWidth:l}}},{key:"drawRangeColumnPaths",value:function(t){var e=t.indexes,i=t.x,a=t.xDivision,s=t.barWidth,r=t.barXPosition,n=t.zeroH,o=this.w,l=e.i,h=e.j,c=e.realIndex,d=e.translationsIndex,u=this.yRatio[d],g=this.getRangeValue(c,h),p=Math.min(g.start,g.end),f=Math.max(g.start,g.end);void 0===this.series[l][h]||null===this.series[l][h]?p=n:(p=n-p/u,f=n-f/u);var x=Math.abs(f-p),b=this.barHelpers.getColumnPaths({barXPosition:r,barWidth:s,y1:p,y2:f,strokeWidth:this.strokeWidth,series:this.seriesRangeEnd,realIndex:c,i:c,j:h,w:o});if(o.globals.isXNumeric){var m=this.getBarXForNumericXAxis({x:i,j:h,realIndex:c,barWidth:s});i=m.x,r=m.barXPosition}else i+=a;return{pathTo:b.pathTo,pathFrom:b.pathFrom,barHeight:x,x:i,y:g.start<0&&g.end<0?p:f,goalY:this.barHelpers.getGoalValues("y",null,n,l,h,d),barXPosition:r}}},{key:"preventBarOverflow",value:function(t){var e=this.w;return t<0&&(t=0),t>e.globals.gridWidth&&(t=e.globals.gridWidth),t}},{key:"drawRangeBarPaths",value:function(t){var e=t.indexes,i=t.y,a=t.y1,s=t.y2,r=t.yDivision,n=t.barHeight,o=t.barYPosition,l=t.zeroW,h=this.w,c=e.realIndex,d=e.j,u=this.preventBarOverflow(l+a/this.invertedYRatio),g=this.preventBarOverflow(l+s/this.invertedYRatio),p=this.getRangeValue(c,d),f=Math.abs(g-u),x=this.barHelpers.getBarpaths({barYPosition:o,barHeight:n,x1:u,x2:g,strokeWidth:this.strokeWidth,series:this.seriesRangeEnd,i:c,realIndex:c,j:d,w:h});return h.globals.isXNumeric||(i+=r),{pathTo:x.pathTo,pathFrom:x.pathFrom,barWidth:f,x:p.start<0&&p.end<0?u:g,goalX:this.barHelpers.getGoalValues("x",l,null,c,d),y:i}}},{key:"getRangeValue",value:function(t,e){var i=this.w;return{start:i.globals.seriesRangeStart[t][e],end:i.globals.seriesRangeEnd[t][e]}}}]),a}(),Fa=function(){function t(e){i(this,t),this.w=e.w,this.lineCtx=e}return s(t,[{key:"sameValueSeriesFix",value:function(t,e){var i=this.w;if(("gradient"===i.config.fill.type||"gradient"===i.config.fill.type[t])&&new Pi(this.lineCtx.ctx,i).seriesHaveSameValues(t)){var a=e[t].slice();a[a.length-1]=a[a.length-1]+1e-6,e[t]=a}return e}},{key:"calculatePoints",value:function(t){var e=t.series,i=t.realIndex,a=t.x,s=t.y,r=t.i,n=t.j,o=t.prevY,l=this.w,h=[],c=[],d=this.lineCtx.categoryAxisCorrection+l.config.markers.offsetX;return l.globals.isXNumeric&&(d=(l.globals.seriesX[i][0]-l.globals.minX)/this.lineCtx.xRatio+l.config.markers.offsetX),0===n&&(h.push(d),c.push(v.isNumber(e[r][0])?o+l.config.markers.offsetY:null)),h.push(a+l.config.markers.offsetX),c.push(v.isNumber(e[r][n+1])?s+l.config.markers.offsetY:null),{x:h,y:c}}},{key:"checkPreviousPaths",value:function(t){for(var e=t.pathFromLine,i=t.pathFromArea,a=t.realIndex,s=this.w,r=0;r0&&parseInt(n.realIndex,10)===parseInt(a,10)&&("line"===n.type?(this.lineCtx.appendPathFrom=!1,e=s.globals.previousPaths[r].paths[0].d):"area"===n.type&&(this.lineCtx.appendPathFrom=!1,i=s.globals.previousPaths[r].paths[0].d,s.config.stroke.show&&s.globals.previousPaths[r].paths[1]&&(e=s.globals.previousPaths[r].paths[1].d)))}return{pathFromLine:e,pathFromArea:i}}},{key:"determineFirstPrevY",value:function(t){var e,i,a,s=t.i,r=t.realIndex,n=t.series,o=t.prevY,l=t.lineYPosition,h=t.translationsIndex,c=this.w,d=c.config.chart.stacked&&!c.globals.comboCharts||c.config.chart.stacked&&c.globals.comboCharts&&(!this.w.config.chart.stackOnlyBar||"bar"===(null===(e=this.w.config.series[r])||void 0===e?void 0:e.type)||"column"===(null===(i=this.w.config.series[r])||void 0===i?void 0:i.type));if(void 0!==(null===(a=n[s])||void 0===a?void 0:a[0]))o=(l=d&&s>0?this.lineCtx.prevSeriesY[s-1][0]:this.lineCtx.zeroY)-n[s][0]/this.lineCtx.yRatio[h]+2*(this.lineCtx.isReversed?n[s][0]/this.lineCtx.yRatio[h]:0);else if(d&&s>0&&void 0===n[s][0])for(var u=s-1;u>=0;u--)if(null!==n[u][0]&&void 0!==n[u][0]){o=l=this.lineCtx.prevSeriesY[u][0];break}return{prevY:o,lineYPosition:l}}}]),t}(),Da=function(t){for(var e,i,a,s,r=function(t){for(var e=[],i=t[0],a=t[1],s=e[0]=Wa(i,a),r=1,n=t.length-1;r9&&(s=3*a/Math.sqrt(s),r[l]=s*e,r[l+1]=s*i);for(var h=0;h<=n;h++)s=(t[Math.min(n,h+1)][0]-t[Math.max(0,h-1)][0])/(6*(1+r[h]*r[h])),o.push([s||0,r[h]*s||0]);return o},_a=function(t){var e=Da(t),i=t[1],a=t[0],s=[],r=e[1],n=e[0];s.push(a,[a[0]+n[0],a[1]+n[1],i[0]-r[0],i[1]-r[1],i[0],i[1]]);for(var o=2,l=e.length;o1&&a[1].length<6){var s=a[0].length;a[1]=[2*a[0][s-2]-a[0][s-4],2*a[0][s-1]-a[0][s-3]].concat(a[1])}a[0]=a[0].slice(-2)}return a};function Wa(t,e){return(e[1]-t[1])/(e[0]-t[0])}var Ba=function(){function t(e,a,s){i(this,t),this.ctx=e,this.w=e.w,this.xyRatios=a,this.pointsChart=!("bubble"!==this.w.config.chart.type&&"scatter"!==this.w.config.chart.type)||s,this.scatter=new Ui(this.ctx),this.noNegatives=this.w.globals.minX===Number.MAX_VALUE,this.lineHelpers=new Fa(this),this.markers=new Vi(this.ctx),this.prevSeriesY=[],this.categoryAxisCorrection=0,this.yaxisIndex=0}return s(t,[{key:"draw",value:function(t,e,i,a){var s,r=this.w,n=new Mi(this.ctx),o=r.globals.comboCharts?e:r.config.chart.type,l=n.group({class:"apexcharts-".concat(o,"-series apexcharts-plot-series")}),h=new Pi(this.ctx,r);this.yRatio=this.xyRatios.yRatio,this.zRatio=this.xyRatios.zRatio,this.xRatio=this.xyRatios.xRatio,this.baseLineY=this.xyRatios.baseLineY,t=h.getLogSeries(t),this.yRatio=h.getLogYRatios(this.yRatio),this.prevSeriesY=[];for(var c=[],d=0;d1?g:0;this._initSerieVariables(t,d,g);var f=[],x=[],b=[],m=r.globals.padHorizontal+this.categoryAxisCorrection;this.ctx.series.addCollapsedClassToSeries(this.elSeries,g),r.globals.isXNumeric&&r.globals.seriesX.length>0&&(m=(r.globals.seriesX[g][0]-r.globals.minX)/this.xRatio),b.push(m);var v,y=m,w=void 0,k=y,A=this.zeroY,C=this.zeroY;A=this.lineHelpers.determineFirstPrevY({i:d,realIndex:g,series:t,prevY:A,lineYPosition:0,translationsIndex:p}).prevY,"monotoneCubic"===r.config.stroke.curve&&null===t[d][0]?f.push(null):f.push(A),v=A;"rangeArea"===o&&(w=C=this.lineHelpers.determineFirstPrevY({i:d,realIndex:g,series:a,prevY:C,lineYPosition:0,translationsIndex:p}).prevY,x.push(null!==f[0]?C:null));var S=this._calculatePathsFrom({type:o,series:t,i:d,realIndex:g,translationsIndex:p,prevX:k,prevY:A,prevY2:C}),L=[f[0]],M=[x[0]],P={type:o,series:t,realIndex:g,translationsIndex:p,i:d,x:m,y:1,pX:y,pY:v,pathsFrom:S,linePaths:[],areaPaths:[],seriesIndex:i,lineYPosition:0,xArrj:b,yArrj:f,y2Arrj:x,seriesRangeEnd:a},I=this._iterateOverDataPoints(u(u({},P),{},{iterations:"rangeArea"===o?t[d].length-1:void 0,isRangeStart:!0}));if("rangeArea"===o){for(var T=this._calculatePathsFrom({series:a,i:d,realIndex:g,prevX:k,prevY:C}),z=this._iterateOverDataPoints(u(u({},P),{},{series:a,xArrj:[m],yArrj:L,y2Arrj:M,pY:w,areaPaths:I.areaPaths,pathsFrom:T,iterations:a[d].length-1,isRangeStart:!1})),X=I.linePaths.length/2,R=0;R=0;E--)l.add(c[E]);else for(var Y=0;Y1&&(this.yaxisIndex=a.globals.seriesYAxisReverseMap[i],r=i),this.isReversed=a.config.yaxis[this.yaxisIndex]&&a.config.yaxis[this.yaxisIndex].reversed,this.zeroY=a.globals.gridHeight-this.baseLineY[r]-(this.isReversed?a.globals.gridHeight:0)+(this.isReversed?2*this.baseLineY[r]:0),this.areaBottomY=this.zeroY,(this.zeroY>a.globals.gridHeight||"end"===a.config.plotOptions.area.fillTo)&&(this.areaBottomY=a.globals.gridHeight),this.categoryAxisCorrection=this.xDivision/2,this.elSeries=s.group({class:"apexcharts-series",zIndex:void 0!==a.config.series[i].zIndex?a.config.series[i].zIndex:i,seriesName:v.escapeString(a.globals.seriesNames[i])}),this.elPointsMain=s.group({class:"apexcharts-series-markers-wrap","data:realIndex":i}),a.globals.hasNullValues){var n=this.markers.plotChartMarkers({pointsPos:{x:[0],y:[a.globals.gridHeight+a.globals.markers.largestSize]},seriesIndex:e,j:0,pSize:.1,alwaysDrawMarker:!0,isVirtualPoint:!0});null!==n&&this.elPointsMain.add(n)}this.elDataLabelsWrap=s.group({class:"apexcharts-datalabels","data:realIndex":i});var o=t[e].length===a.globals.dataPoints;this.elSeries.attr({"data:longestSeries":o,rel:e+1,"data:realIndex":i}),this.appendPathFrom=!0}},{key:"_calculatePathsFrom",value:function(t){var e,i,a,s,r=t.type,n=t.series,o=t.i,l=t.realIndex,h=t.translationsIndex,c=t.prevX,d=t.prevY,u=t.prevY2,g=this.w,p=new Mi(this.ctx);if(null===n[o][0]){for(var f=0;f0){var x=this.lineHelpers.checkPreviousPaths({pathFromLine:a,pathFromArea:s,realIndex:l});a=x.pathFromLine,s=x.pathFromArea}return{prevX:c,prevY:d,linePath:e,areaPath:i,pathFromLine:a,pathFromArea:s}}},{key:"_handlePaths",value:function(t){var e=t.type,i=t.realIndex,a=t.i,s=t.paths,r=this.w,n=new Mi(this.ctx),o=new ji(this.ctx);this.prevSeriesY.push(s.yArrj),r.globals.seriesXvalues[i]=s.xArrj,r.globals.seriesYvalues[i]=s.yArrj;var l=r.config.forecastDataPoints;if(l.count>0&&"rangeArea"!==e){var h=r.globals.seriesXvalues[i][r.globals.seriesXvalues[i].length-l.count-1],c=n.drawRect(h,0,r.globals.gridWidth,r.globals.gridHeight,0);r.globals.dom.elForecastMask.appendChild(c.node);var d=n.drawRect(0,0,h,r.globals.gridHeight,0);r.globals.dom.elNonForecastMask.appendChild(d.node)}this.pointsChart||r.globals.delayedElements.push({el:this.elPointsMain.node,index:i});var g={i:a,realIndex:i,animationDelay:a,initialSpeed:r.config.chart.animations.speed,dataChangeSpeed:r.config.chart.animations.dynamicAnimation.speed,className:"apexcharts-".concat(e)};if("area"===e)for(var p=o.fillPath({seriesNumber:i}),f=0;f0&&"rangeArea"!==e){var A=n.renderPaths(w);A.node.setAttribute("stroke-dasharray",l.dashArray),l.strokeWidth&&A.node.setAttribute("stroke-width",l.strokeWidth),this.elSeries.add(A),A.attr("clip-path","url(#forecastMask".concat(r.globals.cuid,")")),k.attr("clip-path","url(#nonForecastMask".concat(r.globals.cuid,")"))}}}}},{key:"_iterateOverDataPoints",value:function(t){var e,i,a=this,s=t.type,r=t.series,n=t.iterations,o=t.realIndex,l=t.translationsIndex,h=t.i,c=t.x,d=t.y,u=t.pX,g=t.pY,p=t.pathsFrom,f=t.linePaths,x=t.areaPaths,b=t.seriesIndex,m=t.lineYPosition,y=t.xArrj,w=t.yArrj,k=t.y2Arrj,A=t.isRangeStart,C=t.seriesRangeEnd,S=this.w,L=new Mi(this.ctx),M=this.yRatio,P=p.prevY,I=p.linePath,T=p.areaPath,z=p.pathFromLine,X=p.pathFromArea,R=v.isNumber(S.globals.minYArr[o])?S.globals.minYArr[o]:S.globals.minY;n||(n=S.globals.dataPoints>1?S.globals.dataPoints-1:S.globals.dataPoints);var E=function(t,e){return e-t/M[l]+2*(a.isReversed?t/M[l]:0)},Y=d,H=S.config.chart.stacked&&!S.globals.comboCharts||S.config.chart.stacked&&S.globals.comboCharts&&(!this.w.config.chart.stackOnlyBar||"bar"===(null===(e=this.w.config.series[o])||void 0===e?void 0:e.type)||"column"===(null===(i=this.w.config.series[o])||void 0===i?void 0:i.type)),O=S.config.stroke.curve;Array.isArray(O)&&(O=Array.isArray(b)?O[b[h]]:O[h]);for(var F,D=0,_=0;_0&&S.globals.collapsedSeries.length0;e--){if(!(S.globals.collapsedSeriesIndices.indexOf((null==b?void 0:b[e])||e)>-1))return e;e--}return 0}(h-1)][_+1]}else m=this.zeroY;else m=this.zeroY;N?d=E(R,m):(d=E(r[h][_+1],m),"rangeArea"===s&&(Y=E(C[h][_+1],m))),y.push(null===r[h][_+1]?null:c),!N||"smooth"!==S.config.stroke.curve&&"monotoneCubic"!==S.config.stroke.curve?(w.push(d),k.push(Y)):(w.push(null),k.push(null));var B=this.lineHelpers.calculatePoints({series:r,x:c,y:d,realIndex:o,i:h,j:_,prevY:P}),G=this._createPaths({type:s,series:r,i:h,realIndex:o,j:_,x:c,y:d,y2:Y,xArrj:y,yArrj:w,y2Arrj:k,pX:u,pY:g,pathState:D,segmentStartX:F,linePath:I,areaPath:T,linePaths:f,areaPaths:x,curve:O,isRangeStart:A});x=G.areaPaths,f=G.linePaths,u=G.pX,g=G.pY,D=G.pathState,F=G.segmentStartX,T=G.areaPath,I=G.linePath,!this.appendPathFrom||S.globals.hasNullValues||"monotoneCubic"===O&&"rangeArea"===s||(z+=L.line(c,this.areaBottomY),X+=L.line(c,this.areaBottomY)),this.handleNullDataPoints(r,B,h,_,o),this._handleMarkersAndLabels({type:s,pointsPos:B,i:h,j:_,realIndex:o,isRangeStart:A})}return{yArrj:w,xArrj:y,pathFromArea:X,areaPaths:x,pathFromLine:z,linePaths:f,linePath:I,areaPath:T}}},{key:"_handleMarkersAndLabels",value:function(t){var e=t.type,i=t.pointsPos,a=t.isRangeStart,s=t.i,r=t.j,n=t.realIndex,o=this.w,l=new qi(this.ctx);if(this.pointsChart)this.scatter.draw(this.elSeries,r,{realIndex:n,pointsPos:i,zRatio:this.zRatio,elParent:this.elPointsMain});else{o.globals.series[s].length>1&&this.elPointsMain.node.classList.add("apexcharts-element-hidden");var h=this.markers.plotChartMarkers({pointsPos:i,seriesIndex:n,j:r+1});null!==h&&this.elPointsMain.add(h)}var c=l.drawDataLabel({type:e,isRangeStart:a,pos:i,i:n,j:r+1});null!==c&&this.elDataLabelsWrap.add(c)}},{key:"_createPaths",value:function(t){var e=t.type,i=t.series,a=t.i;t.realIndex;var s,r=t.j,n=t.x,o=t.y,l=t.xArrj,h=t.yArrj,c=t.y2,d=t.y2Arrj,u=t.pX,g=t.pY,p=t.pathState,f=t.segmentStartX,x=t.linePath,b=t.areaPath,m=t.linePaths,v=t.areaPaths,y=t.curve,w=t.isRangeStart,k=new Mi(this.ctx),A=this.areaBottomY,C="rangeArea"===e,S="rangeArea"===e&&w;switch(y){case"monotoneCubic":var L=w?h:d;switch(p){case 0:if(null===L[r+1])break;p=1;case 1:if(!(C?l.length===i[a].length:r===i[a].length-2))break;case 2:var M=w?l:l.slice().reverse(),P=w?L:L.slice().reverse(),I=(s=P,M.map((function(t,e){return[t,s[e]]})).filter((function(t){return null!==t[1]}))),T=I.length>1?_a(I):I,z=[];C&&(S?v=I:z=v.reverse());var X=0,R=0;if(function(t,e){for(var i=function(t){var e=[],i=0;return t.forEach((function(t){null!==t?i++:i>0&&(e.push(i),i=0)})),i>0&&e.push(i),e}(t),a=[],s=0,r=0;s4?(e+="C".concat(a[0],", ").concat(a[1]),e+=", ".concat(a[2],", ").concat(a[3]),e+=", ".concat(a[4],", ").concat(a[5])):s>2&&(e+="S".concat(a[0],", ").concat(a[1]),e+=", ".concat(a[2],", ").concat(a[3]))}return e}(t),i=R,a=(R+=t.length)-1;S?x=k.move(I[i][0],I[i][1])+e:C?x=k.move(z[i][0],z[i][1])+k.line(I[i][0],I[i][1])+e+k.line(z[a][0],z[a][1]):(x=k.move(I[i][0],I[i][1])+e,b=x+k.line(I[a][0],A)+k.line(I[i][0],A)+"z",v.push(b)),m.push(x)})),C&&X>1&&!S){var E=m.slice(X).reverse();m.splice(X),E.forEach((function(t){return m.push(t)}))}p=0}break;case"smooth":var Y=.35*(n-u);if(null===i[a][r])p=0;else switch(p){case 0:if(f=u,x=S?k.move(u,d[r])+k.line(u,g):k.move(u,g),b=k.move(u,g),null===i[a][r+1]||void 0===i[a][r+1]){m.push(x),v.push(b);break}if(p=1,r=i[a].length-2&&(S&&(x+=k.curve(n,o,n,o,n,c)+k.move(n,c)),b+=k.curve(n,o,n,o,n,A)+k.line(f,A)+"z",m.push(x),v.push(b),p=-1)}}u=n,g=o;break;default:var F=function(t,e,i){var a=[];switch(t){case"stepline":a=k.line(e,null,"H")+k.line(null,i,"V");break;case"linestep":a=k.line(null,i,"V")+k.line(e,null,"H");break;case"straight":a=k.line(e,i)}return a};if(null===i[a][r])p=0;else switch(p){case 0:if(f=u,x=S?k.move(u,d[r])+k.line(u,g):k.move(u,g),b=k.move(u,g),null===i[a][r+1]||void 0===i[a][r+1]){m.push(x),v.push(b);break}if(p=1,r=i[a].length-2&&(S&&(x+=k.line(n,c)),b+=k.line(n,A)+k.line(f,A)+"z",m.push(x),v.push(b),p=-1)}}u=n,g=o}return{linePaths:m,areaPaths:v,pX:u,pY:g,pathState:p,segmentStartX:f,linePath:x,areaPath:b}}},{key:"handleNullDataPoints",value:function(t,e,i,a,s){var r=this.w;if(null===t[i][a]&&r.config.markers.showNullDataPoints||1===t[i].length){var n=this.strokeWidth-r.config.markers.strokeWidth/2;n>0||(n=0);var o=this.markers.plotChartMarkers({pointsPos:e,seriesIndex:s,j:a+1,pSize:n,alwaysDrawMarker:!0});null!==o&&this.elPointsMain.add(o)}}}]),t}();window.TreemapSquared={},window.TreemapSquared.generate=function(){function t(e,i,a,s){this.xoffset=e,this.yoffset=i,this.height=s,this.width=a,this.shortestEdge=function(){return Math.min(this.height,this.width)},this.getCoordinates=function(t){var e,i=[],a=this.xoffset,s=this.yoffset,n=r(t)/this.height,o=r(t)/this.width;if(this.width>=this.height)for(e=0;e=this.height){var a=e/this.height,s=this.width-a;i=new t(this.xoffset+a,this.yoffset,s,this.height)}else{var r=e/this.width,n=this.height-r;i=new t(this.xoffset,this.yoffset+r,this.width,n)}return i}}function e(e,a,s,n,o){n=void 0===n?0:n,o=void 0===o?0:o;var l=i(function(t,e){var i,a=[],s=e/r(t);for(i=0;i=n}(e,l=t[0],o)?(e.push(l),i(t.slice(1),e,s,n)):(h=s.cutArea(r(e),n),n.push(s.getCoordinates(e)),i(t,[],h,n)),n;n.push(s.getCoordinates(e))}function a(t,e){var i=Math.min.apply(Math,t),a=Math.max.apply(Math,t),s=r(t);return Math.max(Math.pow(e,2)*a/Math.pow(s,2),Math.pow(s,2)/(Math.pow(e,2)*i))}function s(t){return t&&t.constructor===Array}function r(t){var e,i=0;for(e=0;e1&&u&&u.show){var g=i.config.series[o].name||"";if(g&&d.xMin<1/0&&d.yMin<1/0){var p=u.offsetX,f=u.offsetY,x=u.borderColor,b=u.borderWidth,m=u.borderRadius,y=u.style,w=y.color||i.config.chart.foreColor,k={left:y.padding.left,right:y.padding.right,top:y.padding.top,bottom:y.padding.bottom},A=a.getTextRects(g,y.fontSize,y.fontFamily),C=A.width+k.left+k.right,S=A.height+k.top+k.bottom,L=d.xMin+(p||0),M=d.yMin+(f||0),P=a.drawRect(L,M,C,S,m,y.background,1,b,x),I=a.drawText({x:L+k.left,y:M+k.top+.75*A.height,text:g,fontSize:y.fontSize,fontFamily:y.fontFamily,fontWeight:y.fontWeight,foreColor:w,cssClass:y.cssClass||""});l.add(P),l.add(I)}}l.add(c),r.add(l)})),r}},{key:"getFontSize",value:function(t){var e=this.w;var i=function t(e){var i,a=0;if(Array.isArray(e[0]))for(i=0;ir-a&&l.width<=n-s){var h=o.rotateAroundCenter(t.node);t.node.setAttribute("transform","rotate(-90 ".concat(h.x," ").concat(h.y,") translate(").concat(l.height/3,")"))}}},{key:"truncateLabels",value:function(t,e,i,a,s,r){var n=new Mi(this.ctx),o=n.getTextRects(t,e).width+this.w.config.stroke.width+5>s-i&&r-a>s-i?r-a:s-i,l=n.getTextBasedOnMaxWidth({text:t,maxWidth:o,fontSize:e});return t.length!==l.length&&o/e<5?"":l}},{key:"animateTreemap",value:function(t,e,i,a){var s=new y(this.ctx);s.animateRect(t,e,i,a,(function(){s.animationCompleted(t)}))}}]),t}(),ja=86400,Va=10/ja,Ua=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.timeScaleArray=[],this.utc=this.w.config.xaxis.labels.datetimeUTC}return s(t,[{key:"calculateTimeScaleTicks",value:function(t,e){var i=this,a=this.w;if(a.globals.allSeriesCollapsed)return a.globals.labels=[],a.globals.timescaleLabels=[],[];var s=new zi(this.ctx),r=(e-t)/864e5;this.determineInterval(r),a.globals.disableZoomIn=!1,a.globals.disableZoomOut=!1,r5e4&&(a.globals.disableZoomOut=!0);var n=s.getTimeUnitsfromTimestamp(t,e,this.utc),o=a.globals.gridWidth/r,l=o/24,h=l/60,c=h/60,d=Math.floor(24*r),g=Math.floor(1440*r),p=Math.floor(r*ja),f=Math.floor(r),x=Math.floor(r/30),b=Math.floor(r/365),m={minMillisecond:n.minMillisecond,minSecond:n.minSecond,minMinute:n.minMinute,minHour:n.minHour,minDate:n.minDate,minMonth:n.minMonth,minYear:n.minYear},v={firstVal:m,currentMillisecond:m.minMillisecond,currentSecond:m.minSecond,currentMinute:m.minMinute,currentHour:m.minHour,currentMonthDate:m.minDate,currentDate:m.minDate,currentMonth:m.minMonth,currentYear:m.minYear,daysWidthOnXAxis:o,hoursWidthOnXAxis:l,minutesWidthOnXAxis:h,secondsWidthOnXAxis:c,numberOfSeconds:p,numberOfMinutes:g,numberOfHours:d,numberOfDays:f,numberOfMonths:x,numberOfYears:b};switch(this.tickInterval){case"years":this.generateYearScale(v);break;case"months":case"half_year":this.generateMonthScale(v);break;case"months_days":case"months_fortnight":case"days":case"week_days":this.generateDayScale(v);break;case"hours":this.generateHourScale(v);break;case"minutes_fives":case"minutes":this.generateMinuteScale(v);break;case"seconds_tens":case"seconds_fives":case"seconds":this.generateSecondScale(v)}var y=this.timeScaleArray.map((function(t){var e={position:t.position,unit:t.unit,year:t.year,day:t.day?t.day:1,hour:t.hour?t.hour:0,month:t.month+1};return"month"===t.unit?u(u({},e),{},{day:1,value:t.value+1}):"day"===t.unit||"hour"===t.unit?u(u({},e),{},{value:t.value}):"minute"===t.unit?u(u({},e),{},{value:t.value,minute:t.value}):"second"===t.unit?u(u({},e),{},{value:t.value,minute:t.minute,second:t.second}):t}));return y.filter((function(t){var e=1,s=Math.ceil(a.globals.gridWidth/120),r=t.value;void 0!==a.config.xaxis.tickAmount&&(s=a.config.xaxis.tickAmount),y.length>s&&(e=Math.floor(y.length/s));var n=!1,o=!1;switch(i.tickInterval){case"years":"year"===t.unit&&(n=!0);break;case"half_year":e=7,"year"===t.unit&&(n=!0);break;case"months":e=1,"year"===t.unit&&(n=!0);break;case"months_fortnight":e=15,"year"!==t.unit&&"month"!==t.unit||(n=!0),30===r&&(o=!0);break;case"months_days":e=10,"month"===t.unit&&(n=!0),30===r&&(o=!0);break;case"week_days":e=8,"month"===t.unit&&(n=!0);break;case"days":e=1,"month"===t.unit&&(n=!0);break;case"hours":"day"===t.unit&&(n=!0);break;case"minutes_fives":case"seconds_fives":r%5!=0&&(o=!0);break;case"seconds_tens":r%10!=0&&(o=!0)}if("hours"===i.tickInterval||"minutes_fives"===i.tickInterval||"seconds_tens"===i.tickInterval||"seconds_fives"===i.tickInterval){if(!o)return!0}else if((r%e==0||n)&&!o)return!0}))}},{key:"recalcDimensionsBasedOnFormat",value:function(t,e){var i=this.w,a=this.formatDates(t),s=this.removeOverlappingTS(a);i.globals.timescaleLabels=s.slice(),new pa(this.ctx).plotCoords()}},{key:"determineInterval",value:function(t){var e=24*t,i=60*e;switch(!0){case t/365>5:this.tickInterval="years";break;case t>800:this.tickInterval="half_year";break;case t>180:this.tickInterval="months";break;case t>90:this.tickInterval="months_fortnight";break;case t>60:this.tickInterval="months_days";break;case t>30:this.tickInterval="week_days";break;case t>2:this.tickInterval="days";break;case e>2.4:this.tickInterval="hours";break;case i>15:this.tickInterval="minutes_fives";break;case i>5:this.tickInterval="minutes";break;case i>1:this.tickInterval="seconds_tens";break;case 60*i>20:this.tickInterval="seconds_fives";break;default:this.tickInterval="seconds"}}},{key:"generateYearScale",value:function(t){var e=t.firstVal,i=t.currentMonth,a=t.currentYear,s=t.daysWidthOnXAxis,r=t.numberOfYears,n=e.minYear,o=0,l=new zi(this.ctx),h="year";if(e.minDate>1||e.minMonth>0){var c=l.determineRemainingDaysOfYear(e.minYear,e.minMonth,e.minDate);o=(l.determineDaysOfYear(e.minYear)-c+1)*s,n=e.minYear+1,this.timeScaleArray.push({position:o,value:n,unit:h,year:n,month:v.monthMod(i+1)})}else 1===e.minDate&&0===e.minMonth&&this.timeScaleArray.push({position:o,value:n,unit:h,year:a,month:v.monthMod(i+1)});for(var d=n,u=o,g=0;g1){l=(h.determineDaysOfMonths(a+1,e.minYear)-i+1)*r,o=v.monthMod(a+1);var u=s+d,g=v.monthMod(o),p=o;0===o&&(c="year",p=u,g=1,u+=d+=1),this.timeScaleArray.push({position:l,value:p,unit:c,year:u,month:g})}else this.timeScaleArray.push({position:l,value:o,unit:c,year:s,month:v.monthMod(a)});for(var f=o+1,x=l,b=0,m=1;bn.determineDaysOfMonths(e+1,i)?(h=1,o="month",u=e+=1,e):e},d=(24-e.minHour)*s,u=l,g=c(h,i,a);0===e.minHour&&1===e.minDate?(d=0,u=v.monthMod(e.minMonth),o="month",h=e.minDate):1!==e.minDate&&0===e.minHour&&0===e.minMinute&&(d=0,l=e.minDate,u=l,g=c(h=l,i,a),1!==u&&(o="day")),this.timeScaleArray.push({position:d,value:u,unit:o,year:this._getYear(a,g,0),month:v.monthMod(g),day:h});for(var p=d,f=0;fo.determineDaysOfMonths(e+1,s)&&(f=1,e+=1),{month:e,date:f}},c=function(t,e){return t>o.determineDaysOfMonths(e+1,s)?e+=1:e},d=60-(e.minMinute+e.minSecond/60),u=d*r,g=e.minHour+1,p=g;60===d&&(u=0,p=g=e.minHour);var f=i;p>=24&&(p=0,l="day",g=f+=1);var x=h(f,a).month;x=c(f,x),g>31&&(g=f=1),this.timeScaleArray.push({position:u,value:g,unit:l,day:f,hour:p,year:s,month:v.monthMod(x)}),p++;for(var b=u,m=0;m=24)p=0,l="day",x=h(f+=1,x).month,x=c(f,x);var y=this._getYear(s,x,0);b=60*r+b;var w=0===p?f:p;this.timeScaleArray.push({position:b,value:w,unit:l,hour:p,day:f,year:y,month:v.monthMod(x)}),p++}}},{key:"generateMinuteScale",value:function(t){for(var e=t.currentMillisecond,i=t.currentSecond,a=t.currentMinute,s=t.currentHour,r=t.currentDate,n=t.currentMonth,o=t.currentYear,l=t.minutesWidthOnXAxis,h=t.secondsWidthOnXAxis,c=t.numberOfMinutes,d=a+1,u=r,g=n,p=o,f=s,x=(60-i-e/1e3)*h,b=0;b=60&&(d=0,24===(f+=1)&&(f=0)),this.timeScaleArray.push({position:x,value:d,unit:"minute",hour:f,minute:d,day:u,year:this._getYear(p,g,0),month:v.monthMod(g)}),x+=l,d++}},{key:"generateSecondScale",value:function(t){for(var e=t.currentMillisecond,i=t.currentSecond,a=t.currentMinute,s=t.currentHour,r=t.currentDate,n=t.currentMonth,o=t.currentYear,l=t.secondsWidthOnXAxis,h=t.numberOfSeconds,c=i+1,d=a,u=r,g=n,p=o,f=s,x=(1e3-e)/1e3*l,b=0;b=60&&(c=0,++d>=60&&(d=0,24===++f&&(f=0))),this.timeScaleArray.push({position:x,value:c,unit:"second",hour:f,minute:d,second:c,day:u,year:this._getYear(p,g,0),month:v.monthMod(g)}),x+=l,c++}},{key:"createRawDateString",value:function(t,e){var i=t.year;return 0===t.month&&(t.month=1),i+="-"+("0"+t.month.toString()).slice(-2),"day"===t.unit?i+="day"===t.unit?"-"+("0"+e).slice(-2):"-01":i+="-"+("0"+(t.day?t.day:"1")).slice(-2),"hour"===t.unit?i+="hour"===t.unit?"T"+("0"+e).slice(-2):"T00":i+="T"+("0"+(t.hour?t.hour:"0")).slice(-2),"minute"===t.unit?i+=":"+("0"+e).slice(-2):i+=":"+(t.minute?("0"+t.minute).slice(-2):"00"),"second"===t.unit?i+=":"+("0"+e).slice(-2):i+=":00",this.utc&&(i+=".000Z"),i}},{key:"formatDates",value:function(t){var e=this,i=this.w;return t.map((function(t){var a=t.value.toString(),s=new zi(e.ctx),r=e.createRawDateString(t,a),n=s.getDate(s.parseDate(r));if(e.utc||(n=s.getDate(s.parseDateWithTimezone(r))),void 0===i.config.xaxis.labels.format){var o="dd MMM",l=i.config.xaxis.labels.datetimeFormatter;"year"===t.unit&&(o=l.year),"month"===t.unit&&(o=l.month),"day"===t.unit&&(o=l.day),"hour"===t.unit&&(o=l.hour),"minute"===t.unit&&(o=l.minute),"second"===t.unit&&(o=l.second),a=s.formatDate(n,o)}else a=s.formatDate(n,i.config.xaxis.labels.format);return{dateString:r,position:t.position,value:a,unit:t.unit,year:t.year,month:t.month}}))}},{key:"removeOverlappingTS",value:function(t){var e,i=this,a=new Mi(this.ctx),s=!1;t.length>0&&t[0].value&&t.every((function(e){return e.value.length===t[0].value.length}))&&(s=!0,e=a.getTextRects(t[0].value).width);var r=0,n=t.map((function(n,o){if(o>0&&i.w.config.xaxis.labels.hideOverlappingLabels){var l=s?e:a.getTextRects(t[r].value).width,h=t[r].position;return n.position>h+l+10?(r=o,n):null}return n}));return n=n.filter((function(t){return null!==t}))}},{key:"_getYear",value:function(t,e,i){return t+Math.floor(e/12)+i}}]),t}(),qa=function(){function t(e,a){i(this,t),this.ctx=a,this.w=a.w,this.el=e}return s(t,[{key:"setupElements",value:function(){var t=this.w,e=t.globals,i=t.config,a=i.chart.type;e.axisCharts=["line","area","bar","rangeBar","rangeArea","candlestick","boxPlot","scatter","bubble","radar","heatmap","treemap"].includes(a),e.xyCharts=["line","area","bar","rangeBar","rangeArea","candlestick","boxPlot","scatter","bubble"].includes(a),e.isBarHorizontal=["bar","rangeBar","boxPlot"].includes(a)&&i.plotOptions.bar.horizontal,e.chartClass=".apexcharts".concat(e.chartID),e.dom.baseEl=this.el,e.dom.elWrap=document.createElement("div"),Mi.setAttrs(e.dom.elWrap,{id:e.chartClass.substring(1),class:"apexcharts-canvas ".concat(e.chartClass.substring(1))}),this.el.appendChild(e.dom.elWrap),e.dom.Paper=window.SVG().addTo(e.dom.elWrap),e.dom.Paper.attr({class:"apexcharts-svg","xmlns:data":"ApexChartsNS",transform:"translate(".concat(i.chart.offsetX,", ").concat(i.chart.offsetY,")")}),e.dom.Paper.node.style.background="dark"!==i.theme.mode||i.chart.background?"light"!==i.theme.mode||i.chart.background?i.chart.background:"#fff":"#424242",this.setSVGDimensions(),e.dom.elLegendForeign=document.createElementNS(e.SVGNS,"foreignObject"),Mi.setAttrs(e.dom.elLegendForeign,{x:0,y:0,width:e.svgWidth,height:e.svgHeight}),e.dom.elLegendWrap=document.createElement("div"),e.dom.elLegendWrap.classList.add("apexcharts-legend"),e.dom.elWrap.appendChild(e.dom.elLegendWrap),e.dom.Paper.node.appendChild(e.dom.elLegendForeign),e.dom.elGraphical=e.dom.Paper.group().attr({class:"apexcharts-inner apexcharts-graphical"}),e.dom.elDefs=e.dom.Paper.defs(),e.dom.Paper.add(e.dom.elGraphical),e.dom.elGraphical.add(e.dom.elDefs)}},{key:"plotChartType",value:function(t,e){var i=this.w,a=this.ctx,s=i.config,r=i.globals,n={line:{series:[],i:[]},area:{series:[],i:[]},scatter:{series:[],i:[]},bubble:{series:[],i:[]},bar:{series:[],i:[]},candlestick:{series:[],i:[]},boxPlot:{series:[],i:[]},rangeBar:{series:[],i:[]},rangeArea:{series:[],seriesRangeEnd:[],i:[]}},o=s.chart.type||"line",l=null,h=0;r.series.forEach((function(e,a){var s="column"===t[a].type?"bar":t[a].type||("column"===o?"bar":o);n[s]?("rangeArea"===s?(n[s].series.push(r.seriesRangeStart[a]),n[s].seriesRangeEnd.push(r.seriesRangeEnd[a])):n[s].series.push(e),n[s].i.push(a),"bar"===s&&(i.globals.columnSeries=n.bar)):["heatmap","treemap","pie","donut","polarArea","radialBar","radar"].includes(s)?l=s:console.warn("You have specified an unrecognized series type (".concat(s,").")),o!==s&&"scatter"!==s&&h++})),h>0&&(l&&console.warn("Chart or series type ".concat(l," cannot appear with other chart or series types.")),n.bar.series.length>0&&s.plotOptions.bar.horizontal&&(h-=n.bar.series.length,n.bar={series:[],i:[]},i.globals.columnSeries={series:[],i:[]},console.warn("Horizontal bars are not supported in a mixed/combo chart. Please turn off `plotOptions.bar.horizontal`"))),r.comboCharts||(r.comboCharts=h>0);var c=new Ba(a,e),d=new Ta(a,e);a.pie=new Ea(a);var u=new Ha(a);a.rangeBar=new Oa(a,e);var g=new Ya(a),p=[];if(r.comboCharts){var x,b,m=new Pi(a);if(n.area.series.length>0)(x=p).push.apply(x,f(m.drawSeriesByGroup(n.area,r.areaGroups,"area",c)));if(n.bar.series.length>0)if(s.chart.stacked){var v=new Ia(a,e);p.push(v.draw(n.bar.series,n.bar.i))}else a.bar=new Pa(a,e),p.push(a.bar.draw(n.bar.series,n.bar.i));if(n.rangeArea.series.length>0&&p.push(c.draw(n.rangeArea.series,"rangeArea",n.rangeArea.i,n.rangeArea.seriesRangeEnd)),n.line.series.length>0)(b=p).push.apply(b,f(m.drawSeriesByGroup(n.line,r.lineGroups,"line",c)));if(n.candlestick.series.length>0&&p.push(d.draw(n.candlestick.series,"candlestick",n.candlestick.i)),n.boxPlot.series.length>0&&p.push(d.draw(n.boxPlot.series,"boxPlot",n.boxPlot.i)),n.rangeBar.series.length>0&&p.push(a.rangeBar.draw(n.rangeBar.series,n.rangeBar.i)),n.scatter.series.length>0){var y=new Ba(a,e,!0);p.push(y.draw(n.scatter.series,"scatter",n.scatter.i))}if(n.bubble.series.length>0){var w=new Ba(a,e,!0);p.push(w.draw(n.bubble.series,"bubble",n.bubble.i))}}else switch(s.chart.type){case"line":p=c.draw(r.series,"line");break;case"area":p=c.draw(r.series,"area");break;case"bar":if(s.chart.stacked)p=new Ia(a,e).draw(r.series);else a.bar=new Pa(a,e),p=a.bar.draw(r.series);break;case"candlestick":p=new Ta(a,e).draw(r.series,"candlestick");break;case"boxPlot":p=new Ta(a,e).draw(r.series,s.chart.type);break;case"rangeBar":p=a.rangeBar.draw(r.series);break;case"rangeArea":p=c.draw(r.seriesRangeStart,"rangeArea",void 0,r.seriesRangeEnd);break;case"heatmap":p=new Xa(a,e).draw(r.series);break;case"treemap":p=new Ga(a,e).draw(r.series);break;case"pie":case"donut":case"polarArea":p=a.pie.draw(r.series);break;case"radialBar":p=u.draw(r.series);break;case"radar":p=g.draw(r.series);break;default:p=c.draw(r.series)}return p}},{key:"setSVGDimensions",value:function(){var t=this.w,e=t.globals,i=t.config;i.chart.width=i.chart.width||"100%",i.chart.height=i.chart.height||"auto",e.svgWidth=i.chart.width,e.svgHeight=i.chart.height;var a=v.getDimensions(this.el),s=i.chart.width.toString().split(/[0-9]+/g).pop();"%"===s?v.isNumber(a[0])&&(0===a[0].width&&(a=v.getDimensions(this.el.parentNode)),e.svgWidth=a[0]*parseInt(i.chart.width,10)/100):"px"!==s&&""!==s||(e.svgWidth=parseInt(i.chart.width,10));var r=String(i.chart.height).toString().split(/[0-9]+/g).pop();if("auto"!==e.svgHeight&&""!==e.svgHeight)if("%"===r){var n=v.getDimensions(this.el.parentNode);e.svgHeight=n[1]*parseInt(i.chart.height,10)/100}else e.svgHeight=parseInt(i.chart.height,10);else e.svgHeight=e.axisCharts?e.svgWidth/1.61:e.svgWidth/1.2;if(e.svgWidth=Math.max(e.svgWidth,0),e.svgHeight=Math.max(e.svgHeight,0),Mi.setAttrs(e.dom.Paper.node,{width:e.svgWidth,height:e.svgHeight}),"%"!==r){var o=i.chart.sparkline.enabled?0:e.axisCharts?i.chart.parentHeightOffset:0;e.dom.Paper.node.parentNode.parentNode.style.minHeight="".concat(e.svgHeight+o,"px")}e.dom.elWrap.style.width="".concat(e.svgWidth,"px"),e.dom.elWrap.style.height="".concat(e.svgHeight,"px")}},{key:"shiftGraphPosition",value:function(){var t=this.w.globals,e=t.translateY,i=t.translateX;Mi.setAttrs(t.dom.elGraphical.node,{transform:"translate(".concat(i,", ").concat(e,")")})}},{key:"resizeNonAxisCharts",value:function(){var t=this.w,e=t.globals,i=0,a=t.config.chart.sparkline.enabled?1:15;a+=t.config.grid.padding.bottom,["top","bottom"].includes(t.config.legend.position)&&t.config.legend.show&&!t.config.legend.floating&&(i=new xa(this.ctx).legendHelpers.getLegendDimensions().clwh+7);var s=t.globals.dom.baseEl.querySelector(".apexcharts-radialbar, .apexcharts-pie"),r=2.05*t.globals.radialSize;if(s&&!t.config.chart.sparkline.enabled&&0!==t.config.plotOptions.radialBar.startAngle){var n=v.getBoundingClientRect(s);r=n.bottom;var o=n.bottom-n.top;r=Math.max(2.05*t.globals.radialSize,o)}var l=Math.ceil(r+e.translateY+i+a);e.dom.elLegendForeign&&e.dom.elLegendForeign.setAttribute("height",l),t.config.chart.height&&String(t.config.chart.height).includes("%")||(e.dom.elWrap.style.height="".concat(l,"px"),Mi.setAttrs(e.dom.Paper.node,{height:l}),e.dom.Paper.node.parentNode.parentNode.style.minHeight="".concat(l,"px"))}},{key:"coreCalculations",value:function(){new ea(this.ctx).init()}},{key:"resetGlobals",value:function(){var t=this,e=function(){return t.w.config.series.map((function(){return[]}))},i=new Bi,a=this.w.globals;i.initGlobalVars(a),a.seriesXvalues=e(),a.seriesYvalues=e()}},{key:"isMultipleY",value:function(){return!!(Array.isArray(this.w.config.yaxis)&&this.w.config.yaxis.length>1)&&(this.w.globals.isMultipleYAxis=!0,!0)}},{key:"xySettings",value:function(){var t=this.w,e=null;if(t.globals.axisCharts){if("back"===t.config.xaxis.crosshairs.position&&new na(this.ctx).drawXCrosshairs(),"back"===t.config.yaxis[0].crosshairs.position&&new na(this.ctx).drawYCrosshairs(),"datetime"===t.config.xaxis.type&&void 0===t.config.xaxis.labels.formatter){this.ctx.timeScale=new Ua(this.ctx);var i=[];isFinite(t.globals.minX)&&isFinite(t.globals.maxX)&&!t.globals.isBarHorizontal?i=this.ctx.timeScale.calculateTimeScaleTicks(t.globals.minX,t.globals.maxX):t.globals.isBarHorizontal&&(i=this.ctx.timeScale.calculateTimeScaleTicks(t.globals.minY,t.globals.maxY)),this.ctx.timeScale.recalcDimensionsBasedOnFormat(i)}e=new Pi(this.ctx).getCalculatedRatios()}return e}},{key:"updateSourceChart",value:function(t){this.ctx.w.globals.selection=void 0,this.ctx.updateHelpers._updateOptions({chart:{selection:{xaxis:{min:t.w.globals.minX,max:t.w.globals.maxX}}}},!1,!1)}},{key:"setupBrushHandler",value:function(){var t=this,e=this.ctx,i=this.w;if(i.config.chart.brush.enabled&&"function"!=typeof i.config.chart.events.selection){var a=Array.isArray(i.config.chart.brush.targets)?i.config.chart.brush.targets:[i.config.chart.brush.target];a.forEach((function(i){var a=e.constructor.getChartByID(i);a.w.globals.brushSource=t.ctx,"function"!=typeof a.w.config.chart.events.zoomed&&(a.w.config.chart.events.zoomed=function(){return t.updateSourceChart(a)}),"function"!=typeof a.w.config.chart.events.scrolled&&(a.w.config.chart.events.scrolled=function(){return t.updateSourceChart(a)})})),i.config.chart.events.selection=function(t,i){a.forEach((function(t){e.constructor.getChartByID(t).ctx.updateHelpers._updateOptions({xaxis:{min:i.xaxis.min,max:i.xaxis.max}},!1,!1,!1,!1)}))}}}}]),t}(),Za=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"_updateOptions",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return new Promise((function(n){var o=[e.ctx];s&&(o=e.ctx.getSyncedCharts()),e.ctx.w.globals.isExecCalled&&(o=[e.ctx],e.ctx.w.globals.isExecCalled=!1),o.forEach((function(s,l){var h=s.w;if(h.globals.shouldAnimate=a,i||(h.globals.resized=!0,h.globals.dataChanged=!0,a&&s.series.getPreviousPaths()),t&&"object"===b(t)&&(s.config=new Wi(t),t=Pi.extendArrayProps(s.config,t,h),s.w.globals.chartID!==e.ctx.w.globals.chartID&&delete t.series,h.config=v.extend(h.config,t),r&&(h.globals.lastXAxis=t.xaxis?v.clone(t.xaxis):[],h.globals.lastYAxis=t.yaxis?v.clone(t.yaxis):[],h.globals.initialConfig=v.extend({},h.config),h.globals.initialSeries=v.clone(h.config.series),t.series))){for(var c=0;c2&&void 0!==arguments[2]&&arguments[2];return new Promise((function(s){var r,n=i.w;return n.globals.shouldAnimate=e,n.globals.dataChanged=!0,e&&i.ctx.series.getPreviousPaths(),n.globals.axisCharts?(0===(r=t.map((function(t,e){return i._extendSeries(t,e)}))).length&&(r=[{data:[]}]),n.config.series=r):n.config.series=t.slice(),a&&(n.globals.initialConfig.series=v.clone(n.config.series),n.globals.initialSeries=v.clone(n.config.series)),i.ctx.update().then((function(){s(i.ctx)}))}))}},{key:"_extendSeries",value:function(t,e){var i=this.w,a=i.config.series[e];return u(u({},i.config.series[e]),{},{name:t.name?t.name:null==a?void 0:a.name,color:t.color?t.color:null==a?void 0:a.color,type:t.type?t.type:null==a?void 0:a.type,group:t.group?t.group:null==a?void 0:a.group,hidden:void 0!==t.hidden?t.hidden:null==a?void 0:a.hidden,data:t.data?t.data:null==a?void 0:a.data,zIndex:void 0!==t.zIndex?t.zIndex:e})}},{key:"toggleDataPointSelection",value:function(t,e){var i=this.w,a=null,s=".apexcharts-series[data\\:realIndex='".concat(t,"']");return i.globals.axisCharts?a=i.globals.dom.Paper.findOne("".concat(s," path[j='").concat(e,"'], ").concat(s," circle[j='").concat(e,"'], ").concat(s," rect[j='").concat(e,"']")):void 0===e&&(a=i.globals.dom.Paper.findOne("".concat(s," path[j='").concat(t,"']")),"pie"!==i.config.chart.type&&"polarArea"!==i.config.chart.type&&"donut"!==i.config.chart.type||this.ctx.pie.pieClicked(t)),a?(new Mi(this.ctx).pathMouseDown(a,null),a.node?a.node:null):(console.warn("toggleDataPointSelection: Element not found"),null)}},{key:"forceXAxisUpdate",value:function(t){var e=this.w;if(["min","max"].forEach((function(i){void 0!==t.xaxis[i]&&(e.config.xaxis[i]=t.xaxis[i],e.globals.lastXAxis[i]=t.xaxis[i])})),t.xaxis.categories&&t.xaxis.categories.length&&(e.config.xaxis.categories=t.xaxis.categories),e.config.xaxis.convertedCatToNumeric){var i=new Ni(t);t=i.convertCatToNumericXaxis(t,this.ctx)}return t}},{key:"forceYAxisUpdate",value:function(t){return t.chart&&t.chart.stacked&&"100%"===t.chart.stackType&&(Array.isArray(t.yaxis)?t.yaxis.forEach((function(e,i){t.yaxis[i].min=0,t.yaxis[i].max=100})):(t.yaxis.min=0,t.yaxis.max=100)),t}},{key:"revertDefaultAxisMinMax",value:function(t){var e=this,i=this.w,a=i.globals.lastXAxis,s=i.globals.lastYAxis;t&&t.xaxis&&(a=t.xaxis),t&&t.yaxis&&(s=t.yaxis),i.config.xaxis.min=a.min,i.config.xaxis.max=a.max;var r=function(t){void 0!==s[t]&&(i.config.yaxis[t].min=s[t].min,i.config.yaxis[t].max=s[t].max)};i.config.yaxis.map((function(t,a){i.globals.zoomed||void 0!==s[a]?r(a):void 0!==e.ctx.opts.yaxis[a]&&(t.min=e.ctx.opts.yaxis[a].min,t.max=e.ctx.opts.yaxis[a].max)}))}}]),t}();!function(){function t(){for(var t=arguments.length>0&&arguments[0]!==h?arguments[0]:[],s=arguments.length>1?arguments[1]:h,r=arguments.length>2?arguments[2]:h,n=arguments.length>3?arguments[3]:h,o=arguments.length>4?arguments[4]:h,l=arguments.length>5?arguments[5]:h,h=arguments.length>6?arguments[6]:h,c=t.slice(s,r||h),d=n.slice(o,l||h),u=0,g={pos:[0,0],start:[0,0]},p={pos:[0,0],start:[0,0]};;){if(c[u]=e.call(g,c[u]),d[u]=e.call(p,d[u]),c[u][0]!=d[u][0]||"M"==c[u][0]||"A"==c[u][0]&&(c[u][4]!=d[u][4]||c[u][5]!=d[u][5])?(Array.prototype.splice.apply(c,[u,1].concat(a.call(g,c[u]))),Array.prototype.splice.apply(d,[u,1].concat(a.call(p,d[u])))):(c[u]=i.call(g,c[u]),d[u]=i.call(p,d[u])),++u==c.length&&u==d.length)break;u==c.length&&c.push(["C",g.pos[0],g.pos[1],g.pos[0],g.pos[1],g.pos[0],g.pos[1]]),u==d.length&&d.push(["C",p.pos[0],p.pos[1],p.pos[0],p.pos[1],p.pos[0],p.pos[1]])}return{start:c,dest:d}}function e(t){switch(t[0]){case"z":case"Z":t[0]="L",t[1]=this.start[0],t[2]=this.start[1];break;case"H":t[0]="L",t[2]=this.pos[1];break;case"V":t[0]="L",t[2]=t[1],t[1]=this.pos[0];break;case"T":t[0]="Q",t[3]=t[1],t[4]=t[2],t[1]=this.reflection[1],t[2]=this.reflection[0];break;case"S":t[0]="C",t[6]=t[4],t[5]=t[3],t[4]=t[2],t[3]=t[1],t[2]=this.reflection[1],t[1]=this.reflection[0]}return t}function i(t){var e=t.length;return this.pos=[t[e-2],t[e-1]],-1!="SCQT".indexOf(t[0])&&(this.reflection=[2*this.pos[0]-t[e-4],2*this.pos[1]-t[e-3]]),t}function a(t){var e=[t];switch(t[0]){case"M":return this.pos=this.start=[t[1],t[2]],e;case"L":t[5]=t[3]=t[1],t[6]=t[4]=t[2],t[1]=this.pos[0],t[2]=this.pos[1];break;case"Q":t[6]=t[4],t[5]=t[3],t[4]=1*t[4]/3+2*t[2]/3,t[3]=1*t[3]/3+2*t[1]/3,t[2]=1*this.pos[1]/3+2*t[2]/3,t[1]=1*this.pos[0]/3+2*t[1]/3;break;case"A":e=function(t,e){var i,a,s,r,n,o,l,h,c,d,u,g,p,f,x,b,m,v,y,w,k,A,C,S,L,M,P=Math.abs(e[1]),I=Math.abs(e[2]),T=e[3]%360,z=e[4],X=e[5],R=e[6],E=e[7],Y=new bt(t),H=new bt(R,E),O=[];if(0===P||0===I||Y.x===H.x&&Y.y===H.y)return[["C",Y.x,Y.y,H.x,H.y,H.x,H.y]];i=new bt((Y.x-H.x)/2,(Y.y-H.y)/2).transform((new vt).rotate(T)),a=i.x*i.x/(P*P)+i.y*i.y/(I*I),a>1&&(P*=a=Math.sqrt(a),I*=a);s=(new vt).rotate(T).scale(1/P,1/I).rotate(-T),Y=Y.transform(s),H=H.transform(s),r=[H.x-Y.x,H.y-Y.y],o=r[0]*r[0]+r[1]*r[1],n=Math.sqrt(o),r[0]/=n,r[1]/=n,l=o<4?Math.sqrt(1-o/4):0,z===X&&(l*=-1);h=new bt((H.x+Y.x)/2+l*-r[1],(H.y+Y.y)/2+l*r[0]),c=new bt(Y.x-h.x,Y.y-h.y),d=new bt(H.x-h.x,H.y-h.y),u=Math.acos(c.x/Math.sqrt(c.x*c.x+c.y*c.y)),c.y<0&&(u*=-1);g=Math.acos(d.x/Math.sqrt(d.x*d.x+d.y*d.y)),d.y<0&&(g*=-1);X&&u>g&&(g+=2*Math.PI);!X&&u0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1?arguments[1]:void 0;if(!1===e)return!1;for(var i=e,a=t.length;i(t.changedTouches&&(t=t.changedTouches[0]),{x:t.clientX,y:t.clientY});class Ja{constructor(t){t.remember("_draggable",this),this.el=t,this.drag=this.drag.bind(this),this.startDrag=this.startDrag.bind(this),this.endDrag=this.endDrag.bind(this)}init(t){t?(this.el.on("mousedown.drag",this.startDrag),this.el.on("touchstart.drag",this.startDrag,{passive:!1})):(this.el.off("mousedown.drag"),this.el.off("touchstart.drag"))}startDrag(t){const e=!t.type.indexOf("mouse");if(e&&1!==t.which&&0!==t.buttons)return;if(this.el.dispatch("beforedrag",{event:t,handler:this}).defaultPrevented)return;t.preventDefault(),t.stopPropagation(),this.init(!1),this.box=this.el.bbox(),this.lastClick=this.el.point($a(t));const i=(e?"mouseup":"touchend")+".drag";zt(window,(e?"mousemove":"touchmove")+".drag",this.drag,this,{passive:!1}),zt(window,i,this.endDrag,this,{passive:!1}),this.el.fire("dragstart",{event:t,handler:this,box:this.box})}drag(t){const{box:e,lastClick:i}=this,a=this.el.point($a(t)),s=a.x-i.x,r=a.y-i.y;if(!s&&!r)return e;const n=e.x+s,o=e.y+r;this.box=new kt(n,o,e.w,e.h),this.lastClick=a,this.el.dispatch("dragmove",{event:t,handler:this,box:this.box}).defaultPrevented||this.move(n,o)}move(t,e){"svg"===this.el.type?gi.prototype.move.call(this.el,t,e):this.el.move(t,e)}endDrag(t){this.drag(t),this.el.fire("dragend",{event:t,handler:this,box:this.box}),Xt(window,"mousemove.drag"),Xt(window,"touchmove.drag"),Xt(window,"mouseup.drag"),Xt(window,"touchend.drag"),this.init(!0)}} +/*! +* @svgdotjs/svg.select.js - An extension of svg.js which allows to select elements with mouse +* @version 4.0.1 +* https://github.com/svgdotjs/svg.select.js +* +* @copyright Ulrich-Matthias Schäfer +* @license MIT +* +* BUILT: Mon Jul 01 2024 15:04:42 GMT+0200 (Central European Summer Time) +*/ +function Qa(t,e,i,a=null){return function(s){s.preventDefault(),s.stopPropagation();var r=s.pageX||s.touches[0].pageX,n=s.pageY||s.touches[0].pageY;e.fire(t,{x:r,y:n,event:s,index:a,points:i})}}function Ka([t,e],{a:i,b:a,c:s,d:r,e:n,f:o}){return[t*i+e*s+n,t*a+e*r+o]}Q(Gt,{draggable(t=!0){return(this.remember("_draggable")||new Ja(this)).init(t),this}});let ts=class{constructor(t){this.el=t,t.remember("_selectHandler",this),this.selection=new gi,this.order=["lt","t","rt","r","rb","b","lb","l","rot"],this.mutationHandler=this.mutationHandler.bind(this);const e=F();this.observer=new e.MutationObserver(this.mutationHandler)}init(t){this.createHandle=t.createHandle||this.createHandleFn,this.createRot=t.createRot||this.createRotFn,this.updateHandle=t.updateHandle||this.updateHandleFn,this.updateRot=t.updateRot||this.updateRotFn,this.el.root().put(this.selection),this.updatePoints(),this.createSelection(),this.createResizeHandles(),this.updateResizeHandles(),this.createRotationHandle(),this.updateRotationHandle(),this.observer.observe(this.el.node,{attributes:!0})}active(t,e){if(!t)return this.selection.clear().remove(),void this.observer.disconnect();this.init(e)}createSelection(){this.selection.polygon(this.handlePoints).addClass("svg_select_shape")}updateSelection(){this.selection.get(0).plot(this.handlePoints)}createResizeHandles(){this.handlePoints.forEach(((t,e,i)=>{const a=this.order[e];this.createHandle.call(this,this.selection,t,e,i,a),this.selection.get(e+1).addClass("svg_select_handle svg_select_handle_"+a).on("mousedown.selection touchstart.selection",Qa(a,this.el,this.handlePoints,e))}))}createHandleFn(t){t.polyline()}updateHandleFn(t,e,i,a){const s=a.at(i-1),r=a[(i+1)%a.length],n=e,o=[n[0]-s[0],n[1]-s[1]],l=[n[0]-r[0],n[1]-r[1]],h=Math.sqrt(o[0]*o[0]+o[1]*o[1]),c=Math.sqrt(l[0]*l[0]+l[1]*l[1]),d=[o[0]/h,o[1]/h],u=[l[0]/c,l[1]/c],g=[n[0]-10*d[0],n[1]-10*d[1]],p=[n[0]-10*u[0],n[1]-10*u[1]];t.plot([g,n,p])}updateResizeHandles(){this.handlePoints.forEach(((t,e,i)=>{const a=this.order[e];this.updateHandle.call(this,this.selection.get(e+1),t,e,i,a)}))}createRotFn(t){t.line(),t.circle(5)}getPoint(t){return this.handlePoints[this.order.indexOf(t)]}getPointHandle(t){return this.selection.get(this.order.indexOf(t)+1)}updateRotFn(t,e){const i=this.getPoint("t");t.get(0).plot(i[0],i[1],e[0],e[1]),t.get(1).center(e[0],e[1])}createRotationHandle(){const t=this.selection.group().addClass("svg_select_handle_rot").on("mousedown.selection touchstart.selection",Qa("rot",this.el,this.handlePoints));this.createRot.call(this,t)}updateRotationHandle(){const t=this.selection.findOne("g.svg_select_handle_rot");this.updateRot(t,this.rotationPoint,this.handlePoints)}updatePoints(){const t=this.el.bbox(),e=this.el.parent().screenCTM().inverseO().multiplyO(this.el.screenCTM());this.handlePoints=this.getHandlePoints(t).map((t=>Ka(t,e))),this.rotationPoint=Ka(this.getRotationPoint(t),e)}getHandlePoints({x:t,x2:e,y:i,y2:a,cx:s,cy:r}=this.el.bbox()){return[[t,i],[s,i],[e,i],[e,r],[e,a],[s,a],[t,a],[t,r]]}getRotationPoint({y:t,cx:e}=this.el.bbox()){return[e,t-20]}mutationHandler(){this.updatePoints(),this.updateSelection(),this.updateResizeHandles(),this.updateRotationHandle()}};const es=t=>function(e=!0,i={}){"object"==typeof e&&(i=e,e=!0);let a=this.remember("_"+t.name);return a||(e.prototype instanceof ts?(a=new e(this),e=!0):a=new t(this),this.remember("_"+t.name,a)),a.active(e,i),this}; +/*! +* @svgdotjs/svg.resize.js - An extension for svg.js which allows to resize elements which are selected +* @version 2.0.4 +* https://github.com/svgdotjs/svg.resize.js +* +* @copyright [object Object] +* @license MIT +* +* BUILT: Fri Sep 13 2024 12:43:14 GMT+0200 (Central European Summer Time) +*/ +/*! +* @svgdotjs/svg.select.js - An extension of svg.js which allows to select elements with mouse +* @version 4.0.1 +* https://github.com/svgdotjs/svg.select.js +* +* @copyright Ulrich-Matthias Schäfer +* @license MIT +* +* BUILT: Mon Jul 01 2024 15:04:42 GMT+0200 (Central European Summer Time) +*/ +function is(t,e,i,a=null){return function(s){s.preventDefault(),s.stopPropagation();var r=s.pageX||s.touches[0].pageX,n=s.pageY||s.touches[0].pageY;e.fire(t,{x:r,y:n,event:s,index:a,points:i})}}function as([t,e],{a:i,b:a,c:s,d:r,e:n,f:o}){return[t*i+e*s+n,t*a+e*r+o]}Q(Gt,{select:es(ts)}),Q([Ge,je,xe],{pointSelect:es(class{constructor(t){this.el=t,t.remember("_pointSelectHandler",this),this.selection=new gi,this.order=["lt","t","rt","r","rb","b","lb","l","rot"],this.mutationHandler=this.mutationHandler.bind(this);const e=F();this.observer=new e.MutationObserver(this.mutationHandler)}init(t){this.createHandle=t.createHandle||this.createHandleFn,this.updateHandle=t.updateHandle||this.updateHandleFn,this.el.root().put(this.selection),this.updatePoints(),this.createSelection(),this.createPointHandles(),this.updatePointHandles(),this.observer.observe(this.el.node,{attributes:!0})}active(t,e){if(!t)return this.selection.clear().remove(),void this.observer.disconnect();this.init(e)}createSelection(){this.selection.polygon(this.points).addClass("svg_select_shape_pointSelect")}updateSelection(){this.selection.get(0).plot(this.points)}createPointHandles(){this.points.forEach(((t,e,i)=>{this.createHandle.call(this,this.selection,t,e,i),this.selection.get(e+1).addClass("svg_select_handle_point").on("mousedown.selection touchstart.selection",Qa("point",this.el,this.points,e))}))}createHandleFn(t){t.circle(5)}updateHandleFn(t,e){t.center(e[0],e[1])}updatePointHandles(){this.points.forEach(((t,e,i)=>{this.updateHandle.call(this,this.selection.get(e+1),t,e,i)}))}updatePoints(){const t=this.el.parent().screenCTM().inverseO().multiplyO(this.el.screenCTM());this.points=this.el.array().map((e=>Ka(e,t)))}mutationHandler(){this.updatePoints(),this.updateSelection(),this.updatePointHandles()}})});class ss{constructor(t){this.el=t,t.remember("_selectHandler",this),this.selection=new gi,this.order=["lt","t","rt","r","rb","b","lb","l","rot"],this.mutationHandler=this.mutationHandler.bind(this);const e=F();this.observer=new e.MutationObserver(this.mutationHandler)}init(t){this.createHandle=t.createHandle||this.createHandleFn,this.createRot=t.createRot||this.createRotFn,this.updateHandle=t.updateHandle||this.updateHandleFn,this.updateRot=t.updateRot||this.updateRotFn,this.el.root().put(this.selection),this.updatePoints(),this.createSelection(),this.createResizeHandles(),this.updateResizeHandles(),this.createRotationHandle(),this.updateRotationHandle(),this.observer.observe(this.el.node,{attributes:!0})}active(t,e){if(!t)return this.selection.clear().remove(),void this.observer.disconnect();this.init(e)}createSelection(){this.selection.polygon(this.handlePoints).addClass("svg_select_shape")}updateSelection(){this.selection.get(0).plot(this.handlePoints)}createResizeHandles(){this.handlePoints.forEach(((t,e,i)=>{const a=this.order[e];this.createHandle.call(this,this.selection,t,e,i,a),this.selection.get(e+1).addClass("svg_select_handle svg_select_handle_"+a).on("mousedown.selection touchstart.selection",is(a,this.el,this.handlePoints,e))}))}createHandleFn(t){t.polyline()}updateHandleFn(t,e,i,a){const s=a.at(i-1),r=a[(i+1)%a.length],n=e,o=[n[0]-s[0],n[1]-s[1]],l=[n[0]-r[0],n[1]-r[1]],h=Math.sqrt(o[0]*o[0]+o[1]*o[1]),c=Math.sqrt(l[0]*l[0]+l[1]*l[1]),d=[o[0]/h,o[1]/h],u=[l[0]/c,l[1]/c],g=[n[0]-10*d[0],n[1]-10*d[1]],p=[n[0]-10*u[0],n[1]-10*u[1]];t.plot([g,n,p])}updateResizeHandles(){this.handlePoints.forEach(((t,e,i)=>{const a=this.order[e];this.updateHandle.call(this,this.selection.get(e+1),t,e,i,a)}))}createRotFn(t){t.line(),t.circle(5)}getPoint(t){return this.handlePoints[this.order.indexOf(t)]}getPointHandle(t){return this.selection.get(this.order.indexOf(t)+1)}updateRotFn(t,e){const i=this.getPoint("t");t.get(0).plot(i[0],i[1],e[0],e[1]),t.get(1).center(e[0],e[1])}createRotationHandle(){const t=this.selection.group().addClass("svg_select_handle_rot").on("mousedown.selection touchstart.selection",is("rot",this.el,this.handlePoints));this.createRot.call(this,t)}updateRotationHandle(){const t=this.selection.findOne("g.svg_select_handle_rot");this.updateRot(t,this.rotationPoint,this.handlePoints)}updatePoints(){const t=this.el.bbox(),e=this.el.parent().screenCTM().inverseO().multiplyO(this.el.screenCTM());this.handlePoints=this.getHandlePoints(t).map((t=>as(t,e))),this.rotationPoint=as(this.getRotationPoint(t),e)}getHandlePoints({x:t,x2:e,y:i,y2:a,cx:s,cy:r}=this.el.bbox()){return[[t,i],[s,i],[e,i],[e,r],[e,a],[s,a],[t,a],[t,r]]}getRotationPoint({y:t,cx:e}=this.el.bbox()){return[e,t-20]}mutationHandler(){this.updatePoints(),this.updateSelection(),this.updateResizeHandles(),this.updateRotationHandle()}}const rs=t=>function(e=!0,i={}){"object"==typeof e&&(i=e,e=!0);let a=this.remember("_"+t.name);return a||(e.prototype instanceof ss?(a=new e(this),e=!0):a=new t(this),this.remember("_"+t.name,a)),a.active(e,i),this};Q(Gt,{select:rs(ss)}),Q([Ge,je,xe],{pointSelect:rs(class{constructor(t){this.el=t,t.remember("_pointSelectHandler",this),this.selection=new gi,this.order=["lt","t","rt","r","rb","b","lb","l","rot"],this.mutationHandler=this.mutationHandler.bind(this);const e=F();this.observer=new e.MutationObserver(this.mutationHandler)}init(t){this.createHandle=t.createHandle||this.createHandleFn,this.updateHandle=t.updateHandle||this.updateHandleFn,this.el.root().put(this.selection),this.updatePoints(),this.createSelection(),this.createPointHandles(),this.updatePointHandles(),this.observer.observe(this.el.node,{attributes:!0})}active(t,e){if(!t)return this.selection.clear().remove(),void this.observer.disconnect();this.init(e)}createSelection(){this.selection.polygon(this.points).addClass("svg_select_shape_pointSelect")}updateSelection(){this.selection.get(0).plot(this.points)}createPointHandles(){this.points.forEach(((t,e,i)=>{this.createHandle.call(this,this.selection,t,e,i),this.selection.get(e+1).addClass("svg_select_handle_point").on("mousedown.selection touchstart.selection",is("point",this.el,this.points,e))}))}createHandleFn(t){t.circle(5)}updateHandleFn(t,e){t.center(e[0],e[1])}updatePointHandles(){this.points.forEach(((t,e,i)=>{this.updateHandle.call(this,this.selection.get(e+1),t,e,i)}))}updatePoints(){const t=this.el.parent().screenCTM().inverseO().multiplyO(this.el.screenCTM());this.points=this.el.array().map((e=>as(e,t)))}mutationHandler(){this.updatePoints(),this.updateSelection(),this.updatePointHandles()}})});const ns=t=>(t.changedTouches&&(t=t.changedTouches[0]),{x:t.clientX,y:t.clientY}),os=t=>{let e=1/0,i=1/0,a=-1/0,s=-1/0;for(let r=0;r{const s=t-e[0],r=(a-e[1])*i;return[s*i+e[0],r+e[1]]}));return os(a)}(this.box,s,r)}this.el.dispatch("resize",{box:new kt(l),angle:0,eventType:this.eventType,event:t,handler:this}).defaultPrevented||this.el.size(l.width,l.height).move(l.x,l.y)}movePoint(t){this.lastEvent=t;const{x:e,y:i}=this.snapToGrid(this.el.point(ns(t))),a=this.el.array().slice();a[this.index]=[e,i],this.el.dispatch("resize",{box:os(a),angle:0,eventType:this.eventType,event:t,handler:this}).defaultPrevented||this.el.plot(a)}rotate(t){this.lastEvent=t;const e=this.startPoint,i=this.el.point(ns(t)),{cx:a,cy:s}=this.box,r=e.x-a,n=e.y-s,o=i.x-a,l=i.y-s,h=Math.sqrt(r*r+n*n)*Math.sqrt(o*o+l*l);if(0===h)return;let c=Math.acos((r*o+n*l)/h)/Math.PI*180;if(!c)return;i.xdiv {\n margin: 4px 0\n}\n\n.apexcharts-tooltip-box span.value {\n font-weight: 700\n}\n\n.apexcharts-tooltip-rangebar {\n padding: 5px 8px\n}\n\n.apexcharts-tooltip-rangebar .category {\n font-weight: 600;\n color: #777\n}\n\n.apexcharts-tooltip-rangebar .series-name {\n font-weight: 700;\n display: block;\n margin-bottom: 5px\n}\n\n.apexcharts-xaxistooltip,\n.apexcharts-yaxistooltip {\n opacity: 0;\n pointer-events: none;\n color: #373d3f;\n font-size: 13px;\n text-align: center;\n border-radius: 2px;\n position: absolute;\n z-index: 10;\n background: #eceff1;\n border: 1px solid #90a4ae\n}\n\n.apexcharts-xaxistooltip {\n padding: 9px 10px;\n transition: .15s ease all\n}\n\n.apexcharts-xaxistooltip.apexcharts-theme-dark {\n background: rgba(0, 0, 0, .7);\n border: 1px solid rgba(0, 0, 0, .5);\n color: #fff\n}\n\n.apexcharts-xaxistooltip:after,\n.apexcharts-xaxistooltip:before {\n left: 50%;\n border: solid transparent;\n content: " ";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none\n}\n\n.apexcharts-xaxistooltip:after {\n border-color: transparent;\n border-width: 6px;\n margin-left: -6px\n}\n\n.apexcharts-xaxistooltip:before {\n border-color: transparent;\n border-width: 7px;\n margin-left: -7px\n}\n\n.apexcharts-xaxistooltip-bottom:after,\n.apexcharts-xaxistooltip-bottom:before {\n bottom: 100%\n}\n\n.apexcharts-xaxistooltip-top:after,\n.apexcharts-xaxistooltip-top:before {\n top: 100%\n}\n\n.apexcharts-xaxistooltip-bottom:after {\n border-bottom-color: #eceff1\n}\n\n.apexcharts-xaxistooltip-bottom:before {\n border-bottom-color: #90a4ae\n}\n\n.apexcharts-xaxistooltip-bottom.apexcharts-theme-dark:after,\n.apexcharts-xaxistooltip-bottom.apexcharts-theme-dark:before {\n border-bottom-color: rgba(0, 0, 0, .5)\n}\n\n.apexcharts-xaxistooltip-top:after {\n border-top-color: #eceff1\n}\n\n.apexcharts-xaxistooltip-top:before {\n border-top-color: #90a4ae\n}\n\n.apexcharts-xaxistooltip-top.apexcharts-theme-dark:after,\n.apexcharts-xaxistooltip-top.apexcharts-theme-dark:before {\n border-top-color: rgba(0, 0, 0, .5)\n}\n\n.apexcharts-xaxistooltip.apexcharts-active {\n opacity: 1;\n transition: .15s ease all\n}\n\n.apexcharts-yaxistooltip {\n padding: 4px 10px\n}\n\n.apexcharts-yaxistooltip.apexcharts-theme-dark {\n background: rgba(0, 0, 0, .7);\n border: 1px solid rgba(0, 0, 0, .5);\n color: #fff\n}\n\n.apexcharts-yaxistooltip:after,\n.apexcharts-yaxistooltip:before {\n top: 50%;\n border: solid transparent;\n content: " ";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none\n}\n\n.apexcharts-yaxistooltip:after {\n border-color: transparent;\n border-width: 6px;\n margin-top: -6px\n}\n\n.apexcharts-yaxistooltip:before {\n border-color: transparent;\n border-width: 7px;\n margin-top: -7px\n}\n\n.apexcharts-yaxistooltip-left:after,\n.apexcharts-yaxistooltip-left:before {\n left: 100%\n}\n\n.apexcharts-yaxistooltip-right:after,\n.apexcharts-yaxistooltip-right:before {\n right: 100%\n}\n\n.apexcharts-yaxistooltip-left:after {\n border-left-color: #eceff1\n}\n\n.apexcharts-yaxistooltip-left:before {\n border-left-color: #90a4ae\n}\n\n.apexcharts-yaxistooltip-left.apexcharts-theme-dark:after,\n.apexcharts-yaxistooltip-left.apexcharts-theme-dark:before {\n border-left-color: rgba(0, 0, 0, .5)\n}\n\n.apexcharts-yaxistooltip-right:after {\n border-right-color: #eceff1\n}\n\n.apexcharts-yaxistooltip-right:before {\n border-right-color: #90a4ae\n}\n\n.apexcharts-yaxistooltip-right.apexcharts-theme-dark:after,\n.apexcharts-yaxistooltip-right.apexcharts-theme-dark:before {\n border-right-color: rgba(0, 0, 0, .5)\n}\n\n.apexcharts-yaxistooltip.apexcharts-active {\n opacity: 1\n}\n\n.apexcharts-yaxistooltip-hidden {\n display: none\n}\n\n.apexcharts-xcrosshairs,\n.apexcharts-ycrosshairs {\n pointer-events: none;\n opacity: 0;\n transition: .15s ease all\n}\n\n.apexcharts-xcrosshairs.apexcharts-active,\n.apexcharts-ycrosshairs.apexcharts-active {\n opacity: 1;\n transition: .15s ease all\n}\n\n.apexcharts-ycrosshairs-hidden {\n opacity: 0\n}\n\n.apexcharts-selection-rect {\n cursor: move\n}\n\n.svg_select_shape {\n stroke-width: 1;\n stroke-dasharray: 10 10;\n stroke: black;\n stroke-opacity: 0.1;\n pointer-events: none;\n fill: none;\n}\n\n.svg_select_handle {\n stroke-width: 3;\n stroke: black;\n fill: none;\n}\n\n.svg_select_handle_r {\n cursor: e-resize;\n}\n\n.svg_select_handle_l {\n cursor: w-resize;\n}\n\n.apexcharts-svg.apexcharts-zoomable.hovering-zoom {\n cursor: crosshair\n}\n\n.apexcharts-svg.apexcharts-zoomable.hovering-pan {\n cursor: move\n}\n\n.apexcharts-menu-icon,\n.apexcharts-pan-icon,\n.apexcharts-reset-icon,\n.apexcharts-selection-icon,\n.apexcharts-toolbar-custom-icon,\n.apexcharts-zoom-icon,\n.apexcharts-zoomin-icon,\n.apexcharts-zoomout-icon {\n cursor: pointer;\n width: 20px;\n height: 20px;\n line-height: 24px;\n color: #6e8192;\n text-align: center\n}\n\n.apexcharts-menu-icon svg,\n.apexcharts-reset-icon svg,\n.apexcharts-zoom-icon svg,\n.apexcharts-zoomin-icon svg,\n.apexcharts-zoomout-icon svg {\n fill: #6e8192\n}\n\n.apexcharts-selection-icon svg {\n fill: #444;\n transform: scale(.76)\n}\n\n.apexcharts-theme-dark .apexcharts-menu-icon svg,\n.apexcharts-theme-dark .apexcharts-pan-icon svg,\n.apexcharts-theme-dark .apexcharts-reset-icon svg,\n.apexcharts-theme-dark .apexcharts-selection-icon svg,\n.apexcharts-theme-dark .apexcharts-toolbar-custom-icon svg,\n.apexcharts-theme-dark .apexcharts-zoom-icon svg,\n.apexcharts-theme-dark .apexcharts-zoomin-icon svg,\n.apexcharts-theme-dark .apexcharts-zoomout-icon svg {\n fill: #f3f4f5\n}\n\n.apexcharts-canvas .apexcharts-reset-zoom-icon.apexcharts-selected svg,\n.apexcharts-canvas .apexcharts-selection-icon.apexcharts-selected svg,\n.apexcharts-canvas .apexcharts-zoom-icon.apexcharts-selected svg {\n fill: #008ffb\n}\n\n.apexcharts-theme-light .apexcharts-menu-icon:hover svg,\n.apexcharts-theme-light .apexcharts-reset-icon:hover svg,\n.apexcharts-theme-light .apexcharts-selection-icon:not(.apexcharts-selected):hover svg,\n.apexcharts-theme-light .apexcharts-zoom-icon:not(.apexcharts-selected):hover svg,\n.apexcharts-theme-light .apexcharts-zoomin-icon:hover svg,\n.apexcharts-theme-light .apexcharts-zoomout-icon:hover svg {\n fill: #333\n}\n\n.apexcharts-menu-icon,\n.apexcharts-selection-icon {\n position: relative\n}\n\n.apexcharts-reset-icon {\n margin-left: 5px\n}\n\n.apexcharts-menu-icon,\n.apexcharts-reset-icon,\n.apexcharts-zoom-icon {\n transform: scale(.85)\n}\n\n.apexcharts-zoomin-icon,\n.apexcharts-zoomout-icon {\n transform: scale(.7)\n}\n\n.apexcharts-zoomout-icon {\n margin-right: 3px\n}\n\n.apexcharts-pan-icon {\n transform: scale(.62);\n position: relative;\n left: 1px;\n top: 0\n}\n\n.apexcharts-pan-icon svg {\n fill: #fff;\n stroke: #6e8192;\n stroke-width: 2\n}\n\n.apexcharts-pan-icon.apexcharts-selected svg {\n stroke: #008ffb\n}\n\n.apexcharts-pan-icon:not(.apexcharts-selected):hover svg {\n stroke: #333\n}\n\n.apexcharts-toolbar {\n position: absolute;\n z-index: 11;\n max-width: 176px;\n text-align: right;\n border-radius: 3px;\n padding: 0 6px 2px;\n display: flex;\n justify-content: space-between;\n align-items: center\n}\n\n.apexcharts-menu {\n background: #fff;\n position: absolute;\n top: 100%;\n border: 1px solid #ddd;\n border-radius: 3px;\n padding: 3px;\n right: 10px;\n opacity: 0;\n min-width: 110px;\n transition: .15s ease all;\n pointer-events: none\n}\n\n.apexcharts-menu.apexcharts-menu-open {\n opacity: 1;\n pointer-events: all;\n transition: .15s ease all\n}\n\n.apexcharts-menu-item {\n padding: 6px 7px;\n font-size: 12px;\n cursor: pointer\n}\n\n.apexcharts-theme-light .apexcharts-menu-item:hover {\n background: #eee\n}\n\n.apexcharts-theme-dark .apexcharts-menu {\n background: rgba(0, 0, 0, .7);\n color: #fff\n}\n\n@media screen and (min-width:768px) {\n .apexcharts-canvas:hover .apexcharts-toolbar {\n opacity: 1\n }\n}\n\n.apexcharts-canvas .apexcharts-element-hidden,\n.apexcharts-datalabel.apexcharts-element-hidden,\n.apexcharts-hide .apexcharts-series-points {\n opacity: 0;\n}\n\n.apexcharts-hidden-element-shown {\n opacity: 1;\n transition: 0.25s ease all;\n}\n\n.apexcharts-datalabel,\n.apexcharts-datalabel-label,\n.apexcharts-datalabel-value,\n.apexcharts-datalabels,\n.apexcharts-pie-label {\n cursor: default;\n pointer-events: none\n}\n\n.apexcharts-pie-label-delay {\n opacity: 0;\n animation-name: opaque;\n animation-duration: .3s;\n animation-fill-mode: forwards;\n animation-timing-function: ease\n}\n\n.apexcharts-radialbar-label {\n cursor: pointer;\n}\n\n.apexcharts-annotation-rect,\n.apexcharts-area-series .apexcharts-area,\n.apexcharts-gridline,\n.apexcharts-line,\n.apexcharts-point-annotation-label,\n.apexcharts-radar-series path:not(.apexcharts-marker),\n.apexcharts-radar-series polygon,\n.apexcharts-toolbar svg,\n.apexcharts-tooltip .apexcharts-marker,\n.apexcharts-xaxis-annotation-label,\n.apexcharts-yaxis-annotation-label,\n.apexcharts-zoom-rect,\n.no-pointer-events {\n pointer-events: none\n}\n\n.apexcharts-tooltip-active .apexcharts-marker {\n transition: .15s ease all\n}\n\n.apexcharts-radar-series .apexcharts-yaxis {\n pointer-events: none;\n}\n\n.resize-triggers {\n animation: 1ms resizeanim;\n visibility: hidden;\n opacity: 0;\n height: 100%;\n width: 100%;\n overflow: hidden\n}\n\n.contract-trigger:before,\n.resize-triggers,\n.resize-triggers>div {\n content: " ";\n display: block;\n position: absolute;\n top: 0;\n left: 0\n}\n\n.resize-triggers>div {\n height: 100%;\n width: 100%;\n background: #eee;\n overflow: auto\n}\n\n.contract-trigger:before {\n overflow: hidden;\n width: 200%;\n height: 200%\n}\n\n.apexcharts-bar-goals-markers {\n pointer-events: none\n}\n\n.apexcharts-bar-shadows {\n pointer-events: none\n}\n\n.apexcharts-rangebar-goals-markers {\n pointer-events: none\n}';var h=(null===(l=t.opts.chart)||void 0===l?void 0:l.nonce)||t.w.config.chart.nonce;h&&o.setAttribute("nonce",h),r?s.prepend(o):n.head.appendChild(o)}var c=t.create(t.w.config.series,{});if(!c)return e(t);t.mount(c).then((function(){"function"==typeof t.w.config.chart.events.mounted&&t.w.config.chart.events.mounted(t,t.w),t.events.fireEvent("mounted",[t,t.w]),e(c)})).catch((function(t){i(t)}))}else i(new Error("Element not found"))}))}},{key:"create",value:function(t,e){var i=this,a=this.w;new hs(this).initModules();var s=this.w.globals;if(s.noData=!1,s.animationEnded=!1,!v.elementExists(this.el))return s.animationEnded=!0,this.destroy(),null;(this.responsive.checkResponsiveConfig(e),a.config.xaxis.convertedCatToNumeric)&&new Ni(a.config).convertCatToNumericXaxis(a.config,this.ctx);if(this.core.setupElements(),"treemap"===a.config.chart.type&&(a.config.grid.show=!1,a.config.yaxis[0].show=!1),0===s.svgWidth)return s.animationEnded=!0,null;var r=t;t.forEach((function(t,e){t.hidden&&(r=i.legend.legendHelpers.getSeriesAfterCollapsing({realIndex:e}))}));var n=Pi.checkComboSeries(r,a.config.chart.type);s.comboCharts=n.comboCharts,s.comboBarCount=n.comboBarCount;var o=r.every((function(t){return t.data&&0===t.data.length}));(0===r.length||o&&s.collapsedSeries.length<1)&&this.series.handleNoData(),this.events.setupEventHandlers(),this.data.parseData(r),this.theme.init(),new Vi(this).setGlobalMarkerSize(),this.formatters.setLabelFormatters(),this.titleSubtitle.draw(),s.noData&&s.collapsedSeries.length!==s.series.length&&!a.config.legend.showForSingleSeries||this.legend.init(),this.series.hasAllSeriesEqualX(),s.axisCharts&&(this.core.coreCalculations(),"category"!==a.config.xaxis.type&&this.formatters.setLabelFormatters(),this.ctx.toolbar.minX=a.globals.minX,this.ctx.toolbar.maxX=a.globals.maxX),this.formatters.heatmapLabelFormatters(),new Pi(this).getLargestMarkerSize(),this.dimensions.plotCoords();var l=this.core.xySettings();this.grid.createGridMask();var h=this.core.plotChartType(r,l),c=new qi(this);return c.bringForward(),a.config.dataLabels.background.enabled&&c.dataLabelsBackground(),this.core.shiftGraphPosition(),{elGraph:h,xyRatios:l,dimensions:{plot:{left:a.globals.translateX,top:a.globals.translateY,width:a.globals.gridWidth,height:a.globals.gridHeight}}}}},{key:"mount",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=this,a=i.w;return new Promise((function(s,r){if(null===i.el)return r(new Error("Not enough data to display or target element not found"));(null===e||a.globals.allSeriesCollapsed)&&i.series.handleNoData(),i.grid=new Ki(i);var n,o,l=i.grid.drawGrid();(i.annotations=new Fi(i),i.annotations.drawImageAnnos(),i.annotations.drawTextAnnos(),"back"===a.config.grid.position)&&(l&&a.globals.dom.elGraphical.add(l.el),null!=l&&null!==(n=l.elGridBorders)&&void 0!==n&&n.node&&a.globals.dom.elGraphical.add(l.elGridBorders));if(Array.isArray(e.elGraph))for(var h=0;h0&&a.globals.memory.methodsToExec.forEach((function(t){t.method(t.params,!1,t.context)})),a.globals.axisCharts||a.globals.noData||i.core.resizeNonAxisCharts(),s(i)}))}},{key:"destroy",value:function(){window.removeEventListener("resize",this.windowResizeHandler),function(t,e){var i=ds.get(e);i&&(i.disconnect(),ds.delete(e))}(this.el.parentNode,this.parentResizeHandler);var t=this.w.config.chart.id;t&&Apex._chartInstances.forEach((function(e,i){e.id===v.escapeString(t)&&Apex._chartInstances.splice(i,1)})),new cs(this.ctx).clear({isUpdating:!1})}},{key:"updateOptions",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=this.w;return n.globals.selection=void 0,t.series&&(this.series.resetSeries(!1,!0,!1),t.series.length&&t.series[0].data&&(t.series=t.series.map((function(t,i){return e.updateHelpers._extendSeries(t,i)}))),this.updateHelpers.revertDefaultAxisMinMax()),t.xaxis&&(t=this.updateHelpers.forceXAxisUpdate(t)),t.yaxis&&(t=this.updateHelpers.forceYAxisUpdate(t)),n.globals.collapsedSeriesIndices.length>0&&this.series.clearPreviousPaths(),t.theme&&(t=this.theme.updateThemeOptions(t)),this.updateHelpers._updateOptions(t,i,a,s,r)}},{key:"updateSeries",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return this.series.resetSeries(!1),this.updateHelpers.revertDefaultAxisMinMax(),this.updateHelpers._updateSeries(t,e,i)}},{key:"appendSeries",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=this.w.config.series.slice();return a.push(t),this.series.resetSeries(!1),this.updateHelpers.revertDefaultAxisMinMax(),this.updateHelpers._updateSeries(a,e,i)}},{key:"appendData",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this;i.w.globals.dataChanged=!0,i.series.getPreviousPaths();for(var a=i.w.config.series.slice(),s=0;s0&&void 0!==arguments[0])||arguments[0],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.series.resetSeries(t,e)}},{key:"addEventListener",value:function(t,e){this.events.addEventListener(t,e)}},{key:"removeEventListener",value:function(t,e){this.events.removeEventListener(t,e)}},{key:"addXaxisAnnotation",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,a=this;i&&(a=i),a.annotations.addXaxisAnnotationExternal(t,e,a)}},{key:"addYaxisAnnotation",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,a=this;i&&(a=i),a.annotations.addYaxisAnnotationExternal(t,e,a)}},{key:"addPointAnnotation",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,a=this;i&&(a=i),a.annotations.addPointAnnotationExternal(t,e,a)}},{key:"clearAnnotations",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,e=this;t&&(e=t),e.annotations.clearAnnotations(e)}},{key:"removeAnnotation",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,i=this;e&&(i=e),i.annotations.removeAnnotation(i,t)}},{key:"getChartArea",value:function(){return this.w.globals.dom.baseEl.querySelector(".apexcharts-inner")}},{key:"getSeriesTotalXRange",value:function(t,e){return this.coreUtils.getSeriesTotalsXRange(t,e)}},{key:"getHighestValueInSeries",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new ea(this.ctx).getMinYMaxY(t).highestY}},{key:"getLowestValueInSeries",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new ea(this.ctx).getMinYMaxY(t).lowestY}},{key:"getSeriesTotal",value:function(){return this.w.globals.seriesTotals}},{key:"toggleDataPointSelection",value:function(t,e){return this.updateHelpers.toggleDataPointSelection(t,e)}},{key:"zoomX",value:function(t,e){this.ctx.toolbar.zoomUpdateOptions(t,e)}},{key:"setLocale",value:function(t){this.localization.setCurrentLocaleValues(t)}},{key:"dataURI",value:function(t){return new Ji(this.ctx).dataURI(t)}},{key:"getSvgString",value:function(t){return new Ji(this.ctx).getSvgString(t)}},{key:"exportToCSV",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Ji(this.ctx).exportToCSV(t)}},{key:"paper",value:function(){return this.w.globals.dom.Paper}},{key:"_parentResizeCallback",value:function(){this.w.globals.animationEnded&&this.w.config.chart.redrawOnParentResize&&this._windowResize()}},{key:"_windowResize",value:function(){var t=this;clearTimeout(this.w.globals.resizeTimer),this.w.globals.resizeTimer=window.setTimeout((function(){t.w.globals.resized=!0,t.w.globals.dataChanged=!1,t.ctx.update()}),150)}},{key:"_windowResizeHandler",value:function(){var t=this.w.config.chart.redrawOnWindowResize;"function"==typeof t&&(t=t()),t&&this._windowResize()}}],[{key:"getChartByID",value:function(t){var e=v.escapeString(t);if(Apex._chartInstances){var i=Apex._chartInstances.filter((function(t){return t.id===e}))[0];return i&&i.chart}}},{key:"initOnLoad",value:function(){for(var e=document.querySelectorAll("[data-apexcharts]"),i=0;i2?s-2:0),n=2;ndiv { + margin: 4px 0 +} + +.apexcharts-tooltip-box span.value { + font-weight: 700 +} + +.apexcharts-tooltip-rangebar { + padding: 5px 8px +} + +.apexcharts-tooltip-rangebar .category { + font-weight: 600; + color: #777 +} + +.apexcharts-tooltip-rangebar .series-name { + font-weight: 700; + display: block; + margin-bottom: 5px +} + +.apexcharts-xaxistooltip, +.apexcharts-yaxistooltip { + opacity: 0; + pointer-events: none; + color: #373d3f; + font-size: 13px; + text-align: center; + border-radius: 2px; + position: absolute; + z-index: 10; + background: #eceff1; + border: 1px solid #90a4ae +} + +.apexcharts-xaxistooltip { + padding: 9px 10px; + transition: .15s ease all +} + +.apexcharts-xaxistooltip.apexcharts-theme-dark { + background: rgba(0, 0, 0, .7); + border: 1px solid rgba(0, 0, 0, .5); + color: #fff +} + +.apexcharts-xaxistooltip:after, +.apexcharts-xaxistooltip:before { + left: 50%; + border: solid transparent; + content: " "; + height: 0; + width: 0; + position: absolute; + pointer-events: none +} + +.apexcharts-xaxistooltip:after { + border-color: transparent; + border-width: 6px; + margin-left: -6px +} + +.apexcharts-xaxistooltip:before { + border-color: transparent; + border-width: 7px; + margin-left: -7px +} + +.apexcharts-xaxistooltip-bottom:after, +.apexcharts-xaxistooltip-bottom:before { + bottom: 100% +} + +.apexcharts-xaxistooltip-top:after, +.apexcharts-xaxistooltip-top:before { + top: 100% +} + +.apexcharts-xaxistooltip-bottom:after { + border-bottom-color: #eceff1 +} + +.apexcharts-xaxistooltip-bottom:before { + border-bottom-color: #90a4ae +} + +.apexcharts-xaxistooltip-bottom.apexcharts-theme-dark:after, +.apexcharts-xaxistooltip-bottom.apexcharts-theme-dark:before { + border-bottom-color: rgba(0, 0, 0, .5) +} + +.apexcharts-xaxistooltip-top:after { + border-top-color: #eceff1 +} + +.apexcharts-xaxistooltip-top:before { + border-top-color: #90a4ae +} + +.apexcharts-xaxistooltip-top.apexcharts-theme-dark:after, +.apexcharts-xaxistooltip-top.apexcharts-theme-dark:before { + border-top-color: rgba(0, 0, 0, .5) +} + +.apexcharts-xaxistooltip.apexcharts-active { + opacity: 1; + transition: .15s ease all +} + +.apexcharts-yaxistooltip { + padding: 4px 10px +} + +.apexcharts-yaxistooltip.apexcharts-theme-dark { + background: rgba(0, 0, 0, .7); + border: 1px solid rgba(0, 0, 0, .5); + color: #fff +} + +.apexcharts-yaxistooltip:after, +.apexcharts-yaxistooltip:before { + top: 50%; + border: solid transparent; + content: " "; + height: 0; + width: 0; + position: absolute; + pointer-events: none +} + +.apexcharts-yaxistooltip:after { + border-color: transparent; + border-width: 6px; + margin-top: -6px +} + +.apexcharts-yaxistooltip:before { + border-color: transparent; + border-width: 7px; + margin-top: -7px +} + +.apexcharts-yaxistooltip-left:after, +.apexcharts-yaxistooltip-left:before { + left: 100% +} + +.apexcharts-yaxistooltip-right:after, +.apexcharts-yaxistooltip-right:before { + right: 100% +} + +.apexcharts-yaxistooltip-left:after { + border-left-color: #eceff1 +} + +.apexcharts-yaxistooltip-left:before { + border-left-color: #90a4ae +} + +.apexcharts-yaxistooltip-left.apexcharts-theme-dark:after, +.apexcharts-yaxistooltip-left.apexcharts-theme-dark:before { + border-left-color: rgba(0, 0, 0, .5) +} + +.apexcharts-yaxistooltip-right:after { + border-right-color: #eceff1 +} + +.apexcharts-yaxistooltip-right:before { + border-right-color: #90a4ae +} + +.apexcharts-yaxistooltip-right.apexcharts-theme-dark:after, +.apexcharts-yaxistooltip-right.apexcharts-theme-dark:before { + border-right-color: rgba(0, 0, 0, .5) +} + +.apexcharts-yaxistooltip.apexcharts-active { + opacity: 1 +} + +.apexcharts-yaxistooltip-hidden { + display: none +} + +.apexcharts-xcrosshairs, +.apexcharts-ycrosshairs { + pointer-events: none; + opacity: 0; + transition: .15s ease all +} + +.apexcharts-xcrosshairs.apexcharts-active, +.apexcharts-ycrosshairs.apexcharts-active { + opacity: 1; + transition: .15s ease all +} + +.apexcharts-ycrosshairs-hidden { + opacity: 0 +} + +.apexcharts-selection-rect { + cursor: move +} + +.svg_select_shape { + stroke-width: 1; + stroke-dasharray: 10 10; + stroke: black; + stroke-opacity: 0.1; + pointer-events: none; + fill: none; +} + +.svg_select_handle { + stroke-width: 3; + stroke: black; + fill: none; +} + +.svg_select_handle_r { + cursor: e-resize; +} + +.svg_select_handle_l { + cursor: w-resize; +} + +.apexcharts-svg.apexcharts-zoomable.hovering-zoom { + cursor: crosshair +} + +.apexcharts-svg.apexcharts-zoomable.hovering-pan { + cursor: move +} + +.apexcharts-menu-icon, +.apexcharts-pan-icon, +.apexcharts-reset-icon, +.apexcharts-selection-icon, +.apexcharts-toolbar-custom-icon, +.apexcharts-zoom-icon, +.apexcharts-zoomin-icon, +.apexcharts-zoomout-icon { + cursor: pointer; + width: 20px; + height: 20px; + line-height: 24px; + color: #6e8192; + text-align: center +} + +.apexcharts-menu-icon svg, +.apexcharts-reset-icon svg, +.apexcharts-zoom-icon svg, +.apexcharts-zoomin-icon svg, +.apexcharts-zoomout-icon svg { + fill: #6e8192 +} + +.apexcharts-selection-icon svg { + fill: #444; + transform: scale(.76) +} + +.apexcharts-theme-dark .apexcharts-menu-icon svg, +.apexcharts-theme-dark .apexcharts-pan-icon svg, +.apexcharts-theme-dark .apexcharts-reset-icon svg, +.apexcharts-theme-dark .apexcharts-selection-icon svg, +.apexcharts-theme-dark .apexcharts-toolbar-custom-icon svg, +.apexcharts-theme-dark .apexcharts-zoom-icon svg, +.apexcharts-theme-dark .apexcharts-zoomin-icon svg, +.apexcharts-theme-dark .apexcharts-zoomout-icon svg { + fill: #f3f4f5 +} + +.apexcharts-canvas .apexcharts-reset-zoom-icon.apexcharts-selected svg, +.apexcharts-canvas .apexcharts-selection-icon.apexcharts-selected svg, +.apexcharts-canvas .apexcharts-zoom-icon.apexcharts-selected svg { + fill: #008ffb +} + +.apexcharts-theme-light .apexcharts-menu-icon:hover svg, +.apexcharts-theme-light .apexcharts-reset-icon:hover svg, +.apexcharts-theme-light .apexcharts-selection-icon:not(.apexcharts-selected):hover svg, +.apexcharts-theme-light .apexcharts-zoom-icon:not(.apexcharts-selected):hover svg, +.apexcharts-theme-light .apexcharts-zoomin-icon:hover svg, +.apexcharts-theme-light .apexcharts-zoomout-icon:hover svg { + fill: #333 +} + +.apexcharts-menu-icon, +.apexcharts-selection-icon { + position: relative +} + +.apexcharts-reset-icon { + margin-left: 5px +} + +.apexcharts-menu-icon, +.apexcharts-reset-icon, +.apexcharts-zoom-icon { + transform: scale(.85) +} + +.apexcharts-zoomin-icon, +.apexcharts-zoomout-icon { + transform: scale(.7) +} + +.apexcharts-zoomout-icon { + margin-right: 3px +} + +.apexcharts-pan-icon { + transform: scale(.62); + position: relative; + left: 1px; + top: 0 +} + +.apexcharts-pan-icon svg { + fill: #fff; + stroke: #6e8192; + stroke-width: 2 +} + +.apexcharts-pan-icon.apexcharts-selected svg { + stroke: #008ffb +} + +.apexcharts-pan-icon:not(.apexcharts-selected):hover svg { + stroke: #333 +} + +.apexcharts-toolbar { + position: absolute; + z-index: 11; + max-width: 176px; + text-align: right; + border-radius: 3px; + padding: 0 6px 2px; + display: flex; + justify-content: space-between; + align-items: center +} + +.apexcharts-menu { + background: #fff; + position: absolute; + top: 100%; + border: 1px solid #ddd; + border-radius: 3px; + padding: 3px; + right: 10px; + opacity: 0; + min-width: 110px; + transition: .15s ease all; + pointer-events: none +} + +.apexcharts-menu.apexcharts-menu-open { + opacity: 1; + pointer-events: all; + transition: .15s ease all +} + +.apexcharts-menu-item { + padding: 6px 7px; + font-size: 12px; + cursor: pointer +} + +.apexcharts-theme-light .apexcharts-menu-item:hover { + background: #eee +} + +.apexcharts-theme-dark .apexcharts-menu { + background: rgba(0, 0, 0, .7); + color: #fff +} + +@media screen and (min-width:768px) { + .apexcharts-canvas:hover .apexcharts-toolbar { + opacity: 1 + } +} + +.apexcharts-canvas .apexcharts-element-hidden, +.apexcharts-datalabel.apexcharts-element-hidden, +.apexcharts-hide .apexcharts-series-points { + opacity: 0; +} + +.apexcharts-hidden-element-shown { + opacity: 1; + transition: 0.25s ease all; +} + +.apexcharts-datalabel, +.apexcharts-datalabel-label, +.apexcharts-datalabel-value, +.apexcharts-datalabels, +.apexcharts-pie-label { + cursor: default; + pointer-events: none +} + +.apexcharts-pie-label-delay { + opacity: 0; + animation-name: opaque; + animation-duration: .3s; + animation-fill-mode: forwards; + animation-timing-function: ease +} + +.apexcharts-radialbar-label { + cursor: pointer; +} + +.apexcharts-annotation-rect, +.apexcharts-area-series .apexcharts-area, +.apexcharts-gridline, +.apexcharts-line, +.apexcharts-point-annotation-label, +.apexcharts-radar-series path:not(.apexcharts-marker), +.apexcharts-radar-series polygon, +.apexcharts-toolbar svg, +.apexcharts-tooltip .apexcharts-marker, +.apexcharts-xaxis-annotation-label, +.apexcharts-yaxis-annotation-label, +.apexcharts-zoom-rect, +.no-pointer-events { + pointer-events: none +} + +.apexcharts-tooltip-active .apexcharts-marker { + transition: .15s ease all +} + +.apexcharts-radar-series .apexcharts-yaxis { + pointer-events: none; +} + +.resize-triggers { + animation: 1ms resizeanim; + visibility: hidden; + opacity: 0; + height: 100%; + width: 100%; + overflow: hidden +} + +.contract-trigger:before, +.resize-triggers, +.resize-triggers>div { + content: " "; + display: block; + position: absolute; + top: 0; + left: 0 +} + +.resize-triggers>div { + height: 100%; + width: 100%; + background: #eee; + overflow: auto +} + +.contract-trigger:before { + overflow: hidden; + width: 200%; + height: 200% +} + +.apexcharts-bar-goals-markers { + pointer-events: none +} + +.apexcharts-bar-shadows { + pointer-events: none +} + +.apexcharts-rangebar-goals-markers { + pointer-events: none +} \ No newline at end of file diff --git a/node_modules/apexcharts/dist/apexcharts.esm.js b/node_modules/apexcharts/dist/apexcharts.esm.js new file mode 100644 index 0000000..5196572 --- /dev/null +++ b/node_modules/apexcharts/dist/apexcharts.esm.js @@ -0,0 +1,38 @@ +/*! + * ApexCharts v4.5.0 + * (c) 2018-2025 ApexCharts + * Released under the MIT License. + */ +function t(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,a=Array(e);i=t.length?{done:!0}:{done:!1,value:t[a++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,n=!0,o=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return n=t.done,t},e:function(t){o=!0,r=t},f:function(){try{n||null==i.return||i.return()}finally{if(o)throw r}}}}function n(t){var i=c();return function(){var a,s=l(t);if(i){var r=l(this).constructor;a=Reflect.construct(s,arguments,r)}else a=s.apply(this,arguments);return function(t,i){if(i&&("object"==typeof i||"function"==typeof i))return i;if(void 0!==i)throw new TypeError("Derived constructors may only return object or undefined");return e(t)}(this,a)}}function o(t,e,i){return(e=x(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function l(t){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},l(t)}function h(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&g(t,e)}function c(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(c=function(){return!!t})()}function d(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,a)}return i}function u(t){for(var e=1;e>16,n=i>>8&255,o=255&i;return"#"+(16777216+65536*(Math.round((a-r)*s)+r)+256*(Math.round((a-n)*s)+n)+(Math.round((a-o)*s)+o)).toString(16).slice(1)}},{key:"shadeColor",value:function(e,i){return t.isColorHex(i)?this.shadeHexColor(e,i):this.shadeRGBColor(e,i)}}],[{key:"bind",value:function(t,e){return function(){return t.apply(e,arguments)}}},{key:"isObject",value:function(t){return t&&"object"===b(t)&&!Array.isArray(t)&&null!=t}},{key:"is",value:function(t,e){return Object.prototype.toString.call(e)==="[object "+t+"]"}},{key:"listToArray",value:function(t){var e,i=[];for(e=0;e1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if(null===t||"object"!==b(t))return t;if(i.has(t))return i.get(t);if(Array.isArray(t)){e=[],i.set(t,e);for(var a=0;a1&&void 0!==arguments[1]?arguments[1]:2;return Number.isInteger(t)?t:parseFloat(t.toPrecision(e))}},{key:"randomId",value:function(){return(Math.random()+1).toString(36).substring(4)}},{key:"noExponents",value:function(t){return t.toString().includes("e")?Math.round(t):t}},{key:"elementExists",value:function(t){return!(!t||!t.isConnected)}},{key:"getDimensions",value:function(t){var e=getComputedStyle(t,null),i=t.clientHeight,a=t.clientWidth;return i-=parseFloat(e.paddingTop)+parseFloat(e.paddingBottom),[a-=parseFloat(e.paddingLeft)+parseFloat(e.paddingRight),i]}},{key:"getBoundingClientRect",value:function(t){var e=t.getBoundingClientRect();return{top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:t.clientWidth,height:t.clientHeight,x:e.left,y:e.top}}},{key:"getLargestStringFromArr",value:function(t){return t.reduce((function(t,e){return Array.isArray(e)&&(e=e.reduce((function(t,e){return t.length>e.length?t:e}))),t.length>e.length?t:e}),0)}},{key:"hexToRgba",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"#999999",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.6;"#"!==t.substring(0,1)&&(t="#999999");var i=t.replace("#","");i=i.match(new RegExp("(.{"+i.length/3+"})","g"));for(var a=0;a1&&void 0!==arguments[1]?arguments[1]:"x",i=t.toString().slice();return i=i.replace(/[` ~!@#$%^&*()|+\=?;:'",.<>{}[\]\\/]/gi,e)}},{key:"negToZero",value:function(t){return t<0?0:t}},{key:"moveIndexInArray",value:function(t,e,i){if(i>=t.length)for(var a=i-t.length+1;a--;)t.push(void 0);return t.splice(i,0,t.splice(e,1)[0]),t}},{key:"extractNumber",value:function(t){return parseFloat(t.replace(/[^\d.]*/g,""))}},{key:"findAncestor",value:function(t,e){for(;(t=t.parentElement)&&!t.classList.contains(e););return t}},{key:"setELstyles",value:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t.style.key=e[i])}},{key:"preciseAddition",value:function(t,e){var i=(String(t).split(".")[1]||"").length,a=(String(e).split(".")[1]||"").length,s=Math.pow(10,Math.max(i,a));return(Math.round(t*s)+Math.round(e*s))/s}},{key:"isNumber",value:function(t){return!isNaN(t)&&parseFloat(Number(t))===t&&!isNaN(parseInt(t,10))}},{key:"isFloat",value:function(t){return Number(t)===t&&t%1!=0}},{key:"isMsEdge",value:function(){var t=window.navigator.userAgent,e=t.indexOf("Edge/");return e>0&&parseInt(t.substring(e+5,t.indexOf(".",e)),10)}},{key:"getGCD",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:7,a=Math.pow(10,i-Math.floor(Math.log10(Math.max(t,e))));for(t=Math.round(Math.abs(t)*a),e=Math.round(Math.abs(e)*a);e;){var s=e;e=t%e,t=s}return t/a}},{key:"getPrimeFactors",value:function(t){for(var e=[],i=2;t>=2;)t%i==0?(e.push(i),t/=i):i++;return e}},{key:"mod",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:7,a=Math.pow(10,i-Math.floor(Math.log10(Math.max(t,e))));return(t=Math.round(Math.abs(t)*a))%(e=Math.round(Math.abs(e)*a))/a}}]),t}(),y=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"animateLine",value:function(t,e,i,a){t.attr(e).animate(a).attr(i)}},{key:"animateMarker",value:function(t,e,i,a){t.attr({opacity:0}).animate(e).attr({opacity:1}).after((function(){a()}))}},{key:"animateRect",value:function(t,e,i,a,s){t.attr(e).animate(a).attr(i).after((function(){return s()}))}},{key:"animatePathsGradually",value:function(t){var e=t.el,i=t.realIndex,a=t.j,s=t.fill,r=t.pathFrom,n=t.pathTo,o=t.speed,l=t.delay,h=this.w,c=0;h.config.chart.animations.animateGradually.enabled&&(c=h.config.chart.animations.animateGradually.delay),h.config.chart.animations.dynamicAnimation.enabled&&h.globals.dataChanged&&"bar"!==h.config.chart.type&&(c=0),this.morphSVG(e,i,a,"line"!==h.config.chart.type||h.globals.comboCharts?s:"stroke",r,n,o,l*c)}},{key:"showDelayedElements",value:function(){this.w.globals.delayedElements.forEach((function(t){var e=t.el;e.classList.remove("apexcharts-element-hidden"),e.classList.add("apexcharts-hidden-element-shown")}))}},{key:"animationCompleted",value:function(t){var e=this.w;e.globals.animationEnded||(e.globals.animationEnded=!0,this.showDelayedElements(),"function"==typeof e.config.chart.events.animationEnd&&e.config.chart.events.animationEnd(this.ctx,{el:t,w:e}))}},{key:"morphSVG",value:function(t,e,i,a,s,r,n,o){var l=this,h=this.w;s||(s=t.attr("pathFrom")),r||(r=t.attr("pathTo"));var c=function(t){return"radar"===h.config.chart.type&&(n=1),"M 0 ".concat(h.globals.gridHeight)};(!s||s.indexOf("undefined")>-1||s.indexOf("NaN")>-1)&&(s=c()),(!r.trim()||r.indexOf("undefined")>-1||r.indexOf("NaN")>-1)&&(r=c()),h.globals.shouldAnimate||(n=1),t.plot(s).animate(1,o).plot(s).animate(n,o).plot(r).after((function(){v.isNumber(i)?i===h.globals.series[h.globals.maxValsInArrayIndex].length-2&&h.globals.shouldAnimate&&l.animationCompleted(t):"none"!==a&&h.globals.shouldAnimate&&(!h.globals.comboCharts&&e===h.globals.series.length-1||h.globals.comboCharts)&&l.animationCompleted(t),l.showDelayedElements()}))}}]),t}();const w={},k=[];function A(t,e){if(Array.isArray(t))for(const i of t)A(i,e);else if("object"!=typeof t)S(Object.getOwnPropertyNames(e)),w[t]=Object.assign(w[t]||{},e);else for(const e in t)A(e,t[e])}function C(t){return w[t]||{}}function S(t){k.push(...t)}function L(t,e){let i;const a=t.length,s=[];for(i=0;iz.has(t.nodeName),R=(t,e,i={})=>{const a={...e};for(const t in a)a[t].valueOf()===i[t]&&delete a[t];Object.keys(a).length?t.node.setAttribute("data-svgjs",JSON.stringify(a)):(t.node.removeAttribute("data-svgjs"),t.node.removeAttribute("svgjs:data"))},E="http://www.w3.org/2000/svg",Y="http://www.w3.org/2000/xmlns/",H="http://www.w3.org/1999/xlink",O={window:"undefined"==typeof window?null:window,document:"undefined"==typeof document?null:document};function F(){return O.window}let D=class{};const _={},N="___SYMBOL___ROOT___";function W(t,e=E){return O.document.createElementNS(e,t)}function B(t,e=!1){if(t instanceof D)return t;if("object"==typeof t)return U(t);if(null==t)return new _[N];if("string"==typeof t&&"<"!==t.charAt(0))return U(O.document.querySelector(t));const i=e?O.document.createElement("div"):W("svg");return i.innerHTML=t,t=U(i.firstChild),i.removeChild(i.firstChild),t}function G(t,e){return e&&(e instanceof O.window.Node||e.ownerDocument&&e instanceof e.ownerDocument.defaultView.Node)?e:W(t)}function V(t){if(!t)return null;if(t.instance instanceof D)return t.instance;if("#document-fragment"===t.nodeName)return new _.Fragment(t);let e=P(t.nodeName||"Dom");return"LinearGradient"===e||"RadialGradient"===e?e="Gradient":_[e]||(e="Dom"),new _[e](t)}let U=V;function q(t,e=t.name,i=!1){return _[e]=t,i&&(_[N]=t),S(Object.getOwnPropertyNames(t.prototype)),t}let Z=1e3;function $(t){return"Svgjs"+P(t)+Z++}function J(t){for(let e=t.children.length-1;e>=0;e--)J(t.children[e]);return t.id?(t.id=$(t.nodeName),t):t}function Q(t,e){let i,a;for(a=(t=Array.isArray(t)?t:[t]).length-1;a>=0;a--)for(i in e)t[a].prototype[i]=e[i]}function K(t){return function(...e){const i=e[e.length-1];return!i||i.constructor!==Object||i instanceof Array?t.apply(this,e):t.apply(this,e.slice(0,-1)).attr(i)}}A("Dom",{siblings:function(){return this.parent().children()},position:function(){return this.parent().index(this)},next:function(){return this.siblings()[this.position()+1]},prev:function(){return this.siblings()[this.position()-1]},forward:function(){const t=this.position();return this.parent().add(this.remove(),t+1),this},backward:function(){const t=this.position();return this.parent().add(this.remove(),t?t-1:0),this},front:function(){return this.parent().add(this.remove()),this},back:function(){return this.parent().add(this.remove(),0),this},before:function(t){(t=B(t)).remove();const e=this.position();return this.parent().add(t,e),this},after:function(t){(t=B(t)).remove();const e=this.position();return this.parent().add(t,e+1),this},insertBefore:function(t){return(t=B(t)).before(this),this},insertAfter:function(t){return(t=B(t)).after(this),this}});const tt=/^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i,et=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,it=/rgb\((\d+),(\d+),(\d+)\)/,at=/(#[a-z_][a-z0-9\-_]*)/i,st=/\)\s*,?\s*/,rt=/\s/g,nt=/^#[a-f0-9]{3}$|^#[a-f0-9]{6}$/i,ot=/^rgb\(/,lt=/^(\s+)?$/,ht=/^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ct=/\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i,dt=/[\s,]+/,ut=/[MLHVCSQTAZ]/i;function gt(t){const e=Math.round(t),i=Math.max(0,Math.min(255,e)).toString(16);return 1===i.length?"0"+i:i}function pt(t,e){for(let i=e.length;i--;)if(null==t[e[i]])return!1;return!0}function ft(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}A("Dom",{classes:function(){const t=this.attr("class");return null==t?[]:t.trim().split(dt)},hasClass:function(t){return-1!==this.classes().indexOf(t)},addClass:function(t){if(!this.hasClass(t)){const e=this.classes();e.push(t),this.attr("class",e.join(" "))}return this},removeClass:function(t){return this.hasClass(t)&&this.attr("class",this.classes().filter((function(e){return e!==t})).join(" ")),this},toggleClass:function(t){return this.hasClass(t)?this.removeClass(t):this.addClass(t)}}),A("Dom",{css:function(t,e){const i={};if(0===arguments.length)return this.node.style.cssText.split(/\s*;\s*/).filter((function(t){return!!t.length})).forEach((function(t){const e=t.split(/\s*:\s*/);i[e[0]]=e[1]})),i;if(arguments.length<2){if(Array.isArray(t)){for(const e of t){const t=e;i[e]=this.node.style.getPropertyValue(t)}return i}if("string"==typeof t)return this.node.style.getPropertyValue(t);if("object"==typeof t)for(const e in t)this.node.style.setProperty(e,null==t[e]||lt.test(t[e])?"":t[e])}return 2===arguments.length&&this.node.style.setProperty(t,null==e||lt.test(e)?"":e),this},show:function(){return this.css("display","")},hide:function(){return this.css("display","none")},visible:function(){return"none"!==this.css("display")}}),A("Dom",{data:function(t,e,i){if(null==t)return this.data(L(function(t,e){let i;const a=t.length,s=[];for(i=0;i0===t.nodeName.indexOf("data-"))),(t=>t.nodeName.slice(5))));if(t instanceof Array){const e={};for(const i of t)e[i]=this.data(i);return e}if("object"==typeof t)for(e in t)this.data(e,t[e]);else if(arguments.length<2)try{return JSON.parse(this.attr("data-"+t))}catch(e){return this.attr("data-"+t)}else this.attr("data-"+t,null===e?null:!0===i||"string"==typeof e||"number"==typeof e?e:JSON.stringify(e));return this}}),A("Dom",{remember:function(t,e){if("object"==typeof arguments[0])for(const e in t)this.remember(e,t[e]);else{if(1===arguments.length)return this.memory()[t];this.memory()[t]=e}return this},forget:function(){if(0===arguments.length)this._memory={};else for(let t=arguments.length-1;t>=0;t--)delete this.memory()[arguments[t]];return this},memory:function(){return this._memory=this._memory||{}}});class xt{constructor(...t){this.init(...t)}static isColor(t){return t&&(t instanceof xt||this.isRgb(t)||this.test(t))}static isRgb(t){return t&&"number"==typeof t.r&&"number"==typeof t.g&&"number"==typeof t.b}static random(t="vibrant",e){const{random:i,round:a,sin:s,PI:r}=Math;if("vibrant"===t){const t=24*i()+57,e=38*i()+45,a=360*i();return new xt(t,e,a,"lch")}if("sine"===t){const t=a(80*s(2*r*(e=null==e?i():e)/.5+.01)+150),n=a(50*s(2*r*e/.5+4.6)+200),o=a(100*s(2*r*e/.5+2.3)+150);return new xt(t,n,o)}if("pastel"===t){const t=8*i()+86,e=17*i()+9,a=360*i();return new xt(t,e,a,"lch")}if("dark"===t){const t=10+10*i(),e=50*i()+86,a=360*i();return new xt(t,e,a,"lch")}if("rgb"===t){const t=255*i(),e=255*i(),a=255*i();return new xt(t,e,a)}if("lab"===t){const t=100*i(),e=256*i()-128,a=256*i()-128;return new xt(t,e,a,"lab")}if("grey"===t){const t=255*i();return new xt(t,t,t)}throw new Error("Unsupported random color mode")}static test(t){return"string"==typeof t&&(nt.test(t)||ot.test(t))}cmyk(){const{_a:t,_b:e,_c:i}=this.rgb(),[a,s,r]=[t,e,i].map((t=>t/255)),n=Math.min(1-a,1-s,1-r);if(1===n)return new xt(0,0,0,1,"cmyk");return new xt((1-a-n)/(1-n),(1-s-n)/(1-n),(1-r-n)/(1-n),n,"cmyk")}hsl(){const{_a:t,_b:e,_c:i}=this.rgb(),[a,s,r]=[t,e,i].map((t=>t/255)),n=Math.max(a,s,r),o=Math.min(a,s,r),l=(n+o)/2,h=n===o,c=n-o;return new xt(360*(h?0:n===a?((s-r)/c+(s.5?c/(2-n-o):c/(n+o)),100*l,"hsl")}init(t=0,e=0,i=0,a=0,s="rgb"){if(t=t||0,this.space)for(const t in this.space)delete this[this.space[t]];if("number"==typeof t)s="string"==typeof a?a:s,a="string"==typeof a?0:a,Object.assign(this,{_a:t,_b:e,_c:i,_d:a,space:s});else if(t instanceof Array)this.space=e||("string"==typeof t[3]?t[3]:t[4])||"rgb",Object.assign(this,{_a:t[0],_b:t[1],_c:t[2],_d:t[3]||0});else if(t instanceof Object){const i=function(t,e){const i=pt(t,"rgb")?{_a:t.r,_b:t.g,_c:t.b,_d:0,space:"rgb"}:pt(t,"xyz")?{_a:t.x,_b:t.y,_c:t.z,_d:0,space:"xyz"}:pt(t,"hsl")?{_a:t.h,_b:t.s,_c:t.l,_d:0,space:"hsl"}:pt(t,"lab")?{_a:t.l,_b:t.a,_c:t.b,_d:0,space:"lab"}:pt(t,"lch")?{_a:t.l,_b:t.c,_c:t.h,_d:0,space:"lch"}:pt(t,"cmyk")?{_a:t.c,_b:t.m,_c:t.y,_d:t.k,space:"cmyk"}:{_a:0,_b:0,_c:0,space:"rgb"};return i.space=e||i.space,i}(t,e);Object.assign(this,i)}else if("string"==typeof t)if(ot.test(t)){const e=t.replace(rt,""),[i,a,s]=it.exec(e).slice(1,4).map((t=>parseInt(t)));Object.assign(this,{_a:i,_b:a,_c:s,_d:0,space:"rgb"})}else{if(!nt.test(t))throw Error("Unsupported string format, can't construct Color");{const e=t=>parseInt(t,16),[,i,a,s]=et.exec(function(t){return 4===t.length?["#",t.substring(1,2),t.substring(1,2),t.substring(2,3),t.substring(2,3),t.substring(3,4),t.substring(3,4)].join(""):t}(t)).map(e);Object.assign(this,{_a:i,_b:a,_c:s,_d:0,space:"rgb"})}}const{_a:r,_b:n,_c:o,_d:l}=this,h="rgb"===this.space?{r:r,g:n,b:o}:"xyz"===this.space?{x:r,y:n,z:o}:"hsl"===this.space?{h:r,s:n,l:o}:"lab"===this.space?{l:r,a:n,b:o}:"lch"===this.space?{l:r,c:n,h:o}:"cmyk"===this.space?{c:r,m:n,y:o,k:l}:{};Object.assign(this,h)}lab(){const{x:t,y:e,z:i}=this.xyz();return new xt(116*e-16,500*(t-e),200*(e-i),"lab")}lch(){const{l:t,a:e,b:i}=this.lab(),a=Math.sqrt(e**2+i**2);let s=180*Math.atan2(i,e)/Math.PI;s<0&&(s*=-1,s=360-s);return new xt(t,a,s,"lch")}rgb(){if("rgb"===this.space)return this;if("lab"===(t=this.space)||"xyz"===t||"lch"===t){let{x:t,y:e,z:i}=this;if("lab"===this.space||"lch"===this.space){let{l:a,a:s,b:r}=this;if("lch"===this.space){const{c:t,h:e}=this,i=Math.PI/180;s=t*Math.cos(i*e),r=t*Math.sin(i*e)}const n=(a+16)/116,o=s/500+n,l=n-r/200,h=16/116,c=.008856,d=7.787;t=.95047*(o**3>c?o**3:(o-h)/d),e=1*(n**3>c?n**3:(n-h)/d),i=1.08883*(l**3>c?l**3:(l-h)/d)}const a=3.2406*t+-1.5372*e+-.4986*i,s=-.9689*t+1.8758*e+.0415*i,r=.0557*t+-.204*e+1.057*i,n=Math.pow,o=.0031308,l=a>o?1.055*n(a,1/2.4)-.055:12.92*a,h=s>o?1.055*n(s,1/2.4)-.055:12.92*s,c=r>o?1.055*n(r,1/2.4)-.055:12.92*r;return new xt(255*l,255*h,255*c)}if("hsl"===this.space){let{h:t,s:e,l:i}=this;if(t/=360,e/=100,i/=100,0===e){i*=255;return new xt(i,i,i)}const a=i<.5?i*(1+e):i+e-i*e,s=2*i-a,r=255*ft(s,a,t+1/3),n=255*ft(s,a,t),o=255*ft(s,a,t-1/3);return new xt(r,n,o)}if("cmyk"===this.space){const{c:t,m:e,y:i,k:a}=this,s=255*(1-Math.min(1,t*(1-a)+a)),r=255*(1-Math.min(1,e*(1-a)+a)),n=255*(1-Math.min(1,i*(1-a)+a));return new xt(s,r,n)}return this;var t}toArray(){const{_a:t,_b:e,_c:i,_d:a,space:s}=this;return[t,e,i,a,s]}toHex(){const[t,e,i]=this._clamped().map(gt);return`#${t}${e}${i}`}toRgb(){const[t,e,i]=this._clamped();return`rgb(${t},${e},${i})`}toString(){return this.toHex()}xyz(){const{_a:t,_b:e,_c:i}=this.rgb(),[a,s,r]=[t,e,i].map((t=>t/255)),n=a>.04045?Math.pow((a+.055)/1.055,2.4):a/12.92,o=s>.04045?Math.pow((s+.055)/1.055,2.4):s/12.92,l=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92,h=(.4124*n+.3576*o+.1805*l)/.95047,c=(.2126*n+.7152*o+.0722*l)/1,d=(.0193*n+.1192*o+.9505*l)/1.08883,u=h>.008856?Math.pow(h,1/3):7.787*h+16/116,g=c>.008856?Math.pow(c,1/3):7.787*c+16/116,p=d>.008856?Math.pow(d,1/3):7.787*d+16/116;return new xt(u,g,p,"xyz")}_clamped(){const{_a:t,_b:e,_c:i}=this.rgb(),{max:a,min:s,round:r}=Math;return[t,e,i].map((t=>a(0,s(r(t),255))))}}class bt{constructor(...t){this.init(...t)}clone(){return new bt(this)}init(t,e){const i=0,a=0,s=Array.isArray(t)?{x:t[0],y:t[1]}:"object"==typeof t?{x:t.x,y:t.y}:{x:t,y:e};return this.x=null==s.x?i:s.x,this.y=null==s.y?a:s.y,this}toArray(){return[this.x,this.y]}transform(t){return this.clone().transformO(t)}transformO(t){vt.isMatrixLike(t)||(t=new vt(t));const{x:e,y:i}=this;return this.x=t.a*e+t.c*i+t.e,this.y=t.b*e+t.d*i+t.f,this}}function mt(t,e,i){return Math.abs(e-t)<(i||1e-6)}class vt{constructor(...t){this.init(...t)}static formatTransforms(t){const e="both"===t.flip||!0===t.flip,i=t.flip&&(e||"x"===t.flip)?-1:1,a=t.flip&&(e||"y"===t.flip)?-1:1,s=t.skew&&t.skew.length?t.skew[0]:isFinite(t.skew)?t.skew:isFinite(t.skewX)?t.skewX:0,r=t.skew&&t.skew.length?t.skew[1]:isFinite(t.skew)?t.skew:isFinite(t.skewY)?t.skewY:0,n=t.scale&&t.scale.length?t.scale[0]*i:isFinite(t.scale)?t.scale*i:isFinite(t.scaleX)?t.scaleX*i:i,o=t.scale&&t.scale.length?t.scale[1]*a:isFinite(t.scale)?t.scale*a:isFinite(t.scaleY)?t.scaleY*a:a,l=t.shear||0,h=t.rotate||t.theta||0,c=new bt(t.origin||t.around||t.ox||t.originX,t.oy||t.originY),d=c.x,u=c.y,g=new bt(t.position||t.px||t.positionX||NaN,t.py||t.positionY||NaN),p=g.x,f=g.y,x=new bt(t.translate||t.tx||t.translateX,t.ty||t.translateY),b=x.x,m=x.y,v=new bt(t.relative||t.rx||t.relativeX,t.ry||t.relativeY);return{scaleX:n,scaleY:o,skewX:s,skewY:r,shear:l,theta:h,rx:v.x,ry:v.y,tx:b,ty:m,ox:d,oy:u,px:p,py:f}}static fromArray(t){return{a:t[0],b:t[1],c:t[2],d:t[3],e:t[4],f:t[5]}}static isMatrixLike(t){return null!=t.a||null!=t.b||null!=t.c||null!=t.d||null!=t.e||null!=t.f}static matrixMultiply(t,e,i){const a=t.a*e.a+t.c*e.b,s=t.b*e.a+t.d*e.b,r=t.a*e.c+t.c*e.d,n=t.b*e.c+t.d*e.d,o=t.e+t.a*e.e+t.c*e.f,l=t.f+t.b*e.e+t.d*e.f;return i.a=a,i.b=s,i.c=r,i.d=n,i.e=o,i.f=l,i}around(t,e,i){return this.clone().aroundO(t,e,i)}aroundO(t,e,i){const a=t||0,s=e||0;return this.translateO(-a,-s).lmultiplyO(i).translateO(a,s)}clone(){return new vt(this)}decompose(t=0,e=0){const i=this.a,a=this.b,s=this.c,r=this.d,n=this.e,o=this.f,l=i*r-a*s,h=l>0?1:-1,c=h*Math.sqrt(i*i+a*a),d=Math.atan2(h*a,h*i),u=180/Math.PI*d,g=Math.cos(d),p=Math.sin(d),f=(i*s+a*r)/l,x=s*c/(f*i-a)||r*c/(f*a+i);return{scaleX:c,scaleY:x,shear:f,rotate:u,translateX:n-t+t*g*c+e*(f*g*c-p*x),translateY:o-e+t*p*c+e*(f*p*c+g*x),originX:t,originY:e,a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}equals(t){if(t===this)return!0;const e=new vt(t);return mt(this.a,e.a)&&mt(this.b,e.b)&&mt(this.c,e.c)&&mt(this.d,e.d)&&mt(this.e,e.e)&&mt(this.f,e.f)}flip(t,e){return this.clone().flipO(t,e)}flipO(t,e){return"x"===t?this.scaleO(-1,1,e,0):"y"===t?this.scaleO(1,-1,0,e):this.scaleO(-1,-1,t,e||t)}init(t){const e=vt.fromArray([1,0,0,1,0,0]);return t=t instanceof Gt?t.matrixify():"string"==typeof t?vt.fromArray(t.split(dt).map(parseFloat)):Array.isArray(t)?vt.fromArray(t):"object"==typeof t&&vt.isMatrixLike(t)?t:"object"==typeof t?(new vt).transform(t):6===arguments.length?vt.fromArray([].slice.call(arguments)):e,this.a=null!=t.a?t.a:e.a,this.b=null!=t.b?t.b:e.b,this.c=null!=t.c?t.c:e.c,this.d=null!=t.d?t.d:e.d,this.e=null!=t.e?t.e:e.e,this.f=null!=t.f?t.f:e.f,this}inverse(){return this.clone().inverseO()}inverseO(){const t=this.a,e=this.b,i=this.c,a=this.d,s=this.e,r=this.f,n=t*a-e*i;if(!n)throw new Error("Cannot invert "+this);const o=a/n,l=-e/n,h=-i/n,c=t/n,d=-(o*s+h*r),u=-(l*s+c*r);return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}lmultiply(t){return this.clone().lmultiplyO(t)}lmultiplyO(t){const e=t instanceof vt?t:new vt(t);return vt.matrixMultiply(e,this,this)}multiply(t){return this.clone().multiplyO(t)}multiplyO(t){const e=t instanceof vt?t:new vt(t);return vt.matrixMultiply(this,e,this)}rotate(t,e,i){return this.clone().rotateO(t,e,i)}rotateO(t,e=0,i=0){t=M(t);const a=Math.cos(t),s=Math.sin(t),{a:r,b:n,c:o,d:l,e:h,f:c}=this;return this.a=r*a-n*s,this.b=n*a+r*s,this.c=o*a-l*s,this.d=l*a+o*s,this.e=h*a-c*s+i*s-e*a+e,this.f=c*a+h*s-e*s-i*a+i,this}scale(){return this.clone().scaleO(...arguments)}scaleO(t,e=t,i=0,a=0){3===arguments.length&&(a=i,i=e,e=t);const{a:s,b:r,c:n,d:o,e:l,f:h}=this;return this.a=s*t,this.b=r*e,this.c=n*t,this.d=o*e,this.e=l*t-i*t+i,this.f=h*e-a*e+a,this}shear(t,e,i){return this.clone().shearO(t,e,i)}shearO(t,e=0,i=0){const{a:a,b:s,c:r,d:n,e:o,f:l}=this;return this.a=a+s*t,this.c=r+n*t,this.e=o+l*t-i*t,this}skew(){return this.clone().skewO(...arguments)}skewO(t,e=t,i=0,a=0){3===arguments.length&&(a=i,i=e,e=t),t=M(t),e=M(e);const s=Math.tan(t),r=Math.tan(e),{a:n,b:o,c:l,d:h,e:c,f:d}=this;return this.a=n+o*s,this.b=o+n*r,this.c=l+h*s,this.d=h+l*r,this.e=c+d*s-a*s,this.f=d+c*r-i*r,this}skewX(t,e,i){return this.skew(t,0,e,i)}skewY(t,e,i){return this.skew(0,t,e,i)}toArray(){return[this.a,this.b,this.c,this.d,this.e,this.f]}toString(){return"matrix("+this.a+","+this.b+","+this.c+","+this.d+","+this.e+","+this.f+")"}transform(t){if(vt.isMatrixLike(t)){return new vt(t).multiplyO(this)}const e=vt.formatTransforms(t),{x:i,y:a}=new bt(e.ox,e.oy).transform(this),s=(new vt).translateO(e.rx,e.ry).lmultiplyO(this).translateO(-i,-a).scaleO(e.scaleX,e.scaleY).skewO(e.skewX,e.skewY).shearO(e.shear).rotateO(e.theta).translateO(i,a);if(isFinite(e.px)||isFinite(e.py)){const t=new bt(i,a).transform(s),r=isFinite(e.px)?e.px-t.x:0,n=isFinite(e.py)?e.py-t.y:0;s.translateO(r,n)}return s.translateO(e.tx,e.ty),s}translate(t,e){return this.clone().translateO(t,e)}translateO(t,e){return this.e+=t||0,this.f+=e||0,this}valueOf(){return{a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}}function yt(){if(!yt.nodes){const t=B().size(2,0);t.node.style.cssText=["opacity: 0","position: absolute","left: -100%","top: -100%","overflow: hidden"].join(";"),t.attr("focusable","false"),t.attr("aria-hidden","true");const e=t.path().node;yt.nodes={svg:t,path:e}}if(!yt.nodes.svg.node.parentNode){const t=O.document.body||O.document.documentElement;yt.nodes.svg.addTo(t)}return yt.nodes}function wt(t){return!(t.width||t.height||t.x||t.y)}q(vt,"Matrix");class kt{constructor(...t){this.init(...t)}addOffset(){return this.x+=O.window.pageXOffset,this.y+=O.window.pageYOffset,new kt(this)}init(t){return t="string"==typeof t?t.split(dt).map(parseFloat):Array.isArray(t)?t:"object"==typeof t?[null!=t.left?t.left:t.x,null!=t.top?t.top:t.y,t.width,t.height]:4===arguments.length?[].slice.call(arguments):[0,0,0,0],this.x=t[0]||0,this.y=t[1]||0,this.width=this.w=t[2]||0,this.height=this.h=t[3]||0,this.x2=this.x+this.w,this.y2=this.y+this.h,this.cx=this.x+this.w/2,this.cy=this.y+this.h/2,this}isNulled(){return wt(this)}merge(t){const e=Math.min(this.x,t.x),i=Math.min(this.y,t.y),a=Math.max(this.x+this.width,t.x+t.width)-e,s=Math.max(this.y+this.height,t.y+t.height)-i;return new kt(e,i,a,s)}toArray(){return[this.x,this.y,this.width,this.height]}toString(){return this.x+" "+this.y+" "+this.width+" "+this.height}transform(t){t instanceof vt||(t=new vt(t));let e=1/0,i=-1/0,a=1/0,s=-1/0;return[new bt(this.x,this.y),new bt(this.x2,this.y),new bt(this.x,this.y2),new bt(this.x2,this.y2)].forEach((function(r){r=r.transform(t),e=Math.min(e,r.x),i=Math.max(i,r.x),a=Math.min(a,r.y),s=Math.max(s,r.y)})),new kt(e,a,i-e,s-a)}}function At(t,e,i){let a;try{if(a=e(t.node),wt(a)&&((s=t.node)!==O.document&&!(O.document.documentElement.contains||function(t){for(;t.parentNode;)t=t.parentNode;return t===O.document}).call(O.document.documentElement,s)))throw new Error("Element not in the dom")}catch(e){a=i(t)}var s;return a}A({viewbox:{viewbox(t,e,i,a){return null==t?new kt(this.attr("viewBox")):this.attr("viewBox",new kt(t,e,i,a))},zoom(t,e){let{width:i,height:a}=this.attr(["width","height"]);if((i||a)&&"string"!=typeof i&&"string"!=typeof a||(i=this.node.clientWidth,a=this.node.clientHeight),!i||!a)throw new Error("Impossible to get absolute width and height. Please provide an absolute width and height attribute on the zooming element");const s=this.viewbox(),r=i/s.width,n=a/s.height,o=Math.min(r,n);if(null==t)return o;let l=o/t;l===1/0&&(l=Number.MAX_SAFE_INTEGER/100),e=e||new bt(i/2/r+s.x,a/2/n+s.y);const h=new kt(s).transform(new vt({scale:l,origin:e}));return this.viewbox(h)}}}),q(kt,"Box");class Ct extends Array{constructor(t=[],...e){if(super(t,...e),"number"==typeof t)return this;this.length=0,this.push(...t)}}Q([Ct],{each(t,...e){return"function"==typeof t?this.map(((e,i,a)=>t.call(e,e,i,a))):this.map((i=>i[t](...e)))},toArray(){return Array.prototype.concat.apply([],this)}});const St=["toArray","constructor","each"];function Lt(t,e){return new Ct(L((e||O.document).querySelectorAll(t),(function(t){return V(t)})))}Ct.extend=function(t){t=t.reduce(((t,e)=>(St.includes(e)||"_"===e[0]||(e in Array.prototype&&(t["$"+e]=Array.prototype[e]),t[e]=function(...t){return this.each(e,...t)}),t)),{}),Q([Ct],t)};let Mt=0;const Pt={};function It(t){let e=t.getEventHolder();return e===O.window&&(e=Pt),e.events||(e.events={}),e.events}function Tt(t){return t.getEventTarget()}function zt(t,e,i,a,s){const r=i.bind(a||t),n=B(t),o=It(n),l=Tt(n);e=Array.isArray(e)?e:e.split(dt),i._svgjsListenerId||(i._svgjsListenerId=++Mt),e.forEach((function(t){const e=t.split(".")[0],a=t.split(".")[1]||"*";o[e]=o[e]||{},o[e][a]=o[e][a]||{},o[e][a][i._svgjsListenerId]=r,l.addEventListener(e,r,s||!1)}))}function Xt(t,e,i,a){const s=B(t),r=It(s),n=Tt(s);("function"!=typeof i||(i=i._svgjsListenerId))&&(e=Array.isArray(e)?e:(e||"").split(dt)).forEach((function(t){const e=t&&t.split(".")[0],o=t&&t.split(".")[1];let l,h;if(i)r[e]&&r[e][o||"*"]&&(n.removeEventListener(e,r[e][o||"*"][i],a||!1),delete r[e][o||"*"][i]);else if(e&&o){if(r[e]&&r[e][o]){for(h in r[e][o])Xt(n,[e,o].join("."),h);delete r[e][o]}}else if(o)for(t in r)for(l in r[t])o===l&&Xt(n,[t,o].join("."));else if(e){if(r[e]){for(l in r[e])Xt(n,[e,l].join("."));delete r[e]}}else{for(t in r)Xt(n,t);!function(t){let e=t.getEventHolder();e===O.window&&(e=Pt),e.events&&(e.events={})}(s)}}))}class Rt extends D{addEventListener(){}dispatch(t,e,i){return function(t,e,i,a){const s=Tt(t);return e instanceof O.window.Event||(e=new O.window.CustomEvent(e,{detail:i,cancelable:!0,...a})),s.dispatchEvent(e),e}(this,t,e,i)}dispatchEvent(t){const e=this.getEventHolder().events;if(!e)return!0;const i=e[t.type];for(const e in i)for(const a in i[e])i[e][a](t);return!t.defaultPrevented}fire(t,e,i){return this.dispatch(t,e,i),this}getEventHolder(){return this}getEventTarget(){return this}off(t,e,i){return Xt(this,t,e,i),this}on(t,e,i,a){return zt(this,t,e,i,a),this}removeEventListener(){}}function Et(){}q(Rt,"EventTarget");const Yt=400,Ht=">",Ot=0,Ft={"fill-opacity":1,"stroke-opacity":1,"stroke-width":0,"stroke-linejoin":"miter","stroke-linecap":"butt",fill:"#000000",stroke:"#000000",opacity:1,x:0,y:0,cx:0,cy:0,width:0,height:0,r:0,rx:0,ry:0,offset:0,"stop-opacity":1,"stop-color":"#000000","text-anchor":"start"};class Dt extends Array{constructor(...t){super(...t),this.init(...t)}clone(){return new this.constructor(this)}init(t){return"number"==typeof t||(this.length=0,this.push(...this.parse(t))),this}parse(t=[]){return t instanceof Array?t:t.trim().split(dt).map(parseFloat)}toArray(){return Array.prototype.concat.apply([],this)}toSet(){return new Set(this)}toString(){return this.join(" ")}valueOf(){const t=[];return t.push(...this),t}}class _t{constructor(...t){this.init(...t)}convert(t){return new _t(this.value,t)}divide(t){return t=new _t(t),new _t(this/t,this.unit||t.unit)}init(t,e){return e=Array.isArray(t)?t[1]:e,t=Array.isArray(t)?t[0]:t,this.value=0,this.unit=e||"","number"==typeof t?this.value=isNaN(t)?0:isFinite(t)?t:t<0?-34e37:34e37:"string"==typeof t?(e=t.match(tt))&&(this.value=parseFloat(e[1]),"%"===e[5]?this.value/=100:"s"===e[5]&&(this.value*=1e3),this.unit=e[5]):t instanceof _t&&(this.value=t.valueOf(),this.unit=t.unit),this}minus(t){return t=new _t(t),new _t(this-t,this.unit||t.unit)}plus(t){return t=new _t(t),new _t(this+t,this.unit||t.unit)}times(t){return t=new _t(t),new _t(this*t,this.unit||t.unit)}toArray(){return[this.value,this.unit]}toJSON(){return this.toString()}toString(){return("%"===this.unit?~~(1e8*this.value)/1e6:"s"===this.unit?this.value/1e3:this.value)+this.unit}valueOf(){return this.value}}const Nt=new Set(["fill","stroke","color","bgcolor","stop-color","flood-color","lighting-color"]),Wt=[];class Bt extends Rt{constructor(t,e){super(),this.node=t,this.type=t.nodeName,e&&t!==e&&this.attr(e)}add(t,e){return(t=B(t)).removeNamespace&&this.node instanceof O.window.SVGElement&&t.removeNamespace(),null==e?this.node.appendChild(t.node):t.node!==this.node.childNodes[e]&&this.node.insertBefore(t.node,this.node.childNodes[e]),this}addTo(t,e){return B(t).put(this,e)}children(){return new Ct(L(this.node.children,(function(t){return V(t)})))}clear(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return this}clone(t=!0,e=!0){this.writeDataToDom();let i=this.node.cloneNode(t);return e&&(i=J(i)),new this.constructor(i)}each(t,e){const i=this.children();let a,s;for(a=0,s=i.length;a=0}html(t,e){return this.xml(t,e,"http://www.w3.org/1999/xhtml")}id(t){return void 0!==t||this.node.id||(this.node.id=$(this.type)),this.attr("id",t)}index(t){return[].slice.call(this.node.childNodes).indexOf(t.node)}last(){return V(this.node.lastChild)}matches(t){const e=this.node,i=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector||null;return i&&i.call(e,t)}parent(t){let e=this;if(!e.node.parentNode)return null;if(e=V(e.node.parentNode),!t)return e;do{if("string"==typeof t?e.matches(t):e instanceof t)return e}while(e=V(e.node.parentNode));return e}put(t,e){return t=B(t),this.add(t,e),t}putIn(t,e){return B(t).add(this,e)}remove(){return this.parent()&&this.parent().removeElement(this),this}removeElement(t){return this.node.removeChild(t.node),this}replace(t){return t=B(t),this.node.parentNode&&this.node.parentNode.replaceChild(t.node,this.node),t}round(t=2,e=null){const i=10**t,a=this.attr(e);for(const t in a)"number"==typeof a[t]&&(a[t]=Math.round(a[t]*i)/i);return this.attr(a),this}svg(t,e){return this.xml(t,e,E)}toString(){return this.id()}words(t){return this.node.textContent=t,this}wrap(t){const e=this.parent();if(!e)return this.addTo(t);const i=e.index(this);return e.put(t,i).put(this)}writeDataToDom(){return this.each((function(){this.writeDataToDom()})),this}xml(t,e,i){if("boolean"==typeof t&&(i=e,e=t,t=null),null==t||"function"==typeof t){e=null==e||e,this.writeDataToDom();let i=this;if(null!=t){if(i=V(i.node.cloneNode(!0)),e){const e=t(i);if(i=e||i,!1===e)return""}i.each((function(){const e=t(this),i=e||this;!1===e?this.remove():e&&this!==i&&this.replace(i)}),!0)}return e?i.node.outerHTML:i.node.innerHTML}e=null!=e&&e;const a=W("wrapper",i),s=O.document.createDocumentFragment();a.innerHTML=t;for(let t=a.children.length;t--;)s.appendChild(a.firstElementChild);const r=this.parent();return e?this.replace(s)&&r:this.add(s)}}Q(Bt,{attr:function(t,e,i){if(null==t){t={},e=this.node.attributes;for(const i of e)t[i.nodeName]=ht.test(i.nodeValue)?parseFloat(i.nodeValue):i.nodeValue;return t}if(t instanceof Array)return t.reduce(((t,e)=>(t[e]=this.attr(e),t)),{});if("object"==typeof t&&t.constructor===Object)for(e in t)this.attr(e,t[e]);else if(null===e)this.node.removeAttribute(t);else{if(null==e)return null==(e=this.node.getAttribute(t))?Ft[t]:ht.test(e)?parseFloat(e):e;"number"==typeof(e=Wt.reduce(((e,i)=>i(t,e,this)),e))?e=new _t(e):Nt.has(t)&&xt.isColor(e)?e=new xt(e):e.constructor===Array&&(e=new Dt(e)),"leading"===t?this.leading&&this.leading(e):"string"==typeof i?this.node.setAttributeNS(i,t,e.toString()):this.node.setAttribute(t,e.toString()),!this.rebuild||"font-size"!==t&&"x"!==t||this.rebuild()}return this},find:function(t){return Lt(t,this.node)},findOne:function(t){return V(this.node.querySelector(t))}}),q(Bt,"Dom");let Gt=class extends Bt{constructor(t,e){super(t,e),this.dom={},this.node.instance=this,(t.hasAttribute("data-svgjs")||t.hasAttribute("svgjs:data"))&&this.setData(JSON.parse(t.getAttribute("data-svgjs"))??JSON.parse(t.getAttribute("svgjs:data"))??{})}center(t,e){return this.cx(t).cy(e)}cx(t){return null==t?this.x()+this.width()/2:this.x(t-this.width()/2)}cy(t){return null==t?this.y()+this.height()/2:this.y(t-this.height()/2)}defs(){const t=this.root();return t&&t.defs()}dmove(t,e){return this.dx(t).dy(e)}dx(t=0){return this.x(new _t(t).plus(this.x()))}dy(t=0){return this.y(new _t(t).plus(this.y()))}getEventHolder(){return this}height(t){return this.attr("height",t)}move(t,e){return this.x(t).y(e)}parents(t=this.root()){const e="string"==typeof t;e||(t=B(t));const i=new Ct;let a=this;for(;(a=a.parent())&&a.node!==O.document&&"#document-fragment"!==a.nodeName&&(i.push(a),e||a.node!==t.node)&&(!e||!a.matches(t));)if(a.node===this.root().node)return null;return i}reference(t){if(!(t=this.attr(t)))return null;const e=(t+"").match(at);return e?B(e[1]):null}root(){const t=this.parent(function(t){return _[t]}(N));return t&&t.root()}setData(t){return this.dom=t,this}size(t,e){const i=I(this,t,e);return this.width(new _t(i.width)).height(new _t(i.height))}width(t){return this.attr("width",t)}writeDataToDom(){return R(this,this.dom),super.writeDataToDom()}x(t){return this.attr("x",t)}y(t){return this.attr("y",t)}};Q(Gt,{bbox:function(){const t=At(this,(t=>t.getBBox()),(t=>{try{const e=t.clone().addTo(yt().svg).show(),i=e.node.getBBox();return e.remove(),i}catch(e){throw new Error(`Getting bbox of element "${t.node.nodeName}" is not possible: ${e.toString()}`)}}));return new kt(t)},rbox:function(t){const e=At(this,(t=>t.getBoundingClientRect()),(t=>{throw new Error(`Getting rbox of element "${t.node.nodeName}" is not possible`)})),i=new kt(e);return t?i.transform(t.screenCTM().inverseO()):i.addOffset()},inside:function(t,e){const i=this.bbox();return t>i.x&&e>i.y&&t=0;i--)null!=e[jt[t][i]]&&this.attr(jt.prefix(t,jt[t][i]),e[jt[t][i]]);return this},A(["Element","Runner"],e)})),A(["Element","Runner"],{matrix:function(t,e,i,a,s,r){return null==t?new vt(this):this.attr("transform",new vt(t,e,i,a,s,r))},rotate:function(t,e,i){return this.transform({rotate:t,ox:e,oy:i},!0)},skew:function(t,e,i,a){return 1===arguments.length||3===arguments.length?this.transform({skew:t,ox:e,oy:i},!0):this.transform({skew:[t,e],ox:i,oy:a},!0)},shear:function(t,e,i){return this.transform({shear:t,ox:e,oy:i},!0)},scale:function(t,e,i,a){return 1===arguments.length||3===arguments.length?this.transform({scale:t,ox:e,oy:i},!0):this.transform({scale:[t,e],ox:i,oy:a},!0)},translate:function(t,e){return this.transform({translate:[t,e]},!0)},relative:function(t,e){return this.transform({relative:[t,e]},!0)},flip:function(t="both",e="center"){return-1==="xybothtrue".indexOf(t)&&(e=t,t="both"),this.transform({flip:t,origin:e},!0)},opacity:function(t){return this.attr("opacity",t)}}),A("radius",{radius:function(t,e=t){return"radialGradient"===(this._element||this).type?this.attr("r",new _t(t)):this.rx(t).ry(e)}}),A("Path",{length:function(){return this.node.getTotalLength()},pointAt:function(t){return new bt(this.node.getPointAtLength(t))}}),A(["Element","Runner"],{font:function(t,e){if("object"==typeof t){for(e in t)this.font(e,t[e]);return this}return"leading"===t?this.leading(e):"anchor"===t?this.attr("text-anchor",e):"size"===t||"family"===t||"weight"===t||"stretch"===t||"variant"===t||"style"===t?this.attr("font-"+t,e):this.attr(t,e)}});A("Element",["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","mouseenter","mouseleave","touchstart","touchmove","touchleave","touchend","touchcancel","contextmenu","wheel","pointerdown","pointermove","pointerup","pointerleave","pointercancel"].reduce((function(t,e){return t[e]=function(t){return null===t?this.off(e):this.on(e,t),this},t}),{})),A("Element",{untransform:function(){return this.attr("transform",null)},matrixify:function(){const t=(this.attr("transform")||"").split(st).slice(0,-1).map((function(t){const e=t.trim().split("(");return[e[0],e[1].split(dt).map((function(t){return parseFloat(t)}))]})).reverse().reduce((function(t,e){return"matrix"===e[0]?t.lmultiply(vt.fromArray(e[1])):t[e[0]].apply(t,e[1])}),new vt);return t},toParent:function(t,e){if(this===t)return this;if(X(this.node))return this.addTo(t,e);const i=this.screenCTM(),a=t.screenCTM().inverse();return this.addTo(t,e).untransform().transform(a.multiply(i)),this},toRoot:function(t){return this.toParent(this.root(),t)},transform:function(t,e){if(null==t||"string"==typeof t){const e=new vt(this).decompose();return null==t?e:e[t]}vt.isMatrixLike(t)||(t={...t,origin:T(t,this)});const i=new vt(!0===e?this:e||!1).transform(t);return this.attr("transform",i)}});class Vt extends Gt{flatten(){return this.each((function(){if(this instanceof Vt)return this.flatten().ungroup()})),this}ungroup(t=this.parent(),e=t.index(this)){return e=-1===e?t.children().length:e,this.each((function(i,a){return a[a.length-i-1].toParent(t,e)})),this.remove()}}q(Vt,"Container");class Ut extends Vt{constructor(t,e=t){super(G("defs",t),e)}flatten(){return this}ungroup(){return this}}q(Ut,"Defs");class qt extends Gt{}function Zt(t){return this.attr("rx",t)}function $t(t){return this.attr("ry",t)}function Jt(t){return null==t?this.cx()-this.rx():this.cx(t+this.rx())}function Qt(t){return null==t?this.cy()-this.ry():this.cy(t+this.ry())}function Kt(t){return this.attr("cx",t)}function te(t){return this.attr("cy",t)}function ee(t){return null==t?2*this.rx():this.rx(new _t(t).divide(2))}function ie(t){return null==t?2*this.ry():this.ry(new _t(t).divide(2))}q(qt,"Shape");var ae=Object.freeze({__proto__:null,cx:Kt,cy:te,height:ie,rx:Zt,ry:$t,width:ee,x:Jt,y:Qt});class se extends qt{constructor(t,e=t){super(G("ellipse",t),e)}size(t,e){const i=I(this,t,e);return this.rx(new _t(i.width).divide(2)).ry(new _t(i.height).divide(2))}}Q(se,ae),A("Container",{ellipse:K((function(t=0,e=t){return this.put(new se).size(t,e).move(0,0)}))}),q(se,"Ellipse");class re extends Bt{constructor(t=O.document.createDocumentFragment()){super(t)}xml(t,e,i){if("boolean"==typeof t&&(i=e,e=t,t=null),null==t||"function"==typeof t){const t=new Bt(W("wrapper",i));return t.add(this.node.cloneNode(!0)),t.xml(!1,i)}return super.xml(t,!1,i)}}function ne(t,e){return"radialGradient"===(this._element||this).type?this.attr({fx:new _t(t),fy:new _t(e)}):this.attr({x1:new _t(t),y1:new _t(e)})}function oe(t,e){return"radialGradient"===(this._element||this).type?this.attr({cx:new _t(t),cy:new _t(e)}):this.attr({x2:new _t(t),y2:new _t(e)})}q(re,"Fragment");var le=Object.freeze({__proto__:null,from:ne,to:oe});class he extends Vt{constructor(t,e){super(G(t+"Gradient","string"==typeof t?null:t),e)}attr(t,e,i){return"transform"===t&&(t="gradientTransform"),super.attr(t,e,i)}bbox(){return new kt}targets(){return Lt("svg [fill*="+this.id()+"]")}toString(){return this.url()}update(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}url(){return"url(#"+this.id()+")"}}Q(he,le),A({Container:{gradient(...t){return this.defs().gradient(...t)}},Defs:{gradient:K((function(t,e){return this.put(new he(t)).update(e)}))}}),q(he,"Gradient");class ce extends Vt{constructor(t,e=t){super(G("pattern",t),e)}attr(t,e,i){return"transform"===t&&(t="patternTransform"),super.attr(t,e,i)}bbox(){return new kt}targets(){return Lt("svg [fill*="+this.id()+"]")}toString(){return this.url()}update(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}url(){return"url(#"+this.id()+")"}}A({Container:{pattern(...t){return this.defs().pattern(...t)}},Defs:{pattern:K((function(t,e,i){return this.put(new ce).update(i).attr({x:0,y:0,width:t,height:e,patternUnits:"userSpaceOnUse"})}))}}),q(ce,"Pattern");let de=class extends qt{constructor(t,e=t){super(G("image",t),e)}load(t,e){if(!t)return this;const i=new O.window.Image;return zt(i,"load",(function(t){const a=this.parent(ce);0===this.width()&&0===this.height()&&this.size(i.width,i.height),a instanceof ce&&0===a.width()&&0===a.height()&&a.size(this.width(),this.height()),"function"==typeof e&&e.call(this,t)}),this),zt(i,"load error",(function(){Xt(i)})),this.attr("href",i.src=t,H)}};var ue;ue=function(t,e,i){return"fill"!==t&&"stroke"!==t||ct.test(e)&&(e=i.root().defs().image(e)),e instanceof de&&(e=i.root().defs().pattern(0,0,(t=>{t.add(e)}))),e},Wt.push(ue),A({Container:{image:K((function(t,e){return this.put(new de).size(0,0).load(t,e)}))}}),q(de,"Image");class ge extends Dt{bbox(){let t=-1/0,e=-1/0,i=1/0,a=1/0;return this.forEach((function(s){t=Math.max(s[0],t),e=Math.max(s[1],e),i=Math.min(s[0],i),a=Math.min(s[1],a)})),new kt(i,a,t-i,e-a)}move(t,e){const i=this.bbox();if(t-=i.x,e-=i.y,!isNaN(t)&&!isNaN(e))for(let i=this.length-1;i>=0;i--)this[i]=[this[i][0]+t,this[i][1]+e];return this}parse(t=[0,0]){const e=[];(t=t instanceof Array?Array.prototype.concat.apply([],t):t.trim().split(dt).map(parseFloat)).length%2!=0&&t.pop();for(let i=0,a=t.length;i=0;i--)a.width&&(this[i][0]=(this[i][0]-a.x)*t/a.width+a.x),a.height&&(this[i][1]=(this[i][1]-a.y)*e/a.height+a.y);return this}toLine(){return{x1:this[0][0],y1:this[0][1],x2:this[1][0],y2:this[1][1]}}toString(){const t=[];for(let e=0,i=this.length;e":function(t){return-Math.cos(t*Math.PI)/2+.5},">":function(t){return Math.sin(t*Math.PI/2)},"<":function(t){return 1-Math.cos(t*Math.PI/2)},bezier:function(t,e,i,a){return function(s){return s<0?t>0?e/t*s:i>0?a/i*s:0:s>1?i<1?(1-a)/(1-i)*s+(a-i)/(1-i):t<1?(1-e)/(1-t)*s+(e-t)/(1-t):1:3*s*(1-s)**2*e+3*s**2*(1-s)*a+s**3}},steps:function(t,e="end"){e=e.split("-").reverse()[0];let i=t;return"none"===e?--i:"both"===e&&++i,(a,s=!1)=>{let r=Math.floor(a*t);const n=a*r%1==0;return"start"!==e&&"both"!==e||++r,s&&n&&--r,a>=0&&r<0&&(r=0),a<=1&&r>i&&(r=i),r/i}}};class ye{done(){return!1}}class we extends ye{constructor(t=Ht){super(),this.ease=ve[t]||t}step(t,e,i){return"number"!=typeof t?i<1?t:e:t+(e-t)*this.ease(i)}}class ke extends ye{constructor(t){super(),this.stepper=t}done(t){return t.done}step(t,e,i,a){return this.stepper(t,e,i,a)}}function Ae(){const t=(this._duration||500)/1e3,e=this._overshoot||0,i=Math.PI,a=Math.log(e/100+1e-10),s=-a/Math.sqrt(i*i+a*a),r=3.9/(s*t);this.d=2*s*r,this.k=r*r}Q(class extends ke{constructor(t=500,e=0){super(),this.duration(t).overshoot(e)}step(t,e,i,a){if("string"==typeof t)return t;if(a.done=i===1/0,i===1/0)return e;if(0===i)return t;i>100&&(i=16),i/=1e3;const s=a.velocity||0,r=-this.d*s-this.k*(t-e),n=t+s*i+r*i*i/2;return a.velocity=s+r*i,a.done=Math.abs(e-n)+Math.abs(s)<.002,a.done?e:n}},{duration:me("_duration",Ae),overshoot:me("_overshoot",Ae)});Q(class extends ke{constructor(t=.1,e=.01,i=0,a=1e3){super(),this.p(t).i(e).d(i).windup(a)}step(t,e,i,a){if("string"==typeof t)return t;if(a.done=i===1/0,i===1/0)return e;if(0===i)return t;const s=e-t;let r=(a.integral||0)+s*i;const n=(s-(a.error||0))/i,o=this._windup;return!1!==o&&(r=Math.max(-o,Math.min(r,o))),a.error=s,a.integral=r,a.done=Math.abs(s)<.001,a.done?e:t+(this.P*s+this.I*r+this.D*n)}},{windup:me("_windup"),p:me("P"),i:me("I"),d:me("D")});const Ce={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0},Se={M:function(t,e,i){return e.x=i.x=t[0],e.y=i.y=t[1],["M",e.x,e.y]},L:function(t,e){return e.x=t[0],e.y=t[1],["L",t[0],t[1]]},H:function(t,e){return e.x=t[0],["H",t[0]]},V:function(t,e){return e.y=t[0],["V",t[0]]},C:function(t,e){return e.x=t[4],e.y=t[5],["C",t[0],t[1],t[2],t[3],t[4],t[5]]},S:function(t,e){return e.x=t[2],e.y=t[3],["S",t[0],t[1],t[2],t[3]]},Q:function(t,e){return e.x=t[2],e.y=t[3],["Q",t[0],t[1],t[2],t[3]]},T:function(t,e){return e.x=t[0],e.y=t[1],["T",t[0],t[1]]},Z:function(t,e,i){return e.x=i.x,e.y=i.y,["Z"]},A:function(t,e){return e.x=t[5],e.y=t[6],["A",t[0],t[1],t[2],t[3],t[4],t[5],t[6]]}},Le="mlhvqtcsaz".split("");for(let t=0,e=Le.length;t=0;a--)i=this[a][0],"M"===i||"L"===i||"T"===i?(this[a][1]+=t,this[a][2]+=e):"H"===i?this[a][1]+=t:"V"===i?this[a][1]+=e:"C"===i||"S"===i||"Q"===i?(this[a][1]+=t,this[a][2]+=e,this[a][3]+=t,this[a][4]+=e,"C"===i&&(this[a][5]+=t,this[a][6]+=e)):"A"===i&&(this[a][6]+=t,this[a][7]+=e);return this}parse(t="M0 0"){return Array.isArray(t)&&(t=Array.prototype.concat.apply([],t).toString()),function(t,e=!0){let i=0,a="";const s={segment:[],inNumber:!1,number:"",lastToken:"",inSegment:!1,segments:[],pointSeen:!1,hasExponent:!1,absolute:e,p0:new bt,p:new bt};for(;s.lastToken=a,a=t.charAt(i++);)if(s.inSegment||!Pe(s,a))if("."!==a)if(isNaN(parseInt(a)))if(Re.has(a))s.inNumber&&Ie(s,!1);else if("-"!==a&&"+"!==a)if("E"!==a.toUpperCase()){if(ut.test(a)){if(s.inNumber)Ie(s,!1);else{if(!Me(s))throw new Error("parser Error");Te(s)}--i}}else s.number+=a,s.hasExponent=!0;else{if(s.inNumber&&!Xe(s)){Ie(s,!1),--i;continue}s.number+=a,s.inNumber=!0}else{if("0"===s.number||ze(s)){s.inNumber=!0,s.number=a,Ie(s,!0);continue}s.inNumber=!0,s.number+=a}else{if(s.pointSeen||s.hasExponent){Ie(s,!1),--i;continue}s.inNumber=!0,s.pointSeen=!0,s.number+=a}return s.inNumber&&Ie(s,!1),s.inSegment&&Me(s)&&Te(s),s.segments}(t)}size(t,e){const i=this.bbox();let a,s;for(i.width=0===i.width?1:i.width,i.height=0===i.height?1:i.height,a=this.length-1;a>=0;a--)s=this[a][0],"M"===s||"L"===s||"T"===s?(this[a][1]=(this[a][1]-i.x)*t/i.width+i.x,this[a][2]=(this[a][2]-i.y)*e/i.height+i.y):"H"===s?this[a][1]=(this[a][1]-i.x)*t/i.width+i.x:"V"===s?this[a][1]=(this[a][1]-i.y)*e/i.height+i.y:"C"===s||"S"===s||"Q"===s?(this[a][1]=(this[a][1]-i.x)*t/i.width+i.x,this[a][2]=(this[a][2]-i.y)*e/i.height+i.y,this[a][3]=(this[a][3]-i.x)*t/i.width+i.x,this[a][4]=(this[a][4]-i.y)*e/i.height+i.y,"C"===s&&(this[a][5]=(this[a][5]-i.x)*t/i.width+i.x,this[a][6]=(this[a][6]-i.y)*e/i.height+i.y)):"A"===s&&(this[a][1]=this[a][1]*t/i.width,this[a][2]=this[a][2]*e/i.height,this[a][6]=(this[a][6]-i.x)*t/i.width+i.x,this[a][7]=(this[a][7]-i.y)*e/i.height+i.y);return this}toString(){return function(t){let e="";for(let i=0,a=t.length;i{const e=typeof t;return"number"===e?_t:"string"===e?xt.isColor(t)?xt:dt.test(t)?ut.test(t)?Ee:Dt:tt.test(t)?_t:Oe:Ne.indexOf(t.constructor)>-1?t.constructor:Array.isArray(t)?Dt:"object"===e?_e:Oe};class He{constructor(t){this._stepper=t||new we("-"),this._from=null,this._to=null,this._type=null,this._context=null,this._morphObj=null}at(t){return this._morphObj.morph(this._from,this._to,t,this._stepper,this._context)}done(){return this._context.map(this._stepper.done).reduce((function(t,e){return t&&e}),!0)}from(t){return null==t?this._from:(this._from=this._set(t),this)}stepper(t){return null==t?this._stepper:(this._stepper=t,this)}to(t){return null==t?this._to:(this._to=this._set(t),this)}type(t){return null==t?this._type:(this._type=t,this)}_set(t){this._type||this.type(Ye(t));let e=new this._type(t);return this._type===xt&&(e=this._to?e[this._to[4]]():this._from?e[this._from[4]]():e),this._type===_e&&(e=this._to?e.align(this._to):this._from?e.align(this._from):e),e=e.toConsumable(),this._morphObj=this._morphObj||new this._type,this._context=this._context||Array.apply(null,Array(e.length)).map(Object).map((function(t){return t.done=!0,t})),e}}class Oe{constructor(...t){this.init(...t)}init(t){return t=Array.isArray(t)?t[0]:t,this.value=t,this}toArray(){return[this.value]}valueOf(){return this.value}}class Fe{constructor(...t){this.init(...t)}init(t){return Array.isArray(t)&&(t={scaleX:t[0],scaleY:t[1],shear:t[2],rotate:t[3],translateX:t[4],translateY:t[5],originX:t[6],originY:t[7]}),Object.assign(this,Fe.defaults,t),this}toArray(){const t=this;return[t.scaleX,t.scaleY,t.shear,t.rotate,t.translateX,t.translateY,t.originX,t.originY]}}Fe.defaults={scaleX:1,scaleY:1,shear:0,rotate:0,translateX:0,translateY:0,originX:0,originY:0};const De=(t,e)=>t[0]e[0]?1:0;class _e{constructor(...t){this.init(...t)}align(t){const e=this.values;for(let i=0,a=e.length;it.concat(e)),[]),this}toArray(){return this.values}valueOf(){const t={},e=this.values;for(;e.length;){const i=e.shift(),a=e.shift(),s=e.shift(),r=e.splice(0,s);t[i]=new a(r)}return t}}const Ne=[Oe,Fe,_e];class We extends qt{constructor(t,e=t){super(G("path",t),e)}array(){return this._array||(this._array=new Ee(this.attr("d")))}clear(){return delete this._array,this}height(t){return null==t?this.bbox().height:this.size(this.bbox().width,t)}move(t,e){return this.attr("d",this.array().move(t,e))}plot(t){return null==t?this.array():this.clear().attr("d","string"==typeof t?t:this._array=new Ee(t))}size(t,e){const i=I(this,t,e);return this.attr("d",this.array().size(i.width,i.height))}width(t){return null==t?this.bbox().width:this.size(t,this.bbox().height)}x(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)}y(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)}}We.prototype.MorphArray=Ee,A({Container:{path:K((function(t){return this.put(new We).plot(t||new Ee)}))}}),q(We,"Path");var Be=Object.freeze({__proto__:null,array:function(){return this._array||(this._array=new ge(this.attr("points")))},clear:function(){return delete this._array,this},move:function(t,e){return this.attr("points",this.array().move(t,e))},plot:function(t){return null==t?this.array():this.clear().attr("points","string"==typeof t?t:this._array=new ge(t))},size:function(t,e){const i=I(this,t,e);return this.attr("points",this.array().size(i.width,i.height))}});class Ge extends qt{constructor(t,e=t){super(G("polygon",t),e)}}A({Container:{polygon:K((function(t){return this.put(new Ge).plot(t||new ge)}))}}),Q(Ge,fe),Q(Ge,Be),q(Ge,"Polygon");class je extends qt{constructor(t,e=t){super(G("polyline",t),e)}}A({Container:{polyline:K((function(t){return this.put(new je).plot(t||new ge)}))}}),Q(je,fe),Q(je,Be),q(je,"Polyline");class Ve extends qt{constructor(t,e=t){super(G("rect",t),e)}}Q(Ve,{rx:Zt,ry:$t}),A({Container:{rect:K((function(t,e){return this.put(new Ve).size(t,e)}))}}),q(Ve,"Rect");class Ue{constructor(){this._first=null,this._last=null}first(){return this._first&&this._first.value}last(){return this._last&&this._last.value}push(t){const e=void 0!==t.next?t:{value:t,next:null,prev:null};return this._last?(e.prev=this._last,this._last.next=e,this._last=e):(this._last=e,this._first=e),e}remove(t){t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t===this._last&&(this._last=t.prev),t===this._first&&(this._first=t.next),t.prev=null,t.next=null}shift(){const t=this._first;return t?(this._first=t.next,this._first&&(this._first.prev=null),this._last=this._first?this._last:null,t.value):null}}const qe={nextDraw:null,frames:new Ue,timeouts:new Ue,immediates:new Ue,timer:()=>O.window.performance||O.window.Date,transforms:[],frame(t){const e=qe.frames.push({run:t});return null===qe.nextDraw&&(qe.nextDraw=O.window.requestAnimationFrame(qe._draw)),e},timeout(t,e){e=e||0;const i=qe.timer().now()+e,a=qe.timeouts.push({run:t,time:i});return null===qe.nextDraw&&(qe.nextDraw=O.window.requestAnimationFrame(qe._draw)),a},immediate(t){const e=qe.immediates.push(t);return null===qe.nextDraw&&(qe.nextDraw=O.window.requestAnimationFrame(qe._draw)),e},cancelFrame(t){null!=t&&qe.frames.remove(t)},clearTimeout(t){null!=t&&qe.timeouts.remove(t)},cancelImmediate(t){null!=t&&qe.immediates.remove(t)},_draw(t){let e=null;const i=qe.timeouts.last();for(;(e=qe.timeouts.shift())&&(t>=e.time?e.run():qe.timeouts.push(e),e!==i););let a=null;const s=qe.frames.last();for(;a!==s&&(a=qe.frames.shift());)a.run(t);let r=null;for(;r=qe.immediates.shift();)r();qe.nextDraw=qe.timeouts.first()||qe.frames.first()?O.window.requestAnimationFrame(qe._draw):null}},Ze=function(t){const e=t.start,i=t.runner.duration();return{start:e,duration:i,end:e+i,runner:t.runner}},$e=function(){const t=O.window;return(t.performance||t.Date).now()};class Je extends Rt{constructor(t=$e){super(),this._timeSource=t,this.terminate()}active(){return!!this._nextFrame}finish(){return this.time(this.getEndTimeOfTimeline()+1),this.pause()}getEndTime(){const t=this.getLastRunnerInfo(),e=t?t.runner.duration():0;return(t?t.start:this._time)+e}getEndTimeOfTimeline(){const t=this._runners.map((t=>t.start+t.runner.duration()));return Math.max(0,...t)}getLastRunnerInfo(){return this.getRunnerInfoById(this._lastRunnerId)}getRunnerInfoById(t){return this._runners[this._runnerIds.indexOf(t)]||null}pause(){return this._paused=!0,this._continue()}persist(t){return null==t?this._persist:(this._persist=t,this)}play(){return this._paused=!1,this.updateTime()._continue()}reverse(t){const e=this.speed();if(null==t)return this.speed(-e);const i=Math.abs(e);return this.speed(t?-i:i)}schedule(t,e,i){if(null==t)return this._runners.map(Ze);let a=0;const s=this.getEndTime();if(e=e||0,null==i||"last"===i||"after"===i)a=s;else if("absolute"===i||"start"===i)a=e,e=0;else if("now"===i)a=this._time;else if("relative"===i){const i=this.getRunnerInfoById(t.id);i&&(a=i.start+e,e=0)}else{if("with-last"!==i)throw new Error('Invalid value for the "when" parameter');{const t=this.getLastRunnerInfo();a=t?t.start:this._time}}t.unschedule(),t.timeline(this);const r=t.persist(),n={persist:null===r?this._persist:r,start:a+e,runner:t};return this._lastRunnerId=t.id,this._runners.push(n),this._runners.sort(((t,e)=>t.start-e.start)),this._runnerIds=this._runners.map((t=>t.runner.id)),this.updateTime()._continue(),this}seek(t){return this.time(this._time+t)}source(t){return null==t?this._timeSource:(this._timeSource=t,this)}speed(t){return null==t?this._speed:(this._speed=t,this)}stop(){return this.time(0),this.pause()}time(t){return null==t?this._time:(this._time=t,this._continue(!0))}unschedule(t){const e=this._runnerIds.indexOf(t.id);return e<0||(this._runners.splice(e,1),this._runnerIds.splice(e,1),t.timeline(null)),this}updateTime(){return this.active()||(this._lastSourceTime=this._timeSource()),this}_continue(t=!1){return qe.cancelFrame(this._nextFrame),this._nextFrame=null,t?this._stepImmediate():(this._paused||(this._nextFrame=qe.frame(this._step)),this)}_stepFn(t=!1){const e=this._timeSource();let i=e-this._lastSourceTime;t&&(i=0);const a=this._speed*i+(this._time-this._lastStepTime);this._lastSourceTime=e,t||(this._time+=a,this._time=this._time<0?0:this._time),this._lastStepTime=this._time,this.fire("time",this._time);for(let t=this._runners.length;t--;){const e=this._runners[t],i=e.runner;this._time-e.start<=0&&i.reset()}let s=!1;for(let t=0,e=this._runners.length;t0?this._continue():(this.pause(),this.fire("finished")),this}terminate(){this._startTime=0,this._speed=1,this._persist=0,this._nextFrame=null,this._paused=!0,this._runners=[],this._runnerIds=[],this._lastRunnerId=-1,this._time=0,this._lastSourceTime=0,this._lastStepTime=0,this._step=this._stepFn.bind(this,!1),this._stepImmediate=this._stepFn.bind(this,!0)}}A({Element:{timeline:function(t){return null==t?(this._timeline=this._timeline||new Je,this._timeline):(this._timeline=t,this)}}});class Qe extends Rt{constructor(t){super(),this.id=Qe.id++,t="function"==typeof(t=null==t?Yt:t)?new ke(t):t,this._element=null,this._timeline=null,this.done=!1,this._queue=[],this._duration="number"==typeof t&&t,this._isDeclarative=t instanceof ke,this._stepper=this._isDeclarative?t:new we,this._history={},this.enabled=!0,this._time=0,this._lastTime=0,this._reseted=!0,this.transforms=new vt,this.transformId=1,this._haveReversed=!1,this._reverse=!1,this._loopsDone=0,this._swing=!1,this._wait=0,this._times=1,this._frameId=null,this._persist=!!this._isDeclarative||null}static sanitise(t,e,i){let a=1,s=!1,r=0;return e=e??Ot,i=i||"last","object"!=typeof(t=t??Yt)||t instanceof ye||(e=t.delay??e,i=t.when??i,s=t.swing||s,a=t.times??a,r=t.wait??r,t=t.duration??Yt),{duration:t,delay:e,swing:s,times:a,wait:r,when:i}}active(t){return null==t?this.enabled:(this.enabled=t,this)}addTransform(t){return this.transforms.lmultiplyO(t),this}after(t){return this.on("finished",t)}animate(t,e,i){const a=Qe.sanitise(t,e,i),s=new Qe(a.duration);return this._timeline&&s.timeline(this._timeline),this._element&&s.element(this._element),s.loop(a).schedule(a.delay,a.when)}clearTransform(){return this.transforms=new vt,this}clearTransformsFromQueue(){this.done&&this._timeline&&this._timeline._runnerIds.includes(this.id)||(this._queue=this._queue.filter((t=>!t.isTransform)))}delay(t){return this.animate(0,t)}duration(){return this._times*(this._wait+this._duration)-this._wait}during(t){return this.queue(null,t)}ease(t){return this._stepper=new we(t),this}element(t){return null==t?this._element:(this._element=t,t._prepareRunner(),this)}finish(){return this.step(1/0)}loop(t,e,i){return"object"==typeof t&&(e=t.swing,i=t.wait,t=t.times),this._times=t||1/0,this._swing=e||!1,this._wait=i||0,!0===this._times&&(this._times=1/0),this}loops(t){const e=this._duration+this._wait;if(null==t){const t=Math.floor(this._time/e),i=(this._time-t*e)/this._duration;return Math.min(t+i,this._times)}const i=t%1,a=e*Math.floor(t)+this._duration*i;return this.time(a)}persist(t){return null==t?this._persist:(this._persist=t,this)}position(t){const e=this._time,i=this._duration,a=this._wait,s=this._times,r=this._swing,n=this._reverse;let o;if(null==t){const t=function(t){const e=r*Math.floor(t%(2*(a+i))/(a+i)),s=e&&!n||!e&&n,o=Math.pow(-1,s)*(t%(a+i))/i+s;return Math.max(Math.min(o,1),0)},l=s*(a+i)-a;return o=e<=0?Math.round(t(1e-5)):e=0;this._lastPosition=e;const a=this.duration(),s=this._lastTime<=0&&this._time>0,r=this._lastTime=a;this._lastTime=this._time,s&&this.fire("start",this);const n=this._isDeclarative;this.done=!n&&!r&&this._time>=a,this._reseted=!1;let o=!1;return(i||n)&&(this._initialise(i),this.transforms=new vt,o=this._run(n?t:e),this.fire("step",this)),this.done=this.done||o&&n,r&&this.fire("finished",this),this}time(t){if(null==t)return this._time;const e=t-this._time;return this.step(e),this}timeline(t){return void 0===t?this._timeline:(this._timeline=t,this)}unschedule(){const t=this.timeline();return t&&t.unschedule(this),this}_initialise(t){if(t||this._isDeclarative)for(let e=0,i=this._queue.length;et.lmultiplyO(e),ei=t=>t.transforms;function ii(){const t=this._transformationRunners.runners.map(ei).reduce(ti,new vt);this.transform(t),this._transformationRunners.merge(),1===this._transformationRunners.length()&&(this._frameId=null)}class ai{constructor(){this.runners=[],this.ids=[]}add(t){if(this.runners.includes(t))return;const e=t.id+1;return this.runners.push(t),this.ids.push(e),this}clearBefore(t){const e=this.ids.indexOf(t+1)||1;return this.ids.splice(0,e,0),this.runners.splice(0,e,new Ke).forEach((t=>t.clearTransformsFromQueue())),this}edit(t,e){const i=this.ids.indexOf(t+1);return this.ids.splice(i,1,t+1),this.runners.splice(i,1,e),this}getByID(t){return this.runners[this.ids.indexOf(t+1)]}length(){return this.ids.length}merge(){let t=null;for(let e=0;ee.id<=t.id)).map(ei).reduce(ti,new vt)},_addRunner(t){this._transformationRunners.add(t),qe.cancelImmediate(this._frameId),this._frameId=qe.immediate(ii.bind(this))},_prepareRunner(){null==this._frameId&&(this._transformationRunners=(new ai).add(new Ke(new vt(this))))}}});Q(Qe,{attr(t,e){return this.styleAttr("attr",t,e)},css(t,e){return this.styleAttr("css",t,e)},styleAttr(t,e,i){if("string"==typeof e)return this.styleAttr(t,{[e]:i});let a=e;if(this._tryRetarget(t,a))return this;let s=new He(this._stepper).to(a),r=Object.keys(a);return this.queue((function(){s=s.from(this.element()[t](r))}),(function(e){return this.element()[t](s.at(e).valueOf()),s.done()}),(function(e){const i=Object.keys(e),n=(o=r,i.filter((t=>!o.includes(t))));var o;if(n.length){const e=this.element()[t](n),i=new _e(s.from()).valueOf();Object.assign(i,e),s.from(i)}const l=new _e(s.to()).valueOf();Object.assign(l,e),s.to(l),r=i,a=e})),this._rememberMorpher(t,s),this},zoom(t,e){if(this._tryRetarget("zoom",t,e))return this;let i=new He(this._stepper).to(new _t(t));return this.queue((function(){i=i.from(this.element().zoom())}),(function(t){return this.element().zoom(i.at(t),e),i.done()}),(function(t,a){e=a,i.to(t)})),this._rememberMorpher("zoom",i),this},transform(t,e,i){if(e=t.relative||e,this._isDeclarative&&!e&&this._tryRetarget("transform",t))return this;const a=vt.isMatrixLike(t);i=null!=t.affine?t.affine:null!=i?i:!a;const s=new He(this._stepper).type(i?Fe:vt);let r,n,o,l,h;return this.queue((function(){n=n||this.element(),r=r||T(t,n),h=new vt(e?void 0:n),n._addRunner(this),e||n._clearTransformRunnersBefore(this)}),(function(c){e||this.clearTransform();const{x:d,y:u}=new bt(r).transform(n._currentTransform(this));let g=new vt({...t,origin:[d,u]}),p=this._isDeclarative&&o?o:h;if(i){g=g.decompose(d,u),p=p.decompose(d,u);const t=g.rotate,e=p.rotate,i=[t-360,t,t+360],a=i.map((t=>Math.abs(t-e))),s=Math.min(...a),r=a.indexOf(s);g.rotate=i[r]}e&&(a||(g.rotate=t.rotate||0),this._isDeclarative&&l&&(p.rotate=l)),s.from(p),s.to(g);const f=s.at(c);return l=f.rotate,o=new vt(f),this.addTransform(o),n._addRunner(this),s.done()}),(function(e){(e.origin||"center").toString()!==(t.origin||"center").toString()&&(r=T(e,n)),t={...e,origin:r}}),!0),this._isDeclarative&&this._rememberMorpher("transform",s),this},x(t){return this._queueNumber("x",t)},y(t){return this._queueNumber("y",t)},ax(t){return this._queueNumber("ax",t)},ay(t){return this._queueNumber("ay",t)},dx(t=0){return this._queueNumberDelta("x",t)},dy(t=0){return this._queueNumberDelta("y",t)},dmove(t,e){return this.dx(t).dy(e)},_queueNumberDelta(t,e){if(e=new _t(e),this._tryRetarget(t,e))return this;const i=new He(this._stepper).to(e);let a=null;return this.queue((function(){a=this.element()[t](),i.from(a),i.to(a+e)}),(function(e){return this.element()[t](i.at(e)),i.done()}),(function(t){i.to(a+new _t(t))})),this._rememberMorpher(t,i),this},_queueObject(t,e){if(this._tryRetarget(t,e))return this;const i=new He(this._stepper).to(e);return this.queue((function(){i.from(this.element()[t]())}),(function(e){return this.element()[t](i.at(e)),i.done()})),this._rememberMorpher(t,i),this},_queueNumber(t,e){return this._queueObject(t,new _t(e))},cx(t){return this._queueNumber("cx",t)},cy(t){return this._queueNumber("cy",t)},move(t,e){return this.x(t).y(e)},amove(t,e){return this.ax(t).ay(e)},center(t,e){return this.cx(t).cy(e)},size(t,e){let i;return t&&e||(i=this._element.bbox()),t||(t=i.width/i.height*e),e||(e=i.height/i.width*t),this.width(t).height(e)},width(t){return this._queueNumber("width",t)},height(t){return this._queueNumber("height",t)},plot(t,e,i,a){if(4===arguments.length)return this.plot([t,e,i,a]);if(this._tryRetarget("plot",t))return this;const s=new He(this._stepper).type(this._element.MorphArray).to(t);return this.queue((function(){s.from(this._element.array())}),(function(t){return this._element.plot(s.at(t)),s.done()})),this._rememberMorpher("plot",s),this},leading(t){return this._queueNumber("leading",t)},viewbox(t,e,i,a){return this._queueObject("viewbox",new kt(t,e,i,a))},update(t){return"object"!=typeof t?this.update({offset:arguments[0],color:arguments[1],opacity:arguments[2]}):(null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",t.offset),this)}}),Q(Qe,{rx:Zt,ry:$t,from:ne,to:oe}),q(Qe,"Runner");class si extends Vt{constructor(t,e=t){super(G("svg",t),e),this.namespace()}defs(){return this.isRoot()?V(this.node.querySelector("defs"))||this.put(new Ut):this.root().defs()}isRoot(){return!this.node.parentNode||!(this.node.parentNode instanceof O.window.SVGElement)&&"#document-fragment"!==this.node.parentNode.nodeName}namespace(){return this.isRoot()?this.attr({xmlns:E,version:"1.1"}).attr("xmlns:xlink",H,Y):this.root().namespace()}removeNamespace(){return this.attr({xmlns:null,version:null}).attr("xmlns:xlink",null,Y).attr("xmlns:svgjs",null,Y)}root(){return this.isRoot()?this:super.root()}}A({Container:{nested:K((function(){return this.put(new si)}))}}),q(si,"Svg",!0);let ri=class extends Vt{constructor(t,e=t){super(G("symbol",t),e)}};A({Container:{symbol:K((function(){return this.put(new ri)}))}}),q(ri,"Symbol");var ni=Object.freeze({__proto__:null,amove:function(t,e){return this.ax(t).ay(e)},ax:function(t){return this.attr("x",t)},ay:function(t){return this.attr("y",t)},build:function(t){return this._build=!!t,this},center:function(t,e,i=this.bbox()){return this.cx(t,i).cy(e,i)},cx:function(t,e=this.bbox()){return null==t?e.cx:this.attr("x",this.attr("x")+t-e.cx)},cy:function(t,e=this.bbox()){return null==t?e.cy:this.attr("y",this.attr("y")+t-e.cy)},length:function(){return this.node.getComputedTextLength()},move:function(t,e,i=this.bbox()){return this.x(t,i).y(e,i)},plain:function(t){return!1===this._build&&this.clear(),this.node.appendChild(O.document.createTextNode(t)),this},x:function(t,e=this.bbox()){return null==t?e.x:this.attr("x",this.attr("x")+t-e.x)},y:function(t,e=this.bbox()){return null==t?e.y:this.attr("y",this.attr("y")+t-e.y)}});class oi extends qt{constructor(t,e=t){super(G("text",t),e),this.dom.leading=this.dom.leading??new _t(1.3),this._rebuild=!0,this._build=!1}leading(t){return null==t?this.dom.leading:(this.dom.leading=new _t(t),this.rebuild())}rebuild(t){if("boolean"==typeof t&&(this._rebuild=t),this._rebuild){const t=this;let e=0;const i=this.dom.leading;this.each((function(a){if(X(this.node))return;const s=O.window.getComputedStyle(this.node).getPropertyValue("font-size"),r=i*new _t(s);this.dom.newLined&&(this.attr("x",t.attr("x")),"\n"===this.text()?e+=r:(this.attr("dy",a?r+e:0),e=0))})),this.fire("rebuild")}return this}setData(t){return this.dom=t,this.dom.leading=new _t(t.leading||1.3),this}writeDataToDom(){return R(this,this.dom,{leading:1.3}),this}text(t){if(void 0===t){const e=this.node.childNodes;let i=0;t="";for(let a=0,s=e.length;a{let a;try{a=i.node instanceof F().SVGSVGElement?new kt(i.attr(["x","y","width","height"])):i.bbox()}catch(t){return}const s=new vt(i),r=s.translate(t,e).transform(s.inverse()),n=new bt(a.x,a.y).transform(r);i.move(n.x,n.y)})),this},dx:function(t){return this.dmove(t,0)},dy:function(t){return this.dmove(0,t)},height:function(t,e=this.bbox()){return null==t?e.height:this.size(e.width,t,e)},move:function(t=0,e=0,i=this.bbox()){const a=t-i.x,s=e-i.y;return this.dmove(a,s)},size:function(t,e,i=this.bbox()){const a=I(this,t,e,i),s=a.width/i.width,r=a.height/i.height;return this.children().forEach((t=>{const e=new bt(i).transform(new vt(t).inverse());t.scale(s,r,e.x,e.y)})),this},width:function(t,e=this.bbox()){return null==t?e.width:this.size(t,e.height,e)},x:function(t,e=this.bbox()){return null==t?e.x:this.move(t,e.y,e)},y:function(t,e=this.bbox()){return null==t?e.y:this.move(e.x,t,e)}});class gi extends Vt{constructor(t,e=t){super(G("g",t),e)}}Q(gi,ui),A({Container:{group:K((function(){return this.put(new gi)}))}}),q(gi,"G");class pi extends Vt{constructor(t,e=t){super(G("a",t),e)}target(t){return this.attr("target",t)}to(t){return this.attr("href",t,H)}}Q(pi,ui),A({Container:{link:K((function(t){return this.put(new pi).to(t)}))},Element:{unlink(){const t=this.linker();if(!t)return this;const e=t.parent();if(!e)return this.remove();const i=e.index(t);return e.add(this,i),t.remove(),this},linkTo(t){let e=this.linker();return e||(e=new pi,this.wrap(e)),"function"==typeof t?t.call(e,e):e.to(t),this},linker(){const t=this.parent();return t&&"a"===t.node.nodeName.toLowerCase()?t:null}}}),q(pi,"A");class fi extends Vt{constructor(t,e=t){super(G("mask",t),e)}remove(){return this.targets().forEach((function(t){t.unmask()})),super.remove()}targets(){return Lt("svg [mask*="+this.id()+"]")}}A({Container:{mask:K((function(){return this.defs().put(new fi)}))},Element:{masker(){return this.reference("mask")},maskWith(t){const e=t instanceof fi?t:this.parent().mask().add(t);return this.attr("mask","url(#"+e.id()+")")},unmask(){return this.attr("mask",null)}}}),q(fi,"Mask");class xi extends Gt{constructor(t,e=t){super(G("stop",t),e)}update(t){return("number"==typeof t||t instanceof _t)&&(t={offset:arguments[0],color:arguments[1],opacity:arguments[2]}),null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",new _t(t.offset)),this}}A({Gradient:{stop:function(t,e,i){return this.put(new xi).update(t,e,i)}}}),q(xi,"Stop");class bi extends Gt{constructor(t,e=t){super(G("style",t),e)}addText(t=""){return this.node.textContent+=t,this}font(t,e,i={}){return this.rule("@font-face",{fontFamily:t,src:e,...i})}rule(t,e){return this.addText(function(t,e){if(!t)return"";if(!e)return t;let i=t+"{";for(const t in e)i+=t.replace(/([A-Z])/g,(function(t,e){return"-"+e.toLowerCase()}))+":"+e[t]+";";return i+="}",i}(t,e))}}A("Dom",{style(t,e){return this.put(new bi).rule(t,e)},fontface(t,e,i){return this.put(new bi).font(t,e,i)}}),q(bi,"Style");class mi extends oi{constructor(t,e=t){super(G("textPath",t),e)}array(){const t=this.track();return t?t.array():null}plot(t){const e=this.track();let i=null;return e&&(i=e.plot(t)),null==t?i:this}track(){return this.reference("href")}}A({Container:{textPath:K((function(t,e){return t instanceof oi||(t=this.text(t)),t.path(e)}))},Text:{path:K((function(t,e=!0){const i=new mi;let a;if(t instanceof We||(t=this.defs().path(t)),i.attr("href","#"+t,H),e)for(;a=this.node.firstChild;)i.node.appendChild(a);return this.put(i)})),textPath(){return this.findOne("textPath")}},Path:{text:K((function(t){return t instanceof oi||(t=(new oi).addTo(this.parent()).text(t)),t.path(this)})),targets(){return Lt("svg textPath").filter((t=>(t.attr("href")||"").includes(this.id())))}}}),mi.prototype.MorphArray=Ee,q(mi,"TextPath");class vi extends qt{constructor(t,e=t){super(G("use",t),e)}use(t,e){return this.attr("href",(e||"")+"#"+t,H)}}A({Container:{use:K((function(t,e){return this.put(new vi).use(t,e)}))}}),q(vi,"Use");const yi=B;Q([si,ri,de,ce,be],C("viewbox")),Q([xe,je,Ge,We],C("marker")),Q(oi,C("Text")),Q(We,C("Path")),Q(Ut,C("Defs")),Q([oi,li],C("Tspan")),Q([Ve,se,he,Qe],C("radius")),Q(Rt,C("EventTarget")),Q(Bt,C("Dom")),Q(Gt,C("Element")),Q(qt,C("Shape")),Q([Vt,re],C("Container")),Q(he,C("Gradient")),Q(Qe,C("Runner")),Ct.extend([...new Set(k)]),function(t=[]){Ne.push(...[].concat(t))}([_t,xt,kt,vt,Dt,ge,Ee,bt]),Q(Ne,{to(t){return(new He).type(this.constructor).from(this.toArray()).to(t)},fromArray(t){return this.init(t),this},toConsumable(){return this.toArray()},morph(t,e,i,a,s){return this.fromArray(t.map((function(t,r){return a.step(t,e[r],i,s[r],s)})))}});class wi extends Gt{constructor(t){super(G("filter",t),t),this.$source="SourceGraphic",this.$sourceAlpha="SourceAlpha",this.$background="BackgroundImage",this.$backgroundAlpha="BackgroundAlpha",this.$fill="FillPaint",this.$stroke="StrokePaint",this.$autoSetIn=!0}put(t,e){return!(t=super.put(t,e)).attr("in")&&this.$autoSetIn&&t.attr("in",this.$source),t.attr("result")||t.attr("result",t.id()),t}remove(){return this.targets().each("unfilter"),super.remove()}targets(){return Lt('svg [filter*="'+this.id()+'"]')}toString(){return"url(#"+this.id()+")"}}class ki extends Gt{constructor(t,e){super(t,e),this.result(this.id())}in(t){if(null==t){const t=this.attr("in");return this.parent()&&this.parent().find(`[result="${t}"]`)[0]||t}return this.attr("in",t)}result(t){return this.attr("result",t)}toString(){return this.result()}}const Ai=t=>function(...e){for(let i=t.length;i--;)null!=e[i]&&this.attr(t[i],e[i])},Ci={blend:Ai(["in","in2","mode"]),colorMatrix:Ai(["type","values"]),composite:Ai(["in","in2","operator"]),convolveMatrix:function(t){t=new Dt(t).toString(),this.attr({order:Math.sqrt(t.split(" ").length),kernelMatrix:t})},diffuseLighting:Ai(["surfaceScale","lightingColor","diffuseConstant","kernelUnitLength"]),displacementMap:Ai(["in","in2","scale","xChannelSelector","yChannelSelector"]),dropShadow:Ai(["in","dx","dy","stdDeviation"]),flood:Ai(["flood-color","flood-opacity"]),gaussianBlur:function(t=0,e=t){this.attr("stdDeviation",t+" "+e)},image:function(t){this.attr("href",t,H)},morphology:Ai(["operator","radius"]),offset:Ai(["dx","dy"]),specularLighting:Ai(["surfaceScale","lightingColor","diffuseConstant","specularExponent","kernelUnitLength"]),tile:Ai([]),turbulence:Ai(["baseFrequency","numOctaves","seed","stitchTiles","type"])};["blend","colorMatrix","componentTransfer","composite","convolveMatrix","diffuseLighting","displacementMap","dropShadow","flood","gaussianBlur","image","merge","morphology","offset","specularLighting","tile","turbulence"].forEach((t=>{const e=P(t),i=Ci[t];wi[e+"Effect"]=class extends ki{constructor(t){super(G("fe"+e,t),t)}update(t){return i.apply(this,t),this}},wi.prototype[t]=K((function(t,...i){const a=new wi[e+"Effect"];return null==t?this.put(a):("function"==typeof t?t.call(a,a):i.unshift(t),this.put(a).update(i))}))})),Q(wi,{merge(t){const e=this.put(new wi.MergeEffect);if("function"==typeof t)return t.call(e,e),e;return(t instanceof Array?t:[...arguments]).forEach((t=>{t instanceof wi.MergeNode?e.put(t):e.mergeNode(t)})),e},componentTransfer(t={}){const e=this.put(new wi.ComponentTransferEffect);if("function"==typeof t)return t.call(e,e),e;if(!(t.r||t.g||t.b||t.a)){t={r:t,g:t,b:t,a:t}}for(const i in t)e.add(new(wi["Func"+i.toUpperCase()])(t[i]));return e}});["distantLight","pointLight","spotLight","mergeNode","FuncR","FuncG","FuncB","FuncA"].forEach((t=>{const e=P(t);wi[e]=class extends ki{constructor(t){super(G("fe"+e,t),t)}}}));["funcR","funcG","funcB","funcA"].forEach((function(t){const e=wi[P(t)],i=K((function(){return this.put(new e)}));wi.ComponentTransferEffect.prototype[t]=i}));["distantLight","pointLight","spotLight"].forEach((t=>{const e=wi[P(t)],i=K((function(){return this.put(new e)}));wi.DiffuseLightingEffect.prototype[t]=i,wi.SpecularLightingEffect.prototype[t]=i})),Q(wi.MergeEffect,{mergeNode(t){return this.put(new wi.MergeNode).attr("in",t)}}),Q(Ut,{filter:function(t){const e=this.put(new wi);return"function"==typeof t&&t.call(e,e),e}}),Q(Vt,{filter:function(t){return this.defs().filter(t)}}),Q(Gt,{filterWith:function(t){const e=t instanceof wi?t:this.defs().filter(t);return this.attr("filter",e)},unfilter:function(t){return this.attr("filter",null)},filterer(){return this.reference("filter")}});const Si={blend:function(t,e){return this.parent()&&this.parent().blend(this,t,e)},colorMatrix:function(t,e){return this.parent()&&this.parent().colorMatrix(t,e).in(this)},componentTransfer:function(t){return this.parent()&&this.parent().componentTransfer(t).in(this)},composite:function(t,e){return this.parent()&&this.parent().composite(this,t,e)},convolveMatrix:function(t){return this.parent()&&this.parent().convolveMatrix(t).in(this)},diffuseLighting:function(t,e,i,a){return this.parent()&&this.parent().diffuseLighting(t,i,a).in(this)},displacementMap:function(t,e,i,a){return this.parent()&&this.parent().displacementMap(this,t,e,i,a)},dropShadow:function(t,e,i){return this.parent()&&this.parent().dropShadow(this,t,e,i).in(this)},flood:function(t,e){return this.parent()&&this.parent().flood(t,e)},gaussianBlur:function(t,e){return this.parent()&&this.parent().gaussianBlur(t,e).in(this)},image:function(t){return this.parent()&&this.parent().image(t)},merge:function(t){return t=t instanceof Array?t:[...t],this.parent()&&this.parent().merge(this,...t)},morphology:function(t,e){return this.parent()&&this.parent().morphology(t,e).in(this)},offset:function(t,e){return this.parent()&&this.parent().offset(t,e).in(this)},specularLighting:function(t,e,i,a,s){return this.parent()&&this.parent().specularLighting(t,i,a,s).in(this)},tile:function(){return this.parent()&&this.parent().tile().in(this)},turbulence:function(t,e,i,a,s){return this.parent()&&this.parent().turbulence(t,e,i,a,s).in(this)}};Q(ki,Si),Q(wi.MergeEffect,{in:function(t){return t instanceof wi.MergeNode?this.add(t,0):this.add((new wi.MergeNode).in(t),0),this}}),Q([wi.CompositeEffect,wi.BlendEffect,wi.DisplacementMapEffect],{in2:function(t){if(null==t){const t=this.attr("in2");return this.parent()&&this.parent().find(`[result="${t}"]`)[0]||t}return this.attr("in2",t)}}),wi.filter={sepiatone:[.343,.669,.119,0,0,.249,.626,.13,0,0,.172,.334,.111,0,0,0,0,0,1,0]};var Li=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"getDefaultFilter",value:function(t,e){var i=this.w;t.unfilter(!0),(new wi).size("120%","180%","-5%","-40%"),i.config.chart.dropShadow.enabled&&this.dropShadow(t,i.config.chart.dropShadow,e)}},{key:"applyFilter",value:function(t,e,i){var a,s=this,r=this.w;if(t.unfilter(!0),"none"!==i){var n,o,l=r.config.chart.dropShadow,h="lighten"===i?2:.3;if(t.filterWith((function(t){t.colorMatrix({type:"matrix",values:"\n ".concat(h," 0 0 0 0\n 0 ").concat(h," 0 0 0\n 0 0 ").concat(h," 0 0\n 0 0 0 1 0\n "),in:"SourceGraphic",result:"brightness"}),l.enabled&&s.addShadow(t,e,l,"brightness")})),!l.noUserSpaceOnUse)null===(n=t.filterer())||void 0===n||null===(o=n.node)||void 0===o||o.setAttribute("filterUnits","userSpaceOnUse");this._scaleFilterSize(null===(a=t.filterer())||void 0===a?void 0:a.node)}else this.getDefaultFilter(t,e)}},{key:"addShadow",value:function(t,e,i,a){var s,r=this.w,n=i.blur,o=i.top,l=i.left,h=i.color,c=i.opacity;if(h=Array.isArray(h)?h[e]:h,(null===(s=r.config.chart.dropShadow.enabledOnSeries)||void 0===s?void 0:s.length)>0&&-1===r.config.chart.dropShadow.enabledOnSeries.indexOf(e))return t;t.offset({in:a,dx:l,dy:o,result:"offset"}),t.gaussianBlur({in:"offset",stdDeviation:n,result:"blur"}),t.flood({"flood-color":h,"flood-opacity":c,result:"flood"}),t.composite({in:"flood",in2:"blur",operator:"in",result:"shadow"}),t.merge(["shadow",a])}},{key:"dropShadow",value:function(t,e){var i,a,s,r,n,o=this,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,h=this.w;if(t.unfilter(!0),v.isMsEdge()&&"radialBar"===h.config.chart.type)return t;if((null===(i=h.config.chart.dropShadow.enabledOnSeries)||void 0===i?void 0:i.length)>0&&-1===(null===(s=h.config.chart.dropShadow.enabledOnSeries)||void 0===s?void 0:s.indexOf(l)))return t;(t.filterWith((function(t){o.addShadow(t,l,e,"SourceGraphic")})),e.noUserSpaceOnUse)||(null===(r=t.filterer())||void 0===r||null===(n=r.node)||void 0===n||n.setAttribute("filterUnits","userSpaceOnUse"));return this._scaleFilterSize(null===(a=t.filterer())||void 0===a?void 0:a.node),t}},{key:"setSelectionFilter",value:function(t,e,i){var a=this.w;if(void 0!==a.globals.selectedDataPoints[e]&&a.globals.selectedDataPoints[e].indexOf(i)>-1){t.node.setAttribute("selected",!0);var s=a.config.states.active.filter;"none"!==s&&this.applyFilter(t,e,s.type)}}},{key:"_scaleFilterSize",value:function(t){if(t){!function(e){for(var i in e)e.hasOwnProperty(i)&&t.setAttribute(i,e[i])}({width:"200%",height:"200%",x:"-50%",y:"-50%"})}}}]),t}(),Mi=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"roundPathCorners",value:function(t,e){function i(t,e,i){var s=e.x-t.x,r=e.y-t.y,n=Math.sqrt(s*s+r*r);return a(t,e,Math.min(1,i/n))}function a(t,e,i){return{x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i}}function s(t,e){t.length>2&&(t[t.length-2]=e.x,t[t.length-1]=e.y)}function r(t){return{x:parseFloat(t[t.length-2]),y:parseFloat(t[t.length-1])}}t.indexOf("NaN")>-1&&(t="");var n=t.split(/[,\s]/).reduce((function(t,e){var i=e.match("([a-zA-Z])(.+)");return i?(t.push(i[1]),t.push(i[2])):t.push(e),t}),[]).reduce((function(t,e){return parseFloat(e)==e&&t.length?t[t.length-1].push(e):t.push([e]),t}),[]),o=[];if(n.length>1){var l=r(n[0]),h=null;"Z"==n[n.length-1][0]&&n[0].length>2&&(h=["L",l.x,l.y],n[n.length-1]=h),o.push(n[0]);for(var c=1;c2&&"L"==u[0]&&g.length>2&&"L"==g[0]){var p,f,x=r(d),b=r(u),m=r(g);p=i(b,x,e),f=i(b,m,e),s(u,p),u.origPoint=b,o.push(u);var v=a(p,b,.5),y=a(b,f,.5),w=["C",v.x,v.y,y.x,y.y,f.x,f.y];w.origPoint=b,o.push(w)}else o.push(u)}if(h){var k=r(o[o.length-1]);o.push(["Z"]),s(o[0],k)}}else o=n;return o.reduce((function(t,e){return t+e.join(" ")+" "}),"")}},{key:"drawLine",value:function(t,e,i,a){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"#a8a8a8",r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,n=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"butt";return this.w.globals.dom.Paper.line().attr({x1:t,y1:e,x2:i,y2:a,stroke:s,"stroke-dasharray":r,"stroke-width":n,"stroke-linecap":o})}},{key:"drawRect",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"#fefefe",n=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null,l=arguments.length>8&&void 0!==arguments[8]?arguments[8]:null,h=arguments.length>9&&void 0!==arguments[9]?arguments[9]:0,c=this.w.globals.dom.Paper.rect();return c.attr({x:t,y:e,width:i>0?i:0,height:a>0?a:0,rx:s,ry:s,opacity:n,"stroke-width":null!==o?o:0,stroke:null!==l?l:"none","stroke-dasharray":h}),c.node.setAttribute("fill",r),c}},{key:"drawPolygon",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#e1e1e1",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"none";return this.w.globals.dom.Paper.polygon(t).attr({fill:a,stroke:e,"stroke-width":i})}},{key:"drawCircle",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;t<0&&(t=0);var i=this.w.globals.dom.Paper.circle(2*t);return null!==e&&i.attr(e),i}},{key:"drawPath",value:function(t){var e=t.d,i=void 0===e?"":e,a=t.stroke,s=void 0===a?"#a8a8a8":a,r=t.strokeWidth,n=void 0===r?1:r,o=t.fill,l=t.fillOpacity,h=void 0===l?1:l,c=t.strokeOpacity,d=void 0===c?1:c,u=t.classes,g=t.strokeLinecap,p=void 0===g?null:g,f=t.strokeDashArray,x=void 0===f?0:f,b=this.w;return null===p&&(p=b.config.stroke.lineCap),(i.indexOf("undefined")>-1||i.indexOf("NaN")>-1)&&(i="M 0 ".concat(b.globals.gridHeight)),b.globals.dom.Paper.path(i).attr({fill:o,"fill-opacity":h,stroke:s,"stroke-opacity":d,"stroke-linecap":p,"stroke-width":n,"stroke-dasharray":x,class:u})}},{key:"group",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=this.w.globals.dom.Paper.group();return null!==t&&e.attr(t),e}},{key:"move",value:function(t,e){var i=["M",t,e].join(" ");return i}},{key:"line",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=null;return null===i?a=[" L",t,e].join(" "):"H"===i?a=[" H",t].join(" "):"V"===i&&(a=[" V",e].join(" ")),a}},{key:"curve",value:function(t,e,i,a,s,r){var n=["C",t,e,i,a,s,r].join(" ");return n}},{key:"quadraticCurve",value:function(t,e,i,a){return["Q",t,e,i,a].join(" ")}},{key:"arc",value:function(t,e,i,a,s,r,n){var o="A";arguments.length>7&&void 0!==arguments[7]&&arguments[7]&&(o="a");var l=[o,t,e,i,a,s,r,n].join(" ");return l}},{key:"renderPaths",value:function(t){var e,i=t.j,a=t.realIndex,s=t.pathFrom,r=t.pathTo,n=t.stroke,o=t.strokeWidth,l=t.strokeLinecap,h=t.fill,c=t.animationDelay,d=t.initialSpeed,g=t.dataChangeSpeed,p=t.className,f=t.chartType,x=t.shouldClipToGrid,b=void 0===x||x,m=t.bindEventsOnPaths,v=void 0===m||m,w=t.drawShadow,k=void 0===w||w,A=this.w,C=new Li(this.ctx),S=new y(this.ctx),L=this.w.config.chart.animations.enabled,M=L&&this.w.config.chart.animations.dynamicAnimation.enabled,P=!!(L&&!A.globals.resized||M&&A.globals.dataChanged&&A.globals.shouldAnimate);P?e=s:(e=r,A.globals.animationEnded=!0);var I=A.config.stroke.dashArray,T=0;T=Array.isArray(I)?I[a]:A.config.stroke.dashArray;var z=this.drawPath({d:e,stroke:n,strokeWidth:o,fill:h,fillOpacity:1,classes:p,strokeLinecap:l,strokeDashArray:T});z.attr("index",a),b&&("bar"===f&&!A.globals.isHorizontal||A.globals.comboCharts?z.attr({"clip-path":"url(#gridRectBarMask".concat(A.globals.cuid,")")}):z.attr({"clip-path":"url(#gridRectMask".concat(A.globals.cuid,")")})),A.config.chart.dropShadow.enabled&&k&&C.dropShadow(z,A.config.chart.dropShadow,a),v&&(z.node.addEventListener("mouseenter",this.pathMouseEnter.bind(this,z)),z.node.addEventListener("mouseleave",this.pathMouseLeave.bind(this,z)),z.node.addEventListener("mousedown",this.pathMouseDown.bind(this,z))),z.attr({pathTo:r,pathFrom:s});var X={el:z,j:i,realIndex:a,pathFrom:s,pathTo:r,fill:h,strokeWidth:o,delay:c};return!L||A.globals.resized||A.globals.dataChanged?!A.globals.resized&&A.globals.dataChanged||S.showDelayedElements():S.animatePathsGradually(u(u({},X),{},{speed:d})),A.globals.dataChanged&&M&&P&&S.animatePathsGradually(u(u({},X),{},{speed:g})),z}},{key:"drawPattern",value:function(t,e,i){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"#a8a8a8",s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return this.w.globals.dom.Paper.pattern(e,i,(function(r){"horizontalLines"===t?r.line(0,0,i,0).stroke({color:a,width:s+1}):"verticalLines"===t?r.line(0,0,0,e).stroke({color:a,width:s+1}):"slantedLines"===t?r.line(0,0,e,i).stroke({color:a,width:s}):"squares"===t?r.rect(e,i).fill("none").stroke({color:a,width:s}):"circles"===t&&r.circle(e).fill("none").stroke({color:a,width:s})}))}},{key:"drawGradient",value:function(t,e,i,a,s){var r,n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:[],h=arguments.length>8&&void 0!==arguments[8]?arguments[8]:0,c=this.w;e.length<9&&0===e.indexOf("#")&&(e=v.hexToRgba(e,a)),i.length<9&&0===i.indexOf("#")&&(i=v.hexToRgba(i,s));var d=0,u=1,g=1,p=null;null!==o&&(d=void 0!==o[0]?o[0]/100:0,u=void 0!==o[1]?o[1]/100:1,g=void 0!==o[2]?o[2]/100:1,p=void 0!==o[3]?o[3]/100:null);var f=!("donut"!==c.config.chart.type&&"pie"!==c.config.chart.type&&"polarArea"!==c.config.chart.type&&"bubble"!==c.config.chart.type);if(r=l&&0!==l.length?c.globals.dom.Paper.gradient(f?"radial":"linear",(function(t){(Array.isArray(l[h])?l[h]:l).forEach((function(e){t.stop(e.offset/100,e.color,e.opacity)}))})):c.globals.dom.Paper.gradient(f?"radial":"linear",(function(t){t.stop(d,e,a),t.stop(u,i,s),t.stop(g,i,s),null!==p&&t.stop(p,e,a)})),f){var x=c.globals.gridWidth/2,b=c.globals.gridHeight/2;"bubble"!==c.config.chart.type?r.attr({gradientUnits:"userSpaceOnUse",cx:x,cy:b,r:n}):r.attr({cx:.5,cy:.5,r:.8,fx:.2,fy:.2})}else"vertical"===t?r.from(0,0).to(0,1):"diagonal"===t?r.from(0,0).to(1,1):"horizontal"===t?r.from(0,1).to(1,1):"diagonal2"===t&&r.from(1,0).to(0,1);return r}},{key:"getTextBasedOnMaxWidth",value:function(t){var e=t.text,i=t.maxWidth,a=t.fontSize,s=t.fontFamily,r=this.getTextRects(e,a,s),n=r.width/e.length,o=Math.floor(i/n);return i-1){var o=i.globals.selectedDataPoints[s].indexOf(r);i.globals.selectedDataPoints[s].splice(o,1)}}else{if(!i.config.states.active.allowMultipleDataPointsSelection&&i.globals.selectedDataPoints.length>0){i.globals.selectedDataPoints=[];var l=i.globals.dom.Paper.find(".apexcharts-series path:not(.apexcharts-decoration-element)"),h=i.globals.dom.Paper.find(".apexcharts-series circle:not(.apexcharts-decoration-element), .apexcharts-series rect:not(.apexcharts-decoration-element)"),c=function(t){Array.prototype.forEach.call(t,(function(t){t.node.setAttribute("selected","false"),a.getDefaultFilter(t,s)}))};c(l),c(h)}t.node.setAttribute("selected","true"),n="true",void 0===i.globals.selectedDataPoints[s]&&(i.globals.selectedDataPoints[s]=[]),i.globals.selectedDataPoints[s].push(r)}if("true"===n){var d=i.config.states.active.filter;if("none"!==d)a.applyFilter(t,s,d.type);else if("none"!==i.config.states.hover.filter&&!i.globals.isTouchDevice){var u=i.config.states.hover.filter;a.applyFilter(t,s,u.type)}}else if("none"!==i.config.states.active.filter.type)if("none"===i.config.states.hover.filter.type||i.globals.isTouchDevice)a.getDefaultFilter(t,s);else{u=i.config.states.hover.filter;a.applyFilter(t,s,u.type)}"function"==typeof i.config.chart.events.dataPointSelection&&i.config.chart.events.dataPointSelection(e,this.ctx,{selectedDataPoints:i.globals.selectedDataPoints,seriesIndex:s,dataPointIndex:r,w:i}),e&&this.ctx.events.fireEvent("dataPointSelection",[e,this.ctx,{selectedDataPoints:i.globals.selectedDataPoints,seriesIndex:s,dataPointIndex:r,w:i}])}},{key:"rotateAroundCenter",value:function(t){var e={};return t&&"function"==typeof t.getBBox&&(e=t.getBBox()),{x:e.x+e.width/2,y:e.y+e.height/2}}},{key:"getTextRects",value:function(t,e,i,a){var s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],r=this.w,n=this.drawText({x:-200,y:-200,text:t,textAnchor:"start",fontSize:e,fontFamily:i,foreColor:"#fff",opacity:0});a&&n.attr("transform",a),r.globals.dom.Paper.add(n);var o=n.bbox();return s||(o=n.node.getBoundingClientRect()),n.remove(),{width:o.width,height:o.height}}},{key:"placeTextWithEllipsis",value:function(t,e,i){if("function"==typeof t.getComputedTextLength&&(t.textContent=e,e.length>0&&t.getComputedTextLength()>=i/1.1)){for(var a=e.length-3;a>0;a-=3)if(t.getSubStringLength(0,a)<=i/1.1)return void(t.textContent=e.substring(0,a)+"...");t.textContent="."}}}],[{key:"setAttrs",value:function(t,e){for(var i in e)e.hasOwnProperty(i)&&t.setAttribute(i,e[i])}}]),t}(),Pi=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"getStackedSeriesTotals",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=this.w,i=[];if(0===e.globals.series.length)return i;for(var a=0;a0&&void 0!==arguments[0]?arguments[0]:null;return null===t?this.w.config.series.reduce((function(t,e){return t+e}),0):this.w.globals.series[t].reduce((function(t,e){return t+e}),0)}},{key:"getStackedSeriesTotalsByGroups",value:function(){var t=this,e=this.w,i=[];return e.globals.seriesGroups.forEach((function(a){var s=[];e.config.series.forEach((function(t,i){a.indexOf(e.globals.seriesNames[i])>-1&&s.push(i)}));var r=e.globals.series.map((function(t,e){return-1===s.indexOf(e)?e:-1})).filter((function(t){return-1!==t}));i.push(t.getStackedSeriesTotals(r))})),i}},{key:"setSeriesYAxisMappings",value:function(){var t=this.w.globals,e=this.w.config,i=[],a=[],s=[],r=t.series.length>e.yaxis.length||e.yaxis.some((function(t){return Array.isArray(t.seriesName)}));e.series.forEach((function(t,e){s.push(e),a.push(null)})),e.yaxis.forEach((function(t,e){i[e]=[]}));var n=[];e.yaxis.forEach((function(t,a){var o=!1;if(t.seriesName){var l=[];Array.isArray(t.seriesName)?l=t.seriesName:l.push(t.seriesName),l.forEach((function(t){e.series.forEach((function(e,n){if(e.name===t){var l=n;a===n||r?!r||s.indexOf(n)>-1?i[a].push([a,n]):console.warn("Series '"+e.name+"' referenced more than once in what looks like the new style. That is, when using either seriesName: [], or when there are more series than yaxes."):(i[n].push([n,a]),l=a),o=!0,-1!==(l=s.indexOf(l))&&s.splice(l,1)}}))}))}o||n.push(a)})),i=i.map((function(t,e){var i=[];return t.forEach((function(t){a[t[1]]=t[0],i.push(t[1])})),i}));for(var o=e.yaxis.length-1,l=0;l0&&void 0!==arguments[0]?arguments[0]:null;return 0===(null===t?this.w.config.series.filter((function(t){return null!==t})):this.w.config.series[t].data.filter((function(t){return null!==t}))).length}},{key:"seriesHaveSameValues",value:function(t){return this.w.globals.series[t].every((function(t,e,i){return t===i[0]}))}},{key:"getCategoryLabels",value:function(t){var e=this.w,i=t.slice();return e.config.xaxis.convertedCatToNumeric&&(i=t.map((function(t,i){return e.config.xaxis.labels.formatter(t-e.globals.minX+1)}))),i}},{key:"getLargestSeries",value:function(){var t=this.w;t.globals.maxValsInArrayIndex=t.globals.series.map((function(t){return t.length})).indexOf(Math.max.apply(Math,t.globals.series.map((function(t){return t.length}))))}},{key:"getLargestMarkerSize",value:function(){var t=this.w,e=0;return t.globals.markers.size.forEach((function(t){e=Math.max(e,t)})),t.config.markers.discrete&&t.config.markers.discrete.length&&t.config.markers.discrete.forEach((function(t){e=Math.max(e,t.size)})),e>0&&(t.config.markers.hover.size>0?e=t.config.markers.hover.size:e+=t.config.markers.hover.sizeOffset),t.globals.markers.largestSize=e,e}},{key:"getSeriesTotals",value:function(){var t=this.w;t.globals.seriesTotals=t.globals.series.map((function(t,e){var i=0;if(Array.isArray(t))for(var a=0;at&&i.globals.seriesX[s][n]0){var g=function(t,e){var i=s.config.yaxis[s.globals.seriesYAxisReverseMap[e]],r=t<0?-1:1;return t=Math.abs(t),i.logarithmic&&(t=a.getBaseLog(i.logBase,t)),-r*t/n[e]};if(r.isMultipleYAxis){l=[];for(var p=0;p0&&e.forEach((function(e){var n=[],o=[];t.i.forEach((function(i,a){s.config.series[i].group===e&&(n.push(t.series[a]),o.push(i))})),n.length>0&&r.push(a.draw(n,i,o))})),r}}],[{key:"checkComboSeries",value:function(t,e){var i=!1,a=0,s=0;return void 0===e&&(e="line"),t.length&&void 0!==t[0].type&&t.forEach((function(t){"bar"!==t.type&&"column"!==t.type&&"candlestick"!==t.type&&"boxPlot"!==t.type||a++,void 0!==t.type&&t.type!==e&&s++})),s>0&&(i=!0),{comboBarCount:a,comboCharts:i}}},{key:"extendArrayProps",value:function(t,e,i){var a,s,r,n,o,l;(null!==(a=e)&&void 0!==a&&a.yaxis&&(e=t.extendYAxis(e,i)),null!==(s=e)&&void 0!==s&&s.annotations)&&(e.annotations.yaxis&&(e=t.extendYAxisAnnotations(e)),null!==(r=e)&&void 0!==r&&null!==(n=r.annotations)&&void 0!==n&&n.xaxis&&(e=t.extendXAxisAnnotations(e)),null!==(o=e)&&void 0!==o&&null!==(l=o.annotations)&&void 0!==l&&l.points&&(e=t.extendPointAnnotations(e)));return e}}]),t}(),Ii=function(){function t(e){i(this,t),this.w=e.w,this.annoCtx=e}return s(t,[{key:"setOrientations",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=this.w;if("vertical"===t.label.orientation){var a=null!==e?e:0,s=i.globals.dom.baseEl.querySelector(".apexcharts-xaxis-annotations .apexcharts-xaxis-annotation-label[rel='".concat(a,"']"));if(null!==s){var r=s.getBoundingClientRect();s.setAttribute("x",parseFloat(s.getAttribute("x"))-r.height+4);var n="top"===t.label.position?r.width:-r.width;s.setAttribute("y",parseFloat(s.getAttribute("y"))+n);var o=this.annoCtx.graphics.rotateAroundCenter(s),l=o.x,h=o.y;s.setAttribute("transform","rotate(-90 ".concat(l," ").concat(h,")"))}}}},{key:"addBackgroundToAnno",value:function(t,e){var i=this.w;if(!t||!e.label.text||!String(e.label.text).trim())return null;var a=i.globals.dom.baseEl.querySelector(".apexcharts-grid").getBoundingClientRect(),s=t.getBoundingClientRect(),r=e.label.style.padding,n=r.left,o=r.right,l=r.top,h=r.bottom;if("vertical"===e.label.orientation){var c=[n,o,l,h];l=c[0],h=c[1],n=c[2],o=c[3]}var d=s.left-a.left-n,u=s.top-a.top-l,g=this.annoCtx.graphics.drawRect(d-i.globals.barPadForNumericAxis,u,s.width+n+o,s.height+l+h,e.label.borderRadius,e.label.style.background,1,e.label.borderWidth,e.label.borderColor,0);return e.id&&g.node.classList.add(e.id),g}},{key:"annotationsBackground",value:function(){var t=this,e=this.w,i=function(i,a,s){var r=e.globals.dom.baseEl.querySelector(".apexcharts-".concat(s,"-annotations .apexcharts-").concat(s,"-annotation-label[rel='").concat(a,"']"));if(r){var n=r.parentNode,o=t.addBackgroundToAnno(r,i);o&&(n.insertBefore(o.node,r),i.label.mouseEnter&&o.node.addEventListener("mouseenter",i.label.mouseEnter.bind(t,i)),i.label.mouseLeave&&o.node.addEventListener("mouseleave",i.label.mouseLeave.bind(t,i)),i.label.click&&o.node.addEventListener("click",i.label.click.bind(t,i)))}};e.config.annotations.xaxis.forEach((function(t,e){return i(t,e,"xaxis")})),e.config.annotations.yaxis.forEach((function(t,e){return i(t,e,"yaxis")})),e.config.annotations.points.forEach((function(t,e){return i(t,e,"point")}))}},{key:"getY1Y2",value:function(t,e){var i,a=this.w,s="y1"===t?e.y:e.y2,r=!1;if(this.annoCtx.invertAxis){var n=a.config.xaxis.convertedCatToNumeric?a.globals.categoryLabels:a.globals.labels,o=n.indexOf(s),l=a.globals.dom.baseEl.querySelector(".apexcharts-yaxis-texts-g text:nth-child(".concat(o+1,")"));i=l?parseFloat(l.getAttribute("y")):(a.globals.gridHeight/n.length-1)*(o+1)-a.globals.barHeight,void 0!==e.seriesIndex&&a.globals.barHeight&&(i-=a.globals.barHeight/2*(a.globals.series.length-1)-a.globals.barHeight*e.seriesIndex)}else{var h,c=a.globals.seriesYAxisMap[e.yAxisIndex][0],d=a.config.yaxis[e.yAxisIndex].logarithmic?new Pi(this.annoCtx.ctx).getLogVal(a.config.yaxis[e.yAxisIndex].logBase,s,c)/a.globals.yLogRatio[c]:(s-a.globals.minYArr[c])/(a.globals.yRange[c]/a.globals.gridHeight);i=a.globals.gridHeight-Math.min(Math.max(d,0),a.globals.gridHeight),r=d>a.globals.gridHeight||d<0,!e.marker||void 0!==e.y&&null!==e.y||(i=0),null!==(h=a.config.yaxis[e.yAxisIndex])&&void 0!==h&&h.reversed&&(i=d)}return"string"==typeof s&&s.includes("px")&&(i=parseFloat(s)),{yP:i,clipped:r}}},{key:"getX1X2",value:function(t,e){var i=this.w,a="x1"===t?e.x:e.x2,s=this.annoCtx.invertAxis?i.globals.minY:i.globals.minX,r=this.annoCtx.invertAxis?i.globals.maxY:i.globals.maxX,n=this.annoCtx.invertAxis?i.globals.yRange[0]:i.globals.xRange,o=!1,l=this.annoCtx.inversedReversedAxis?(r-a)/(n/i.globals.gridWidth):(a-s)/(n/i.globals.gridWidth);return"category"!==i.config.xaxis.type&&!i.config.xaxis.convertedCatToNumeric||this.annoCtx.invertAxis||i.globals.dataFormatXNumeric||i.config.chart.sparkline.enabled||(l=this.getStringX(a)),"string"==typeof a&&a.includes("px")&&(l=parseFloat(a)),null==a&&e.marker&&(l=i.globals.gridWidth),void 0!==e.seriesIndex&&i.globals.barWidth&&!this.annoCtx.invertAxis&&(l-=i.globals.barWidth/2*(i.globals.series.length-1)-i.globals.barWidth*e.seriesIndex),l>i.globals.gridWidth?(l=i.globals.gridWidth,o=!0):l<0&&(l=0,o=!0),{x:l,clipped:o}}},{key:"getStringX",value:function(t){var e=this.w,i=t;e.config.xaxis.convertedCatToNumeric&&e.globals.categoryLabels.length&&(t=e.globals.categoryLabels.indexOf(t)+1);var a=e.globals.labels.map((function(t){return Array.isArray(t)?t.join(" "):t})).indexOf(t),s=e.globals.dom.baseEl.querySelector(".apexcharts-xaxis-texts-g text:nth-child(".concat(a+1,")"));return s&&(i=parseFloat(s.getAttribute("x"))),i}}]),t}(),Ti=function(){function t(e){i(this,t),this.w=e.w,this.annoCtx=e,this.invertAxis=this.annoCtx.invertAxis,this.helpers=new Ii(this.annoCtx)}return s(t,[{key:"addXaxisAnnotation",value:function(t,e,i){var a,s=this.w,r=this.helpers.getX1X2("x1",t),n=r.x,o=r.clipped,l=!0,h=t.label.text,c=t.strokeDashArray;if(v.isNumber(n)){if(null===t.x2||void 0===t.x2){if(!o){var d=this.annoCtx.graphics.drawLine(n+t.offsetX,0+t.offsetY,n+t.offsetX,s.globals.gridHeight+t.offsetY,t.borderColor,c,t.borderWidth);e.appendChild(d.node),t.id&&d.node.classList.add(t.id)}}else{var u=this.helpers.getX1X2("x2",t);if(a=u.x,l=u.clipped,a12?u-12:0===u?12:u;e=(e=(e=(e=e.replace(/(^|[^\\])HH+/g,"$1"+l(u))).replace(/(^|[^\\])H/g,"$1"+u)).replace(/(^|[^\\])hh+/g,"$1"+l(g))).replace(/(^|[^\\])h/g,"$1"+g);var p=a?t.getUTCMinutes():t.getMinutes();e=(e=e.replace(/(^|[^\\])mm+/g,"$1"+l(p))).replace(/(^|[^\\])m/g,"$1"+p);var x=a?t.getUTCSeconds():t.getSeconds();e=(e=e.replace(/(^|[^\\])ss+/g,"$1"+l(x))).replace(/(^|[^\\])s/g,"$1"+x);var b=a?t.getUTCMilliseconds():t.getMilliseconds();e=e.replace(/(^|[^\\])fff+/g,"$1"+l(b,3)),b=Math.round(b/10),e=e.replace(/(^|[^\\])ff/g,"$1"+l(b)),b=Math.round(b/10);var m=u<12?"AM":"PM";e=(e=(e=e.replace(/(^|[^\\])f/g,"$1"+b)).replace(/(^|[^\\])TT+/g,"$1"+m)).replace(/(^|[^\\])T/g,"$1"+m.charAt(0));var v=m.toLowerCase();e=(e=e.replace(/(^|[^\\])tt+/g,"$1"+v)).replace(/(^|[^\\])t/g,"$1"+v.charAt(0));var y=-t.getTimezoneOffset(),w=a||!y?"Z":y>0?"+":"-";if(!a){var k=(y=Math.abs(y))%60;w+=l(Math.floor(y/60))+":"+l(k)}e=e.replace(/(^|[^\\])K/g,"$1"+w);var A=(a?t.getUTCDay():t.getDay())+1;return e=(e=(e=(e=(e=e.replace(new RegExp(n[0],"g"),n[A])).replace(new RegExp(o[0],"g"),o[A])).replace(new RegExp(s[0],"g"),s[c])).replace(new RegExp(r[0],"g"),r[c])).replace(/\\(.)/g,"$1")}},{key:"getTimeUnitsfromTimestamp",value:function(t,e,i){var a=this.w;void 0!==a.config.xaxis.min&&(t=a.config.xaxis.min),void 0!==a.config.xaxis.max&&(e=a.config.xaxis.max);var s=this.getDate(t),r=this.getDate(e),n=this.formatDate(s,"yyyy MM dd HH mm ss fff").split(" "),o=this.formatDate(r,"yyyy MM dd HH mm ss fff").split(" ");return{minMillisecond:parseInt(n[6],10),maxMillisecond:parseInt(o[6],10),minSecond:parseInt(n[5],10),maxSecond:parseInt(o[5],10),minMinute:parseInt(n[4],10),maxMinute:parseInt(o[4],10),minHour:parseInt(n[3],10),maxHour:parseInt(o[3],10),minDate:parseInt(n[2],10),maxDate:parseInt(o[2],10),minMonth:parseInt(n[1],10)-1,maxMonth:parseInt(o[1],10)-1,minYear:parseInt(n[0],10),maxYear:parseInt(o[0],10)}}},{key:"isLeapYear",value:function(t){return t%4==0&&t%100!=0||t%400==0}},{key:"calculcateLastDaysOfMonth",value:function(t,e,i){return this.determineDaysOfMonths(t,e)-i}},{key:"determineDaysOfYear",value:function(t){var e=365;return this.isLeapYear(t)&&(e=366),e}},{key:"determineRemainingDaysOfYear",value:function(t,e,i){var a=this.daysCntOfYear[e]+i;return e>1&&this.isLeapYear()&&a++,a}},{key:"determineDaysOfMonths",value:function(t,e){var i=30;switch(t=v.monthMod(t),!0){case this.months30.indexOf(t)>-1:2===t&&(i=this.isLeapYear(e)?29:28);break;case this.months31.indexOf(t)>-1:default:i=31}return i}}]),t}(),Xi=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.tooltipKeyFormat="dd MMM"}return s(t,[{key:"xLabelFormat",value:function(t,e,i,a){var s=this.w;if("datetime"===s.config.xaxis.type&&void 0===s.config.xaxis.labels.formatter&&void 0===s.config.tooltip.x.formatter){var r=new zi(this.ctx);return r.formatDate(r.getDate(e),s.config.tooltip.x.format)}return t(e,i,a)}},{key:"defaultGeneralFormatter",value:function(t){return Array.isArray(t)?t.map((function(t){return t})):t}},{key:"defaultYFormatter",value:function(t,e,i){var a=this.w;if(v.isNumber(t))if(0!==a.globals.yValueDecimal)t=t.toFixed(void 0!==e.decimalsInFloat?e.decimalsInFloat:a.globals.yValueDecimal);else{var s=t.toFixed(0);t=t==s?s:t.toFixed(1)}return t}},{key:"setLabelFormatters",value:function(){var t=this,e=this.w;return e.globals.xaxisTooltipFormatter=function(e){return t.defaultGeneralFormatter(e)},e.globals.ttKeyFormatter=function(e){return t.defaultGeneralFormatter(e)},e.globals.ttZFormatter=function(t){return t},e.globals.legendFormatter=function(e){return t.defaultGeneralFormatter(e)},void 0!==e.config.xaxis.labels.formatter?e.globals.xLabelFormatter=e.config.xaxis.labels.formatter:e.globals.xLabelFormatter=function(t){if(v.isNumber(t)){if(!e.config.xaxis.convertedCatToNumeric&&"numeric"===e.config.xaxis.type){if(v.isNumber(e.config.xaxis.decimalsInFloat))return t.toFixed(e.config.xaxis.decimalsInFloat);var i=e.globals.maxX-e.globals.minX;return i>0&&i<100?t.toFixed(1):t.toFixed(0)}if(e.globals.isBarHorizontal)if(e.globals.maxY-e.globals.minYArr<4)return t.toFixed(1);return t.toFixed(0)}return t},"function"==typeof e.config.tooltip.x.formatter?e.globals.ttKeyFormatter=e.config.tooltip.x.formatter:e.globals.ttKeyFormatter=e.globals.xLabelFormatter,"function"==typeof e.config.xaxis.tooltip.formatter&&(e.globals.xaxisTooltipFormatter=e.config.xaxis.tooltip.formatter),(Array.isArray(e.config.tooltip.y)||void 0!==e.config.tooltip.y.formatter)&&(e.globals.ttVal=e.config.tooltip.y),void 0!==e.config.tooltip.z.formatter&&(e.globals.ttZFormatter=e.config.tooltip.z.formatter),void 0!==e.config.legend.formatter&&(e.globals.legendFormatter=e.config.legend.formatter),e.config.yaxis.forEach((function(i,a){void 0!==i.labels.formatter?e.globals.yLabelFormatters[a]=i.labels.formatter:e.globals.yLabelFormatters[a]=function(s){return e.globals.xyCharts?Array.isArray(s)?s.map((function(e){return t.defaultYFormatter(e,i,a)})):t.defaultYFormatter(s,i,a):s}})),e.globals}},{key:"heatmapLabelFormatters",value:function(){var t=this.w;if("heatmap"===t.config.chart.type){t.globals.yAxisScale[0].result=t.globals.seriesNames.slice();var e=t.globals.seriesNames.reduce((function(t,e){return t.length>e.length?t:e}),0);t.globals.yAxisScale[0].niceMax=e,t.globals.yAxisScale[0].niceMin=e}}}]),t}(),Ri=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"getLabel",value:function(t,e,i,a){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"12px",n=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=this.w,l=void 0===t[a]?"":t[a],h=l,c=o.globals.xLabelFormatter,d=o.config.xaxis.labels.formatter,u=!1,g=new Xi(this.ctx),p=l;n&&(h=g.xLabelFormat(c,l,p,{i:a,dateFormatter:new zi(this.ctx).formatDate,w:o}),void 0!==d&&(h=d(l,t[a],{i:a,dateFormatter:new zi(this.ctx).formatDate,w:o})));var f,x;e.length>0?(f=e[a].unit,x=null,e.forEach((function(t){"month"===t.unit?x="year":"day"===t.unit?x="month":"hour"===t.unit?x="day":"minute"===t.unit&&(x="hour")})),u=x===f,i=e[a].position,h=e[a].value):"datetime"===o.config.xaxis.type&&void 0===d&&(h=""),void 0===h&&(h=""),h=Array.isArray(h)?h:h.toString();var b=new Mi(this.ctx),m={};m=o.globals.rotateXLabels&&n?b.getTextRects(h,parseInt(r,10),null,"rotate(".concat(o.config.xaxis.labels.rotate," 0 0)"),!1):b.getTextRects(h,parseInt(r,10));var v=!o.config.xaxis.labels.showDuplicates&&this.ctx.timeScale;return!Array.isArray(h)&&("NaN"===String(h)||s.indexOf(h)>=0&&v)&&(h=""),{x:i,text:h,textRect:m,isBold:u}}},{key:"checkLabelBasedOnTickamount",value:function(t,e,i){var a=this.w,s=a.config.xaxis.tickAmount;return"dataPoints"===s&&(s=Math.round(a.globals.gridWidth/120)),s>i||t%Math.round(i/(s+1))==0||(e.text=""),e}},{key:"checkForOverflowingLabels",value:function(t,e,i,a,s){var r=this.w;if(0===t&&r.globals.skipFirstTimelinelabel&&(e.text=""),t===i-1&&r.globals.skipLastTimelinelabel&&(e.text=""),r.config.xaxis.labels.hideOverlappingLabels&&a.length>0){var n=s[s.length-1];e.xa.length||a.some((function(t){return Array.isArray(t.seriesName)}))?t:i.seriesYAxisReverseMap[t]}},{key:"isYAxisHidden",value:function(t){var e=this.w,i=e.config.yaxis[t];if(!i.show||this.yAxisAllSeriesCollapsed(t))return!0;if(!i.showForNullSeries){var a=e.globals.seriesYAxisMap[t],s=new Pi(this.ctx);return a.every((function(t){return s.isSeriesNull(t)}))}return!1}},{key:"getYAxisForeColor",value:function(t,e){var i=this.w;return Array.isArray(t)&&i.globals.yAxisScale[e]&&this.ctx.theme.pushExtraColors(t,i.globals.yAxisScale[e].result.length,!1),t}},{key:"drawYAxisTicks",value:function(t,e,i,a,s,r,n){var o=this.w,l=new Mi(this.ctx),h=o.globals.translateY+o.config.yaxis[s].labels.offsetY;if(o.globals.isBarHorizontal?h=0:"heatmap"===o.config.chart.type&&(h+=r/2),a.show&&e>0){!0===o.config.yaxis[s].opposite&&(t+=a.width);for(var c=e;c>=0;c--){var d=l.drawLine(t+i.offsetX-a.width+a.offsetX,h+a.offsetY,t+i.offsetX+a.offsetX,h+a.offsetY,a.color);n.add(d),h+=r}}}}]),t}(),Ei=function(){function t(e){i(this,t),this.w=e.w,this.annoCtx=e,this.helpers=new Ii(this.annoCtx),this.axesUtils=new Ri(this.annoCtx)}return s(t,[{key:"addYaxisAnnotation",value:function(t,e,i){var a,s=this.w,r=t.strokeDashArray,n=this.helpers.getY1Y2("y1",t),o=n.yP,l=n.clipped,h=!0,c=!1,d=t.label.text;if(null===t.y2||void 0===t.y2){if(!l){c=!0;var u=this.annoCtx.graphics.drawLine(0+t.offsetX,o+t.offsetY,this._getYAxisAnnotationWidth(t),o+t.offsetY,t.borderColor,r,t.borderWidth);e.appendChild(u.node),t.id&&u.node.classList.add(t.id)}}else{if(a=(n=this.helpers.getY1Y2("y2",t)).yP,h=n.clipped,a>o){var g=o;o=a,a=g}if(!l||!h){c=!0;var p=this.annoCtx.graphics.drawRect(0+t.offsetX,a+t.offsetY,this._getYAxisAnnotationWidth(t),o-a,0,t.fillColor,t.opacity,1,t.borderColor,r);p.node.classList.add("apexcharts-annotation-rect"),p.attr("clip-path","url(#gridRectMask".concat(s.globals.cuid,")")),e.appendChild(p.node),t.id&&p.node.classList.add(t.id)}}if(c){var f="right"===t.label.position?s.globals.gridWidth:"center"===t.label.position?s.globals.gridWidth/2:0,x=this.annoCtx.graphics.drawText({x:f+t.label.offsetX,y:(null!=a?a:o)+t.label.offsetY-3,text:d,textAnchor:t.label.textAnchor,fontSize:t.label.style.fontSize,fontFamily:t.label.style.fontFamily,fontWeight:t.label.style.fontWeight,foreColor:t.label.style.color,cssClass:"apexcharts-yaxis-annotation-label ".concat(t.label.style.cssClass," ").concat(t.id?t.id:"")});x.attr({rel:i}),e.appendChild(x.node)}}},{key:"_getYAxisAnnotationWidth",value:function(t){var e=this.w;e.globals.gridWidth;return(t.width.indexOf("%")>-1?e.globals.gridWidth*parseInt(t.width,10)/100:parseInt(t.width,10))+t.offsetX}},{key:"drawYAxisAnnotations",value:function(){var t=this,e=this.w,i=this.annoCtx.graphics.group({class:"apexcharts-yaxis-annotations"});return e.config.annotations.yaxis.forEach((function(e,a){e.yAxisIndex=t.axesUtils.translateYAxisIndex(e.yAxisIndex),t.axesUtils.isYAxisHidden(e.yAxisIndex)&&t.axesUtils.yAxisAllSeriesCollapsed(e.yAxisIndex)||t.addYaxisAnnotation(e,i.node,a)})),i}}]),t}(),Yi=function(){function t(e){i(this,t),this.w=e.w,this.annoCtx=e,this.helpers=new Ii(this.annoCtx)}return s(t,[{key:"addPointAnnotation",value:function(t,e,i){if(!(this.w.globals.collapsedSeriesIndices.indexOf(t.seriesIndex)>-1)){var a=this.helpers.getX1X2("x1",t),s=a.x,r=a.clipped,n=(a=this.helpers.getY1Y2("y1",t)).yP,o=a.clipped;if(v.isNumber(s)&&!o&&!r){var l={pSize:t.marker.size,pointStrokeWidth:t.marker.strokeWidth,pointFillColor:t.marker.fillColor,pointStrokeColor:t.marker.strokeColor,shape:t.marker.shape,pRadius:t.marker.radius,class:"apexcharts-point-annotation-marker ".concat(t.marker.cssClass," ").concat(t.id?t.id:"")},h=this.annoCtx.graphics.drawMarker(s+t.marker.offsetX,n+t.marker.offsetY,l);e.appendChild(h.node);var c=t.label.text?t.label.text:"",d=this.annoCtx.graphics.drawText({x:s+t.label.offsetX,y:n+t.label.offsetY-t.marker.size-parseFloat(t.label.style.fontSize)/1.6,text:c,textAnchor:t.label.textAnchor,fontSize:t.label.style.fontSize,fontFamily:t.label.style.fontFamily,fontWeight:t.label.style.fontWeight,foreColor:t.label.style.color,cssClass:"apexcharts-point-annotation-label ".concat(t.label.style.cssClass," ").concat(t.id?t.id:"")});if(d.attr({rel:i}),e.appendChild(d.node),t.customSVG.SVG){var u=this.annoCtx.graphics.group({class:"apexcharts-point-annotations-custom-svg "+t.customSVG.cssClass});u.attr({transform:"translate(".concat(s+t.customSVG.offsetX,", ").concat(n+t.customSVG.offsetY,")")}),u.node.innerHTML=t.customSVG.SVG,e.appendChild(u.node)}if(t.image.path){var g=t.image.width?t.image.width:20,p=t.image.height?t.image.height:20;h=this.annoCtx.addImage({x:s+t.image.offsetX-g/2,y:n+t.image.offsetY-p/2,width:g,height:p,path:t.image.path,appendTo:".apexcharts-point-annotations"})}t.mouseEnter&&h.node.addEventListener("mouseenter",t.mouseEnter.bind(this,t)),t.mouseLeave&&h.node.addEventListener("mouseleave",t.mouseLeave.bind(this,t)),t.click&&h.node.addEventListener("click",t.click.bind(this,t))}}}},{key:"drawPointAnnotations",value:function(){var t=this,e=this.w,i=this.annoCtx.graphics.group({class:"apexcharts-point-annotations"});return e.config.annotations.points.map((function(e,a){t.addPointAnnotation(e,i.node,a)})),i}}]),t}();var Hi={name:"en",options:{months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],toolbar:{exportToSVG:"Download SVG",exportToPNG:"Download PNG",exportToCSV:"Download CSV",menu:"Menu",selection:"Selection",selectionZoom:"Selection Zoom",zoomIn:"Zoom In",zoomOut:"Zoom Out",pan:"Panning",reset:"Reset Zoom"}}},Oi=function(){function t(){i(this,t),this.yAxis={show:!0,showAlways:!1,showForNullSeries:!0,seriesName:void 0,opposite:!1,reversed:!1,logarithmic:!1,logBase:10,tickAmount:void 0,stepSize:void 0,forceNiceScale:!1,max:void 0,min:void 0,floating:!1,decimalsInFloat:void 0,labels:{show:!0,showDuplicates:!1,minWidth:0,maxWidth:160,offsetX:0,offsetY:0,align:void 0,rotate:0,padding:20,style:{colors:[],fontSize:"11px",fontWeight:400,fontFamily:void 0,cssClass:""},formatter:void 0},axisBorder:{show:!1,color:"#e0e0e0",width:1,offsetX:0,offsetY:0},axisTicks:{show:!1,color:"#e0e0e0",width:6,offsetX:0,offsetY:0},title:{text:void 0,rotate:-90,offsetY:0,offsetX:0,style:{color:void 0,fontSize:"11px",fontWeight:900,fontFamily:void 0,cssClass:""}},tooltip:{enabled:!1,offsetX:0},crosshairs:{show:!0,position:"front",stroke:{color:"#b6b6b6",width:1,dashArray:0}}},this.pointAnnotation={id:void 0,x:0,y:null,yAxisIndex:0,seriesIndex:void 0,mouseEnter:void 0,mouseLeave:void 0,click:void 0,marker:{size:4,fillColor:"#fff",strokeWidth:2,strokeColor:"#333",shape:"circle",offsetX:0,offsetY:0,cssClass:""},label:{borderColor:"#c2c2c2",borderWidth:1,borderRadius:2,text:void 0,textAnchor:"middle",offsetX:0,offsetY:0,mouseEnter:void 0,mouseLeave:void 0,click:void 0,style:{background:"#fff",color:void 0,fontSize:"11px",fontFamily:void 0,fontWeight:400,cssClass:"",padding:{left:5,right:5,top:2,bottom:2}}},customSVG:{SVG:void 0,cssClass:void 0,offsetX:0,offsetY:0},image:{path:void 0,width:20,height:20,offsetX:0,offsetY:0}},this.yAxisAnnotation={id:void 0,y:0,y2:null,strokeDashArray:1,fillColor:"#c2c2c2",borderColor:"#c2c2c2",borderWidth:1,opacity:.3,offsetX:0,offsetY:0,width:"100%",yAxisIndex:0,label:{borderColor:"#c2c2c2",borderWidth:1,borderRadius:2,text:void 0,textAnchor:"end",position:"right",offsetX:0,offsetY:-3,mouseEnter:void 0,mouseLeave:void 0,click:void 0,style:{background:"#fff",color:void 0,fontSize:"11px",fontFamily:void 0,fontWeight:400,cssClass:"",padding:{left:5,right:5,top:2,bottom:2}}}},this.xAxisAnnotation={id:void 0,x:0,x2:null,strokeDashArray:1,fillColor:"#c2c2c2",borderColor:"#c2c2c2",borderWidth:1,opacity:.3,offsetX:0,offsetY:0,label:{borderColor:"#c2c2c2",borderWidth:1,borderRadius:2,text:void 0,textAnchor:"middle",orientation:"vertical",position:"top",offsetX:0,offsetY:0,mouseEnter:void 0,mouseLeave:void 0,click:void 0,style:{background:"#fff",color:void 0,fontSize:"11px",fontFamily:void 0,fontWeight:400,cssClass:"",padding:{left:5,right:5,top:2,bottom:2}}}},this.text={x:0,y:0,text:"",textAnchor:"start",foreColor:void 0,fontSize:"13px",fontFamily:void 0,fontWeight:400,appendTo:".apexcharts-annotations",backgroundColor:"transparent",borderColor:"#c2c2c2",borderRadius:0,borderWidth:0,paddingLeft:4,paddingRight:4,paddingTop:2,paddingBottom:2}}return s(t,[{key:"init",value:function(){return{annotations:{yaxis:[this.yAxisAnnotation],xaxis:[this.xAxisAnnotation],points:[this.pointAnnotation],texts:[],images:[],shapes:[]},chart:{animations:{enabled:!0,speed:800,animateGradually:{delay:150,enabled:!0},dynamicAnimation:{enabled:!0,speed:350}},background:"",locales:[Hi],defaultLocale:"en",dropShadow:{enabled:!1,enabledOnSeries:void 0,top:2,left:2,blur:4,color:"#000",opacity:.7},events:{animationEnd:void 0,beforeMount:void 0,mounted:void 0,updated:void 0,click:void 0,mouseMove:void 0,mouseLeave:void 0,xAxisLabelClick:void 0,legendClick:void 0,markerClick:void 0,selection:void 0,dataPointSelection:void 0,dataPointMouseEnter:void 0,dataPointMouseLeave:void 0,beforeZoom:void 0,beforeResetZoom:void 0,zoomed:void 0,scrolled:void 0,brushScrolled:void 0},foreColor:"#373d3f",fontFamily:"Helvetica, Arial, sans-serif",height:"auto",parentHeightOffset:15,redrawOnParentResize:!0,redrawOnWindowResize:!0,id:void 0,group:void 0,nonce:void 0,offsetX:0,offsetY:0,selection:{enabled:!1,type:"x",fill:{color:"#24292e",opacity:.1},stroke:{width:1,color:"#24292e",opacity:.4,dashArray:3},xaxis:{min:void 0,max:void 0},yaxis:{min:void 0,max:void 0}},sparkline:{enabled:!1},brush:{enabled:!1,autoScaleYaxis:!0,target:void 0,targets:void 0},stacked:!1,stackOnlyBar:!0,stackType:"normal",toolbar:{show:!0,offsetX:0,offsetY:0,tools:{download:!0,selection:!0,zoom:!0,zoomin:!0,zoomout:!0,pan:!0,reset:!0,customIcons:[]},export:{csv:{filename:void 0,columnDelimiter:",",headerCategory:"category",headerValue:"value",categoryFormatter:void 0,valueFormatter:void 0},png:{filename:void 0},svg:{filename:void 0},scale:void 0,width:void 0},autoSelected:"zoom"},type:"line",width:"100%",zoom:{enabled:!0,type:"x",autoScaleYaxis:!1,allowMouseWheelZoom:!0,zoomedArea:{fill:{color:"#90CAF9",opacity:.4},stroke:{color:"#0D47A1",opacity:.4,width:1}}}},plotOptions:{line:{isSlopeChart:!1,colors:{threshold:0,colorAboveThreshold:void 0,colorBelowThreshold:void 0}},area:{fillTo:"origin"},bar:{horizontal:!1,columnWidth:"70%",barHeight:"70%",distributed:!1,borderRadius:0,borderRadiusApplication:"around",borderRadiusWhenStacked:"last",rangeBarOverlap:!0,rangeBarGroupRows:!1,hideZeroBarsWhenGrouped:!1,isDumbbell:!1,dumbbellColors:void 0,isFunnel:!1,isFunnel3d:!0,colors:{ranges:[],backgroundBarColors:[],backgroundBarOpacity:1,backgroundBarRadius:0},dataLabels:{position:"top",maxItems:100,hideOverflowingLabels:!0,orientation:"horizontal",total:{enabled:!1,formatter:void 0,offsetX:0,offsetY:0,style:{color:"#373d3f",fontSize:"12px",fontFamily:void 0,fontWeight:600}}}},bubble:{zScaling:!0,minBubbleRadius:void 0,maxBubbleRadius:void 0},candlestick:{colors:{upward:"#00B746",downward:"#EF403C"},wick:{useFillColor:!0}},boxPlot:{colors:{upper:"#00E396",lower:"#008FFB"}},heatmap:{radius:2,enableShades:!0,shadeIntensity:.5,reverseNegativeShade:!1,distributed:!1,useFillColorAsStroke:!1,colorScale:{inverse:!1,ranges:[],min:void 0,max:void 0}},treemap:{enableShades:!0,shadeIntensity:.5,distributed:!1,reverseNegativeShade:!1,useFillColorAsStroke:!1,borderRadius:4,dataLabels:{format:"scale"},colorScale:{inverse:!1,ranges:[],min:void 0,max:void 0},seriesTitle:{show:!0,offsetY:1,offsetX:1,borderColor:"#000",borderWidth:1,borderRadius:2,style:{background:"rgba(0, 0, 0, 0.6)",color:"#fff",fontSize:"12px",fontFamily:void 0,fontWeight:400,cssClass:"",padding:{left:6,right:6,top:2,bottom:2}}}},radialBar:{inverseOrder:!1,startAngle:0,endAngle:360,offsetX:0,offsetY:0,hollow:{margin:5,size:"50%",background:"transparent",image:void 0,imageWidth:150,imageHeight:150,imageOffsetX:0,imageOffsetY:0,imageClipped:!0,position:"front",dropShadow:{enabled:!1,top:0,left:0,blur:3,color:"#000",opacity:.5}},track:{show:!0,startAngle:void 0,endAngle:void 0,background:"#f2f2f2",strokeWidth:"97%",opacity:1,margin:5,dropShadow:{enabled:!1,top:0,left:0,blur:3,color:"#000",opacity:.5}},dataLabels:{show:!0,name:{show:!0,fontSize:"16px",fontFamily:void 0,fontWeight:600,color:void 0,offsetY:0,formatter:function(t){return t}},value:{show:!0,fontSize:"14px",fontFamily:void 0,fontWeight:400,color:void 0,offsetY:16,formatter:function(t){return t+"%"}},total:{show:!1,label:"Total",fontSize:"16px",fontWeight:600,fontFamily:void 0,color:void 0,formatter:function(t){return t.globals.seriesTotals.reduce((function(t,e){return t+e}),0)/t.globals.series.length+"%"}}},barLabels:{enabled:!1,offsetX:0,offsetY:0,useSeriesColors:!0,fontFamily:void 0,fontWeight:600,fontSize:"16px",formatter:function(t){return t},onClick:void 0}},pie:{customScale:1,offsetX:0,offsetY:0,startAngle:0,endAngle:360,expandOnClick:!0,dataLabels:{offset:0,minAngleToShowLabel:10},donut:{size:"65%",background:"transparent",labels:{show:!1,name:{show:!0,fontSize:"16px",fontFamily:void 0,fontWeight:600,color:void 0,offsetY:-10,formatter:function(t){return t}},value:{show:!0,fontSize:"20px",fontFamily:void 0,fontWeight:400,color:void 0,offsetY:10,formatter:function(t){return t}},total:{show:!1,showAlways:!1,label:"Total",fontSize:"16px",fontWeight:400,fontFamily:void 0,color:void 0,formatter:function(t){return t.globals.seriesTotals.reduce((function(t,e){return t+e}),0)}}}}},polarArea:{rings:{strokeWidth:1,strokeColor:"#e8e8e8"},spokes:{strokeWidth:1,connectorColors:"#e8e8e8"}},radar:{size:void 0,offsetX:0,offsetY:0,polygons:{strokeWidth:1,strokeColors:"#e8e8e8",connectorColors:"#e8e8e8",fill:{colors:void 0}}}},colors:void 0,dataLabels:{enabled:!0,enabledOnSeries:void 0,formatter:function(t){return null!==t?t:""},textAnchor:"middle",distributed:!1,offsetX:0,offsetY:0,style:{fontSize:"12px",fontFamily:void 0,fontWeight:600,colors:void 0},background:{enabled:!0,foreColor:"#fff",borderRadius:2,padding:4,opacity:.9,borderWidth:1,borderColor:"#fff",dropShadow:{enabled:!1,top:1,left:1,blur:1,color:"#000",opacity:.8}},dropShadow:{enabled:!1,top:1,left:1,blur:1,color:"#000",opacity:.8}},fill:{type:"solid",colors:void 0,opacity:.85,gradient:{shade:"dark",type:"horizontal",shadeIntensity:.5,gradientToColors:void 0,inverseColors:!0,opacityFrom:1,opacityTo:1,stops:[0,50,100],colorStops:[]},image:{src:[],width:void 0,height:void 0},pattern:{style:"squares",width:6,height:6,strokeWidth:2}},forecastDataPoints:{count:0,fillOpacity:.5,strokeWidth:void 0,dashArray:4},grid:{show:!0,borderColor:"#e0e0e0",strokeDashArray:0,position:"back",xaxis:{lines:{show:!1}},yaxis:{lines:{show:!0}},row:{colors:void 0,opacity:.5},column:{colors:void 0,opacity:.5},padding:{top:0,right:10,bottom:0,left:12}},labels:[],legend:{show:!0,showForSingleSeries:!1,showForNullSeries:!0,showForZeroSeries:!0,floating:!1,position:"bottom",horizontalAlign:"center",inverseOrder:!1,fontSize:"12px",fontFamily:void 0,fontWeight:400,width:void 0,height:void 0,formatter:void 0,tooltipHoverFormatter:void 0,offsetX:-20,offsetY:4,customLegendItems:[],clusterGroupedSeries:!0,clusterGroupedSeriesOrientation:"vertical",labels:{colors:void 0,useSeriesColors:!1},markers:{size:7,fillColors:void 0,strokeWidth:1,shape:void 0,offsetX:0,offsetY:0,customHTML:void 0,onClick:void 0},itemMargin:{horizontal:5,vertical:4},onItemClick:{toggleDataSeries:!0},onItemHover:{highlightDataSeries:!0}},markers:{discrete:[],size:0,colors:void 0,strokeColors:"#fff",strokeWidth:2,strokeOpacity:.9,strokeDashArray:0,fillOpacity:1,shape:"circle",offsetX:0,offsetY:0,showNullDataPoints:!0,onClick:void 0,onDblClick:void 0,hover:{size:void 0,sizeOffset:3}},noData:{text:void 0,align:"center",verticalAlign:"middle",offsetX:0,offsetY:0,style:{color:void 0,fontSize:"14px",fontFamily:void 0}},responsive:[],series:void 0,states:{hover:{filter:{type:"lighten"}},active:{allowMultipleDataPointsSelection:!1,filter:{type:"darken"}}},title:{text:void 0,align:"left",margin:5,offsetX:0,offsetY:0,floating:!1,style:{fontSize:"14px",fontWeight:900,fontFamily:void 0,color:void 0}},subtitle:{text:void 0,align:"left",margin:5,offsetX:0,offsetY:30,floating:!1,style:{fontSize:"12px",fontWeight:400,fontFamily:void 0,color:void 0}},stroke:{show:!0,curve:"smooth",lineCap:"butt",width:2,colors:void 0,dashArray:0,fill:{type:"solid",colors:void 0,opacity:.85,gradient:{shade:"dark",type:"horizontal",shadeIntensity:.5,gradientToColors:void 0,inverseColors:!0,opacityFrom:1,opacityTo:1,stops:[0,50,100],colorStops:[]}}},tooltip:{enabled:!0,enabledOnSeries:void 0,shared:!0,hideEmptySeries:!1,followCursor:!1,intersect:!1,inverseOrder:!1,custom:void 0,fillSeriesColor:!1,theme:"light",cssClass:"",style:{fontSize:"12px",fontFamily:void 0},onDatasetHover:{highlightDataSeries:!1},x:{show:!0,format:"dd MMM",formatter:void 0},y:{formatter:void 0,title:{formatter:function(t){return t?t+": ":""}}},z:{formatter:void 0,title:"Size: "},marker:{show:!0,fillColors:void 0},items:{display:"flex"},fixed:{enabled:!1,position:"topRight",offsetX:0,offsetY:0}},xaxis:{type:"category",categories:[],convertedCatToNumeric:!1,offsetX:0,offsetY:0,overwriteCategories:void 0,labels:{show:!0,rotate:-45,rotateAlways:!1,hideOverlappingLabels:!0,trim:!1,minHeight:void 0,maxHeight:120,showDuplicates:!0,style:{colors:[],fontSize:"12px",fontWeight:400,fontFamily:void 0,cssClass:""},offsetX:0,offsetY:0,format:void 0,formatter:void 0,datetimeUTC:!0,datetimeFormatter:{year:"yyyy",month:"MMM 'yy",day:"dd MMM",hour:"HH:mm",minute:"HH:mm:ss",second:"HH:mm:ss"}},group:{groups:[],style:{colors:[],fontSize:"12px",fontWeight:400,fontFamily:void 0,cssClass:""}},axisBorder:{show:!0,color:"#e0e0e0",width:"100%",height:1,offsetX:0,offsetY:0},axisTicks:{show:!0,color:"#e0e0e0",height:6,offsetX:0,offsetY:0},stepSize:void 0,tickAmount:void 0,tickPlacement:"on",min:void 0,max:void 0,range:void 0,floating:!1,decimalsInFloat:void 0,position:"bottom",title:{text:void 0,offsetX:0,offsetY:0,style:{color:void 0,fontSize:"12px",fontWeight:900,fontFamily:void 0,cssClass:""}},crosshairs:{show:!0,width:1,position:"back",opacity:.9,stroke:{color:"#b6b6b6",width:1,dashArray:3},fill:{type:"solid",color:"#B1B9C4",gradient:{colorFrom:"#D8E3F0",colorTo:"#BED1E6",stops:[0,100],opacityFrom:.4,opacityTo:.5}},dropShadow:{enabled:!1,left:0,top:0,blur:1,opacity:.8}},tooltip:{enabled:!0,offsetY:0,formatter:void 0,style:{fontSize:"12px",fontFamily:void 0}}},yaxis:this.yAxis,theme:{mode:"",palette:"palette1",monochrome:{enabled:!1,color:"#008FFB",shadeTo:"light",shadeIntensity:.65}}}}}]),t}(),Fi=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.graphics=new Mi(this.ctx),this.w.globals.isBarHorizontal&&(this.invertAxis=!0),this.helpers=new Ii(this),this.xAxisAnnotations=new Ti(this),this.yAxisAnnotations=new Ei(this),this.pointsAnnotations=new Yi(this),this.w.globals.isBarHorizontal&&this.w.config.yaxis[0].reversed&&(this.inversedReversedAxis=!0),this.xDivision=this.w.globals.gridWidth/this.w.globals.dataPoints}return s(t,[{key:"drawAxesAnnotations",value:function(){var t=this.w;if(t.globals.axisCharts&&t.globals.dataPoints){for(var e=this.yAxisAnnotations.drawYAxisAnnotations(),i=this.xAxisAnnotations.drawXAxisAnnotations(),a=this.pointsAnnotations.drawPointAnnotations(),s=t.config.chart.animations.enabled,r=[e,i,a],n=[i.node,e.node,a.node],o=0;o<3;o++)t.globals.dom.elGraphical.add(r[o]),!s||t.globals.resized||t.globals.dataChanged||"scatter"!==t.config.chart.type&&"bubble"!==t.config.chart.type&&t.globals.dataPoints>1&&n[o].classList.add("apexcharts-element-hidden"),t.globals.delayedElements.push({el:n[o],index:0});this.helpers.annotationsBackground()}}},{key:"drawImageAnnos",value:function(){var t=this;this.w.config.annotations.images.map((function(e,i){t.addImage(e,i)}))}},{key:"drawTextAnnos",value:function(){var t=this;this.w.config.annotations.texts.map((function(e,i){t.addText(e,i)}))}},{key:"addXaxisAnnotation",value:function(t,e,i){this.xAxisAnnotations.addXaxisAnnotation(t,e,i)}},{key:"addYaxisAnnotation",value:function(t,e,i){this.yAxisAnnotations.addYaxisAnnotation(t,e,i)}},{key:"addPointAnnotation",value:function(t,e,i){this.pointsAnnotations.addPointAnnotation(t,e,i)}},{key:"addText",value:function(t,e){var i=t.x,a=t.y,s=t.text,r=t.textAnchor,n=t.foreColor,o=t.fontSize,l=t.fontFamily,h=t.fontWeight,c=t.cssClass,d=t.backgroundColor,u=t.borderWidth,g=t.strokeDashArray,p=t.borderRadius,f=t.borderColor,x=t.appendTo,b=void 0===x?".apexcharts-svg":x,m=t.paddingLeft,v=void 0===m?4:m,y=t.paddingRight,w=void 0===y?4:y,k=t.paddingBottom,A=void 0===k?2:k,C=t.paddingTop,S=void 0===C?2:C,L=this.w,M=this.graphics.drawText({x:i,y:a,text:s,textAnchor:r||"start",fontSize:o||"12px",fontWeight:h||"regular",fontFamily:l||L.config.chart.fontFamily,foreColor:n||L.config.chart.foreColor,cssClass:c}),P=L.globals.dom.baseEl.querySelector(b);P&&P.appendChild(M.node);var I=M.bbox();if(s){var T=this.graphics.drawRect(I.x-v,I.y-S,I.width+v+w,I.height+A+S,p,d||"transparent",1,u,f,g);P.insertBefore(T.node,M.node)}}},{key:"addImage",value:function(t,e){var i=this.w,a=t.path,s=t.x,r=void 0===s?0:s,n=t.y,o=void 0===n?0:n,l=t.width,h=void 0===l?20:l,c=t.height,d=void 0===c?20:c,u=t.appendTo,g=void 0===u?".apexcharts-svg":u,p=i.globals.dom.Paper.image(a);p.size(h,d).move(r,o);var f=i.globals.dom.baseEl.querySelector(g);return f&&f.appendChild(p.node),p}},{key:"addXaxisAnnotationExternal",value:function(t,e,i){return this.addAnnotationExternal({params:t,pushToMemory:e,context:i,type:"xaxis",contextMethod:i.addXaxisAnnotation}),i}},{key:"addYaxisAnnotationExternal",value:function(t,e,i){return this.addAnnotationExternal({params:t,pushToMemory:e,context:i,type:"yaxis",contextMethod:i.addYaxisAnnotation}),i}},{key:"addPointAnnotationExternal",value:function(t,e,i){return void 0===this.invertAxis&&(this.invertAxis=i.w.globals.isBarHorizontal),this.addAnnotationExternal({params:t,pushToMemory:e,context:i,type:"point",contextMethod:i.addPointAnnotation}),i}},{key:"addAnnotationExternal",value:function(t){var e=t.params,i=t.pushToMemory,a=t.context,s=t.type,r=t.contextMethod,n=a,o=n.w,l=o.globals.dom.baseEl.querySelector(".apexcharts-".concat(s,"-annotations")),h=l.childNodes.length+1,c=new Oi,d=Object.assign({},"xaxis"===s?c.xAxisAnnotation:"yaxis"===s?c.yAxisAnnotation:c.pointAnnotation),u=v.extend(d,e);switch(s){case"xaxis":this.addXaxisAnnotation(u,l,h);break;case"yaxis":this.addYaxisAnnotation(u,l,h);break;case"point":this.addPointAnnotation(u,l,h)}var g=o.globals.dom.baseEl.querySelector(".apexcharts-".concat(s,"-annotations .apexcharts-").concat(s,"-annotation-label[rel='").concat(h,"']")),p=this.helpers.addBackgroundToAnno(g,u);return p&&l.insertBefore(p.node,g),i&&o.globals.memory.methodsToExec.push({context:n,id:u.id?u.id:v.randomId(),method:r,label:"addAnnotation",params:e}),a}},{key:"clearAnnotations",value:function(t){for(var e=t.w,i=e.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxis-annotations, .apexcharts-xaxis-annotations, .apexcharts-point-annotations"),a=e.globals.memory.methodsToExec.length-1;a>=0;a--)"addText"!==e.globals.memory.methodsToExec[a].label&&"addAnnotation"!==e.globals.memory.methodsToExec[a].label||e.globals.memory.methodsToExec.splice(a,1);i=v.listToArray(i),Array.prototype.forEach.call(i,(function(t){for(;t.firstChild;)t.removeChild(t.firstChild)}))}},{key:"removeAnnotation",value:function(t,e){var i=t.w,a=i.globals.dom.baseEl.querySelectorAll(".".concat(e));a&&(i.globals.memory.methodsToExec.map((function(t,a){t.id===e&&i.globals.memory.methodsToExec.splice(a,1)})),Array.prototype.forEach.call(a,(function(t){t.parentElement.removeChild(t)})))}}]),t}(),Di=function(t){var e,i=t.isTimeline,a=t.ctx,s=t.seriesIndex,r=t.dataPointIndex,n=t.y1,o=t.y2,l=t.w,h=l.globals.seriesRangeStart[s][r],c=l.globals.seriesRangeEnd[s][r],d=l.globals.labels[r],u=l.config.series[s].name?l.config.series[s].name:"",g=l.globals.ttKeyFormatter,p=l.config.tooltip.y.title.formatter,f={w:l,seriesIndex:s,dataPointIndex:r,start:h,end:c};("function"==typeof p&&(u=p(u,f)),null!==(e=l.config.series[s].data[r])&&void 0!==e&&e.x&&(d=l.config.series[s].data[r].x),i)||"datetime"===l.config.xaxis.type&&(d=new Xi(a).xLabelFormat(l.globals.ttKeyFormatter,d,d,{i:void 0,dateFormatter:new zi(a).formatDate,w:l}));"function"==typeof g&&(d=g(d,f)),Number.isFinite(n)&&Number.isFinite(o)&&(h=n,c=o);var x="",b="",m=l.globals.colors[s];if(void 0===l.config.tooltip.x.formatter)if("datetime"===l.config.xaxis.type){var v=new zi(a);x=v.formatDate(v.getDate(h),l.config.tooltip.x.format),b=v.formatDate(v.getDate(c),l.config.tooltip.x.format)}else x=h,b=c;else x=l.config.tooltip.x.formatter(h),b=l.config.tooltip.x.formatter(c);return{start:h,end:c,startVal:x,endVal:b,ylabel:d,color:m,seriesName:u}},_i=function(t){var e=t.color,i=t.seriesName,a=t.ylabel,s=t.start,r=t.end,n=t.seriesIndex,o=t.dataPointIndex,l=t.ctx.tooltip.tooltipLabels.getFormatters(n);s=l.yLbFormatter(s),r=l.yLbFormatter(r);var h=l.yLbFormatter(t.w.globals.series[n][o]),c='\n '.concat(s,'\n - \n ').concat(r,"\n ");return'
'+(i||"")+'
'+a+": "+(t.w.globals.comboCharts?"rangeArea"===t.w.config.series[n].type||"rangeBar"===t.w.config.series[n].type?c:"".concat(h,""):c)+"
"},Ni=function(){function t(e){i(this,t),this.opts=e}return s(t,[{key:"hideYAxis",value:function(){this.opts.yaxis[0].show=!1,this.opts.yaxis[0].title.text="",this.opts.yaxis[0].axisBorder.show=!1,this.opts.yaxis[0].axisTicks.show=!1,this.opts.yaxis[0].floating=!0}},{key:"line",value:function(){return{dataLabels:{enabled:!1},stroke:{width:5,curve:"straight"},markers:{size:0,hover:{sizeOffset:6}},xaxis:{crosshairs:{width:1}}}}},{key:"sparkline",value:function(t){this.hideYAxis();return v.extend(t,{grid:{show:!1,padding:{left:0,right:0,top:0,bottom:0}},legend:{show:!1},xaxis:{labels:{show:!1},tooltip:{enabled:!1},axisBorder:{show:!1},axisTicks:{show:!1}},chart:{toolbar:{show:!1},zoom:{enabled:!1}},dataLabels:{enabled:!1}})}},{key:"slope",value:function(){return this.hideYAxis(),{chart:{toolbar:{show:!1},zoom:{enabled:!1}},dataLabels:{enabled:!0,formatter:function(t,e){var i=e.w.config.series[e.seriesIndex].name;return null!==t?i+": "+t:""},background:{enabled:!1},offsetX:-5},grid:{xaxis:{lines:{show:!0}},yaxis:{lines:{show:!1}}},xaxis:{position:"top",labels:{style:{fontSize:14,fontWeight:900}},tooltip:{enabled:!1},crosshairs:{show:!1}},markers:{size:8,hover:{sizeOffset:1}},legend:{show:!1},tooltip:{shared:!1,intersect:!0,followCursor:!0},stroke:{width:5,curve:"straight"}}}},{key:"bar",value:function(){return{chart:{stacked:!1},plotOptions:{bar:{dataLabels:{position:"center"}}},dataLabels:{style:{colors:["#fff"]},background:{enabled:!1}},stroke:{width:0,lineCap:"square"},fill:{opacity:.85},legend:{markers:{shape:"square"}},tooltip:{shared:!1,intersect:!0},xaxis:{tooltip:{enabled:!1},tickPlacement:"between",crosshairs:{width:"barWidth",position:"back",fill:{type:"gradient"},dropShadow:{enabled:!1},stroke:{width:0}}}}}},{key:"funnel",value:function(){return this.hideYAxis(),u(u({},this.bar()),{},{chart:{animations:{speed:800,animateGradually:{enabled:!1}}},plotOptions:{bar:{horizontal:!0,borderRadiusApplication:"around",borderRadius:0,dataLabels:{position:"center"}}},grid:{show:!1,padding:{left:0,right:0}},xaxis:{labels:{show:!1},tooltip:{enabled:!1},axisBorder:{show:!1},axisTicks:{show:!1}}})}},{key:"candlestick",value:function(){var t=this;return{stroke:{width:1,colors:["#333"]},fill:{opacity:1},dataLabels:{enabled:!1},tooltip:{shared:!0,custom:function(e){var i=e.seriesIndex,a=e.dataPointIndex,s=e.w;return t._getBoxTooltip(s,i,a,["Open","High","","Low","Close"],"candlestick")}},states:{active:{filter:{type:"none"}}},xaxis:{crosshairs:{width:1}}}}},{key:"boxPlot",value:function(){var t=this;return{chart:{animations:{dynamicAnimation:{enabled:!1}}},stroke:{width:1,colors:["#24292e"]},dataLabels:{enabled:!1},tooltip:{shared:!0,custom:function(e){var i=e.seriesIndex,a=e.dataPointIndex,s=e.w;return t._getBoxTooltip(s,i,a,["Minimum","Q1","Median","Q3","Maximum"],"boxPlot")}},markers:{size:7,strokeWidth:1,strokeColors:"#111"},xaxis:{crosshairs:{width:1}}}}},{key:"rangeBar",value:function(){return{chart:{animations:{animateGradually:!1}},stroke:{width:0,lineCap:"square"},plotOptions:{bar:{borderRadius:0,dataLabels:{position:"center"}}},dataLabels:{enabled:!1,formatter:function(t,e){e.ctx;var i=e.seriesIndex,a=e.dataPointIndex,s=e.w,r=function(){var t=s.globals.seriesRangeStart[i][a];return s.globals.seriesRangeEnd[i][a]-t};return s.globals.comboCharts?"rangeBar"===s.config.series[i].type||"rangeArea"===s.config.series[i].type?r():t:r()},background:{enabled:!1},style:{colors:["#fff"]}},markers:{size:10},tooltip:{shared:!1,followCursor:!0,custom:function(t){return t.w.config.plotOptions&&t.w.config.plotOptions.bar&&t.w.config.plotOptions.bar.horizontal?function(t){var e=Di(u(u({},t),{},{isTimeline:!0})),i=e.color,a=e.seriesName,s=e.ylabel,r=e.startVal,n=e.endVal;return _i(u(u({},t),{},{color:i,seriesName:a,ylabel:s,start:r,end:n}))}(t):function(t){var e=Di(t),i=e.color,a=e.seriesName,s=e.ylabel,r=e.start,n=e.end;return _i(u(u({},t),{},{color:i,seriesName:a,ylabel:s,start:r,end:n}))}(t)}},xaxis:{tickPlacement:"between",tooltip:{enabled:!1},crosshairs:{stroke:{width:0}}}}}},{key:"dumbbell",value:function(t){var e,i;return null!==(e=t.plotOptions.bar)&&void 0!==e&&e.barHeight||(t.plotOptions.bar.barHeight=2),null!==(i=t.plotOptions.bar)&&void 0!==i&&i.columnWidth||(t.plotOptions.bar.columnWidth=2),t}},{key:"area",value:function(){return{stroke:{width:4,fill:{type:"solid",gradient:{inverseColors:!1,shade:"light",type:"vertical",opacityFrom:.65,opacityTo:.5,stops:[0,100,100]}}},fill:{type:"gradient",gradient:{inverseColors:!1,shade:"light",type:"vertical",opacityFrom:.65,opacityTo:.5,stops:[0,100,100]}},markers:{size:0,hover:{sizeOffset:6}},tooltip:{followCursor:!1}}}},{key:"rangeArea",value:function(){return{stroke:{curve:"straight",width:0},fill:{type:"solid",opacity:.6},markers:{size:0},states:{hover:{filter:{type:"none"}},active:{filter:{type:"none"}}},tooltip:{intersect:!1,shared:!0,followCursor:!0,custom:function(t){return function(t){var e=Di(t),i=e.color,a=e.seriesName,s=e.ylabel,r=e.start,n=e.end;return _i(u(u({},t),{},{color:i,seriesName:a,ylabel:s,start:r,end:n}))}(t)}}}}},{key:"brush",value:function(t){return v.extend(t,{chart:{toolbar:{autoSelected:"selection",show:!1},zoom:{enabled:!1}},dataLabels:{enabled:!1},stroke:{width:1},tooltip:{enabled:!1},xaxis:{tooltip:{enabled:!1}}})}},{key:"stacked100",value:function(t){t.dataLabels=t.dataLabels||{},t.dataLabels.formatter=t.dataLabels.formatter||void 0;var e=t.dataLabels.formatter;return t.yaxis.forEach((function(e,i){t.yaxis[i].min=0,t.yaxis[i].max=100})),"bar"===t.chart.type&&(t.dataLabels.formatter=e||function(t){return"number"==typeof t&&t?t.toFixed(0)+"%":t}),t}},{key:"stackedBars",value:function(){var t=this.bar();return u(u({},t),{},{plotOptions:u(u({},t.plotOptions),{},{bar:u(u({},t.plotOptions.bar),{},{borderRadiusApplication:"end",borderRadiusWhenStacked:"last"})})})}},{key:"convertCatToNumeric",value:function(t){return t.xaxis.convertedCatToNumeric=!0,t}},{key:"convertCatToNumericXaxis",value:function(t,e,i){t.xaxis.type="numeric",t.xaxis.labels=t.xaxis.labels||{},t.xaxis.labels.formatter=t.xaxis.labels.formatter||function(t){return v.isNumber(t)?Math.floor(t):t};var a=t.xaxis.labels.formatter,s=t.xaxis.categories&&t.xaxis.categories.length?t.xaxis.categories:t.labels;return i&&i.length&&(s=i.map((function(t){return Array.isArray(t)?t:String(t)}))),s&&s.length&&(t.xaxis.labels.formatter=function(t){return v.isNumber(t)?a(s[Math.floor(t)-1]):a(t)}),t.xaxis.categories=[],t.labels=[],t.xaxis.tickAmount=t.xaxis.tickAmount||"dataPoints",t}},{key:"bubble",value:function(){return{dataLabels:{style:{colors:["#fff"]}},tooltip:{shared:!1,intersect:!0},xaxis:{crosshairs:{width:0}},fill:{type:"solid",gradient:{shade:"light",inverse:!0,shadeIntensity:.55,opacityFrom:.4,opacityTo:.8}}}}},{key:"scatter",value:function(){return{dataLabels:{enabled:!1},tooltip:{shared:!1,intersect:!0},markers:{size:6,strokeWidth:1,hover:{sizeOffset:2}}}}},{key:"heatmap",value:function(){return{chart:{stacked:!1},fill:{opacity:1},dataLabels:{style:{colors:["#fff"]}},stroke:{colors:["#fff"]},tooltip:{followCursor:!0,marker:{show:!1},x:{show:!1}},legend:{position:"top",markers:{shape:"square"}},grid:{padding:{right:20}}}}},{key:"treemap",value:function(){return{chart:{zoom:{enabled:!1}},dataLabels:{style:{fontSize:14,fontWeight:600,colors:["#fff"]}},stroke:{show:!0,width:2,colors:["#fff"]},legend:{show:!1},fill:{opacity:1,gradient:{stops:[0,100]}},tooltip:{followCursor:!0,x:{show:!1}},grid:{padding:{left:0,right:0}},xaxis:{crosshairs:{show:!1},tooltip:{enabled:!1}}}}},{key:"pie",value:function(){return{chart:{toolbar:{show:!1}},plotOptions:{pie:{donut:{labels:{show:!1}}}},dataLabels:{formatter:function(t){return t.toFixed(1)+"%"},style:{colors:["#fff"]},background:{enabled:!1},dropShadow:{enabled:!0}},stroke:{colors:["#fff"]},fill:{opacity:1,gradient:{shade:"light",stops:[0,100]}},tooltip:{theme:"dark",fillSeriesColor:!0},legend:{position:"right"},grid:{padding:{left:0,right:0,top:0,bottom:0}}}}},{key:"donut",value:function(){return{chart:{toolbar:{show:!1}},dataLabels:{formatter:function(t){return t.toFixed(1)+"%"},style:{colors:["#fff"]},background:{enabled:!1},dropShadow:{enabled:!0}},stroke:{colors:["#fff"]},fill:{opacity:1,gradient:{shade:"light",shadeIntensity:.35,stops:[80,100],opacityFrom:1,opacityTo:1}},tooltip:{theme:"dark",fillSeriesColor:!0},legend:{position:"right"},grid:{padding:{left:0,right:0,top:0,bottom:0}}}}},{key:"polarArea",value:function(){return{chart:{toolbar:{show:!1}},dataLabels:{formatter:function(t){return t.toFixed(1)+"%"},enabled:!1},stroke:{show:!0,width:2},fill:{opacity:.7},tooltip:{theme:"dark",fillSeriesColor:!0},legend:{position:"right"},grid:{padding:{left:0,right:0,top:0,bottom:0}}}}},{key:"radar",value:function(){return this.opts.yaxis[0].labels.offsetY=this.opts.yaxis[0].labels.offsetY?this.opts.yaxis[0].labels.offsetY:6,{dataLabels:{enabled:!1,style:{fontSize:"11px"}},stroke:{width:2},markers:{size:5,strokeWidth:1,strokeOpacity:1},fill:{opacity:.2},tooltip:{shared:!1,intersect:!0,followCursor:!0},grid:{show:!1,padding:{left:0,right:0,top:0,bottom:0}},xaxis:{labels:{formatter:function(t){return t},style:{colors:["#a8a8a8"],fontSize:"11px"}},tooltip:{enabled:!1},crosshairs:{show:!1}}}}},{key:"radialBar",value:function(){return{chart:{animations:{dynamicAnimation:{enabled:!0,speed:800}},toolbar:{show:!1}},fill:{gradient:{shade:"dark",shadeIntensity:.4,inverseColors:!1,type:"diagonal2",opacityFrom:1,opacityTo:1,stops:[70,98,100]}},legend:{show:!1,position:"right"},tooltip:{enabled:!1,fillSeriesColor:!0},grid:{padding:{left:0,right:0,top:0,bottom:0}}}}},{key:"_getBoxTooltip",value:function(t,e,i,a,s){var r=t.globals.seriesCandleO[e][i],n=t.globals.seriesCandleH[e][i],o=t.globals.seriesCandleM[e][i],l=t.globals.seriesCandleL[e][i],h=t.globals.seriesCandleC[e][i];return t.config.series[e].type&&t.config.series[e].type!==s?'
\n '.concat(t.config.series[e].name?t.config.series[e].name:"series-"+(e+1),": ").concat(t.globals.series[e][i],"\n
"):'
')+"
".concat(a[0],': ')+r+"
"+"
".concat(a[1],': ')+n+"
"+(o?"
".concat(a[2],': ')+o+"
":"")+"
".concat(a[3],': ')+l+"
"+"
".concat(a[4],': ')+h+"
"}}]),t}(),Wi=function(){function t(e){i(this,t),this.opts=e}return s(t,[{key:"init",value:function(t){var e=t.responsiveOverride,i=this.opts,a=new Oi,s=new Ni(i);this.chartType=i.chart.type,i=this.extendYAxis(i),i=this.extendAnnotations(i);var r=a.init(),n={};if(i&&"object"===b(i)){var o,l,h,c,d,u,g,p,f,x,m={};m=-1!==["line","area","bar","candlestick","boxPlot","rangeBar","rangeArea","bubble","scatter","heatmap","treemap","pie","polarArea","donut","radar","radialBar"].indexOf(i.chart.type)?s[i.chart.type]():s.line(),null!==(o=i.plotOptions)&&void 0!==o&&null!==(l=o.bar)&&void 0!==l&&l.isFunnel&&(m=s.funnel()),i.chart.stacked&&"bar"===i.chart.type&&(m=s.stackedBars()),null!==(h=i.chart.brush)&&void 0!==h&&h.enabled&&(m=s.brush(m)),null!==(c=i.plotOptions)&&void 0!==c&&null!==(d=c.line)&&void 0!==d&&d.isSlopeChart&&(m=s.slope()),i.chart.stacked&&"100%"===i.chart.stackType&&(i=s.stacked100(i)),null!==(u=i.plotOptions)&&void 0!==u&&null!==(g=u.bar)&&void 0!==g&&g.isDumbbell&&(i=s.dumbbell(i)),this.checkForDarkTheme(window.Apex),this.checkForDarkTheme(i),i.xaxis=i.xaxis||window.Apex.xaxis||{},e||(i.xaxis.convertedCatToNumeric=!1),(null!==(p=(i=this.checkForCatToNumericXAxis(this.chartType,m,i)).chart.sparkline)&&void 0!==p&&p.enabled||null!==(f=window.Apex.chart)&&void 0!==f&&null!==(x=f.sparkline)&&void 0!==x&&x.enabled)&&(m=s.sparkline(m)),n=v.extend(r,m)}var y=v.extend(n,window.Apex);return r=v.extend(y,i),r=this.handleUserInputErrors(r)}},{key:"checkForCatToNumericXAxis",value:function(t,e,i){var a,s,r=new Ni(i),n=("bar"===t||"boxPlot"===t)&&(null===(a=i.plotOptions)||void 0===a||null===(s=a.bar)||void 0===s?void 0:s.horizontal),o="pie"===t||"polarArea"===t||"donut"===t||"radar"===t||"radialBar"===t||"heatmap"===t,l="datetime"!==i.xaxis.type&&"numeric"!==i.xaxis.type,h=i.xaxis.tickPlacement?i.xaxis.tickPlacement:e.xaxis&&e.xaxis.tickPlacement;return n||o||!l||"between"===h||(i=r.convertCatToNumeric(i)),i}},{key:"extendYAxis",value:function(t,e){var i=new Oi;(void 0===t.yaxis||!t.yaxis||Array.isArray(t.yaxis)&&0===t.yaxis.length)&&(t.yaxis={}),t.yaxis.constructor!==Array&&window.Apex.yaxis&&window.Apex.yaxis.constructor!==Array&&(t.yaxis=v.extend(t.yaxis,window.Apex.yaxis)),t.yaxis.constructor!==Array?t.yaxis=[v.extend(i.yAxis,t.yaxis)]:t.yaxis=v.extendArray(t.yaxis,i.yAxis);var a=!1;t.yaxis.forEach((function(t){t.logarithmic&&(a=!0)}));var s=t.series;return e&&!s&&(s=e.config.series),a&&s.length!==t.yaxis.length&&s.length&&(t.yaxis=s.map((function(e,a){if(e.name||(s[a].name="series-".concat(a+1)),t.yaxis[a])return t.yaxis[a].seriesName=s[a].name,t.yaxis[a];var r=v.extend(i.yAxis,t.yaxis[0]);return r.show=!1,r}))),a&&s.length>1&&s.length!==t.yaxis.length&&console.warn("A multi-series logarithmic chart should have equal number of series and y-axes"),t}},{key:"extendAnnotations",value:function(t){return void 0===t.annotations&&(t.annotations={},t.annotations.yaxis=[],t.annotations.xaxis=[],t.annotations.points=[]),t=this.extendYAxisAnnotations(t),t=this.extendXAxisAnnotations(t),t=this.extendPointAnnotations(t)}},{key:"extendYAxisAnnotations",value:function(t){var e=new Oi;return t.annotations.yaxis=v.extendArray(void 0!==t.annotations.yaxis?t.annotations.yaxis:[],e.yAxisAnnotation),t}},{key:"extendXAxisAnnotations",value:function(t){var e=new Oi;return t.annotations.xaxis=v.extendArray(void 0!==t.annotations.xaxis?t.annotations.xaxis:[],e.xAxisAnnotation),t}},{key:"extendPointAnnotations",value:function(t){var e=new Oi;return t.annotations.points=v.extendArray(void 0!==t.annotations.points?t.annotations.points:[],e.pointAnnotation),t}},{key:"checkForDarkTheme",value:function(t){t.theme&&"dark"===t.theme.mode&&(t.tooltip||(t.tooltip={}),"light"!==t.tooltip.theme&&(t.tooltip.theme="dark"),t.chart.foreColor||(t.chart.foreColor="#f6f7f8"),t.theme.palette||(t.theme.palette="palette4"))}},{key:"handleUserInputErrors",value:function(t){var e=t;if(e.tooltip.shared&&e.tooltip.intersect)throw new Error("tooltip.shared cannot be enabled when tooltip.intersect is true. Turn off any other option by setting it to false.");if("bar"===e.chart.type&&e.plotOptions.bar.horizontal){if(e.yaxis.length>1)throw new Error("Multiple Y Axis for bars are not supported. Switch to column chart by setting plotOptions.bar.horizontal=false");e.yaxis[0].reversed&&(e.yaxis[0].opposite=!0),e.xaxis.tooltip.enabled=!1,e.yaxis[0].tooltip.enabled=!1,e.chart.zoom.enabled=!1}return"bar"!==e.chart.type&&"rangeBar"!==e.chart.type||e.tooltip.shared&&"barWidth"===e.xaxis.crosshairs.width&&e.series.length>1&&(e.xaxis.crosshairs.width="tickWidth"),"candlestick"!==e.chart.type&&"boxPlot"!==e.chart.type||e.yaxis[0].reversed&&(console.warn("Reversed y-axis in ".concat(e.chart.type," chart is not supported.")),e.yaxis[0].reversed=!1),e}}]),t}(),Bi=function(){function t(){i(this,t)}return s(t,[{key:"initGlobalVars",value:function(t){t.series=[],t.seriesCandleO=[],t.seriesCandleH=[],t.seriesCandleM=[],t.seriesCandleL=[],t.seriesCandleC=[],t.seriesRangeStart=[],t.seriesRangeEnd=[],t.seriesRange=[],t.seriesPercent=[],t.seriesGoals=[],t.seriesX=[],t.seriesZ=[],t.seriesNames=[],t.seriesTotals=[],t.seriesLog=[],t.seriesColors=[],t.stackedSeriesTotals=[],t.seriesXvalues=[],t.seriesYvalues=[],t.labels=[],t.hasXaxisGroups=!1,t.groups=[],t.barGroups=[],t.lineGroups=[],t.areaGroups=[],t.hasSeriesGroups=!1,t.seriesGroups=[],t.categoryLabels=[],t.timescaleLabels=[],t.noLabelsProvided=!1,t.resizeTimer=null,t.selectionResizeTimer=null,t.lastWheelExecution=0,t.delayedElements=[],t.pointsArray=[],t.dataLabelsRects=[],t.isXNumeric=!1,t.skipLastTimelinelabel=!1,t.skipFirstTimelinelabel=!1,t.isDataXYZ=!1,t.isMultiLineX=!1,t.isMultipleYAxis=!1,t.maxY=-Number.MAX_VALUE,t.minY=Number.MIN_VALUE,t.minYArr=[],t.maxYArr=[],t.maxX=-Number.MAX_VALUE,t.minX=Number.MAX_VALUE,t.initialMaxX=-Number.MAX_VALUE,t.initialMinX=Number.MAX_VALUE,t.maxDate=0,t.minDate=Number.MAX_VALUE,t.minZ=Number.MAX_VALUE,t.maxZ=-Number.MAX_VALUE,t.minXDiff=Number.MAX_VALUE,t.yAxisScale=[],t.xAxisScale=null,t.xAxisTicksPositions=[],t.yLabelsCoords=[],t.yTitleCoords=[],t.barPadForNumericAxis=0,t.padHorizontal=0,t.xRange=0,t.yRange=[],t.zRange=0,t.dataPoints=0,t.xTickAmount=0,t.multiAxisTickAmount=0}},{key:"globalVars",value:function(t){return{chartID:null,cuid:null,events:{beforeMount:[],mounted:[],updated:[],clicked:[],selection:[],dataPointSelection:[],zoomed:[],scrolled:[]},colors:[],clientX:null,clientY:null,fill:{colors:[]},stroke:{colors:[]},dataLabels:{style:{colors:[]}},radarPolygons:{fill:{colors:[]}},markers:{colors:[],size:t.markers.size,largestSize:0},animationEnded:!1,isTouchDevice:"ontouchstart"in window||navigator.msMaxTouchPoints,isDirty:!1,isExecCalled:!1,initialConfig:null,initialSeries:[],lastXAxis:[],lastYAxis:[],columnSeries:null,labels:[],timescaleLabels:[],noLabelsProvided:!1,allSeriesCollapsed:!1,collapsedSeries:[],collapsedSeriesIndices:[],ancillaryCollapsedSeries:[],ancillaryCollapsedSeriesIndices:[],risingSeries:[],dataFormatXNumeric:!1,capturedSeriesIndex:-1,capturedDataPointIndex:-1,selectedDataPoints:[],invalidLogScale:!1,ignoreYAxisIndexes:[],maxValsInArrayIndex:0,radialSize:0,selection:void 0,zoomEnabled:"zoom"===t.chart.toolbar.autoSelected&&t.chart.toolbar.tools.zoom&&t.chart.zoom.enabled,panEnabled:"pan"===t.chart.toolbar.autoSelected&&t.chart.toolbar.tools.pan,selectionEnabled:"selection"===t.chart.toolbar.autoSelected&&t.chart.toolbar.tools.selection,yaxis:null,mousedown:!1,lastClientPosition:{},visibleXRange:void 0,yValueDecimal:0,total:0,SVGNS:"http://www.w3.org/2000/svg",svgWidth:0,svgHeight:0,noData:!1,locale:{},dom:{},memory:{methodsToExec:[]},shouldAnimate:!0,skipLastTimelinelabel:!1,skipFirstTimelinelabel:!1,delayedElements:[],axisCharts:!0,isDataXYZ:!1,isSlopeChart:t.plotOptions.line.isSlopeChart,resized:!1,resizeTimer:null,comboCharts:!1,dataChanged:!1,previousPaths:[],allSeriesHasEqualX:!0,pointsArray:[],dataLabelsRects:[],lastDrawnDataLabelsIndexes:[],hasNullValues:!1,zoomed:!1,gridWidth:0,gridHeight:0,rotateXLabels:!1,defaultLabels:!1,xLabelFormatter:void 0,yLabelFormatters:[],xaxisTooltipFormatter:void 0,ttKeyFormatter:void 0,ttVal:void 0,ttZFormatter:void 0,LINE_HEIGHT_RATIO:1.618,xAxisLabelsHeight:0,xAxisGroupLabelsHeight:0,xAxisLabelsWidth:0,yAxisLabelsWidth:0,scaleX:1,scaleY:1,translateX:0,translateY:0,translateYAxisX:[],yAxisWidths:[],translateXAxisY:0,translateXAxisX:0,tooltip:null,niceScaleAllowedMagMsd:[[1,1,2,5,5,5,10,10,10,10,10],[1,1,2,5,5,5,10,10,10,10,10]],niceScaleDefaultTicks:[1,2,4,4,6,6,6,6,6,6,6,6,6,6,6,6,6,6,12,12,12,12,12,12,12,12,12,24],seriesYAxisMap:[],seriesYAxisReverseMap:[]}}},{key:"init",value:function(t){var e=this.globalVars(t);return this.initGlobalVars(e),e.initialConfig=v.extend({},t),e.initialSeries=v.clone(t.series),e.lastXAxis=v.clone(e.initialConfig.xaxis),e.lastYAxis=v.clone(e.initialConfig.yaxis),e}}]),t}(),Gi=function(){function t(e){i(this,t),this.opts=e}return s(t,[{key:"init",value:function(){var t=new Wi(this.opts).init({responsiveOverride:!1});return{config:t,globals:(new Bi).init(t)}}}]),t}(),ji=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.opts=null,this.seriesIndex=0,this.patternIDs=[]}return s(t,[{key:"clippedImgArea",value:function(t){var e=this.w,i=e.config,a=parseInt(e.globals.gridWidth,10),s=parseInt(e.globals.gridHeight,10),r=a>s?a:s,n=t.image,o=0,l=0;void 0===t.width&&void 0===t.height?void 0!==i.fill.image.width&&void 0!==i.fill.image.height?(o=i.fill.image.width+1,l=i.fill.image.height):(o=r+1,l=r):(o=t.width,l=t.height);var h=document.createElementNS(e.globals.SVGNS,"pattern");Mi.setAttrs(h,{id:t.patternID,patternUnits:t.patternUnits?t.patternUnits:"userSpaceOnUse",width:o+"px",height:l+"px"});var c=document.createElementNS(e.globals.SVGNS,"image");h.appendChild(c),c.setAttributeNS(window.SVG.xlink,"href",n),Mi.setAttrs(c,{x:0,y:0,preserveAspectRatio:"none",width:o+"px",height:l+"px"}),c.style.opacity=t.opacity,e.globals.dom.elDefs.node.appendChild(h)}},{key:"getSeriesIndex",value:function(t){var e=this.w,i=e.config.chart.type;return("bar"===i||"rangeBar"===i)&&e.config.plotOptions.bar.distributed||"heatmap"===i||"treemap"===i?this.seriesIndex=t.seriesNumber:this.seriesIndex=t.seriesNumber%e.globals.series.length,this.seriesIndex}},{key:"computeColorStops",value:function(t,e){var i,a=this.w,s=null,n=null,o=r(t);try{for(o.s();!(i=o.n()).done;){var l=i.value;l>=e.threshold?(null===s||l>s)&&(s=l):(null===n||l-1?x=v.getOpacityFromRGBA(c):m=v.hexToRgba(v.rgb2hex(c),x),t.opacity&&(x=t.opacity),"pattern"===p&&(n=this.handlePatternFill({fillConfig:t.fillConfig,patternFill:n,fillColor:c,fillOpacity:x,defaultColor:m})),b){var y=f(l.fill.gradient.colorStops)||[],w=l.fill.gradient.type;h&&(y[this.seriesIndex]=this.computeColorStops(s.globals.series[this.seriesIndex],l.plotOptions.line.colors),w="vertical"),o=this.handleGradientFill({type:w,fillConfig:t.fillConfig,fillColor:c,fillOpacity:x,colorStops:y,i:this.seriesIndex})}if("image"===p){var k=l.fill.image.src,A=t.patternID?t.patternID:"",C="pattern".concat(s.globals.cuid).concat(t.seriesNumber+1).concat(A);-1===this.patternIDs.indexOf(C)&&(this.clippedImgArea({opacity:x,image:Array.isArray(k)?t.seriesNumber-1&&(p=v.getOpacityFromRGBA(g));var f=void 0===o.gradient.opacityTo?a:Array.isArray(o.gradient.opacityTo)?o.gradient.opacityTo[n]:o.gradient.opacityTo;if(void 0===o.gradient.gradientToColors||0===o.gradient.gradientToColors.length)d="dark"===o.gradient.shade?c.shadeColor(-1*parseFloat(o.gradient.shadeIntensity),i.indexOf("rgb")>-1?v.rgb2hex(i):i):c.shadeColor(parseFloat(o.gradient.shadeIntensity),i.indexOf("rgb")>-1?v.rgb2hex(i):i);else if(o.gradient.gradientToColors[l.seriesNumber]){var x=o.gradient.gradientToColors[l.seriesNumber];d=x,x.indexOf("rgba")>-1&&(f=v.getOpacityFromRGBA(x))}else d=i;if(o.gradient.gradientFrom&&(g=o.gradient.gradientFrom),o.gradient.gradientTo&&(d=o.gradient.gradientTo),o.gradient.inverseColors){var b=g;g=d,d=b}return g.indexOf("rgb")>-1&&(g=v.rgb2hex(g)),d.indexOf("rgb")>-1&&(d=v.rgb2hex(d)),h.drawGradient(e,g,d,p,f,l.size,o.gradient.stops,r,n)}}]),t}(),Vi=function(){function t(e,a){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"setGlobalMarkerSize",value:function(){var t=this.w;if(t.globals.markers.size=Array.isArray(t.config.markers.size)?t.config.markers.size:[t.config.markers.size],t.globals.markers.size.length>0){if(t.globals.markers.size.length0:h.config.markers.size>0)||n||p){m||(y+=" w".concat(v.randomId()));var w=this.getMarkerConfig({cssClass:y,seriesIndex:i,dataPointIndex:b});if(h.config.series[c].data[b]&&(h.config.series[c].data[b].fillColor&&(w.pointFillColor=h.config.series[c].data[b].fillColor),h.config.series[c].data[b].strokeColor&&(w.pointStrokeColor=h.config.series[c].data[b].strokeColor)),void 0!==s&&(w.pSize=s),(d.x[f]<-h.globals.markers.largestSize||d.x[f]>h.globals.gridWidth+h.globals.markers.largestSize||d.y[f]<-h.globals.markers.largestSize||d.y[f]>h.globals.gridHeight+h.globals.markers.largestSize)&&(w.pSize=0),!m)(h.globals.markers.size[i]>0||n||p)&&!u&&(u=g.group({class:n||p?"":"apexcharts-series-markers"})).attr("clip-path","url(#gridRectMarkerMask".concat(h.globals.cuid,")")),(x=g.drawMarker(d.x[f],d.y[f],w)).attr("rel",b),x.attr("j",b),x.attr("index",i),x.node.setAttribute("default-marker-size",w.pSize),new Li(this.ctx).setSelectionFilter(x,i,b),this.addEvents(x),u&&u.add(x)}else void 0===h.globals.pointsArray[i]&&(h.globals.pointsArray[i]=[]),h.globals.pointsArray[i].push([d.x[f],d.y[f]])}return u}},{key:"getMarkerConfig",value:function(t){var e=t.cssClass,i=t.seriesIndex,a=t.dataPointIndex,s=void 0===a?null:a,r=t.radius,n=void 0===r?null:r,o=t.size,l=void 0===o?null:o,h=t.strokeWidth,c=void 0===h?null:h,d=this.w,u=this.getMarkerStyle(i),g=null===l?d.globals.markers.size[i]:l,p=d.config.markers;return null!==s&&p.discrete.length&&p.discrete.map((function(t){t.seriesIndex===i&&t.dataPointIndex===s&&(u.pointStrokeColor=t.strokeColor,u.pointFillColor=t.fillColor,g=t.size,u.pointShape=t.shape)})),{pSize:null===n?g:n,pRadius:null!==n?n:p.radius,pointStrokeWidth:null!==c?c:Array.isArray(p.strokeWidth)?p.strokeWidth[i]:p.strokeWidth,pointStrokeColor:u.pointStrokeColor,pointFillColor:u.pointFillColor,shape:u.pointShape||(Array.isArray(p.shape)?p.shape[i]:p.shape),class:e,pointStrokeOpacity:Array.isArray(p.strokeOpacity)?p.strokeOpacity[i]:p.strokeOpacity,pointStrokeDashArray:Array.isArray(p.strokeDashArray)?p.strokeDashArray[i]:p.strokeDashArray,pointFillOpacity:Array.isArray(p.fillOpacity)?p.fillOpacity[i]:p.fillOpacity,seriesIndex:i}}},{key:"addEvents",value:function(t){var e=this.w,i=new Mi(this.ctx);t.node.addEventListener("mouseenter",i.pathMouseEnter.bind(this.ctx,t)),t.node.addEventListener("mouseleave",i.pathMouseLeave.bind(this.ctx,t)),t.node.addEventListener("mousedown",i.pathMouseDown.bind(this.ctx,t)),t.node.addEventListener("click",e.config.markers.onClick),t.node.addEventListener("dblclick",e.config.markers.onDblClick),t.node.addEventListener("touchstart",i.pathMouseDown.bind(this.ctx,t),{passive:!0})}},{key:"getMarkerStyle",value:function(t){var e=this.w,i=e.globals.markers.colors,a=e.config.markers.strokeColor||e.config.markers.strokeColors;return{pointStrokeColor:Array.isArray(a)?a[t]:a,pointFillColor:Array.isArray(i)?i[t]:i}}}]),t}(),Ui=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.initialAnim=this.w.config.chart.animations.enabled}return s(t,[{key:"draw",value:function(t,e,i){var a=this.w,s=new Mi(this.ctx),r=i.realIndex,n=i.pointsPos,o=i.zRatio,l=i.elParent,h=s.group({class:"apexcharts-series-markers apexcharts-series-".concat(a.config.chart.type)});if(h.attr("clip-path","url(#gridRectMarkerMask".concat(a.globals.cuid,")")),Array.isArray(n.x))for(var c=0;cp.maxBubbleRadius&&(g=p.maxBubbleRadius)}var f=n.x[c],x=n.y[c];if(g=g||0,null!==x&&void 0!==a.globals.series[r][d]||(u=!1),u){var b=this.drawPoint(f,x,g,r,d,e);h.add(b)}l.add(h)}}},{key:"drawPoint",value:function(t,e,i,a,s,r){var n=this.w,o=a,l=new y(this.ctx),h=new Li(this.ctx),c=new ji(this.ctx),d=new Vi(this.ctx),u=new Mi(this.ctx),g=d.getMarkerConfig({cssClass:"apexcharts-marker",seriesIndex:o,dataPointIndex:s,radius:"bubble"===n.config.chart.type||n.globals.comboCharts&&n.config.series[a]&&"bubble"===n.config.series[a].type?i:null}),p=c.fillPath({seriesNumber:a,dataPointIndex:s,color:g.pointFillColor,patternUnits:"objectBoundingBox",value:n.globals.series[a][r]}),f=u.drawMarker(t,e,g);if(n.config.series[o].data[s]&&n.config.series[o].data[s].fillColor&&(p=n.config.series[o].data[s].fillColor),f.attr({fill:p}),n.config.chart.dropShadow.enabled){var x=n.config.chart.dropShadow;h.dropShadow(f,x,a)}if(!this.initialAnim||n.globals.dataChanged||n.globals.resized)n.globals.animationEnded=!0;else{var b=n.config.chart.animations.speed;l.animateMarker(f,b,n.globals.easing,(function(){window.setTimeout((function(){l.animationCompleted(f)}),100)}))}return f.attr({rel:s,j:s,index:a,"default-marker-size":g.pSize}),h.setSelectionFilter(f,a,s),d.addEvents(f),f.node.classList.add("apexcharts-marker"),f}},{key:"centerTextInBubble",value:function(t){var e=this.w;return{y:t+=parseInt(e.config.dataLabels.style.fontSize,10)/4}}}]),t}(),qi=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"dataLabelsCorrection",value:function(t,e,i,a,s,r,n){var o=this.w,l=!1,h=new Mi(this.ctx).getTextRects(i,n),c=h.width,d=h.height;e<0&&(e=0),e>o.globals.gridHeight+d&&(e=o.globals.gridHeight+d/2),void 0===o.globals.dataLabelsRects[a]&&(o.globals.dataLabelsRects[a]=[]),o.globals.dataLabelsRects[a].push({x:t,y:e,width:c,height:d});var u=o.globals.dataLabelsRects[a].length-2,g=void 0!==o.globals.lastDrawnDataLabelsIndexes[a]?o.globals.lastDrawnDataLabelsIndexes[a][o.globals.lastDrawnDataLabelsIndexes[a].length-1]:0;if(void 0!==o.globals.dataLabelsRects[a][u]){var p=o.globals.dataLabelsRects[a][g];(t>p.x+p.width||e>p.y+p.height||e+de.globals.gridWidth+b.textRects.width+30)&&(o="");var m=e.globals.dataLabels.style.colors[r];(("bar"===e.config.chart.type||"rangeBar"===e.config.chart.type)&&e.config.plotOptions.bar.distributed||e.config.dataLabels.distributed)&&(m=e.globals.dataLabels.style.colors[n]),"function"==typeof m&&(m=m({series:e.globals.series,seriesIndex:r,dataPointIndex:n,w:e})),u&&(m=u);var v=d.offsetX,y=d.offsetY;if("bar"!==e.config.chart.type&&"rangeBar"!==e.config.chart.type||(v=0,y=0),e.globals.isSlopeChart&&(0!==n&&(v=-2*d.offsetX+5),0!==n&&n!==e.config.series[r].data.length-1&&(v=0)),b.drawnextLabel){if((x=i.drawText({width:100,height:parseInt(d.style.fontSize,10),x:a+v,y:s+y,foreColor:m,textAnchor:l||d.textAnchor,text:o,fontSize:h||d.style.fontSize,fontFamily:d.style.fontFamily,fontWeight:d.style.fontWeight||"normal"})).attr({class:f||"apexcharts-datalabel",cx:a,cy:s}),d.dropShadow.enabled){var w=d.dropShadow;new Li(this.ctx).dropShadow(x,w)}c.add(x),void 0===e.globals.lastDrawnDataLabelsIndexes[r]&&(e.globals.lastDrawnDataLabelsIndexes[r]=[]),e.globals.lastDrawnDataLabelsIndexes[r].push(n)}return x}},{key:"addBackgroundToDataLabel",value:function(t,e){var i=this.w,a=i.config.dataLabels.background,s=a.padding,r=a.padding/2,n=e.width,o=e.height,l=new Mi(this.ctx).drawRect(e.x-s,e.y-r/2,n+2*s,o+r,a.borderRadius,"transparent"!==i.config.chart.background&&i.config.chart.background?i.config.chart.background:"#fff",a.opacity,a.borderWidth,a.borderColor);a.dropShadow.enabled&&new Li(this.ctx).dropShadow(l,a.dropShadow);return l}},{key:"dataLabelsBackground",value:function(){var t=this.w;if("bubble"!==t.config.chart.type)for(var e=t.globals.dom.baseEl.querySelectorAll(".apexcharts-datalabels text"),i=0;i0&&void 0!==arguments[0])||arguments[0],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=this.w,s=v.clone(a.globals.initialSeries);a.globals.previousPaths=[],i?(a.globals.collapsedSeries=[],a.globals.ancillaryCollapsedSeries=[],a.globals.collapsedSeriesIndices=[],a.globals.ancillaryCollapsedSeriesIndices=[]):s=this.emptyCollapsedSeries(s),a.config.series=s,t&&(e&&(a.globals.zoomed=!1,this.ctx.updateHelpers.revertDefaultAxisMinMax()),this.ctx.updateHelpers._updateSeries(s,a.config.chart.animations.dynamicAnimation.enabled))}},{key:"emptyCollapsedSeries",value:function(t){for(var e=this.w,i=0;i-1&&(t[i].data=[]);return t}},{key:"highlightSeries",value:function(t){var e=this.w,i=this.getSeriesByName(t),a=parseInt(null==i?void 0:i.getAttribute("data:realIndex"),10),s=e.globals.dom.baseEl.querySelectorAll(".apexcharts-series, .apexcharts-datalabels, .apexcharts-yaxis"),r=null,n=null,o=null;if(e.globals.axisCharts||"radialBar"===e.config.chart.type)if(e.globals.axisCharts){r=e.globals.dom.baseEl.querySelector(".apexcharts-series[data\\:realIndex='".concat(a,"']")),n=e.globals.dom.baseEl.querySelector(".apexcharts-datalabels[data\\:realIndex='".concat(a,"']"));var l=e.globals.seriesYAxisReverseMap[a];o=e.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(l,"']"))}else r=e.globals.dom.baseEl.querySelector(".apexcharts-series[rel='".concat(a+1,"']"));else r=e.globals.dom.baseEl.querySelector(".apexcharts-series[rel='".concat(a+1,"'] path"));for(var h=0;h=t.from&&(r0&&void 0!==arguments[0]?arguments[0]:"asc",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=this.w,a=0;if(i.config.series.length>1)for(var s=i.config.series.map((function(t,a){return t.data&&t.data.length>0&&-1===i.globals.collapsedSeriesIndices.indexOf(a)&&(!i.globals.comboCharts||0===e.length||e.length&&e.indexOf(i.config.series[a].type)>-1)?a:-1})),r="asc"===t?0:s.length-1;"asc"===t?r=0;"asc"===t?r++:r--)if(-1!==s[r]){a=s[r];break}return a}},{key:"getBarSeriesIndices",value:function(){return this.w.globals.comboCharts?this.w.config.series.map((function(t,e){return"bar"===t.type||"column"===t.type?e:-1})).filter((function(t){return-1!==t})):this.w.config.series.map((function(t,e){return e}))}},{key:"getPreviousPaths",value:function(){var t=this.w;function e(e,i,a){for(var s=e[i].childNodes,r={type:a,paths:[],realIndex:e[i].getAttribute("data:realIndex")},n=0;n0)for(var a=function(e){for(var i=t.globals.dom.baseEl.querySelectorAll(".apexcharts-".concat(t.config.chart.type," .apexcharts-series[data\\:realIndex='").concat(e,"'] rect")),a=[],s=function(t){var e=function(e){return i[t].getAttribute(e)},s={x:parseFloat(e("x")),y:parseFloat(e("y")),width:parseFloat(e("width")),height:parseFloat(e("height"))};a.push({rect:s,color:i[t].getAttribute("color")})},r=0;r0?t:[]}));return t}}]),t}(),$i=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.twoDSeries=[],this.threeDSeries=[],this.twoDSeriesX=[],this.seriesGoals=[],this.coreUtils=new Pi(this.ctx)}return s(t,[{key:"isMultiFormat",value:function(){return this.isFormatXY()||this.isFormat2DArray()}},{key:"isFormatXY",value:function(){var t=this.w.config.series.slice(),e=new Zi(this.ctx);if(this.activeSeriesIndex=e.getActiveConfigSeriesIndex(),void 0!==t[this.activeSeriesIndex].data&&t[this.activeSeriesIndex].data.length>0&&null!==t[this.activeSeriesIndex].data[0]&&void 0!==t[this.activeSeriesIndex].data[0].x&&null!==t[this.activeSeriesIndex].data[0])return!0}},{key:"isFormat2DArray",value:function(){var t=this.w.config.series.slice(),e=new Zi(this.ctx);if(this.activeSeriesIndex=e.getActiveConfigSeriesIndex(),void 0!==t[this.activeSeriesIndex].data&&t[this.activeSeriesIndex].data.length>0&&void 0!==t[this.activeSeriesIndex].data[0]&&null!==t[this.activeSeriesIndex].data[0]&&t[this.activeSeriesIndex].data[0].constructor===Array)return!0}},{key:"handleFormat2DArray",value:function(t,e){for(var i=this.w.config,a=this.w.globals,s="boxPlot"===i.chart.type||"boxPlot"===i.series[e].type,r=0;r=5?this.twoDSeries.push(v.parseNumber(t[e].data[r][4])):this.twoDSeries.push(v.parseNumber(t[e].data[r][1])),a.dataFormatXNumeric=!0),"datetime"===i.xaxis.type){var n=new Date(t[e].data[r][0]);n=new Date(n).getTime(),this.twoDSeriesX.push(n)}else this.twoDSeriesX.push(t[e].data[r][0]);for(var o=0;o-1&&(r=this.activeSeriesIndex);for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:this.ctx,a=this.w.config,s=this.w.globals,r=new zi(i),n=a.labels.length>0?a.labels.slice():a.xaxis.categories.slice();s.isRangeBar="rangeBar"===a.chart.type&&s.isBarHorizontal,s.hasXaxisGroups="category"===a.xaxis.type&&a.xaxis.group.groups.length>0,s.hasXaxisGroups&&(s.groups=a.xaxis.group.groups),t.forEach((function(t,e){void 0!==t.name?s.seriesNames.push(t.name):s.seriesNames.push("series-"+parseInt(e+1,10))})),this.coreUtils.setSeriesYAxisMappings();var o=[],l=f(new Set(a.series.map((function(t){return t.group}))));a.series.forEach((function(t,e){var i=l.indexOf(t.group);o[i]||(o[i]=[]),o[i].push(s.seriesNames[e])})),s.seriesGroups=o;for(var h=function(){for(var t=0;t0&&(this.twoDSeriesX=n,s.seriesX.push(this.twoDSeriesX))),s.labels.push(this.twoDSeriesX);var d=t[c].data.map((function(t){return v.parseNumber(t)}));s.series.push(d)}s.seriesZ.push(this.threeDSeries),void 0!==t[c].color?s.seriesColors.push(t[c].color):s.seriesColors.push(void 0)}return this.w}},{key:"parseDataNonAxisCharts",value:function(t){var e=this.w.globals,i=this.w.config;e.series=t.slice(),e.seriesNames=i.labels.slice();for(var a=0;a0)i.labels=e.xaxis.categories;else if(e.labels.length>0)i.labels=e.labels.slice();else if(this.fallbackToCategory){if(i.labels=i.labels[0],i.seriesRange.length&&(i.seriesRange.map((function(t){t.forEach((function(t){i.labels.indexOf(t.x)<0&&t.x&&i.labels.push(t.x)}))})),i.labels=Array.from(new Set(i.labels.map(JSON.stringify)),JSON.parse)),e.xaxis.convertedCatToNumeric)new Ni(e).convertCatToNumericXaxis(e,this.ctx,i.seriesX[0]),this._generateExternalLabels(t)}else this._generateExternalLabels(t)}},{key:"_generateExternalLabels",value:function(t){var e=this.w.globals,i=this.w.config,a=[];if(e.axisCharts){if(e.series.length>0)if(this.isFormatXY())for(var s=i.series.map((function(t,e){return t.data.filter((function(t,e,i){return i.findIndex((function(e){return e.x===t.x}))===e}))})),r=s.reduce((function(t,e,i,a){return a[t].length>e.length?t:i}),0),n=0;n0&&s==i.length&&e.push(a)})),t.globals.ignoreYAxisIndexes=e.map((function(t){return t}))}}]),t}(),Ji=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"svgStringToNode",value:function(t){return(new DOMParser).parseFromString(t,"image/svg+xml").documentElement}},{key:"scaleSvgNode",value:function(t,e){var i=parseFloat(t.getAttributeNS(null,"width")),a=parseFloat(t.getAttributeNS(null,"height"));t.setAttributeNS(null,"width",i*e),t.setAttributeNS(null,"height",a*e),t.setAttributeNS(null,"viewBox","0 0 "+i+" "+a)}},{key:"getSvgString",value:function(t){var e=this;return new Promise((function(i){var a=e.w,s=t||a.config.chart.toolbar.export.scale||a.config.chart.toolbar.export.width/a.globals.svgWidth;s||(s=1);var r=a.globals.svgWidth*s,n=a.globals.svgHeight*s,o=a.globals.dom.elWrap.cloneNode(!0);o.style.width=r+"px",o.style.height=n+"px";var l=(new XMLSerializer).serializeToString(o),h='\n \n \n
\n \n ').concat(l,"\n
\n
\n
\n "),c=e.svgStringToNode(h);1!==s&&e.scaleSvgNode(c,s),e.convertImagesToBase64(c).then((function(){h=(new XMLSerializer).serializeToString(c),i(h.replace(/ /g," "))}))}))}},{key:"convertImagesToBase64",value:function(t){var e=this,i=t.getElementsByTagName("image"),a=Array.from(i).map((function(t){var i=t.getAttributeNS("http://www.w3.org/1999/xlink","href");return i&&!i.startsWith("data:")?e.getBase64FromUrl(i).then((function(e){t.setAttributeNS("http://www.w3.org/1999/xlink","href",e)})).catch((function(t){console.error("Error converting image to base64:",t)})):Promise.resolve()}));return Promise.all(a)}},{key:"getBase64FromUrl",value:function(t){return new Promise((function(e,i){var a=new Image;a.crossOrigin="Anonymous",a.onload=function(){var t=document.createElement("canvas");t.width=a.width,t.height=a.height,t.getContext("2d").drawImage(a,0,0),e(t.toDataURL())},a.onerror=i,a.src=t}))}},{key:"svgUrl",value:function(){var t=this;return new Promise((function(e){t.getSvgString().then((function(t){var i=new Blob([t],{type:"image/svg+xml;charset=utf-8"});e(URL.createObjectURL(i))}))}))}},{key:"dataURI",value:function(t){var e=this;return new Promise((function(i){var a=e.w,s=t?t.scale||t.width/a.globals.svgWidth:1,r=document.createElement("canvas");r.width=a.globals.svgWidth*s,r.height=parseInt(a.globals.dom.elWrap.style.height,10)*s;var n="transparent"!==a.config.chart.background&&a.config.chart.background?a.config.chart.background:"#fff",o=r.getContext("2d");o.fillStyle=n,o.fillRect(0,0,r.width*s,r.height*s),e.getSvgString(s).then((function(t){var e="data:image/svg+xml,"+encodeURIComponent(t),a=new Image;a.crossOrigin="anonymous",a.onload=function(){if(o.drawImage(a,0,0),r.msToBlob){var t=r.msToBlob();i({blob:t})}else{var e=r.toDataURL("image/png");i({imgURI:e})}},a.src=e}))}))}},{key:"exportToSVG",value:function(){var t=this;this.svgUrl().then((function(e){t.triggerDownload(e,t.w.config.chart.toolbar.export.svg.filename,".svg")}))}},{key:"exportToPng",value:function(){var t=this,e=this.w.config.chart.toolbar.export.scale,i=this.w.config.chart.toolbar.export.width,a=e?{scale:e}:i?{width:i}:void 0;this.dataURI(a).then((function(e){var i=e.imgURI,a=e.blob;a?navigator.msSaveOrOpenBlob(a,t.w.globals.chartID+".png"):t.triggerDownload(i,t.w.config.chart.toolbar.export.png.filename,".png")}))}},{key:"exportToCSV",value:function(t){var e=this,i=t.series,a=t.fileName,s=t.columnDelimiter,r=void 0===s?",":s,n=t.lineDelimiter,o=void 0===n?"\n":n,l=this.w;i||(i=l.config.series);var h=[],c=[],d="",u=l.globals.series.map((function(t,e){return-1===l.globals.collapsedSeriesIndices.indexOf(e)?t:[]})),g=function(t){return"function"==typeof l.config.chart.toolbar.export.csv.categoryFormatter?l.config.chart.toolbar.export.csv.categoryFormatter(t):"datetime"===l.config.xaxis.type&&String(t).length>=10?new Date(t).toDateString():v.isNumber(t)?t:t.split(r).join("")},p=function(t){return"function"==typeof l.config.chart.toolbar.export.csv.valueFormatter?l.config.chart.toolbar.export.csv.valueFormatter(t):t},x=Math.max.apply(Math,f(i.map((function(t){return t.data?t.data.length:0})))),b=new $i(this.ctx),m=new Ri(this.ctx),y=function(t){var i="";if(l.globals.axisCharts){if("category"===l.config.xaxis.type||l.config.xaxis.convertedCatToNumeric)if(l.globals.isBarHorizontal){var a=l.globals.yLabelFormatters[0],s=new Zi(e.ctx).getActiveConfigSeriesIndex();i=a(l.globals.labels[t],{seriesIndex:s,dataPointIndex:t,w:l})}else i=m.getLabel(l.globals.labels,l.globals.timescaleLabels,0,t).text;"datetime"===l.config.xaxis.type&&(l.config.xaxis.categories.length?i=l.config.xaxis.categories[t]:l.config.labels.length&&(i=l.config.labels[t]))}else i=l.config.labels[t];return null===i?"nullvalue":(Array.isArray(i)&&(i=i.join(" ")),v.isNumber(i)?i:i.split(r).join(""))},w=function(t,e){if(h.length&&0===e&&c.push(h.join(r)),t.data){t.data=t.data.length&&t.data||f(Array(x)).map((function(){return""}));for(var a=0;a0&&!s.globals.isBarHorizontal&&(this.xaxisLabels=s.globals.timescaleLabels.slice()),s.config.xaxis.overwriteCategories&&(this.xaxisLabels=s.config.xaxis.overwriteCategories),this.drawnLabels=[],this.drawnLabelsRects=[],"top"===s.config.xaxis.position?this.offY=0:this.offY=s.globals.gridHeight,this.offY=this.offY+s.config.xaxis.axisBorder.offsetY,this.isCategoryBarHorizontal="bar"===s.config.chart.type&&s.config.plotOptions.bar.horizontal,this.xaxisFontSize=s.config.xaxis.labels.style.fontSize,this.xaxisFontFamily=s.config.xaxis.labels.style.fontFamily,this.xaxisForeColors=s.config.xaxis.labels.style.colors,this.xaxisBorderWidth=s.config.xaxis.axisBorder.width,this.isCategoryBarHorizontal&&(this.xaxisBorderWidth=s.config.yaxis[0].axisBorder.width.toString()),this.xaxisBorderWidth.indexOf("%")>-1?this.xaxisBorderWidth=s.globals.gridWidth*parseInt(this.xaxisBorderWidth,10)/100:this.xaxisBorderWidth=parseInt(this.xaxisBorderWidth,10),this.xaxisBorderHeight=s.config.xaxis.axisBorder.height,this.yaxis=s.config.yaxis[0]}return s(t,[{key:"drawXaxis",value:function(){var t=this.w,e=new Mi(this.ctx),i=e.group({class:"apexcharts-xaxis",transform:"translate(".concat(t.config.xaxis.offsetX,", ").concat(t.config.xaxis.offsetY,")")}),a=e.group({class:"apexcharts-xaxis-texts-g",transform:"translate(".concat(t.globals.translateXAxisX,", ").concat(t.globals.translateXAxisY,")")});i.add(a);for(var s=[],r=0;r6&&void 0!==arguments[6]?arguments[6]:{},h=[],c=[],d=this.w,u=l.xaxisFontSize||this.xaxisFontSize,g=l.xaxisFontFamily||this.xaxisFontFamily,p=l.xaxisForeColors||this.xaxisForeColors,f=l.fontWeight||d.config.xaxis.labels.style.fontWeight,x=l.cssClass||d.config.xaxis.labels.style.cssClass,b=d.globals.padHorizontal,m=a.length,v="category"===d.config.xaxis.type?d.globals.dataPoints:m;if(0===v&&m>v&&(v=m),s){var y=Math.max(Number(d.config.xaxis.tickAmount)||1,v>1?v-1:v);n=d.globals.gridWidth/Math.min(y,m-1),b=b+r(0,n)/2+d.config.xaxis.labels.offsetX}else n=d.globals.gridWidth/v,b=b+r(0,n)+d.config.xaxis.labels.offsetX;for(var w=function(s){var l=b-r(s,n)/2+d.config.xaxis.labels.offsetX;0===s&&1===m&&n/2===b&&1===v&&(l=d.globals.gridWidth/2);var y=o.axesUtils.getLabel(a,d.globals.timescaleLabels,l,s,h,u,t),w=28;d.globals.rotateXLabels&&t&&(w=22),d.config.xaxis.title.text&&"top"===d.config.xaxis.position&&(w+=parseFloat(d.config.xaxis.title.style.fontSize)+2),t||(w=w+parseFloat(u)+(d.globals.xAxisLabelsHeight-d.globals.xAxisGroupLabelsHeight)+(d.globals.rotateXLabels?10:0)),y=void 0!==d.config.xaxis.tickAmount&&"dataPoints"!==d.config.xaxis.tickAmount&&"datetime"!==d.config.xaxis.type?o.axesUtils.checkLabelBasedOnTickamount(s,y,m):o.axesUtils.checkForOverflowingLabels(s,y,m,h,c);if(d.config.xaxis.labels.show){var k=e.drawText({x:y.x,y:o.offY+d.config.xaxis.labels.offsetY+w-("top"===d.config.xaxis.position?d.globals.xAxisHeight+d.config.xaxis.axisTicks.height-2:0),text:y.text,textAnchor:"middle",fontWeight:y.isBold?600:f,fontSize:u,fontFamily:g,foreColor:Array.isArray(p)?t&&d.config.xaxis.convertedCatToNumeric?p[d.globals.minX+s-1]:p[s]:p,isPlainText:!1,cssClass:(t?"apexcharts-xaxis-label ":"apexcharts-xaxis-group-label ")+x});if(i.add(k),k.on("click",(function(t){if("function"==typeof d.config.chart.events.xAxisLabelClick){var e=Object.assign({},d,{labelIndex:s});d.config.chart.events.xAxisLabelClick(t,o.ctx,e)}})),t){var A=document.createElementNS(d.globals.SVGNS,"title");A.textContent=Array.isArray(y.text)?y.text.join(" "):y.text,k.node.appendChild(A),""!==y.text&&(h.push(y.text),c.push(y))}}sa.globals.gridWidth)){var r=this.offY+a.config.xaxis.axisTicks.offsetY;if(e=e+r+a.config.xaxis.axisTicks.height,"top"===a.config.xaxis.position&&(e=r-a.config.xaxis.axisTicks.height),a.config.xaxis.axisTicks.show){var n=new Mi(this.ctx).drawLine(t+a.config.xaxis.axisTicks.offsetX,r+a.config.xaxis.offsetY,s+a.config.xaxis.axisTicks.offsetX,e+a.config.xaxis.offsetY,a.config.xaxis.axisTicks.color);i.add(n),n.node.classList.add("apexcharts-xaxis-tick")}}}},{key:"getXAxisTicksPositions",value:function(){var t=this.w,e=[],i=this.xaxisLabels.length,a=t.globals.padHorizontal;if(t.globals.timescaleLabels.length>0)for(var s=0;s0){var h=s[s.length-1].getBBox(),c=s[0].getBBox();h.x<-20&&s[s.length-1].parentNode.removeChild(s[s.length-1]),c.x+c.width>t.globals.gridWidth&&!t.globals.isBarHorizontal&&s[0].parentNode.removeChild(s[0]);for(var d=0;d0&&(this.xaxisLabels=a.globals.timescaleLabels.slice())}return s(t,[{key:"drawGridArea",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=this.w,i=new Mi(this.ctx);t||(t=i.group({class:"apexcharts-grid"}));var a=i.drawLine(e.globals.padHorizontal,1,e.globals.padHorizontal,e.globals.gridHeight,"transparent"),s=i.drawLine(e.globals.padHorizontal,e.globals.gridHeight,e.globals.gridWidth,e.globals.gridHeight,"transparent");return t.add(s),t.add(a),t}},{key:"drawGrid",value:function(){if(this.w.globals.axisCharts){var t=this.renderGrid();return this.drawGridArea(t.el),t}return null}},{key:"createGridMask",value:function(){var t=this.w,e=t.globals,i=new Mi(this.ctx),a=Array.isArray(t.config.stroke.width)?Math.max.apply(Math,f(t.config.stroke.width)):t.config.stroke.width,s=function(t){var i=document.createElementNS(e.SVGNS,"clipPath");return i.setAttribute("id",t),i};e.dom.elGridRectMask=s("gridRectMask".concat(e.cuid)),e.dom.elGridRectBarMask=s("gridRectBarMask".concat(e.cuid)),e.dom.elGridRectMarkerMask=s("gridRectMarkerMask".concat(e.cuid)),e.dom.elForecastMask=s("forecastMask".concat(e.cuid)),e.dom.elNonForecastMask=s("nonForecastMask".concat(e.cuid));var r=0,n=0;(["bar","rangeBar","candlestick","boxPlot"].includes(t.config.chart.type)||t.globals.comboBarCount>0)&&t.globals.isXNumeric&&!t.globals.isBarHorizontal&&(r=Math.max(t.config.grid.padding.left,e.barPadForNumericAxis),n=Math.max(t.config.grid.padding.right,e.barPadForNumericAxis)),e.dom.elGridRect=i.drawRect(-a/2-2,-a/2-2,e.gridWidth+a+4,e.gridHeight+a+4,0,"#fff"),e.dom.elGridRectBar=i.drawRect(-a/2-r-2,-a/2-2,e.gridWidth+a+n+r+4,e.gridHeight+a+4,0,"#fff");var o=t.globals.markers.largestSize;e.dom.elGridRectMarker=i.drawRect(-o,-o,e.gridWidth+2*o,e.gridHeight+2*o,0,"#fff"),e.dom.elGridRectMask.appendChild(e.dom.elGridRect.node),e.dom.elGridRectBarMask.appendChild(e.dom.elGridRectBar.node),e.dom.elGridRectMarkerMask.appendChild(e.dom.elGridRectMarker.node);var l=e.dom.baseEl.querySelector("defs");l.appendChild(e.dom.elGridRectMask),l.appendChild(e.dom.elGridRectBarMask),l.appendChild(e.dom.elGridRectMarkerMask),l.appendChild(e.dom.elForecastMask),l.appendChild(e.dom.elNonForecastMask)}},{key:"_drawGridLines",value:function(t){var e=t.i,i=t.x1,a=t.y1,s=t.x2,r=t.y2,n=t.xCount,o=t.parent,l=this.w;if(!(0===e&&l.globals.skipFirstTimelinelabel||e===n-1&&l.globals.skipLastTimelinelabel&&!l.config.xaxis.labels.formatter||"radar"===l.config.chart.type)){l.config.grid.xaxis.lines.show&&this._drawGridLine({i:e,x1:i,y1:a,x2:s,y2:r,xCount:n,parent:o});var h=0;if(l.globals.hasXaxisGroups&&"between"===l.config.xaxis.tickPlacement){var c=l.globals.groups;if(c){for(var d=0,u=0;d0&&"datetime"!==t.config.xaxis.type&&(s=e.yAxisScale[a].result.length-1);this._drawXYLines({xCount:s,tickAmount:r})}else s=r,r=e.xTickAmount,this._drawInvertedXYLines({xCount:s,tickAmount:r});return this.drawGridBands(s,r),{el:this.elg,elGridBorders:this.elGridBorders,xAxisTickWidth:e.gridWidth/s}}},{key:"drawGridBands",value:function(t,e){var i,a,s=this,r=this.w;if((null===(i=r.config.grid.row.colors)||void 0===i?void 0:i.length)>0&&function(t,i,a,n,o,l){for(var h=0,c=0;h=r.config.grid[t].colors.length&&(c=0),s._drawGridBandRect({c:c,x1:a,y1:n,x2:o,y2:l,type:t}),n+=r.globals.gridHeight/e}("row",e,0,0,r.globals.gridWidth,r.globals.gridHeight/e),(null===(a=r.config.grid.column.colors)||void 0===a?void 0:a.length)>0){var n=r.globals.isBarHorizontal||"on"!==r.config.xaxis.tickPlacement||"category"!==r.config.xaxis.type&&!r.config.xaxis.convertedCatToNumeric?t:t-1;r.globals.isXNumeric&&(n=r.globals.xAxisScale.result.length-1);for(var o=r.globals.padHorizontal,l=r.globals.padHorizontal+r.globals.gridWidth/n,h=r.globals.gridHeight,c=0,d=0;c=r.config.grid.column.colors.length&&(d=0),"datetime"===r.config.xaxis.type)o=this.xaxisLabels[c].position,l=((null===(u=this.xaxisLabels[c+1])||void 0===u?void 0:u.position)||r.globals.gridWidth)-this.xaxisLabels[c].position;this._drawGridBandRect({c:d,x1:o,y1:0,x2:l,y2:h,type:"column"}),o+=r.globals.gridWidth/n}}}}]),t}(),ta=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.coreUtils=new Pi(this.ctx)}return s(t,[{key:"niceScale",value:function(t,e){var i,a,s,r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=1e-11,l=this.w,h=l.globals;h.isBarHorizontal?(i=l.config.xaxis,a=Math.max((h.svgWidth-100)/25,2)):(i=l.config.yaxis[n],a=Math.max((h.svgHeight-100)/15,2)),v.isNumber(a)||(a=10),s=void 0!==i.min&&null!==i.min,r=void 0!==i.max&&null!==i.min;var c=void 0!==i.stepSize&&null!==i.stepSize,d=void 0!==i.tickAmount&&null!==i.tickAmount,u=d?i.tickAmount:h.niceScaleDefaultTicks[Math.min(Math.round(a/2),h.niceScaleDefaultTicks.length-1)];if(h.isMultipleYAxis&&!d&&h.multiAxisTickAmount>0&&(u=h.multiAxisTickAmount,d=!0),u="dataPoints"===u?h.dataPoints-1:Math.abs(Math.round(u)),(t===Number.MIN_VALUE&&0===e||!v.isNumber(t)&&!v.isNumber(e)||t===Number.MIN_VALUE&&e===-Number.MAX_VALUE)&&(t=v.isNumber(i.min)?i.min:0,e=v.isNumber(i.max)?i.max:t+u,h.allSeriesCollapsed=!1),t>e){console.warn("axis.min cannot be greater than axis.max: swapping min and max");var g=e;e=t,t=g}else t===e&&(t=0===t?0:t-1,e=0===e?2:e+1);var p=[];u<1&&(u=1);var f=u,x=Math.abs(e-t);!s&&t>0&&t/x<.15&&(t=0,s=!0),!r&&e<0&&-e/x<.15&&(e=0,r=!0);var b=(x=Math.abs(e-t))/f,m=b,y=Math.floor(Math.log10(m)),w=Math.pow(10,y),k=Math.ceil(m/w);if(b=m=(k=h.niceScaleAllowedMagMsd[0===h.yValueDecimal?0:1][k])*w,h.isBarHorizontal&&i.stepSize&&"datetime"!==i.type?(b=i.stepSize,c=!0):c&&(b=i.stepSize),c&&i.forceNiceScale){var A=Math.floor(Math.log10(b));b*=Math.pow(10,y-A)}if(s&&r){var C=x/f;if(d)if(c)if(0!=v.mod(x,b)){var S=v.getGCD(b,C);b=C/S<10?S:C}else 0==v.mod(b,C)?b=C:(C=b,d=!1);else b=C;else if(c)0==v.mod(x,b)?C=b:b=C;else if(0==v.mod(x,b))C=b;else{C=x/(f=Math.ceil(x/b));var L=v.getGCD(x,b);x/La&&(t=e-b*u,t+=b*Math.floor((M-t)/b))}else if(s)if(d)e=t+b*f;else{var P=e;e=b*Math.ceil(e/b),Math.abs(e-t)/v.getGCD(x,b)>a&&(e=t+b*u,e+=b*Math.ceil((P-e)/b))}}else if(h.isMultipleYAxis&&d){var I=b*Math.floor(t/b),T=I+b*f;T0&&t16&&v.getPrimeFactors(f).length<2&&f++,!d&&i.forceNiceScale&&0===h.yValueDecimal&&f>x&&(f=x,b=Math.round(x/f)),f>a&&(!d&&!c||i.forceNiceScale)){var z=v.getPrimeFactors(f),X=z.length-1,R=f;t:for(var E=0;EN);return{result:p,niceMin:p[0],niceMax:p[p.length-1]}}},{key:"linearScale",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0,r=Math.abs(e-t),n=[];if(t===e)return{result:n=[t],niceMin:n[0],niceMax:n[n.length-1]};"dataPoints"===(i=this._adjustTicksForSmallRange(i,a,r))&&(i=this.w.globals.dataPoints-1),s||(s=r/i),s=Math.round(100*(s+Number.EPSILON))/100,i===Number.MAX_VALUE&&(i=5,s=1);for(var o=t;i>=0;)n.push(o),o=v.preciseAddition(o,s),i-=1;return{result:n,niceMin:n[0],niceMax:n[n.length-1]}}},{key:"logarithmicScaleNice",value:function(t,e,i){e<=0&&(e=Math.max(t,i)),t<=0&&(t=Math.min(e,i));for(var a=[],s=Math.ceil(Math.log(e)/Math.log(i)+1),r=Math.floor(Math.log(t)/Math.log(i));r5?(a.allSeriesCollapsed=!1,a.yAxisScale[t]=r.forceNiceScale?this.logarithmicScaleNice(e,i,r.logBase):this.logarithmicScale(e,i,r.logBase)):i!==-Number.MAX_VALUE&&v.isNumber(i)&&e!==Number.MAX_VALUE&&v.isNumber(e)?(a.allSeriesCollapsed=!1,a.yAxisScale[t]=this.niceScale(e,i,t)):a.yAxisScale[t]=this.niceScale(Number.MIN_VALUE,0,t)}},{key:"setXScale",value:function(t,e){var i=this.w,a=i.globals;if(e!==-Number.MAX_VALUE&&v.isNumber(e)){var s=a.xTickAmount;a.xAxisScale=this.linearScale(t,e,s,0,i.config.xaxis.stepSize)}else a.xAxisScale=this.linearScale(0,10,10);return a.xAxisScale}},{key:"scaleMultipleYAxes",value:function(){var t=this,e=this.w.config,i=this.w.globals;this.coreUtils.setSeriesYAxisMappings();var a=i.seriesYAxisMap,s=i.minYArr,r=i.maxYArr;i.allSeriesCollapsed=!0,i.barGroups=[],a.forEach((function(a,n){var o=[];a.forEach((function(t){var i,a=null===(i=e.series[t])||void 0===i?void 0:i.group;o.indexOf(a)<0&&o.push(a)})),a.length>0?function(){var l,h,c=Number.MAX_VALUE,d=-Number.MAX_VALUE,u=c,g=d;if(e.chart.stacked)!function(){var t=new Array(i.dataPoints).fill(0),s=[],r=[],p=[];o.forEach((function(){s.push(t.map((function(){return Number.MIN_VALUE}))),r.push(t.map((function(){return Number.MIN_VALUE}))),p.push(t.map((function(){return Number.MIN_VALUE})))}));for(var f=function(t){!l&&e.series[a[t]].type&&(l=e.series[a[t]].type);var c=a[t];h=e.series[c].group?e.series[c].group:"axis-".concat(n),!(i.collapsedSeriesIndices.indexOf(c)<0&&i.ancillaryCollapsedSeriesIndices.indexOf(c)<0)||(i.allSeriesCollapsed=!1,o.forEach((function(t,a){if(e.series[c].group===t)for(var n=0;n=0?r[a][n]+=o:p[a][n]+=o,s[a][n]+=o,u=Math.min(u,o),g=Math.max(g,o)}}))),"bar"!==l&&"column"!==l||i.barGroups.push(h)},x=0;x1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-Number.MAX_VALUE,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,s=this.w.config,r=this.w.globals,n=-Number.MAX_VALUE,o=Number.MIN_VALUE;null===a&&(a=t+1);var l=r.series,h=l,c=l;"candlestick"===s.chart.type?(h=r.seriesCandleL,c=r.seriesCandleH):"boxPlot"===s.chart.type?(h=r.seriesCandleO,c=r.seriesCandleC):r.isRangeData&&(h=r.seriesRangeStart,c=r.seriesRangeEnd);var d=!1;if(r.seriesX.length>=a){var u,g=null===(u=r.brushSource)||void 0===u?void 0:u.w.config.chart.brush;(s.chart.zoom.enabled&&s.chart.zoom.autoScaleYaxis||null!=g&&g.enabled&&null!=g&&g.autoScaleYaxis)&&(d=!0)}for(var p=t;px&&r.seriesX[p][b]>s.xaxis.max;b--);}for(var m=x;m<=b&&mh[p][m]&&h[p][m]<0&&(o=h[p][m])}else r.hasNullValues=!0}"bar"!==f&&"column"!==f||(o<0&&n<0&&(n=0,i=Math.max(i,0)),o===Number.MIN_VALUE&&(o=0,e=Math.min(e,0)))}return"rangeBar"===s.chart.type&&r.seriesRangeStart.length&&r.isBarHorizontal&&(o=e),"bar"===s.chart.type&&(o<0&&n<0&&(n=0),o===Number.MIN_VALUE&&(o=0)),{minY:o,maxY:n,lowestY:e,highestY:i}}},{key:"setYRange",value:function(){var t=this.w.globals,e=this.w.config;t.maxY=-Number.MAX_VALUE,t.minY=Number.MIN_VALUE;var i,a=Number.MAX_VALUE;if(t.isMultipleYAxis){a=Number.MAX_VALUE;for(var s=0;st.dataPoints&&0!==t.dataPoints&&(a=t.dataPoints-1);else if("dataPoints"===e.xaxis.tickAmount){if(t.series.length>1&&(a=t.series[t.maxValsInArrayIndex].length-1),t.isXNumeric){var s=Math.round(t.maxX-t.minX);s<30&&(a=s-1)}}else a=e.xaxis.tickAmount;if(t.xTickAmount=a,void 0!==e.xaxis.max&&"number"==typeof e.xaxis.max&&(t.maxX=e.xaxis.max),void 0!==e.xaxis.min&&"number"==typeof e.xaxis.min&&(t.minX=e.xaxis.min),void 0!==e.xaxis.range&&(t.minX=t.maxX-e.xaxis.range),t.minX!==Number.MAX_VALUE&&t.maxX!==-Number.MAX_VALUE)if(e.xaxis.convertedCatToNumeric&&!t.dataFormatXNumeric){for(var r=[],n=t.minX-1;n0&&(t.xAxisScale=this.scales.linearScale(1,t.labels.length,a-1,0,e.xaxis.stepSize),t.seriesX=t.labels.slice());i&&(t.labels=t.xAxisScale.result.slice())}return t.isBarHorizontal&&t.labels.length&&(t.xTickAmount=t.labels.length),this._handleSingleDataPoint(),this._getMinXDiff(),{minX:t.minX,maxX:t.maxX}}},{key:"setZRange",value:function(){var t=this.w.globals;if(t.isDataXYZ)for(var e=0;e0){var s=e-a[i-1];s>0&&(t.minXDiff=Math.min(s,t.minXDiff))}})),1!==t.dataPoints&&t.minXDiff!==Number.MAX_VALUE||(t.minXDiff=.5)}}))}},{key:"_setStackedMinMax",value:function(){var t=this,e=this.w.globals;if(e.series.length){var i=e.seriesGroups;i.length||(i=[this.w.globals.seriesNames.map((function(t){return t}))]);var a={},s={};i.forEach((function(i){a[i]=[],s[i]=[],t.w.config.series.map((function(t,a){return i.indexOf(e.seriesNames[a])>-1?a:null})).filter((function(t){return null!==t})).forEach((function(r){for(var n=0;n0?a[i][n]+=parseFloat(e.series[r][n])+1e-4:s[i][n]+=parseFloat(e.series[r][n]))}}))})),Object.entries(a).forEach((function(t){var i=p(t,1)[0];a[i].forEach((function(t,r){e.maxY=Math.max(e.maxY,a[i][r]),e.minY=Math.min(e.minY,s[i][r])}))}))}}}]),t}(),ia=function(){function t(e,a){i(this,t),this.ctx=e,this.elgrid=a,this.w=e.w;var s=this.w;this.xaxisFontSize=s.config.xaxis.labels.style.fontSize,this.axisFontFamily=s.config.xaxis.labels.style.fontFamily,this.xaxisForeColors=s.config.xaxis.labels.style.colors,this.isCategoryBarHorizontal="bar"===s.config.chart.type&&s.config.plotOptions.bar.horizontal,this.xAxisoffX="bottom"===s.config.xaxis.position?s.globals.gridHeight:0,this.drawnLabels=[],this.axesUtils=new Ri(e)}return s(t,[{key:"drawYaxis",value:function(t){var e=this.w,i=new Mi(this.ctx),a=e.config.yaxis[t].labels.style,s=a.fontSize,r=a.fontFamily,n=a.fontWeight,o=i.group({class:"apexcharts-yaxis",rel:t,transform:"translate(".concat(e.globals.translateYAxisX[t],", 0)")});if(this.axesUtils.isYAxisHidden(t))return o;var l=i.group({class:"apexcharts-yaxis-texts-g"});o.add(l);var h=e.globals.yAxisScale[t].result.length-1,c=e.globals.gridHeight/h,d=e.globals.yLabelFormatters[t],u=this.axesUtils.checkForReversedLabels(t,e.globals.yAxisScale[t].result.slice());if(e.config.yaxis[t].labels.show){var g=e.globals.translateY+e.config.yaxis[t].labels.offsetY;e.globals.isBarHorizontal?g=0:"heatmap"===e.config.chart.type&&(g-=c/2),g+=parseInt(s,10)/3;for(var p=h;p>=0;p--){var f=d(u[p],p,e),x=e.config.yaxis[t].labels.padding;e.config.yaxis[t].opposite&&0!==e.config.yaxis.length&&(x*=-1);var b=this.getTextAnchor(e.config.yaxis[t].labels.align,e.config.yaxis[t].opposite),m=this.axesUtils.getYAxisForeColor(a.colors,t),y=Array.isArray(m)?m[p]:m,w=v.listToArray(e.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxis[rel='".concat(t,"'] .apexcharts-yaxis-label tspan"))).map((function(t){return t.textContent})),k=i.drawText({x:x,y:g,text:w.includes(f)&&!e.config.yaxis[t].labels.showDuplicates?"":f,textAnchor:b,fontSize:s,fontFamily:r,fontWeight:n,maxWidth:e.config.yaxis[t].labels.maxWidth,foreColor:y,isPlainText:!1,cssClass:"apexcharts-yaxis-label ".concat(a.cssClass)});l.add(k),this.addTooltip(k,f),0!==e.config.yaxis[t].labels.rotate&&this.rotateLabel(i,k,firstLabel,e.config.yaxis[t].labels.rotate),g+=c}}return this.addYAxisTitle(i,o,t),this.addAxisBorder(i,o,t,h,c),o}},{key:"getTextAnchor",value:function(t,e){return"left"===t?"start":"center"===t?"middle":"right"===t?"end":e?"start":"end"}},{key:"addTooltip",value:function(t,e){var i=document.createElementNS(this.w.globals.SVGNS,"title");i.textContent=Array.isArray(e)?e.join(" "):e,t.node.appendChild(i)}},{key:"rotateLabel",value:function(t,e,i,a){var s=t.rotateAroundCenter(i.node),r=t.rotateAroundCenter(e.node);e.node.setAttribute("transform","rotate(".concat(a," ").concat(s.x," ").concat(r.y,")"))}},{key:"addYAxisTitle",value:function(t,e,i){var a=this.w;if(void 0!==a.config.yaxis[i].title.text){var s=t.group({class:"apexcharts-yaxis-title"}),r=a.config.yaxis[i].opposite?a.globals.translateYAxisX[i]:0,n=t.drawText({x:r,y:a.globals.gridHeight/2+a.globals.translateY+a.config.yaxis[i].title.offsetY,text:a.config.yaxis[i].title.text,textAnchor:"end",foreColor:a.config.yaxis[i].title.style.color,fontSize:a.config.yaxis[i].title.style.fontSize,fontWeight:a.config.yaxis[i].title.style.fontWeight,fontFamily:a.config.yaxis[i].title.style.fontFamily,cssClass:"apexcharts-yaxis-title-text ".concat(a.config.yaxis[i].title.style.cssClass)});s.add(n),e.add(s)}}},{key:"addAxisBorder",value:function(t,e,i,a,s){var r=this.w,n=r.config.yaxis[i].axisBorder,o=31+n.offsetX;if(r.config.yaxis[i].opposite&&(o=-31-n.offsetX),n.show){var l=t.drawLine(o,r.globals.translateY+n.offsetY-2,o,r.globals.gridHeight+r.globals.translateY+n.offsetY+2,n.color,0,n.width);e.add(l)}r.config.yaxis[i].axisTicks.show&&this.axesUtils.drawYAxisTicks(o,a,n,r.config.yaxis[i].axisTicks,i,s,e)}},{key:"drawYaxisInversed",value:function(t){var e=this.w,i=new Mi(this.ctx),a=i.group({class:"apexcharts-xaxis apexcharts-yaxis-inversed"}),s=i.group({class:"apexcharts-xaxis-texts-g",transform:"translate(".concat(e.globals.translateXAxisX,", ").concat(e.globals.translateXAxisY,")")});a.add(s);var r=e.globals.yAxisScale[t].result.length-1,n=e.globals.gridWidth/r+.1,o=n+e.config.xaxis.labels.offsetX,l=e.globals.xLabelFormatter,h=this.axesUtils.checkForReversedLabels(t,e.globals.yAxisScale[t].result.slice()),c=e.globals.timescaleLabels;if(c.length>0&&(this.xaxisLabels=c.slice(),r=(h=c.slice()).length),e.config.xaxis.labels.show)for(var d=c.length?0:r;c.length?d=0;c.length?d++:d--){var u=l(h[d],d,e),g=e.globals.gridWidth+e.globals.padHorizontal-(o-n+e.config.xaxis.labels.offsetX);if(c.length){var p=this.axesUtils.getLabel(h,c,g,d,this.drawnLabels,this.xaxisFontSize);g=p.x,u=p.text,this.drawnLabels.push(p.text),0===d&&e.globals.skipFirstTimelinelabel&&(u=""),d===h.length-1&&e.globals.skipLastTimelinelabel&&(u="")}var f=i.drawText({x:g,y:this.xAxisoffX+e.config.xaxis.labels.offsetY+30-("top"===e.config.xaxis.position?e.globals.xAxisHeight+e.config.xaxis.axisTicks.height-2:0),text:u,textAnchor:"middle",foreColor:Array.isArray(this.xaxisForeColors)?this.xaxisForeColors[t]:this.xaxisForeColors,fontSize:this.xaxisFontSize,fontFamily:this.xaxisFontFamily,fontWeight:e.config.xaxis.labels.style.fontWeight,isPlainText:!1,cssClass:"apexcharts-xaxis-label ".concat(e.config.xaxis.labels.style.cssClass)});s.add(f),f.tspan(u),this.addTooltip(f,u),o+=n}return this.inversedYAxisTitleText(a),this.inversedYAxisBorder(a),a}},{key:"inversedYAxisBorder",value:function(t){var e=this.w,i=new Mi(this.ctx),a=e.config.xaxis.axisBorder;if(a.show){var s=0;"bar"===e.config.chart.type&&e.globals.isXNumeric&&(s-=15);var r=i.drawLine(e.globals.padHorizontal+s+a.offsetX,this.xAxisoffX,e.globals.gridWidth,this.xAxisoffX,a.color,0,a.height);this.elgrid&&this.elgrid.elGridBorders&&e.config.grid.show?this.elgrid.elGridBorders.add(r):t.add(r)}}},{key:"inversedYAxisTitleText",value:function(t){var e=this.w,i=new Mi(this.ctx);if(void 0!==e.config.xaxis.title.text){var a=i.group({class:"apexcharts-xaxis-title apexcharts-yaxis-title-inversed"}),s=i.drawText({x:e.globals.gridWidth/2+e.config.xaxis.title.offsetX,y:this.xAxisoffX+parseFloat(this.xaxisFontSize)+parseFloat(e.config.xaxis.title.style.fontSize)+e.config.xaxis.title.offsetY+20,text:e.config.xaxis.title.text,textAnchor:"middle",fontSize:e.config.xaxis.title.style.fontSize,fontFamily:e.config.xaxis.title.style.fontFamily,fontWeight:e.config.xaxis.title.style.fontWeight,foreColor:e.config.xaxis.title.style.color,cssClass:"apexcharts-xaxis-title-text ".concat(e.config.xaxis.title.style.cssClass)});a.add(s),t.add(a)}}},{key:"yAxisTitleRotate",value:function(t,e){var i=this.w,a=new Mi(this.ctx),s=i.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(t,"'] .apexcharts-yaxis-texts-g")),r=s?s.getBoundingClientRect():{width:0,height:0},n=i.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(t,"'] .apexcharts-yaxis-title text")),o=n?n.getBoundingClientRect():{width:0,height:0};if(n){var l=this.xPaddingForYAxisTitle(t,r,o,e);n.setAttribute("x",l.xPos-(e?10:0));var h=a.rotateAroundCenter(n);n.setAttribute("transform","rotate(".concat(e?-1*i.config.yaxis[t].title.rotate:i.config.yaxis[t].title.rotate," ").concat(h.x," ").concat(h.y,")"))}}},{key:"xPaddingForYAxisTitle",value:function(t,e,i,a){var s=this.w,r=0,n=10;return void 0===s.config.yaxis[t].title.text||t<0?{xPos:r,padd:0}:(a?r=e.width+s.config.yaxis[t].title.offsetX+i.width/2+n/2:(r=-1*e.width+s.config.yaxis[t].title.offsetX+n/2+i.width/2,s.globals.isBarHorizontal&&(n=25,r=-1*e.width-s.config.yaxis[t].title.offsetX-n)),{xPos:r,padd:n})}},{key:"setYAxisXPosition",value:function(t,e){var i=this.w,a=0,s=0,r=18,n=1;i.config.yaxis.length>1&&(this.multipleYs=!0),i.config.yaxis.forEach((function(o,l){var h=i.globals.ignoreYAxisIndexes.includes(l)||!o.show||o.floating||0===t[l].width,c=t[l].width+e[l].width;o.opposite?i.globals.isBarHorizontal?(s=i.globals.gridWidth+i.globals.translateX-1,i.globals.translateYAxisX[l]=s-o.labels.offsetX):(s=i.globals.gridWidth+i.globals.translateX+n,h||(n+=c+20),i.globals.translateYAxisX[l]=s-o.labels.offsetX+20):(a=i.globals.translateX-r,h||(r+=c+20),i.globals.translateYAxisX[l]=a+o.labels.offsetX)}))}},{key:"setYAxisTextAlignments",value:function(){var t=this.w;v.listToArray(t.globals.dom.baseEl.getElementsByClassName("apexcharts-yaxis")).forEach((function(e,i){var a=t.config.yaxis[i];if(a&&!a.floating&&void 0!==a.labels.align){var s=t.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(i,"'] .apexcharts-yaxis-texts-g")),r=v.listToArray(t.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxis[rel='".concat(i,"'] .apexcharts-yaxis-label"))),n=s.getBoundingClientRect();r.forEach((function(t){t.setAttribute("text-anchor",a.labels.align)})),"left"!==a.labels.align||a.opposite?"center"===a.labels.align?s.setAttribute("transform","translate(".concat(n.width/2*(a.opposite?1:-1),", 0)")):"right"===a.labels.align&&a.opposite&&s.setAttribute("transform","translate(".concat(n.width,", 0)")):s.setAttribute("transform","translate(-".concat(n.width,", 0)"))}}))}}]),t}(),aa=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.documentEvent=v.bind(this.documentEvent,this)}return s(t,[{key:"addEventListener",value:function(t,e){var i=this.w;i.globals.events.hasOwnProperty(t)?i.globals.events[t].push(e):i.globals.events[t]=[e]}},{key:"removeEventListener",value:function(t,e){var i=this.w;if(i.globals.events.hasOwnProperty(t)){var a=i.globals.events[t].indexOf(e);-1!==a&&i.globals.events[t].splice(a,1)}}},{key:"fireEvent",value:function(t,e){var i=this.w;if(i.globals.events.hasOwnProperty(t)){e&&e.length||(e=[]);for(var a=i.globals.events[t],s=a.length,r=0;r0&&(e=this.w.config.chart.locales.concat(window.Apex.chart.locales));var i=e.filter((function(e){return e.name===t}))[0];if(!i)throw new Error("Wrong locale name provided. Please make sure you set the correct locale name in options");var a=v.extend(Hi,i);this.w.globals.locale=a.options}}]),t}(),ra=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"drawAxis",value:function(t,e){var i,a,s=this,r=this.w.globals,n=this.w.config,o=new Qi(this.ctx,e),l=new ia(this.ctx,e);r.axisCharts&&"radar"!==t&&(r.isBarHorizontal?(a=l.drawYaxisInversed(0),i=o.drawXaxisInversed(0),r.dom.elGraphical.add(i),r.dom.elGraphical.add(a)):(i=o.drawXaxis(),r.dom.elGraphical.add(i),n.yaxis.map((function(t,e){if(-1===r.ignoreYAxisIndexes.indexOf(e)&&(a=l.drawYaxis(e),r.dom.Paper.add(a),"back"===s.w.config.grid.position)){var i=r.dom.Paper.children()[1];i.remove(),r.dom.Paper.add(i)}}))))}}]),t}(),na=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"drawXCrosshairs",value:function(){var t=this.w,e=new Mi(this.ctx),i=new Li(this.ctx),a=t.config.xaxis.crosshairs.fill.gradient,s=t.config.xaxis.crosshairs.dropShadow,r=t.config.xaxis.crosshairs.fill.type,n=a.colorFrom,o=a.colorTo,l=a.opacityFrom,h=a.opacityTo,c=a.stops,d=s.enabled,u=s.left,g=s.top,p=s.blur,f=s.color,x=s.opacity,b=t.config.xaxis.crosshairs.fill.color;if(t.config.xaxis.crosshairs.show){"gradient"===r&&(b=e.drawGradient("vertical",n,o,l,h,null,c,null));var m=e.drawRect();1===t.config.xaxis.crosshairs.width&&(m=e.drawLine());var y=t.globals.gridHeight;(!v.isNumber(y)||y<0)&&(y=0);var w=t.config.xaxis.crosshairs.width;(!v.isNumber(w)||w<0)&&(w=0),m.attr({class:"apexcharts-xcrosshairs",x:0,y:0,y2:y,width:w,height:y,fill:b,filter:"none","fill-opacity":t.config.xaxis.crosshairs.opacity,stroke:t.config.xaxis.crosshairs.stroke.color,"stroke-width":t.config.xaxis.crosshairs.stroke.width,"stroke-dasharray":t.config.xaxis.crosshairs.stroke.dashArray}),d&&(m=i.dropShadow(m,{left:u,top:g,blur:p,color:f,opacity:x})),t.globals.dom.elGraphical.add(m)}}},{key:"drawYCrosshairs",value:function(){var t=this.w,e=new Mi(this.ctx),i=t.config.yaxis[0].crosshairs,a=t.globals.barPadForNumericAxis;if(t.config.yaxis[0].crosshairs.show){var s=e.drawLine(-a,0,t.globals.gridWidth+a,0,i.stroke.color,i.stroke.dashArray,i.stroke.width);s.attr({class:"apexcharts-ycrosshairs"}),t.globals.dom.elGraphical.add(s)}var r=e.drawLine(-a,0,t.globals.gridWidth+a,0,i.stroke.color,0,0);r.attr({class:"apexcharts-ycrosshairs-hidden"}),t.globals.dom.elGraphical.add(r)}}]),t}(),oa=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"checkResponsiveConfig",value:function(t){var e=this,i=this.w,a=i.config;if(0!==a.responsive.length){var s=a.responsive.slice();s.sort((function(t,e){return t.breakpoint>e.breakpoint?1:e.breakpoint>t.breakpoint?-1:0})).reverse();var r=new Wi({}),n=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=s[0].breakpoint,n=window.innerWidth>0?window.innerWidth:screen.width;if(n>a){var o=v.clone(i.globals.initialConfig);o.series=v.clone(i.config.series);var l=Pi.extendArrayProps(r,o,i);t=v.extend(l,t),t=v.extend(i.config,t),e.overrideResponsiveOptions(t)}else for(var h=0;h0&&"function"==typeof t[0]?(this.isColorFn=!0,i.config.series.map((function(a,s){var r=t[s]||t[0];return"function"==typeof r?r({value:i.globals.axisCharts?i.globals.series[s][0]||0:i.globals.series[s],seriesIndex:s,dataPointIndex:s,w:e.w}):r}))):t:this.predefined()}},{key:"applySeriesColors",value:function(t,e){t.forEach((function(t,i){t&&(e[i]=t)}))}},{key:"getMonochromeColors",value:function(t,e,i){var a=t.color,s=t.shadeIntensity,r=t.shadeTo,n=this.isBarDistributed||this.isHeatmapDistributed?e[0].length*e.length:e.length,o=1/(n/s),l=0;return Array.from({length:n},(function(){var t="dark"===r?i.shadeColor(-1*l,a):i.shadeColor(l,a);return l+=o,t}))}},{key:"applyColorTypes",value:function(t,e){var i=this,a=this.w;t.forEach((function(t){a.globals[t].colors=void 0===a.config[t].colors?i.isColorFn?a.config.colors:e:a.config[t].colors.slice(),i.pushExtraColors(a.globals[t].colors)}))}},{key:"applyDataLabelsColors",value:function(t){var e=this.w;e.globals.dataLabels.style.colors=void 0===e.config.dataLabels.style.colors?t:e.config.dataLabels.style.colors.slice(),this.pushExtraColors(e.globals.dataLabels.style.colors,50)}},{key:"applyRadarPolygonsColors",value:function(){var t=this.w;t.globals.radarPolygons.fill.colors=void 0===t.config.plotOptions.radar.polygons.fill.colors?["dark"===t.config.theme.mode?"#424242":"none"]:t.config.plotOptions.radar.polygons.fill.colors.slice(),this.pushExtraColors(t.globals.radarPolygons.fill.colors,20)}},{key:"applyMarkersColors",value:function(t){var e=this.w;e.globals.markers.colors=void 0===e.config.markers.colors?t:e.config.markers.colors.slice(),this.pushExtraColors(e.globals.markers.colors)}},{key:"pushExtraColors",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=this.w,s=e||a.globals.series.length;if(null===i&&(i=this.isBarDistributed||this.isHeatmapDistributed||"heatmap"===a.config.chart.type&&a.config.plotOptions.heatmap&&a.config.plotOptions.heatmap.colorScale.inverse),i&&a.globals.series.length&&(s=a.globals.series[a.globals.maxValsInArrayIndex].length*a.globals.series.length),t.lengtht.globals.svgWidth&&(this.dCtx.lgRect.width=t.globals.svgWidth/1.5),this.dCtx.lgRect}},{key:"getDatalabelsRect",value:function(){var t=this,e=this.w,i=[];e.config.series.forEach((function(s,r){s.data.forEach((function(s,n){var o;o=e.globals.series[r][n],a=e.config.dataLabels.formatter(o,{ctx:t.dCtx.ctx,seriesIndex:r,dataPointIndex:n,w:e}),i.push(a)}))}));var a=v.getLargestStringFromArr(i),s=new Mi(this.dCtx.ctx),r=e.config.dataLabels.style,n=s.getTextRects(a,parseInt(r.fontSize),r.fontFamily);return{width:1.05*n.width,height:n.height}}},{key:"getLargestStringFromMultiArr",value:function(t,e){var i=t;if(this.w.globals.isMultiLineX){var a=e.map((function(t,e){return Array.isArray(t)?t.length:1})),s=Math.max.apply(Math,f(a));i=e[a.indexOf(s)]}return i}}]),t}(),da=function(){function t(e){i(this,t),this.w=e.w,this.dCtx=e}return s(t,[{key:"getxAxisLabelsCoords",value:function(){var t,e=this.w,i=e.globals.labels.slice();if(e.config.xaxis.convertedCatToNumeric&&0===i.length&&(i=e.globals.categoryLabels),e.globals.timescaleLabels.length>0){var a=this.getxAxisTimeScaleLabelsCoords();t={width:a.width,height:a.height},e.globals.rotateXLabels=!1}else{this.dCtx.lgWidthForSideLegends="left"!==e.config.legend.position&&"right"!==e.config.legend.position||e.config.legend.floating?0:this.dCtx.lgRect.width;var s=e.globals.xLabelFormatter,r=v.getLargestStringFromArr(i),n=this.dCtx.dimHelpers.getLargestStringFromMultiArr(r,i);e.globals.isBarHorizontal&&(n=r=e.globals.yAxisScale[0].result.reduce((function(t,e){return t.length>e.length?t:e}),0));var o=new Xi(this.dCtx.ctx),l=r;r=o.xLabelFormat(s,r,l,{i:void 0,dateFormatter:new zi(this.dCtx.ctx).formatDate,w:e}),n=o.xLabelFormat(s,n,l,{i:void 0,dateFormatter:new zi(this.dCtx.ctx).formatDate,w:e}),(e.config.xaxis.convertedCatToNumeric&&void 0===r||""===String(r).trim())&&(n=r="1");var h=new Mi(this.dCtx.ctx),c=h.getTextRects(r,e.config.xaxis.labels.style.fontSize),d=c;if(r!==n&&(d=h.getTextRects(n,e.config.xaxis.labels.style.fontSize)),(t={width:c.width>=d.width?c.width:d.width,height:c.height>=d.height?c.height:d.height}).width*i.length>e.globals.svgWidth-this.dCtx.lgWidthForSideLegends-this.dCtx.yAxisWidth-this.dCtx.gridPad.left-this.dCtx.gridPad.right&&0!==e.config.xaxis.labels.rotate||e.config.xaxis.labels.rotateAlways){if(!e.globals.isBarHorizontal){e.globals.rotateXLabels=!0;var u=function(t){return h.getTextRects(t,e.config.xaxis.labels.style.fontSize,e.config.xaxis.labels.style.fontFamily,"rotate(".concat(e.config.xaxis.labels.rotate," 0 0)"),!1)};c=u(r),r!==n&&(d=u(n)),t.height=(c.height>d.height?c.height:d.height)/1.5,t.width=c.width>d.width?c.width:d.width}}else e.globals.rotateXLabels=!1}return e.config.xaxis.labels.show||(t={width:0,height:0}),{width:t.width,height:t.height}}},{key:"getxAxisGroupLabelsCoords",value:function(){var t,e=this.w;if(!e.globals.hasXaxisGroups)return{width:0,height:0};var i,a=(null===(t=e.config.xaxis.group.style)||void 0===t?void 0:t.fontSize)||e.config.xaxis.labels.style.fontSize,s=e.globals.groups.map((function(t){return t.title})),r=v.getLargestStringFromArr(s),n=this.dCtx.dimHelpers.getLargestStringFromMultiArr(r,s),o=new Mi(this.dCtx.ctx),l=o.getTextRects(r,a),h=l;return r!==n&&(h=o.getTextRects(n,a)),i={width:l.width>=h.width?l.width:h.width,height:l.height>=h.height?l.height:h.height},e.config.xaxis.labels.show||(i={width:0,height:0}),{width:i.width,height:i.height}}},{key:"getxAxisTitleCoords",value:function(){var t=this.w,e=0,i=0;if(void 0!==t.config.xaxis.title.text){var a=new Mi(this.dCtx.ctx).getTextRects(t.config.xaxis.title.text,t.config.xaxis.title.style.fontSize);e=a.width,i=a.height}return{width:e,height:i}}},{key:"getxAxisTimeScaleLabelsCoords",value:function(){var t,e=this.w;this.dCtx.timescaleLabels=e.globals.timescaleLabels.slice();var i=this.dCtx.timescaleLabels.map((function(t){return t.value})),a=i.reduce((function(t,e){return void 0===t?(console.error("You have possibly supplied invalid Date format. Please supply a valid JavaScript Date"),0):t.length>e.length?t:e}),0);return 1.05*(t=new Mi(this.dCtx.ctx).getTextRects(a,e.config.xaxis.labels.style.fontSize)).width*i.length>e.globals.gridWidth&&0!==e.config.xaxis.labels.rotate&&(e.globals.overlappingXLabels=!0),t}},{key:"additionalPaddingXLabels",value:function(t){var e=this,i=this.w,a=i.globals,s=i.config,r=s.xaxis.type,n=t.width;a.skipLastTimelinelabel=!1,a.skipFirstTimelinelabel=!1;var o=i.config.yaxis[0].opposite&&i.globals.isBarHorizontal,l=function(t,o){s.yaxis.length>1&&function(t){return-1!==a.collapsedSeriesIndices.indexOf(t)}(o)||function(t){if(e.dCtx.timescaleLabels&&e.dCtx.timescaleLabels.length){var o=e.dCtx.timescaleLabels[0],l=e.dCtx.timescaleLabels[e.dCtx.timescaleLabels.length-1].position+n/1.75-e.dCtx.yAxisWidthRight,h=o.position-n/1.75+e.dCtx.yAxisWidthLeft,c="right"===i.config.legend.position&&e.dCtx.lgRect.width>0?e.dCtx.lgRect.width:0;l>a.svgWidth-a.translateX-c&&(a.skipLastTimelinelabel=!0),h<-(t.show&&!t.floating||"bar"!==s.chart.type&&"candlestick"!==s.chart.type&&"rangeBar"!==s.chart.type&&"boxPlot"!==s.chart.type?10:n/1.75)&&(a.skipFirstTimelinelabel=!0)}else"datetime"===r?e.dCtx.gridPad.right(null===(a=String(c(e,o)))||void 0===a?void 0:a.length)?t:e}),d),g=u=c(u,o);if(void 0!==u&&0!==u.length||(u=l.niceMax),e.globals.isBarHorizontal){a=0;var p=e.globals.labels.slice();u=v.getLargestStringFromArr(p),u=c(u,{seriesIndex:n,dataPointIndex:-1,w:e}),g=t.dCtx.dimHelpers.getLargestStringFromMultiArr(u,p)}var f=new Mi(t.dCtx.ctx),x="rotate(".concat(r.labels.rotate," 0 0)"),b=f.getTextRects(u,r.labels.style.fontSize,r.labels.style.fontFamily,x,!1),m=b;u!==g&&(m=f.getTextRects(g,r.labels.style.fontSize,r.labels.style.fontFamily,x,!1)),i.push({width:(h>m.width||h>b.width?h:m.width>b.width?m.width:b.width)+a,height:m.height>b.height?m.height:b.height})}else i.push({width:0,height:0})})),i}},{key:"getyAxisTitleCoords",value:function(){var t=this,e=this.w,i=[];return e.config.yaxis.map((function(e,a){if(e.show&&void 0!==e.title.text){var s=new Mi(t.dCtx.ctx),r="rotate(".concat(e.title.rotate," 0 0)"),n=s.getTextRects(e.title.text,e.title.style.fontSize,e.title.style.fontFamily,r,!1);i.push({width:n.width,height:n.height})}else i.push({width:0,height:0})})),i}},{key:"getTotalYAxisWidth",value:function(){var t=this.w,e=0,i=0,a=0,s=t.globals.yAxisScale.length>1?10:0,r=new Ri(this.dCtx.ctx),n=function(n,o){var l=t.config.yaxis[o].floating,h=0;n.width>0&&!l?(h=n.width+s,function(e){return t.globals.ignoreYAxisIndexes.indexOf(e)>-1}(o)&&(h=h-n.width-s)):h=l||r.isYAxisHidden(o)?0:5,t.config.yaxis[o].opposite?a+=h:i+=h,e+=h};return t.globals.yLabelsCoords.map((function(t,e){n(t,e)})),t.globals.yTitleCoords.map((function(t,e){n(t,e)})),t.globals.isBarHorizontal&&!t.config.yaxis[0].floating&&(e=t.globals.yLabelsCoords[0].width+t.globals.yTitleCoords[0].width+15),this.dCtx.yAxisWidthLeft=i,this.dCtx.yAxisWidthRight=a,e}}]),t}(),ga=function(){function t(e){i(this,t),this.w=e.w,this.dCtx=e}return s(t,[{key:"gridPadForColumnsInNumericAxis",value:function(t){var e=this.w,i=e.config,a=e.globals;if(a.noData||a.collapsedSeries.length+a.ancillaryCollapsedSeries.length===i.series.length)return 0;var s=function(t){return["bar","rangeBar","candlestick","boxPlot"].includes(t)},r=i.chart.type,n=0,o=s(r)?i.series.length:1;a.comboBarCount>0&&(o=a.comboBarCount),a.collapsedSeries.forEach((function(t){s(t.type)&&(o-=1)})),i.chart.stacked&&(o=1);var l=s(r)||a.comboBarCount>0,h=Math.abs(a.initialMaxX-a.initialMinX);if(l&&a.isXNumeric&&!a.isBarHorizontal&&o>0&&0!==h){h<=3&&(h=a.dataPoints);var c=h/t,d=a.minXDiff&&a.minXDiff/c>0?a.minXDiff/c:0;d>t/2&&(d/=2),(n=d*parseInt(i.plotOptions.bar.columnWidth,10)/100)<1&&(n=1),a.barPadForNumericAxis=n}return n}},{key:"gridPadFortitleSubtitle",value:function(){var t=this,e=this.w,i=e.globals,a=this.dCtx.isSparkline||!i.axisCharts?0:10;["title","subtitle"].forEach((function(s){void 0!==e.config[s].text?a+=e.config[s].margin:a+=t.dCtx.isSparkline||!i.axisCharts?0:5})),!e.config.legend.show||"bottom"!==e.config.legend.position||e.config.legend.floating||i.axisCharts||(a+=10);var s=this.dCtx.dimHelpers.getTitleSubtitleCoords("title"),r=this.dCtx.dimHelpers.getTitleSubtitleCoords("subtitle");i.gridHeight-=s.height+r.height+a,i.translateY+=s.height+r.height+a}},{key:"setGridXPosForDualYAxis",value:function(t,e){var i=this.w,a=new Ri(this.dCtx.ctx);i.config.yaxis.forEach((function(s,r){-1!==i.globals.ignoreYAxisIndexes.indexOf(r)||s.floating||a.isYAxisHidden(r)||(s.opposite&&(i.globals.translateX-=e[r].width+t[r].width+parseInt(s.labels.style.fontSize,10)/1.2+12),i.globals.translateX<2&&(i.globals.translateX=2))}))}}]),t}(),pa=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.lgRect={},this.yAxisWidth=0,this.yAxisWidthLeft=0,this.yAxisWidthRight=0,this.xAxisHeight=0,this.isSparkline=this.w.config.chart.sparkline.enabled,this.dimHelpers=new ca(this),this.dimYAxis=new ua(this),this.dimXAxis=new da(this),this.dimGrid=new ga(this),this.lgWidthForSideLegends=0,this.gridPad=this.w.config.grid.padding,this.xPadRight=0,this.xPadLeft=0}return s(t,[{key:"plotCoords",value:function(){var t=this,e=this.w,i=e.globals;this.lgRect=this.dimHelpers.getLegendsRect(),this.datalabelsCoords={width:0,height:0};var a=Array.isArray(e.config.stroke.width)?Math.max.apply(Math,f(e.config.stroke.width)):e.config.stroke.width;this.isSparkline&&((e.config.markers.discrete.length>0||e.config.markers.size>0)&&Object.entries(this.gridPad).forEach((function(e){var i=p(e,2),a=i[0],s=i[1];t.gridPad[a]=Math.max(s,t.w.globals.markers.largestSize/1.5)})),this.gridPad.top=Math.max(a/2,this.gridPad.top),this.gridPad.bottom=Math.max(a/2,this.gridPad.bottom)),i.axisCharts?this.setDimensionsForAxisCharts():this.setDimensionsForNonAxisCharts(),this.dimGrid.gridPadFortitleSubtitle(),i.gridHeight=i.gridHeight-this.gridPad.top-this.gridPad.bottom,i.gridWidth=i.gridWidth-this.gridPad.left-this.gridPad.right-this.xPadRight-this.xPadLeft;var s=this.dimGrid.gridPadForColumnsInNumericAxis(i.gridWidth);i.gridWidth=i.gridWidth-2*s,i.translateX=i.translateX+this.gridPad.left+this.xPadLeft+(s>0?s:0),i.translateY=i.translateY+this.gridPad.top}},{key:"setDimensionsForAxisCharts",value:function(){var t=this,e=this.w,i=e.globals,a=this.dimYAxis.getyAxisLabelsCoords(),s=this.dimYAxis.getyAxisTitleCoords();i.isSlopeChart&&(this.datalabelsCoords=this.dimHelpers.getDatalabelsRect()),e.globals.yLabelsCoords=[],e.globals.yTitleCoords=[],e.config.yaxis.map((function(t,i){e.globals.yLabelsCoords.push({width:a[i].width,index:i}),e.globals.yTitleCoords.push({width:s[i].width,index:i})})),this.yAxisWidth=this.dimYAxis.getTotalYAxisWidth();var r=this.dimXAxis.getxAxisLabelsCoords(),n=this.dimXAxis.getxAxisGroupLabelsCoords(),o=this.dimXAxis.getxAxisTitleCoords();this.conditionalChecksForAxisCoords(r,o,n),i.translateXAxisY=e.globals.rotateXLabels?this.xAxisHeight/8:-4,i.translateXAxisX=e.globals.rotateXLabels&&e.globals.isXNumeric&&e.config.xaxis.labels.rotate<=-45?-this.xAxisWidth/4:0,e.globals.isBarHorizontal&&(i.rotateXLabels=!1,i.translateXAxisY=parseInt(e.config.xaxis.labels.style.fontSize,10)/1.5*-1),i.translateXAxisY=i.translateXAxisY+e.config.xaxis.labels.offsetY,i.translateXAxisX=i.translateXAxisX+e.config.xaxis.labels.offsetX;var l=this.yAxisWidth,h=this.xAxisHeight;i.xAxisLabelsHeight=this.xAxisHeight-o.height,i.xAxisGroupLabelsHeight=i.xAxisLabelsHeight-r.height,i.xAxisLabelsWidth=this.xAxisWidth,i.xAxisHeight=this.xAxisHeight;var c=10;("radar"===e.config.chart.type||this.isSparkline)&&(l=0,h=0),this.isSparkline&&(this.lgRect={height:0,width:0}),(this.isSparkline||"treemap"===e.config.chart.type)&&(l=0,h=0,c=0),this.isSparkline||"treemap"===e.config.chart.type||this.dimXAxis.additionalPaddingXLabels(r);var d=function(){i.translateX=l+t.datalabelsCoords.width,i.gridHeight=i.svgHeight-t.lgRect.height-h-(t.isSparkline||"treemap"===e.config.chart.type?0:e.globals.rotateXLabels?10:15),i.gridWidth=i.svgWidth-l-2*t.datalabelsCoords.width};switch("top"===e.config.xaxis.position&&(c=i.xAxisHeight-e.config.xaxis.axisTicks.height-5),e.config.legend.position){case"bottom":i.translateY=c,d();break;case"top":i.translateY=this.lgRect.height+c,d();break;case"left":i.translateY=c,i.translateX=this.lgRect.width+l+this.datalabelsCoords.width,i.gridHeight=i.svgHeight-h-12,i.gridWidth=i.svgWidth-this.lgRect.width-l-2*this.datalabelsCoords.width;break;case"right":i.translateY=c,i.translateX=l+this.datalabelsCoords.width,i.gridHeight=i.svgHeight-h-12,i.gridWidth=i.svgWidth-this.lgRect.width-l-2*this.datalabelsCoords.width-5;break;default:throw new Error("Legend position not supported")}this.dimGrid.setGridXPosForDualYAxis(s,a),new ia(this.ctx).setYAxisXPosition(a,s)}},{key:"setDimensionsForNonAxisCharts",value:function(){var t=this.w,e=t.globals,i=t.config,a=0;t.config.legend.show&&!t.config.legend.floating&&(a=20);var s="pie"===i.chart.type||"polarArea"===i.chart.type||"donut"===i.chart.type?"pie":"radialBar",r=i.plotOptions[s].offsetY,n=i.plotOptions[s].offsetX;if(!i.legend.show||i.legend.floating){e.gridHeight=e.svgHeight;var o=e.dom.elWrap.getBoundingClientRect().width;return e.gridWidth=Math.min(o,e.gridHeight),e.translateY=r,void(e.translateX=n+(e.svgWidth-e.gridWidth)/2)}switch(i.legend.position){case"bottom":e.gridHeight=e.svgHeight-this.lgRect.height,e.gridWidth=e.svgWidth,e.translateY=r-10,e.translateX=n+(e.svgWidth-e.gridWidth)/2;break;case"top":e.gridHeight=e.svgHeight-this.lgRect.height,e.gridWidth=e.svgWidth,e.translateY=this.lgRect.height+r+10,e.translateX=n+(e.svgWidth-e.gridWidth)/2;break;case"left":e.gridWidth=e.svgWidth-this.lgRect.width-a,e.gridHeight="auto"!==i.chart.height?e.svgHeight:e.gridWidth,e.translateY=r,e.translateX=n+this.lgRect.width+a;break;case"right":e.gridWidth=e.svgWidth-this.lgRect.width-a-5,e.gridHeight="auto"!==i.chart.height?e.svgHeight:e.gridWidth,e.translateY=r,e.translateX=n+10;break;default:throw new Error("Legend position not supported")}}},{key:"conditionalChecksForAxisCoords",value:function(t,e,i){var a=this.w,s=a.globals.hasXaxisGroups?2:1,r=i.height+t.height+e.height,n=a.globals.isMultiLineX?1.2:a.globals.LINE_HEIGHT_RATIO,o=a.globals.rotateXLabels?22:10,l=a.globals.rotateXLabels&&"bottom"===a.config.legend.position?10:0;this.xAxisHeight=r*n+s*o+l,this.xAxisWidth=t.width,this.xAxisHeight-e.height>a.config.xaxis.labels.maxHeight&&(this.xAxisHeight=a.config.xaxis.labels.maxHeight),a.config.xaxis.labels.minHeight&&this.xAxisHeightc&&(this.yAxisWidth=c)}}]),t}(),fa=function(){function t(e){i(this,t),this.w=e.w,this.lgCtx=e}return s(t,[{key:"getLegendStyles",value:function(){var t,e,i,a=document.createElement("style");a.setAttribute("type","text/css");var s=(null===(t=this.lgCtx.ctx)||void 0===t||null===(e=t.opts)||void 0===e||null===(i=e.chart)||void 0===i?void 0:i.nonce)||this.w.config.chart.nonce;s&&a.setAttribute("nonce",s);var r=document.createTextNode("\n .apexcharts-flip-y {\n transform: scaleY(-1) translateY(-100%);\n transform-origin: top;\n transform-box: fill-box;\n }\n .apexcharts-flip-x {\n transform: scaleX(-1);\n transform-origin: center;\n transform-box: fill-box;\n }\n .apexcharts-legend {\n display: flex;\n overflow: auto;\n padding: 0 10px;\n }\n .apexcharts-legend.apexcharts-legend-group-horizontal {\n flex-direction: column;\n }\n .apexcharts-legend-group {\n display: flex;\n }\n .apexcharts-legend-group-vertical {\n flex-direction: column-reverse;\n }\n .apexcharts-legend.apx-legend-position-bottom, .apexcharts-legend.apx-legend-position-top {\n flex-wrap: wrap\n }\n .apexcharts-legend.apx-legend-position-right, .apexcharts-legend.apx-legend-position-left {\n flex-direction: column;\n bottom: 0;\n }\n .apexcharts-legend.apx-legend-position-bottom.apexcharts-align-left, .apexcharts-legend.apx-legend-position-top.apexcharts-align-left, .apexcharts-legend.apx-legend-position-right, .apexcharts-legend.apx-legend-position-left {\n justify-content: flex-start;\n align-items: flex-start;\n }\n .apexcharts-legend.apx-legend-position-bottom.apexcharts-align-center, .apexcharts-legend.apx-legend-position-top.apexcharts-align-center {\n justify-content: center;\n align-items: center;\n }\n .apexcharts-legend.apx-legend-position-bottom.apexcharts-align-right, .apexcharts-legend.apx-legend-position-top.apexcharts-align-right {\n justify-content: flex-end;\n align-items: flex-end;\n }\n .apexcharts-legend-series {\n cursor: pointer;\n line-height: normal;\n display: flex;\n align-items: center;\n }\n .apexcharts-legend-text {\n position: relative;\n font-size: 14px;\n }\n .apexcharts-legend-text *, .apexcharts-legend-marker * {\n pointer-events: none;\n }\n .apexcharts-legend-marker {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n margin-right: 1px;\n }\n\n .apexcharts-legend-series.apexcharts-no-click {\n cursor: auto;\n }\n .apexcharts-legend .apexcharts-hidden-zero-series, .apexcharts-legend .apexcharts-hidden-null-series {\n display: none !important;\n }\n .apexcharts-inactive-legend {\n opacity: 0.45;\n }\n\n ");return a.appendChild(r),a}},{key:"getLegendDimensions",value:function(){var t=this.w.globals.dom.baseEl.querySelector(".apexcharts-legend").getBoundingClientRect(),e=t.width;return{clwh:t.height,clww:e}}},{key:"appendToForeignObject",value:function(){this.w.globals.dom.elLegendForeign.appendChild(this.getLegendStyles())}},{key:"toggleDataSeries",value:function(t,e){var i=this,a=this.w;if(a.globals.axisCharts||"radialBar"===a.config.chart.type){a.globals.resized=!0;var s=null,r=null;if(a.globals.risingSeries=[],a.globals.axisCharts?(s=a.globals.dom.baseEl.querySelector(".apexcharts-series[data\\:realIndex='".concat(t,"']")),r=parseInt(s.getAttribute("data:realIndex"),10)):(s=a.globals.dom.baseEl.querySelector(".apexcharts-series[rel='".concat(t+1,"']")),r=parseInt(s.getAttribute("rel"),10)-1),e)[{cs:a.globals.collapsedSeries,csi:a.globals.collapsedSeriesIndices},{cs:a.globals.ancillaryCollapsedSeries,csi:a.globals.ancillaryCollapsedSeriesIndices}].forEach((function(t){i.riseCollapsedSeries(t.cs,t.csi,r)}));else this.hideSeries({seriesEl:s,realIndex:r})}else{var n=a.globals.dom.Paper.findOne(" .apexcharts-series[rel='".concat(t+1,"'] path")),o=a.config.chart.type;if("pie"===o||"polarArea"===o||"donut"===o){var l=a.config.plotOptions.pie.donut.labels;new Mi(this.lgCtx.ctx).pathMouseDown(n,null),this.lgCtx.ctx.pie.printDataLabelsInner(n.node,l)}n.fire("click")}}},{key:"getSeriesAfterCollapsing",value:function(t){var e=t.realIndex,i=this.w,a=i.globals,s=v.clone(i.config.series);if(a.axisCharts){var r=i.config.yaxis[a.seriesYAxisReverseMap[e]],n={index:e,data:s[e].data.slice(),type:s[e].type||i.config.chart.type};if(r&&r.show&&r.showAlways)a.ancillaryCollapsedSeriesIndices.indexOf(e)<0&&(a.ancillaryCollapsedSeries.push(n),a.ancillaryCollapsedSeriesIndices.push(e));else if(a.collapsedSeriesIndices.indexOf(e)<0){a.collapsedSeries.push(n),a.collapsedSeriesIndices.push(e);var o=a.risingSeries.indexOf(e);a.risingSeries.splice(o,1)}}else a.collapsedSeries.push({index:e,data:s[e]}),a.collapsedSeriesIndices.push(e);return a.allSeriesCollapsed=a.collapsedSeries.length+a.ancillaryCollapsedSeries.length===i.config.series.length,this._getSeriesBasedOnCollapsedState(s)}},{key:"hideSeries",value:function(t){for(var e=t.seriesEl,i=t.realIndex,a=this.w,s=this.getSeriesAfterCollapsing({realIndex:i}),r=e.childNodes,n=0;n0){for(var r=0;r1;if(this.legendHelpers.appendToForeignObject(),(a||!e.axisCharts)&&i.legend.show){for(;e.dom.elLegendWrap.firstChild;)e.dom.elLegendWrap.removeChild(e.dom.elLegendWrap.firstChild);this.drawLegends(),"bottom"===i.legend.position||"top"===i.legend.position?this.legendAlignHorizontal():"right"!==i.legend.position&&"left"!==i.legend.position||this.legendAlignVertical()}}},{key:"createLegendMarker",value:function(t){var e=t.i,i=t.fillcolor,a=this.w,s=document.createElement("span");s.classList.add("apexcharts-legend-marker");var r=a.config.legend.markers.shape||a.config.markers.shape,n=r;Array.isArray(r)&&(n=r[e]);var o=Array.isArray(a.config.legend.markers.size)?parseFloat(a.config.legend.markers.size[e]):parseFloat(a.config.legend.markers.size),l=Array.isArray(a.config.legend.markers.offsetX)?parseFloat(a.config.legend.markers.offsetX[e]):parseFloat(a.config.legend.markers.offsetX),h=Array.isArray(a.config.legend.markers.offsetY)?parseFloat(a.config.legend.markers.offsetY[e]):parseFloat(a.config.legend.markers.offsetY),c=Array.isArray(a.config.legend.markers.strokeWidth)?parseFloat(a.config.legend.markers.strokeWidth[e]):parseFloat(a.config.legend.markers.strokeWidth),d=s.style;if(d.height=2*(o+c)+"px",d.width=2*(o+c)+"px",d.left=l+"px",d.top=h+"px",a.config.legend.markers.customHTML)d.background="transparent",d.color=i[e],Array.isArray(a.config.legend.markers.customHTML)?a.config.legend.markers.customHTML[e]&&(s.innerHTML=a.config.legend.markers.customHTML[e]()):s.innerHTML=a.config.legend.markers.customHTML();else{var g=new Vi(this.ctx).getMarkerConfig({cssClass:"apexcharts-legend-marker apexcharts-marker apexcharts-marker-".concat(n),seriesIndex:e,strokeWidth:c,size:o}),p=window.SVG().addTo(s).size("100%","100%"),f=new Mi(this.ctx).drawMarker(0,0,u(u({},g),{},{pointFillColor:Array.isArray(i)?i[e]:g.pointFillColor,shape:n}));a.globals.dom.Paper.find(".apexcharts-legend-marker.apexcharts-marker").forEach((function(t){t.node.classList.contains("apexcharts-marker-triangle")?t.node.style.transform="translate(50%, 45%)":t.node.style.transform="translate(50%, 50%)"})),p.add(f)}return s}},{key:"drawLegends",value:function(){var t=this,e=this,i=this.w,a=i.config.legend.fontFamily,s=i.globals.seriesNames,r=i.config.legend.markers.fillColors?i.config.legend.markers.fillColors.slice():i.globals.colors.slice();if("heatmap"===i.config.chart.type){var n=i.config.plotOptions.heatmap.colorScale.ranges;s=n.map((function(t){return t.name?t.name:t.from+" - "+t.to})),r=n.map((function(t){return t.color}))}else this.isBarsDistributed&&(s=i.globals.labels.slice());i.config.legend.customLegendItems.length&&(s=i.config.legend.customLegendItems);var o=i.globals.legendFormatter,l=i.config.legend.inverseOrder,h=[];i.globals.seriesGroups.length>1&&i.config.legend.clusterGroupedSeries&&i.globals.seriesGroups.forEach((function(t,e){h[e]=document.createElement("div"),h[e].classList.add("apexcharts-legend-group","apexcharts-legend-group-".concat(e)),"horizontal"===i.config.legend.clusterGroupedSeriesOrientation?i.globals.dom.elLegendWrap.classList.add("apexcharts-legend-group-horizontal"):h[e].classList.add("apexcharts-legend-group-vertical")}));for(var c=function(e){var n,l=o(s[e],{seriesIndex:e,w:i}),c=!1,d=!1;if(i.globals.collapsedSeries.length>0)for(var u=0;u0)for(var g=0;g=0:d<=s.length-1;l?d--:d++)c(d);i.globals.dom.elWrap.addEventListener("click",e.onLegendClick,!0),i.config.legend.onItemHover.highlightDataSeries&&0===i.config.legend.customLegendItems.length&&(i.globals.dom.elWrap.addEventListener("mousemove",e.onLegendHovered,!0),i.globals.dom.elWrap.addEventListener("mouseout",e.onLegendHovered,!0))}},{key:"setLegendWrapXY",value:function(t,e){var i=this.w,a=i.globals.dom.elLegendWrap,s=a.clientHeight,r=0,n=0;if("bottom"===i.config.legend.position)n=i.globals.svgHeight-Math.min(s,i.globals.svgHeight/2)-5;else if("top"===i.config.legend.position){var o=new pa(this.ctx),l=o.dimHelpers.getTitleSubtitleCoords("title").height,h=o.dimHelpers.getTitleSubtitleCoords("subtitle").height;n=(l>0?l-10:0)+(h>0?h-10:0)}a.style.position="absolute",r=r+t+i.config.legend.offsetX,n=n+e+i.config.legend.offsetY,a.style.left=r+"px",a.style.top=n+"px","right"===i.config.legend.position&&(a.style.left="auto",a.style.right=25+i.config.legend.offsetX+"px");["width","height"].forEach((function(t){a.style[t]&&(a.style[t]=parseInt(i.config.legend[t],10)+"px")}))}},{key:"legendAlignHorizontal",value:function(){var t=this.w;t.globals.dom.elLegendWrap.style.right=0;var e=new pa(this.ctx),i=e.dimHelpers.getTitleSubtitleCoords("title"),a=e.dimHelpers.getTitleSubtitleCoords("subtitle"),s=0;"top"===t.config.legend.position&&(s=i.height+a.height+t.config.title.margin+t.config.subtitle.margin-10),this.setLegendWrapXY(20,s)}},{key:"legendAlignVertical",value:function(){var t=this.w,e=this.legendHelpers.getLegendDimensions(),i=0;"left"===t.config.legend.position&&(i=20),"right"===t.config.legend.position&&(i=t.globals.svgWidth-e.clww-10),this.setLegendWrapXY(i,20)}},{key:"onLegendHovered",value:function(t){var e=this.w,i=t.target.classList.contains("apexcharts-legend-series")||t.target.classList.contains("apexcharts-legend-text")||t.target.classList.contains("apexcharts-legend-marker");if("heatmap"===e.config.chart.type||this.isBarsDistributed){if(i){var a=parseInt(t.target.getAttribute("rel"),10)-1;this.ctx.events.fireEvent("legendHover",[this.ctx,a,this.w]),new Zi(this.ctx).highlightRangeInSeries(t,t.target)}}else!t.target.classList.contains("apexcharts-inactive-legend")&&i&&new Zi(this.ctx).toggleSeriesOnHover(t,t.target)}},{key:"onLegendClick",value:function(t){var e=this.w;if(!e.config.legend.customLegendItems.length&&(t.target.classList.contains("apexcharts-legend-series")||t.target.classList.contains("apexcharts-legend-text")||t.target.classList.contains("apexcharts-legend-marker"))){var i=parseInt(t.target.getAttribute("rel"),10)-1,a="true"===t.target.getAttribute("data:collapsed"),s=this.w.config.chart.events.legendClick;"function"==typeof s&&s(this.ctx,i,this.w),this.ctx.events.fireEvent("legendClick",[this.ctx,i,this.w]);var r=this.w.config.legend.markers.onClick;"function"==typeof r&&t.target.classList.contains("apexcharts-legend-marker")&&(r(this.ctx,i,this.w),this.ctx.events.fireEvent("legendMarkerClick",[this.ctx,i,this.w])),"treemap"!==e.config.chart.type&&"heatmap"!==e.config.chart.type&&!this.isBarsDistributed&&e.config.legend.onItemClick.toggleDataSeries&&this.legendHelpers.toggleDataSeries(i,a)}}}]),t}(),ba=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w;var a=this.w;this.ev=this.w.config.chart.events,this.selectedClass="apexcharts-selected",this.localeValues=this.w.globals.locale.toolbar,this.minX=a.globals.minX,this.maxX=a.globals.maxX}return s(t,[{key:"createToolbar",value:function(){var t=this,e=this.w,i=function(){return document.createElement("div")},a=i();if(a.setAttribute("class","apexcharts-toolbar"),a.style.top=e.config.chart.toolbar.offsetY+"px",a.style.right=3-e.config.chart.toolbar.offsetX+"px",e.globals.dom.elWrap.appendChild(a),this.elZoom=i(),this.elZoomIn=i(),this.elZoomOut=i(),this.elPan=i(),this.elSelection=i(),this.elZoomReset=i(),this.elMenuIcon=i(),this.elMenu=i(),this.elCustomIcons=[],this.t=e.config.chart.toolbar.tools,Array.isArray(this.t.customIcons))for(var s=0;s\n \n \n\n'),n("zoomOut",this.elZoomOut,'\n \n \n\n');var o=function(i){t.t[i]&&e.config.chart[i].enabled&&r.push({el:"zoom"===i?t.elZoom:t.elSelection,icon:"string"==typeof t.t[i]?t.t[i]:"zoom"===i?'\n \n \n \n':'\n \n \n',title:t.localeValues["zoom"===i?"selectionZoom":"selection"],class:e.globals.isTouchDevice?"apexcharts-element-hidden":"apexcharts-".concat(i,"-icon")})};o("zoom"),o("selection"),this.t.pan&&e.config.chart.zoom.enabled&&r.push({el:this.elPan,icon:"string"==typeof this.t.pan?this.t.pan:'\n \n \n \n \n \n \n \n',title:this.localeValues.pan,class:e.globals.isTouchDevice?"apexcharts-element-hidden":"apexcharts-pan-icon"}),n("reset",this.elZoomReset,'\n \n \n'),this.t.download&&r.push({el:this.elMenuIcon,icon:"string"==typeof this.t.download?this.t.download:'',title:this.localeValues.menu,class:"apexcharts-menu-icon"});for(var l=0;lthis.wheelDelay&&(this.executeMouseWheelZoom(t),i.globals.lastWheelExecution=a),this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout((function(){a-i.globals.lastWheelExecution>e.wheelDelay&&(e.executeMouseWheelZoom(t),i.globals.lastWheelExecution=a)}),this.debounceDelay)}},{key:"executeMouseWheelZoom",value:function(t){var e,i=this.w;this.minX=i.globals.isRangeBar?i.globals.minY:i.globals.minX,this.maxX=i.globals.isRangeBar?i.globals.maxY:i.globals.maxX;var a=null===(e=this.gridRect)||void 0===e?void 0:e.getBoundingClientRect();if(a){var s,r,n,o=(t.clientX-a.left)/a.width,l=this.minX,h=this.maxX,c=h-l;if(t.deltaY<0){var d=l+o*c;r=d-(s=.5*c)/2,n=d+s/2}else r=l-(s=1.5*c)/2,n=h+s/2;if(!i.globals.isRangeBar){r=Math.max(r,i.globals.initialMinX),n=Math.min(n,i.globals.initialMaxX);var u=.01*(i.globals.initialMaxX-i.globals.initialMinX);if(n-r0&&i.height>0&&(this.selectionRect.select(!1).resize(!1),this.selectionRect.select({createRot:function(){},updateRot:function(){},createHandle:function(t,e,i,a,s){return"l"===s||"r"===s?t.circle(8).css({"stroke-width":1,stroke:"#333",fill:"#fff"}):t.circle(0)},updateHandle:function(t,e){return t.center(e[0],e[1])}}).resize().on("resize",(function(){var i=e.globals.zoomEnabled?e.config.chart.zoom.type:e.config.chart.selection.type;t.handleMouseUp({zoomtype:i,isResized:!0})})))}}},{key:"preselectedSelection",value:function(){var t=this.w,e=this.xyRatios;if(!t.globals.zoomEnabled)if(void 0!==t.globals.selection&&null!==t.globals.selection)this.drawSelectionRect(u(u({},t.globals.selection),{},{translateX:t.globals.translateX,translateY:t.globals.translateY}));else if(void 0!==t.config.chart.selection.xaxis.min&&void 0!==t.config.chart.selection.xaxis.max){var i=(t.config.chart.selection.xaxis.min-t.globals.minX)/e.xRatio,a=t.globals.gridWidth-(t.globals.maxX-t.config.chart.selection.xaxis.max)/e.xRatio-i;t.globals.isRangeBar&&(i=(t.config.chart.selection.xaxis.min-t.globals.yAxisScale[0].niceMin)/e.invertedYRatio,a=(t.config.chart.selection.xaxis.max-t.config.chart.selection.xaxis.min)/e.invertedYRatio);var s={x:i,y:0,width:a,height:t.globals.gridHeight,translateX:t.globals.translateX,translateY:t.globals.translateY,selectionEnabled:!0};this.drawSelectionRect(s),this.makeSelectionRectDraggable(),"function"==typeof t.config.chart.events.selection&&t.config.chart.events.selection(this.ctx,{xaxis:{min:t.config.chart.selection.xaxis.min,max:t.config.chart.selection.xaxis.max},yaxis:{}})}}},{key:"drawSelectionRect",value:function(t){var e=t.x,i=t.y,a=t.width,s=t.height,r=t.translateX,n=void 0===r?0:r,o=t.translateY,l=void 0===o?0:o,h=this.w,c=this.zoomRect,d=this.selectionRect;if(this.dragged||null!==h.globals.selection){var u={transform:"translate("+n+", "+l+")"};h.globals.zoomEnabled&&this.dragged&&(a<0&&(a=1),c.attr({x:e,y:i,width:a,height:s,fill:h.config.chart.zoom.zoomedArea.fill.color,"fill-opacity":h.config.chart.zoom.zoomedArea.fill.opacity,stroke:h.config.chart.zoom.zoomedArea.stroke.color,"stroke-width":h.config.chart.zoom.zoomedArea.stroke.width,"stroke-opacity":h.config.chart.zoom.zoomedArea.stroke.opacity}),Mi.setAttrs(c.node,u)),h.globals.selectionEnabled&&(d.attr({x:e,y:i,width:a>0?a:0,height:s>0?s:0,fill:h.config.chart.selection.fill.color,"fill-opacity":h.config.chart.selection.fill.opacity,stroke:h.config.chart.selection.stroke.color,"stroke-width":h.config.chart.selection.stroke.width,"stroke-dasharray":h.config.chart.selection.stroke.dashArray,"stroke-opacity":h.config.chart.selection.stroke.opacity}),Mi.setAttrs(d.node,u))}}},{key:"hideSelectionRect",value:function(t){t&&t.attr({x:0,y:0,width:0,height:0})}},{key:"selectionDrawing",value:function(t){var e=t.context,i=t.zoomtype,a=this.w,s=e,r=this.gridRect.getBoundingClientRect(),n=s.startX-1,o=s.startY,l=!1,h=!1,c=s.clientX-r.left-a.globals.barPadForNumericAxis,d=s.clientY-r.top,g=c-n,p=d-o,f={translateX:a.globals.translateX,translateY:a.globals.translateY};return Math.abs(g+n)>a.globals.gridWidth?g=a.globals.gridWidth-n:c<0&&(g=n),n>c&&(l=!0,g=Math.abs(g)),o>d&&(h=!0,p=Math.abs(p)),f=u(u({},f="x"===i?{x:l?n-g:n,y:0,width:g,height:a.globals.gridHeight}:"y"===i?{x:0,y:h?o-p:o,width:a.globals.gridWidth,height:p}:{x:l?n-g:n,y:h?o-p:o,width:g,height:p}),{},{translateX:a.globals.translateX,translateY:a.globals.translateY}),s.drawSelectionRect(f),s.selectionDragging("resizing"),f}},{key:"selectionDragging",value:function(t,e){var i=this,a=this.w;if(e){e.preventDefault();var s=e.detail,r=s.handler,n=s.box,o=n.x,l=n.y;othis.constraints.x2&&(o=this.constraints.x2-n.w),n.y2>this.constraints.y2&&(l=this.constraints.y2-n.h),r.move(o,l);var h=this.xyRatios,c=this.selectionRect,d=0;"resizing"===t&&(d=30);var u=function(t){return parseFloat(c.node.getAttribute(t))},g={x:u("x"),y:u("y"),width:u("width"),height:u("height")};a.globals.selection=g,"function"==typeof a.config.chart.events.selection&&a.globals.selectionEnabled&&(clearTimeout(this.w.globals.selectionResizeTimer),this.w.globals.selectionResizeTimer=window.setTimeout((function(){var t,e,s,r,n=i.gridRect.getBoundingClientRect(),o=c.node.getBoundingClientRect();a.globals.isRangeBar?(t=a.globals.yAxisScale[0].niceMin+(o.left-n.left)*h.invertedYRatio,e=a.globals.yAxisScale[0].niceMin+(o.right-n.left)*h.invertedYRatio,s=0,r=1):(t=a.globals.xAxisScale.niceMin+(o.left-n.left)*h.xRatio,e=a.globals.xAxisScale.niceMin+(o.right-n.left)*h.xRatio,s=a.globals.yAxisScale[0].niceMin+(n.bottom-o.bottom)*h.yRatio[0],r=a.globals.yAxisScale[0].niceMax-(o.top-n.top)*h.yRatio[0]);var l={xaxis:{min:t,max:e},yaxis:{min:s,max:r}};a.config.chart.events.selection(i.ctx,l),a.config.chart.brush.enabled&&void 0!==a.config.chart.events.brushScrolled&&a.config.chart.events.brushScrolled(i.ctx,l)}),d))}}},{key:"selectionDrawn",value:function(t){var e,i,a=t.context,s=t.zoomtype,r=this.w,n=a,o=this.xyRatios,l=this.ctx.toolbar,h=r.globals.zoomEnabled?n.zoomRect.node.getBoundingClientRect():n.selectionRect.node.getBoundingClientRect(),c=n.gridRect.getBoundingClientRect(),d=h.left-c.left-r.globals.barPadForNumericAxis,u=h.right-c.left-r.globals.barPadForNumericAxis,g=h.top-c.top,p=h.bottom-c.top;r.globals.isRangeBar?(e=r.globals.yAxisScale[0].niceMin+d*o.invertedYRatio,i=r.globals.yAxisScale[0].niceMin+u*o.invertedYRatio):(e=r.globals.xAxisScale.niceMin+d*o.xRatio,i=r.globals.xAxisScale.niceMin+u*o.xRatio);var f=[],x=[];if(r.config.yaxis.forEach((function(t,e){var i=r.globals.seriesYAxisMap[e][0],a=r.globals.yAxisScale[e].niceMax-o.yRatio[i]*g,s=r.globals.yAxisScale[e].niceMax-o.yRatio[i]*p;f.push(a),x.push(s)})),n.dragged&&(n.dragX>10||n.dragY>10)&&e!==i)if(r.globals.zoomEnabled){var b=v.clone(r.globals.initialConfig.yaxis),m=v.clone(r.globals.initialConfig.xaxis);if(r.globals.zoomed=!0,r.config.xaxis.convertedCatToNumeric&&(e=Math.floor(e),i=Math.floor(i),e<1&&(e=1,i=r.globals.dataPoints),i-e<2&&(i=e+1)),"xy"!==s&&"x"!==s||(m={min:e,max:i}),"xy"!==s&&"y"!==s||b.forEach((function(t,e){b[e].min=x[e],b[e].max=f[e]})),l){var y=l.getBeforeZoomRange(m,b);y&&(m=y.xaxis?y.xaxis:m,b=y.yaxis?y.yaxis:b)}var w={xaxis:m};r.config.chart.group||(w.yaxis=b),n.ctx.updateHelpers._updateOptions(w,!1,n.w.config.chart.animations.dynamicAnimation.enabled),"function"==typeof r.config.chart.events.zoomed&&l.zoomCallback(m,b)}else if(r.globals.selectionEnabled){var k,A=null;k={min:e,max:i},"xy"!==s&&"y"!==s||(A=v.clone(r.config.yaxis)).forEach((function(t,e){A[e].min=x[e],A[e].max=f[e]})),r.globals.selection=n.selection,"function"==typeof r.config.chart.events.selection&&r.config.chart.events.selection(n.ctx,{xaxis:k,yaxis:A})}}},{key:"panDragging",value:function(t){var e=t.context,i=this.w,a=e;if(void 0!==i.globals.lastClientPosition.x){var s=i.globals.lastClientPosition.x-a.clientX,r=i.globals.lastClientPosition.y-a.clientY;Math.abs(s)>Math.abs(r)&&s>0?this.moveDirection="left":Math.abs(s)>Math.abs(r)&&s<0?this.moveDirection="right":Math.abs(r)>Math.abs(s)&&r>0?this.moveDirection="up":Math.abs(r)>Math.abs(s)&&r<0&&(this.moveDirection="down")}i.globals.lastClientPosition={x:a.clientX,y:a.clientY};var n=i.globals.isRangeBar?i.globals.minY:i.globals.minX,o=i.globals.isRangeBar?i.globals.maxY:i.globals.maxX;i.config.xaxis.convertedCatToNumeric||a.panScrolled(n,o)}},{key:"delayedPanScrolled",value:function(){var t=this.w,e=t.globals.minX,i=t.globals.maxX,a=(t.globals.maxX-t.globals.minX)/2;"left"===this.moveDirection?(e=t.globals.minX+a,i=t.globals.maxX+a):"right"===this.moveDirection&&(e=t.globals.minX-a,i=t.globals.maxX-a),e=Math.floor(e),i=Math.floor(i),this.updateScrolledChart({xaxis:{min:e,max:i}},e,i)}},{key:"panScrolled",value:function(t,e){var i=this.w,a=this.xyRatios,s=v.clone(i.globals.initialConfig.yaxis),r=a.xRatio,n=i.globals.minX,o=i.globals.maxX;i.globals.isRangeBar&&(r=a.invertedYRatio,n=i.globals.minY,o=i.globals.maxY),"left"===this.moveDirection?(t=n+i.globals.gridWidth/15*r,e=o+i.globals.gridWidth/15*r):"right"===this.moveDirection&&(t=n-i.globals.gridWidth/15*r,e=o-i.globals.gridWidth/15*r),i.globals.isRangeBar||(ti.globals.initialMaxX)&&(t=n,e=o);var l={xaxis:{min:t,max:e}};i.config.chart.group||(l.yaxis=s),this.updateScrolledChart(l,t,e)}},{key:"updateScrolledChart",value:function(t,e,i){var a=this.w;this.ctx.updateHelpers._updateOptions(t,!1,!1),"function"==typeof a.config.chart.events.scrolled&&a.config.chart.events.scrolled(this.ctx,{xaxis:{min:e,max:i}})}}]),a}(),va=function(){function t(e){i(this,t),this.w=e.w,this.ttCtx=e,this.ctx=e.ctx}return s(t,[{key:"getNearestValues",value:function(t){var e=t.hoverArea,i=t.elGrid,a=t.clientX,s=t.clientY,r=this.w,n=i.getBoundingClientRect(),o=n.width,l=n.height,h=o/(r.globals.dataPoints-1),c=l/r.globals.dataPoints,d=this.hasBars();!r.globals.comboCharts&&!d||r.config.xaxis.convertedCatToNumeric||(h=o/r.globals.dataPoints);var u=a-n.left-r.globals.barPadForNumericAxis,g=s-n.top;u<0||g<0||u>o||g>l?(e.classList.remove("hovering-zoom"),e.classList.remove("hovering-pan")):r.globals.zoomEnabled?(e.classList.remove("hovering-pan"),e.classList.add("hovering-zoom")):r.globals.panEnabled&&(e.classList.remove("hovering-zoom"),e.classList.add("hovering-pan"));var p=Math.round(u/h),f=Math.floor(g/c);d&&!r.config.xaxis.convertedCatToNumeric&&(p=Math.ceil(u/h),p-=1);var x=null,b=null,m=r.globals.seriesXvalues.map((function(t){return t.filter((function(t){return v.isNumber(t)}))})),y=r.globals.seriesYvalues.map((function(t){return t.filter((function(t){return v.isNumber(t)}))}));if(r.globals.isXNumeric){var w=this.ttCtx.getElGrid().getBoundingClientRect(),k=u*(w.width/o),A=g*(w.height/l);x=(b=this.closestInMultiArray(k,A,m,y)).index,p=b.j,null!==x&&r.globals.hasNullValues&&(m=r.globals.seriesXvalues[x],p=(b=this.closestInArray(k,m)).j)}return r.globals.capturedSeriesIndex=null===x?-1:x,(!p||p<1)&&(p=0),r.globals.isBarHorizontal?r.globals.capturedDataPointIndex=f:r.globals.capturedDataPointIndex=p,{capturedSeries:x,j:r.globals.isBarHorizontal?f:p,hoverX:u,hoverY:g}}},{key:"getFirstActiveXArray",value:function(t){for(var e=this.w,i=0,a=t.map((function(t,e){return t.length>0?e:-1})),s=0;s0)for(var a=0;a *")):this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-series-markers-wrap > *")}},{key:"getAllMarkers",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-series-markers-wrap");i=f(i),e&&(i=i.filter((function(e){var i=Number(e.getAttribute("data:realIndex"));return-1===t.w.globals.collapsedSeriesIndices.indexOf(i)}))),i.sort((function(t,e){var i=Number(t.getAttribute("data:realIndex")),a=Number(e.getAttribute("data:realIndex"));return ai?-1:0}));var a=[];return i.forEach((function(t){a.push(t.querySelector(".apexcharts-marker"))})),a}},{key:"hasMarkers",value:function(t){return this.getElMarkers(t).length>0}},{key:"getPathFromPoint",value:function(t,e){var i=Number(t.getAttribute("cx")),a=Number(t.getAttribute("cy")),s=t.getAttribute("shape");return new Mi(this.ctx).getMarkerPath(i,a,s,e)}},{key:"getElBars",value:function(){return this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-bar-series, .apexcharts-candlestick-series, .apexcharts-boxPlot-series, .apexcharts-rangebar-series")}},{key:"hasBars",value:function(){return this.getElBars().length>0}},{key:"getHoverMarkerSize",value:function(t){var e=this.w,i=e.config.markers.hover.size;return void 0===i&&(i=e.globals.markers.size[t]+e.config.markers.hover.sizeOffset),i}},{key:"toggleAllTooltipSeriesGroups",value:function(t){var e=this.w,i=this.ttCtx;0===i.allTooltipSeriesGroups.length&&(i.allTooltipSeriesGroups=e.globals.dom.baseEl.querySelectorAll(".apexcharts-tooltip-series-group"));for(var a=i.allTooltipSeriesGroups,s=0;s ').concat(i.attrs.name,""),e+="
".concat(i.val,"
")})),m.innerHTML=t+"",v.innerHTML=e+""};n?l.globals.seriesGoals[e][i]&&Array.isArray(l.globals.seriesGoals[e][i])?y():(m.innerHTML="",v.innerHTML=""):y()}else m.innerHTML="",v.innerHTML="";null!==p&&(a[e].querySelector(".apexcharts-tooltip-text-z-label").innerHTML=l.config.tooltip.z.title,a[e].querySelector(".apexcharts-tooltip-text-z-value").innerHTML=void 0!==p?p:"");if(n&&f[0]){if(l.config.tooltip.hideEmptySeries){var w=a[e].querySelector(".apexcharts-tooltip-marker"),k=a[e].querySelector(".apexcharts-tooltip-text");0==parseFloat(c)?(w.style.display="none",k.style.display="none"):(w.style.display="block",k.style.display="block")}null==c||l.globals.ancillaryCollapsedSeriesIndices.indexOf(e)>-1||l.globals.collapsedSeriesIndices.indexOf(e)>-1||Array.isArray(h.tConfig.enabledOnSeries)&&-1===h.tConfig.enabledOnSeries.indexOf(e)?f[0].parentNode.style.display="none":f[0].parentNode.style.display=l.config.tooltip.items.display}else Array.isArray(h.tConfig.enabledOnSeries)&&-1===h.tConfig.enabledOnSeries.indexOf(e)&&(f[0].parentNode.style.display="none")}},{key:"toggleActiveInactiveSeries",value:function(t,e){var i=this.w;if(t)this.tooltipUtil.toggleAllTooltipSeriesGroups("enable");else{this.tooltipUtil.toggleAllTooltipSeriesGroups("disable");var a=i.globals.dom.baseEl.querySelector(".apexcharts-tooltip-series-group-".concat(e));a&&(a.classList.add("apexcharts-active"),a.style.display=i.config.tooltip.items.display)}}},{key:"getValuesToPrint",value:function(t){var e=t.i,i=t.j,a=this.w,s=this.ctx.series.filteredSeriesX(),r="",n="",o=null,l=null,h={series:a.globals.series,seriesIndex:e,dataPointIndex:i,w:a},c=a.globals.ttZFormatter;null===i?l=a.globals.series[e]:a.globals.isXNumeric&&"treemap"!==a.config.chart.type?(r=s[e][i],0===s[e].length&&(r=s[this.tooltipUtil.getFirstActiveXArray(s)][i])):r=new $i(this.ctx).isFormatXY()?void 0!==a.config.series[e].data[i]?a.config.series[e].data[i].x:"":void 0!==a.globals.labels[i]?a.globals.labels[i]:"";var d=r;a.globals.isXNumeric&&"datetime"===a.config.xaxis.type?r=new Xi(this.ctx).xLabelFormat(a.globals.ttKeyFormatter,d,d,{i:void 0,dateFormatter:new zi(this.ctx).formatDate,w:this.w}):r=a.globals.isBarHorizontal?a.globals.yLabelFormatters[0](d,h):a.globals.xLabelFormatter(d,h);return void 0!==a.config.tooltip.x.formatter&&(r=a.globals.ttKeyFormatter(d,h)),a.globals.seriesZ.length>0&&a.globals.seriesZ[e].length>0&&(o=c(a.globals.seriesZ[e][i],a)),n="function"==typeof a.config.xaxis.tooltip.formatter?a.globals.xaxisTooltipFormatter(d,h):r,{val:Array.isArray(l)?l.join(" "):l,xVal:Array.isArray(r)?r.join(" "):r,xAxisTTVal:Array.isArray(n)?n.join(" "):n,zVal:o}}},{key:"handleCustomTooltip",value:function(t){var e=t.i,i=t.j,a=t.y1,s=t.y2,r=t.w,n=this.ttCtx.getElTooltip(),o=r.config.tooltip.custom;Array.isArray(o)&&o[e]&&(o=o[e]);var l=o({ctx:this.ctx,series:r.globals.series,seriesIndex:e,dataPointIndex:i,y1:a,y2:s,w:r});"string"==typeof l?n.innerHTML=l:(l instanceof Element||"string"==typeof l.nodeName)&&(n.innerHTML="",n.appendChild(l.cloneNode(!0)))}}]),t}(),wa=function(){function t(e){i(this,t),this.ttCtx=e,this.ctx=e.ctx,this.w=e.w}return s(t,[{key:"moveXCrosshairs",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=this.ttCtx,a=this.w,s=i.getElXCrosshairs(),r=t-i.xcrosshairsWidth/2,n=a.globals.labels.slice().length;if(null!==e&&(r=a.globals.gridWidth/n*e),null===s||a.globals.isBarHorizontal||(s.setAttribute("x",r),s.setAttribute("x1",r),s.setAttribute("x2",r),s.setAttribute("y2",a.globals.gridHeight),s.classList.add("apexcharts-active")),r<0&&(r=0),r>a.globals.gridWidth&&(r=a.globals.gridWidth),i.isXAxisTooltipEnabled){var o=r;"tickWidth"!==a.config.xaxis.crosshairs.width&&"barWidth"!==a.config.xaxis.crosshairs.width||(o=r+i.xcrosshairsWidth/2),this.moveXAxisTooltip(o)}}},{key:"moveYCrosshairs",value:function(t){var e=this.ttCtx;null!==e.ycrosshairs&&Mi.setAttrs(e.ycrosshairs,{y1:t,y2:t}),null!==e.ycrosshairsHidden&&Mi.setAttrs(e.ycrosshairsHidden,{y1:t,y2:t})}},{key:"moveXAxisTooltip",value:function(t){var e=this.w,i=this.ttCtx;if(null!==i.xaxisTooltip&&0!==i.xcrosshairsWidth){i.xaxisTooltip.classList.add("apexcharts-active");var a=i.xaxisOffY+e.config.xaxis.tooltip.offsetY+e.globals.translateY+1+e.config.xaxis.offsetY;if(t-=i.xaxisTooltip.getBoundingClientRect().width/2,!isNaN(t)){t+=e.globals.translateX;var s;s=new Mi(this.ctx).getTextRects(i.xaxisTooltipText.innerHTML),i.xaxisTooltipText.style.minWidth=s.width+"px",i.xaxisTooltip.style.left=t+"px",i.xaxisTooltip.style.top=a+"px"}}}},{key:"moveYAxisTooltip",value:function(t){var e=this.w,i=this.ttCtx;null===i.yaxisTTEls&&(i.yaxisTTEls=e.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxistooltip"));var a=parseInt(i.ycrosshairsHidden.getAttribute("y1"),10),s=e.globals.translateY+a,r=i.yaxisTTEls[t].getBoundingClientRect().height,n=e.globals.translateYAxisX[t]-2;e.config.yaxis[t].opposite&&(n-=26),s-=r/2,-1===e.globals.ignoreYAxisIndexes.indexOf(t)?(i.yaxisTTEls[t].classList.add("apexcharts-active"),i.yaxisTTEls[t].style.top=s+"px",i.yaxisTTEls[t].style.left=n+e.config.yaxis[t].tooltip.offsetX+"px"):i.yaxisTTEls[t].classList.remove("apexcharts-active")}},{key:"moveTooltip",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=this.w,s=this.ttCtx,r=s.getElTooltip(),n=s.tooltipRect,o=null!==i?parseFloat(i):1,l=parseFloat(t)+o+5,h=parseFloat(e)+o/2;if(l>a.globals.gridWidth/2&&(l=l-n.ttWidth-o-10),l>a.globals.gridWidth-n.ttWidth-10&&(l=a.globals.gridWidth-n.ttWidth),l<-20&&(l=-20),a.config.tooltip.followCursor){var c=s.getElGrid().getBoundingClientRect();(l=s.e.clientX-c.left)>a.globals.gridWidth/2&&(l-=s.tooltipRect.ttWidth),(h=s.e.clientY+a.globals.translateY-c.top)>a.globals.gridHeight/2&&(h-=s.tooltipRect.ttHeight)}else a.globals.isBarHorizontal||n.ttHeight/2+h>a.globals.gridHeight&&(h=a.globals.gridHeight-n.ttHeight+a.globals.translateY);isNaN(l)||(l+=a.globals.translateX,r.style.left=l+"px",r.style.top=h+"px")}},{key:"moveMarkers",value:function(t,e){var i=this.w,a=this.ttCtx;if(i.globals.markers.size[t]>0)for(var s=i.globals.dom.baseEl.querySelectorAll(" .apexcharts-series[data\\:realIndex='".concat(t,"'] .apexcharts-marker")),r=0;r0){var g=u.getAttribute("shape"),p=l.getMarkerPath(s,r,g,1.5*c);u.setAttribute("d",p)}this.moveXCrosshairs(s),o.fixedTooltip||this.moveTooltip(s,r,c)}}},{key:"moveDynamicPointsOnHover",value:function(t){var e,i=this.ttCtx,a=i.w,s=0,r=0,n=a.globals.pointsArray,o=new Zi(this.ctx),l=new Mi(this.ctx);e=o.getActiveConfigSeriesIndex("asc",["line","area","scatter","bubble"]);var h=i.tooltipUtil.getHoverMarkerSize(e);if(n[e]&&(s=n[e][t][0],r=n[e][t][1]),!isNaN(s)){var c=i.tooltipUtil.getAllMarkers();if(c.length)for(var d=0;d0){var b=l.getMarkerPath(s,g,f,h);c[d].setAttribute("d",b)}else c[d].setAttribute("d","")}}this.moveXCrosshairs(s),i.fixedTooltip||this.moveTooltip(s,r||a.globals.gridHeight,h)}}},{key:"moveStickyTooltipOverBars",value:function(t,e){var i=this.w,a=this.ttCtx,s=i.globals.columnSeries?i.globals.columnSeries.length:i.globals.series.length;i.config.chart.stacked&&(s=i.globals.barGroups.length);var r=s>=2&&s%2==0?Math.floor(s/2):Math.floor(s/2)+1;i.globals.isBarHorizontal&&(r=new Zi(this.ctx).getActiveConfigSeriesIndex("desc")+1);var n=i.globals.dom.baseEl.querySelector(".apexcharts-bar-series .apexcharts-series[rel='".concat(r,"'] path[j='").concat(t,"'], .apexcharts-candlestick-series .apexcharts-series[rel='").concat(r,"'] path[j='").concat(t,"'], .apexcharts-boxPlot-series .apexcharts-series[rel='").concat(r,"'] path[j='").concat(t,"'], .apexcharts-rangebar-series .apexcharts-series[rel='").concat(r,"'] path[j='").concat(t,"']"));n||"number"!=typeof e||(n=i.globals.dom.baseEl.querySelector(".apexcharts-bar-series .apexcharts-series[data\\:realIndex='".concat(e,"'] path[j='").concat(t,"'],\n .apexcharts-candlestick-series .apexcharts-series[data\\:realIndex='").concat(e,"'] path[j='").concat(t,"'],\n .apexcharts-boxPlot-series .apexcharts-series[data\\:realIndex='").concat(e,"'] path[j='").concat(t,"'],\n .apexcharts-rangebar-series .apexcharts-series[data\\:realIndex='").concat(e,"'] path[j='").concat(t,"']")));var o=n?parseFloat(n.getAttribute("cx")):0,l=n?parseFloat(n.getAttribute("cy")):0,h=n?parseFloat(n.getAttribute("barWidth")):0,c=a.getElGrid().getBoundingClientRect(),d=n&&(n.classList.contains("apexcharts-candlestick-area")||n.classList.contains("apexcharts-boxPlot-area"));i.globals.isXNumeric?(n&&!d&&(o-=s%2!=0?h/2:0),n&&d&&(o-=h/2)):i.globals.isBarHorizontal||(o=a.xAxisTicksPositions[t-1]+a.dataPointsDividedWidth/2,isNaN(o)&&(o=a.xAxisTicksPositions[t]-a.dataPointsDividedWidth/2)),i.globals.isBarHorizontal?l-=a.tooltipRect.ttHeight:i.config.tooltip.followCursor?l=a.e.clientY-c.top-a.tooltipRect.ttHeight/2:l+a.tooltipRect.ttHeight+15>i.globals.gridHeight&&(l=i.globals.gridHeight),i.globals.isBarHorizontal||this.moveXCrosshairs(o),a.fixedTooltip||this.moveTooltip(o,l||i.globals.gridHeight)}}]),t}(),ka=function(){function t(e){i(this,t),this.w=e.w,this.ttCtx=e,this.ctx=e.ctx,this.tooltipPosition=new wa(e)}return s(t,[{key:"drawDynamicPoints",value:function(){var t=this.w,e=new Mi(this.ctx),i=new Vi(this.ctx),a=t.globals.dom.baseEl.querySelectorAll(".apexcharts-series");a=f(a),t.config.chart.stacked&&a.sort((function(t,e){return parseFloat(t.getAttribute("data:realIndex"))-parseFloat(e.getAttribute("data:realIndex"))}));for(var s=0;s2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,s=this.w;"bubble"!==s.config.chart.type&&this.newPointSize(t,e);var r=e.getAttribute("cx"),n=e.getAttribute("cy");if(null!==i&&null!==a&&(r=i,n=a),this.tooltipPosition.moveXCrosshairs(r),!this.fixedTooltip){if("radar"===s.config.chart.type){var o=this.ttCtx.getElGrid().getBoundingClientRect();r=this.ttCtx.e.clientX-o.left}this.tooltipPosition.moveTooltip(r,n,s.config.markers.hover.size)}}},{key:"enlargePoints",value:function(t){for(var e=this.w,i=this,a=this.ttCtx,s=t,r=e.globals.dom.baseEl.querySelectorAll(".apexcharts-series:not(.apexcharts-series-collapsed) .apexcharts-marker"),n=e.config.markers.hover.size,o=0;o0){var a=this.ttCtx.tooltipUtil.getPathFromPoint(t[e],i);t[e].setAttribute("d",a)}else t[e].setAttribute("d","M0,0")}}}]),t}(),Aa=function(){function t(e){i(this,t),this.w=e.w;var a=this.w;this.ttCtx=e,this.isVerticalGroupedRangeBar=!a.globals.isBarHorizontal&&"rangeBar"===a.config.chart.type&&a.config.plotOptions.bar.rangeBarGroupRows}return s(t,[{key:"getAttr",value:function(t,e){return parseFloat(t.target.getAttribute(e))}},{key:"handleHeatTreeTooltip",value:function(t){var e=t.e,i=t.opt,a=t.x,s=t.y,r=t.type,n=this.ttCtx,o=this.w;if(e.target.classList.contains("apexcharts-".concat(r,"-rect"))){var l=this.getAttr(e,"i"),h=this.getAttr(e,"j"),c=this.getAttr(e,"cx"),d=this.getAttr(e,"cy"),u=this.getAttr(e,"width"),g=this.getAttr(e,"height");if(n.tooltipLabels.drawSeriesTexts({ttItems:i.ttItems,i:l,j:h,shared:!1,e:e}),o.globals.capturedSeriesIndex=l,o.globals.capturedDataPointIndex=h,a=c+n.tooltipRect.ttWidth/2+u,s=d+n.tooltipRect.ttHeight/2-g/2,n.tooltipPosition.moveXCrosshairs(c+u/2),a>o.globals.gridWidth/2&&(a=c-n.tooltipRect.ttWidth/2+u),n.w.config.tooltip.followCursor){var p=o.globals.dom.elWrap.getBoundingClientRect();a=o.globals.clientX-p.left-(a>o.globals.gridWidth/2?n.tooltipRect.ttWidth:0),s=o.globals.clientY-p.top-(s>o.globals.gridHeight/2?n.tooltipRect.ttHeight:0)}}return{x:a,y:s}}},{key:"handleMarkerTooltip",value:function(t){var e,i,a=t.e,s=t.opt,r=t.x,n=t.y,o=this.w,l=this.ttCtx;if(a.target.classList.contains("apexcharts-marker")){var h=parseInt(s.paths.getAttribute("cx"),10),c=parseInt(s.paths.getAttribute("cy"),10),d=parseFloat(s.paths.getAttribute("val"));if(i=parseInt(s.paths.getAttribute("rel"),10),e=parseInt(s.paths.parentNode.parentNode.parentNode.getAttribute("rel"),10)-1,l.intersect){var u=v.findAncestor(s.paths,"apexcharts-series");u&&(e=parseInt(u.getAttribute("data:realIndex"),10))}if(l.tooltipLabels.drawSeriesTexts({ttItems:s.ttItems,i:e,j:i,shared:!l.showOnIntersect&&o.config.tooltip.shared,e:a}),"mouseup"===a.type&&l.markerClick(a,e,i),o.globals.capturedSeriesIndex=e,o.globals.capturedDataPointIndex=i,r=h,n=c+o.globals.translateY-1.4*l.tooltipRect.ttHeight,l.w.config.tooltip.followCursor){var g=l.getElGrid().getBoundingClientRect();n=l.e.clientY+o.globals.translateY-g.top}d<0&&(n=c),l.marker.enlargeCurrentPoint(i,s.paths,r,n)}return{x:r,y:n}}},{key:"handleBarTooltip",value:function(t){var e,i,a=t.e,s=t.opt,r=this.w,n=this.ttCtx,o=n.getElTooltip(),l=0,h=0,c=0,d=this.getBarTooltipXY({e:a,opt:s});if(null!==d.j||0!==d.barHeight||0!==d.barWidth){e=d.i;var u=d.j;if(r.globals.capturedSeriesIndex=e,r.globals.capturedDataPointIndex=u,r.globals.isBarHorizontal&&n.tooltipUtil.hasBars()||!r.config.tooltip.shared?(h=d.x,c=d.y,i=Array.isArray(r.config.stroke.width)?r.config.stroke.width[e]:r.config.stroke.width,l=h):r.globals.comboCharts||r.config.tooltip.shared||(l/=2),isNaN(c)&&(c=r.globals.svgHeight-n.tooltipRect.ttHeight),parseInt(s.paths.parentNode.getAttribute("data:realIndex"),10),h+n.tooltipRect.ttWidth>r.globals.gridWidth?h-=n.tooltipRect.ttWidth:h<0&&(h=0),n.w.config.tooltip.followCursor){var g=n.getElGrid().getBoundingClientRect();c=n.e.clientY-g.top}null===n.tooltip&&(n.tooltip=r.globals.dom.baseEl.querySelector(".apexcharts-tooltip")),r.config.tooltip.shared||(r.globals.comboBarCount>0?n.tooltipPosition.moveXCrosshairs(l+i/2):n.tooltipPosition.moveXCrosshairs(l)),!n.fixedTooltip&&(!r.config.tooltip.shared||r.globals.isBarHorizontal&&n.tooltipUtil.hasBars())&&(c=c+r.globals.translateY-n.tooltipRect.ttHeight/2,o.style.left=h+r.globals.translateX+"px",o.style.top=c+"px")}}},{key:"getBarTooltipXY",value:function(t){var e=this,i=t.e,a=t.opt,s=this.w,r=null,n=this.ttCtx,o=0,l=0,h=0,c=0,d=0,u=i.target.classList;if(u.contains("apexcharts-bar-area")||u.contains("apexcharts-candlestick-area")||u.contains("apexcharts-boxPlot-area")||u.contains("apexcharts-rangebar-area")){var g=i.target,p=g.getBoundingClientRect(),f=a.elGrid.getBoundingClientRect(),x=p.height;d=p.height;var b=p.width,m=parseInt(g.getAttribute("cx"),10),v=parseInt(g.getAttribute("cy"),10);c=parseFloat(g.getAttribute("barWidth"));var y="touchmove"===i.type?i.touches[0].clientX:i.clientX;r=parseInt(g.getAttribute("j"),10),o=parseInt(g.parentNode.getAttribute("rel"),10)-1;var w=g.getAttribute("data-range-y1"),k=g.getAttribute("data-range-y2");s.globals.comboCharts&&(o=parseInt(g.parentNode.getAttribute("data:realIndex"),10));var A=function(t){return s.globals.isXNumeric?m-b/2:e.isVerticalGroupedRangeBar?m+b/2:m-n.dataPointsDividedWidth+b/2},C=function(){return v-n.dataPointsDividedHeight+x/2-n.tooltipRect.ttHeight/2};n.tooltipLabels.drawSeriesTexts({ttItems:a.ttItems,i:o,j:r,y1:w?parseInt(w,10):null,y2:k?parseInt(k,10):null,shared:!n.showOnIntersect&&s.config.tooltip.shared,e:i}),s.config.tooltip.followCursor?s.globals.isBarHorizontal?(l=y-f.left+15,h=C()):(l=A(),h=i.clientY-f.top-n.tooltipRect.ttHeight/2-15):s.globals.isBarHorizontal?((l=m)0&&i.setAttribute("width",e.xcrosshairsWidth)}},{key:"handleYCrosshair",value:function(){var t=this.w,e=this.ttCtx;e.ycrosshairs=t.globals.dom.baseEl.querySelector(".apexcharts-ycrosshairs"),e.ycrosshairsHidden=t.globals.dom.baseEl.querySelector(".apexcharts-ycrosshairs-hidden")}},{key:"drawYaxisTooltipText",value:function(t,e,i){var a=this.ttCtx,s=this.w,r=s.globals,n=r.seriesYAxisMap[t];if(a.yaxisTooltips[t]&&n.length>0){var o=r.yLabelFormatters[t],l=a.getElGrid().getBoundingClientRect(),h=n[0],c=0;i.yRatio.length>1&&(c=h);var d=(e-l.top)*i.yRatio[c],u=r.maxYArr[h]-r.minYArr[h],g=r.minYArr[h]+(u-d);s.config.yaxis[t].reversed&&(g=r.maxYArr[h]-(u-d)),a.tooltipPosition.moveYCrosshairs(e-l.top),a.yaxisTooltipText[t].innerHTML=o(g),a.tooltipPosition.moveYAxisTooltip(t)}}}]),t}(),Sa=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w;var a=this.w;this.tConfig=a.config.tooltip,this.tooltipUtil=new va(this),this.tooltipLabels=new ya(this),this.tooltipPosition=new wa(this),this.marker=new ka(this),this.intersect=new Aa(this),this.axesTooltip=new Ca(this),this.showOnIntersect=this.tConfig.intersect,this.showTooltipTitle=this.tConfig.x.show,this.fixedTooltip=this.tConfig.fixed.enabled,this.xaxisTooltip=null,this.yaxisTTEls=null,this.isBarShared=!a.globals.isBarHorizontal&&this.tConfig.shared,this.lastHoverTime=Date.now()}return s(t,[{key:"getElTooltip",value:function(t){return t||(t=this),t.w.globals.dom.baseEl?t.w.globals.dom.baseEl.querySelector(".apexcharts-tooltip"):null}},{key:"getElXCrosshairs",value:function(){return this.w.globals.dom.baseEl.querySelector(".apexcharts-xcrosshairs")}},{key:"getElGrid",value:function(){return this.w.globals.dom.baseEl.querySelector(".apexcharts-grid")}},{key:"drawTooltip",value:function(t){var e=this.w;this.xyRatios=t,this.isXAxisTooltipEnabled=e.config.xaxis.tooltip.enabled&&e.globals.axisCharts,this.yaxisTooltips=e.config.yaxis.map((function(t,i){return!!(t.show&&t.tooltip.enabled&&e.globals.axisCharts)})),this.allTooltipSeriesGroups=[],e.globals.axisCharts||(this.showTooltipTitle=!1);var i=document.createElement("div");if(i.classList.add("apexcharts-tooltip"),e.config.tooltip.cssClass&&i.classList.add(e.config.tooltip.cssClass),i.classList.add("apexcharts-theme-".concat(this.tConfig.theme)),e.globals.dom.elWrap.appendChild(i),e.globals.axisCharts){this.axesTooltip.drawXaxisTooltip(),this.axesTooltip.drawYaxisTooltip(),this.axesTooltip.setXCrosshairWidth(),this.axesTooltip.handleYCrosshair();var a=new Qi(this.ctx);this.xAxisTicksPositions=a.getXAxisTicksPositions()}if(!e.globals.comboCharts&&!this.tConfig.intersect&&"rangeBar"!==e.config.chart.type||this.tConfig.shared||(this.showOnIntersect=!0),0!==e.config.markers.size&&0!==e.globals.markers.largestSize||this.marker.drawDynamicPoints(this),e.globals.collapsedSeries.length!==e.globals.series.length){this.dataPointsDividedHeight=e.globals.gridHeight/e.globals.dataPoints,this.dataPointsDividedWidth=e.globals.gridWidth/e.globals.dataPoints,this.showTooltipTitle&&(this.tooltipTitle=document.createElement("div"),this.tooltipTitle.classList.add("apexcharts-tooltip-title"),this.tooltipTitle.style.fontFamily=this.tConfig.style.fontFamily||e.config.chart.fontFamily,this.tooltipTitle.style.fontSize=this.tConfig.style.fontSize,i.appendChild(this.tooltipTitle));var s=e.globals.series.length;(e.globals.xyCharts||e.globals.comboCharts)&&this.tConfig.shared&&(s=this.showOnIntersect?1:e.globals.series.length),this.legendLabels=e.globals.dom.baseEl.querySelectorAll(".apexcharts-legend-text"),this.ttItems=this.createTTElements(s),this.addSVGEvents()}}},{key:"createTTElements",value:function(t){for(var e=this,i=this.w,a=[],s=this.getElTooltip(),r=function(r){var n=document.createElement("div");n.classList.add("apexcharts-tooltip-series-group","apexcharts-tooltip-series-group-".concat(r)),n.style.order=i.config.tooltip.inverseOrder?t-r:r+1;var o=document.createElement("span");o.classList.add("apexcharts-tooltip-marker"),i.config.tooltip.fillSeriesColor?o.style.backgroundColor=i.globals.colors[r]:o.style.color=i.globals.colors[r];var l=i.config.markers.shape,h=l;Array.isArray(l)&&(h=l[r]),o.setAttribute("shape",h),n.appendChild(o);var c=document.createElement("div");c.classList.add("apexcharts-tooltip-text"),c.style.fontFamily=e.tConfig.style.fontFamily||i.config.chart.fontFamily,c.style.fontSize=e.tConfig.style.fontSize,["y","goals","z"].forEach((function(t){var e=document.createElement("div");e.classList.add("apexcharts-tooltip-".concat(t,"-group"));var i=document.createElement("span");i.classList.add("apexcharts-tooltip-text-".concat(t,"-label")),e.appendChild(i);var a=document.createElement("span");a.classList.add("apexcharts-tooltip-text-".concat(t,"-value")),e.appendChild(a),c.appendChild(e)})),n.appendChild(c),s.appendChild(n),a.push(n)},n=0;n0&&this.addPathsEventListeners(g,c),this.tooltipUtil.hasBars()&&!this.tConfig.shared&&this.addDatapointEventsListeners(c)}}},{key:"drawFixedTooltipRect",value:function(){var t=this.w,e=this.getElTooltip(),i=e.getBoundingClientRect(),a=i.width+10,s=i.height+10,r=this.tConfig.fixed.offsetX,n=this.tConfig.fixed.offsetY,o=this.tConfig.fixed.position.toLowerCase();return o.indexOf("right")>-1&&(r=r+t.globals.svgWidth-a+10),o.indexOf("bottom")>-1&&(n=n+t.globals.svgHeight-s-10),e.style.left=r+"px",e.style.top=n+"px",{x:r,y:n,ttWidth:a,ttHeight:s}}},{key:"addDatapointEventsListeners",value:function(t){var e=this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-series-markers .apexcharts-marker, .apexcharts-bar-area, .apexcharts-candlestick-area, .apexcharts-boxPlot-area, .apexcharts-rangebar-area");this.addPathsEventListeners(e,t)}},{key:"addPathsEventListeners",value:function(t,e){for(var i=this,a=function(a){var s={paths:t[a],tooltipEl:e.tooltipEl,tooltipY:e.tooltipY,tooltipX:e.tooltipX,elGrid:e.elGrid,hoverArea:e.hoverArea,ttItems:e.ttItems};["mousemove","mouseup","touchmove","mouseout","touchend"].map((function(e){return t[a].addEventListener(e,i.onSeriesHover.bind(i,s),{capture:!1,passive:!0})}))},s=0;s=20?this.seriesHover(t,e):(clearTimeout(this.seriesHoverTimeout),this.seriesHoverTimeout=setTimeout((function(){i.seriesHover(t,e)}),20-a))}},{key:"seriesHover",value:function(t,e){var i=this;this.lastHoverTime=Date.now();var a=[],s=this.w;s.config.chart.group&&(a=this.ctx.getGroupedCharts()),s.globals.axisCharts&&(s.globals.minX===-1/0&&s.globals.maxX===1/0||0===s.globals.dataPoints)||(a.length?a.forEach((function(a){var s=i.getElTooltip(a),r={paths:t.paths,tooltipEl:s,tooltipY:t.tooltipY,tooltipX:t.tooltipX,elGrid:t.elGrid,hoverArea:t.hoverArea,ttItems:a.w.globals.tooltip.ttItems};a.w.globals.minX===i.w.globals.minX&&a.w.globals.maxX===i.w.globals.maxX&&a.w.globals.tooltip.seriesHoverByContext({chartCtx:a,ttCtx:a.w.globals.tooltip,opt:r,e:e})})):this.seriesHoverByContext({chartCtx:this.ctx,ttCtx:this.w.globals.tooltip,opt:t,e:e}))}},{key:"seriesHoverByContext",value:function(t){var e=t.chartCtx,i=t.ttCtx,a=t.opt,s=t.e,r=e.w,n=this.getElTooltip(e);if(n){if(i.tooltipRect={x:0,y:0,ttWidth:n.getBoundingClientRect().width,ttHeight:n.getBoundingClientRect().height},i.e=s,i.tooltipUtil.hasBars()&&!r.globals.comboCharts&&!i.isBarShared)if(this.tConfig.onDatasetHover.highlightDataSeries)new Zi(e).toggleSeriesOnHover(s,s.target.parentNode);i.fixedTooltip&&i.drawFixedTooltipRect(),r.globals.axisCharts?i.axisChartsTooltips({e:s,opt:a,tooltipRect:i.tooltipRect}):i.nonAxisChartsTooltips({e:s,opt:a,tooltipRect:i.tooltipRect})}}},{key:"axisChartsTooltips",value:function(t){var e,i,a=t.e,s=t.opt,r=this.w,n=s.elGrid.getBoundingClientRect(),o="touchmove"===a.type?a.touches[0].clientX:a.clientX,l="touchmove"===a.type?a.touches[0].clientY:a.clientY;if(this.clientY=l,this.clientX=o,r.globals.capturedSeriesIndex=-1,r.globals.capturedDataPointIndex=-1,ln.top+n.height)this.handleMouseOut(s);else{if(Array.isArray(this.tConfig.enabledOnSeries)&&!r.config.tooltip.shared){var h=parseInt(s.paths.getAttribute("index"),10);if(this.tConfig.enabledOnSeries.indexOf(h)<0)return void this.handleMouseOut(s)}var c=this.getElTooltip(),d=this.getElXCrosshairs(),u=[];r.config.chart.group&&(u=this.ctx.getSyncedCharts());var g=r.globals.xyCharts||"bar"===r.config.chart.type&&!r.globals.isBarHorizontal&&this.tooltipUtil.hasBars()&&this.tConfig.shared||r.globals.comboCharts&&this.tooltipUtil.hasBars();if("mousemove"===a.type||"touchmove"===a.type||"mouseup"===a.type){if(r.globals.collapsedSeries.length+r.globals.ancillaryCollapsedSeries.length===r.globals.series.length)return;null!==d&&d.classList.add("apexcharts-active");var p=this.yaxisTooltips.filter((function(t){return!0===t}));if(null!==this.ycrosshairs&&p.length&&this.ycrosshairs.classList.add("apexcharts-active"),g&&!this.showOnIntersect||u.length>1)this.handleStickyTooltip(a,o,l,s);else if("heatmap"===r.config.chart.type||"treemap"===r.config.chart.type){var f=this.intersect.handleHeatTreeTooltip({e:a,opt:s,x:e,y:i,type:r.config.chart.type});e=f.x,i=f.y,c.style.left=e+"px",c.style.top=i+"px"}else this.tooltipUtil.hasBars()&&this.intersect.handleBarTooltip({e:a,opt:s}),this.tooltipUtil.hasMarkers()&&this.intersect.handleMarkerTooltip({e:a,opt:s,x:e,y:i});if(this.yaxisTooltips.length)for(var x=0;xl.width)this.handleMouseOut(a);else if(null!==o)this.handleStickyCapturedSeries(t,o,a,n);else if(this.tooltipUtil.isXoverlap(n)||s.globals.isBarHorizontal){var h=s.globals.series.findIndex((function(t,e){return!s.globals.collapsedSeriesIndices.includes(e)}));this.create(t,this,h,n,a.ttItems)}}},{key:"handleStickyCapturedSeries",value:function(t,e,i,a){var s=this.w;if(!this.tConfig.shared&&null===s.globals.series[e][a])return void this.handleMouseOut(i);if(void 0!==s.globals.series[e][a])this.tConfig.shared&&this.tooltipUtil.isXoverlap(a)&&this.tooltipUtil.isInitialSeriesSameLen()?this.create(t,this,e,a,i.ttItems):this.create(t,this,e,a,i.ttItems,!1);else if(this.tooltipUtil.isXoverlap(a)){var r=s.globals.series.findIndex((function(t,e){return!s.globals.collapsedSeriesIndices.includes(e)}));this.create(t,this,r,a,i.ttItems)}}},{key:"deactivateHoverFilter",value:function(){for(var t=this.w,e=new Mi(this.ctx),i=t.globals.dom.Paper.find(".apexcharts-bar-area"),a=0;a5&&void 0!==arguments[5]?arguments[5]:null,A=this.w,C=e;"mouseup"===t.type&&this.markerClick(t,i,a),null===k&&(k=this.tConfig.shared);var S=this.tooltipUtil.hasMarkers(i),L=this.tooltipUtil.getElBars(),M=function(){A.globals.markers.largestSize>0?C.marker.enlargePoints(a):C.tooltipPosition.moveDynamicPointsOnHover(a)};if(A.config.legend.tooltipHoverFormatter){var P=A.config.legend.tooltipHoverFormatter,I=Array.from(this.legendLabels);I.forEach((function(t){var e=t.getAttribute("data:default-text");t.innerHTML=decodeURIComponent(e)}));for(var T=0;T0)){var H=new Mi(this.ctx),O=A.globals.dom.Paper.find(".apexcharts-bar-area[j='".concat(a,"']"));this.deactivateHoverFilter(),C.tooltipPosition.moveStickyTooltipOverBars(a,i),C.tooltipUtil.getAllMarkers(!0).length&&M();for(var F=0;F0&&i.config.plotOptions.bar.hideZeroBarsWhenGrouped&&(g-=c*A)),k){g=g+u.height/2-m/2-2}var S=i.globals.series[a][s]<0,L=l;switch(this.barCtx.isReversed&&(L=l+(S?d:-d)),x.position){case"center":p=k?S?L-d/2+y:L+d/2-y:S?L-d/2+u.height/2+y:L+d/2+u.height/2-y;break;case"bottom":p=k?S?L-d+y:L+d-y:S?L-d+u.height+m+y:L+d-u.height/2+m-y;break;case"top":p=k?S?L+y:L-y:S?L-u.height/2-y:L+u.height+y}var M=L;if(i.globals.seriesGroups.forEach((function(t){var i;null===(i=e.barCtx[t.join(",")])||void 0===i||i.prevY.forEach((function(t){M=S?Math.max(t[s],M):Math.min(t[s],M)}))})),this.barCtx.lastActiveBarSerieIndex===r&&b.enabled){var P=new Mi(this.barCtx.ctx).getTextRects(this.getStackedTotalDataLabel({realIndex:r,j:s}),f.fontSize);n=S?M-P.height/2-y-b.offsetY+18:M+P.height+y+b.offsetY-18;var I=C;o=w+(i.globals.isXNumeric?-c*i.globals.barGroups.length/2:i.globals.barGroups.length*c/2-(i.globals.barGroups.length-1)*c-I)+b.offsetX}return i.config.chart.stacked||(p<0?p=0+m:p+u.height/3>i.globals.gridHeight&&(p=i.globals.gridHeight-m)),{bcx:h,bcy:l,dataLabelsX:g,dataLabelsY:p,totalDataLabelsX:o,totalDataLabelsY:n,totalDataLabelsAnchor:"middle"}}},{key:"calculateBarsDataLabelsPosition",value:function(t){var e=this,i=this.w,a=t.x,s=t.i,r=t.j,n=t.realIndex,o=t.bcy,l=t.barHeight,h=t.barWidth,c=t.textRects,d=t.dataLabelsX,u=t.strokeWidth,g=t.dataLabelsConfig,p=t.barDataLabelsConfig,f=t.barTotalDataLabelsConfig,x=t.offX,b=t.offY,m=i.globals.gridHeight/i.globals.dataPoints,v=this.barCtx.barHelpers.getZeroValueEncounters({i:s,j:r}).zeroEncounters;h=Math.abs(h);var y,w,k=o-(this.barCtx.isRangeBar?0:m)+l/2+c.height/2+b-3;!i.config.chart.stacked&&v>0&&i.config.plotOptions.bar.hideZeroBarsWhenGrouped&&(k-=l*v);var A="start",C=i.globals.series[s][r]<0,S=a;switch(this.barCtx.isReversed&&(S=a+(C?-h:h),A=C?"start":"end"),p.position){case"center":d=C?S+h/2-x:Math.max(c.width/2,S-h/2)+x;break;case"bottom":d=C?S+h-u-x:S-h+u+x;break;case"top":d=C?S-u-x:S-u+x}var L=S;if(i.globals.seriesGroups.forEach((function(t){var i;null===(i=e.barCtx[t.join(",")])||void 0===i||i.prevX.forEach((function(t){L=C?Math.min(t[r],L):Math.max(t[r],L)}))})),this.barCtx.lastActiveBarSerieIndex===n&&f.enabled){var M=new Mi(this.barCtx.ctx).getTextRects(this.getStackedTotalDataLabel({realIndex:n,j:r}),g.fontSize);C?(y=L-u-x-f.offsetX,A="end"):y=L+x+f.offsetX+(this.barCtx.isReversed?-(h+u):u),w=k-c.height/2+M.height/2+f.offsetY+u,i.globals.barGroups.length>1&&(w-=i.globals.barGroups.length/2*(l/2))}return i.config.chart.stacked||("start"===g.textAnchor?d-c.width<0?d=C?c.width+u:u:d+c.width>i.globals.gridWidth&&(d=C?i.globals.gridWidth-u:i.globals.gridWidth-c.width-u):"middle"===g.textAnchor?d-c.width/2<0?d=c.width/2+u:d+c.width/2>i.globals.gridWidth&&(d=i.globals.gridWidth-c.width/2-u):"end"===g.textAnchor&&(d<1?d=c.width+u:d+1>i.globals.gridWidth&&(d=i.globals.gridWidth-c.width-u))),{bcx:a,bcy:o,dataLabelsX:d,dataLabelsY:k,totalDataLabelsX:y,totalDataLabelsY:w,totalDataLabelsAnchor:A}}},{key:"drawCalculatedDataLabels",value:function(t){var e=t.x,i=t.y,a=t.val,s=t.i,r=t.j,n=t.textRects,o=t.barHeight,l=t.barWidth,h=t.dataLabelsConfig,c=this.w,d="rotate(0)";"vertical"===c.config.plotOptions.bar.dataLabels.orientation&&(d="rotate(-90, ".concat(e,", ").concat(i,")"));var g=new qi(this.barCtx.ctx),p=new Mi(this.barCtx.ctx),f=h.formatter,x=null,b=c.globals.collapsedSeriesIndices.indexOf(s)>-1;if(h.enabled&&!b){x=p.group({class:"apexcharts-data-labels",transform:d});var m="";void 0!==a&&(m=f(a,u(u({},c),{},{seriesIndex:s,dataPointIndex:r,w:c}))),!a&&c.config.plotOptions.bar.hideZeroBarsWhenGrouped&&(m="");var v=c.globals.series[s][r]<0,y=c.config.plotOptions.bar.dataLabels.position;if("vertical"===c.config.plotOptions.bar.dataLabels.orientation&&("top"===y&&(h.textAnchor=v?"end":"start"),"center"===y&&(h.textAnchor="middle"),"bottom"===y&&(h.textAnchor=v?"end":"start")),this.barCtx.isRangeBar&&this.barCtx.barOptions.dataLabels.hideOverflowingLabels)lMath.abs(l)&&(m=""):n.height/1.6>Math.abs(o)&&(m=""));var w=u({},h);this.barCtx.isHorizontal&&a<0&&("start"===h.textAnchor?w.textAnchor="end":"end"===h.textAnchor&&(w.textAnchor="start")),g.plotDataLabelsText({x:e,y:i,text:m,i:s,j:r,parent:x,dataLabelsConfig:w,alwaysDrawDataLabel:!0,offsetCorrection:!0})}return x}},{key:"drawTotalDataLabels",value:function(t){var e=t.x,i=t.y,a=t.val,s=t.realIndex,r=t.textAnchor,n=t.barTotalDataLabelsConfig;this.w;var o,l=new Mi(this.barCtx.ctx);return n.enabled&&void 0!==e&&void 0!==i&&this.barCtx.lastActiveBarSerieIndex===s&&(o=l.drawText({x:e,y:i,foreColor:n.style.color,text:a,textAnchor:r,fontFamily:n.style.fontFamily,fontSize:n.style.fontSize,fontWeight:n.style.fontWeight})),o}}]),t}(),Ma=function(){function t(e){i(this,t),this.w=e.w,this.barCtx=e}return s(t,[{key:"initVariables",value:function(t){var e=this.w;this.barCtx.series=t,this.barCtx.totalItems=0,this.barCtx.seriesLen=0,this.barCtx.visibleI=-1,this.barCtx.visibleItems=1;for(var i=0;i0&&(this.barCtx.seriesLen=this.barCtx.seriesLen+1,this.barCtx.totalItems+=t[i].length),e.globals.isXNumeric)for(var a=0;ae.globals.minX&&e.globals.seriesX[i][a]0&&(s=h.globals.minXDiff/u),(n=s/d*parseInt(this.barCtx.barOptions.columnWidth,10)/100)<1&&(n=1)}if(-1===String(this.barCtx.barOptions.columnWidth).indexOf("%")&&(n=parseInt(this.barCtx.barOptions.columnWidth,10)),o=h.globals.gridHeight-this.barCtx.baseLineY[this.barCtx.translationsIndex]-(this.barCtx.isReversed?h.globals.gridHeight:0)+(this.barCtx.isReversed?2*this.barCtx.baseLineY[this.barCtx.translationsIndex]:0),h.globals.isXNumeric)e=this.barCtx.getBarXForNumericXAxis({x:e,j:0,realIndex:t,barWidth:n}).x;else e=h.globals.padHorizontal+v.noExponents(s-n*this.barCtx.seriesLen)/2}return h.globals.barHeight=r,h.globals.barWidth=n,{x:e,y:i,yDivision:a,xDivision:s,barHeight:r,barWidth:n,zeroH:o,zeroW:l}}},{key:"initializeStackedPrevVars",value:function(t){t.w.globals.seriesGroups.forEach((function(e){t[e]||(t[e]={}),t[e].prevY=[],t[e].prevX=[],t[e].prevYF=[],t[e].prevXF=[],t[e].prevYVal=[],t[e].prevXVal=[]}))}},{key:"initializeStackedXYVars",value:function(t){t.w.globals.seriesGroups.forEach((function(e){t[e]||(t[e]={}),t[e].xArrj=[],t[e].xArrjF=[],t[e].xArrjVal=[],t[e].yArrj=[],t[e].yArrjF=[],t[e].yArrjVal=[]}))}},{key:"getPathFillColor",value:function(t,e,i,a){var s,r,n,o,l=this.w,h=this.barCtx.ctx.fill,c=null,d=this.barCtx.barOptions.distributed?i:e,u=!1;this.barCtx.barOptions.colors.ranges.length>0&&this.barCtx.barOptions.colors.ranges.map((function(a){t[e][i]>=a.from&&t[e][i]<=a.to&&(c=a.color,u=!0)}));return{color:h.fillPath({seriesNumber:this.barCtx.barOptions.distributed?d:a,dataPointIndex:i,color:c,value:t[e][i],fillConfig:null===(s=l.config.series[e].data[i])||void 0===s?void 0:s.fill,fillType:null!==(r=l.config.series[e].data[i])&&void 0!==r&&null!==(n=r.fill)&&void 0!==n&&n.type?null===(o=l.config.series[e].data[i])||void 0===o?void 0:o.fill.type:Array.isArray(l.config.fill.type)?l.config.fill.type[a]:l.config.fill.type}),useRangeColor:u}}},{key:"getStrokeWidth",value:function(t,e,i){var a=0,s=this.w;return this.barCtx.series[t][e]?this.barCtx.isNullValue=!1:this.barCtx.isNullValue=!0,s.config.stroke.show&&(this.barCtx.isNullValue||(a=Array.isArray(this.barCtx.strokeWidth)?this.barCtx.strokeWidth[i]:this.barCtx.strokeWidth)),a}},{key:"createBorderRadiusArr",value:function(t){var e,i=this.w,a=!this.w.config.chart.stacked||i.config.plotOptions.bar.borderRadius<=0,s=t.length,n=0|(null===(e=t[0])||void 0===e?void 0:e.length),o=Array.from({length:s},(function(){return Array(n).fill(a?"top":"none")}));if(a)return o;for(var l=0;l0?(h.push(u),d++):g<0&&(c.push(u),d++)}if(h.length>0&&0===c.length)if(1===h.length)o[h[0]][l]="both";else{var p,f=h[0],x=h[h.length-1],b=r(h);try{for(b.s();!(p=b.n()).done;){var m=p.value;o[m][l]=m===f?"bottom":m===x?"top":"none"}}catch(t){b.e(t)}finally{b.f()}}else if(c.length>0&&0===h.length)if(1===c.length)o[c[0]][l]="both";else{var v,y=Math.max.apply(Math,c),w=Math.min.apply(Math,c),k=r(c);try{for(k.s();!(v=k.n()).done;){var A=v.value;o[A][l]=A===y?"bottom":A===w?"top":"none"}}catch(t){k.e(t)}finally{k.f()}}else if(h.length>0&&c.length>0){var C,S=h[h.length-1],L=r(h);try{for(L.s();!(C=L.n()).done;){var M=C.value;o[M][l]=M===S?"top":"none"}}catch(t){L.e(t)}finally{L.f()}var P,I=Math.max.apply(Math,c),T=r(c);try{for(T.s();!(P=T.n()).done;){var z=P.value;o[z][l]=z===I?"bottom":"none"}}catch(t){T.e(t)}finally{T.f()}}else if(1===d){o[h[0]||c[0]][l]="both"}}return o}},{key:"barBackground",value:function(t){var e=t.j,i=t.i,a=t.x1,s=t.x2,r=t.y1,n=t.y2,o=t.elSeries,l=this.w,h=new Mi(this.barCtx.ctx),c=new Zi(this.barCtx.ctx).getActiveConfigSeriesIndex();if(this.barCtx.barOptions.colors.backgroundBarColors.length>0&&c===i){e>=this.barCtx.barOptions.colors.backgroundBarColors.length&&(e%=this.barCtx.barOptions.colors.backgroundBarColors.length);var d=this.barCtx.barOptions.colors.backgroundBarColors[e],u=h.drawRect(void 0!==a?a:0,void 0!==r?r:0,void 0!==s?s:l.globals.gridWidth,void 0!==n?n:l.globals.gridHeight,this.barCtx.barOptions.colors.backgroundBarRadius,d,this.barCtx.barOptions.colors.backgroundBarOpacity);o.add(u),u.node.classList.add("apexcharts-backgroundBar")}}},{key:"getColumnPaths",value:function(t){var e,i=t.barWidth,a=t.barXPosition,s=t.y1,r=t.y2,n=t.strokeWidth,o=t.isReversed,l=t.series,h=t.seriesGroup,c=t.realIndex,d=t.i,u=t.j,g=t.w,p=new Mi(this.barCtx.ctx);(n=Array.isArray(n)?n[c]:n)||(n=0);var f=i,x=a;null!==(e=g.config.series[c].data[u])&&void 0!==e&&e.columnWidthOffset&&(x=a-g.config.series[c].data[u].columnWidthOffset/2,f=i+g.config.series[c].data[u].columnWidthOffset);var b=n/2,m=x+b,v=x+f-b,y=(l[d][u]>=0?1:-1)*(o?-1:1);s+=.001-b*y,r+=.001+b*y;var w=p.move(m,s),k=p.move(m,s),A=p.line(v,s);if(g.globals.previousPaths.length>0&&(k=this.barCtx.getPreviousPath(c,u,!1)),w=w+p.line(m,r)+p.line(v,r)+A+("around"===g.config.plotOptions.bar.borderRadiusApplication||"both"===this.arrBorderRadius[c][u]?" Z":" z"),k=k+p.line(m,s)+A+A+A+A+A+p.line(m,s)+("around"===g.config.plotOptions.bar.borderRadiusApplication||"both"===this.arrBorderRadius[c][u]?" Z":" z"),"none"!==this.arrBorderRadius[c][u]&&(w=p.roundPathCorners(w,g.config.plotOptions.bar.borderRadius)),g.config.chart.stacked){var C=this.barCtx;(C=this.barCtx[h]).yArrj.push(r-b*y),C.yArrjF.push(Math.abs(s-r+n*y)),C.yArrjVal.push(this.barCtx.series[d][u])}return{pathTo:w,pathFrom:k}}},{key:"getBarpaths",value:function(t){var e,i=t.barYPosition,a=t.barHeight,s=t.x1,r=t.x2,n=t.strokeWidth,o=t.isReversed,l=t.series,h=t.seriesGroup,c=t.realIndex,d=t.i,u=t.j,g=t.w,p=new Mi(this.barCtx.ctx);(n=Array.isArray(n)?n[c]:n)||(n=0);var f=i,x=a;null!==(e=g.config.series[c].data[u])&&void 0!==e&&e.barHeightOffset&&(f=i-g.config.series[c].data[u].barHeightOffset/2,x=a+g.config.series[c].data[u].barHeightOffset);var b=n/2,m=f+b,v=f+x-b,y=(l[d][u]>=0?1:-1)*(o?-1:1);s+=.001+b*y,r+=.001-b*y;var w=p.move(s,m),k=p.move(s,m);g.globals.previousPaths.length>0&&(k=this.barCtx.getPreviousPath(c,u,!1));var A=p.line(s,v);if(w=w+p.line(r,m)+p.line(r,v)+A+("around"===g.config.plotOptions.bar.borderRadiusApplication||"both"===this.arrBorderRadius[c][u]?" Z":" z"),k=k+p.line(s,m)+A+A+A+A+A+p.line(s,m)+("around"===g.config.plotOptions.bar.borderRadiusApplication||"both"===this.arrBorderRadius[c][u]?" Z":" z"),"none"!==this.arrBorderRadius[c][u]&&(w=p.roundPathCorners(w,g.config.plotOptions.bar.borderRadius)),g.config.chart.stacked){var C=this.barCtx;(C=this.barCtx[h]).xArrj.push(r+b*y),C.xArrjF.push(Math.abs(s-r-n*y)),C.xArrjVal.push(this.barCtx.series[d][u])}return{pathTo:w,pathFrom:k}}},{key:"checkZeroSeries",value:function(t){for(var e=t.series,i=this.w,a=0;a2&&void 0!==arguments[2])||arguments[2]?e:null;return null!=t&&(i=e+t/this.barCtx.invertedYRatio-2*(this.barCtx.isReversed?t/this.barCtx.invertedYRatio:0)),i}},{key:"getYForValue",value:function(t,e,i){var a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3]?e:null;return null!=t&&(a=e-t/this.barCtx.yRatio[i]+2*(this.barCtx.isReversed?t/this.barCtx.yRatio[i]:0)),a}},{key:"getGoalValues",value:function(t,e,i,a,s,r){var n=this,l=this.w,h=[],c=function(a,s){var l;h.push((o(l={},t,"x"===t?n.getXForValue(a,e,!1):n.getYForValue(a,i,r,!1)),o(l,"attrs",s),l))};if(l.globals.seriesGoals[a]&&l.globals.seriesGoals[a][s]&&Array.isArray(l.globals.seriesGoals[a][s])&&l.globals.seriesGoals[a][s].forEach((function(t){c(t.value,t)})),this.barCtx.barOptions.isDumbbell&&l.globals.seriesRange.length){var d=this.barCtx.barOptions.dumbbellColors?this.barCtx.barOptions.dumbbellColors:l.globals.colors,g={strokeHeight:"x"===t?0:l.globals.markers.size[a],strokeWidth:"x"===t?l.globals.markers.size[a]:0,strokeDashArray:0,strokeLineCap:"round",strokeColor:Array.isArray(d[a])?d[a][0]:d[a]};c(l.globals.seriesRangeStart[a][s],g),c(l.globals.seriesRangeEnd[a][s],u(u({},g),{},{strokeColor:Array.isArray(d[a])?d[a][1]:d[a]}))}return h}},{key:"drawGoalLine",value:function(t){var e=t.barXPosition,i=t.barYPosition,a=t.goalX,s=t.goalY,r=t.barWidth,n=t.barHeight,o=new Mi(this.barCtx.ctx),l=o.group({className:"apexcharts-bar-goals-groups"});l.node.classList.add("apexcharts-element-hidden"),this.barCtx.w.globals.delayedElements.push({el:l.node}),l.attr("clip-path","url(#gridRectMarkerMask".concat(this.barCtx.w.globals.cuid,")"));var h=null;return this.barCtx.isHorizontal?Array.isArray(a)&&a.forEach((function(t){if(t.x>=-1&&t.x<=o.w.globals.gridWidth+1){var e=void 0!==t.attrs.strokeHeight?t.attrs.strokeHeight:n/2,a=i+e+n/2;h=o.drawLine(t.x,a-2*e,t.x,a,t.attrs.strokeColor?t.attrs.strokeColor:void 0,t.attrs.strokeDashArray,t.attrs.strokeWidth?t.attrs.strokeWidth:2,t.attrs.strokeLineCap),l.add(h)}})):Array.isArray(s)&&s.forEach((function(t){if(t.y>=-1&&t.y<=o.w.globals.gridHeight+1){var i=void 0!==t.attrs.strokeWidth?t.attrs.strokeWidth:r/2,a=e+i+r/2;h=o.drawLine(a-2*i,t.y,a,t.y,t.attrs.strokeColor?t.attrs.strokeColor:void 0,t.attrs.strokeDashArray,t.attrs.strokeHeight?t.attrs.strokeHeight:2,t.attrs.strokeLineCap),l.add(h)}})),l}},{key:"drawBarShadow",value:function(t){var e=t.prevPaths,i=t.currPaths,a=t.color,s=this.w,r=e.x,n=e.x1,o=e.barYPosition,l=i.x,h=i.x1,c=i.barYPosition,d=o+i.barHeight,u=new Mi(this.barCtx.ctx),g=new v,p=u.move(n,d)+u.line(r,d)+u.line(l,c)+u.line(h,c)+u.line(n,d)+("around"===s.config.plotOptions.bar.borderRadiusApplication||"both"===this.arrBorderRadius[realIndex][j]?" Z":" z");return u.drawPath({d:p,fill:g.shadeColor(.5,v.rgb2hex(a)),stroke:"none",strokeWidth:0,fillOpacity:1,classes:"apexcharts-bar-shadow apexcharts-decoration-element"})}},{key:"getZeroValueEncounters",value:function(t){var e,i=t.i,a=t.j,s=this.w,r=0,n=0;return(s.config.plotOptions.bar.horizontal?s.globals.series.map((function(t,e){return e})):(null===(e=s.globals.columnSeries)||void 0===e?void 0:e.i.map((function(t){return t})))||[]).forEach((function(t){var e=s.globals.seriesPercent[t][a];e&&r++,t-1})),a=this.barCtx.columnGroupIndices,s=a.indexOf(i);return s<0&&(a.push(i),s=a.length-1),{groupIndex:i,columnGroupIndex:s}}}]),t}(),Pa=function(){function t(e,a){i(this,t),this.ctx=e,this.w=e.w;var s=this.w;this.barOptions=s.config.plotOptions.bar,this.isHorizontal=this.barOptions.horizontal,this.strokeWidth=s.config.stroke.width,this.isNullValue=!1,this.isRangeBar=s.globals.seriesRange.length&&this.isHorizontal,this.isVerticalGroupedRangeBar=!s.globals.isBarHorizontal&&s.globals.seriesRange.length&&s.config.plotOptions.bar.rangeBarGroupRows,this.isFunnel=this.barOptions.isFunnel,this.xyRatios=a,null!==this.xyRatios&&(this.xRatio=a.xRatio,this.yRatio=a.yRatio,this.invertedXRatio=a.invertedXRatio,this.invertedYRatio=a.invertedYRatio,this.baseLineY=a.baseLineY,this.baseLineInvertedY=a.baseLineInvertedY),this.yaxisIndex=0,this.translationsIndex=0,this.seriesLen=0,this.pathArr=[];var r=new Zi(this.ctx);this.lastActiveBarSerieIndex=r.getActiveConfigSeriesIndex("desc",["bar","column"]),this.columnGroupIndices=[];var n=r.getBarSeriesIndices(),o=new Pi(this.ctx);this.stackedSeriesTotals=o.getStackedSeriesTotals(this.w.config.series.map((function(t,e){return-1===n.indexOf(e)?e:-1})).filter((function(t){return-1!==t}))),this.barHelpers=new Ma(this)}return s(t,[{key:"draw",value:function(t,e){var i=this.w,a=new Mi(this.ctx),s=new Pi(this.ctx,i);t=s.getLogSeries(t),this.series=t,this.yRatio=s.getLogYRatios(this.yRatio),this.barHelpers.initVariables(t);var r=a.group({class:"apexcharts-bar-series apexcharts-plot-series"});i.config.dataLabels.enabled&&this.totalItems>this.barOptions.dataLabels.maxItems&&console.warn("WARNING: DataLabels are enabled but there are too many to display. This may cause performance issue when rendering - ApexCharts");for(var n=0,o=0;n0&&(this.visibleI=this.visibleI+1);var w=0,k=0;this.yRatio.length>1&&(this.yaxisIndex=i.globals.seriesYAxisReverseMap[b],this.translationsIndex=b);var A=this.translationsIndex;this.isReversed=i.config.yaxis[this.yaxisIndex]&&i.config.yaxis[this.yaxisIndex].reversed;var C=this.barHelpers.initialPositions(b);p=C.y,w=C.barHeight,h=C.yDivision,d=C.zeroW,g=C.x,k=C.barWidth,l=C.xDivision,c=C.zeroH,this.isHorizontal||x.push(g+k/2);var S=a.group({class:"apexcharts-datalabels","data:realIndex":b});i.globals.delayedElements.push({el:S.node}),S.node.classList.add("apexcharts-element-hidden");var L=a.group({class:"apexcharts-bar-goals-markers"}),M=a.group({class:"apexcharts-bar-shadows"});i.globals.delayedElements.push({el:M.node}),M.node.classList.add("apexcharts-element-hidden");for(var P=0;P0){var R,E=this.barHelpers.drawBarShadow({color:"string"==typeof X.color&&-1===(null===(R=X.color)||void 0===R?void 0:R.indexOf("url"))?X.color:v.hexToRgba(i.globals.colors[n]),prevPaths:this.pathArr[this.pathArr.length-1],currPaths:T});if(M.add(E),i.config.chart.dropShadow.enabled)new Li(this.ctx).dropShadow(E,i.config.chart.dropShadow,b)}this.pathArr.push(T);var Y=this.barHelpers.drawGoalLine({barXPosition:T.barXPosition,barYPosition:T.barYPosition,goalX:T.goalX,goalY:T.goalY,barHeight:w,barWidth:k});Y&&L.add(Y),p=T.y,g=T.x,P>0&&x.push(g+k/2),f.push(p),this.renderSeries(u(u({realIndex:b,pathFill:X.color},X.useRangeColor?{lineFill:X.color}:{}),{},{j:P,i:n,columnGroupIndex:m,pathFrom:T.pathFrom,pathTo:T.pathTo,strokeWidth:I,elSeries:y,x:g,y:p,series:t,barHeight:Math.abs(T.barHeight?T.barHeight:w),barWidth:Math.abs(T.barWidth?T.barWidth:k),elDataLabelsWrap:S,elGoalsMarkers:L,elBarShadows:M,visibleSeries:this.visibleI,type:"bar"}))}i.globals.seriesXvalues[b]=x,i.globals.seriesYvalues[b]=f,r.add(y)}return r}},{key:"renderSeries",value:function(t){var e=t.realIndex,i=t.pathFill,a=t.lineFill,s=t.j,r=t.i,n=t.columnGroupIndex,o=t.pathFrom,l=t.pathTo,h=t.strokeWidth,c=t.elSeries,d=t.x,u=t.y,g=t.y1,p=t.y2,f=t.series,x=t.barHeight,b=t.barWidth,m=t.barXPosition,v=t.barYPosition,y=t.elDataLabelsWrap,w=t.elGoalsMarkers,k=t.elBarShadows,A=t.visibleSeries,C=t.type,S=t.classes,L=this.w,M=new Mi(this.ctx);if(!a){var P="function"==typeof L.globals.stroke.colors[e]?function(t){var e,i=L.config.stroke.colors;return Array.isArray(i)&&i.length>0&&((e=i[t])||(e=""),"function"==typeof e)?e({value:L.globals.series[t][s],dataPointIndex:s,w:L}):e}(e):L.globals.stroke.colors[e];a=this.barOptions.distributed?L.globals.stroke.colors[s]:P}L.config.series[r].data[s]&&L.config.series[r].data[s].strokeColor&&(a=L.config.series[r].data[s].strokeColor),this.isNullValue&&(i="none");var I=s/L.config.chart.animations.animateGradually.delay*(L.config.chart.animations.speed/L.globals.dataPoints)/2.4,T=M.renderPaths({i:r,j:s,realIndex:e,pathFrom:o,pathTo:l,stroke:a,strokeWidth:h,strokeLineCap:L.config.stroke.lineCap,fill:i,animationDelay:I,initialSpeed:L.config.chart.animations.speed,dataChangeSpeed:L.config.chart.animations.dynamicAnimation.speed,className:"apexcharts-".concat(C,"-area ").concat(S),chartType:C});T.attr("clip-path","url(#gridRectBarMask".concat(L.globals.cuid,")"));var z=L.config.forecastDataPoints;z.count>0&&s>=L.globals.dataPoints-z.count&&(T.node.setAttribute("stroke-dasharray",z.dashArray),T.node.setAttribute("stroke-width",z.strokeWidth),T.node.setAttribute("fill-opacity",z.fillOpacity)),void 0!==g&&void 0!==p&&(T.attr("data-range-y1",g),T.attr("data-range-y2",p)),new Li(this.ctx).setSelectionFilter(T,e,s),c.add(T);var X=new La(this).handleBarDataLabels({x:d,y:u,y1:g,y2:p,i:r,j:s,series:f,realIndex:e,columnGroupIndex:n,barHeight:x,barWidth:b,barXPosition:m,barYPosition:v,renderedPath:T,visibleSeries:A});return null!==X.dataLabels&&y.add(X.dataLabels),X.totalDataLabels&&y.add(X.totalDataLabels),c.add(y),w&&c.add(w),k&&c.add(k),c}},{key:"drawBarPaths",value:function(t){var e,i=t.indexes,a=t.barHeight,s=t.strokeWidth,r=t.zeroW,n=t.x,o=t.y,l=t.yDivision,h=t.elSeries,c=this.w,d=i.i,u=i.j;if(c.globals.isXNumeric)e=(o=(c.globals.seriesX[d][u]-c.globals.minX)/this.invertedXRatio-a)+a*this.visibleI;else if(c.config.plotOptions.bar.hideZeroBarsWhenGrouped){var g=this.barHelpers.getZeroValueEncounters({i:d,j:u}),p=g.nonZeroColumns,f=g.zeroEncounters;p>0&&(a=this.seriesLen*a/p),e=o+a*this.visibleI,e-=a*f}else e=o+a*this.visibleI;this.isFunnel&&(r-=(this.barHelpers.getXForValue(this.series[d][u],r)-r)/2),n=this.barHelpers.getXForValue(this.series[d][u],r);var x=this.barHelpers.getBarpaths({barYPosition:e,barHeight:a,x1:r,x2:n,strokeWidth:s,isReversed:this.isReversed,series:this.series,realIndex:i.realIndex,i:d,j:u,w:c});return c.globals.isXNumeric||(o+=l),this.barHelpers.barBackground({j:u,i:d,y1:e-a*this.visibleI,y2:a*this.seriesLen,elSeries:h}),{pathTo:x.pathTo,pathFrom:x.pathFrom,x1:r,x:n,y:o,goalX:this.barHelpers.getGoalValues("x",r,null,d,u),barYPosition:e,barHeight:a}}},{key:"drawColumnPaths",value:function(t){var e,i=t.indexes,a=t.x,s=t.y,r=t.xDivision,n=t.barWidth,o=t.zeroH,l=t.strokeWidth,h=t.elSeries,c=this.w,d=i.realIndex,u=i.translationsIndex,g=i.i,p=i.j,f=i.bc;if(c.globals.isXNumeric){var x=this.getBarXForNumericXAxis({x:a,j:p,realIndex:d,barWidth:n});a=x.x,e=x.barXPosition}else if(c.config.plotOptions.bar.hideZeroBarsWhenGrouped){var b=this.barHelpers.getZeroValueEncounters({i:g,j:p}),m=b.nonZeroColumns,v=b.zeroEncounters;m>0&&(n=this.seriesLen*n/m),e=a+n*this.visibleI,e-=n*v}else e=a+n*this.visibleI;s=this.barHelpers.getYForValue(this.series[g][p],o,u);var y=this.barHelpers.getColumnPaths({barXPosition:e,barWidth:n,y1:o,y2:s,strokeWidth:l,isReversed:this.isReversed,series:this.series,realIndex:d,i:g,j:p,w:c});return c.globals.isXNumeric||(a+=r),this.barHelpers.barBackground({bc:f,j:p,i:g,x1:e-l/2-n*this.visibleI,x2:n*this.seriesLen+l/2,elSeries:h}),{pathTo:y.pathTo,pathFrom:y.pathFrom,x:a,y:s,goalY:this.barHelpers.getGoalValues("y",null,o,g,p,u),barXPosition:e,barWidth:n}}},{key:"getBarXForNumericXAxis",value:function(t){var e=t.x,i=t.barWidth,a=t.realIndex,s=t.j,r=this.w,n=a;return r.globals.seriesX[a].length||(n=r.globals.maxValsInArrayIndex),v.isNumber(r.globals.seriesX[n][s])&&(e=(r.globals.seriesX[n][s]-r.globals.minX)/this.xRatio-i*this.seriesLen/2),{barXPosition:e+i*this.visibleI,x:e}}},{key:"getPreviousPath",value:function(t,e){for(var i,a=this.w,s=0;s0&&parseInt(r.realIndex,10)===parseInt(t,10)&&void 0!==a.globals.previousPaths[s].paths[e]&&(i=a.globals.previousPaths[s].paths[e].d)}return i}}]),t}(),Ia=function(t){h(a,Pa);var e=n(a);function a(){return i(this,a),e.apply(this,arguments)}return s(a,[{key:"draw",value:function(t,e){var i=this,a=this.w;this.graphics=new Mi(this.ctx),this.bar=new Pa(this.ctx,this.xyRatios);var s=new Pi(this.ctx,a);t=s.getLogSeries(t),this.yRatio=s.getLogYRatios(this.yRatio),this.barHelpers.initVariables(t),"100%"===a.config.chart.stackType&&(t=a.globals.comboCharts?e.map((function(t){return a.globals.seriesPercent[t]})):a.globals.seriesPercent.slice()),this.series=t,this.barHelpers.initializeStackedPrevVars(this);for(var r=this.graphics.group({class:"apexcharts-bar-series apexcharts-plot-series"}),n=0,o=0,l=function(s,l){var h=void 0,c=void 0,d=void 0,g=void 0,p=a.globals.comboCharts?e[s]:s,f=i.barHelpers.getGroupIndex(p),x=f.groupIndex,b=f.columnGroupIndex;i.groupCtx=i[a.globals.seriesGroups[x]];var m=[],y=[],w=0;i.yRatio.length>1&&(i.yaxisIndex=a.globals.seriesYAxisReverseMap[p][0],w=p),i.isReversed=a.config.yaxis[i.yaxisIndex]&&a.config.yaxis[i.yaxisIndex].reversed;var k=i.graphics.group({class:"apexcharts-series",seriesName:v.escapeString(a.globals.seriesNames[p]),rel:s+1,"data:realIndex":p});i.ctx.series.addCollapsedClassToSeries(k,p);var A=i.graphics.group({class:"apexcharts-datalabels","data:realIndex":p}),C=i.graphics.group({class:"apexcharts-bar-goals-markers"}),S=0,L=0,M=i.initialPositions(n,o,h,c,d,g,w);o=M.y,S=M.barHeight,c=M.yDivision,g=M.zeroW,n=M.x,L=M.barWidth,h=M.xDivision,d=M.zeroH,a.globals.barHeight=S,a.globals.barWidth=L,i.barHelpers.initializeStackedXYVars(i),1===i.groupCtx.prevY.length&&i.groupCtx.prevY[0].every((function(t){return isNaN(t)}))&&(i.groupCtx.prevY[0]=i.groupCtx.prevY[0].map((function(){return d})),i.groupCtx.prevYF[0]=i.groupCtx.prevYF[0].map((function(){return 0})));for(var P=0;P0||"top"===i.barHelpers.arrBorderRadius[p][P]&&a.globals.series[p][P]<0)&&(E=Y),k=i.renderSeries(u(u({realIndex:p,pathFill:R.color},R.useRangeColor?{lineFill:R.color}:{}),{},{j:P,i:s,columnGroupIndex:b,pathFrom:z.pathFrom,pathTo:z.pathTo,strokeWidth:I,elSeries:k,x:n,y:o,series:t,barHeight:S,barWidth:L,elDataLabelsWrap:A,elGoalsMarkers:C,type:"bar",visibleSeries:b,classes:E}))}a.globals.seriesXvalues[p]=m,a.globals.seriesYvalues[p]=y,i.groupCtx.prevY.push(i.groupCtx.yArrj),i.groupCtx.prevYF.push(i.groupCtx.yArrjF),i.groupCtx.prevYVal.push(i.groupCtx.yArrjVal),i.groupCtx.prevX.push(i.groupCtx.xArrj),i.groupCtx.prevXF.push(i.groupCtx.xArrjF),i.groupCtx.prevXVal.push(i.groupCtx.xArrjVal),r.add(k)},h=0,c=0;h1?l=(i=h.globals.minXDiff/this.xRatio)*parseInt(this.barOptions.columnWidth,10)/100:-1===String(d).indexOf("%")?l=parseInt(d,10):l*=parseInt(d,10)/100,s=this.isReversed?this.baseLineY[n]:h.globals.gridHeight-this.baseLineY[n],t=h.globals.padHorizontal+(i-l)/2}var u=h.globals.barGroups.length||1;return{x:t,y:e,yDivision:a,xDivision:i,barHeight:o/u,barWidth:l/u,zeroH:s,zeroW:r}}},{key:"drawStackedBarPaths",value:function(t){for(var e,i=t.indexes,a=t.barHeight,s=t.strokeWidth,r=t.zeroW,n=t.x,o=t.y,l=t.columnGroupIndex,h=t.seriesGroup,c=t.yDivision,d=t.elSeries,u=this.w,g=o+l*a,p=i.i,f=i.j,x=i.realIndex,b=i.translationsIndex,m=0,v=0;v0){var w=r;this.groupCtx.prevXVal[y-1][f]<0?w=this.series[p][f]>=0?this.groupCtx.prevX[y-1][f]+m-2*(this.isReversed?m:0):this.groupCtx.prevX[y-1][f]:this.groupCtx.prevXVal[y-1][f]>=0&&(w=this.series[p][f]>=0?this.groupCtx.prevX[y-1][f]:this.groupCtx.prevX[y-1][f]-m+2*(this.isReversed?m:0)),e=w}else e=r;n=null===this.series[p][f]?e:e+this.series[p][f]/this.invertedYRatio-2*(this.isReversed?this.series[p][f]/this.invertedYRatio:0);var k=this.barHelpers.getBarpaths({barYPosition:g,barHeight:a,x1:e,x2:n,strokeWidth:s,isReversed:this.isReversed,series:this.series,realIndex:i.realIndex,seriesGroup:h,i:p,j:f,w:u});return this.barHelpers.barBackground({j:f,i:p,y1:g,y2:a,elSeries:d}),o+=c,{pathTo:k.pathTo,pathFrom:k.pathFrom,goalX:this.barHelpers.getGoalValues("x",r,null,p,f,b),barXPosition:e,barYPosition:g,x:n,y:o}}},{key:"drawStackedColumnPaths",value:function(t){var e=t.indexes,i=t.x,a=t.y,s=t.xDivision,r=t.barWidth,n=t.zeroH,o=t.columnGroupIndex,l=t.seriesGroup,h=t.elSeries,c=this.w,d=e.i,u=e.j,g=e.bc,p=e.realIndex,f=e.translationsIndex;if(c.globals.isXNumeric){var x=c.globals.seriesX[p][u];x||(x=0),i=(x-c.globals.minX)/this.xRatio-r/2*c.globals.barGroups.length}for(var b,m=i+o*r,v=0,y=0;y0&&!c.globals.isXNumeric||w>0&&c.globals.isXNumeric&&c.globals.seriesX[p-1][u]===c.globals.seriesX[p][u]){var k,A,C,S=Math.min(this.yRatio.length+1,p+1);if(void 0!==this.groupCtx.prevY[w-1]&&this.groupCtx.prevY[w-1].length)for(var L=1;L=0?C-v+2*(this.isReversed?v:0):C;break}if((null===(T=this.groupCtx.prevYVal[w-P])||void 0===T?void 0:T[u])>=0){A=this.series[d][u]>=0?C:C+v-2*(this.isReversed?v:0);break}}void 0===A&&(A=c.globals.gridHeight),b=null!==(k=this.groupCtx.prevYF[0])&&void 0!==k&&k.every((function(t){return 0===t}))&&this.groupCtx.prevYF.slice(1,w).every((function(t){return t.every((function(t){return isNaN(t)}))}))?n:A}else b=n;a=this.series[d][u]?b-this.series[d][u]/this.yRatio[f]+2*(this.isReversed?this.series[d][u]/this.yRatio[f]:0):b;var z=this.barHelpers.getColumnPaths({barXPosition:m,barWidth:r,y1:b,y2:a,yRatio:this.yRatio[f],strokeWidth:this.strokeWidth,isReversed:this.isReversed,series:this.series,seriesGroup:l,realIndex:e.realIndex,i:d,j:u,w:c});return this.barHelpers.barBackground({bc:g,j:u,i:d,x1:m,x2:r,elSeries:h}),{pathTo:z.pathTo,pathFrom:z.pathFrom,goalY:this.barHelpers.getGoalValues("y",null,n,d,u),barXPosition:m,x:c.globals.isXNumeric?i:i+s,y:a}}}]),a}(),Ta=function(t){h(a,Pa);var e=n(a);function a(){return i(this,a),e.apply(this,arguments)}return s(a,[{key:"draw",value:function(t,e,i){var a=this,s=this.w,r=new Mi(this.ctx),n=s.globals.comboCharts?e:s.config.chart.type,o=new ji(this.ctx);this.candlestickOptions=this.w.config.plotOptions.candlestick,this.boxOptions=this.w.config.plotOptions.boxPlot,this.isHorizontal=s.config.plotOptions.bar.horizontal;var l=new Pi(this.ctx,s);t=l.getLogSeries(t),this.series=t,this.yRatio=l.getLogYRatios(this.yRatio),this.barHelpers.initVariables(t);for(var h=r.group({class:"apexcharts-".concat(n,"-series apexcharts-plot-series")}),c=function(e){a.isBoxPlot="boxPlot"===s.config.chart.type||"boxPlot"===s.config.series[e].type;var n,l,c,d,g=void 0,p=void 0,f=[],x=[],b=s.globals.comboCharts?i[e]:e,m=a.barHelpers.getGroupIndex(b).columnGroupIndex,y=r.group({class:"apexcharts-series",seriesName:v.escapeString(s.globals.seriesNames[b]),rel:e+1,"data:realIndex":b});a.ctx.series.addCollapsedClassToSeries(y,b),t[e].length>0&&(a.visibleI=a.visibleI+1);var w,k,A=0;a.yRatio.length>1&&(a.yaxisIndex=s.globals.seriesYAxisReverseMap[b][0],A=b);var C=a.barHelpers.initialPositions(b);p=C.y,w=C.barHeight,l=C.yDivision,d=C.zeroW,g=C.x,k=C.barWidth,n=C.xDivision,c=C.zeroH,x.push(g+k/2);for(var S=r.group({class:"apexcharts-datalabels","data:realIndex":b}),L=r.group({class:"apexcharts-bar-goals-markers"}),M=function(i){var r=a.barHelpers.getStrokeWidth(e,i,b),h=null,v={indexes:{i:e,j:i,realIndex:b,translationsIndex:A},x:g,y:p,strokeWidth:r,elSeries:y};h=a.isHorizontal?a.drawHorizontalBoxPaths(u(u({},v),{},{yDivision:l,barHeight:w,zeroW:d})):a.drawVerticalBoxPaths(u(u({},v),{},{xDivision:n,barWidth:k,zeroH:c})),p=h.y,g=h.x;var C=a.barHelpers.drawGoalLine({barXPosition:h.barXPosition,barYPosition:h.barYPosition,goalX:h.goalX,goalY:h.goalY,barHeight:w,barWidth:k});C&&L.add(C),i>0&&x.push(g+k/2),f.push(p),h.pathTo.forEach((function(n,l){var c=!a.isBoxPlot&&a.candlestickOptions.wick.useFillColor?h.color[l]:s.globals.stroke.colors[e],d=o.fillPath({seriesNumber:b,dataPointIndex:i,color:h.color[l],value:t[e][i]});a.renderSeries({realIndex:b,pathFill:d,lineFill:c,j:i,i:e,pathFrom:h.pathFrom,pathTo:n,strokeWidth:r,elSeries:y,x:g,y:p,series:t,columnGroupIndex:m,barHeight:w,barWidth:k,elDataLabelsWrap:S,elGoalsMarkers:L,visibleSeries:a.visibleI,type:s.config.chart.type})}))},P=0;P0&&(M=this.getPreviousPath(g,c,!0)),L=this.isBoxPlot?[l.move(S,k)+l.line(S+s/2,k)+l.line(S+s/2,v)+l.line(S+s/4,v)+l.line(S+s-s/4,v)+l.line(S+s/2,v)+l.line(S+s/2,k)+l.line(S+s,k)+l.line(S+s,C)+l.line(S,C)+l.line(S,k+n/2),l.move(S,C)+l.line(S+s,C)+l.line(S+s,A)+l.line(S+s/2,A)+l.line(S+s/2,y)+l.line(S+s-s/4,y)+l.line(S+s/4,y)+l.line(S+s/2,y)+l.line(S+s/2,A)+l.line(S,A)+l.line(S,C)+"z"]:[l.move(S,A)+l.line(S+s/2,A)+l.line(S+s/2,v)+l.line(S+s/2,A)+l.line(S+s,A)+l.line(S+s,k)+l.line(S+s/2,k)+l.line(S+s/2,y)+l.line(S+s/2,k)+l.line(S,k)+l.line(S,A-n/2)],M+=l.move(S,k),o.globals.isXNumeric||(i+=a),{pathTo:L,pathFrom:M,x:i,y:A,goalY:this.barHelpers.getGoalValues("y",null,r,h,c,e.translationsIndex),barXPosition:S,color:w}}},{key:"drawHorizontalBoxPaths",value:function(t){var e=t.indexes;t.x;var i=t.y,a=t.yDivision,s=t.barHeight,r=t.zeroW,n=t.strokeWidth,o=this.w,l=new Mi(this.ctx),h=e.i,c=e.j,d=this.boxOptions.colors.lower;this.isBoxPlot&&(d=[this.boxOptions.colors.lower,this.boxOptions.colors.upper]);var u=this.invertedYRatio,g=e.realIndex,p=this.getOHLCValue(g,c),f=r,x=r,b=Math.min(p.o,p.c),m=Math.max(p.o,p.c),v=p.m;o.globals.isXNumeric&&(i=(o.globals.seriesX[g][c]-o.globals.minX)/this.invertedXRatio-s/2);var y=i+s*this.visibleI;void 0===this.series[h][c]||null===this.series[h][c]?(b=r,m=r):(b=r+b/u,m=r+m/u,f=r+p.h/u,x=r+p.l/u,v=r+p.m/u);var w=l.move(r,y),k=l.move(b,y+s/2);return o.globals.previousPaths.length>0&&(k=this.getPreviousPath(g,c,!0)),w=[l.move(b,y)+l.line(b,y+s/2)+l.line(f,y+s/2)+l.line(f,y+s/2-s/4)+l.line(f,y+s/2+s/4)+l.line(f,y+s/2)+l.line(b,y+s/2)+l.line(b,y+s)+l.line(v,y+s)+l.line(v,y)+l.line(b+n/2,y),l.move(v,y)+l.line(v,y+s)+l.line(m,y+s)+l.line(m,y+s/2)+l.line(x,y+s/2)+l.line(x,y+s-s/4)+l.line(x,y+s/4)+l.line(x,y+s/2)+l.line(m,y+s/2)+l.line(m,y)+l.line(v,y)+"z"],k+=l.move(b,y),o.globals.isXNumeric||(i+=a),{pathTo:w,pathFrom:k,x:m,y:i,goalX:this.barHelpers.getGoalValues("x",r,null,h,c),barYPosition:y,color:d}}},{key:"getOHLCValue",value:function(t,e){var i=this.w,a=new Pi(this.ctx,i),s=a.getLogValAtSeriesIndex(i.globals.seriesCandleH[t][e],t),r=a.getLogValAtSeriesIndex(i.globals.seriesCandleO[t][e],t),n=a.getLogValAtSeriesIndex(i.globals.seriesCandleM[t][e],t),o=a.getLogValAtSeriesIndex(i.globals.seriesCandleC[t][e],t),l=a.getLogValAtSeriesIndex(i.globals.seriesCandleL[t][e],t);return{o:this.isBoxPlot?s:r,h:this.isBoxPlot?r:s,m:n,l:this.isBoxPlot?o:l,c:this.isBoxPlot?l:o}}}]),a}(),za=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"checkColorRange",value:function(){var t=this.w,e=!1,i=t.config.plotOptions[t.config.chart.type];return i.colorScale.ranges.length>0&&i.colorScale.ranges.map((function(t,i){t.from<=0&&(e=!0)})),e}},{key:"getShadeColor",value:function(t,e,i,a){var s=this.w,r=1,n=s.config.plotOptions[t].shadeIntensity,o=this.determineColor(t,e,i);s.globals.hasNegs||a?r=s.config.plotOptions[t].reverseNegativeShade?o.percent<0?o.percent/100*(1.25*n):(1-o.percent/100)*(1.25*n):o.percent<=0?1-(1+o.percent/100)*n:(1-o.percent/100)*n:(r=1-o.percent/100,"treemap"===t&&(r=(1-o.percent/100)*(1.25*n)));var l=o.color,h=new v;if(s.config.plotOptions[t].enableShades)if("dark"===this.w.config.theme.mode){var c=h.shadeColor(-1*r,o.color);l=v.hexToRgba(v.isColorHex(c)?c:v.rgb2hex(c),s.config.fill.opacity)}else{var d=h.shadeColor(r,o.color);l=v.hexToRgba(v.isColorHex(d)?d:v.rgb2hex(d),s.config.fill.opacity)}return{color:l,colorProps:o}}},{key:"determineColor",value:function(t,e,i){var a=this.w,s=a.globals.series[e][i],r=a.config.plotOptions[t],n=r.colorScale.inverse?i:e;r.distributed&&"treemap"===a.config.chart.type&&(n=i);var o=a.globals.colors[n],l=null,h=Math.min.apply(Math,f(a.globals.series[e])),c=Math.max.apply(Math,f(a.globals.series[e]));r.distributed||"heatmap"!==t||(h=a.globals.minY,c=a.globals.maxY),void 0!==r.colorScale.min&&(h=r.colorScale.mina.globals.maxY?r.colorScale.max:a.globals.maxY);var d=Math.abs(c)+Math.abs(h),u=100*s/(0===d?d-1e-6:d);r.colorScale.ranges.length>0&&r.colorScale.ranges.map((function(t,e){if(s>=t.from&&s<=t.to){o=t.color,l=t.foreColor?t.foreColor:null,h=t.from,c=t.to;var i=Math.abs(c)+Math.abs(h);u=100*s/(0===i?i-1e-6:i)}}));return{color:o,foreColor:l,percent:u}}},{key:"calculateDataLabels",value:function(t){var e=t.text,i=t.x,a=t.y,s=t.i,r=t.j,n=t.colorProps,o=t.fontSize,l=this.w.config.dataLabels,h=new Mi(this.ctx),c=new qi(this.ctx),d=null;if(l.enabled){d=h.group({class:"apexcharts-data-labels"});var u=l.offsetX,g=l.offsetY,p=i+u,f=a+parseFloat(l.style.fontSize)/3+g;c.plotDataLabelsText({x:p,y:f,text:e,i:s,j:r,color:n.foreColor,parent:d,fontSize:o,dataLabelsConfig:l})}return d}},{key:"addListeners",value:function(t){var e=new Mi(this.ctx);t.node.addEventListener("mouseenter",e.pathMouseEnter.bind(this,t)),t.node.addEventListener("mouseleave",e.pathMouseLeave.bind(this,t)),t.node.addEventListener("mousedown",e.pathMouseDown.bind(this,t))}}]),t}(),Xa=function(){function t(e,a){i(this,t),this.ctx=e,this.w=e.w,this.xRatio=a.xRatio,this.yRatio=a.yRatio,this.dynamicAnim=this.w.config.chart.animations.dynamicAnimation,this.helpers=new za(e),this.rectRadius=this.w.config.plotOptions.heatmap.radius,this.strokeWidth=this.w.config.stroke.show?this.w.config.stroke.width:0}return s(t,[{key:"draw",value:function(t){var e=this.w,i=new Mi(this.ctx),a=i.group({class:"apexcharts-heatmap"});a.attr("clip-path","url(#gridRectMask".concat(e.globals.cuid,")"));var s=e.globals.gridWidth/e.globals.dataPoints,r=e.globals.gridHeight/e.globals.series.length,n=0,o=!1;this.negRange=this.helpers.checkColorRange();var l=t.slice();e.config.yaxis[0].reversed&&(o=!0,l.reverse());for(var h=o?0:l.length-1;o?h=0;o?h++:h--){var c=i.group({class:"apexcharts-series apexcharts-heatmap-series",seriesName:v.escapeString(e.globals.seriesNames[h]),rel:h+1,"data:realIndex":h});if(this.ctx.series.addCollapsedClassToSeries(c,h),e.config.chart.dropShadow.enabled){var d=e.config.chart.dropShadow;new Li(this.ctx).dropShadow(c,d,h)}for(var u=0,g=e.config.plotOptions.heatmap.shadeIntensity,p=0,f=0;f=l[h].length)break;var x=this.helpers.getShadeColor(e.config.chart.type,h,p,this.negRange),b=x.color,m=x.colorProps;if("image"===e.config.fill.type)b=new ji(this.ctx).fillPath({seriesNumber:h,dataPointIndex:p,opacity:e.globals.hasNegs?m.percent<0?1-(1+m.percent/100):g+m.percent/100:m.percent/100,patternID:v.randomId(),width:e.config.fill.image.width?e.config.fill.image.width:s,height:e.config.fill.image.height?e.config.fill.image.height:r});var y=this.rectRadius,w=i.drawRect(u,n,s,r,y);if(w.attr({cx:u,cy:n}),w.node.classList.add("apexcharts-heatmap-rect"),c.add(w),w.attr({fill:b,i:h,index:h,j:p,val:t[h][p],"stroke-width":this.strokeWidth,stroke:e.config.plotOptions.heatmap.useFillColorAsStroke?b:e.globals.stroke.colors[0],color:b}),this.helpers.addListeners(w),e.config.chart.animations.enabled&&!e.globals.dataChanged){var k=1;e.globals.resized||(k=e.config.chart.animations.speed),this.animateHeatMap(w,u,n,s,r,k)}if(e.globals.dataChanged){var A=1;if(this.dynamicAnim.enabled&&e.globals.shouldAnimate){A=this.dynamicAnim.speed;var C=e.globals.previousPaths[h]&&e.globals.previousPaths[h][p]&&e.globals.previousPaths[h][p].color;C||(C="rgba(255, 255, 255, 0)"),this.animateHeatColor(w,v.isColorHex(C)?C:v.rgb2hex(C),v.isColorHex(b)?b:v.rgb2hex(b),A)}}var S=(0,e.config.dataLabels.formatter)(e.globals.series[h][p],{value:e.globals.series[h][p],seriesIndex:h,dataPointIndex:p,w:e}),L=this.helpers.calculateDataLabels({text:S,x:u+s/2,y:n+r/2,i:h,j:p,colorProps:m,series:l});null!==L&&c.add(L),u+=s,p++}n+=r,a.add(c)}var M=e.globals.yAxisScale[0].result.slice();return e.config.yaxis[0].reversed?M.unshift(""):M.push(""),e.globals.yAxisScale[0].result=M,a}},{key:"animateHeatMap",value:function(t,e,i,a,s,r){var n=new y(this.ctx);n.animateRect(t,{x:e+a/2,y:i+s/2,width:0,height:0},{x:e,y:i,width:a,height:s},r,(function(){n.animationCompleted(t)}))}},{key:"animateHeatColor",value:function(t,e,i,a){t.attr({fill:e}).animate(a).attr({fill:i})}}]),t}(),Ra=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"drawYAxisTexts",value:function(t,e,i,a){var s=this.w,r=s.config.yaxis[0],n=s.globals.yLabelFormatters[0];return new Mi(this.ctx).drawText({x:t+r.labels.offsetX,y:e+r.labels.offsetY,text:n(a,i),textAnchor:"middle",fontSize:r.labels.style.fontSize,fontFamily:r.labels.style.fontFamily,foreColor:Array.isArray(r.labels.style.colors)?r.labels.style.colors[i]:r.labels.style.colors})}}]),t}(),Ea=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w;var a=this.w;this.chartType=this.w.config.chart.type,this.initialAnim=this.w.config.chart.animations.enabled,this.dynamicAnim=this.initialAnim&&this.w.config.chart.animations.dynamicAnimation.enabled,this.animBeginArr=[0],this.animDur=0,this.donutDataLabels=this.w.config.plotOptions.pie.donut.labels,this.lineColorArr=void 0!==a.globals.stroke.colors?a.globals.stroke.colors:a.globals.colors,this.defaultSize=Math.min(a.globals.gridWidth,a.globals.gridHeight),this.centerY=this.defaultSize/2,this.centerX=a.globals.gridWidth/2,"radialBar"===a.config.chart.type?this.fullAngle=360:this.fullAngle=Math.abs(a.config.plotOptions.pie.endAngle-a.config.plotOptions.pie.startAngle),this.initialAngle=a.config.plotOptions.pie.startAngle%this.fullAngle,a.globals.radialSize=this.defaultSize/2.05-a.config.stroke.width-(a.config.chart.sparkline.enabled?0:a.config.chart.dropShadow.blur),this.donutSize=a.globals.radialSize*parseInt(a.config.plotOptions.pie.donut.size,10)/100;var s=a.config.plotOptions.pie.customScale,r=a.globals.gridWidth/2,n=a.globals.gridHeight/2;this.translateX=r-r*s,this.translateY=n-n*s,this.dataLabelsGroup=new Mi(this.ctx).group({class:"apexcharts-datalabels-group",transform:"translate(".concat(this.translateX,", ").concat(this.translateY,") scale(").concat(s,")")}),this.maxY=0,this.sliceLabels=[],this.sliceSizes=[],this.prevSectorAngleArr=[]}return s(t,[{key:"draw",value:function(t){var e=this,i=this.w,a=new Mi(this.ctx),s=a.group({class:"apexcharts-pie"});if(i.globals.noData)return s;for(var r=0,n=0;n-1&&this.pieClicked(d),i.config.dataLabels.enabled){var w=m.x,k=m.y,A=100*g/this.fullAngle+"%";if(0!==g&&i.config.plotOptions.pie.dataLabels.minAngleToShowLabelthis.fullAngle?e.endAngle=e.endAngle-(a+n):a+n=this.fullAngle+this.w.config.plotOptions.pie.startAngle%this.fullAngle&&(h=this.fullAngle+this.w.config.plotOptions.pie.startAngle%this.fullAngle-.01),Math.ceil(h)>this.fullAngle&&(h-=this.fullAngle);var c=Math.PI*(h-90)/180,d=i.centerX+r*Math.cos(l),u=i.centerY+r*Math.sin(l),g=i.centerX+r*Math.cos(c),p=i.centerY+r*Math.sin(c),f=v.polarToCartesian(i.centerX,i.centerY,i.donutSize,h),x=v.polarToCartesian(i.centerX,i.centerY,i.donutSize,o),b=s>180?1:0,m=["M",d,u,"A",r,r,0,b,1,g,p];return e="donut"===i.chartType?[].concat(m,["L",f.x,f.y,"A",i.donutSize,i.donutSize,0,b,0,x.x,x.y,"L",d,u,"z"]).join(" "):"pie"===i.chartType||"polarArea"===i.chartType?[].concat(m,["L",i.centerX,i.centerY,"L",d,u]).join(" "):[].concat(m).join(" "),n.roundPathCorners(e,2*this.strokeWidth)}},{key:"drawPolarElements",value:function(t){var e=this.w,i=new ta(this.ctx),a=new Mi(this.ctx),s=new Ra(this.ctx),r=a.group(),n=a.group(),o=i.niceScale(0,Math.ceil(this.maxY),0),l=o.result.reverse(),h=o.result.length;this.maxY=o.niceMax;for(var c=e.globals.radialSize,d=c/(h-1),u=0;u1&&t.total.show&&(s=t.total.color);var n=r.globals.dom.baseEl.querySelector(".apexcharts-datalabel-label"),o=r.globals.dom.baseEl.querySelector(".apexcharts-datalabel-value");i=(0,t.value.formatter)(i,r),a||"function"!=typeof t.total.formatter||(i=t.total.formatter(r));var l=e===t.total.label;e=this.donutDataLabels.total.label?t.name.formatter(e,l,r):"",null!==n&&(n.textContent=e),null!==o&&(o.textContent=i),null!==n&&(n.style.fill=s)}},{key:"printDataLabelsInner",value:function(t,e){var i=this.w,a=t.getAttribute("data:value"),s=i.globals.seriesNames[parseInt(t.parentNode.getAttribute("rel"),10)-1];i.globals.series.length>1&&this.printInnerLabels(e,s,a,t);var r=i.globals.dom.baseEl.querySelector(".apexcharts-datalabels-group");null!==r&&(r.style.opacity=1)}},{key:"drawSpokes",value:function(t){var e=this,i=this.w,a=new Mi(this.ctx),s=i.config.plotOptions.polarArea.spokes;if(0!==s.strokeWidth){for(var r=[],n=360/i.globals.series.length,o=0;o0&&(f=e.getPreviousPath(n));for(var x=0;x=10?t.x>0?(i="start",a+=10):t.x<0&&(i="end",a-=10):i="middle",Math.abs(t.y)>=e-10&&(t.y<0?s-=10:t.y>0&&(s+=10)),{textAnchor:i,newX:a,newY:s}}},{key:"getPreviousPath",value:function(t){for(var e=this.w,i=null,a=0;a0&&parseInt(s.realIndex,10)===parseInt(t,10)&&void 0!==e.globals.previousPaths[a].paths[0]&&(i=e.globals.previousPaths[a].paths[0].d)}return i}},{key:"getDataPointsPos",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dataPointsLen;t=t||[],e=e||[];for(var a=[],s=0;s=360&&(u=360-Math.abs(this.startAngle)-.1);var g=i.drawPath({d:"",stroke:c,strokeWidth:n*parseInt(h.strokeWidth,10)/100,fill:"none",strokeOpacity:h.opacity,classes:"apexcharts-radialbar-area"});if(h.dropShadow.enabled){var p=h.dropShadow;s.dropShadow(g,p)}l.add(g),g.attr("id","apexcharts-radialbarTrack-"+o),this.animatePaths(g,{centerX:t.centerX,centerY:t.centerY,endAngle:u,startAngle:d,size:t.size,i:o,totalItems:2,animBeginArr:0,dur:0,isTrack:!0})}return a}},{key:"drawArcs",value:function(t){var e=this.w,i=new Mi(this.ctx),a=new ji(this.ctx),s=new Li(this.ctx),r=i.group(),n=this.getStrokeWidth(t);t.size=t.size-n/2;var o=e.config.plotOptions.radialBar.hollow.background,l=t.size-n*t.series.length-this.margin*t.series.length-n*parseInt(e.config.plotOptions.radialBar.track.strokeWidth,10)/100/2,h=l-e.config.plotOptions.radialBar.hollow.margin;void 0!==e.config.plotOptions.radialBar.hollow.image&&(o=this.drawHollowImage(t,r,l,o));var c=this.drawHollow({size:h,centerX:t.centerX,centerY:t.centerY,fill:o||"transparent"});if(e.config.plotOptions.radialBar.hollow.dropShadow.enabled){var d=e.config.plotOptions.radialBar.hollow.dropShadow;s.dropShadow(c,d)}var u=1;!this.radialDataLabels.total.show&&e.globals.series.length>1&&(u=0);var g=null;if(this.radialDataLabels.show){var p=e.globals.dom.Paper.findOne(".apexcharts-datalabels-group");g=this.renderInnerDataLabels(p,this.radialDataLabels,{hollowSize:l,centerX:t.centerX,centerY:t.centerY,opacity:u})}"back"===e.config.plotOptions.radialBar.hollow.position&&(r.add(c),g&&r.add(g));var f=!1;e.config.plotOptions.radialBar.inverseOrder&&(f=!0);for(var x=f?t.series.length-1:0;f?x>=0:x100?100:t.series[x])/100,A=Math.round(this.totalAngle*k)+this.startAngle,C=void 0;e.globals.dataChanged&&(w=this.startAngle,C=Math.round(this.totalAngle*v.negToZero(e.globals.previousPaths[x])/100)+w),Math.abs(A)+Math.abs(y)>360&&(A-=.01),Math.abs(C)+Math.abs(w)>360&&(C-=.01);var S=A-y,L=Array.isArray(e.config.stroke.dashArray)?e.config.stroke.dashArray[x]:e.config.stroke.dashArray,M=i.drawPath({d:"",stroke:m,strokeWidth:n,fill:"none",fillOpacity:e.config.fill.opacity,classes:"apexcharts-radialbar-area apexcharts-radialbar-slice-"+x,strokeDashArray:L});if(Mi.setAttrs(M.node,{"data:angle":S,"data:value":t.series[x]}),e.config.chart.dropShadow.enabled){var P=e.config.chart.dropShadow;s.dropShadow(M,P,x)}if(s.setSelectionFilter(M,0,x),this.addListeners(M,this.radialDataLabels),b.add(M),M.attr({index:0,j:x}),this.barLabels.enabled){var I=v.polarToCartesian(t.centerX,t.centerY,t.size,y),T=this.barLabels.formatter(e.globals.seriesNames[x],{seriesIndex:x,w:e}),z=["apexcharts-radialbar-label"];this.barLabels.onClick||z.push("apexcharts-no-click");var X=this.barLabels.useSeriesColors?e.globals.colors[x]:e.config.chart.foreColor;X||(X=e.config.chart.foreColor);var R=I.x+this.barLabels.offsetX,E=I.y+this.barLabels.offsetY,Y=i.drawText({x:R,y:E,text:T,textAnchor:"end",dominantBaseline:"middle",fontFamily:this.barLabels.fontFamily,fontWeight:this.barLabels.fontWeight,fontSize:this.barLabels.fontSize,foreColor:X,cssClass:z.join(" ")});Y.on("click",this.onBarLabelClick),Y.attr({rel:x+1}),0!==y&&Y.attr({"transform-origin":"".concat(R," ").concat(E),transform:"rotate(".concat(y," 0 0)")}),b.add(Y)}var H=0;!this.initialAnim||e.globals.resized||e.globals.dataChanged||(H=e.config.chart.animations.speed),e.globals.dataChanged&&(H=e.config.chart.animations.dynamicAnimation.speed),this.animDur=H/(1.2*t.series.length)+this.animDur,this.animBeginArr.push(this.animDur),this.animatePaths(M,{centerX:t.centerX,centerY:t.centerY,endAngle:A,startAngle:y,prevEndAngle:C,prevStartAngle:w,size:t.size,i:x,totalItems:2,animBeginArr:this.animBeginArr,dur:H,shouldSetPrevPaths:!0})}return{g:r,elHollow:c,dataLabels:g}}},{key:"drawHollow",value:function(t){var e=new Mi(this.ctx).drawCircle(2*t.size);return e.attr({class:"apexcharts-radialbar-hollow",cx:t.centerX,cy:t.centerY,r:t.size,fill:t.fill}),e}},{key:"drawHollowImage",value:function(t,e,i,a){var s=this.w,r=new ji(this.ctx),n=v.randomId(),o=s.config.plotOptions.radialBar.hollow.image;if(s.config.plotOptions.radialBar.hollow.imageClipped)r.clippedImgArea({width:i,height:i,image:o,patternID:"pattern".concat(s.globals.cuid).concat(n)}),a="url(#pattern".concat(s.globals.cuid).concat(n,")");else{var l=s.config.plotOptions.radialBar.hollow.imageWidth,h=s.config.plotOptions.radialBar.hollow.imageHeight;if(void 0===l&&void 0===h){var c=s.globals.dom.Paper.image(o,(function(e){this.move(t.centerX-e.width/2+s.config.plotOptions.radialBar.hollow.imageOffsetX,t.centerY-e.height/2+s.config.plotOptions.radialBar.hollow.imageOffsetY)}));e.add(c)}else{var d=s.globals.dom.Paper.image(o,(function(e){this.move(t.centerX-l/2+s.config.plotOptions.radialBar.hollow.imageOffsetX,t.centerY-h/2+s.config.plotOptions.radialBar.hollow.imageOffsetY),this.size(l,h)}));e.add(d)}}return a}},{key:"getStrokeWidth",value:function(t){var e=this.w;return t.size*(100-parseInt(e.config.plotOptions.radialBar.hollow.size,10))/100/(t.series.length+1)-this.margin}},{key:"onBarLabelClick",value:function(t){var e=parseInt(t.target.getAttribute("rel"),10)-1,i=this.barLabels.onClick,a=this.w;i&&i(a.globals.seriesNames[e],{w:a,seriesIndex:e})}}]),r}(),Oa=function(t){h(a,Pa);var e=n(a);function a(){return i(this,a),e.apply(this,arguments)}return s(a,[{key:"draw",value:function(t,e){var i=this.w,a=new Mi(this.ctx);this.rangeBarOptions=this.w.config.plotOptions.rangeBar,this.series=t,this.seriesRangeStart=i.globals.seriesRangeStart,this.seriesRangeEnd=i.globals.seriesRangeEnd,this.barHelpers.initVariables(t);for(var s=a.group({class:"apexcharts-rangebar-series apexcharts-plot-series"}),r=0;r0&&(this.visibleI=this.visibleI+1);var x=0,b=0,m=0;this.yRatio.length>1&&(this.yaxisIndex=i.globals.seriesYAxisReverseMap[g][0],m=g);var y=this.barHelpers.initialPositions(g);d=y.y,h=y.zeroW,c=y.x,b=y.barWidth,x=y.barHeight,n=y.xDivision,o=y.yDivision,l=y.zeroH;for(var w=a.group({class:"apexcharts-datalabels","data:realIndex":g}),k=a.group({class:"apexcharts-rangebar-goals-markers"}),A=0;A0}));return this.isHorizontal?(a=u.config.plotOptions.bar.rangeBarGroupRows?r+h*b:r+o*this.visibleI+h*b,m>-1&&!u.config.plotOptions.bar.rangeBarOverlap&&(g=u.globals.seriesRange[e][m].overlaps).indexOf(p)>-1&&(a=(o=d.barHeight/g.length)*this.visibleI+h*(100-parseInt(this.barOptions.barHeight,10))/100/2+o*(this.visibleI+g.indexOf(p))+h*b)):(b>-1&&!u.globals.timescaleLabels.length&&(s=u.config.plotOptions.bar.rangeBarGroupRows?n+c*b:n+l*this.visibleI+c*b),m>-1&&!u.config.plotOptions.bar.rangeBarOverlap&&(g=u.globals.seriesRange[e][m].overlaps).indexOf(p)>-1&&(s=(l=d.barWidth/g.length)*this.visibleI+c*(100-parseInt(this.barOptions.barWidth,10))/100/2+l*(this.visibleI+g.indexOf(p))+c*b)),{barYPosition:a,barXPosition:s,barHeight:o,barWidth:l}}},{key:"drawRangeColumnPaths",value:function(t){var e=t.indexes,i=t.x,a=t.xDivision,s=t.barWidth,r=t.barXPosition,n=t.zeroH,o=this.w,l=e.i,h=e.j,c=e.realIndex,d=e.translationsIndex,u=this.yRatio[d],g=this.getRangeValue(c,h),p=Math.min(g.start,g.end),f=Math.max(g.start,g.end);void 0===this.series[l][h]||null===this.series[l][h]?p=n:(p=n-p/u,f=n-f/u);var x=Math.abs(f-p),b=this.barHelpers.getColumnPaths({barXPosition:r,barWidth:s,y1:p,y2:f,strokeWidth:this.strokeWidth,series:this.seriesRangeEnd,realIndex:c,i:c,j:h,w:o});if(o.globals.isXNumeric){var m=this.getBarXForNumericXAxis({x:i,j:h,realIndex:c,barWidth:s});i=m.x,r=m.barXPosition}else i+=a;return{pathTo:b.pathTo,pathFrom:b.pathFrom,barHeight:x,x:i,y:g.start<0&&g.end<0?p:f,goalY:this.barHelpers.getGoalValues("y",null,n,l,h,d),barXPosition:r}}},{key:"preventBarOverflow",value:function(t){var e=this.w;return t<0&&(t=0),t>e.globals.gridWidth&&(t=e.globals.gridWidth),t}},{key:"drawRangeBarPaths",value:function(t){var e=t.indexes,i=t.y,a=t.y1,s=t.y2,r=t.yDivision,n=t.barHeight,o=t.barYPosition,l=t.zeroW,h=this.w,c=e.realIndex,d=e.j,u=this.preventBarOverflow(l+a/this.invertedYRatio),g=this.preventBarOverflow(l+s/this.invertedYRatio),p=this.getRangeValue(c,d),f=Math.abs(g-u),x=this.barHelpers.getBarpaths({barYPosition:o,barHeight:n,x1:u,x2:g,strokeWidth:this.strokeWidth,series:this.seriesRangeEnd,i:c,realIndex:c,j:d,w:h});return h.globals.isXNumeric||(i+=r),{pathTo:x.pathTo,pathFrom:x.pathFrom,barWidth:f,x:p.start<0&&p.end<0?u:g,goalX:this.barHelpers.getGoalValues("x",l,null,c,d),y:i}}},{key:"getRangeValue",value:function(t,e){var i=this.w;return{start:i.globals.seriesRangeStart[t][e],end:i.globals.seriesRangeEnd[t][e]}}}]),a}(),Fa=function(){function t(e){i(this,t),this.w=e.w,this.lineCtx=e}return s(t,[{key:"sameValueSeriesFix",value:function(t,e){var i=this.w;if(("gradient"===i.config.fill.type||"gradient"===i.config.fill.type[t])&&new Pi(this.lineCtx.ctx,i).seriesHaveSameValues(t)){var a=e[t].slice();a[a.length-1]=a[a.length-1]+1e-6,e[t]=a}return e}},{key:"calculatePoints",value:function(t){var e=t.series,i=t.realIndex,a=t.x,s=t.y,r=t.i,n=t.j,o=t.prevY,l=this.w,h=[],c=[],d=this.lineCtx.categoryAxisCorrection+l.config.markers.offsetX;return l.globals.isXNumeric&&(d=(l.globals.seriesX[i][0]-l.globals.minX)/this.lineCtx.xRatio+l.config.markers.offsetX),0===n&&(h.push(d),c.push(v.isNumber(e[r][0])?o+l.config.markers.offsetY:null)),h.push(a+l.config.markers.offsetX),c.push(v.isNumber(e[r][n+1])?s+l.config.markers.offsetY:null),{x:h,y:c}}},{key:"checkPreviousPaths",value:function(t){for(var e=t.pathFromLine,i=t.pathFromArea,a=t.realIndex,s=this.w,r=0;r0&&parseInt(n.realIndex,10)===parseInt(a,10)&&("line"===n.type?(this.lineCtx.appendPathFrom=!1,e=s.globals.previousPaths[r].paths[0].d):"area"===n.type&&(this.lineCtx.appendPathFrom=!1,i=s.globals.previousPaths[r].paths[0].d,s.config.stroke.show&&s.globals.previousPaths[r].paths[1]&&(e=s.globals.previousPaths[r].paths[1].d)))}return{pathFromLine:e,pathFromArea:i}}},{key:"determineFirstPrevY",value:function(t){var e,i,a,s=t.i,r=t.realIndex,n=t.series,o=t.prevY,l=t.lineYPosition,h=t.translationsIndex,c=this.w,d=c.config.chart.stacked&&!c.globals.comboCharts||c.config.chart.stacked&&c.globals.comboCharts&&(!this.w.config.chart.stackOnlyBar||"bar"===(null===(e=this.w.config.series[r])||void 0===e?void 0:e.type)||"column"===(null===(i=this.w.config.series[r])||void 0===i?void 0:i.type));if(void 0!==(null===(a=n[s])||void 0===a?void 0:a[0]))o=(l=d&&s>0?this.lineCtx.prevSeriesY[s-1][0]:this.lineCtx.zeroY)-n[s][0]/this.lineCtx.yRatio[h]+2*(this.lineCtx.isReversed?n[s][0]/this.lineCtx.yRatio[h]:0);else if(d&&s>0&&void 0===n[s][0])for(var u=s-1;u>=0;u--)if(null!==n[u][0]&&void 0!==n[u][0]){o=l=this.lineCtx.prevSeriesY[u][0];break}return{prevY:o,lineYPosition:l}}}]),t}(),Da=function(t){for(var e,i,a,s,r=function(t){for(var e=[],i=t[0],a=t[1],s=e[0]=Wa(i,a),r=1,n=t.length-1;r9&&(s=3*a/Math.sqrt(s),r[l]=s*e,r[l+1]=s*i);for(var h=0;h<=n;h++)s=(t[Math.min(n,h+1)][0]-t[Math.max(0,h-1)][0])/(6*(1+r[h]*r[h])),o.push([s||0,r[h]*s||0]);return o},_a=function(t){var e=Da(t),i=t[1],a=t[0],s=[],r=e[1],n=e[0];s.push(a,[a[0]+n[0],a[1]+n[1],i[0]-r[0],i[1]-r[1],i[0],i[1]]);for(var o=2,l=e.length;o1&&a[1].length<6){var s=a[0].length;a[1]=[2*a[0][s-2]-a[0][s-4],2*a[0][s-1]-a[0][s-3]].concat(a[1])}a[0]=a[0].slice(-2)}return a};function Wa(t,e){return(e[1]-t[1])/(e[0]-t[0])}var Ba=function(){function t(e,a,s){i(this,t),this.ctx=e,this.w=e.w,this.xyRatios=a,this.pointsChart=!("bubble"!==this.w.config.chart.type&&"scatter"!==this.w.config.chart.type)||s,this.scatter=new Ui(this.ctx),this.noNegatives=this.w.globals.minX===Number.MAX_VALUE,this.lineHelpers=new Fa(this),this.markers=new Vi(this.ctx),this.prevSeriesY=[],this.categoryAxisCorrection=0,this.yaxisIndex=0}return s(t,[{key:"draw",value:function(t,e,i,a){var s,r=this.w,n=new Mi(this.ctx),o=r.globals.comboCharts?e:r.config.chart.type,l=n.group({class:"apexcharts-".concat(o,"-series apexcharts-plot-series")}),h=new Pi(this.ctx,r);this.yRatio=this.xyRatios.yRatio,this.zRatio=this.xyRatios.zRatio,this.xRatio=this.xyRatios.xRatio,this.baseLineY=this.xyRatios.baseLineY,t=h.getLogSeries(t),this.yRatio=h.getLogYRatios(this.yRatio),this.prevSeriesY=[];for(var c=[],d=0;d1?g:0;this._initSerieVariables(t,d,g);var f=[],x=[],b=[],m=r.globals.padHorizontal+this.categoryAxisCorrection;this.ctx.series.addCollapsedClassToSeries(this.elSeries,g),r.globals.isXNumeric&&r.globals.seriesX.length>0&&(m=(r.globals.seriesX[g][0]-r.globals.minX)/this.xRatio),b.push(m);var v,y=m,w=void 0,k=y,A=this.zeroY,C=this.zeroY;A=this.lineHelpers.determineFirstPrevY({i:d,realIndex:g,series:t,prevY:A,lineYPosition:0,translationsIndex:p}).prevY,"monotoneCubic"===r.config.stroke.curve&&null===t[d][0]?f.push(null):f.push(A),v=A;"rangeArea"===o&&(w=C=this.lineHelpers.determineFirstPrevY({i:d,realIndex:g,series:a,prevY:C,lineYPosition:0,translationsIndex:p}).prevY,x.push(null!==f[0]?C:null));var S=this._calculatePathsFrom({type:o,series:t,i:d,realIndex:g,translationsIndex:p,prevX:k,prevY:A,prevY2:C}),L=[f[0]],M=[x[0]],P={type:o,series:t,realIndex:g,translationsIndex:p,i:d,x:m,y:1,pX:y,pY:v,pathsFrom:S,linePaths:[],areaPaths:[],seriesIndex:i,lineYPosition:0,xArrj:b,yArrj:f,y2Arrj:x,seriesRangeEnd:a},I=this._iterateOverDataPoints(u(u({},P),{},{iterations:"rangeArea"===o?t[d].length-1:void 0,isRangeStart:!0}));if("rangeArea"===o){for(var T=this._calculatePathsFrom({series:a,i:d,realIndex:g,prevX:k,prevY:C}),z=this._iterateOverDataPoints(u(u({},P),{},{series:a,xArrj:[m],yArrj:L,y2Arrj:M,pY:w,areaPaths:I.areaPaths,pathsFrom:T,iterations:a[d].length-1,isRangeStart:!1})),X=I.linePaths.length/2,R=0;R=0;E--)l.add(c[E]);else for(var Y=0;Y1&&(this.yaxisIndex=a.globals.seriesYAxisReverseMap[i],r=i),this.isReversed=a.config.yaxis[this.yaxisIndex]&&a.config.yaxis[this.yaxisIndex].reversed,this.zeroY=a.globals.gridHeight-this.baseLineY[r]-(this.isReversed?a.globals.gridHeight:0)+(this.isReversed?2*this.baseLineY[r]:0),this.areaBottomY=this.zeroY,(this.zeroY>a.globals.gridHeight||"end"===a.config.plotOptions.area.fillTo)&&(this.areaBottomY=a.globals.gridHeight),this.categoryAxisCorrection=this.xDivision/2,this.elSeries=s.group({class:"apexcharts-series",zIndex:void 0!==a.config.series[i].zIndex?a.config.series[i].zIndex:i,seriesName:v.escapeString(a.globals.seriesNames[i])}),this.elPointsMain=s.group({class:"apexcharts-series-markers-wrap","data:realIndex":i}),a.globals.hasNullValues){var n=this.markers.plotChartMarkers({pointsPos:{x:[0],y:[a.globals.gridHeight+a.globals.markers.largestSize]},seriesIndex:e,j:0,pSize:.1,alwaysDrawMarker:!0,isVirtualPoint:!0});null!==n&&this.elPointsMain.add(n)}this.elDataLabelsWrap=s.group({class:"apexcharts-datalabels","data:realIndex":i});var o=t[e].length===a.globals.dataPoints;this.elSeries.attr({"data:longestSeries":o,rel:e+1,"data:realIndex":i}),this.appendPathFrom=!0}},{key:"_calculatePathsFrom",value:function(t){var e,i,a,s,r=t.type,n=t.series,o=t.i,l=t.realIndex,h=t.translationsIndex,c=t.prevX,d=t.prevY,u=t.prevY2,g=this.w,p=new Mi(this.ctx);if(null===n[o][0]){for(var f=0;f0){var x=this.lineHelpers.checkPreviousPaths({pathFromLine:a,pathFromArea:s,realIndex:l});a=x.pathFromLine,s=x.pathFromArea}return{prevX:c,prevY:d,linePath:e,areaPath:i,pathFromLine:a,pathFromArea:s}}},{key:"_handlePaths",value:function(t){var e=t.type,i=t.realIndex,a=t.i,s=t.paths,r=this.w,n=new Mi(this.ctx),o=new ji(this.ctx);this.prevSeriesY.push(s.yArrj),r.globals.seriesXvalues[i]=s.xArrj,r.globals.seriesYvalues[i]=s.yArrj;var l=r.config.forecastDataPoints;if(l.count>0&&"rangeArea"!==e){var h=r.globals.seriesXvalues[i][r.globals.seriesXvalues[i].length-l.count-1],c=n.drawRect(h,0,r.globals.gridWidth,r.globals.gridHeight,0);r.globals.dom.elForecastMask.appendChild(c.node);var d=n.drawRect(0,0,h,r.globals.gridHeight,0);r.globals.dom.elNonForecastMask.appendChild(d.node)}this.pointsChart||r.globals.delayedElements.push({el:this.elPointsMain.node,index:i});var g={i:a,realIndex:i,animationDelay:a,initialSpeed:r.config.chart.animations.speed,dataChangeSpeed:r.config.chart.animations.dynamicAnimation.speed,className:"apexcharts-".concat(e)};if("area"===e)for(var p=o.fillPath({seriesNumber:i}),f=0;f0&&"rangeArea"!==e){var A=n.renderPaths(w);A.node.setAttribute("stroke-dasharray",l.dashArray),l.strokeWidth&&A.node.setAttribute("stroke-width",l.strokeWidth),this.elSeries.add(A),A.attr("clip-path","url(#forecastMask".concat(r.globals.cuid,")")),k.attr("clip-path","url(#nonForecastMask".concat(r.globals.cuid,")"))}}}}},{key:"_iterateOverDataPoints",value:function(t){var e,i,a=this,s=t.type,r=t.series,n=t.iterations,o=t.realIndex,l=t.translationsIndex,h=t.i,c=t.x,d=t.y,u=t.pX,g=t.pY,p=t.pathsFrom,f=t.linePaths,x=t.areaPaths,b=t.seriesIndex,m=t.lineYPosition,y=t.xArrj,w=t.yArrj,k=t.y2Arrj,A=t.isRangeStart,C=t.seriesRangeEnd,S=this.w,L=new Mi(this.ctx),M=this.yRatio,P=p.prevY,I=p.linePath,T=p.areaPath,z=p.pathFromLine,X=p.pathFromArea,R=v.isNumber(S.globals.minYArr[o])?S.globals.minYArr[o]:S.globals.minY;n||(n=S.globals.dataPoints>1?S.globals.dataPoints-1:S.globals.dataPoints);var E=function(t,e){return e-t/M[l]+2*(a.isReversed?t/M[l]:0)},Y=d,H=S.config.chart.stacked&&!S.globals.comboCharts||S.config.chart.stacked&&S.globals.comboCharts&&(!this.w.config.chart.stackOnlyBar||"bar"===(null===(e=this.w.config.series[o])||void 0===e?void 0:e.type)||"column"===(null===(i=this.w.config.series[o])||void 0===i?void 0:i.type)),O=S.config.stroke.curve;Array.isArray(O)&&(O=Array.isArray(b)?O[b[h]]:O[h]);for(var F,D=0,_=0;_0&&S.globals.collapsedSeries.length0;e--){if(!(S.globals.collapsedSeriesIndices.indexOf((null==b?void 0:b[e])||e)>-1))return e;e--}return 0}(h-1)][_+1]}else m=this.zeroY;else m=this.zeroY;N?d=E(R,m):(d=E(r[h][_+1],m),"rangeArea"===s&&(Y=E(C[h][_+1],m))),y.push(null===r[h][_+1]?null:c),!N||"smooth"!==S.config.stroke.curve&&"monotoneCubic"!==S.config.stroke.curve?(w.push(d),k.push(Y)):(w.push(null),k.push(null));var B=this.lineHelpers.calculatePoints({series:r,x:c,y:d,realIndex:o,i:h,j:_,prevY:P}),G=this._createPaths({type:s,series:r,i:h,realIndex:o,j:_,x:c,y:d,y2:Y,xArrj:y,yArrj:w,y2Arrj:k,pX:u,pY:g,pathState:D,segmentStartX:F,linePath:I,areaPath:T,linePaths:f,areaPaths:x,curve:O,isRangeStart:A});x=G.areaPaths,f=G.linePaths,u=G.pX,g=G.pY,D=G.pathState,F=G.segmentStartX,T=G.areaPath,I=G.linePath,!this.appendPathFrom||S.globals.hasNullValues||"monotoneCubic"===O&&"rangeArea"===s||(z+=L.line(c,this.areaBottomY),X+=L.line(c,this.areaBottomY)),this.handleNullDataPoints(r,B,h,_,o),this._handleMarkersAndLabels({type:s,pointsPos:B,i:h,j:_,realIndex:o,isRangeStart:A})}return{yArrj:w,xArrj:y,pathFromArea:X,areaPaths:x,pathFromLine:z,linePaths:f,linePath:I,areaPath:T}}},{key:"_handleMarkersAndLabels",value:function(t){var e=t.type,i=t.pointsPos,a=t.isRangeStart,s=t.i,r=t.j,n=t.realIndex,o=this.w,l=new qi(this.ctx);if(this.pointsChart)this.scatter.draw(this.elSeries,r,{realIndex:n,pointsPos:i,zRatio:this.zRatio,elParent:this.elPointsMain});else{o.globals.series[s].length>1&&this.elPointsMain.node.classList.add("apexcharts-element-hidden");var h=this.markers.plotChartMarkers({pointsPos:i,seriesIndex:n,j:r+1});null!==h&&this.elPointsMain.add(h)}var c=l.drawDataLabel({type:e,isRangeStart:a,pos:i,i:n,j:r+1});null!==c&&this.elDataLabelsWrap.add(c)}},{key:"_createPaths",value:function(t){var e=t.type,i=t.series,a=t.i;t.realIndex;var s,r=t.j,n=t.x,o=t.y,l=t.xArrj,h=t.yArrj,c=t.y2,d=t.y2Arrj,u=t.pX,g=t.pY,p=t.pathState,f=t.segmentStartX,x=t.linePath,b=t.areaPath,m=t.linePaths,v=t.areaPaths,y=t.curve,w=t.isRangeStart,k=new Mi(this.ctx),A=this.areaBottomY,C="rangeArea"===e,S="rangeArea"===e&&w;switch(y){case"monotoneCubic":var L=w?h:d;switch(p){case 0:if(null===L[r+1])break;p=1;case 1:if(!(C?l.length===i[a].length:r===i[a].length-2))break;case 2:var M=w?l:l.slice().reverse(),P=w?L:L.slice().reverse(),I=(s=P,M.map((function(t,e){return[t,s[e]]})).filter((function(t){return null!==t[1]}))),T=I.length>1?_a(I):I,z=[];C&&(S?v=I:z=v.reverse());var X=0,R=0;if(function(t,e){for(var i=function(t){var e=[],i=0;return t.forEach((function(t){null!==t?i++:i>0&&(e.push(i),i=0)})),i>0&&e.push(i),e}(t),a=[],s=0,r=0;s4?(e+="C".concat(a[0],", ").concat(a[1]),e+=", ".concat(a[2],", ").concat(a[3]),e+=", ".concat(a[4],", ").concat(a[5])):s>2&&(e+="S".concat(a[0],", ").concat(a[1]),e+=", ".concat(a[2],", ").concat(a[3]))}return e}(t),i=R,a=(R+=t.length)-1;S?x=k.move(I[i][0],I[i][1])+e:C?x=k.move(z[i][0],z[i][1])+k.line(I[i][0],I[i][1])+e+k.line(z[a][0],z[a][1]):(x=k.move(I[i][0],I[i][1])+e,b=x+k.line(I[a][0],A)+k.line(I[i][0],A)+"z",v.push(b)),m.push(x)})),C&&X>1&&!S){var E=m.slice(X).reverse();m.splice(X),E.forEach((function(t){return m.push(t)}))}p=0}break;case"smooth":var Y=.35*(n-u);if(null===i[a][r])p=0;else switch(p){case 0:if(f=u,x=S?k.move(u,d[r])+k.line(u,g):k.move(u,g),b=k.move(u,g),null===i[a][r+1]||void 0===i[a][r+1]){m.push(x),v.push(b);break}if(p=1,r=i[a].length-2&&(S&&(x+=k.curve(n,o,n,o,n,c)+k.move(n,c)),b+=k.curve(n,o,n,o,n,A)+k.line(f,A)+"z",m.push(x),v.push(b),p=-1)}}u=n,g=o;break;default:var F=function(t,e,i){var a=[];switch(t){case"stepline":a=k.line(e,null,"H")+k.line(null,i,"V");break;case"linestep":a=k.line(null,i,"V")+k.line(e,null,"H");break;case"straight":a=k.line(e,i)}return a};if(null===i[a][r])p=0;else switch(p){case 0:if(f=u,x=S?k.move(u,d[r])+k.line(u,g):k.move(u,g),b=k.move(u,g),null===i[a][r+1]||void 0===i[a][r+1]){m.push(x),v.push(b);break}if(p=1,r=i[a].length-2&&(S&&(x+=k.line(n,c)),b+=k.line(n,A)+k.line(f,A)+"z",m.push(x),v.push(b),p=-1)}}u=n,g=o}return{linePaths:m,areaPaths:v,pX:u,pY:g,pathState:p,segmentStartX:f,linePath:x,areaPath:b}}},{key:"handleNullDataPoints",value:function(t,e,i,a,s){var r=this.w;if(null===t[i][a]&&r.config.markers.showNullDataPoints||1===t[i].length){var n=this.strokeWidth-r.config.markers.strokeWidth/2;n>0||(n=0);var o=this.markers.plotChartMarkers({pointsPos:e,seriesIndex:s,j:a+1,pSize:n,alwaysDrawMarker:!0});null!==o&&this.elPointsMain.add(o)}}}]),t}();window.TreemapSquared={},window.TreemapSquared.generate=function(){function t(e,i,a,s){this.xoffset=e,this.yoffset=i,this.height=s,this.width=a,this.shortestEdge=function(){return Math.min(this.height,this.width)},this.getCoordinates=function(t){var e,i=[],a=this.xoffset,s=this.yoffset,n=r(t)/this.height,o=r(t)/this.width;if(this.width>=this.height)for(e=0;e=this.height){var a=e/this.height,s=this.width-a;i=new t(this.xoffset+a,this.yoffset,s,this.height)}else{var r=e/this.width,n=this.height-r;i=new t(this.xoffset,this.yoffset+r,this.width,n)}return i}}function e(e,a,s,n,o){n=void 0===n?0:n,o=void 0===o?0:o;var l=i(function(t,e){var i,a=[],s=e/r(t);for(i=0;i=n}(e,l=t[0],o)?(e.push(l),i(t.slice(1),e,s,n)):(h=s.cutArea(r(e),n),n.push(s.getCoordinates(e)),i(t,[],h,n)),n;n.push(s.getCoordinates(e))}function a(t,e){var i=Math.min.apply(Math,t),a=Math.max.apply(Math,t),s=r(t);return Math.max(Math.pow(e,2)*a/Math.pow(s,2),Math.pow(s,2)/(Math.pow(e,2)*i))}function s(t){return t&&t.constructor===Array}function r(t){var e,i=0;for(e=0;e1&&u&&u.show){var g=i.config.series[o].name||"";if(g&&d.xMin<1/0&&d.yMin<1/0){var p=u.offsetX,f=u.offsetY,x=u.borderColor,b=u.borderWidth,m=u.borderRadius,y=u.style,w=y.color||i.config.chart.foreColor,k={left:y.padding.left,right:y.padding.right,top:y.padding.top,bottom:y.padding.bottom},A=a.getTextRects(g,y.fontSize,y.fontFamily),C=A.width+k.left+k.right,S=A.height+k.top+k.bottom,L=d.xMin+(p||0),M=d.yMin+(f||0),P=a.drawRect(L,M,C,S,m,y.background,1,b,x),I=a.drawText({x:L+k.left,y:M+k.top+.75*A.height,text:g,fontSize:y.fontSize,fontFamily:y.fontFamily,fontWeight:y.fontWeight,foreColor:w,cssClass:y.cssClass||""});l.add(P),l.add(I)}}l.add(c),r.add(l)})),r}},{key:"getFontSize",value:function(t){var e=this.w;var i=function t(e){var i,a=0;if(Array.isArray(e[0]))for(i=0;ir-a&&l.width<=n-s){var h=o.rotateAroundCenter(t.node);t.node.setAttribute("transform","rotate(-90 ".concat(h.x," ").concat(h.y,") translate(").concat(l.height/3,")"))}}},{key:"truncateLabels",value:function(t,e,i,a,s,r){var n=new Mi(this.ctx),o=n.getTextRects(t,e).width+this.w.config.stroke.width+5>s-i&&r-a>s-i?r-a:s-i,l=n.getTextBasedOnMaxWidth({text:t,maxWidth:o,fontSize:e});return t.length!==l.length&&o/e<5?"":l}},{key:"animateTreemap",value:function(t,e,i,a){var s=new y(this.ctx);s.animateRect(t,e,i,a,(function(){s.animationCompleted(t)}))}}]),t}(),ja=86400,Va=10/ja,Ua=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.timeScaleArray=[],this.utc=this.w.config.xaxis.labels.datetimeUTC}return s(t,[{key:"calculateTimeScaleTicks",value:function(t,e){var i=this,a=this.w;if(a.globals.allSeriesCollapsed)return a.globals.labels=[],a.globals.timescaleLabels=[],[];var s=new zi(this.ctx),r=(e-t)/864e5;this.determineInterval(r),a.globals.disableZoomIn=!1,a.globals.disableZoomOut=!1,r5e4&&(a.globals.disableZoomOut=!0);var n=s.getTimeUnitsfromTimestamp(t,e,this.utc),o=a.globals.gridWidth/r,l=o/24,h=l/60,c=h/60,d=Math.floor(24*r),g=Math.floor(1440*r),p=Math.floor(r*ja),f=Math.floor(r),x=Math.floor(r/30),b=Math.floor(r/365),m={minMillisecond:n.minMillisecond,minSecond:n.minSecond,minMinute:n.minMinute,minHour:n.minHour,minDate:n.minDate,minMonth:n.minMonth,minYear:n.minYear},v={firstVal:m,currentMillisecond:m.minMillisecond,currentSecond:m.minSecond,currentMinute:m.minMinute,currentHour:m.minHour,currentMonthDate:m.minDate,currentDate:m.minDate,currentMonth:m.minMonth,currentYear:m.minYear,daysWidthOnXAxis:o,hoursWidthOnXAxis:l,minutesWidthOnXAxis:h,secondsWidthOnXAxis:c,numberOfSeconds:p,numberOfMinutes:g,numberOfHours:d,numberOfDays:f,numberOfMonths:x,numberOfYears:b};switch(this.tickInterval){case"years":this.generateYearScale(v);break;case"months":case"half_year":this.generateMonthScale(v);break;case"months_days":case"months_fortnight":case"days":case"week_days":this.generateDayScale(v);break;case"hours":this.generateHourScale(v);break;case"minutes_fives":case"minutes":this.generateMinuteScale(v);break;case"seconds_tens":case"seconds_fives":case"seconds":this.generateSecondScale(v)}var y=this.timeScaleArray.map((function(t){var e={position:t.position,unit:t.unit,year:t.year,day:t.day?t.day:1,hour:t.hour?t.hour:0,month:t.month+1};return"month"===t.unit?u(u({},e),{},{day:1,value:t.value+1}):"day"===t.unit||"hour"===t.unit?u(u({},e),{},{value:t.value}):"minute"===t.unit?u(u({},e),{},{value:t.value,minute:t.value}):"second"===t.unit?u(u({},e),{},{value:t.value,minute:t.minute,second:t.second}):t}));return y.filter((function(t){var e=1,s=Math.ceil(a.globals.gridWidth/120),r=t.value;void 0!==a.config.xaxis.tickAmount&&(s=a.config.xaxis.tickAmount),y.length>s&&(e=Math.floor(y.length/s));var n=!1,o=!1;switch(i.tickInterval){case"years":"year"===t.unit&&(n=!0);break;case"half_year":e=7,"year"===t.unit&&(n=!0);break;case"months":e=1,"year"===t.unit&&(n=!0);break;case"months_fortnight":e=15,"year"!==t.unit&&"month"!==t.unit||(n=!0),30===r&&(o=!0);break;case"months_days":e=10,"month"===t.unit&&(n=!0),30===r&&(o=!0);break;case"week_days":e=8,"month"===t.unit&&(n=!0);break;case"days":e=1,"month"===t.unit&&(n=!0);break;case"hours":"day"===t.unit&&(n=!0);break;case"minutes_fives":case"seconds_fives":r%5!=0&&(o=!0);break;case"seconds_tens":r%10!=0&&(o=!0)}if("hours"===i.tickInterval||"minutes_fives"===i.tickInterval||"seconds_tens"===i.tickInterval||"seconds_fives"===i.tickInterval){if(!o)return!0}else if((r%e==0||n)&&!o)return!0}))}},{key:"recalcDimensionsBasedOnFormat",value:function(t,e){var i=this.w,a=this.formatDates(t),s=this.removeOverlappingTS(a);i.globals.timescaleLabels=s.slice(),new pa(this.ctx).plotCoords()}},{key:"determineInterval",value:function(t){var e=24*t,i=60*e;switch(!0){case t/365>5:this.tickInterval="years";break;case t>800:this.tickInterval="half_year";break;case t>180:this.tickInterval="months";break;case t>90:this.tickInterval="months_fortnight";break;case t>60:this.tickInterval="months_days";break;case t>30:this.tickInterval="week_days";break;case t>2:this.tickInterval="days";break;case e>2.4:this.tickInterval="hours";break;case i>15:this.tickInterval="minutes_fives";break;case i>5:this.tickInterval="minutes";break;case i>1:this.tickInterval="seconds_tens";break;case 60*i>20:this.tickInterval="seconds_fives";break;default:this.tickInterval="seconds"}}},{key:"generateYearScale",value:function(t){var e=t.firstVal,i=t.currentMonth,a=t.currentYear,s=t.daysWidthOnXAxis,r=t.numberOfYears,n=e.minYear,o=0,l=new zi(this.ctx),h="year";if(e.minDate>1||e.minMonth>0){var c=l.determineRemainingDaysOfYear(e.minYear,e.minMonth,e.minDate);o=(l.determineDaysOfYear(e.minYear)-c+1)*s,n=e.minYear+1,this.timeScaleArray.push({position:o,value:n,unit:h,year:n,month:v.monthMod(i+1)})}else 1===e.minDate&&0===e.minMonth&&this.timeScaleArray.push({position:o,value:n,unit:h,year:a,month:v.monthMod(i+1)});for(var d=n,u=o,g=0;g1){l=(h.determineDaysOfMonths(a+1,e.minYear)-i+1)*r,o=v.monthMod(a+1);var u=s+d,g=v.monthMod(o),p=o;0===o&&(c="year",p=u,g=1,u+=d+=1),this.timeScaleArray.push({position:l,value:p,unit:c,year:u,month:g})}else this.timeScaleArray.push({position:l,value:o,unit:c,year:s,month:v.monthMod(a)});for(var f=o+1,x=l,b=0,m=1;bn.determineDaysOfMonths(e+1,i)?(h=1,o="month",u=e+=1,e):e},d=(24-e.minHour)*s,u=l,g=c(h,i,a);0===e.minHour&&1===e.minDate?(d=0,u=v.monthMod(e.minMonth),o="month",h=e.minDate):1!==e.minDate&&0===e.minHour&&0===e.minMinute&&(d=0,l=e.minDate,u=l,g=c(h=l,i,a),1!==u&&(o="day")),this.timeScaleArray.push({position:d,value:u,unit:o,year:this._getYear(a,g,0),month:v.monthMod(g),day:h});for(var p=d,f=0;fo.determineDaysOfMonths(e+1,s)&&(f=1,e+=1),{month:e,date:f}},c=function(t,e){return t>o.determineDaysOfMonths(e+1,s)?e+=1:e},d=60-(e.minMinute+e.minSecond/60),u=d*r,g=e.minHour+1,p=g;60===d&&(u=0,p=g=e.minHour);var f=i;p>=24&&(p=0,l="day",g=f+=1);var x=h(f,a).month;x=c(f,x),g>31&&(g=f=1),this.timeScaleArray.push({position:u,value:g,unit:l,day:f,hour:p,year:s,month:v.monthMod(x)}),p++;for(var b=u,m=0;m=24)p=0,l="day",x=h(f+=1,x).month,x=c(f,x);var y=this._getYear(s,x,0);b=60*r+b;var w=0===p?f:p;this.timeScaleArray.push({position:b,value:w,unit:l,hour:p,day:f,year:y,month:v.monthMod(x)}),p++}}},{key:"generateMinuteScale",value:function(t){for(var e=t.currentMillisecond,i=t.currentSecond,a=t.currentMinute,s=t.currentHour,r=t.currentDate,n=t.currentMonth,o=t.currentYear,l=t.minutesWidthOnXAxis,h=t.secondsWidthOnXAxis,c=t.numberOfMinutes,d=a+1,u=r,g=n,p=o,f=s,x=(60-i-e/1e3)*h,b=0;b=60&&(d=0,24===(f+=1)&&(f=0)),this.timeScaleArray.push({position:x,value:d,unit:"minute",hour:f,minute:d,day:u,year:this._getYear(p,g,0),month:v.monthMod(g)}),x+=l,d++}},{key:"generateSecondScale",value:function(t){for(var e=t.currentMillisecond,i=t.currentSecond,a=t.currentMinute,s=t.currentHour,r=t.currentDate,n=t.currentMonth,o=t.currentYear,l=t.secondsWidthOnXAxis,h=t.numberOfSeconds,c=i+1,d=a,u=r,g=n,p=o,f=s,x=(1e3-e)/1e3*l,b=0;b=60&&(c=0,++d>=60&&(d=0,24===++f&&(f=0))),this.timeScaleArray.push({position:x,value:c,unit:"second",hour:f,minute:d,second:c,day:u,year:this._getYear(p,g,0),month:v.monthMod(g)}),x+=l,c++}},{key:"createRawDateString",value:function(t,e){var i=t.year;return 0===t.month&&(t.month=1),i+="-"+("0"+t.month.toString()).slice(-2),"day"===t.unit?i+="day"===t.unit?"-"+("0"+e).slice(-2):"-01":i+="-"+("0"+(t.day?t.day:"1")).slice(-2),"hour"===t.unit?i+="hour"===t.unit?"T"+("0"+e).slice(-2):"T00":i+="T"+("0"+(t.hour?t.hour:"0")).slice(-2),"minute"===t.unit?i+=":"+("0"+e).slice(-2):i+=":"+(t.minute?("0"+t.minute).slice(-2):"00"),"second"===t.unit?i+=":"+("0"+e).slice(-2):i+=":00",this.utc&&(i+=".000Z"),i}},{key:"formatDates",value:function(t){var e=this,i=this.w;return t.map((function(t){var a=t.value.toString(),s=new zi(e.ctx),r=e.createRawDateString(t,a),n=s.getDate(s.parseDate(r));if(e.utc||(n=s.getDate(s.parseDateWithTimezone(r))),void 0===i.config.xaxis.labels.format){var o="dd MMM",l=i.config.xaxis.labels.datetimeFormatter;"year"===t.unit&&(o=l.year),"month"===t.unit&&(o=l.month),"day"===t.unit&&(o=l.day),"hour"===t.unit&&(o=l.hour),"minute"===t.unit&&(o=l.minute),"second"===t.unit&&(o=l.second),a=s.formatDate(n,o)}else a=s.formatDate(n,i.config.xaxis.labels.format);return{dateString:r,position:t.position,value:a,unit:t.unit,year:t.year,month:t.month}}))}},{key:"removeOverlappingTS",value:function(t){var e,i=this,a=new Mi(this.ctx),s=!1;t.length>0&&t[0].value&&t.every((function(e){return e.value.length===t[0].value.length}))&&(s=!0,e=a.getTextRects(t[0].value).width);var r=0,n=t.map((function(n,o){if(o>0&&i.w.config.xaxis.labels.hideOverlappingLabels){var l=s?e:a.getTextRects(t[r].value).width,h=t[r].position;return n.position>h+l+10?(r=o,n):null}return n}));return n=n.filter((function(t){return null!==t}))}},{key:"_getYear",value:function(t,e,i){return t+Math.floor(e/12)+i}}]),t}(),qa=function(){function t(e,a){i(this,t),this.ctx=a,this.w=a.w,this.el=e}return s(t,[{key:"setupElements",value:function(){var t=this.w,e=t.globals,i=t.config,a=i.chart.type;e.axisCharts=["line","area","bar","rangeBar","rangeArea","candlestick","boxPlot","scatter","bubble","radar","heatmap","treemap"].includes(a),e.xyCharts=["line","area","bar","rangeBar","rangeArea","candlestick","boxPlot","scatter","bubble"].includes(a),e.isBarHorizontal=["bar","rangeBar","boxPlot"].includes(a)&&i.plotOptions.bar.horizontal,e.chartClass=".apexcharts".concat(e.chartID),e.dom.baseEl=this.el,e.dom.elWrap=document.createElement("div"),Mi.setAttrs(e.dom.elWrap,{id:e.chartClass.substring(1),class:"apexcharts-canvas ".concat(e.chartClass.substring(1))}),this.el.appendChild(e.dom.elWrap),e.dom.Paper=window.SVG().addTo(e.dom.elWrap),e.dom.Paper.attr({class:"apexcharts-svg","xmlns:data":"ApexChartsNS",transform:"translate(".concat(i.chart.offsetX,", ").concat(i.chart.offsetY,")")}),e.dom.Paper.node.style.background="dark"!==i.theme.mode||i.chart.background?"light"!==i.theme.mode||i.chart.background?i.chart.background:"#fff":"#424242",this.setSVGDimensions(),e.dom.elLegendForeign=document.createElementNS(e.SVGNS,"foreignObject"),Mi.setAttrs(e.dom.elLegendForeign,{x:0,y:0,width:e.svgWidth,height:e.svgHeight}),e.dom.elLegendWrap=document.createElement("div"),e.dom.elLegendWrap.classList.add("apexcharts-legend"),e.dom.elWrap.appendChild(e.dom.elLegendWrap),e.dom.Paper.node.appendChild(e.dom.elLegendForeign),e.dom.elGraphical=e.dom.Paper.group().attr({class:"apexcharts-inner apexcharts-graphical"}),e.dom.elDefs=e.dom.Paper.defs(),e.dom.Paper.add(e.dom.elGraphical),e.dom.elGraphical.add(e.dom.elDefs)}},{key:"plotChartType",value:function(t,e){var i=this.w,a=this.ctx,s=i.config,r=i.globals,n={line:{series:[],i:[]},area:{series:[],i:[]},scatter:{series:[],i:[]},bubble:{series:[],i:[]},bar:{series:[],i:[]},candlestick:{series:[],i:[]},boxPlot:{series:[],i:[]},rangeBar:{series:[],i:[]},rangeArea:{series:[],seriesRangeEnd:[],i:[]}},o=s.chart.type||"line",l=null,h=0;r.series.forEach((function(e,a){var s="column"===t[a].type?"bar":t[a].type||("column"===o?"bar":o);n[s]?("rangeArea"===s?(n[s].series.push(r.seriesRangeStart[a]),n[s].seriesRangeEnd.push(r.seriesRangeEnd[a])):n[s].series.push(e),n[s].i.push(a),"bar"===s&&(i.globals.columnSeries=n.bar)):["heatmap","treemap","pie","donut","polarArea","radialBar","radar"].includes(s)?l=s:console.warn("You have specified an unrecognized series type (".concat(s,").")),o!==s&&"scatter"!==s&&h++})),h>0&&(l&&console.warn("Chart or series type ".concat(l," cannot appear with other chart or series types.")),n.bar.series.length>0&&s.plotOptions.bar.horizontal&&(h-=n.bar.series.length,n.bar={series:[],i:[]},i.globals.columnSeries={series:[],i:[]},console.warn("Horizontal bars are not supported in a mixed/combo chart. Please turn off `plotOptions.bar.horizontal`"))),r.comboCharts||(r.comboCharts=h>0);var c=new Ba(a,e),d=new Ta(a,e);a.pie=new Ea(a);var u=new Ha(a);a.rangeBar=new Oa(a,e);var g=new Ya(a),p=[];if(r.comboCharts){var x,b,m=new Pi(a);if(n.area.series.length>0)(x=p).push.apply(x,f(m.drawSeriesByGroup(n.area,r.areaGroups,"area",c)));if(n.bar.series.length>0)if(s.chart.stacked){var v=new Ia(a,e);p.push(v.draw(n.bar.series,n.bar.i))}else a.bar=new Pa(a,e),p.push(a.bar.draw(n.bar.series,n.bar.i));if(n.rangeArea.series.length>0&&p.push(c.draw(n.rangeArea.series,"rangeArea",n.rangeArea.i,n.rangeArea.seriesRangeEnd)),n.line.series.length>0)(b=p).push.apply(b,f(m.drawSeriesByGroup(n.line,r.lineGroups,"line",c)));if(n.candlestick.series.length>0&&p.push(d.draw(n.candlestick.series,"candlestick",n.candlestick.i)),n.boxPlot.series.length>0&&p.push(d.draw(n.boxPlot.series,"boxPlot",n.boxPlot.i)),n.rangeBar.series.length>0&&p.push(a.rangeBar.draw(n.rangeBar.series,n.rangeBar.i)),n.scatter.series.length>0){var y=new Ba(a,e,!0);p.push(y.draw(n.scatter.series,"scatter",n.scatter.i))}if(n.bubble.series.length>0){var w=new Ba(a,e,!0);p.push(w.draw(n.bubble.series,"bubble",n.bubble.i))}}else switch(s.chart.type){case"line":p=c.draw(r.series,"line");break;case"area":p=c.draw(r.series,"area");break;case"bar":if(s.chart.stacked)p=new Ia(a,e).draw(r.series);else a.bar=new Pa(a,e),p=a.bar.draw(r.series);break;case"candlestick":p=new Ta(a,e).draw(r.series,"candlestick");break;case"boxPlot":p=new Ta(a,e).draw(r.series,s.chart.type);break;case"rangeBar":p=a.rangeBar.draw(r.series);break;case"rangeArea":p=c.draw(r.seriesRangeStart,"rangeArea",void 0,r.seriesRangeEnd);break;case"heatmap":p=new Xa(a,e).draw(r.series);break;case"treemap":p=new Ga(a,e).draw(r.series);break;case"pie":case"donut":case"polarArea":p=a.pie.draw(r.series);break;case"radialBar":p=u.draw(r.series);break;case"radar":p=g.draw(r.series);break;default:p=c.draw(r.series)}return p}},{key:"setSVGDimensions",value:function(){var t=this.w,e=t.globals,i=t.config;i.chart.width=i.chart.width||"100%",i.chart.height=i.chart.height||"auto",e.svgWidth=i.chart.width,e.svgHeight=i.chart.height;var a=v.getDimensions(this.el),s=i.chart.width.toString().split(/[0-9]+/g).pop();"%"===s?v.isNumber(a[0])&&(0===a[0].width&&(a=v.getDimensions(this.el.parentNode)),e.svgWidth=a[0]*parseInt(i.chart.width,10)/100):"px"!==s&&""!==s||(e.svgWidth=parseInt(i.chart.width,10));var r=String(i.chart.height).toString().split(/[0-9]+/g).pop();if("auto"!==e.svgHeight&&""!==e.svgHeight)if("%"===r){var n=v.getDimensions(this.el.parentNode);e.svgHeight=n[1]*parseInt(i.chart.height,10)/100}else e.svgHeight=parseInt(i.chart.height,10);else e.svgHeight=e.axisCharts?e.svgWidth/1.61:e.svgWidth/1.2;if(e.svgWidth=Math.max(e.svgWidth,0),e.svgHeight=Math.max(e.svgHeight,0),Mi.setAttrs(e.dom.Paper.node,{width:e.svgWidth,height:e.svgHeight}),"%"!==r){var o=i.chart.sparkline.enabled?0:e.axisCharts?i.chart.parentHeightOffset:0;e.dom.Paper.node.parentNode.parentNode.style.minHeight="".concat(e.svgHeight+o,"px")}e.dom.elWrap.style.width="".concat(e.svgWidth,"px"),e.dom.elWrap.style.height="".concat(e.svgHeight,"px")}},{key:"shiftGraphPosition",value:function(){var t=this.w.globals,e=t.translateY,i=t.translateX;Mi.setAttrs(t.dom.elGraphical.node,{transform:"translate(".concat(i,", ").concat(e,")")})}},{key:"resizeNonAxisCharts",value:function(){var t=this.w,e=t.globals,i=0,a=t.config.chart.sparkline.enabled?1:15;a+=t.config.grid.padding.bottom,["top","bottom"].includes(t.config.legend.position)&&t.config.legend.show&&!t.config.legend.floating&&(i=new xa(this.ctx).legendHelpers.getLegendDimensions().clwh+7);var s=t.globals.dom.baseEl.querySelector(".apexcharts-radialbar, .apexcharts-pie"),r=2.05*t.globals.radialSize;if(s&&!t.config.chart.sparkline.enabled&&0!==t.config.plotOptions.radialBar.startAngle){var n=v.getBoundingClientRect(s);r=n.bottom;var o=n.bottom-n.top;r=Math.max(2.05*t.globals.radialSize,o)}var l=Math.ceil(r+e.translateY+i+a);e.dom.elLegendForeign&&e.dom.elLegendForeign.setAttribute("height",l),t.config.chart.height&&String(t.config.chart.height).includes("%")||(e.dom.elWrap.style.height="".concat(l,"px"),Mi.setAttrs(e.dom.Paper.node,{height:l}),e.dom.Paper.node.parentNode.parentNode.style.minHeight="".concat(l,"px"))}},{key:"coreCalculations",value:function(){new ea(this.ctx).init()}},{key:"resetGlobals",value:function(){var t=this,e=function(){return t.w.config.series.map((function(){return[]}))},i=new Bi,a=this.w.globals;i.initGlobalVars(a),a.seriesXvalues=e(),a.seriesYvalues=e()}},{key:"isMultipleY",value:function(){return!!(Array.isArray(this.w.config.yaxis)&&this.w.config.yaxis.length>1)&&(this.w.globals.isMultipleYAxis=!0,!0)}},{key:"xySettings",value:function(){var t=this.w,e=null;if(t.globals.axisCharts){if("back"===t.config.xaxis.crosshairs.position&&new na(this.ctx).drawXCrosshairs(),"back"===t.config.yaxis[0].crosshairs.position&&new na(this.ctx).drawYCrosshairs(),"datetime"===t.config.xaxis.type&&void 0===t.config.xaxis.labels.formatter){this.ctx.timeScale=new Ua(this.ctx);var i=[];isFinite(t.globals.minX)&&isFinite(t.globals.maxX)&&!t.globals.isBarHorizontal?i=this.ctx.timeScale.calculateTimeScaleTicks(t.globals.minX,t.globals.maxX):t.globals.isBarHorizontal&&(i=this.ctx.timeScale.calculateTimeScaleTicks(t.globals.minY,t.globals.maxY)),this.ctx.timeScale.recalcDimensionsBasedOnFormat(i)}e=new Pi(this.ctx).getCalculatedRatios()}return e}},{key:"updateSourceChart",value:function(t){this.ctx.w.globals.selection=void 0,this.ctx.updateHelpers._updateOptions({chart:{selection:{xaxis:{min:t.w.globals.minX,max:t.w.globals.maxX}}}},!1,!1)}},{key:"setupBrushHandler",value:function(){var t=this,e=this.ctx,i=this.w;if(i.config.chart.brush.enabled&&"function"!=typeof i.config.chart.events.selection){var a=Array.isArray(i.config.chart.brush.targets)?i.config.chart.brush.targets:[i.config.chart.brush.target];a.forEach((function(i){var a=e.constructor.getChartByID(i);a.w.globals.brushSource=t.ctx,"function"!=typeof a.w.config.chart.events.zoomed&&(a.w.config.chart.events.zoomed=function(){return t.updateSourceChart(a)}),"function"!=typeof a.w.config.chart.events.scrolled&&(a.w.config.chart.events.scrolled=function(){return t.updateSourceChart(a)})})),i.config.chart.events.selection=function(t,i){a.forEach((function(t){e.constructor.getChartByID(t).ctx.updateHelpers._updateOptions({xaxis:{min:i.xaxis.min,max:i.xaxis.max}},!1,!1,!1,!1)}))}}}}]),t}(),Za=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"_updateOptions",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return new Promise((function(n){var o=[e.ctx];s&&(o=e.ctx.getSyncedCharts()),e.ctx.w.globals.isExecCalled&&(o=[e.ctx],e.ctx.w.globals.isExecCalled=!1),o.forEach((function(s,l){var h=s.w;if(h.globals.shouldAnimate=a,i||(h.globals.resized=!0,h.globals.dataChanged=!0,a&&s.series.getPreviousPaths()),t&&"object"===b(t)&&(s.config=new Wi(t),t=Pi.extendArrayProps(s.config,t,h),s.w.globals.chartID!==e.ctx.w.globals.chartID&&delete t.series,h.config=v.extend(h.config,t),r&&(h.globals.lastXAxis=t.xaxis?v.clone(t.xaxis):[],h.globals.lastYAxis=t.yaxis?v.clone(t.yaxis):[],h.globals.initialConfig=v.extend({},h.config),h.globals.initialSeries=v.clone(h.config.series),t.series))){for(var c=0;c2&&void 0!==arguments[2]&&arguments[2];return new Promise((function(s){var r,n=i.w;return n.globals.shouldAnimate=e,n.globals.dataChanged=!0,e&&i.ctx.series.getPreviousPaths(),n.globals.axisCharts?(0===(r=t.map((function(t,e){return i._extendSeries(t,e)}))).length&&(r=[{data:[]}]),n.config.series=r):n.config.series=t.slice(),a&&(n.globals.initialConfig.series=v.clone(n.config.series),n.globals.initialSeries=v.clone(n.config.series)),i.ctx.update().then((function(){s(i.ctx)}))}))}},{key:"_extendSeries",value:function(t,e){var i=this.w,a=i.config.series[e];return u(u({},i.config.series[e]),{},{name:t.name?t.name:null==a?void 0:a.name,color:t.color?t.color:null==a?void 0:a.color,type:t.type?t.type:null==a?void 0:a.type,group:t.group?t.group:null==a?void 0:a.group,hidden:void 0!==t.hidden?t.hidden:null==a?void 0:a.hidden,data:t.data?t.data:null==a?void 0:a.data,zIndex:void 0!==t.zIndex?t.zIndex:e})}},{key:"toggleDataPointSelection",value:function(t,e){var i=this.w,a=null,s=".apexcharts-series[data\\:realIndex='".concat(t,"']");return i.globals.axisCharts?a=i.globals.dom.Paper.findOne("".concat(s," path[j='").concat(e,"'], ").concat(s," circle[j='").concat(e,"'], ").concat(s," rect[j='").concat(e,"']")):void 0===e&&(a=i.globals.dom.Paper.findOne("".concat(s," path[j='").concat(t,"']")),"pie"!==i.config.chart.type&&"polarArea"!==i.config.chart.type&&"donut"!==i.config.chart.type||this.ctx.pie.pieClicked(t)),a?(new Mi(this.ctx).pathMouseDown(a,null),a.node?a.node:null):(console.warn("toggleDataPointSelection: Element not found"),null)}},{key:"forceXAxisUpdate",value:function(t){var e=this.w;if(["min","max"].forEach((function(i){void 0!==t.xaxis[i]&&(e.config.xaxis[i]=t.xaxis[i],e.globals.lastXAxis[i]=t.xaxis[i])})),t.xaxis.categories&&t.xaxis.categories.length&&(e.config.xaxis.categories=t.xaxis.categories),e.config.xaxis.convertedCatToNumeric){var i=new Ni(t);t=i.convertCatToNumericXaxis(t,this.ctx)}return t}},{key:"forceYAxisUpdate",value:function(t){return t.chart&&t.chart.stacked&&"100%"===t.chart.stackType&&(Array.isArray(t.yaxis)?t.yaxis.forEach((function(e,i){t.yaxis[i].min=0,t.yaxis[i].max=100})):(t.yaxis.min=0,t.yaxis.max=100)),t}},{key:"revertDefaultAxisMinMax",value:function(t){var e=this,i=this.w,a=i.globals.lastXAxis,s=i.globals.lastYAxis;t&&t.xaxis&&(a=t.xaxis),t&&t.yaxis&&(s=t.yaxis),i.config.xaxis.min=a.min,i.config.xaxis.max=a.max;var r=function(t){void 0!==s[t]&&(i.config.yaxis[t].min=s[t].min,i.config.yaxis[t].max=s[t].max)};i.config.yaxis.map((function(t,a){i.globals.zoomed||void 0!==s[a]?r(a):void 0!==e.ctx.opts.yaxis[a]&&(t.min=e.ctx.opts.yaxis[a].min,t.max=e.ctx.opts.yaxis[a].max)}))}}]),t}();!function(){function t(){for(var t=arguments.length>0&&arguments[0]!==h?arguments[0]:[],s=arguments.length>1?arguments[1]:h,r=arguments.length>2?arguments[2]:h,n=arguments.length>3?arguments[3]:h,o=arguments.length>4?arguments[4]:h,l=arguments.length>5?arguments[5]:h,h=arguments.length>6?arguments[6]:h,c=t.slice(s,r||h),d=n.slice(o,l||h),u=0,g={pos:[0,0],start:[0,0]},p={pos:[0,0],start:[0,0]};;){if(c[u]=e.call(g,c[u]),d[u]=e.call(p,d[u]),c[u][0]!=d[u][0]||"M"==c[u][0]||"A"==c[u][0]&&(c[u][4]!=d[u][4]||c[u][5]!=d[u][5])?(Array.prototype.splice.apply(c,[u,1].concat(a.call(g,c[u]))),Array.prototype.splice.apply(d,[u,1].concat(a.call(p,d[u])))):(c[u]=i.call(g,c[u]),d[u]=i.call(p,d[u])),++u==c.length&&u==d.length)break;u==c.length&&c.push(["C",g.pos[0],g.pos[1],g.pos[0],g.pos[1],g.pos[0],g.pos[1]]),u==d.length&&d.push(["C",p.pos[0],p.pos[1],p.pos[0],p.pos[1],p.pos[0],p.pos[1]])}return{start:c,dest:d}}function e(t){switch(t[0]){case"z":case"Z":t[0]="L",t[1]=this.start[0],t[2]=this.start[1];break;case"H":t[0]="L",t[2]=this.pos[1];break;case"V":t[0]="L",t[2]=t[1],t[1]=this.pos[0];break;case"T":t[0]="Q",t[3]=t[1],t[4]=t[2],t[1]=this.reflection[1],t[2]=this.reflection[0];break;case"S":t[0]="C",t[6]=t[4],t[5]=t[3],t[4]=t[2],t[3]=t[1],t[2]=this.reflection[1],t[1]=this.reflection[0]}return t}function i(t){var e=t.length;return this.pos=[t[e-2],t[e-1]],-1!="SCQT".indexOf(t[0])&&(this.reflection=[2*this.pos[0]-t[e-4],2*this.pos[1]-t[e-3]]),t}function a(t){var e=[t];switch(t[0]){case"M":return this.pos=this.start=[t[1],t[2]],e;case"L":t[5]=t[3]=t[1],t[6]=t[4]=t[2],t[1]=this.pos[0],t[2]=this.pos[1];break;case"Q":t[6]=t[4],t[5]=t[3],t[4]=1*t[4]/3+2*t[2]/3,t[3]=1*t[3]/3+2*t[1]/3,t[2]=1*this.pos[1]/3+2*t[2]/3,t[1]=1*this.pos[0]/3+2*t[1]/3;break;case"A":e=function(t,e){var i,a,s,r,n,o,l,h,c,d,u,g,p,f,x,b,m,v,y,w,k,A,C,S,L,M,P=Math.abs(e[1]),I=Math.abs(e[2]),T=e[3]%360,z=e[4],X=e[5],R=e[6],E=e[7],Y=new bt(t),H=new bt(R,E),O=[];if(0===P||0===I||Y.x===H.x&&Y.y===H.y)return[["C",Y.x,Y.y,H.x,H.y,H.x,H.y]];i=new bt((Y.x-H.x)/2,(Y.y-H.y)/2).transform((new vt).rotate(T)),a=i.x*i.x/(P*P)+i.y*i.y/(I*I),a>1&&(P*=a=Math.sqrt(a),I*=a);s=(new vt).rotate(T).scale(1/P,1/I).rotate(-T),Y=Y.transform(s),H=H.transform(s),r=[H.x-Y.x,H.y-Y.y],o=r[0]*r[0]+r[1]*r[1],n=Math.sqrt(o),r[0]/=n,r[1]/=n,l=o<4?Math.sqrt(1-o/4):0,z===X&&(l*=-1);h=new bt((H.x+Y.x)/2+l*-r[1],(H.y+Y.y)/2+l*r[0]),c=new bt(Y.x-h.x,Y.y-h.y),d=new bt(H.x-h.x,H.y-h.y),u=Math.acos(c.x/Math.sqrt(c.x*c.x+c.y*c.y)),c.y<0&&(u*=-1);g=Math.acos(d.x/Math.sqrt(d.x*d.x+d.y*d.y)),d.y<0&&(g*=-1);X&&u>g&&(g+=2*Math.PI);!X&&u0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1?arguments[1]:void 0;if(!1===e)return!1;for(var i=e,a=t.length;i(t.changedTouches&&(t=t.changedTouches[0]),{x:t.clientX,y:t.clientY});class Ja{constructor(t){t.remember("_draggable",this),this.el=t,this.drag=this.drag.bind(this),this.startDrag=this.startDrag.bind(this),this.endDrag=this.endDrag.bind(this)}init(t){t?(this.el.on("mousedown.drag",this.startDrag),this.el.on("touchstart.drag",this.startDrag,{passive:!1})):(this.el.off("mousedown.drag"),this.el.off("touchstart.drag"))}startDrag(t){const e=!t.type.indexOf("mouse");if(e&&1!==t.which&&0!==t.buttons)return;if(this.el.dispatch("beforedrag",{event:t,handler:this}).defaultPrevented)return;t.preventDefault(),t.stopPropagation(),this.init(!1),this.box=this.el.bbox(),this.lastClick=this.el.point($a(t));const i=(e?"mouseup":"touchend")+".drag";zt(window,(e?"mousemove":"touchmove")+".drag",this.drag,this,{passive:!1}),zt(window,i,this.endDrag,this,{passive:!1}),this.el.fire("dragstart",{event:t,handler:this,box:this.box})}drag(t){const{box:e,lastClick:i}=this,a=this.el.point($a(t)),s=a.x-i.x,r=a.y-i.y;if(!s&&!r)return e;const n=e.x+s,o=e.y+r;this.box=new kt(n,o,e.w,e.h),this.lastClick=a,this.el.dispatch("dragmove",{event:t,handler:this,box:this.box}).defaultPrevented||this.move(n,o)}move(t,e){"svg"===this.el.type?gi.prototype.move.call(this.el,t,e):this.el.move(t,e)}endDrag(t){this.drag(t),this.el.fire("dragend",{event:t,handler:this,box:this.box}),Xt(window,"mousemove.drag"),Xt(window,"touchmove.drag"),Xt(window,"mouseup.drag"),Xt(window,"touchend.drag"),this.init(!0)}} +/*! +* @svgdotjs/svg.select.js - An extension of svg.js which allows to select elements with mouse +* @version 4.0.1 +* https://github.com/svgdotjs/svg.select.js +* +* @copyright Ulrich-Matthias Schäfer +* @license MIT +* +* BUILT: Mon Jul 01 2024 15:04:42 GMT+0200 (Central European Summer Time) +*/ +function Qa(t,e,i,a=null){return function(s){s.preventDefault(),s.stopPropagation();var r=s.pageX||s.touches[0].pageX,n=s.pageY||s.touches[0].pageY;e.fire(t,{x:r,y:n,event:s,index:a,points:i})}}function Ka([t,e],{a:i,b:a,c:s,d:r,e:n,f:o}){return[t*i+e*s+n,t*a+e*r+o]}Q(Gt,{draggable(t=!0){return(this.remember("_draggable")||new Ja(this)).init(t),this}});let ts=class{constructor(t){this.el=t,t.remember("_selectHandler",this),this.selection=new gi,this.order=["lt","t","rt","r","rb","b","lb","l","rot"],this.mutationHandler=this.mutationHandler.bind(this);const e=F();this.observer=new e.MutationObserver(this.mutationHandler)}init(t){this.createHandle=t.createHandle||this.createHandleFn,this.createRot=t.createRot||this.createRotFn,this.updateHandle=t.updateHandle||this.updateHandleFn,this.updateRot=t.updateRot||this.updateRotFn,this.el.root().put(this.selection),this.updatePoints(),this.createSelection(),this.createResizeHandles(),this.updateResizeHandles(),this.createRotationHandle(),this.updateRotationHandle(),this.observer.observe(this.el.node,{attributes:!0})}active(t,e){if(!t)return this.selection.clear().remove(),void this.observer.disconnect();this.init(e)}createSelection(){this.selection.polygon(this.handlePoints).addClass("svg_select_shape")}updateSelection(){this.selection.get(0).plot(this.handlePoints)}createResizeHandles(){this.handlePoints.forEach(((t,e,i)=>{const a=this.order[e];this.createHandle.call(this,this.selection,t,e,i,a),this.selection.get(e+1).addClass("svg_select_handle svg_select_handle_"+a).on("mousedown.selection touchstart.selection",Qa(a,this.el,this.handlePoints,e))}))}createHandleFn(t){t.polyline()}updateHandleFn(t,e,i,a){const s=a.at(i-1),r=a[(i+1)%a.length],n=e,o=[n[0]-s[0],n[1]-s[1]],l=[n[0]-r[0],n[1]-r[1]],h=Math.sqrt(o[0]*o[0]+o[1]*o[1]),c=Math.sqrt(l[0]*l[0]+l[1]*l[1]),d=[o[0]/h,o[1]/h],u=[l[0]/c,l[1]/c],g=[n[0]-10*d[0],n[1]-10*d[1]],p=[n[0]-10*u[0],n[1]-10*u[1]];t.plot([g,n,p])}updateResizeHandles(){this.handlePoints.forEach(((t,e,i)=>{const a=this.order[e];this.updateHandle.call(this,this.selection.get(e+1),t,e,i,a)}))}createRotFn(t){t.line(),t.circle(5)}getPoint(t){return this.handlePoints[this.order.indexOf(t)]}getPointHandle(t){return this.selection.get(this.order.indexOf(t)+1)}updateRotFn(t,e){const i=this.getPoint("t");t.get(0).plot(i[0],i[1],e[0],e[1]),t.get(1).center(e[0],e[1])}createRotationHandle(){const t=this.selection.group().addClass("svg_select_handle_rot").on("mousedown.selection touchstart.selection",Qa("rot",this.el,this.handlePoints));this.createRot.call(this,t)}updateRotationHandle(){const t=this.selection.findOne("g.svg_select_handle_rot");this.updateRot(t,this.rotationPoint,this.handlePoints)}updatePoints(){const t=this.el.bbox(),e=this.el.parent().screenCTM().inverseO().multiplyO(this.el.screenCTM());this.handlePoints=this.getHandlePoints(t).map((t=>Ka(t,e))),this.rotationPoint=Ka(this.getRotationPoint(t),e)}getHandlePoints({x:t,x2:e,y:i,y2:a,cx:s,cy:r}=this.el.bbox()){return[[t,i],[s,i],[e,i],[e,r],[e,a],[s,a],[t,a],[t,r]]}getRotationPoint({y:t,cx:e}=this.el.bbox()){return[e,t-20]}mutationHandler(){this.updatePoints(),this.updateSelection(),this.updateResizeHandles(),this.updateRotationHandle()}};const es=t=>function(e=!0,i={}){"object"==typeof e&&(i=e,e=!0);let a=this.remember("_"+t.name);return a||(e.prototype instanceof ts?(a=new e(this),e=!0):a=new t(this),this.remember("_"+t.name,a)),a.active(e,i),this}; +/*! +* @svgdotjs/svg.resize.js - An extension for svg.js which allows to resize elements which are selected +* @version 2.0.4 +* https://github.com/svgdotjs/svg.resize.js +* +* @copyright [object Object] +* @license MIT +* +* BUILT: Fri Sep 13 2024 12:43:14 GMT+0200 (Central European Summer Time) +*/ +/*! +* @svgdotjs/svg.select.js - An extension of svg.js which allows to select elements with mouse +* @version 4.0.1 +* https://github.com/svgdotjs/svg.select.js +* +* @copyright Ulrich-Matthias Schäfer +* @license MIT +* +* BUILT: Mon Jul 01 2024 15:04:42 GMT+0200 (Central European Summer Time) +*/ +function is(t,e,i,a=null){return function(s){s.preventDefault(),s.stopPropagation();var r=s.pageX||s.touches[0].pageX,n=s.pageY||s.touches[0].pageY;e.fire(t,{x:r,y:n,event:s,index:a,points:i})}}function as([t,e],{a:i,b:a,c:s,d:r,e:n,f:o}){return[t*i+e*s+n,t*a+e*r+o]}Q(Gt,{select:es(ts)}),Q([Ge,je,xe],{pointSelect:es(class{constructor(t){this.el=t,t.remember("_pointSelectHandler",this),this.selection=new gi,this.order=["lt","t","rt","r","rb","b","lb","l","rot"],this.mutationHandler=this.mutationHandler.bind(this);const e=F();this.observer=new e.MutationObserver(this.mutationHandler)}init(t){this.createHandle=t.createHandle||this.createHandleFn,this.updateHandle=t.updateHandle||this.updateHandleFn,this.el.root().put(this.selection),this.updatePoints(),this.createSelection(),this.createPointHandles(),this.updatePointHandles(),this.observer.observe(this.el.node,{attributes:!0})}active(t,e){if(!t)return this.selection.clear().remove(),void this.observer.disconnect();this.init(e)}createSelection(){this.selection.polygon(this.points).addClass("svg_select_shape_pointSelect")}updateSelection(){this.selection.get(0).plot(this.points)}createPointHandles(){this.points.forEach(((t,e,i)=>{this.createHandle.call(this,this.selection,t,e,i),this.selection.get(e+1).addClass("svg_select_handle_point").on("mousedown.selection touchstart.selection",Qa("point",this.el,this.points,e))}))}createHandleFn(t){t.circle(5)}updateHandleFn(t,e){t.center(e[0],e[1])}updatePointHandles(){this.points.forEach(((t,e,i)=>{this.updateHandle.call(this,this.selection.get(e+1),t,e,i)}))}updatePoints(){const t=this.el.parent().screenCTM().inverseO().multiplyO(this.el.screenCTM());this.points=this.el.array().map((e=>Ka(e,t)))}mutationHandler(){this.updatePoints(),this.updateSelection(),this.updatePointHandles()}})});class ss{constructor(t){this.el=t,t.remember("_selectHandler",this),this.selection=new gi,this.order=["lt","t","rt","r","rb","b","lb","l","rot"],this.mutationHandler=this.mutationHandler.bind(this);const e=F();this.observer=new e.MutationObserver(this.mutationHandler)}init(t){this.createHandle=t.createHandle||this.createHandleFn,this.createRot=t.createRot||this.createRotFn,this.updateHandle=t.updateHandle||this.updateHandleFn,this.updateRot=t.updateRot||this.updateRotFn,this.el.root().put(this.selection),this.updatePoints(),this.createSelection(),this.createResizeHandles(),this.updateResizeHandles(),this.createRotationHandle(),this.updateRotationHandle(),this.observer.observe(this.el.node,{attributes:!0})}active(t,e){if(!t)return this.selection.clear().remove(),void this.observer.disconnect();this.init(e)}createSelection(){this.selection.polygon(this.handlePoints).addClass("svg_select_shape")}updateSelection(){this.selection.get(0).plot(this.handlePoints)}createResizeHandles(){this.handlePoints.forEach(((t,e,i)=>{const a=this.order[e];this.createHandle.call(this,this.selection,t,e,i,a),this.selection.get(e+1).addClass("svg_select_handle svg_select_handle_"+a).on("mousedown.selection touchstart.selection",is(a,this.el,this.handlePoints,e))}))}createHandleFn(t){t.polyline()}updateHandleFn(t,e,i,a){const s=a.at(i-1),r=a[(i+1)%a.length],n=e,o=[n[0]-s[0],n[1]-s[1]],l=[n[0]-r[0],n[1]-r[1]],h=Math.sqrt(o[0]*o[0]+o[1]*o[1]),c=Math.sqrt(l[0]*l[0]+l[1]*l[1]),d=[o[0]/h,o[1]/h],u=[l[0]/c,l[1]/c],g=[n[0]-10*d[0],n[1]-10*d[1]],p=[n[0]-10*u[0],n[1]-10*u[1]];t.plot([g,n,p])}updateResizeHandles(){this.handlePoints.forEach(((t,e,i)=>{const a=this.order[e];this.updateHandle.call(this,this.selection.get(e+1),t,e,i,a)}))}createRotFn(t){t.line(),t.circle(5)}getPoint(t){return this.handlePoints[this.order.indexOf(t)]}getPointHandle(t){return this.selection.get(this.order.indexOf(t)+1)}updateRotFn(t,e){const i=this.getPoint("t");t.get(0).plot(i[0],i[1],e[0],e[1]),t.get(1).center(e[0],e[1])}createRotationHandle(){const t=this.selection.group().addClass("svg_select_handle_rot").on("mousedown.selection touchstart.selection",is("rot",this.el,this.handlePoints));this.createRot.call(this,t)}updateRotationHandle(){const t=this.selection.findOne("g.svg_select_handle_rot");this.updateRot(t,this.rotationPoint,this.handlePoints)}updatePoints(){const t=this.el.bbox(),e=this.el.parent().screenCTM().inverseO().multiplyO(this.el.screenCTM());this.handlePoints=this.getHandlePoints(t).map((t=>as(t,e))),this.rotationPoint=as(this.getRotationPoint(t),e)}getHandlePoints({x:t,x2:e,y:i,y2:a,cx:s,cy:r}=this.el.bbox()){return[[t,i],[s,i],[e,i],[e,r],[e,a],[s,a],[t,a],[t,r]]}getRotationPoint({y:t,cx:e}=this.el.bbox()){return[e,t-20]}mutationHandler(){this.updatePoints(),this.updateSelection(),this.updateResizeHandles(),this.updateRotationHandle()}}const rs=t=>function(e=!0,i={}){"object"==typeof e&&(i=e,e=!0);let a=this.remember("_"+t.name);return a||(e.prototype instanceof ss?(a=new e(this),e=!0):a=new t(this),this.remember("_"+t.name,a)),a.active(e,i),this};Q(Gt,{select:rs(ss)}),Q([Ge,je,xe],{pointSelect:rs(class{constructor(t){this.el=t,t.remember("_pointSelectHandler",this),this.selection=new gi,this.order=["lt","t","rt","r","rb","b","lb","l","rot"],this.mutationHandler=this.mutationHandler.bind(this);const e=F();this.observer=new e.MutationObserver(this.mutationHandler)}init(t){this.createHandle=t.createHandle||this.createHandleFn,this.updateHandle=t.updateHandle||this.updateHandleFn,this.el.root().put(this.selection),this.updatePoints(),this.createSelection(),this.createPointHandles(),this.updatePointHandles(),this.observer.observe(this.el.node,{attributes:!0})}active(t,e){if(!t)return this.selection.clear().remove(),void this.observer.disconnect();this.init(e)}createSelection(){this.selection.polygon(this.points).addClass("svg_select_shape_pointSelect")}updateSelection(){this.selection.get(0).plot(this.points)}createPointHandles(){this.points.forEach(((t,e,i)=>{this.createHandle.call(this,this.selection,t,e,i),this.selection.get(e+1).addClass("svg_select_handle_point").on("mousedown.selection touchstart.selection",is("point",this.el,this.points,e))}))}createHandleFn(t){t.circle(5)}updateHandleFn(t,e){t.center(e[0],e[1])}updatePointHandles(){this.points.forEach(((t,e,i)=>{this.updateHandle.call(this,this.selection.get(e+1),t,e,i)}))}updatePoints(){const t=this.el.parent().screenCTM().inverseO().multiplyO(this.el.screenCTM());this.points=this.el.array().map((e=>as(e,t)))}mutationHandler(){this.updatePoints(),this.updateSelection(),this.updatePointHandles()}})});const ns=t=>(t.changedTouches&&(t=t.changedTouches[0]),{x:t.clientX,y:t.clientY}),os=t=>{let e=1/0,i=1/0,a=-1/0,s=-1/0;for(let r=0;r{const s=t-e[0],r=(a-e[1])*i;return[s*i+e[0],r+e[1]]}));return os(a)}(this.box,s,r)}this.el.dispatch("resize",{box:new kt(l),angle:0,eventType:this.eventType,event:t,handler:this}).defaultPrevented||this.el.size(l.width,l.height).move(l.x,l.y)}movePoint(t){this.lastEvent=t;const{x:e,y:i}=this.snapToGrid(this.el.point(ns(t))),a=this.el.array().slice();a[this.index]=[e,i],this.el.dispatch("resize",{box:os(a),angle:0,eventType:this.eventType,event:t,handler:this}).defaultPrevented||this.el.plot(a)}rotate(t){this.lastEvent=t;const e=this.startPoint,i=this.el.point(ns(t)),{cx:a,cy:s}=this.box,r=e.x-a,n=e.y-s,o=i.x-a,l=i.y-s,h=Math.sqrt(r*r+n*n)*Math.sqrt(o*o+l*l);if(0===h)return;let c=Math.acos((r*o+n*l)/h)/Math.PI*180;if(!c)return;i.xdiv {\n margin: 4px 0\n}\n\n.apexcharts-tooltip-box span.value {\n font-weight: 700\n}\n\n.apexcharts-tooltip-rangebar {\n padding: 5px 8px\n}\n\n.apexcharts-tooltip-rangebar .category {\n font-weight: 600;\n color: #777\n}\n\n.apexcharts-tooltip-rangebar .series-name {\n font-weight: 700;\n display: block;\n margin-bottom: 5px\n}\n\n.apexcharts-xaxistooltip,\n.apexcharts-yaxistooltip {\n opacity: 0;\n pointer-events: none;\n color: #373d3f;\n font-size: 13px;\n text-align: center;\n border-radius: 2px;\n position: absolute;\n z-index: 10;\n background: #eceff1;\n border: 1px solid #90a4ae\n}\n\n.apexcharts-xaxistooltip {\n padding: 9px 10px;\n transition: .15s ease all\n}\n\n.apexcharts-xaxistooltip.apexcharts-theme-dark {\n background: rgba(0, 0, 0, .7);\n border: 1px solid rgba(0, 0, 0, .5);\n color: #fff\n}\n\n.apexcharts-xaxistooltip:after,\n.apexcharts-xaxistooltip:before {\n left: 50%;\n border: solid transparent;\n content: " ";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none\n}\n\n.apexcharts-xaxistooltip:after {\n border-color: transparent;\n border-width: 6px;\n margin-left: -6px\n}\n\n.apexcharts-xaxistooltip:before {\n border-color: transparent;\n border-width: 7px;\n margin-left: -7px\n}\n\n.apexcharts-xaxistooltip-bottom:after,\n.apexcharts-xaxistooltip-bottom:before {\n bottom: 100%\n}\n\n.apexcharts-xaxistooltip-top:after,\n.apexcharts-xaxistooltip-top:before {\n top: 100%\n}\n\n.apexcharts-xaxistooltip-bottom:after {\n border-bottom-color: #eceff1\n}\n\n.apexcharts-xaxistooltip-bottom:before {\n border-bottom-color: #90a4ae\n}\n\n.apexcharts-xaxistooltip-bottom.apexcharts-theme-dark:after,\n.apexcharts-xaxistooltip-bottom.apexcharts-theme-dark:before {\n border-bottom-color: rgba(0, 0, 0, .5)\n}\n\n.apexcharts-xaxistooltip-top:after {\n border-top-color: #eceff1\n}\n\n.apexcharts-xaxistooltip-top:before {\n border-top-color: #90a4ae\n}\n\n.apexcharts-xaxistooltip-top.apexcharts-theme-dark:after,\n.apexcharts-xaxistooltip-top.apexcharts-theme-dark:before {\n border-top-color: rgba(0, 0, 0, .5)\n}\n\n.apexcharts-xaxistooltip.apexcharts-active {\n opacity: 1;\n transition: .15s ease all\n}\n\n.apexcharts-yaxistooltip {\n padding: 4px 10px\n}\n\n.apexcharts-yaxistooltip.apexcharts-theme-dark {\n background: rgba(0, 0, 0, .7);\n border: 1px solid rgba(0, 0, 0, .5);\n color: #fff\n}\n\n.apexcharts-yaxistooltip:after,\n.apexcharts-yaxistooltip:before {\n top: 50%;\n border: solid transparent;\n content: " ";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none\n}\n\n.apexcharts-yaxistooltip:after {\n border-color: transparent;\n border-width: 6px;\n margin-top: -6px\n}\n\n.apexcharts-yaxistooltip:before {\n border-color: transparent;\n border-width: 7px;\n margin-top: -7px\n}\n\n.apexcharts-yaxistooltip-left:after,\n.apexcharts-yaxistooltip-left:before {\n left: 100%\n}\n\n.apexcharts-yaxistooltip-right:after,\n.apexcharts-yaxistooltip-right:before {\n right: 100%\n}\n\n.apexcharts-yaxistooltip-left:after {\n border-left-color: #eceff1\n}\n\n.apexcharts-yaxistooltip-left:before {\n border-left-color: #90a4ae\n}\n\n.apexcharts-yaxistooltip-left.apexcharts-theme-dark:after,\n.apexcharts-yaxistooltip-left.apexcharts-theme-dark:before {\n border-left-color: rgba(0, 0, 0, .5)\n}\n\n.apexcharts-yaxistooltip-right:after {\n border-right-color: #eceff1\n}\n\n.apexcharts-yaxistooltip-right:before {\n border-right-color: #90a4ae\n}\n\n.apexcharts-yaxistooltip-right.apexcharts-theme-dark:after,\n.apexcharts-yaxistooltip-right.apexcharts-theme-dark:before {\n border-right-color: rgba(0, 0, 0, .5)\n}\n\n.apexcharts-yaxistooltip.apexcharts-active {\n opacity: 1\n}\n\n.apexcharts-yaxistooltip-hidden {\n display: none\n}\n\n.apexcharts-xcrosshairs,\n.apexcharts-ycrosshairs {\n pointer-events: none;\n opacity: 0;\n transition: .15s ease all\n}\n\n.apexcharts-xcrosshairs.apexcharts-active,\n.apexcharts-ycrosshairs.apexcharts-active {\n opacity: 1;\n transition: .15s ease all\n}\n\n.apexcharts-ycrosshairs-hidden {\n opacity: 0\n}\n\n.apexcharts-selection-rect {\n cursor: move\n}\n\n.svg_select_shape {\n stroke-width: 1;\n stroke-dasharray: 10 10;\n stroke: black;\n stroke-opacity: 0.1;\n pointer-events: none;\n fill: none;\n}\n\n.svg_select_handle {\n stroke-width: 3;\n stroke: black;\n fill: none;\n}\n\n.svg_select_handle_r {\n cursor: e-resize;\n}\n\n.svg_select_handle_l {\n cursor: w-resize;\n}\n\n.apexcharts-svg.apexcharts-zoomable.hovering-zoom {\n cursor: crosshair\n}\n\n.apexcharts-svg.apexcharts-zoomable.hovering-pan {\n cursor: move\n}\n\n.apexcharts-menu-icon,\n.apexcharts-pan-icon,\n.apexcharts-reset-icon,\n.apexcharts-selection-icon,\n.apexcharts-toolbar-custom-icon,\n.apexcharts-zoom-icon,\n.apexcharts-zoomin-icon,\n.apexcharts-zoomout-icon {\n cursor: pointer;\n width: 20px;\n height: 20px;\n line-height: 24px;\n color: #6e8192;\n text-align: center\n}\n\n.apexcharts-menu-icon svg,\n.apexcharts-reset-icon svg,\n.apexcharts-zoom-icon svg,\n.apexcharts-zoomin-icon svg,\n.apexcharts-zoomout-icon svg {\n fill: #6e8192\n}\n\n.apexcharts-selection-icon svg {\n fill: #444;\n transform: scale(.76)\n}\n\n.apexcharts-theme-dark .apexcharts-menu-icon svg,\n.apexcharts-theme-dark .apexcharts-pan-icon svg,\n.apexcharts-theme-dark .apexcharts-reset-icon svg,\n.apexcharts-theme-dark .apexcharts-selection-icon svg,\n.apexcharts-theme-dark .apexcharts-toolbar-custom-icon svg,\n.apexcharts-theme-dark .apexcharts-zoom-icon svg,\n.apexcharts-theme-dark .apexcharts-zoomin-icon svg,\n.apexcharts-theme-dark .apexcharts-zoomout-icon svg {\n fill: #f3f4f5\n}\n\n.apexcharts-canvas .apexcharts-reset-zoom-icon.apexcharts-selected svg,\n.apexcharts-canvas .apexcharts-selection-icon.apexcharts-selected svg,\n.apexcharts-canvas .apexcharts-zoom-icon.apexcharts-selected svg {\n fill: #008ffb\n}\n\n.apexcharts-theme-light .apexcharts-menu-icon:hover svg,\n.apexcharts-theme-light .apexcharts-reset-icon:hover svg,\n.apexcharts-theme-light .apexcharts-selection-icon:not(.apexcharts-selected):hover svg,\n.apexcharts-theme-light .apexcharts-zoom-icon:not(.apexcharts-selected):hover svg,\n.apexcharts-theme-light .apexcharts-zoomin-icon:hover svg,\n.apexcharts-theme-light .apexcharts-zoomout-icon:hover svg {\n fill: #333\n}\n\n.apexcharts-menu-icon,\n.apexcharts-selection-icon {\n position: relative\n}\n\n.apexcharts-reset-icon {\n margin-left: 5px\n}\n\n.apexcharts-menu-icon,\n.apexcharts-reset-icon,\n.apexcharts-zoom-icon {\n transform: scale(.85)\n}\n\n.apexcharts-zoomin-icon,\n.apexcharts-zoomout-icon {\n transform: scale(.7)\n}\n\n.apexcharts-zoomout-icon {\n margin-right: 3px\n}\n\n.apexcharts-pan-icon {\n transform: scale(.62);\n position: relative;\n left: 1px;\n top: 0\n}\n\n.apexcharts-pan-icon svg {\n fill: #fff;\n stroke: #6e8192;\n stroke-width: 2\n}\n\n.apexcharts-pan-icon.apexcharts-selected svg {\n stroke: #008ffb\n}\n\n.apexcharts-pan-icon:not(.apexcharts-selected):hover svg {\n stroke: #333\n}\n\n.apexcharts-toolbar {\n position: absolute;\n z-index: 11;\n max-width: 176px;\n text-align: right;\n border-radius: 3px;\n padding: 0 6px 2px;\n display: flex;\n justify-content: space-between;\n align-items: center\n}\n\n.apexcharts-menu {\n background: #fff;\n position: absolute;\n top: 100%;\n border: 1px solid #ddd;\n border-radius: 3px;\n padding: 3px;\n right: 10px;\n opacity: 0;\n min-width: 110px;\n transition: .15s ease all;\n pointer-events: none\n}\n\n.apexcharts-menu.apexcharts-menu-open {\n opacity: 1;\n pointer-events: all;\n transition: .15s ease all\n}\n\n.apexcharts-menu-item {\n padding: 6px 7px;\n font-size: 12px;\n cursor: pointer\n}\n\n.apexcharts-theme-light .apexcharts-menu-item:hover {\n background: #eee\n}\n\n.apexcharts-theme-dark .apexcharts-menu {\n background: rgba(0, 0, 0, .7);\n color: #fff\n}\n\n@media screen and (min-width:768px) {\n .apexcharts-canvas:hover .apexcharts-toolbar {\n opacity: 1\n }\n}\n\n.apexcharts-canvas .apexcharts-element-hidden,\n.apexcharts-datalabel.apexcharts-element-hidden,\n.apexcharts-hide .apexcharts-series-points {\n opacity: 0;\n}\n\n.apexcharts-hidden-element-shown {\n opacity: 1;\n transition: 0.25s ease all;\n}\n\n.apexcharts-datalabel,\n.apexcharts-datalabel-label,\n.apexcharts-datalabel-value,\n.apexcharts-datalabels,\n.apexcharts-pie-label {\n cursor: default;\n pointer-events: none\n}\n\n.apexcharts-pie-label-delay {\n opacity: 0;\n animation-name: opaque;\n animation-duration: .3s;\n animation-fill-mode: forwards;\n animation-timing-function: ease\n}\n\n.apexcharts-radialbar-label {\n cursor: pointer;\n}\n\n.apexcharts-annotation-rect,\n.apexcharts-area-series .apexcharts-area,\n.apexcharts-gridline,\n.apexcharts-line,\n.apexcharts-point-annotation-label,\n.apexcharts-radar-series path:not(.apexcharts-marker),\n.apexcharts-radar-series polygon,\n.apexcharts-toolbar svg,\n.apexcharts-tooltip .apexcharts-marker,\n.apexcharts-xaxis-annotation-label,\n.apexcharts-yaxis-annotation-label,\n.apexcharts-zoom-rect,\n.no-pointer-events {\n pointer-events: none\n}\n\n.apexcharts-tooltip-active .apexcharts-marker {\n transition: .15s ease all\n}\n\n.apexcharts-radar-series .apexcharts-yaxis {\n pointer-events: none;\n}\n\n.resize-triggers {\n animation: 1ms resizeanim;\n visibility: hidden;\n opacity: 0;\n height: 100%;\n width: 100%;\n overflow: hidden\n}\n\n.contract-trigger:before,\n.resize-triggers,\n.resize-triggers>div {\n content: " ";\n display: block;\n position: absolute;\n top: 0;\n left: 0\n}\n\n.resize-triggers>div {\n height: 100%;\n width: 100%;\n background: #eee;\n overflow: auto\n}\n\n.contract-trigger:before {\n overflow: hidden;\n width: 200%;\n height: 200%\n}\n\n.apexcharts-bar-goals-markers {\n pointer-events: none\n}\n\n.apexcharts-bar-shadows {\n pointer-events: none\n}\n\n.apexcharts-rangebar-goals-markers {\n pointer-events: none\n}';var h=(null===(l=t.opts.chart)||void 0===l?void 0:l.nonce)||t.w.config.chart.nonce;h&&o.setAttribute("nonce",h),r?s.prepend(o):n.head.appendChild(o)}var c=t.create(t.w.config.series,{});if(!c)return e(t);t.mount(c).then((function(){"function"==typeof t.w.config.chart.events.mounted&&t.w.config.chart.events.mounted(t,t.w),t.events.fireEvent("mounted",[t,t.w]),e(c)})).catch((function(t){i(t)}))}else i(new Error("Element not found"))}))}},{key:"create",value:function(t,e){var i=this,a=this.w;new hs(this).initModules();var s=this.w.globals;if(s.noData=!1,s.animationEnded=!1,!v.elementExists(this.el))return s.animationEnded=!0,this.destroy(),null;(this.responsive.checkResponsiveConfig(e),a.config.xaxis.convertedCatToNumeric)&&new Ni(a.config).convertCatToNumericXaxis(a.config,this.ctx);if(this.core.setupElements(),"treemap"===a.config.chart.type&&(a.config.grid.show=!1,a.config.yaxis[0].show=!1),0===s.svgWidth)return s.animationEnded=!0,null;var r=t;t.forEach((function(t,e){t.hidden&&(r=i.legend.legendHelpers.getSeriesAfterCollapsing({realIndex:e}))}));var n=Pi.checkComboSeries(r,a.config.chart.type);s.comboCharts=n.comboCharts,s.comboBarCount=n.comboBarCount;var o=r.every((function(t){return t.data&&0===t.data.length}));(0===r.length||o&&s.collapsedSeries.length<1)&&this.series.handleNoData(),this.events.setupEventHandlers(),this.data.parseData(r),this.theme.init(),new Vi(this).setGlobalMarkerSize(),this.formatters.setLabelFormatters(),this.titleSubtitle.draw(),s.noData&&s.collapsedSeries.length!==s.series.length&&!a.config.legend.showForSingleSeries||this.legend.init(),this.series.hasAllSeriesEqualX(),s.axisCharts&&(this.core.coreCalculations(),"category"!==a.config.xaxis.type&&this.formatters.setLabelFormatters(),this.ctx.toolbar.minX=a.globals.minX,this.ctx.toolbar.maxX=a.globals.maxX),this.formatters.heatmapLabelFormatters(),new Pi(this).getLargestMarkerSize(),this.dimensions.plotCoords();var l=this.core.xySettings();this.grid.createGridMask();var h=this.core.plotChartType(r,l),c=new qi(this);return c.bringForward(),a.config.dataLabels.background.enabled&&c.dataLabelsBackground(),this.core.shiftGraphPosition(),{elGraph:h,xyRatios:l,dimensions:{plot:{left:a.globals.translateX,top:a.globals.translateY,width:a.globals.gridWidth,height:a.globals.gridHeight}}}}},{key:"mount",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=this,a=i.w;return new Promise((function(s,r){if(null===i.el)return r(new Error("Not enough data to display or target element not found"));(null===e||a.globals.allSeriesCollapsed)&&i.series.handleNoData(),i.grid=new Ki(i);var n,o,l=i.grid.drawGrid();(i.annotations=new Fi(i),i.annotations.drawImageAnnos(),i.annotations.drawTextAnnos(),"back"===a.config.grid.position)&&(l&&a.globals.dom.elGraphical.add(l.el),null!=l&&null!==(n=l.elGridBorders)&&void 0!==n&&n.node&&a.globals.dom.elGraphical.add(l.elGridBorders));if(Array.isArray(e.elGraph))for(var h=0;h0&&a.globals.memory.methodsToExec.forEach((function(t){t.method(t.params,!1,t.context)})),a.globals.axisCharts||a.globals.noData||i.core.resizeNonAxisCharts(),s(i)}))}},{key:"destroy",value:function(){window.removeEventListener("resize",this.windowResizeHandler),function(t,e){var i=ds.get(e);i&&(i.disconnect(),ds.delete(e))}(this.el.parentNode,this.parentResizeHandler);var t=this.w.config.chart.id;t&&Apex._chartInstances.forEach((function(e,i){e.id===v.escapeString(t)&&Apex._chartInstances.splice(i,1)})),new cs(this.ctx).clear({isUpdating:!1})}},{key:"updateOptions",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=this.w;return n.globals.selection=void 0,t.series&&(this.series.resetSeries(!1,!0,!1),t.series.length&&t.series[0].data&&(t.series=t.series.map((function(t,i){return e.updateHelpers._extendSeries(t,i)}))),this.updateHelpers.revertDefaultAxisMinMax()),t.xaxis&&(t=this.updateHelpers.forceXAxisUpdate(t)),t.yaxis&&(t=this.updateHelpers.forceYAxisUpdate(t)),n.globals.collapsedSeriesIndices.length>0&&this.series.clearPreviousPaths(),t.theme&&(t=this.theme.updateThemeOptions(t)),this.updateHelpers._updateOptions(t,i,a,s,r)}},{key:"updateSeries",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return this.series.resetSeries(!1),this.updateHelpers.revertDefaultAxisMinMax(),this.updateHelpers._updateSeries(t,e,i)}},{key:"appendSeries",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=this.w.config.series.slice();return a.push(t),this.series.resetSeries(!1),this.updateHelpers.revertDefaultAxisMinMax(),this.updateHelpers._updateSeries(a,e,i)}},{key:"appendData",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this;i.w.globals.dataChanged=!0,i.series.getPreviousPaths();for(var a=i.w.config.series.slice(),s=0;s0&&void 0!==arguments[0])||arguments[0],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.series.resetSeries(t,e)}},{key:"addEventListener",value:function(t,e){this.events.addEventListener(t,e)}},{key:"removeEventListener",value:function(t,e){this.events.removeEventListener(t,e)}},{key:"addXaxisAnnotation",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,a=this;i&&(a=i),a.annotations.addXaxisAnnotationExternal(t,e,a)}},{key:"addYaxisAnnotation",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,a=this;i&&(a=i),a.annotations.addYaxisAnnotationExternal(t,e,a)}},{key:"addPointAnnotation",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,a=this;i&&(a=i),a.annotations.addPointAnnotationExternal(t,e,a)}},{key:"clearAnnotations",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,e=this;t&&(e=t),e.annotations.clearAnnotations(e)}},{key:"removeAnnotation",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,i=this;e&&(i=e),i.annotations.removeAnnotation(i,t)}},{key:"getChartArea",value:function(){return this.w.globals.dom.baseEl.querySelector(".apexcharts-inner")}},{key:"getSeriesTotalXRange",value:function(t,e){return this.coreUtils.getSeriesTotalsXRange(t,e)}},{key:"getHighestValueInSeries",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new ea(this.ctx).getMinYMaxY(t).highestY}},{key:"getLowestValueInSeries",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new ea(this.ctx).getMinYMaxY(t).lowestY}},{key:"getSeriesTotal",value:function(){return this.w.globals.seriesTotals}},{key:"toggleDataPointSelection",value:function(t,e){return this.updateHelpers.toggleDataPointSelection(t,e)}},{key:"zoomX",value:function(t,e){this.ctx.toolbar.zoomUpdateOptions(t,e)}},{key:"setLocale",value:function(t){this.localization.setCurrentLocaleValues(t)}},{key:"dataURI",value:function(t){return new Ji(this.ctx).dataURI(t)}},{key:"getSvgString",value:function(t){return new Ji(this.ctx).getSvgString(t)}},{key:"exportToCSV",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Ji(this.ctx).exportToCSV(t)}},{key:"paper",value:function(){return this.w.globals.dom.Paper}},{key:"_parentResizeCallback",value:function(){this.w.globals.animationEnded&&this.w.config.chart.redrawOnParentResize&&this._windowResize()}},{key:"_windowResize",value:function(){var t=this;clearTimeout(this.w.globals.resizeTimer),this.w.globals.resizeTimer=window.setTimeout((function(){t.w.globals.resized=!0,t.w.globals.dataChanged=!1,t.ctx.update()}),150)}},{key:"_windowResizeHandler",value:function(){var t=this.w.config.chart.redrawOnWindowResize;"function"==typeof t&&(t=t()),t&&this._windowResize()}}],[{key:"getChartByID",value:function(t){var e=v.escapeString(t);if(Apex._chartInstances){var i=Apex._chartInstances.filter((function(t){return t.id===e}))[0];return i&&i.chart}}},{key:"initOnLoad",value:function(){for(var e=document.querySelectorAll("[data-apexcharts]"),i=0;i2?s-2:0),n=2;n r.length) && (a = r.length); + for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; + return n; + } + function _arrayWithHoles(r) { + if (Array.isArray(r)) return r; + } + function _arrayWithoutHoles(r) { + if (Array.isArray(r)) return _arrayLikeToArray(r); + } + function _assertThisInitialized(e) { + if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + return e; + } + function _classCallCheck(a, n) { + if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); + } + function _defineProperties(e, r) { + for (var t = 0; t < r.length; t++) { + var o = r[t]; + o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); + } + } + function _createClass(e, r, t) { + return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { + writable: !1 + }), e; + } + function _createForOfIteratorHelper(r, e) { + var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; + if (!t) { + if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { + t && (r = t); + var n = 0, + F = function () {}; + return { + s: F, + n: function () { + return n >= r.length ? { + done: !0 + } : { + done: !1, + value: r[n++] + }; + }, + e: function (r) { + throw r; + }, + f: F + }; + } + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + var o, + a = !0, + u = !1; + return { + s: function () { + t = t.call(r); + }, + n: function () { + var r = t.next(); + return a = r.done, r; + }, + e: function (r) { + u = !0, o = r; + }, + f: function () { + try { + a || null == t.return || t.return(); + } finally { + if (u) throw o; + } + } + }; + } + function _createSuper(t) { + var r = _isNativeReflectConstruct(); + return function () { + var e, + o = _getPrototypeOf(t); + if (r) { + var s = _getPrototypeOf(this).constructor; + e = Reflect.construct(o, arguments, s); + } else e = o.apply(this, arguments); + return _possibleConstructorReturn(this, e); + }; + } + function _defineProperty(e, r, t) { + return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { + value: t, + enumerable: !0, + configurable: !0, + writable: !0 + }) : e[r] = t, e; + } + function _getPrototypeOf(t) { + return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { + return t.__proto__ || Object.getPrototypeOf(t); + }, _getPrototypeOf(t); + } + function _inherits(t, e) { + if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); + t.prototype = Object.create(e && e.prototype, { + constructor: { + value: t, + writable: !0, + configurable: !0 + } + }), Object.defineProperty(t, "prototype", { + writable: !1 + }), e && _setPrototypeOf(t, e); + } + function _isNativeReflectConstruct() { + try { + var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (t) {} + return (_isNativeReflectConstruct = function () { + return !!t; + })(); + } + function _iterableToArray(r) { + if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); + } + function _iterableToArrayLimit(r, l) { + var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; + if (null != t) { + var e, + n, + i, + u, + a = [], + f = !0, + o = !1; + try { + if (i = (t = t.call(r)).next, 0 === l) { + if (Object(t) !== t) return; + f = !1; + } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); + } catch (r) { + o = !0, n = r; + } finally { + try { + if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; + } finally { + if (o) throw n; + } + } + return a; + } + } + function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + function ownKeys(e, r) { + var t = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function (r) { + return Object.getOwnPropertyDescriptor(e, r).enumerable; + })), t.push.apply(t, o); + } + return t; + } + function _objectSpread2(e) { + for (var r = 1; r < arguments.length; r++) { + var t = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { + _defineProperty(e, r, t[r]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { + Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); + }); + } + return e; + } + function _possibleConstructorReturn(t, e) { + if (e && ("object" == typeof e || "function" == typeof e)) return e; + if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); + return _assertThisInitialized(t); + } + function _setPrototypeOf(t, e) { + return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { + return t.__proto__ = e, t; + }, _setPrototypeOf(t, e); + } + function _slicedToArray(r, e) { + return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); + } + function _toConsumableArray(r) { + return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); + } + function _toPrimitive(t, r) { + if ("object" != typeof t || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != typeof i) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); + } + function _toPropertyKey(t) { + var i = _toPrimitive(t, "string"); + return "symbol" == typeof i ? i : i + ""; + } + function _typeof(o) { + "@babel/helpers - typeof"; + + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { + return typeof o; + } : function (o) { + return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; + }, _typeof(o); + } + function _unsupportedIterableToArray(r, a) { + if (r) { + if ("string" == typeof r) return _arrayLikeToArray(r, a); + var t = {}.toString.call(r).slice(8, -1); + return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; + } + } + + /* + ** Generic functions which are not dependent on ApexCharts + */ + var Utils$1 = /*#__PURE__*/function () { + function Utils() { + _classCallCheck(this, Utils); + } + _createClass(Utils, [{ + key: "shadeRGBColor", + value: function shadeRGBColor(percent, color) { + var f = color.split(','), + t = percent < 0 ? 0 : 255, + p = percent < 0 ? percent * -1 : percent, + R = parseInt(f[0].slice(4), 10), + G = parseInt(f[1], 10), + B = parseInt(f[2], 10); + return 'rgb(' + (Math.round((t - R) * p) + R) + ',' + (Math.round((t - G) * p) + G) + ',' + (Math.round((t - B) * p) + B) + ')'; + } + }, { + key: "shadeHexColor", + value: function shadeHexColor(percent, color) { + var f = parseInt(color.slice(1), 16), + t = percent < 0 ? 0 : 255, + p = percent < 0 ? percent * -1 : percent, + R = f >> 16, + G = f >> 8 & 0x00ff, + B = f & 0x0000ff; + return '#' + (0x1000000 + (Math.round((t - R) * p) + R) * 0x10000 + (Math.round((t - G) * p) + G) * 0x100 + (Math.round((t - B) * p) + B)).toString(16).slice(1); + } + + // beautiful color shading blending code + // http://stackoverflow.com/questions/5560248/programmatically-lighten-or-darken-a-hex-color-or-rgb-and-blend-colors + }, { + key: "shadeColor", + value: function shadeColor(p, color) { + if (Utils.isColorHex(color)) { + return this.shadeHexColor(p, color); + } else { + return this.shadeRGBColor(p, color); + } + } + }], [{ + key: "bind", + value: function bind(fn, me) { + return function () { + return fn.apply(me, arguments); + }; + } + }, { + key: "isObject", + value: function isObject(item) { + return item && _typeof(item) === 'object' && !Array.isArray(item) && item != null; + } + + // Type checking that works across different window objects + }, { + key: "is", + value: function is(type, val) { + return Object.prototype.toString.call(val) === '[object ' + type + ']'; + } + }, { + key: "listToArray", + value: function listToArray(list) { + var i, + array = []; + for (i = 0; i < list.length; i++) { + array[i] = list[i]; + } + return array; + } + + // to extend defaults with user options + // credit: http://stackoverflow.com/questions/27936772/deep-object-merging-in-es6-es7#answer-34749873 + }, { + key: "extend", + value: function extend(target, source) { + var _this = this; + if (typeof Object.assign !== 'function') { + (function () { + Object.assign = function (target) { + + // We must check against these specific cases. + if (target === undefined || target === null) { + throw new TypeError('Cannot convert undefined or null to object'); + } + var output = Object(target); + for (var index = 1; index < arguments.length; index++) { + var _source = arguments[index]; + if (_source !== undefined && _source !== null) { + for (var nextKey in _source) { + if (_source.hasOwnProperty(nextKey)) { + output[nextKey] = _source[nextKey]; + } + } + } + } + return output; + }; + })(); + } + var output = Object.assign({}, target); + if (this.isObject(target) && this.isObject(source)) { + Object.keys(source).forEach(function (key) { + if (_this.isObject(source[key])) { + if (!(key in target)) { + Object.assign(output, _defineProperty({}, key, source[key])); + } else { + output[key] = _this.extend(target[key], source[key]); + } + } else { + Object.assign(output, _defineProperty({}, key, source[key])); + } + }); + } + return output; + } + }, { + key: "extendArray", + value: function extendArray(arrToExtend, resultArr) { + var extendedArr = []; + arrToExtend.map(function (item) { + extendedArr.push(Utils.extend(resultArr, item)); + }); + arrToExtend = extendedArr; + return arrToExtend; + } + + // If month counter exceeds 12, it starts again from 1 + }, { + key: "monthMod", + value: function monthMod(month) { + return month % 12; + } + }, { + key: "clone", + value: function clone(source) { + var visited = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new WeakMap(); + if (source === null || _typeof(source) !== 'object') { + return source; + } + if (visited.has(source)) { + return visited.get(source); + } + var cloneResult; + if (Array.isArray(source)) { + cloneResult = []; + visited.set(source, cloneResult); + for (var i = 0; i < source.length; i++) { + cloneResult[i] = this.clone(source[i], visited); + } + } else if (source instanceof Date) { + cloneResult = new Date(source.getTime()); + } else { + cloneResult = {}; + visited.set(source, cloneResult); + for (var prop in source) { + if (source.hasOwnProperty(prop)) { + cloneResult[prop] = this.clone(source[prop], visited); + } + } + } + return cloneResult; + } + }, { + key: "log10", + value: function log10(x) { + return Math.log(x) / Math.LN10; + } + }, { + key: "roundToBase10", + value: function roundToBase10(x) { + return Math.pow(10, Math.floor(Math.log10(x))); + } + }, { + key: "roundToBase", + value: function roundToBase(x, base) { + return Math.pow(base, Math.floor(Math.log(x) / Math.log(base))); + } + }, { + key: "parseNumber", + value: function parseNumber(val) { + if (val === null) return val; + return parseFloat(val); + } + }, { + key: "stripNumber", + value: function stripNumber(num) { + var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2; + return Number.isInteger(num) ? num : parseFloat(num.toPrecision(precision)); + } + }, { + key: "randomId", + value: function randomId() { + return (Math.random() + 1).toString(36).substring(4); + } + }, { + key: "noExponents", + value: function noExponents(num) { + // Check if the number contains 'e' (exponential notation) + if (num.toString().includes('e')) { + return Math.round(num); // Round the number + } + return num; // Return as-is if no exponential notation + } + }, { + key: "elementExists", + value: function elementExists(element) { + if (!element || !element.isConnected) { + return false; + } + return true; + } + }, { + key: "getDimensions", + value: function getDimensions(el) { + var computedStyle = getComputedStyle(el, null); + var elementHeight = el.clientHeight; + var elementWidth = el.clientWidth; + elementHeight -= parseFloat(computedStyle.paddingTop) + parseFloat(computedStyle.paddingBottom); + elementWidth -= parseFloat(computedStyle.paddingLeft) + parseFloat(computedStyle.paddingRight); + return [elementWidth, elementHeight]; + } + }, { + key: "getBoundingClientRect", + value: function getBoundingClientRect(element) { + var rect = element.getBoundingClientRect(); + return { + top: rect.top, + right: rect.right, + bottom: rect.bottom, + left: rect.left, + width: element.clientWidth, + height: element.clientHeight, + x: rect.left, + y: rect.top + }; + } + }, { + key: "getLargestStringFromArr", + value: function getLargestStringFromArr(arr) { + return arr.reduce(function (a, b) { + if (Array.isArray(b)) { + b = b.reduce(function (aa, bb) { + return aa.length > bb.length ? aa : bb; + }); + } + return a.length > b.length ? a : b; + }, 0); + } + + // http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb#answer-12342275 + }, { + key: "hexToRgba", + value: function hexToRgba() { + var hex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '#999999'; + var opacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.6; + if (hex.substring(0, 1) !== '#') { + hex = '#999999'; + } + var h = hex.replace('#', ''); + h = h.match(new RegExp('(.{' + h.length / 3 + '})', 'g')); + for (var i = 0; i < h.length; i++) { + h[i] = parseInt(h[i].length === 1 ? h[i] + h[i] : h[i], 16); + } + if (typeof opacity !== 'undefined') h.push(opacity); + return 'rgba(' + h.join(',') + ')'; + } + }, { + key: "getOpacityFromRGBA", + value: function getOpacityFromRGBA(rgba) { + return parseFloat(rgba.replace(/^.*,(.+)\)/, '$1')); + } + }, { + key: "rgb2hex", + value: function rgb2hex(rgb) { + rgb = rgb.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i); + return rgb && rgb.length === 4 ? '#' + ('0' + parseInt(rgb[1], 10).toString(16)).slice(-2) + ('0' + parseInt(rgb[2], 10).toString(16)).slice(-2) + ('0' + parseInt(rgb[3], 10).toString(16)).slice(-2) : ''; + } + }, { + key: "isColorHex", + value: function isColorHex(color) { + return /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)|(^#[0-9A-F]{8}$)/i.test(color); + } + }, { + key: "getPolygonPos", + value: function getPolygonPos(size, dataPointsLen) { + var dotsArray = []; + var angle = Math.PI * 2 / dataPointsLen; + for (var i = 0; i < dataPointsLen; i++) { + var curPos = {}; + curPos.x = size * Math.sin(i * angle); + curPos.y = -size * Math.cos(i * angle); + dotsArray.push(curPos); + } + return dotsArray; + } + }, { + key: "polarToCartesian", + value: function polarToCartesian(centerX, centerY, radius, angleInDegrees) { + var angleInRadians = (angleInDegrees - 90) * Math.PI / 180.0; + return { + x: centerX + radius * Math.cos(angleInRadians), + y: centerY + radius * Math.sin(angleInRadians) + }; + } + }, { + key: "escapeString", + value: function escapeString(str) { + var escapeWith = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'x'; + var newStr = str.toString().slice(); + newStr = newStr.replace(/[` ~!@#$%^&*()|+\=?;:'",.<>{}[\]\\/]/gi, escapeWith); + return newStr; + } + }, { + key: "negToZero", + value: function negToZero(val) { + return val < 0 ? 0 : val; + } + }, { + key: "moveIndexInArray", + value: function moveIndexInArray(arr, old_index, new_index) { + if (new_index >= arr.length) { + var k = new_index - arr.length + 1; + while (k--) { + arr.push(undefined); + } + } + arr.splice(new_index, 0, arr.splice(old_index, 1)[0]); + return arr; + } + }, { + key: "extractNumber", + value: function extractNumber(s) { + return parseFloat(s.replace(/[^\d.]*/g, '')); + } + }, { + key: "findAncestor", + value: function findAncestor(el, cls) { + while ((el = el.parentElement) && !el.classList.contains(cls)) { + } + return el; + } + }, { + key: "setELstyles", + value: function setELstyles(el, styles) { + for (var key in styles) { + if (styles.hasOwnProperty(key)) { + el.style.key = styles[key]; + } + } + } + // prevents JS prevision errors when adding + }, { + key: "preciseAddition", + value: function preciseAddition(a, b) { + var aDecimals = (String(a).split('.')[1] || '').length; + var bDecimals = (String(b).split('.')[1] || '').length; + var factor = Math.pow(10, Math.max(aDecimals, bDecimals)); + return (Math.round(a * factor) + Math.round(b * factor)) / factor; + } + }, { + key: "isNumber", + value: function isNumber(value) { + return !isNaN(value) && parseFloat(Number(value)) === value && !isNaN(parseInt(value, 10)); + } + }, { + key: "isFloat", + value: function isFloat(n) { + return Number(n) === n && n % 1 !== 0; + } + }, { + key: "isMsEdge", + value: function isMsEdge() { + var ua = window.navigator.userAgent; + var edge = ua.indexOf('Edge/'); + if (edge > 0) { + // Edge (IE 12+) => return version number + return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10); + } + + // other browser + return false; + } + // + // Find the Greatest Common Divisor of two numbers + // + }, { + key: "getGCD", + value: function getGCD(a, b) { + var p = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 7; + var big = Math.pow(10, p - Math.floor(Math.log10(Math.max(a, b)))); + a = Math.round(Math.abs(a) * big); + b = Math.round(Math.abs(b) * big); + while (b) { + var t = b; + b = a % b; + a = t; + } + return a / big; + } + }, { + key: "getPrimeFactors", + value: function getPrimeFactors(n) { + var factors = []; + var divisor = 2; + while (n >= 2) { + if (n % divisor == 0) { + factors.push(divisor); + n = n / divisor; + } else { + divisor++; + } + } + return factors; + } + }, { + key: "mod", + value: function mod(a, b) { + var p = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 7; + var big = Math.pow(10, p - Math.floor(Math.log10(Math.max(a, b)))); + a = Math.round(Math.abs(a) * big); + b = Math.round(Math.abs(b) * big); + return a % b / big; + } + }]); + return Utils; + }(); + + /** + * ApexCharts Animation Class. + * + * @module Animations + **/ + var Animations = /*#__PURE__*/function () { + function Animations(ctx) { + _classCallCheck(this, Animations); + this.ctx = ctx; + this.w = ctx.w; + } + _createClass(Animations, [{ + key: "animateLine", + value: function animateLine(el, from, to, speed) { + el.attr(from).animate(speed).attr(to); + } + + /* + ** Animate radius of a circle element + */ + }, { + key: "animateMarker", + value: function animateMarker(el, speed, easing, cb) { + el.attr({ + opacity: 0 + }).animate(speed).attr({ + opacity: 1 + }).after(function () { + cb(); + }); + } + + /* + ** Animate rect properties + */ + }, { + key: "animateRect", + value: function animateRect(el, from, to, speed, fn) { + el.attr(from).animate(speed).attr(to).after(function () { + return fn(); + }); + } + }, { + key: "animatePathsGradually", + value: function animatePathsGradually(params) { + var el = params.el, + realIndex = params.realIndex, + j = params.j, + fill = params.fill, + pathFrom = params.pathFrom, + pathTo = params.pathTo, + speed = params.speed, + delay = params.delay; + var me = this; + var w = this.w; + var delayFactor = 0; + if (w.config.chart.animations.animateGradually.enabled) { + delayFactor = w.config.chart.animations.animateGradually.delay; + } + if (w.config.chart.animations.dynamicAnimation.enabled && w.globals.dataChanged && w.config.chart.type !== 'bar') { + // disabled due to this bug - https://github.com/apexcharts/vue-apexcharts/issues/75 + delayFactor = 0; + } + me.morphSVG(el, realIndex, j, w.config.chart.type === 'line' && !w.globals.comboCharts ? 'stroke' : fill, pathFrom, pathTo, speed, delay * delayFactor); + } + }, { + key: "showDelayedElements", + value: function showDelayedElements() { + this.w.globals.delayedElements.forEach(function (d) { + var ele = d.el; + ele.classList.remove('apexcharts-element-hidden'); + ele.classList.add('apexcharts-hidden-element-shown'); + }); + } + }, { + key: "animationCompleted", + value: function animationCompleted(el) { + var w = this.w; + if (w.globals.animationEnded) return; + w.globals.animationEnded = true; + this.showDelayedElements(); + if (typeof w.config.chart.events.animationEnd === 'function') { + w.config.chart.events.animationEnd(this.ctx, { + el: el, + w: w + }); + } + } + + // SVG.js animation for morphing one path to another + }, { + key: "morphSVG", + value: function morphSVG(el, realIndex, j, fill, pathFrom, pathTo, speed, delay) { + var _this = this; + var w = this.w; + if (!pathFrom) { + pathFrom = el.attr('pathFrom'); + } + if (!pathTo) { + pathTo = el.attr('pathTo'); + } + var disableAnimationForCorrupPath = function disableAnimationForCorrupPath(path) { + if (w.config.chart.type === 'radar') { + // radar chart drops the path to bottom and hence a corrup path looks ugly + // therefore, disable animation for such a case + speed = 1; + } + return "M 0 ".concat(w.globals.gridHeight); + }; + if (!pathFrom || pathFrom.indexOf('undefined') > -1 || pathFrom.indexOf('NaN') > -1) { + pathFrom = disableAnimationForCorrupPath(); + } + if (!pathTo.trim() || pathTo.indexOf('undefined') > -1 || pathTo.indexOf('NaN') > -1) { + pathTo = disableAnimationForCorrupPath(); + } + if (!w.globals.shouldAnimate) { + speed = 1; + } + el.plot(pathFrom).animate(1, delay).plot(pathFrom).animate(speed, delay).plot(pathTo).after(function () { + // a flag to indicate that the original mount function can return true now as animation finished here + if (Utils$1.isNumber(j)) { + if (j === w.globals.series[w.globals.maxValsInArrayIndex].length - 2 && w.globals.shouldAnimate) { + _this.animationCompleted(el); + } + } else if (fill !== 'none' && w.globals.shouldAnimate) { + if (!w.globals.comboCharts && realIndex === w.globals.series.length - 1 || w.globals.comboCharts) { + _this.animationCompleted(el); + } + } + _this.showDelayedElements(); + }); + } + }]); + return Animations; + }(); + + const methods$1 = {}; + const names = []; + + function registerMethods(name, m) { + if (Array.isArray(name)) { + for (const _name of name) { + registerMethods(_name, m); + } + return + } + + if (typeof name === 'object') { + for (const _name in name) { + registerMethods(_name, name[_name]); + } + return + } + + addMethodNames(Object.getOwnPropertyNames(m)); + methods$1[name] = Object.assign(methods$1[name] || {}, m); + } + + function getMethodsFor(name) { + return methods$1[name] || {} + } + + function getMethodNames() { + return [...new Set(names)] + } + + function addMethodNames(_names) { + names.push(..._names); + } + + // Map function + function map(array, block) { + let i; + const il = array.length; + const result = []; + + for (i = 0; i < il; i++) { + result.push(block(array[i])); + } + + return result + } + + // Filter function + function filter(array, block) { + let i; + const il = array.length; + const result = []; + + for (i = 0; i < il; i++) { + if (block(array[i])) { + result.push(array[i]); + } + } + + return result + } + + // Degrees to radians + function radians(d) { + return ((d % 360) * Math.PI) / 180 + } + + // Convert camel cased string to dash separated + function unCamelCase(s) { + return s.replace(/([A-Z])/g, function (m, g) { + return '-' + g.toLowerCase() + }) + } + + // Capitalize first letter of a string + function capitalize(s) { + return s.charAt(0).toUpperCase() + s.slice(1) + } + + // Calculate proportional width and height values when necessary + function proportionalSize(element, width, height, box) { + if (width == null || height == null) { + box = box || element.bbox(); + + if (width == null) { + width = (box.width / box.height) * height; + } else if (height == null) { + height = (box.height / box.width) * width; + } + } + + return { + width: width, + height: height + } + } + + /** + * This function adds support for string origins. + * It searches for an origin in o.origin o.ox and o.originX. + * This way, origin: {x: 'center', y: 50} can be passed as well as ox: 'center', oy: 50 + **/ + function getOrigin(o, element) { + const origin = o.origin; + // First check if origin is in ox or originX + let ox = o.ox != null ? o.ox : o.originX != null ? o.originX : 'center'; + let oy = o.oy != null ? o.oy : o.originY != null ? o.originY : 'center'; + + // Then check if origin was used and overwrite in that case + if (origin != null) { + [ox, oy] = Array.isArray(origin) + ? origin + : typeof origin === 'object' + ? [origin.x, origin.y] + : [origin, origin]; + } + + // Make sure to only call bbox when actually needed + const condX = typeof ox === 'string'; + const condY = typeof oy === 'string'; + if (condX || condY) { + const { height, width, x, y } = element.bbox(); + + // And only overwrite if string was passed for this specific axis + if (condX) { + ox = ox.includes('left') + ? x + : ox.includes('right') + ? x + width + : x + width / 2; + } + + if (condY) { + oy = oy.includes('top') + ? y + : oy.includes('bottom') + ? y + height + : y + height / 2; + } + } + + // Return the origin as it is if it wasn't a string + return [ox, oy] + } + + const descriptiveElements = new Set(['desc', 'metadata', 'title']); + const isDescriptive = (element) => + descriptiveElements.has(element.nodeName); + + const writeDataToDom = (element, data, defaults = {}) => { + const cloned = { ...data }; + + for (const key in cloned) { + if (cloned[key].valueOf() === defaults[key]) { + delete cloned[key]; + } + } + + if (Object.keys(cloned).length) { + element.node.setAttribute('data-svgjs', JSON.stringify(cloned)); // see #428 + } else { + element.node.removeAttribute('data-svgjs'); + element.node.removeAttribute('svgjs:data'); + } + }; + + // Default namespaces + const svg = 'http://www.w3.org/2000/svg'; + const html = 'http://www.w3.org/1999/xhtml'; + const xmlns = 'http://www.w3.org/2000/xmlns/'; + const xlink = 'http://www.w3.org/1999/xlink'; + + const globals = { + window: typeof window === 'undefined' ? null : window, + document: typeof document === 'undefined' ? null : document + }; + + function getWindow() { + return globals.window + } + + let Base$1 = class Base { + // constructor (node/*, {extensions = []} */) { + // // this.tags = [] + // // + // // for (let extension of extensions) { + // // extension.setup.call(this, node) + // // this.tags.push(extension.name) + // // } + // } + }; + + const elements = {}; + const root = '___SYMBOL___ROOT___'; + + // Method for element creation + function create(name, ns = svg) { + // create element + return globals.document.createElementNS(ns, name) + } + + function makeInstance(element, isHTML = false) { + if (element instanceof Base$1) return element + + if (typeof element === 'object') { + return adopter(element) + } + + if (element == null) { + return new elements[root]() + } + + if (typeof element === 'string' && element.charAt(0) !== '<') { + return adopter(globals.document.querySelector(element)) + } + + // Make sure, that HTML elements are created with the correct namespace + const wrapper = isHTML ? globals.document.createElement('div') : create('svg'); + wrapper.innerHTML = element; + + // We can use firstChild here because we know, + // that the first char is < and thus an element + element = adopter(wrapper.firstChild); + + // make sure, that element doesn't have its wrapper attached + wrapper.removeChild(wrapper.firstChild); + return element + } + + function nodeOrNew(name, node) { + return node && + (node instanceof globals.window.Node || + (node.ownerDocument && + node instanceof node.ownerDocument.defaultView.Node)) + ? node + : create(name) + } + + // Adopt existing svg elements + function adopt(node) { + // check for presence of node + if (!node) return null + + // make sure a node isn't already adopted + if (node.instance instanceof Base$1) return node.instance + + if (node.nodeName === '#document-fragment') { + return new elements.Fragment(node) + } + + // initialize variables + let className = capitalize(node.nodeName || 'Dom'); + + // Make sure that gradients are adopted correctly + if (className === 'LinearGradient' || className === 'RadialGradient') { + className = 'Gradient'; + + // Fallback to Dom if element is not known + } else if (!elements[className]) { + className = 'Dom'; + } + + return new elements[className](node) + } + + let adopter = adopt; + + function register(element, name = element.name, asRoot = false) { + elements[name] = element; + if (asRoot) elements[root] = element; + + addMethodNames(Object.getOwnPropertyNames(element.prototype)); + + return element + } + + function getClass(name) { + return elements[name] + } + + // Element id sequence + let did = 1000; + + // Get next named element id + function eid(name) { + return 'Svgjs' + capitalize(name) + did++ + } + + // Deep new id assignment + function assignNewId(node) { + // do the same for SVG child nodes as well + for (let i = node.children.length - 1; i >= 0; i--) { + assignNewId(node.children[i]); + } + + if (node.id) { + node.id = eid(node.nodeName); + return node + } + + return node + } + + // Method for extending objects + function extend(modules, methods) { + let key, i; + + modules = Array.isArray(modules) ? modules : [modules]; + + for (i = modules.length - 1; i >= 0; i--) { + for (key in methods) { + modules[i].prototype[key] = methods[key]; + } + } + } + + function wrapWithAttrCheck(fn) { + return function (...args) { + const o = args[args.length - 1]; + + if (o && o.constructor === Object && !(o instanceof Array)) { + return fn.apply(this, args.slice(0, -1)).attr(o) + } else { + return fn.apply(this, args) + } + } + } + + // Get all siblings, including myself + function siblings() { + return this.parent().children() + } + + // Get the current position siblings + function position() { + return this.parent().index(this) + } + + // Get the next element (will return null if there is none) + function next() { + return this.siblings()[this.position() + 1] + } + + // Get the next element (will return null if there is none) + function prev() { + return this.siblings()[this.position() - 1] + } + + // Send given element one step forward + function forward() { + const i = this.position(); + const p = this.parent(); + + // move node one step forward + p.add(this.remove(), i + 1); + + return this + } + + // Send given element one step backward + function backward() { + const i = this.position(); + const p = this.parent(); + + p.add(this.remove(), i ? i - 1 : 0); + + return this + } + + // Send given element all the way to the front + function front() { + const p = this.parent(); + + // Move node forward + p.add(this.remove()); + + return this + } + + // Send given element all the way to the back + function back() { + const p = this.parent(); + + // Move node back + p.add(this.remove(), 0); + + return this + } + + // Inserts a given element before the targeted element + function before(element) { + element = makeInstance(element); + element.remove(); + + const i = this.position(); + + this.parent().add(element, i); + + return this + } + + // Inserts a given element after the targeted element + function after(element) { + element = makeInstance(element); + element.remove(); + + const i = this.position(); + + this.parent().add(element, i + 1); + + return this + } + + function insertBefore(element) { + element = makeInstance(element); + element.before(this); + return this + } + + function insertAfter(element) { + element = makeInstance(element); + element.after(this); + return this + } + + registerMethods('Dom', { + siblings, + position, + next, + prev, + forward, + backward, + front, + back, + before, + after, + insertBefore, + insertAfter + }); + + // Parse unit value + const numberAndUnit = + /^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i; + + // Parse hex value + const hex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i; + + // Parse rgb value + const rgb = /rgb\((\d+),(\d+),(\d+)\)/; + + // Parse reference id + const reference = /(#[a-z_][a-z0-9\-_]*)/i; + + // splits a transformation chain + const transforms = /\)\s*,?\s*/; + + // Whitespace + const whitespace = /\s/g; + + // Test hex value + const isHex = /^#[a-f0-9]{3}$|^#[a-f0-9]{6}$/i; + + // Test rgb value + const isRgb = /^rgb\(/; + + // Test for blank string + const isBlank = /^(\s+)?$/; + + // Test for numeric string + const isNumber = /^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i; + + // Test for image url + const isImage = /\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i; + + // split at whitespace and comma + const delimiter = /[\s,]+/; + + // Test for path letter + const isPathLetter = /[MLHVCSQTAZ]/i; + + // Return array of classes on the node + function classes() { + const attr = this.attr('class'); + return attr == null ? [] : attr.trim().split(delimiter) + } + + // Return true if class exists on the node, false otherwise + function hasClass(name) { + return this.classes().indexOf(name) !== -1 + } + + // Add class to the node + function addClass(name) { + if (!this.hasClass(name)) { + const array = this.classes(); + array.push(name); + this.attr('class', array.join(' ')); + } + + return this + } + + // Remove class from the node + function removeClass(name) { + if (this.hasClass(name)) { + this.attr( + 'class', + this.classes() + .filter(function (c) { + return c !== name + }) + .join(' ') + ); + } + + return this + } + + // Toggle the presence of a class on the node + function toggleClass(name) { + return this.hasClass(name) ? this.removeClass(name) : this.addClass(name) + } + + registerMethods('Dom', { + classes, + hasClass, + addClass, + removeClass, + toggleClass + }); + + // Dynamic style generator + function css(style, val) { + const ret = {}; + if (arguments.length === 0) { + // get full style as object + this.node.style.cssText + .split(/\s*;\s*/) + .filter(function (el) { + return !!el.length + }) + .forEach(function (el) { + const t = el.split(/\s*:\s*/); + ret[t[0]] = t[1]; + }); + return ret + } + + if (arguments.length < 2) { + // get style properties as array + if (Array.isArray(style)) { + for (const name of style) { + const cased = name; + ret[name] = this.node.style.getPropertyValue(cased); + } + return ret + } + + // get style for property + if (typeof style === 'string') { + return this.node.style.getPropertyValue(style) + } + + // set styles in object + if (typeof style === 'object') { + for (const name in style) { + // set empty string if null/undefined/'' was given + this.node.style.setProperty( + name, + style[name] == null || isBlank.test(style[name]) ? '' : style[name] + ); + } + } + } + + // set style for property + if (arguments.length === 2) { + this.node.style.setProperty( + style, + val == null || isBlank.test(val) ? '' : val + ); + } + + return this + } + + // Show element + function show() { + return this.css('display', '') + } + + // Hide element + function hide() { + return this.css('display', 'none') + } + + // Is element visible? + function visible() { + return this.css('display') !== 'none' + } + + registerMethods('Dom', { + css, + show, + hide, + visible + }); + + // Store data values on svg nodes + function data(a, v, r) { + if (a == null) { + // get an object of attributes + return this.data( + map( + filter( + this.node.attributes, + (el) => el.nodeName.indexOf('data-') === 0 + ), + (el) => el.nodeName.slice(5) + ) + ) + } else if (a instanceof Array) { + const data = {}; + for (const key of a) { + data[key] = this.data(key); + } + return data + } else if (typeof a === 'object') { + for (v in a) { + this.data(v, a[v]); + } + } else if (arguments.length < 2) { + try { + return JSON.parse(this.attr('data-' + a)) + } catch (e) { + return this.attr('data-' + a) + } + } else { + this.attr( + 'data-' + a, + v === null + ? null + : r === true || typeof v === 'string' || typeof v === 'number' + ? v + : JSON.stringify(v) + ); + } + + return this + } + + registerMethods('Dom', { data }); + + // Remember arbitrary data + function remember(k, v) { + // remember every item in an object individually + if (typeof arguments[0] === 'object') { + for (const key in k) { + this.remember(key, k[key]); + } + } else if (arguments.length === 1) { + // retrieve memory + return this.memory()[k] + } else { + // store memory + this.memory()[k] = v; + } + + return this + } + + // Erase a given memory + function forget() { + if (arguments.length === 0) { + this._memory = {}; + } else { + for (let i = arguments.length - 1; i >= 0; i--) { + delete this.memory()[arguments[i]]; + } + } + return this + } + + // This triggers creation of a new hidden class which is not performant + // However, this function is not rarely used so it will not happen frequently + // Return local memory object + function memory() { + return (this._memory = this._memory || {}) + } + + registerMethods('Dom', { remember, forget, memory }); + + function sixDigitHex(hex) { + return hex.length === 4 + ? [ + '#', + hex.substring(1, 2), + hex.substring(1, 2), + hex.substring(2, 3), + hex.substring(2, 3), + hex.substring(3, 4), + hex.substring(3, 4) + ].join('') + : hex + } + + function componentHex(component) { + const integer = Math.round(component); + const bounded = Math.max(0, Math.min(255, integer)); + const hex = bounded.toString(16); + return hex.length === 1 ? '0' + hex : hex + } + + function is(object, space) { + for (let i = space.length; i--; ) { + if (object[space[i]] == null) { + return false + } + } + return true + } + + function getParameters(a, b) { + const params = is(a, 'rgb') + ? { _a: a.r, _b: a.g, _c: a.b, _d: 0, space: 'rgb' } + : is(a, 'xyz') + ? { _a: a.x, _b: a.y, _c: a.z, _d: 0, space: 'xyz' } + : is(a, 'hsl') + ? { _a: a.h, _b: a.s, _c: a.l, _d: 0, space: 'hsl' } + : is(a, 'lab') + ? { _a: a.l, _b: a.a, _c: a.b, _d: 0, space: 'lab' } + : is(a, 'lch') + ? { _a: a.l, _b: a.c, _c: a.h, _d: 0, space: 'lch' } + : is(a, 'cmyk') + ? { _a: a.c, _b: a.m, _c: a.y, _d: a.k, space: 'cmyk' } + : { _a: 0, _b: 0, _c: 0, space: 'rgb' }; + + params.space = b || params.space; + return params + } + + function cieSpace(space) { + if (space === 'lab' || space === 'xyz' || space === 'lch') { + return true + } else { + return false + } + } + + function hueToRgb(p, q, t) { + if (t < 0) t += 1; + if (t > 1) t -= 1; + if (t < 1 / 6) return p + (q - p) * 6 * t + if (t < 1 / 2) return q + if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6 + return p + } + + class Color { + constructor(...inputs) { + this.init(...inputs); + } + + // Test if given value is a color + static isColor(color) { + return ( + color && (color instanceof Color || this.isRgb(color) || this.test(color)) + ) + } + + // Test if given value is an rgb object + static isRgb(color) { + return ( + color && + typeof color.r === 'number' && + typeof color.g === 'number' && + typeof color.b === 'number' + ) + } + + /* + Generating random colors + */ + static random(mode = 'vibrant', t) { + // Get the math modules + const { random, round, sin, PI: pi } = Math; + + // Run the correct generator + if (mode === 'vibrant') { + const l = (81 - 57) * random() + 57; + const c = (83 - 45) * random() + 45; + const h = 360 * random(); + const color = new Color(l, c, h, 'lch'); + return color + } else if (mode === 'sine') { + t = t == null ? random() : t; + const r = round(80 * sin((2 * pi * t) / 0.5 + 0.01) + 150); + const g = round(50 * sin((2 * pi * t) / 0.5 + 4.6) + 200); + const b = round(100 * sin((2 * pi * t) / 0.5 + 2.3) + 150); + const color = new Color(r, g, b); + return color + } else if (mode === 'pastel') { + const l = (94 - 86) * random() + 86; + const c = (26 - 9) * random() + 9; + const h = 360 * random(); + const color = new Color(l, c, h, 'lch'); + return color + } else if (mode === 'dark') { + const l = 10 + 10 * random(); + const c = (125 - 75) * random() + 86; + const h = 360 * random(); + const color = new Color(l, c, h, 'lch'); + return color + } else if (mode === 'rgb') { + const r = 255 * random(); + const g = 255 * random(); + const b = 255 * random(); + const color = new Color(r, g, b); + return color + } else if (mode === 'lab') { + const l = 100 * random(); + const a = 256 * random() - 128; + const b = 256 * random() - 128; + const color = new Color(l, a, b, 'lab'); + return color + } else if (mode === 'grey') { + const grey = 255 * random(); + const color = new Color(grey, grey, grey); + return color + } else { + throw new Error('Unsupported random color mode') + } + } + + // Test if given value is a color string + static test(color) { + return typeof color === 'string' && (isHex.test(color) || isRgb.test(color)) + } + + cmyk() { + // Get the rgb values for the current color + const { _a, _b, _c } = this.rgb(); + const [r, g, b] = [_a, _b, _c].map((v) => v / 255); + + // Get the cmyk values in an unbounded format + const k = Math.min(1 - r, 1 - g, 1 - b); + + if (k === 1) { + // Catch the black case + return new Color(0, 0, 0, 1, 'cmyk') + } + + const c = (1 - r - k) / (1 - k); + const m = (1 - g - k) / (1 - k); + const y = (1 - b - k) / (1 - k); + + // Construct the new color + const color = new Color(c, m, y, k, 'cmyk'); + return color + } + + hsl() { + // Get the rgb values + const { _a, _b, _c } = this.rgb(); + const [r, g, b] = [_a, _b, _c].map((v) => v / 255); + + // Find the maximum and minimum values to get the lightness + const max = Math.max(r, g, b); + const min = Math.min(r, g, b); + const l = (max + min) / 2; + + // If the r, g, v values are identical then we are grey + const isGrey = max === min; + + // Calculate the hue and saturation + const delta = max - min; + const s = isGrey + ? 0 + : l > 0.5 + ? delta / (2 - max - min) + : delta / (max + min); + const h = isGrey + ? 0 + : max === r + ? ((g - b) / delta + (g < b ? 6 : 0)) / 6 + : max === g + ? ((b - r) / delta + 2) / 6 + : max === b + ? ((r - g) / delta + 4) / 6 + : 0; + + // Construct and return the new color + const color = new Color(360 * h, 100 * s, 100 * l, 'hsl'); + return color + } + + init(a = 0, b = 0, c = 0, d = 0, space = 'rgb') { + // This catches the case when a falsy value is passed like '' + a = !a ? 0 : a; + + // Reset all values in case the init function is rerun with new color space + if (this.space) { + for (const component in this.space) { + delete this[this.space[component]]; + } + } + + if (typeof a === 'number') { + // Allow for the case that we don't need d... + space = typeof d === 'string' ? d : space; + d = typeof d === 'string' ? 0 : d; + + // Assign the values straight to the color + Object.assign(this, { _a: a, _b: b, _c: c, _d: d, space }); + // If the user gave us an array, make the color from it + } else if (a instanceof Array) { + this.space = b || (typeof a[3] === 'string' ? a[3] : a[4]) || 'rgb'; + Object.assign(this, { _a: a[0], _b: a[1], _c: a[2], _d: a[3] || 0 }); + } else if (a instanceof Object) { + // Set the object up and assign its values directly + const values = getParameters(a, b); + Object.assign(this, values); + } else if (typeof a === 'string') { + if (isRgb.test(a)) { + const noWhitespace = a.replace(whitespace, ''); + const [_a, _b, _c] = rgb + .exec(noWhitespace) + .slice(1, 4) + .map((v) => parseInt(v)); + Object.assign(this, { _a, _b, _c, _d: 0, space: 'rgb' }); + } else if (isHex.test(a)) { + const hexParse = (v) => parseInt(v, 16); + const [, _a, _b, _c] = hex.exec(sixDigitHex(a)).map(hexParse); + Object.assign(this, { _a, _b, _c, _d: 0, space: 'rgb' }); + } else throw Error("Unsupported string format, can't construct Color") + } + + // Now add the components as a convenience + const { _a, _b, _c, _d } = this; + const components = + this.space === 'rgb' + ? { r: _a, g: _b, b: _c } + : this.space === 'xyz' + ? { x: _a, y: _b, z: _c } + : this.space === 'hsl' + ? { h: _a, s: _b, l: _c } + : this.space === 'lab' + ? { l: _a, a: _b, b: _c } + : this.space === 'lch' + ? { l: _a, c: _b, h: _c } + : this.space === 'cmyk' + ? { c: _a, m: _b, y: _c, k: _d } + : {}; + Object.assign(this, components); + } + + lab() { + // Get the xyz color + const { x, y, z } = this.xyz(); + + // Get the lab components + const l = 116 * y - 16; + const a = 500 * (x - y); + const b = 200 * (y - z); + + // Construct and return a new color + const color = new Color(l, a, b, 'lab'); + return color + } + + lch() { + // Get the lab color directly + const { l, a, b } = this.lab(); + + // Get the chromaticity and the hue using polar coordinates + const c = Math.sqrt(a ** 2 + b ** 2); + let h = (180 * Math.atan2(b, a)) / Math.PI; + if (h < 0) { + h *= -1; + h = 360 - h; + } + + // Make a new color and return it + const color = new Color(l, c, h, 'lch'); + return color + } + /* + Conversion Methods + */ + + rgb() { + if (this.space === 'rgb') { + return this + } else if (cieSpace(this.space)) { + // Convert to the xyz color space + let { x, y, z } = this; + if (this.space === 'lab' || this.space === 'lch') { + // Get the values in the lab space + let { l, a, b } = this; + if (this.space === 'lch') { + const { c, h } = this; + const dToR = Math.PI / 180; + a = c * Math.cos(dToR * h); + b = c * Math.sin(dToR * h); + } + + // Undo the nonlinear function + const yL = (l + 16) / 116; + const xL = a / 500 + yL; + const zL = yL - b / 200; + + // Get the xyz values + const ct = 16 / 116; + const mx = 0.008856; + const nm = 7.787; + x = 0.95047 * (xL ** 3 > mx ? xL ** 3 : (xL - ct) / nm); + y = 1.0 * (yL ** 3 > mx ? yL ** 3 : (yL - ct) / nm); + z = 1.08883 * (zL ** 3 > mx ? zL ** 3 : (zL - ct) / nm); + } + + // Convert xyz to unbounded rgb values + const rU = x * 3.2406 + y * -1.5372 + z * -0.4986; + const gU = x * -0.9689 + y * 1.8758 + z * 0.0415; + const bU = x * 0.0557 + y * -0.204 + z * 1.057; + + // Convert the values to true rgb values + const pow = Math.pow; + const bd = 0.0031308; + const r = rU > bd ? 1.055 * pow(rU, 1 / 2.4) - 0.055 : 12.92 * rU; + const g = gU > bd ? 1.055 * pow(gU, 1 / 2.4) - 0.055 : 12.92 * gU; + const b = bU > bd ? 1.055 * pow(bU, 1 / 2.4) - 0.055 : 12.92 * bU; + + // Make and return the color + const color = new Color(255 * r, 255 * g, 255 * b); + return color + } else if (this.space === 'hsl') { + // https://bgrins.github.io/TinyColor/docs/tinycolor.html + // Get the current hsl values + let { h, s, l } = this; + h /= 360; + s /= 100; + l /= 100; + + // If we are grey, then just make the color directly + if (s === 0) { + l *= 255; + const color = new Color(l, l, l); + return color + } + + // TODO I have no idea what this does :D If you figure it out, tell me! + const q = l < 0.5 ? l * (1 + s) : l + s - l * s; + const p = 2 * l - q; + + // Get the rgb values + const r = 255 * hueToRgb(p, q, h + 1 / 3); + const g = 255 * hueToRgb(p, q, h); + const b = 255 * hueToRgb(p, q, h - 1 / 3); + + // Make a new color + const color = new Color(r, g, b); + return color + } else if (this.space === 'cmyk') { + // https://gist.github.com/felipesabino/5066336 + // Get the normalised cmyk values + const { c, m, y, k } = this; + + // Get the rgb values + const r = 255 * (1 - Math.min(1, c * (1 - k) + k)); + const g = 255 * (1 - Math.min(1, m * (1 - k) + k)); + const b = 255 * (1 - Math.min(1, y * (1 - k) + k)); + + // Form the color and return it + const color = new Color(r, g, b); + return color + } else { + return this + } + } + + toArray() { + const { _a, _b, _c, _d, space } = this; + return [_a, _b, _c, _d, space] + } + + toHex() { + const [r, g, b] = this._clamped().map(componentHex); + return `#${r}${g}${b}` + } + + toRgb() { + const [rV, gV, bV] = this._clamped(); + const string = `rgb(${rV},${gV},${bV})`; + return string + } + + toString() { + return this.toHex() + } + + xyz() { + // Normalise the red, green and blue values + const { _a: r255, _b: g255, _c: b255 } = this.rgb(); + const [r, g, b] = [r255, g255, b255].map((v) => v / 255); + + // Convert to the lab rgb space + const rL = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92; + const gL = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92; + const bL = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92; + + // Convert to the xyz color space without bounding the values + const xU = (rL * 0.4124 + gL * 0.3576 + bL * 0.1805) / 0.95047; + const yU = (rL * 0.2126 + gL * 0.7152 + bL * 0.0722) / 1.0; + const zU = (rL * 0.0193 + gL * 0.1192 + bL * 0.9505) / 1.08883; + + // Get the proper xyz values by applying the bounding + const x = xU > 0.008856 ? Math.pow(xU, 1 / 3) : 7.787 * xU + 16 / 116; + const y = yU > 0.008856 ? Math.pow(yU, 1 / 3) : 7.787 * yU + 16 / 116; + const z = zU > 0.008856 ? Math.pow(zU, 1 / 3) : 7.787 * zU + 16 / 116; + + // Make and return the color + const color = new Color(x, y, z, 'xyz'); + return color + } + + /* + Input and Output methods + */ + + _clamped() { + const { _a, _b, _c } = this.rgb(); + const { max, min, round } = Math; + const format = (v) => max(0, min(round(v), 255)); + return [_a, _b, _c].map(format) + } + + /* + Constructing colors + */ + } + + class Point { + // Initialize + constructor(...args) { + this.init(...args); + } + + // Clone point + clone() { + return new Point(this) + } + + init(x, y) { + const base = { x: 0, y: 0 }; + + // ensure source as object + const source = Array.isArray(x) + ? { x: x[0], y: x[1] } + : typeof x === 'object' + ? { x: x.x, y: x.y } + : { x: x, y: y }; + + // merge source + this.x = source.x == null ? base.x : source.x; + this.y = source.y == null ? base.y : source.y; + + return this + } + + toArray() { + return [this.x, this.y] + } + + transform(m) { + return this.clone().transformO(m) + } + + // Transform point with matrix + transformO(m) { + if (!Matrix.isMatrixLike(m)) { + m = new Matrix(m); + } + + const { x, y } = this; + + // Perform the matrix multiplication + this.x = m.a * x + m.c * y + m.e; + this.y = m.b * x + m.d * y + m.f; + + return this + } + } + + function point(x, y) { + return new Point(x, y).transformO(this.screenCTM().inverseO()) + } + + function closeEnough(a, b, threshold) { + return Math.abs(b - a) < (threshold || 1e-6) + } + + class Matrix { + constructor(...args) { + this.init(...args); + } + + static formatTransforms(o) { + // Get all of the parameters required to form the matrix + const flipBoth = o.flip === 'both' || o.flip === true; + const flipX = o.flip && (flipBoth || o.flip === 'x') ? -1 : 1; + const flipY = o.flip && (flipBoth || o.flip === 'y') ? -1 : 1; + const skewX = + o.skew && o.skew.length + ? o.skew[0] + : isFinite(o.skew) + ? o.skew + : isFinite(o.skewX) + ? o.skewX + : 0; + const skewY = + o.skew && o.skew.length + ? o.skew[1] + : isFinite(o.skew) + ? o.skew + : isFinite(o.skewY) + ? o.skewY + : 0; + const scaleX = + o.scale && o.scale.length + ? o.scale[0] * flipX + : isFinite(o.scale) + ? o.scale * flipX + : isFinite(o.scaleX) + ? o.scaleX * flipX + : flipX; + const scaleY = + o.scale && o.scale.length + ? o.scale[1] * flipY + : isFinite(o.scale) + ? o.scale * flipY + : isFinite(o.scaleY) + ? o.scaleY * flipY + : flipY; + const shear = o.shear || 0; + const theta = o.rotate || o.theta || 0; + const origin = new Point( + o.origin || o.around || o.ox || o.originX, + o.oy || o.originY + ); + const ox = origin.x; + const oy = origin.y; + // We need Point to be invalid if nothing was passed because we cannot default to 0 here. That is why NaN + const position = new Point( + o.position || o.px || o.positionX || NaN, + o.py || o.positionY || NaN + ); + const px = position.x; + const py = position.y; + const translate = new Point( + o.translate || o.tx || o.translateX, + o.ty || o.translateY + ); + const tx = translate.x; + const ty = translate.y; + const relative = new Point( + o.relative || o.rx || o.relativeX, + o.ry || o.relativeY + ); + const rx = relative.x; + const ry = relative.y; + + // Populate all of the values + return { + scaleX, + scaleY, + skewX, + skewY, + shear, + theta, + rx, + ry, + tx, + ty, + ox, + oy, + px, + py + } + } + + static fromArray(a) { + return { a: a[0], b: a[1], c: a[2], d: a[3], e: a[4], f: a[5] } + } + + static isMatrixLike(o) { + return ( + o.a != null || + o.b != null || + o.c != null || + o.d != null || + o.e != null || + o.f != null + ) + } + + // left matrix, right matrix, target matrix which is overwritten + static matrixMultiply(l, r, o) { + // Work out the product directly + const a = l.a * r.a + l.c * r.b; + const b = l.b * r.a + l.d * r.b; + const c = l.a * r.c + l.c * r.d; + const d = l.b * r.c + l.d * r.d; + const e = l.e + l.a * r.e + l.c * r.f; + const f = l.f + l.b * r.e + l.d * r.f; + + // make sure to use local variables because l/r and o could be the same + o.a = a; + o.b = b; + o.c = c; + o.d = d; + o.e = e; + o.f = f; + + return o + } + + around(cx, cy, matrix) { + return this.clone().aroundO(cx, cy, matrix) + } + + // Transform around a center point + aroundO(cx, cy, matrix) { + const dx = cx || 0; + const dy = cy || 0; + return this.translateO(-dx, -dy).lmultiplyO(matrix).translateO(dx, dy) + } + + // Clones this matrix + clone() { + return new Matrix(this) + } + + // Decomposes this matrix into its affine parameters + decompose(cx = 0, cy = 0) { + // Get the parameters from the matrix + const a = this.a; + const b = this.b; + const c = this.c; + const d = this.d; + const e = this.e; + const f = this.f; + + // Figure out if the winding direction is clockwise or counterclockwise + const determinant = a * d - b * c; + const ccw = determinant > 0 ? 1 : -1; + + // Since we only shear in x, we can use the x basis to get the x scale + // and the rotation of the resulting matrix + const sx = ccw * Math.sqrt(a * a + b * b); + const thetaRad = Math.atan2(ccw * b, ccw * a); + const theta = (180 / Math.PI) * thetaRad; + const ct = Math.cos(thetaRad); + const st = Math.sin(thetaRad); + + // We can then solve the y basis vector simultaneously to get the other + // two affine parameters directly from these parameters + const lam = (a * c + b * d) / determinant; + const sy = (c * sx) / (lam * a - b) || (d * sx) / (lam * b + a); + + // Use the translations + const tx = e - cx + cx * ct * sx + cy * (lam * ct * sx - st * sy); + const ty = f - cy + cx * st * sx + cy * (lam * st * sx + ct * sy); + + // Construct the decomposition and return it + return { + // Return the affine parameters + scaleX: sx, + scaleY: sy, + shear: lam, + rotate: theta, + translateX: tx, + translateY: ty, + originX: cx, + originY: cy, + + // Return the matrix parameters + a: this.a, + b: this.b, + c: this.c, + d: this.d, + e: this.e, + f: this.f + } + } + + // Check if two matrices are equal + equals(other) { + if (other === this) return true + const comp = new Matrix(other); + return ( + closeEnough(this.a, comp.a) && + closeEnough(this.b, comp.b) && + closeEnough(this.c, comp.c) && + closeEnough(this.d, comp.d) && + closeEnough(this.e, comp.e) && + closeEnough(this.f, comp.f) + ) + } + + // Flip matrix on x or y, at a given offset + flip(axis, around) { + return this.clone().flipO(axis, around) + } + + flipO(axis, around) { + return axis === 'x' + ? this.scaleO(-1, 1, around, 0) + : axis === 'y' + ? this.scaleO(1, -1, 0, around) + : this.scaleO(-1, -1, axis, around || axis) // Define an x, y flip point + } + + // Initialize + init(source) { + const base = Matrix.fromArray([1, 0, 0, 1, 0, 0]); + + // ensure source as object + source = + source instanceof Element$1 + ? source.matrixify() + : typeof source === 'string' + ? Matrix.fromArray(source.split(delimiter).map(parseFloat)) + : Array.isArray(source) + ? Matrix.fromArray(source) + : typeof source === 'object' && Matrix.isMatrixLike(source) + ? source + : typeof source === 'object' + ? new Matrix().transform(source) + : arguments.length === 6 + ? Matrix.fromArray([].slice.call(arguments)) + : base; + + // Merge the source matrix with the base matrix + this.a = source.a != null ? source.a : base.a; + this.b = source.b != null ? source.b : base.b; + this.c = source.c != null ? source.c : base.c; + this.d = source.d != null ? source.d : base.d; + this.e = source.e != null ? source.e : base.e; + this.f = source.f != null ? source.f : base.f; + + return this + } + + inverse() { + return this.clone().inverseO() + } + + // Inverses matrix + inverseO() { + // Get the current parameters out of the matrix + const a = this.a; + const b = this.b; + const c = this.c; + const d = this.d; + const e = this.e; + const f = this.f; + + // Invert the 2x2 matrix in the top left + const det = a * d - b * c; + if (!det) throw new Error('Cannot invert ' + this) + + // Calculate the top 2x2 matrix + const na = d / det; + const nb = -b / det; + const nc = -c / det; + const nd = a / det; + + // Apply the inverted matrix to the top right + const ne = -(na * e + nc * f); + const nf = -(nb * e + nd * f); + + // Construct the inverted matrix + this.a = na; + this.b = nb; + this.c = nc; + this.d = nd; + this.e = ne; + this.f = nf; + + return this + } + + lmultiply(matrix) { + return this.clone().lmultiplyO(matrix) + } + + lmultiplyO(matrix) { + const r = this; + const l = matrix instanceof Matrix ? matrix : new Matrix(matrix); + + return Matrix.matrixMultiply(l, r, this) + } + + // Left multiplies by the given matrix + multiply(matrix) { + return this.clone().multiplyO(matrix) + } + + multiplyO(matrix) { + // Get the matrices + const l = this; + const r = matrix instanceof Matrix ? matrix : new Matrix(matrix); + + return Matrix.matrixMultiply(l, r, this) + } + + // Rotate matrix + rotate(r, cx, cy) { + return this.clone().rotateO(r, cx, cy) + } + + rotateO(r, cx = 0, cy = 0) { + // Convert degrees to radians + r = radians(r); + + const cos = Math.cos(r); + const sin = Math.sin(r); + + const { a, b, c, d, e, f } = this; + + this.a = a * cos - b * sin; + this.b = b * cos + a * sin; + this.c = c * cos - d * sin; + this.d = d * cos + c * sin; + this.e = e * cos - f * sin + cy * sin - cx * cos + cx; + this.f = f * cos + e * sin - cx * sin - cy * cos + cy; + + return this + } + + // Scale matrix + scale() { + return this.clone().scaleO(...arguments) + } + + scaleO(x, y = x, cx = 0, cy = 0) { + // Support uniform scaling + if (arguments.length === 3) { + cy = cx; + cx = y; + y = x; + } + + const { a, b, c, d, e, f } = this; + + this.a = a * x; + this.b = b * y; + this.c = c * x; + this.d = d * y; + this.e = e * x - cx * x + cx; + this.f = f * y - cy * y + cy; + + return this + } + + // Shear matrix + shear(a, cx, cy) { + return this.clone().shearO(a, cx, cy) + } + + // eslint-disable-next-line no-unused-vars + shearO(lx, cx = 0, cy = 0) { + const { a, b, c, d, e, f } = this; + + this.a = a + b * lx; + this.c = c + d * lx; + this.e = e + f * lx - cy * lx; + + return this + } + + // Skew Matrix + skew() { + return this.clone().skewO(...arguments) + } + + skewO(x, y = x, cx = 0, cy = 0) { + // support uniformal skew + if (arguments.length === 3) { + cy = cx; + cx = y; + y = x; + } + + // Convert degrees to radians + x = radians(x); + y = radians(y); + + const lx = Math.tan(x); + const ly = Math.tan(y); + + const { a, b, c, d, e, f } = this; + + this.a = a + b * lx; + this.b = b + a * ly; + this.c = c + d * lx; + this.d = d + c * ly; + this.e = e + f * lx - cy * lx; + this.f = f + e * ly - cx * ly; + + return this + } + + // SkewX + skewX(x, cx, cy) { + return this.skew(x, 0, cx, cy) + } + + // SkewY + skewY(y, cx, cy) { + return this.skew(0, y, cx, cy) + } + + toArray() { + return [this.a, this.b, this.c, this.d, this.e, this.f] + } + + // Convert matrix to string + toString() { + return ( + 'matrix(' + + this.a + + ',' + + this.b + + ',' + + this.c + + ',' + + this.d + + ',' + + this.e + + ',' + + this.f + + ')' + ) + } + + // Transform a matrix into another matrix by manipulating the space + transform(o) { + // Check if o is a matrix and then left multiply it directly + if (Matrix.isMatrixLike(o)) { + const matrix = new Matrix(o); + return matrix.multiplyO(this) + } + + // Get the proposed transformations and the current transformations + const t = Matrix.formatTransforms(o); + const current = this; + const { x: ox, y: oy } = new Point(t.ox, t.oy).transform(current); + + // Construct the resulting matrix + const transformer = new Matrix() + .translateO(t.rx, t.ry) + .lmultiplyO(current) + .translateO(-ox, -oy) + .scaleO(t.scaleX, t.scaleY) + .skewO(t.skewX, t.skewY) + .shearO(t.shear) + .rotateO(t.theta) + .translateO(ox, oy); + + // If we want the origin at a particular place, we force it there + if (isFinite(t.px) || isFinite(t.py)) { + const origin = new Point(ox, oy).transform(transformer); + // TODO: Replace t.px with isFinite(t.px) + // Doesn't work because t.px is also 0 if it wasn't passed + const dx = isFinite(t.px) ? t.px - origin.x : 0; + const dy = isFinite(t.py) ? t.py - origin.y : 0; + transformer.translateO(dx, dy); + } + + // Translate now after positioning + transformer.translateO(t.tx, t.ty); + return transformer + } + + // Translate matrix + translate(x, y) { + return this.clone().translateO(x, y) + } + + translateO(x, y) { + this.e += x || 0; + this.f += y || 0; + return this + } + + valueOf() { + return { + a: this.a, + b: this.b, + c: this.c, + d: this.d, + e: this.e, + f: this.f + } + } + } + + function ctm() { + return new Matrix(this.node.getCTM()) + } + + function screenCTM() { + try { + /* https://bugzilla.mozilla.org/show_bug.cgi?id=1344537 + This is needed because FF does not return the transformation matrix + for the inner coordinate system when getScreenCTM() is called on nested svgs. + However all other Browsers do that */ + if (typeof this.isRoot === 'function' && !this.isRoot()) { + const rect = this.rect(1, 1); + const m = rect.node.getScreenCTM(); + rect.remove(); + return new Matrix(m) + } + return new Matrix(this.node.getScreenCTM()) + } catch (e) { + console.warn( + `Cannot get CTM from SVG node ${this.node.nodeName}. Is the element rendered?` + ); + return new Matrix() + } + } + + register(Matrix, 'Matrix'); + + function parser() { + // Reuse cached element if possible + if (!parser.nodes) { + const svg = makeInstance().size(2, 0); + svg.node.style.cssText = [ + 'opacity: 0', + 'position: absolute', + 'left: -100%', + 'top: -100%', + 'overflow: hidden' + ].join(';'); + + svg.attr('focusable', 'false'); + svg.attr('aria-hidden', 'true'); + + const path = svg.path().node; + + parser.nodes = { svg, path }; + } + + if (!parser.nodes.svg.node.parentNode) { + const b = globals.document.body || globals.document.documentElement; + parser.nodes.svg.addTo(b); + } + + return parser.nodes + } + + function isNulledBox(box) { + return !box.width && !box.height && !box.x && !box.y + } + + function domContains(node) { + return ( + node === globals.document || + ( + globals.document.documentElement.contains || + function (node) { + // This is IE - it does not support contains() for top-level SVGs + while (node.parentNode) { + node = node.parentNode; + } + return node === globals.document + } + ).call(globals.document.documentElement, node) + ) + } + + class Box { + constructor(...args) { + this.init(...args); + } + + addOffset() { + // offset by window scroll position, because getBoundingClientRect changes when window is scrolled + this.x += globals.window.pageXOffset; + this.y += globals.window.pageYOffset; + return new Box(this) + } + + init(source) { + const base = [0, 0, 0, 0]; + source = + typeof source === 'string' + ? source.split(delimiter).map(parseFloat) + : Array.isArray(source) + ? source + : typeof source === 'object' + ? [ + source.left != null ? source.left : source.x, + source.top != null ? source.top : source.y, + source.width, + source.height + ] + : arguments.length === 4 + ? [].slice.call(arguments) + : base; + + this.x = source[0] || 0; + this.y = source[1] || 0; + this.width = this.w = source[2] || 0; + this.height = this.h = source[3] || 0; + + // Add more bounding box properties + this.x2 = this.x + this.w; + this.y2 = this.y + this.h; + this.cx = this.x + this.w / 2; + this.cy = this.y + this.h / 2; + + return this + } + + isNulled() { + return isNulledBox(this) + } + + // Merge rect box with another, return a new instance + merge(box) { + const x = Math.min(this.x, box.x); + const y = Math.min(this.y, box.y); + const width = Math.max(this.x + this.width, box.x + box.width) - x; + const height = Math.max(this.y + this.height, box.y + box.height) - y; + + return new Box(x, y, width, height) + } + + toArray() { + return [this.x, this.y, this.width, this.height] + } + + toString() { + return this.x + ' ' + this.y + ' ' + this.width + ' ' + this.height + } + + transform(m) { + if (!(m instanceof Matrix)) { + m = new Matrix(m); + } + + let xMin = Infinity; + let xMax = -Infinity; + let yMin = Infinity; + let yMax = -Infinity; + + const pts = [ + new Point(this.x, this.y), + new Point(this.x2, this.y), + new Point(this.x, this.y2), + new Point(this.x2, this.y2) + ]; + + pts.forEach(function (p) { + p = p.transform(m); + xMin = Math.min(xMin, p.x); + xMax = Math.max(xMax, p.x); + yMin = Math.min(yMin, p.y); + yMax = Math.max(yMax, p.y); + }); + + return new Box(xMin, yMin, xMax - xMin, yMax - yMin) + } + } + + function getBox(el, getBBoxFn, retry) { + let box; + + try { + // Try to get the box with the provided function + box = getBBoxFn(el.node); + + // If the box is worthless and not even in the dom, retry + // by throwing an error here... + if (isNulledBox(box) && !domContains(el.node)) { + throw new Error('Element not in the dom') + } + } catch (e) { + // ... and calling the retry handler here + box = retry(el); + } + + return box + } + + function bbox() { + // Function to get bbox is getBBox() + const getBBox = (node) => node.getBBox(); + + // Take all measures so that a stupid browser renders the element + // so we can get the bbox from it when we try again + const retry = (el) => { + try { + const clone = el.clone().addTo(parser().svg).show(); + const box = clone.node.getBBox(); + clone.remove(); + return box + } catch (e) { + // We give up... + throw new Error( + `Getting bbox of element "${ + el.node.nodeName + }" is not possible: ${e.toString()}` + ) + } + }; + + const box = getBox(this, getBBox, retry); + const bbox = new Box(box); + + return bbox + } + + function rbox(el) { + const getRBox = (node) => node.getBoundingClientRect(); + const retry = (el) => { + // There is no point in trying tricks here because if we insert the element into the dom ourselves + // it obviously will be at the wrong position + throw new Error( + `Getting rbox of element "${el.node.nodeName}" is not possible` + ) + }; + + const box = getBox(this, getRBox, retry); + const rbox = new Box(box); + + // If an element was passed, we want the bbox in the coordinate system of that element + if (el) { + return rbox.transform(el.screenCTM().inverseO()) + } + + // Else we want it in absolute screen coordinates + // Therefore we need to add the scrollOffset + return rbox.addOffset() + } + + // Checks whether the given point is inside the bounding box + function inside(x, y) { + const box = this.bbox(); + + return ( + x > box.x && y > box.y && x < box.x + box.width && y < box.y + box.height + ) + } + + registerMethods({ + viewbox: { + viewbox(x, y, width, height) { + // act as getter + if (x == null) return new Box(this.attr('viewBox')) + + // act as setter + return this.attr('viewBox', new Box(x, y, width, height)) + }, + + zoom(level, point) { + // Its best to rely on the attributes here and here is why: + // clientXYZ: Doesn't work on non-root svgs because they dont have a CSSBox (silly!) + // getBoundingClientRect: Doesn't work because Chrome just ignores width and height of nested svgs completely + // that means, their clientRect is always as big as the content. + // Furthermore this size is incorrect if the element is further transformed by its parents + // computedStyle: Only returns meaningful values if css was used with px. We dont go this route here! + // getBBox: returns the bounding box of its content - that doesn't help! + let { width, height } = this.attr(['width', 'height']); + + // Width and height is a string when a number with a unit is present which we can't use + // So we try clientXYZ + if ( + (!width && !height) || + typeof width === 'string' || + typeof height === 'string' + ) { + width = this.node.clientWidth; + height = this.node.clientHeight; + } + + // Giving up... + if (!width || !height) { + throw new Error( + 'Impossible to get absolute width and height. Please provide an absolute width and height attribute on the zooming element' + ) + } + + const v = this.viewbox(); + + const zoomX = width / v.width; + const zoomY = height / v.height; + const zoom = Math.min(zoomX, zoomY); + + if (level == null) { + return zoom + } + + let zoomAmount = zoom / level; + + // Set the zoomAmount to the highest value which is safe to process and recover from + // The * 100 is a bit of wiggle room for the matrix transformation + if (zoomAmount === Infinity) zoomAmount = Number.MAX_SAFE_INTEGER / 100; + + point = + point || new Point(width / 2 / zoomX + v.x, height / 2 / zoomY + v.y); + + const box = new Box(v).transform( + new Matrix({ scale: zoomAmount, origin: point }) + ); + + return this.viewbox(box) + } + } + }); + + register(Box, 'Box'); + + // import { subClassArray } from './ArrayPolyfill.js' + + class List extends Array { + constructor(arr = [], ...args) { + super(arr, ...args); + if (typeof arr === 'number') return this + this.length = 0; + this.push(...arr); + } + } + + extend([List], { + each(fnOrMethodName, ...args) { + if (typeof fnOrMethodName === 'function') { + return this.map((el, i, arr) => { + return fnOrMethodName.call(el, el, i, arr) + }) + } else { + return this.map((el) => { + return el[fnOrMethodName](...args) + }) + } + }, + + toArray() { + return Array.prototype.concat.apply([], this) + } + }); + + const reserved = ['toArray', 'constructor', 'each']; + + List.extend = function (methods) { + methods = methods.reduce((obj, name) => { + // Don't overwrite own methods + if (reserved.includes(name)) return obj + + // Don't add private methods + if (name[0] === '_') return obj + + // Allow access to original Array methods through a prefix + if (name in Array.prototype) { + obj['$' + name] = Array.prototype[name]; + } + + // Relay every call to each() + obj[name] = function (...attrs) { + return this.each(name, ...attrs) + }; + return obj + }, {}); + + extend([List], methods); + }; + + function baseFind(query, parent) { + return new List( + map((parent || globals.document).querySelectorAll(query), function (node) { + return adopt(node) + }) + ) + } + + // Scoped find method + function find(query) { + return baseFind(query, this.node) + } + + function findOne(query) { + return adopt(this.node.querySelector(query)) + } + + let listenerId = 0; + const windowEvents = {}; + + function getEvents(instance) { + let n = instance.getEventHolder(); + + // We dont want to save events in global space + if (n === globals.window) n = windowEvents; + if (!n.events) n.events = {}; + return n.events + } + + function getEventTarget(instance) { + return instance.getEventTarget() + } + + function clearEvents(instance) { + let n = instance.getEventHolder(); + if (n === globals.window) n = windowEvents; + if (n.events) n.events = {}; + } + + // Add event binder in the SVG namespace + function on(node, events, listener, binding, options) { + const l = listener.bind(binding || node); + const instance = makeInstance(node); + const bag = getEvents(instance); + const n = getEventTarget(instance); + + // events can be an array of events or a string of events + events = Array.isArray(events) ? events : events.split(delimiter); + + // add id to listener + if (!listener._svgjsListenerId) { + listener._svgjsListenerId = ++listenerId; + } + + events.forEach(function (event) { + const ev = event.split('.')[0]; + const ns = event.split('.')[1] || '*'; + + // ensure valid object + bag[ev] = bag[ev] || {}; + bag[ev][ns] = bag[ev][ns] || {}; + + // reference listener + bag[ev][ns][listener._svgjsListenerId] = l; + + // add listener + n.addEventListener(ev, l, options || false); + }); + } + + // Add event unbinder in the SVG namespace + function off(node, events, listener, options) { + const instance = makeInstance(node); + const bag = getEvents(instance); + const n = getEventTarget(instance); + + // listener can be a function or a number + if (typeof listener === 'function') { + listener = listener._svgjsListenerId; + if (!listener) return + } + + // events can be an array of events or a string or undefined + events = Array.isArray(events) ? events : (events || '').split(delimiter); + + events.forEach(function (event) { + const ev = event && event.split('.')[0]; + const ns = event && event.split('.')[1]; + let namespace, l; + + if (listener) { + // remove listener reference + if (bag[ev] && bag[ev][ns || '*']) { + // removeListener + n.removeEventListener( + ev, + bag[ev][ns || '*'][listener], + options || false + ); + + delete bag[ev][ns || '*'][listener]; + } + } else if (ev && ns) { + // remove all listeners for a namespaced event + if (bag[ev] && bag[ev][ns]) { + for (l in bag[ev][ns]) { + off(n, [ev, ns].join('.'), l); + } + + delete bag[ev][ns]; + } + } else if (ns) { + // remove all listeners for a specific namespace + for (event in bag) { + for (namespace in bag[event]) { + if (ns === namespace) { + off(n, [event, ns].join('.')); + } + } + } + } else if (ev) { + // remove all listeners for the event + if (bag[ev]) { + for (namespace in bag[ev]) { + off(n, [ev, namespace].join('.')); + } + + delete bag[ev]; + } + } else { + // remove all listeners on a given node + for (event in bag) { + off(n, event); + } + + clearEvents(instance); + } + }); + } + + function dispatch(node, event, data, options) { + const n = getEventTarget(node); + + // Dispatch event + if (event instanceof globals.window.Event) { + n.dispatchEvent(event); + } else { + event = new globals.window.CustomEvent(event, { + detail: data, + cancelable: true, + ...options + }); + n.dispatchEvent(event); + } + return event + } + + class EventTarget extends Base$1 { + addEventListener() {} + + dispatch(event, data, options) { + return dispatch(this, event, data, options) + } + + dispatchEvent(event) { + const bag = this.getEventHolder().events; + if (!bag) return true + + const events = bag[event.type]; + + for (const i in events) { + for (const j in events[i]) { + events[i][j](event); + } + } + + return !event.defaultPrevented + } + + // Fire given event + fire(event, data, options) { + this.dispatch(event, data, options); + return this + } + + getEventHolder() { + return this + } + + getEventTarget() { + return this + } + + // Unbind event from listener + off(event, listener, options) { + off(this, event, listener, options); + return this + } + + // Bind given event to listener + on(event, listener, binding, options) { + on(this, event, listener, binding, options); + return this + } + + removeEventListener() {} + } + + register(EventTarget, 'EventTarget'); + + function noop() {} + + // Default animation values + const timeline = { + duration: 400, + ease: '>', + delay: 0 + }; + + // Default attribute values + const attrs = { + // fill and stroke + 'fill-opacity': 1, + 'stroke-opacity': 1, + 'stroke-width': 0, + 'stroke-linejoin': 'miter', + 'stroke-linecap': 'butt', + fill: '#000000', + stroke: '#000000', + opacity: 1, + + // position + x: 0, + y: 0, + cx: 0, + cy: 0, + + // size + width: 0, + height: 0, + + // radius + r: 0, + rx: 0, + ry: 0, + + // gradient + offset: 0, + 'stop-opacity': 1, + 'stop-color': '#000000', + + // text + 'text-anchor': 'start' + }; + + class SVGArray extends Array { + constructor(...args) { + super(...args); + this.init(...args); + } + + clone() { + return new this.constructor(this) + } + + init(arr) { + // This catches the case, that native map tries to create an array with new Array(1) + if (typeof arr === 'number') return this + this.length = 0; + this.push(...this.parse(arr)); + return this + } + + // Parse whitespace separated string + parse(array = []) { + // If already is an array, no need to parse it + if (array instanceof Array) return array + + return array.trim().split(delimiter).map(parseFloat) + } + + toArray() { + return Array.prototype.concat.apply([], this) + } + + toSet() { + return new Set(this) + } + + toString() { + return this.join(' ') + } + + // Flattens the array if needed + valueOf() { + const ret = []; + ret.push(...this); + return ret + } + } + + // Module for unit conversions + class SVGNumber { + // Initialize + constructor(...args) { + this.init(...args); + } + + convert(unit) { + return new SVGNumber(this.value, unit) + } + + // Divide number + divide(number) { + number = new SVGNumber(number); + return new SVGNumber(this / number, this.unit || number.unit) + } + + init(value, unit) { + unit = Array.isArray(value) ? value[1] : unit; + value = Array.isArray(value) ? value[0] : value; + + // initialize defaults + this.value = 0; + this.unit = unit || ''; + + // parse value + if (typeof value === 'number') { + // ensure a valid numeric value + this.value = isNaN(value) + ? 0 + : !isFinite(value) + ? value < 0 + ? -3.4e38 + : +3.4e38 + : value; + } else if (typeof value === 'string') { + unit = value.match(numberAndUnit); + + if (unit) { + // make value numeric + this.value = parseFloat(unit[1]); + + // normalize + if (unit[5] === '%') { + this.value /= 100; + } else if (unit[5] === 's') { + this.value *= 1000; + } + + // store unit + this.unit = unit[5]; + } + } else { + if (value instanceof SVGNumber) { + this.value = value.valueOf(); + this.unit = value.unit; + } + } + + return this + } + + // Subtract number + minus(number) { + number = new SVGNumber(number); + return new SVGNumber(this - number, this.unit || number.unit) + } + + // Add number + plus(number) { + number = new SVGNumber(number); + return new SVGNumber(this + number, this.unit || number.unit) + } + + // Multiply number + times(number) { + number = new SVGNumber(number); + return new SVGNumber(this * number, this.unit || number.unit) + } + + toArray() { + return [this.value, this.unit] + } + + toJSON() { + return this.toString() + } + + toString() { + return ( + (this.unit === '%' + ? ~~(this.value * 1e8) / 1e6 + : this.unit === 's' + ? this.value / 1e3 + : this.value) + this.unit + ) + } + + valueOf() { + return this.value + } + } + + const colorAttributes = new Set([ + 'fill', + 'stroke', + 'color', + 'bgcolor', + 'stop-color', + 'flood-color', + 'lighting-color' + ]); + + const hooks = []; + function registerAttrHook(fn) { + hooks.push(fn); + } + + // Set svg element attribute + function attr(attr, val, ns) { + // act as full getter + if (attr == null) { + // get an object of attributes + attr = {}; + val = this.node.attributes; + + for (const node of val) { + attr[node.nodeName] = isNumber.test(node.nodeValue) + ? parseFloat(node.nodeValue) + : node.nodeValue; + } + + return attr + } else if (attr instanceof Array) { + // loop through array and get all values + return attr.reduce((last, curr) => { + last[curr] = this.attr(curr); + return last + }, {}) + } else if (typeof attr === 'object' && attr.constructor === Object) { + // apply every attribute individually if an object is passed + for (val in attr) this.attr(val, attr[val]); + } else if (val === null) { + // remove value + this.node.removeAttribute(attr); + } else if (val == null) { + // act as a getter if the first and only argument is not an object + val = this.node.getAttribute(attr); + return val == null + ? attrs[attr] + : isNumber.test(val) + ? parseFloat(val) + : val + } else { + // Loop through hooks and execute them to convert value + val = hooks.reduce((_val, hook) => { + return hook(attr, _val, this) + }, val); + + // ensure correct numeric values (also accepts NaN and Infinity) + if (typeof val === 'number') { + val = new SVGNumber(val); + } else if (colorAttributes.has(attr) && Color.isColor(val)) { + // ensure full hex color + val = new Color(val); + } else if (val.constructor === Array) { + // Check for plain arrays and parse array values + val = new SVGArray(val); + } + + // if the passed attribute is leading... + if (attr === 'leading') { + // ... call the leading method instead + if (this.leading) { + this.leading(val); + } + } else { + // set given attribute on node + typeof ns === 'string' + ? this.node.setAttributeNS(ns, attr, val.toString()) + : this.node.setAttribute(attr, val.toString()); + } + + // rebuild if required + if (this.rebuild && (attr === 'font-size' || attr === 'x')) { + this.rebuild(); + } + } + + return this + } + + class Dom extends EventTarget { + constructor(node, attrs) { + super(); + this.node = node; + this.type = node.nodeName; + + if (attrs && node !== attrs) { + this.attr(attrs); + } + } + + // Add given element at a position + add(element, i) { + element = makeInstance(element); + + // If non-root svg nodes are added we have to remove their namespaces + if ( + element.removeNamespace && + this.node instanceof globals.window.SVGElement + ) { + element.removeNamespace(); + } + + if (i == null) { + this.node.appendChild(element.node); + } else if (element.node !== this.node.childNodes[i]) { + this.node.insertBefore(element.node, this.node.childNodes[i]); + } + + return this + } + + // Add element to given container and return self + addTo(parent, i) { + return makeInstance(parent).put(this, i) + } + + // Returns all child elements + children() { + return new List( + map(this.node.children, function (node) { + return adopt(node) + }) + ) + } + + // Remove all elements in this container + clear() { + // remove children + while (this.node.hasChildNodes()) { + this.node.removeChild(this.node.lastChild); + } + + return this + } + + // Clone element + clone(deep = true, assignNewIds = true) { + // write dom data to the dom so the clone can pickup the data + this.writeDataToDom(); + + // clone element + let nodeClone = this.node.cloneNode(deep); + if (assignNewIds) { + // assign new id + nodeClone = assignNewId(nodeClone); + } + return new this.constructor(nodeClone) + } + + // Iterates over all children and invokes a given block + each(block, deep) { + const children = this.children(); + let i, il; + + for (i = 0, il = children.length; i < il; i++) { + block.apply(children[i], [i, children]); + + if (deep) { + children[i].each(block, deep); + } + } + + return this + } + + element(nodeName, attrs) { + return this.put(new Dom(create(nodeName), attrs)) + } + + // Get first child + first() { + return adopt(this.node.firstChild) + } + + // Get a element at the given index + get(i) { + return adopt(this.node.childNodes[i]) + } + + getEventHolder() { + return this.node + } + + getEventTarget() { + return this.node + } + + // Checks if the given element is a child + has(element) { + return this.index(element) >= 0 + } + + html(htmlOrFn, outerHTML) { + return this.xml(htmlOrFn, outerHTML, html) + } + + // Get / set id + id(id) { + // generate new id if no id set + if (typeof id === 'undefined' && !this.node.id) { + this.node.id = eid(this.type); + } + + // don't set directly with this.node.id to make `null` work correctly + return this.attr('id', id) + } + + // Gets index of given element + index(element) { + return [].slice.call(this.node.childNodes).indexOf(element.node) + } + + // Get the last child + last() { + return adopt(this.node.lastChild) + } + + // matches the element vs a css selector + matches(selector) { + const el = this.node; + const matcher = + el.matches || + el.matchesSelector || + el.msMatchesSelector || + el.mozMatchesSelector || + el.webkitMatchesSelector || + el.oMatchesSelector || + null; + return matcher && matcher.call(el, selector) + } + + // Returns the parent element instance + parent(type) { + let parent = this; + + // check for parent + if (!parent.node.parentNode) return null + + // get parent element + parent = adopt(parent.node.parentNode); + + if (!type) return parent + + // loop through ancestors if type is given + do { + if ( + typeof type === 'string' ? parent.matches(type) : parent instanceof type + ) + return parent + } while ((parent = adopt(parent.node.parentNode))) + + return parent + } + + // Basically does the same as `add()` but returns the added element instead + put(element, i) { + element = makeInstance(element); + this.add(element, i); + return element + } + + // Add element to given container and return container + putIn(parent, i) { + return makeInstance(parent).add(this, i) + } + + // Remove element + remove() { + if (this.parent()) { + this.parent().removeElement(this); + } + + return this + } + + // Remove a given child + removeElement(element) { + this.node.removeChild(element.node); + + return this + } + + // Replace this with element + replace(element) { + element = makeInstance(element); + + if (this.node.parentNode) { + this.node.parentNode.replaceChild(element.node, this.node); + } + + return element + } + + round(precision = 2, map = null) { + const factor = 10 ** precision; + const attrs = this.attr(map); + + for (const i in attrs) { + if (typeof attrs[i] === 'number') { + attrs[i] = Math.round(attrs[i] * factor) / factor; + } + } + + this.attr(attrs); + return this + } + + // Import / Export raw svg + svg(svgOrFn, outerSVG) { + return this.xml(svgOrFn, outerSVG, svg) + } + + // Return id on string conversion + toString() { + return this.id() + } + + words(text) { + // This is faster than removing all children and adding a new one + this.node.textContent = text; + return this + } + + wrap(node) { + const parent = this.parent(); + + if (!parent) { + return this.addTo(node) + } + + const position = parent.index(this); + return parent.put(node, position).put(this) + } + + // write svgjs data to the dom + writeDataToDom() { + // dump variables recursively + this.each(function () { + this.writeDataToDom(); + }); + + return this + } + + // Import / Export raw svg + xml(xmlOrFn, outerXML, ns) { + if (typeof xmlOrFn === 'boolean') { + ns = outerXML; + outerXML = xmlOrFn; + xmlOrFn = null; + } + + // act as getter if no svg string is given + if (xmlOrFn == null || typeof xmlOrFn === 'function') { + // The default for exports is, that the outerNode is included + outerXML = outerXML == null ? true : outerXML; + + // write svgjs data to the dom + this.writeDataToDom(); + let current = this; + + // An export modifier was passed + if (xmlOrFn != null) { + current = adopt(current.node.cloneNode(true)); + + // If the user wants outerHTML we need to process this node, too + if (outerXML) { + const result = xmlOrFn(current); + current = result || current; + + // The user does not want this node? Well, then he gets nothing + if (result === false) return '' + } + + // Deep loop through all children and apply modifier + current.each(function () { + const result = xmlOrFn(this); + const _this = result || this; + + // If modifier returns false, discard node + if (result === false) { + this.remove(); + + // If modifier returns new node, use it + } else if (result && this !== _this) { + this.replace(_this); + } + }, true); + } + + // Return outer or inner content + return outerXML ? current.node.outerHTML : current.node.innerHTML + } + + // Act as setter if we got a string + + // The default for import is, that the current node is not replaced + outerXML = outerXML == null ? false : outerXML; + + // Create temporary holder + const well = create('wrapper', ns); + const fragment = globals.document.createDocumentFragment(); + + // Dump raw svg + well.innerHTML = xmlOrFn; + + // Transplant nodes into the fragment + for (let len = well.children.length; len--; ) { + fragment.appendChild(well.firstElementChild); + } + + const parent = this.parent(); + + // Add the whole fragment at once + return outerXML ? this.replace(fragment) && parent : this.add(fragment) + } + } + + extend(Dom, { attr, find, findOne }); + register(Dom, 'Dom'); + + let Element$1 = class Element extends Dom { + constructor(node, attrs) { + super(node, attrs); + + // initialize data object + this.dom = {}; + + // create circular reference + this.node.instance = this; + + if (node.hasAttribute('data-svgjs') || node.hasAttribute('svgjs:data')) { + // pull svgjs data from the dom (getAttributeNS doesn't work in html5) + this.setData( + JSON.parse(node.getAttribute('data-svgjs')) ?? + JSON.parse(node.getAttribute('svgjs:data')) ?? + {} + ); + } + } + + // Move element by its center + center(x, y) { + return this.cx(x).cy(y) + } + + // Move by center over x-axis + cx(x) { + return x == null + ? this.x() + this.width() / 2 + : this.x(x - this.width() / 2) + } + + // Move by center over y-axis + cy(y) { + return y == null + ? this.y() + this.height() / 2 + : this.y(y - this.height() / 2) + } + + // Get defs + defs() { + const root = this.root(); + return root && root.defs() + } + + // Relative move over x and y axes + dmove(x, y) { + return this.dx(x).dy(y) + } + + // Relative move over x axis + dx(x = 0) { + return this.x(new SVGNumber(x).plus(this.x())) + } + + // Relative move over y axis + dy(y = 0) { + return this.y(new SVGNumber(y).plus(this.y())) + } + + getEventHolder() { + return this + } + + // Set height of element + height(height) { + return this.attr('height', height) + } + + // Move element to given x and y values + move(x, y) { + return this.x(x).y(y) + } + + // return array of all ancestors of given type up to the root svg + parents(until = this.root()) { + const isSelector = typeof until === 'string'; + if (!isSelector) { + until = makeInstance(until); + } + const parents = new List(); + let parent = this; + + while ( + (parent = parent.parent()) && + parent.node !== globals.document && + parent.nodeName !== '#document-fragment' + ) { + parents.push(parent); + + if (!isSelector && parent.node === until.node) { + break + } + if (isSelector && parent.matches(until)) { + break + } + if (parent.node === this.root().node) { + // We worked our way to the root and didn't match `until` + return null + } + } + + return parents + } + + // Get referenced element form attribute value + reference(attr) { + attr = this.attr(attr); + if (!attr) return null + + const m = (attr + '').match(reference); + return m ? makeInstance(m[1]) : null + } + + // Get parent document + root() { + const p = this.parent(getClass(root)); + return p && p.root() + } + + // set given data to the elements data property + setData(o) { + this.dom = o; + return this + } + + // Set element size to given width and height + size(width, height) { + const p = proportionalSize(this, width, height); + + return this.width(new SVGNumber(p.width)).height(new SVGNumber(p.height)) + } + + // Set width of element + width(width) { + return this.attr('width', width) + } + + // write svgjs data to the dom + writeDataToDom() { + writeDataToDom(this, this.dom); + return super.writeDataToDom() + } + + // Move over x-axis + x(x) { + return this.attr('x', x) + } + + // Move over y-axis + y(y) { + return this.attr('y', y) + } + }; + + extend(Element$1, { + bbox, + rbox, + inside, + point, + ctm, + screenCTM + }); + + register(Element$1, 'Element'); + + // Define list of available attributes for stroke and fill + const sugar = { + stroke: [ + 'color', + 'width', + 'opacity', + 'linecap', + 'linejoin', + 'miterlimit', + 'dasharray', + 'dashoffset' + ], + fill: ['color', 'opacity', 'rule'], + prefix: function (t, a) { + return a === 'color' ? t : t + '-' + a + } + } + + // Add sugar for fill and stroke + ;['fill', 'stroke'].forEach(function (m) { + const extension = {}; + let i; + + extension[m] = function (o) { + if (typeof o === 'undefined') { + return this.attr(m) + } + if ( + typeof o === 'string' || + o instanceof Color || + Color.isRgb(o) || + o instanceof Element$1 + ) { + this.attr(m, o); + } else { + // set all attributes from sugar.fill and sugar.stroke list + for (i = sugar[m].length - 1; i >= 0; i--) { + if (o[sugar[m][i]] != null) { + this.attr(sugar.prefix(m, sugar[m][i]), o[sugar[m][i]]); + } + } + } + + return this + }; + + registerMethods(['Element', 'Runner'], extension); + }); + + registerMethods(['Element', 'Runner'], { + // Let the user set the matrix directly + matrix: function (mat, b, c, d, e, f) { + // Act as a getter + if (mat == null) { + return new Matrix(this) + } + + // Act as a setter, the user can pass a matrix or a set of numbers + return this.attr('transform', new Matrix(mat, b, c, d, e, f)) + }, + + // Map rotation to transform + rotate: function (angle, cx, cy) { + return this.transform({ rotate: angle, ox: cx, oy: cy }, true) + }, + + // Map skew to transform + skew: function (x, y, cx, cy) { + return arguments.length === 1 || arguments.length === 3 + ? this.transform({ skew: x, ox: y, oy: cx }, true) + : this.transform({ skew: [x, y], ox: cx, oy: cy }, true) + }, + + shear: function (lam, cx, cy) { + return this.transform({ shear: lam, ox: cx, oy: cy }, true) + }, + + // Map scale to transform + scale: function (x, y, cx, cy) { + return arguments.length === 1 || arguments.length === 3 + ? this.transform({ scale: x, ox: y, oy: cx }, true) + : this.transform({ scale: [x, y], ox: cx, oy: cy }, true) + }, + + // Map translate to transform + translate: function (x, y) { + return this.transform({ translate: [x, y] }, true) + }, + + // Map relative translations to transform + relative: function (x, y) { + return this.transform({ relative: [x, y] }, true) + }, + + // Map flip to transform + flip: function (direction = 'both', origin = 'center') { + if ('xybothtrue'.indexOf(direction) === -1) { + origin = direction; + direction = 'both'; + } + + return this.transform({ flip: direction, origin: origin }, true) + }, + + // Opacity + opacity: function (value) { + return this.attr('opacity', value) + } + }); + + registerMethods('radius', { + // Add x and y radius + radius: function (x, y = x) { + const type = (this._element || this).type; + return type === 'radialGradient' + ? this.attr('r', new SVGNumber(x)) + : this.rx(x).ry(y) + } + }); + + registerMethods('Path', { + // Get path length + length: function () { + return this.node.getTotalLength() + }, + // Get point at length + pointAt: function (length) { + return new Point(this.node.getPointAtLength(length)) + } + }); + + registerMethods(['Element', 'Runner'], { + // Set font + font: function (a, v) { + if (typeof a === 'object') { + for (v in a) this.font(v, a[v]); + return this + } + + return a === 'leading' + ? this.leading(v) + : a === 'anchor' + ? this.attr('text-anchor', v) + : a === 'size' || + a === 'family' || + a === 'weight' || + a === 'stretch' || + a === 'variant' || + a === 'style' + ? this.attr('font-' + a, v) + : this.attr(a, v) + } + }); + + // Add events to elements + const methods = [ + 'click', + 'dblclick', + 'mousedown', + 'mouseup', + 'mouseover', + 'mouseout', + 'mousemove', + 'mouseenter', + 'mouseleave', + 'touchstart', + 'touchmove', + 'touchleave', + 'touchend', + 'touchcancel', + 'contextmenu', + 'wheel', + 'pointerdown', + 'pointermove', + 'pointerup', + 'pointerleave', + 'pointercancel' + ].reduce(function (last, event) { + // add event to Element + const fn = function (f) { + if (f === null) { + this.off(event); + } else { + this.on(event, f); + } + return this + }; + + last[event] = fn; + return last + }, {}); + + registerMethods('Element', methods); + + // Reset all transformations + function untransform() { + return this.attr('transform', null) + } + + // merge the whole transformation chain into one matrix and returns it + function matrixify() { + const matrix = (this.attr('transform') || '') + // split transformations + .split(transforms) + .slice(0, -1) + .map(function (str) { + // generate key => value pairs + const kv = str.trim().split('('); + return [ + kv[0], + kv[1].split(delimiter).map(function (str) { + return parseFloat(str) + }) + ] + }) + .reverse() + // merge every transformation into one matrix + .reduce(function (matrix, transform) { + if (transform[0] === 'matrix') { + return matrix.lmultiply(Matrix.fromArray(transform[1])) + } + return matrix[transform[0]].apply(matrix, transform[1]) + }, new Matrix()); + + return matrix + } + + // add an element to another parent without changing the visual representation on the screen + function toParent(parent, i) { + if (this === parent) return this + + if (isDescriptive(this.node)) return this.addTo(parent, i) + + const ctm = this.screenCTM(); + const pCtm = parent.screenCTM().inverse(); + + this.addTo(parent, i).untransform().transform(pCtm.multiply(ctm)); + + return this + } + + // same as above with parent equals root-svg + function toRoot(i) { + return this.toParent(this.root(), i) + } + + // Add transformations + function transform(o, relative) { + // Act as a getter if no object was passed + if (o == null || typeof o === 'string') { + const decomposed = new Matrix(this).decompose(); + return o == null ? decomposed : decomposed[o] + } + + if (!Matrix.isMatrixLike(o)) { + // Set the origin according to the defined transform + o = { ...o, origin: getOrigin(o, this) }; + } + + // The user can pass a boolean, an Element or an Matrix or nothing + const cleanRelative = relative === true ? this : relative || false; + const result = new Matrix(cleanRelative).transform(o); + return this.attr('transform', result) + } + + registerMethods('Element', { + untransform, + matrixify, + toParent, + toRoot, + transform + }); + + class Container extends Element$1 { + flatten() { + this.each(function () { + if (this instanceof Container) { + return this.flatten().ungroup() + } + }); + + return this + } + + ungroup(parent = this.parent(), index = parent.index(this)) { + // when parent != this, we want append all elements to the end + index = index === -1 ? parent.children().length : index; + + this.each(function (i, children) { + // reverse each + return children[children.length - i - 1].toParent(parent, index) + }); + + return this.remove() + } + } + + register(Container, 'Container'); + + class Defs extends Container { + constructor(node, attrs = node) { + super(nodeOrNew('defs', node), attrs); + } + + flatten() { + return this + } + + ungroup() { + return this + } + } + + register(Defs, 'Defs'); + + class Shape extends Element$1 {} + + register(Shape, 'Shape'); + + // Radius x value + function rx(rx) { + return this.attr('rx', rx) + } + + // Radius y value + function ry(ry) { + return this.attr('ry', ry) + } + + // Move over x-axis + function x$3(x) { + return x == null ? this.cx() - this.rx() : this.cx(x + this.rx()) + } + + // Move over y-axis + function y$3(y) { + return y == null ? this.cy() - this.ry() : this.cy(y + this.ry()) + } + + // Move by center over x-axis + function cx$1(x) { + return this.attr('cx', x) + } + + // Move by center over y-axis + function cy$1(y) { + return this.attr('cy', y) + } + + // Set width of element + function width$2(width) { + return width == null ? this.rx() * 2 : this.rx(new SVGNumber(width).divide(2)) + } + + // Set height of element + function height$2(height) { + return height == null + ? this.ry() * 2 + : this.ry(new SVGNumber(height).divide(2)) + } + + var circled = /*#__PURE__*/Object.freeze({ + __proto__: null, + cx: cx$1, + cy: cy$1, + height: height$2, + rx: rx, + ry: ry, + width: width$2, + x: x$3, + y: y$3 + }); + + class Ellipse extends Shape { + constructor(node, attrs = node) { + super(nodeOrNew('ellipse', node), attrs); + } + + size(width, height) { + const p = proportionalSize(this, width, height); + + return this.rx(new SVGNumber(p.width).divide(2)).ry( + new SVGNumber(p.height).divide(2) + ) + } + } + + extend(Ellipse, circled); + + registerMethods('Container', { + // Create an ellipse + ellipse: wrapWithAttrCheck(function (width = 0, height = width) { + return this.put(new Ellipse()).size(width, height).move(0, 0) + }) + }); + + register(Ellipse, 'Ellipse'); + + class Fragment extends Dom { + constructor(node = globals.document.createDocumentFragment()) { + super(node); + } + + // Import / Export raw xml + xml(xmlOrFn, outerXML, ns) { + if (typeof xmlOrFn === 'boolean') { + ns = outerXML; + outerXML = xmlOrFn; + xmlOrFn = null; + } + + // because this is a fragment we have to put all elements into a wrapper first + // before we can get the innerXML from it + if (xmlOrFn == null || typeof xmlOrFn === 'function') { + const wrapper = new Dom(create('wrapper', ns)); + wrapper.add(this.node.cloneNode(true)); + + return wrapper.xml(false, ns) + } + + // Act as setter if we got a string + return super.xml(xmlOrFn, false, ns) + } + } + + register(Fragment, 'Fragment'); + + function from(x, y) { + return (this._element || this).type === 'radialGradient' + ? this.attr({ fx: new SVGNumber(x), fy: new SVGNumber(y) }) + : this.attr({ x1: new SVGNumber(x), y1: new SVGNumber(y) }) + } + + function to(x, y) { + return (this._element || this).type === 'radialGradient' + ? this.attr({ cx: new SVGNumber(x), cy: new SVGNumber(y) }) + : this.attr({ x2: new SVGNumber(x), y2: new SVGNumber(y) }) + } + + var gradiented = /*#__PURE__*/Object.freeze({ + __proto__: null, + from: from, + to: to + }); + + class Gradient extends Container { + constructor(type, attrs) { + super( + nodeOrNew(type + 'Gradient', typeof type === 'string' ? null : type), + attrs + ); + } + + // custom attr to handle transform + attr(a, b, c) { + if (a === 'transform') a = 'gradientTransform'; + return super.attr(a, b, c) + } + + bbox() { + return new Box() + } + + targets() { + return baseFind('svg [fill*=' + this.id() + ']') + } + + // Alias string conversion to fill + toString() { + return this.url() + } + + // Update gradient + update(block) { + // remove all stops + this.clear(); + + // invoke passed block + if (typeof block === 'function') { + block.call(this, this); + } + + return this + } + + // Return the fill id + url() { + return 'url(#' + this.id() + ')' + } + } + + extend(Gradient, gradiented); + + registerMethods({ + Container: { + // Create gradient element in defs + gradient(...args) { + return this.defs().gradient(...args) + } + }, + // define gradient + Defs: { + gradient: wrapWithAttrCheck(function (type, block) { + return this.put(new Gradient(type)).update(block) + }) + } + }); + + register(Gradient, 'Gradient'); + + class Pattern extends Container { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('pattern', node), attrs); + } + + // custom attr to handle transform + attr(a, b, c) { + if (a === 'transform') a = 'patternTransform'; + return super.attr(a, b, c) + } + + bbox() { + return new Box() + } + + targets() { + return baseFind('svg [fill*=' + this.id() + ']') + } + + // Alias string conversion to fill + toString() { + return this.url() + } + + // Update pattern by rebuilding + update(block) { + // remove content + this.clear(); + + // invoke passed block + if (typeof block === 'function') { + block.call(this, this); + } + + return this + } + + // Return the fill id + url() { + return 'url(#' + this.id() + ')' + } + } + + registerMethods({ + Container: { + // Create pattern element in defs + pattern(...args) { + return this.defs().pattern(...args) + } + }, + Defs: { + pattern: wrapWithAttrCheck(function (width, height, block) { + return this.put(new Pattern()).update(block).attr({ + x: 0, + y: 0, + width: width, + height: height, + patternUnits: 'userSpaceOnUse' + }) + }) + } + }); + + register(Pattern, 'Pattern'); + + let Image$1 = class Image extends Shape { + constructor(node, attrs = node) { + super(nodeOrNew('image', node), attrs); + } + + // (re)load image + load(url, callback) { + if (!url) return this + + const img = new globals.window.Image(); + + on( + img, + 'load', + function (e) { + const p = this.parent(Pattern); + + // ensure image size + if (this.width() === 0 && this.height() === 0) { + this.size(img.width, img.height); + } + + if (p instanceof Pattern) { + // ensure pattern size if not set + if (p.width() === 0 && p.height() === 0) { + p.size(this.width(), this.height()); + } + } + + if (typeof callback === 'function') { + callback.call(this, e); + } + }, + this + ); + + on(img, 'load error', function () { + // dont forget to unbind memory leaking events + off(img); + }); + + return this.attr('href', (img.src = url), xlink) + } + }; + + registerAttrHook(function (attr, val, _this) { + // convert image fill and stroke to patterns + if (attr === 'fill' || attr === 'stroke') { + if (isImage.test(val)) { + val = _this.root().defs().image(val); + } + } + + if (val instanceof Image$1) { + val = _this + .root() + .defs() + .pattern(0, 0, (pattern) => { + pattern.add(val); + }); + } + + return val + }); + + registerMethods({ + Container: { + // create image element, load image and set its size + image: wrapWithAttrCheck(function (source, callback) { + return this.put(new Image$1()).size(0, 0).load(source, callback) + }) + } + }); + + register(Image$1, 'Image'); + + class PointArray extends SVGArray { + // Get bounding box of points + bbox() { + let maxX = -Infinity; + let maxY = -Infinity; + let minX = Infinity; + let minY = Infinity; + this.forEach(function (el) { + maxX = Math.max(el[0], maxX); + maxY = Math.max(el[1], maxY); + minX = Math.min(el[0], minX); + minY = Math.min(el[1], minY); + }); + return new Box(minX, minY, maxX - minX, maxY - minY) + } + + // Move point string + move(x, y) { + const box = this.bbox(); + + // get relative offset + x -= box.x; + y -= box.y; + + // move every point + if (!isNaN(x) && !isNaN(y)) { + for (let i = this.length - 1; i >= 0; i--) { + this[i] = [this[i][0] + x, this[i][1] + y]; + } + } + + return this + } + + // Parse point string and flat array + parse(array = [0, 0]) { + const points = []; + + // if it is an array, we flatten it and therefore clone it to 1 depths + if (array instanceof Array) { + array = Array.prototype.concat.apply([], array); + } else { + // Else, it is considered as a string + // parse points + array = array.trim().split(delimiter).map(parseFloat); + } + + // validate points - https://svgwg.org/svg2-draft/shapes.html#DataTypePoints + // Odd number of coordinates is an error. In such cases, drop the last odd coordinate. + if (array.length % 2 !== 0) array.pop(); + + // wrap points in two-tuples + for (let i = 0, len = array.length; i < len; i = i + 2) { + points.push([array[i], array[i + 1]]); + } + + return points + } + + // Resize poly string + size(width, height) { + let i; + const box = this.bbox(); + + // recalculate position of all points according to new size + for (i = this.length - 1; i >= 0; i--) { + if (box.width) + this[i][0] = ((this[i][0] - box.x) * width) / box.width + box.x; + if (box.height) + this[i][1] = ((this[i][1] - box.y) * height) / box.height + box.y; + } + + return this + } + + // Convert array to line object + toLine() { + return { + x1: this[0][0], + y1: this[0][1], + x2: this[1][0], + y2: this[1][1] + } + } + + // Convert array to string + toString() { + const array = []; + // convert to a poly point string + for (let i = 0, il = this.length; i < il; i++) { + array.push(this[i].join(',')); + } + + return array.join(' ') + } + + transform(m) { + return this.clone().transformO(m) + } + + // transform points with matrix (similar to Point.transform) + transformO(m) { + if (!Matrix.isMatrixLike(m)) { + m = new Matrix(m); + } + + for (let i = this.length; i--; ) { + // Perform the matrix multiplication + const [x, y] = this[i]; + this[i][0] = m.a * x + m.c * y + m.e; + this[i][1] = m.b * x + m.d * y + m.f; + } + + return this + } + } + + const MorphArray = PointArray; + + // Move by left top corner over x-axis + function x$2(x) { + return x == null ? this.bbox().x : this.move(x, this.bbox().y) + } + + // Move by left top corner over y-axis + function y$2(y) { + return y == null ? this.bbox().y : this.move(this.bbox().x, y) + } + + // Set width of element + function width$1(width) { + const b = this.bbox(); + return width == null ? b.width : this.size(width, b.height) + } + + // Set height of element + function height$1(height) { + const b = this.bbox(); + return height == null ? b.height : this.size(b.width, height) + } + + var pointed = /*#__PURE__*/Object.freeze({ + __proto__: null, + MorphArray: MorphArray, + height: height$1, + width: width$1, + x: x$2, + y: y$2 + }); + + let Line$1 = class Line extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('line', node), attrs); + } + + // Get array + array() { + return new PointArray([ + [this.attr('x1'), this.attr('y1')], + [this.attr('x2'), this.attr('y2')] + ]) + } + + // Move by left top corner + move(x, y) { + return this.attr(this.array().move(x, y).toLine()) + } + + // Overwrite native plot() method + plot(x1, y1, x2, y2) { + if (x1 == null) { + return this.array() + } else if (typeof y1 !== 'undefined') { + x1 = { x1, y1, x2, y2 }; + } else { + x1 = new PointArray(x1).toLine(); + } + + return this.attr(x1) + } + + // Set element size to given width and height + size(width, height) { + const p = proportionalSize(this, width, height); + return this.attr(this.array().size(p.width, p.height).toLine()) + } + }; + + extend(Line$1, pointed); + + registerMethods({ + Container: { + // Create a line element + line: wrapWithAttrCheck(function (...args) { + // make sure plot is called as a setter + // x1 is not necessarily a number, it can also be an array, a string and a PointArray + return Line$1.prototype.plot.apply( + this.put(new Line$1()), + args[0] != null ? args : [0, 0, 0, 0] + ) + }) + } + }); + + register(Line$1, 'Line'); + + let Marker$1 = class Marker extends Container { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('marker', node), attrs); + } + + // Set height of element + height(height) { + return this.attr('markerHeight', height) + } + + orient(orient) { + return this.attr('orient', orient) + } + + // Set marker refX and refY + ref(x, y) { + return this.attr('refX', x).attr('refY', y) + } + + // Return the fill id + toString() { + return 'url(#' + this.id() + ')' + } + + // Update marker + update(block) { + // remove all content + this.clear(); + + // invoke passed block + if (typeof block === 'function') { + block.call(this, this); + } + + return this + } + + // Set width of element + width(width) { + return this.attr('markerWidth', width) + } + }; + + registerMethods({ + Container: { + marker(...args) { + // Create marker element in defs + return this.defs().marker(...args) + } + }, + Defs: { + // Create marker + marker: wrapWithAttrCheck(function (width, height, block) { + // Set default viewbox to match the width and height, set ref to cx and cy and set orient to auto + return this.put(new Marker$1()) + .size(width, height) + .ref(width / 2, height / 2) + .viewbox(0, 0, width, height) + .attr('orient', 'auto') + .update(block) + }) + }, + marker: { + // Create and attach markers + marker(marker, width, height, block) { + let attr = ['marker']; + + // Build attribute name + if (marker !== 'all') attr.push(marker); + attr = attr.join('-'); + + // Set marker attribute + marker = + arguments[1] instanceof Marker$1 + ? arguments[1] + : this.defs().marker(width, height, block); + + return this.attr(attr, marker) + } + } + }); + + register(Marker$1, 'Marker'); + + /*** + Base Class + ========== + The base stepper class that will be + ***/ + + function makeSetterGetter(k, f) { + return function (v) { + if (v == null) return this[k] + this[k] = v; + if (f) f.call(this); + return this + } + } + + const easing = { + '-': function (pos) { + return pos + }, + '<>': function (pos) { + return -Math.cos(pos * Math.PI) / 2 + 0.5 + }, + '>': function (pos) { + return Math.sin((pos * Math.PI) / 2) + }, + '<': function (pos) { + return -Math.cos((pos * Math.PI) / 2) + 1 + }, + bezier: function (x1, y1, x2, y2) { + // see https://www.w3.org/TR/css-easing-1/#cubic-bezier-algo + return function (t) { + if (t < 0) { + if (x1 > 0) { + return (y1 / x1) * t + } else if (x2 > 0) { + return (y2 / x2) * t + } else { + return 0 + } + } else if (t > 1) { + if (x2 < 1) { + return ((1 - y2) / (1 - x2)) * t + (y2 - x2) / (1 - x2) + } else if (x1 < 1) { + return ((1 - y1) / (1 - x1)) * t + (y1 - x1) / (1 - x1) + } else { + return 1 + } + } else { + return 3 * t * (1 - t) ** 2 * y1 + 3 * t ** 2 * (1 - t) * y2 + t ** 3 + } + } + }, + // see https://www.w3.org/TR/css-easing-1/#step-timing-function-algo + steps: function (steps, stepPosition = 'end') { + // deal with "jump-" prefix + stepPosition = stepPosition.split('-').reverse()[0]; + + let jumps = steps; + if (stepPosition === 'none') { + --jumps; + } else if (stepPosition === 'both') { + ++jumps; + } + + // The beforeFlag is essentially useless + return (t, beforeFlag = false) => { + // Step is called currentStep in referenced url + let step = Math.floor(t * steps); + const jumping = (t * step) % 1 === 0; + + if (stepPosition === 'start' || stepPosition === 'both') { + ++step; + } + + if (beforeFlag && jumping) { + --step; + } + + if (t >= 0 && step < 0) { + step = 0; + } + + if (t <= 1 && step > jumps) { + step = jumps; + } + + return step / jumps + } + } + }; + + class Stepper { + done() { + return false + } + } + + /*** + Easing Functions + ================ + ***/ + + class Ease extends Stepper { + constructor(fn = timeline.ease) { + super(); + this.ease = easing[fn] || fn; + } + + step(from, to, pos) { + if (typeof from !== 'number') { + return pos < 1 ? from : to + } + return from + (to - from) * this.ease(pos) + } + } + + /*** + Controller Types + ================ + ***/ + + class Controller extends Stepper { + constructor(fn) { + super(); + this.stepper = fn; + } + + done(c) { + return c.done + } + + step(current, target, dt, c) { + return this.stepper(current, target, dt, c) + } + } + + function recalculate() { + // Apply the default parameters + const duration = (this._duration || 500) / 1000; + const overshoot = this._overshoot || 0; + + // Calculate the PID natural response + const eps = 1e-10; + const pi = Math.PI; + const os = Math.log(overshoot / 100 + eps); + const zeta = -os / Math.sqrt(pi * pi + os * os); + const wn = 3.9 / (zeta * duration); + + // Calculate the Spring values + this.d = 2 * zeta * wn; + this.k = wn * wn; + } + + class Spring extends Controller { + constructor(duration = 500, overshoot = 0) { + super(); + this.duration(duration).overshoot(overshoot); + } + + step(current, target, dt, c) { + if (typeof current === 'string') return current + c.done = dt === Infinity; + if (dt === Infinity) return target + if (dt === 0) return current + + if (dt > 100) dt = 16; + + dt /= 1000; + + // Get the previous velocity + const velocity = c.velocity || 0; + + // Apply the control to get the new position and store it + const acceleration = -this.d * velocity - this.k * (current - target); + const newPosition = current + velocity * dt + (acceleration * dt * dt) / 2; + + // Store the velocity + c.velocity = velocity + acceleration * dt; + + // Figure out if we have converged, and if so, pass the value + c.done = Math.abs(target - newPosition) + Math.abs(velocity) < 0.002; + return c.done ? target : newPosition + } + } + + extend(Spring, { + duration: makeSetterGetter('_duration', recalculate), + overshoot: makeSetterGetter('_overshoot', recalculate) + }); + + class PID extends Controller { + constructor(p = 0.1, i = 0.01, d = 0, windup = 1000) { + super(); + this.p(p).i(i).d(d).windup(windup); + } + + step(current, target, dt, c) { + if (typeof current === 'string') return current + c.done = dt === Infinity; + + if (dt === Infinity) return target + if (dt === 0) return current + + const p = target - current; + let i = (c.integral || 0) + p * dt; + const d = (p - (c.error || 0)) / dt; + const windup = this._windup; + + // antiwindup + if (windup !== false) { + i = Math.max(-windup, Math.min(i, windup)); + } + + c.error = p; + c.integral = i; + + c.done = Math.abs(p) < 0.001; + + return c.done ? target : current + (this.P * p + this.I * i + this.D * d) + } + } + + extend(PID, { + windup: makeSetterGetter('_windup'), + p: makeSetterGetter('P'), + i: makeSetterGetter('I'), + d: makeSetterGetter('D') + }); + + const segmentParameters = { + M: 2, + L: 2, + H: 1, + V: 1, + C: 6, + S: 4, + Q: 4, + T: 2, + A: 7, + Z: 0 + }; + + const pathHandlers = { + M: function (c, p, p0) { + p.x = p0.x = c[0]; + p.y = p0.y = c[1]; + + return ['M', p.x, p.y] + }, + L: function (c, p) { + p.x = c[0]; + p.y = c[1]; + return ['L', c[0], c[1]] + }, + H: function (c, p) { + p.x = c[0]; + return ['H', c[0]] + }, + V: function (c, p) { + p.y = c[0]; + return ['V', c[0]] + }, + C: function (c, p) { + p.x = c[4]; + p.y = c[5]; + return ['C', c[0], c[1], c[2], c[3], c[4], c[5]] + }, + S: function (c, p) { + p.x = c[2]; + p.y = c[3]; + return ['S', c[0], c[1], c[2], c[3]] + }, + Q: function (c, p) { + p.x = c[2]; + p.y = c[3]; + return ['Q', c[0], c[1], c[2], c[3]] + }, + T: function (c, p) { + p.x = c[0]; + p.y = c[1]; + return ['T', c[0], c[1]] + }, + Z: function (c, p, p0) { + p.x = p0.x; + p.y = p0.y; + return ['Z'] + }, + A: function (c, p) { + p.x = c[5]; + p.y = c[6]; + return ['A', c[0], c[1], c[2], c[3], c[4], c[5], c[6]] + } + }; + + const mlhvqtcsaz = 'mlhvqtcsaz'.split(''); + + for (let i = 0, il = mlhvqtcsaz.length; i < il; ++i) { + pathHandlers[mlhvqtcsaz[i]] = (function (i) { + return function (c, p, p0) { + if (i === 'H') c[0] = c[0] + p.x; + else if (i === 'V') c[0] = c[0] + p.y; + else if (i === 'A') { + c[5] = c[5] + p.x; + c[6] = c[6] + p.y; + } else { + for (let j = 0, jl = c.length; j < jl; ++j) { + c[j] = c[j] + (j % 2 ? p.y : p.x); + } + } + + return pathHandlers[i](c, p, p0) + } + })(mlhvqtcsaz[i].toUpperCase()); + } + + function makeAbsolut(parser) { + const command = parser.segment[0]; + return pathHandlers[command](parser.segment.slice(1), parser.p, parser.p0) + } + + function segmentComplete(parser) { + return ( + parser.segment.length && + parser.segment.length - 1 === + segmentParameters[parser.segment[0].toUpperCase()] + ) + } + + function startNewSegment(parser, token) { + parser.inNumber && finalizeNumber(parser, false); + const pathLetter = isPathLetter.test(token); + + if (pathLetter) { + parser.segment = [token]; + } else { + const lastCommand = parser.lastCommand; + const small = lastCommand.toLowerCase(); + const isSmall = lastCommand === small; + parser.segment = [small === 'm' ? (isSmall ? 'l' : 'L') : lastCommand]; + } + + parser.inSegment = true; + parser.lastCommand = parser.segment[0]; + + return pathLetter + } + + function finalizeNumber(parser, inNumber) { + if (!parser.inNumber) throw new Error('Parser Error') + parser.number && parser.segment.push(parseFloat(parser.number)); + parser.inNumber = inNumber; + parser.number = ''; + parser.pointSeen = false; + parser.hasExponent = false; + + if (segmentComplete(parser)) { + finalizeSegment(parser); + } + } + + function finalizeSegment(parser) { + parser.inSegment = false; + if (parser.absolute) { + parser.segment = makeAbsolut(parser); + } + parser.segments.push(parser.segment); + } + + function isArcFlag(parser) { + if (!parser.segment.length) return false + const isArc = parser.segment[0].toUpperCase() === 'A'; + const length = parser.segment.length; + + return isArc && (length === 4 || length === 5) + } + + function isExponential(parser) { + return parser.lastToken.toUpperCase() === 'E' + } + + const pathDelimiters = new Set([' ', ',', '\t', '\n', '\r', '\f']); + function pathParser(d, toAbsolute = true) { + let index = 0; + let token = ''; + const parser = { + segment: [], + inNumber: false, + number: '', + lastToken: '', + inSegment: false, + segments: [], + pointSeen: false, + hasExponent: false, + absolute: toAbsolute, + p0: new Point(), + p: new Point() + }; + + while (((parser.lastToken = token), (token = d.charAt(index++)))) { + if (!parser.inSegment) { + if (startNewSegment(parser, token)) { + continue + } + } + + if (token === '.') { + if (parser.pointSeen || parser.hasExponent) { + finalizeNumber(parser, false); + --index; + continue + } + parser.inNumber = true; + parser.pointSeen = true; + parser.number += token; + continue + } + + if (!isNaN(parseInt(token))) { + if (parser.number === '0' || isArcFlag(parser)) { + parser.inNumber = true; + parser.number = token; + finalizeNumber(parser, true); + continue + } + + parser.inNumber = true; + parser.number += token; + continue + } + + if (pathDelimiters.has(token)) { + if (parser.inNumber) { + finalizeNumber(parser, false); + } + continue + } + + if (token === '-' || token === '+') { + if (parser.inNumber && !isExponential(parser)) { + finalizeNumber(parser, false); + --index; + continue + } + parser.number += token; + parser.inNumber = true; + continue + } + + if (token.toUpperCase() === 'E') { + parser.number += token; + parser.hasExponent = true; + continue + } + + if (isPathLetter.test(token)) { + if (parser.inNumber) { + finalizeNumber(parser, false); + } else if (!segmentComplete(parser)) { + throw new Error('parser Error') + } else { + finalizeSegment(parser); + } + --index; + } + } + + if (parser.inNumber) { + finalizeNumber(parser, false); + } + + if (parser.inSegment && segmentComplete(parser)) { + finalizeSegment(parser); + } + + return parser.segments + } + + function arrayToString(a) { + let s = ''; + for (let i = 0, il = a.length; i < il; i++) { + s += a[i][0]; + + if (a[i][1] != null) { + s += a[i][1]; + + if (a[i][2] != null) { + s += ' '; + s += a[i][2]; + + if (a[i][3] != null) { + s += ' '; + s += a[i][3]; + s += ' '; + s += a[i][4]; + + if (a[i][5] != null) { + s += ' '; + s += a[i][5]; + s += ' '; + s += a[i][6]; + + if (a[i][7] != null) { + s += ' '; + s += a[i][7]; + } + } + } + } + } + } + + return s + ' ' + } + + class PathArray extends SVGArray { + // Get bounding box of path + bbox() { + parser().path.setAttribute('d', this.toString()); + return new Box(parser.nodes.path.getBBox()) + } + + // Move path string + move(x, y) { + // get bounding box of current situation + const box = this.bbox(); + + // get relative offset + x -= box.x; + y -= box.y; + + if (!isNaN(x) && !isNaN(y)) { + // move every point + for (let l, i = this.length - 1; i >= 0; i--) { + l = this[i][0]; + + if (l === 'M' || l === 'L' || l === 'T') { + this[i][1] += x; + this[i][2] += y; + } else if (l === 'H') { + this[i][1] += x; + } else if (l === 'V') { + this[i][1] += y; + } else if (l === 'C' || l === 'S' || l === 'Q') { + this[i][1] += x; + this[i][2] += y; + this[i][3] += x; + this[i][4] += y; + + if (l === 'C') { + this[i][5] += x; + this[i][6] += y; + } + } else if (l === 'A') { + this[i][6] += x; + this[i][7] += y; + } + } + } + + return this + } + + // Absolutize and parse path to array + parse(d = 'M0 0') { + if (Array.isArray(d)) { + d = Array.prototype.concat.apply([], d).toString(); + } + + return pathParser(d) + } + + // Resize path string + size(width, height) { + // get bounding box of current situation + const box = this.bbox(); + let i, l; + + // If the box width or height is 0 then we ignore + // transformations on the respective axis + box.width = box.width === 0 ? 1 : box.width; + box.height = box.height === 0 ? 1 : box.height; + + // recalculate position of all points according to new size + for (i = this.length - 1; i >= 0; i--) { + l = this[i][0]; + + if (l === 'M' || l === 'L' || l === 'T') { + this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x; + this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y; + } else if (l === 'H') { + this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x; + } else if (l === 'V') { + this[i][1] = ((this[i][1] - box.y) * height) / box.height + box.y; + } else if (l === 'C' || l === 'S' || l === 'Q') { + this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x; + this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y; + this[i][3] = ((this[i][3] - box.x) * width) / box.width + box.x; + this[i][4] = ((this[i][4] - box.y) * height) / box.height + box.y; + + if (l === 'C') { + this[i][5] = ((this[i][5] - box.x) * width) / box.width + box.x; + this[i][6] = ((this[i][6] - box.y) * height) / box.height + box.y; + } + } else if (l === 'A') { + // resize radii + this[i][1] = (this[i][1] * width) / box.width; + this[i][2] = (this[i][2] * height) / box.height; + + // move position values + this[i][6] = ((this[i][6] - box.x) * width) / box.width + box.x; + this[i][7] = ((this[i][7] - box.y) * height) / box.height + box.y; + } + } + + return this + } + + // Convert array to string + toString() { + return arrayToString(this) + } + } + + const getClassForType = (value) => { + const type = typeof value; + + if (type === 'number') { + return SVGNumber + } else if (type === 'string') { + if (Color.isColor(value)) { + return Color + } else if (delimiter.test(value)) { + return isPathLetter.test(value) ? PathArray : SVGArray + } else if (numberAndUnit.test(value)) { + return SVGNumber + } else { + return NonMorphable + } + } else if (morphableTypes.indexOf(value.constructor) > -1) { + return value.constructor + } else if (Array.isArray(value)) { + return SVGArray + } else if (type === 'object') { + return ObjectBag + } else { + return NonMorphable + } + }; + + class Morphable { + constructor(stepper) { + this._stepper = stepper || new Ease('-'); + + this._from = null; + this._to = null; + this._type = null; + this._context = null; + this._morphObj = null; + } + + at(pos) { + return this._morphObj.morph( + this._from, + this._to, + pos, + this._stepper, + this._context + ) + } + + done() { + const complete = this._context.map(this._stepper.done).reduce(function ( + last, + curr + ) { + return last && curr + }, true); + return complete + } + + from(val) { + if (val == null) { + return this._from + } + + this._from = this._set(val); + return this + } + + stepper(stepper) { + if (stepper == null) return this._stepper + this._stepper = stepper; + return this + } + + to(val) { + if (val == null) { + return this._to + } + + this._to = this._set(val); + return this + } + + type(type) { + // getter + if (type == null) { + return this._type + } + + // setter + this._type = type; + return this + } + + _set(value) { + if (!this._type) { + this.type(getClassForType(value)); + } + + let result = new this._type(value); + if (this._type === Color) { + result = this._to + ? result[this._to[4]]() + : this._from + ? result[this._from[4]]() + : result; + } + + if (this._type === ObjectBag) { + result = this._to + ? result.align(this._to) + : this._from + ? result.align(this._from) + : result; + } + + result = result.toConsumable(); + + this._morphObj = this._morphObj || new this._type(); + this._context = + this._context || + Array.apply(null, Array(result.length)) + .map(Object) + .map(function (o) { + o.done = true; + return o + }); + return result + } + } + + class NonMorphable { + constructor(...args) { + this.init(...args); + } + + init(val) { + val = Array.isArray(val) ? val[0] : val; + this.value = val; + return this + } + + toArray() { + return [this.value] + } + + valueOf() { + return this.value + } + } + + class TransformBag { + constructor(...args) { + this.init(...args); + } + + init(obj) { + if (Array.isArray(obj)) { + obj = { + scaleX: obj[0], + scaleY: obj[1], + shear: obj[2], + rotate: obj[3], + translateX: obj[4], + translateY: obj[5], + originX: obj[6], + originY: obj[7] + }; + } + + Object.assign(this, TransformBag.defaults, obj); + return this + } + + toArray() { + const v = this; + + return [ + v.scaleX, + v.scaleY, + v.shear, + v.rotate, + v.translateX, + v.translateY, + v.originX, + v.originY + ] + } + } + + TransformBag.defaults = { + scaleX: 1, + scaleY: 1, + shear: 0, + rotate: 0, + translateX: 0, + translateY: 0, + originX: 0, + originY: 0 + }; + + const sortByKey = (a, b) => { + return a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0 + }; + + class ObjectBag { + constructor(...args) { + this.init(...args); + } + + align(other) { + const values = this.values; + for (let i = 0, il = values.length; i < il; ++i) { + // If the type is the same we only need to check if the color is in the correct format + if (values[i + 1] === other[i + 1]) { + if (values[i + 1] === Color && other[i + 7] !== values[i + 7]) { + const space = other[i + 7]; + const color = new Color(this.values.splice(i + 3, 5)) + [space]() + .toArray(); + this.values.splice(i + 3, 0, ...color); + } + + i += values[i + 2] + 2; + continue + } + + if (!other[i + 1]) { + return this + } + + // The types differ, so we overwrite the new type with the old one + // And initialize it with the types default (e.g. black for color or 0 for number) + const defaultObject = new other[i + 1]().toArray(); + + // Than we fix the values array + const toDelete = values[i + 2] + 3; + + values.splice( + i, + toDelete, + other[i], + other[i + 1], + other[i + 2], + ...defaultObject + ); + + i += values[i + 2] + 2; + } + return this + } + + init(objOrArr) { + this.values = []; + + if (Array.isArray(objOrArr)) { + this.values = objOrArr.slice(); + return + } + + objOrArr = objOrArr || {}; + const entries = []; + + for (const i in objOrArr) { + const Type = getClassForType(objOrArr[i]); + const val = new Type(objOrArr[i]).toArray(); + entries.push([i, Type, val.length, ...val]); + } + + entries.sort(sortByKey); + + this.values = entries.reduce((last, curr) => last.concat(curr), []); + return this + } + + toArray() { + return this.values + } + + valueOf() { + const obj = {}; + const arr = this.values; + + // for (var i = 0, len = arr.length; i < len; i += 2) { + while (arr.length) { + const key = arr.shift(); + const Type = arr.shift(); + const num = arr.shift(); + const values = arr.splice(0, num); + obj[key] = new Type(values); // .valueOf() + } + + return obj + } + } + + const morphableTypes = [NonMorphable, TransformBag, ObjectBag]; + + function registerMorphableType(type = []) { + morphableTypes.push(...[].concat(type)); + } + + function makeMorphable() { + extend(morphableTypes, { + to(val) { + return new Morphable() + .type(this.constructor) + .from(this.toArray()) // this.valueOf()) + .to(val) + }, + fromArray(arr) { + this.init(arr); + return this + }, + toConsumable() { + return this.toArray() + }, + morph(from, to, pos, stepper, context) { + const mapper = function (i, index) { + return stepper.step(i, to[index], pos, context[index], context) + }; + + return this.fromArray(from.map(mapper)) + } + }); + } + + class Path extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('path', node), attrs); + } + + // Get array + array() { + return this._array || (this._array = new PathArray(this.attr('d'))) + } + + // Clear array cache + clear() { + delete this._array; + return this + } + + // Set height of element + height(height) { + return height == null + ? this.bbox().height + : this.size(this.bbox().width, height) + } + + // Move by left top corner + move(x, y) { + return this.attr('d', this.array().move(x, y)) + } + + // Plot new path + plot(d) { + return d == null + ? this.array() + : this.clear().attr( + 'd', + typeof d === 'string' ? d : (this._array = new PathArray(d)) + ) + } + + // Set element size to given width and height + size(width, height) { + const p = proportionalSize(this, width, height); + return this.attr('d', this.array().size(p.width, p.height)) + } + + // Set width of element + width(width) { + return width == null + ? this.bbox().width + : this.size(width, this.bbox().height) + } + + // Move by left top corner over x-axis + x(x) { + return x == null ? this.bbox().x : this.move(x, this.bbox().y) + } + + // Move by left top corner over y-axis + y(y) { + return y == null ? this.bbox().y : this.move(this.bbox().x, y) + } + } + + // Define morphable array + Path.prototype.MorphArray = PathArray; + + // Add parent method + registerMethods({ + Container: { + // Create a wrapped path element + path: wrapWithAttrCheck(function (d) { + // make sure plot is called as a setter + return this.put(new Path()).plot(d || new PathArray()) + }) + } + }); + + register(Path, 'Path'); + + // Get array + function array() { + return this._array || (this._array = new PointArray(this.attr('points'))) + } + + // Clear array cache + function clear() { + delete this._array; + return this + } + + // Move by left top corner + function move$2(x, y) { + return this.attr('points', this.array().move(x, y)) + } + + // Plot new path + function plot(p) { + return p == null + ? this.array() + : this.clear().attr( + 'points', + typeof p === 'string' ? p : (this._array = new PointArray(p)) + ) + } + + // Set element size to given width and height + function size$1(width, height) { + const p = proportionalSize(this, width, height); + return this.attr('points', this.array().size(p.width, p.height)) + } + + var poly = /*#__PURE__*/Object.freeze({ + __proto__: null, + array: array, + clear: clear, + move: move$2, + plot: plot, + size: size$1 + }); + + class Polygon extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('polygon', node), attrs); + } + } + + registerMethods({ + Container: { + // Create a wrapped polygon element + polygon: wrapWithAttrCheck(function (p) { + // make sure plot is called as a setter + return this.put(new Polygon()).plot(p || new PointArray()) + }) + } + }); + + extend(Polygon, pointed); + extend(Polygon, poly); + register(Polygon, 'Polygon'); + + class Polyline extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('polyline', node), attrs); + } + } + + registerMethods({ + Container: { + // Create a wrapped polygon element + polyline: wrapWithAttrCheck(function (p) { + // make sure plot is called as a setter + return this.put(new Polyline()).plot(p || new PointArray()) + }) + } + }); + + extend(Polyline, pointed); + extend(Polyline, poly); + register(Polyline, 'Polyline'); + + class Rect extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('rect', node), attrs); + } + } + + extend(Rect, { rx, ry }); + + registerMethods({ + Container: { + // Create a rect element + rect: wrapWithAttrCheck(function (width, height) { + return this.put(new Rect()).size(width, height) + }) + } + }); + + register(Rect, 'Rect'); + + class Queue { + constructor() { + this._first = null; + this._last = null; + } + + // Shows us the first item in the list + first() { + return this._first && this._first.value + } + + // Shows us the last item in the list + last() { + return this._last && this._last.value + } + + push(value) { + // An item stores an id and the provided value + const item = + typeof value.next !== 'undefined' + ? value + : { value: value, next: null, prev: null }; + + // Deal with the queue being empty or populated + if (this._last) { + item.prev = this._last; + this._last.next = item; + this._last = item; + } else { + this._last = item; + this._first = item; + } + + // Return the current item + return item + } + + // Removes the item that was returned from the push + remove(item) { + // Relink the previous item + if (item.prev) item.prev.next = item.next; + if (item.next) item.next.prev = item.prev; + if (item === this._last) this._last = item.prev; + if (item === this._first) this._first = item.next; + + // Invalidate item + item.prev = null; + item.next = null; + } + + shift() { + // Check if we have a value + const remove = this._first; + if (!remove) return null + + // If we do, remove it and relink things + this._first = remove.next; + if (this._first) this._first.prev = null; + this._last = this._first ? this._last : null; + return remove.value + } + } + + const Animator = { + nextDraw: null, + frames: new Queue(), + timeouts: new Queue(), + immediates: new Queue(), + timer: () => globals.window.performance || globals.window.Date, + transforms: [], + + frame(fn) { + // Store the node + const node = Animator.frames.push({ run: fn }); + + // Request an animation frame if we don't have one + if (Animator.nextDraw === null) { + Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw); + } + + // Return the node so we can remove it easily + return node + }, + + timeout(fn, delay) { + delay = delay || 0; + + // Work out when the event should fire + const time = Animator.timer().now() + delay; + + // Add the timeout to the end of the queue + const node = Animator.timeouts.push({ run: fn, time: time }); + + // Request another animation frame if we need one + if (Animator.nextDraw === null) { + Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw); + } + + return node + }, + + immediate(fn) { + // Add the immediate fn to the end of the queue + const node = Animator.immediates.push(fn); + // Request another animation frame if we need one + if (Animator.nextDraw === null) { + Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw); + } + + return node + }, + + cancelFrame(node) { + node != null && Animator.frames.remove(node); + }, + + clearTimeout(node) { + node != null && Animator.timeouts.remove(node); + }, + + cancelImmediate(node) { + node != null && Animator.immediates.remove(node); + }, + + _draw(now) { + // Run all the timeouts we can run, if they are not ready yet, add them + // to the end of the queue immediately! (bad timeouts!!! [sarcasm]) + let nextTimeout = null; + const lastTimeout = Animator.timeouts.last(); + while ((nextTimeout = Animator.timeouts.shift())) { + // Run the timeout if its time, or push it to the end + if (now >= nextTimeout.time) { + nextTimeout.run(); + } else { + Animator.timeouts.push(nextTimeout); + } + + // If we hit the last item, we should stop shifting out more items + if (nextTimeout === lastTimeout) break + } + + // Run all of the animation frames + let nextFrame = null; + const lastFrame = Animator.frames.last(); + while (nextFrame !== lastFrame && (nextFrame = Animator.frames.shift())) { + nextFrame.run(now); + } + + let nextImmediate = null; + while ((nextImmediate = Animator.immediates.shift())) { + nextImmediate(); + } + + // If we have remaining timeouts or frames, draw until we don't anymore + Animator.nextDraw = + Animator.timeouts.first() || Animator.frames.first() + ? globals.window.requestAnimationFrame(Animator._draw) + : null; + } + }; + + const makeSchedule = function (runnerInfo) { + const start = runnerInfo.start; + const duration = runnerInfo.runner.duration(); + const end = start + duration; + return { + start: start, + duration: duration, + end: end, + runner: runnerInfo.runner + } + }; + + const defaultSource = function () { + const w = globals.window; + return (w.performance || w.Date).now() + }; + + class Timeline extends EventTarget { + // Construct a new timeline on the given element + constructor(timeSource = defaultSource) { + super(); + + this._timeSource = timeSource; + + // terminate resets all variables to their initial state + this.terminate(); + } + + active() { + return !!this._nextFrame + } + + finish() { + // Go to end and pause + this.time(this.getEndTimeOfTimeline() + 1); + return this.pause() + } + + // Calculates the end of the timeline + getEndTime() { + const lastRunnerInfo = this.getLastRunnerInfo(); + const lastDuration = lastRunnerInfo ? lastRunnerInfo.runner.duration() : 0; + const lastStartTime = lastRunnerInfo ? lastRunnerInfo.start : this._time; + return lastStartTime + lastDuration + } + + getEndTimeOfTimeline() { + const endTimes = this._runners.map((i) => i.start + i.runner.duration()); + return Math.max(0, ...endTimes) + } + + getLastRunnerInfo() { + return this.getRunnerInfoById(this._lastRunnerId) + } + + getRunnerInfoById(id) { + return this._runners[this._runnerIds.indexOf(id)] || null + } + + pause() { + this._paused = true; + return this._continue() + } + + persist(dtOrForever) { + if (dtOrForever == null) return this._persist + this._persist = dtOrForever; + return this + } + + play() { + // Now make sure we are not paused and continue the animation + this._paused = false; + return this.updateTime()._continue() + } + + reverse(yes) { + const currentSpeed = this.speed(); + if (yes == null) return this.speed(-currentSpeed) + + const positive = Math.abs(currentSpeed); + return this.speed(yes ? -positive : positive) + } + + // schedules a runner on the timeline + schedule(runner, delay, when) { + if (runner == null) { + return this._runners.map(makeSchedule) + } + + // The start time for the next animation can either be given explicitly, + // derived from the current timeline time or it can be relative to the + // last start time to chain animations directly + + let absoluteStartTime = 0; + const endTime = this.getEndTime(); + delay = delay || 0; + + // Work out when to start the animation + if (when == null || when === 'last' || when === 'after') { + // Take the last time and increment + absoluteStartTime = endTime; + } else if (when === 'absolute' || when === 'start') { + absoluteStartTime = delay; + delay = 0; + } else if (when === 'now') { + absoluteStartTime = this._time; + } else if (when === 'relative') { + const runnerInfo = this.getRunnerInfoById(runner.id); + if (runnerInfo) { + absoluteStartTime = runnerInfo.start + delay; + delay = 0; + } + } else if (when === 'with-last') { + const lastRunnerInfo = this.getLastRunnerInfo(); + const lastStartTime = lastRunnerInfo ? lastRunnerInfo.start : this._time; + absoluteStartTime = lastStartTime; + } else { + throw new Error('Invalid value for the "when" parameter') + } + + // Manage runner + runner.unschedule(); + runner.timeline(this); + + const persist = runner.persist(); + const runnerInfo = { + persist: persist === null ? this._persist : persist, + start: absoluteStartTime + delay, + runner + }; + + this._lastRunnerId = runner.id; + + this._runners.push(runnerInfo); + this._runners.sort((a, b) => a.start - b.start); + this._runnerIds = this._runners.map((info) => info.runner.id); + + this.updateTime()._continue(); + return this + } + + seek(dt) { + return this.time(this._time + dt) + } + + source(fn) { + if (fn == null) return this._timeSource + this._timeSource = fn; + return this + } + + speed(speed) { + if (speed == null) return this._speed + this._speed = speed; + return this + } + + stop() { + // Go to start and pause + this.time(0); + return this.pause() + } + + time(time) { + if (time == null) return this._time + this._time = time; + return this._continue(true) + } + + // Remove the runner from this timeline + unschedule(runner) { + const index = this._runnerIds.indexOf(runner.id); + if (index < 0) return this + + this._runners.splice(index, 1); + this._runnerIds.splice(index, 1); + + runner.timeline(null); + return this + } + + // Makes sure, that after pausing the time doesn't jump + updateTime() { + if (!this.active()) { + this._lastSourceTime = this._timeSource(); + } + return this + } + + // Checks if we are running and continues the animation + _continue(immediateStep = false) { + Animator.cancelFrame(this._nextFrame); + this._nextFrame = null; + + if (immediateStep) return this._stepImmediate() + if (this._paused) return this + + this._nextFrame = Animator.frame(this._step); + return this + } + + _stepFn(immediateStep = false) { + // Get the time delta from the last time and update the time + const time = this._timeSource(); + let dtSource = time - this._lastSourceTime; + + if (immediateStep) dtSource = 0; + + const dtTime = this._speed * dtSource + (this._time - this._lastStepTime); + this._lastSourceTime = time; + + // Only update the time if we use the timeSource. + // Otherwise use the current time + if (!immediateStep) { + // Update the time + this._time += dtTime; + this._time = this._time < 0 ? 0 : this._time; + } + this._lastStepTime = this._time; + this.fire('time', this._time); + + // This is for the case that the timeline was seeked so that the time + // is now before the startTime of the runner. That is why we need to set + // the runner to position 0 + + // FIXME: + // However, resetting in insertion order leads to bugs. Considering the case, + // where 2 runners change the same attribute but in different times, + // resetting both of them will lead to the case where the later defined + // runner always wins the reset even if the other runner started earlier + // and therefore should win the attribute battle + // this can be solved by resetting them backwards + for (let k = this._runners.length; k--; ) { + // Get and run the current runner and ignore it if its inactive + const runnerInfo = this._runners[k]; + const runner = runnerInfo.runner; + + // Make sure that we give the actual difference + // between runner start time and now + const dtToStart = this._time - runnerInfo.start; + + // Dont run runner if not started yet + // and try to reset it + if (dtToStart <= 0) { + runner.reset(); + } + } + + // Run all of the runners directly + let runnersLeft = false; + for (let i = 0, len = this._runners.length; i < len; i++) { + // Get and run the current runner and ignore it if its inactive + const runnerInfo = this._runners[i]; + const runner = runnerInfo.runner; + let dt = dtTime; + + // Make sure that we give the actual difference + // between runner start time and now + const dtToStart = this._time - runnerInfo.start; + + // Dont run runner if not started yet + if (dtToStart <= 0) { + runnersLeft = true; + continue + } else if (dtToStart < dt) { + // Adjust dt to make sure that animation is on point + dt = dtToStart; + } + + if (!runner.active()) continue + + // If this runner is still going, signal that we need another animation + // frame, otherwise, remove the completed runner + const finished = runner.step(dt).done; + if (!finished) { + runnersLeft = true; + // continue + } else if (runnerInfo.persist !== true) { + // runner is finished. And runner might get removed + const endTime = runner.duration() - runner.time() + this._time; + + if (endTime + runnerInfo.persist < this._time) { + // Delete runner and correct index + runner.unschedule(); + --i; + --len; + } + } + } + + // Basically: we continue when there are runners right from us in time + // when -->, and when runners are left from us when <-- + if ( + (runnersLeft && !(this._speed < 0 && this._time === 0)) || + (this._runnerIds.length && this._speed < 0 && this._time > 0) + ) { + this._continue(); + } else { + this.pause(); + this.fire('finished'); + } + + return this + } + + terminate() { + // cleanup memory + + // Store the timing variables + this._startTime = 0; + this._speed = 1.0; + + // Determines how long a runner is hold in memory. Can be a dt or true/false + this._persist = 0; + + // Keep track of the running animations and their starting parameters + this._nextFrame = null; + this._paused = true; + this._runners = []; + this._runnerIds = []; + this._lastRunnerId = -1; + this._time = 0; + this._lastSourceTime = 0; + this._lastStepTime = 0; + + // Make sure that step is always called in class context + this._step = this._stepFn.bind(this, false); + this._stepImmediate = this._stepFn.bind(this, true); + } + } + + registerMethods({ + Element: { + timeline: function (timeline) { + if (timeline == null) { + this._timeline = this._timeline || new Timeline(); + return this._timeline + } else { + this._timeline = timeline; + return this + } + } + } + }); + + class Runner extends EventTarget { + constructor(options) { + super(); + + // Store a unique id on the runner, so that we can identify it later + this.id = Runner.id++; + + // Ensure a default value + options = options == null ? timeline.duration : options; + + // Ensure that we get a controller + options = typeof options === 'function' ? new Controller(options) : options; + + // Declare all of the variables + this._element = null; + this._timeline = null; + this.done = false; + this._queue = []; + + // Work out the stepper and the duration + this._duration = typeof options === 'number' && options; + this._isDeclarative = options instanceof Controller; + this._stepper = this._isDeclarative ? options : new Ease(); + + // We copy the current values from the timeline because they can change + this._history = {}; + + // Store the state of the runner + this.enabled = true; + this._time = 0; + this._lastTime = 0; + + // At creation, the runner is in reset state + this._reseted = true; + + // Save transforms applied to this runner + this.transforms = new Matrix(); + this.transformId = 1; + + // Looping variables + this._haveReversed = false; + this._reverse = false; + this._loopsDone = 0; + this._swing = false; + this._wait = 0; + this._times = 1; + + this._frameId = null; + + // Stores how long a runner is stored after being done + this._persist = this._isDeclarative ? true : null; + } + + static sanitise(duration, delay, when) { + // Initialise the default parameters + let times = 1; + let swing = false; + let wait = 0; + duration = duration ?? timeline.duration; + delay = delay ?? timeline.delay; + when = when || 'last'; + + // If we have an object, unpack the values + if (typeof duration === 'object' && !(duration instanceof Stepper)) { + delay = duration.delay ?? delay; + when = duration.when ?? when; + swing = duration.swing || swing; + times = duration.times ?? times; + wait = duration.wait ?? wait; + duration = duration.duration ?? timeline.duration; + } + + return { + duration: duration, + delay: delay, + swing: swing, + times: times, + wait: wait, + when: when + } + } + + active(enabled) { + if (enabled == null) return this.enabled + this.enabled = enabled; + return this + } + + /* + Private Methods + =============== + Methods that shouldn't be used externally + */ + addTransform(transform) { + this.transforms.lmultiplyO(transform); + return this + } + + after(fn) { + return this.on('finished', fn) + } + + animate(duration, delay, when) { + const o = Runner.sanitise(duration, delay, when); + const runner = new Runner(o.duration); + if (this._timeline) runner.timeline(this._timeline); + if (this._element) runner.element(this._element); + return runner.loop(o).schedule(o.delay, o.when) + } + + clearTransform() { + this.transforms = new Matrix(); + return this + } + + // TODO: Keep track of all transformations so that deletion is faster + clearTransformsFromQueue() { + if ( + !this.done || + !this._timeline || + !this._timeline._runnerIds.includes(this.id) + ) { + this._queue = this._queue.filter((item) => { + return !item.isTransform + }); + } + } + + delay(delay) { + return this.animate(0, delay) + } + + duration() { + return this._times * (this._wait + this._duration) - this._wait + } + + during(fn) { + return this.queue(null, fn) + } + + ease(fn) { + this._stepper = new Ease(fn); + return this + } + /* + Runner Definitions + ================== + These methods help us define the runtime behaviour of the Runner or they + help us make new runners from the current runner + */ + + element(element) { + if (element == null) return this._element + this._element = element; + element._prepareRunner(); + return this + } + + finish() { + return this.step(Infinity) + } + + loop(times, swing, wait) { + // Deal with the user passing in an object + if (typeof times === 'object') { + swing = times.swing; + wait = times.wait; + times = times.times; + } + + // Sanitise the values and store them + this._times = times || Infinity; + this._swing = swing || false; + this._wait = wait || 0; + + // Allow true to be passed + if (this._times === true) { + this._times = Infinity; + } + + return this + } + + loops(p) { + const loopDuration = this._duration + this._wait; + if (p == null) { + const loopsDone = Math.floor(this._time / loopDuration); + const relativeTime = this._time - loopsDone * loopDuration; + const position = relativeTime / this._duration; + return Math.min(loopsDone + position, this._times) + } + const whole = Math.floor(p); + const partial = p % 1; + const time = loopDuration * whole + this._duration * partial; + return this.time(time) + } + + persist(dtOrForever) { + if (dtOrForever == null) return this._persist + this._persist = dtOrForever; + return this + } + + position(p) { + // Get all of the variables we need + const x = this._time; + const d = this._duration; + const w = this._wait; + const t = this._times; + const s = this._swing; + const r = this._reverse; + let position; + + if (p == null) { + /* + This function converts a time to a position in the range [0, 1] + The full explanation can be found in this desmos demonstration + https://www.desmos.com/calculator/u4fbavgche + The logic is slightly simplified here because we can use booleans + */ + + // Figure out the value without thinking about the start or end time + const f = function (x) { + const swinging = s * Math.floor((x % (2 * (w + d))) / (w + d)); + const backwards = (swinging && !r) || (!swinging && r); + const uncliped = + (Math.pow(-1, backwards) * (x % (w + d))) / d + backwards; + const clipped = Math.max(Math.min(uncliped, 1), 0); + return clipped + }; + + // Figure out the value by incorporating the start time + const endTime = t * (w + d) - w; + position = + x <= 0 + ? Math.round(f(1e-5)) + : x < endTime + ? f(x) + : Math.round(f(endTime - 1e-5)); + return position + } + + // Work out the loops done and add the position to the loops done + const loopsDone = Math.floor(this.loops()); + const swingForward = s && loopsDone % 2 === 0; + const forwards = (swingForward && !r) || (r && swingForward); + position = loopsDone + (forwards ? p : 1 - p); + return this.loops(position) + } + + progress(p) { + if (p == null) { + return Math.min(1, this._time / this.duration()) + } + return this.time(p * this.duration()) + } + + /* + Basic Functionality + =================== + These methods allow us to attach basic functions to the runner directly + */ + queue(initFn, runFn, retargetFn, isTransform) { + this._queue.push({ + initialiser: initFn || noop, + runner: runFn || noop, + retarget: retargetFn, + isTransform: isTransform, + initialised: false, + finished: false + }); + const timeline = this.timeline(); + timeline && this.timeline()._continue(); + return this + } + + reset() { + if (this._reseted) return this + this.time(0); + this._reseted = true; + return this + } + + reverse(reverse) { + this._reverse = reverse == null ? !this._reverse : reverse; + return this + } + + schedule(timeline, delay, when) { + // The user doesn't need to pass a timeline if we already have one + if (!(timeline instanceof Timeline)) { + when = delay; + delay = timeline; + timeline = this.timeline(); + } + + // If there is no timeline, yell at the user... + if (!timeline) { + throw Error('Runner cannot be scheduled without timeline') + } + + // Schedule the runner on the timeline provided + timeline.schedule(this, delay, when); + return this + } + + step(dt) { + // If we are inactive, this stepper just gets skipped + if (!this.enabled) return this + + // Update the time and get the new position + dt = dt == null ? 16 : dt; + this._time += dt; + const position = this.position(); + + // Figure out if we need to run the stepper in this frame + const running = this._lastPosition !== position && this._time >= 0; + this._lastPosition = position; + + // Figure out if we just started + const duration = this.duration(); + const justStarted = this._lastTime <= 0 && this._time > 0; + const justFinished = this._lastTime < duration && this._time >= duration; + + this._lastTime = this._time; + if (justStarted) { + this.fire('start', this); + } + + // Work out if the runner is finished set the done flag here so animations + // know, that they are running in the last step (this is good for + // transformations which can be merged) + const declarative = this._isDeclarative; + this.done = !declarative && !justFinished && this._time >= duration; + + // Runner is running. So its not in reset state anymore + this._reseted = false; + + let converged = false; + // Call initialise and the run function + if (running || declarative) { + this._initialise(running); + + // clear the transforms on this runner so they dont get added again and again + this.transforms = new Matrix(); + converged = this._run(declarative ? dt : position); + + this.fire('step', this); + } + // correct the done flag here + // declarative animations itself know when they converged + this.done = this.done || (converged && declarative); + if (justFinished) { + this.fire('finished', this); + } + return this + } + + /* + Runner animation methods + ======================== + Control how the animation plays + */ + time(time) { + if (time == null) { + return this._time + } + const dt = time - this._time; + this.step(dt); + return this + } + + timeline(timeline) { + // check explicitly for undefined so we can set the timeline to null + if (typeof timeline === 'undefined') return this._timeline + this._timeline = timeline; + return this + } + + unschedule() { + const timeline = this.timeline(); + timeline && timeline.unschedule(this); + return this + } + + // Run each initialise function in the runner if required + _initialise(running) { + // If we aren't running, we shouldn't initialise when not declarative + if (!running && !this._isDeclarative) return + + // Loop through all of the initialisers + for (let i = 0, len = this._queue.length; i < len; ++i) { + // Get the current initialiser + const current = this._queue[i]; + + // Determine whether we need to initialise + const needsIt = this._isDeclarative || (!current.initialised && running); + running = !current.finished; + + // Call the initialiser if we need to + if (needsIt && running) { + current.initialiser.call(this); + current.initialised = true; + } + } + } + + // Save a morpher to the morpher list so that we can retarget it later + _rememberMorpher(method, morpher) { + this._history[method] = { + morpher: morpher, + caller: this._queue[this._queue.length - 1] + }; + + // We have to resume the timeline in case a controller + // is already done without being ever run + // This can happen when e.g. this is done: + // anim = el.animate(new SVG.Spring) + // and later + // anim.move(...) + if (this._isDeclarative) { + const timeline = this.timeline(); + timeline && timeline.play(); + } + } + + // Try to set the target for a morpher if the morpher exists, otherwise + // Run each run function for the position or dt given + _run(positionOrDt) { + // Run all of the _queue directly + let allfinished = true; + for (let i = 0, len = this._queue.length; i < len; ++i) { + // Get the current function to run + const current = this._queue[i]; + + // Run the function if its not finished, we keep track of the finished + // flag for the sake of declarative _queue + const converged = current.runner.call(this, positionOrDt); + current.finished = current.finished || converged === true; + allfinished = allfinished && current.finished; + } + + // We report when all of the constructors are finished + return allfinished + } + + // do nothing and return false + _tryRetarget(method, target, extra) { + if (this._history[method]) { + // if the last method wasn't even initialised, throw it away + if (!this._history[method].caller.initialised) { + const index = this._queue.indexOf(this._history[method].caller); + this._queue.splice(index, 1); + return false + } + + // for the case of transformations, we use the special retarget function + // which has access to the outer scope + if (this._history[method].caller.retarget) { + this._history[method].caller.retarget.call(this, target, extra); + // for everything else a simple morpher change is sufficient + } else { + this._history[method].morpher.to(target); + } + + this._history[method].caller.finished = false; + const timeline = this.timeline(); + timeline && timeline.play(); + return true + } + return false + } + } + + Runner.id = 0; + + class FakeRunner { + constructor(transforms = new Matrix(), id = -1, done = true) { + this.transforms = transforms; + this.id = id; + this.done = done; + } + + clearTransformsFromQueue() {} + } + + extend([Runner, FakeRunner], { + mergeWith(runner) { + return new FakeRunner( + runner.transforms.lmultiply(this.transforms), + runner.id + ) + } + }); + + // FakeRunner.emptyRunner = new FakeRunner() + + const lmultiply = (last, curr) => last.lmultiplyO(curr); + const getRunnerTransform = (runner) => runner.transforms; + + function mergeTransforms() { + // Find the matrix to apply to the element and apply it + const runners = this._transformationRunners.runners; + const netTransform = runners + .map(getRunnerTransform) + .reduce(lmultiply, new Matrix()); + + this.transform(netTransform); + + this._transformationRunners.merge(); + + if (this._transformationRunners.length() === 1) { + this._frameId = null; + } + } + + class RunnerArray { + constructor() { + this.runners = []; + this.ids = []; + } + + add(runner) { + if (this.runners.includes(runner)) return + const id = runner.id + 1; + + this.runners.push(runner); + this.ids.push(id); + + return this + } + + clearBefore(id) { + const deleteCnt = this.ids.indexOf(id + 1) || 1; + this.ids.splice(0, deleteCnt, 0); + this.runners + .splice(0, deleteCnt, new FakeRunner()) + .forEach((r) => r.clearTransformsFromQueue()); + return this + } + + edit(id, newRunner) { + const index = this.ids.indexOf(id + 1); + this.ids.splice(index, 1, id + 1); + this.runners.splice(index, 1, newRunner); + return this + } + + getByID(id) { + return this.runners[this.ids.indexOf(id + 1)] + } + + length() { + return this.ids.length + } + + merge() { + let lastRunner = null; + for (let i = 0; i < this.runners.length; ++i) { + const runner = this.runners[i]; + + const condition = + lastRunner && + runner.done && + lastRunner.done && + // don't merge runner when persisted on timeline + (!runner._timeline || + !runner._timeline._runnerIds.includes(runner.id)) && + (!lastRunner._timeline || + !lastRunner._timeline._runnerIds.includes(lastRunner.id)); + + if (condition) { + // the +1 happens in the function + this.remove(runner.id); + const newRunner = runner.mergeWith(lastRunner); + this.edit(lastRunner.id, newRunner); + lastRunner = newRunner; + --i; + } else { + lastRunner = runner; + } + } + + return this + } + + remove(id) { + const index = this.ids.indexOf(id + 1); + this.ids.splice(index, 1); + this.runners.splice(index, 1); + return this + } + } + + registerMethods({ + Element: { + animate(duration, delay, when) { + const o = Runner.sanitise(duration, delay, when); + const timeline = this.timeline(); + return new Runner(o.duration) + .loop(o) + .element(this) + .timeline(timeline.play()) + .schedule(o.delay, o.when) + }, + + delay(by, when) { + return this.animate(0, by, when) + }, + + // this function searches for all runners on the element and deletes the ones + // which run before the current one. This is because absolute transformations + // overwrite anything anyway so there is no need to waste time computing + // other runners + _clearTransformRunnersBefore(currentRunner) { + this._transformationRunners.clearBefore(currentRunner.id); + }, + + _currentTransform(current) { + return ( + this._transformationRunners.runners + // we need the equal sign here to make sure, that also transformations + // on the same runner which execute before the current transformation are + // taken into account + .filter((runner) => runner.id <= current.id) + .map(getRunnerTransform) + .reduce(lmultiply, new Matrix()) + ) + }, + + _addRunner(runner) { + this._transformationRunners.add(runner); + + // Make sure that the runner merge is executed at the very end of + // all Animator functions. That is why we use immediate here to execute + // the merge right after all frames are run + Animator.cancelImmediate(this._frameId); + this._frameId = Animator.immediate(mergeTransforms.bind(this)); + }, + + _prepareRunner() { + if (this._frameId == null) { + this._transformationRunners = new RunnerArray().add( + new FakeRunner(new Matrix(this)) + ); + } + } + } + }); + + // Will output the elements from array A that are not in the array B + const difference = (a, b) => a.filter((x) => !b.includes(x)); + + extend(Runner, { + attr(a, v) { + return this.styleAttr('attr', a, v) + }, + + // Add animatable styles + css(s, v) { + return this.styleAttr('css', s, v) + }, + + styleAttr(type, nameOrAttrs, val) { + if (typeof nameOrAttrs === 'string') { + return this.styleAttr(type, { [nameOrAttrs]: val }) + } + + let attrs = nameOrAttrs; + if (this._tryRetarget(type, attrs)) return this + + let morpher = new Morphable(this._stepper).to(attrs); + let keys = Object.keys(attrs); + + this.queue( + function () { + morpher = morpher.from(this.element()[type](keys)); + }, + function (pos) { + this.element()[type](morpher.at(pos).valueOf()); + return morpher.done() + }, + function (newToAttrs) { + // Check if any new keys were added + const newKeys = Object.keys(newToAttrs); + const differences = difference(newKeys, keys); + + // If their are new keys, initialize them and add them to morpher + if (differences.length) { + // Get the values + const addedFromAttrs = this.element()[type](differences); + + // Get the already initialized values + const oldFromAttrs = new ObjectBag(morpher.from()).valueOf(); + + // Merge old and new + Object.assign(oldFromAttrs, addedFromAttrs); + morpher.from(oldFromAttrs); + } + + // Get the object from the morpher + const oldToAttrs = new ObjectBag(morpher.to()).valueOf(); + + // Merge in new attributes + Object.assign(oldToAttrs, newToAttrs); + + // Change morpher target + morpher.to(oldToAttrs); + + // Make sure that we save the work we did so we don't need it to do again + keys = newKeys; + attrs = newToAttrs; + } + ); + + this._rememberMorpher(type, morpher); + return this + }, + + zoom(level, point) { + if (this._tryRetarget('zoom', level, point)) return this + + let morpher = new Morphable(this._stepper).to(new SVGNumber(level)); + + this.queue( + function () { + morpher = morpher.from(this.element().zoom()); + }, + function (pos) { + this.element().zoom(morpher.at(pos), point); + return morpher.done() + }, + function (newLevel, newPoint) { + point = newPoint; + morpher.to(newLevel); + } + ); + + this._rememberMorpher('zoom', morpher); + return this + }, + + /** + ** absolute transformations + **/ + + // + // M v -----|-----(D M v = F v)------|-----> T v + // + // 1. define the final state (T) and decompose it (once) + // t = [tx, ty, the, lam, sy, sx] + // 2. on every frame: pull the current state of all previous transforms + // (M - m can change) + // and then write this as m = [tx0, ty0, the0, lam0, sy0, sx0] + // 3. Find the interpolated matrix F(pos) = m + pos * (t - m) + // - Note F(0) = M + // - Note F(1) = T + // 4. Now you get the delta matrix as a result: D = F * inv(M) + + transform(transforms, relative, affine) { + // If we have a declarative function, we should retarget it if possible + relative = transforms.relative || relative; + if ( + this._isDeclarative && + !relative && + this._tryRetarget('transform', transforms) + ) { + return this + } + + // Parse the parameters + const isMatrix = Matrix.isMatrixLike(transforms); + affine = + transforms.affine != null + ? transforms.affine + : affine != null + ? affine + : !isMatrix; + + // Create a morpher and set its type + const morpher = new Morphable(this._stepper).type( + affine ? TransformBag : Matrix + ); + + let origin; + let element; + let current; + let currentAngle; + let startTransform; + + function setup() { + // make sure element and origin is defined + element = element || this.element(); + origin = origin || getOrigin(transforms, element); + + startTransform = new Matrix(relative ? undefined : element); + + // add the runner to the element so it can merge transformations + element._addRunner(this); + + // Deactivate all transforms that have run so far if we are absolute + if (!relative) { + element._clearTransformRunnersBefore(this); + } + } + + function run(pos) { + // clear all other transforms before this in case something is saved + // on this runner. We are absolute. We dont need these! + if (!relative) this.clearTransform(); + + const { x, y } = new Point(origin).transform( + element._currentTransform(this) + ); + + let target = new Matrix({ ...transforms, origin: [x, y] }); + let start = this._isDeclarative && current ? current : startTransform; + + if (affine) { + target = target.decompose(x, y); + start = start.decompose(x, y); + + // Get the current and target angle as it was set + const rTarget = target.rotate; + const rCurrent = start.rotate; + + // Figure out the shortest path to rotate directly + const possibilities = [rTarget - 360, rTarget, rTarget + 360]; + const distances = possibilities.map((a) => Math.abs(a - rCurrent)); + const shortest = Math.min(...distances); + const index = distances.indexOf(shortest); + target.rotate = possibilities[index]; + } + + if (relative) { + // we have to be careful here not to overwrite the rotation + // with the rotate method of Matrix + if (!isMatrix) { + target.rotate = transforms.rotate || 0; + } + if (this._isDeclarative && currentAngle) { + start.rotate = currentAngle; + } + } + + morpher.from(start); + morpher.to(target); + + const affineParameters = morpher.at(pos); + currentAngle = affineParameters.rotate; + current = new Matrix(affineParameters); + + this.addTransform(current); + element._addRunner(this); + return morpher.done() + } + + function retarget(newTransforms) { + // only get a new origin if it changed since the last call + if ( + (newTransforms.origin || 'center').toString() !== + (transforms.origin || 'center').toString() + ) { + origin = getOrigin(newTransforms, element); + } + + // overwrite the old transformations with the new ones + transforms = { ...newTransforms, origin }; + } + + this.queue(setup, run, retarget, true); + this._isDeclarative && this._rememberMorpher('transform', morpher); + return this + }, + + // Animatable x-axis + x(x) { + return this._queueNumber('x', x) + }, + + // Animatable y-axis + y(y) { + return this._queueNumber('y', y) + }, + + ax(x) { + return this._queueNumber('ax', x) + }, + + ay(y) { + return this._queueNumber('ay', y) + }, + + dx(x = 0) { + return this._queueNumberDelta('x', x) + }, + + dy(y = 0) { + return this._queueNumberDelta('y', y) + }, + + dmove(x, y) { + return this.dx(x).dy(y) + }, + + _queueNumberDelta(method, to) { + to = new SVGNumber(to); + + // Try to change the target if we have this method already registered + if (this._tryRetarget(method, to)) return this + + // Make a morpher and queue the animation + const morpher = new Morphable(this._stepper).to(to); + let from = null; + this.queue( + function () { + from = this.element()[method](); + morpher.from(from); + morpher.to(from + to); + }, + function (pos) { + this.element()[method](morpher.at(pos)); + return morpher.done() + }, + function (newTo) { + morpher.to(from + new SVGNumber(newTo)); + } + ); + + // Register the morpher so that if it is changed again, we can retarget it + this._rememberMorpher(method, morpher); + return this + }, + + _queueObject(method, to) { + // Try to change the target if we have this method already registered + if (this._tryRetarget(method, to)) return this + + // Make a morpher and queue the animation + const morpher = new Morphable(this._stepper).to(to); + this.queue( + function () { + morpher.from(this.element()[method]()); + }, + function (pos) { + this.element()[method](morpher.at(pos)); + return morpher.done() + } + ); + + // Register the morpher so that if it is changed again, we can retarget it + this._rememberMorpher(method, morpher); + return this + }, + + _queueNumber(method, value) { + return this._queueObject(method, new SVGNumber(value)) + }, + + // Animatable center x-axis + cx(x) { + return this._queueNumber('cx', x) + }, + + // Animatable center y-axis + cy(y) { + return this._queueNumber('cy', y) + }, + + // Add animatable move + move(x, y) { + return this.x(x).y(y) + }, + + amove(x, y) { + return this.ax(x).ay(y) + }, + + // Add animatable center + center(x, y) { + return this.cx(x).cy(y) + }, + + // Add animatable size + size(width, height) { + // animate bbox based size for all other elements + let box; + + if (!width || !height) { + box = this._element.bbox(); + } + + if (!width) { + width = (box.width / box.height) * height; + } + + if (!height) { + height = (box.height / box.width) * width; + } + + return this.width(width).height(height) + }, + + // Add animatable width + width(width) { + return this._queueNumber('width', width) + }, + + // Add animatable height + height(height) { + return this._queueNumber('height', height) + }, + + // Add animatable plot + plot(a, b, c, d) { + // Lines can be plotted with 4 arguments + if (arguments.length === 4) { + return this.plot([a, b, c, d]) + } + + if (this._tryRetarget('plot', a)) return this + + const morpher = new Morphable(this._stepper) + .type(this._element.MorphArray) + .to(a); + + this.queue( + function () { + morpher.from(this._element.array()); + }, + function (pos) { + this._element.plot(morpher.at(pos)); + return morpher.done() + } + ); + + this._rememberMorpher('plot', morpher); + return this + }, + + // Add leading method + leading(value) { + return this._queueNumber('leading', value) + }, + + // Add animatable viewbox + viewbox(x, y, width, height) { + return this._queueObject('viewbox', new Box(x, y, width, height)) + }, + + update(o) { + if (typeof o !== 'object') { + return this.update({ + offset: arguments[0], + color: arguments[1], + opacity: arguments[2] + }) + } + + if (o.opacity != null) this.attr('stop-opacity', o.opacity); + if (o.color != null) this.attr('stop-color', o.color); + if (o.offset != null) this.attr('offset', o.offset); + + return this + } + }); + + extend(Runner, { rx, ry, from, to }); + register(Runner, 'Runner'); + + class Svg extends Container { + constructor(node, attrs = node) { + super(nodeOrNew('svg', node), attrs); + this.namespace(); + } + + // Creates and returns defs element + defs() { + if (!this.isRoot()) return this.root().defs() + + return adopt(this.node.querySelector('defs')) || this.put(new Defs()) + } + + isRoot() { + return ( + !this.node.parentNode || + (!(this.node.parentNode instanceof globals.window.SVGElement) && + this.node.parentNode.nodeName !== '#document-fragment') + ) + } + + // Add namespaces + namespace() { + if (!this.isRoot()) return this.root().namespace() + return this.attr({ xmlns: svg, version: '1.1' }).attr( + 'xmlns:xlink', + xlink, + xmlns + ) + } + + removeNamespace() { + return this.attr({ xmlns: null, version: null }) + .attr('xmlns:xlink', null, xmlns) + .attr('xmlns:svgjs', null, xmlns) + } + + // Check if this is a root svg + // If not, call root() from this element + root() { + if (this.isRoot()) return this + return super.root() + } + } + + registerMethods({ + Container: { + // Create nested svg document + nested: wrapWithAttrCheck(function () { + return this.put(new Svg()) + }) + } + }); + + register(Svg, 'Svg', true); + + let Symbol$1 = class Symbol extends Container { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('symbol', node), attrs); + } + }; + + registerMethods({ + Container: { + symbol: wrapWithAttrCheck(function () { + return this.put(new Symbol$1()) + }) + } + }); + + register(Symbol$1, 'Symbol'); + + // Create plain text node + function plain(text) { + // clear if build mode is disabled + if (this._build === false) { + this.clear(); + } + + // create text node + this.node.appendChild(globals.document.createTextNode(text)); + + return this + } + + // Get length of text element + function length() { + return this.node.getComputedTextLength() + } + + // Move over x-axis + // Text is moved by its bounding box + // text-anchor does NOT matter + function x$1(x, box = this.bbox()) { + if (x == null) { + return box.x + } + + return this.attr('x', this.attr('x') + x - box.x) + } + + // Move over y-axis + function y$1(y, box = this.bbox()) { + if (y == null) { + return box.y + } + + return this.attr('y', this.attr('y') + y - box.y) + } + + function move$1(x, y, box = this.bbox()) { + return this.x(x, box).y(y, box) + } + + // Move center over x-axis + function cx(x, box = this.bbox()) { + if (x == null) { + return box.cx + } + + return this.attr('x', this.attr('x') + x - box.cx) + } + + // Move center over y-axis + function cy(y, box = this.bbox()) { + if (y == null) { + return box.cy + } + + return this.attr('y', this.attr('y') + y - box.cy) + } + + function center(x, y, box = this.bbox()) { + return this.cx(x, box).cy(y, box) + } + + function ax(x) { + return this.attr('x', x) + } + + function ay(y) { + return this.attr('y', y) + } + + function amove(x, y) { + return this.ax(x).ay(y) + } + + // Enable / disable build mode + function build(build) { + this._build = !!build; + return this + } + + var textable = /*#__PURE__*/Object.freeze({ + __proto__: null, + amove: amove, + ax: ax, + ay: ay, + build: build, + center: center, + cx: cx, + cy: cy, + length: length, + move: move$1, + plain: plain, + x: x$1, + y: y$1 + }); + + class Text extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('text', node), attrs); + + this.dom.leading = this.dom.leading ?? new SVGNumber(1.3); // store leading value for rebuilding + this._rebuild = true; // enable automatic updating of dy values + this._build = false; // disable build mode for adding multiple lines + } + + // Set / get leading + leading(value) { + // act as getter + if (value == null) { + return this.dom.leading + } + + // act as setter + this.dom.leading = new SVGNumber(value); + + return this.rebuild() + } + + // Rebuild appearance type + rebuild(rebuild) { + // store new rebuild flag if given + if (typeof rebuild === 'boolean') { + this._rebuild = rebuild; + } + + // define position of all lines + if (this._rebuild) { + const self = this; + let blankLineOffset = 0; + const leading = this.dom.leading; + + this.each(function (i) { + if (isDescriptive(this.node)) return + + const fontSize = globals.window + .getComputedStyle(this.node) + .getPropertyValue('font-size'); + + const dy = leading * new SVGNumber(fontSize); + + if (this.dom.newLined) { + this.attr('x', self.attr('x')); + + if (this.text() === '\n') { + blankLineOffset += dy; + } else { + this.attr('dy', i ? dy + blankLineOffset : 0); + blankLineOffset = 0; + } + } + }); + + this.fire('rebuild'); + } + + return this + } + + // overwrite method from parent to set data properly + setData(o) { + this.dom = o; + this.dom.leading = new SVGNumber(o.leading || 1.3); + return this + } + + writeDataToDom() { + writeDataToDom(this, this.dom, { leading: 1.3 }); + return this + } + + // Set the text content + text(text) { + // act as getter + if (text === undefined) { + const children = this.node.childNodes; + let firstLine = 0; + text = ''; + + for (let i = 0, len = children.length; i < len; ++i) { + // skip textPaths - they are no lines + if (children[i].nodeName === 'textPath' || isDescriptive(children[i])) { + if (i === 0) firstLine = i + 1; + continue + } + + // add newline if its not the first child and newLined is set to true + if ( + i !== firstLine && + children[i].nodeType !== 3 && + adopt(children[i]).dom.newLined === true + ) { + text += '\n'; + } + + // add content of this node + text += children[i].textContent; + } + + return text + } + + // remove existing content + this.clear().build(true); + + if (typeof text === 'function') { + // call block + text.call(this, this); + } else { + // store text and make sure text is not blank + text = (text + '').split('\n'); + + // build new lines + for (let j = 0, jl = text.length; j < jl; j++) { + this.newLine(text[j]); + } + } + + // disable build mode and rebuild lines + return this.build(false).rebuild() + } + } + + extend(Text, textable); + + registerMethods({ + Container: { + // Create text element + text: wrapWithAttrCheck(function (text = '') { + return this.put(new Text()).text(text) + }), + + // Create plain text element + plain: wrapWithAttrCheck(function (text = '') { + return this.put(new Text()).plain(text) + }) + } + }); + + register(Text, 'Text'); + + class Tspan extends Shape { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('tspan', node), attrs); + this._build = false; // disable build mode for adding multiple lines + } + + // Shortcut dx + dx(dx) { + return this.attr('dx', dx) + } + + // Shortcut dy + dy(dy) { + return this.attr('dy', dy) + } + + // Create new line + newLine() { + // mark new line + this.dom.newLined = true; + + // fetch parent + const text = this.parent(); + + // early return in case we are not in a text element + if (!(text instanceof Text)) { + return this + } + + const i = text.index(this); + + const fontSize = globals.window + .getComputedStyle(this.node) + .getPropertyValue('font-size'); + const dy = text.dom.leading * new SVGNumber(fontSize); + + // apply new position + return this.dy(i ? dy : 0).attr('x', text.x()) + } + + // Set text content + text(text) { + if (text == null) + return this.node.textContent + (this.dom.newLined ? '\n' : '') + + if (typeof text === 'function') { + this.clear().build(true); + text.call(this, this); + this.build(false); + } else { + this.plain(text); + } + + return this + } + } + + extend(Tspan, textable); + + registerMethods({ + Tspan: { + tspan: wrapWithAttrCheck(function (text = '') { + const tspan = new Tspan(); + + // clear if build mode is disabled + if (!this._build) { + this.clear(); + } + + // add new tspan + return this.put(tspan).text(text) + }) + }, + Text: { + newLine: function (text = '') { + return this.tspan(text).newLine() + } + } + }); + + register(Tspan, 'Tspan'); + + class Circle extends Shape { + constructor(node, attrs = node) { + super(nodeOrNew('circle', node), attrs); + } + + radius(r) { + return this.attr('r', r) + } + + // Radius x value + rx(rx) { + return this.attr('r', rx) + } + + // Alias radius x value + ry(ry) { + return this.rx(ry) + } + + size(size) { + return this.radius(new SVGNumber(size).divide(2)) + } + } + + extend(Circle, { x: x$3, y: y$3, cx: cx$1, cy: cy$1, width: width$2, height: height$2 }); + + registerMethods({ + Container: { + // Create circle element + circle: wrapWithAttrCheck(function (size = 0) { + return this.put(new Circle()).size(size).move(0, 0) + }) + } + }); + + register(Circle, 'Circle'); + + class ClipPath extends Container { + constructor(node, attrs = node) { + super(nodeOrNew('clipPath', node), attrs); + } + + // Unclip all clipped elements and remove itself + remove() { + // unclip all targets + this.targets().forEach(function (el) { + el.unclip(); + }); + + // remove clipPath from parent + return super.remove() + } + + targets() { + return baseFind('svg [clip-path*=' + this.id() + ']') + } + } + + registerMethods({ + Container: { + // Create clipping element + clip: wrapWithAttrCheck(function () { + return this.defs().put(new ClipPath()) + }) + }, + Element: { + // Distribute clipPath to svg element + clipper() { + return this.reference('clip-path') + }, + + clipWith(element) { + // use given clip or create a new one + const clipper = + element instanceof ClipPath + ? element + : this.parent().clip().add(element); + + // apply mask + return this.attr('clip-path', 'url(#' + clipper.id() + ')') + }, + + // Unclip element + unclip() { + return this.attr('clip-path', null) + } + } + }); + + register(ClipPath, 'ClipPath'); + + class ForeignObject extends Element$1 { + constructor(node, attrs = node) { + super(nodeOrNew('foreignObject', node), attrs); + } + } + + registerMethods({ + Container: { + foreignObject: wrapWithAttrCheck(function (width, height) { + return this.put(new ForeignObject()).size(width, height) + }) + } + }); + + register(ForeignObject, 'ForeignObject'); + + function dmove(dx, dy) { + this.children().forEach((child) => { + let bbox; + + // We have to wrap this for elements that dont have a bbox + // e.g. title and other descriptive elements + try { + // Get the childs bbox + // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1905039 + // Because bbox for nested svgs returns the contents bbox in the coordinate space of the svg itself (weird!), we cant use bbox for svgs + // Therefore we have to use getBoundingClientRect. But THAT is broken (as explained in the bug). + // Funnily enough the broken behavior would work for us but that breaks it in chrome + // So we have to replicate the broken behavior of FF by just reading the attributes of the svg itself + bbox = + child.node instanceof getWindow().SVGSVGElement + ? new Box(child.attr(['x', 'y', 'width', 'height'])) + : child.bbox(); + } catch (e) { + return + } + + // Get childs matrix + const m = new Matrix(child); + // Translate childs matrix by amount and + // transform it back into parents space + const matrix = m.translate(dx, dy).transform(m.inverse()); + // Calculate new x and y from old box + const p = new Point(bbox.x, bbox.y).transform(matrix); + // Move element + child.move(p.x, p.y); + }); + + return this + } + + function dx(dx) { + return this.dmove(dx, 0) + } + + function dy(dy) { + return this.dmove(0, dy) + } + + function height(height, box = this.bbox()) { + if (height == null) return box.height + return this.size(box.width, height, box) + } + + function move(x = 0, y = 0, box = this.bbox()) { + const dx = x - box.x; + const dy = y - box.y; + + return this.dmove(dx, dy) + } + + function size(width, height, box = this.bbox()) { + const p = proportionalSize(this, width, height, box); + const scaleX = p.width / box.width; + const scaleY = p.height / box.height; + + this.children().forEach((child) => { + const o = new Point(box).transform(new Matrix(child).inverse()); + child.scale(scaleX, scaleY, o.x, o.y); + }); + + return this + } + + function width(width, box = this.bbox()) { + if (width == null) return box.width + return this.size(width, box.height, box) + } + + function x(x, box = this.bbox()) { + if (x == null) return box.x + return this.move(x, box.y, box) + } + + function y(y, box = this.bbox()) { + if (y == null) return box.y + return this.move(box.x, y, box) + } + + var containerGeometry = /*#__PURE__*/Object.freeze({ + __proto__: null, + dmove: dmove, + dx: dx, + dy: dy, + height: height, + move: move, + size: size, + width: width, + x: x, + y: y + }); + + class G extends Container { + constructor(node, attrs = node) { + super(nodeOrNew('g', node), attrs); + } + } + + extend(G, containerGeometry); + + registerMethods({ + Container: { + // Create a group element + group: wrapWithAttrCheck(function () { + return this.put(new G()) + }) + } + }); + + register(G, 'G'); + + class A extends Container { + constructor(node, attrs = node) { + super(nodeOrNew('a', node), attrs); + } + + // Link target attribute + target(target) { + return this.attr('target', target) + } + + // Link url + to(url) { + return this.attr('href', url, xlink) + } + } + + extend(A, containerGeometry); + + registerMethods({ + Container: { + // Create a hyperlink element + link: wrapWithAttrCheck(function (url) { + return this.put(new A()).to(url) + }) + }, + Element: { + unlink() { + const link = this.linker(); + + if (!link) return this + + const parent = link.parent(); + + if (!parent) { + return this.remove() + } + + const index = parent.index(link); + parent.add(this, index); + + link.remove(); + return this + }, + linkTo(url) { + // reuse old link if possible + let link = this.linker(); + + if (!link) { + link = new A(); + this.wrap(link); + } + + if (typeof url === 'function') { + url.call(link, link); + } else { + link.to(url); + } + + return this + }, + linker() { + const link = this.parent(); + if (link && link.node.nodeName.toLowerCase() === 'a') { + return link + } + + return null + } + } + }); + + register(A, 'A'); + + class Mask extends Container { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('mask', node), attrs); + } + + // Unmask all masked elements and remove itself + remove() { + // unmask all targets + this.targets().forEach(function (el) { + el.unmask(); + }); + + // remove mask from parent + return super.remove() + } + + targets() { + return baseFind('svg [mask*=' + this.id() + ']') + } + } + + registerMethods({ + Container: { + mask: wrapWithAttrCheck(function () { + return this.defs().put(new Mask()) + }) + }, + Element: { + // Distribute mask to svg element + masker() { + return this.reference('mask') + }, + + maskWith(element) { + // use given mask or create a new one + const masker = + element instanceof Mask ? element : this.parent().mask().add(element); + + // apply mask + return this.attr('mask', 'url(#' + masker.id() + ')') + }, + + // Unmask element + unmask() { + return this.attr('mask', null) + } + } + }); + + register(Mask, 'Mask'); + + class Stop extends Element$1 { + constructor(node, attrs = node) { + super(nodeOrNew('stop', node), attrs); + } + + // add color stops + update(o) { + if (typeof o === 'number' || o instanceof SVGNumber) { + o = { + offset: arguments[0], + color: arguments[1], + opacity: arguments[2] + }; + } + + // set attributes + if (o.opacity != null) this.attr('stop-opacity', o.opacity); + if (o.color != null) this.attr('stop-color', o.color); + if (o.offset != null) this.attr('offset', new SVGNumber(o.offset)); + + return this + } + } + + registerMethods({ + Gradient: { + // Add a color stop + stop: function (offset, color, opacity) { + return this.put(new Stop()).update(offset, color, opacity) + } + } + }); + + register(Stop, 'Stop'); + + function cssRule(selector, rule) { + if (!selector) return '' + if (!rule) return selector + + let ret = selector + '{'; + + for (const i in rule) { + ret += unCamelCase(i) + ':' + rule[i] + ';'; + } + + ret += '}'; + + return ret + } + + class Style extends Element$1 { + constructor(node, attrs = node) { + super(nodeOrNew('style', node), attrs); + } + + addText(w = '') { + this.node.textContent += w; + return this + } + + font(name, src, params = {}) { + return this.rule('@font-face', { + fontFamily: name, + src: src, + ...params + }) + } + + rule(selector, obj) { + return this.addText(cssRule(selector, obj)) + } + } + + registerMethods('Dom', { + style(selector, obj) { + return this.put(new Style()).rule(selector, obj) + }, + fontface(name, src, params) { + return this.put(new Style()).font(name, src, params) + } + }); + + register(Style, 'Style'); + + class TextPath extends Text { + // Initialize node + constructor(node, attrs = node) { + super(nodeOrNew('textPath', node), attrs); + } + + // return the array of the path track element + array() { + const track = this.track(); + + return track ? track.array() : null + } + + // Plot path if any + plot(d) { + const track = this.track(); + let pathArray = null; + + if (track) { + pathArray = track.plot(d); + } + + return d == null ? pathArray : this + } + + // Get the path element + track() { + return this.reference('href') + } + } + + registerMethods({ + Container: { + textPath: wrapWithAttrCheck(function (text, path) { + // Convert text to instance if needed + if (!(text instanceof Text)) { + text = this.text(text); + } + + return text.path(path) + }) + }, + Text: { + // Create path for text to run on + path: wrapWithAttrCheck(function (track, importNodes = true) { + const textPath = new TextPath(); + + // if track is a path, reuse it + if (!(track instanceof Path)) { + // create path element + track = this.defs().path(track); + } + + // link textPath to path and add content + textPath.attr('href', '#' + track, xlink); + + // Transplant all nodes from text to textPath + let node; + if (importNodes) { + while ((node = this.node.firstChild)) { + textPath.node.appendChild(node); + } + } + + // add textPath element as child node and return textPath + return this.put(textPath) + }), + + // Get the textPath children + textPath() { + return this.findOne('textPath') + } + }, + Path: { + // creates a textPath from this path + text: wrapWithAttrCheck(function (text) { + // Convert text to instance if needed + if (!(text instanceof Text)) { + text = new Text().addTo(this.parent()).text(text); + } + + // Create textPath from text and path and return + return text.path(this) + }), + + targets() { + return baseFind('svg textPath').filter((node) => { + return (node.attr('href') || '').includes(this.id()) + }) + + // Does not work in IE11. Use when IE support is dropped + // return baseFind('svg textPath[*|href*=' + this.id() + ']') + } + } + }); + + TextPath.prototype.MorphArray = PathArray; + register(TextPath, 'TextPath'); + + class Use extends Shape { + constructor(node, attrs = node) { + super(nodeOrNew('use', node), attrs); + } + + // Use element as a reference + use(element, file) { + // Set lined element + return this.attr('href', (file || '') + '#' + element, xlink) + } + } + + registerMethods({ + Container: { + // Create a use element + use: wrapWithAttrCheck(function (element, file) { + return this.put(new Use()).use(element, file) + }) + } + }); + + register(Use, 'Use'); + + /* Optional Modules */ + const SVG = makeInstance; + + extend([Svg, Symbol$1, Image$1, Pattern, Marker$1], getMethodsFor('viewbox')); + + extend([Line$1, Polyline, Polygon, Path], getMethodsFor('marker')); + + extend(Text, getMethodsFor('Text')); + extend(Path, getMethodsFor('Path')); + + extend(Defs, getMethodsFor('Defs')); + + extend([Text, Tspan], getMethodsFor('Tspan')); + + extend([Rect, Ellipse, Gradient, Runner], getMethodsFor('radius')); + + extend(EventTarget, getMethodsFor('EventTarget')); + extend(Dom, getMethodsFor('Dom')); + extend(Element$1, getMethodsFor('Element')); + extend(Shape, getMethodsFor('Shape')); + extend([Container, Fragment], getMethodsFor('Container')); + extend(Gradient, getMethodsFor('Gradient')); + + extend(Runner, getMethodsFor('Runner')); + + List.extend(getMethodNames()); + + registerMorphableType([ + SVGNumber, + Color, + Box, + Matrix, + SVGArray, + PointArray, + PathArray, + Point + ]); + + makeMorphable(); + + class Filter extends Element$1 { + constructor (node) { + super(nodeOrNew('filter', node), node); + + this.$source = 'SourceGraphic'; + this.$sourceAlpha = 'SourceAlpha'; + this.$background = 'BackgroundImage'; + this.$backgroundAlpha = 'BackgroundAlpha'; + this.$fill = 'FillPaint'; + this.$stroke = 'StrokePaint'; + this.$autoSetIn = true; + } + + put (element, i) { + element = super.put(element, i); + + if (!element.attr('in') && this.$autoSetIn) { + element.attr('in', this.$source); + } + if (!element.attr('result')) { + element.attr('result', element.id()); + } + + return element + } + + // Unmask all masked elements and remove itself + remove () { + // unmask all targets + this.targets().each('unfilter'); + + // remove mask from parent + return super.remove() + } + + targets () { + return baseFind('svg [filter*="' + this.id() + '"]') + } + + toString () { + return 'url(#' + this.id() + ')' + } + } + + // Create Effect class + class Effect extends Element$1 { + constructor (node, attr) { + super(node, attr); + this.result(this.id()); + } + + in (effect) { + // Act as getter + if (effect == null) { + const _in = this.attr('in'); + const ref = this.parent() && this.parent().find(`[result="${_in}"]`)[0]; + return ref || _in + } + + // Avr as setter + return this.attr('in', effect) + } + + // Named result + result (result) { + return this.attr('result', result) + } + + // Stringification + toString () { + return this.result() + } + } + + // This function takes an array with attr keys and sets for every key the + // attribute to the value of one paramater + // getAttrSetter(['a', 'b']) becomes this.attr({a: param1, b: param2}) + const getAttrSetter = (params) => { + return function (...args) { + for (let i = params.length; i--;) { + if (args[i] != null) { + this.attr(params[i], args[i]); + } + } + } + }; + + const updateFunctions = { + blend: getAttrSetter(['in', 'in2', 'mode']), + // ColorMatrix effect + colorMatrix: getAttrSetter(['type', 'values']), + // Composite effect + composite: getAttrSetter(['in', 'in2', 'operator']), + // ConvolveMatrix effect + convolveMatrix: function (matrix) { + matrix = new SVGArray(matrix).toString(); + + this.attr({ + order: Math.sqrt(matrix.split(' ').length), + kernelMatrix: matrix + }); + }, + // DiffuseLighting effect + diffuseLighting: getAttrSetter(['surfaceScale', 'lightingColor', 'diffuseConstant', 'kernelUnitLength']), + // DisplacementMap effect + displacementMap: getAttrSetter(['in', 'in2', 'scale', 'xChannelSelector', 'yChannelSelector']), + // DropShadow effect + dropShadow: getAttrSetter(['in', 'dx', 'dy', 'stdDeviation']), + // Flood effect + flood: getAttrSetter(['flood-color', 'flood-opacity']), + // Gaussian Blur effect + gaussianBlur: function (x = 0, y = x) { + this.attr('stdDeviation', x + ' ' + y); + }, + // Image effect + image: function (src) { + this.attr('href', src, xlink); + }, + // Morphology effect + morphology: getAttrSetter(['operator', 'radius']), + // Offset effect + offset: getAttrSetter(['dx', 'dy']), + // SpecularLighting effect + specularLighting: getAttrSetter(['surfaceScale', 'lightingColor', 'diffuseConstant', 'specularExponent', 'kernelUnitLength']), + // Tile effect + tile: getAttrSetter([]), + // Turbulence effect + turbulence: getAttrSetter(['baseFrequency', 'numOctaves', 'seed', 'stitchTiles', 'type']) + }; + + const filterNames = [ + 'blend', + 'colorMatrix', + 'componentTransfer', + 'composite', + 'convolveMatrix', + 'diffuseLighting', + 'displacementMap', + 'dropShadow', + 'flood', + 'gaussianBlur', + 'image', + 'merge', + 'morphology', + 'offset', + 'specularLighting', + 'tile', + 'turbulence' + ]; + + // For every filter create a class + filterNames.forEach((effect) => { + const name = capitalize(effect); + const fn = updateFunctions[effect]; + + Filter[name + 'Effect'] = class extends Effect { + constructor (node) { + super(nodeOrNew('fe' + name, node), node); + } + + // This function takes all parameters from the factory call + // and updates the attributes according to the updateFunctions + update (args) { + fn.apply(this, args); + return this + } + }; + + // Add factory function to filter + // Allow to pass a function or object + // The attr object is catched from "wrapWithAttrCheck" + Filter.prototype[effect] = wrapWithAttrCheck(function (fn, ...args) { + const effect = new Filter[name + 'Effect'](); + + if (fn == null) return this.put(effect) + + // For Effects which can take children, a function is allowed + if (typeof fn === 'function') { + fn.call(effect, effect); + } else { + // In case it is not a function, add it to arguments + args.unshift(fn); + } + return this.put(effect).update(args) + }); + }); + + // Correct factories which are not that simple + extend(Filter, { + merge (arrayOrFn) { + const node = this.put(new Filter.MergeEffect()); + + // If a function was passed, execute it + // That makes stuff like this possible: + // filter.merge((mergeEffect) => mergeEffect.mergeNode(in)) + if (typeof arrayOrFn === 'function') { + arrayOrFn.call(node, node); + return node + } + + // Check if first child is an array, otherwise use arguments as array + const children = arrayOrFn instanceof Array ? arrayOrFn : [...arguments]; + + children.forEach((child) => { + if (child instanceof Filter.MergeNode) { + node.put(child); + } else { + node.mergeNode(child); + } + }); + + return node + }, + componentTransfer (components = {}) { + const node = this.put(new Filter.ComponentTransferEffect()); + + if (typeof components === 'function') { + components.call(node, node); + return node + } + + // If no component is set, we use the given object for all components + if (!components.r && !components.g && !components.b && !components.a) { + const temp = components; + components = { + r: temp, g: temp, b: temp, a: temp + }; + } + + for (const c in components) { + // components[c] has to hold an attributes object + node.add(new Filter['Func' + c.toUpperCase()](components[c])); + } + + return node + } + }); + + const filterChildNodes = [ + 'distantLight', + 'pointLight', + 'spotLight', + 'mergeNode', + 'FuncR', + 'FuncG', + 'FuncB', + 'FuncA' + ]; + + filterChildNodes.forEach((child) => { + const name = capitalize(child); + Filter[name] = class extends Effect { + constructor (node) { + super(nodeOrNew('fe' + name, node), node); + } + }; + }); + + const componentFuncs = [ + 'funcR', + 'funcG', + 'funcB', + 'funcA' + ]; + + // Add an update function for componentTransfer-children + componentFuncs.forEach(function (c) { + const _class = Filter[capitalize(c)]; + const fn = wrapWithAttrCheck(function () { + return this.put(new _class()) + }); + + Filter.ComponentTransferEffect.prototype[c] = fn; + }); + + const lights = [ + 'distantLight', + 'pointLight', + 'spotLight' + ]; + + // Add light sources factories to lightining effects + lights.forEach((light) => { + const _class = Filter[capitalize(light)]; + const fn = wrapWithAttrCheck(function () { + return this.put(new _class()) + }); + + Filter.DiffuseLightingEffect.prototype[light] = fn; + Filter.SpecularLightingEffect.prototype[light] = fn; + }); + + extend(Filter.MergeEffect, { + mergeNode (_in) { + return this.put(new Filter.MergeNode()).attr('in', _in) + } + }); + + // add .filter function + extend(Defs, { + // Define filter + filter: function (block) { + const filter = this.put(new Filter()); + + /* invoke passed block */ + if (typeof block === 'function') { block.call(filter, filter); } + + return filter + } + }); + + extend(Container, { + // Define filter on defs + filter: function (block) { + return this.defs().filter(block) + } + }); + + extend(Element$1, { + // Create filter element in defs and store reference + filterWith: function (block) { + const filter = block instanceof Filter + ? block + : this.defs().filter(block); + + return this.attr('filter', filter) + }, + // Remove filter + unfilter: function (remove) { + /* remove filter attribute */ + return this.attr('filter', null) + }, + filterer () { + return this.reference('filter') + } + }); + + // chaining + const chainingEffects = { + // Blend effect + blend: function (in2, mode) { + return this.parent() && this.parent().blend(this, in2, mode) // pass this as the first input + }, + // ColorMatrix effect + colorMatrix: function (type, values) { + return this.parent() && this.parent().colorMatrix(type, values).in(this) + }, + // ComponentTransfer effect + componentTransfer: function (components) { + return this.parent() && this.parent().componentTransfer(components).in(this) + }, + // Composite effect + composite: function (in2, operator) { + return this.parent() && this.parent().composite(this, in2, operator) // pass this as the first input + }, + // ConvolveMatrix effect + convolveMatrix: function (matrix) { + return this.parent() && this.parent().convolveMatrix(matrix).in(this) + }, + // DiffuseLighting effect + diffuseLighting: function (surfaceScale, lightingColor, diffuseConstant, kernelUnitLength) { + return this.parent() && this.parent().diffuseLighting(surfaceScale, diffuseConstant, kernelUnitLength).in(this) + }, + // DisplacementMap effect + displacementMap: function (in2, scale, xChannelSelector, yChannelSelector) { + return this.parent() && this.parent().displacementMap(this, in2, scale, xChannelSelector, yChannelSelector) // pass this as the first input + }, + // DisplacementMap effect + dropShadow: function (x, y, stdDeviation) { + return this.parent() && this.parent().dropShadow(this, x, y, stdDeviation).in(this) // pass this as the first input + }, + // Flood effect + flood: function (color, opacity) { + return this.parent() && this.parent().flood(color, opacity) // this effect dont have inputs + }, + // Gaussian Blur effect + gaussianBlur: function (x, y) { + return this.parent() && this.parent().gaussianBlur(x, y).in(this) + }, + // Image effect + image: function (src) { + return this.parent() && this.parent().image(src) // this effect dont have inputs + }, + // Merge effect + merge: function (arg) { + arg = arg instanceof Array ? arg : [...arg]; + return this.parent() && this.parent().merge(this, ...arg) // pass this as the first argument + }, + // Morphology effect + morphology: function (operator, radius) { + return this.parent() && this.parent().morphology(operator, radius).in(this) + }, + // Offset effect + offset: function (dx, dy) { + return this.parent() && this.parent().offset(dx, dy).in(this) + }, + // SpecularLighting effect + specularLighting: function (surfaceScale, lightingColor, diffuseConstant, specularExponent, kernelUnitLength) { + return this.parent() && this.parent().specularLighting(surfaceScale, diffuseConstant, specularExponent, kernelUnitLength).in(this) + }, + // Tile effect + tile: function () { + return this.parent() && this.parent().tile().in(this) + }, + // Turbulence effect + turbulence: function (baseFrequency, numOctaves, seed, stitchTiles, type) { + return this.parent() && this.parent().turbulence(baseFrequency, numOctaves, seed, stitchTiles, type).in(this) + } + }; + + extend(Effect, chainingEffects); + + // Effect-specific extensions + extend(Filter.MergeEffect, { + in: function (effect) { + if (effect instanceof Filter.MergeNode) { + this.add(effect, 0); + } else { + this.add(new Filter.MergeNode().in(effect), 0); + } + + return this + } + }); + + extend([Filter.CompositeEffect, Filter.BlendEffect, Filter.DisplacementMapEffect], { + in2: function (effect) { + if (effect == null) { + const in2 = this.attr('in2'); + const ref = this.parent() && this.parent().find(`[result="${in2}"]`)[0]; + return ref || in2 + } + return this.attr('in2', effect) + } + }); + + // Presets + Filter.filter = { + sepiatone: [ + 0.343, 0.669, 0.119, 0, 0, + 0.249, 0.626, 0.130, 0, 0, + 0.172, 0.334, 0.111, 0, 0, + 0.000, 0.000, 0.000, 1, 0] + }; + + /** + * ApexCharts Filters Class for setting hover/active states on the paths. + * + * @module Formatters + **/ + var Filters = /*#__PURE__*/function () { + function Filters(ctx) { + _classCallCheck(this, Filters); + this.ctx = ctx; + this.w = ctx.w; + } + + // create a re-usable filter which can be appended other filter effects and applied to multiple elements + _createClass(Filters, [{ + key: "getDefaultFilter", + value: function getDefaultFilter(el, i) { + var w = this.w; + el.unfilter(true); + var filter = new Filter(); + filter.size('120%', '180%', '-5%', '-40%'); + if (w.config.chart.dropShadow.enabled) { + this.dropShadow(el, w.config.chart.dropShadow, i); + } + } + }, { + key: "applyFilter", + value: function applyFilter(el, i, filterType) { + var _this = this, + _el$filterer2; + var w = this.w; + el.unfilter(true); + if (filterType === 'none') { + this.getDefaultFilter(el, i); + return; + } + var shadowAttr = w.config.chart.dropShadow; + var brightnessFactor = filterType === 'lighten' ? 2 : 0.3; + el.filterWith(function (add) { + add.colorMatrix({ + type: 'matrix', + values: "\n ".concat(brightnessFactor, " 0 0 0 0\n 0 ").concat(brightnessFactor, " 0 0 0\n 0 0 ").concat(brightnessFactor, " 0 0\n 0 0 0 1 0\n "), + in: 'SourceGraphic', + result: 'brightness' + }); + if (shadowAttr.enabled) { + _this.addShadow(add, i, shadowAttr, 'brightness'); + } + }); + if (!shadowAttr.noUserSpaceOnUse) { + var _el$filterer, _el$filterer$node; + (_el$filterer = el.filterer()) === null || _el$filterer === void 0 ? void 0 : (_el$filterer$node = _el$filterer.node) === null || _el$filterer$node === void 0 ? void 0 : _el$filterer$node.setAttribute('filterUnits', 'userSpaceOnUse'); + } + + // this scales the filter to a bigger size so that the dropshadow doesn't crops + this._scaleFilterSize((_el$filterer2 = el.filterer()) === null || _el$filterer2 === void 0 ? void 0 : _el$filterer2.node); + } + + // appends dropShadow to the filter object which can be chained with other filter effects + }, { + key: "addShadow", + value: function addShadow(add, i, attrs, source) { + var _w$config$chart$dropS; + var w = this.w; + var blur = attrs.blur, + top = attrs.top, + left = attrs.left, + color = attrs.color, + opacity = attrs.opacity; + color = Array.isArray(color) ? color[i] : color; + if (((_w$config$chart$dropS = w.config.chart.dropShadow.enabledOnSeries) === null || _w$config$chart$dropS === void 0 ? void 0 : _w$config$chart$dropS.length) > 0) { + if (w.config.chart.dropShadow.enabledOnSeries.indexOf(i) === -1) { + return add; + } + } + add.offset({ + in: source, + dx: left, + dy: top, + result: 'offset' + }); + add.gaussianBlur({ + in: 'offset', + stdDeviation: blur, + result: 'blur' + }); + add.flood({ + 'flood-color': color, + 'flood-opacity': opacity, + result: 'flood' + }); + add.composite({ + in: 'flood', + in2: 'blur', + operator: 'in', + result: 'shadow' + }); + add.merge(['shadow', source]); + } + + // directly adds dropShadow to the element and returns the same element. + }, { + key: "dropShadow", + value: function dropShadow(el, attrs) { + var _w$config$chart$dropS2, + _this2 = this, + _el$filterer4; + var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + var w = this.w; + el.unfilter(true); + if (Utils$1.isMsEdge() && w.config.chart.type === 'radialBar') { + // in radialbar charts, dropshadow is clipping actual drawing in IE + return el; + } + if (((_w$config$chart$dropS2 = w.config.chart.dropShadow.enabledOnSeries) === null || _w$config$chart$dropS2 === void 0 ? void 0 : _w$config$chart$dropS2.length) > 0) { + var _w$config$chart$dropS3; + if (((_w$config$chart$dropS3 = w.config.chart.dropShadow.enabledOnSeries) === null || _w$config$chart$dropS3 === void 0 ? void 0 : _w$config$chart$dropS3.indexOf(i)) === -1) { + return el; + } + } + el.filterWith(function (add) { + _this2.addShadow(add, i, attrs, 'SourceGraphic'); + }); + if (!attrs.noUserSpaceOnUse) { + var _el$filterer3, _el$filterer3$node; + (_el$filterer3 = el.filterer()) === null || _el$filterer3 === void 0 ? void 0 : (_el$filterer3$node = _el$filterer3.node) === null || _el$filterer3$node === void 0 ? void 0 : _el$filterer3$node.setAttribute('filterUnits', 'userSpaceOnUse'); + } + + // this scales the filter to a bigger size so that the dropshadow doesn't crops + this._scaleFilterSize((_el$filterer4 = el.filterer()) === null || _el$filterer4 === void 0 ? void 0 : _el$filterer4.node); + return el; + } + }, { + key: "setSelectionFilter", + value: function setSelectionFilter(el, realIndex, dataPointIndex) { + var w = this.w; + if (typeof w.globals.selectedDataPoints[realIndex] !== 'undefined') { + if (w.globals.selectedDataPoints[realIndex].indexOf(dataPointIndex) > -1) { + el.node.setAttribute('selected', true); + var activeFilter = w.config.states.active.filter; + if (activeFilter !== 'none') { + this.applyFilter(el, realIndex, activeFilter.type); + } + } + } + } + }, { + key: "_scaleFilterSize", + value: function _scaleFilterSize(el) { + if (!el) return; + var setAttributes = function setAttributes(attrs) { + for (var key in attrs) { + if (attrs.hasOwnProperty(key)) { + el.setAttribute(key, attrs[key]); + } + } + }; + setAttributes({ + width: '200%', + height: '200%', + x: '-50%', + y: '-50%' + }); + } + }]); + return Filters; + }(); + + /** + * ApexCharts Graphics Class for all drawing operations. + * + * @module Graphics + **/ + var Graphics = /*#__PURE__*/function () { + function Graphics(ctx) { + _classCallCheck(this, Graphics); + this.ctx = ctx; + this.w = ctx.w; + } + + /***************************************************************************** + * * + * SVG Path Rounding Function * + * Copyright (C) 2014 Yona Appletree * + * * + * Licensed under the Apache License, Version 2.0 (the "License"); * + * you may not use this file except in compliance with the License. * + * You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, software * + * distributed under the License is distributed on an "AS IS" BASIS, * + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * + * See the License for the specific language governing permissions and * + * limitations under the License. * + * * + *****************************************************************************/ + + /** + * SVG Path rounding function. Takes an input path string and outputs a path + * string where all line-line corners have been rounded. Only supports absolute + * commands at the moment. + * + * @param pathString The SVG input path + * @param radius The amount to round the corners, either a value in the SVG + * coordinate space, or, if useFractionalRadius is true, a value + * from 0 to 1. + * @returns A new SVG path string with the rounding + */ + _createClass(Graphics, [{ + key: "roundPathCorners", + value: function roundPathCorners(pathString, radius) { + if (pathString.indexOf('NaN') > -1) pathString = ''; + function moveTowardsLength(movingPoint, targetPoint, amount) { + var width = targetPoint.x - movingPoint.x; + var height = targetPoint.y - movingPoint.y; + var distance = Math.sqrt(width * width + height * height); + return moveTowardsFractional(movingPoint, targetPoint, Math.min(1, amount / distance)); + } + function moveTowardsFractional(movingPoint, targetPoint, fraction) { + return { + x: movingPoint.x + (targetPoint.x - movingPoint.x) * fraction, + y: movingPoint.y + (targetPoint.y - movingPoint.y) * fraction + }; + } + + // Adjusts the ending position of a command + function adjustCommand(cmd, newPoint) { + if (cmd.length > 2) { + cmd[cmd.length - 2] = newPoint.x; + cmd[cmd.length - 1] = newPoint.y; + } + } + + // Gives an {x, y} object for a command's ending position + function pointForCommand(cmd) { + return { + x: parseFloat(cmd[cmd.length - 2]), + y: parseFloat(cmd[cmd.length - 1]) + }; + } + + // Split apart the path, handing concatonated letters and numbers + var pathParts = pathString.split(/[,\s]/).reduce(function (parts, part) { + var match = part.match('([a-zA-Z])(.+)'); + if (match) { + parts.push(match[1]); + parts.push(match[2]); + } else { + parts.push(part); + } + return parts; + }, []); + + // Group the commands with their arguments for easier handling + var commands = pathParts.reduce(function (commands, part) { + if (parseFloat(part) == part && commands.length) { + commands[commands.length - 1].push(part); + } else { + commands.push([part]); + } + return commands; + }, []); + + // The resulting commands, also grouped + var resultCommands = []; + if (commands.length > 1) { + var startPoint = pointForCommand(commands[0]); + + // Handle the close path case with a "virtual" closing line + var virtualCloseLine = null; + if (commands[commands.length - 1][0] == 'Z' && commands[0].length > 2) { + virtualCloseLine = ['L', startPoint.x, startPoint.y]; + commands[commands.length - 1] = virtualCloseLine; + } + + // We always use the first command (but it may be mutated) + resultCommands.push(commands[0]); + for (var cmdIndex = 1; cmdIndex < commands.length; cmdIndex++) { + var prevCmd = resultCommands[resultCommands.length - 1]; + var curCmd = commands[cmdIndex]; + + // Handle closing case + var nextCmd = curCmd == virtualCloseLine ? commands[1] : commands[cmdIndex + 1]; + + // Nasty logic to decide if this path is a candidite. + if (nextCmd && prevCmd && prevCmd.length > 2 && curCmd[0] == 'L' && nextCmd.length > 2 && nextCmd[0] == 'L') { + // Calc the points we're dealing with + var prevPoint = pointForCommand(prevCmd); + var curPoint = pointForCommand(curCmd); + var nextPoint = pointForCommand(nextCmd); + + // The start and end of the cuve are just our point moved towards the previous and next points, respectivly + var curveStart, curveEnd; + curveStart = moveTowardsLength(curPoint, prevPoint, radius); + curveEnd = moveTowardsLength(curPoint, nextPoint, radius); + + // Adjust the current command and add it + adjustCommand(curCmd, curveStart); + curCmd.origPoint = curPoint; + resultCommands.push(curCmd); + + // The curve control points are halfway between the start/end of the curve and + // the original point + var startControl = moveTowardsFractional(curveStart, curPoint, 0.5); + var endControl = moveTowardsFractional(curPoint, curveEnd, 0.5); + + // Create the curve + var curveCmd = ['C', startControl.x, startControl.y, endControl.x, endControl.y, curveEnd.x, curveEnd.y]; + // Save the original point for fractional calculations + curveCmd.origPoint = curPoint; + resultCommands.push(curveCmd); + } else { + // Pass through commands that don't qualify + resultCommands.push(curCmd); + } + } + + // Fix up the starting point and restore the close path if the path was orignally closed + if (virtualCloseLine) { + var newStartPoint = pointForCommand(resultCommands[resultCommands.length - 1]); + resultCommands.push(['Z']); + adjustCommand(resultCommands[0], newStartPoint); + } + } else { + resultCommands = commands; + } + return resultCommands.reduce(function (str, c) { + return str + c.join(' ') + ' '; + }, ''); + } + }, { + key: "drawLine", + value: function drawLine(x1, y1, x2, y2) { + var lineColor = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '#a8a8a8'; + var dashArray = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0; + var strokeWidth = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null; + var strokeLineCap = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 'butt'; + var w = this.w; + var line = w.globals.dom.Paper.line().attr({ + x1: x1, + y1: y1, + x2: x2, + y2: y2, + stroke: lineColor, + 'stroke-dasharray': dashArray, + 'stroke-width': strokeWidth, + 'stroke-linecap': strokeLineCap + }); + return line; + } + }, { + key: "drawRect", + value: function drawRect() { + var x1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + var y1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + var x2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + var y2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; + var radius = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0; + var color = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : '#fefefe'; + var opacity = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 1; + var strokeWidth = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null; + var strokeColor = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null; + var strokeDashArray = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : 0; + var w = this.w; + var rect = w.globals.dom.Paper.rect(); + rect.attr({ + x: x1, + y: y1, + width: x2 > 0 ? x2 : 0, + height: y2 > 0 ? y2 : 0, + rx: radius, + ry: radius, + opacity: opacity, + 'stroke-width': strokeWidth !== null ? strokeWidth : 0, + stroke: strokeColor !== null ? strokeColor : 'none', + 'stroke-dasharray': strokeDashArray + }); + + // fix apexcharts.js#1410 + rect.node.setAttribute('fill', color); + return rect; + } + }, { + key: "drawPolygon", + value: function drawPolygon(polygonString) { + var stroke = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '#e1e1e1'; + var strokeWidth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; + var fill = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'none'; + var w = this.w; + var polygon = w.globals.dom.Paper.polygon(polygonString).attr({ + fill: fill, + stroke: stroke, + 'stroke-width': strokeWidth + }); + return polygon; + } + }, { + key: "drawCircle", + value: function drawCircle(radius) { + var attrs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + var w = this.w; + if (radius < 0) radius = 0; + var c = w.globals.dom.Paper.circle(radius * 2); + if (attrs !== null) { + c.attr(attrs); + } + return c; + } + }, { + key: "drawPath", + value: function drawPath(_ref) { + var _ref$d = _ref.d, + d = _ref$d === void 0 ? '' : _ref$d, + _ref$stroke = _ref.stroke, + stroke = _ref$stroke === void 0 ? '#a8a8a8' : _ref$stroke, + _ref$strokeWidth = _ref.strokeWidth, + strokeWidth = _ref$strokeWidth === void 0 ? 1 : _ref$strokeWidth, + fill = _ref.fill, + _ref$fillOpacity = _ref.fillOpacity, + fillOpacity = _ref$fillOpacity === void 0 ? 1 : _ref$fillOpacity, + _ref$strokeOpacity = _ref.strokeOpacity, + strokeOpacity = _ref$strokeOpacity === void 0 ? 1 : _ref$strokeOpacity, + classes = _ref.classes, + _ref$strokeLinecap = _ref.strokeLinecap, + strokeLinecap = _ref$strokeLinecap === void 0 ? null : _ref$strokeLinecap, + _ref$strokeDashArray = _ref.strokeDashArray, + strokeDashArray = _ref$strokeDashArray === void 0 ? 0 : _ref$strokeDashArray; + var w = this.w; + if (strokeLinecap === null) { + strokeLinecap = w.config.stroke.lineCap; + } + if (d.indexOf('undefined') > -1 || d.indexOf('NaN') > -1) { + d = "M 0 ".concat(w.globals.gridHeight); + } + var p = w.globals.dom.Paper.path(d).attr({ + fill: fill, + 'fill-opacity': fillOpacity, + stroke: stroke, + 'stroke-opacity': strokeOpacity, + 'stroke-linecap': strokeLinecap, + 'stroke-width': strokeWidth, + 'stroke-dasharray': strokeDashArray, + class: classes + }); + return p; + } + }, { + key: "group", + value: function group() { + var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + var w = this.w; + var g = w.globals.dom.Paper.group(); + if (attrs !== null) { + g.attr(attrs); + } + return g; + } + }, { + key: "move", + value: function move(x, y) { + var move = ['M', x, y].join(' '); + return move; + } + }, { + key: "line", + value: function line(x, y) { + var hORv = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + var line = null; + if (hORv === null) { + line = [' L', x, y].join(' '); + } else if (hORv === 'H') { + line = [' H', x].join(' '); + } else if (hORv === 'V') { + line = [' V', y].join(' '); + } + return line; + } + }, { + key: "curve", + value: function curve(x1, y1, x2, y2, x, y) { + var curve = ['C', x1, y1, x2, y2, x, y].join(' '); + return curve; + } + }, { + key: "quadraticCurve", + value: function quadraticCurve(x1, y1, x, y) { + var curve = ['Q', x1, y1, x, y].join(' '); + return curve; + } + }, { + key: "arc", + value: function arc(rx, ry, axisRotation, largeArcFlag, sweepFlag, x, y) { + var relative = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false; + var coord = 'A'; + if (relative) coord = 'a'; + var arc = [coord, rx, ry, axisRotation, largeArcFlag, sweepFlag, x, y].join(' '); + return arc; + } + + /** + * @memberof Graphics + * @param {object} + * i = series's index + * realIndex = realIndex is series's actual index when it was drawn time. After several redraws, the iterating "i" may change in loops, but realIndex doesn't + * pathFrom = existing pathFrom to animateTo + * pathTo = new Path to which d attr will be animated from pathFrom to pathTo + * stroke = line Color + * strokeWidth = width of path Line + * fill = it can be gradient, single color, pattern or image + * animationDelay = how much to delay when starting animation (in milliseconds) + * dataChangeSpeed = for dynamic animations, when data changes + * className = class attribute to add + * @return {object} svg.js path object + **/ + }, { + key: "renderPaths", + value: function renderPaths(_ref2) { + var j = _ref2.j, + realIndex = _ref2.realIndex, + pathFrom = _ref2.pathFrom, + pathTo = _ref2.pathTo, + stroke = _ref2.stroke, + strokeWidth = _ref2.strokeWidth, + strokeLinecap = _ref2.strokeLinecap, + fill = _ref2.fill, + animationDelay = _ref2.animationDelay, + initialSpeed = _ref2.initialSpeed, + dataChangeSpeed = _ref2.dataChangeSpeed, + className = _ref2.className, + chartType = _ref2.chartType, + _ref2$shouldClipToGri = _ref2.shouldClipToGrid, + shouldClipToGrid = _ref2$shouldClipToGri === void 0 ? true : _ref2$shouldClipToGri, + _ref2$bindEventsOnPat = _ref2.bindEventsOnPaths, + bindEventsOnPaths = _ref2$bindEventsOnPat === void 0 ? true : _ref2$bindEventsOnPat, + _ref2$drawShadow = _ref2.drawShadow, + drawShadow = _ref2$drawShadow === void 0 ? true : _ref2$drawShadow; + var w = this.w; + var filters = new Filters(this.ctx); + var anim = new Animations(this.ctx); + var initialAnim = this.w.config.chart.animations.enabled; + var dynamicAnim = initialAnim && this.w.config.chart.animations.dynamicAnimation.enabled; + var d; + var shouldAnimate = !!(initialAnim && !w.globals.resized || dynamicAnim && w.globals.dataChanged && w.globals.shouldAnimate); + if (shouldAnimate) { + d = pathFrom; + } else { + d = pathTo; + w.globals.animationEnded = true; + } + var strokeDashArrayOpt = w.config.stroke.dashArray; + var strokeDashArray = 0; + if (Array.isArray(strokeDashArrayOpt)) { + strokeDashArray = strokeDashArrayOpt[realIndex]; + } else { + strokeDashArray = w.config.stroke.dashArray; + } + var el = this.drawPath({ + d: d, + stroke: stroke, + strokeWidth: strokeWidth, + fill: fill, + fillOpacity: 1, + classes: className, + strokeLinecap: strokeLinecap, + strokeDashArray: strokeDashArray + }); + el.attr('index', realIndex); + if (shouldClipToGrid) { + if (chartType === 'bar' && !w.globals.isHorizontal || w.globals.comboCharts) { + el.attr({ + 'clip-path': "url(#gridRectBarMask".concat(w.globals.cuid, ")") + }); + } else { + el.attr({ + 'clip-path': "url(#gridRectMask".concat(w.globals.cuid, ")") + }); + } + } + if (w.config.chart.dropShadow.enabled && drawShadow) { + filters.dropShadow(el, w.config.chart.dropShadow, realIndex); + } + if (bindEventsOnPaths) { + el.node.addEventListener('mouseenter', this.pathMouseEnter.bind(this, el)); + el.node.addEventListener('mouseleave', this.pathMouseLeave.bind(this, el)); + el.node.addEventListener('mousedown', this.pathMouseDown.bind(this, el)); + } + el.attr({ + pathTo: pathTo, + pathFrom: pathFrom + }); + var defaultAnimateOpts = { + el: el, + j: j, + realIndex: realIndex, + pathFrom: pathFrom, + pathTo: pathTo, + fill: fill, + strokeWidth: strokeWidth, + delay: animationDelay + }; + if (initialAnim && !w.globals.resized && !w.globals.dataChanged) { + anim.animatePathsGradually(_objectSpread2(_objectSpread2({}, defaultAnimateOpts), {}, { + speed: initialSpeed + })); + } else { + if (w.globals.resized || !w.globals.dataChanged) { + anim.showDelayedElements(); + } + } + if (w.globals.dataChanged && dynamicAnim && shouldAnimate) { + anim.animatePathsGradually(_objectSpread2(_objectSpread2({}, defaultAnimateOpts), {}, { + speed: dataChangeSpeed + })); + } + return el; + } + }, { + key: "drawPattern", + value: function drawPattern(style, width, height) { + var stroke = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '#a8a8a8'; + var strokeWidth = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0; + var w = this.w; + var p = w.globals.dom.Paper.pattern(width, height, function (add) { + if (style === 'horizontalLines') { + add.line(0, 0, height, 0).stroke({ + color: stroke, + width: strokeWidth + 1 + }); + } else if (style === 'verticalLines') { + add.line(0, 0, 0, width).stroke({ + color: stroke, + width: strokeWidth + 1 + }); + } else if (style === 'slantedLines') { + add.line(0, 0, width, height).stroke({ + color: stroke, + width: strokeWidth + }); + } else if (style === 'squares') { + add.rect(width, height).fill('none').stroke({ + color: stroke, + width: strokeWidth + }); + } else if (style === 'circles') { + add.circle(width).fill('none').stroke({ + color: stroke, + width: strokeWidth + }); + } + }); + return p; + } + }, { + key: "drawGradient", + value: function drawGradient(style, gfrom, gto, opacityFrom, opacityTo) { + var size = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null; + var stops = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null; + var colorStops = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : []; + var i = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 0; + var w = this.w; + var g; + if (gfrom.length < 9 && gfrom.indexOf('#') === 0) { + // if the hex contains alpha and is of 9 digit, skip the opacity + gfrom = Utils$1.hexToRgba(gfrom, opacityFrom); + } + if (gto.length < 9 && gto.indexOf('#') === 0) { + gto = Utils$1.hexToRgba(gto, opacityTo); + } + var stop1 = 0; + var stop2 = 1; + var stop3 = 1; + var stop4 = null; + if (stops !== null) { + stop1 = typeof stops[0] !== 'undefined' ? stops[0] / 100 : 0; + stop2 = typeof stops[1] !== 'undefined' ? stops[1] / 100 : 1; + stop3 = typeof stops[2] !== 'undefined' ? stops[2] / 100 : 1; + stop4 = typeof stops[3] !== 'undefined' ? stops[3] / 100 : null; + } + var radial = !!(w.config.chart.type === 'donut' || w.config.chart.type === 'pie' || w.config.chart.type === 'polarArea' || w.config.chart.type === 'bubble'); + if (!colorStops || colorStops.length === 0) { + g = w.globals.dom.Paper.gradient(radial ? 'radial' : 'linear', function (add) { + add.stop(stop1, gfrom, opacityFrom); + add.stop(stop2, gto, opacityTo); + add.stop(stop3, gto, opacityTo); + if (stop4 !== null) { + add.stop(stop4, gfrom, opacityFrom); + } + }); + } else { + g = w.globals.dom.Paper.gradient(radial ? 'radial' : 'linear', function (add) { + var gradientStops = Array.isArray(colorStops[i]) ? colorStops[i] : colorStops; + gradientStops.forEach(function (s) { + add.stop(s.offset / 100, s.color, s.opacity); + }); + }); + } + if (!radial) { + if (style === 'vertical') { + g.from(0, 0).to(0, 1); + } else if (style === 'diagonal') { + g.from(0, 0).to(1, 1); + } else if (style === 'horizontal') { + g.from(0, 1).to(1, 1); + } else if (style === 'diagonal2') { + g.from(1, 0).to(0, 1); + } + } else { + var offx = w.globals.gridWidth / 2; + var offy = w.globals.gridHeight / 2; + if (w.config.chart.type !== 'bubble') { + g.attr({ + gradientUnits: 'userSpaceOnUse', + cx: offx, + cy: offy, + r: size + }); + } else { + g.attr({ + cx: 0.5, + cy: 0.5, + r: 0.8, + fx: 0.2, + fy: 0.2 + }); + } + } + return g; + } + }, { + key: "getTextBasedOnMaxWidth", + value: function getTextBasedOnMaxWidth(_ref3) { + var text = _ref3.text, + maxWidth = _ref3.maxWidth, + fontSize = _ref3.fontSize, + fontFamily = _ref3.fontFamily; + var tRects = this.getTextRects(text, fontSize, fontFamily); + var wordWidth = tRects.width / text.length; + var wordsBasedOnWidth = Math.floor(maxWidth / wordWidth); + if (maxWidth < tRects.width) { + return text.slice(0, wordsBasedOnWidth - 3) + '...'; + } + return text; + } + }, { + key: "drawText", + value: function drawText(_ref4) { + var _this = this; + var x = _ref4.x, + y = _ref4.y, + text = _ref4.text, + textAnchor = _ref4.textAnchor, + fontSize = _ref4.fontSize, + fontFamily = _ref4.fontFamily, + fontWeight = _ref4.fontWeight, + foreColor = _ref4.foreColor, + opacity = _ref4.opacity, + maxWidth = _ref4.maxWidth, + _ref4$cssClass = _ref4.cssClass, + cssClass = _ref4$cssClass === void 0 ? '' : _ref4$cssClass, + _ref4$isPlainText = _ref4.isPlainText, + isPlainText = _ref4$isPlainText === void 0 ? true : _ref4$isPlainText, + _ref4$dominantBaselin = _ref4.dominantBaseline, + dominantBaseline = _ref4$dominantBaselin === void 0 ? 'auto' : _ref4$dominantBaselin; + var w = this.w; + if (typeof text === 'undefined') text = ''; + var truncatedText = text; + if (!textAnchor) { + textAnchor = 'start'; + } + if (!foreColor || !foreColor.length) { + foreColor = w.config.chart.foreColor; + } + fontFamily = fontFamily || w.config.chart.fontFamily; + fontSize = fontSize || '11px'; + fontWeight = fontWeight || 'regular'; + var commonProps = { + maxWidth: maxWidth, + fontSize: fontSize, + fontFamily: fontFamily + }; + var elText; + if (Array.isArray(text)) { + elText = w.globals.dom.Paper.text(function (add) { + for (var i = 0; i < text.length; i++) { + truncatedText = text[i]; + if (maxWidth) { + truncatedText = _this.getTextBasedOnMaxWidth(_objectSpread2({ + text: text[i] + }, commonProps)); + } + i === 0 ? add.tspan(truncatedText) : add.tspan(truncatedText).newLine(); + } + }); + } else { + if (maxWidth) { + truncatedText = this.getTextBasedOnMaxWidth(_objectSpread2({ + text: text + }, commonProps)); + } + elText = isPlainText ? w.globals.dom.Paper.plain(text) : w.globals.dom.Paper.text(function (add) { + return add.tspan(truncatedText); + }); + } + elText.attr({ + x: x, + y: y, + 'text-anchor': textAnchor, + 'dominant-baseline': dominantBaseline, + 'font-size': fontSize, + 'font-family': fontFamily, + 'font-weight': fontWeight, + fill: foreColor, + class: 'apexcharts-text ' + cssClass + }); + elText.node.style.fontFamily = fontFamily; + elText.node.style.opacity = opacity; + return elText; + } + }, { + key: "getMarkerPath", + value: function getMarkerPath(x, y, type, size) { + var d = ''; + switch (type) { + case 'cross': + size = size / 1.4; + d = "M ".concat(x - size, " ").concat(y - size, " L ").concat(x + size, " ").concat(y + size, " M ").concat(x - size, " ").concat(y + size, " L ").concat(x + size, " ").concat(y - size); + break; + case 'plus': + size = size / 1.12; + d = "M ".concat(x - size, " ").concat(y, " L ").concat(x + size, " ").concat(y, " M ").concat(x, " ").concat(y - size, " L ").concat(x, " ").concat(y + size); + break; + case 'star': + case 'sparkle': + var points = 5; + size = size * 1.15; + if (type === 'sparkle') { + size = size / 1.1; + points = 4; + } + var step = Math.PI / points; + for (var i = 0; i <= 2 * points; i++) { + var angle = i * step; + var radius = i % 2 === 0 ? size : size / 2; + var xPos = x + radius * Math.sin(angle); + var yPos = y - radius * Math.cos(angle); + d += (i === 0 ? 'M' : 'L') + xPos + ',' + yPos; + } + d += 'Z'; + break; + case 'triangle': + d = "M ".concat(x, " ").concat(y - size, " \n L ").concat(x + size, " ").concat(y + size, " \n L ").concat(x - size, " ").concat(y + size, " \n Z"); + break; + case 'square': + case 'rect': + size = size / 1.125; + d = "M ".concat(x - size, " ").concat(y - size, " \n L ").concat(x + size, " ").concat(y - size, " \n L ").concat(x + size, " ").concat(y + size, " \n L ").concat(x - size, " ").concat(y + size, " \n Z"); + break; + case 'diamond': + size = size * 1.05; + d = "M ".concat(x, " ").concat(y - size, " \n L ").concat(x + size, " ").concat(y, " \n L ").concat(x, " ").concat(y + size, " \n L ").concat(x - size, " ").concat(y, " \n Z"); + break; + case 'line': + size = size / 1.1; + d = "M ".concat(x - size, " ").concat(y, " \n L ").concat(x + size, " ").concat(y); + break; + case 'circle': + default: + size = size * 2; + d = "M ".concat(x, ", ").concat(y, " \n m -").concat(size / 2, ", 0 \n a ").concat(size / 2, ",").concat(size / 2, " 0 1,0 ").concat(size, ",0 \n a ").concat(size / 2, ",").concat(size / 2, " 0 1,0 -").concat(size, ",0"); + break; + } + return d; + } + + /** + * @param {number} x - The x-coordinate of the marker + * @param {number} y - The y-coordinate of the marker. + * @param {number} size - The size of the marker + * @param {Object} opts - The options for the marker. + * @returns {Object} The created marker. + */ + }, { + key: "drawMarkerShape", + value: function drawMarkerShape(x, y, type, size, opts) { + var path = this.drawPath({ + d: this.getMarkerPath(x, y, type, size, opts), + stroke: opts.pointStrokeColor, + strokeDashArray: opts.pointStrokeDashArray, + strokeWidth: opts.pointStrokeWidth, + fill: opts.pointFillColor, + fillOpacity: opts.pointFillOpacity, + strokeOpacity: opts.pointStrokeOpacity + }); + path.attr({ + cx: x, + cy: y, + shape: opts.shape, + class: opts.class ? opts.class : '' + }); + return path; + } + }, { + key: "drawMarker", + value: function drawMarker(x, y, opts) { + x = x || 0; + var size = opts.pSize || 0; + if (!Utils$1.isNumber(y)) { + size = 0; + y = 0; + } + return this.drawMarkerShape(x, y, opts === null || opts === void 0 ? void 0 : opts.shape, size, _objectSpread2(_objectSpread2({}, opts), opts.shape === 'line' || opts.shape === 'plus' || opts.shape === 'cross' ? { + pointStrokeColor: opts.pointFillColor, + pointStrokeOpacity: opts.pointFillOpacity + } : {})); + } + }, { + key: "pathMouseEnter", + value: function pathMouseEnter(path, e) { + var w = this.w; + var filters = new Filters(this.ctx); + var i = parseInt(path.node.getAttribute('index'), 10); + var j = parseInt(path.node.getAttribute('j'), 10); + if (typeof w.config.chart.events.dataPointMouseEnter === 'function') { + w.config.chart.events.dataPointMouseEnter(e, this.ctx, { + seriesIndex: i, + dataPointIndex: j, + w: w + }); + } + this.ctx.events.fireEvent('dataPointMouseEnter', [e, this.ctx, { + seriesIndex: i, + dataPointIndex: j, + w: w + }]); + if (w.config.states.active.filter.type !== 'none') { + if (path.node.getAttribute('selected') === 'true') { + return; + } + } + if (w.config.states.hover.filter.type !== 'none') { + if (!w.globals.isTouchDevice) { + var hoverFilter = w.config.states.hover.filter; + filters.applyFilter(path, i, hoverFilter.type); + } + } + } + }, { + key: "pathMouseLeave", + value: function pathMouseLeave(path, e) { + var w = this.w; + var filters = new Filters(this.ctx); + var i = parseInt(path.node.getAttribute('index'), 10); + var j = parseInt(path.node.getAttribute('j'), 10); + if (typeof w.config.chart.events.dataPointMouseLeave === 'function') { + w.config.chart.events.dataPointMouseLeave(e, this.ctx, { + seriesIndex: i, + dataPointIndex: j, + w: w + }); + } + this.ctx.events.fireEvent('dataPointMouseLeave', [e, this.ctx, { + seriesIndex: i, + dataPointIndex: j, + w: w + }]); + if (w.config.states.active.filter.type !== 'none') { + if (path.node.getAttribute('selected') === 'true') { + return; + } + } + if (w.config.states.hover.filter.type !== 'none') { + filters.getDefaultFilter(path, i); + } + } + }, { + key: "pathMouseDown", + value: function pathMouseDown(path, e) { + var w = this.w; + var filters = new Filters(this.ctx); + var i = parseInt(path.node.getAttribute('index'), 10); + var j = parseInt(path.node.getAttribute('j'), 10); + var selected = 'false'; + if (path.node.getAttribute('selected') === 'true') { + path.node.setAttribute('selected', 'false'); + if (w.globals.selectedDataPoints[i].indexOf(j) > -1) { + var index = w.globals.selectedDataPoints[i].indexOf(j); + w.globals.selectedDataPoints[i].splice(index, 1); + } + } else { + if (!w.config.states.active.allowMultipleDataPointsSelection && w.globals.selectedDataPoints.length > 0) { + w.globals.selectedDataPoints = []; + var elPaths = w.globals.dom.Paper.find('.apexcharts-series path:not(.apexcharts-decoration-element)'); + var elCircles = w.globals.dom.Paper.find('.apexcharts-series circle:not(.apexcharts-decoration-element), .apexcharts-series rect:not(.apexcharts-decoration-element)'); + var deSelect = function deSelect(els) { + Array.prototype.forEach.call(els, function (el) { + el.node.setAttribute('selected', 'false'); + filters.getDefaultFilter(el, i); + }); + }; + deSelect(elPaths); + deSelect(elCircles); + } + path.node.setAttribute('selected', 'true'); + selected = 'true'; + if (typeof w.globals.selectedDataPoints[i] === 'undefined') { + w.globals.selectedDataPoints[i] = []; + } + w.globals.selectedDataPoints[i].push(j); + } + if (selected === 'true') { + var activeFilter = w.config.states.active.filter; + if (activeFilter !== 'none') { + filters.applyFilter(path, i, activeFilter.type); + } else { + // Reapply the hover filter in case it was removed by `deselect`when there is no active filter and it is not a touch device + if (w.config.states.hover.filter !== 'none') { + if (!w.globals.isTouchDevice) { + var hoverFilter = w.config.states.hover.filter; + filters.applyFilter(path, i, hoverFilter.type); + } + } + } + } else { + // If the item was deselected, apply hover state filter if it is not a touch device + if (w.config.states.active.filter.type !== 'none') { + if (w.config.states.hover.filter.type !== 'none' && !w.globals.isTouchDevice) { + var hoverFilter = w.config.states.hover.filter; + filters.applyFilter(path, i, hoverFilter.type); + } else { + filters.getDefaultFilter(path, i); + } + } + } + if (typeof w.config.chart.events.dataPointSelection === 'function') { + w.config.chart.events.dataPointSelection(e, this.ctx, { + selectedDataPoints: w.globals.selectedDataPoints, + seriesIndex: i, + dataPointIndex: j, + w: w + }); + } + if (e) { + this.ctx.events.fireEvent('dataPointSelection', [e, this.ctx, { + selectedDataPoints: w.globals.selectedDataPoints, + seriesIndex: i, + dataPointIndex: j, + w: w + }]); + } + } + }, { + key: "rotateAroundCenter", + value: function rotateAroundCenter(el) { + var coord = {}; + if (el && typeof el.getBBox === 'function') { + coord = el.getBBox(); + } + var x = coord.x + coord.width / 2; + var y = coord.y + coord.height / 2; + return { + x: x, + y: y + }; + } + }, { + key: "getTextRects", + value: function getTextRects(text, fontSize, fontFamily, transform) { + var useBBox = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true; + var w = this.w; + var virtualText = this.drawText({ + x: -200, + y: -200, + text: text, + textAnchor: 'start', + fontSize: fontSize, + fontFamily: fontFamily, + foreColor: '#fff', + opacity: 0 + }); + if (transform) { + virtualText.attr('transform', transform); + } + w.globals.dom.Paper.add(virtualText); + var rect = virtualText.bbox(); + if (!useBBox) { + rect = virtualText.node.getBoundingClientRect(); + } + virtualText.remove(); + return { + width: rect.width, + height: rect.height + }; + } + + /** + * append ... to long text + * http://stackoverflow.com/questions/9241315/trimming-text-to-a-given-pixel-width-in-svg + * @memberof Graphics + **/ + }, { + key: "placeTextWithEllipsis", + value: function placeTextWithEllipsis(textObj, textString, width) { + if (typeof textObj.getComputedTextLength !== 'function') return; + textObj.textContent = textString; + if (textString.length > 0) { + // ellipsis is needed + if (textObj.getComputedTextLength() >= width / 1.1) { + for (var x = textString.length - 3; x > 0; x -= 3) { + if (textObj.getSubStringLength(0, x) <= width / 1.1) { + textObj.textContent = textString.substring(0, x) + '...'; + return; + } + } + textObj.textContent = '.'; // can't place at all + } + } + } + }], [{ + key: "setAttrs", + value: function setAttrs(el, attrs) { + for (var key in attrs) { + if (attrs.hasOwnProperty(key)) { + el.setAttribute(key, attrs[key]); + } + } + } + }]); + return Graphics; + }(); + + /* + ** Util functions which are dependent on ApexCharts instance + */ + var CoreUtils = /*#__PURE__*/function () { + function CoreUtils(ctx) { + _classCallCheck(this, CoreUtils); + this.ctx = ctx; + this.w = ctx.w; + } + _createClass(CoreUtils, [{ + key: "getStackedSeriesTotals", + value: + /** + * @memberof CoreUtils + * returns the sum of all individual values in a multiple stacked series + * Eg. w.globals.series = [[32,33,43,12], [2,3,5,1]] + * @return [34,36,48,13] + **/ + function getStackedSeriesTotals() { + var excludedSeriesIndices = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + var w = this.w; + var total = []; + if (w.globals.series.length === 0) return total; + for (var i = 0; i < w.globals.series[w.globals.maxValsInArrayIndex].length; i++) { + var t = 0; + for (var j = 0; j < w.globals.series.length; j++) { + if (typeof w.globals.series[j][i] !== 'undefined' && excludedSeriesIndices.indexOf(j) === -1) { + t += w.globals.series[j][i]; + } + } + total.push(t); + } + return total; + } + + // get total of the all values inside all series + }, { + key: "getSeriesTotalByIndex", + value: function getSeriesTotalByIndex() { + var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + if (index === null) { + // non-plot chart types - pie / donut / circle + return this.w.config.series.reduce(function (acc, cur) { + return acc + cur; + }, 0); + } else { + // axis charts - supporting multiple series + return this.w.globals.series[index].reduce(function (acc, cur) { + return acc + cur; + }, 0); + } + } + + /** + * @memberof CoreUtils + * returns the sum of values in a multiple stacked grouped charts + * Eg. w.globals.series = [[32,33,43,12], [2,3,5,1], [43, 23, 34, 22]] + * series 1 and 2 are in a group, while series 3 is in another group + * @return [[34, 36, 48, 12], [43, 23, 34, 22]] + **/ + }, { + key: "getStackedSeriesTotalsByGroups", + value: function getStackedSeriesTotalsByGroups() { + var _this = this; + var w = this.w; + var total = []; + w.globals.seriesGroups.forEach(function (sg) { + var includedIndexes = []; + w.config.series.forEach(function (s, si) { + if (sg.indexOf(w.globals.seriesNames[si]) > -1) { + includedIndexes.push(si); + } + }); + var excludedIndices = w.globals.series.map(function (_, fi) { + return includedIndexes.indexOf(fi) === -1 ? fi : -1; + }).filter(function (f) { + return f !== -1; + }); + total.push(_this.getStackedSeriesTotals(excludedIndices)); + }); + return total; + } + }, { + key: "setSeriesYAxisMappings", + value: function setSeriesYAxisMappings() { + var gl = this.w.globals; + var cnf = this.w.config; + + // The old config method to map multiple series to a y axis is to + // include one yaxis config per series but set each yaxis seriesName to the + // same series name. This relies on indexing equivalence to map series to + // an axis: series[n] => yaxis[n]. This needs to be retained for compatibility. + // But we introduce an alternative that explicitly configures yaxis elements + // with the series that will be referenced to them (seriesName: []). This + // only requires including the yaxis elements that will be seen on the chart. + // Old way: + // ya: s + // 0: 0 + // 1: 1 + // 2: 1 + // 3: 1 + // 4: 1 + // Axes 0..4 are all scaled and all will be rendered unless the axes are + // show: false. If the chart is stacked, it's assumed that series 1..4 are + // the contributing series. This is not particularly intuitive. + // New way: + // ya: s + // 0: [0] + // 1: [1,2,3,4] + // If the chart is stacked, it can be assumed that any axis with multiple + // series is stacked. + // + // If this is an old chart and we are being backward compatible, it will be + // expected that each series is associated with it's corresponding yaxis + // through their indices, one-to-one. + // If yaxis.seriesName matches series.name, we have indices yi and si. + // A name match where yi != si is interpretted as yaxis[yi] and yaxis[si] + // will both be scaled to fit the combined series[si] and series[yi]. + // Consider series named: S0,S1,S2 and yaxes A0,A1,A2. + // + // Example 1: A0 and A1 scaled the same. + // A0.seriesName: S0 + // A1.seriesName: S0 + // A2.seriesName: S2 + // Then A1 <-> A0 + // + // Example 2: A0, A1 and A2 all scaled the same. + // A0.seriesName: S2 + // A1.seriesName: S0 + // A2.seriesName: S1 + // A0 <-> A2, A1 <-> A0, A2 <-> A1 --->>> A0 <-> A1 <-> A2 + + var axisSeriesMap = []; + var seriesYAxisReverseMap = []; + var unassignedSeriesIndices = []; + var seriesNameArrayStyle = gl.series.length > cnf.yaxis.length || cnf.yaxis.some(function (a) { + return Array.isArray(a.seriesName); + }); + cnf.series.forEach(function (s, i) { + unassignedSeriesIndices.push(i); + seriesYAxisReverseMap.push(null); + }); + cnf.yaxis.forEach(function (yaxe, yi) { + axisSeriesMap[yi] = []; + }); + var unassignedYAxisIndices = []; + + // here, we loop through the yaxis array and find the item which has "seriesName" property + cnf.yaxis.forEach(function (yaxe, yi) { + var assigned = false; + // Allow seriesName to be either a string (for backward compatibility), + // in which case, handle multiple yaxes referencing the same series. + // or an array of strings so that a yaxis can reference multiple series. + // Feature request #4237 + if (yaxe.seriesName) { + var seriesNames = []; + if (Array.isArray(yaxe.seriesName)) { + seriesNames = yaxe.seriesName; + } else { + seriesNames.push(yaxe.seriesName); + } + seriesNames.forEach(function (name) { + cnf.series.forEach(function (s, si) { + if (s.name === name) { + var remove = si; + if (yi === si || seriesNameArrayStyle) { + // New style, don't allow series to be double referenced + if (!seriesNameArrayStyle || unassignedSeriesIndices.indexOf(si) > -1) { + axisSeriesMap[yi].push([yi, si]); + } else { + console.warn("Series '" + s.name + "' referenced more than once in what looks like the new style." + ' That is, when using either seriesName: [],' + ' or when there are more series than yaxes.'); + } + } else { + // The series index refers to the target yaxis and the current + // yaxis index refers to the actual referenced series. + axisSeriesMap[si].push([si, yi]); + remove = yi; + } + assigned = true; + remove = unassignedSeriesIndices.indexOf(remove); + if (remove !== -1) { + unassignedSeriesIndices.splice(remove, 1); + } + } + }); + }); + } + if (!assigned) { + unassignedYAxisIndices.push(yi); + } + }); + axisSeriesMap = axisSeriesMap.map(function (yaxe, yi) { + var ra = []; + yaxe.forEach(function (sa) { + seriesYAxisReverseMap[sa[1]] = sa[0]; + ra.push(sa[1]); + }); + return ra; + }); + + // All series referenced directly by yaxes have been assigned to those axes. + // Any series so far unassigned will be assigned to any yaxes that have yet + // to reference series directly, one-for-one in order of appearance, with + // all left-over series assigned to either the last unassigned yaxis, or the + // last yaxis if all have assigned series. This captures the + // default single and multiaxis config options which simply includes zero, + // one or as many yaxes as there are series but do not reference them by name. + var lastUnassignedYAxis = cnf.yaxis.length - 1; + for (var i = 0; i < unassignedYAxisIndices.length; i++) { + lastUnassignedYAxis = unassignedYAxisIndices[i]; + axisSeriesMap[lastUnassignedYAxis] = []; + if (unassignedSeriesIndices) { + var si = unassignedSeriesIndices[0]; + unassignedSeriesIndices.shift(); + axisSeriesMap[lastUnassignedYAxis].push(si); + seriesYAxisReverseMap[si] = lastUnassignedYAxis; + } else { + break; + } + } + unassignedSeriesIndices.forEach(function (i) { + axisSeriesMap[lastUnassignedYAxis].push(i); + seriesYAxisReverseMap[i] = lastUnassignedYAxis; + }); + + // For the old-style seriesName-as-string-only, leave the zero-length yaxis + // array elements in for compatibility so that series.length == yaxes.length + // for multi axis charts. + gl.seriesYAxisMap = axisSeriesMap.map(function (x) { + return x; + }); + gl.seriesYAxisReverseMap = seriesYAxisReverseMap.map(function (x) { + return x; + }); + // Set default series group names + gl.seriesYAxisMap.forEach(function (axisSeries, ai) { + axisSeries.forEach(function (si) { + // series may be bare until loaded in realtime + if (cnf.series[si] && cnf.series[si].group === undefined) { + // A series with no group defined will be named after the axis that + // referenced it and thus form a group automatically. + cnf.series[si].group = 'apexcharts-axis-'.concat(ai.toString()); + } + }); + }); + } + }, { + key: "isSeriesNull", + value: function isSeriesNull() { + var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + var r = []; + if (index === null) { + // non-plot chart types - pie / donut / circle + r = this.w.config.series.filter(function (d) { + return d !== null; + }); + } else { + // axis charts - supporting multiple series + r = this.w.config.series[index].data.filter(function (d) { + return d !== null; + }); + } + return r.length === 0; + } + }, { + key: "seriesHaveSameValues", + value: function seriesHaveSameValues(index) { + return this.w.globals.series[index].every(function (val, i, arr) { + return val === arr[0]; + }); + } + }, { + key: "getCategoryLabels", + value: function getCategoryLabels(labels) { + var w = this.w; + var catLabels = labels.slice(); + if (w.config.xaxis.convertedCatToNumeric) { + catLabels = labels.map(function (i, li) { + return w.config.xaxis.labels.formatter(i - w.globals.minX + 1); + }); + } + return catLabels; + } + // maxValsInArrayIndex is the index of series[] which has the largest number of items + }, { + key: "getLargestSeries", + value: function getLargestSeries() { + var w = this.w; + w.globals.maxValsInArrayIndex = w.globals.series.map(function (a) { + return a.length; + }).indexOf(Math.max.apply(Math, w.globals.series.map(function (a) { + return a.length; + }))); + } + }, { + key: "getLargestMarkerSize", + value: function getLargestMarkerSize() { + var w = this.w; + var size = 0; + w.globals.markers.size.forEach(function (m) { + size = Math.max(size, m); + }); + if (w.config.markers.discrete && w.config.markers.discrete.length) { + w.config.markers.discrete.forEach(function (m) { + size = Math.max(size, m.size); + }); + } + if (size > 0) { + if (w.config.markers.hover.size > 0) { + size = w.config.markers.hover.size; + } else { + size += w.config.markers.hover.sizeOffset; + } + } + w.globals.markers.largestSize = size; + return size; + } + + /** + * @memberof Core + * returns the sum of all values in a series + * Eg. w.globals.series = [[32,33,43,12], [2,3,5,1]] + * @return [120, 11] + **/ + }, { + key: "getSeriesTotals", + value: function getSeriesTotals() { + var w = this.w; + w.globals.seriesTotals = w.globals.series.map(function (ser, index) { + var total = 0; + if (Array.isArray(ser)) { + for (var j = 0; j < ser.length; j++) { + total += ser[j]; + } + } else { + // for pie/donuts/gauges + total += ser; + } + return total; + }); + } + }, { + key: "getSeriesTotalsXRange", + value: function getSeriesTotalsXRange(minX, maxX) { + var w = this.w; + var seriesTotalsXRange = w.globals.series.map(function (ser, index) { + var total = 0; + for (var j = 0; j < ser.length; j++) { + if (w.globals.seriesX[index][j] > minX && w.globals.seriesX[index][j] < maxX) { + total += ser[j]; + } + } + return total; + }); + return seriesTotalsXRange; + } + + /** + * @memberof CoreUtils + * returns the percentage value of all individual values which can be used in a 100% stacked series + * Eg. w.globals.series = [[32, 33, 43, 12], [2, 3, 5, 1]] + * @return [[94.11, 91.66, 89.58, 92.30], [5.88, 8.33, 10.41, 7.7]] + **/ + }, { + key: "getPercentSeries", + value: function getPercentSeries() { + var w = this.w; + w.globals.seriesPercent = w.globals.series.map(function (ser, index) { + var seriesPercent = []; + if (Array.isArray(ser)) { + for (var j = 0; j < ser.length; j++) { + var total = w.globals.stackedSeriesTotals[j]; + var percent = 0; + if (total) { + percent = 100 * ser[j] / total; + } + seriesPercent.push(percent); + } + } else { + var _total = w.globals.seriesTotals.reduce(function (acc, val) { + return acc + val; + }, 0); + var _percent = 100 * ser / _total; + seriesPercent.push(_percent); + } + return seriesPercent; + }); + } + }, { + key: "getCalculatedRatios", + value: function getCalculatedRatios() { + var _this2 = this; + var w = this.w; + var gl = w.globals; + var yRatio = []; + var invertedYRatio = 0; + var xRatio = 0; + var invertedXRatio = 0; + var zRatio = 0; + var baseLineY = []; + var baseLineInvertedY = 0.1; + var baseLineX = 0; + gl.yRange = []; + if (gl.isMultipleYAxis) { + for (var i = 0; i < gl.minYArr.length; i++) { + gl.yRange.push(Math.abs(gl.minYArr[i] - gl.maxYArr[i])); + baseLineY.push(0); + } + } else { + gl.yRange.push(Math.abs(gl.minY - gl.maxY)); + } + gl.xRange = Math.abs(gl.maxX - gl.minX); + gl.zRange = Math.abs(gl.maxZ - gl.minZ); + + // multiple y axis + for (var _i = 0; _i < gl.yRange.length; _i++) { + yRatio.push(gl.yRange[_i] / gl.gridHeight); + } + xRatio = gl.xRange / gl.gridWidth; + invertedYRatio = gl.yRange / gl.gridWidth; + invertedXRatio = gl.xRange / gl.gridHeight; + zRatio = gl.zRange / gl.gridHeight * 16; + if (!zRatio) { + zRatio = 1; + } + if (gl.minY !== Number.MIN_VALUE && Math.abs(gl.minY) !== 0) { + // Negative numbers present in series + gl.hasNegs = true; + } + + // Check we have a map as series may still to be added/updated. + if (w.globals.seriesYAxisReverseMap.length > 0) { + var scaleBaseLineYScale = function scaleBaseLineYScale(y, i) { + var yAxis = w.config.yaxis[w.globals.seriesYAxisReverseMap[i]]; + var sign = y < 0 ? -1 : 1; + y = Math.abs(y); + if (yAxis.logarithmic) { + y = _this2.getBaseLog(yAxis.logBase, y); + } + return -sign * y / yRatio[i]; + }; + if (gl.isMultipleYAxis) { + baseLineY = []; + // baseline variables is the 0 of the yaxis which will be needed when there are negatives + for (var _i2 = 0; _i2 < yRatio.length; _i2++) { + baseLineY.push(scaleBaseLineYScale(gl.minYArr[_i2], _i2)); + } + } else { + baseLineY = []; + baseLineY.push(scaleBaseLineYScale(gl.minY, 0)); + if (gl.minY !== Number.MIN_VALUE && Math.abs(gl.minY) !== 0) { + baseLineInvertedY = -gl.minY / invertedYRatio; // this is for bar chart + baseLineX = gl.minX / xRatio; + } + } + } else { + baseLineY = []; + baseLineY.push(0); + baseLineInvertedY = 0; + baseLineX = 0; + } + return { + yRatio: yRatio, + invertedYRatio: invertedYRatio, + zRatio: zRatio, + xRatio: xRatio, + invertedXRatio: invertedXRatio, + baseLineInvertedY: baseLineInvertedY, + baseLineY: baseLineY, + baseLineX: baseLineX + }; + } + }, { + key: "getLogSeries", + value: function getLogSeries(series) { + var _this3 = this; + var w = this.w; + w.globals.seriesLog = series.map(function (s, i) { + var yAxisIndex = w.globals.seriesYAxisReverseMap[i]; + if (w.config.yaxis[yAxisIndex] && w.config.yaxis[yAxisIndex].logarithmic) { + return s.map(function (d) { + if (d === null) return null; + return _this3.getLogVal(w.config.yaxis[yAxisIndex].logBase, d, i); + }); + } else { + return s; + } + }); + return w.globals.invalidLogScale ? series : w.globals.seriesLog; + } + }, { + key: "getLogValAtSeriesIndex", + value: function getLogValAtSeriesIndex(val, seriesIndex) { + if (val === null) return null; + var w = this.w; + var yAxisIndex = w.globals.seriesYAxisReverseMap[seriesIndex]; + if (w.config.yaxis[yAxisIndex] && w.config.yaxis[yAxisIndex].logarithmic) { + return this.getLogVal(w.config.yaxis[yAxisIndex].logBase, val, seriesIndex); + } + return val; + } + }, { + key: "getBaseLog", + value: function getBaseLog(base, value) { + return Math.log(value) / Math.log(base); + } + }, { + key: "getLogVal", + value: function getLogVal(b, d, seriesIndex) { + if (d <= 0) { + return 0; // Should be Number.NEGATIVE_INFINITY + } + var w = this.w; + var min_log_val = w.globals.minYArr[seriesIndex] === 0 ? -1 // make sure we dont calculate log of 0 + : this.getBaseLog(b, w.globals.minYArr[seriesIndex]); + var max_log_val = w.globals.maxYArr[seriesIndex] === 0 ? 0 // make sure we dont calculate log of 0 + : this.getBaseLog(b, w.globals.maxYArr[seriesIndex]); + var number_of_height_levels = max_log_val - min_log_val; + if (d < 1) return d / number_of_height_levels; + var log_height_value = this.getBaseLog(b, d) - min_log_val; + return log_height_value / number_of_height_levels; + } + }, { + key: "getLogYRatios", + value: function getLogYRatios(yRatio) { + var _this4 = this; + var w = this.w; + var gl = this.w.globals; + gl.yLogRatio = yRatio.slice(); + gl.logYRange = gl.yRange.map(function (_, i) { + var yAxisIndex = w.globals.seriesYAxisReverseMap[i]; + if (w.config.yaxis[yAxisIndex] && _this4.w.config.yaxis[yAxisIndex].logarithmic) { + var maxY = -Number.MAX_VALUE; + var minY = Number.MIN_VALUE; + var range = 1; + gl.seriesLog.forEach(function (s, si) { + s.forEach(function (v) { + if (w.config.yaxis[si] && w.config.yaxis[si].logarithmic) { + maxY = Math.max(v, maxY); + minY = Math.min(v, minY); + } + }); + }); + range = Math.pow(gl.yRange[i], Math.abs(minY - maxY) / gl.yRange[i]); + gl.yLogRatio[i] = range / gl.gridHeight; + return range; + } + }); + return gl.invalidLogScale ? yRatio.slice() : gl.yLogRatio; + } + + // Some config objects can be array - and we need to extend them correctly + }, { + key: "drawSeriesByGroup", + value: + // Series of the same group and type can be stacked together distinct from + // other series of the same type on the same axis. + function drawSeriesByGroup(typeSeries, typeGroups, type, chartClass) { + var w = this.w; + var graph = []; + if (typeSeries.series.length > 0) { + // draw each group separately + typeGroups.forEach(function (gn) { + var gs = []; + var gi = []; + typeSeries.i.forEach(function (i, ii) { + if (w.config.series[i].group === gn) { + gs.push(typeSeries.series[ii]); + gi.push(i); + } + }); + gs.length > 0 && graph.push(chartClass.draw(gs, type, gi)); + }); + } + return graph; + } + }], [{ + key: "checkComboSeries", + value: function checkComboSeries(series, chartType) { + var comboCharts = false; + var comboBarCount = 0; + var comboCount = 0; + if (chartType === undefined) { + chartType = 'line'; + } + + // Check if user specified a type in series that may make us a combo chart. + // The default type for chart is "line" and the default for series is the + // chart type, therefore, if the types of all series match the chart type, + // this should not be considered a combo chart. + if (series.length && typeof series[0].type !== 'undefined') { + series.forEach(function (s) { + if (s.type === 'bar' || s.type === 'column' || s.type === 'candlestick' || s.type === 'boxPlot') { + comboBarCount++; + } + if (typeof s.type !== 'undefined' && s.type !== chartType) { + comboCount++; + } + }); + } + if (comboCount > 0) { + comboCharts = true; + } + return { + comboBarCount: comboBarCount, + comboCharts: comboCharts + }; + } + }, { + key: "extendArrayProps", + value: function extendArrayProps(configInstance, options, w) { + var _options, _options2; + if ((_options = options) !== null && _options !== void 0 && _options.yaxis) { + options = configInstance.extendYAxis(options, w); + } + if ((_options2 = options) !== null && _options2 !== void 0 && _options2.annotations) { + var _options3, _options3$annotations, _options4, _options4$annotations; + if (options.annotations.yaxis) { + options = configInstance.extendYAxisAnnotations(options); + } + if ((_options3 = options) !== null && _options3 !== void 0 && (_options3$annotations = _options3.annotations) !== null && _options3$annotations !== void 0 && _options3$annotations.xaxis) { + options = configInstance.extendXAxisAnnotations(options); + } + if ((_options4 = options) !== null && _options4 !== void 0 && (_options4$annotations = _options4.annotations) !== null && _options4$annotations !== void 0 && _options4$annotations.points) { + options = configInstance.extendPointAnnotations(options); + } + } + return options; + } + }]); + return CoreUtils; + }(); + + var Helpers$4 = /*#__PURE__*/function () { + function Helpers(annoCtx) { + _classCallCheck(this, Helpers); + this.w = annoCtx.w; + this.annoCtx = annoCtx; + } + _createClass(Helpers, [{ + key: "setOrientations", + value: function setOrientations(anno) { + var annoIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + var w = this.w; + if (anno.label.orientation === 'vertical') { + var i = annoIndex !== null ? annoIndex : 0; + var xAnno = w.globals.dom.baseEl.querySelector(".apexcharts-xaxis-annotations .apexcharts-xaxis-annotation-label[rel='".concat(i, "']")); + if (xAnno !== null) { + var xAnnoCoord = xAnno.getBoundingClientRect(); + xAnno.setAttribute('x', parseFloat(xAnno.getAttribute('x')) - xAnnoCoord.height + 4); + var yOffset = anno.label.position === 'top' ? xAnnoCoord.width : -xAnnoCoord.width; + xAnno.setAttribute('y', parseFloat(xAnno.getAttribute('y')) + yOffset); + var _this$annoCtx$graphic = this.annoCtx.graphics.rotateAroundCenter(xAnno), + x = _this$annoCtx$graphic.x, + y = _this$annoCtx$graphic.y; + xAnno.setAttribute('transform', "rotate(-90 ".concat(x, " ").concat(y, ")")); + } + } + } + }, { + key: "addBackgroundToAnno", + value: function addBackgroundToAnno(annoEl, anno) { + var w = this.w; + if (!annoEl || !anno.label.text || !String(anno.label.text).trim()) { + return null; + } + var elGridRect = w.globals.dom.baseEl.querySelector('.apexcharts-grid').getBoundingClientRect(); + var coords = annoEl.getBoundingClientRect(); + var _anno$label$style$pad = anno.label.style.padding, + pleft = _anno$label$style$pad.left, + pright = _anno$label$style$pad.right, + ptop = _anno$label$style$pad.top, + pbottom = _anno$label$style$pad.bottom; + if (anno.label.orientation === 'vertical') { + var _ref = [pleft, pright, ptop, pbottom]; + ptop = _ref[0]; + pbottom = _ref[1]; + pleft = _ref[2]; + pright = _ref[3]; + } + var x1 = coords.left - elGridRect.left - pleft; + var y1 = coords.top - elGridRect.top - ptop; + var elRect = this.annoCtx.graphics.drawRect(x1 - w.globals.barPadForNumericAxis, y1, coords.width + pleft + pright, coords.height + ptop + pbottom, anno.label.borderRadius, anno.label.style.background, 1, anno.label.borderWidth, anno.label.borderColor, 0); + if (anno.id) { + elRect.node.classList.add(anno.id); + } + return elRect; + } + }, { + key: "annotationsBackground", + value: function annotationsBackground() { + var _this = this; + var w = this.w; + var add = function add(anno, i, type) { + var annoLabel = w.globals.dom.baseEl.querySelector(".apexcharts-".concat(type, "-annotations .apexcharts-").concat(type, "-annotation-label[rel='").concat(i, "']")); + if (annoLabel) { + var parent = annoLabel.parentNode; + var elRect = _this.addBackgroundToAnno(annoLabel, anno); + if (elRect) { + parent.insertBefore(elRect.node, annoLabel); + if (anno.label.mouseEnter) { + elRect.node.addEventListener('mouseenter', anno.label.mouseEnter.bind(_this, anno)); + } + if (anno.label.mouseLeave) { + elRect.node.addEventListener('mouseleave', anno.label.mouseLeave.bind(_this, anno)); + } + if (anno.label.click) { + elRect.node.addEventListener('click', anno.label.click.bind(_this, anno)); + } + } + } + }; + w.config.annotations.xaxis.forEach(function (anno, i) { + return add(anno, i, 'xaxis'); + }); + w.config.annotations.yaxis.forEach(function (anno, i) { + return add(anno, i, 'yaxis'); + }); + w.config.annotations.points.forEach(function (anno, i) { + return add(anno, i, 'point'); + }); + } + }, { + key: "getY1Y2", + value: function getY1Y2(type, anno) { + var w = this.w; + var y = type === 'y1' ? anno.y : anno.y2; + var yP; + var clipped = false; + if (this.annoCtx.invertAxis) { + var labels = w.config.xaxis.convertedCatToNumeric ? w.globals.categoryLabels : w.globals.labels; + var catIndex = labels.indexOf(y); + var xLabel = w.globals.dom.baseEl.querySelector(".apexcharts-yaxis-texts-g text:nth-child(".concat(catIndex + 1, ")")); + yP = xLabel ? parseFloat(xLabel.getAttribute('y')) : (w.globals.gridHeight / labels.length - 1) * (catIndex + 1) - w.globals.barHeight; + if (anno.seriesIndex !== undefined && w.globals.barHeight) { + yP -= w.globals.barHeight / 2 * (w.globals.series.length - 1) - w.globals.barHeight * anno.seriesIndex; + } + } else { + var _w$config$yaxis$anno$; + var seriesIndex = w.globals.seriesYAxisMap[anno.yAxisIndex][0]; + var yPos = w.config.yaxis[anno.yAxisIndex].logarithmic ? new CoreUtils(this.annoCtx.ctx).getLogVal(w.config.yaxis[anno.yAxisIndex].logBase, y, seriesIndex) / w.globals.yLogRatio[seriesIndex] : (y - w.globals.minYArr[seriesIndex]) / (w.globals.yRange[seriesIndex] / w.globals.gridHeight); + yP = w.globals.gridHeight - Math.min(Math.max(yPos, 0), w.globals.gridHeight); + clipped = yPos > w.globals.gridHeight || yPos < 0; + if (anno.marker && (anno.y === undefined || anno.y === null)) { + yP = 0; + } + if ((_w$config$yaxis$anno$ = w.config.yaxis[anno.yAxisIndex]) !== null && _w$config$yaxis$anno$ !== void 0 && _w$config$yaxis$anno$.reversed) { + yP = yPos; + } + } + if (typeof y === 'string' && y.includes('px')) { + yP = parseFloat(y); + } + return { + yP: yP, + clipped: clipped + }; + } + }, { + key: "getX1X2", + value: function getX1X2(type, anno) { + var w = this.w; + var x = type === 'x1' ? anno.x : anno.x2; + var min = this.annoCtx.invertAxis ? w.globals.minY : w.globals.minX; + var max = this.annoCtx.invertAxis ? w.globals.maxY : w.globals.maxX; + var range = this.annoCtx.invertAxis ? w.globals.yRange[0] : w.globals.xRange; + var clipped = false; + var xP = this.annoCtx.inversedReversedAxis ? (max - x) / (range / w.globals.gridWidth) : (x - min) / (range / w.globals.gridWidth); + if ((w.config.xaxis.type === 'category' || w.config.xaxis.convertedCatToNumeric) && !this.annoCtx.invertAxis && !w.globals.dataFormatXNumeric) { + if (!w.config.chart.sparkline.enabled) { + xP = this.getStringX(x); + } + } + if (typeof x === 'string' && x.includes('px')) { + xP = parseFloat(x); + } + if ((x === undefined || x === null) && anno.marker) { + xP = w.globals.gridWidth; + } + if (anno.seriesIndex !== undefined && w.globals.barWidth && !this.annoCtx.invertAxis) { + xP -= w.globals.barWidth / 2 * (w.globals.series.length - 1) - w.globals.barWidth * anno.seriesIndex; + } + if (xP > w.globals.gridWidth) { + xP = w.globals.gridWidth; + clipped = true; + } else if (xP < 0) { + xP = 0; + clipped = true; + } + return { + x: xP, + clipped: clipped + }; + } + }, { + key: "getStringX", + value: function getStringX(x) { + var w = this.w; + var rX = x; + if (w.config.xaxis.convertedCatToNumeric && w.globals.categoryLabels.length) { + x = w.globals.categoryLabels.indexOf(x) + 1; + } + var catIndex = w.globals.labels.map(function (item) { + return Array.isArray(item) ? item.join(' ') : item; + }).indexOf(x); + var xLabel = w.globals.dom.baseEl.querySelector(".apexcharts-xaxis-texts-g text:nth-child(".concat(catIndex + 1, ")")); + if (xLabel) { + rX = parseFloat(xLabel.getAttribute('x')); + } + return rX; + } + }]); + return Helpers; + }(); + + var XAnnotations = /*#__PURE__*/function () { + function XAnnotations(annoCtx) { + _classCallCheck(this, XAnnotations); + this.w = annoCtx.w; + this.annoCtx = annoCtx; + this.invertAxis = this.annoCtx.invertAxis; + this.helpers = new Helpers$4(this.annoCtx); + } + _createClass(XAnnotations, [{ + key: "addXaxisAnnotation", + value: function addXaxisAnnotation(anno, parent, index) { + var w = this.w; + var result = this.helpers.getX1X2('x1', anno); + var x1 = result.x; + var clipX1 = result.clipped; + var clipX2 = true; + var x2; + var text = anno.label.text; + var strokeDashArray = anno.strokeDashArray; + if (!Utils$1.isNumber(x1)) return; + if (anno.x2 === null || typeof anno.x2 === 'undefined') { + if (!clipX1) { + var line = this.annoCtx.graphics.drawLine(x1 + anno.offsetX, + // x1 + 0 + anno.offsetY, + // y1 + x1 + anno.offsetX, + // x2 + w.globals.gridHeight + anno.offsetY, + // y2 + anno.borderColor, + // lineColor + strokeDashArray, + //dashArray + anno.borderWidth); + parent.appendChild(line.node); + if (anno.id) { + line.node.classList.add(anno.id); + } + } + } else { + var _result = this.helpers.getX1X2('x2', anno); + x2 = _result.x; + clipX2 = _result.clipped; + if (x2 < x1) { + var temp = x1; + x1 = x2; + x2 = temp; + } + var rect = this.annoCtx.graphics.drawRect(x1 + anno.offsetX, + // x1 + 0 + anno.offsetY, + // y1 + x2 - x1, + // x2 + w.globals.gridHeight + anno.offsetY, + // y2 + 0, + // radius + anno.fillColor, + // color + anno.opacity, + // opacity, + 1, + // strokeWidth + anno.borderColor, + // strokeColor + strokeDashArray // stokeDashArray + ); + rect.node.classList.add('apexcharts-annotation-rect'); + rect.attr('clip-path', "url(#gridRectMask".concat(w.globals.cuid, ")")); + parent.appendChild(rect.node); + if (anno.id) { + rect.node.classList.add(anno.id); + } + } + if (!(clipX1 && clipX2)) { + var textRects = this.annoCtx.graphics.getTextRects(text, parseFloat(anno.label.style.fontSize)); + var textY = anno.label.position === 'top' ? 4 : anno.label.position === 'center' ? w.globals.gridHeight / 2 + (anno.label.orientation === 'vertical' ? textRects.width / 2 : 0) : w.globals.gridHeight; + var elText = this.annoCtx.graphics.drawText({ + x: x1 + anno.label.offsetX, + y: textY + anno.label.offsetY - (anno.label.orientation === 'vertical' ? anno.label.position === 'top' ? textRects.width / 2 - 12 : -textRects.width / 2 : 0), + text: text, + textAnchor: anno.label.textAnchor, + fontSize: anno.label.style.fontSize, + fontFamily: anno.label.style.fontFamily, + fontWeight: anno.label.style.fontWeight, + foreColor: anno.label.style.color, + cssClass: "apexcharts-xaxis-annotation-label ".concat(anno.label.style.cssClass, " ").concat(anno.id ? anno.id : '') + }); + elText.attr({ + rel: index + }); + parent.appendChild(elText.node); + + // after placing the annotations on svg, set any vertically placed annotations + this.annoCtx.helpers.setOrientations(anno, index); + } + } + }, { + key: "drawXAxisAnnotations", + value: function drawXAxisAnnotations() { + var _this = this; + var w = this.w; + var elg = this.annoCtx.graphics.group({ + class: 'apexcharts-xaxis-annotations' + }); + w.config.annotations.xaxis.map(function (anno, index) { + _this.addXaxisAnnotation(anno, elg.node, index); + }); + return elg; + } + }]); + return XAnnotations; + }(); + + /** + * DateTime Class to manipulate datetime values. + * + * @module DateTime + **/ + var DateTime = /*#__PURE__*/function () { + function DateTime(ctx) { + _classCallCheck(this, DateTime); + this.ctx = ctx; + this.w = ctx.w; + this.months31 = [1, 3, 5, 7, 8, 10, 12]; + this.months30 = [2, 4, 6, 9, 11]; + this.daysCntOfYear = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]; + } + _createClass(DateTime, [{ + key: "isValidDate", + value: function isValidDate(date) { + if (typeof date === 'number') { + return false; // don't test for timestamps + } + return !isNaN(this.parseDate(date)); + } + }, { + key: "getTimeStamp", + value: function getTimeStamp(dateStr) { + if (!Date.parse(dateStr)) { + return dateStr; + } + var utc = this.w.config.xaxis.labels.datetimeUTC; + return !utc ? new Date(dateStr).getTime() : new Date(new Date(dateStr).toISOString().substr(0, 25)).getTime(); + } + }, { + key: "getDate", + value: function getDate(timestamp) { + var utc = this.w.config.xaxis.labels.datetimeUTC; + return utc ? new Date(new Date(timestamp).toUTCString()) : new Date(timestamp); + } + }, { + key: "parseDate", + value: function parseDate(dateStr) { + var parsed = Date.parse(dateStr); + if (!isNaN(parsed)) { + return this.getTimeStamp(dateStr); + } + var output = Date.parse(dateStr.replace(/-/g, '/').replace(/[a-z]+/gi, ' ')); + output = this.getTimeStamp(output); + return output; + } + + // This fixes the difference of x-axis labels between chrome/safari + // Fixes #1726, #1544, #1485, #1255 + }, { + key: "parseDateWithTimezone", + value: function parseDateWithTimezone(dateStr) { + return Date.parse(dateStr.replace(/-/g, '/').replace(/[a-z]+/gi, ' ')); + } + + // http://stackoverflow.com/questions/14638018/current-time-formatting-with-javascript#answer-14638191 + }, { + key: "formatDate", + value: function formatDate(date, format) { + var locale = this.w.globals.locale; + var utc = this.w.config.xaxis.labels.datetimeUTC; + var MMMM = ['\x00'].concat(_toConsumableArray(locale.months)); + var MMM = ['\x01'].concat(_toConsumableArray(locale.shortMonths)); + var dddd = ['\x02'].concat(_toConsumableArray(locale.days)); + var ddd = ['\x03'].concat(_toConsumableArray(locale.shortDays)); + function ii(i, len) { + var s = i + ''; + len = len || 2; + while (s.length < len) { + s = '0' + s; + } + return s; + } + var y = utc ? date.getUTCFullYear() : date.getFullYear(); + format = format.replace(/(^|[^\\])yyyy+/g, '$1' + y); + format = format.replace(/(^|[^\\])yy/g, '$1' + y.toString().substr(2, 2)); + format = format.replace(/(^|[^\\])y/g, '$1' + y); + var M = (utc ? date.getUTCMonth() : date.getMonth()) + 1; + format = format.replace(/(^|[^\\])MMMM+/g, '$1' + MMMM[0]); + format = format.replace(/(^|[^\\])MMM/g, '$1' + MMM[0]); + format = format.replace(/(^|[^\\])MM/g, '$1' + ii(M)); + format = format.replace(/(^|[^\\])M/g, '$1' + M); + var d = utc ? date.getUTCDate() : date.getDate(); + format = format.replace(/(^|[^\\])dddd+/g, '$1' + dddd[0]); + format = format.replace(/(^|[^\\])ddd/g, '$1' + ddd[0]); + format = format.replace(/(^|[^\\])dd/g, '$1' + ii(d)); + format = format.replace(/(^|[^\\])d/g, '$1' + d); + var H = utc ? date.getUTCHours() : date.getHours(); + format = format.replace(/(^|[^\\])HH+/g, '$1' + ii(H)); + format = format.replace(/(^|[^\\])H/g, '$1' + H); + var h = H > 12 ? H - 12 : H === 0 ? 12 : H; + format = format.replace(/(^|[^\\])hh+/g, '$1' + ii(h)); + format = format.replace(/(^|[^\\])h/g, '$1' + h); + var m = utc ? date.getUTCMinutes() : date.getMinutes(); + format = format.replace(/(^|[^\\])mm+/g, '$1' + ii(m)); + format = format.replace(/(^|[^\\])m/g, '$1' + m); + var s = utc ? date.getUTCSeconds() : date.getSeconds(); + format = format.replace(/(^|[^\\])ss+/g, '$1' + ii(s)); + format = format.replace(/(^|[^\\])s/g, '$1' + s); + var f = utc ? date.getUTCMilliseconds() : date.getMilliseconds(); + format = format.replace(/(^|[^\\])fff+/g, '$1' + ii(f, 3)); + f = Math.round(f / 10); + format = format.replace(/(^|[^\\])ff/g, '$1' + ii(f)); + f = Math.round(f / 10); + format = format.replace(/(^|[^\\])f/g, '$1' + f); + var T = H < 12 ? 'AM' : 'PM'; + format = format.replace(/(^|[^\\])TT+/g, '$1' + T); + format = format.replace(/(^|[^\\])T/g, '$1' + T.charAt(0)); + var t = T.toLowerCase(); + format = format.replace(/(^|[^\\])tt+/g, '$1' + t); + format = format.replace(/(^|[^\\])t/g, '$1' + t.charAt(0)); + var tz = -date.getTimezoneOffset(); + var K = utc || !tz ? 'Z' : tz > 0 ? '+' : '-'; + if (!utc) { + tz = Math.abs(tz); + var tzHrs = Math.floor(tz / 60); + var tzMin = tz % 60; + K += ii(tzHrs) + ':' + ii(tzMin); + } + format = format.replace(/(^|[^\\])K/g, '$1' + K); + var day = (utc ? date.getUTCDay() : date.getDay()) + 1; + format = format.replace(new RegExp(dddd[0], 'g'), dddd[day]); + format = format.replace(new RegExp(ddd[0], 'g'), ddd[day]); + format = format.replace(new RegExp(MMMM[0], 'g'), MMMM[M]); + format = format.replace(new RegExp(MMM[0], 'g'), MMM[M]); + format = format.replace(/\\(.)/g, '$1'); + return format; + } + }, { + key: "getTimeUnitsfromTimestamp", + value: function getTimeUnitsfromTimestamp(minX, maxX, utc) { + var w = this.w; + if (w.config.xaxis.min !== undefined) { + minX = w.config.xaxis.min; + } + if (w.config.xaxis.max !== undefined) { + maxX = w.config.xaxis.max; + } + var tsMin = this.getDate(minX); + var tsMax = this.getDate(maxX); + var minD = this.formatDate(tsMin, 'yyyy MM dd HH mm ss fff').split(' '); + var maxD = this.formatDate(tsMax, 'yyyy MM dd HH mm ss fff').split(' '); + return { + minMillisecond: parseInt(minD[6], 10), + maxMillisecond: parseInt(maxD[6], 10), + minSecond: parseInt(minD[5], 10), + maxSecond: parseInt(maxD[5], 10), + minMinute: parseInt(minD[4], 10), + maxMinute: parseInt(maxD[4], 10), + minHour: parseInt(minD[3], 10), + maxHour: parseInt(maxD[3], 10), + minDate: parseInt(minD[2], 10), + maxDate: parseInt(maxD[2], 10), + minMonth: parseInt(minD[1], 10) - 1, + maxMonth: parseInt(maxD[1], 10) - 1, + minYear: parseInt(minD[0], 10), + maxYear: parseInt(maxD[0], 10) + }; + } + }, { + key: "isLeapYear", + value: function isLeapYear(year) { + return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0; + } + }, { + key: "calculcateLastDaysOfMonth", + value: function calculcateLastDaysOfMonth(month, year, subtract) { + var days = this.determineDaysOfMonths(month, year); + + // whatever days we get, subtract the number of days asked + return days - subtract; + } + }, { + key: "determineDaysOfYear", + value: function determineDaysOfYear(year) { + var days = 365; + if (this.isLeapYear(year)) { + days = 366; + } + return days; + } + }, { + key: "determineRemainingDaysOfYear", + value: function determineRemainingDaysOfYear(year, month, date) { + var dayOfYear = this.daysCntOfYear[month] + date; + if (month > 1 && this.isLeapYear()) dayOfYear++; + return dayOfYear; + } + }, { + key: "determineDaysOfMonths", + value: function determineDaysOfMonths(month, year) { + var days = 30; + month = Utils$1.monthMod(month); + switch (true) { + case this.months30.indexOf(month) > -1: + if (month === 2) { + if (this.isLeapYear(year)) { + days = 29; + } else { + days = 28; + } + } + break; + case this.months31.indexOf(month) > -1: + days = 31; + break; + default: + days = 31; + break; + } + return days; + } + }]); + return DateTime; + }(); + + /** + * ApexCharts Formatter Class for setting value formatters for axes as well as tooltips. + * + * @module Formatters + **/ + var Formatters = /*#__PURE__*/function () { + function Formatters(ctx) { + _classCallCheck(this, Formatters); + this.ctx = ctx; + this.w = ctx.w; + this.tooltipKeyFormat = 'dd MMM'; + } + _createClass(Formatters, [{ + key: "xLabelFormat", + value: function xLabelFormat(fn, val, timestamp, opts) { + var w = this.w; + if (w.config.xaxis.type === 'datetime') { + if (w.config.xaxis.labels.formatter === undefined) { + // if user has not specified a custom formatter, use the default tooltip.x.format + if (w.config.tooltip.x.formatter === undefined) { + var datetimeObj = new DateTime(this.ctx); + return datetimeObj.formatDate(datetimeObj.getDate(val), w.config.tooltip.x.format); + } + } + } + return fn(val, timestamp, opts); + } + }, { + key: "defaultGeneralFormatter", + value: function defaultGeneralFormatter(val) { + if (Array.isArray(val)) { + return val.map(function (v) { + return v; + }); + } else { + return val; + } + } + }, { + key: "defaultYFormatter", + value: function defaultYFormatter(v, yaxe, i) { + var w = this.w; + if (Utils$1.isNumber(v)) { + if (w.globals.yValueDecimal !== 0) { + v = v.toFixed(yaxe.decimalsInFloat !== undefined ? yaxe.decimalsInFloat : w.globals.yValueDecimal); + } else { + // We have an integer value but the label is not an integer. We can + // deduce this is due to the number of ticks exceeding the even lower + // integer range. Add an additional decimal place only in this case. + var f = v.toFixed(0); + // Do not change the == to === + v = v == f ? f : v.toFixed(1); + } + } + return v; + } + }, { + key: "setLabelFormatters", + value: function setLabelFormatters() { + var _this = this; + var w = this.w; + w.globals.xaxisTooltipFormatter = function (val) { + return _this.defaultGeneralFormatter(val); + }; + w.globals.ttKeyFormatter = function (val) { + return _this.defaultGeneralFormatter(val); + }; + w.globals.ttZFormatter = function (val) { + return val; + }; + w.globals.legendFormatter = function (val) { + return _this.defaultGeneralFormatter(val); + }; + + // formatter function will always overwrite format property + if (w.config.xaxis.labels.formatter !== undefined) { + w.globals.xLabelFormatter = w.config.xaxis.labels.formatter; + } else { + w.globals.xLabelFormatter = function (val) { + if (Utils$1.isNumber(val)) { + if (!w.config.xaxis.convertedCatToNumeric && w.config.xaxis.type === 'numeric') { + if (Utils$1.isNumber(w.config.xaxis.decimalsInFloat)) { + return val.toFixed(w.config.xaxis.decimalsInFloat); + } else { + var diff = w.globals.maxX - w.globals.minX; + if (diff > 0 && diff < 100) { + return val.toFixed(1); + } + return val.toFixed(0); + } + } + if (w.globals.isBarHorizontal) { + var range = w.globals.maxY - w.globals.minYArr; + if (range < 4) { + return val.toFixed(1); + } + } + return val.toFixed(0); + } + return val; + }; + } + if (typeof w.config.tooltip.x.formatter === 'function') { + w.globals.ttKeyFormatter = w.config.tooltip.x.formatter; + } else { + w.globals.ttKeyFormatter = w.globals.xLabelFormatter; + } + if (typeof w.config.xaxis.tooltip.formatter === 'function') { + w.globals.xaxisTooltipFormatter = w.config.xaxis.tooltip.formatter; + } + if (Array.isArray(w.config.tooltip.y)) { + w.globals.ttVal = w.config.tooltip.y; + } else { + if (w.config.tooltip.y.formatter !== undefined) { + w.globals.ttVal = w.config.tooltip.y; + } + } + if (w.config.tooltip.z.formatter !== undefined) { + w.globals.ttZFormatter = w.config.tooltip.z.formatter; + } + + // legend formatter - if user wants to append any global values of series to legend text + if (w.config.legend.formatter !== undefined) { + w.globals.legendFormatter = w.config.legend.formatter; + } + + // formatter function will always overwrite format property + w.config.yaxis.forEach(function (yaxe, i) { + if (yaxe.labels.formatter !== undefined) { + w.globals.yLabelFormatters[i] = yaxe.labels.formatter; + } else { + w.globals.yLabelFormatters[i] = function (val) { + if (!w.globals.xyCharts) return val; + if (Array.isArray(val)) { + return val.map(function (v) { + return _this.defaultYFormatter(v, yaxe, i); + }); + } else { + return _this.defaultYFormatter(val, yaxe, i); + } + }; + } + }); + return w.globals; + } + }, { + key: "heatmapLabelFormatters", + value: function heatmapLabelFormatters() { + var w = this.w; + if (w.config.chart.type === 'heatmap') { + w.globals.yAxisScale[0].result = w.globals.seriesNames.slice(); + + // get the longest string from the labels array and also apply label formatter to it + var longest = w.globals.seriesNames.reduce(function (a, b) { + return a.length > b.length ? a : b; + }, 0); + w.globals.yAxisScale[0].niceMax = longest; + w.globals.yAxisScale[0].niceMin = longest; + } + } + }]); + return Formatters; + }(); + + var AxesUtils = /*#__PURE__*/function () { + function AxesUtils(ctx) { + _classCallCheck(this, AxesUtils); + this.ctx = ctx; + this.w = ctx.w; + } + + // Based on the formatter function, get the label text and position + _createClass(AxesUtils, [{ + key: "getLabel", + value: function getLabel(labels, timescaleLabels, x, i) { + var drawnLabels = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : []; + var fontSize = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : '12px'; + var isLeafGroup = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : true; + var w = this.w; + var rawLabel = typeof labels[i] === 'undefined' ? '' : labels[i]; + var label = rawLabel; + var xlbFormatter = w.globals.xLabelFormatter; + var customFormatter = w.config.xaxis.labels.formatter; + var isBold = false; + var xFormat = new Formatters(this.ctx); + var timestamp = rawLabel; + if (isLeafGroup) { + label = xFormat.xLabelFormat(xlbFormatter, rawLabel, timestamp, { + i: i, + dateFormatter: new DateTime(this.ctx).formatDate, + w: w + }); + if (customFormatter !== undefined) { + label = customFormatter(rawLabel, labels[i], { + i: i, + dateFormatter: new DateTime(this.ctx).formatDate, + w: w + }); + } + } + var determineHighestUnit = function determineHighestUnit(unit) { + var highestUnit = null; + timescaleLabels.forEach(function (t) { + if (t.unit === 'month') { + highestUnit = 'year'; + } else if (t.unit === 'day') { + highestUnit = 'month'; + } else if (t.unit === 'hour') { + highestUnit = 'day'; + } else if (t.unit === 'minute') { + highestUnit = 'hour'; + } + }); + return highestUnit === unit; + }; + if (timescaleLabels.length > 0) { + isBold = determineHighestUnit(timescaleLabels[i].unit); + x = timescaleLabels[i].position; + label = timescaleLabels[i].value; + } else { + if (w.config.xaxis.type === 'datetime' && customFormatter === undefined) { + label = ''; + } + } + if (typeof label === 'undefined') label = ''; + label = Array.isArray(label) ? label : label.toString(); + var graphics = new Graphics(this.ctx); + var textRect = {}; + if (w.globals.rotateXLabels && isLeafGroup) { + textRect = graphics.getTextRects(label, parseInt(fontSize, 10), null, "rotate(".concat(w.config.xaxis.labels.rotate, " 0 0)"), false); + } else { + textRect = graphics.getTextRects(label, parseInt(fontSize, 10)); + } + var allowDuplicatesInTimeScale = !w.config.xaxis.labels.showDuplicates && this.ctx.timeScale; + if (!Array.isArray(label) && (String(label) === 'NaN' || drawnLabels.indexOf(label) >= 0 && allowDuplicatesInTimeScale)) { + label = ''; + } + return { + x: x, + text: label, + textRect: textRect, + isBold: isBold + }; + } + }, { + key: "checkLabelBasedOnTickamount", + value: function checkLabelBasedOnTickamount(i, label, labelsLen) { + var w = this.w; + var ticks = w.config.xaxis.tickAmount; + if (ticks === 'dataPoints') ticks = Math.round(w.globals.gridWidth / 120); + if (ticks > labelsLen) return label; + var tickMultiple = Math.round(labelsLen / (ticks + 1)); + if (i % tickMultiple === 0) { + return label; + } else { + label.text = ''; + } + return label; + } + }, { + key: "checkForOverflowingLabels", + value: function checkForOverflowingLabels(i, label, labelsLen, drawnLabels, drawnLabelsRects) { + var w = this.w; + if (i === 0) { + // check if first label is being truncated + if (w.globals.skipFirstTimelinelabel) { + label.text = ''; + } + } + if (i === labelsLen - 1) { + // check if last label is being truncated + if (w.globals.skipLastTimelinelabel) { + label.text = ''; + } + } + if (w.config.xaxis.labels.hideOverlappingLabels && drawnLabels.length > 0) { + var prev = drawnLabelsRects[drawnLabelsRects.length - 1]; + if (label.x < prev.textRect.width / (w.globals.rotateXLabels ? Math.abs(w.config.xaxis.labels.rotate) / 12 : 1.01) + prev.x) { + label.text = ''; + } + } + return label; + } + }, { + key: "checkForReversedLabels", + value: function checkForReversedLabels(i, labels) { + var w = this.w; + if (w.config.yaxis[i] && w.config.yaxis[i].reversed) { + labels.reverse(); + } + return labels; + } + }, { + key: "yAxisAllSeriesCollapsed", + value: function yAxisAllSeriesCollapsed(index) { + var gl = this.w.globals; + return !gl.seriesYAxisMap[index].some(function (si) { + return gl.collapsedSeriesIndices.indexOf(si) === -1; + }); + } + + // Method to translate annotation.yAxisIndex values from + // seriesName-as-a-string values to seriesName-as-an-array values (old style + // series mapping to new style). + }, { + key: "translateYAxisIndex", + value: function translateYAxisIndex(index) { + var w = this.w; + var gl = w.globals; + var yaxis = w.config.yaxis; + var newStyle = gl.series.length > yaxis.length || yaxis.some(function (a) { + return Array.isArray(a.seriesName); + }); + if (newStyle) { + return index; + } else { + return gl.seriesYAxisReverseMap[index]; + } + } + }, { + key: "isYAxisHidden", + value: function isYAxisHidden(index) { + var w = this.w; + var yaxis = w.config.yaxis[index]; + if (!yaxis.show || this.yAxisAllSeriesCollapsed(index)) { + return true; + } + if (!yaxis.showForNullSeries) { + var seriesIndices = w.globals.seriesYAxisMap[index]; + var coreUtils = new CoreUtils(this.ctx); + return seriesIndices.every(function (si) { + return coreUtils.isSeriesNull(si); + }); + } + return false; + } + + // get the label color for y-axis + // realIndex is the actual series index, while i is the tick Index + }, { + key: "getYAxisForeColor", + value: function getYAxisForeColor(yColors, realIndex) { + var w = this.w; + if (Array.isArray(yColors) && w.globals.yAxisScale[realIndex]) { + this.ctx.theme.pushExtraColors(yColors, w.globals.yAxisScale[realIndex].result.length, false); + } + return yColors; + } + }, { + key: "drawYAxisTicks", + value: function drawYAxisTicks(x, tickAmount, axisBorder, axisTicks, realIndex, labelsDivider, elYaxis) { + var w = this.w; + var graphics = new Graphics(this.ctx); + + // initial label position = 0; + var tY = w.globals.translateY + w.config.yaxis[realIndex].labels.offsetY; + if (w.globals.isBarHorizontal) { + tY = 0; + } else if (w.config.chart.type === 'heatmap') { + tY += labelsDivider / 2; + } + if (axisTicks.show && tickAmount > 0) { + if (w.config.yaxis[realIndex].opposite === true) x = x + axisTicks.width; + for (var i = tickAmount; i >= 0; i--) { + var elTick = graphics.drawLine(x + axisBorder.offsetX - axisTicks.width + axisTicks.offsetX, tY + axisTicks.offsetY, x + axisBorder.offsetX + axisTicks.offsetX, tY + axisTicks.offsetY, axisTicks.color); + elYaxis.add(elTick); + tY += labelsDivider; + } + } + } + }]); + return AxesUtils; + }(); + + var YAnnotations = /*#__PURE__*/function () { + function YAnnotations(annoCtx) { + _classCallCheck(this, YAnnotations); + this.w = annoCtx.w; + this.annoCtx = annoCtx; + this.helpers = new Helpers$4(this.annoCtx); + this.axesUtils = new AxesUtils(this.annoCtx); + } + _createClass(YAnnotations, [{ + key: "addYaxisAnnotation", + value: function addYaxisAnnotation(anno, parent, index) { + var w = this.w; + var strokeDashArray = anno.strokeDashArray; + var result = this.helpers.getY1Y2('y1', anno); + var y1 = result.yP; + var clipY1 = result.clipped; + var y2; + var clipY2 = true; + var drawn = false; + var text = anno.label.text; + if (anno.y2 === null || typeof anno.y2 === 'undefined') { + if (!clipY1) { + drawn = true; + var line = this.annoCtx.graphics.drawLine(0 + anno.offsetX, + // x1 + y1 + anno.offsetY, + // y1 + this._getYAxisAnnotationWidth(anno), + // x2 + y1 + anno.offsetY, + // y2 + anno.borderColor, + // lineColor + strokeDashArray, + // dashArray + anno.borderWidth); + parent.appendChild(line.node); + if (anno.id) { + line.node.classList.add(anno.id); + } + } + } else { + result = this.helpers.getY1Y2('y2', anno); + y2 = result.yP; + clipY2 = result.clipped; + if (y2 > y1) { + var temp = y1; + y1 = y2; + y2 = temp; + } + if (!(clipY1 && clipY2)) { + drawn = true; + var rect = this.annoCtx.graphics.drawRect(0 + anno.offsetX, + // x1 + y2 + anno.offsetY, + // y1 + this._getYAxisAnnotationWidth(anno), + // x2 + y1 - y2, + // y2 + 0, + // radius + anno.fillColor, + // color + anno.opacity, + // opacity, + 1, + // strokeWidth + anno.borderColor, + // strokeColor + strokeDashArray // stokeDashArray + ); + rect.node.classList.add('apexcharts-annotation-rect'); + rect.attr('clip-path', "url(#gridRectMask".concat(w.globals.cuid, ")")); + parent.appendChild(rect.node); + if (anno.id) { + rect.node.classList.add(anno.id); + } + } + } + if (drawn) { + var textX = anno.label.position === 'right' ? w.globals.gridWidth : anno.label.position === 'center' ? w.globals.gridWidth / 2 : 0; + var elText = this.annoCtx.graphics.drawText({ + x: textX + anno.label.offsetX, + y: (y2 != null ? y2 : y1) + anno.label.offsetY - 3, + text: text, + textAnchor: anno.label.textAnchor, + fontSize: anno.label.style.fontSize, + fontFamily: anno.label.style.fontFamily, + fontWeight: anno.label.style.fontWeight, + foreColor: anno.label.style.color, + cssClass: "apexcharts-yaxis-annotation-label ".concat(anno.label.style.cssClass, " ").concat(anno.id ? anno.id : '') + }); + elText.attr({ + rel: index + }); + parent.appendChild(elText.node); + } + } + }, { + key: "_getYAxisAnnotationWidth", + value: function _getYAxisAnnotationWidth(anno) { + // issue apexcharts.js#2009 + var w = this.w; + var width = w.globals.gridWidth; + if (anno.width.indexOf('%') > -1) { + width = w.globals.gridWidth * parseInt(anno.width, 10) / 100; + } else { + width = parseInt(anno.width, 10); + } + return width + anno.offsetX; + } + }, { + key: "drawYAxisAnnotations", + value: function drawYAxisAnnotations() { + var _this = this; + var w = this.w; + var elg = this.annoCtx.graphics.group({ + class: 'apexcharts-yaxis-annotations' + }); + w.config.annotations.yaxis.forEach(function (anno, index) { + anno.yAxisIndex = _this.axesUtils.translateYAxisIndex(anno.yAxisIndex); + if (!(_this.axesUtils.isYAxisHidden(anno.yAxisIndex) && _this.axesUtils.yAxisAllSeriesCollapsed(anno.yAxisIndex))) { + _this.addYaxisAnnotation(anno, elg.node, index); + } + }); + return elg; + } + }]); + return YAnnotations; + }(); + + var PointAnnotations = /*#__PURE__*/function () { + function PointAnnotations(annoCtx) { + _classCallCheck(this, PointAnnotations); + this.w = annoCtx.w; + this.annoCtx = annoCtx; + this.helpers = new Helpers$4(this.annoCtx); + } + _createClass(PointAnnotations, [{ + key: "addPointAnnotation", + value: function addPointAnnotation(anno, parent, index) { + var w = this.w; + if (w.globals.collapsedSeriesIndices.indexOf(anno.seriesIndex) > -1) { + return; + } + var result = this.helpers.getX1X2('x1', anno); + var x = result.x; + var clipX = result.clipped; + result = this.helpers.getY1Y2('y1', anno); + var y = result.yP; + var clipY = result.clipped; + if (!Utils$1.isNumber(x)) return; + if (!(clipY || clipX)) { + var optsPoints = { + pSize: anno.marker.size, + pointStrokeWidth: anno.marker.strokeWidth, + pointFillColor: anno.marker.fillColor, + pointStrokeColor: anno.marker.strokeColor, + shape: anno.marker.shape, + pRadius: anno.marker.radius, + class: "apexcharts-point-annotation-marker ".concat(anno.marker.cssClass, " ").concat(anno.id ? anno.id : '') + }; + var point = this.annoCtx.graphics.drawMarker(x + anno.marker.offsetX, y + anno.marker.offsetY, optsPoints); + parent.appendChild(point.node); + var text = anno.label.text ? anno.label.text : ''; + var elText = this.annoCtx.graphics.drawText({ + x: x + anno.label.offsetX, + y: y + anno.label.offsetY - anno.marker.size - parseFloat(anno.label.style.fontSize) / 1.6, + text: text, + textAnchor: anno.label.textAnchor, + fontSize: anno.label.style.fontSize, + fontFamily: anno.label.style.fontFamily, + fontWeight: anno.label.style.fontWeight, + foreColor: anno.label.style.color, + cssClass: "apexcharts-point-annotation-label ".concat(anno.label.style.cssClass, " ").concat(anno.id ? anno.id : '') + }); + elText.attr({ + rel: index + }); + parent.appendChild(elText.node); + + // TODO: deprecate this as we will use custom + if (anno.customSVG.SVG) { + var g = this.annoCtx.graphics.group({ + class: 'apexcharts-point-annotations-custom-svg ' + anno.customSVG.cssClass + }); + g.attr({ + transform: "translate(".concat(x + anno.customSVG.offsetX, ", ").concat(y + anno.customSVG.offsetY, ")") + }); + g.node.innerHTML = anno.customSVG.SVG; + parent.appendChild(g.node); + } + if (anno.image.path) { + var imgWidth = anno.image.width ? anno.image.width : 20; + var imgHeight = anno.image.height ? anno.image.height : 20; + point = this.annoCtx.addImage({ + x: x + anno.image.offsetX - imgWidth / 2, + y: y + anno.image.offsetY - imgHeight / 2, + width: imgWidth, + height: imgHeight, + path: anno.image.path, + appendTo: '.apexcharts-point-annotations' + }); + } + if (anno.mouseEnter) { + point.node.addEventListener('mouseenter', anno.mouseEnter.bind(this, anno)); + } + if (anno.mouseLeave) { + point.node.addEventListener('mouseleave', anno.mouseLeave.bind(this, anno)); + } + if (anno.click) { + point.node.addEventListener('click', anno.click.bind(this, anno)); + } + } + } + }, { + key: "drawPointAnnotations", + value: function drawPointAnnotations() { + var _this = this; + var w = this.w; + var elg = this.annoCtx.graphics.group({ + class: 'apexcharts-point-annotations' + }); + w.config.annotations.points.map(function (anno, index) { + _this.addPointAnnotation(anno, elg.node, index); + }); + return elg; + } + }]); + return PointAnnotations; + }(); + + const name = "en"; + const options = { + months: [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December" + ], + shortMonths: [ + "Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec" + ], + days: [ + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday" + ], + shortDays: [ + "Sun", + "Mon", + "Tue", + "Wed", + "Thu", + "Fri", + "Sat" + ], + toolbar: { + exportToSVG: "Download SVG", + exportToPNG: "Download PNG", + exportToCSV: "Download CSV", + menu: "Menu", + selection: "Selection", + selectionZoom: "Selection Zoom", + zoomIn: "Zoom In", + zoomOut: "Zoom Out", + pan: "Panning", + reset: "Reset Zoom" + } + }; + var en = { + name: name, + options: options + }; + + var Options = /*#__PURE__*/function () { + function Options() { + _classCallCheck(this, Options); + this.yAxis = { + show: true, + showAlways: false, + showForNullSeries: true, + seriesName: undefined, + opposite: false, + reversed: false, + logarithmic: false, + logBase: 10, + tickAmount: undefined, + stepSize: undefined, + forceNiceScale: false, + max: undefined, + min: undefined, + floating: false, + decimalsInFloat: undefined, + labels: { + show: true, + showDuplicates: false, + minWidth: 0, + maxWidth: 160, + offsetX: 0, + offsetY: 0, + align: undefined, + rotate: 0, + padding: 20, + style: { + colors: [], + fontSize: '11px', + fontWeight: 400, + fontFamily: undefined, + cssClass: '' + }, + formatter: undefined + }, + axisBorder: { + show: false, + color: '#e0e0e0', + width: 1, + offsetX: 0, + offsetY: 0 + }, + axisTicks: { + show: false, + color: '#e0e0e0', + width: 6, + offsetX: 0, + offsetY: 0 + }, + title: { + text: undefined, + rotate: -90, + offsetY: 0, + offsetX: 0, + style: { + color: undefined, + fontSize: '11px', + fontWeight: 900, + fontFamily: undefined, + cssClass: '' + } + }, + tooltip: { + enabled: false, + offsetX: 0 + }, + crosshairs: { + show: true, + position: 'front', + stroke: { + color: '#b6b6b6', + width: 1, + dashArray: 0 + } + } + }; + this.pointAnnotation = { + id: undefined, + x: 0, + y: null, + yAxisIndex: 0, + seriesIndex: undefined, + mouseEnter: undefined, + mouseLeave: undefined, + click: undefined, + marker: { + size: 4, + fillColor: '#fff', + strokeWidth: 2, + strokeColor: '#333', + shape: 'circle', + offsetX: 0, + offsetY: 0, + // radius: 2, // DEPRECATED + cssClass: '' + }, + label: { + borderColor: '#c2c2c2', + borderWidth: 1, + borderRadius: 2, + text: undefined, + textAnchor: 'middle', + offsetX: 0, + offsetY: 0, + mouseEnter: undefined, + mouseLeave: undefined, + click: undefined, + style: { + background: '#fff', + color: undefined, + fontSize: '11px', + fontFamily: undefined, + fontWeight: 400, + cssClass: '', + padding: { + left: 5, + right: 5, + top: 2, + bottom: 2 + } + } + }, + customSVG: { + // this will be deprecated in the next major version as it is going to be replaced with a better alternative below (image) + SVG: undefined, + cssClass: undefined, + offsetX: 0, + offsetY: 0 + }, + image: { + path: undefined, + width: 20, + height: 20, + offsetX: 0, + offsetY: 0 + } + }; + this.yAxisAnnotation = { + id: undefined, + y: 0, + y2: null, + strokeDashArray: 1, + fillColor: '#c2c2c2', + borderColor: '#c2c2c2', + borderWidth: 1, + opacity: 0.3, + offsetX: 0, + offsetY: 0, + width: '100%', + yAxisIndex: 0, + label: { + borderColor: '#c2c2c2', + borderWidth: 1, + borderRadius: 2, + text: undefined, + textAnchor: 'end', + position: 'right', + offsetX: 0, + offsetY: -3, + mouseEnter: undefined, + mouseLeave: undefined, + click: undefined, + style: { + background: '#fff', + color: undefined, + fontSize: '11px', + fontFamily: undefined, + fontWeight: 400, + cssClass: '', + padding: { + left: 5, + right: 5, + top: 2, + bottom: 2 + } + } + } + }; + this.xAxisAnnotation = { + id: undefined, + x: 0, + x2: null, + strokeDashArray: 1, + fillColor: '#c2c2c2', + borderColor: '#c2c2c2', + borderWidth: 1, + opacity: 0.3, + offsetX: 0, + offsetY: 0, + label: { + borderColor: '#c2c2c2', + borderWidth: 1, + borderRadius: 2, + text: undefined, + textAnchor: 'middle', + orientation: 'vertical', + position: 'top', + offsetX: 0, + offsetY: 0, + mouseEnter: undefined, + mouseLeave: undefined, + click: undefined, + style: { + background: '#fff', + color: undefined, + fontSize: '11px', + fontFamily: undefined, + fontWeight: 400, + cssClass: '', + padding: { + left: 5, + right: 5, + top: 2, + bottom: 2 + } + } + } + }; + this.text = { + x: 0, + y: 0, + text: '', + textAnchor: 'start', + foreColor: undefined, + fontSize: '13px', + fontFamily: undefined, + fontWeight: 400, + appendTo: '.apexcharts-annotations', + backgroundColor: 'transparent', + borderColor: '#c2c2c2', + borderRadius: 0, + borderWidth: 0, + paddingLeft: 4, + paddingRight: 4, + paddingTop: 2, + paddingBottom: 2 + }; + } + _createClass(Options, [{ + key: "init", + value: function init() { + return { + annotations: { + yaxis: [this.yAxisAnnotation], + xaxis: [this.xAxisAnnotation], + points: [this.pointAnnotation], + texts: [], + images: [], + shapes: [] + }, + chart: { + animations: { + enabled: true, + speed: 800, + animateGradually: { + delay: 150, + enabled: true + }, + dynamicAnimation: { + enabled: true, + speed: 350 + } + }, + background: '', + locales: [en], + defaultLocale: 'en', + dropShadow: { + enabled: false, + enabledOnSeries: undefined, + top: 2, + left: 2, + blur: 4, + color: '#000', + opacity: 0.7 + }, + events: { + animationEnd: undefined, + beforeMount: undefined, + mounted: undefined, + updated: undefined, + click: undefined, + mouseMove: undefined, + mouseLeave: undefined, + xAxisLabelClick: undefined, + legendClick: undefined, + markerClick: undefined, + selection: undefined, + dataPointSelection: undefined, + dataPointMouseEnter: undefined, + dataPointMouseLeave: undefined, + beforeZoom: undefined, + beforeResetZoom: undefined, + zoomed: undefined, + scrolled: undefined, + brushScrolled: undefined + }, + foreColor: '#373d3f', + fontFamily: 'Helvetica, Arial, sans-serif', + height: 'auto', + parentHeightOffset: 15, + redrawOnParentResize: true, + redrawOnWindowResize: true, + id: undefined, + group: undefined, + nonce: undefined, + offsetX: 0, + offsetY: 0, + selection: { + enabled: false, + type: 'x', + // selectedPoints: undefined, // default datapoints that should be selected automatically + fill: { + color: '#24292e', + opacity: 0.1 + }, + stroke: { + width: 1, + color: '#24292e', + opacity: 0.4, + dashArray: 3 + }, + xaxis: { + min: undefined, + max: undefined + }, + yaxis: { + min: undefined, + max: undefined + } + }, + sparkline: { + enabled: false + }, + brush: { + enabled: false, + autoScaleYaxis: true, + target: undefined, + targets: undefined + }, + stacked: false, + stackOnlyBar: true, + // mixed chart with stacked bars and line series - incorrect line draw #907 + stackType: 'normal', + toolbar: { + show: true, + offsetX: 0, + offsetY: 0, + tools: { + download: true, + selection: true, + zoom: true, + zoomin: true, + zoomout: true, + pan: true, + reset: true, + customIcons: [] + }, + export: { + csv: { + filename: undefined, + columnDelimiter: ',', + headerCategory: 'category', + headerValue: 'value', + categoryFormatter: undefined, + valueFormatter: undefined + }, + png: { + filename: undefined + }, + svg: { + filename: undefined + }, + scale: undefined, + width: undefined + }, + autoSelected: 'zoom' // accepts -> zoom, pan, selection + }, + type: 'line', + width: '100%', + zoom: { + enabled: true, + type: 'x', + autoScaleYaxis: false, + allowMouseWheelZoom: true, + zoomedArea: { + fill: { + color: '#90CAF9', + opacity: 0.4 + }, + stroke: { + color: '#0D47A1', + opacity: 0.4, + width: 1 + } + } + } + }, + plotOptions: { + line: { + isSlopeChart: false, + colors: { + threshold: 0, + colorAboveThreshold: undefined, + colorBelowThreshold: undefined + } + }, + area: { + fillTo: 'origin' + }, + bar: { + horizontal: false, + columnWidth: '70%', + // should be in percent 0 - 100 + barHeight: '70%', + // should be in percent 0 - 100 + distributed: false, + borderRadius: 0, + borderRadiusApplication: 'around', + // [around, end] + borderRadiusWhenStacked: 'last', + // [all, last] + rangeBarOverlap: true, + rangeBarGroupRows: false, + hideZeroBarsWhenGrouped: false, + isDumbbell: false, + dumbbellColors: undefined, + isFunnel: false, + isFunnel3d: true, + colors: { + ranges: [], + backgroundBarColors: [], + backgroundBarOpacity: 1, + backgroundBarRadius: 0 + }, + dataLabels: { + position: 'top', + // top, center, bottom + maxItems: 100, + hideOverflowingLabels: true, + orientation: 'horizontal', + total: { + enabled: false, + formatter: undefined, + offsetX: 0, + offsetY: 0, + style: { + color: '#373d3f', + fontSize: '12px', + fontFamily: undefined, + fontWeight: 600 + } + } + } + }, + bubble: { + zScaling: true, + minBubbleRadius: undefined, + maxBubbleRadius: undefined + }, + candlestick: { + colors: { + upward: '#00B746', + downward: '#EF403C' + }, + wick: { + useFillColor: true + } + }, + boxPlot: { + colors: { + upper: '#00E396', + lower: '#008FFB' + } + }, + heatmap: { + radius: 2, + enableShades: true, + shadeIntensity: 0.5, + reverseNegativeShade: false, + distributed: false, + useFillColorAsStroke: false, + colorScale: { + inverse: false, + ranges: [], + min: undefined, + max: undefined + } + }, + treemap: { + enableShades: true, + shadeIntensity: 0.5, + distributed: false, + reverseNegativeShade: false, + useFillColorAsStroke: false, + borderRadius: 4, + dataLabels: { + format: 'scale' // scale | truncate + }, + colorScale: { + inverse: false, + ranges: [], + min: undefined, + max: undefined + }, + seriesTitle: { + show: true, + offsetY: 1, + offsetX: 1, + borderColor: '#000', + borderWidth: 1, + borderRadius: 2, + style: { + background: 'rgba(0, 0, 0, 0.6)', + color: '#fff', + fontSize: '12px', + fontFamily: undefined, + fontWeight: 400, + cssClass: '', + padding: { + left: 6, + right: 6, + top: 2, + bottom: 2 + } + } + } + }, + radialBar: { + inverseOrder: false, + startAngle: 0, + endAngle: 360, + offsetX: 0, + offsetY: 0, + hollow: { + margin: 5, + size: '50%', + background: 'transparent', + image: undefined, + imageWidth: 150, + imageHeight: 150, + imageOffsetX: 0, + imageOffsetY: 0, + imageClipped: true, + position: 'front', + dropShadow: { + enabled: false, + top: 0, + left: 0, + blur: 3, + color: '#000', + opacity: 0.5 + } + }, + track: { + show: true, + startAngle: undefined, + endAngle: undefined, + background: '#f2f2f2', + strokeWidth: '97%', + opacity: 1, + margin: 5, + // margin is in pixels + dropShadow: { + enabled: false, + top: 0, + left: 0, + blur: 3, + color: '#000', + opacity: 0.5 + } + }, + dataLabels: { + show: true, + name: { + show: true, + fontSize: '16px', + fontFamily: undefined, + fontWeight: 600, + color: undefined, + offsetY: 0, + formatter: function formatter(val) { + return val; + } + }, + value: { + show: true, + fontSize: '14px', + fontFamily: undefined, + fontWeight: 400, + color: undefined, + offsetY: 16, + formatter: function formatter(val) { + return val + '%'; + } + }, + total: { + show: false, + label: 'Total', + fontSize: '16px', + fontWeight: 600, + fontFamily: undefined, + color: undefined, + formatter: function formatter(w) { + return w.globals.seriesTotals.reduce(function (a, b) { + return a + b; + }, 0) / w.globals.series.length + '%'; + } + } + }, + barLabels: { + enabled: false, + offsetX: 0, + offsetY: 0, + useSeriesColors: true, + fontFamily: undefined, + fontWeight: 600, + fontSize: '16px', + formatter: function formatter(val) { + return val; + }, + onClick: undefined + } + }, + pie: { + customScale: 1, + offsetX: 0, + offsetY: 0, + startAngle: 0, + endAngle: 360, + expandOnClick: true, + dataLabels: { + // These are the percentage values which are displayed on slice + offset: 0, + // offset by which labels will move outside + minAngleToShowLabel: 10 + }, + donut: { + size: '65%', + background: 'transparent', + labels: { + // These are the inner labels appearing inside donut + show: false, + name: { + show: true, + fontSize: '16px', + fontFamily: undefined, + fontWeight: 600, + color: undefined, + offsetY: -10, + formatter: function formatter(val) { + return val; + } + }, + value: { + show: true, + fontSize: '20px', + fontFamily: undefined, + fontWeight: 400, + color: undefined, + offsetY: 10, + formatter: function formatter(val) { + return val; + } + }, + total: { + show: false, + showAlways: false, + label: 'Total', + fontSize: '16px', + fontWeight: 400, + fontFamily: undefined, + color: undefined, + formatter: function formatter(w) { + return w.globals.seriesTotals.reduce(function (a, b) { + return a + b; + }, 0); + } + } + } + } + }, + polarArea: { + rings: { + strokeWidth: 1, + strokeColor: '#e8e8e8' + }, + spokes: { + strokeWidth: 1, + connectorColors: '#e8e8e8' + } + }, + radar: { + size: undefined, + offsetX: 0, + offsetY: 0, + polygons: { + // strokeColor: '#e8e8e8', // should be deprecated in the minor version i.e 3.2 + strokeWidth: 1, + strokeColors: '#e8e8e8', + connectorColors: '#e8e8e8', + fill: { + colors: undefined + } + } + } + }, + colors: undefined, + dataLabels: { + enabled: true, + enabledOnSeries: undefined, + formatter: function formatter(val) { + return val !== null ? val : ''; + }, + textAnchor: 'middle', + distributed: false, + offsetX: 0, + offsetY: 0, + style: { + fontSize: '12px', + fontFamily: undefined, + fontWeight: 600, + colors: undefined + }, + background: { + enabled: true, + foreColor: '#fff', + borderRadius: 2, + padding: 4, + opacity: 0.9, + borderWidth: 1, + borderColor: '#fff', + dropShadow: { + enabled: false, + top: 1, + left: 1, + blur: 1, + color: '#000', + opacity: 0.8 + } + }, + dropShadow: { + enabled: false, + top: 1, + left: 1, + blur: 1, + color: '#000', + opacity: 0.8 + } + }, + fill: { + type: 'solid', + colors: undefined, + // array of colors + opacity: 0.85, + gradient: { + shade: 'dark', + type: 'horizontal', + shadeIntensity: 0.5, + gradientToColors: undefined, + inverseColors: true, + opacityFrom: 1, + opacityTo: 1, + stops: [0, 50, 100], + colorStops: [] + }, + image: { + src: [], + width: undefined, + // optional + height: undefined // optional + }, + pattern: { + style: 'squares', + // String | Array of Strings + width: 6, + height: 6, + strokeWidth: 2 + } + }, + forecastDataPoints: { + count: 0, + fillOpacity: 0.5, + strokeWidth: undefined, + dashArray: 4 + }, + grid: { + show: true, + borderColor: '#e0e0e0', + strokeDashArray: 0, + position: 'back', + xaxis: { + lines: { + show: false + } + }, + yaxis: { + lines: { + show: true + } + }, + row: { + colors: undefined, + // takes as array which will be repeated on rows + opacity: 0.5 + }, + column: { + colors: undefined, + // takes an array which will be repeated on columns + opacity: 0.5 + }, + padding: { + top: 0, + right: 10, + bottom: 0, + left: 12 + } + }, + labels: [], + legend: { + show: true, + showForSingleSeries: false, + showForNullSeries: true, + showForZeroSeries: true, + floating: false, + position: 'bottom', + // whether to position legends in 1 of 4 + // direction - top, bottom, left, right + horizontalAlign: 'center', + // when position top/bottom, you can specify whether to align legends left, right or center + inverseOrder: false, + fontSize: '12px', + fontFamily: undefined, + fontWeight: 400, + width: undefined, + height: undefined, + formatter: undefined, + tooltipHoverFormatter: undefined, + offsetX: -20, + offsetY: 4, + customLegendItems: [], + clusterGroupedSeries: true, + clusterGroupedSeriesOrientation: 'vertical', + labels: { + colors: undefined, + useSeriesColors: false + }, + markers: { + size: 7, + fillColors: undefined, + strokeWidth: 1, + shape: undefined, + offsetX: 0, + offsetY: 0, + customHTML: undefined, + onClick: undefined + }, + itemMargin: { + horizontal: 5, + vertical: 4 + }, + onItemClick: { + toggleDataSeries: true + }, + onItemHover: { + highlightDataSeries: true + } + }, + markers: { + discrete: [], + size: 0, + colors: undefined, + strokeColors: '#fff', + strokeWidth: 2, + strokeOpacity: 0.9, + strokeDashArray: 0, + fillOpacity: 1, + shape: 'circle', + offsetX: 0, + offsetY: 0, + showNullDataPoints: true, + onClick: undefined, + onDblClick: undefined, + hover: { + size: undefined, + sizeOffset: 3 + } + }, + noData: { + text: undefined, + align: 'center', + verticalAlign: 'middle', + offsetX: 0, + offsetY: 0, + style: { + color: undefined, + fontSize: '14px', + fontFamily: undefined + } + }, + responsive: [], + // breakpoints should follow ascending order 400, then 700, then 1000 + series: undefined, + states: { + hover: { + filter: { + type: 'lighten' + } + }, + active: { + allowMultipleDataPointsSelection: false, + filter: { + type: 'darken' + } + } + }, + title: { + text: undefined, + align: 'left', + margin: 5, + offsetX: 0, + offsetY: 0, + floating: false, + style: { + fontSize: '14px', + fontWeight: 900, + fontFamily: undefined, + color: undefined + } + }, + subtitle: { + text: undefined, + align: 'left', + margin: 5, + offsetX: 0, + offsetY: 30, + floating: false, + style: { + fontSize: '12px', + fontWeight: 400, + fontFamily: undefined, + color: undefined + } + }, + stroke: { + show: true, + curve: 'smooth', + // "smooth" / "straight" / "monotoneCubic" / "stepline" / "linestep" + lineCap: 'butt', + // round, butt , square + width: 2, + colors: undefined, + // array of colors + dashArray: 0, + // single value or array of values + fill: { + type: 'solid', + colors: undefined, + // array of colors + opacity: 0.85, + gradient: { + shade: 'dark', + type: 'horizontal', + shadeIntensity: 0.5, + gradientToColors: undefined, + inverseColors: true, + opacityFrom: 1, + opacityTo: 1, + stops: [0, 50, 100], + colorStops: [] + } + } + }, + tooltip: { + enabled: true, + enabledOnSeries: undefined, + shared: true, + hideEmptySeries: false, + followCursor: false, + // when disabled, the tooltip will show on top of the series instead of mouse position + intersect: false, + // when enabled, tooltip will only show when user directly hovers over point + inverseOrder: false, + custom: undefined, + fillSeriesColor: false, + theme: 'light', + cssClass: '', + style: { + fontSize: '12px', + fontFamily: undefined + }, + onDatasetHover: { + highlightDataSeries: false + }, + x: { + // x value + show: true, + format: 'dd MMM', + // dd/MM, dd MMM yy, dd MMM yyyy + formatter: undefined // a custom user supplied formatter function + }, + y: { + formatter: undefined, + title: { + formatter: function formatter(seriesName) { + return seriesName ? seriesName + ': ' : ''; + } + } + }, + z: { + formatter: undefined, + title: 'Size: ' + }, + marker: { + show: true, + fillColors: undefined + }, + items: { + display: 'flex' + }, + fixed: { + enabled: false, + position: 'topRight', + // topRight, topLeft, bottomRight, bottomLeft + offsetX: 0, + offsetY: 0 + } + }, + xaxis: { + type: 'category', + categories: [], + convertedCatToNumeric: false, + // internal property which should not be altered outside + offsetX: 0, + offsetY: 0, + overwriteCategories: undefined, + labels: { + show: true, + rotate: -45, + rotateAlways: false, + hideOverlappingLabels: true, + trim: false, + minHeight: undefined, + maxHeight: 120, + showDuplicates: true, + style: { + colors: [], + fontSize: '12px', + fontWeight: 400, + fontFamily: undefined, + cssClass: '' + }, + offsetX: 0, + offsetY: 0, + format: undefined, + formatter: undefined, + // custom formatter function which will override format + datetimeUTC: true, + datetimeFormatter: { + year: 'yyyy', + month: "MMM 'yy", + day: 'dd MMM', + hour: 'HH:mm', + minute: 'HH:mm:ss', + second: 'HH:mm:ss' + } + }, + group: { + groups: [], + style: { + colors: [], + fontSize: '12px', + fontWeight: 400, + fontFamily: undefined, + cssClass: '' + } + }, + axisBorder: { + show: true, + color: '#e0e0e0', + width: '100%', + height: 1, + offsetX: 0, + offsetY: 0 + }, + axisTicks: { + show: true, + color: '#e0e0e0', + height: 6, + offsetX: 0, + offsetY: 0 + }, + stepSize: undefined, + tickAmount: undefined, + tickPlacement: 'on', + min: undefined, + max: undefined, + range: undefined, + floating: false, + decimalsInFloat: undefined, + position: 'bottom', + title: { + text: undefined, + offsetX: 0, + offsetY: 0, + style: { + color: undefined, + fontSize: '12px', + fontWeight: 900, + fontFamily: undefined, + cssClass: '' + } + }, + crosshairs: { + show: true, + width: 1, + // tickWidth/barWidth or an integer + position: 'back', + opacity: 0.9, + stroke: { + color: '#b6b6b6', + width: 1, + dashArray: 3 + }, + fill: { + type: 'solid', + // solid, gradient + color: '#B1B9C4', + gradient: { + colorFrom: '#D8E3F0', + colorTo: '#BED1E6', + stops: [0, 100], + opacityFrom: 0.4, + opacityTo: 0.5 + } + }, + dropShadow: { + enabled: false, + left: 0, + top: 0, + blur: 1, + opacity: 0.8 + } + }, + tooltip: { + enabled: true, + offsetY: 0, + formatter: undefined, + style: { + fontSize: '12px', + fontFamily: undefined + } + } + }, + yaxis: this.yAxis, + theme: { + mode: '', + palette: 'palette1', + // If defined, it will overwrite globals.colors variable + monochrome: { + // monochrome allows you to select just 1 color and fill out the rest with light/dark shade (intensity can be selected) + enabled: false, + color: '#008FFB', + shadeTo: 'light', + shadeIntensity: 0.65 + } + } + }; + } + }]); + return Options; + }(); + + /** + * ApexCharts Annotations Class for drawing lines/rects on both xaxis and yaxis. + * + * @module Annotations + **/ + var Annotations = /*#__PURE__*/function () { + function Annotations(ctx) { + _classCallCheck(this, Annotations); + this.ctx = ctx; + this.w = ctx.w; + this.graphics = new Graphics(this.ctx); + if (this.w.globals.isBarHorizontal) { + this.invertAxis = true; + } + this.helpers = new Helpers$4(this); + this.xAxisAnnotations = new XAnnotations(this); + this.yAxisAnnotations = new YAnnotations(this); + this.pointsAnnotations = new PointAnnotations(this); + if (this.w.globals.isBarHorizontal && this.w.config.yaxis[0].reversed) { + this.inversedReversedAxis = true; + } + this.xDivision = this.w.globals.gridWidth / this.w.globals.dataPoints; + } + _createClass(Annotations, [{ + key: "drawAxesAnnotations", + value: function drawAxesAnnotations() { + var w = this.w; + if (w.globals.axisCharts && w.globals.dataPoints) { + // w.globals.dataPoints check added to fix #1832 + var yAnnotations = this.yAxisAnnotations.drawYAxisAnnotations(); + var xAnnotations = this.xAxisAnnotations.drawXAxisAnnotations(); + var pointAnnotations = this.pointsAnnotations.drawPointAnnotations(); + var initialAnim = w.config.chart.animations.enabled; + var annoArray = [yAnnotations, xAnnotations, pointAnnotations]; + var annoElArray = [xAnnotations.node, yAnnotations.node, pointAnnotations.node]; + for (var i = 0; i < 3; i++) { + w.globals.dom.elGraphical.add(annoArray[i]); + if (initialAnim && !w.globals.resized && !w.globals.dataChanged) { + // fixes apexcharts/apexcharts.js#685 + if (w.config.chart.type !== 'scatter' && w.config.chart.type !== 'bubble' && w.globals.dataPoints > 1) { + annoElArray[i].classList.add('apexcharts-element-hidden'); + } + } + w.globals.delayedElements.push({ + el: annoElArray[i], + index: 0 + }); + } + + // background sizes needs to be calculated after text is drawn, so calling them last + this.helpers.annotationsBackground(); + } + } + }, { + key: "drawImageAnnos", + value: function drawImageAnnos() { + var _this = this; + var w = this.w; + w.config.annotations.images.map(function (s, index) { + _this.addImage(s, index); + }); + } + }, { + key: "drawTextAnnos", + value: function drawTextAnnos() { + var _this2 = this; + var w = this.w; + w.config.annotations.texts.map(function (t, index) { + _this2.addText(t, index); + }); + } + }, { + key: "addXaxisAnnotation", + value: function addXaxisAnnotation(anno, parent, index) { + this.xAxisAnnotations.addXaxisAnnotation(anno, parent, index); + } + }, { + key: "addYaxisAnnotation", + value: function addYaxisAnnotation(anno, parent, index) { + this.yAxisAnnotations.addYaxisAnnotation(anno, parent, index); + } + }, { + key: "addPointAnnotation", + value: function addPointAnnotation(anno, parent, index) { + this.pointsAnnotations.addPointAnnotation(anno, parent, index); + } + }, { + key: "addText", + value: function addText(params, index) { + var x = params.x, + y = params.y, + text = params.text, + textAnchor = params.textAnchor, + foreColor = params.foreColor, + fontSize = params.fontSize, + fontFamily = params.fontFamily, + fontWeight = params.fontWeight, + cssClass = params.cssClass, + backgroundColor = params.backgroundColor, + borderWidth = params.borderWidth, + strokeDashArray = params.strokeDashArray, + borderRadius = params.borderRadius, + borderColor = params.borderColor, + _params$appendTo = params.appendTo, + appendTo = _params$appendTo === void 0 ? '.apexcharts-svg' : _params$appendTo, + _params$paddingLeft = params.paddingLeft, + paddingLeft = _params$paddingLeft === void 0 ? 4 : _params$paddingLeft, + _params$paddingRight = params.paddingRight, + paddingRight = _params$paddingRight === void 0 ? 4 : _params$paddingRight, + _params$paddingBottom = params.paddingBottom, + paddingBottom = _params$paddingBottom === void 0 ? 2 : _params$paddingBottom, + _params$paddingTop = params.paddingTop, + paddingTop = _params$paddingTop === void 0 ? 2 : _params$paddingTop; + var w = this.w; + var elText = this.graphics.drawText({ + x: x, + y: y, + text: text, + textAnchor: textAnchor || 'start', + fontSize: fontSize || '12px', + fontWeight: fontWeight || 'regular', + fontFamily: fontFamily || w.config.chart.fontFamily, + foreColor: foreColor || w.config.chart.foreColor, + cssClass: 'apexcharts-text ' + cssClass ? cssClass : '' + }); + var parent = w.globals.dom.baseEl.querySelector(appendTo); + if (parent) { + parent.appendChild(elText.node); + } + var textRect = elText.bbox(); + if (text) { + var elRect = this.graphics.drawRect(textRect.x - paddingLeft, textRect.y - paddingTop, textRect.width + paddingLeft + paddingRight, textRect.height + paddingBottom + paddingTop, borderRadius, backgroundColor ? backgroundColor : 'transparent', 1, borderWidth, borderColor, strokeDashArray); + parent.insertBefore(elRect.node, elText.node); + } + } + }, { + key: "addImage", + value: function addImage(params, index) { + var w = this.w; + var path = params.path, + _params$x = params.x, + x = _params$x === void 0 ? 0 : _params$x, + _params$y = params.y, + y = _params$y === void 0 ? 0 : _params$y, + _params$width = params.width, + width = _params$width === void 0 ? 20 : _params$width, + _params$height = params.height, + height = _params$height === void 0 ? 20 : _params$height, + _params$appendTo2 = params.appendTo, + appendTo = _params$appendTo2 === void 0 ? '.apexcharts-svg' : _params$appendTo2; + var img = w.globals.dom.Paper.image(path); + img.size(width, height).move(x, y); + var parent = w.globals.dom.baseEl.querySelector(appendTo); + if (parent) { + parent.appendChild(img.node); + } + return img; + } + + // The addXaxisAnnotation method requires a parent class, and user calling this method externally on the chart instance may not specify parent, hence a different method + }, { + key: "addXaxisAnnotationExternal", + value: function addXaxisAnnotationExternal(params, pushToMemory, context) { + this.addAnnotationExternal({ + params: params, + pushToMemory: pushToMemory, + context: context, + type: 'xaxis', + contextMethod: context.addXaxisAnnotation + }); + return context; + } + }, { + key: "addYaxisAnnotationExternal", + value: function addYaxisAnnotationExternal(params, pushToMemory, context) { + this.addAnnotationExternal({ + params: params, + pushToMemory: pushToMemory, + context: context, + type: 'yaxis', + contextMethod: context.addYaxisAnnotation + }); + return context; + } + }, { + key: "addPointAnnotationExternal", + value: function addPointAnnotationExternal(params, pushToMemory, context) { + if (typeof this.invertAxis === 'undefined') { + this.invertAxis = context.w.globals.isBarHorizontal; + } + this.addAnnotationExternal({ + params: params, + pushToMemory: pushToMemory, + context: context, + type: 'point', + contextMethod: context.addPointAnnotation + }); + return context; + } + }, { + key: "addAnnotationExternal", + value: function addAnnotationExternal(_ref) { + var params = _ref.params, + pushToMemory = _ref.pushToMemory, + context = _ref.context, + type = _ref.type, + contextMethod = _ref.contextMethod; + var me = context; + var w = me.w; + var parent = w.globals.dom.baseEl.querySelector(".apexcharts-".concat(type, "-annotations")); + var index = parent.childNodes.length + 1; + var options = new Options(); + var axesAnno = Object.assign({}, type === 'xaxis' ? options.xAxisAnnotation : type === 'yaxis' ? options.yAxisAnnotation : options.pointAnnotation); + var anno = Utils$1.extend(axesAnno, params); + switch (type) { + case 'xaxis': + this.addXaxisAnnotation(anno, parent, index); + break; + case 'yaxis': + this.addYaxisAnnotation(anno, parent, index); + break; + case 'point': + this.addPointAnnotation(anno, parent, index); + break; + } + + // add background + var axesAnnoLabel = w.globals.dom.baseEl.querySelector(".apexcharts-".concat(type, "-annotations .apexcharts-").concat(type, "-annotation-label[rel='").concat(index, "']")); + var elRect = this.helpers.addBackgroundToAnno(axesAnnoLabel, anno); + if (elRect) { + parent.insertBefore(elRect.node, axesAnnoLabel); + } + if (pushToMemory) { + w.globals.memory.methodsToExec.push({ + context: me, + id: anno.id ? anno.id : Utils$1.randomId(), + method: contextMethod, + label: 'addAnnotation', + params: params + }); + } + return context; + } + }, { + key: "clearAnnotations", + value: function clearAnnotations(ctx) { + var w = ctx.w; + var annos = w.globals.dom.baseEl.querySelectorAll('.apexcharts-yaxis-annotations, .apexcharts-xaxis-annotations, .apexcharts-point-annotations'); + + // annotations added externally should be cleared out too + for (var i = w.globals.memory.methodsToExec.length - 1; i >= 0; i--) { + if (w.globals.memory.methodsToExec[i].label === 'addText' || w.globals.memory.methodsToExec[i].label === 'addAnnotation') { + w.globals.memory.methodsToExec.splice(i, 1); + } + } + annos = Utils$1.listToArray(annos); + + // delete the DOM elements + Array.prototype.forEach.call(annos, function (a) { + while (a.firstChild) { + a.removeChild(a.firstChild); + } + }); + } + }, { + key: "removeAnnotation", + value: function removeAnnotation(ctx, id) { + var w = ctx.w; + var annos = w.globals.dom.baseEl.querySelectorAll(".".concat(id)); + if (annos) { + w.globals.memory.methodsToExec.map(function (m, i) { + if (m.id === id) { + w.globals.memory.methodsToExec.splice(i, 1); + } + }); + Array.prototype.forEach.call(annos, function (a) { + a.parentElement.removeChild(a); + }); + } + } + }]); + return Annotations; + }(); + + /** + * ApexCharts Default Class for setting default options for all chart types. + * + * @module Defaults + **/ + + var getRangeValues = function getRangeValues(_ref) { + var _w$config$series$seri; + var isTimeline = _ref.isTimeline, + ctx = _ref.ctx, + seriesIndex = _ref.seriesIndex, + dataPointIndex = _ref.dataPointIndex, + y1 = _ref.y1, + y2 = _ref.y2, + w = _ref.w; + var start = w.globals.seriesRangeStart[seriesIndex][dataPointIndex]; + var end = w.globals.seriesRangeEnd[seriesIndex][dataPointIndex]; + var ylabel = w.globals.labels[dataPointIndex]; + var seriesName = w.config.series[seriesIndex].name ? w.config.series[seriesIndex].name : ''; + var yLbFormatter = w.globals.ttKeyFormatter; + var yLbTitleFormatter = w.config.tooltip.y.title.formatter; + var opts = { + w: w, + seriesIndex: seriesIndex, + dataPointIndex: dataPointIndex, + start: start, + end: end + }; + if (typeof yLbTitleFormatter === 'function') { + seriesName = yLbTitleFormatter(seriesName, opts); + } + if ((_w$config$series$seri = w.config.series[seriesIndex].data[dataPointIndex]) !== null && _w$config$series$seri !== void 0 && _w$config$series$seri.x) { + ylabel = w.config.series[seriesIndex].data[dataPointIndex].x; + } + if (!isTimeline) { + if (w.config.xaxis.type === 'datetime') { + var xFormat = new Formatters(ctx); + ylabel = xFormat.xLabelFormat(w.globals.ttKeyFormatter, ylabel, ylabel, { + i: undefined, + dateFormatter: new DateTime(ctx).formatDate, + w: w + }); + } + } + if (typeof yLbFormatter === 'function') { + ylabel = yLbFormatter(ylabel, opts); + } + if (Number.isFinite(y1) && Number.isFinite(y2)) { + start = y1; + end = y2; + } + var startVal = ''; + var endVal = ''; + var color = w.globals.colors[seriesIndex]; + if (w.config.tooltip.x.formatter === undefined) { + if (w.config.xaxis.type === 'datetime') { + var datetimeObj = new DateTime(ctx); + startVal = datetimeObj.formatDate(datetimeObj.getDate(start), w.config.tooltip.x.format); + endVal = datetimeObj.formatDate(datetimeObj.getDate(end), w.config.tooltip.x.format); + } else { + startVal = start; + endVal = end; + } + } else { + startVal = w.config.tooltip.x.formatter(start); + endVal = w.config.tooltip.x.formatter(end); + } + return { + start: start, + end: end, + startVal: startVal, + endVal: endVal, + ylabel: ylabel, + color: color, + seriesName: seriesName + }; + }; + var buildRangeTooltipHTML = function buildRangeTooltipHTML(opts) { + var color = opts.color, + seriesName = opts.seriesName, + ylabel = opts.ylabel, + start = opts.start, + end = opts.end, + seriesIndex = opts.seriesIndex, + dataPointIndex = opts.dataPointIndex; + var formatter = opts.ctx.tooltip.tooltipLabels.getFormatters(seriesIndex); + start = formatter.yLbFormatter(start); + end = formatter.yLbFormatter(end); + var val = formatter.yLbFormatter(opts.w.globals.series[seriesIndex][dataPointIndex]); + var valueHTML = ''; + var rangeValues = "\n ".concat(start, "\n - \n ").concat(end, "\n "); + if (opts.w.globals.comboCharts) { + if (opts.w.config.series[seriesIndex].type === 'rangeArea' || opts.w.config.series[seriesIndex].type === 'rangeBar') { + valueHTML = rangeValues; + } else { + valueHTML = "".concat(val, ""); + } + } else { + valueHTML = rangeValues; + } + return '
' + '
' + (seriesName ? seriesName : '') + '
' + '
' + ylabel + ': ' + valueHTML + '
' + '
'; + }; + var Defaults = /*#__PURE__*/function () { + function Defaults(opts) { + _classCallCheck(this, Defaults); + this.opts = opts; + } + _createClass(Defaults, [{ + key: "hideYAxis", + value: function hideYAxis() { + this.opts.yaxis[0].show = false; + this.opts.yaxis[0].title.text = ''; + this.opts.yaxis[0].axisBorder.show = false; + this.opts.yaxis[0].axisTicks.show = false; + this.opts.yaxis[0].floating = true; + } + }, { + key: "line", + value: function line() { + return { + dataLabels: { + enabled: false + }, + stroke: { + width: 5, + curve: 'straight' + }, + markers: { + size: 0, + hover: { + sizeOffset: 6 + } + }, + xaxis: { + crosshairs: { + width: 1 + } + } + }; + } + }, { + key: "sparkline", + value: function sparkline(defaults) { + this.hideYAxis(); + var ret = { + grid: { + show: false, + padding: { + left: 0, + right: 0, + top: 0, + bottom: 0 + } + }, + legend: { + show: false + }, + xaxis: { + labels: { + show: false + }, + tooltip: { + enabled: false + }, + axisBorder: { + show: false + }, + axisTicks: { + show: false + } + }, + chart: { + toolbar: { + show: false + }, + zoom: { + enabled: false + } + }, + dataLabels: { + enabled: false + } + }; + return Utils$1.extend(defaults, ret); + } + }, { + key: "slope", + value: function slope() { + this.hideYAxis(); + return { + chart: { + toolbar: { + show: false + }, + zoom: { + enabled: false + } + }, + dataLabels: { + enabled: true, + formatter: function formatter(val, opts) { + var seriesName = opts.w.config.series[opts.seriesIndex].name; + return val !== null ? seriesName + ': ' + val : ''; + }, + background: { + enabled: false + }, + offsetX: -5 + }, + grid: { + xaxis: { + lines: { + show: true + } + }, + yaxis: { + lines: { + show: false + } + } + }, + xaxis: { + position: 'top', + labels: { + style: { + fontSize: 14, + fontWeight: 900 + } + }, + tooltip: { + enabled: false + }, + crosshairs: { + show: false + } + }, + markers: { + size: 8, + hover: { + sizeOffset: 1 + } + }, + legend: { + show: false + }, + tooltip: { + shared: false, + intersect: true, + followCursor: true + }, + stroke: { + width: 5, + curve: 'straight' + } + }; + } + }, { + key: "bar", + value: function bar() { + return { + chart: { + stacked: false + }, + plotOptions: { + bar: { + dataLabels: { + position: 'center' + } + } + }, + dataLabels: { + style: { + colors: ['#fff'] + }, + background: { + enabled: false + } + }, + stroke: { + width: 0, + lineCap: 'square' + }, + fill: { + opacity: 0.85 + }, + legend: { + markers: { + shape: 'square' + } + }, + tooltip: { + shared: false, + intersect: true + }, + xaxis: { + tooltip: { + enabled: false + }, + tickPlacement: 'between', + crosshairs: { + width: 'barWidth', + position: 'back', + fill: { + type: 'gradient' + }, + dropShadow: { + enabled: false + }, + stroke: { + width: 0 + } + } + } + }; + } + }, { + key: "funnel", + value: function funnel() { + this.hideYAxis(); + return _objectSpread2(_objectSpread2({}, this.bar()), {}, { + chart: { + animations: { + speed: 800, + animateGradually: { + enabled: false + } + } + }, + plotOptions: { + bar: { + horizontal: true, + borderRadiusApplication: 'around', + borderRadius: 0, + dataLabels: { + position: 'center' + } + } + }, + grid: { + show: false, + padding: { + left: 0, + right: 0 + } + }, + xaxis: { + labels: { + show: false + }, + tooltip: { + enabled: false + }, + axisBorder: { + show: false + }, + axisTicks: { + show: false + } + } + }); + } + }, { + key: "candlestick", + value: function candlestick() { + var _this = this; + return { + stroke: { + width: 1, + colors: ['#333'] + }, + fill: { + opacity: 1 + }, + dataLabels: { + enabled: false + }, + tooltip: { + shared: true, + custom: function custom(_ref2) { + var seriesIndex = _ref2.seriesIndex, + dataPointIndex = _ref2.dataPointIndex, + w = _ref2.w; + return _this._getBoxTooltip(w, seriesIndex, dataPointIndex, ['Open', 'High', '', 'Low', 'Close'], 'candlestick'); + } + }, + states: { + active: { + filter: { + type: 'none' + } + } + }, + xaxis: { + crosshairs: { + width: 1 + } + } + }; + } + }, { + key: "boxPlot", + value: function boxPlot() { + var _this2 = this; + return { + chart: { + animations: { + dynamicAnimation: { + enabled: false + } + } + }, + stroke: { + width: 1, + colors: ['#24292e'] + }, + dataLabels: { + enabled: false + }, + tooltip: { + shared: true, + custom: function custom(_ref3) { + var seriesIndex = _ref3.seriesIndex, + dataPointIndex = _ref3.dataPointIndex, + w = _ref3.w; + return _this2._getBoxTooltip(w, seriesIndex, dataPointIndex, ['Minimum', 'Q1', 'Median', 'Q3', 'Maximum'], 'boxPlot'); + } + }, + markers: { + size: 7, + strokeWidth: 1, + strokeColors: '#111' + }, + xaxis: { + crosshairs: { + width: 1 + } + } + }; + } + }, { + key: "rangeBar", + value: function rangeBar() { + var handleTimelineTooltip = function handleTimelineTooltip(opts) { + var _getRangeValues = getRangeValues(_objectSpread2(_objectSpread2({}, opts), {}, { + isTimeline: true + })), + color = _getRangeValues.color, + seriesName = _getRangeValues.seriesName, + ylabel = _getRangeValues.ylabel, + startVal = _getRangeValues.startVal, + endVal = _getRangeValues.endVal; + return buildRangeTooltipHTML(_objectSpread2(_objectSpread2({}, opts), {}, { + color: color, + seriesName: seriesName, + ylabel: ylabel, + start: startVal, + end: endVal + })); + }; + var handleRangeColumnTooltip = function handleRangeColumnTooltip(opts) { + var _getRangeValues2 = getRangeValues(opts), + color = _getRangeValues2.color, + seriesName = _getRangeValues2.seriesName, + ylabel = _getRangeValues2.ylabel, + start = _getRangeValues2.start, + end = _getRangeValues2.end; + return buildRangeTooltipHTML(_objectSpread2(_objectSpread2({}, opts), {}, { + color: color, + seriesName: seriesName, + ylabel: ylabel, + start: start, + end: end + })); + }; + return { + chart: { + animations: { + animateGradually: false + } + }, + stroke: { + width: 0, + lineCap: 'square' + }, + plotOptions: { + bar: { + borderRadius: 0, + dataLabels: { + position: 'center' + } + } + }, + dataLabels: { + enabled: false, + formatter: function formatter(val, _ref4) { + _ref4.ctx; + var seriesIndex = _ref4.seriesIndex, + dataPointIndex = _ref4.dataPointIndex, + w = _ref4.w; + var getVal = function getVal() { + var start = w.globals.seriesRangeStart[seriesIndex][dataPointIndex]; + var end = w.globals.seriesRangeEnd[seriesIndex][dataPointIndex]; + return end - start; + }; + if (w.globals.comboCharts) { + if (w.config.series[seriesIndex].type === 'rangeBar' || w.config.series[seriesIndex].type === 'rangeArea') { + return getVal(); + } else { + return val; + } + } else { + return getVal(); + } + }, + background: { + enabled: false + }, + style: { + colors: ['#fff'] + } + }, + markers: { + size: 10 + }, + tooltip: { + shared: false, + followCursor: true, + custom: function custom(opts) { + if (opts.w.config.plotOptions && opts.w.config.plotOptions.bar && opts.w.config.plotOptions.bar.horizontal) { + return handleTimelineTooltip(opts); + } else { + return handleRangeColumnTooltip(opts); + } + } + }, + xaxis: { + tickPlacement: 'between', + tooltip: { + enabled: false + }, + crosshairs: { + stroke: { + width: 0 + } + } + } + }; + } + }, { + key: "dumbbell", + value: function dumbbell(opts) { + var _opts$plotOptions$bar, _opts$plotOptions$bar2; + if (!((_opts$plotOptions$bar = opts.plotOptions.bar) !== null && _opts$plotOptions$bar !== void 0 && _opts$plotOptions$bar.barHeight)) { + opts.plotOptions.bar.barHeight = 2; + } + if (!((_opts$plotOptions$bar2 = opts.plotOptions.bar) !== null && _opts$plotOptions$bar2 !== void 0 && _opts$plotOptions$bar2.columnWidth)) { + opts.plotOptions.bar.columnWidth = 2; + } + return opts; + } + }, { + key: "area", + value: function area() { + return { + stroke: { + width: 4, + fill: { + type: 'solid', + gradient: { + inverseColors: false, + shade: 'light', + type: 'vertical', + opacityFrom: 0.65, + opacityTo: 0.5, + stops: [0, 100, 100] + } + } + }, + fill: { + type: 'gradient', + gradient: { + inverseColors: false, + shade: 'light', + type: 'vertical', + opacityFrom: 0.65, + opacityTo: 0.5, + stops: [0, 100, 100] + } + }, + markers: { + size: 0, + hover: { + sizeOffset: 6 + } + }, + tooltip: { + followCursor: false + } + }; + } + }, { + key: "rangeArea", + value: function rangeArea() { + var handleRangeAreaTooltip = function handleRangeAreaTooltip(opts) { + var _getRangeValues3 = getRangeValues(opts), + color = _getRangeValues3.color, + seriesName = _getRangeValues3.seriesName, + ylabel = _getRangeValues3.ylabel, + start = _getRangeValues3.start, + end = _getRangeValues3.end; + return buildRangeTooltipHTML(_objectSpread2(_objectSpread2({}, opts), {}, { + color: color, + seriesName: seriesName, + ylabel: ylabel, + start: start, + end: end + })); + }; + return { + stroke: { + curve: 'straight', + width: 0 + }, + fill: { + type: 'solid', + opacity: 0.6 + }, + markers: { + size: 0 + }, + states: { + hover: { + filter: { + type: 'none' + } + }, + active: { + filter: { + type: 'none' + } + } + }, + tooltip: { + intersect: false, + shared: true, + followCursor: true, + custom: function custom(opts) { + return handleRangeAreaTooltip(opts); + } + } + }; + } + }, { + key: "brush", + value: function brush(defaults) { + var ret = { + chart: { + toolbar: { + autoSelected: 'selection', + show: false + }, + zoom: { + enabled: false + } + }, + dataLabels: { + enabled: false + }, + stroke: { + width: 1 + }, + tooltip: { + enabled: false + }, + xaxis: { + tooltip: { + enabled: false + } + } + }; + return Utils$1.extend(defaults, ret); + } + }, { + key: "stacked100", + value: function stacked100(opts) { + opts.dataLabels = opts.dataLabels || {}; + opts.dataLabels.formatter = opts.dataLabels.formatter || undefined; + var existingDataLabelFormatter = opts.dataLabels.formatter; + opts.yaxis.forEach(function (yaxe, index) { + opts.yaxis[index].min = 0; + opts.yaxis[index].max = 100; + }); + var isBar = opts.chart.type === 'bar'; + if (isBar) { + opts.dataLabels.formatter = existingDataLabelFormatter || function (val) { + if (typeof val === 'number') { + return val ? val.toFixed(0) + '%' : val; + } + return val; + }; + } + return opts; + } + }, { + key: "stackedBars", + value: function stackedBars() { + var barDefaults = this.bar(); + return _objectSpread2(_objectSpread2({}, barDefaults), {}, { + plotOptions: _objectSpread2(_objectSpread2({}, barDefaults.plotOptions), {}, { + bar: _objectSpread2(_objectSpread2({}, barDefaults.plotOptions.bar), {}, { + borderRadiusApplication: 'end', + borderRadiusWhenStacked: 'last' + }) + }) + }); + } + + // This function removes the left and right spacing in chart for line/area/scatter if xaxis type = category for those charts by converting xaxis = numeric. Numeric/Datetime xaxis prevents the unnecessary spacing in the left/right of the chart area + }, { + key: "convertCatToNumeric", + value: function convertCatToNumeric(opts) { + opts.xaxis.convertedCatToNumeric = true; + return opts; + } + }, { + key: "convertCatToNumericXaxis", + value: function convertCatToNumericXaxis(opts, ctx, cats) { + opts.xaxis.type = 'numeric'; + opts.xaxis.labels = opts.xaxis.labels || {}; + opts.xaxis.labels.formatter = opts.xaxis.labels.formatter || function (val) { + return Utils$1.isNumber(val) ? Math.floor(val) : val; + }; + var defaultFormatter = opts.xaxis.labels.formatter; + var labels = opts.xaxis.categories && opts.xaxis.categories.length ? opts.xaxis.categories : opts.labels; + if (cats && cats.length) { + labels = cats.map(function (c) { + return Array.isArray(c) ? c : String(c); + }); + } + if (labels && labels.length) { + opts.xaxis.labels.formatter = function (val) { + return Utils$1.isNumber(val) ? defaultFormatter(labels[Math.floor(val) - 1]) : defaultFormatter(val); + }; + } + opts.xaxis.categories = []; + opts.labels = []; + opts.xaxis.tickAmount = opts.xaxis.tickAmount || 'dataPoints'; + return opts; + } + }, { + key: "bubble", + value: function bubble() { + return { + dataLabels: { + style: { + colors: ['#fff'] + } + }, + tooltip: { + shared: false, + intersect: true + }, + xaxis: { + crosshairs: { + width: 0 + } + }, + fill: { + type: 'solid', + gradient: { + shade: 'light', + inverse: true, + shadeIntensity: 0.55, + opacityFrom: 0.4, + opacityTo: 0.8 + } + } + }; + } + }, { + key: "scatter", + value: function scatter() { + return { + dataLabels: { + enabled: false + }, + tooltip: { + shared: false, + intersect: true + }, + markers: { + size: 6, + strokeWidth: 1, + hover: { + sizeOffset: 2 + } + } + }; + } + }, { + key: "heatmap", + value: function heatmap() { + return { + chart: { + stacked: false + }, + fill: { + opacity: 1 + }, + dataLabels: { + style: { + colors: ['#fff'] + } + }, + stroke: { + colors: ['#fff'] + }, + tooltip: { + followCursor: true, + marker: { + show: false + }, + x: { + show: false + } + }, + legend: { + position: 'top', + markers: { + shape: 'square' + } + }, + grid: { + padding: { + right: 20 + } + } + }; + } + }, { + key: "treemap", + value: function treemap() { + return { + chart: { + zoom: { + enabled: false + } + }, + dataLabels: { + style: { + fontSize: 14, + fontWeight: 600, + colors: ['#fff'] + } + }, + stroke: { + show: true, + width: 2, + colors: ['#fff'] + }, + legend: { + show: false + }, + fill: { + opacity: 1, + gradient: { + stops: [0, 100] + } + }, + tooltip: { + followCursor: true, + x: { + show: false + } + }, + grid: { + padding: { + left: 0, + right: 0 + } + }, + xaxis: { + crosshairs: { + show: false + }, + tooltip: { + enabled: false + } + } + }; + } + }, { + key: "pie", + value: function pie() { + return { + chart: { + toolbar: { + show: false + } + }, + plotOptions: { + pie: { + donut: { + labels: { + show: false + } + } + } + }, + dataLabels: { + formatter: function formatter(val) { + return val.toFixed(1) + '%'; + }, + style: { + colors: ['#fff'] + }, + background: { + enabled: false + }, + dropShadow: { + enabled: true + } + }, + stroke: { + colors: ['#fff'] + }, + fill: { + opacity: 1, + gradient: { + shade: 'light', + stops: [0, 100] + } + }, + tooltip: { + theme: 'dark', + fillSeriesColor: true + }, + legend: { + position: 'right' + }, + grid: { + padding: { + left: 0, + right: 0, + top: 0, + bottom: 0 + } + } + }; + } + }, { + key: "donut", + value: function donut() { + return { + chart: { + toolbar: { + show: false + } + }, + dataLabels: { + formatter: function formatter(val) { + return val.toFixed(1) + '%'; + }, + style: { + colors: ['#fff'] + }, + background: { + enabled: false + }, + dropShadow: { + enabled: true + } + }, + stroke: { + colors: ['#fff'] + }, + fill: { + opacity: 1, + gradient: { + shade: 'light', + shadeIntensity: 0.35, + stops: [80, 100], + opacityFrom: 1, + opacityTo: 1 + } + }, + tooltip: { + theme: 'dark', + fillSeriesColor: true + }, + legend: { + position: 'right' + }, + grid: { + padding: { + left: 0, + right: 0, + top: 0, + bottom: 0 + } + } + }; + } + }, { + key: "polarArea", + value: function polarArea() { + return { + chart: { + toolbar: { + show: false + } + }, + dataLabels: { + formatter: function formatter(val) { + return val.toFixed(1) + '%'; + }, + enabled: false + }, + stroke: { + show: true, + width: 2 + }, + fill: { + opacity: 0.7 + }, + tooltip: { + theme: 'dark', + fillSeriesColor: true + }, + legend: { + position: 'right' + }, + grid: { + padding: { + left: 0, + right: 0, + top: 0, + bottom: 0 + } + } + }; + } + }, { + key: "radar", + value: function radar() { + this.opts.yaxis[0].labels.offsetY = this.opts.yaxis[0].labels.offsetY ? this.opts.yaxis[0].labels.offsetY : 6; + return { + dataLabels: { + enabled: false, + style: { + fontSize: '11px' + } + }, + stroke: { + width: 2 + }, + markers: { + size: 5, + strokeWidth: 1, + strokeOpacity: 1 + }, + fill: { + opacity: 0.2 + }, + tooltip: { + shared: false, + intersect: true, + followCursor: true + }, + grid: { + show: false, + padding: { + left: 0, + right: 0, + top: 0, + bottom: 0 + } + }, + xaxis: { + labels: { + formatter: function formatter(val) { + return val; + }, + style: { + colors: ['#a8a8a8'], + fontSize: '11px' + } + }, + tooltip: { + enabled: false + }, + crosshairs: { + show: false + } + } + }; + } + }, { + key: "radialBar", + value: function radialBar() { + return { + chart: { + animations: { + dynamicAnimation: { + enabled: true, + speed: 800 + } + }, + toolbar: { + show: false + } + }, + fill: { + gradient: { + shade: 'dark', + shadeIntensity: 0.4, + inverseColors: false, + type: 'diagonal2', + opacityFrom: 1, + opacityTo: 1, + stops: [70, 98, 100] + } + }, + legend: { + show: false, + position: 'right' + }, + tooltip: { + enabled: false, + fillSeriesColor: true + }, + grid: { + padding: { + left: 0, + right: 0, + top: 0, + bottom: 0 + } + } + }; + } + }, { + key: "_getBoxTooltip", + value: function _getBoxTooltip(w, seriesIndex, dataPointIndex, labels, chartType) { + var o = w.globals.seriesCandleO[seriesIndex][dataPointIndex]; + var h = w.globals.seriesCandleH[seriesIndex][dataPointIndex]; + var m = w.globals.seriesCandleM[seriesIndex][dataPointIndex]; + var l = w.globals.seriesCandleL[seriesIndex][dataPointIndex]; + var c = w.globals.seriesCandleC[seriesIndex][dataPointIndex]; + if (w.config.series[seriesIndex].type && w.config.series[seriesIndex].type !== chartType) { + return "
\n ".concat(w.config.series[seriesIndex].name ? w.config.series[seriesIndex].name : 'series-' + (seriesIndex + 1), ": ").concat(w.globals.series[seriesIndex][dataPointIndex], "\n
"); + } else { + return "
") + "
".concat(labels[0], ": ") + o + '
' + "
".concat(labels[1], ": ") + h + '
' + (m ? "
".concat(labels[2], ": ") + m + '
' : '') + "
".concat(labels[3], ": ") + l + '
' + "
".concat(labels[4], ": ") + c + '
' + '
'; + } + } + }]); + return Defaults; + }(); + + /** + * ApexCharts Config Class for extending user options with pre-defined ApexCharts config. + * + * @module Config + **/ + var Config = /*#__PURE__*/function () { + function Config(opts) { + _classCallCheck(this, Config); + this.opts = opts; + } + _createClass(Config, [{ + key: "init", + value: function init(_ref) { + var responsiveOverride = _ref.responsiveOverride; + var opts = this.opts; + var options = new Options(); + var defaults = new Defaults(opts); + this.chartType = opts.chart.type; + opts = this.extendYAxis(opts); + opts = this.extendAnnotations(opts); + var config = options.init(); + var newDefaults = {}; + if (opts && _typeof(opts) === 'object') { + var _opts$plotOptions, _opts$plotOptions$bar, _opts$chart$brush, _opts$plotOptions2, _opts$plotOptions2$li, _opts$plotOptions3, _opts$plotOptions3$ba, _opts$chart$sparkline, _window$Apex$chart, _window$Apex$chart$sp; + var chartDefaults = {}; + var chartTypes = ['line', 'area', 'bar', 'candlestick', 'boxPlot', 'rangeBar', 'rangeArea', 'bubble', 'scatter', 'heatmap', 'treemap', 'pie', 'polarArea', 'donut', 'radar', 'radialBar']; + if (chartTypes.indexOf(opts.chart.type) !== -1) { + chartDefaults = defaults[opts.chart.type](); + } else { + chartDefaults = defaults.line(); + } + if ((_opts$plotOptions = opts.plotOptions) !== null && _opts$plotOptions !== void 0 && (_opts$plotOptions$bar = _opts$plotOptions.bar) !== null && _opts$plotOptions$bar !== void 0 && _opts$plotOptions$bar.isFunnel) { + chartDefaults = defaults.funnel(); + } + if (opts.chart.stacked && opts.chart.type === 'bar') { + chartDefaults = defaults.stackedBars(); + } + if ((_opts$chart$brush = opts.chart.brush) !== null && _opts$chart$brush !== void 0 && _opts$chart$brush.enabled) { + chartDefaults = defaults.brush(chartDefaults); + } + if ((_opts$plotOptions2 = opts.plotOptions) !== null && _opts$plotOptions2 !== void 0 && (_opts$plotOptions2$li = _opts$plotOptions2.line) !== null && _opts$plotOptions2$li !== void 0 && _opts$plotOptions2$li.isSlopeChart) { + chartDefaults = defaults.slope(); + } + if (opts.chart.stacked && opts.chart.stackType === '100%') { + opts = defaults.stacked100(opts); + } + if ((_opts$plotOptions3 = opts.plotOptions) !== null && _opts$plotOptions3 !== void 0 && (_opts$plotOptions3$ba = _opts$plotOptions3.bar) !== null && _opts$plotOptions3$ba !== void 0 && _opts$plotOptions3$ba.isDumbbell) { + opts = defaults.dumbbell(opts); + } + + // If user has specified a dark theme, make the tooltip dark too + this.checkForDarkTheme(window.Apex); // check global window Apex options + this.checkForDarkTheme(opts); // check locally passed options + + opts.xaxis = opts.xaxis || window.Apex.xaxis || {}; + + // an important boolean needs to be set here + // otherwise all the charts will have this flag set to true window.Apex.xaxis is set globally + if (!responsiveOverride) { + opts.xaxis.convertedCatToNumeric = false; + } + opts = this.checkForCatToNumericXAxis(this.chartType, chartDefaults, opts); + if ((_opts$chart$sparkline = opts.chart.sparkline) !== null && _opts$chart$sparkline !== void 0 && _opts$chart$sparkline.enabled || (_window$Apex$chart = window.Apex.chart) !== null && _window$Apex$chart !== void 0 && (_window$Apex$chart$sp = _window$Apex$chart.sparkline) !== null && _window$Apex$chart$sp !== void 0 && _window$Apex$chart$sp.enabled) { + chartDefaults = defaults.sparkline(chartDefaults); + } + newDefaults = Utils$1.extend(config, chartDefaults); + } + + // config should cascade in this fashion + // default-config < global-apex-variable-config < user-defined-config + + // get GLOBALLY defined options and merge with the default config + var mergedWithDefaultConfig = Utils$1.extend(newDefaults, window.Apex); + + // get the merged config and extend with user defined config + config = Utils$1.extend(mergedWithDefaultConfig, opts); + + // some features are not supported. those mismatches should be handled + config = this.handleUserInputErrors(config); + return config; + } + }, { + key: "checkForCatToNumericXAxis", + value: function checkForCatToNumericXAxis(chartType, chartDefaults, opts) { + var _opts$plotOptions4, _opts$plotOptions4$ba; + var defaults = new Defaults(opts); + var isBarHorizontal = (chartType === 'bar' || chartType === 'boxPlot') && ((_opts$plotOptions4 = opts.plotOptions) === null || _opts$plotOptions4 === void 0 ? void 0 : (_opts$plotOptions4$ba = _opts$plotOptions4.bar) === null || _opts$plotOptions4$ba === void 0 ? void 0 : _opts$plotOptions4$ba.horizontal); + var unsupportedZoom = chartType === 'pie' || chartType === 'polarArea' || chartType === 'donut' || chartType === 'radar' || chartType === 'radialBar' || chartType === 'heatmap'; + var notNumericXAxis = opts.xaxis.type !== 'datetime' && opts.xaxis.type !== 'numeric'; + var tickPlacement = opts.xaxis.tickPlacement ? opts.xaxis.tickPlacement : chartDefaults.xaxis && chartDefaults.xaxis.tickPlacement; + if (!isBarHorizontal && !unsupportedZoom && notNumericXAxis && tickPlacement !== 'between') { + opts = defaults.convertCatToNumeric(opts); + } + return opts; + } + }, { + key: "extendYAxis", + value: function extendYAxis(opts, w) { + var options = new Options(); + if (typeof opts.yaxis === 'undefined' || !opts.yaxis || Array.isArray(opts.yaxis) && opts.yaxis.length === 0) { + opts.yaxis = {}; + } + + // extend global yaxis config (only if object is provided / not an array) + if (opts.yaxis.constructor !== Array && window.Apex.yaxis && window.Apex.yaxis.constructor !== Array) { + opts.yaxis = Utils$1.extend(opts.yaxis, window.Apex.yaxis); + } + + // as we can't extend nested object's array with extend, we need to do it first + // user can provide either an array or object in yaxis config + if (opts.yaxis.constructor !== Array) { + // convert the yaxis to array if user supplied object + opts.yaxis = [Utils$1.extend(options.yAxis, opts.yaxis)]; + } else { + opts.yaxis = Utils$1.extendArray(opts.yaxis, options.yAxis); + } + var isLogY = false; + opts.yaxis.forEach(function (y) { + if (y.logarithmic) { + isLogY = true; + } + }); + var series = opts.series; + if (w && !series) { + series = w.config.series; + } + + // A logarithmic chart works correctly when each series has a corresponding y-axis + // If this is not the case, we manually create yaxis for multi-series log chart + if (isLogY && series.length !== opts.yaxis.length && series.length) { + opts.yaxis = series.map(function (s, i) { + if (!s.name) { + series[i].name = "series-".concat(i + 1); + } + if (opts.yaxis[i]) { + opts.yaxis[i].seriesName = series[i].name; + return opts.yaxis[i]; + } else { + var newYaxis = Utils$1.extend(options.yAxis, opts.yaxis[0]); + newYaxis.show = false; + return newYaxis; + } + }); + } + if (isLogY && series.length > 1 && series.length !== opts.yaxis.length) { + console.warn('A multi-series logarithmic chart should have equal number of series and y-axes'); + } + return opts; + } + + // annotations also accepts array, so we need to extend them manually + }, { + key: "extendAnnotations", + value: function extendAnnotations(opts) { + if (typeof opts.annotations === 'undefined') { + opts.annotations = {}; + opts.annotations.yaxis = []; + opts.annotations.xaxis = []; + opts.annotations.points = []; + } + opts = this.extendYAxisAnnotations(opts); + opts = this.extendXAxisAnnotations(opts); + opts = this.extendPointAnnotations(opts); + return opts; + } + }, { + key: "extendYAxisAnnotations", + value: function extendYAxisAnnotations(opts) { + var options = new Options(); + opts.annotations.yaxis = Utils$1.extendArray(typeof opts.annotations.yaxis !== 'undefined' ? opts.annotations.yaxis : [], options.yAxisAnnotation); + return opts; + } + }, { + key: "extendXAxisAnnotations", + value: function extendXAxisAnnotations(opts) { + var options = new Options(); + opts.annotations.xaxis = Utils$1.extendArray(typeof opts.annotations.xaxis !== 'undefined' ? opts.annotations.xaxis : [], options.xAxisAnnotation); + return opts; + } + }, { + key: "extendPointAnnotations", + value: function extendPointAnnotations(opts) { + var options = new Options(); + opts.annotations.points = Utils$1.extendArray(typeof opts.annotations.points !== 'undefined' ? opts.annotations.points : [], options.pointAnnotation); + return opts; + } + }, { + key: "checkForDarkTheme", + value: function checkForDarkTheme(opts) { + if (opts.theme && opts.theme.mode === 'dark') { + if (!opts.tooltip) { + opts.tooltip = {}; + } + if (opts.tooltip.theme !== 'light') { + opts.tooltip.theme = 'dark'; + } + if (!opts.chart.foreColor) { + opts.chart.foreColor = '#f6f7f8'; + } + if (!opts.theme.palette) { + opts.theme.palette = 'palette4'; + } + } + } + }, { + key: "handleUserInputErrors", + value: function handleUserInputErrors(opts) { + var config = opts; + // conflicting tooltip option. intersect makes sure to focus on 1 point at a time. Shared cannot be used along with it + if (config.tooltip.shared && config.tooltip.intersect) { + throw new Error('tooltip.shared cannot be enabled when tooltip.intersect is true. Turn off any other option by setting it to false.'); + } + if (config.chart.type === 'bar' && config.plotOptions.bar.horizontal) { + // No multiple yaxis for bars + if (config.yaxis.length > 1) { + throw new Error('Multiple Y Axis for bars are not supported. Switch to column chart by setting plotOptions.bar.horizontal=false'); + } + + // if yaxis is reversed in horizontal bar chart, you should draw the y-axis on right side + if (config.yaxis[0].reversed) { + config.yaxis[0].opposite = true; + } + config.xaxis.tooltip.enabled = false; // no xaxis tooltip for horizontal bar + config.yaxis[0].tooltip.enabled = false; // no xaxis tooltip for horizontal bar + config.chart.zoom.enabled = false; // no zooming for horz bars + } + if (config.chart.type === 'bar' || config.chart.type === 'rangeBar') { + if (config.tooltip.shared) { + if (config.xaxis.crosshairs.width === 'barWidth' && config.series.length > 1) { + config.xaxis.crosshairs.width = 'tickWidth'; + } + } + } + if (config.chart.type === 'candlestick' || config.chart.type === 'boxPlot') { + if (config.yaxis[0].reversed) { + console.warn("Reversed y-axis in ".concat(config.chart.type, " chart is not supported.")); + config.yaxis[0].reversed = false; + } + } + return config; + } + }]); + return Config; + }(); + + var Globals = /*#__PURE__*/function () { + function Globals() { + _classCallCheck(this, Globals); + } + _createClass(Globals, [{ + key: "initGlobalVars", + value: function initGlobalVars(gl) { + gl.series = []; // the MAIN series array (y values) + gl.seriesCandleO = []; + gl.seriesCandleH = []; + gl.seriesCandleM = []; + gl.seriesCandleL = []; + gl.seriesCandleC = []; + gl.seriesRangeStart = []; + gl.seriesRangeEnd = []; + gl.seriesRange = []; + gl.seriesPercent = []; + gl.seriesGoals = []; + gl.seriesX = []; + gl.seriesZ = []; + gl.seriesNames = []; + gl.seriesTotals = []; + gl.seriesLog = []; + gl.seriesColors = []; + gl.stackedSeriesTotals = []; + gl.seriesXvalues = []; // we will need this in tooltip (it's x position) + // when we will have unequal x values, we will need + // some way to get x value depending on mouse pointer + gl.seriesYvalues = []; // we will need this when deciding which series + // user hovered on + gl.labels = []; + gl.hasXaxisGroups = false; + gl.groups = []; + gl.barGroups = []; + gl.lineGroups = []; + gl.areaGroups = []; + gl.hasSeriesGroups = false; + gl.seriesGroups = []; + gl.categoryLabels = []; + gl.timescaleLabels = []; + gl.noLabelsProvided = false; + gl.resizeTimer = null; + gl.selectionResizeTimer = null; + gl.lastWheelExecution = 0; + gl.delayedElements = []; + gl.pointsArray = []; + gl.dataLabelsRects = []; + gl.isXNumeric = false; + gl.skipLastTimelinelabel = false; + gl.skipFirstTimelinelabel = false; + gl.isDataXYZ = false; + gl.isMultiLineX = false; + gl.isMultipleYAxis = false; + gl.maxY = -Number.MAX_VALUE; + gl.minY = Number.MIN_VALUE; + gl.minYArr = []; + gl.maxYArr = []; + gl.maxX = -Number.MAX_VALUE; + gl.minX = Number.MAX_VALUE; + gl.initialMaxX = -Number.MAX_VALUE; + gl.initialMinX = Number.MAX_VALUE; + gl.maxDate = 0; + gl.minDate = Number.MAX_VALUE; + gl.minZ = Number.MAX_VALUE; + gl.maxZ = -Number.MAX_VALUE; + gl.minXDiff = Number.MAX_VALUE; + gl.yAxisScale = []; + gl.xAxisScale = null; + gl.xAxisTicksPositions = []; + gl.yLabelsCoords = []; + gl.yTitleCoords = []; + gl.barPadForNumericAxis = 0; + gl.padHorizontal = 0; + gl.xRange = 0; + gl.yRange = []; + gl.zRange = 0; + gl.dataPoints = 0; + gl.xTickAmount = 0; + gl.multiAxisTickAmount = 0; + } + }, { + key: "globalVars", + value: function globalVars(config) { + return { + chartID: null, + // chart ID - apexcharts-cuid + cuid: null, + // chart ID - random numbers excluding "apexcharts" part + events: { + beforeMount: [], + mounted: [], + updated: [], + clicked: [], + selection: [], + dataPointSelection: [], + zoomed: [], + scrolled: [] + }, + colors: [], + clientX: null, + clientY: null, + fill: { + colors: [] + }, + stroke: { + colors: [] + }, + dataLabels: { + style: { + colors: [] + } + }, + radarPolygons: { + fill: { + colors: [] + } + }, + markers: { + colors: [], + size: config.markers.size, + largestSize: 0 + }, + animationEnded: false, + isTouchDevice: 'ontouchstart' in window || navigator.msMaxTouchPoints, + isDirty: false, + // chart has been updated after the initial render. This is different than dataChanged property. isDirty means user manually called some method to update + isExecCalled: false, + // whether user updated the chart through the exec method + initialConfig: null, + // we will store the first config user has set to go back when user finishes interactions like zooming and come out of it + initialSeries: [], + lastXAxis: [], + lastYAxis: [], + columnSeries: null, + labels: [], + // store the text to draw on x axis + // Don't mutate the labels, many things including tooltips depends on it! + timescaleLabels: [], + // store the timescaleLabels Labels in another variable + noLabelsProvided: false, + // if user didn't provide any categories/labels or x values, fallback to 1,2,3,4... + allSeriesCollapsed: false, + collapsedSeries: [], + // when user collapses a series, it goes into this array + collapsedSeriesIndices: [], + // this stores the index of the collapsedSeries instead of whole object for quick access + ancillaryCollapsedSeries: [], + // when user collapses an "alwaysVisible" series, it goes into this array + ancillaryCollapsedSeriesIndices: [], + // this stores the index of the ancillaryCollapsedSeries whose y-axis is always visible + risingSeries: [], + // when user re-opens a collapsed series, it goes here + dataFormatXNumeric: false, + // boolean value to indicate user has passed numeric x values + capturedSeriesIndex: -1, + capturedDataPointIndex: -1, + selectedDataPoints: [], + invalidLogScale: false, + // if a user enabled log scale but the data provided is not valid to generate a log scale, turn on this flag + ignoreYAxisIndexes: [], + // when series are being collapsed in multiple y axes, ignore certain index + maxValsInArrayIndex: 0, + radialSize: 0, + selection: undefined, + zoomEnabled: config.chart.toolbar.autoSelected === 'zoom' && config.chart.toolbar.tools.zoom && config.chart.zoom.enabled, + panEnabled: config.chart.toolbar.autoSelected === 'pan' && config.chart.toolbar.tools.pan, + selectionEnabled: config.chart.toolbar.autoSelected === 'selection' && config.chart.toolbar.tools.selection, + yaxis: null, + mousedown: false, + lastClientPosition: {}, + // don't reset this variable this the chart is destroyed. It is used to detect right or left mousemove in panning + visibleXRange: undefined, + yValueDecimal: 0, + // are there floating numbers in the series. If yes, this represent the len of the decimals + total: 0, + SVGNS: 'http://www.w3.org/2000/svg', + // svg namespace + svgWidth: 0, + // the whole svg width + svgHeight: 0, + // the whole svg height + noData: false, + // whether there is any data to display or not + locale: {}, + // the current locale values will be preserved here for global access + dom: {}, + // for storing all dom nodes in this particular property + memory: { + methodsToExec: [] + }, + shouldAnimate: true, + skipLastTimelinelabel: false, + // when last label is cropped, skip drawing it + skipFirstTimelinelabel: false, + // when first label is cropped, skip drawing it + delayedElements: [], + // element which appear after animation has finished + axisCharts: true, + // chart type = line or area or bar + // (refer them also as plot charts in the code) + isDataXYZ: false, + // bool: data was provided in a {[x,y,z]} pattern + isSlopeChart: config.plotOptions.line.isSlopeChart, + resized: false, + // bool: user has resized + resizeTimer: null, + // timeout function to make a small delay before + // drawing when user resized + comboCharts: false, + // bool: whether it's a combination of line/column + dataChanged: false, + // bool: has data changed dynamically + previousPaths: [], + // array: when data is changed, it will animate from + // previous paths + allSeriesHasEqualX: true, + pointsArray: [], + // store the points positions here to draw later on hover + // format is - [[x,y],[x,y]... [x,y]] + dataLabelsRects: [], + // store the positions of datalabels to prevent collision + lastDrawnDataLabelsIndexes: [], + hasNullValues: false, + // bool: whether series contains null values + zoomed: false, + // whether user has zoomed or not + gridWidth: 0, + // drawable width of actual graphs (series paths) + gridHeight: 0, + // drawable height of actual graphs (series paths) + rotateXLabels: false, + defaultLabels: false, + xLabelFormatter: undefined, + // formatter for x axis labels + yLabelFormatters: [], + xaxisTooltipFormatter: undefined, + // formatter for x axis tooltip + ttKeyFormatter: undefined, + ttVal: undefined, + ttZFormatter: undefined, + LINE_HEIGHT_RATIO: 1.618, + xAxisLabelsHeight: 0, + xAxisGroupLabelsHeight: 0, + xAxisLabelsWidth: 0, + yAxisLabelsWidth: 0, + scaleX: 1, + scaleY: 1, + translateX: 0, + translateY: 0, + translateYAxisX: [], + yAxisWidths: [], + translateXAxisY: 0, + translateXAxisX: 0, + tooltip: null, + // Rules for niceScaleAllowedMagMsd: + // 1) An array of two arrays only ([[],[]]): + // * array[0][]: influences labelling of data series that contain only integers + // - must contain only integers (or expect ugly ticks) + // * array[1][]: influences labelling of data series that contain at least one float + // - may contain floats + // * both arrays: + // - each array[][i] ideally satisfy: 10 mod array[][i] == 0 (or expect ugly ticks) + // - to avoid clipping data point keep each array[][i] >= i + // 2) each array[i][] contains 11 values, for all possible index values 0..10. + // array[][0] should not be needed (not proven) but ensures non-zero is returned. + // + // Users can effectively force their preferred "magMsd" through stepSize and + // forceNiceScale. With forceNiceScale: true, stepSize becomes normalizable to the + // axis's min..max range, which allows users to set stepSize to an integer 1..10, for + // example, stepSize: 3. This value will be preferred to the value determined through + // this array. The range-normalized value is checked for consistency with other + // user defined options and will be ignored if inconsistent. + niceScaleAllowedMagMsd: [[1, 1, 2, 5, 5, 5, 10, 10, 10, 10, 10], [1, 1, 2, 5, 5, 5, 10, 10, 10, 10, 10]], + // Default ticks based on SVG size. These values have high numbers + // of divisors. The array is indexed using a calculated maxTicks value + // divided by 2 simply to halve the array size. See Scales.niceScale(). + niceScaleDefaultTicks: [1, 2, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 12, 12, 12, 12, 12, 12, 12, 12, 12, 24], + seriesYAxisMap: [], + // Given yAxis index, return all series indices belonging to it. Multiple series can be referenced to each yAxis. + seriesYAxisReverseMap: [] // Given a Series index, return its yAxis index. + }; + } + }, { + key: "init", + value: function init(config) { + var globals = this.globalVars(config); + this.initGlobalVars(globals); + globals.initialConfig = Utils$1.extend({}, config); + globals.initialSeries = Utils$1.clone(config.series); + globals.lastXAxis = Utils$1.clone(globals.initialConfig.xaxis); + globals.lastYAxis = Utils$1.clone(globals.initialConfig.yaxis); + return globals; + } + }]); + return Globals; + }(); + + /** + * ApexCharts Base Class for extending user options with pre-defined ApexCharts config. + * + * @module Base + **/ + var Base = /*#__PURE__*/function () { + function Base(opts) { + _classCallCheck(this, Base); + this.opts = opts; + } + _createClass(Base, [{ + key: "init", + value: function init() { + var config = new Config(this.opts).init({ + responsiveOverride: false + }); + var globals = new Globals().init(config); + var w = { + config: config, + globals: globals + }; + return w; + } + }]); + return Base; + }(); + + /** + * ApexCharts Fill Class for setting fill options of the paths. + * + * @module Fill + **/ + var Fill = /*#__PURE__*/function () { + function Fill(ctx) { + _classCallCheck(this, Fill); + this.ctx = ctx; + this.w = ctx.w; + this.opts = null; + this.seriesIndex = 0; + this.patternIDs = []; + } + _createClass(Fill, [{ + key: "clippedImgArea", + value: function clippedImgArea(params) { + var w = this.w; + var cnf = w.config; + var svgW = parseInt(w.globals.gridWidth, 10); + var svgH = parseInt(w.globals.gridHeight, 10); + var size = svgW > svgH ? svgW : svgH; + var fillImg = params.image; + var imgWidth = 0; + var imgHeight = 0; + if (typeof params.width === 'undefined' && typeof params.height === 'undefined') { + if (cnf.fill.image.width !== undefined && cnf.fill.image.height !== undefined) { + imgWidth = cnf.fill.image.width + 1; + imgHeight = cnf.fill.image.height; + } else { + imgWidth = size + 1; + imgHeight = size; + } + } else { + imgWidth = params.width; + imgHeight = params.height; + } + var elPattern = document.createElementNS(w.globals.SVGNS, 'pattern'); + Graphics.setAttrs(elPattern, { + id: params.patternID, + patternUnits: params.patternUnits ? params.patternUnits : 'userSpaceOnUse', + width: imgWidth + 'px', + height: imgHeight + 'px' + }); + var elImage = document.createElementNS(w.globals.SVGNS, 'image'); + elPattern.appendChild(elImage); + elImage.setAttributeNS(window.SVG.xlink, 'href', fillImg); + Graphics.setAttrs(elImage, { + x: 0, + y: 0, + preserveAspectRatio: 'none', + width: imgWidth + 'px', + height: imgHeight + 'px' + }); + elImage.style.opacity = params.opacity; + w.globals.dom.elDefs.node.appendChild(elPattern); + } + }, { + key: "getSeriesIndex", + value: function getSeriesIndex(opts) { + var w = this.w; + var cType = w.config.chart.type; + if ((cType === 'bar' || cType === 'rangeBar') && w.config.plotOptions.bar.distributed || cType === 'heatmap' || cType === 'treemap') { + this.seriesIndex = opts.seriesNumber; + } else { + this.seriesIndex = opts.seriesNumber % w.globals.series.length; + } + return this.seriesIndex; + } + }, { + key: "computeColorStops", + value: function computeColorStops(data, multiColorConfig) { + var w = this.w; + var maxPositive = null; + var minNegative = null; + var _iterator = _createForOfIteratorHelper(data), + _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var value = _step.value; + if (value >= multiColorConfig.threshold) { + if (maxPositive === null || value > maxPositive) { + maxPositive = value; + } + } else { + if (minNegative === null || value < minNegative) { + minNegative = value; + } + } + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + if (maxPositive === null) { + maxPositive = multiColorConfig.threshold; + } + if (minNegative === null) { + minNegative = multiColorConfig.threshold; + } + var totalRange = maxPositive - multiColorConfig.threshold + (multiColorConfig.threshold - minNegative); + if (totalRange === 0) { + totalRange = 1; + } + var negativePercentage = (multiColorConfig.threshold - minNegative) / totalRange * 100; + var offset = 100 - negativePercentage; + offset = Math.max(0, Math.min(offset, 100)); + return [{ + offset: offset, + color: multiColorConfig.colorAboveThreshold, + opacity: w.config.fill.opacity + }, { + offset: 0, + color: multiColorConfig.colorBelowThreshold, + opacity: w.config.fill.opacity + }]; + } + }, { + key: "fillPath", + value: function fillPath(opts) { + var _w$config$series$this, _w$config$series$this2, _w$config$series$this3; + var w = this.w; + this.opts = opts; + var cnf = this.w.config; + var pathFill; + var patternFill, gradientFill; + this.seriesIndex = this.getSeriesIndex(opts); + var drawMultiColorLine = cnf.plotOptions.line.colors.colorAboveThreshold && cnf.plotOptions.line.colors.colorBelowThreshold; + var fillColors = this.getFillColors(); + var fillColor = fillColors[this.seriesIndex]; + + //override fillcolor if user inputted color with data + if (w.globals.seriesColors[this.seriesIndex] !== undefined) { + fillColor = w.globals.seriesColors[this.seriesIndex]; + } + if (typeof fillColor === 'function') { + fillColor = fillColor({ + seriesIndex: this.seriesIndex, + dataPointIndex: opts.dataPointIndex, + value: opts.value, + w: w + }); + } + var fillType = opts.fillType ? opts.fillType : this.getFillType(this.seriesIndex); + var fillOpacity = Array.isArray(cnf.fill.opacity) ? cnf.fill.opacity[this.seriesIndex] : cnf.fill.opacity; + + // when line colors needs to be different based on values, we use gradient config to achieve this + var useGradient = fillType === 'gradient' || drawMultiColorLine; + if (opts.color) { + fillColor = opts.color; + } + if ((_w$config$series$this = w.config.series[this.seriesIndex]) !== null && _w$config$series$this !== void 0 && (_w$config$series$this2 = _w$config$series$this.data) !== null && _w$config$series$this2 !== void 0 && (_w$config$series$this3 = _w$config$series$this2[opts.dataPointIndex]) !== null && _w$config$series$this3 !== void 0 && _w$config$series$this3.fillColor) { + var _w$config$series$this4, _w$config$series$this5, _w$config$series$this6; + fillColor = (_w$config$series$this4 = w.config.series[this.seriesIndex]) === null || _w$config$series$this4 === void 0 ? void 0 : (_w$config$series$this5 = _w$config$series$this4.data) === null || _w$config$series$this5 === void 0 ? void 0 : (_w$config$series$this6 = _w$config$series$this5[opts.dataPointIndex]) === null || _w$config$series$this6 === void 0 ? void 0 : _w$config$series$this6.fillColor; + } + + // in case a color is undefined, fallback to white color to prevent runtime error + if (!fillColor) { + fillColor = '#fff'; + console.warn('undefined color - ApexCharts'); + } + var defaultColor = fillColor; + if (fillColor.indexOf('rgb') === -1) { + if (fillColor.indexOf('#') === -1) { + defaultColor = fillColor; + } else if (fillColor.length < 9) { + // if the hex contains alpha and is of 9 digit, skip the opacity + defaultColor = Utils$1.hexToRgba(fillColor, fillOpacity); + } + } else { + if (fillColor.indexOf('rgba') > -1) { + fillOpacity = Utils$1.getOpacityFromRGBA(fillColor); + } else { + defaultColor = Utils$1.hexToRgba(Utils$1.rgb2hex(fillColor), fillOpacity); + } + } + if (opts.opacity) fillOpacity = opts.opacity; + if (fillType === 'pattern') { + patternFill = this.handlePatternFill({ + fillConfig: opts.fillConfig, + patternFill: patternFill, + fillColor: fillColor, + fillOpacity: fillOpacity, + defaultColor: defaultColor + }); + } + if (useGradient) { + var colorStops = _toConsumableArray(cnf.fill.gradient.colorStops) || []; + var type = cnf.fill.gradient.type; + if (drawMultiColorLine) { + colorStops[this.seriesIndex] = this.computeColorStops(w.globals.series[this.seriesIndex], cnf.plotOptions.line.colors); + type = 'vertical'; + } + gradientFill = this.handleGradientFill({ + type: type, + fillConfig: opts.fillConfig, + fillColor: fillColor, + fillOpacity: fillOpacity, + colorStops: colorStops, + i: this.seriesIndex + }); + } + if (fillType === 'image') { + var imgSrc = cnf.fill.image.src; + var patternID = opts.patternID ? opts.patternID : ''; + var patternKey = "pattern".concat(w.globals.cuid).concat(opts.seriesNumber + 1).concat(patternID); + if (this.patternIDs.indexOf(patternKey) === -1) { + this.clippedImgArea({ + opacity: fillOpacity, + image: Array.isArray(imgSrc) ? opts.seriesNumber < imgSrc.length ? imgSrc[opts.seriesNumber] : imgSrc[0] : imgSrc, + width: opts.width ? opts.width : undefined, + height: opts.height ? opts.height : undefined, + patternUnits: opts.patternUnits, + patternID: patternKey + }); + this.patternIDs.push(patternKey); + } + pathFill = "url(#".concat(patternKey, ")"); + } else if (useGradient) { + pathFill = gradientFill; + } else if (fillType === 'pattern') { + pathFill = patternFill; + } else { + pathFill = defaultColor; + } + + // override pattern/gradient if opts.solid is true + if (opts.solid) { + pathFill = defaultColor; + } + return pathFill; + } + }, { + key: "getFillType", + value: function getFillType(seriesIndex) { + var w = this.w; + if (Array.isArray(w.config.fill.type)) { + return w.config.fill.type[seriesIndex]; + } else { + return w.config.fill.type; + } + } + }, { + key: "getFillColors", + value: function getFillColors() { + var w = this.w; + var cnf = w.config; + var opts = this.opts; + var fillColors = []; + if (w.globals.comboCharts) { + if (w.config.series[this.seriesIndex].type === 'line') { + if (Array.isArray(w.globals.stroke.colors)) { + fillColors = w.globals.stroke.colors; + } else { + fillColors.push(w.globals.stroke.colors); + } + } else { + if (Array.isArray(w.globals.fill.colors)) { + fillColors = w.globals.fill.colors; + } else { + fillColors.push(w.globals.fill.colors); + } + } + } else { + if (cnf.chart.type === 'line') { + if (Array.isArray(w.globals.stroke.colors)) { + fillColors = w.globals.stroke.colors; + } else { + fillColors.push(w.globals.stroke.colors); + } + } else { + if (Array.isArray(w.globals.fill.colors)) { + fillColors = w.globals.fill.colors; + } else { + fillColors.push(w.globals.fill.colors); + } + } + } + + // colors passed in arguments + if (typeof opts.fillColors !== 'undefined') { + fillColors = []; + if (Array.isArray(opts.fillColors)) { + fillColors = opts.fillColors.slice(); + } else { + fillColors.push(opts.fillColors); + } + } + return fillColors; + } + }, { + key: "handlePatternFill", + value: function handlePatternFill(_ref) { + var fillConfig = _ref.fillConfig, + patternFill = _ref.patternFill, + fillColor = _ref.fillColor, + fillOpacity = _ref.fillOpacity, + defaultColor = _ref.defaultColor; + var fillCnf = this.w.config.fill; + if (fillConfig) { + fillCnf = fillConfig; + } + var opts = this.opts; + var graphics = new Graphics(this.ctx); + var patternStrokeWidth = Array.isArray(fillCnf.pattern.strokeWidth) ? fillCnf.pattern.strokeWidth[this.seriesIndex] : fillCnf.pattern.strokeWidth; + var patternLineColor = fillColor; + if (Array.isArray(fillCnf.pattern.style)) { + if (typeof fillCnf.pattern.style[opts.seriesNumber] !== 'undefined') { + var pf = graphics.drawPattern(fillCnf.pattern.style[opts.seriesNumber], fillCnf.pattern.width, fillCnf.pattern.height, patternLineColor, patternStrokeWidth, fillOpacity); + patternFill = pf; + } else { + patternFill = defaultColor; + } + } else { + patternFill = graphics.drawPattern(fillCnf.pattern.style, fillCnf.pattern.width, fillCnf.pattern.height, patternLineColor, patternStrokeWidth, fillOpacity); + } + return patternFill; + } + }, { + key: "handleGradientFill", + value: function handleGradientFill(_ref2) { + var type = _ref2.type, + fillColor = _ref2.fillColor, + fillOpacity = _ref2.fillOpacity, + fillConfig = _ref2.fillConfig, + colorStops = _ref2.colorStops, + i = _ref2.i; + var fillCnf = this.w.config.fill; + if (fillConfig) { + fillCnf = _objectSpread2(_objectSpread2({}, fillCnf), fillConfig); + } + var opts = this.opts; + var graphics = new Graphics(this.ctx); + var utils = new Utils$1(); + type = type || fillCnf.gradient.type; + var gradientFrom = fillColor; + var gradientTo; + var opacityFrom = fillCnf.gradient.opacityFrom === undefined ? fillOpacity : Array.isArray(fillCnf.gradient.opacityFrom) ? fillCnf.gradient.opacityFrom[i] : fillCnf.gradient.opacityFrom; + if (gradientFrom.indexOf('rgba') > -1) { + opacityFrom = Utils$1.getOpacityFromRGBA(gradientFrom); + } + var opacityTo = fillCnf.gradient.opacityTo === undefined ? fillOpacity : Array.isArray(fillCnf.gradient.opacityTo) ? fillCnf.gradient.opacityTo[i] : fillCnf.gradient.opacityTo; + if (fillCnf.gradient.gradientToColors === undefined || fillCnf.gradient.gradientToColors.length === 0) { + if (fillCnf.gradient.shade === 'dark') { + gradientTo = utils.shadeColor(parseFloat(fillCnf.gradient.shadeIntensity) * -1, fillColor.indexOf('rgb') > -1 ? Utils$1.rgb2hex(fillColor) : fillColor); + } else { + gradientTo = utils.shadeColor(parseFloat(fillCnf.gradient.shadeIntensity), fillColor.indexOf('rgb') > -1 ? Utils$1.rgb2hex(fillColor) : fillColor); + } + } else { + if (fillCnf.gradient.gradientToColors[opts.seriesNumber]) { + var gToColor = fillCnf.gradient.gradientToColors[opts.seriesNumber]; + gradientTo = gToColor; + if (gToColor.indexOf('rgba') > -1) { + opacityTo = Utils$1.getOpacityFromRGBA(gToColor); + } + } else { + gradientTo = fillColor; + } + } + if (fillCnf.gradient.gradientFrom) { + gradientFrom = fillCnf.gradient.gradientFrom; + } + if (fillCnf.gradient.gradientTo) { + gradientTo = fillCnf.gradient.gradientTo; + } + if (fillCnf.gradient.inverseColors) { + var t = gradientFrom; + gradientFrom = gradientTo; + gradientTo = t; + } + if (gradientFrom.indexOf('rgb') > -1) { + gradientFrom = Utils$1.rgb2hex(gradientFrom); + } + if (gradientTo.indexOf('rgb') > -1) { + gradientTo = Utils$1.rgb2hex(gradientTo); + } + return graphics.drawGradient(type, gradientFrom, gradientTo, opacityFrom, opacityTo, opts.size, fillCnf.gradient.stops, colorStops, i); + } + }]); + return Fill; + }(); + + /** + * ApexCharts Markers Class for drawing markers on y values in axes charts. + * + * @module Markers + **/ + var Markers = /*#__PURE__*/function () { + function Markers(ctx, opts) { + _classCallCheck(this, Markers); + this.ctx = ctx; + this.w = ctx.w; + } + _createClass(Markers, [{ + key: "setGlobalMarkerSize", + value: function setGlobalMarkerSize() { + var w = this.w; + w.globals.markers.size = Array.isArray(w.config.markers.size) ? w.config.markers.size : [w.config.markers.size]; + if (w.globals.markers.size.length > 0) { + if (w.globals.markers.size.length < w.globals.series.length + 1) { + for (var i = 0; i <= w.globals.series.length; i++) { + if (typeof w.globals.markers.size[i] === 'undefined') { + w.globals.markers.size.push(w.globals.markers.size[0]); + } + } + } + } else { + w.globals.markers.size = w.config.series.map(function (s) { + return w.config.markers.size; + }); + } + } + }, { + key: "plotChartMarkers", + value: function plotChartMarkers(_ref) { + var pointsPos = _ref.pointsPos, + seriesIndex = _ref.seriesIndex, + j = _ref.j, + pSize = _ref.pSize, + _ref$alwaysDrawMarker = _ref.alwaysDrawMarker, + alwaysDrawMarker = _ref$alwaysDrawMarker === void 0 ? false : _ref$alwaysDrawMarker, + _ref$isVirtualPoint = _ref.isVirtualPoint, + isVirtualPoint = _ref$isVirtualPoint === void 0 ? false : _ref$isVirtualPoint; + var w = this.w; + var i = seriesIndex; + var p = pointsPos; + var elMarkersWrap = null; + var graphics = new Graphics(this.ctx); + var hasDiscreteMarkers = w.config.markers.discrete && w.config.markers.discrete.length; + if (Array.isArray(p.x)) { + for (var q = 0; q < p.x.length; q++) { + var markerElement = void 0; + var dataPointIndex = j; + var invalidMarker = !Utils$1.isNumber(p.y[q]); + if (w.globals.markers.largestSize === 0 && w.globals.hasNullValues && w.globals.series[i][j + 1] !== null && !isVirtualPoint) { + invalidMarker = true; + } + + // a small hack as we have 2 points for the first val to connect it + if (j === 1 && q === 0) dataPointIndex = 0; + if (j === 1 && q === 1) dataPointIndex = 1; + var markerClasses = 'apexcharts-marker'; + if ((w.config.chart.type === 'line' || w.config.chart.type === 'area') && !w.globals.comboCharts && !w.config.tooltip.intersect) { + markerClasses += ' no-pointer-events'; + } + var shouldMarkerDraw = Array.isArray(w.config.markers.size) ? w.globals.markers.size[seriesIndex] > 0 : w.config.markers.size > 0; + if (shouldMarkerDraw || alwaysDrawMarker || hasDiscreteMarkers) { + if (!invalidMarker) { + markerClasses += " w".concat(Utils$1.randomId()); + } + var opts = this.getMarkerConfig({ + cssClass: markerClasses, + seriesIndex: seriesIndex, + dataPointIndex: dataPointIndex + }); + if (w.config.series[i].data[dataPointIndex]) { + if (w.config.series[i].data[dataPointIndex].fillColor) { + opts.pointFillColor = w.config.series[i].data[dataPointIndex].fillColor; + } + if (w.config.series[i].data[dataPointIndex].strokeColor) { + opts.pointStrokeColor = w.config.series[i].data[dataPointIndex].strokeColor; + } + } + if (typeof pSize !== 'undefined') { + opts.pSize = pSize; + } + if (p.x[q] < -w.globals.markers.largestSize || p.x[q] > w.globals.gridWidth + w.globals.markers.largestSize || p.y[q] < -w.globals.markers.largestSize || p.y[q] > w.globals.gridHeight + w.globals.markers.largestSize) { + opts.pSize = 0; + } + if (!invalidMarker) { + var shouldCreateMarkerWrap = w.globals.markers.size[seriesIndex] > 0 || alwaysDrawMarker || hasDiscreteMarkers; + if (shouldCreateMarkerWrap && !elMarkersWrap) { + elMarkersWrap = graphics.group({ + class: alwaysDrawMarker || hasDiscreteMarkers ? '' : 'apexcharts-series-markers' + }); + elMarkersWrap.attr('clip-path', "url(#gridRectMarkerMask".concat(w.globals.cuid, ")")); + } + markerElement = graphics.drawMarker(p.x[q], p.y[q], opts); + markerElement.attr('rel', dataPointIndex); + markerElement.attr('j', dataPointIndex); + markerElement.attr('index', seriesIndex); + markerElement.node.setAttribute('default-marker-size', opts.pSize); + var filters = new Filters(this.ctx); + filters.setSelectionFilter(markerElement, seriesIndex, dataPointIndex); + this.addEvents(markerElement); + if (elMarkersWrap) { + elMarkersWrap.add(markerElement); + } + } + } else { + // dynamic array creation - multidimensional + if (typeof w.globals.pointsArray[seriesIndex] === 'undefined') w.globals.pointsArray[seriesIndex] = []; + w.globals.pointsArray[seriesIndex].push([p.x[q], p.y[q]]); + } + } + } + return elMarkersWrap; + } + }, { + key: "getMarkerConfig", + value: function getMarkerConfig(_ref2) { + var cssClass = _ref2.cssClass, + seriesIndex = _ref2.seriesIndex, + _ref2$dataPointIndex = _ref2.dataPointIndex, + dataPointIndex = _ref2$dataPointIndex === void 0 ? null : _ref2$dataPointIndex, + _ref2$radius = _ref2.radius, + radius = _ref2$radius === void 0 ? null : _ref2$radius, + _ref2$size = _ref2.size, + size = _ref2$size === void 0 ? null : _ref2$size, + _ref2$strokeWidth = _ref2.strokeWidth, + strokeWidth = _ref2$strokeWidth === void 0 ? null : _ref2$strokeWidth; + var w = this.w; + var pStyle = this.getMarkerStyle(seriesIndex); + var pSize = size === null ? w.globals.markers.size[seriesIndex] : size; + var m = w.config.markers; + + // discrete markers is an option where user can specify a particular marker with different shape, size and color + + if (dataPointIndex !== null && m.discrete.length) { + m.discrete.map(function (marker) { + if (marker.seriesIndex === seriesIndex && marker.dataPointIndex === dataPointIndex) { + pStyle.pointStrokeColor = marker.strokeColor; + pStyle.pointFillColor = marker.fillColor; + pSize = marker.size; + pStyle.pointShape = marker.shape; + } + }); + } + return { + pSize: radius === null ? pSize : radius, + pRadius: radius !== null ? radius : m.radius, + pointStrokeWidth: strokeWidth !== null ? strokeWidth : Array.isArray(m.strokeWidth) ? m.strokeWidth[seriesIndex] : m.strokeWidth, + pointStrokeColor: pStyle.pointStrokeColor, + pointFillColor: pStyle.pointFillColor, + shape: pStyle.pointShape || (Array.isArray(m.shape) ? m.shape[seriesIndex] : m.shape), + class: cssClass, + pointStrokeOpacity: Array.isArray(m.strokeOpacity) ? m.strokeOpacity[seriesIndex] : m.strokeOpacity, + pointStrokeDashArray: Array.isArray(m.strokeDashArray) ? m.strokeDashArray[seriesIndex] : m.strokeDashArray, + pointFillOpacity: Array.isArray(m.fillOpacity) ? m.fillOpacity[seriesIndex] : m.fillOpacity, + seriesIndex: seriesIndex + }; + } + }, { + key: "addEvents", + value: function addEvents(marker) { + var w = this.w; + var graphics = new Graphics(this.ctx); + marker.node.addEventListener('mouseenter', graphics.pathMouseEnter.bind(this.ctx, marker)); + marker.node.addEventListener('mouseleave', graphics.pathMouseLeave.bind(this.ctx, marker)); + marker.node.addEventListener('mousedown', graphics.pathMouseDown.bind(this.ctx, marker)); + marker.node.addEventListener('click', w.config.markers.onClick); + marker.node.addEventListener('dblclick', w.config.markers.onDblClick); + marker.node.addEventListener('touchstart', graphics.pathMouseDown.bind(this.ctx, marker), { + passive: true + }); + } + }, { + key: "getMarkerStyle", + value: function getMarkerStyle(seriesIndex) { + var w = this.w; + var colors = w.globals.markers.colors; + var strokeColors = w.config.markers.strokeColor || w.config.markers.strokeColors; + var pointStrokeColor = Array.isArray(strokeColors) ? strokeColors[seriesIndex] : strokeColors; + var pointFillColor = Array.isArray(colors) ? colors[seriesIndex] : colors; + return { + pointStrokeColor: pointStrokeColor, + pointFillColor: pointFillColor + }; + } + }]); + return Markers; + }(); + + /** + * ApexCharts Scatter Class. + * This Class also handles bubbles chart as currently there is no major difference in drawing them, + * @module Scatter + **/ + var Scatter = /*#__PURE__*/function () { + function Scatter(ctx) { + _classCallCheck(this, Scatter); + this.ctx = ctx; + this.w = ctx.w; + this.initialAnim = this.w.config.chart.animations.enabled; + } + _createClass(Scatter, [{ + key: "draw", + value: function draw(elSeries, j, opts) { + var w = this.w; + var graphics = new Graphics(this.ctx); + var realIndex = opts.realIndex; + var pointsPos = opts.pointsPos; + var zRatio = opts.zRatio; + var elPointsMain = opts.elParent; + var elPointsWrap = graphics.group({ + class: "apexcharts-series-markers apexcharts-series-".concat(w.config.chart.type) + }); + elPointsWrap.attr('clip-path', "url(#gridRectMarkerMask".concat(w.globals.cuid, ")")); + if (Array.isArray(pointsPos.x)) { + for (var q = 0; q < pointsPos.x.length; q++) { + var dataPointIndex = j + 1; + var shouldDraw = true; + + // a small hack as we have 2 points for the first val to connect it + if (j === 0 && q === 0) dataPointIndex = 0; + if (j === 0 && q === 1) dataPointIndex = 1; + var radius = w.globals.markers.size[realIndex]; + if (zRatio !== Infinity) { + // means we have a bubble + var bubble = w.config.plotOptions.bubble; + radius = w.globals.seriesZ[realIndex][dataPointIndex]; + if (bubble.zScaling) { + radius /= zRatio; + } + if (bubble.minBubbleRadius && radius < bubble.minBubbleRadius) { + radius = bubble.minBubbleRadius; + } + if (bubble.maxBubbleRadius && radius > bubble.maxBubbleRadius) { + radius = bubble.maxBubbleRadius; + } + } + var x = pointsPos.x[q]; + var y = pointsPos.y[q]; + radius = radius || 0; + if (y === null || typeof w.globals.series[realIndex][dataPointIndex] === 'undefined') { + shouldDraw = false; + } + if (shouldDraw) { + var point = this.drawPoint(x, y, radius, realIndex, dataPointIndex, j); + elPointsWrap.add(point); + } + elPointsMain.add(elPointsWrap); + } + } + } + }, { + key: "drawPoint", + value: function drawPoint(x, y, radius, realIndex, dataPointIndex, j) { + var w = this.w; + var i = realIndex; + var anim = new Animations(this.ctx); + var filters = new Filters(this.ctx); + var fill = new Fill(this.ctx); + var markers = new Markers(this.ctx); + var graphics = new Graphics(this.ctx); + var markerConfig = markers.getMarkerConfig({ + cssClass: 'apexcharts-marker', + seriesIndex: i, + dataPointIndex: dataPointIndex, + radius: w.config.chart.type === 'bubble' || w.globals.comboCharts && w.config.series[realIndex] && w.config.series[realIndex].type === 'bubble' ? radius : null + }); + var pathFillCircle = fill.fillPath({ + seriesNumber: realIndex, + dataPointIndex: dataPointIndex, + color: markerConfig.pointFillColor, + patternUnits: 'objectBoundingBox', + value: w.globals.series[realIndex][j] + }); + var el = graphics.drawMarker(x, y, markerConfig); + if (w.config.series[i].data[dataPointIndex]) { + if (w.config.series[i].data[dataPointIndex].fillColor) { + pathFillCircle = w.config.series[i].data[dataPointIndex].fillColor; + } + } + el.attr({ + fill: pathFillCircle + }); + if (w.config.chart.dropShadow.enabled) { + var dropShadow = w.config.chart.dropShadow; + filters.dropShadow(el, dropShadow, realIndex); + } + if (this.initialAnim && !w.globals.dataChanged && !w.globals.resized) { + var speed = w.config.chart.animations.speed; + anim.animateMarker(el, speed, w.globals.easing, function () { + window.setTimeout(function () { + anim.animationCompleted(el); + }, 100); + }); + } else { + w.globals.animationEnded = true; + } + el.attr({ + rel: dataPointIndex, + j: dataPointIndex, + index: realIndex, + 'default-marker-size': markerConfig.pSize + }); + filters.setSelectionFilter(el, realIndex, dataPointIndex); + markers.addEvents(el); + el.node.classList.add('apexcharts-marker'); + return el; + } + }, { + key: "centerTextInBubble", + value: function centerTextInBubble(y) { + var w = this.w; + y = y + parseInt(w.config.dataLabels.style.fontSize, 10) / 4; + return { + y: y + }; + } + }]); + return Scatter; + }(); + + /** + * ApexCharts DataLabels Class for drawing dataLabels on Axes based Charts. + * + * @module DataLabels + **/ + var DataLabels = /*#__PURE__*/function () { + function DataLabels(ctx) { + _classCallCheck(this, DataLabels); + this.ctx = ctx; + this.w = ctx.w; + } + + // When there are many datalabels to be printed, and some of them overlaps each other in the same series, this method will take care of that + // Also, when datalabels exceeds the drawable area and get clipped off, we need to adjust and move some pixels to make them visible again + _createClass(DataLabels, [{ + key: "dataLabelsCorrection", + value: function dataLabelsCorrection(x, y, val, i, dataPointIndex, alwaysDrawDataLabel, fontSize) { + var w = this.w; + var graphics = new Graphics(this.ctx); + var drawnextLabel = false; // + + var textRects = graphics.getTextRects(val, fontSize); + var width = textRects.width; + var height = textRects.height; + if (y < 0) y = 0; + if (y > w.globals.gridHeight + height) y = w.globals.gridHeight + height / 2; + + // first value in series, so push an empty array + if (typeof w.globals.dataLabelsRects[i] === 'undefined') w.globals.dataLabelsRects[i] = []; + + // then start pushing actual rects in that sub-array + w.globals.dataLabelsRects[i].push({ + x: x, + y: y, + width: width, + height: height + }); + var len = w.globals.dataLabelsRects[i].length - 2; + var lastDrawnIndex = typeof w.globals.lastDrawnDataLabelsIndexes[i] !== 'undefined' ? w.globals.lastDrawnDataLabelsIndexes[i][w.globals.lastDrawnDataLabelsIndexes[i].length - 1] : 0; + if (typeof w.globals.dataLabelsRects[i][len] !== 'undefined') { + var lastDataLabelRect = w.globals.dataLabelsRects[i][lastDrawnIndex]; + if ( + // next label forward and x not intersecting + x > lastDataLabelRect.x + lastDataLabelRect.width || y > lastDataLabelRect.y + lastDataLabelRect.height || y + height < lastDataLabelRect.y || x + width < lastDataLabelRect.x // next label is going to be drawn backwards + ) { + // the 2 indexes don't override, so OK to draw next label + drawnextLabel = true; + } + } + if (dataPointIndex === 0 || alwaysDrawDataLabel) { + drawnextLabel = true; + } + return { + x: x, + y: y, + textRects: textRects, + drawnextLabel: drawnextLabel + }; + } + }, { + key: "drawDataLabel", + value: function drawDataLabel(_ref) { + var _this = this; + var type = _ref.type, + pos = _ref.pos, + i = _ref.i, + j = _ref.j, + isRangeStart = _ref.isRangeStart, + _ref$strokeWidth = _ref.strokeWidth, + strokeWidth = _ref$strokeWidth === void 0 ? 2 : _ref$strokeWidth; + // this method handles line, area, bubble, scatter charts as those charts contains markers/points which have pre-defined x/y positions + // all other charts like radar / bars / heatmaps will define their own drawDataLabel routine + var w = this.w; + var graphics = new Graphics(this.ctx); + var dataLabelsConfig = w.config.dataLabels; + var x = 0; + var y = 0; + var dataPointIndex = j; + var elDataLabelsWrap = null; + var seriesCollapsed = w.globals.collapsedSeriesIndices.indexOf(i) !== -1; + if (seriesCollapsed || !dataLabelsConfig.enabled || !Array.isArray(pos.x)) { + return elDataLabelsWrap; + } + elDataLabelsWrap = graphics.group({ + class: 'apexcharts-data-labels' + }); + for (var q = 0; q < pos.x.length; q++) { + x = pos.x[q] + dataLabelsConfig.offsetX; + y = pos.y[q] + dataLabelsConfig.offsetY + strokeWidth; + if (!isNaN(x)) { + // a small hack as we have 2 points for the first val to connect it + if (j === 1 && q === 0) dataPointIndex = 0; + if (j === 1 && q === 1) dataPointIndex = 1; + var val = w.globals.series[i][dataPointIndex]; + if (type === 'rangeArea') { + if (isRangeStart) { + val = w.globals.seriesRangeStart[i][dataPointIndex]; + } else { + val = w.globals.seriesRangeEnd[i][dataPointIndex]; + } + } + var text = ''; + var getText = function getText(v) { + return w.config.dataLabels.formatter(v, { + ctx: _this.ctx, + seriesIndex: i, + dataPointIndex: dataPointIndex, + w: w + }); + }; + if (w.config.chart.type === 'bubble') { + val = w.globals.seriesZ[i][dataPointIndex]; + text = getText(val); + y = pos.y[q]; + var scatter = new Scatter(this.ctx); + var centerTextInBubbleCoords = scatter.centerTextInBubble(y, i, dataPointIndex); + y = centerTextInBubbleCoords.y; + } else { + if (typeof val !== 'undefined') { + text = getText(val); + } + } + var textAnchor = w.config.dataLabels.textAnchor; + if (w.globals.isSlopeChart) { + if (dataPointIndex === 0) { + textAnchor = 'end'; + } else if (dataPointIndex === w.config.series[i].data.length - 1) { + textAnchor = 'start'; + } else { + textAnchor = 'middle'; + } + } + this.plotDataLabelsText({ + x: x, + y: y, + text: text, + i: i, + j: dataPointIndex, + parent: elDataLabelsWrap, + offsetCorrection: true, + dataLabelsConfig: w.config.dataLabels, + textAnchor: textAnchor + }); + } + } + return elDataLabelsWrap; + } + }, { + key: "plotDataLabelsText", + value: function plotDataLabelsText(opts) { + var w = this.w; + var graphics = new Graphics(this.ctx); + var x = opts.x, + y = opts.y, + i = opts.i, + j = opts.j, + text = opts.text, + textAnchor = opts.textAnchor, + fontSize = opts.fontSize, + parent = opts.parent, + dataLabelsConfig = opts.dataLabelsConfig, + color = opts.color, + alwaysDrawDataLabel = opts.alwaysDrawDataLabel, + offsetCorrection = opts.offsetCorrection, + className = opts.className; + var dataLabelText = null; + if (Array.isArray(w.config.dataLabels.enabledOnSeries)) { + if (w.config.dataLabels.enabledOnSeries.indexOf(i) < 0) { + return dataLabelText; + } + } + var correctedLabels = { + x: x, + y: y, + drawnextLabel: true, + textRects: null + }; + if (offsetCorrection) { + correctedLabels = this.dataLabelsCorrection(x, y, text, i, j, alwaysDrawDataLabel, parseInt(dataLabelsConfig.style.fontSize, 10)); + } + + // when zoomed, we don't need to correct labels offsets, + // but if normally, labels get cropped, correct them + if (!w.globals.zoomed) { + x = correctedLabels.x; + y = correctedLabels.y; + } + if (correctedLabels.textRects) { + // fixes #2264 + if (x < -20 - correctedLabels.textRects.width || x > w.globals.gridWidth + correctedLabels.textRects.width + 30) { + // datalabels fall outside drawing area, so draw a blank label + text = ''; + } + } + var dataLabelColor = w.globals.dataLabels.style.colors[i]; + if ((w.config.chart.type === 'bar' || w.config.chart.type === 'rangeBar') && w.config.plotOptions.bar.distributed || w.config.dataLabels.distributed) { + dataLabelColor = w.globals.dataLabels.style.colors[j]; + } + if (typeof dataLabelColor === 'function') { + dataLabelColor = dataLabelColor({ + series: w.globals.series, + seriesIndex: i, + dataPointIndex: j, + w: w + }); + } + if (color) { + dataLabelColor = color; + } + var offX = dataLabelsConfig.offsetX; + var offY = dataLabelsConfig.offsetY; + if (w.config.chart.type === 'bar' || w.config.chart.type === 'rangeBar') { + // for certain chart types, we handle offsets while calculating datalabels pos + // why? because bars/column may have negative values and based on that + // offsets becomes reversed + offX = 0; + offY = 0; + } + if (w.globals.isSlopeChart) { + if (j !== 0) { + offX = dataLabelsConfig.offsetX * -2 + 5; + } + if (j !== 0 && j !== w.config.series[i].data.length - 1) { + offX = 0; + } + } + if (correctedLabels.drawnextLabel) { + dataLabelText = graphics.drawText({ + width: 100, + height: parseInt(dataLabelsConfig.style.fontSize, 10), + x: x + offX, + y: y + offY, + foreColor: dataLabelColor, + textAnchor: textAnchor || dataLabelsConfig.textAnchor, + text: text, + fontSize: fontSize || dataLabelsConfig.style.fontSize, + fontFamily: dataLabelsConfig.style.fontFamily, + fontWeight: dataLabelsConfig.style.fontWeight || 'normal' + }); + dataLabelText.attr({ + class: className || 'apexcharts-datalabel', + cx: x, + cy: y + }); + if (dataLabelsConfig.dropShadow.enabled) { + var textShadow = dataLabelsConfig.dropShadow; + var filters = new Filters(this.ctx); + filters.dropShadow(dataLabelText, textShadow); + } + parent.add(dataLabelText); + if (typeof w.globals.lastDrawnDataLabelsIndexes[i] === 'undefined') { + w.globals.lastDrawnDataLabelsIndexes[i] = []; + } + w.globals.lastDrawnDataLabelsIndexes[i].push(j); + } + return dataLabelText; + } + }, { + key: "addBackgroundToDataLabel", + value: function addBackgroundToDataLabel(el, coords) { + var w = this.w; + var bCnf = w.config.dataLabels.background; + var paddingH = bCnf.padding; + var paddingV = bCnf.padding / 2; + var width = coords.width; + var height = coords.height; + var graphics = new Graphics(this.ctx); + var elRect = graphics.drawRect(coords.x - paddingH, coords.y - paddingV / 2, width + paddingH * 2, height + paddingV, bCnf.borderRadius, w.config.chart.background === 'transparent' || !w.config.chart.background ? '#fff' : w.config.chart.background, bCnf.opacity, bCnf.borderWidth, bCnf.borderColor); + if (bCnf.dropShadow.enabled) { + var filters = new Filters(this.ctx); + filters.dropShadow(elRect, bCnf.dropShadow); + } + return elRect; + } + }, { + key: "dataLabelsBackground", + value: function dataLabelsBackground() { + var w = this.w; + if (w.config.chart.type === 'bubble') return; + var elDataLabels = w.globals.dom.baseEl.querySelectorAll('.apexcharts-datalabels text'); + for (var i = 0; i < elDataLabels.length; i++) { + var el = elDataLabels[i]; + var coords = el.getBBox(); + var elRect = null; + if (coords.width && coords.height) { + elRect = this.addBackgroundToDataLabel(el, coords); + } + if (elRect) { + el.parentNode.insertBefore(elRect.node, el); + var background = el.getAttribute('fill'); + var shouldAnim = w.config.chart.animations.enabled && !w.globals.resized && !w.globals.dataChanged; + if (shouldAnim) { + elRect.animate().attr({ + fill: background + }); + } else { + elRect.attr({ + fill: background + }); + } + el.setAttribute('fill', w.config.dataLabels.background.foreColor); + } + } + } + }, { + key: "bringForward", + value: function bringForward() { + var w = this.w; + var elDataLabelsNodes = w.globals.dom.baseEl.querySelectorAll('.apexcharts-datalabels'); + var elSeries = w.globals.dom.baseEl.querySelector('.apexcharts-plot-series:last-child'); + for (var i = 0; i < elDataLabelsNodes.length; i++) { + if (elSeries) { + elSeries.insertBefore(elDataLabelsNodes[i], elSeries.nextSibling); + } + } + } + }]); + return DataLabels; + }(); + + /** + * ApexCharts Series Class for interaction with the Series of the chart. + * + * @module Series + **/ + var Series = /*#__PURE__*/function () { + function Series(ctx) { + _classCallCheck(this, Series); + this.ctx = ctx; + this.w = ctx.w; + this.legendInactiveClass = 'legend-mouseover-inactive'; + } + _createClass(Series, [{ + key: "getAllSeriesEls", + value: function getAllSeriesEls() { + return this.w.globals.dom.baseEl.getElementsByClassName("apexcharts-series"); + } + }, { + key: "getSeriesByName", + value: function getSeriesByName(seriesName) { + return this.w.globals.dom.baseEl.querySelector(".apexcharts-inner .apexcharts-series[seriesName='".concat(Utils$1.escapeString(seriesName), "']")); + } + }, { + key: "isSeriesHidden", + value: function isSeriesHidden(seriesName) { + var targetElement = this.getSeriesByName(seriesName); + var realIndex = parseInt(targetElement.getAttribute('data:realIndex'), 10); + var isHidden = targetElement.classList.contains('apexcharts-series-collapsed'); + return { + isHidden: isHidden, + realIndex: realIndex + }; + } + }, { + key: "addCollapsedClassToSeries", + value: function addCollapsedClassToSeries(elSeries, index) { + var w = this.w; + function iterateOnAllCollapsedSeries(series) { + for (var cs = 0; cs < series.length; cs++) { + if (series[cs].index === index) { + elSeries.node.classList.add('apexcharts-series-collapsed'); + } + } + } + iterateOnAllCollapsedSeries(w.globals.collapsedSeries); + iterateOnAllCollapsedSeries(w.globals.ancillaryCollapsedSeries); + } + }, { + key: "toggleSeries", + value: function toggleSeries(seriesName) { + var isSeriesHidden = this.isSeriesHidden(seriesName); + this.ctx.legend.legendHelpers.toggleDataSeries(isSeriesHidden.realIndex, isSeriesHidden.isHidden); + return isSeriesHidden.isHidden; + } + }, { + key: "showSeries", + value: function showSeries(seriesName) { + var isSeriesHidden = this.isSeriesHidden(seriesName); + if (isSeriesHidden.isHidden) { + this.ctx.legend.legendHelpers.toggleDataSeries(isSeriesHidden.realIndex, true); + } + } + }, { + key: "hideSeries", + value: function hideSeries(seriesName) { + var isSeriesHidden = this.isSeriesHidden(seriesName); + if (!isSeriesHidden.isHidden) { + this.ctx.legend.legendHelpers.toggleDataSeries(isSeriesHidden.realIndex, false); + } + } + }, { + key: "resetSeries", + value: function resetSeries() { + var shouldUpdateChart = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; + var shouldResetZoom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + var shouldResetCollapsed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + var w = this.w; + var series = Utils$1.clone(w.globals.initialSeries); + w.globals.previousPaths = []; + if (shouldResetCollapsed) { + w.globals.collapsedSeries = []; + w.globals.ancillaryCollapsedSeries = []; + w.globals.collapsedSeriesIndices = []; + w.globals.ancillaryCollapsedSeriesIndices = []; + } else { + series = this.emptyCollapsedSeries(series); + } + w.config.series = series; + if (shouldUpdateChart) { + if (shouldResetZoom) { + w.globals.zoomed = false; + this.ctx.updateHelpers.revertDefaultAxisMinMax(); + } + this.ctx.updateHelpers._updateSeries(series, w.config.chart.animations.dynamicAnimation.enabled); + } + } + }, { + key: "emptyCollapsedSeries", + value: function emptyCollapsedSeries(series) { + var w = this.w; + for (var i = 0; i < series.length; i++) { + if (w.globals.collapsedSeriesIndices.indexOf(i) > -1) { + series[i].data = []; + } + } + return series; + } + }, { + key: "highlightSeries", + value: function highlightSeries(seriesName) { + var w = this.w; + var targetElement = this.getSeriesByName(seriesName); + var realIndex = parseInt(targetElement === null || targetElement === void 0 ? void 0 : targetElement.getAttribute('data:realIndex'), 10); + var allSeriesEls = w.globals.dom.baseEl.querySelectorAll(".apexcharts-series, .apexcharts-datalabels, .apexcharts-yaxis"); + var seriesEl = null; + var dataLabelEl = null; + var yaxisEl = null; + if (w.globals.axisCharts || w.config.chart.type === 'radialBar') { + if (w.globals.axisCharts) { + seriesEl = w.globals.dom.baseEl.querySelector(".apexcharts-series[data\\:realIndex='".concat(realIndex, "']")); + dataLabelEl = w.globals.dom.baseEl.querySelector(".apexcharts-datalabels[data\\:realIndex='".concat(realIndex, "']")); + var yaxisIndex = w.globals.seriesYAxisReverseMap[realIndex]; + yaxisEl = w.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(yaxisIndex, "']")); + } else { + seriesEl = w.globals.dom.baseEl.querySelector(".apexcharts-series[rel='".concat(realIndex + 1, "']")); + } + } else { + seriesEl = w.globals.dom.baseEl.querySelector(".apexcharts-series[rel='".concat(realIndex + 1, "'] path")); + } + for (var se = 0; se < allSeriesEls.length; se++) { + allSeriesEls[se].classList.add(this.legendInactiveClass); + } + if (seriesEl) { + if (!w.globals.axisCharts) { + seriesEl.parentNode.classList.remove(this.legendInactiveClass); + } + seriesEl.classList.remove(this.legendInactiveClass); + if (dataLabelEl !== null) { + dataLabelEl.classList.remove(this.legendInactiveClass); + } + if (yaxisEl !== null) { + yaxisEl.classList.remove(this.legendInactiveClass); + } + } else { + for (var _se = 0; _se < allSeriesEls.length; _se++) { + allSeriesEls[_se].classList.remove(this.legendInactiveClass); + } + } + } + }, { + key: "toggleSeriesOnHover", + value: function toggleSeriesOnHover(e, targetElement) { + var w = this.w; + if (!targetElement) targetElement = e.target; + var allSeriesEls = w.globals.dom.baseEl.querySelectorAll(".apexcharts-series, .apexcharts-datalabels, .apexcharts-yaxis"); + if (e.type === 'mousemove') { + var realIndex = parseInt(targetElement.getAttribute('rel'), 10) - 1; + this.highlightSeries(w.globals.seriesNames[realIndex]); + } else if (e.type === 'mouseout') { + for (var se = 0; se < allSeriesEls.length; se++) { + allSeriesEls[se].classList.remove(this.legendInactiveClass); + } + } + } + }, { + key: "highlightRangeInSeries", + value: function highlightRangeInSeries(e, targetElement) { + var _this = this; + var w = this.w; + var allHeatMapElements = w.globals.dom.baseEl.getElementsByClassName('apexcharts-heatmap-rect'); + var activeInactive = function activeInactive(action) { + for (var i = 0; i < allHeatMapElements.length; i++) { + allHeatMapElements[i].classList[action](_this.legendInactiveClass); + } + }; + var removeInactiveClassFromHoveredRange = function removeInactiveClassFromHoveredRange(range, rangeMax) { + for (var i = 0; i < allHeatMapElements.length; i++) { + var val = Number(allHeatMapElements[i].getAttribute('val')); + if (val >= range.from && (val < range.to || range.to === rangeMax && val === rangeMax)) { + allHeatMapElements[i].classList.remove(_this.legendInactiveClass); + } + } + }; + if (e.type === 'mousemove') { + var seriesCnt = parseInt(targetElement.getAttribute('rel'), 10) - 1; + activeInactive('add'); + var ranges = w.config.plotOptions.heatmap.colorScale.ranges; + var range = ranges[seriesCnt]; + var rangeMax = ranges.reduce(function (acc, cur) { + return Math.max(acc, cur.to); + }, 0); + removeInactiveClassFromHoveredRange(range, rangeMax); + } else if (e.type === 'mouseout') { + activeInactive('remove'); + } + } + }, { + key: "getActiveConfigSeriesIndex", + value: function getActiveConfigSeriesIndex() { + var order = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'asc'; + var chartTypes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; + var w = this.w; + var activeIndex = 0; + if (w.config.series.length > 1) { + // active series flag is required to know if user has not deactivated via legend click + var activeSeriesIndex = w.config.series.map(function (s, index) { + var checkChartType = function checkChartType() { + if (w.globals.comboCharts) { + return chartTypes.length === 0 || chartTypes.length && chartTypes.indexOf(w.config.series[index].type) > -1; + } + return true; + }; + var hasData = s.data && s.data.length > 0 && w.globals.collapsedSeriesIndices.indexOf(index) === -1; + return hasData && checkChartType() ? index : -1; + }); + for (var a = order === 'asc' ? 0 : activeSeriesIndex.length - 1; order === 'asc' ? a < activeSeriesIndex.length : a >= 0; order === 'asc' ? a++ : a--) { + if (activeSeriesIndex[a] !== -1) { + activeIndex = activeSeriesIndex[a]; + break; + } + } + } + return activeIndex; + } + }, { + key: "getBarSeriesIndices", + value: function getBarSeriesIndices() { + var w = this.w; + if (w.globals.comboCharts) { + return this.w.config.series.map(function (s, i) { + return s.type === 'bar' || s.type === 'column' ? i : -1; + }).filter(function (i) { + return i !== -1; + }); + } + return this.w.config.series.map(function (s, i) { + return i; + }); + } + }, { + key: "getPreviousPaths", + value: function getPreviousPaths() { + var w = this.w; + w.globals.previousPaths = []; + function pushPaths(seriesEls, i, type) { + var paths = seriesEls[i].childNodes; + var dArr = { + type: type, + paths: [], + realIndex: seriesEls[i].getAttribute('data:realIndex') + }; + for (var j = 0; j < paths.length; j++) { + if (paths[j].hasAttribute('pathTo')) { + var d = paths[j].getAttribute('pathTo'); + dArr.paths.push({ + d: d + }); + } + } + w.globals.previousPaths.push(dArr); + } + var getPaths = function getPaths(chartType) { + return w.globals.dom.baseEl.querySelectorAll(".apexcharts-".concat(chartType, "-series .apexcharts-series")); + }; + var chartTypes = ['line', 'area', 'bar', 'rangebar', 'rangeArea', 'candlestick', 'radar']; + chartTypes.forEach(function (type) { + var paths = getPaths(type); + for (var p = 0; p < paths.length; p++) { + pushPaths(paths, p, type); + } + }); + var heatTreeSeries = w.globals.dom.baseEl.querySelectorAll(".apexcharts-".concat(w.config.chart.type, " .apexcharts-series")); + if (heatTreeSeries.length > 0) { + var _loop = function _loop(h) { + var seriesEls = w.globals.dom.baseEl.querySelectorAll(".apexcharts-".concat(w.config.chart.type, " .apexcharts-series[data\\:realIndex='").concat(h, "'] rect")); + var dArr = []; + var _loop2 = function _loop2(i) { + var getAttr = function getAttr(x) { + return seriesEls[i].getAttribute(x); + }; + var rect = { + x: parseFloat(getAttr('x')), + y: parseFloat(getAttr('y')), + width: parseFloat(getAttr('width')), + height: parseFloat(getAttr('height')) + }; + dArr.push({ + rect: rect, + color: seriesEls[i].getAttribute('color') + }); + }; + for (var i = 0; i < seriesEls.length; i++) { + _loop2(i); + } + w.globals.previousPaths.push(dArr); + }; + for (var h = 0; h < heatTreeSeries.length; h++) { + _loop(h); + } + } + if (!w.globals.axisCharts) { + // for non-axis charts (i.e., circular charts, pathFrom is not usable. We need whole series) + w.globals.previousPaths = w.globals.series; + } + } + }, { + key: "clearPreviousPaths", + value: function clearPreviousPaths() { + var w = this.w; + w.globals.previousPaths = []; + w.globals.allSeriesCollapsed = false; + } + }, { + key: "handleNoData", + value: function handleNoData() { + var w = this.w; + var me = this; + var noDataOpts = w.config.noData; + var graphics = new Graphics(me.ctx); + var x = w.globals.svgWidth / 2; + var y = w.globals.svgHeight / 2; + var textAnchor = 'middle'; + w.globals.noData = true; + w.globals.animationEnded = true; + if (noDataOpts.align === 'left') { + x = 10; + textAnchor = 'start'; + } else if (noDataOpts.align === 'right') { + x = w.globals.svgWidth - 10; + textAnchor = 'end'; + } + if (noDataOpts.verticalAlign === 'top') { + y = 50; + } else if (noDataOpts.verticalAlign === 'bottom') { + y = w.globals.svgHeight - 50; + } + x = x + noDataOpts.offsetX; + y = y + parseInt(noDataOpts.style.fontSize, 10) + 2 + noDataOpts.offsetY; + if (noDataOpts.text !== undefined && noDataOpts.text !== '') { + var titleText = graphics.drawText({ + x: x, + y: y, + text: noDataOpts.text, + textAnchor: textAnchor, + fontSize: noDataOpts.style.fontSize, + fontFamily: noDataOpts.style.fontFamily, + foreColor: noDataOpts.style.color, + opacity: 1, + class: 'apexcharts-text-nodata' + }); + w.globals.dom.Paper.add(titleText); + } + } + + // When user clicks on legends, the collapsed series is filled with [0,0,0,...,0] + // This is because we don't want to alter the series' length as it is used at many places + }, { + key: "setNullSeriesToZeroValues", + value: function setNullSeriesToZeroValues(series) { + var w = this.w; + for (var sl = 0; sl < series.length; sl++) { + if (series[sl].length === 0) { + for (var j = 0; j < series[w.globals.maxValsInArrayIndex].length; j++) { + series[sl].push(0); + } + } + } + return series; + } + }, { + key: "hasAllSeriesEqualX", + value: function hasAllSeriesEqualX() { + var equalLen = true; + var w = this.w; + var filteredSerX = this.filteredSeriesX(); + for (var i = 0; i < filteredSerX.length - 1; i++) { + if (filteredSerX[i][0] !== filteredSerX[i + 1][0]) { + equalLen = false; + break; + } + } + w.globals.allSeriesHasEqualX = equalLen; + return equalLen; + } + }, { + key: "filteredSeriesX", + value: function filteredSeriesX() { + var w = this.w; + var filteredSeriesX = w.globals.seriesX.map(function (ser) { + return ser.length > 0 ? ser : []; + }); + return filteredSeriesX; + } + }]); + return Series; + }(); + + var Data = /*#__PURE__*/function () { + function Data(ctx) { + _classCallCheck(this, Data); + this.ctx = ctx; + this.w = ctx.w; + this.twoDSeries = []; + this.threeDSeries = []; + this.twoDSeriesX = []; + this.seriesGoals = []; + this.coreUtils = new CoreUtils(this.ctx); + } + _createClass(Data, [{ + key: "isMultiFormat", + value: function isMultiFormat() { + return this.isFormatXY() || this.isFormat2DArray(); + } + + // given format is [{x, y}, {x, y}] + }, { + key: "isFormatXY", + value: function isFormatXY() { + var series = this.w.config.series.slice(); + var sr = new Series(this.ctx); + this.activeSeriesIndex = sr.getActiveConfigSeriesIndex(); + if (typeof series[this.activeSeriesIndex].data !== 'undefined' && series[this.activeSeriesIndex].data.length > 0 && series[this.activeSeriesIndex].data[0] !== null && typeof series[this.activeSeriesIndex].data[0].x !== 'undefined' && series[this.activeSeriesIndex].data[0] !== null) { + return true; + } + } + + // given format is [[x, y], [x, y]] + }, { + key: "isFormat2DArray", + value: function isFormat2DArray() { + var series = this.w.config.series.slice(); + var sr = new Series(this.ctx); + this.activeSeriesIndex = sr.getActiveConfigSeriesIndex(); + if (typeof series[this.activeSeriesIndex].data !== 'undefined' && series[this.activeSeriesIndex].data.length > 0 && typeof series[this.activeSeriesIndex].data[0] !== 'undefined' && series[this.activeSeriesIndex].data[0] !== null && series[this.activeSeriesIndex].data[0].constructor === Array) { + return true; + } + } + }, { + key: "handleFormat2DArray", + value: function handleFormat2DArray(ser, i) { + var cnf = this.w.config; + var gl = this.w.globals; + var isBoxPlot = cnf.chart.type === 'boxPlot' || cnf.series[i].type === 'boxPlot'; + for (var j = 0; j < ser[i].data.length; j++) { + if (typeof ser[i].data[j][1] !== 'undefined') { + if (Array.isArray(ser[i].data[j][1]) && ser[i].data[j][1].length === 4 && !isBoxPlot) { + // candlestick nested ohlc format + this.twoDSeries.push(Utils$1.parseNumber(ser[i].data[j][1][3])); + } else if (ser[i].data[j].length >= 5) { + // candlestick non-nested ohlc format + this.twoDSeries.push(Utils$1.parseNumber(ser[i].data[j][4])); + } else { + this.twoDSeries.push(Utils$1.parseNumber(ser[i].data[j][1])); + } + gl.dataFormatXNumeric = true; + } + if (cnf.xaxis.type === 'datetime') { + // if timestamps are provided and xaxis type is datetime, + + var ts = new Date(ser[i].data[j][0]); + ts = new Date(ts).getTime(); + this.twoDSeriesX.push(ts); + } else { + this.twoDSeriesX.push(ser[i].data[j][0]); + } + } + for (var _j = 0; _j < ser[i].data.length; _j++) { + if (typeof ser[i].data[_j][2] !== 'undefined') { + this.threeDSeries.push(ser[i].data[_j][2]); + gl.isDataXYZ = true; + } + } + } + }, { + key: "handleFormatXY", + value: function handleFormatXY(ser, i) { + var cnf = this.w.config; + var gl = this.w.globals; + var dt = new DateTime(this.ctx); + var activeI = i; + if (gl.collapsedSeriesIndices.indexOf(i) > -1) { + // fix #368 + activeI = this.activeSeriesIndex; + } + + // get series + for (var j = 0; j < ser[i].data.length; j++) { + if (typeof ser[i].data[j].y !== 'undefined') { + if (Array.isArray(ser[i].data[j].y)) { + this.twoDSeries.push(Utils$1.parseNumber(ser[i].data[j].y[ser[i].data[j].y.length - 1])); + } else { + this.twoDSeries.push(Utils$1.parseNumber(ser[i].data[j].y)); + } + } + if (typeof ser[i].data[j].goals !== 'undefined' && Array.isArray(ser[i].data[j].goals)) { + if (typeof this.seriesGoals[i] === 'undefined') { + this.seriesGoals[i] = []; + } + this.seriesGoals[i].push(ser[i].data[j].goals); + } else { + if (typeof this.seriesGoals[i] === 'undefined') { + this.seriesGoals[i] = []; + } + this.seriesGoals[i].push(null); + } + } + + // get seriesX + for (var _j2 = 0; _j2 < ser[activeI].data.length; _j2++) { + var isXString = typeof ser[activeI].data[_j2].x === 'string'; + var isXArr = Array.isArray(ser[activeI].data[_j2].x); + var isXDate = !isXArr && !!dt.isValidDate(ser[activeI].data[_j2].x); + if (isXString || isXDate) { + // user supplied '01/01/2017' or a date string (a JS date object is not supported) + if (isXString || cnf.xaxis.convertedCatToNumeric) { + var isRangeColumn = gl.isBarHorizontal && gl.isRangeData; + if (cnf.xaxis.type === 'datetime' && !isRangeColumn) { + this.twoDSeriesX.push(dt.parseDate(ser[activeI].data[_j2].x)); + } else { + // a category and not a numeric x value + this.fallbackToCategory = true; + this.twoDSeriesX.push(ser[activeI].data[_j2].x); + if (!isNaN(ser[activeI].data[_j2].x) && this.w.config.xaxis.type !== 'category' && typeof ser[activeI].data[_j2].x !== 'string') { + gl.isXNumeric = true; + } + } + } else { + if (cnf.xaxis.type === 'datetime') { + this.twoDSeriesX.push(dt.parseDate(ser[activeI].data[_j2].x.toString())); + } else { + gl.dataFormatXNumeric = true; + gl.isXNumeric = true; + this.twoDSeriesX.push(parseFloat(ser[activeI].data[_j2].x)); + } + } + } else if (isXArr) { + // a multiline label described in array format + this.fallbackToCategory = true; + this.twoDSeriesX.push(ser[activeI].data[_j2].x); + } else { + // a numeric value in x property + gl.isXNumeric = true; + gl.dataFormatXNumeric = true; + this.twoDSeriesX.push(ser[activeI].data[_j2].x); + } + } + if (ser[i].data[0] && typeof ser[i].data[0].z !== 'undefined') { + for (var t = 0; t < ser[i].data.length; t++) { + this.threeDSeries.push(ser[i].data[t].z); + } + gl.isDataXYZ = true; + } + } + }, { + key: "handleRangeData", + value: function handleRangeData(ser, i) { + var gl = this.w.globals; + var range = {}; + if (this.isFormat2DArray()) { + range = this.handleRangeDataFormat('array', ser, i); + } else if (this.isFormatXY()) { + range = this.handleRangeDataFormat('xy', ser, i); + } + + // Fix: RangeArea Chart: hide all series results in a crash #3984 + gl.seriesRangeStart.push(range.start === undefined ? [] : range.start); + gl.seriesRangeEnd.push(range.end === undefined ? [] : range.end); + gl.seriesRange.push(range.rangeUniques); + + // check for overlaps to avoid clashes in a timeline chart + gl.seriesRange.forEach(function (sr, si) { + if (sr) { + sr.forEach(function (sarr, sarri) { + sarr.y.forEach(function (arr, arri) { + for (var sri = 0; sri < sarr.y.length; sri++) { + if (arri !== sri) { + var range1y1 = arr.y1; + var range1y2 = arr.y2; + var range2y1 = sarr.y[sri].y1; + var range2y2 = sarr.y[sri].y2; + if (range1y1 <= range2y2 && range2y1 <= range1y2) { + if (sarr.overlaps.indexOf(arr.rangeName) < 0) { + sarr.overlaps.push(arr.rangeName); + } + if (sarr.overlaps.indexOf(sarr.y[sri].rangeName) < 0) { + sarr.overlaps.push(sarr.y[sri].rangeName); + } + } + } + } + }); + }); + } + }); + return range; + } + }, { + key: "handleCandleStickBoxData", + value: function handleCandleStickBoxData(ser, i) { + var gl = this.w.globals; + var ohlc = {}; + if (this.isFormat2DArray()) { + ohlc = this.handleCandleStickBoxDataFormat('array', ser, i); + } else if (this.isFormatXY()) { + ohlc = this.handleCandleStickBoxDataFormat('xy', ser, i); + } + gl.seriesCandleO[i] = ohlc.o; + gl.seriesCandleH[i] = ohlc.h; + gl.seriesCandleM[i] = ohlc.m; + gl.seriesCandleL[i] = ohlc.l; + gl.seriesCandleC[i] = ohlc.c; + return ohlc; + } + }, { + key: "handleRangeDataFormat", + value: function handleRangeDataFormat(format, ser, i) { + var rangeStart = []; + var rangeEnd = []; + var uniqueKeys = ser[i].data.filter(function (thing, index, self) { + return index === self.findIndex(function (t) { + return t.x === thing.x; + }); + }).map(function (r, index) { + return { + x: r.x, + overlaps: [], + y: [] + }; + }); + if (format === 'array') { + for (var j = 0; j < ser[i].data.length; j++) { + if (Array.isArray(ser[i].data[j])) { + rangeStart.push(ser[i].data[j][1][0]); + rangeEnd.push(ser[i].data[j][1][1]); + } else { + rangeStart.push(ser[i].data[j]); + rangeEnd.push(ser[i].data[j]); + } + } + } else if (format === 'xy') { + var _loop = function _loop(_j3) { + var isDataPoint2D = Array.isArray(ser[i].data[_j3].y); + var id = Utils$1.randomId(); + var x = ser[i].data[_j3].x; + var y = { + y1: isDataPoint2D ? ser[i].data[_j3].y[0] : ser[i].data[_j3].y, + y2: isDataPoint2D ? ser[i].data[_j3].y[1] : ser[i].data[_j3].y, + rangeName: id + }; + + // CAUTION: mutating config object by adding a new property + // TODO: As this is specifically for timeline rangebar charts, update the docs mentioning the series only supports xy format + ser[i].data[_j3].rangeName = id; + var uI = uniqueKeys.findIndex(function (t) { + return t.x === x; + }); + uniqueKeys[uI].y.push(y); + rangeStart.push(y.y1); + rangeEnd.push(y.y2); + }; + for (var _j3 = 0; _j3 < ser[i].data.length; _j3++) { + _loop(_j3); + } + } + return { + start: rangeStart, + end: rangeEnd, + rangeUniques: uniqueKeys + }; + } + }, { + key: "handleCandleStickBoxDataFormat", + value: function handleCandleStickBoxDataFormat(format, ser, i) { + var w = this.w; + var isBoxPlot = w.config.chart.type === 'boxPlot' || w.config.series[i].type === 'boxPlot'; + var serO = []; + var serH = []; + var serM = []; + var serL = []; + var serC = []; + if (format === 'array') { + if (isBoxPlot && ser[i].data[0].length === 6 || !isBoxPlot && ser[i].data[0].length === 5) { + for (var j = 0; j < ser[i].data.length; j++) { + serO.push(ser[i].data[j][1]); + serH.push(ser[i].data[j][2]); + if (isBoxPlot) { + serM.push(ser[i].data[j][3]); + serL.push(ser[i].data[j][4]); + serC.push(ser[i].data[j][5]); + } else { + serL.push(ser[i].data[j][3]); + serC.push(ser[i].data[j][4]); + } + } + } else { + for (var _j4 = 0; _j4 < ser[i].data.length; _j4++) { + if (Array.isArray(ser[i].data[_j4][1])) { + serO.push(ser[i].data[_j4][1][0]); + serH.push(ser[i].data[_j4][1][1]); + if (isBoxPlot) { + serM.push(ser[i].data[_j4][1][2]); + serL.push(ser[i].data[_j4][1][3]); + serC.push(ser[i].data[_j4][1][4]); + } else { + serL.push(ser[i].data[_j4][1][2]); + serC.push(ser[i].data[_j4][1][3]); + } + } + } + } + } else if (format === 'xy') { + for (var _j5 = 0; _j5 < ser[i].data.length; _j5++) { + if (Array.isArray(ser[i].data[_j5].y)) { + serO.push(ser[i].data[_j5].y[0]); + serH.push(ser[i].data[_j5].y[1]); + if (isBoxPlot) { + serM.push(ser[i].data[_j5].y[2]); + serL.push(ser[i].data[_j5].y[3]); + serC.push(ser[i].data[_j5].y[4]); + } else { + serL.push(ser[i].data[_j5].y[2]); + serC.push(ser[i].data[_j5].y[3]); + } + } + } + } + return { + o: serO, + h: serH, + m: serM, + l: serL, + c: serC + }; + } + }, { + key: "parseDataAxisCharts", + value: function parseDataAxisCharts(ser) { + var _this = this; + var ctx = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.ctx; + var cnf = this.w.config; + var gl = this.w.globals; + var dt = new DateTime(ctx); + var xlabels = cnf.labels.length > 0 ? cnf.labels.slice() : cnf.xaxis.categories.slice(); + gl.isRangeBar = cnf.chart.type === 'rangeBar' && gl.isBarHorizontal; + gl.hasXaxisGroups = cnf.xaxis.type === 'category' && cnf.xaxis.group.groups.length > 0; + if (gl.hasXaxisGroups) { + gl.groups = cnf.xaxis.group.groups; + } + ser.forEach(function (s, i) { + if (s.name !== undefined) { + gl.seriesNames.push(s.name); + } else { + gl.seriesNames.push('series-' + parseInt(i + 1, 10)); + } + }); + this.coreUtils.setSeriesYAxisMappings(); + // At this point, every series that didn't have a user defined group name + // has been given a name according to the yaxis the series is referenced by. + // This fits the existing behaviour where all series associated with an axis + // are defacto presented as a single group. It is now formalised. + var buckets = []; + var groups = _toConsumableArray(new Set(cnf.series.map(function (s) { + return s.group; + }))); + cnf.series.forEach(function (s, i) { + var index = groups.indexOf(s.group); + if (!buckets[index]) buckets[index] = []; + buckets[index].push(gl.seriesNames[i]); + }); + gl.seriesGroups = buckets; + var handleDates = function handleDates() { + for (var j = 0; j < xlabels.length; j++) { + if (typeof xlabels[j] === 'string') { + // user provided date strings + var isDate = dt.isValidDate(xlabels[j]); + if (isDate) { + _this.twoDSeriesX.push(dt.parseDate(xlabels[j])); + } else { + throw new Error('You have provided invalid Date format. Please provide a valid JavaScript Date'); + } + } else { + // user provided timestamps + _this.twoDSeriesX.push(xlabels[j]); + } + } + }; + for (var i = 0; i < ser.length; i++) { + this.twoDSeries = []; + this.twoDSeriesX = []; + this.threeDSeries = []; + if (typeof ser[i].data === 'undefined') { + console.error("It is a possibility that you may have not included 'data' property in series."); + return; + } + if (cnf.chart.type === 'rangeBar' || cnf.chart.type === 'rangeArea' || ser[i].type === 'rangeBar' || ser[i].type === 'rangeArea') { + gl.isRangeData = true; + if (cnf.chart.type === 'rangeBar' || cnf.chart.type === 'rangeArea') { + this.handleRangeData(ser, i); + } + } + if (this.isMultiFormat()) { + if (this.isFormat2DArray()) { + this.handleFormat2DArray(ser, i); + } else if (this.isFormatXY()) { + this.handleFormatXY(ser, i); + } + if (cnf.chart.type === 'candlestick' || ser[i].type === 'candlestick' || cnf.chart.type === 'boxPlot' || ser[i].type === 'boxPlot') { + this.handleCandleStickBoxData(ser, i); + } + gl.series.push(this.twoDSeries); + gl.labels.push(this.twoDSeriesX); + gl.seriesX.push(this.twoDSeriesX); + gl.seriesGoals = this.seriesGoals; + if (i === this.activeSeriesIndex && !this.fallbackToCategory) { + gl.isXNumeric = true; + } + } else { + if (cnf.xaxis.type === 'datetime') { + // user didn't supplied [{x,y}] or [[x,y]], but single array in data. + // Also labels/categories were supplied differently + gl.isXNumeric = true; + handleDates(); + gl.seriesX.push(this.twoDSeriesX); + } else if (cnf.xaxis.type === 'numeric') { + gl.isXNumeric = true; + if (xlabels.length > 0) { + this.twoDSeriesX = xlabels; + gl.seriesX.push(this.twoDSeriesX); + } + } + gl.labels.push(this.twoDSeriesX); + var singleArray = ser[i].data.map(function (d) { + return Utils$1.parseNumber(d); + }); + gl.series.push(singleArray); + } + gl.seriesZ.push(this.threeDSeries); + + // overrided default color if user inputs color with series data + if (ser[i].color !== undefined) { + gl.seriesColors.push(ser[i].color); + } else { + gl.seriesColors.push(undefined); + } + } + return this.w; + } + }, { + key: "parseDataNonAxisCharts", + value: function parseDataNonAxisCharts(ser) { + var gl = this.w.globals; + var cnf = this.w.config; + gl.series = ser.slice(); + gl.seriesNames = cnf.labels.slice(); + for (var i = 0; i < gl.series.length; i++) { + if (gl.seriesNames[i] === undefined) { + gl.seriesNames.push('series-' + (i + 1)); + } + } + return this.w; + } + + /** User possibly set string categories in xaxis.categories or labels prop + * Or didn't set xaxis labels at all - in which case we manually do it. + * If user passed series data as [[3, 2], [4, 5]] or [{ x: 3, y: 55 }], + * this shouldn't be called + * @param {array} ser - the series which user passed to the config + */ + }, { + key: "handleExternalLabelsData", + value: function handleExternalLabelsData(ser) { + var cnf = this.w.config; + var gl = this.w.globals; + if (cnf.xaxis.categories.length > 0) { + // user provided labels in xaxis.category prop + gl.labels = cnf.xaxis.categories; + } else if (cnf.labels.length > 0) { + // user provided labels in labels props + gl.labels = cnf.labels.slice(); + } else if (this.fallbackToCategory) { + // user provided labels in x prop in [{ x: 3, y: 55 }] data, and those labels are already stored in gl.labels[0], so just re-arrange the gl.labels array + gl.labels = gl.labels[0]; + if (gl.seriesRange.length) { + gl.seriesRange.map(function (srt) { + srt.forEach(function (sr) { + if (gl.labels.indexOf(sr.x) < 0 && sr.x) { + gl.labels.push(sr.x); + } + }); + }); + // remove duplicate x-axis labels + gl.labels = Array.from(new Set(gl.labels.map(JSON.stringify)), JSON.parse); + } + if (cnf.xaxis.convertedCatToNumeric) { + var defaults = new Defaults(cnf); + defaults.convertCatToNumericXaxis(cnf, this.ctx, gl.seriesX[0]); + this._generateExternalLabels(ser); + } + } else { + this._generateExternalLabels(ser); + } + } + }, { + key: "_generateExternalLabels", + value: function _generateExternalLabels(ser) { + var gl = this.w.globals; + var cnf = this.w.config; + // user didn't provided any labels, fallback to 1-2-3-4-5 + var labelArr = []; + if (gl.axisCharts) { + if (gl.series.length > 0) { + if (this.isFormatXY()) { + // in case there is a combo chart (boxplot/scatter) + // and there are duplicated x values, we need to eliminate duplicates + var seriesDataFiltered = cnf.series.map(function (serie, s) { + return serie.data.filter(function (v, i, a) { + return a.findIndex(function (t) { + return t.x === v.x; + }) === i; + }); + }); + var len = seriesDataFiltered.reduce(function (p, c, i, a) { + return a[p].length > c.length ? p : i; + }, 0); + for (var i = 0; i < seriesDataFiltered[len].length; i++) { + labelArr.push(i + 1); + } + } else { + for (var _i = 0; _i < gl.series[gl.maxValsInArrayIndex].length; _i++) { + labelArr.push(_i + 1); + } + } + } + gl.seriesX = []; + // create gl.seriesX as it will be used in calculations of x positions + for (var _i2 = 0; _i2 < ser.length; _i2++) { + gl.seriesX.push(labelArr); + } + + // turn on the isXNumeric flag to allow minX and maxX to function properly + if (!this.w.globals.isBarHorizontal) { + gl.isXNumeric = true; + } + } + + // no series to pull labels from, put a 0-10 series + // possibly, user collapsed all series. Hence we can't work with above calc + if (labelArr.length === 0) { + labelArr = gl.axisCharts ? [] : gl.series.map(function (gls, glsi) { + return glsi + 1; + }); + for (var _i3 = 0; _i3 < ser.length; _i3++) { + gl.seriesX.push(labelArr); + } + } + + // Finally, pass the labelArr in gl.labels which will be printed on x-axis + gl.labels = labelArr; + if (cnf.xaxis.convertedCatToNumeric) { + gl.categoryLabels = labelArr.map(function (l) { + return cnf.xaxis.labels.formatter(l); + }); + } + + // Turn on this global flag to indicate no labels were provided by user + gl.noLabelsProvided = true; + } + + // Segregate user provided data into appropriate vars + }, { + key: "parseData", + value: function parseData(ser) { + var w = this.w; + var cnf = w.config; + var gl = w.globals; + this.excludeCollapsedSeriesInYAxis(); + + // If we detected string in X prop of series, we fallback to category x-axis + this.fallbackToCategory = false; + this.ctx.core.resetGlobals(); + this.ctx.core.isMultipleY(); + if (gl.axisCharts) { + // axisCharts includes line / area / column / scatter + this.parseDataAxisCharts(ser); + this.coreUtils.getLargestSeries(); + } else { + // non-axis charts are pie / donut + this.parseDataNonAxisCharts(ser); + } + + // set Null values to 0 in all series when user hides/shows some series + if (cnf.chart.stacked) { + var series = new Series(this.ctx); + gl.series = series.setNullSeriesToZeroValues(gl.series); + } + this.coreUtils.getSeriesTotals(); + if (gl.axisCharts) { + gl.stackedSeriesTotals = this.coreUtils.getStackedSeriesTotals(); + gl.stackedSeriesTotalsByGroups = this.coreUtils.getStackedSeriesTotalsByGroups(); + } + this.coreUtils.getPercentSeries(); + if (!gl.dataFormatXNumeric && (!gl.isXNumeric || cnf.xaxis.type === 'numeric' && cnf.labels.length === 0 && cnf.xaxis.categories.length === 0)) { + // x-axis labels couldn't be detected; hence try searching every option in config + this.handleExternalLabelsData(ser); + } + + // check for multiline xaxis + var catLabels = this.coreUtils.getCategoryLabels(gl.labels); + for (var l = 0; l < catLabels.length; l++) { + if (Array.isArray(catLabels[l])) { + gl.isMultiLineX = true; + break; + } + } + } + }, { + key: "excludeCollapsedSeriesInYAxis", + value: function excludeCollapsedSeriesInYAxis() { + var w = this.w; + // Post revision 3.46.0 there is no longer a strict one-to-one + // correspondence between series and Y axes. + // An axis can be ignored only while all series referenced by it + // are collapsed. + var yAxisIndexes = []; + w.globals.seriesYAxisMap.forEach(function (yAxisArr, yi) { + var collapsedCount = 0; + yAxisArr.forEach(function (seriesIndex) { + if (w.globals.collapsedSeriesIndices.indexOf(seriesIndex) !== -1) { + collapsedCount++; + } + }); + // It's possible to have a yaxis that doesn't reference any series yet, + // eg, because there are no series' yet, so don't list it as ignored + // prematurely. + if (collapsedCount > 0 && collapsedCount == yAxisArr.length) { + yAxisIndexes.push(yi); + } + }); + w.globals.ignoreYAxisIndexes = yAxisIndexes.map(function (x) { + return x; + }); + } + }]); + return Data; + }(); + + var Exports = /*#__PURE__*/function () { + function Exports(ctx) { + _classCallCheck(this, Exports); + this.ctx = ctx; + this.w = ctx.w; + } + _createClass(Exports, [{ + key: "svgStringToNode", + value: function svgStringToNode(svgString) { + var parser = new DOMParser(); + var svgDoc = parser.parseFromString(svgString, 'image/svg+xml'); + return svgDoc.documentElement; + } + }, { + key: "scaleSvgNode", + value: function scaleSvgNode(svg, scale) { + // get current both width and height of the svg + var svgWidth = parseFloat(svg.getAttributeNS(null, 'width')); + var svgHeight = parseFloat(svg.getAttributeNS(null, 'height')); + // set new width and height based on the scale + svg.setAttributeNS(null, 'width', svgWidth * scale); + svg.setAttributeNS(null, 'height', svgHeight * scale); + svg.setAttributeNS(null, 'viewBox', '0 0 ' + svgWidth + ' ' + svgHeight); + } + }, { + key: "getSvgString", + value: function getSvgString(_scale) { + var _this = this; + return new Promise(function (resolve) { + var w = _this.w; + var scale = _scale || w.config.chart.toolbar.export.scale || w.config.chart.toolbar.export.width / w.globals.svgWidth; + if (!scale) { + scale = 1; // if no scale is specified, don't scale... + } + var width = w.globals.svgWidth * scale; + var height = w.globals.svgHeight * scale; + var clonedNode = w.globals.dom.elWrap.cloneNode(true); + clonedNode.style.width = width + 'px'; + clonedNode.style.height = height + 'px'; + var serializedNode = new XMLSerializer().serializeToString(clonedNode); + var svgString = "\n \n \n
\n \n ").concat(serializedNode, "\n
\n
\n
\n "); + var svgNode = _this.svgStringToNode(svgString); + if (scale !== 1) { + // scale the image + _this.scaleSvgNode(svgNode, scale); + } + _this.convertImagesToBase64(svgNode).then(function () { + svgString = new XMLSerializer().serializeToString(svgNode); + resolve(svgString.replace(/ /g, ' ')); + }); + }); + } + }, { + key: "convertImagesToBase64", + value: function convertImagesToBase64(svgNode) { + var _this2 = this; + var images = svgNode.getElementsByTagName('image'); + var promises = Array.from(images).map(function (img) { + var href = img.getAttributeNS('http://www.w3.org/1999/xlink', 'href'); + if (href && !href.startsWith('data:')) { + return _this2.getBase64FromUrl(href).then(function (base64) { + img.setAttributeNS('http://www.w3.org/1999/xlink', 'href', base64); + }).catch(function (error) { + console.error('Error converting image to base64:', error); + }); + } + return Promise.resolve(); + }); + return Promise.all(promises); + } + }, { + key: "getBase64FromUrl", + value: function getBase64FromUrl(url) { + return new Promise(function (resolve, reject) { + var img = new Image(); + img.crossOrigin = 'Anonymous'; + img.onload = function () { + var canvas = document.createElement('canvas'); + canvas.width = img.width; + canvas.height = img.height; + var ctx = canvas.getContext('2d'); + ctx.drawImage(img, 0, 0); + resolve(canvas.toDataURL()); + }; + img.onerror = reject; + img.src = url; + }); + } + }, { + key: "svgUrl", + value: function svgUrl() { + var _this3 = this; + return new Promise(function (resolve) { + _this3.getSvgString().then(function (svgData) { + var svgBlob = new Blob([svgData], { + type: 'image/svg+xml;charset=utf-8' + }); + resolve(URL.createObjectURL(svgBlob)); + }); + }); + } + }, { + key: "dataURI", + value: function dataURI(options) { + var _this4 = this; + return new Promise(function (resolve) { + var w = _this4.w; + var scale = options ? options.scale || options.width / w.globals.svgWidth : 1; + var canvas = document.createElement('canvas'); + canvas.width = w.globals.svgWidth * scale; + canvas.height = parseInt(w.globals.dom.elWrap.style.height, 10) * scale; // because of resizeNonAxisCharts + + var canvasBg = w.config.chart.background === 'transparent' || !w.config.chart.background ? '#fff' : w.config.chart.background; + var ctx = canvas.getContext('2d'); + ctx.fillStyle = canvasBg; + ctx.fillRect(0, 0, canvas.width * scale, canvas.height * scale); + _this4.getSvgString(scale).then(function (svgData) { + var svgUrl = 'data:image/svg+xml,' + encodeURIComponent(svgData); + var img = new Image(); + img.crossOrigin = 'anonymous'; + img.onload = function () { + ctx.drawImage(img, 0, 0); + if (canvas.msToBlob) { + // Microsoft Edge can't navigate to data urls, so we return the blob instead + var blob = canvas.msToBlob(); + resolve({ + blob: blob + }); + } else { + var imgURI = canvas.toDataURL('image/png'); + resolve({ + imgURI: imgURI + }); + } + }; + img.src = svgUrl; + }); + }); + } + }, { + key: "exportToSVG", + value: function exportToSVG() { + var _this5 = this; + this.svgUrl().then(function (url) { + _this5.triggerDownload(url, _this5.w.config.chart.toolbar.export.svg.filename, '.svg'); + }); + } + }, { + key: "exportToPng", + value: function exportToPng() { + var _this6 = this; + var scale = this.w.config.chart.toolbar.export.scale; + var width = this.w.config.chart.toolbar.export.width; + var option = scale ? { + scale: scale + } : width ? { + width: width + } : undefined; + this.dataURI(option).then(function (_ref) { + var imgURI = _ref.imgURI, + blob = _ref.blob; + if (blob) { + navigator.msSaveOrOpenBlob(blob, _this6.w.globals.chartID + '.png'); + } else { + _this6.triggerDownload(imgURI, _this6.w.config.chart.toolbar.export.png.filename, '.png'); + } + }); + } + }, { + key: "exportToCSV", + value: function exportToCSV(_ref2) { + var _this7 = this; + var series = _ref2.series, + fileName = _ref2.fileName, + _ref2$columnDelimiter = _ref2.columnDelimiter, + columnDelimiter = _ref2$columnDelimiter === void 0 ? ',' : _ref2$columnDelimiter, + _ref2$lineDelimiter = _ref2.lineDelimiter, + lineDelimiter = _ref2$lineDelimiter === void 0 ? '\n' : _ref2$lineDelimiter; + var w = this.w; + if (!series) series = w.config.series; + var columns = []; + var rows = []; + var result = ''; + var universalBOM = "\uFEFF"; + var gSeries = w.globals.series.map(function (s, i) { + return w.globals.collapsedSeriesIndices.indexOf(i) === -1 ? s : []; + }); + var getFormattedCategory = function getFormattedCategory(cat) { + if (typeof w.config.chart.toolbar.export.csv.categoryFormatter === 'function') { + return w.config.chart.toolbar.export.csv.categoryFormatter(cat); + } + if (w.config.xaxis.type === 'datetime' && String(cat).length >= 10) { + return new Date(cat).toDateString(); + } + return Utils$1.isNumber(cat) ? cat : cat.split(columnDelimiter).join(''); + }; + var getFormattedValue = function getFormattedValue(value) { + return typeof w.config.chart.toolbar.export.csv.valueFormatter === 'function' ? w.config.chart.toolbar.export.csv.valueFormatter(value) : value; + }; + var seriesMaxDataLength = Math.max.apply(Math, _toConsumableArray(series.map(function (s) { + return s.data ? s.data.length : 0; + }))); + var dataFormat = new Data(this.ctx); + var axesUtils = new AxesUtils(this.ctx); + var getCat = function getCat(i) { + var cat = ''; + + // pie / donut/ radial + if (!w.globals.axisCharts) { + cat = w.config.labels[i]; + } else { + // xy charts + + // non datetime + if (w.config.xaxis.type === 'category' || w.config.xaxis.convertedCatToNumeric) { + if (w.globals.isBarHorizontal) { + var lbFormatter = w.globals.yLabelFormatters[0]; + var sr = new Series(_this7.ctx); + var activeSeries = sr.getActiveConfigSeriesIndex(); + cat = lbFormatter(w.globals.labels[i], { + seriesIndex: activeSeries, + dataPointIndex: i, + w: w + }); + } else { + cat = axesUtils.getLabel(w.globals.labels, w.globals.timescaleLabels, 0, i).text; + } + } + + // datetime, but labels specified in categories or labels + if (w.config.xaxis.type === 'datetime') { + if (w.config.xaxis.categories.length) { + cat = w.config.xaxis.categories[i]; + } else if (w.config.labels.length) { + cat = w.config.labels[i]; + } + } + } + + // let the caller know the current category is null. this can happen for example + // when dealing with line charts having inconsistent time series data + if (cat === null) return 'nullvalue'; + if (Array.isArray(cat)) { + cat = cat.join(' '); + } + return Utils$1.isNumber(cat) ? cat : cat.split(columnDelimiter).join(''); + }; + + // Fix https://github.com/apexcharts/apexcharts.js/issues/3365 + var getEmptyDataForCsvColumn = function getEmptyDataForCsvColumn() { + return _toConsumableArray(Array(seriesMaxDataLength)).map(function () { + return ''; + }); + }; + var handleAxisRowsColumns = function handleAxisRowsColumns(s, sI) { + if (columns.length && sI === 0) { + // It's the first series. Go ahead and create the first row with header information. + rows.push(columns.join(columnDelimiter)); + } + if (s.data) { + // Use the data we have, or generate a properly sized empty array with empty data if some data is missing. + s.data = s.data.length && s.data || getEmptyDataForCsvColumn(); + for (var i = 0; i < s.data.length; i++) { + // Reset the columns array so that we can start building columns for this row. + columns = []; + var cat = getCat(i); + + // current category is null, let's move on to the next one + if (cat === 'nullvalue') continue; + if (!cat) { + if (dataFormat.isFormatXY()) { + cat = series[sI].data[i].x; + } else if (dataFormat.isFormat2DArray()) { + cat = series[sI].data[i] ? series[sI].data[i][0] : ''; + } + } + if (sI === 0) { + // It's the first series. Also handle the category. + columns.push(getFormattedCategory(cat)); + for (var ci = 0; ci < w.globals.series.length; ci++) { + var _series$ci$data$i; + var value = dataFormat.isFormatXY() ? (_series$ci$data$i = series[ci].data[i]) === null || _series$ci$data$i === void 0 ? void 0 : _series$ci$data$i.y : gSeries[ci][i]; + columns.push(getFormattedValue(value)); + } + } + if (w.config.chart.type === 'candlestick' || s.type && s.type === 'candlestick') { + columns.pop(); + columns.push(w.globals.seriesCandleO[sI][i]); + columns.push(w.globals.seriesCandleH[sI][i]); + columns.push(w.globals.seriesCandleL[sI][i]); + columns.push(w.globals.seriesCandleC[sI][i]); + } + if (w.config.chart.type === 'boxPlot' || s.type && s.type === 'boxPlot') { + columns.pop(); + columns.push(w.globals.seriesCandleO[sI][i]); + columns.push(w.globals.seriesCandleH[sI][i]); + columns.push(w.globals.seriesCandleM[sI][i]); + columns.push(w.globals.seriesCandleL[sI][i]); + columns.push(w.globals.seriesCandleC[sI][i]); + } + if (w.config.chart.type === 'rangeBar') { + columns.pop(); + columns.push(w.globals.seriesRangeStart[sI][i]); + columns.push(w.globals.seriesRangeEnd[sI][i]); + } + if (columns.length) { + rows.push(columns.join(columnDelimiter)); + } + } + } + }; + var handleUnequalXValues = function handleUnequalXValues() { + var categories = new Set(); + var data = {}; + series.forEach(function (s, sI) { + s === null || s === void 0 ? void 0 : s.data.forEach(function (dataItem) { + var cat, value; + if (dataFormat.isFormatXY()) { + cat = dataItem.x; + value = dataItem.y; + } else if (dataFormat.isFormat2DArray()) { + cat = dataItem[0]; + value = dataItem[1]; + } else { + return; + } + if (!data[cat]) { + data[cat] = Array(series.length).fill(''); + } + data[cat][sI] = getFormattedValue(value); + categories.add(cat); + }); + }); + if (columns.length) { + rows.push(columns.join(columnDelimiter)); + } + Array.from(categories).sort().forEach(function (cat) { + rows.push([getFormattedCategory(cat), data[cat].join(columnDelimiter)]); + }); + }; + columns.push(w.config.chart.toolbar.export.csv.headerCategory); + if (w.config.chart.type === 'boxPlot') { + columns.push('minimum'); + columns.push('q1'); + columns.push('median'); + columns.push('q3'); + columns.push('maximum'); + } else if (w.config.chart.type === 'candlestick') { + columns.push('open'); + columns.push('high'); + columns.push('low'); + columns.push('close'); + } else if (w.config.chart.type === 'rangeBar') { + columns.push('minimum'); + columns.push('maximum'); + } else { + series.map(function (s, sI) { + var sname = (s.name ? s.name : "series-".concat(sI)) + ''; + if (w.globals.axisCharts) { + columns.push(sname.split(columnDelimiter).join('') ? sname.split(columnDelimiter).join('') : "series-".concat(sI)); + } + }); + } + if (!w.globals.axisCharts) { + columns.push(w.config.chart.toolbar.export.csv.headerValue); + rows.push(columns.join(columnDelimiter)); + } + if (!w.globals.allSeriesHasEqualX && w.globals.axisCharts && !w.config.xaxis.categories.length && !w.config.labels.length) { + handleUnequalXValues(); + } else { + series.map(function (s, sI) { + if (w.globals.axisCharts) { + handleAxisRowsColumns(s, sI); + } else { + columns = []; + columns.push(getFormattedCategory(w.globals.labels[sI])); + columns.push(getFormattedValue(gSeries[sI])); + rows.push(columns.join(columnDelimiter)); + } + }); + } + result += rows.join(lineDelimiter); + this.triggerDownload('data:text/csv; charset=utf-8,' + encodeURIComponent(universalBOM + result), fileName ? fileName : w.config.chart.toolbar.export.csv.filename, '.csv'); + } + }, { + key: "triggerDownload", + value: function triggerDownload(href, filename, ext) { + var downloadLink = document.createElement('a'); + downloadLink.href = href; + downloadLink.download = (filename ? filename : this.w.globals.chartID) + ext; + document.body.appendChild(downloadLink); + downloadLink.click(); + document.body.removeChild(downloadLink); + } + }]); + return Exports; + }(); + + /** + * ApexCharts XAxis Class for drawing X-Axis. + * + * @module XAxis + **/ + var XAxis = /*#__PURE__*/function () { + function XAxis(ctx, elgrid) { + _classCallCheck(this, XAxis); + this.ctx = ctx; + this.elgrid = elgrid; + this.w = ctx.w; + var w = this.w; + this.axesUtils = new AxesUtils(ctx); + this.xaxisLabels = w.globals.labels.slice(); + if (w.globals.timescaleLabels.length > 0 && !w.globals.isBarHorizontal) { + // timeline labels are there and chart is not rangeabr timeline + this.xaxisLabels = w.globals.timescaleLabels.slice(); + } + if (w.config.xaxis.overwriteCategories) { + this.xaxisLabels = w.config.xaxis.overwriteCategories; + } + this.drawnLabels = []; + this.drawnLabelsRects = []; + if (w.config.xaxis.position === 'top') { + this.offY = 0; + } else { + this.offY = w.globals.gridHeight; + } + this.offY = this.offY + w.config.xaxis.axisBorder.offsetY; + this.isCategoryBarHorizontal = w.config.chart.type === 'bar' && w.config.plotOptions.bar.horizontal; + this.xaxisFontSize = w.config.xaxis.labels.style.fontSize; + this.xaxisFontFamily = w.config.xaxis.labels.style.fontFamily; + this.xaxisForeColors = w.config.xaxis.labels.style.colors; + this.xaxisBorderWidth = w.config.xaxis.axisBorder.width; + if (this.isCategoryBarHorizontal) { + this.xaxisBorderWidth = w.config.yaxis[0].axisBorder.width.toString(); + } + if (this.xaxisBorderWidth.indexOf('%') > -1) { + this.xaxisBorderWidth = w.globals.gridWidth * parseInt(this.xaxisBorderWidth, 10) / 100; + } else { + this.xaxisBorderWidth = parseInt(this.xaxisBorderWidth, 10); + } + this.xaxisBorderHeight = w.config.xaxis.axisBorder.height; + + // For bars, we will only consider single y xais, + // as we are not providing multiple yaxis for bar charts + this.yaxis = w.config.yaxis[0]; + } + _createClass(XAxis, [{ + key: "drawXaxis", + value: function drawXaxis() { + var w = this.w; + var graphics = new Graphics(this.ctx); + var elXaxis = graphics.group({ + class: 'apexcharts-xaxis', + transform: "translate(".concat(w.config.xaxis.offsetX, ", ").concat(w.config.xaxis.offsetY, ")") + }); + var elXaxisTexts = graphics.group({ + class: 'apexcharts-xaxis-texts-g', + transform: "translate(".concat(w.globals.translateXAxisX, ", ").concat(w.globals.translateXAxisY, ")") + }); + elXaxis.add(elXaxisTexts); + var labels = []; + for (var i = 0; i < this.xaxisLabels.length; i++) { + labels.push(this.xaxisLabels[i]); + } + this.drawXAxisLabelAndGroup(true, graphics, elXaxisTexts, labels, w.globals.isXNumeric, function (i, colWidth) { + return colWidth; + }); + if (w.globals.hasXaxisGroups) { + var labelsGroup = w.globals.groups; + labels = []; + for (var _i = 0; _i < labelsGroup.length; _i++) { + labels.push(labelsGroup[_i].title); + } + var overwriteStyles = {}; + if (w.config.xaxis.group.style) { + overwriteStyles.xaxisFontSize = w.config.xaxis.group.style.fontSize; + overwriteStyles.xaxisFontFamily = w.config.xaxis.group.style.fontFamily; + overwriteStyles.xaxisForeColors = w.config.xaxis.group.style.colors; + overwriteStyles.fontWeight = w.config.xaxis.group.style.fontWeight; + overwriteStyles.cssClass = w.config.xaxis.group.style.cssClass; + } + this.drawXAxisLabelAndGroup(false, graphics, elXaxisTexts, labels, false, function (i, colWidth) { + return labelsGroup[i].cols * colWidth; + }, overwriteStyles); + } + if (w.config.xaxis.title.text !== undefined) { + var elXaxisTitle = graphics.group({ + class: 'apexcharts-xaxis-title' + }); + var elXAxisTitleText = graphics.drawText({ + x: w.globals.gridWidth / 2 + w.config.xaxis.title.offsetX, + y: this.offY + parseFloat(this.xaxisFontSize) + (w.config.xaxis.position === 'bottom' ? w.globals.xAxisLabelsHeight : -w.globals.xAxisLabelsHeight - 10) + w.config.xaxis.title.offsetY, + text: w.config.xaxis.title.text, + textAnchor: 'middle', + fontSize: w.config.xaxis.title.style.fontSize, + fontFamily: w.config.xaxis.title.style.fontFamily, + fontWeight: w.config.xaxis.title.style.fontWeight, + foreColor: w.config.xaxis.title.style.color, + cssClass: 'apexcharts-xaxis-title-text ' + w.config.xaxis.title.style.cssClass + }); + elXaxisTitle.add(elXAxisTitleText); + elXaxis.add(elXaxisTitle); + } + if (w.config.xaxis.axisBorder.show) { + var offX = w.globals.barPadForNumericAxis; + var elHorzLine = graphics.drawLine(w.globals.padHorizontal + w.config.xaxis.axisBorder.offsetX - offX, this.offY, this.xaxisBorderWidth + offX, this.offY, w.config.xaxis.axisBorder.color, 0, this.xaxisBorderHeight); + if (this.elgrid && this.elgrid.elGridBorders && w.config.grid.show) { + this.elgrid.elGridBorders.add(elHorzLine); + } else { + elXaxis.add(elHorzLine); + } + } + return elXaxis; + } + }, { + key: "drawXAxisLabelAndGroup", + value: function drawXAxisLabelAndGroup(isLeafGroup, graphics, elXaxisTexts, labels, isXNumeric, colWidthCb) { + var _this = this; + var overwriteStyles = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : {}; + var drawnLabels = []; + var drawnLabelsRects = []; + var w = this.w; + var xaxisFontSize = overwriteStyles.xaxisFontSize || this.xaxisFontSize; + var xaxisFontFamily = overwriteStyles.xaxisFontFamily || this.xaxisFontFamily; + var xaxisForeColors = overwriteStyles.xaxisForeColors || this.xaxisForeColors; + var fontWeight = overwriteStyles.fontWeight || w.config.xaxis.labels.style.fontWeight; + var cssClass = overwriteStyles.cssClass || w.config.xaxis.labels.style.cssClass; + var colWidth; + + // initial x Position (keep adding column width in the loop) + var xPos = w.globals.padHorizontal; + var labelsLen = labels.length; + + /** + * labelsLen can be different (whether you are drawing x-axis labels or x-axis group labels) + * hence, we introduce dataPoints to be consistent. + * Also, in datetime/numeric xaxis, dataPoints can be misleading, so we resort to labelsLen for such xaxis type + */ + var dataPoints = w.config.xaxis.type === 'category' ? w.globals.dataPoints : labelsLen; + + // when all series are collapsed, fixes #3381 + if (dataPoints === 0 && labelsLen > dataPoints) dataPoints = labelsLen; + if (isXNumeric) { + var len = Math.max(Number(w.config.xaxis.tickAmount) || 1, dataPoints > 1 ? dataPoints - 1 : dataPoints); + colWidth = w.globals.gridWidth / Math.min(len, labelsLen - 1); + xPos = xPos + colWidthCb(0, colWidth) / 2 + w.config.xaxis.labels.offsetX; + } else { + colWidth = w.globals.gridWidth / dataPoints; + xPos = xPos + colWidthCb(0, colWidth) + w.config.xaxis.labels.offsetX; + } + var _loop = function _loop(i) { + var x = xPos - colWidthCb(i, colWidth) / 2 + w.config.xaxis.labels.offsetX; + if (i === 0 && labelsLen === 1 && colWidth / 2 === xPos && dataPoints === 1) { + // single datapoint + x = w.globals.gridWidth / 2; + } + var label = _this.axesUtils.getLabel(labels, w.globals.timescaleLabels, x, i, drawnLabels, xaxisFontSize, isLeafGroup); + var offsetYCorrection = 28; + if (w.globals.rotateXLabels && isLeafGroup) { + offsetYCorrection = 22; + } + if (w.config.xaxis.title.text && w.config.xaxis.position === 'top') { + offsetYCorrection += parseFloat(w.config.xaxis.title.style.fontSize) + 2; + } + if (!isLeafGroup) { + offsetYCorrection = offsetYCorrection + parseFloat(xaxisFontSize) + (w.globals.xAxisLabelsHeight - w.globals.xAxisGroupLabelsHeight) + (w.globals.rotateXLabels ? 10 : 0); + } + var isCategoryTickAmounts = typeof w.config.xaxis.tickAmount !== 'undefined' && w.config.xaxis.tickAmount !== 'dataPoints' && w.config.xaxis.type !== 'datetime'; + if (isCategoryTickAmounts) { + label = _this.axesUtils.checkLabelBasedOnTickamount(i, label, labelsLen); + } else { + label = _this.axesUtils.checkForOverflowingLabels(i, label, labelsLen, drawnLabels, drawnLabelsRects); + } + var getCatForeColor = function getCatForeColor() { + return isLeafGroup && w.config.xaxis.convertedCatToNumeric ? xaxisForeColors[w.globals.minX + i - 1] : xaxisForeColors[i]; + }; + if (w.config.xaxis.labels.show) { + var elText = graphics.drawText({ + x: label.x, + y: _this.offY + w.config.xaxis.labels.offsetY + offsetYCorrection - (w.config.xaxis.position === 'top' ? w.globals.xAxisHeight + w.config.xaxis.axisTicks.height - 2 : 0), + text: label.text, + textAnchor: 'middle', + fontWeight: label.isBold ? 600 : fontWeight, + fontSize: xaxisFontSize, + fontFamily: xaxisFontFamily, + foreColor: Array.isArray(xaxisForeColors) ? getCatForeColor() : xaxisForeColors, + isPlainText: false, + cssClass: (isLeafGroup ? 'apexcharts-xaxis-label ' : 'apexcharts-xaxis-group-label ') + cssClass + }); + elXaxisTexts.add(elText); + elText.on('click', function (e) { + if (typeof w.config.chart.events.xAxisLabelClick === 'function') { + var opts = Object.assign({}, w, { + labelIndex: i + }); + w.config.chart.events.xAxisLabelClick(e, _this.ctx, opts); + } + }); + if (isLeafGroup) { + var elTooltipTitle = document.createElementNS(w.globals.SVGNS, 'title'); + elTooltipTitle.textContent = Array.isArray(label.text) ? label.text.join(' ') : label.text; + elText.node.appendChild(elTooltipTitle); + if (label.text !== '') { + drawnLabels.push(label.text); + drawnLabelsRects.push(label); + } + } + } + if (i < labelsLen - 1) { + xPos = xPos + colWidthCb(i + 1, colWidth); + } + }; + for (var i = 0; i <= labelsLen - 1; i++) { + _loop(i); + } + } + + // this actually becomes the vertical axis (for bar charts) + }, { + key: "drawXaxisInversed", + value: function drawXaxisInversed(realIndex) { + var _this2 = this; + var w = this.w; + var graphics = new Graphics(this.ctx); + var translateYAxisX = w.config.yaxis[0].opposite ? w.globals.translateYAxisX[realIndex] : 0; + var elYaxis = graphics.group({ + class: 'apexcharts-yaxis apexcharts-xaxis-inversed', + rel: realIndex + }); + var elYaxisTexts = graphics.group({ + class: 'apexcharts-yaxis-texts-g apexcharts-xaxis-inversed-texts-g', + transform: 'translate(' + translateYAxisX + ', 0)' + }); + elYaxis.add(elYaxisTexts); + var colHeight; + + // initial x Position (keep adding column width in the loop) + var yPos; + var labels = []; + if (w.config.yaxis[realIndex].show) { + for (var i = 0; i < this.xaxisLabels.length; i++) { + labels.push(this.xaxisLabels[i]); + } + } + colHeight = w.globals.gridHeight / labels.length; + yPos = -(colHeight / 2.2); + var lbFormatter = w.globals.yLabelFormatters[0]; + var ylabels = w.config.yaxis[0].labels; + if (ylabels.show) { + var _loop2 = function _loop2(_i2) { + var label = typeof labels[_i2] === 'undefined' ? '' : labels[_i2]; + label = lbFormatter(label, { + seriesIndex: realIndex, + dataPointIndex: _i2, + w: w + }); + var yColors = _this2.axesUtils.getYAxisForeColor(ylabels.style.colors, realIndex); + var getForeColor = function getForeColor() { + return Array.isArray(yColors) ? yColors[_i2] : yColors; + }; + var multiY = 0; + if (Array.isArray(label)) { + multiY = label.length / 2 * parseInt(ylabels.style.fontSize, 10); + } + var offsetX = ylabels.offsetX - 15; + var textAnchor = 'end'; + if (_this2.yaxis.opposite) { + textAnchor = 'start'; + } + if (w.config.yaxis[0].labels.align === 'left') { + offsetX = ylabels.offsetX; + textAnchor = 'start'; + } else if (w.config.yaxis[0].labels.align === 'center') { + offsetX = ylabels.offsetX; + textAnchor = 'middle'; + } else if (w.config.yaxis[0].labels.align === 'right') { + textAnchor = 'end'; + } + var elLabel = graphics.drawText({ + x: offsetX, + y: yPos + colHeight + ylabels.offsetY - multiY, + text: label, + textAnchor: textAnchor, + foreColor: getForeColor(), + fontSize: ylabels.style.fontSize, + fontFamily: ylabels.style.fontFamily, + fontWeight: ylabels.style.fontWeight, + isPlainText: false, + cssClass: 'apexcharts-yaxis-label ' + ylabels.style.cssClass, + maxWidth: ylabels.maxWidth + }); + elYaxisTexts.add(elLabel); + elLabel.on('click', function (e) { + if (typeof w.config.chart.events.xAxisLabelClick === 'function') { + var opts = Object.assign({}, w, { + labelIndex: _i2 + }); + w.config.chart.events.xAxisLabelClick(e, _this2.ctx, opts); + } + }); + var elTooltipTitle = document.createElementNS(w.globals.SVGNS, 'title'); + elTooltipTitle.textContent = Array.isArray(label) ? label.join(' ') : label; + elLabel.node.appendChild(elTooltipTitle); + if (w.config.yaxis[realIndex].labels.rotate !== 0) { + var labelRotatingCenter = graphics.rotateAroundCenter(elLabel.node); + elLabel.node.setAttribute('transform', "rotate(".concat(w.config.yaxis[realIndex].labels.rotate, " 0 ").concat(labelRotatingCenter.y, ")")); + } + yPos = yPos + colHeight; + }; + for (var _i2 = 0; _i2 <= labels.length - 1; _i2++) { + _loop2(_i2); + } + } + if (w.config.yaxis[0].title.text !== undefined) { + var elXaxisTitle = graphics.group({ + class: 'apexcharts-yaxis-title apexcharts-xaxis-title-inversed', + transform: 'translate(' + translateYAxisX + ', 0)' + }); + var elXAxisTitleText = graphics.drawText({ + x: w.config.yaxis[0].title.offsetX, + y: w.globals.gridHeight / 2 + w.config.yaxis[0].title.offsetY, + text: w.config.yaxis[0].title.text, + textAnchor: 'middle', + foreColor: w.config.yaxis[0].title.style.color, + fontSize: w.config.yaxis[0].title.style.fontSize, + fontWeight: w.config.yaxis[0].title.style.fontWeight, + fontFamily: w.config.yaxis[0].title.style.fontFamily, + cssClass: 'apexcharts-yaxis-title-text ' + w.config.yaxis[0].title.style.cssClass + }); + elXaxisTitle.add(elXAxisTitleText); + elYaxis.add(elXaxisTitle); + } + var offX = 0; + if (this.isCategoryBarHorizontal && w.config.yaxis[0].opposite) { + offX = w.globals.gridWidth; + } + var axisBorder = w.config.xaxis.axisBorder; + if (axisBorder.show) { + var elVerticalLine = graphics.drawLine(w.globals.padHorizontal + axisBorder.offsetX + offX, 1 + axisBorder.offsetY, w.globals.padHorizontal + axisBorder.offsetX + offX, w.globals.gridHeight + axisBorder.offsetY, axisBorder.color, 0); + if (this.elgrid && this.elgrid.elGridBorders && w.config.grid.show) { + this.elgrid.elGridBorders.add(elVerticalLine); + } else { + elYaxis.add(elVerticalLine); + } + } + if (w.config.yaxis[0].axisTicks.show) { + this.axesUtils.drawYAxisTicks(offX, labels.length, w.config.yaxis[0].axisBorder, w.config.yaxis[0].axisTicks, 0, colHeight, elYaxis); + } + return elYaxis; + } + }, { + key: "drawXaxisTicks", + value: function drawXaxisTicks(x1, y2, appendToElement) { + var w = this.w; + var x2 = x1; + if (x1 < 0 || x1 - 2 > w.globals.gridWidth) return; + var y1 = this.offY + w.config.xaxis.axisTicks.offsetY; + y2 = y2 + y1 + w.config.xaxis.axisTicks.height; + if (w.config.xaxis.position === 'top') { + y2 = y1 - w.config.xaxis.axisTicks.height; + } + if (w.config.xaxis.axisTicks.show) { + var graphics = new Graphics(this.ctx); + var line = graphics.drawLine(x1 + w.config.xaxis.axisTicks.offsetX, y1 + w.config.xaxis.offsetY, x2 + w.config.xaxis.axisTicks.offsetX, y2 + w.config.xaxis.offsetY, w.config.xaxis.axisTicks.color); + + // we are not returning anything, but appending directly to the element passed in param + appendToElement.add(line); + line.node.classList.add('apexcharts-xaxis-tick'); + } + } + }, { + key: "getXAxisTicksPositions", + value: function getXAxisTicksPositions() { + var w = this.w; + var xAxisTicksPositions = []; + var xCount = this.xaxisLabels.length; + var x1 = w.globals.padHorizontal; + if (w.globals.timescaleLabels.length > 0) { + for (var i = 0; i < xCount; i++) { + x1 = this.xaxisLabels[i].position; + xAxisTicksPositions.push(x1); + } + } else { + var xCountForCategoryCharts = xCount; + for (var _i3 = 0; _i3 < xCountForCategoryCharts; _i3++) { + var x1Count = xCountForCategoryCharts; + if (w.globals.isXNumeric && w.config.chart.type !== 'bar') { + x1Count -= 1; + } + x1 = x1 + w.globals.gridWidth / x1Count; + xAxisTicksPositions.push(x1); + } + } + return xAxisTicksPositions; + } + + // to rotate x-axis labels or to put ... for longer text in xaxis + }, { + key: "xAxisLabelCorrections", + value: function xAxisLabelCorrections() { + var w = this.w; + var graphics = new Graphics(this.ctx); + var xAxis = w.globals.dom.baseEl.querySelector('.apexcharts-xaxis-texts-g'); + var xAxisTexts = w.globals.dom.baseEl.querySelectorAll('.apexcharts-xaxis-texts-g text:not(.apexcharts-xaxis-group-label)'); + var yAxisTextsInversed = w.globals.dom.baseEl.querySelectorAll('.apexcharts-yaxis-inversed text'); + var xAxisTextsInversed = w.globals.dom.baseEl.querySelectorAll('.apexcharts-xaxis-inversed-texts-g text tspan'); + if (w.globals.rotateXLabels || w.config.xaxis.labels.rotateAlways) { + for (var xat = 0; xat < xAxisTexts.length; xat++) { + var textRotatingCenter = graphics.rotateAroundCenter(xAxisTexts[xat]); + textRotatingCenter.y = textRotatingCenter.y - 1; // + tickWidth/4; + textRotatingCenter.x = textRotatingCenter.x + 1; + xAxisTexts[xat].setAttribute('transform', "rotate(".concat(w.config.xaxis.labels.rotate, " ").concat(textRotatingCenter.x, " ").concat(textRotatingCenter.y, ")")); + xAxisTexts[xat].setAttribute('text-anchor', "end"); + var offsetHeight = 10; + xAxis.setAttribute('transform', "translate(0, ".concat(-offsetHeight, ")")); + var tSpan = xAxisTexts[xat].childNodes; + if (w.config.xaxis.labels.trim) { + Array.prototype.forEach.call(tSpan, function (ts) { + graphics.placeTextWithEllipsis(ts, ts.textContent, w.globals.xAxisLabelsHeight - (w.config.legend.position === 'bottom' ? 20 : 10)); + }); + } + } + } else { + (function () { + var width = w.globals.gridWidth / (w.globals.labels.length + 1); + for (var _xat = 0; _xat < xAxisTexts.length; _xat++) { + var _tSpan = xAxisTexts[_xat].childNodes; + if (w.config.xaxis.labels.trim && w.config.xaxis.type !== 'datetime') { + Array.prototype.forEach.call(_tSpan, function (ts) { + graphics.placeTextWithEllipsis(ts, ts.textContent, width); + }); + } + } + })(); + } + if (yAxisTextsInversed.length > 0) { + // truncate rotated y axis in bar chart (x axis) + var firstLabelPosX = yAxisTextsInversed[yAxisTextsInversed.length - 1].getBBox(); + var lastLabelPosX = yAxisTextsInversed[0].getBBox(); + if (firstLabelPosX.x < -20) { + yAxisTextsInversed[yAxisTextsInversed.length - 1].parentNode.removeChild(yAxisTextsInversed[yAxisTextsInversed.length - 1]); + } + if (lastLabelPosX.x + lastLabelPosX.width > w.globals.gridWidth && !w.globals.isBarHorizontal) { + yAxisTextsInversed[0].parentNode.removeChild(yAxisTextsInversed[0]); + } + + // truncate rotated x axis in bar chart (y axis) + for (var _xat2 = 0; _xat2 < xAxisTextsInversed.length; _xat2++) { + graphics.placeTextWithEllipsis(xAxisTextsInversed[_xat2], xAxisTextsInversed[_xat2].textContent, w.config.yaxis[0].labels.maxWidth - (w.config.yaxis[0].title.text ? parseFloat(w.config.yaxis[0].title.style.fontSize) * 2 : 0) - 15); + } + } + } + + // renderXAxisBands() { + // let w = this.w; + + // let plotBand = document.createElementNS(w.globals.SVGNS, 'rect') + // w.globals.dom.elGraphical.add(plotBand) + // } + }]); + return XAxis; + }(); + + /** + * ApexCharts Grid Class for drawing Cartesian Grid. + * + * @module Grid + **/ + var Grid = /*#__PURE__*/function () { + function Grid(ctx) { + _classCallCheck(this, Grid); + this.ctx = ctx; + this.w = ctx.w; + var w = this.w; + this.xaxisLabels = w.globals.labels.slice(); + this.axesUtils = new AxesUtils(ctx); + this.isRangeBar = w.globals.seriesRange.length && w.globals.isBarHorizontal; + if (w.globals.timescaleLabels.length > 0) { + // timescaleLabels labels are there + this.xaxisLabels = w.globals.timescaleLabels.slice(); + } + } + _createClass(Grid, [{ + key: "drawGridArea", + value: function drawGridArea() { + var elGrid = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + var w = this.w; + var graphics = new Graphics(this.ctx); + if (!elGrid) { + elGrid = graphics.group({ + class: 'apexcharts-grid' + }); + } + var elVerticalLine = graphics.drawLine(w.globals.padHorizontal, 1, w.globals.padHorizontal, w.globals.gridHeight, 'transparent'); + var elHorzLine = graphics.drawLine(w.globals.padHorizontal, w.globals.gridHeight, w.globals.gridWidth, w.globals.gridHeight, 'transparent'); + elGrid.add(elHorzLine); + elGrid.add(elVerticalLine); + return elGrid; + } + }, { + key: "drawGrid", + value: function drawGrid() { + var gl = this.w.globals; + if (gl.axisCharts) { + var elgrid = this.renderGrid(); + this.drawGridArea(elgrid.el); + return elgrid; + } + return null; + } + }, { + key: "createGridMask", + value: function createGridMask() { + var w = this.w; + var gl = w.globals; + var graphics = new Graphics(this.ctx); + var strokeSize = Array.isArray(w.config.stroke.width) ? Math.max.apply(Math, _toConsumableArray(w.config.stroke.width)) : w.config.stroke.width; + var createClipPath = function createClipPath(id) { + var clipPath = document.createElementNS(gl.SVGNS, 'clipPath'); + clipPath.setAttribute('id', id); + return clipPath; + }; + gl.dom.elGridRectMask = createClipPath("gridRectMask".concat(gl.cuid)); + gl.dom.elGridRectBarMask = createClipPath("gridRectBarMask".concat(gl.cuid)); + gl.dom.elGridRectMarkerMask = createClipPath("gridRectMarkerMask".concat(gl.cuid)); + gl.dom.elForecastMask = createClipPath("forecastMask".concat(gl.cuid)); + gl.dom.elNonForecastMask = createClipPath("nonForecastMask".concat(gl.cuid)); + var hasBar = ['bar', 'rangeBar', 'candlestick', 'boxPlot'].includes(w.config.chart.type) || w.globals.comboBarCount > 0; + var barWidthLeft = 0; + var barWidthRight = 0; + if (hasBar && w.globals.isXNumeric && !w.globals.isBarHorizontal) { + barWidthLeft = Math.max(w.config.grid.padding.left, gl.barPadForNumericAxis); + barWidthRight = Math.max(w.config.grid.padding.right, gl.barPadForNumericAxis); + } + gl.dom.elGridRect = graphics.drawRect(-strokeSize / 2 - 2, -strokeSize / 2 - 2, gl.gridWidth + strokeSize + 4, gl.gridHeight + strokeSize + 4, 0, '#fff'); + gl.dom.elGridRectBar = graphics.drawRect(-strokeSize / 2 - barWidthLeft - 2, -strokeSize / 2 - 2, gl.gridWidth + strokeSize + barWidthRight + barWidthLeft + 4, gl.gridHeight + strokeSize + 4, 0, '#fff'); + var markerSize = w.globals.markers.largestSize; + gl.dom.elGridRectMarker = graphics.drawRect(-markerSize, -markerSize, gl.gridWidth + markerSize * 2, gl.gridHeight + markerSize * 2, 0, '#fff'); + gl.dom.elGridRectMask.appendChild(gl.dom.elGridRect.node); + gl.dom.elGridRectBarMask.appendChild(gl.dom.elGridRectBar.node); + gl.dom.elGridRectMarkerMask.appendChild(gl.dom.elGridRectMarker.node); + var defs = gl.dom.baseEl.querySelector('defs'); + defs.appendChild(gl.dom.elGridRectMask); + defs.appendChild(gl.dom.elGridRectBarMask); + defs.appendChild(gl.dom.elGridRectMarkerMask); + defs.appendChild(gl.dom.elForecastMask); + defs.appendChild(gl.dom.elNonForecastMask); + } + }, { + key: "_drawGridLines", + value: function _drawGridLines(_ref) { + var i = _ref.i, + x1 = _ref.x1, + y1 = _ref.y1, + x2 = _ref.x2, + y2 = _ref.y2, + xCount = _ref.xCount, + parent = _ref.parent; + var w = this.w; + var shouldDraw = function shouldDraw() { + if (i === 0 && w.globals.skipFirstTimelinelabel) return false; + if (i === xCount - 1 && w.globals.skipLastTimelinelabel && !w.config.xaxis.labels.formatter) return false; + if (w.config.chart.type === 'radar') return false; + return true; + }; + if (shouldDraw()) { + if (w.config.grid.xaxis.lines.show) { + this._drawGridLine({ + i: i, + x1: x1, + y1: y1, + x2: x2, + y2: y2, + xCount: xCount, + parent: parent + }); + } + var y_2 = 0; + if (w.globals.hasXaxisGroups && w.config.xaxis.tickPlacement === 'between') { + var groups = w.globals.groups; + if (groups) { + var gacc = 0; + for (var gi = 0; gacc < i && gi < groups.length; gi++) { + gacc += groups[gi].cols; + } + if (gacc === i) { + y_2 = w.globals.xAxisLabelsHeight * 0.6; + } + } + } + var xAxis = new XAxis(this.ctx); + xAxis.drawXaxisTicks(x1, y_2, w.globals.dom.elGraphical); + } + } + }, { + key: "_drawGridLine", + value: function _drawGridLine(_ref2) { + var i = _ref2.i, + x1 = _ref2.x1, + y1 = _ref2.y1, + x2 = _ref2.x2, + y2 = _ref2.y2, + xCount = _ref2.xCount, + parent = _ref2.parent; + var w = this.w; + var isHorzLine = parent.node.classList.contains('apexcharts-gridlines-horizontal'); + var offX = w.globals.barPadForNumericAxis; + var excludeBorders = y1 === 0 && y2 === 0 || x1 === 0 && x2 === 0 || y1 === w.globals.gridHeight && y2 === w.globals.gridHeight || w.globals.isBarHorizontal && (i === 0 || i === xCount - 1); + var graphics = new Graphics(this); + var line = graphics.drawLine(x1 - (isHorzLine ? offX : 0), y1, x2 + (isHorzLine ? offX : 0), y2, w.config.grid.borderColor, w.config.grid.strokeDashArray); + line.node.classList.add('apexcharts-gridline'); + if (excludeBorders && w.config.grid.show) { + this.elGridBorders.add(line); + } else { + parent.add(line); + } + } + }, { + key: "_drawGridBandRect", + value: function _drawGridBandRect(_ref3) { + var c = _ref3.c, + x1 = _ref3.x1, + y1 = _ref3.y1, + x2 = _ref3.x2, + y2 = _ref3.y2, + type = _ref3.type; + var w = this.w; + var graphics = new Graphics(this.ctx); + var offX = w.globals.barPadForNumericAxis; + var color = w.config.grid[type].colors[c]; + var rect = graphics.drawRect(x1 - (type === 'row' ? offX : 0), y1, x2 + (type === 'row' ? offX * 2 : 0), y2, 0, color, w.config.grid[type].opacity); + this.elg.add(rect); + rect.attr('clip-path', "url(#gridRectMask".concat(w.globals.cuid, ")")); + rect.node.classList.add("apexcharts-grid-".concat(type)); + } + }, { + key: "_drawXYLines", + value: function _drawXYLines(_ref4) { + var _this = this; + var xCount = _ref4.xCount, + tickAmount = _ref4.tickAmount; + var w = this.w; + var datetimeLines = function datetimeLines(_ref5) { + var xC = _ref5.xC, + x1 = _ref5.x1, + y1 = _ref5.y1, + x2 = _ref5.x2, + y2 = _ref5.y2; + for (var i = 0; i < xC; i++) { + x1 = _this.xaxisLabels[i].position; + x2 = _this.xaxisLabels[i].position; + _this._drawGridLines({ + i: i, + x1: x1, + y1: y1, + x2: x2, + y2: y2, + xCount: xCount, + parent: _this.elgridLinesV + }); + } + }; + var categoryLines = function categoryLines(_ref6) { + var xC = _ref6.xC, + x1 = _ref6.x1, + y1 = _ref6.y1, + x2 = _ref6.x2, + y2 = _ref6.y2; + for (var i = 0; i < xC + (w.globals.isXNumeric ? 0 : 1); i++) { + if (i === 0 && xC === 1 && w.globals.dataPoints === 1) { + x1 = w.globals.gridWidth / 2; + x2 = x1; + } + _this._drawGridLines({ + i: i, + x1: x1, + y1: y1, + x2: x2, + y2: y2, + xCount: xCount, + parent: _this.elgridLinesV + }); + x1 += w.globals.gridWidth / (w.globals.isXNumeric ? xC - 1 : xC); + x2 = x1; + } + }; + if (w.config.grid.xaxis.lines.show || w.config.xaxis.axisTicks.show) { + var x1 = w.globals.padHorizontal; + var y1 = 0; + var x2; + var y2 = w.globals.gridHeight; + if (w.globals.timescaleLabels.length) { + datetimeLines({ + xC: xCount, + x1: x1, + y1: y1, + x2: x2, + y2: y2 + }); + } else { + if (w.globals.isXNumeric) { + xCount = w.globals.xAxisScale.result.length; + } + categoryLines({ + xC: xCount, + x1: x1, + y1: y1, + x2: x2, + y2: y2 + }); + } + } + if (w.config.grid.yaxis.lines.show) { + var _x = 0; + var _y = 0; + var _y2 = 0; + var _x2 = w.globals.gridWidth; + var tA = tickAmount + 1; + if (this.isRangeBar) { + tA = w.globals.labels.length; + } + for (var i = 0; i < tA + (this.isRangeBar ? 1 : 0); i++) { + this._drawGridLine({ + i: i, + xCount: tA + (this.isRangeBar ? 1 : 0), + x1: _x, + y1: _y, + x2: _x2, + y2: _y2, + parent: this.elgridLinesH + }); + _y += w.globals.gridHeight / (this.isRangeBar ? tA : tickAmount); + _y2 = _y; + } + } + } + }, { + key: "_drawInvertedXYLines", + value: function _drawInvertedXYLines(_ref7) { + var xCount = _ref7.xCount; + var w = this.w; + if (w.config.grid.xaxis.lines.show || w.config.xaxis.axisTicks.show) { + var x1 = w.globals.padHorizontal; + var y1 = 0; + var x2; + var y2 = w.globals.gridHeight; + for (var i = 0; i < xCount + 1; i++) { + if (w.config.grid.xaxis.lines.show) { + this._drawGridLine({ + i: i, + xCount: xCount + 1, + x1: x1, + y1: y1, + x2: x2, + y2: y2, + parent: this.elgridLinesV + }); + } + var xAxis = new XAxis(this.ctx); + xAxis.drawXaxisTicks(x1, 0, w.globals.dom.elGraphical); + x1 += w.globals.gridWidth / xCount; + x2 = x1; + } + } + if (w.config.grid.yaxis.lines.show) { + var _x3 = 0; + var _y3 = 0; + var _y4 = 0; + var _x4 = w.globals.gridWidth; + for (var _i = 0; _i < w.globals.dataPoints + 1; _i++) { + this._drawGridLine({ + i: _i, + xCount: w.globals.dataPoints + 1, + x1: _x3, + y1: _y3, + x2: _x4, + y2: _y4, + parent: this.elgridLinesH + }); + _y3 += w.globals.gridHeight / w.globals.dataPoints; + _y4 = _y3; + } + } + } + }, { + key: "renderGrid", + value: function renderGrid() { + var w = this.w; + var gl = w.globals; + var graphics = new Graphics(this.ctx); + this.elg = graphics.group({ + class: 'apexcharts-grid' + }); + this.elgridLinesH = graphics.group({ + class: 'apexcharts-gridlines-horizontal' + }); + this.elgridLinesV = graphics.group({ + class: 'apexcharts-gridlines-vertical' + }); + this.elGridBorders = graphics.group({ + class: 'apexcharts-grid-borders' + }); + this.elg.add(this.elgridLinesH); + this.elg.add(this.elgridLinesV); + if (!w.config.grid.show) { + this.elgridLinesV.hide(); + this.elgridLinesH.hide(); + this.elGridBorders.hide(); + } + var gridAxisIndex = 0; + while (gridAxisIndex < gl.seriesYAxisMap.length && gl.ignoreYAxisIndexes.includes(gridAxisIndex)) { + gridAxisIndex++; + } + if (gridAxisIndex === gl.seriesYAxisMap.length) { + gridAxisIndex = 0; + } + var yTickAmount = gl.yAxisScale[gridAxisIndex].result.length - 1; + var xCount; + if (!gl.isBarHorizontal || this.isRangeBar) { + xCount = this.xaxisLabels.length; + if (this.isRangeBar) { + var _gl$yAxisScale, _gl$yAxisScale$gridAx, _gl$yAxisScale$gridAx2; + yTickAmount = gl.labels.length; + if (w.config.xaxis.tickAmount && w.config.xaxis.labels.formatter) { + xCount = w.config.xaxis.tickAmount; + } + if (((_gl$yAxisScale = gl.yAxisScale) === null || _gl$yAxisScale === void 0 ? void 0 : (_gl$yAxisScale$gridAx = _gl$yAxisScale[gridAxisIndex]) === null || _gl$yAxisScale$gridAx === void 0 ? void 0 : (_gl$yAxisScale$gridAx2 = _gl$yAxisScale$gridAx.result) === null || _gl$yAxisScale$gridAx2 === void 0 ? void 0 : _gl$yAxisScale$gridAx2.length) > 0 && w.config.xaxis.type !== 'datetime') { + xCount = gl.yAxisScale[gridAxisIndex].result.length - 1; + } + } + this._drawXYLines({ + xCount: xCount, + tickAmount: yTickAmount + }); + } else { + xCount = yTickAmount; + + // for horizontal bar chart, get the xaxis tickamount + yTickAmount = gl.xTickAmount; + this._drawInvertedXYLines({ + xCount: xCount, + tickAmount: yTickAmount + }); + } + this.drawGridBands(xCount, yTickAmount); + return { + el: this.elg, + elGridBorders: this.elGridBorders, + xAxisTickWidth: gl.gridWidth / xCount + }; + } + }, { + key: "drawGridBands", + value: function drawGridBands(xCount, tickAmount) { + var _this2 = this, + _w$config$grid$row$co, + _w$config$grid$column; + var w = this.w; + var drawBands = function drawBands(type, count, x1, y1, x2, y2) { + for (var i = 0, c = 0; i < count; i++, c++) { + if (c >= w.config.grid[type].colors.length) { + c = 0; + } + _this2._drawGridBandRect({ + c: c, + x1: x1, + y1: y1, + x2: x2, + y2: y2, + type: type + }); + y1 += w.globals.gridHeight / tickAmount; + } + }; + if (((_w$config$grid$row$co = w.config.grid.row.colors) === null || _w$config$grid$row$co === void 0 ? void 0 : _w$config$grid$row$co.length) > 0) { + drawBands('row', tickAmount, 0, 0, w.globals.gridWidth, w.globals.gridHeight / tickAmount); + } + if (((_w$config$grid$column = w.config.grid.column.colors) === null || _w$config$grid$column === void 0 ? void 0 : _w$config$grid$column.length) > 0) { + var xc = !w.globals.isBarHorizontal && w.config.xaxis.tickPlacement === 'on' && (w.config.xaxis.type === 'category' || w.config.xaxis.convertedCatToNumeric) ? xCount - 1 : xCount; + if (w.globals.isXNumeric) { + xc = w.globals.xAxisScale.result.length - 1; + } + var x1 = w.globals.padHorizontal; + var y1 = 0; + var x2 = w.globals.padHorizontal + w.globals.gridWidth / xc; + var y2 = w.globals.gridHeight; + for (var i = 0, c = 0; i < xCount; i++, c++) { + if (c >= w.config.grid.column.colors.length) { + c = 0; + } + if (w.config.xaxis.type === 'datetime') { + var _this$xaxisLabels; + x1 = this.xaxisLabels[i].position; + x2 = (((_this$xaxisLabels = this.xaxisLabels[i + 1]) === null || _this$xaxisLabels === void 0 ? void 0 : _this$xaxisLabels.position) || w.globals.gridWidth) - this.xaxisLabels[i].position; + } + this._drawGridBandRect({ + c: c, + x1: x1, + y1: y1, + x2: x2, + y2: y2, + type: 'column' + }); + x1 += w.globals.gridWidth / xc; + } + } + } + }]); + return Grid; + }(); + + var Scales = /*#__PURE__*/function () { + function Scales(ctx) { + _classCallCheck(this, Scales); + this.ctx = ctx; + this.w = ctx.w; + this.coreUtils = new CoreUtils(this.ctx); + } + + // http://stackoverflow.com/questions/326679/choosing-an-attractive-linear-scale-for-a-graphs-y-axis + // This routine creates the Y axis values for a graph. + _createClass(Scales, [{ + key: "niceScale", + value: function niceScale(yMin, yMax) { + var index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + // Calculate Min amd Max graphical labels and graph + // increments. + // + // Output will be an array of the Y axis values that + // encompass the Y values. + var jsPrecision = 1e-11; // JS precision errors + var w = this.w; + var gl = w.globals; + var axisCnf; + var maxTicks; + var gotMin; + var gotMax; + if (gl.isBarHorizontal) { + axisCnf = w.config.xaxis; + // The most ticks we can fit into the svg chart dimensions + maxTicks = Math.max((gl.svgWidth - 100) / 25, 2); // Guestimate + } else { + axisCnf = w.config.yaxis[index]; + maxTicks = Math.max((gl.svgHeight - 100) / 15, 2); + } + if (!Utils$1.isNumber(maxTicks)) { + maxTicks = 10; + } + gotMin = axisCnf.min !== undefined && axisCnf.min !== null; + gotMax = axisCnf.max !== undefined && axisCnf.min !== null; + var gotStepSize = axisCnf.stepSize !== undefined && axisCnf.stepSize !== null; + var gotTickAmount = axisCnf.tickAmount !== undefined && axisCnf.tickAmount !== null; + var ticks = gotTickAmount ? axisCnf.tickAmount : gl.niceScaleDefaultTicks[Math.min(Math.round(maxTicks / 2), gl.niceScaleDefaultTicks.length - 1)]; + + // In case we have a multi axis chart: + // Ensure subsequent series start with the same tickAmount as series[0], + // because the tick lines are drawn based on series[0]. This does not + // override user defined options for any yaxis. + if (gl.isMultipleYAxis && !gotTickAmount && gl.multiAxisTickAmount > 0) { + ticks = gl.multiAxisTickAmount; + gotTickAmount = true; + } + if (ticks === 'dataPoints') { + ticks = gl.dataPoints - 1; + } else { + // Ensure ticks is an integer + ticks = Math.abs(Math.round(ticks)); + } + if (yMin === Number.MIN_VALUE && yMax === 0 || !Utils$1.isNumber(yMin) && !Utils$1.isNumber(yMax) || yMin === Number.MIN_VALUE && yMax === -Number.MAX_VALUE) { + // when all values are 0 + yMin = Utils$1.isNumber(axisCnf.min) ? axisCnf.min : 0; + yMax = Utils$1.isNumber(axisCnf.max) ? axisCnf.max : yMin + ticks; + gl.allSeriesCollapsed = false; + } + if (yMin > yMax) { + // if somehow due to some wrong config, user sent max less than min, + // adjust the min/max again + console.warn('axis.min cannot be greater than axis.max: swapping min and max'); + var temp = yMax; + yMax = yMin; + yMin = temp; + } else if (yMin === yMax) { + // If yMin and yMax are identical, then + // adjust the yMin and yMax values to actually + // make a graph. Also avoids division by zero errors. + yMin = yMin === 0 ? 0 : yMin - 1; // choose an integer in case yValueDecimals=0 + yMax = yMax === 0 ? 2 : yMax + 1; // choose an integer in case yValueDecimals=0 + } + var result = []; + if (ticks < 1) { + ticks = 1; + } + var tiks = ticks; + + // Determine Range + var range = Math.abs(yMax - yMin); + + // Snap min or max to zero if close + var proximityRatio = 0.15; + if (!gotMin && yMin > 0 && yMin / range < proximityRatio) { + yMin = 0; + gotMin = true; + } + if (!gotMax && yMax < 0 && -yMax / range < proximityRatio) { + yMax = 0; + gotMax = true; + } + range = Math.abs(yMax - yMin); + + // Calculate a pretty step value based on ticks + + // Initial stepSize + var stepSize = range / tiks; + var niceStep = stepSize; + var mag = Math.floor(Math.log10(niceStep)); + var magPow = Math.pow(10, mag); + // ceil() is used below in conjunction with the values populating + // niceScaleAllowedMagMsd[][] to ensure that (niceStep * tiks) + // produces a range that doesn't clip data points after stretching + // the raw range out a little to match the prospective new range. + var magMsd = Math.ceil(niceStep / magPow); + // See globals.js for info on what niceScaleAllowedMagMsd does + magMsd = gl.niceScaleAllowedMagMsd[gl.yValueDecimal === 0 ? 0 : 1][magMsd]; + niceStep = magMsd * magPow; + + // Initial stepSize + stepSize = niceStep; + + // Get step value + if (gl.isBarHorizontal && axisCnf.stepSize && axisCnf.type !== 'datetime') { + stepSize = axisCnf.stepSize; + gotStepSize = true; + } else if (gotStepSize) { + stepSize = axisCnf.stepSize; + } + if (gotStepSize) { + if (axisCnf.forceNiceScale) { + // Check that given stepSize is sane with respect to the range. + // + // The user can, by setting forceNiceScale = true, + // define a stepSize that will be scaled to a useful value before + // it's checked for consistency. + // + // If, for example, the range = 4 and the user defined stepSize = 8 + // (or 8000 or 0.0008, etc), then stepSize is inapplicable as + // it is. Reducing it to 0.8 will fit with 5 ticks. + // + var stepMag = Math.floor(Math.log10(stepSize)); + stepSize *= Math.pow(10, mag - stepMag); + } + } + + // Start applying some rules + if (gotMin && gotMax) { + var crudeStep = range / tiks; + // min and max (range) cannot be changed + if (gotTickAmount) { + if (gotStepSize) { + if (Utils$1.mod(range, stepSize) != 0) { + // stepSize conflicts with range + var gcdStep = Utils$1.getGCD(stepSize, crudeStep); + // gcdStep is a multiple of range because crudeStep is a multiple. + // gcdStep is also a multiple of stepSize, so it partially honoured + // All three could be equal, which would be very nice + // if the computed stepSize generates too many ticks they will be + // reduced later, unless the number is prime, in which case, + // the chart will display all of them or just one (plus the X axis) + // depending on svg dimensions. Setting forceNiceScale: true will force + // the display of at least the default number of ticks. + if (crudeStep / gcdStep < 10) { + stepSize = gcdStep; + } else { + // stepSize conflicts and no reasonable adjustment, but must + // honour tickAmount + stepSize = crudeStep; + } + } else { + // stepSize fits + if (Utils$1.mod(stepSize, crudeStep) == 0) { + // crudeStep is a multiple of stepSize, or vice versa + // but we know that crudeStep will generate tickAmount ticks + stepSize = crudeStep; + } else { + // stepSize conflicts with tickAmount + // if the user is setting up a multi-axis chart and wants + // synced axis ticks then they should not define stepSize + // or ensure there is no conflict between any of their options + // on any axis. + crudeStep = stepSize; + // De-prioritizing ticks from now on + gotTickAmount = false; + } + } + } else { + // no user stepSize, honour tickAmount + stepSize = crudeStep; + } + } else { + // default ticks in use, tiks can change + if (gotStepSize) { + if (Utils$1.mod(range, stepSize) == 0) { + // user stepSize fits + crudeStep = stepSize; + } else { + stepSize = crudeStep; + } + } else { + // no user stepSize + if (Utils$1.mod(range, stepSize) == 0) { + // generated nice stepSize fits + crudeStep = stepSize; + } else { + tiks = Math.ceil(range / stepSize); + crudeStep = range / tiks; + var _gcdStep = Utils$1.getGCD(range, stepSize); + if (range / _gcdStep < maxTicks) { + crudeStep = _gcdStep; + } + stepSize = crudeStep; + } + } + } + tiks = Math.round(range / stepSize); + } else { + // Snap range to ticks + if (!gotMin && !gotMax) { + if (gl.isMultipleYAxis && gotTickAmount) { + // Ensure graph doesn't clip. + var tMin = stepSize * Math.floor(yMin / stepSize); + var tMax = tMin + stepSize * tiks; + if (tMax < yMax) { + stepSize *= 2; + } + yMin = tMin; + tMax = yMax; + yMax = yMin + stepSize * tiks; + // Snap min or max to zero if possible + range = Math.abs(yMax - yMin); + if (yMin > 0 && yMin < Math.abs(tMax - yMax)) { + yMin = 0; + yMax = stepSize * tiks; + } + if (yMax < 0 && -yMax < Math.abs(tMin - yMin)) { + yMax = 0; + yMin = -stepSize * tiks; + } + } else { + yMin = stepSize * Math.floor(yMin / stepSize); + yMax = stepSize * Math.ceil(yMax / stepSize); + } + } else if (gotMax) { + if (gotTickAmount) { + yMin = yMax - stepSize * tiks; + } else { + var yMinPrev = yMin; + yMin = stepSize * Math.floor(yMin / stepSize); + if (Math.abs(yMax - yMin) / Utils$1.getGCD(range, stepSize) > maxTicks) { + // Use default ticks to compute yMin then shrinkwrap + yMin = yMax - stepSize * ticks; + yMin += stepSize * Math.floor((yMinPrev - yMin) / stepSize); + } + } + } else if (gotMin) { + if (gotTickAmount) { + yMax = yMin + stepSize * tiks; + } else { + var yMaxPrev = yMax; + yMax = stepSize * Math.ceil(yMax / stepSize); + if (Math.abs(yMax - yMin) / Utils$1.getGCD(range, stepSize) > maxTicks) { + // Use default ticks to compute yMin then shrinkwrap + yMax = yMin + stepSize * ticks; + yMax += stepSize * Math.ceil((yMaxPrev - yMax) / stepSize); + } + } + } + range = Math.abs(yMax - yMin); + // Final check and possible adjustment of stepSize to prevent + // overriding the user's min or max choice. + stepSize = Utils$1.getGCD(range, stepSize); + tiks = Math.round(range / stepSize); + } + + // Shrinkwrap ticks to the range + if (!gotTickAmount && !(gotMin || gotMax)) { + tiks = Math.ceil((range - jsPrecision) / (stepSize + jsPrecision)); + // No user tickAmount, or min or max, we are free to adjust to avoid a + // prime number. This helps when reducing ticks for small svg dimensions. + if (tiks > 16 && Utils$1.getPrimeFactors(tiks).length < 2) { + tiks++; + } + } + + // Prune tiks down to range if series is all integers. Since tiks > range, + // range is very low (< 10 or so). Skip this step if gotTickAmount is true + // because either the user set tickAmount or the chart is multiscale and + // this axis is not determining the number of grid lines. + if (!gotTickAmount && axisCnf.forceNiceScale && gl.yValueDecimal === 0 && tiks > range) { + tiks = range; + stepSize = Math.round(range / tiks); + } + if (tiks > maxTicks && (!(gotTickAmount || gotStepSize) || axisCnf.forceNiceScale)) { + // Reduce the number of ticks nicely if chart svg dimensions shrink too far. + // The reduced tick set should always be a subset of the full set. + // + // This following products of prime factors method works as follows: + // We compute the prime factors of the full tick count (tiks), then all the + // possible products of those factors in order from smallest to biggest, + // until we find a product P such that: tiks/P < maxTicks. + // + // Example: + // Computing products of the prime factors of 30. + // + // tiks | pf | 1 2 3 4 5 6 <-- compute order + // -------------------------------------------------- + // 30 | 5 | 5 5 5 <-- Multiply all + // | 3 | 3 3 3 3 <-- primes in each + // | 2 | 2 2 2 <-- column = P + // -------------------------------------------------- + // 15 10 6 5 2 1 <-- tiks/P + // + // tiks = 30 has prime factors [2, 3, 5] + // The loop below computes the products [2,3,5,6,15,30]. + // The last product of P = 2*3*5 is skipped since 30/P = 1. + // This yields tiks/P = [15,10,6,5,2,1], checked in order until + // tiks/P < maxTicks. + // + // Pros: + // 1) The ticks in the reduced set are always members of the + // full set of ticks. + // Cons: + // 1) None: if tiks is prime, we get all or one, nothing between, so + // the worst case is to display all, which is the status quo. Really + // only a problem visually for larger tick numbers, say, > 7. + // + var pf = Utils$1.getPrimeFactors(tiks); + var last = pf.length - 1; + var tt = tiks; + reduceLoop: for (var xFactors = 0; xFactors < last; xFactors++) { + for (var lowest = 0; lowest <= last - xFactors; lowest++) { + var stop = Math.min(lowest + xFactors, last); + var t = tt; + var div = 1; + for (var next = lowest; next <= stop; next++) { + div *= pf[next]; + } + t /= div; + if (t < maxTicks) { + tt = t; + break reduceLoop; + } + } + } + if (tt === tiks) { + // Could not reduce ticks at all, go all in and display just the + // X axis and one tick. + stepSize = range; + } else { + stepSize = range / tt; + } + tiks = Math.round(range / stepSize); + } + + // Record final tiks for use by other series that call niceScale(). + // Note: some don't, like logarithmicScale(), etc. + if (gl.isMultipleYAxis && gl.multiAxisTickAmount == 0 && gl.ignoreYAxisIndexes.indexOf(index) < 0) { + gl.multiAxisTickAmount = tiks; + } + + // build Y label array. + + var val = yMin - stepSize; + // Ensure we don't under/over shoot due to JS precision errors. + // This also fixes (amongst others): + // https://github.com/apexcharts/apexcharts.js/issues/430 + var err = stepSize * jsPrecision; + do { + val += stepSize; + result.push(Utils$1.stripNumber(val, 7)); + } while (yMax - val > err); + return { + result: result, + niceMin: result[0], + niceMax: result[result.length - 1] + }; + } + }, { + key: "linearScale", + value: function linearScale(yMin, yMax) { + var ticks = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 10; + var index = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; + var step = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : undefined; + var range = Math.abs(yMax - yMin); + var result = []; + if (yMin === yMax) { + result = [yMin]; + return { + result: result, + niceMin: result[0], + niceMax: result[result.length - 1] + }; + } + ticks = this._adjustTicksForSmallRange(ticks, index, range); + if (ticks === 'dataPoints') { + ticks = this.w.globals.dataPoints - 1; + } + if (!step) { + step = range / ticks; + } + step = Math.round((step + Number.EPSILON) * 100) / 100; + if (ticks === Number.MAX_VALUE) { + ticks = 5; + step = 1; + } + var v = yMin; + while (ticks >= 0) { + result.push(v); + v = Utils$1.preciseAddition(v, step); + ticks -= 1; + } + return { + result: result, + niceMin: result[0], + niceMax: result[result.length - 1] + }; + } + }, { + key: "logarithmicScaleNice", + value: function logarithmicScaleNice(yMin, yMax, base) { + // Basic validation to avoid for loop starting at -inf. + if (yMax <= 0) yMax = Math.max(yMin, base); + if (yMin <= 0) yMin = Math.min(yMax, base); + var logs = []; + + // Get powers of base for our max and min + var logMax = Math.ceil(Math.log(yMax) / Math.log(base) + 1); + var logMin = Math.floor(Math.log(yMin) / Math.log(base)); + for (var i = logMin; i < logMax; i++) { + logs.push(Math.pow(base, i)); + } + return { + result: logs, + niceMin: logs[0], + niceMax: logs[logs.length - 1] + }; + } + }, { + key: "logarithmicScale", + value: function logarithmicScale(yMin, yMax, base) { + // Basic validation to avoid for loop starting at -inf. + if (yMax <= 0) yMax = Math.max(yMin, base); + if (yMin <= 0) yMin = Math.min(yMax, base); + var logs = []; + + // Get the logarithmic range. + var logMax = Math.log(yMax) / Math.log(base); + var logMin = Math.log(yMin) / Math.log(base); + + // Get the exact logarithmic range. + // (This is the exact number of multiples of the base there are between yMin and yMax). + var logRange = logMax - logMin; + + // Round the logarithmic range to get the number of ticks we will create. + // If the chosen min/max values are multiples of each other WRT the base, this will be neat. + // If the chosen min/max aren't, we will at least still provide USEFUL ticks. + var ticks = Math.round(logRange); + + // Get the logarithmic spacing between ticks. + var logTickSpacing = logRange / ticks; + + // Create as many ticks as there is range in the logs. + for (var i = 0, logTick = logMin; i < ticks; i++, logTick += logTickSpacing) { + logs.push(Math.pow(base, logTick)); + } + + // Add a final tick at the yMax. + logs.push(Math.pow(base, logMax)); + return { + result: logs, + niceMin: yMin, + niceMax: yMax + }; + } + }, { + key: "_adjustTicksForSmallRange", + value: function _adjustTicksForSmallRange(ticks, index, range) { + var newTicks = ticks; + if (typeof index !== 'undefined' && this.w.config.yaxis[index].labels.formatter && this.w.config.yaxis[index].tickAmount === undefined) { + var formattedVal = Number(this.w.config.yaxis[index].labels.formatter(1)); + if (Utils$1.isNumber(formattedVal) && this.w.globals.yValueDecimal === 0) { + newTicks = Math.ceil(range); + } + } + return newTicks < ticks ? newTicks : ticks; + } + }, { + key: "setYScaleForIndex", + value: function setYScaleForIndex(index, minY, maxY) { + var gl = this.w.globals; + var cnf = this.w.config; + var y = gl.isBarHorizontal ? cnf.xaxis : cnf.yaxis[index]; + if (typeof gl.yAxisScale[index] === 'undefined') { + gl.yAxisScale[index] = []; + } + var range = Math.abs(maxY - minY); + if (y.logarithmic && range <= 5) { + gl.invalidLogScale = true; + } + if (y.logarithmic && range > 5) { + gl.allSeriesCollapsed = false; + gl.yAxisScale[index] = y.forceNiceScale ? this.logarithmicScaleNice(minY, maxY, y.logBase) : this.logarithmicScale(minY, maxY, y.logBase); + } else { + if (maxY === -Number.MAX_VALUE || !Utils$1.isNumber(maxY) || minY === Number.MAX_VALUE || !Utils$1.isNumber(minY)) { + // no data in the chart. + // Either all series collapsed or user passed a blank array. + // Show the user's yaxis with their scale options but with a range. + gl.yAxisScale[index] = this.niceScale(Number.MIN_VALUE, 0, index); + } else { + // there is some data. Turn off the allSeriesCollapsed flag + gl.allSeriesCollapsed = false; + gl.yAxisScale[index] = this.niceScale(minY, maxY, index); + } + } + } + }, { + key: "setXScale", + value: function setXScale(minX, maxX) { + var w = this.w; + var gl = w.globals; + if (maxX === -Number.MAX_VALUE || !Utils$1.isNumber(maxX)) { + // no data in the chart. Either all series collapsed or user passed a blank array + gl.xAxisScale = this.linearScale(0, 10, 10); + } else { + var ticks = gl.xTickAmount; + gl.xAxisScale = this.linearScale(minX, maxX, ticks, 0, w.config.xaxis.stepSize); + } + return gl.xAxisScale; + } + }, { + key: "scaleMultipleYAxes", + value: function scaleMultipleYAxes() { + var _this = this; + var cnf = this.w.config; + var gl = this.w.globals; + this.coreUtils.setSeriesYAxisMappings(); + var axisSeriesMap = gl.seriesYAxisMap; + var minYArr = gl.minYArr; + var maxYArr = gl.maxYArr; + + // Compute min..max for each yaxis + gl.allSeriesCollapsed = true; + gl.barGroups = []; + axisSeriesMap.forEach(function (axisSeries, ai) { + var groupNames = []; + axisSeries.forEach(function (as) { + var _cnf$series$as; + var group = (_cnf$series$as = cnf.series[as]) === null || _cnf$series$as === void 0 ? void 0 : _cnf$series$as.group; + if (groupNames.indexOf(group) < 0) { + groupNames.push(group); + } + }); + if (axisSeries.length > 0) { + (function () { + var minY = Number.MAX_VALUE; + var maxY = -Number.MAX_VALUE; + var lowestY = minY; + var highestY = maxY; + var seriesType; + var seriesGroupName; + if (cnf.chart.stacked) { + (function () { + // Series' on this axis with the same group name will be stacked. + // Sum series in each group separately + var mapSeries = new Array(gl.dataPoints).fill(0); + var sumSeries = []; + var posSeries = []; + var negSeries = []; + groupNames.forEach(function () { + sumSeries.push(mapSeries.map(function () { + return Number.MIN_VALUE; + })); + posSeries.push(mapSeries.map(function () { + return Number.MIN_VALUE; + })); + negSeries.push(mapSeries.map(function () { + return Number.MIN_VALUE; + })); + }); + var _loop = function _loop(i) { + // Assume chart type but the first series that has a type overrides. + if (!seriesType && cnf.series[axisSeries[i]].type) { + seriesType = cnf.series[axisSeries[i]].type; + } + // Sum all series for this yaxis at each corresponding datapoint + // For bar and column charts we need to keep positive and negative + // values separate, for each group separately. + var si = axisSeries[i]; + if (cnf.series[si].group) { + seriesGroupName = cnf.series[si].group; + } else { + seriesGroupName = 'axis-'.concat(ai); + } + var collapsed = !(gl.collapsedSeriesIndices.indexOf(si) < 0 && gl.ancillaryCollapsedSeriesIndices.indexOf(si) < 0); + if (!collapsed) { + gl.allSeriesCollapsed = false; + groupNames.forEach(function (gn, gni) { + // Undefined group names will be grouped together as their own + // group. + if (cnf.series[si].group === gn) { + for (var j = 0; j < gl.series[si].length; j++) { + var val = gl.series[si][j]; + if (val >= 0) { + posSeries[gni][j] += val; + } else { + negSeries[gni][j] += val; + } + sumSeries[gni][j] += val; + // For non bar-like series' we need these point max/min values. + lowestY = Math.min(lowestY, val); + highestY = Math.max(highestY, val); + } + } + }); + } + if (seriesType === 'bar' || seriesType === 'column') { + gl.barGroups.push(seriesGroupName); + } + }; + for (var i = 0; i < axisSeries.length; i++) { + _loop(i); + } + if (!seriesType) { + seriesType = cnf.chart.type; + } + if (seriesType === 'bar' || seriesType === 'column') { + groupNames.forEach(function (gn, gni) { + minY = Math.min(minY, Math.min.apply(null, negSeries[gni])); + maxY = Math.max(maxY, Math.max.apply(null, posSeries[gni])); + }); + } else { + groupNames.forEach(function (gn, gni) { + lowestY = Math.min(lowestY, Math.min.apply(null, sumSeries[gni])); + highestY = Math.max(highestY, Math.max.apply(null, sumSeries[gni])); + }); + minY = lowestY; + maxY = highestY; + } + if (minY === Number.MIN_VALUE && maxY === Number.MIN_VALUE) { + // No series data + maxY = -Number.MAX_VALUE; + } + })(); + } else { + for (var i = 0; i < axisSeries.length; i++) { + var si = axisSeries[i]; + minY = Math.min(minY, minYArr[si]); + maxY = Math.max(maxY, maxYArr[si]); + var collapsed = !(gl.collapsedSeriesIndices.indexOf(si) < 0 && gl.ancillaryCollapsedSeriesIndices.indexOf(si) < 0); + if (!collapsed) { + gl.allSeriesCollapsed = false; + } + } + } + if (cnf.yaxis[ai].min !== undefined) { + if (typeof cnf.yaxis[ai].min === 'function') { + minY = cnf.yaxis[ai].min(minY); + } else { + minY = cnf.yaxis[ai].min; + } + } + if (cnf.yaxis[ai].max !== undefined) { + if (typeof cnf.yaxis[ai].max === 'function') { + maxY = cnf.yaxis[ai].max(maxY); + } else { + maxY = cnf.yaxis[ai].max; + } + } + gl.barGroups = gl.barGroups.filter(function (v, i, a) { + return a.indexOf(v) === i; + }); + // Set the scale for this yaxis + _this.setYScaleForIndex(ai, minY, maxY); + // Set individual series min and max to nice values + axisSeries.forEach(function (si) { + minYArr[si] = gl.yAxisScale[ai].niceMin; + maxYArr[si] = gl.yAxisScale[ai].niceMax; + }); + })(); + } else { + // No series referenced by this yaxis + _this.setYScaleForIndex(ai, 0, -Number.MAX_VALUE); + } + }); + } + }]); + return Scales; + }(); + + /** + * Range is used to generates values between min and max. + * + * @module Range + **/ + var Range = /*#__PURE__*/function () { + function Range(ctx) { + _classCallCheck(this, Range); + this.ctx = ctx; + this.w = ctx.w; + this.scales = new Scales(ctx); + } + _createClass(Range, [{ + key: "init", + value: function init() { + this.setYRange(); + this.setXRange(); + this.setZRange(); + } + }, { + key: "getMinYMaxY", + value: function getMinYMaxY(startingSeriesIndex) { + var lowestY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.MAX_VALUE; + var highestY = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -Number.MAX_VALUE; + var endingSeriesIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; + var cnf = this.w.config; + var gl = this.w.globals; + var maxY = -Number.MAX_VALUE; + var minY = Number.MIN_VALUE; + if (endingSeriesIndex === null) { + endingSeriesIndex = startingSeriesIndex + 1; + } + var series = gl.series; + var seriesMin = series; + var seriesMax = series; + if (cnf.chart.type === 'candlestick') { + seriesMin = gl.seriesCandleL; + seriesMax = gl.seriesCandleH; + } else if (cnf.chart.type === 'boxPlot') { + seriesMin = gl.seriesCandleO; + seriesMax = gl.seriesCandleC; + } else if (gl.isRangeData) { + seriesMin = gl.seriesRangeStart; + seriesMax = gl.seriesRangeEnd; + } + var autoScaleYaxis = false; + if (gl.seriesX.length >= endingSeriesIndex) { + var _gl$brushSource; + // Eventually brushSource will be set if the current chart is a target. + // That is, after the appropriate event causes us to update. + var brush = (_gl$brushSource = gl.brushSource) === null || _gl$brushSource === void 0 ? void 0 : _gl$brushSource.w.config.chart.brush; + if (cnf.chart.zoom.enabled && cnf.chart.zoom.autoScaleYaxis || brush !== null && brush !== void 0 && brush.enabled && brush !== null && brush !== void 0 && brush.autoScaleYaxis) { + autoScaleYaxis = true; + } + } + for (var i = startingSeriesIndex; i < endingSeriesIndex; i++) { + gl.dataPoints = Math.max(gl.dataPoints, series[i].length); + var seriesType = cnf.series[i].type; + if (gl.categoryLabels.length) { + gl.dataPoints = gl.categoryLabels.filter(function (label) { + return typeof label !== 'undefined'; + }).length; + } + if (gl.labels.length && cnf.xaxis.type !== 'datetime' && gl.series.reduce(function (a, c) { + return a + c.length; + }, 0) !== 0) { + // the condition cnf.xaxis.type !== 'datetime' fixes #3897 and #3905 + gl.dataPoints = Math.max(gl.dataPoints, gl.labels.length); + } + var firstXIndex = 0; + var lastXIndex = series[i].length - 1; + if (autoScaleYaxis) { + // Scale the Y axis to the min..max within the possibly zoomed X axis domain. + if (cnf.xaxis.min) { + for (; firstXIndex < lastXIndex && gl.seriesX[i][firstXIndex] < cnf.xaxis.min; firstXIndex++) {} + } + if (cnf.xaxis.max) { + for (; lastXIndex > firstXIndex && gl.seriesX[i][lastXIndex] > cnf.xaxis.max; lastXIndex--) {} + } + } + for (var j = firstXIndex; j <= lastXIndex && j < gl.series[i].length; j++) { + var val = series[i][j]; + if (val !== null && Utils$1.isNumber(val)) { + if (typeof seriesMax[i][j] !== 'undefined') { + maxY = Math.max(maxY, seriesMax[i][j]); + lowestY = Math.min(lowestY, seriesMax[i][j]); + } + if (typeof seriesMin[i][j] !== 'undefined') { + lowestY = Math.min(lowestY, seriesMin[i][j]); + highestY = Math.max(highestY, seriesMin[i][j]); + } + + // These series arrays are dual purpose: + // Array : CandleO, CandleH, CandleM, CandleL, CandleC + // Candlestick: O H L C + // Boxplot : Min Q1 Median Q3 Max + switch (seriesType) { + case 'candlestick': + { + if (typeof gl.seriesCandleC[i][j] !== 'undefined') { + maxY = Math.max(maxY, gl.seriesCandleH[i][j]); + lowestY = Math.min(lowestY, gl.seriesCandleL[i][j]); + } + } + break; + case 'boxPlot': + { + if (typeof gl.seriesCandleC[i][j] !== 'undefined') { + maxY = Math.max(maxY, gl.seriesCandleC[i][j]); + lowestY = Math.min(lowestY, gl.seriesCandleO[i][j]); + } + } + break; + } + + // there is a combo chart and the specified series in not either + // candlestick, boxplot, or rangeArea/rangeBar; find the max there. + if (seriesType && seriesType !== 'candlestick' && seriesType !== 'boxPlot' && seriesType !== 'rangeArea' && seriesType !== 'rangeBar') { + maxY = Math.max(maxY, gl.series[i][j]); + lowestY = Math.min(lowestY, gl.series[i][j]); + } + if (gl.seriesGoals[i] && gl.seriesGoals[i][j] && Array.isArray(gl.seriesGoals[i][j])) { + gl.seriesGoals[i][j].forEach(function (g) { + maxY = Math.max(maxY, g.value); + lowestY = Math.min(lowestY, g.value); + }); + } + highestY = maxY; + val = Utils$1.noExponents(val); + if (Utils$1.isFloat(val)) { + gl.yValueDecimal = Math.max(gl.yValueDecimal, val.toString().split('.')[1].length); + } + if (minY > seriesMin[i][j] && seriesMin[i][j] < 0) { + minY = seriesMin[i][j]; + } + } else { + gl.hasNullValues = true; + } + } + if (seriesType === 'bar' || seriesType === 'column') { + if (minY < 0 && maxY < 0) { + // all negative values in a bar series, hence make the max to 0 + maxY = 0; + highestY = Math.max(highestY, 0); + } + if (minY === Number.MIN_VALUE) { + minY = 0; + lowestY = Math.min(lowestY, 0); + } + } + } + if (cnf.chart.type === 'rangeBar' && gl.seriesRangeStart.length && gl.isBarHorizontal) { + minY = lowestY; + } + if (cnf.chart.type === 'bar') { + if (minY < 0 && maxY < 0) { + // all negative values in a bar chart, hence make the max to 0 + maxY = 0; + } + if (minY === Number.MIN_VALUE) { + minY = 0; + } + } + return { + minY: minY, + maxY: maxY, + lowestY: lowestY, + highestY: highestY + }; + } + }, { + key: "setYRange", + value: function setYRange() { + var gl = this.w.globals; + var cnf = this.w.config; + gl.maxY = -Number.MAX_VALUE; + gl.minY = Number.MIN_VALUE; + var lowestYInAllSeries = Number.MAX_VALUE; + var minYMaxY; + if (gl.isMultipleYAxis) { + // we need to get minY and maxY for multiple y axis + lowestYInAllSeries = Number.MAX_VALUE; + for (var i = 0; i < gl.series.length; i++) { + minYMaxY = this.getMinYMaxY(i); + gl.minYArr[i] = minYMaxY.lowestY; + gl.maxYArr[i] = minYMaxY.highestY; + lowestYInAllSeries = Math.min(lowestYInAllSeries, minYMaxY.lowestY); + } + } + + // and then, get the minY and maxY from all series + minYMaxY = this.getMinYMaxY(0, lowestYInAllSeries, null, gl.series.length); + if (cnf.chart.type === 'bar') { + gl.minY = minYMaxY.minY; + gl.maxY = minYMaxY.maxY; + } else { + gl.minY = minYMaxY.lowestY; + gl.maxY = minYMaxY.highestY; + } + lowestYInAllSeries = minYMaxY.lowestY; + if (cnf.chart.stacked) { + this._setStackedMinMax(); + } + + // if the numbers are too big, reduce the range + // for eg, if number is between 100000-110000, putting 0 as the lowest + // value is not so good idea. So change the gl.minY for + // line/area/scatter/candlesticks/boxPlot/vertical rangebar + if (cnf.chart.type === 'line' || cnf.chart.type === 'area' || cnf.chart.type === 'scatter' || cnf.chart.type === 'candlestick' || cnf.chart.type === 'boxPlot' || cnf.chart.type === 'rangeBar' && !gl.isBarHorizontal) { + if (gl.minY === Number.MIN_VALUE && lowestYInAllSeries !== -Number.MAX_VALUE && lowestYInAllSeries !== gl.maxY // single value possibility + ) { + gl.minY = lowestYInAllSeries; + } + } else { + gl.minY = gl.minY !== Number.MIN_VALUE ? Math.min(minYMaxY.minY, gl.minY) : minYMaxY.minY; + } + cnf.yaxis.forEach(function (yaxe, index) { + // override all min/max values by user defined values (y axis) + if (yaxe.max !== undefined) { + if (typeof yaxe.max === 'number') { + gl.maxYArr[index] = yaxe.max; + } else if (typeof yaxe.max === 'function') { + // fixes apexcharts.js/issues/2098 + gl.maxYArr[index] = yaxe.max(gl.isMultipleYAxis ? gl.maxYArr[index] : gl.maxY); + } + + // gl.maxY is for single y-axis chart, it will be ignored in multi-yaxis + gl.maxY = gl.maxYArr[index]; + } + if (yaxe.min !== undefined) { + if (typeof yaxe.min === 'number') { + gl.minYArr[index] = yaxe.min; + } else if (typeof yaxe.min === 'function') { + // fixes apexcharts.js/issues/2098 + gl.minYArr[index] = yaxe.min(gl.isMultipleYAxis ? gl.minYArr[index] === Number.MIN_VALUE ? 0 : gl.minYArr[index] : gl.minY); + } + // gl.minY is for single y-axis chart, it will be ignored in multi-yaxis + gl.minY = gl.minYArr[index]; + } + }); + + // for horizontal bar charts, we need to check xaxis min/max as user may have specified there + if (gl.isBarHorizontal) { + var minmax = ['min', 'max']; + minmax.forEach(function (m) { + if (cnf.xaxis[m] !== undefined && typeof cnf.xaxis[m] === 'number') { + m === 'min' ? gl.minY = cnf.xaxis[m] : gl.maxY = cnf.xaxis[m]; + } + }); + } + if (gl.isMultipleYAxis) { + this.scales.scaleMultipleYAxes(); + gl.minY = lowestYInAllSeries; + } else { + this.scales.setYScaleForIndex(0, gl.minY, gl.maxY); + gl.minY = gl.yAxisScale[0].niceMin; + gl.maxY = gl.yAxisScale[0].niceMax; + gl.minYArr[0] = gl.minY; + gl.maxYArr[0] = gl.maxY; + } + gl.barGroups = []; + gl.lineGroups = []; + gl.areaGroups = []; + cnf.series.forEach(function (s) { + var type = s.type || cnf.chart.type; + switch (type) { + case 'bar': + case 'column': + gl.barGroups.push(s.group); + break; + case 'line': + gl.lineGroups.push(s.group); + break; + case 'area': + gl.areaGroups.push(s.group); + break; + } + }); + // Uniquify the group names in each stackable chart type. + gl.barGroups = gl.barGroups.filter(function (v, i, a) { + return a.indexOf(v) === i; + }); + gl.lineGroups = gl.lineGroups.filter(function (v, i, a) { + return a.indexOf(v) === i; + }); + gl.areaGroups = gl.areaGroups.filter(function (v, i, a) { + return a.indexOf(v) === i; + }); + return { + minY: gl.minY, + maxY: gl.maxY, + minYArr: gl.minYArr, + maxYArr: gl.maxYArr, + yAxisScale: gl.yAxisScale + }; + } + }, { + key: "setXRange", + value: function setXRange() { + var gl = this.w.globals; + var cnf = this.w.config; + var isXNumeric = cnf.xaxis.type === 'numeric' || cnf.xaxis.type === 'datetime' || cnf.xaxis.type === 'category' && !gl.noLabelsProvided || gl.noLabelsProvided || gl.isXNumeric; + var getInitialMinXMaxX = function getInitialMinXMaxX() { + for (var i = 0; i < gl.series.length; i++) { + if (gl.labels[i]) { + for (var j = 0; j < gl.labels[i].length; j++) { + if (gl.labels[i][j] !== null && Utils$1.isNumber(gl.labels[i][j])) { + gl.maxX = Math.max(gl.maxX, gl.labels[i][j]); + gl.initialMaxX = Math.max(gl.maxX, gl.labels[i][j]); + gl.minX = Math.min(gl.minX, gl.labels[i][j]); + gl.initialMinX = Math.min(gl.minX, gl.labels[i][j]); + } + } + } + } + }; + // minX maxX starts here + if (gl.isXNumeric) { + getInitialMinXMaxX(); + } + if (gl.noLabelsProvided) { + if (cnf.xaxis.categories.length === 0) { + gl.maxX = gl.labels[gl.labels.length - 1]; + gl.initialMaxX = gl.labels[gl.labels.length - 1]; + gl.minX = 1; + gl.initialMinX = 1; + } + } + if (gl.isXNumeric || gl.noLabelsProvided || gl.dataFormatXNumeric) { + var ticks = 10; + if (cnf.xaxis.tickAmount === undefined) { + ticks = Math.round(gl.svgWidth / 150); + + // no labels provided and total number of dataPoints is less than 30 + if (cnf.xaxis.type === 'numeric' && gl.dataPoints < 30) { + ticks = gl.dataPoints - 1; + } + + // this check is for when ticks exceeds total datapoints and that would result in duplicate labels + if (ticks > gl.dataPoints && gl.dataPoints !== 0) { + ticks = gl.dataPoints - 1; + } + } else if (cnf.xaxis.tickAmount === 'dataPoints') { + if (gl.series.length > 1) { + ticks = gl.series[gl.maxValsInArrayIndex].length - 1; + } + if (gl.isXNumeric) { + var diff = Math.round(gl.maxX - gl.minX); + if (diff < 30) { + ticks = diff - 1; + } + } + } else { + ticks = cnf.xaxis.tickAmount; + } + gl.xTickAmount = ticks; + + // override all min/max values by user defined values (x axis) + if (cnf.xaxis.max !== undefined && typeof cnf.xaxis.max === 'number') { + gl.maxX = cnf.xaxis.max; + } + if (cnf.xaxis.min !== undefined && typeof cnf.xaxis.min === 'number') { + gl.minX = cnf.xaxis.min; + } + + // if range is provided, adjust the new minX + if (cnf.xaxis.range !== undefined) { + gl.minX = gl.maxX - cnf.xaxis.range; + } + if (gl.minX !== Number.MAX_VALUE && gl.maxX !== -Number.MAX_VALUE) { + if (cnf.xaxis.convertedCatToNumeric && !gl.dataFormatXNumeric) { + var catScale = []; + for (var i = gl.minX - 1; i < gl.maxX; i++) { + catScale.push(i + 1); + } + gl.xAxisScale = { + result: catScale, + niceMin: catScale[0], + niceMax: catScale[catScale.length - 1] + }; + } else { + gl.xAxisScale = this.scales.setXScale(gl.minX, gl.maxX); + } + } else { + gl.xAxisScale = this.scales.linearScale(0, ticks, ticks, 0, cnf.xaxis.stepSize); + if (gl.noLabelsProvided && gl.labels.length > 0) { + gl.xAxisScale = this.scales.linearScale(1, gl.labels.length, ticks - 1, 0, cnf.xaxis.stepSize); + + // this is the only place seriesX is again mutated + gl.seriesX = gl.labels.slice(); + } + } + // we will still store these labels as the count for this will be different (to draw grid and labels placement) + if (isXNumeric) { + gl.labels = gl.xAxisScale.result.slice(); + } + } + if (gl.isBarHorizontal && gl.labels.length) { + gl.xTickAmount = gl.labels.length; + } + + // single dataPoint + this._handleSingleDataPoint(); + + // minimum x difference to calculate bar width in numeric bars + this._getMinXDiff(); + return { + minX: gl.minX, + maxX: gl.maxX + }; + } + }, { + key: "setZRange", + value: function setZRange() { + // minZ, maxZ starts here + var gl = this.w.globals; + if (!gl.isDataXYZ) return; + for (var i = 0; i < gl.series.length; i++) { + if (typeof gl.seriesZ[i] !== 'undefined') { + for (var j = 0; j < gl.seriesZ[i].length; j++) { + if (gl.seriesZ[i][j] !== null && Utils$1.isNumber(gl.seriesZ[i][j])) { + gl.maxZ = Math.max(gl.maxZ, gl.seriesZ[i][j]); + gl.minZ = Math.min(gl.minZ, gl.seriesZ[i][j]); + } + } + } + } + } + }, { + key: "_handleSingleDataPoint", + value: function _handleSingleDataPoint() { + var gl = this.w.globals; + var cnf = this.w.config; + if (gl.minX === gl.maxX) { + var datetimeObj = new DateTime(this.ctx); + if (cnf.xaxis.type === 'datetime') { + var newMinX = datetimeObj.getDate(gl.minX); + if (cnf.xaxis.labels.datetimeUTC) { + newMinX.setUTCDate(newMinX.getUTCDate() - 2); + } else { + newMinX.setDate(newMinX.getDate() - 2); + } + gl.minX = new Date(newMinX).getTime(); + var newMaxX = datetimeObj.getDate(gl.maxX); + if (cnf.xaxis.labels.datetimeUTC) { + newMaxX.setUTCDate(newMaxX.getUTCDate() + 2); + } else { + newMaxX.setDate(newMaxX.getDate() + 2); + } + gl.maxX = new Date(newMaxX).getTime(); + } else if (cnf.xaxis.type === 'numeric' || cnf.xaxis.type === 'category' && !gl.noLabelsProvided) { + gl.minX = gl.minX - 2; + gl.initialMinX = gl.minX; + gl.maxX = gl.maxX + 2; + gl.initialMaxX = gl.maxX; + } + } + } + }, { + key: "_getMinXDiff", + value: function _getMinXDiff() { + var gl = this.w.globals; + if (gl.isXNumeric) { + // get the least x diff if numeric x axis is present + gl.seriesX.forEach(function (sX, i) { + if (sX.length) { + if (sX.length === 1) { + // a small hack to prevent overlapping multiple bars when there is just 1 datapoint in bar series. + // fix #811 + sX.push(gl.seriesX[gl.maxValsInArrayIndex][gl.seriesX[gl.maxValsInArrayIndex].length - 1]); + } + + // fix #983 (clone the array to avoid side effects) + var seriesX = sX.slice(); + seriesX.sort(function (a, b) { + return a - b; + }); + seriesX.forEach(function (s, j) { + if (j > 0) { + var xDiff = s - seriesX[j - 1]; + if (xDiff > 0) { + gl.minXDiff = Math.min(xDiff, gl.minXDiff); + } + } + }); + if (gl.dataPoints === 1 || gl.minXDiff === Number.MAX_VALUE) { + // fixes apexcharts.js #1221 + gl.minXDiff = 0.5; + } + } + }); + } + } + }, { + key: "_setStackedMinMax", + value: function _setStackedMinMax() { + var _this = this; + var gl = this.w.globals; + // for stacked charts, we calculate each series's parallel values. + // i.e, series[0][j] + series[1][j] .... [series[i.length][j]] + // and get the max out of it + + if (!gl.series.length) return; + var seriesGroups = gl.seriesGroups; + if (!seriesGroups.length) { + seriesGroups = [this.w.globals.seriesNames.map(function (name) { + return name; + })]; + } + var stackedPoss = {}; + var stackedNegs = {}; + seriesGroups.forEach(function (group) { + stackedPoss[group] = []; + stackedNegs[group] = []; + var indicesOfSeriesInGroup = _this.w.config.series.map(function (serie, si) { + return group.indexOf(gl.seriesNames[si]) > -1 ? si : null; + }).filter(function (f) { + return f !== null; + }); + indicesOfSeriesInGroup.forEach(function (i) { + for (var j = 0; j < gl.series[gl.maxValsInArrayIndex].length; j++) { + var _this$w$config$series, _this$w$config$series2, _this$w$config$series3, _this$w$config$series4; + if (typeof stackedPoss[group][j] === 'undefined') { + stackedPoss[group][j] = 0; + stackedNegs[group][j] = 0; + } + var stackSeries = _this.w.config.chart.stacked && !gl.comboCharts || _this.w.config.chart.stacked && gl.comboCharts && (!_this.w.config.chart.stackOnlyBar || ((_this$w$config$series = _this.w.config.series) === null || _this$w$config$series === void 0 ? void 0 : (_this$w$config$series2 = _this$w$config$series[i]) === null || _this$w$config$series2 === void 0 ? void 0 : _this$w$config$series2.type) === 'bar' || ((_this$w$config$series3 = _this.w.config.series) === null || _this$w$config$series3 === void 0 ? void 0 : (_this$w$config$series4 = _this$w$config$series3[i]) === null || _this$w$config$series4 === void 0 ? void 0 : _this$w$config$series4.type) === 'column'); + if (stackSeries) { + if (gl.series[i][j] !== null && Utils$1.isNumber(gl.series[i][j])) { + gl.series[i][j] > 0 ? stackedPoss[group][j] += parseFloat(gl.series[i][j]) + 0.0001 : stackedNegs[group][j] += parseFloat(gl.series[i][j]); + } + } + } + }); + }); + Object.entries(stackedPoss).forEach(function (_ref) { + var _ref2 = _slicedToArray(_ref, 1), + key = _ref2[0]; + stackedPoss[key].forEach(function (_, stgi) { + gl.maxY = Math.max(gl.maxY, stackedPoss[key][stgi]); + gl.minY = Math.min(gl.minY, stackedNegs[key][stgi]); + }); + }); + } + }]); + return Range; + }(); + + /** + * ApexCharts YAxis Class for drawing Y-Axis. + * + * @module YAxis + **/ + var YAxis = /*#__PURE__*/function () { + function YAxis(ctx, elgrid) { + _classCallCheck(this, YAxis); + this.ctx = ctx; + this.elgrid = elgrid; + this.w = ctx.w; + var w = this.w; + this.xaxisFontSize = w.config.xaxis.labels.style.fontSize; + this.axisFontFamily = w.config.xaxis.labels.style.fontFamily; + this.xaxisForeColors = w.config.xaxis.labels.style.colors; + this.isCategoryBarHorizontal = w.config.chart.type === 'bar' && w.config.plotOptions.bar.horizontal; + this.xAxisoffX = w.config.xaxis.position === 'bottom' ? w.globals.gridHeight : 0; + this.drawnLabels = []; + this.axesUtils = new AxesUtils(ctx); + } + _createClass(YAxis, [{ + key: "drawYaxis", + value: function drawYaxis(realIndex) { + var w = this.w; + var graphics = new Graphics(this.ctx); + var yaxisStyle = w.config.yaxis[realIndex].labels.style; + var yaxisFontSize = yaxisStyle.fontSize, + yaxisFontFamily = yaxisStyle.fontFamily, + yaxisFontWeight = yaxisStyle.fontWeight; + var elYaxis = graphics.group({ + class: 'apexcharts-yaxis', + rel: realIndex, + transform: "translate(".concat(w.globals.translateYAxisX[realIndex], ", 0)") + }); + if (this.axesUtils.isYAxisHidden(realIndex)) return elYaxis; + var elYaxisTexts = graphics.group({ + class: 'apexcharts-yaxis-texts-g' + }); + elYaxis.add(elYaxisTexts); + var tickAmount = w.globals.yAxisScale[realIndex].result.length - 1; + var labelsDivider = w.globals.gridHeight / tickAmount; + var lbFormatter = w.globals.yLabelFormatters[realIndex]; + var labels = this.axesUtils.checkForReversedLabels(realIndex, w.globals.yAxisScale[realIndex].result.slice()); + if (w.config.yaxis[realIndex].labels.show) { + var lY = w.globals.translateY + w.config.yaxis[realIndex].labels.offsetY; + if (w.globals.isBarHorizontal) lY = 0;else if (w.config.chart.type === 'heatmap') lY -= labelsDivider / 2; + lY += parseInt(yaxisFontSize, 10) / 3; + for (var i = tickAmount; i >= 0; i--) { + var val = lbFormatter(labels[i], i, w); + var xPad = w.config.yaxis[realIndex].labels.padding; + if (w.config.yaxis[realIndex].opposite && w.config.yaxis.length !== 0) xPad *= -1; + var textAnchor = this.getTextAnchor(w.config.yaxis[realIndex].labels.align, w.config.yaxis[realIndex].opposite); + var yColors = this.axesUtils.getYAxisForeColor(yaxisStyle.colors, realIndex); + var foreColor = Array.isArray(yColors) ? yColors[i] : yColors; + var existingYLabels = Utils$1.listToArray(w.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxis[rel='".concat(realIndex, "'] .apexcharts-yaxis-label tspan"))).map(function (label) { + return label.textContent; + }); + var label = graphics.drawText({ + x: xPad, + y: lY, + text: existingYLabels.includes(val) && !w.config.yaxis[realIndex].labels.showDuplicates ? '' : val, + textAnchor: textAnchor, + fontSize: yaxisFontSize, + fontFamily: yaxisFontFamily, + fontWeight: yaxisFontWeight, + maxWidth: w.config.yaxis[realIndex].labels.maxWidth, + foreColor: foreColor, + isPlainText: false, + cssClass: "apexcharts-yaxis-label ".concat(yaxisStyle.cssClass) + }); + elYaxisTexts.add(label); + this.addTooltip(label, val); + if (w.config.yaxis[realIndex].labels.rotate !== 0) { + this.rotateLabel(graphics, label, firstLabel, w.config.yaxis[realIndex].labels.rotate); + } + lY += labelsDivider; + } + } + this.addYAxisTitle(graphics, elYaxis, realIndex); + this.addAxisBorder(graphics, elYaxis, realIndex, tickAmount, labelsDivider); + return elYaxis; + } + }, { + key: "getTextAnchor", + value: function getTextAnchor(align, opposite) { + if (align === 'left') return 'start'; + if (align === 'center') return 'middle'; + if (align === 'right') return 'end'; + return opposite ? 'start' : 'end'; + } + }, { + key: "addTooltip", + value: function addTooltip(label, val) { + var elTooltipTitle = document.createElementNS(this.w.globals.SVGNS, 'title'); + elTooltipTitle.textContent = Array.isArray(val) ? val.join(' ') : val; + label.node.appendChild(elTooltipTitle); + } + }, { + key: "rotateLabel", + value: function rotateLabel(graphics, label, firstLabel, rotate) { + var firstLabelCenter = graphics.rotateAroundCenter(firstLabel.node); + var labelCenter = graphics.rotateAroundCenter(label.node); + label.node.setAttribute('transform', "rotate(".concat(rotate, " ").concat(firstLabelCenter.x, " ").concat(labelCenter.y, ")")); + } + }, { + key: "addYAxisTitle", + value: function addYAxisTitle(graphics, elYaxis, realIndex) { + var w = this.w; + if (w.config.yaxis[realIndex].title.text !== undefined) { + var elYaxisTitle = graphics.group({ + class: 'apexcharts-yaxis-title' + }); + var x = w.config.yaxis[realIndex].opposite ? w.globals.translateYAxisX[realIndex] : 0; + var elYAxisTitleText = graphics.drawText({ + x: x, + y: w.globals.gridHeight / 2 + w.globals.translateY + w.config.yaxis[realIndex].title.offsetY, + text: w.config.yaxis[realIndex].title.text, + textAnchor: 'end', + foreColor: w.config.yaxis[realIndex].title.style.color, + fontSize: w.config.yaxis[realIndex].title.style.fontSize, + fontWeight: w.config.yaxis[realIndex].title.style.fontWeight, + fontFamily: w.config.yaxis[realIndex].title.style.fontFamily, + cssClass: "apexcharts-yaxis-title-text ".concat(w.config.yaxis[realIndex].title.style.cssClass) + }); + elYaxisTitle.add(elYAxisTitleText); + elYaxis.add(elYaxisTitle); + } + } + }, { + key: "addAxisBorder", + value: function addAxisBorder(graphics, elYaxis, realIndex, tickAmount, labelsDivider) { + var w = this.w; + var axisBorder = w.config.yaxis[realIndex].axisBorder; + var x = 31 + axisBorder.offsetX; + if (w.config.yaxis[realIndex].opposite) x = -31 - axisBorder.offsetX; + if (axisBorder.show) { + var elVerticalLine = graphics.drawLine(x, w.globals.translateY + axisBorder.offsetY - 2, x, w.globals.gridHeight + w.globals.translateY + axisBorder.offsetY + 2, axisBorder.color, 0, axisBorder.width); + elYaxis.add(elVerticalLine); + } + if (w.config.yaxis[realIndex].axisTicks.show) { + this.axesUtils.drawYAxisTicks(x, tickAmount, axisBorder, w.config.yaxis[realIndex].axisTicks, realIndex, labelsDivider, elYaxis); + } + } + }, { + key: "drawYaxisInversed", + value: function drawYaxisInversed(realIndex) { + var w = this.w; + var graphics = new Graphics(this.ctx); + var elXaxis = graphics.group({ + class: 'apexcharts-xaxis apexcharts-yaxis-inversed' + }); + var elXaxisTexts = graphics.group({ + class: 'apexcharts-xaxis-texts-g', + transform: "translate(".concat(w.globals.translateXAxisX, ", ").concat(w.globals.translateXAxisY, ")") + }); + elXaxis.add(elXaxisTexts); + var tickAmount = w.globals.yAxisScale[realIndex].result.length - 1; + var labelsDivider = w.globals.gridWidth / tickAmount + 0.1; + var l = labelsDivider + w.config.xaxis.labels.offsetX; + var lbFormatter = w.globals.xLabelFormatter; + var labels = this.axesUtils.checkForReversedLabels(realIndex, w.globals.yAxisScale[realIndex].result.slice()); + var timescaleLabels = w.globals.timescaleLabels; + if (timescaleLabels.length > 0) { + this.xaxisLabels = timescaleLabels.slice(); + labels = timescaleLabels.slice(); + tickAmount = labels.length; + } + if (w.config.xaxis.labels.show) { + for (var i = timescaleLabels.length ? 0 : tickAmount; timescaleLabels.length ? i < timescaleLabels.length : i >= 0; timescaleLabels.length ? i++ : i--) { + var val = lbFormatter(labels[i], i, w); + var x = w.globals.gridWidth + w.globals.padHorizontal - (l - labelsDivider + w.config.xaxis.labels.offsetX); + if (timescaleLabels.length) { + var label = this.axesUtils.getLabel(labels, timescaleLabels, x, i, this.drawnLabels, this.xaxisFontSize); + x = label.x; + val = label.text; + this.drawnLabels.push(label.text); + if (i === 0 && w.globals.skipFirstTimelinelabel) val = ''; + if (i === labels.length - 1 && w.globals.skipLastTimelinelabel) val = ''; + } + var elTick = graphics.drawText({ + x: x, + y: this.xAxisoffX + w.config.xaxis.labels.offsetY + 30 - (w.config.xaxis.position === 'top' ? w.globals.xAxisHeight + w.config.xaxis.axisTicks.height - 2 : 0), + text: val, + textAnchor: 'middle', + foreColor: Array.isArray(this.xaxisForeColors) ? this.xaxisForeColors[realIndex] : this.xaxisForeColors, + fontSize: this.xaxisFontSize, + fontFamily: this.xaxisFontFamily, + fontWeight: w.config.xaxis.labels.style.fontWeight, + isPlainText: false, + cssClass: "apexcharts-xaxis-label ".concat(w.config.xaxis.labels.style.cssClass) + }); + elXaxisTexts.add(elTick); + elTick.tspan(val); + this.addTooltip(elTick, val); + l += labelsDivider; + } + } + this.inversedYAxisTitleText(elXaxis); + this.inversedYAxisBorder(elXaxis); + return elXaxis; + } + }, { + key: "inversedYAxisBorder", + value: function inversedYAxisBorder(parent) { + var w = this.w; + var graphics = new Graphics(this.ctx); + var axisBorder = w.config.xaxis.axisBorder; + if (axisBorder.show) { + var lineCorrection = 0; + if (w.config.chart.type === 'bar' && w.globals.isXNumeric) lineCorrection -= 15; + var elHorzLine = graphics.drawLine(w.globals.padHorizontal + lineCorrection + axisBorder.offsetX, this.xAxisoffX, w.globals.gridWidth, this.xAxisoffX, axisBorder.color, 0, axisBorder.height); + if (this.elgrid && this.elgrid.elGridBorders && w.config.grid.show) { + this.elgrid.elGridBorders.add(elHorzLine); + } else { + parent.add(elHorzLine); + } + } + } + }, { + key: "inversedYAxisTitleText", + value: function inversedYAxisTitleText(parent) { + var w = this.w; + var graphics = new Graphics(this.ctx); + if (w.config.xaxis.title.text !== undefined) { + var elYaxisTitle = graphics.group({ + class: 'apexcharts-xaxis-title apexcharts-yaxis-title-inversed' + }); + var elYAxisTitleText = graphics.drawText({ + x: w.globals.gridWidth / 2 + w.config.xaxis.title.offsetX, + y: this.xAxisoffX + parseFloat(this.xaxisFontSize) + parseFloat(w.config.xaxis.title.style.fontSize) + w.config.xaxis.title.offsetY + 20, + text: w.config.xaxis.title.text, + textAnchor: 'middle', + fontSize: w.config.xaxis.title.style.fontSize, + fontFamily: w.config.xaxis.title.style.fontFamily, + fontWeight: w.config.xaxis.title.style.fontWeight, + foreColor: w.config.xaxis.title.style.color, + cssClass: "apexcharts-xaxis-title-text ".concat(w.config.xaxis.title.style.cssClass) + }); + elYaxisTitle.add(elYAxisTitleText); + parent.add(elYaxisTitle); + } + } + }, { + key: "yAxisTitleRotate", + value: function yAxisTitleRotate(realIndex, yAxisOpposite) { + var w = this.w; + var graphics = new Graphics(this.ctx); + var elYAxisLabelsWrap = w.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(realIndex, "'] .apexcharts-yaxis-texts-g")); + var yAxisLabelsCoord = elYAxisLabelsWrap ? elYAxisLabelsWrap.getBoundingClientRect() : { + width: 0, + height: 0 + }; + var yAxisTitle = w.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(realIndex, "'] .apexcharts-yaxis-title text")); + var yAxisTitleCoord = yAxisTitle ? yAxisTitle.getBoundingClientRect() : { + width: 0, + height: 0 + }; + if (yAxisTitle) { + var x = this.xPaddingForYAxisTitle(realIndex, yAxisLabelsCoord, yAxisTitleCoord, yAxisOpposite); + yAxisTitle.setAttribute('x', x.xPos - (yAxisOpposite ? 10 : 0)); + var titleRotatingCenter = graphics.rotateAroundCenter(yAxisTitle); + yAxisTitle.setAttribute('transform', "rotate(".concat(yAxisOpposite ? w.config.yaxis[realIndex].title.rotate * -1 : w.config.yaxis[realIndex].title.rotate, " ").concat(titleRotatingCenter.x, " ").concat(titleRotatingCenter.y, ")")); + } + } + }, { + key: "xPaddingForYAxisTitle", + value: function xPaddingForYAxisTitle(realIndex, yAxisLabelsCoord, yAxisTitleCoord, yAxisOpposite) { + var w = this.w; + var x = 0; + var padd = 10; + if (w.config.yaxis[realIndex].title.text === undefined || realIndex < 0) { + return { + xPos: x, + padd: 0 + }; + } + if (yAxisOpposite) { + x = yAxisLabelsCoord.width + w.config.yaxis[realIndex].title.offsetX + yAxisTitleCoord.width / 2 + padd / 2; + } else { + x = yAxisLabelsCoord.width * -1 + w.config.yaxis[realIndex].title.offsetX + padd / 2 + yAxisTitleCoord.width / 2; + if (w.globals.isBarHorizontal) { + padd = 25; + x = yAxisLabelsCoord.width * -1 - w.config.yaxis[realIndex].title.offsetX - padd; + } + } + return { + xPos: x, + padd: padd + }; + } + }, { + key: "setYAxisXPosition", + value: function setYAxisXPosition(yaxisLabelCoords, yTitleCoords) { + var w = this.w; + var xLeft = 0; + var xRight = 0; + var leftOffsetX = 18; + var rightOffsetX = 1; + if (w.config.yaxis.length > 1) this.multipleYs = true; + w.config.yaxis.forEach(function (yaxe, index) { + var shouldNotDrawAxis = w.globals.ignoreYAxisIndexes.includes(index) || !yaxe.show || yaxe.floating || yaxisLabelCoords[index].width === 0; + var axisWidth = yaxisLabelCoords[index].width + yTitleCoords[index].width; + if (!yaxe.opposite) { + xLeft = w.globals.translateX - leftOffsetX; + if (!shouldNotDrawAxis) leftOffsetX += axisWidth + 20; + w.globals.translateYAxisX[index] = xLeft + yaxe.labels.offsetX; + } else { + if (w.globals.isBarHorizontal) { + xRight = w.globals.gridWidth + w.globals.translateX - 1; + w.globals.translateYAxisX[index] = xRight - yaxe.labels.offsetX; + } else { + xRight = w.globals.gridWidth + w.globals.translateX + rightOffsetX; + if (!shouldNotDrawAxis) rightOffsetX += axisWidth + 20; + w.globals.translateYAxisX[index] = xRight - yaxe.labels.offsetX + 20; + } + } + }); + } + }, { + key: "setYAxisTextAlignments", + value: function setYAxisTextAlignments() { + var w = this.w; + var yaxis = Utils$1.listToArray(w.globals.dom.baseEl.getElementsByClassName('apexcharts-yaxis')); + yaxis.forEach(function (y, index) { + var yaxe = w.config.yaxis[index]; + if (yaxe && !yaxe.floating && yaxe.labels.align !== undefined) { + var yAxisInner = w.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(index, "'] .apexcharts-yaxis-texts-g")); + var yAxisTexts = Utils$1.listToArray(w.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxis[rel='".concat(index, "'] .apexcharts-yaxis-label"))); + var rect = yAxisInner.getBoundingClientRect(); + yAxisTexts.forEach(function (label) { + label.setAttribute('text-anchor', yaxe.labels.align); + }); + if (yaxe.labels.align === 'left' && !yaxe.opposite) { + yAxisInner.setAttribute('transform', "translate(-".concat(rect.width, ", 0)")); + } else if (yaxe.labels.align === 'center') { + yAxisInner.setAttribute('transform', "translate(".concat(rect.width / 2 * (!yaxe.opposite ? -1 : 1), ", 0)")); + } else if (yaxe.labels.align === 'right' && yaxe.opposite) { + yAxisInner.setAttribute('transform', "translate(".concat(rect.width, ", 0)")); + } + } + }); + } + }]); + return YAxis; + }(); + + var Events = /*#__PURE__*/function () { + function Events(ctx) { + _classCallCheck(this, Events); + this.ctx = ctx; + this.w = ctx.w; + this.documentEvent = Utils$1.bind(this.documentEvent, this); + } + _createClass(Events, [{ + key: "addEventListener", + value: function addEventListener(name, handler) { + var w = this.w; + if (w.globals.events.hasOwnProperty(name)) { + w.globals.events[name].push(handler); + } else { + w.globals.events[name] = [handler]; + } + } + }, { + key: "removeEventListener", + value: function removeEventListener(name, handler) { + var w = this.w; + if (!w.globals.events.hasOwnProperty(name)) { + return; + } + var index = w.globals.events[name].indexOf(handler); + if (index !== -1) { + w.globals.events[name].splice(index, 1); + } + } + }, { + key: "fireEvent", + value: function fireEvent(name, args) { + var w = this.w; + if (!w.globals.events.hasOwnProperty(name)) { + return; + } + if (!args || !args.length) { + args = []; + } + var evs = w.globals.events[name]; + var l = evs.length; + for (var i = 0; i < l; i++) { + evs[i].apply(null, args); + } + } + }, { + key: "setupEventHandlers", + value: function setupEventHandlers() { + var _this = this; + var w = this.w; + var me = this.ctx; + var clickableArea = w.globals.dom.baseEl.querySelector(w.globals.chartClass); + this.ctx.eventList.forEach(function (event) { + clickableArea.addEventListener(event, function (e) { + var opts = Object.assign({}, w, { + seriesIndex: w.globals.axisCharts ? w.globals.capturedSeriesIndex : 0, + dataPointIndex: w.globals.capturedDataPointIndex + }); + if (e.type === 'mousemove' || e.type === 'touchmove') { + if (typeof w.config.chart.events.mouseMove === 'function') { + w.config.chart.events.mouseMove(e, me, opts); + } + } else if (e.type === 'mouseleave' || e.type === 'touchleave') { + if (typeof w.config.chart.events.mouseLeave === 'function') { + w.config.chart.events.mouseLeave(e, me, opts); + } + } else if (e.type === 'mouseup' && e.which === 1 || e.type === 'touchend') { + if (typeof w.config.chart.events.click === 'function') { + w.config.chart.events.click(e, me, opts); + } + me.ctx.events.fireEvent('click', [e, me, opts]); + } + }, { + capture: false, + passive: true + }); + }); + this.ctx.eventList.forEach(function (event) { + w.globals.dom.baseEl.addEventListener(event, _this.documentEvent, { + passive: true + }); + }); + this.ctx.core.setupBrushHandler(); + } + }, { + key: "documentEvent", + value: function documentEvent(e) { + var w = this.w; + var target = e.target.className; + if (e.type === 'click') { + var elMenu = w.globals.dom.baseEl.querySelector('.apexcharts-menu'); + if (elMenu && elMenu.classList.contains('apexcharts-menu-open') && target !== 'apexcharts-menu-icon') { + elMenu.classList.remove('apexcharts-menu-open'); + } + } + w.globals.clientX = e.type === 'touchmove' ? e.touches[0].clientX : e.clientX; + w.globals.clientY = e.type === 'touchmove' ? e.touches[0].clientY : e.clientY; + } + }]); + return Events; + }(); + + var Localization = /*#__PURE__*/function () { + function Localization(ctx) { + _classCallCheck(this, Localization); + this.ctx = ctx; + this.w = ctx.w; + } + _createClass(Localization, [{ + key: "setCurrentLocaleValues", + value: function setCurrentLocaleValues(localeName) { + var locales = this.w.config.chart.locales; + + // check if user has specified locales in global Apex variable + // if yes - then extend those with local chart's locale + if (window.Apex.chart && window.Apex.chart.locales && window.Apex.chart.locales.length > 0) { + locales = this.w.config.chart.locales.concat(window.Apex.chart.locales); + } + + // find the locale from the array of locales which user has set (either by chart.defaultLocale or by calling setLocale() method.) + var selectedLocale = locales.filter(function (c) { + return c.name === localeName; + })[0]; + if (selectedLocale) { + // create a complete locale object by extending defaults so you don't get undefined errors. + var ret = Utils$1.extend(en, selectedLocale); + + // store these locale options in global var for ease access + this.w.globals.locale = ret.options; + } else { + throw new Error('Wrong locale name provided. Please make sure you set the correct locale name in options'); + } + } + }]); + return Localization; + }(); + + var Axes = /*#__PURE__*/function () { + function Axes(ctx) { + _classCallCheck(this, Axes); + this.ctx = ctx; + this.w = ctx.w; + } + _createClass(Axes, [{ + key: "drawAxis", + value: function drawAxis(type, elgrid) { + var _this = this; + var gl = this.w.globals; + var cnf = this.w.config; + var xAxis = new XAxis(this.ctx, elgrid); + var yAxis = new YAxis(this.ctx, elgrid); + if (gl.axisCharts && type !== 'radar') { + var elXaxis, elYaxis; + if (gl.isBarHorizontal) { + elYaxis = yAxis.drawYaxisInversed(0); + elXaxis = xAxis.drawXaxisInversed(0); + gl.dom.elGraphical.add(elXaxis); + gl.dom.elGraphical.add(elYaxis); + } else { + elXaxis = xAxis.drawXaxis(); + gl.dom.elGraphical.add(elXaxis); + cnf.yaxis.map(function (yaxe, index) { + if (gl.ignoreYAxisIndexes.indexOf(index) === -1) { + elYaxis = yAxis.drawYaxis(index); + gl.dom.Paper.add(elYaxis); + if (_this.w.config.grid.position === 'back') { + var inner = gl.dom.Paper.children()[1]; + inner.remove(); + gl.dom.Paper.add(inner); + } + } + }); + } + } + } + }]); + return Axes; + }(); + + var Crosshairs = /*#__PURE__*/function () { + function Crosshairs(ctx) { + _classCallCheck(this, Crosshairs); + this.ctx = ctx; + this.w = ctx.w; + } + _createClass(Crosshairs, [{ + key: "drawXCrosshairs", + value: function drawXCrosshairs() { + var w = this.w; + var graphics = new Graphics(this.ctx); + var filters = new Filters(this.ctx); + var crosshairGradient = w.config.xaxis.crosshairs.fill.gradient; + var crosshairShadow = w.config.xaxis.crosshairs.dropShadow; + var fillType = w.config.xaxis.crosshairs.fill.type; + var gradientFrom = crosshairGradient.colorFrom; + var gradientTo = crosshairGradient.colorTo; + var opacityFrom = crosshairGradient.opacityFrom; + var opacityTo = crosshairGradient.opacityTo; + var stops = crosshairGradient.stops; + var shadow = 'none'; + var dropShadow = crosshairShadow.enabled; + var shadowLeft = crosshairShadow.left; + var shadowTop = crosshairShadow.top; + var shadowBlur = crosshairShadow.blur; + var shadowColor = crosshairShadow.color; + var shadowOpacity = crosshairShadow.opacity; + var xcrosshairsFill = w.config.xaxis.crosshairs.fill.color; + if (w.config.xaxis.crosshairs.show) { + if (fillType === 'gradient') { + xcrosshairsFill = graphics.drawGradient('vertical', gradientFrom, gradientTo, opacityFrom, opacityTo, null, stops, null); + } + var xcrosshairs = graphics.drawRect(); + if (w.config.xaxis.crosshairs.width === 1) { + // to prevent drawing 2 lines, convert rect to line + xcrosshairs = graphics.drawLine(); + } + var gridHeight = w.globals.gridHeight; + if (!Utils$1.isNumber(gridHeight) || gridHeight < 0) { + gridHeight = 0; + } + var crosshairsWidth = w.config.xaxis.crosshairs.width; + if (!Utils$1.isNumber(crosshairsWidth) || crosshairsWidth < 0) { + crosshairsWidth = 0; + } + xcrosshairs.attr({ + class: 'apexcharts-xcrosshairs', + x: 0, + y: 0, + y2: gridHeight, + width: crosshairsWidth, + height: gridHeight, + fill: xcrosshairsFill, + filter: shadow, + 'fill-opacity': w.config.xaxis.crosshairs.opacity, + stroke: w.config.xaxis.crosshairs.stroke.color, + 'stroke-width': w.config.xaxis.crosshairs.stroke.width, + 'stroke-dasharray': w.config.xaxis.crosshairs.stroke.dashArray + }); + if (dropShadow) { + xcrosshairs = filters.dropShadow(xcrosshairs, { + left: shadowLeft, + top: shadowTop, + blur: shadowBlur, + color: shadowColor, + opacity: shadowOpacity + }); + } + w.globals.dom.elGraphical.add(xcrosshairs); + } + } + }, { + key: "drawYCrosshairs", + value: function drawYCrosshairs() { + var w = this.w; + var graphics = new Graphics(this.ctx); + var crosshair = w.config.yaxis[0].crosshairs; + var offX = w.globals.barPadForNumericAxis; + if (w.config.yaxis[0].crosshairs.show) { + var ycrosshairs = graphics.drawLine(-offX, 0, w.globals.gridWidth + offX, 0, crosshair.stroke.color, crosshair.stroke.dashArray, crosshair.stroke.width); + ycrosshairs.attr({ + class: 'apexcharts-ycrosshairs' + }); + w.globals.dom.elGraphical.add(ycrosshairs); + } + + // draw an invisible crosshair to help in positioning the yaxis tooltip + var ycrosshairsHidden = graphics.drawLine(-offX, 0, w.globals.gridWidth + offX, 0, crosshair.stroke.color, 0, 0); + ycrosshairsHidden.attr({ + class: 'apexcharts-ycrosshairs-hidden' + }); + w.globals.dom.elGraphical.add(ycrosshairsHidden); + } + }]); + return Crosshairs; + }(); + + /** + * ApexCharts Responsive Class to override options for different screen sizes. + * + * @module Responsive + **/ + var Responsive = /*#__PURE__*/function () { + function Responsive(ctx) { + _classCallCheck(this, Responsive); + this.ctx = ctx; + this.w = ctx.w; + } + + // the opts parameter if not null has to be set overriding everything + // as the opts is set by user externally + _createClass(Responsive, [{ + key: "checkResponsiveConfig", + value: function checkResponsiveConfig(opts) { + var _this = this; + var w = this.w; + var cnf = w.config; + + // check if responsive config exists + if (cnf.responsive.length === 0) return; + var res = cnf.responsive.slice(); + res.sort(function (a, b) { + return a.breakpoint > b.breakpoint ? 1 : b.breakpoint > a.breakpoint ? -1 : 0; + }).reverse(); + var config = new Config({}); + var iterateResponsiveOptions = function iterateResponsiveOptions() { + var newOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + var largestBreakpoint = res[0].breakpoint; + var width = window.innerWidth > 0 ? window.innerWidth : screen.width; + if (width > largestBreakpoint) { + var initialConfig = Utils$1.clone(w.globals.initialConfig); + // Retain state of series in case any have been collapsed + // (indicated by series.data === [], these series' will be zeroed later + // enabling stacking to work correctly) + initialConfig.series = Utils$1.clone(w.config.series); + var options = CoreUtils.extendArrayProps(config, initialConfig, w); + newOptions = Utils$1.extend(options, newOptions); + newOptions = Utils$1.extend(w.config, newOptions); + _this.overrideResponsiveOptions(newOptions); + } else { + for (var i = 0; i < res.length; i++) { + if (width < res[i].breakpoint) { + newOptions = CoreUtils.extendArrayProps(config, res[i].options, w); + newOptions = Utils$1.extend(w.config, newOptions); + _this.overrideResponsiveOptions(newOptions); + } + } + } + }; + if (opts) { + var options = CoreUtils.extendArrayProps(config, opts, w); + options = Utils$1.extend(w.config, options); + options = Utils$1.extend(options, opts); + iterateResponsiveOptions(options); + } else { + iterateResponsiveOptions({}); + } + } + }, { + key: "overrideResponsiveOptions", + value: function overrideResponsiveOptions(newOptions) { + var newConfig = new Config(newOptions).init({ + responsiveOverride: true + }); + this.w.config = newConfig; + } + }]); + return Responsive; + }(); + + /** + * ApexCharts Theme Class for setting the colors and palettes. + * + * @module Theme + **/ + var Theme = /*#__PURE__*/function () { + function Theme(ctx) { + _classCallCheck(this, Theme); + this.ctx = ctx; + this.w = ctx.w; + this.colors = []; + this.isColorFn = false; + this.isHeatmapDistributed = this.checkHeatmapDistributed(); + this.isBarDistributed = this.checkBarDistributed(); + } + _createClass(Theme, [{ + key: "checkHeatmapDistributed", + value: function checkHeatmapDistributed() { + var _this$w$config = this.w.config, + chart = _this$w$config.chart, + plotOptions = _this$w$config.plotOptions; + return chart.type === 'treemap' && plotOptions.treemap && plotOptions.treemap.distributed || chart.type === 'heatmap' && plotOptions.heatmap && plotOptions.heatmap.distributed; + } + }, { + key: "checkBarDistributed", + value: function checkBarDistributed() { + var _this$w$config2 = this.w.config, + chart = _this$w$config2.chart, + plotOptions = _this$w$config2.plotOptions; + return plotOptions.bar && plotOptions.bar.distributed && (chart.type === 'bar' || chart.type === 'rangeBar'); + } + }, { + key: "init", + value: function init() { + this.setDefaultColors(); + } + }, { + key: "setDefaultColors", + value: function setDefaultColors() { + var w = this.w; + var utils = new Utils$1(); + w.globals.dom.elWrap.classList.add("apexcharts-theme-".concat(w.config.theme.mode)); + + // Create a copy of config.colors array to avoid mutating the original config.colors + var configColors = _toConsumableArray(w.config.colors || w.config.fill.colors || []); + w.globals.colors = this.getColors(configColors); + this.applySeriesColors(w.globals.seriesColors, w.globals.colors); + if (w.config.theme.monochrome.enabled) { + w.globals.colors = this.getMonochromeColors(w.config.theme.monochrome, w.globals.series, utils); + } + var defaultColors = w.globals.colors.slice(); + this.pushExtraColors(w.globals.colors); + this.applyColorTypes(['fill', 'stroke'], defaultColors); + this.applyDataLabelsColors(defaultColors); + this.applyRadarPolygonsColors(); + this.applyMarkersColors(defaultColors); + } + }, { + key: "getColors", + value: function getColors(configColors) { + var _this = this; + var w = this.w; + if (!configColors || configColors.length === 0) { + return this.predefined(); + } + if (Array.isArray(configColors) && configColors.length > 0 && typeof configColors[0] === 'function') { + this.isColorFn = true; + return w.config.series.map(function (s, i) { + var c = configColors[i] || configColors[0]; + return typeof c === 'function' ? c({ + value: w.globals.axisCharts ? w.globals.series[i][0] || 0 : w.globals.series[i], + seriesIndex: i, + dataPointIndex: i, + w: _this.w + }) : c; + }); + } + return configColors; + } + }, { + key: "applySeriesColors", + value: function applySeriesColors(seriesColors, globalsColors) { + seriesColors.forEach(function (c, i) { + if (c) { + globalsColors[i] = c; + } + }); + } + }, { + key: "getMonochromeColors", + value: function getMonochromeColors(monochrome, series, utils) { + var color = monochrome.color, + shadeIntensity = monochrome.shadeIntensity, + shadeTo = monochrome.shadeTo; + var glsCnt = this.isBarDistributed || this.isHeatmapDistributed ? series[0].length * series.length : series.length; + var part = 1 / (glsCnt / shadeIntensity); + var percent = 0; + return Array.from({ + length: glsCnt + }, function () { + var newColor = shadeTo === 'dark' ? utils.shadeColor(percent * -1, color) : utils.shadeColor(percent, color); + percent += part; + return newColor; + }); + } + }, { + key: "applyColorTypes", + value: function applyColorTypes(colorTypes, defaultColors) { + var _this2 = this; + var w = this.w; + colorTypes.forEach(function (c) { + w.globals[c].colors = w.config[c].colors === undefined ? _this2.isColorFn ? w.config.colors : defaultColors : w.config[c].colors.slice(); + _this2.pushExtraColors(w.globals[c].colors); + }); + } + }, { + key: "applyDataLabelsColors", + value: function applyDataLabelsColors(defaultColors) { + var w = this.w; + w.globals.dataLabels.style.colors = w.config.dataLabels.style.colors === undefined ? defaultColors : w.config.dataLabels.style.colors.slice(); + this.pushExtraColors(w.globals.dataLabels.style.colors, 50); + } + }, { + key: "applyRadarPolygonsColors", + value: function applyRadarPolygonsColors() { + var w = this.w; + w.globals.radarPolygons.fill.colors = w.config.plotOptions.radar.polygons.fill.colors === undefined ? [w.config.theme.mode === 'dark' ? '#424242' : 'none'] : w.config.plotOptions.radar.polygons.fill.colors.slice(); + this.pushExtraColors(w.globals.radarPolygons.fill.colors, 20); + } + }, { + key: "applyMarkersColors", + value: function applyMarkersColors(defaultColors) { + var w = this.w; + w.globals.markers.colors = w.config.markers.colors === undefined ? defaultColors : w.config.markers.colors.slice(); + this.pushExtraColors(w.globals.markers.colors); + } + }, { + key: "pushExtraColors", + value: function pushExtraColors(colorSeries, length) { + var distributed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + var w = this.w; + var len = length || w.globals.series.length; + if (distributed === null) { + distributed = this.isBarDistributed || this.isHeatmapDistributed || w.config.chart.type === 'heatmap' && w.config.plotOptions.heatmap && w.config.plotOptions.heatmap.colorScale.inverse; + } + if (distributed && w.globals.series.length) { + len = w.globals.series[w.globals.maxValsInArrayIndex].length * w.globals.series.length; + } + if (colorSeries.length < len) { + var diff = len - colorSeries.length; + for (var i = 0; i < diff; i++) { + colorSeries.push(colorSeries[i]); + } + } + } + }, { + key: "updateThemeOptions", + value: function updateThemeOptions(options) { + options.chart = options.chart || {}; + options.tooltip = options.tooltip || {}; + var mode = options.theme.mode; + var palette = mode === 'dark' ? 'palette4' : mode === 'light' ? 'palette1' : options.theme.palette || 'palette1'; + var foreColor = mode === 'dark' ? '#f6f7f8' : mode === 'light' ? '#373d3f' : options.chart.foreColor || '#373d3f'; + options.tooltip.theme = mode || 'light'; + options.chart.foreColor = foreColor; + options.theme.palette = palette; + return options; + } + }, { + key: "predefined", + value: function predefined() { + var palette = this.w.config.theme.palette; + var palettes = { + palette1: ['#008FFB', '#00E396', '#FEB019', '#FF4560', '#775DD0'], + palette2: ['#3f51b5', '#03a9f4', '#4caf50', '#f9ce1d', '#FF9800'], + palette3: ['#33b2df', '#546E7A', '#d4526e', '#13d8aa', '#A5978B'], + palette4: ['#4ecdc4', '#c7f464', '#81D4FA', '#fd6a6a', '#546E7A'], + palette5: ['#2b908f', '#f9a3a4', '#90ee7e', '#fa4443', '#69d2e7'], + palette6: ['#449DD1', '#F86624', '#EA3546', '#662E9B', '#C5D86D'], + palette7: ['#D7263D', '#1B998B', '#2E294E', '#F46036', '#E2C044'], + palette8: ['#662E9B', '#F86624', '#F9C80E', '#EA3546', '#43BCCD'], + palette9: ['#5C4742', '#A5978B', '#8D5B4C', '#5A2A27', '#C4BBAF'], + palette10: ['#A300D6', '#7D02EB', '#5653FE', '#2983FF', '#00B1F2'], + default: ['#008FFB', '#00E396', '#FEB019', '#FF4560', '#775DD0'] + }; + return palettes[palette] || palettes.default; + } + }]); + return Theme; + }(); + + var TitleSubtitle = /*#__PURE__*/function () { + function TitleSubtitle(ctx) { + _classCallCheck(this, TitleSubtitle); + this.ctx = ctx; + this.w = ctx.w; + } + _createClass(TitleSubtitle, [{ + key: "draw", + value: function draw() { + this.drawTitleSubtitle('title'); + this.drawTitleSubtitle('subtitle'); + } + }, { + key: "drawTitleSubtitle", + value: function drawTitleSubtitle(type) { + var w = this.w; + var tsConfig = type === 'title' ? w.config.title : w.config.subtitle; + var x = w.globals.svgWidth / 2; + var y = tsConfig.offsetY; + var textAnchor = 'middle'; + if (tsConfig.align === 'left') { + x = 10; + textAnchor = 'start'; + } else if (tsConfig.align === 'right') { + x = w.globals.svgWidth - 10; + textAnchor = 'end'; + } + x = x + tsConfig.offsetX; + y = y + parseInt(tsConfig.style.fontSize, 10) + tsConfig.margin / 2; + if (tsConfig.text !== undefined) { + var graphics = new Graphics(this.ctx); + var titleText = graphics.drawText({ + x: x, + y: y, + text: tsConfig.text, + textAnchor: textAnchor, + fontSize: tsConfig.style.fontSize, + fontFamily: tsConfig.style.fontFamily, + fontWeight: tsConfig.style.fontWeight, + foreColor: tsConfig.style.color, + opacity: 1 + }); + titleText.node.setAttribute('class', "apexcharts-".concat(type, "-text")); + w.globals.dom.Paper.add(titleText); + } + } + }]); + return TitleSubtitle; + }(); + + var Helpers$3 = /*#__PURE__*/function () { + function Helpers(dCtx) { + _classCallCheck(this, Helpers); + this.w = dCtx.w; + this.dCtx = dCtx; + } + + /** + * Get Chart Title/Subtitle Dimensions + * @memberof Dimensions + * @return {{width, height}} + **/ + _createClass(Helpers, [{ + key: "getTitleSubtitleCoords", + value: function getTitleSubtitleCoords(type) { + var w = this.w; + var width = 0; + var height = 0; + var floating = type === 'title' ? w.config.title.floating : w.config.subtitle.floating; + var el = w.globals.dom.baseEl.querySelector(".apexcharts-".concat(type, "-text")); + if (el !== null && !floating) { + var coord = el.getBoundingClientRect(); + width = coord.width; + height = w.globals.axisCharts ? coord.height + 5 : coord.height; + } + return { + width: width, + height: height + }; + } + }, { + key: "getLegendsRect", + value: function getLegendsRect() { + var w = this.w; + var elLegendWrap = w.globals.dom.elLegendWrap; + if (!w.config.legend.height && (w.config.legend.position === 'top' || w.config.legend.position === 'bottom')) { + // avoid legend to take up all the space + elLegendWrap.style.maxHeight = w.globals.svgHeight / 2 + 'px'; + } + var lgRect = Object.assign({}, Utils$1.getBoundingClientRect(elLegendWrap)); + if (elLegendWrap !== null && !w.config.legend.floating && w.config.legend.show) { + this.dCtx.lgRect = { + x: lgRect.x, + y: lgRect.y, + height: lgRect.height, + width: lgRect.height === 0 ? 0 : lgRect.width + }; + } else { + this.dCtx.lgRect = { + x: 0, + y: 0, + height: 0, + width: 0 + }; + } + + // if legend takes up all of the chart space, we need to restrict it. + if (w.config.legend.position === 'left' || w.config.legend.position === 'right') { + if (this.dCtx.lgRect.width * 1.5 > w.globals.svgWidth) { + this.dCtx.lgRect.width = w.globals.svgWidth / 1.5; + } + } + return this.dCtx.lgRect; + } + + /** + * Get Y Axis Dimensions + * @memberof Dimensions + * @return {{width, height}} + **/ + }, { + key: "getDatalabelsRect", + value: function getDatalabelsRect() { + var _this = this; + var w = this.w; + var allLabels = []; + w.config.series.forEach(function (serie, seriesIndex) { + serie.data.forEach(function (datum, dataPointIndex) { + var getText = function getText(v) { + return w.config.dataLabels.formatter(v, { + ctx: _this.dCtx.ctx, + seriesIndex: seriesIndex, + dataPointIndex: dataPointIndex, + w: w + }); + }; + val = getText(w.globals.series[seriesIndex][dataPointIndex]); + allLabels.push(val); + }); + }); + var val = Utils$1.getLargestStringFromArr(allLabels); + var graphics = new Graphics(this.dCtx.ctx); + var dataLabelsStyle = w.config.dataLabels.style; + var labelrect = graphics.getTextRects(val, parseInt(dataLabelsStyle.fontSize), dataLabelsStyle.fontFamily); + return { + width: labelrect.width * 1.05, + height: labelrect.height + }; + } + }, { + key: "getLargestStringFromMultiArr", + value: function getLargestStringFromMultiArr(val, arr) { + var w = this.w; + var valArr = val; + if (w.globals.isMultiLineX) { + // if the xaxis labels has multiline texts (array) + var maxArrs = arr.map(function (xl, idx) { + return Array.isArray(xl) ? xl.length : 1; + }); + var maxArrLen = Math.max.apply(Math, _toConsumableArray(maxArrs)); + var maxArrIndex = maxArrs.indexOf(maxArrLen); + valArr = arr[maxArrIndex]; + } + return valArr; + } + }]); + return Helpers; + }(); + + var DimXAxis = /*#__PURE__*/function () { + function DimXAxis(dCtx) { + _classCallCheck(this, DimXAxis); + this.w = dCtx.w; + this.dCtx = dCtx; + } + + /** + * Get X Axis Dimensions + * @memberof Dimensions + * @return {{width, height}} + **/ + _createClass(DimXAxis, [{ + key: "getxAxisLabelsCoords", + value: function getxAxisLabelsCoords() { + var w = this.w; + var xaxisLabels = w.globals.labels.slice(); + if (w.config.xaxis.convertedCatToNumeric && xaxisLabels.length === 0) { + xaxisLabels = w.globals.categoryLabels; + } + var rect; + if (w.globals.timescaleLabels.length > 0) { + var coords = this.getxAxisTimeScaleLabelsCoords(); + rect = { + width: coords.width, + height: coords.height + }; + w.globals.rotateXLabels = false; + } else { + this.dCtx.lgWidthForSideLegends = (w.config.legend.position === 'left' || w.config.legend.position === 'right') && !w.config.legend.floating ? this.dCtx.lgRect.width : 0; + + // get the longest string from the labels array and also apply label formatter + var xlbFormatter = w.globals.xLabelFormatter; + // prevent changing xaxisLabels to avoid issues in multi-yaxes - fix #522 + var val = Utils$1.getLargestStringFromArr(xaxisLabels); + var valArr = this.dCtx.dimHelpers.getLargestStringFromMultiArr(val, xaxisLabels); + + // the labels gets changed for bar charts + if (w.globals.isBarHorizontal) { + val = w.globals.yAxisScale[0].result.reduce(function (a, b) { + return a.length > b.length ? a : b; + }, 0); + valArr = val; + } + var xFormat = new Formatters(this.dCtx.ctx); + var timestamp = val; + val = xFormat.xLabelFormat(xlbFormatter, val, timestamp, { + i: undefined, + dateFormatter: new DateTime(this.dCtx.ctx).formatDate, + w: w + }); + valArr = xFormat.xLabelFormat(xlbFormatter, valArr, timestamp, { + i: undefined, + dateFormatter: new DateTime(this.dCtx.ctx).formatDate, + w: w + }); + if (w.config.xaxis.convertedCatToNumeric && typeof val === 'undefined' || String(val).trim() === '') { + val = '1'; + valArr = val; + } + var graphics = new Graphics(this.dCtx.ctx); + var xLabelrect = graphics.getTextRects(val, w.config.xaxis.labels.style.fontSize); + var xArrLabelrect = xLabelrect; + if (val !== valArr) { + xArrLabelrect = graphics.getTextRects(valArr, w.config.xaxis.labels.style.fontSize); + } + rect = { + width: xLabelrect.width >= xArrLabelrect.width ? xLabelrect.width : xArrLabelrect.width, + height: xLabelrect.height >= xArrLabelrect.height ? xLabelrect.height : xArrLabelrect.height + }; + if (rect.width * xaxisLabels.length > w.globals.svgWidth - this.dCtx.lgWidthForSideLegends - this.dCtx.yAxisWidth - this.dCtx.gridPad.left - this.dCtx.gridPad.right && w.config.xaxis.labels.rotate !== 0 || w.config.xaxis.labels.rotateAlways) { + if (!w.globals.isBarHorizontal) { + w.globals.rotateXLabels = true; + var getRotatedTextRects = function getRotatedTextRects(text) { + return graphics.getTextRects(text, w.config.xaxis.labels.style.fontSize, w.config.xaxis.labels.style.fontFamily, "rotate(".concat(w.config.xaxis.labels.rotate, " 0 0)"), false); + }; + xLabelrect = getRotatedTextRects(val); + if (val !== valArr) { + xArrLabelrect = getRotatedTextRects(valArr); + } + rect.height = (xLabelrect.height > xArrLabelrect.height ? xLabelrect.height : xArrLabelrect.height) / 1.5; + rect.width = xLabelrect.width > xArrLabelrect.width ? xLabelrect.width : xArrLabelrect.width; + } + } else { + w.globals.rotateXLabels = false; + } + } + if (!w.config.xaxis.labels.show) { + rect = { + width: 0, + height: 0 + }; + } + return { + width: rect.width, + height: rect.height + }; + } + + /** + * Get X Axis Label Group height + * @memberof Dimensions + * @return {{width, height}} + */ + }, { + key: "getxAxisGroupLabelsCoords", + value: function getxAxisGroupLabelsCoords() { + var _w$config$xaxis$group; + var w = this.w; + if (!w.globals.hasXaxisGroups) { + return { + width: 0, + height: 0 + }; + } + var fontSize = ((_w$config$xaxis$group = w.config.xaxis.group.style) === null || _w$config$xaxis$group === void 0 ? void 0 : _w$config$xaxis$group.fontSize) || w.config.xaxis.labels.style.fontSize; + var xaxisLabels = w.globals.groups.map(function (g) { + return g.title; + }); + var rect; + + // prevent changing xaxisLabels to avoid issues in multi-yaxes - fix #522 + var val = Utils$1.getLargestStringFromArr(xaxisLabels); + var valArr = this.dCtx.dimHelpers.getLargestStringFromMultiArr(val, xaxisLabels); + var graphics = new Graphics(this.dCtx.ctx); + var xLabelrect = graphics.getTextRects(val, fontSize); + var xArrLabelrect = xLabelrect; + if (val !== valArr) { + xArrLabelrect = graphics.getTextRects(valArr, fontSize); + } + rect = { + width: xLabelrect.width >= xArrLabelrect.width ? xLabelrect.width : xArrLabelrect.width, + height: xLabelrect.height >= xArrLabelrect.height ? xLabelrect.height : xArrLabelrect.height + }; + if (!w.config.xaxis.labels.show) { + rect = { + width: 0, + height: 0 + }; + } + return { + width: rect.width, + height: rect.height + }; + } + + /** + * Get X Axis Title Dimensions + * @memberof Dimensions + * @return {{width, height}} + **/ + }, { + key: "getxAxisTitleCoords", + value: function getxAxisTitleCoords() { + var w = this.w; + var width = 0; + var height = 0; + if (w.config.xaxis.title.text !== undefined) { + var graphics = new Graphics(this.dCtx.ctx); + var rect = graphics.getTextRects(w.config.xaxis.title.text, w.config.xaxis.title.style.fontSize); + width = rect.width; + height = rect.height; + } + return { + width: width, + height: height + }; + } + }, { + key: "getxAxisTimeScaleLabelsCoords", + value: function getxAxisTimeScaleLabelsCoords() { + var w = this.w; + var rect; + this.dCtx.timescaleLabels = w.globals.timescaleLabels.slice(); + var labels = this.dCtx.timescaleLabels.map(function (label) { + return label.value; + }); + + // get the longest string from the labels array and also apply label formatter to it + var val = labels.reduce(function (a, b) { + // if undefined, maybe user didn't pass the datetime(x) values + if (typeof a === 'undefined') { + console.error('You have possibly supplied invalid Date format. Please supply a valid JavaScript Date'); + return 0; + } else { + return a.length > b.length ? a : b; + } + }, 0); + var graphics = new Graphics(this.dCtx.ctx); + rect = graphics.getTextRects(val, w.config.xaxis.labels.style.fontSize); + var totalWidthRotated = rect.width * 1.05 * labels.length; + if (totalWidthRotated > w.globals.gridWidth && w.config.xaxis.labels.rotate !== 0) { + w.globals.overlappingXLabels = true; + } + return rect; + } + + // In certain cases, the last labels gets cropped in xaxis. + // Hence, we add some additional padding based on the label length to avoid the last label being cropped or we don't draw it at all + }, { + key: "additionalPaddingXLabels", + value: function additionalPaddingXLabels(xaxisLabelCoords) { + var _this = this; + var w = this.w; + var gl = w.globals; + var cnf = w.config; + var xtype = cnf.xaxis.type; + var lbWidth = xaxisLabelCoords.width; + gl.skipLastTimelinelabel = false; + gl.skipFirstTimelinelabel = false; + var isBarOpposite = w.config.yaxis[0].opposite && w.globals.isBarHorizontal; + var isCollapsed = function isCollapsed(i) { + return gl.collapsedSeriesIndices.indexOf(i) !== -1; + }; + var rightPad = function rightPad(yaxe) { + if (_this.dCtx.timescaleLabels && _this.dCtx.timescaleLabels.length) { + // for timeline labels, we take the last label and check if it exceeds gridWidth + var firstimescaleLabel = _this.dCtx.timescaleLabels[0]; + var lastTimescaleLabel = _this.dCtx.timescaleLabels[_this.dCtx.timescaleLabels.length - 1]; + var lastLabelPosition = lastTimescaleLabel.position + lbWidth / 1.75 - _this.dCtx.yAxisWidthRight; + var firstLabelPosition = firstimescaleLabel.position - lbWidth / 1.75 + _this.dCtx.yAxisWidthLeft; + var lgRightRectWidth = w.config.legend.position === 'right' && _this.dCtx.lgRect.width > 0 ? _this.dCtx.lgRect.width : 0; + if (lastLabelPosition > gl.svgWidth - gl.translateX - lgRightRectWidth) { + gl.skipLastTimelinelabel = true; + } + if (firstLabelPosition < -((!yaxe.show || yaxe.floating) && (cnf.chart.type === 'bar' || cnf.chart.type === 'candlestick' || cnf.chart.type === 'rangeBar' || cnf.chart.type === 'boxPlot') ? lbWidth / 1.75 : 10)) { + gl.skipFirstTimelinelabel = true; + } + } else if (xtype === 'datetime') { + // If user has enabled DateTime, but uses own's formatter + if (_this.dCtx.gridPad.right < lbWidth && !gl.rotateXLabels) { + gl.skipLastTimelinelabel = true; + } + } else if (xtype !== 'datetime') { + if (_this.dCtx.gridPad.right < lbWidth / 2 - _this.dCtx.yAxisWidthRight && !gl.rotateXLabels && !w.config.xaxis.labels.trim) { + _this.dCtx.xPadRight = lbWidth / 2 + 1; + } + } + }; + var padYAxe = function padYAxe(yaxe, i) { + if (cnf.yaxis.length > 1 && isCollapsed(i)) return; + rightPad(yaxe); + }; + cnf.yaxis.forEach(function (yaxe, i) { + if (isBarOpposite) { + if (_this.dCtx.gridPad.left < lbWidth) { + _this.dCtx.xPadLeft = lbWidth / 2 + 1; + } + _this.dCtx.xPadRight = lbWidth / 2 + 1; + } else { + padYAxe(yaxe, i); + } + }); + } + }]); + return DimXAxis; + }(); + + var DimYAxis = /*#__PURE__*/function () { + function DimYAxis(dCtx) { + _classCallCheck(this, DimYAxis); + this.w = dCtx.w; + this.dCtx = dCtx; + } + + /** + * Get Y Axis Dimensions + * @memberof Dimensions + * @return {{width, height}} + **/ + _createClass(DimYAxis, [{ + key: "getyAxisLabelsCoords", + value: function getyAxisLabelsCoords() { + var _this = this; + var w = this.w; + var width = 0; + var height = 0; + var ret = []; + var labelPad = 10; + var axesUtils = new AxesUtils(this.dCtx.ctx); + w.config.yaxis.map(function (yaxe, index) { + var formatterArgs = { + seriesIndex: index, + dataPointIndex: -1, + w: w + }; + var yS = w.globals.yAxisScale[index]; + var yAxisMinWidth = 0; + if (!axesUtils.isYAxisHidden(index) && yaxe.labels.show && yaxe.labels.minWidth !== undefined) yAxisMinWidth = yaxe.labels.minWidth; + if (!axesUtils.isYAxisHidden(index) && yaxe.labels.show && yS.result.length) { + var lbFormatter = w.globals.yLabelFormatters[index]; + var minV = yS.niceMin === Number.MIN_VALUE ? 0 : yS.niceMin; + var val = yS.result.reduce(function (acc, curr) { + var _String, _String2; + return ((_String = String(lbFormatter(acc, formatterArgs))) === null || _String === void 0 ? void 0 : _String.length) > ((_String2 = String(lbFormatter(curr, formatterArgs))) === null || _String2 === void 0 ? void 0 : _String2.length) ? acc : curr; + }, minV); + val = lbFormatter(val, formatterArgs); + + // the second parameter -1 is the index of tick which user can use in the formatter + var valArr = val; + + // if user has specified a custom formatter, and the result is null or empty, we need to discard the formatter and take the value as it is. + if (typeof val === 'undefined' || val.length === 0) { + val = yS.niceMax; + } + if (w.globals.isBarHorizontal) { + labelPad = 0; + var barYaxisLabels = w.globals.labels.slice(); + + // get the longest string from the labels array and also apply label formatter to it + val = Utils$1.getLargestStringFromArr(barYaxisLabels); + val = lbFormatter(val, { + seriesIndex: index, + dataPointIndex: -1, + w: w + }); + valArr = _this.dCtx.dimHelpers.getLargestStringFromMultiArr(val, barYaxisLabels); + } + var graphics = new Graphics(_this.dCtx.ctx); + var rotateStr = 'rotate('.concat(yaxe.labels.rotate, ' 0 0)'); + var rect = graphics.getTextRects(val, yaxe.labels.style.fontSize, yaxe.labels.style.fontFamily, rotateStr, false); + var arrLabelrect = rect; + if (val !== valArr) { + arrLabelrect = graphics.getTextRects(valArr, yaxe.labels.style.fontSize, yaxe.labels.style.fontFamily, rotateStr, false); + } + ret.push({ + width: (yAxisMinWidth > arrLabelrect.width || yAxisMinWidth > rect.width ? yAxisMinWidth : arrLabelrect.width > rect.width ? arrLabelrect.width : rect.width) + labelPad, + height: arrLabelrect.height > rect.height ? arrLabelrect.height : rect.height + }); + } else { + ret.push({ + width: width, + height: height + }); + } + }); + return ret; + } + + /** + * Get Y Axis Dimensions + * @memberof Dimensions + * @return {{width, height}} + **/ + }, { + key: "getyAxisTitleCoords", + value: function getyAxisTitleCoords() { + var _this2 = this; + var w = this.w; + var ret = []; + w.config.yaxis.map(function (yaxe, index) { + if (yaxe.show && yaxe.title.text !== undefined) { + var graphics = new Graphics(_this2.dCtx.ctx); + var rotateStr = 'rotate('.concat(yaxe.title.rotate, ' 0 0)'); + var rect = graphics.getTextRects(yaxe.title.text, yaxe.title.style.fontSize, yaxe.title.style.fontFamily, rotateStr, false); + ret.push({ + width: rect.width, + height: rect.height + }); + } else { + ret.push({ + width: 0, + height: 0 + }); + } + }); + return ret; + } + }, { + key: "getTotalYAxisWidth", + value: function getTotalYAxisWidth() { + var w = this.w; + var yAxisWidth = 0; + var yAxisWidthLeft = 0; + var yAxisWidthRight = 0; + var padding = w.globals.yAxisScale.length > 1 ? 10 : 0; + var axesUtils = new AxesUtils(this.dCtx.ctx); + var isHiddenYAxis = function isHiddenYAxis(index) { + return w.globals.ignoreYAxisIndexes.indexOf(index) > -1; + }; + var padForLabelTitle = function padForLabelTitle(coord, index) { + var floating = w.config.yaxis[index].floating; + var width = 0; + if (coord.width > 0 && !floating) { + width = coord.width + padding; + if (isHiddenYAxis(index)) { + width = width - coord.width - padding; + } + } else { + width = floating || axesUtils.isYAxisHidden(index) ? 0 : 5; + } + w.config.yaxis[index].opposite ? yAxisWidthRight = yAxisWidthRight + width : yAxisWidthLeft = yAxisWidthLeft + width; + yAxisWidth = yAxisWidth + width; + }; + w.globals.yLabelsCoords.map(function (yLabelCoord, index) { + padForLabelTitle(yLabelCoord, index); + }); + w.globals.yTitleCoords.map(function (yTitleCoord, index) { + padForLabelTitle(yTitleCoord, index); + }); + if (w.globals.isBarHorizontal && !w.config.yaxis[0].floating) { + yAxisWidth = w.globals.yLabelsCoords[0].width + w.globals.yTitleCoords[0].width + 15; + } + this.dCtx.yAxisWidthLeft = yAxisWidthLeft; + this.dCtx.yAxisWidthRight = yAxisWidthRight; + return yAxisWidth; + } + }]); + return DimYAxis; + }(); + + var DimGrid = /*#__PURE__*/function () { + function DimGrid(dCtx) { + _classCallCheck(this, DimGrid); + this.w = dCtx.w; + this.dCtx = dCtx; + } + _createClass(DimGrid, [{ + key: "gridPadForColumnsInNumericAxis", + value: function gridPadForColumnsInNumericAxis(gridWidth) { + var w = this.w; + var cnf = w.config, + gl = w.globals; + if (gl.noData || gl.collapsedSeries.length + gl.ancillaryCollapsedSeries.length === cnf.series.length) { + return 0; + } + var hasBar = function hasBar(type) { + return ['bar', 'rangeBar', 'candlestick', 'boxPlot'].includes(type); + }; + var type = cnf.chart.type; + var barWidth = 0; + var seriesLen = hasBar(type) ? cnf.series.length : 1; + if (gl.comboBarCount > 0) { + seriesLen = gl.comboBarCount; + } + gl.collapsedSeries.forEach(function (c) { + if (hasBar(c.type)) { + seriesLen -= 1; + } + }); + if (cnf.chart.stacked) { + seriesLen = 1; + } + var barsPresent = hasBar(type) || gl.comboBarCount > 0; + var xRange = Math.abs(gl.initialMaxX - gl.initialMinX); + if (barsPresent && gl.isXNumeric && !gl.isBarHorizontal && seriesLen > 0 && xRange !== 0) { + if (xRange <= 3) { + xRange = gl.dataPoints; + } + var xRatio = xRange / gridWidth; + var xDivision = gl.minXDiff && gl.minXDiff / xRatio > 0 ? gl.minXDiff / xRatio : 0; + if (xDivision > gridWidth / 2) { + xDivision /= 2; + } + // Here, barWidth is assumed to be the width occupied by a group of bars. + // There will be one bar in the group for each series plotted. + // Note: This version of the following math is different to that over in + // Helpers.js. Don't assume they should be the same. Over there, + // xDivision is computed differently and it's used on different charts. + // They were the same, but the solution to + // https://github.com/apexcharts/apexcharts.js/issues/4178 + // was to remove the division by seriesLen. + barWidth = xDivision * parseInt(cnf.plotOptions.bar.columnWidth, 10) / 100; + if (barWidth < 1) { + barWidth = 1; + } + gl.barPadForNumericAxis = barWidth; + } + return barWidth; + } + }, { + key: "gridPadFortitleSubtitle", + value: function gridPadFortitleSubtitle() { + var _this = this; + var w = this.w; + var gl = w.globals; + var gridShrinkOffset = this.dCtx.isSparkline || !gl.axisCharts ? 0 : 10; + var titleSubtitle = ['title', 'subtitle']; + titleSubtitle.forEach(function (t) { + if (w.config[t].text !== undefined) { + gridShrinkOffset += w.config[t].margin; + } else { + gridShrinkOffset += _this.dCtx.isSparkline || !gl.axisCharts ? 0 : 5; + } + }); + if (w.config.legend.show && w.config.legend.position === 'bottom' && !w.config.legend.floating && !gl.axisCharts) { + gridShrinkOffset += 10; + } + var titleCoords = this.dCtx.dimHelpers.getTitleSubtitleCoords('title'); + var subtitleCoords = this.dCtx.dimHelpers.getTitleSubtitleCoords('subtitle'); + gl.gridHeight -= titleCoords.height + subtitleCoords.height + gridShrinkOffset; + gl.translateY += titleCoords.height + subtitleCoords.height + gridShrinkOffset; + } + }, { + key: "setGridXPosForDualYAxis", + value: function setGridXPosForDualYAxis(yTitleCoords, yaxisLabelCoords) { + var w = this.w; + var axesUtils = new AxesUtils(this.dCtx.ctx); + w.config.yaxis.forEach(function (yaxe, index) { + if (w.globals.ignoreYAxisIndexes.indexOf(index) === -1 && !yaxe.floating && !axesUtils.isYAxisHidden(index)) { + if (yaxe.opposite) { + w.globals.translateX -= yaxisLabelCoords[index].width + yTitleCoords[index].width + parseInt(yaxe.labels.style.fontSize, 10) / 1.2 + 12; + } + + // fixes apexcharts.js#1599 + if (w.globals.translateX < 2) { + w.globals.translateX = 2; + } + } + }); + } + }]); + return DimGrid; + }(); + + /** + * ApexCharts Dimensions Class for calculating rects of all elements that are drawn and will be drawn. + * + * @module Dimensions + **/ + var Dimensions = /*#__PURE__*/function () { + function Dimensions(ctx) { + _classCallCheck(this, Dimensions); + this.ctx = ctx; + this.w = ctx.w; + this.lgRect = {}; + this.yAxisWidth = 0; + this.yAxisWidthLeft = 0; + this.yAxisWidthRight = 0; + this.xAxisHeight = 0; + this.isSparkline = this.w.config.chart.sparkline.enabled; + this.dimHelpers = new Helpers$3(this); + this.dimYAxis = new DimYAxis(this); + this.dimXAxis = new DimXAxis(this); + this.dimGrid = new DimGrid(this); + this.lgWidthForSideLegends = 0; + this.gridPad = this.w.config.grid.padding; + this.xPadRight = 0; + this.xPadLeft = 0; + } + + /** + * @memberof Dimensions + * @param {object} w - chart context + **/ + _createClass(Dimensions, [{ + key: "plotCoords", + value: function plotCoords() { + var _this = this; + var w = this.w; + var gl = w.globals; + this.lgRect = this.dimHelpers.getLegendsRect(); + this.datalabelsCoords = { + width: 0, + height: 0 + }; + var maxStrokeWidth = Array.isArray(w.config.stroke.width) ? Math.max.apply(Math, _toConsumableArray(w.config.stroke.width)) : w.config.stroke.width; + if (this.isSparkline) { + if (w.config.markers.discrete.length > 0 || w.config.markers.size > 0) { + Object.entries(this.gridPad).forEach(function (_ref) { + var _ref2 = _slicedToArray(_ref, 2), + k = _ref2[0], + v = _ref2[1]; + _this.gridPad[k] = Math.max(v, _this.w.globals.markers.largestSize / 1.5); + }); + } + this.gridPad.top = Math.max(maxStrokeWidth / 2, this.gridPad.top); + this.gridPad.bottom = Math.max(maxStrokeWidth / 2, this.gridPad.bottom); + } + if (gl.axisCharts) { + // for line / area / scatter / column + this.setDimensionsForAxisCharts(); + } else { + // for pie / donuts / circle + this.setDimensionsForNonAxisCharts(); + } + this.dimGrid.gridPadFortitleSubtitle(); + + // after calculating everything, apply padding set by user + gl.gridHeight = gl.gridHeight - this.gridPad.top - this.gridPad.bottom; + gl.gridWidth = gl.gridWidth - this.gridPad.left - this.gridPad.right - this.xPadRight - this.xPadLeft; + var barWidth = this.dimGrid.gridPadForColumnsInNumericAxis(gl.gridWidth); + gl.gridWidth = gl.gridWidth - barWidth * 2; + gl.translateX = gl.translateX + this.gridPad.left + this.xPadLeft + (barWidth > 0 ? barWidth : 0); + gl.translateY = gl.translateY + this.gridPad.top; + } + }, { + key: "setDimensionsForAxisCharts", + value: function setDimensionsForAxisCharts() { + var _this2 = this; + var w = this.w; + var gl = w.globals; + var yaxisLabelCoords = this.dimYAxis.getyAxisLabelsCoords(); + var yTitleCoords = this.dimYAxis.getyAxisTitleCoords(); + if (gl.isSlopeChart) { + this.datalabelsCoords = this.dimHelpers.getDatalabelsRect(); + } + w.globals.yLabelsCoords = []; + w.globals.yTitleCoords = []; + w.config.yaxis.map(function (yaxe, index) { + // store the labels and titles coords in global vars + w.globals.yLabelsCoords.push({ + width: yaxisLabelCoords[index].width, + index: index + }); + w.globals.yTitleCoords.push({ + width: yTitleCoords[index].width, + index: index + }); + }); + this.yAxisWidth = this.dimYAxis.getTotalYAxisWidth(); + var xaxisLabelCoords = this.dimXAxis.getxAxisLabelsCoords(); + var xaxisGroupLabelCoords = this.dimXAxis.getxAxisGroupLabelsCoords(); + var xtitleCoords = this.dimXAxis.getxAxisTitleCoords(); + this.conditionalChecksForAxisCoords(xaxisLabelCoords, xtitleCoords, xaxisGroupLabelCoords); + gl.translateXAxisY = w.globals.rotateXLabels ? this.xAxisHeight / 8 : -4; + gl.translateXAxisX = w.globals.rotateXLabels && w.globals.isXNumeric && w.config.xaxis.labels.rotate <= -45 ? -this.xAxisWidth / 4 : 0; + if (w.globals.isBarHorizontal) { + gl.rotateXLabels = false; + gl.translateXAxisY = -1 * (parseInt(w.config.xaxis.labels.style.fontSize, 10) / 1.5); + } + gl.translateXAxisY = gl.translateXAxisY + w.config.xaxis.labels.offsetY; + gl.translateXAxisX = gl.translateXAxisX + w.config.xaxis.labels.offsetX; + var yAxisWidth = this.yAxisWidth; + var xAxisHeight = this.xAxisHeight; + gl.xAxisLabelsHeight = this.xAxisHeight - xtitleCoords.height; + gl.xAxisGroupLabelsHeight = gl.xAxisLabelsHeight - xaxisLabelCoords.height; + gl.xAxisLabelsWidth = this.xAxisWidth; + gl.xAxisHeight = this.xAxisHeight; + var translateY = 10; + if (w.config.chart.type === 'radar' || this.isSparkline) { + yAxisWidth = 0; + xAxisHeight = 0; + } + if (this.isSparkline) { + this.lgRect = { + height: 0, + width: 0 + }; + } + if (this.isSparkline || w.config.chart.type === 'treemap') { + yAxisWidth = 0; + xAxisHeight = 0; + translateY = 0; + } + if (!this.isSparkline && w.config.chart.type !== 'treemap') { + this.dimXAxis.additionalPaddingXLabels(xaxisLabelCoords); + } + var legendTopBottom = function legendTopBottom() { + gl.translateX = yAxisWidth + _this2.datalabelsCoords.width; + gl.gridHeight = gl.svgHeight - _this2.lgRect.height - xAxisHeight - (!_this2.isSparkline && w.config.chart.type !== 'treemap' ? w.globals.rotateXLabels ? 10 : 15 : 0); + gl.gridWidth = gl.svgWidth - yAxisWidth - _this2.datalabelsCoords.width * 2; + }; + if (w.config.xaxis.position === 'top') translateY = gl.xAxisHeight - w.config.xaxis.axisTicks.height - 5; + switch (w.config.legend.position) { + case 'bottom': + gl.translateY = translateY; + legendTopBottom(); + break; + case 'top': + gl.translateY = this.lgRect.height + translateY; + legendTopBottom(); + break; + case 'left': + gl.translateY = translateY; + gl.translateX = this.lgRect.width + yAxisWidth + this.datalabelsCoords.width; + gl.gridHeight = gl.svgHeight - xAxisHeight - 12; + gl.gridWidth = gl.svgWidth - this.lgRect.width - yAxisWidth - this.datalabelsCoords.width * 2; + break; + case 'right': + gl.translateY = translateY; + gl.translateX = yAxisWidth + this.datalabelsCoords.width; + gl.gridHeight = gl.svgHeight - xAxisHeight - 12; + gl.gridWidth = gl.svgWidth - this.lgRect.width - yAxisWidth - this.datalabelsCoords.width * 2 - 5; + break; + default: + throw new Error('Legend position not supported'); + } + this.dimGrid.setGridXPosForDualYAxis(yTitleCoords, yaxisLabelCoords); + + // after drawing everything, set the Y axis positions + var objyAxis = new YAxis(this.ctx); + objyAxis.setYAxisXPosition(yaxisLabelCoords, yTitleCoords); + } + }, { + key: "setDimensionsForNonAxisCharts", + value: function setDimensionsForNonAxisCharts() { + var w = this.w; + var gl = w.globals; + var cnf = w.config; + var xPad = 0; + if (w.config.legend.show && !w.config.legend.floating) { + xPad = 20; + } + var type = cnf.chart.type === 'pie' || cnf.chart.type === 'polarArea' || cnf.chart.type === 'donut' ? 'pie' : 'radialBar'; + var offY = cnf.plotOptions[type].offsetY; + var offX = cnf.plotOptions[type].offsetX; + if (!cnf.legend.show || cnf.legend.floating) { + gl.gridHeight = gl.svgHeight; + var maxWidth = gl.dom.elWrap.getBoundingClientRect().width; + gl.gridWidth = Math.min(maxWidth, gl.gridHeight); + gl.translateY = offY; + gl.translateX = offX + (gl.svgWidth - gl.gridWidth) / 2; + return; + } + switch (cnf.legend.position) { + case 'bottom': + gl.gridHeight = gl.svgHeight - this.lgRect.height; + gl.gridWidth = gl.svgWidth; + gl.translateY = offY - 10; + gl.translateX = offX + (gl.svgWidth - gl.gridWidth) / 2; + break; + case 'top': + gl.gridHeight = gl.svgHeight - this.lgRect.height; + gl.gridWidth = gl.svgWidth; + gl.translateY = this.lgRect.height + offY + 10; + gl.translateX = offX + (gl.svgWidth - gl.gridWidth) / 2; + break; + case 'left': + gl.gridWidth = gl.svgWidth - this.lgRect.width - xPad; + gl.gridHeight = cnf.chart.height !== 'auto' ? gl.svgHeight : gl.gridWidth; + gl.translateY = offY; + gl.translateX = offX + this.lgRect.width + xPad; + break; + case 'right': + gl.gridWidth = gl.svgWidth - this.lgRect.width - xPad - 5; + gl.gridHeight = cnf.chart.height !== 'auto' ? gl.svgHeight : gl.gridWidth; + gl.translateY = offY; + gl.translateX = offX + 10; + break; + default: + throw new Error('Legend position not supported'); + } + } + }, { + key: "conditionalChecksForAxisCoords", + value: function conditionalChecksForAxisCoords(xaxisLabelCoords, xtitleCoords, xaxisGroupLabelCoords) { + var w = this.w; + var xAxisNum = w.globals.hasXaxisGroups ? 2 : 1; + var baseXAxisHeight = xaxisGroupLabelCoords.height + xaxisLabelCoords.height + xtitleCoords.height; + var xAxisHeightMultiplicate = w.globals.isMultiLineX ? 1.2 : w.globals.LINE_HEIGHT_RATIO; + var rotatedXAxisOffset = w.globals.rotateXLabels ? 22 : 10; + var rotatedXAxisLegendOffset = w.globals.rotateXLabels && w.config.legend.position === 'bottom'; + var additionalOffset = rotatedXAxisLegendOffset ? 10 : 0; + this.xAxisHeight = baseXAxisHeight * xAxisHeightMultiplicate + xAxisNum * rotatedXAxisOffset + additionalOffset; + this.xAxisWidth = xaxisLabelCoords.width; + if (this.xAxisHeight - xtitleCoords.height > w.config.xaxis.labels.maxHeight) { + this.xAxisHeight = w.config.xaxis.labels.maxHeight; + } + if (w.config.xaxis.labels.minHeight && this.xAxisHeight < w.config.xaxis.labels.minHeight) { + this.xAxisHeight = w.config.xaxis.labels.minHeight; + } + if (w.config.xaxis.floating) { + this.xAxisHeight = 0; + } + var minYAxisWidth = 0; + var maxYAxisWidth = 0; + w.config.yaxis.forEach(function (y) { + minYAxisWidth += y.labels.minWidth; + maxYAxisWidth += y.labels.maxWidth; + }); + if (this.yAxisWidth < minYAxisWidth) { + this.yAxisWidth = minYAxisWidth; + } + if (this.yAxisWidth > maxYAxisWidth) { + this.yAxisWidth = maxYAxisWidth; + } + } + }]); + return Dimensions; + }(); + + var Helpers$2 = /*#__PURE__*/function () { + function Helpers(lgCtx) { + _classCallCheck(this, Helpers); + this.w = lgCtx.w; + this.lgCtx = lgCtx; + } + _createClass(Helpers, [{ + key: "getLegendStyles", + value: function getLegendStyles() { + var _this$lgCtx$ctx, _this$lgCtx$ctx$opts, _this$lgCtx$ctx$opts$; + var stylesheet = document.createElement('style'); + stylesheet.setAttribute('type', 'text/css'); + var nonce = ((_this$lgCtx$ctx = this.lgCtx.ctx) === null || _this$lgCtx$ctx === void 0 ? void 0 : (_this$lgCtx$ctx$opts = _this$lgCtx$ctx.opts) === null || _this$lgCtx$ctx$opts === void 0 ? void 0 : (_this$lgCtx$ctx$opts$ = _this$lgCtx$ctx$opts.chart) === null || _this$lgCtx$ctx$opts$ === void 0 ? void 0 : _this$lgCtx$ctx$opts$.nonce) || this.w.config.chart.nonce; + if (nonce) { + stylesheet.setAttribute('nonce', nonce); + } + var text = "\n .apexcharts-flip-y {\n transform: scaleY(-1) translateY(-100%);\n transform-origin: top;\n transform-box: fill-box;\n }\n .apexcharts-flip-x {\n transform: scaleX(-1);\n transform-origin: center;\n transform-box: fill-box;\n }\n .apexcharts-legend {\n display: flex;\n overflow: auto;\n padding: 0 10px;\n }\n .apexcharts-legend.apexcharts-legend-group-horizontal {\n flex-direction: column;\n }\n .apexcharts-legend-group {\n display: flex;\n }\n .apexcharts-legend-group-vertical {\n flex-direction: column-reverse;\n }\n .apexcharts-legend.apx-legend-position-bottom, .apexcharts-legend.apx-legend-position-top {\n flex-wrap: wrap\n }\n .apexcharts-legend.apx-legend-position-right, .apexcharts-legend.apx-legend-position-left {\n flex-direction: column;\n bottom: 0;\n }\n .apexcharts-legend.apx-legend-position-bottom.apexcharts-align-left, .apexcharts-legend.apx-legend-position-top.apexcharts-align-left, .apexcharts-legend.apx-legend-position-right, .apexcharts-legend.apx-legend-position-left {\n justify-content: flex-start;\n align-items: flex-start;\n }\n .apexcharts-legend.apx-legend-position-bottom.apexcharts-align-center, .apexcharts-legend.apx-legend-position-top.apexcharts-align-center {\n justify-content: center;\n align-items: center;\n }\n .apexcharts-legend.apx-legend-position-bottom.apexcharts-align-right, .apexcharts-legend.apx-legend-position-top.apexcharts-align-right {\n justify-content: flex-end;\n align-items: flex-end;\n }\n .apexcharts-legend-series {\n cursor: pointer;\n line-height: normal;\n display: flex;\n align-items: center;\n }\n .apexcharts-legend-text {\n position: relative;\n font-size: 14px;\n }\n .apexcharts-legend-text *, .apexcharts-legend-marker * {\n pointer-events: none;\n }\n .apexcharts-legend-marker {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n margin-right: 1px;\n }\n\n .apexcharts-legend-series.apexcharts-no-click {\n cursor: auto;\n }\n .apexcharts-legend .apexcharts-hidden-zero-series, .apexcharts-legend .apexcharts-hidden-null-series {\n display: none !important;\n }\n .apexcharts-inactive-legend {\n opacity: 0.45;\n }\n\n "; + var rules = document.createTextNode(text); + stylesheet.appendChild(rules); + return stylesheet; + } + }, { + key: "getLegendDimensions", + value: function getLegendDimensions() { + var w = this.w; + var currLegendsWrap = w.globals.dom.baseEl.querySelector('.apexcharts-legend'); + var _currLegendsWrap$getB = currLegendsWrap.getBoundingClientRect(), + currLegendsWrapWidth = _currLegendsWrap$getB.width, + currLegendsWrapHeight = _currLegendsWrap$getB.height; + return { + clwh: currLegendsWrapHeight, + clww: currLegendsWrapWidth + }; + } + }, { + key: "appendToForeignObject", + value: function appendToForeignObject() { + var gl = this.w.globals; + gl.dom.elLegendForeign.appendChild(this.getLegendStyles()); + } + }, { + key: "toggleDataSeries", + value: function toggleDataSeries(seriesCnt, isHidden) { + var _this = this; + var w = this.w; + if (w.globals.axisCharts || w.config.chart.type === 'radialBar') { + w.globals.resized = true; // we don't want initial animations again + + var seriesEl = null; + var realIndex = null; + + // yes, make it null. 1 series will rise at a time + w.globals.risingSeries = []; + if (w.globals.axisCharts) { + seriesEl = w.globals.dom.baseEl.querySelector(".apexcharts-series[data\\:realIndex='".concat(seriesCnt, "']")); + realIndex = parseInt(seriesEl.getAttribute('data:realIndex'), 10); + } else { + seriesEl = w.globals.dom.baseEl.querySelector(".apexcharts-series[rel='".concat(seriesCnt + 1, "']")); + realIndex = parseInt(seriesEl.getAttribute('rel'), 10) - 1; + } + if (isHidden) { + var seriesToMakeVisible = [{ + cs: w.globals.collapsedSeries, + csi: w.globals.collapsedSeriesIndices + }, { + cs: w.globals.ancillaryCollapsedSeries, + csi: w.globals.ancillaryCollapsedSeriesIndices + }]; + seriesToMakeVisible.forEach(function (r) { + _this.riseCollapsedSeries(r.cs, r.csi, realIndex); + }); + } else { + this.hideSeries({ + seriesEl: seriesEl, + realIndex: realIndex + }); + } + } else { + // for non-axis charts i.e pie / donuts + var _seriesEl = w.globals.dom.Paper.findOne(" .apexcharts-series[rel='".concat(seriesCnt + 1, "'] path")); + var type = w.config.chart.type; + if (type === 'pie' || type === 'polarArea' || type === 'donut') { + var dataLabels = w.config.plotOptions.pie.donut.labels; + var graphics = new Graphics(this.lgCtx.ctx); + graphics.pathMouseDown(_seriesEl, null); + this.lgCtx.ctx.pie.printDataLabelsInner(_seriesEl.node, dataLabels); + } + _seriesEl.fire('click'); + } + } + }, { + key: "getSeriesAfterCollapsing", + value: function getSeriesAfterCollapsing(_ref) { + var realIndex = _ref.realIndex; + var w = this.w; + var gl = w.globals; + var series = Utils$1.clone(w.config.series); + if (gl.axisCharts) { + var yaxis = w.config.yaxis[gl.seriesYAxisReverseMap[realIndex]]; + var collapseData = { + index: realIndex, + data: series[realIndex].data.slice(), + type: series[realIndex].type || w.config.chart.type + }; + if (yaxis && yaxis.show && yaxis.showAlways) { + if (gl.ancillaryCollapsedSeriesIndices.indexOf(realIndex) < 0) { + gl.ancillaryCollapsedSeries.push(collapseData); + gl.ancillaryCollapsedSeriesIndices.push(realIndex); + } + } else { + if (gl.collapsedSeriesIndices.indexOf(realIndex) < 0) { + gl.collapsedSeries.push(collapseData); + gl.collapsedSeriesIndices.push(realIndex); + var removeIndexOfRising = gl.risingSeries.indexOf(realIndex); + gl.risingSeries.splice(removeIndexOfRising, 1); + } + } + } else { + gl.collapsedSeries.push({ + index: realIndex, + data: series[realIndex] + }); + gl.collapsedSeriesIndices.push(realIndex); + } + gl.allSeriesCollapsed = gl.collapsedSeries.length + gl.ancillaryCollapsedSeries.length === w.config.series.length; + return this._getSeriesBasedOnCollapsedState(series); + } + }, { + key: "hideSeries", + value: function hideSeries(_ref2) { + var seriesEl = _ref2.seriesEl, + realIndex = _ref2.realIndex; + var w = this.w; + var series = this.getSeriesAfterCollapsing({ + realIndex: realIndex + }); + var seriesChildren = seriesEl.childNodes; + for (var sc = 0; sc < seriesChildren.length; sc++) { + if (seriesChildren[sc].classList.contains('apexcharts-series-markers-wrap')) { + if (seriesChildren[sc].classList.contains('apexcharts-hide')) { + seriesChildren[sc].classList.remove('apexcharts-hide'); + } else { + seriesChildren[sc].classList.add('apexcharts-hide'); + } + } + } + this.lgCtx.ctx.updateHelpers._updateSeries(series, w.config.chart.animations.dynamicAnimation.enabled); + } + }, { + key: "riseCollapsedSeries", + value: function riseCollapsedSeries(collapsedSeries, seriesIndices, realIndex) { + var w = this.w; + var series = Utils$1.clone(w.config.series); + if (collapsedSeries.length > 0) { + for (var c = 0; c < collapsedSeries.length; c++) { + if (collapsedSeries[c].index === realIndex) { + if (w.globals.axisCharts) { + series[realIndex].data = collapsedSeries[c].data.slice(); + } else { + series[realIndex] = collapsedSeries[c].data; + } + if (typeof series[realIndex] !== 'number') { + series[realIndex].hidden = false; + } + collapsedSeries.splice(c, 1); + seriesIndices.splice(c, 1); + w.globals.risingSeries.push(realIndex); + } + } + series = this._getSeriesBasedOnCollapsedState(series); + this.lgCtx.ctx.updateHelpers._updateSeries(series, w.config.chart.animations.dynamicAnimation.enabled); + } + } + }, { + key: "_getSeriesBasedOnCollapsedState", + value: function _getSeriesBasedOnCollapsedState(series) { + var w = this.w; + var collapsed = 0; + if (w.globals.axisCharts) { + series.forEach(function (s, sI) { + if (!(w.globals.collapsedSeriesIndices.indexOf(sI) < 0 && w.globals.ancillaryCollapsedSeriesIndices.indexOf(sI) < 0)) { + series[sI].data = []; + collapsed++; + } + }); + } else { + series.forEach(function (s, sI) { + if (!w.globals.collapsedSeriesIndices.indexOf(sI) < 0) { + series[sI] = 0; + collapsed++; + } + }); + } + w.globals.allSeriesCollapsed = collapsed === series.length; + return series; + } + }]); + return Helpers; + }(); + + /** + * ApexCharts Legend Class to draw legend. + * + * @module Legend + **/ + var Legend = /*#__PURE__*/function () { + function Legend(ctx) { + _classCallCheck(this, Legend); + this.ctx = ctx; + this.w = ctx.w; + this.onLegendClick = this.onLegendClick.bind(this); + this.onLegendHovered = this.onLegendHovered.bind(this); + this.isBarsDistributed = this.w.config.chart.type === 'bar' && this.w.config.plotOptions.bar.distributed && this.w.config.series.length === 1; + this.legendHelpers = new Helpers$2(this); + } + _createClass(Legend, [{ + key: "init", + value: function init() { + var w = this.w; + var gl = w.globals; + var cnf = w.config; + var showLegendAlways = cnf.legend.showForSingleSeries && gl.series.length === 1 || this.isBarsDistributed || gl.series.length > 1; + this.legendHelpers.appendToForeignObject(); + if ((showLegendAlways || !gl.axisCharts) && cnf.legend.show) { + while (gl.dom.elLegendWrap.firstChild) { + gl.dom.elLegendWrap.removeChild(gl.dom.elLegendWrap.firstChild); + } + this.drawLegends(); + if (cnf.legend.position === 'bottom' || cnf.legend.position === 'top') { + this.legendAlignHorizontal(); + } else if (cnf.legend.position === 'right' || cnf.legend.position === 'left') { + this.legendAlignVertical(); + } + } + } + }, { + key: "createLegendMarker", + value: function createLegendMarker(_ref) { + var i = _ref.i, + fillcolor = _ref.fillcolor; + var w = this.w; + var elMarker = document.createElement('span'); + elMarker.classList.add('apexcharts-legend-marker'); + var mShape = w.config.legend.markers.shape || w.config.markers.shape; + var shape = mShape; + if (Array.isArray(mShape)) { + shape = mShape[i]; + } + var mSize = Array.isArray(w.config.legend.markers.size) ? parseFloat(w.config.legend.markers.size[i]) : parseFloat(w.config.legend.markers.size); + var mOffsetX = Array.isArray(w.config.legend.markers.offsetX) ? parseFloat(w.config.legend.markers.offsetX[i]) : parseFloat(w.config.legend.markers.offsetX); + var mOffsetY = Array.isArray(w.config.legend.markers.offsetY) ? parseFloat(w.config.legend.markers.offsetY[i]) : parseFloat(w.config.legend.markers.offsetY); + var mBorderWidth = Array.isArray(w.config.legend.markers.strokeWidth) ? parseFloat(w.config.legend.markers.strokeWidth[i]) : parseFloat(w.config.legend.markers.strokeWidth); + var mStyle = elMarker.style; + mStyle.height = (mSize + mBorderWidth) * 2 + 'px'; + mStyle.width = (mSize + mBorderWidth) * 2 + 'px'; + mStyle.left = mOffsetX + 'px'; + mStyle.top = mOffsetY + 'px'; + if (w.config.legend.markers.customHTML) { + mStyle.background = 'transparent'; + mStyle.color = fillcolor[i]; + if (Array.isArray(w.config.legend.markers.customHTML)) { + if (w.config.legend.markers.customHTML[i]) { + elMarker.innerHTML = w.config.legend.markers.customHTML[i](); + } + } else { + elMarker.innerHTML = w.config.legend.markers.customHTML(); + } + } else { + var markers = new Markers(this.ctx); + var markerConfig = markers.getMarkerConfig({ + cssClass: "apexcharts-legend-marker apexcharts-marker apexcharts-marker-".concat(shape), + seriesIndex: i, + strokeWidth: mBorderWidth, + size: mSize + }); + var SVGMarker = window.SVG().addTo(elMarker).size('100%', '100%'); + var marker = new Graphics(this.ctx).drawMarker(0, 0, _objectSpread2(_objectSpread2({}, markerConfig), {}, { + pointFillColor: Array.isArray(fillcolor) ? fillcolor[i] : markerConfig.pointFillColor, + shape: shape + })); + var shapesEls = w.globals.dom.Paper.find('.apexcharts-legend-marker.apexcharts-marker'); + shapesEls.forEach(function (shapeEl) { + if (shapeEl.node.classList.contains('apexcharts-marker-triangle')) { + shapeEl.node.style.transform = 'translate(50%, 45%)'; + } else { + shapeEl.node.style.transform = 'translate(50%, 50%)'; + } + }); + SVGMarker.add(marker); + } + return elMarker; + } + }, { + key: "drawLegends", + value: function drawLegends() { + var _this = this; + var me = this; + var w = this.w; + var fontFamily = w.config.legend.fontFamily; + var legendNames = w.globals.seriesNames; + var fillcolor = w.config.legend.markers.fillColors ? w.config.legend.markers.fillColors.slice() : w.globals.colors.slice(); + if (w.config.chart.type === 'heatmap') { + var ranges = w.config.plotOptions.heatmap.colorScale.ranges; + legendNames = ranges.map(function (colorScale) { + return colorScale.name ? colorScale.name : colorScale.from + ' - ' + colorScale.to; + }); + fillcolor = ranges.map(function (color) { + return color.color; + }); + } else if (this.isBarsDistributed) { + legendNames = w.globals.labels.slice(); + } + if (w.config.legend.customLegendItems.length) { + legendNames = w.config.legend.customLegendItems; + } + var legendFormatter = w.globals.legendFormatter; + var isLegendInversed = w.config.legend.inverseOrder; + var legendGroups = []; + if (w.globals.seriesGroups.length > 1 && w.config.legend.clusterGroupedSeries) { + w.globals.seriesGroups.forEach(function (_, gi) { + legendGroups[gi] = document.createElement('div'); + legendGroups[gi].classList.add('apexcharts-legend-group', "apexcharts-legend-group-".concat(gi)); + if (w.config.legend.clusterGroupedSeriesOrientation === 'horizontal') { + w.globals.dom.elLegendWrap.classList.add('apexcharts-legend-group-horizontal'); + } else { + legendGroups[gi].classList.add('apexcharts-legend-group-vertical'); + } + }); + } + var _loop = function _loop(i) { + var _w$config$legend$labe; + var text = legendFormatter(legendNames[i], { + seriesIndex: i, + w: w + }); + var collapsedSeries = false; + var ancillaryCollapsedSeries = false; + if (w.globals.collapsedSeries.length > 0) { + for (var c = 0; c < w.globals.collapsedSeries.length; c++) { + if (w.globals.collapsedSeries[c].index === i) { + collapsedSeries = true; + } + } + } + if (w.globals.ancillaryCollapsedSeriesIndices.length > 0) { + for (var _c = 0; _c < w.globals.ancillaryCollapsedSeriesIndices.length; _c++) { + if (w.globals.ancillaryCollapsedSeriesIndices[_c] === i) { + ancillaryCollapsedSeries = true; + } + } + } + var elMarker = _this.createLegendMarker({ + i: i, + fillcolor: fillcolor + }); + Graphics.setAttrs(elMarker, { + rel: i + 1, + 'data:collapsed': collapsedSeries || ancillaryCollapsedSeries + }); + if (collapsedSeries || ancillaryCollapsedSeries) { + elMarker.classList.add('apexcharts-inactive-legend'); + } + var elLegend = document.createElement('div'); + var elLegendText = document.createElement('span'); + elLegendText.classList.add('apexcharts-legend-text'); + elLegendText.innerHTML = Array.isArray(text) ? text.join(' ') : text; + var textColor = w.config.legend.labels.useSeriesColors ? w.globals.colors[i] : Array.isArray(w.config.legend.labels.colors) ? (_w$config$legend$labe = w.config.legend.labels.colors) === null || _w$config$legend$labe === void 0 ? void 0 : _w$config$legend$labe[i] : w.config.legend.labels.colors; + if (!textColor) { + textColor = w.config.chart.foreColor; + } + elLegendText.style.color = textColor; + elLegendText.style.fontSize = parseFloat(w.config.legend.fontSize) + 'px'; + elLegendText.style.fontWeight = w.config.legend.fontWeight; + elLegendText.style.fontFamily = fontFamily || w.config.chart.fontFamily; + Graphics.setAttrs(elLegendText, { + rel: i + 1, + i: i, + 'data:default-text': encodeURIComponent(text), + 'data:collapsed': collapsedSeries || ancillaryCollapsedSeries + }); + elLegend.appendChild(elMarker); + elLegend.appendChild(elLegendText); + var coreUtils = new CoreUtils(_this.ctx); + if (!w.config.legend.showForZeroSeries) { + var total = coreUtils.getSeriesTotalByIndex(i); + if (total === 0 && coreUtils.seriesHaveSameValues(i) && !coreUtils.isSeriesNull(i) && w.globals.collapsedSeriesIndices.indexOf(i) === -1 && w.globals.ancillaryCollapsedSeriesIndices.indexOf(i) === -1) { + elLegend.classList.add('apexcharts-hidden-zero-series'); + } + } + if (!w.config.legend.showForNullSeries) { + if (coreUtils.isSeriesNull(i) && w.globals.collapsedSeriesIndices.indexOf(i) === -1 && w.globals.ancillaryCollapsedSeriesIndices.indexOf(i) === -1) { + elLegend.classList.add('apexcharts-hidden-null-series'); + } + } + if (legendGroups.length) { + w.globals.seriesGroups.forEach(function (group, gi) { + var _w$config$series$i; + if (group.includes((_w$config$series$i = w.config.series[i]) === null || _w$config$series$i === void 0 ? void 0 : _w$config$series$i.name)) { + w.globals.dom.elLegendWrap.appendChild(legendGroups[gi]); + legendGroups[gi].appendChild(elLegend); + } + }); + } else { + w.globals.dom.elLegendWrap.appendChild(elLegend); + } + w.globals.dom.elLegendWrap.classList.add("apexcharts-align-".concat(w.config.legend.horizontalAlign)); + w.globals.dom.elLegendWrap.classList.add('apx-legend-position-' + w.config.legend.position); + elLegend.classList.add('apexcharts-legend-series'); + elLegend.style.margin = "".concat(w.config.legend.itemMargin.vertical, "px ").concat(w.config.legend.itemMargin.horizontal, "px"); + w.globals.dom.elLegendWrap.style.width = w.config.legend.width ? w.config.legend.width + 'px' : ''; + w.globals.dom.elLegendWrap.style.height = w.config.legend.height ? w.config.legend.height + 'px' : ''; + Graphics.setAttrs(elLegend, { + rel: i + 1, + seriesName: Utils$1.escapeString(legendNames[i]), + 'data:collapsed': collapsedSeries || ancillaryCollapsedSeries + }); + if (collapsedSeries || ancillaryCollapsedSeries) { + elLegend.classList.add('apexcharts-inactive-legend'); + } + if (!w.config.legend.onItemClick.toggleDataSeries) { + elLegend.classList.add('apexcharts-no-click'); + } + }; + for (var i = isLegendInversed ? legendNames.length - 1 : 0; isLegendInversed ? i >= 0 : i <= legendNames.length - 1; isLegendInversed ? i-- : i++) { + _loop(i); + } + w.globals.dom.elWrap.addEventListener('click', me.onLegendClick, true); + if (w.config.legend.onItemHover.highlightDataSeries && w.config.legend.customLegendItems.length === 0) { + w.globals.dom.elWrap.addEventListener('mousemove', me.onLegendHovered, true); + w.globals.dom.elWrap.addEventListener('mouseout', me.onLegendHovered, true); + } + } + }, { + key: "setLegendWrapXY", + value: function setLegendWrapXY(offsetX, offsetY) { + var w = this.w; + var elLegendWrap = w.globals.dom.elLegendWrap; + var legendHeight = elLegendWrap.clientHeight; + var x = 0; + var y = 0; + if (w.config.legend.position === 'bottom') { + y = w.globals.svgHeight - Math.min(legendHeight, w.globals.svgHeight / 2) - 5; + } else if (w.config.legend.position === 'top') { + var dim = new Dimensions(this.ctx); + var titleH = dim.dimHelpers.getTitleSubtitleCoords('title').height; + var subtitleH = dim.dimHelpers.getTitleSubtitleCoords('subtitle').height; + y = (titleH > 0 ? titleH - 10 : 0) + (subtitleH > 0 ? subtitleH - 10 : 0); + } + elLegendWrap.style.position = 'absolute'; + x = x + offsetX + w.config.legend.offsetX; + y = y + offsetY + w.config.legend.offsetY; + elLegendWrap.style.left = x + 'px'; + elLegendWrap.style.top = y + 'px'; + if (w.config.legend.position === 'right') { + elLegendWrap.style.left = 'auto'; + elLegendWrap.style.right = 25 + w.config.legend.offsetX + 'px'; + } + var fixedHeigthWidth = ['width', 'height']; + fixedHeigthWidth.forEach(function (hw) { + if (elLegendWrap.style[hw]) { + elLegendWrap.style[hw] = parseInt(w.config.legend[hw], 10) + 'px'; + } + }); + } + }, { + key: "legendAlignHorizontal", + value: function legendAlignHorizontal() { + var w = this.w; + var elLegendWrap = w.globals.dom.elLegendWrap; + elLegendWrap.style.right = 0; + var dimensions = new Dimensions(this.ctx); + var titleRect = dimensions.dimHelpers.getTitleSubtitleCoords('title'); + var subtitleRect = dimensions.dimHelpers.getTitleSubtitleCoords('subtitle'); + var offsetX = 20; + var offsetY = 0; + if (w.config.legend.position === 'top') { + offsetY = titleRect.height + subtitleRect.height + w.config.title.margin + w.config.subtitle.margin - 10; + } + this.setLegendWrapXY(offsetX, offsetY); + } + }, { + key: "legendAlignVertical", + value: function legendAlignVertical() { + var w = this.w; + var lRect = this.legendHelpers.getLegendDimensions(); + var offsetY = 20; + var offsetX = 0; + if (w.config.legend.position === 'left') { + offsetX = 20; + } + if (w.config.legend.position === 'right') { + offsetX = w.globals.svgWidth - lRect.clww - 10; + } + this.setLegendWrapXY(offsetX, offsetY); + } + }, { + key: "onLegendHovered", + value: function onLegendHovered(e) { + var w = this.w; + var hoverOverLegend = e.target.classList.contains('apexcharts-legend-series') || e.target.classList.contains('apexcharts-legend-text') || e.target.classList.contains('apexcharts-legend-marker'); + if (w.config.chart.type !== 'heatmap' && !this.isBarsDistributed) { + if (!e.target.classList.contains('apexcharts-inactive-legend') && hoverOverLegend) { + var series = new Series(this.ctx); + series.toggleSeriesOnHover(e, e.target); + } + } else { + // for heatmap handling + if (hoverOverLegend) { + var seriesCnt = parseInt(e.target.getAttribute('rel'), 10) - 1; + this.ctx.events.fireEvent('legendHover', [this.ctx, seriesCnt, this.w]); + var _series = new Series(this.ctx); + _series.highlightRangeInSeries(e, e.target); + } + } + } + }, { + key: "onLegendClick", + value: function onLegendClick(e) { + var w = this.w; + if (w.config.legend.customLegendItems.length) return; + if (e.target.classList.contains('apexcharts-legend-series') || e.target.classList.contains('apexcharts-legend-text') || e.target.classList.contains('apexcharts-legend-marker')) { + var seriesCnt = parseInt(e.target.getAttribute('rel'), 10) - 1; + var isHidden = e.target.getAttribute('data:collapsed') === 'true'; + var legendClick = this.w.config.chart.events.legendClick; + if (typeof legendClick === 'function') { + legendClick(this.ctx, seriesCnt, this.w); + } + this.ctx.events.fireEvent('legendClick', [this.ctx, seriesCnt, this.w]); + var markerClick = this.w.config.legend.markers.onClick; + if (typeof markerClick === 'function' && e.target.classList.contains('apexcharts-legend-marker')) { + markerClick(this.ctx, seriesCnt, this.w); + this.ctx.events.fireEvent('legendMarkerClick', [this.ctx, seriesCnt, this.w]); + } + + // for now - just prevent click on heatmap legend - and allow hover only + var clickAllowed = w.config.chart.type !== 'treemap' && w.config.chart.type !== 'heatmap' && !this.isBarsDistributed; + if (clickAllowed && w.config.legend.onItemClick.toggleDataSeries) { + this.legendHelpers.toggleDataSeries(seriesCnt, isHidden); + } + } + } + }]); + return Legend; + }(); + + var icoPan = "\n \n \n \n \n \n \n \n"; + + var icoZoom = "\n \n \n \n"; + + var icoReset = "\n \n \n"; + + var icoZoomIn = "\n \n \n\n"; + + var icoZoomOut = "\n \n \n\n"; + + var icoSelect = "\n \n \n"; + + var icoMenu = ""; + + /** + * ApexCharts Toolbar Class for creating toolbar in axis based charts. + * + * @module Toolbar + **/ + var Toolbar = /*#__PURE__*/function () { + function Toolbar(ctx) { + _classCallCheck(this, Toolbar); + this.ctx = ctx; + this.w = ctx.w; + var w = this.w; + this.ev = this.w.config.chart.events; + this.selectedClass = 'apexcharts-selected'; + this.localeValues = this.w.globals.locale.toolbar; + this.minX = w.globals.minX; + this.maxX = w.globals.maxX; + } + _createClass(Toolbar, [{ + key: "createToolbar", + value: function createToolbar() { + var _this = this; + var w = this.w; + var createDiv = function createDiv() { + return document.createElement('div'); + }; + var elToolbarWrap = createDiv(); + elToolbarWrap.setAttribute('class', 'apexcharts-toolbar'); + elToolbarWrap.style.top = w.config.chart.toolbar.offsetY + 'px'; + elToolbarWrap.style.right = -w.config.chart.toolbar.offsetX + 3 + 'px'; + w.globals.dom.elWrap.appendChild(elToolbarWrap); + this.elZoom = createDiv(); + this.elZoomIn = createDiv(); + this.elZoomOut = createDiv(); + this.elPan = createDiv(); + this.elSelection = createDiv(); + this.elZoomReset = createDiv(); + this.elMenuIcon = createDiv(); + this.elMenu = createDiv(); + this.elCustomIcons = []; + this.t = w.config.chart.toolbar.tools; + if (Array.isArray(this.t.customIcons)) { + for (var i = 0; i < this.t.customIcons.length; i++) { + this.elCustomIcons.push(createDiv()); + } + } + var toolbarControls = []; + var appendZoomControl = function appendZoomControl(type, el, ico) { + var tool = type.toLowerCase(); + if (_this.t[tool] && w.config.chart.zoom.enabled) { + toolbarControls.push({ + el: el, + icon: typeof _this.t[tool] === 'string' ? _this.t[tool] : ico, + title: _this.localeValues[type], + class: "apexcharts-".concat(tool, "-icon") + }); + } + }; + appendZoomControl('zoomIn', this.elZoomIn, icoZoomIn); + appendZoomControl('zoomOut', this.elZoomOut, icoZoomOut); + var zoomSelectionCtrls = function zoomSelectionCtrls(z) { + if (_this.t[z] && w.config.chart[z].enabled) { + toolbarControls.push({ + el: z === 'zoom' ? _this.elZoom : _this.elSelection, + icon: typeof _this.t[z] === 'string' ? _this.t[z] : z === 'zoom' ? icoZoom : icoSelect, + title: _this.localeValues[z === 'zoom' ? 'selectionZoom' : 'selection'], + class: w.globals.isTouchDevice ? 'apexcharts-element-hidden' : "apexcharts-".concat(z, "-icon") + }); + } + }; + zoomSelectionCtrls('zoom'); + zoomSelectionCtrls('selection'); + if (this.t.pan && w.config.chart.zoom.enabled) { + toolbarControls.push({ + el: this.elPan, + icon: typeof this.t.pan === 'string' ? this.t.pan : icoPan, + title: this.localeValues.pan, + class: w.globals.isTouchDevice ? 'apexcharts-element-hidden' : 'apexcharts-pan-icon' + }); + } + appendZoomControl('reset', this.elZoomReset, icoReset); + if (this.t.download) { + toolbarControls.push({ + el: this.elMenuIcon, + icon: typeof this.t.download === 'string' ? this.t.download : icoMenu, + title: this.localeValues.menu, + class: 'apexcharts-menu-icon' + }); + } + for (var _i = 0; _i < this.elCustomIcons.length; _i++) { + toolbarControls.push({ + el: this.elCustomIcons[_i], + icon: this.t.customIcons[_i].icon, + title: this.t.customIcons[_i].title, + index: this.t.customIcons[_i].index, + class: 'apexcharts-toolbar-custom-icon ' + this.t.customIcons[_i].class + }); + } + toolbarControls.forEach(function (t, index) { + if (t.index) { + Utils$1.moveIndexInArray(toolbarControls, index, t.index); + } + }); + for (var _i2 = 0; _i2 < toolbarControls.length; _i2++) { + Graphics.setAttrs(toolbarControls[_i2].el, { + class: toolbarControls[_i2].class, + title: toolbarControls[_i2].title + }); + toolbarControls[_i2].el.innerHTML = toolbarControls[_i2].icon; + elToolbarWrap.appendChild(toolbarControls[_i2].el); + } + this._createHamburgerMenu(elToolbarWrap); + if (w.globals.zoomEnabled) { + this.elZoom.classList.add(this.selectedClass); + } else if (w.globals.panEnabled) { + this.elPan.classList.add(this.selectedClass); + } else if (w.globals.selectionEnabled) { + this.elSelection.classList.add(this.selectedClass); + } + this.addToolbarEventListeners(); + } + }, { + key: "_createHamburgerMenu", + value: function _createHamburgerMenu(parent) { + this.elMenuItems = []; + parent.appendChild(this.elMenu); + Graphics.setAttrs(this.elMenu, { + class: 'apexcharts-menu' + }); + var menuItems = [{ + name: 'exportSVG', + title: this.localeValues.exportToSVG + }, { + name: 'exportPNG', + title: this.localeValues.exportToPNG + }, { + name: 'exportCSV', + title: this.localeValues.exportToCSV + }]; + for (var i = 0; i < menuItems.length; i++) { + this.elMenuItems.push(document.createElement('div')); + this.elMenuItems[i].innerHTML = menuItems[i].title; + Graphics.setAttrs(this.elMenuItems[i], { + class: "apexcharts-menu-item ".concat(menuItems[i].name), + title: menuItems[i].title + }); + this.elMenu.appendChild(this.elMenuItems[i]); + } + } + }, { + key: "addToolbarEventListeners", + value: function addToolbarEventListeners() { + var _this2 = this; + this.elZoomReset.addEventListener('click', this.handleZoomReset.bind(this)); + this.elSelection.addEventListener('click', this.toggleZoomSelection.bind(this, 'selection')); + this.elZoom.addEventListener('click', this.toggleZoomSelection.bind(this, 'zoom')); + this.elZoomIn.addEventListener('click', this.handleZoomIn.bind(this)); + this.elZoomOut.addEventListener('click', this.handleZoomOut.bind(this)); + this.elPan.addEventListener('click', this.togglePanning.bind(this)); + this.elMenuIcon.addEventListener('click', this.toggleMenu.bind(this)); + this.elMenuItems.forEach(function (m) { + if (m.classList.contains('exportSVG')) { + m.addEventListener('click', _this2.handleDownload.bind(_this2, 'svg')); + } else if (m.classList.contains('exportPNG')) { + m.addEventListener('click', _this2.handleDownload.bind(_this2, 'png')); + } else if (m.classList.contains('exportCSV')) { + m.addEventListener('click', _this2.handleDownload.bind(_this2, 'csv')); + } + }); + for (var i = 0; i < this.t.customIcons.length; i++) { + this.elCustomIcons[i].addEventListener('click', this.t.customIcons[i].click.bind(this, this.ctx, this.ctx.w)); + } + } + }, { + key: "toggleZoomSelection", + value: function toggleZoomSelection(type) { + var charts = this.ctx.getSyncedCharts(); + charts.forEach(function (ch) { + ch.ctx.toolbar.toggleOtherControls(); + var el = type === 'selection' ? ch.ctx.toolbar.elSelection : ch.ctx.toolbar.elZoom; + var enabledType = type === 'selection' ? 'selectionEnabled' : 'zoomEnabled'; + ch.w.globals[enabledType] = !ch.w.globals[enabledType]; + if (!el.classList.contains(ch.ctx.toolbar.selectedClass)) { + el.classList.add(ch.ctx.toolbar.selectedClass); + } else { + el.classList.remove(ch.ctx.toolbar.selectedClass); + } + }); + } + }, { + key: "getToolbarIconsReference", + value: function getToolbarIconsReference() { + var w = this.w; + if (!this.elZoom) { + this.elZoom = w.globals.dom.baseEl.querySelector('.apexcharts-zoom-icon'); + } + if (!this.elPan) { + this.elPan = w.globals.dom.baseEl.querySelector('.apexcharts-pan-icon'); + } + if (!this.elSelection) { + this.elSelection = w.globals.dom.baseEl.querySelector('.apexcharts-selection-icon'); + } + } + }, { + key: "enableZoomPanFromToolbar", + value: function enableZoomPanFromToolbar(type) { + this.toggleOtherControls(); + type === 'pan' ? this.w.globals.panEnabled = true : this.w.globals.zoomEnabled = true; + var el = type === 'pan' ? this.elPan : this.elZoom; + var el2 = type === 'pan' ? this.elZoom : this.elPan; + if (el) { + el.classList.add(this.selectedClass); + } + if (el2) { + el2.classList.remove(this.selectedClass); + } + } + }, { + key: "togglePanning", + value: function togglePanning() { + var charts = this.ctx.getSyncedCharts(); + charts.forEach(function (ch) { + ch.ctx.toolbar.toggleOtherControls(); + ch.w.globals.panEnabled = !ch.w.globals.panEnabled; + if (!ch.ctx.toolbar.elPan.classList.contains(ch.ctx.toolbar.selectedClass)) { + ch.ctx.toolbar.elPan.classList.add(ch.ctx.toolbar.selectedClass); + } else { + ch.ctx.toolbar.elPan.classList.remove(ch.ctx.toolbar.selectedClass); + } + }); + } + }, { + key: "toggleOtherControls", + value: function toggleOtherControls() { + var _this3 = this; + var w = this.w; + w.globals.panEnabled = false; + w.globals.zoomEnabled = false; + w.globals.selectionEnabled = false; + this.getToolbarIconsReference(); + var toggleEls = [this.elPan, this.elSelection, this.elZoom]; + toggleEls.forEach(function (el) { + if (el) { + el.classList.remove(_this3.selectedClass); + } + }); + } + }, { + key: "handleZoomIn", + value: function handleZoomIn() { + var w = this.w; + if (w.globals.isRangeBar) { + this.minX = w.globals.minY; + this.maxX = w.globals.maxY; + } + var centerX = (this.minX + this.maxX) / 2; + var newMinX = (this.minX + centerX) / 2; + var newMaxX = (this.maxX + centerX) / 2; + var newMinXMaxX = this._getNewMinXMaxX(newMinX, newMaxX); + if (!w.globals.disableZoomIn) { + this.zoomUpdateOptions(newMinXMaxX.minX, newMinXMaxX.maxX); + } + } + }, { + key: "handleZoomOut", + value: function handleZoomOut() { + var w = this.w; + if (w.globals.isRangeBar) { + this.minX = w.globals.minY; + this.maxX = w.globals.maxY; + } + + // avoid zooming out beyond 1000 which may result in NaN values being printed on x-axis + if (w.config.xaxis.type === 'datetime' && new Date(this.minX).getUTCFullYear() < 1000) { + return; + } + var centerX = (this.minX + this.maxX) / 2; + var newMinX = this.minX - (centerX - this.minX); + var newMaxX = this.maxX - (centerX - this.maxX); + var newMinXMaxX = this._getNewMinXMaxX(newMinX, newMaxX); + if (!w.globals.disableZoomOut) { + this.zoomUpdateOptions(newMinXMaxX.minX, newMinXMaxX.maxX); + } + } + }, { + key: "_getNewMinXMaxX", + value: function _getNewMinXMaxX(newMinX, newMaxX) { + var shouldFloor = this.w.config.xaxis.convertedCatToNumeric; + return { + minX: shouldFloor ? Math.floor(newMinX) : newMinX, + maxX: shouldFloor ? Math.floor(newMaxX) : newMaxX + }; + } + }, { + key: "zoomUpdateOptions", + value: function zoomUpdateOptions(newMinX, newMaxX) { + var w = this.w; + if (newMinX === undefined && newMaxX === undefined) { + this.handleZoomReset(); + return; + } + if (w.config.xaxis.convertedCatToNumeric) { + // in category charts, avoid zooming out beyond min and max + if (newMinX < 1) { + newMinX = 1; + newMaxX = w.globals.dataPoints; + } + if (newMaxX - newMinX < 2) { + return; + } + } + var xaxis = { + min: newMinX, + max: newMaxX + }; + var beforeZoomRange = this.getBeforeZoomRange(xaxis); + if (beforeZoomRange) { + xaxis = beforeZoomRange.xaxis; + } + var options = { + xaxis: xaxis + }; + var yaxis = Utils$1.clone(w.globals.initialConfig.yaxis); + if (!w.config.chart.group) { + // if chart in a group, prevent yaxis update here + // fix issue #650 + options.yaxis = yaxis; + } + this.w.globals.zoomed = true; + this.ctx.updateHelpers._updateOptions(options, false, this.w.config.chart.animations.dynamicAnimation.enabled); + this.zoomCallback(xaxis, yaxis); + } + }, { + key: "zoomCallback", + value: function zoomCallback(xaxis, yaxis) { + if (typeof this.ev.zoomed === 'function') { + this.ev.zoomed(this.ctx, { + xaxis: xaxis, + yaxis: yaxis + }); + } + } + }, { + key: "getBeforeZoomRange", + value: function getBeforeZoomRange(xaxis, yaxis) { + var newRange = null; + if (typeof this.ev.beforeZoom === 'function') { + newRange = this.ev.beforeZoom(this, { + xaxis: xaxis, + yaxis: yaxis + }); + } + return newRange; + } + }, { + key: "toggleMenu", + value: function toggleMenu() { + var _this4 = this; + window.setTimeout(function () { + if (_this4.elMenu.classList.contains('apexcharts-menu-open')) { + _this4.elMenu.classList.remove('apexcharts-menu-open'); + } else { + _this4.elMenu.classList.add('apexcharts-menu-open'); + } + }, 0); + } + }, { + key: "handleDownload", + value: function handleDownload(type) { + var w = this.w; + var exprt = new Exports(this.ctx); + switch (type) { + case 'svg': + exprt.exportToSVG(this.ctx); + break; + case 'png': + exprt.exportToPng(this.ctx); + break; + case 'csv': + exprt.exportToCSV({ + series: w.config.series, + columnDelimiter: w.config.chart.toolbar.export.csv.columnDelimiter + }); + break; + } + } + }, { + key: "handleZoomReset", + value: function handleZoomReset(e) { + var charts = this.ctx.getSyncedCharts(); + charts.forEach(function (ch) { + var w = ch.w; + + // forget lastXAxis min/max as reset button isn't resetting the x-axis completely if zoomX is called before + w.globals.lastXAxis.min = w.globals.initialConfig.xaxis.min; + w.globals.lastXAxis.max = w.globals.initialConfig.xaxis.max; + ch.updateHelpers.revertDefaultAxisMinMax(); + if (typeof w.config.chart.events.beforeResetZoom === 'function') { + // here, user get an option to control xaxis and yaxis when resetZoom is called + // at this point, whatever is returned from w.config.chart.events.beforeResetZoom + // is set as the new xaxis/yaxis min/max + var resetZoomRange = w.config.chart.events.beforeResetZoom(ch, w); + if (resetZoomRange) { + ch.updateHelpers.revertDefaultAxisMinMax(resetZoomRange); + } + } + if (typeof w.config.chart.events.zoomed === 'function') { + ch.ctx.toolbar.zoomCallback({ + min: w.config.xaxis.min, + max: w.config.xaxis.max + }); + } + w.globals.zoomed = false; + + // if user has some series collapsed before hitting zoom reset button, + // those series should stay collapsed + var series = ch.ctx.series.emptyCollapsedSeries(Utils$1.clone(w.globals.initialSeries)); + ch.updateHelpers._updateSeries(series, w.config.chart.animations.dynamicAnimation.enabled); + }); + } + }, { + key: "destroy", + value: function destroy() { + this.elZoom = null; + this.elZoomIn = null; + this.elZoomOut = null; + this.elPan = null; + this.elSelection = null; + this.elZoomReset = null; + this.elMenuIcon = null; + } + }]); + return Toolbar; + }(); + + /** + * ApexCharts Zoom Class for handling zooming and panning on axes based charts. + * + * @module ZoomPanSelection + **/ + var ZoomPanSelection = /*#__PURE__*/function (_Toolbar) { + _inherits(ZoomPanSelection, _Toolbar); + var _super = _createSuper(ZoomPanSelection); + function ZoomPanSelection(ctx) { + var _this; + _classCallCheck(this, ZoomPanSelection); + _this = _super.call(this, ctx); + _this.ctx = ctx; + _this.w = ctx.w; + _this.dragged = false; + _this.graphics = new Graphics(_this.ctx); + _this.eventList = ['mousedown', 'mouseleave', 'mousemove', 'touchstart', 'touchmove', 'mouseup', 'touchend', 'wheel']; + _this.clientX = 0; + _this.clientY = 0; + _this.startX = 0; + _this.endX = 0; + _this.dragX = 0; + _this.startY = 0; + _this.endY = 0; + _this.dragY = 0; + _this.moveDirection = 'none'; + _this.debounceTimer = null; + _this.debounceDelay = 100; + _this.wheelDelay = 400; + return _this; + } + _createClass(ZoomPanSelection, [{ + key: "init", + value: function init(_ref) { + var _this2 = this; + var xyRatios = _ref.xyRatios; + var w = this.w; + var me = this; + this.xyRatios = xyRatios; + this.zoomRect = this.graphics.drawRect(0, 0, 0, 0); + this.selectionRect = this.graphics.drawRect(0, 0, 0, 0); + this.gridRect = w.globals.dom.baseEl.querySelector('.apexcharts-grid'); + this.constraints = new Box(0, 0, w.globals.gridWidth, w.globals.gridHeight); + this.zoomRect.node.classList.add('apexcharts-zoom-rect'); + this.selectionRect.node.classList.add('apexcharts-selection-rect'); + w.globals.dom.Paper.add(this.zoomRect); + w.globals.dom.Paper.add(this.selectionRect); + if (w.config.chart.selection.type === 'x') { + this.slDraggableRect = this.selectionRect.draggable({ + minX: 0, + minY: 0, + maxX: w.globals.gridWidth, + maxY: w.globals.gridHeight + }).on('dragmove.namespace', this.selectionDragging.bind(this, 'dragging')); + } else if (w.config.chart.selection.type === 'y') { + this.slDraggableRect = this.selectionRect.draggable({ + minX: 0, + maxX: w.globals.gridWidth + }).on('dragmove.namespace', this.selectionDragging.bind(this, 'dragging')); + } else { + this.slDraggableRect = this.selectionRect.draggable().on('dragmove.namespace', this.selectionDragging.bind(this, 'dragging')); + } + this.preselectedSelection(); + this.hoverArea = w.globals.dom.baseEl.querySelector("".concat(w.globals.chartClass, " .apexcharts-svg")); + this.hoverArea.classList.add('apexcharts-zoomable'); + this.eventList.forEach(function (event) { + _this2.hoverArea.addEventListener(event, me.svgMouseEvents.bind(me, xyRatios), { + capture: false, + passive: true + }); + }); + if (w.config.chart.zoom.enabled && w.config.chart.zoom.allowMouseWheelZoom) { + this.hoverArea.addEventListener('wheel', me.mouseWheelEvent.bind(me), { + capture: false, + passive: false + }); + } + } + + // remove the event listeners which were previously added on hover area + }, { + key: "destroy", + value: function destroy() { + if (this.slDraggableRect) { + this.slDraggableRect.draggable(false); + this.slDraggableRect.off(); + this.selectionRect.off(); + } + this.selectionRect = null; + this.zoomRect = null; + this.gridRect = null; + } + }, { + key: "svgMouseEvents", + value: function svgMouseEvents(xyRatios, e) { + var w = this.w; + var toolbar = this.ctx.toolbar; + var zoomtype = w.globals.zoomEnabled ? w.config.chart.zoom.type : w.config.chart.selection.type; + var autoSelected = w.config.chart.toolbar.autoSelected; + if (e.shiftKey) { + this.shiftWasPressed = true; + toolbar.enableZoomPanFromToolbar(autoSelected === 'pan' ? 'zoom' : 'pan'); + } else { + if (this.shiftWasPressed) { + toolbar.enableZoomPanFromToolbar(autoSelected); + this.shiftWasPressed = false; + } + } + if (!e.target) return; + var tc = e.target.classList; + var pc; + if (e.target.parentNode && e.target.parentNode !== null) { + pc = e.target.parentNode.classList; + } + var falsePositives = tc.contains('apexcharts-legend-marker') || tc.contains('apexcharts-legend-text') || pc && pc.contains('apexcharts-toolbar'); + if (falsePositives) return; + this.clientX = e.type === 'touchmove' || e.type === 'touchstart' ? e.touches[0].clientX : e.type === 'touchend' ? e.changedTouches[0].clientX : e.clientX; + this.clientY = e.type === 'touchmove' || e.type === 'touchstart' ? e.touches[0].clientY : e.type === 'touchend' ? e.changedTouches[0].clientY : e.clientY; + if (e.type === 'mousedown' && e.which === 1 || e.type === 'touchstart') { + var gridRectDim = this.gridRect.getBoundingClientRect(); + this.startX = this.clientX - gridRectDim.left - w.globals.barPadForNumericAxis; + this.startY = this.clientY - gridRectDim.top; + this.dragged = false; + this.w.globals.mousedown = true; + } + if (e.type === 'mousemove' && e.which === 1 || e.type === 'touchmove') { + this.dragged = true; + if (w.globals.panEnabled) { + w.globals.selection = null; + if (this.w.globals.mousedown) { + this.panDragging({ + context: this, + zoomtype: zoomtype, + xyRatios: xyRatios + }); + } + } else { + if (this.w.globals.mousedown && w.globals.zoomEnabled || this.w.globals.mousedown && w.globals.selectionEnabled) { + this.selection = this.selectionDrawing({ + context: this, + zoomtype: zoomtype + }); + } + } + } + if (e.type === 'mouseup' || e.type === 'touchend' || e.type === 'mouseleave') { + this.handleMouseUp({ + zoomtype: zoomtype + }); + } + this.makeSelectionRectDraggable(); + } + }, { + key: "handleMouseUp", + value: function handleMouseUp(_ref2) { + var _this$gridRect; + var zoomtype = _ref2.zoomtype, + isResized = _ref2.isResized; + var w = this.w; + // we will be calling getBoundingClientRect on each mousedown/mousemove/mouseup + var gridRectDim = (_this$gridRect = this.gridRect) === null || _this$gridRect === void 0 ? void 0 : _this$gridRect.getBoundingClientRect(); + if (gridRectDim && (this.w.globals.mousedown || isResized)) { + // user released the drag, now do all the calculations + this.endX = this.clientX - gridRectDim.left - w.globals.barPadForNumericAxis; + this.endY = this.clientY - gridRectDim.top; + this.dragX = Math.abs(this.endX - this.startX); + this.dragY = Math.abs(this.endY - this.startY); + if (w.globals.zoomEnabled || w.globals.selectionEnabled) { + this.selectionDrawn({ + context: this, + zoomtype: zoomtype + }); + } + if (w.globals.panEnabled && w.config.xaxis.convertedCatToNumeric) { + this.delayedPanScrolled(); + } + } + if (w.globals.zoomEnabled) { + this.hideSelectionRect(this.selectionRect); + } + this.dragged = false; + this.w.globals.mousedown = false; + } + }, { + key: "mouseWheelEvent", + value: function mouseWheelEvent(e) { + var _this3 = this; + var w = this.w; + e.preventDefault(); + var now = Date.now(); + + // Execute immediately if it's the first action or enough time has passed + if (now - w.globals.lastWheelExecution > this.wheelDelay) { + this.executeMouseWheelZoom(e); + w.globals.lastWheelExecution = now; + } + if (this.debounceTimer) clearTimeout(this.debounceTimer); + this.debounceTimer = setTimeout(function () { + if (now - w.globals.lastWheelExecution > _this3.wheelDelay) { + _this3.executeMouseWheelZoom(e); + w.globals.lastWheelExecution = now; + } + }, this.debounceDelay); + } + }, { + key: "executeMouseWheelZoom", + value: function executeMouseWheelZoom(e) { + var _this$gridRect2; + var w = this.w; + this.minX = w.globals.isRangeBar ? w.globals.minY : w.globals.minX; + this.maxX = w.globals.isRangeBar ? w.globals.maxY : w.globals.maxX; + + // Calculate the relative position of the mouse on the chart + var gridRectDim = (_this$gridRect2 = this.gridRect) === null || _this$gridRect2 === void 0 ? void 0 : _this$gridRect2.getBoundingClientRect(); + if (!gridRectDim) return; + var mouseX = (e.clientX - gridRectDim.left) / gridRectDim.width; + var currentMinX = this.minX; + var currentMaxX = this.maxX; + var totalX = currentMaxX - currentMinX; + + // Determine zoom factor + var zoomFactorIn = 0.5; + var zoomFactorOut = 1.5; + var zoomRange; + var newMinX, newMaxX; + if (e.deltaY < 0) { + // Zoom In + zoomRange = zoomFactorIn * totalX; + var midPoint = currentMinX + mouseX * totalX; + newMinX = midPoint - zoomRange / 2; + newMaxX = midPoint + zoomRange / 2; + } else { + // Zoom Out + zoomRange = zoomFactorOut * totalX; + newMinX = currentMinX - zoomRange / 2; + newMaxX = currentMaxX + zoomRange / 2; + } + + // Constrain within original chart bounds + if (!w.globals.isRangeBar) { + newMinX = Math.max(newMinX, w.globals.initialMinX); + newMaxX = Math.min(newMaxX, w.globals.initialMaxX); + + // Ensure minimum range + var minRange = (w.globals.initialMaxX - w.globals.initialMinX) * 0.01; + if (newMaxX - newMinX < minRange) { + var _midPoint = (newMinX + newMaxX) / 2; + newMinX = _midPoint - minRange / 2; + newMaxX = _midPoint + minRange / 2; + } + } + var newMinXMaxX = this._getNewMinXMaxX(newMinX, newMaxX); + + // Apply zoom if valid + if (!isNaN(newMinXMaxX.minX) && !isNaN(newMinXMaxX.maxX)) { + this.zoomUpdateOptions(newMinXMaxX.minX, newMinXMaxX.maxX); + } + } + }, { + key: "makeSelectionRectDraggable", + value: function makeSelectionRectDraggable() { + var _this4 = this; + var w = this.w; + if (!this.selectionRect) return; + var rectDim = this.selectionRect.node.getBoundingClientRect(); + if (rectDim.width > 0 && rectDim.height > 0) { + this.selectionRect.select(false).resize(false); + this.selectionRect.select({ + createRot: function createRot() {}, + updateRot: function updateRot() {}, + createHandle: function createHandle(group, p, index, pointArr, handleName) { + if (handleName === 'l' || handleName === 'r') return group.circle(8).css({ + 'stroke-width': 1, + stroke: '#333', + fill: '#fff' + }); + return group.circle(0); + }, + updateHandle: function updateHandle(group, p) { + return group.center(p[0], p[1]); + } + }).resize().on('resize', function () { + var zoomtype = w.globals.zoomEnabled ? w.config.chart.zoom.type : w.config.chart.selection.type; + _this4.handleMouseUp({ + zoomtype: zoomtype, + isResized: true + }); + }); + } + } + }, { + key: "preselectedSelection", + value: function preselectedSelection() { + var w = this.w; + var xyRatios = this.xyRatios; + if (!w.globals.zoomEnabled) { + if (typeof w.globals.selection !== 'undefined' && w.globals.selection !== null) { + this.drawSelectionRect(_objectSpread2(_objectSpread2({}, w.globals.selection), {}, { + translateX: w.globals.translateX, + translateY: w.globals.translateY + })); + } else { + if (w.config.chart.selection.xaxis.min !== undefined && w.config.chart.selection.xaxis.max !== undefined) { + var x = (w.config.chart.selection.xaxis.min - w.globals.minX) / xyRatios.xRatio; + var width = w.globals.gridWidth - (w.globals.maxX - w.config.chart.selection.xaxis.max) / xyRatios.xRatio - x; + if (w.globals.isRangeBar) { + // rangebars put datetime data in y axis + x = (w.config.chart.selection.xaxis.min - w.globals.yAxisScale[0].niceMin) / xyRatios.invertedYRatio; + width = (w.config.chart.selection.xaxis.max - w.config.chart.selection.xaxis.min) / xyRatios.invertedYRatio; + } + var selectionRect = { + x: x, + y: 0, + width: width, + height: w.globals.gridHeight, + translateX: w.globals.translateX, + translateY: w.globals.translateY, + selectionEnabled: true + }; + this.drawSelectionRect(selectionRect); + this.makeSelectionRectDraggable(); + if (typeof w.config.chart.events.selection === 'function') { + w.config.chart.events.selection(this.ctx, { + xaxis: { + min: w.config.chart.selection.xaxis.min, + max: w.config.chart.selection.xaxis.max + }, + yaxis: {} + }); + } + } + } + } + } + }, { + key: "drawSelectionRect", + value: function drawSelectionRect(_ref3) { + var x = _ref3.x, + y = _ref3.y, + width = _ref3.width, + height = _ref3.height, + _ref3$translateX = _ref3.translateX, + translateX = _ref3$translateX === void 0 ? 0 : _ref3$translateX, + _ref3$translateY = _ref3.translateY, + translateY = _ref3$translateY === void 0 ? 0 : _ref3$translateY; + var w = this.w; + var zoomRect = this.zoomRect; + var selectionRect = this.selectionRect; + if (this.dragged || w.globals.selection !== null) { + var scalingAttrs = { + transform: 'translate(' + translateX + ', ' + translateY + ')' + }; + + // change styles based on zoom or selection + // zoom is Enabled and user has dragged, so draw blue rect + if (w.globals.zoomEnabled && this.dragged) { + if (width < 0) width = 1; // fixes apexcharts.js#1168 + zoomRect.attr({ + x: x, + y: y, + width: width, + height: height, + fill: w.config.chart.zoom.zoomedArea.fill.color, + 'fill-opacity': w.config.chart.zoom.zoomedArea.fill.opacity, + stroke: w.config.chart.zoom.zoomedArea.stroke.color, + 'stroke-width': w.config.chart.zoom.zoomedArea.stroke.width, + 'stroke-opacity': w.config.chart.zoom.zoomedArea.stroke.opacity + }); + Graphics.setAttrs(zoomRect.node, scalingAttrs); + } + + // selection is enabled + if (w.globals.selectionEnabled) { + selectionRect.attr({ + x: x, + y: y, + width: width > 0 ? width : 0, + height: height > 0 ? height : 0, + fill: w.config.chart.selection.fill.color, + 'fill-opacity': w.config.chart.selection.fill.opacity, + stroke: w.config.chart.selection.stroke.color, + 'stroke-width': w.config.chart.selection.stroke.width, + 'stroke-dasharray': w.config.chart.selection.stroke.dashArray, + 'stroke-opacity': w.config.chart.selection.stroke.opacity + }); + Graphics.setAttrs(selectionRect.node, scalingAttrs); + } + } + } + }, { + key: "hideSelectionRect", + value: function hideSelectionRect(rect) { + if (rect) { + rect.attr({ + x: 0, + y: 0, + width: 0, + height: 0 + }); + } + } + }, { + key: "selectionDrawing", + value: function selectionDrawing(_ref4) { + var context = _ref4.context, + zoomtype = _ref4.zoomtype; + var w = this.w; + var me = context; + var gridRectDim = this.gridRect.getBoundingClientRect(); + var startX = me.startX - 1; + var startY = me.startY; + var inversedX = false; + var inversedY = false; + var left = me.clientX - gridRectDim.left - w.globals.barPadForNumericAxis; + var top = me.clientY - gridRectDim.top; + var selectionWidth = left - startX; + var selectionHeight = top - startY; + var selectionRect = { + translateX: w.globals.translateX, + translateY: w.globals.translateY + }; + if (Math.abs(selectionWidth + startX) > w.globals.gridWidth) { + // user dragged the mouse outside drawing area to the right + selectionWidth = w.globals.gridWidth - startX; + } else if (left < 0) { + // user dragged the mouse outside drawing area to the left + selectionWidth = startX; + } + + // inverse selection X + if (startX > left) { + inversedX = true; + selectionWidth = Math.abs(selectionWidth); + } + + // inverse selection Y + if (startY > top) { + inversedY = true; + selectionHeight = Math.abs(selectionHeight); + } + if (zoomtype === 'x') { + selectionRect = { + x: inversedX ? startX - selectionWidth : startX, + y: 0, + width: selectionWidth, + height: w.globals.gridHeight + }; + } else if (zoomtype === 'y') { + selectionRect = { + x: 0, + y: inversedY ? startY - selectionHeight : startY, + width: w.globals.gridWidth, + height: selectionHeight + }; + } else { + selectionRect = { + x: inversedX ? startX - selectionWidth : startX, + y: inversedY ? startY - selectionHeight : startY, + width: selectionWidth, + height: selectionHeight + }; + } + selectionRect = _objectSpread2(_objectSpread2({}, selectionRect), {}, { + translateX: w.globals.translateX, + translateY: w.globals.translateY + }); + me.drawSelectionRect(selectionRect); + me.selectionDragging('resizing'); + return selectionRect; + } + }, { + key: "selectionDragging", + value: function selectionDragging(type, e) { + var _this5 = this; + var w = this.w; + if (!e) return; + e.preventDefault(); + var _e$detail = e.detail, + handler = _e$detail.handler, + box = _e$detail.box; + var x = box.x, + y = box.y; + if (x < this.constraints.x) { + x = this.constraints.x; + } + if (y < this.constraints.y) { + y = this.constraints.y; + } + if (box.x2 > this.constraints.x2) { + x = this.constraints.x2 - box.w; + } + if (box.y2 > this.constraints.y2) { + y = this.constraints.y2 - box.h; + } + handler.move(x, y); + var xyRatios = this.xyRatios; + var selRect = this.selectionRect; + var timerInterval = 0; + if (type === 'resizing') { + timerInterval = 30; + } + + // update selection when selection rect is dragged + var getSelAttr = function getSelAttr(attr) { + return parseFloat(selRect.node.getAttribute(attr)); + }; + var draggedProps = { + x: getSelAttr('x'), + y: getSelAttr('y'), + width: getSelAttr('width'), + height: getSelAttr('height') + }; + w.globals.selection = draggedProps; + // update selection ends + + if (typeof w.config.chart.events.selection === 'function' && w.globals.selectionEnabled) { + // a small debouncer is required when resizing to avoid freezing the chart + clearTimeout(this.w.globals.selectionResizeTimer); + this.w.globals.selectionResizeTimer = window.setTimeout(function () { + var gridRectDim = _this5.gridRect.getBoundingClientRect(); + var selectionRect = selRect.node.getBoundingClientRect(); + var minX, maxX, minY, maxY; + if (!w.globals.isRangeBar) { + // normal XY charts + minX = w.globals.xAxisScale.niceMin + (selectionRect.left - gridRectDim.left) * xyRatios.xRatio; + maxX = w.globals.xAxisScale.niceMin + (selectionRect.right - gridRectDim.left) * xyRatios.xRatio; + minY = w.globals.yAxisScale[0].niceMin + (gridRectDim.bottom - selectionRect.bottom) * xyRatios.yRatio[0]; + maxY = w.globals.yAxisScale[0].niceMax - (selectionRect.top - gridRectDim.top) * xyRatios.yRatio[0]; + } else { + // rangeBars use y for datetime + minX = w.globals.yAxisScale[0].niceMin + (selectionRect.left - gridRectDim.left) * xyRatios.invertedYRatio; + maxX = w.globals.yAxisScale[0].niceMin + (selectionRect.right - gridRectDim.left) * xyRatios.invertedYRatio; + minY = 0; + maxY = 1; + } + var xyAxis = { + xaxis: { + min: minX, + max: maxX + }, + yaxis: { + min: minY, + max: maxY + } + }; + w.config.chart.events.selection(_this5.ctx, xyAxis); + if (w.config.chart.brush.enabled && w.config.chart.events.brushScrolled !== undefined) { + w.config.chart.events.brushScrolled(_this5.ctx, xyAxis); + } + }, timerInterval); + } + } + }, { + key: "selectionDrawn", + value: function selectionDrawn(_ref5) { + var context = _ref5.context, + zoomtype = _ref5.zoomtype; + var w = this.w; + var me = context; + var xyRatios = this.xyRatios; + var toolbar = this.ctx.toolbar; + + // Use boundingRect for final selection area + var selRect = w.globals.zoomEnabled ? me.zoomRect.node.getBoundingClientRect() : me.selectionRect.node.getBoundingClientRect(); + var gridRectDim = me.gridRect.getBoundingClientRect(); + + // Local coords in the chart's grid + var localStartX = selRect.left - gridRectDim.left - w.globals.barPadForNumericAxis; + var localEndX = selRect.right - gridRectDim.left - w.globals.barPadForNumericAxis; + var localStartY = selRect.top - gridRectDim.top; + var localEndY = selRect.bottom - gridRectDim.top; + + // Convert those local coords to actual data values + var xLowestValue, xHighestValue; + if (!w.globals.isRangeBar) { + xLowestValue = w.globals.xAxisScale.niceMin + localStartX * xyRatios.xRatio; + xHighestValue = w.globals.xAxisScale.niceMin + localEndX * xyRatios.xRatio; + } else { + xLowestValue = w.globals.yAxisScale[0].niceMin + localStartX * xyRatios.invertedYRatio; + xHighestValue = w.globals.yAxisScale[0].niceMin + localEndX * xyRatios.invertedYRatio; + } + + // For Y values, pick from the first y-axis, but handle multi-axis + var yHighestValue = []; + var yLowestValue = []; + w.config.yaxis.forEach(function (yaxe, index) { + // pick whichever series is mapped to this y-axis + var seriesIndex = w.globals.seriesYAxisMap[index][0]; + var highestVal = w.globals.yAxisScale[index].niceMax - xyRatios.yRatio[seriesIndex] * localStartY; + var lowestVal = w.globals.yAxisScale[index].niceMax - xyRatios.yRatio[seriesIndex] * localEndY; + yHighestValue.push(highestVal); + yLowestValue.push(lowestVal); + }); + + // Only apply if user actually dragged far enough to consider it a selection + if (me.dragged && (me.dragX > 10 || me.dragY > 10) && xLowestValue !== xHighestValue) { + if (w.globals.zoomEnabled) { + var yaxis = Utils$1.clone(w.globals.initialConfig.yaxis); + var xaxis = Utils$1.clone(w.globals.initialConfig.xaxis); + w.globals.zoomed = true; + if (w.config.xaxis.convertedCatToNumeric) { + xLowestValue = Math.floor(xLowestValue); + xHighestValue = Math.floor(xHighestValue); + if (xLowestValue < 1) { + xLowestValue = 1; + xHighestValue = w.globals.dataPoints; + } + if (xHighestValue - xLowestValue < 2) { + xHighestValue = xLowestValue + 1; + } + } + if (zoomtype === 'xy' || zoomtype === 'x') { + xaxis = { + min: xLowestValue, + max: xHighestValue + }; + } + if (zoomtype === 'xy' || zoomtype === 'y') { + yaxis.forEach(function (yaxe, index) { + yaxis[index].min = yLowestValue[index]; + yaxis[index].max = yHighestValue[index]; + }); + } + if (toolbar) { + var beforeZoomRange = toolbar.getBeforeZoomRange(xaxis, yaxis); + if (beforeZoomRange) { + xaxis = beforeZoomRange.xaxis ? beforeZoomRange.xaxis : xaxis; + yaxis = beforeZoomRange.yaxis ? beforeZoomRange.yaxis : yaxis; + } + } + var options = { + xaxis: xaxis + }; + if (!w.config.chart.group) { + // if chart in a group, prevent yaxis update here + // fix issue #650 + options.yaxis = yaxis; + } + me.ctx.updateHelpers._updateOptions(options, false, me.w.config.chart.animations.dynamicAnimation.enabled); + if (typeof w.config.chart.events.zoomed === 'function') { + toolbar.zoomCallback(xaxis, yaxis); + } + } else if (w.globals.selectionEnabled) { + var _yaxis = null; + var _xaxis = null; + _xaxis = { + min: xLowestValue, + max: xHighestValue + }; + if (zoomtype === 'xy' || zoomtype === 'y') { + _yaxis = Utils$1.clone(w.config.yaxis); + _yaxis.forEach(function (yaxe, index) { + _yaxis[index].min = yLowestValue[index]; + _yaxis[index].max = yHighestValue[index]; + }); + } + w.globals.selection = me.selection; + if (typeof w.config.chart.events.selection === 'function') { + w.config.chart.events.selection(me.ctx, { + xaxis: _xaxis, + yaxis: _yaxis + }); + } + } + } + } + }, { + key: "panDragging", + value: function panDragging(_ref6) { + var context = _ref6.context; + var w = this.w; + var me = context; + + // check to make sure there is data to compare against + if (typeof w.globals.lastClientPosition.x !== 'undefined') { + // get the change from last position to this position + var deltaX = w.globals.lastClientPosition.x - me.clientX; + var deltaY = w.globals.lastClientPosition.y - me.clientY; + + // check which direction had the highest amplitude + if (Math.abs(deltaX) > Math.abs(deltaY) && deltaX > 0) { + this.moveDirection = 'left'; + } else if (Math.abs(deltaX) > Math.abs(deltaY) && deltaX < 0) { + this.moveDirection = 'right'; + } else if (Math.abs(deltaY) > Math.abs(deltaX) && deltaY > 0) { + this.moveDirection = 'up'; + } else if (Math.abs(deltaY) > Math.abs(deltaX) && deltaY < 0) { + this.moveDirection = 'down'; + } + } + + // set the new last position to the current for next time (to get the position of drag) + w.globals.lastClientPosition = { + x: me.clientX, + y: me.clientY + }; + var xLowestValue = w.globals.isRangeBar ? w.globals.minY : w.globals.minX; + var xHighestValue = w.globals.isRangeBar ? w.globals.maxY : w.globals.maxX; + + // on a category, we don't pan continuously as it causes bugs + if (!w.config.xaxis.convertedCatToNumeric) { + me.panScrolled(xLowestValue, xHighestValue); + } + } + }, { + key: "delayedPanScrolled", + value: function delayedPanScrolled() { + var w = this.w; + var newMinX = w.globals.minX; + var newMaxX = w.globals.maxX; + var centerX = (w.globals.maxX - w.globals.minX) / 2; + if (this.moveDirection === 'left') { + newMinX = w.globals.minX + centerX; + newMaxX = w.globals.maxX + centerX; + } else if (this.moveDirection === 'right') { + newMinX = w.globals.minX - centerX; + newMaxX = w.globals.maxX - centerX; + } + newMinX = Math.floor(newMinX); + newMaxX = Math.floor(newMaxX); + this.updateScrolledChart({ + xaxis: { + min: newMinX, + max: newMaxX + } + }, newMinX, newMaxX); + } + }, { + key: "panScrolled", + value: function panScrolled(xLowestValue, xHighestValue) { + var w = this.w; + var xyRatios = this.xyRatios; + var yaxis = Utils$1.clone(w.globals.initialConfig.yaxis); + var xRatio = xyRatios.xRatio; + var minX = w.globals.minX; + var maxX = w.globals.maxX; + if (w.globals.isRangeBar) { + xRatio = xyRatios.invertedYRatio; + minX = w.globals.minY; + maxX = w.globals.maxY; + } + if (this.moveDirection === 'left') { + xLowestValue = minX + w.globals.gridWidth / 15 * xRatio; + xHighestValue = maxX + w.globals.gridWidth / 15 * xRatio; + } else if (this.moveDirection === 'right') { + xLowestValue = minX - w.globals.gridWidth / 15 * xRatio; + xHighestValue = maxX - w.globals.gridWidth / 15 * xRatio; + } + if (!w.globals.isRangeBar) { + if (xLowestValue < w.globals.initialMinX || xHighestValue > w.globals.initialMaxX) { + xLowestValue = minX; + xHighestValue = maxX; + } + } + var xaxis = { + min: xLowestValue, + max: xHighestValue + }; + var options = { + xaxis: xaxis + }; + if (!w.config.chart.group) { + // if chart in a group, prevent yaxis update here + // fix issue #650 + options.yaxis = yaxis; + } + this.updateScrolledChart(options, xLowestValue, xHighestValue); + } + }, { + key: "updateScrolledChart", + value: function updateScrolledChart(options, xLowestValue, xHighestValue) { + var w = this.w; + this.ctx.updateHelpers._updateOptions(options, false, false); + if (typeof w.config.chart.events.scrolled === 'function') { + w.config.chart.events.scrolled(this.ctx, { + xaxis: { + min: xLowestValue, + max: xHighestValue + } + }); + } + } + }]); + return ZoomPanSelection; + }(Toolbar); + + /** + * ApexCharts Tooltip.Utils Class to support Tooltip functionality. + * + * @module Tooltip.Utils + **/ + var Utils = /*#__PURE__*/function () { + function Utils(tooltipContext) { + _classCallCheck(this, Utils); + this.w = tooltipContext.w; + this.ttCtx = tooltipContext; + this.ctx = tooltipContext.ctx; + } + + /** + ** When hovering over series, you need to capture which series is being hovered on. + ** This function will return both capturedseries index as well as inner index of that series + * @memberof Utils + * @param {object} + * - hoverArea = the rect on which user hovers + * - elGrid = dimensions of the hover rect (it can be different than hoverarea) + */ + _createClass(Utils, [{ + key: "getNearestValues", + value: function getNearestValues(_ref) { + var hoverArea = _ref.hoverArea, + elGrid = _ref.elGrid, + clientX = _ref.clientX, + clientY = _ref.clientY; + var w = this.w; + var seriesBound = elGrid.getBoundingClientRect(); + var hoverWidth = seriesBound.width; + var hoverHeight = seriesBound.height; + var xDivisor = hoverWidth / (w.globals.dataPoints - 1); + var yDivisor = hoverHeight / w.globals.dataPoints; + var hasBars = this.hasBars(); + if ((w.globals.comboCharts || hasBars) && !w.config.xaxis.convertedCatToNumeric) { + xDivisor = hoverWidth / w.globals.dataPoints; + } + var hoverX = clientX - seriesBound.left - w.globals.barPadForNumericAxis; + var hoverY = clientY - seriesBound.top; + var notInRect = hoverX < 0 || hoverY < 0 || hoverX > hoverWidth || hoverY > hoverHeight; + if (notInRect) { + hoverArea.classList.remove('hovering-zoom'); + hoverArea.classList.remove('hovering-pan'); + } else { + if (w.globals.zoomEnabled) { + hoverArea.classList.remove('hovering-pan'); + hoverArea.classList.add('hovering-zoom'); + } else if (w.globals.panEnabled) { + hoverArea.classList.remove('hovering-zoom'); + hoverArea.classList.add('hovering-pan'); + } + } + var j = Math.round(hoverX / xDivisor); + var jHorz = Math.floor(hoverY / yDivisor); + if (hasBars && !w.config.xaxis.convertedCatToNumeric) { + j = Math.ceil(hoverX / xDivisor); + j = j - 1; + } + var capturedSeries = null; + var closest = null; + var seriesXValArr = w.globals.seriesXvalues.map(function (seriesXVal) { + return seriesXVal.filter(function (s) { + return Utils$1.isNumber(s); + }); + }); + var seriesYValArr = w.globals.seriesYvalues.map(function (seriesYVal) { + return seriesYVal.filter(function (s) { + return Utils$1.isNumber(s); + }); + }); + + // if X axis type is not category and tooltip is not shared, then we need to find the cursor position and get the nearest value + if (w.globals.isXNumeric) { + // Change origin of cursor position so that we can compute the relative nearest point to the cursor on our chart + // we only need to scale because all points are relative to the bounds.left and bounds.top => origin is virtually (0, 0) + var chartGridEl = this.ttCtx.getElGrid(); + var chartGridElBoundingRect = chartGridEl.getBoundingClientRect(); + var transformedHoverX = hoverX * (chartGridElBoundingRect.width / hoverWidth); + var transformedHoverY = hoverY * (chartGridElBoundingRect.height / hoverHeight); + closest = this.closestInMultiArray(transformedHoverX, transformedHoverY, seriesXValArr, seriesYValArr); + capturedSeries = closest.index; + j = closest.j; + if (capturedSeries !== null && w.globals.hasNullValues) { + // initial push, it should be a little smaller than the 1st val + seriesXValArr = w.globals.seriesXvalues[capturedSeries]; + closest = this.closestInArray(transformedHoverX, seriesXValArr); + j = closest.j; + } + } + w.globals.capturedSeriesIndex = capturedSeries === null ? -1 : capturedSeries; + if (!j || j < 1) j = 0; + if (w.globals.isBarHorizontal) { + w.globals.capturedDataPointIndex = jHorz; + } else { + w.globals.capturedDataPointIndex = j; + } + return { + capturedSeries: capturedSeries, + j: w.globals.isBarHorizontal ? jHorz : j, + hoverX: hoverX, + hoverY: hoverY + }; + } + }, { + key: "getFirstActiveXArray", + value: function getFirstActiveXArray(Xarrays) { + var w = this.w; + var activeIndex = 0; + var firstActiveSeriesIndex = Xarrays.map(function (xarr, index) { + return xarr.length > 0 ? index : -1; + }); + for (var a = 0; a < firstActiveSeriesIndex.length; a++) { + if (firstActiveSeriesIndex[a] !== -1 && w.globals.collapsedSeriesIndices.indexOf(a) === -1 && w.globals.ancillaryCollapsedSeriesIndices.indexOf(a) === -1) { + activeIndex = firstActiveSeriesIndex[a]; + break; + } + } + return activeIndex; + } + }, { + key: "closestInMultiArray", + value: function closestInMultiArray(hoverX, hoverY, Xarrays, Yarrays) { + var w = this.w; + + // Determine which series are active (not collapsed) + var isActiveSeries = function isActiveSeries(seriesIndex) { + return w.globals.collapsedSeriesIndices.indexOf(seriesIndex) === -1 && w.globals.ancillaryCollapsedSeriesIndices.indexOf(seriesIndex) === -1; + }; + var closestDist = Infinity; + var closestSeriesIndex = null; + var closestPointIndex = null; + + // Iterate through all series and points to find the closest (x,y) to (hoverX, hoverY) + for (var i = 0; i < Xarrays.length; i++) { + if (!isActiveSeries(i)) { + continue; + } + var xArr = Xarrays[i]; + var yArr = Yarrays[i]; + var len = Math.min(xArr.length, yArr.length); + for (var j = 0; j < len; j++) { + var xVal = xArr[j]; + var distX = hoverX - xVal; + var dist = Math.sqrt(distX * distX); + if (!w.globals.allSeriesHasEqualX) { + var yVal = yArr[j]; + var distY = hoverY - yVal; + dist = Math.sqrt(distX * distX + distY * distY); + } + if (dist < closestDist) { + closestDist = dist; + closestSeriesIndex = i; + closestPointIndex = j; + } + } + } + return { + index: closestSeriesIndex, + j: closestPointIndex + }; + } + }, { + key: "closestInArray", + value: function closestInArray(val, arr) { + var curr = arr[0]; + var currIndex = null; + var diff = Math.abs(val - curr); + for (var i = 0; i < arr.length; i++) { + var newdiff = Math.abs(val - arr[i]); + if (newdiff < diff) { + diff = newdiff; + currIndex = i; + } + } + return { + j: currIndex + }; + } + + /** + * When there are multiple series, it is possible to have different x values for each series. + * But it may be possible in those multiple series, that there is same x value for 2 or more + * series. + * @memberof Utils + * @param {int} + * - j = is the inner index of series -> (series[i][j]) + * @return {bool} + */ + }, { + key: "isXoverlap", + value: function isXoverlap(j) { + var w = this.w; + var xSameForAllSeriesJArr = []; + var seriesX = w.globals.seriesX.filter(function (s) { + return typeof s[0] !== 'undefined'; + }); + if (seriesX.length > 0) { + for (var i = 0; i < seriesX.length - 1; i++) { + if (typeof seriesX[i][j] !== 'undefined' && typeof seriesX[i + 1][j] !== 'undefined') { + if (seriesX[i][j] !== seriesX[i + 1][j]) { + xSameForAllSeriesJArr.push('unEqual'); + } + } + } + } + if (xSameForAllSeriesJArr.length === 0) { + return true; + } + return false; + } + }, { + key: "isInitialSeriesSameLen", + value: function isInitialSeriesSameLen() { + var sameLen = true; + var initialSeries = this.w.globals.initialSeries; + for (var i = 0; i < initialSeries.length - 1; i++) { + if (initialSeries[i].data.length !== initialSeries[i + 1].data.length) { + sameLen = false; + break; + } + } + return sameLen; + } + }, { + key: "getBarsHeight", + value: function getBarsHeight(allbars) { + var bars = _toConsumableArray(allbars); + var totalHeight = bars.reduce(function (acc, bar) { + return acc + bar.getBBox().height; + }, 0); + return totalHeight; + } + }, { + key: "getElMarkers", + value: function getElMarkers(capturedSeries) { + // The selector .apexcharts-series-markers-wrap > * includes marker groups for which the + // .apexcharts-series-markers class is not added due to null values or discrete markers + if (typeof capturedSeries == 'number') { + return this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-series[data\\:realIndex='".concat(capturedSeries, "'] .apexcharts-series-markers-wrap > *")); + } + return this.w.globals.dom.baseEl.querySelectorAll('.apexcharts-series-markers-wrap > *'); + } + }, { + key: "getAllMarkers", + value: function getAllMarkers() { + var _this = this; + var filterCollapsed = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + // first get all marker parents. This parent class contains series-index + // which helps to sort the markers as they are dynamic + var markersWraps = this.w.globals.dom.baseEl.querySelectorAll('.apexcharts-series-markers-wrap'); + markersWraps = _toConsumableArray(markersWraps); + if (filterCollapsed) { + markersWraps = markersWraps.filter(function (m) { + var realIndex = Number(m.getAttribute('data:realIndex')); + return _this.w.globals.collapsedSeriesIndices.indexOf(realIndex) === -1; + }); + } + markersWraps.sort(function (a, b) { + var indexA = Number(a.getAttribute('data:realIndex')); + var indexB = Number(b.getAttribute('data:realIndex')); + return indexB < indexA ? 1 : indexB > indexA ? -1 : 0; + }); + var markers = []; + markersWraps.forEach(function (m) { + markers.push(m.querySelector('.apexcharts-marker')); + }); + return markers; + } + }, { + key: "hasMarkers", + value: function hasMarkers(capturedSeries) { + var markers = this.getElMarkers(capturedSeries); + return markers.length > 0; + } + }, { + key: "getPathFromPoint", + value: function getPathFromPoint(point, size) { + var cx = Number(point.getAttribute('cx')); + var cy = Number(point.getAttribute('cy')); + var shape = point.getAttribute('shape'); + return new Graphics(this.ctx).getMarkerPath(cx, cy, shape, size); + } + }, { + key: "getElBars", + value: function getElBars() { + return this.w.globals.dom.baseEl.querySelectorAll('.apexcharts-bar-series, .apexcharts-candlestick-series, .apexcharts-boxPlot-series, .apexcharts-rangebar-series'); + } + }, { + key: "hasBars", + value: function hasBars() { + var bars = this.getElBars(); + return bars.length > 0; + } + }, { + key: "getHoverMarkerSize", + value: function getHoverMarkerSize(index) { + var w = this.w; + var hoverSize = w.config.markers.hover.size; + if (hoverSize === undefined) { + hoverSize = w.globals.markers.size[index] + w.config.markers.hover.sizeOffset; + } + return hoverSize; + } + }, { + key: "toggleAllTooltipSeriesGroups", + value: function toggleAllTooltipSeriesGroups(state) { + var w = this.w; + var ttCtx = this.ttCtx; + if (ttCtx.allTooltipSeriesGroups.length === 0) { + ttCtx.allTooltipSeriesGroups = w.globals.dom.baseEl.querySelectorAll('.apexcharts-tooltip-series-group'); + } + var allTooltipSeriesGroups = ttCtx.allTooltipSeriesGroups; + for (var i = 0; i < allTooltipSeriesGroups.length; i++) { + if (state === 'enable') { + allTooltipSeriesGroups[i].classList.add('apexcharts-active'); + allTooltipSeriesGroups[i].style.display = w.config.tooltip.items.display; + } else { + allTooltipSeriesGroups[i].classList.remove('apexcharts-active'); + allTooltipSeriesGroups[i].style.display = 'none'; + } + } + } + }]); + return Utils; + }(); + + /** + * ApexCharts Tooltip.Labels Class to draw texts on the tooltip. + * This file deals with printing actual text on the tooltip. + * + * @module Tooltip.Labels + **/ + var Labels = /*#__PURE__*/function () { + function Labels(tooltipContext) { + _classCallCheck(this, Labels); + this.w = tooltipContext.w; + this.ctx = tooltipContext.ctx; + this.ttCtx = tooltipContext; + this.tooltipUtil = new Utils(tooltipContext); + } + _createClass(Labels, [{ + key: "drawSeriesTexts", + value: function drawSeriesTexts(_ref) { + var _ref$shared = _ref.shared, + shared = _ref$shared === void 0 ? true : _ref$shared, + ttItems = _ref.ttItems, + _ref$i = _ref.i, + i = _ref$i === void 0 ? 0 : _ref$i, + _ref$j = _ref.j, + j = _ref$j === void 0 ? null : _ref$j, + y1 = _ref.y1, + y2 = _ref.y2, + e = _ref.e; + var w = this.w; + if (w.config.tooltip.custom !== undefined) { + this.handleCustomTooltip({ + i: i, + j: j, + y1: y1, + y2: y2, + w: w + }); + } else { + this.toggleActiveInactiveSeries(shared, i); + } + var values = this.getValuesToPrint({ + i: i, + j: j + }); + this.printLabels({ + i: i, + j: j, + values: values, + ttItems: ttItems, + shared: shared, + e: e + }); + + // Re-calculate tooltip dimensions now that we have drawn the text + var tooltipEl = this.ttCtx.getElTooltip(); + this.ttCtx.tooltipRect.ttWidth = tooltipEl.getBoundingClientRect().width; + this.ttCtx.tooltipRect.ttHeight = tooltipEl.getBoundingClientRect().height; + } + }, { + key: "printLabels", + value: function printLabels(_ref2) { + var _this = this; + var i = _ref2.i, + j = _ref2.j, + values = _ref2.values, + ttItems = _ref2.ttItems, + shared = _ref2.shared, + e = _ref2.e; + var w = this.w; + var val; + var goalVals = []; + var hasGoalValues = function hasGoalValues(gi) { + return w.globals.seriesGoals[gi] && w.globals.seriesGoals[gi][j] && Array.isArray(w.globals.seriesGoals[gi][j]); + }; + var xVal = values.xVal, + zVal = values.zVal, + xAxisTTVal = values.xAxisTTVal; + var seriesName = ''; + var pColor = w.globals.colors[i]; // The pColor here is for the markers inside tooltip + if (j !== null && w.config.plotOptions.bar.distributed) { + pColor = w.globals.colors[j]; + } + var _loop = function _loop(t, inverset) { + var f = _this.getFormatters(i); + seriesName = _this.getSeriesName({ + fn: f.yLbTitleFormatter, + index: i, + seriesIndex: i, + j: j + }); + if (w.config.chart.type === 'treemap') { + seriesName = f.yLbTitleFormatter(String(w.config.series[i].data[j].x), { + series: w.globals.series, + seriesIndex: i, + dataPointIndex: j, + w: w + }); + } + var tIndex = w.config.tooltip.inverseOrder ? inverset : t; + if (w.globals.axisCharts) { + var getValBySeriesIndex = function getValBySeriesIndex(index) { + if (w.globals.isRangeData) { + var _w$globals$seriesRang, _w$globals$seriesRang2, _w$globals$seriesRang3, _w$globals$seriesRang4; + return f.yLbFormatter((_w$globals$seriesRang = w.globals.seriesRangeStart) === null || _w$globals$seriesRang === void 0 ? void 0 : (_w$globals$seriesRang2 = _w$globals$seriesRang[index]) === null || _w$globals$seriesRang2 === void 0 ? void 0 : _w$globals$seriesRang2[j], { + series: w.globals.seriesRangeStart, + seriesIndex: index, + dataPointIndex: j, + w: w + }) + ' - ' + f.yLbFormatter((_w$globals$seriesRang3 = w.globals.seriesRangeEnd) === null || _w$globals$seriesRang3 === void 0 ? void 0 : (_w$globals$seriesRang4 = _w$globals$seriesRang3[index]) === null || _w$globals$seriesRang4 === void 0 ? void 0 : _w$globals$seriesRang4[j], { + series: w.globals.seriesRangeEnd, + seriesIndex: index, + dataPointIndex: j, + w: w + }); + } + return f.yLbFormatter(w.globals.series[index][j], { + series: w.globals.series, + seriesIndex: index, + dataPointIndex: j, + w: w + }); + }; + if (shared) { + f = _this.getFormatters(tIndex); + seriesName = _this.getSeriesName({ + fn: f.yLbTitleFormatter, + index: tIndex, + seriesIndex: i, + j: j + }); + pColor = w.globals.colors[tIndex]; + val = getValBySeriesIndex(tIndex); + if (hasGoalValues(tIndex)) { + goalVals = w.globals.seriesGoals[tIndex][j].map(function (goal) { + return { + attrs: goal, + val: f.yLbFormatter(goal.value, { + seriesIndex: tIndex, + dataPointIndex: j, + w: w + }) + }; + }); + } + } else { + var _e$target; + // get a color from a hover area (if it's a line pattern then get from a first line) + var targetFill = e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.getAttribute('fill'); + if (targetFill) { + if (targetFill.indexOf('url') !== -1) { + // pattern fill + if (targetFill.indexOf('Pattern') !== -1) { + pColor = w.globals.dom.baseEl.querySelector(targetFill.substr(4).slice(0, -1)).childNodes[0].getAttribute('stroke'); + } + } else { + pColor = targetFill; + } + } + val = getValBySeriesIndex(i); + if (hasGoalValues(i) && Array.isArray(w.globals.seriesGoals[i][j])) { + goalVals = w.globals.seriesGoals[i][j].map(function (goal) { + return { + attrs: goal, + val: f.yLbFormatter(goal.value, { + seriesIndex: i, + dataPointIndex: j, + w: w + }) + }; + }); + } + } + } + + // for pie / donuts + if (j === null) { + val = f.yLbFormatter(w.globals.series[i], _objectSpread2(_objectSpread2({}, w), {}, { + seriesIndex: i, + dataPointIndex: i + })); + } + _this.DOMHandling({ + i: i, + t: tIndex, + j: j, + ttItems: ttItems, + values: { + val: val, + goalVals: goalVals, + xVal: xVal, + xAxisTTVal: xAxisTTVal, + zVal: zVal + }, + seriesName: seriesName, + shared: shared, + pColor: pColor + }); + }; + for (var t = 0, inverset = w.globals.series.length - 1; t < w.globals.series.length; t++, inverset--) { + _loop(t, inverset); + } + } + }, { + key: "getFormatters", + value: function getFormatters(i) { + var w = this.w; + var yLbFormatter = w.globals.yLabelFormatters[i]; + var yLbTitleFormatter; + if (w.globals.ttVal !== undefined) { + if (Array.isArray(w.globals.ttVal)) { + yLbFormatter = w.globals.ttVal[i] && w.globals.ttVal[i].formatter; + yLbTitleFormatter = w.globals.ttVal[i] && w.globals.ttVal[i].title && w.globals.ttVal[i].title.formatter; + } else { + yLbFormatter = w.globals.ttVal.formatter; + if (typeof w.globals.ttVal.title.formatter === 'function') { + yLbTitleFormatter = w.globals.ttVal.title.formatter; + } + } + } else { + yLbTitleFormatter = w.config.tooltip.y.title.formatter; + } + if (typeof yLbFormatter !== 'function') { + if (w.globals.yLabelFormatters[0]) { + yLbFormatter = w.globals.yLabelFormatters[0]; + } else { + yLbFormatter = function yLbFormatter(label) { + return label; + }; + } + } + if (typeof yLbTitleFormatter !== 'function') { + yLbTitleFormatter = function yLbTitleFormatter(label) { + // refrence used from line: 966 in Options.js + return label ? label + ': ' : ''; + }; + } + return { + yLbFormatter: yLbFormatter, + yLbTitleFormatter: yLbTitleFormatter + }; + } + }, { + key: "getSeriesName", + value: function getSeriesName(_ref3) { + var fn = _ref3.fn, + index = _ref3.index, + seriesIndex = _ref3.seriesIndex, + j = _ref3.j; + var w = this.w; + return fn(String(w.globals.seriesNames[index]), { + series: w.globals.series, + seriesIndex: seriesIndex, + dataPointIndex: j, + w: w + }); + } + }, { + key: "DOMHandling", + value: function DOMHandling(_ref4) { + _ref4.i; + var t = _ref4.t, + j = _ref4.j, + ttItems = _ref4.ttItems, + values = _ref4.values, + seriesName = _ref4.seriesName, + shared = _ref4.shared, + pColor = _ref4.pColor; + var w = this.w; + var ttCtx = this.ttCtx; + var val = values.val, + goalVals = values.goalVals, + xVal = values.xVal, + xAxisTTVal = values.xAxisTTVal, + zVal = values.zVal; + var ttItemsChildren = null; + ttItemsChildren = ttItems[t].children; + if (w.config.tooltip.fillSeriesColor) { + ttItems[t].style.backgroundColor = pColor; + ttItemsChildren[0].style.display = 'none'; + } + if (ttCtx.showTooltipTitle) { + if (ttCtx.tooltipTitle === null) { + // get it once if null, and store it in class property + ttCtx.tooltipTitle = w.globals.dom.baseEl.querySelector('.apexcharts-tooltip-title'); + } + ttCtx.tooltipTitle.innerHTML = xVal; + } + + // if xaxis tooltip is constructed, we need to replace the innerHTML + if (ttCtx.isXAxisTooltipEnabled) { + ttCtx.xaxisTooltipText.innerHTML = xAxisTTVal !== '' ? xAxisTTVal : xVal; + } + var ttYLabel = ttItems[t].querySelector('.apexcharts-tooltip-text-y-label'); + if (ttYLabel) { + ttYLabel.innerHTML = seriesName ? seriesName : ''; + } + var ttYVal = ttItems[t].querySelector('.apexcharts-tooltip-text-y-value'); + if (ttYVal) { + ttYVal.innerHTML = typeof val !== 'undefined' ? val : ''; + } + if (ttItemsChildren[0] && ttItemsChildren[0].classList.contains('apexcharts-tooltip-marker')) { + if (w.config.tooltip.marker.fillColors && Array.isArray(w.config.tooltip.marker.fillColors)) { + pColor = w.config.tooltip.marker.fillColors[t]; + } + if (w.config.tooltip.fillSeriesColor) { + ttItemsChildren[0].style.backgroundColor = pColor; + } else { + ttItemsChildren[0].style.color = pColor; + } + } + if (!w.config.tooltip.marker.show) { + ttItemsChildren[0].style.display = 'none'; + } + var ttGLabel = ttItems[t].querySelector('.apexcharts-tooltip-text-goals-label'); + var ttGVal = ttItems[t].querySelector('.apexcharts-tooltip-text-goals-value'); + if (goalVals.length && w.globals.seriesGoals[t]) { + var createGoalsHtml = function createGoalsHtml() { + var gLabels = '
'; + var gVals = '
'; + goalVals.forEach(function (goal, gi) { + gLabels += "
").concat(goal.attrs.name, "
"); + gVals += "
".concat(goal.val, "
"); + }); + ttGLabel.innerHTML = gLabels + "
"; + ttGVal.innerHTML = gVals + "
"; + }; + if (shared) { + if (w.globals.seriesGoals[t][j] && Array.isArray(w.globals.seriesGoals[t][j])) { + createGoalsHtml(); + } else { + ttGLabel.innerHTML = ''; + ttGVal.innerHTML = ''; + } + } else { + createGoalsHtml(); + } + } else { + ttGLabel.innerHTML = ''; + ttGVal.innerHTML = ''; + } + if (zVal !== null) { + var ttZLabel = ttItems[t].querySelector('.apexcharts-tooltip-text-z-label'); + ttZLabel.innerHTML = w.config.tooltip.z.title; + var ttZVal = ttItems[t].querySelector('.apexcharts-tooltip-text-z-value'); + ttZVal.innerHTML = typeof zVal !== 'undefined' ? zVal : ''; + } + if (shared && ttItemsChildren[0]) { + // hide when no Val or series collapsed + if (w.config.tooltip.hideEmptySeries) { + var ttItemMarker = ttItems[t].querySelector('.apexcharts-tooltip-marker'); + var ttItemText = ttItems[t].querySelector('.apexcharts-tooltip-text'); + if (parseFloat(val) == 0) { + ttItemMarker.style.display = 'none'; + ttItemText.style.display = 'none'; + } else { + ttItemMarker.style.display = 'block'; + ttItemText.style.display = 'block'; + } + } + if (typeof val === 'undefined' || val === null || w.globals.ancillaryCollapsedSeriesIndices.indexOf(t) > -1 || w.globals.collapsedSeriesIndices.indexOf(t) > -1 || Array.isArray(ttCtx.tConfig.enabledOnSeries) && ttCtx.tConfig.enabledOnSeries.indexOf(t) === -1) { + ttItemsChildren[0].parentNode.style.display = 'none'; + } else { + ttItemsChildren[0].parentNode.style.display = w.config.tooltip.items.display; + } + } else { + if (Array.isArray(ttCtx.tConfig.enabledOnSeries) && ttCtx.tConfig.enabledOnSeries.indexOf(t) === -1) { + ttItemsChildren[0].parentNode.style.display = 'none'; + } + } + } + }, { + key: "toggleActiveInactiveSeries", + value: function toggleActiveInactiveSeries(shared, i) { + var w = this.w; + if (shared) { + // make all tooltips active + this.tooltipUtil.toggleAllTooltipSeriesGroups('enable'); + } else { + // disable all tooltip text groups + this.tooltipUtil.toggleAllTooltipSeriesGroups('disable'); + + // enable the first tooltip text group + var firstTooltipSeriesGroup = w.globals.dom.baseEl.querySelector(".apexcharts-tooltip-series-group-".concat(i)); + if (firstTooltipSeriesGroup) { + firstTooltipSeriesGroup.classList.add('apexcharts-active'); + firstTooltipSeriesGroup.style.display = w.config.tooltip.items.display; + } + } + } + }, { + key: "getValuesToPrint", + value: function getValuesToPrint(_ref5) { + var i = _ref5.i, + j = _ref5.j; + var w = this.w; + var filteredSeriesX = this.ctx.series.filteredSeriesX(); + var xVal = ''; + var xAxisTTVal = ''; + var zVal = null; + var val = null; + var customFormatterOpts = { + series: w.globals.series, + seriesIndex: i, + dataPointIndex: j, + w: w + }; + var zFormatter = w.globals.ttZFormatter; + if (j === null) { + val = w.globals.series[i]; + } else { + if (w.globals.isXNumeric && w.config.chart.type !== 'treemap') { + xVal = filteredSeriesX[i][j]; + if (filteredSeriesX[i].length === 0) { + // a series (possibly the first one) might be collapsed, so get the next active index + var firstActiveSeriesIndex = this.tooltipUtil.getFirstActiveXArray(filteredSeriesX); + xVal = filteredSeriesX[firstActiveSeriesIndex][j]; + } + } else { + var dataFormat = new Data(this.ctx); + if (dataFormat.isFormatXY()) { + xVal = typeof w.config.series[i].data[j] !== 'undefined' ? w.config.series[i].data[j].x : ''; + } else { + xVal = typeof w.globals.labels[j] !== 'undefined' ? w.globals.labels[j] : ''; + } + } + } + var bufferXVal = xVal; + if (w.globals.isXNumeric && w.config.xaxis.type === 'datetime') { + var xFormat = new Formatters(this.ctx); + xVal = xFormat.xLabelFormat(w.globals.ttKeyFormatter, bufferXVal, bufferXVal, { + i: undefined, + dateFormatter: new DateTime(this.ctx).formatDate, + w: this.w + }); + } else { + if (w.globals.isBarHorizontal) { + xVal = w.globals.yLabelFormatters[0](bufferXVal, customFormatterOpts); + } else { + xVal = w.globals.xLabelFormatter(bufferXVal, customFormatterOpts); + } + } + + // override default x-axis formatter with tooltip formatter + if (w.config.tooltip.x.formatter !== undefined) { + xVal = w.globals.ttKeyFormatter(bufferXVal, customFormatterOpts); + } + if (w.globals.seriesZ.length > 0 && w.globals.seriesZ[i].length > 0) { + zVal = zFormatter(w.globals.seriesZ[i][j], w); + } + if (typeof w.config.xaxis.tooltip.formatter === 'function') { + xAxisTTVal = w.globals.xaxisTooltipFormatter(bufferXVal, customFormatterOpts); + } else { + xAxisTTVal = xVal; + } + return { + val: Array.isArray(val) ? val.join(' ') : val, + xVal: Array.isArray(xVal) ? xVal.join(' ') : xVal, + xAxisTTVal: Array.isArray(xAxisTTVal) ? xAxisTTVal.join(' ') : xAxisTTVal, + zVal: zVal + }; + } + }, { + key: "handleCustomTooltip", + value: function handleCustomTooltip(_ref6) { + var i = _ref6.i, + j = _ref6.j, + y1 = _ref6.y1, + y2 = _ref6.y2, + w = _ref6.w; + var tooltipEl = this.ttCtx.getElTooltip(); + var fn = w.config.tooltip.custom; + if (Array.isArray(fn) && fn[i]) { + fn = fn[i]; + } + var customTooltip = fn({ + ctx: this.ctx, + series: w.globals.series, + seriesIndex: i, + dataPointIndex: j, + y1: y1, + y2: y2, + w: w + }); + if (typeof customTooltip === 'string') { + tooltipEl.innerHTML = customTooltip; + } else if (customTooltip instanceof Element || typeof customTooltip.nodeName === 'string') { + tooltipEl.innerHTML = ''; + tooltipEl.appendChild(customTooltip.cloneNode(true)); + } + } + }]); + return Labels; + }(); + + /** + * ApexCharts Tooltip.Position Class to move the tooltip based on x and y position. + * + * @module Tooltip.Position + **/ + var Position = /*#__PURE__*/function () { + function Position(tooltipContext) { + _classCallCheck(this, Position); + this.ttCtx = tooltipContext; + this.ctx = tooltipContext.ctx; + this.w = tooltipContext.w; + } + + /** + * This will move the crosshair (the vertical/horz line that moves along with mouse) + * Along with this, this function also calls the xaxisMove function + * @memberof Position + * @param {int} - cx = point's x position, wherever point's x is, you need to move crosshair + */ + _createClass(Position, [{ + key: "moveXCrosshairs", + value: function moveXCrosshairs(cx) { + var j = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + var ttCtx = this.ttCtx; + var w = this.w; + var xcrosshairs = ttCtx.getElXCrosshairs(); + var x = cx - ttCtx.xcrosshairsWidth / 2; + var tickAmount = w.globals.labels.slice().length; + if (j !== null) { + x = w.globals.gridWidth / tickAmount * j; + } + if (xcrosshairs !== null && !w.globals.isBarHorizontal) { + xcrosshairs.setAttribute('x', x); + xcrosshairs.setAttribute('x1', x); + xcrosshairs.setAttribute('x2', x); + xcrosshairs.setAttribute('y2', w.globals.gridHeight); + xcrosshairs.classList.add('apexcharts-active'); + } + if (x < 0) { + x = 0; + } + if (x > w.globals.gridWidth) { + x = w.globals.gridWidth; + } + if (ttCtx.isXAxisTooltipEnabled) { + var tx = x; + if (w.config.xaxis.crosshairs.width === 'tickWidth' || w.config.xaxis.crosshairs.width === 'barWidth') { + tx = x + ttCtx.xcrosshairsWidth / 2; + } + this.moveXAxisTooltip(tx); + } + } + + /** + * This will move the crosshair (the vertical/horz line that moves along with mouse) + * Along with this, this function also calls the xaxisMove function + * @memberof Position + * @param {int} - cx = point's x position, wherever point's x is, you need to move crosshair + */ + }, { + key: "moveYCrosshairs", + value: function moveYCrosshairs(cy) { + var ttCtx = this.ttCtx; + if (ttCtx.ycrosshairs !== null) { + Graphics.setAttrs(ttCtx.ycrosshairs, { + y1: cy, + y2: cy + }); + } + if (ttCtx.ycrosshairsHidden !== null) { + Graphics.setAttrs(ttCtx.ycrosshairsHidden, { + y1: cy, + y2: cy + }); + } + } + + /** + ** AxisTooltip is the small rectangle which appears on x axis with x value, when user moves + * @memberof Position + * @param {int} - cx = point's x position, wherever point's x is, you need to move + */ + }, { + key: "moveXAxisTooltip", + value: function moveXAxisTooltip(cx) { + var w = this.w; + var ttCtx = this.ttCtx; + if (ttCtx.xaxisTooltip !== null && ttCtx.xcrosshairsWidth !== 0) { + ttCtx.xaxisTooltip.classList.add('apexcharts-active'); + var cy = ttCtx.xaxisOffY + w.config.xaxis.tooltip.offsetY + w.globals.translateY + 1 + w.config.xaxis.offsetY; + var xaxisTTText = ttCtx.xaxisTooltip.getBoundingClientRect(); + var xaxisTTTextWidth = xaxisTTText.width; + cx = cx - xaxisTTTextWidth / 2; + if (!isNaN(cx)) { + cx = cx + w.globals.translateX; + var textRect = 0; + var graphics = new Graphics(this.ctx); + textRect = graphics.getTextRects(ttCtx.xaxisTooltipText.innerHTML); + ttCtx.xaxisTooltipText.style.minWidth = textRect.width + 'px'; + ttCtx.xaxisTooltip.style.left = cx + 'px'; + ttCtx.xaxisTooltip.style.top = cy + 'px'; + } + } + } + }, { + key: "moveYAxisTooltip", + value: function moveYAxisTooltip(index) { + var w = this.w; + var ttCtx = this.ttCtx; + if (ttCtx.yaxisTTEls === null) { + ttCtx.yaxisTTEls = w.globals.dom.baseEl.querySelectorAll('.apexcharts-yaxistooltip'); + } + var ycrosshairsHiddenRectY1 = parseInt(ttCtx.ycrosshairsHidden.getAttribute('y1'), 10); + var cy = w.globals.translateY + ycrosshairsHiddenRectY1; + var yAxisTTRect = ttCtx.yaxisTTEls[index].getBoundingClientRect(); + var yAxisTTHeight = yAxisTTRect.height; + var cx = w.globals.translateYAxisX[index] - 2; + if (w.config.yaxis[index].opposite) { + cx = cx - 26; + } + cy = cy - yAxisTTHeight / 2; + if (w.globals.ignoreYAxisIndexes.indexOf(index) === -1) { + ttCtx.yaxisTTEls[index].classList.add('apexcharts-active'); + ttCtx.yaxisTTEls[index].style.top = cy + 'px'; + ttCtx.yaxisTTEls[index].style.left = cx + w.config.yaxis[index].tooltip.offsetX + 'px'; + } else { + ttCtx.yaxisTTEls[index].classList.remove('apexcharts-active'); + } + } + + /** + ** moves the whole tooltip by changing x, y attrs + * @memberof Position + * @param {int} - cx = point's x position, wherever point's x is, you need to move tooltip + * @param {int} - cy = point's y position, wherever point's y is, you need to move tooltip + * @param {int} - markerSize = point's size + */ + }, { + key: "moveTooltip", + value: function moveTooltip(cx, cy) { + var markerSize = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + var w = this.w; + var ttCtx = this.ttCtx; + var tooltipEl = ttCtx.getElTooltip(); + var tooltipRect = ttCtx.tooltipRect; + var pointSize = markerSize !== null ? parseFloat(markerSize) : 1; + var x = parseFloat(cx) + pointSize + 5; + var y = parseFloat(cy) + pointSize / 2; // - tooltipRect.ttHeight / 2 + + if (x > w.globals.gridWidth / 2) { + x = x - tooltipRect.ttWidth - pointSize - 10; + } + if (x > w.globals.gridWidth - tooltipRect.ttWidth - 10) { + x = w.globals.gridWidth - tooltipRect.ttWidth; + } + if (x < -20) { + x = -20; + } + if (w.config.tooltip.followCursor) { + var elGrid = ttCtx.getElGrid(); + var seriesBound = elGrid.getBoundingClientRect(); + x = ttCtx.e.clientX - seriesBound.left; + if (x > w.globals.gridWidth / 2) { + x = x - ttCtx.tooltipRect.ttWidth; + } + y = ttCtx.e.clientY + w.globals.translateY - seriesBound.top; + if (y > w.globals.gridHeight / 2) { + y = y - ttCtx.tooltipRect.ttHeight; + } + } else { + if (!w.globals.isBarHorizontal) { + if (tooltipRect.ttHeight / 2 + y > w.globals.gridHeight) { + y = w.globals.gridHeight - tooltipRect.ttHeight + w.globals.translateY; + } + } + } + if (!isNaN(x)) { + x = x + w.globals.translateX; + tooltipEl.style.left = x + 'px'; + tooltipEl.style.top = y + 'px'; + } + } + }, { + key: "moveMarkers", + value: function moveMarkers(i, j) { + var w = this.w; + var ttCtx = this.ttCtx; + if (w.globals.markers.size[i] > 0) { + var allPoints = w.globals.dom.baseEl.querySelectorAll(" .apexcharts-series[data\\:realIndex='".concat(i, "'] .apexcharts-marker")); + for (var p = 0; p < allPoints.length; p++) { + if (parseInt(allPoints[p].getAttribute('rel'), 10) === j) { + ttCtx.marker.resetPointsSize(); + ttCtx.marker.enlargeCurrentPoint(j, allPoints[p]); + } + } + } else { + ttCtx.marker.resetPointsSize(); + this.moveDynamicPointOnHover(j, i); + } + } + + // This function is used when you need to show markers/points only on hover - + // DIFFERENT X VALUES in multiple series + }, { + key: "moveDynamicPointOnHover", + value: function moveDynamicPointOnHover(j, capturedSeries) { + var _pointsArr$capturedSe, _pointsArr$capturedSe2; + var w = this.w; + var ttCtx = this.ttCtx; + var cx = 0; + var cy = 0; + var graphics = new Graphics(this.ctx); + var pointsArr = w.globals.pointsArray; + var hoverSize = ttCtx.tooltipUtil.getHoverMarkerSize(capturedSeries); + var serType = w.config.series[capturedSeries].type; + if (serType && (serType === 'column' || serType === 'candlestick' || serType === 'boxPlot')) { + // fix error mentioned in #811 + return; + } + cx = (_pointsArr$capturedSe = pointsArr[capturedSeries][j]) === null || _pointsArr$capturedSe === void 0 ? void 0 : _pointsArr$capturedSe[0]; + cy = ((_pointsArr$capturedSe2 = pointsArr[capturedSeries][j]) === null || _pointsArr$capturedSe2 === void 0 ? void 0 : _pointsArr$capturedSe2[1]) || 0; + var point = w.globals.dom.baseEl.querySelector(".apexcharts-series[data\\:realIndex='".concat(capturedSeries, "'] .apexcharts-series-markers path")); + if (point && cy < w.globals.gridHeight && cy > 0) { + var shape = point.getAttribute('shape'); + var path = graphics.getMarkerPath(cx, cy, shape, hoverSize * 1.5); + point.setAttribute('d', path); + } + this.moveXCrosshairs(cx); + if (!ttCtx.fixedTooltip) { + this.moveTooltip(cx, cy, hoverSize); + } + } + + // This function is used when you need to show markers/points only on hover - + // SAME X VALUES in multiple series + }, { + key: "moveDynamicPointsOnHover", + value: function moveDynamicPointsOnHover(j) { + var ttCtx = this.ttCtx; + var w = ttCtx.w; + var cx = 0; + var cy = 0; + var activeSeries = 0; + var pointsArr = w.globals.pointsArray; + var series = new Series(this.ctx); + var graphics = new Graphics(this.ctx); + activeSeries = series.getActiveConfigSeriesIndex('asc', ['line', 'area', 'scatter', 'bubble']); + var hoverSize = ttCtx.tooltipUtil.getHoverMarkerSize(activeSeries); + if (pointsArr[activeSeries]) { + cx = pointsArr[activeSeries][j][0]; + cy = pointsArr[activeSeries][j][1]; + } + if (isNaN(cx)) { + return; + } + var points = ttCtx.tooltipUtil.getAllMarkers(); + if (points.length) { + for (var p = 0; p < w.globals.series.length; p++) { + var pointArr = pointsArr[p]; + if (w.globals.comboCharts) { + // in a combo chart, if column charts are present, markers will not match with the number of series, hence this patch to push a null value in points array + if (typeof pointArr === 'undefined') { + // nodelist to array + points.splice(p, 0, null); + } + } + if (pointArr && pointArr.length) { + var pcy = pointsArr[p][j][1]; + var pcy2 = void 0; + points[p].setAttribute('cx', cx); + var shape = points[p].getAttribute('shape'); + if (w.config.chart.type === 'rangeArea' && !w.globals.comboCharts) { + var rangeStartIndex = j + w.globals.series[p].length; + pcy2 = pointsArr[p][rangeStartIndex][1]; + var pcyDiff = Math.abs(pcy - pcy2) / 2; + pcy = pcy - pcyDiff; + } + if (pcy !== null && !isNaN(pcy) && pcy < w.globals.gridHeight + hoverSize && pcy + hoverSize > 0) { + var path = graphics.getMarkerPath(cx, pcy, shape, hoverSize); + points[p].setAttribute('d', path); + } else { + points[p].setAttribute('d', ''); + } + } + } + } + this.moveXCrosshairs(cx); + if (!ttCtx.fixedTooltip) { + this.moveTooltip(cx, cy || w.globals.gridHeight, hoverSize); + } + } + }, { + key: "moveStickyTooltipOverBars", + value: function moveStickyTooltipOverBars(j, capturedSeries) { + var w = this.w; + var ttCtx = this.ttCtx; + var barLen = w.globals.columnSeries ? w.globals.columnSeries.length : w.globals.series.length; + if (w.config.chart.stacked) { + barLen = w.globals.barGroups.length; + } + var i = barLen >= 2 && barLen % 2 === 0 ? Math.floor(barLen / 2) : Math.floor(barLen / 2) + 1; + if (w.globals.isBarHorizontal) { + var series = new Series(this.ctx); + i = series.getActiveConfigSeriesIndex('desc') + 1; + } + var jBar = w.globals.dom.baseEl.querySelector(".apexcharts-bar-series .apexcharts-series[rel='".concat(i, "'] path[j='").concat(j, "'], .apexcharts-candlestick-series .apexcharts-series[rel='").concat(i, "'] path[j='").concat(j, "'], .apexcharts-boxPlot-series .apexcharts-series[rel='").concat(i, "'] path[j='").concat(j, "'], .apexcharts-rangebar-series .apexcharts-series[rel='").concat(i, "'] path[j='").concat(j, "']")); + if (!jBar && typeof capturedSeries === 'number') { + // Try with captured series index + jBar = w.globals.dom.baseEl.querySelector(".apexcharts-bar-series .apexcharts-series[data\\:realIndex='".concat(capturedSeries, "'] path[j='").concat(j, "'],\n .apexcharts-candlestick-series .apexcharts-series[data\\:realIndex='").concat(capturedSeries, "'] path[j='").concat(j, "'],\n .apexcharts-boxPlot-series .apexcharts-series[data\\:realIndex='").concat(capturedSeries, "'] path[j='").concat(j, "'],\n .apexcharts-rangebar-series .apexcharts-series[data\\:realIndex='").concat(capturedSeries, "'] path[j='").concat(j, "']")); + } + var bcx = jBar ? parseFloat(jBar.getAttribute('cx')) : 0; + var bcy = jBar ? parseFloat(jBar.getAttribute('cy')) : 0; + var bw = jBar ? parseFloat(jBar.getAttribute('barWidth')) : 0; + var elGrid = ttCtx.getElGrid(); + var seriesBound = elGrid.getBoundingClientRect(); + var isBoxOrCandle = jBar && (jBar.classList.contains('apexcharts-candlestick-area') || jBar.classList.contains('apexcharts-boxPlot-area')); + if (w.globals.isXNumeric) { + if (jBar && !isBoxOrCandle) { + bcx = bcx - (barLen % 2 !== 0 ? bw / 2 : 0); + } + if (jBar && + // fixes apexcharts.js#2354 + isBoxOrCandle) { + bcx = bcx - bw / 2; + } + } else { + if (!w.globals.isBarHorizontal) { + bcx = ttCtx.xAxisTicksPositions[j - 1] + ttCtx.dataPointsDividedWidth / 2; + if (isNaN(bcx)) { + bcx = ttCtx.xAxisTicksPositions[j] - ttCtx.dataPointsDividedWidth / 2; + } + } + } + if (!w.globals.isBarHorizontal) { + if (w.config.tooltip.followCursor) { + bcy = ttCtx.e.clientY - seriesBound.top - ttCtx.tooltipRect.ttHeight / 2; + } else { + if (bcy + ttCtx.tooltipRect.ttHeight + 15 > w.globals.gridHeight) { + bcy = w.globals.gridHeight; + } + } + } else { + bcy = bcy - ttCtx.tooltipRect.ttHeight; + } + if (!w.globals.isBarHorizontal) { + this.moveXCrosshairs(bcx); + } + if (!ttCtx.fixedTooltip) { + this.moveTooltip(bcx, bcy || w.globals.gridHeight); + } + } + }]); + return Position; + }(); + + /** + * ApexCharts Tooltip.Marker Class to draw texts on the tooltip. + * This file deals with the markers that appear near tooltip in line/area charts. + * These markers helps the user to associate the data-points and the values + * that are shown in the tooltip + * + * @module Tooltip.Marker + **/ + var Marker = /*#__PURE__*/function () { + function Marker(tooltipContext) { + _classCallCheck(this, Marker); + this.w = tooltipContext.w; + this.ttCtx = tooltipContext; + this.ctx = tooltipContext.ctx; + this.tooltipPosition = new Position(tooltipContext); + } + _createClass(Marker, [{ + key: "drawDynamicPoints", + value: function drawDynamicPoints() { + var w = this.w; + var graphics = new Graphics(this.ctx); + var marker = new Markers(this.ctx); + var elsSeries = w.globals.dom.baseEl.querySelectorAll('.apexcharts-series'); + elsSeries = _toConsumableArray(elsSeries); + if (w.config.chart.stacked) { + elsSeries.sort(function (a, b) { + return parseFloat(a.getAttribute('data:realIndex')) - parseFloat(b.getAttribute('data:realIndex')); + }); + } + for (var i = 0; i < elsSeries.length; i++) { + var pointsMain = elsSeries[i].querySelector(".apexcharts-series-markers-wrap"); + if (pointsMain !== null) { + // it can be null as we have tooltips in donut/bar charts + var point = void 0; + var PointClasses = "apexcharts-marker w".concat((Math.random() + 1).toString(36).substring(4)); + if ((w.config.chart.type === 'line' || w.config.chart.type === 'area') && !w.globals.comboCharts && !w.config.tooltip.intersect) { + PointClasses += ' no-pointer-events'; + } + var elPointOptions = marker.getMarkerConfig({ + cssClass: PointClasses, + seriesIndex: Number(pointsMain.getAttribute('data:realIndex')) // fixes apexcharts/apexcharts.js #1427 + }); + point = graphics.drawMarker(0, 0, elPointOptions); + point.node.setAttribute('default-marker-size', 0); + var elPointsG = document.createElementNS(w.globals.SVGNS, 'g'); + elPointsG.classList.add('apexcharts-series-markers'); + elPointsG.appendChild(point.node); + pointsMain.appendChild(elPointsG); + } + } + } + }, { + key: "enlargeCurrentPoint", + value: function enlargeCurrentPoint(rel, point) { + var x = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + var y = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; + var w = this.w; + if (w.config.chart.type !== 'bubble') { + this.newPointSize(rel, point); + } + var cx = point.getAttribute('cx'); + var cy = point.getAttribute('cy'); + if (x !== null && y !== null) { + cx = x; + cy = y; + } + this.tooltipPosition.moveXCrosshairs(cx); + if (!this.fixedTooltip) { + if (w.config.chart.type === 'radar') { + var elGrid = this.ttCtx.getElGrid(); + var seriesBound = elGrid.getBoundingClientRect(); + cx = this.ttCtx.e.clientX - seriesBound.left; + } + this.tooltipPosition.moveTooltip(cx, cy, w.config.markers.hover.size); + } + } + }, { + key: "enlargePoints", + value: function enlargePoints(j) { + var w = this.w; + var me = this; + var ttCtx = this.ttCtx; + var col = j; + var points = w.globals.dom.baseEl.querySelectorAll('.apexcharts-series:not(.apexcharts-series-collapsed) .apexcharts-marker'); + var newSize = w.config.markers.hover.size; + for (var p = 0; p < points.length; p++) { + var rel = points[p].getAttribute('rel'); + var index = points[p].getAttribute('index'); + if (newSize === undefined) { + newSize = w.globals.markers.size[index] + w.config.markers.hover.sizeOffset; + } + if (col === parseInt(rel, 10)) { + me.newPointSize(col, points[p]); + var cx = points[p].getAttribute('cx'); + var cy = points[p].getAttribute('cy'); + me.tooltipPosition.moveXCrosshairs(cx); + if (!ttCtx.fixedTooltip) { + me.tooltipPosition.moveTooltip(cx, cy, newSize); + } + } else { + me.oldPointSize(points[p]); + } + } + } + }, { + key: "newPointSize", + value: function newPointSize(rel, point) { + var w = this.w; + var newSize = w.config.markers.hover.size; + var elPoint = rel === 0 ? point.parentNode.firstChild : point.parentNode.lastChild; + if (elPoint.getAttribute('default-marker-size') !== '0') { + var index = parseInt(elPoint.getAttribute('index'), 10); + if (newSize === undefined) { + newSize = w.globals.markers.size[index] + w.config.markers.hover.sizeOffset; + } + if (newSize < 0) { + newSize = 0; + } + var path = this.ttCtx.tooltipUtil.getPathFromPoint(point, newSize); + point.setAttribute('d', path); + } + } + }, { + key: "oldPointSize", + value: function oldPointSize(point) { + var size = parseFloat(point.getAttribute('default-marker-size')); + var path = this.ttCtx.tooltipUtil.getPathFromPoint(point, size); + point.setAttribute('d', path); + } + }, { + key: "resetPointsSize", + value: function resetPointsSize() { + var w = this.w; + var points = w.globals.dom.baseEl.querySelectorAll('.apexcharts-series:not(.apexcharts-series-collapsed) .apexcharts-marker'); + for (var p = 0; p < points.length; p++) { + var size = parseFloat(points[p].getAttribute('default-marker-size')); + if (Utils$1.isNumber(size) && size > 0) { + var path = this.ttCtx.tooltipUtil.getPathFromPoint(points[p], size); + points[p].setAttribute('d', path); + } else { + points[p].setAttribute('d', 'M0,0'); + } + } + } + }]); + return Marker; + }(); + + /** + * ApexCharts Tooltip.Intersect Class. + * This file deals with functions related to intersecting tooltips + * (tooltips that appear when user hovers directly over a data-point whether) + * + * @module Tooltip.Intersect + **/ + var Intersect = /*#__PURE__*/function () { + function Intersect(tooltipContext) { + _classCallCheck(this, Intersect); + this.w = tooltipContext.w; + var w = this.w; + this.ttCtx = tooltipContext; + this.isVerticalGroupedRangeBar = !w.globals.isBarHorizontal && w.config.chart.type === 'rangeBar' && w.config.plotOptions.bar.rangeBarGroupRows; + } + + // a helper function to get an element's attribute value + _createClass(Intersect, [{ + key: "getAttr", + value: function getAttr(e, attr) { + return parseFloat(e.target.getAttribute(attr)); + } + + // handle tooltip for heatmaps and treemaps + }, { + key: "handleHeatTreeTooltip", + value: function handleHeatTreeTooltip(_ref) { + var e = _ref.e, + opt = _ref.opt, + x = _ref.x, + y = _ref.y, + type = _ref.type; + var ttCtx = this.ttCtx; + var w = this.w; + if (e.target.classList.contains("apexcharts-".concat(type, "-rect"))) { + var i = this.getAttr(e, 'i'); + var j = this.getAttr(e, 'j'); + var cx = this.getAttr(e, 'cx'); + var cy = this.getAttr(e, 'cy'); + var width = this.getAttr(e, 'width'); + var height = this.getAttr(e, 'height'); + ttCtx.tooltipLabels.drawSeriesTexts({ + ttItems: opt.ttItems, + i: i, + j: j, + shared: false, + e: e + }); + w.globals.capturedSeriesIndex = i; + w.globals.capturedDataPointIndex = j; + x = cx + ttCtx.tooltipRect.ttWidth / 2 + width; + y = cy + ttCtx.tooltipRect.ttHeight / 2 - height / 2; + ttCtx.tooltipPosition.moveXCrosshairs(cx + width / 2); + if (x > w.globals.gridWidth / 2) { + x = cx - ttCtx.tooltipRect.ttWidth / 2 + width; + } + if (ttCtx.w.config.tooltip.followCursor) { + var seriesBound = w.globals.dom.elWrap.getBoundingClientRect(); + x = w.globals.clientX - seriesBound.left - (x > w.globals.gridWidth / 2 ? ttCtx.tooltipRect.ttWidth : 0); + y = w.globals.clientY - seriesBound.top - (y > w.globals.gridHeight / 2 ? ttCtx.tooltipRect.ttHeight : 0); + } + } + return { + x: x, + y: y + }; + } + + /** + * handle tooltips for line/area/scatter charts where tooltip.intersect is true + * when user hovers over the marker directly, this function is executed + */ + }, { + key: "handleMarkerTooltip", + value: function handleMarkerTooltip(_ref2) { + var e = _ref2.e, + opt = _ref2.opt, + x = _ref2.x, + y = _ref2.y; + var w = this.w; + var ttCtx = this.ttCtx; + var i; + var j; + if (e.target.classList.contains('apexcharts-marker')) { + var cx = parseInt(opt.paths.getAttribute('cx'), 10); + var cy = parseInt(opt.paths.getAttribute('cy'), 10); + var val = parseFloat(opt.paths.getAttribute('val')); + j = parseInt(opt.paths.getAttribute('rel'), 10); + i = parseInt(opt.paths.parentNode.parentNode.parentNode.getAttribute('rel'), 10) - 1; + if (ttCtx.intersect) { + var el = Utils$1.findAncestor(opt.paths, 'apexcharts-series'); + if (el) { + i = parseInt(el.getAttribute('data:realIndex'), 10); + } + } + ttCtx.tooltipLabels.drawSeriesTexts({ + ttItems: opt.ttItems, + i: i, + j: j, + shared: ttCtx.showOnIntersect ? false : w.config.tooltip.shared, + e: e + }); + if (e.type === 'mouseup') { + ttCtx.markerClick(e, i, j); + } + w.globals.capturedSeriesIndex = i; + w.globals.capturedDataPointIndex = j; + x = cx; + y = cy + w.globals.translateY - ttCtx.tooltipRect.ttHeight * 1.4; + if (ttCtx.w.config.tooltip.followCursor) { + var elGrid = ttCtx.getElGrid(); + var seriesBound = elGrid.getBoundingClientRect(); + y = ttCtx.e.clientY + w.globals.translateY - seriesBound.top; + } + if (val < 0) { + y = cy; + } + ttCtx.marker.enlargeCurrentPoint(j, opt.paths, x, y); + } + return { + x: x, + y: y + }; + } + + /** + * handle tooltips for bar/column charts + */ + }, { + key: "handleBarTooltip", + value: function handleBarTooltip(_ref3) { + var e = _ref3.e, + opt = _ref3.opt; + var w = this.w; + var ttCtx = this.ttCtx; + var tooltipEl = ttCtx.getElTooltip(); + var bx = 0; + var x = 0; + var y = 0; + var i = 0; + var strokeWidth; + var barXY = this.getBarTooltipXY({ + e: e, + opt: opt + }); + if (barXY.j === null && barXY.barHeight === 0 && barXY.barWidth === 0) { + return; // bar was not hovered and didn't receive correct coords + } + i = barXY.i; + var j = barXY.j; + w.globals.capturedSeriesIndex = i; + w.globals.capturedDataPointIndex = j; + if (w.globals.isBarHorizontal && ttCtx.tooltipUtil.hasBars() || !w.config.tooltip.shared) { + x = barXY.x; + y = barXY.y; + strokeWidth = Array.isArray(w.config.stroke.width) ? w.config.stroke.width[i] : w.config.stroke.width; + bx = x; + } else { + if (!w.globals.comboCharts && !w.config.tooltip.shared) { + // todo: re-check this condition as it's always 0 + bx = bx / 2; + } + } + + // y is NaN, make it touch the bottom of grid area + if (isNaN(y)) { + y = w.globals.svgHeight - ttCtx.tooltipRect.ttHeight; + } + parseInt(opt.paths.parentNode.getAttribute('data:realIndex'), 10); + if (x + ttCtx.tooltipRect.ttWidth > w.globals.gridWidth) { + x = x - ttCtx.tooltipRect.ttWidth; + } else if (x < 0) { + x = 0; + } + if (ttCtx.w.config.tooltip.followCursor) { + var elGrid = ttCtx.getElGrid(); + var seriesBound = elGrid.getBoundingClientRect(); + y = ttCtx.e.clientY - seriesBound.top; + } + + // if tooltip is still null, querySelector + if (ttCtx.tooltip === null) { + ttCtx.tooltip = w.globals.dom.baseEl.querySelector('.apexcharts-tooltip'); + } + if (!w.config.tooltip.shared) { + if (w.globals.comboBarCount > 0) { + ttCtx.tooltipPosition.moveXCrosshairs(bx + strokeWidth / 2); + } else { + ttCtx.tooltipPosition.moveXCrosshairs(bx); + } + } + + // move tooltip here + if (!ttCtx.fixedTooltip && (!w.config.tooltip.shared || w.globals.isBarHorizontal && ttCtx.tooltipUtil.hasBars())) { + y = y + w.globals.translateY - ttCtx.tooltipRect.ttHeight / 2; + tooltipEl.style.left = x + w.globals.translateX + 'px'; + tooltipEl.style.top = y + 'px'; + } + } + }, { + key: "getBarTooltipXY", + value: function getBarTooltipXY(_ref4) { + var _this = this; + var e = _ref4.e, + opt = _ref4.opt; + var w = this.w; + var j = null; + var ttCtx = this.ttCtx; + var i = 0; + var x = 0; + var y = 0; + var barWidth = 0; + var barHeight = 0; + var cl = e.target.classList; + if (cl.contains('apexcharts-bar-area') || cl.contains('apexcharts-candlestick-area') || cl.contains('apexcharts-boxPlot-area') || cl.contains('apexcharts-rangebar-area')) { + var bar = e.target; + var barRect = bar.getBoundingClientRect(); + var seriesBound = opt.elGrid.getBoundingClientRect(); + var bh = barRect.height; + barHeight = barRect.height; + var bw = barRect.width; + var cx = parseInt(bar.getAttribute('cx'), 10); + var cy = parseInt(bar.getAttribute('cy'), 10); + barWidth = parseFloat(bar.getAttribute('barWidth')); + var clientX = e.type === 'touchmove' ? e.touches[0].clientX : e.clientX; + j = parseInt(bar.getAttribute('j'), 10); + i = parseInt(bar.parentNode.getAttribute('rel'), 10) - 1; + var y1 = bar.getAttribute('data-range-y1'); + var y2 = bar.getAttribute('data-range-y2'); + if (w.globals.comboCharts) { + i = parseInt(bar.parentNode.getAttribute('data:realIndex'), 10); + } + var handleXForColumns = function handleXForColumns(x) { + if (w.globals.isXNumeric) { + x = cx - bw / 2; + } else { + if (_this.isVerticalGroupedRangeBar) { + x = cx + bw / 2; + } else { + x = cx - ttCtx.dataPointsDividedWidth + bw / 2; + } + } + return x; + }; + var handleYForBars = function handleYForBars() { + return cy - ttCtx.dataPointsDividedHeight + bh / 2 - ttCtx.tooltipRect.ttHeight / 2; + }; + ttCtx.tooltipLabels.drawSeriesTexts({ + ttItems: opt.ttItems, + i: i, + j: j, + y1: y1 ? parseInt(y1, 10) : null, + y2: y2 ? parseInt(y2, 10) : null, + shared: ttCtx.showOnIntersect ? false : w.config.tooltip.shared, + e: e + }); + if (w.config.tooltip.followCursor) { + if (w.globals.isBarHorizontal) { + x = clientX - seriesBound.left + 15; + y = handleYForBars(); + } else { + x = handleXForColumns(x); + y = e.clientY - seriesBound.top - ttCtx.tooltipRect.ttHeight / 2 - 15; + } + } else { + if (w.globals.isBarHorizontal) { + x = cx; + if (x < ttCtx.xyRatios.baseLineInvertedY) { + x = cx - ttCtx.tooltipRect.ttWidth; + } + y = handleYForBars(); + } else { + x = handleXForColumns(x); + y = cy; // - ttCtx.tooltipRect.ttHeight / 2 + 10 + } + } + } + return { + x: x, + y: y, + barHeight: barHeight, + barWidth: barWidth, + i: i, + j: j + }; + } + }]); + return Intersect; + }(); + + /** + * ApexCharts Tooltip.AxesTooltip Class. + * This file deals with the x-axis and y-axis tooltips. + * + * @module Tooltip.AxesTooltip + **/ + var AxesTooltip = /*#__PURE__*/function () { + function AxesTooltip(tooltipContext) { + _classCallCheck(this, AxesTooltip); + this.w = tooltipContext.w; + this.ttCtx = tooltipContext; + } + + /** + * This method adds the secondary tooltip which appears below x axis + * @memberof Tooltip + **/ + _createClass(AxesTooltip, [{ + key: "drawXaxisTooltip", + value: function drawXaxisTooltip() { + var w = this.w; + var ttCtx = this.ttCtx; + var isBottom = w.config.xaxis.position === 'bottom'; + ttCtx.xaxisOffY = isBottom ? w.globals.gridHeight + 1 : -w.globals.xAxisHeight - w.config.xaxis.axisTicks.height + 3; + var tooltipCssClass = isBottom ? 'apexcharts-xaxistooltip apexcharts-xaxistooltip-bottom' : 'apexcharts-xaxistooltip apexcharts-xaxistooltip-top'; + var renderTo = w.globals.dom.elWrap; + if (ttCtx.isXAxisTooltipEnabled) { + var xaxisTooltip = w.globals.dom.baseEl.querySelector('.apexcharts-xaxistooltip'); + if (xaxisTooltip === null) { + ttCtx.xaxisTooltip = document.createElement('div'); + ttCtx.xaxisTooltip.setAttribute('class', tooltipCssClass + ' apexcharts-theme-' + w.config.tooltip.theme); + renderTo.appendChild(ttCtx.xaxisTooltip); + ttCtx.xaxisTooltipText = document.createElement('div'); + ttCtx.xaxisTooltipText.classList.add('apexcharts-xaxistooltip-text'); + ttCtx.xaxisTooltipText.style.fontFamily = w.config.xaxis.tooltip.style.fontFamily || w.config.chart.fontFamily; + ttCtx.xaxisTooltipText.style.fontSize = w.config.xaxis.tooltip.style.fontSize; + ttCtx.xaxisTooltip.appendChild(ttCtx.xaxisTooltipText); + } + } + } + + /** + * This method adds the secondary tooltip which appears below x axis + * @memberof Tooltip + **/ + }, { + key: "drawYaxisTooltip", + value: function drawYaxisTooltip() { + var w = this.w; + var ttCtx = this.ttCtx; + for (var i = 0; i < w.config.yaxis.length; i++) { + var isRight = w.config.yaxis[i].opposite || w.config.yaxis[i].crosshairs.opposite; + ttCtx.yaxisOffX = isRight ? w.globals.gridWidth + 1 : 1; + var tooltipCssClass = isRight ? "apexcharts-yaxistooltip apexcharts-yaxistooltip-".concat(i, " apexcharts-yaxistooltip-right") : "apexcharts-yaxistooltip apexcharts-yaxistooltip-".concat(i, " apexcharts-yaxistooltip-left"); + var renderTo = w.globals.dom.elWrap; + var yaxisTooltip = w.globals.dom.baseEl.querySelector(".apexcharts-yaxistooltip apexcharts-yaxistooltip-".concat(i)); + if (yaxisTooltip === null) { + ttCtx.yaxisTooltip = document.createElement('div'); + ttCtx.yaxisTooltip.setAttribute('class', tooltipCssClass + ' apexcharts-theme-' + w.config.tooltip.theme); + renderTo.appendChild(ttCtx.yaxisTooltip); + if (i === 0) ttCtx.yaxisTooltipText = []; + ttCtx.yaxisTooltipText[i] = document.createElement('div'); + ttCtx.yaxisTooltipText[i].classList.add('apexcharts-yaxistooltip-text'); + ttCtx.yaxisTooltip.appendChild(ttCtx.yaxisTooltipText[i]); + } + } + } + + /** + * @memberof Tooltip + **/ + }, { + key: "setXCrosshairWidth", + value: function setXCrosshairWidth() { + var w = this.w; + var ttCtx = this.ttCtx; + + // set xcrosshairs width + var xcrosshairs = ttCtx.getElXCrosshairs(); + ttCtx.xcrosshairsWidth = parseInt(w.config.xaxis.crosshairs.width, 10); + if (!w.globals.comboCharts) { + if (w.config.xaxis.crosshairs.width === 'tickWidth') { + var count = w.globals.labels.length; + ttCtx.xcrosshairsWidth = w.globals.gridWidth / count; + } else if (w.config.xaxis.crosshairs.width === 'barWidth') { + var bar = w.globals.dom.baseEl.querySelector('.apexcharts-bar-area'); + if (bar !== null) { + var barWidth = parseFloat(bar.getAttribute('barWidth')); + ttCtx.xcrosshairsWidth = barWidth; + } else { + ttCtx.xcrosshairsWidth = 1; + } + } + } else { + var _bar = w.globals.dom.baseEl.querySelector('.apexcharts-bar-area'); + if (_bar !== null && w.config.xaxis.crosshairs.width === 'barWidth') { + var _barWidth = parseFloat(_bar.getAttribute('barWidth')); + ttCtx.xcrosshairsWidth = _barWidth; + } else { + if (w.config.xaxis.crosshairs.width === 'tickWidth') { + var _count = w.globals.labels.length; + ttCtx.xcrosshairsWidth = w.globals.gridWidth / _count; + } + } + } + if (w.globals.isBarHorizontal) { + ttCtx.xcrosshairsWidth = 0; + } + if (xcrosshairs !== null && ttCtx.xcrosshairsWidth > 0) { + xcrosshairs.setAttribute('width', ttCtx.xcrosshairsWidth); + } + } + }, { + key: "handleYCrosshair", + value: function handleYCrosshair() { + var w = this.w; + var ttCtx = this.ttCtx; + + // set ycrosshairs height + ttCtx.ycrosshairs = w.globals.dom.baseEl.querySelector('.apexcharts-ycrosshairs'); + ttCtx.ycrosshairsHidden = w.globals.dom.baseEl.querySelector('.apexcharts-ycrosshairs-hidden'); + } + }, { + key: "drawYaxisTooltipText", + value: function drawYaxisTooltipText(index, clientY, xyRatios) { + var ttCtx = this.ttCtx; + var w = this.w; + var gl = w.globals; + var yAxisSeriesArr = gl.seriesYAxisMap[index]; + if (ttCtx.yaxisTooltips[index] && yAxisSeriesArr.length > 0) { + var lbFormatter = gl.yLabelFormatters[index]; + var elGrid = ttCtx.getElGrid(); + var seriesBound = elGrid.getBoundingClientRect(); + + // We can use the index of any series referenced by the Yaxis + // because they will all return the same value. + var seriesIndex = yAxisSeriesArr[0]; + var translationsIndex = 0; + if (xyRatios.yRatio.length > 1) { + translationsIndex = seriesIndex; + } + var hoverY = (clientY - seriesBound.top) * xyRatios.yRatio[translationsIndex]; + var height = gl.maxYArr[seriesIndex] - gl.minYArr[seriesIndex]; + var val = gl.minYArr[seriesIndex] + (height - hoverY); + if (w.config.yaxis[index].reversed) { + val = gl.maxYArr[seriesIndex] - (height - hoverY); + } + ttCtx.tooltipPosition.moveYCrosshairs(clientY - seriesBound.top); + ttCtx.yaxisTooltipText[index].innerHTML = lbFormatter(val); + ttCtx.tooltipPosition.moveYAxisTooltip(index); + } + } + }]); + return AxesTooltip; + }(); + + /** + * ApexCharts Core Tooltip Class to handle the tooltip generation. + * + * @module Tooltip + **/ + var Tooltip = /*#__PURE__*/function () { + function Tooltip(ctx) { + _classCallCheck(this, Tooltip); + this.ctx = ctx; + this.w = ctx.w; + var w = this.w; + this.tConfig = w.config.tooltip; + this.tooltipUtil = new Utils(this); + this.tooltipLabels = new Labels(this); + this.tooltipPosition = new Position(this); + this.marker = new Marker(this); + this.intersect = new Intersect(this); + this.axesTooltip = new AxesTooltip(this); + this.showOnIntersect = this.tConfig.intersect; + this.showTooltipTitle = this.tConfig.x.show; + this.fixedTooltip = this.tConfig.fixed.enabled; + this.xaxisTooltip = null; + this.yaxisTTEls = null; + this.isBarShared = !w.globals.isBarHorizontal && this.tConfig.shared; + this.lastHoverTime = Date.now(); + } + _createClass(Tooltip, [{ + key: "getElTooltip", + value: function getElTooltip(ctx) { + if (!ctx) ctx = this; + if (!ctx.w.globals.dom.baseEl) return null; + return ctx.w.globals.dom.baseEl.querySelector('.apexcharts-tooltip'); + } + }, { + key: "getElXCrosshairs", + value: function getElXCrosshairs() { + return this.w.globals.dom.baseEl.querySelector('.apexcharts-xcrosshairs'); + } + }, { + key: "getElGrid", + value: function getElGrid() { + return this.w.globals.dom.baseEl.querySelector('.apexcharts-grid'); + } + }, { + key: "drawTooltip", + value: function drawTooltip(xyRatios) { + var w = this.w; + this.xyRatios = xyRatios; + this.isXAxisTooltipEnabled = w.config.xaxis.tooltip.enabled && w.globals.axisCharts; + this.yaxisTooltips = w.config.yaxis.map(function (y, i) { + return y.show && y.tooltip.enabled && w.globals.axisCharts ? true : false; + }); + this.allTooltipSeriesGroups = []; + if (!w.globals.axisCharts) { + this.showTooltipTitle = false; + } + var tooltipEl = document.createElement('div'); + tooltipEl.classList.add('apexcharts-tooltip'); + if (w.config.tooltip.cssClass) { + tooltipEl.classList.add(w.config.tooltip.cssClass); + } + tooltipEl.classList.add("apexcharts-theme-".concat(this.tConfig.theme)); + w.globals.dom.elWrap.appendChild(tooltipEl); + if (w.globals.axisCharts) { + this.axesTooltip.drawXaxisTooltip(); + this.axesTooltip.drawYaxisTooltip(); + this.axesTooltip.setXCrosshairWidth(); + this.axesTooltip.handleYCrosshair(); + var xAxis = new XAxis(this.ctx); + this.xAxisTicksPositions = xAxis.getXAxisTicksPositions(); + } + + // we forcefully set intersect true for these conditions + if ((w.globals.comboCharts || this.tConfig.intersect || w.config.chart.type === 'rangeBar') && !this.tConfig.shared) { + this.showOnIntersect = true; + } + if (w.config.markers.size === 0 || w.globals.markers.largestSize === 0) { + // when user don't want to show points all the time, but only on when hovering on series + this.marker.drawDynamicPoints(this); + } + + // no visible series, exit + if (w.globals.collapsedSeries.length === w.globals.series.length) return; + this.dataPointsDividedHeight = w.globals.gridHeight / w.globals.dataPoints; + this.dataPointsDividedWidth = w.globals.gridWidth / w.globals.dataPoints; + if (this.showTooltipTitle) { + this.tooltipTitle = document.createElement('div'); + this.tooltipTitle.classList.add('apexcharts-tooltip-title'); + this.tooltipTitle.style.fontFamily = this.tConfig.style.fontFamily || w.config.chart.fontFamily; + this.tooltipTitle.style.fontSize = this.tConfig.style.fontSize; + tooltipEl.appendChild(this.tooltipTitle); + } + var ttItemsCnt = w.globals.series.length; // whether shared or not, default is shared + if ((w.globals.xyCharts || w.globals.comboCharts) && this.tConfig.shared) { + if (!this.showOnIntersect) { + ttItemsCnt = w.globals.series.length; + } else { + ttItemsCnt = 1; + } + } + this.legendLabels = w.globals.dom.baseEl.querySelectorAll('.apexcharts-legend-text'); + this.ttItems = this.createTTElements(ttItemsCnt); + this.addSVGEvents(); + } + }, { + key: "createTTElements", + value: function createTTElements(ttItemsCnt) { + var _this = this; + var w = this.w; + var ttItems = []; + var tooltipEl = this.getElTooltip(); + var _loop = function _loop(i) { + var gTxt = document.createElement('div'); + gTxt.classList.add('apexcharts-tooltip-series-group', "apexcharts-tooltip-series-group-".concat(i)); + gTxt.style.order = w.config.tooltip.inverseOrder ? ttItemsCnt - i : i + 1; + var point = document.createElement('span'); + point.classList.add('apexcharts-tooltip-marker'); + if (w.config.tooltip.fillSeriesColor) { + point.style.backgroundColor = w.globals.colors[i]; + } else { + point.style.color = w.globals.colors[i]; + } + var mShape = w.config.markers.shape; + var shape = mShape; + if (Array.isArray(mShape)) { + shape = mShape[i]; + } + point.setAttribute('shape', shape); + gTxt.appendChild(point); + var gYZ = document.createElement('div'); + gYZ.classList.add('apexcharts-tooltip-text'); + gYZ.style.fontFamily = _this.tConfig.style.fontFamily || w.config.chart.fontFamily; + gYZ.style.fontSize = _this.tConfig.style.fontSize; + ['y', 'goals', 'z'].forEach(function (g) { + var gValText = document.createElement('div'); + gValText.classList.add("apexcharts-tooltip-".concat(g, "-group")); + var txtLabel = document.createElement('span'); + txtLabel.classList.add("apexcharts-tooltip-text-".concat(g, "-label")); + gValText.appendChild(txtLabel); + var txtValue = document.createElement('span'); + txtValue.classList.add("apexcharts-tooltip-text-".concat(g, "-value")); + gValText.appendChild(txtValue); + gYZ.appendChild(gValText); + }); + gTxt.appendChild(gYZ); + tooltipEl.appendChild(gTxt); + ttItems.push(gTxt); + }; + for (var i = 0; i < ttItemsCnt; i++) { + _loop(i); + } + return ttItems; + } + }, { + key: "addSVGEvents", + value: function addSVGEvents() { + var w = this.w; + var type = w.config.chart.type; + var tooltipEl = this.getElTooltip(); + var commonBar = !!(type === 'bar' || type === 'candlestick' || type === 'boxPlot' || type === 'rangeBar'); + var chartWithmarkers = type === 'area' || type === 'line' || type === 'scatter' || type === 'bubble' || type === 'radar'; + var hoverArea = w.globals.dom.Paper.node; + var elGrid = this.getElGrid(); + if (elGrid) { + this.seriesBound = elGrid.getBoundingClientRect(); + } + var tooltipY = []; + var tooltipX = []; + var seriesHoverParams = { + hoverArea: hoverArea, + elGrid: elGrid, + tooltipEl: tooltipEl, + tooltipY: tooltipY, + tooltipX: tooltipX, + ttItems: this.ttItems + }; + var points; + if (w.globals.axisCharts) { + if (chartWithmarkers) { + points = w.globals.dom.baseEl.querySelectorAll(".apexcharts-series[data\\:longestSeries='true'] .apexcharts-marker"); + } else if (commonBar) { + points = w.globals.dom.baseEl.querySelectorAll('.apexcharts-series .apexcharts-bar-area, .apexcharts-series .apexcharts-candlestick-area, .apexcharts-series .apexcharts-boxPlot-area, .apexcharts-series .apexcharts-rangebar-area'); + } else if (type === 'heatmap' || type === 'treemap') { + points = w.globals.dom.baseEl.querySelectorAll('.apexcharts-series .apexcharts-heatmap, .apexcharts-series .apexcharts-treemap'); + } + if (points && points.length) { + for (var p = 0; p < points.length; p++) { + tooltipY.push(points[p].getAttribute('cy')); + tooltipX.push(points[p].getAttribute('cx')); + } + } + } + var validSharedChartTypes = w.globals.xyCharts && !this.showOnIntersect || w.globals.comboCharts && !this.showOnIntersect || commonBar && this.tooltipUtil.hasBars() && this.tConfig.shared; + if (validSharedChartTypes) { + this.addPathsEventListeners([hoverArea], seriesHoverParams); + } else if (commonBar && !w.globals.comboCharts || chartWithmarkers && this.showOnIntersect) { + this.addDatapointEventsListeners(seriesHoverParams); + } else if (!w.globals.axisCharts || type === 'heatmap' || type === 'treemap') { + var seriesAll = w.globals.dom.baseEl.querySelectorAll('.apexcharts-series'); + this.addPathsEventListeners(seriesAll, seriesHoverParams); + } + if (this.showOnIntersect) { + var lineAreaPoints = w.globals.dom.baseEl.querySelectorAll('.apexcharts-line-series .apexcharts-marker, .apexcharts-area-series .apexcharts-marker'); + if (lineAreaPoints.length > 0) { + // if we find any lineSeries, addEventListeners for them + this.addPathsEventListeners(lineAreaPoints, seriesHoverParams); + } + + // combo charts may have bars, so add event listeners here too + if (this.tooltipUtil.hasBars() && !this.tConfig.shared) { + this.addDatapointEventsListeners(seriesHoverParams); + } + } + } + }, { + key: "drawFixedTooltipRect", + value: function drawFixedTooltipRect() { + var w = this.w; + var tooltipEl = this.getElTooltip(); + var tooltipRect = tooltipEl.getBoundingClientRect(); + var ttWidth = tooltipRect.width + 10; + var ttHeight = tooltipRect.height + 10; + var x = this.tConfig.fixed.offsetX; + var y = this.tConfig.fixed.offsetY; + var fixed = this.tConfig.fixed.position.toLowerCase(); + if (fixed.indexOf('right') > -1) { + x = x + w.globals.svgWidth - ttWidth + 10; + } + if (fixed.indexOf('bottom') > -1) { + y = y + w.globals.svgHeight - ttHeight - 10; + } + tooltipEl.style.left = x + 'px'; + tooltipEl.style.top = y + 'px'; + return { + x: x, + y: y, + ttWidth: ttWidth, + ttHeight: ttHeight + }; + } + }, { + key: "addDatapointEventsListeners", + value: function addDatapointEventsListeners(seriesHoverParams) { + var w = this.w; + var points = w.globals.dom.baseEl.querySelectorAll('.apexcharts-series-markers .apexcharts-marker, .apexcharts-bar-area, .apexcharts-candlestick-area, .apexcharts-boxPlot-area, .apexcharts-rangebar-area'); + this.addPathsEventListeners(points, seriesHoverParams); + } + }, { + key: "addPathsEventListeners", + value: function addPathsEventListeners(paths, opts) { + var self = this; + var _loop2 = function _loop2(p) { + var extendedOpts = { + paths: paths[p], + tooltipEl: opts.tooltipEl, + tooltipY: opts.tooltipY, + tooltipX: opts.tooltipX, + elGrid: opts.elGrid, + hoverArea: opts.hoverArea, + ttItems: opts.ttItems + }; + var events = ['mousemove', 'mouseup', 'touchmove', 'mouseout', 'touchend']; + events.map(function (ev) { + return paths[p].addEventListener(ev, self.onSeriesHover.bind(self, extendedOpts), { + capture: false, + passive: true + }); + }); + }; + for (var p = 0; p < paths.length; p++) { + _loop2(p); + } + } + + /* + ** Check to see if the tooltips should be updated based on a mouse / touch event + */ + }, { + key: "onSeriesHover", + value: function onSeriesHover(opt, e) { + var _this2 = this; + // If a user is moving their mouse quickly, don't bother updating the tooltip every single frame + + var targetDelay = 20; + var timeSinceLastUpdate = Date.now() - this.lastHoverTime; + if (timeSinceLastUpdate >= targetDelay) { + // The tooltip was last updated over 100ms ago - redraw it even if the user is still moving their + // mouse so they get some feedback that their moves are being registered + this.seriesHover(opt, e); + } else { + // The tooltip was last updated less than 100ms ago + // Cancel any other delayed draw, so we don't show stale data + clearTimeout(this.seriesHoverTimeout); + + // Schedule the next draw so that it happens about 100ms after the last update + this.seriesHoverTimeout = setTimeout(function () { + _this2.seriesHover(opt, e); + }, targetDelay - timeSinceLastUpdate); + } + } + + /* + ** The actual series hover function + */ + }, { + key: "seriesHover", + value: function seriesHover(opt, e) { + var _this3 = this; + this.lastHoverTime = Date.now(); + var chartGroups = []; + var w = this.w; + + // if user has more than one charts in group, we need to sync + if (w.config.chart.group) { + chartGroups = this.ctx.getGroupedCharts(); + } + if (w.globals.axisCharts && (w.globals.minX === -Infinity && w.globals.maxX === Infinity || w.globals.dataPoints === 0)) { + return; + } + if (chartGroups.length) { + chartGroups.forEach(function (ch) { + var tooltipEl = _this3.getElTooltip(ch); + var newOpts = { + paths: opt.paths, + tooltipEl: tooltipEl, + tooltipY: opt.tooltipY, + tooltipX: opt.tooltipX, + elGrid: opt.elGrid, + hoverArea: opt.hoverArea, + ttItems: ch.w.globals.tooltip.ttItems + }; + + // all the charts should have the same minX and maxX (same xaxis) for multiple tooltips to work correctly + if (ch.w.globals.minX === _this3.w.globals.minX && ch.w.globals.maxX === _this3.w.globals.maxX) { + ch.w.globals.tooltip.seriesHoverByContext({ + chartCtx: ch, + ttCtx: ch.w.globals.tooltip, + opt: newOpts, + e: e + }); + } + }); + } else { + this.seriesHoverByContext({ + chartCtx: this.ctx, + ttCtx: this.w.globals.tooltip, + opt: opt, + e: e + }); + } + } + }, { + key: "seriesHoverByContext", + value: function seriesHoverByContext(_ref) { + var chartCtx = _ref.chartCtx, + ttCtx = _ref.ttCtx, + opt = _ref.opt, + e = _ref.e; + var w = chartCtx.w; + var tooltipEl = this.getElTooltip(chartCtx); + if (!tooltipEl) return; + + // tooltipRect is calculated on every mousemove, because the text is dynamic + ttCtx.tooltipRect = { + x: 0, + y: 0, + ttWidth: tooltipEl.getBoundingClientRect().width, + ttHeight: tooltipEl.getBoundingClientRect().height + }; + ttCtx.e = e; + + // highlight the current hovered bars + if (ttCtx.tooltipUtil.hasBars() && !w.globals.comboCharts && !ttCtx.isBarShared) { + if (this.tConfig.onDatasetHover.highlightDataSeries) { + var series = new Series(chartCtx); + series.toggleSeriesOnHover(e, e.target.parentNode); + } + } + if (ttCtx.fixedTooltip) { + ttCtx.drawFixedTooltipRect(); + } + if (w.globals.axisCharts) { + ttCtx.axisChartsTooltips({ + e: e, + opt: opt, + tooltipRect: ttCtx.tooltipRect + }); + } else { + // non-plot charts i.e pie/donut/circle + ttCtx.nonAxisChartsTooltips({ + e: e, + opt: opt, + tooltipRect: ttCtx.tooltipRect + }); + } + } + + // tooltip handling for line/area/bar/columns/scatter + }, { + key: "axisChartsTooltips", + value: function axisChartsTooltips(_ref2) { + var e = _ref2.e, + opt = _ref2.opt; + var w = this.w; + var x, y; + var seriesBound = opt.elGrid.getBoundingClientRect(); + var clientX = e.type === 'touchmove' ? e.touches[0].clientX : e.clientX; + var clientY = e.type === 'touchmove' ? e.touches[0].clientY : e.clientY; + this.clientY = clientY; + this.clientX = clientX; + w.globals.capturedSeriesIndex = -1; + w.globals.capturedDataPointIndex = -1; + if (clientY < seriesBound.top || clientY > seriesBound.top + seriesBound.height) { + this.handleMouseOut(opt); + return; + } + if (Array.isArray(this.tConfig.enabledOnSeries) && !w.config.tooltip.shared) { + var index = parseInt(opt.paths.getAttribute('index'), 10); + if (this.tConfig.enabledOnSeries.indexOf(index) < 0) { + this.handleMouseOut(opt); + return; + } + } + var tooltipEl = this.getElTooltip(); + var xcrosshairs = this.getElXCrosshairs(); + var syncedCharts = []; + if (w.config.chart.group) { + // we need to fallback to sticky tooltip in case charts are synced + syncedCharts = this.ctx.getSyncedCharts(); + } + var isStickyTooltip = w.globals.xyCharts || w.config.chart.type === 'bar' && !w.globals.isBarHorizontal && this.tooltipUtil.hasBars() && this.tConfig.shared || w.globals.comboCharts && this.tooltipUtil.hasBars(); + if (e.type === 'mousemove' || e.type === 'touchmove' || e.type === 'mouseup') { + // there is no series to hover over + if (w.globals.collapsedSeries.length + w.globals.ancillaryCollapsedSeries.length === w.globals.series.length) { + return; + } + if (xcrosshairs !== null) { + xcrosshairs.classList.add('apexcharts-active'); + } + var hasYAxisTooltip = this.yaxisTooltips.filter(function (b) { + return b === true; + }); + if (this.ycrosshairs !== null && hasYAxisTooltip.length) { + this.ycrosshairs.classList.add('apexcharts-active'); + } + if (isStickyTooltip && !this.showOnIntersect || syncedCharts.length > 1) { + this.handleStickyTooltip(e, clientX, clientY, opt); + } else { + if (w.config.chart.type === 'heatmap' || w.config.chart.type === 'treemap') { + var markerXY = this.intersect.handleHeatTreeTooltip({ + e: e, + opt: opt, + x: x, + y: y, + type: w.config.chart.type + }); + x = markerXY.x; + y = markerXY.y; + tooltipEl.style.left = x + 'px'; + tooltipEl.style.top = y + 'px'; + } else { + if (this.tooltipUtil.hasBars()) { + this.intersect.handleBarTooltip({ + e: e, + opt: opt + }); + } + if (this.tooltipUtil.hasMarkers()) { + // intersect - line/area/scatter/bubble + this.intersect.handleMarkerTooltip({ + e: e, + opt: opt, + x: x, + y: y + }); + } + } + } + if (this.yaxisTooltips.length) { + for (var yt = 0; yt < w.config.yaxis.length; yt++) { + this.axesTooltip.drawYaxisTooltipText(yt, clientY, this.xyRatios); + } + } + w.globals.dom.baseEl.classList.add('apexcharts-tooltip-active'); + opt.tooltipEl.classList.add('apexcharts-active'); + } else if (e.type === 'mouseout' || e.type === 'touchend') { + this.handleMouseOut(opt); + } + } + + // tooltip handling for pie/donuts + }, { + key: "nonAxisChartsTooltips", + value: function nonAxisChartsTooltips(_ref3) { + var e = _ref3.e, + opt = _ref3.opt, + tooltipRect = _ref3.tooltipRect; + var w = this.w; + var rel = opt.paths.getAttribute('rel'); + var tooltipEl = this.getElTooltip(); + var seriesBound = w.globals.dom.elWrap.getBoundingClientRect(); + if (e.type === 'mousemove' || e.type === 'touchmove') { + w.globals.dom.baseEl.classList.add('apexcharts-tooltip-active'); + tooltipEl.classList.add('apexcharts-active'); + this.tooltipLabels.drawSeriesTexts({ + ttItems: opt.ttItems, + i: parseInt(rel, 10) - 1, + shared: false + }); + var x = w.globals.clientX - seriesBound.left - tooltipRect.ttWidth / 2; + var y = w.globals.clientY - seriesBound.top - tooltipRect.ttHeight - 10; + tooltipEl.style.left = x + 'px'; + tooltipEl.style.top = y + 'px'; + if (w.config.legend.tooltipHoverFormatter) { + var legendFormatter = w.config.legend.tooltipHoverFormatter; + var i = rel - 1; + var legendName = this.legendLabels[i].getAttribute('data:default-text'); + var text = legendFormatter(legendName, { + seriesIndex: i, + dataPointIndex: i, + w: w + }); + this.legendLabels[i].innerHTML = text; + } + } else if (e.type === 'mouseout' || e.type === 'touchend') { + tooltipEl.classList.remove('apexcharts-active'); + w.globals.dom.baseEl.classList.remove('apexcharts-tooltip-active'); + if (w.config.legend.tooltipHoverFormatter) { + this.legendLabels.forEach(function (l) { + var defaultText = l.getAttribute('data:default-text'); + l.innerHTML = decodeURIComponent(defaultText); + }); + } + } + } + }, { + key: "handleStickyTooltip", + value: function handleStickyTooltip(e, clientX, clientY, opt) { + var w = this.w; + var capj = this.tooltipUtil.getNearestValues({ + context: this, + hoverArea: opt.hoverArea, + elGrid: opt.elGrid, + clientX: clientX, + clientY: clientY + }); + var j = capj.j; + var capturedSeries = capj.capturedSeries; + if (w.globals.collapsedSeriesIndices.includes(capturedSeries)) capturedSeries = null; + var bounds = opt.elGrid.getBoundingClientRect(); + if (capj.hoverX < 0 || capj.hoverX > bounds.width) { + this.handleMouseOut(opt); + return; + } + if (capturedSeries !== null) { + this.handleStickyCapturedSeries(e, capturedSeries, opt, j); + } else { + // couldn't capture any series. check if shared X is same, + // if yes, draw a grouped tooltip + if (this.tooltipUtil.isXoverlap(j) || w.globals.isBarHorizontal) { + var firstVisibleSeries = w.globals.series.findIndex(function (s, i) { + return !w.globals.collapsedSeriesIndices.includes(i); + }); + this.create(e, this, firstVisibleSeries, j, opt.ttItems); + } + } + } + }, { + key: "handleStickyCapturedSeries", + value: function handleStickyCapturedSeries(e, capturedSeries, opt, j) { + var w = this.w; + if (!this.tConfig.shared) { + var ignoreNull = w.globals.series[capturedSeries][j] === null; + if (ignoreNull) { + this.handleMouseOut(opt); + return; + } + } + if (typeof w.globals.series[capturedSeries][j] !== 'undefined') { + if (this.tConfig.shared && this.tooltipUtil.isXoverlap(j) && this.tooltipUtil.isInitialSeriesSameLen()) { + this.create(e, this, capturedSeries, j, opt.ttItems); + } else { + this.create(e, this, capturedSeries, j, opt.ttItems, false); + } + } else { + if (this.tooltipUtil.isXoverlap(j)) { + var firstVisibleSeries = w.globals.series.findIndex(function (s, i) { + return !w.globals.collapsedSeriesIndices.includes(i); + }); + this.create(e, this, firstVisibleSeries, j, opt.ttItems); + } + } + } + }, { + key: "deactivateHoverFilter", + value: function deactivateHoverFilter() { + var w = this.w; + var graphics = new Graphics(this.ctx); + var allPaths = w.globals.dom.Paper.find(".apexcharts-bar-area"); + for (var b = 0; b < allPaths.length; b++) { + graphics.pathMouseLeave(allPaths[b]); + } + } + }, { + key: "handleMouseOut", + value: function handleMouseOut(opt) { + var w = this.w; + var xcrosshairs = this.getElXCrosshairs(); + w.globals.dom.baseEl.classList.remove('apexcharts-tooltip-active'); + opt.tooltipEl.classList.remove('apexcharts-active'); + this.deactivateHoverFilter(); + if (w.config.chart.type !== 'bubble') { + this.marker.resetPointsSize(); + } + if (xcrosshairs !== null) { + xcrosshairs.classList.remove('apexcharts-active'); + } + if (this.ycrosshairs !== null) { + this.ycrosshairs.classList.remove('apexcharts-active'); + } + if (this.isXAxisTooltipEnabled) { + this.xaxisTooltip.classList.remove('apexcharts-active'); + } + if (this.yaxisTooltips.length) { + if (this.yaxisTTEls === null) { + this.yaxisTTEls = w.globals.dom.baseEl.querySelectorAll('.apexcharts-yaxistooltip'); + } + for (var i = 0; i < this.yaxisTTEls.length; i++) { + this.yaxisTTEls[i].classList.remove('apexcharts-active'); + } + } + if (w.config.legend.tooltipHoverFormatter) { + this.legendLabels.forEach(function (l) { + var defaultText = l.getAttribute('data:default-text'); + l.innerHTML = decodeURIComponent(defaultText); + }); + } + } + }, { + key: "markerClick", + value: function markerClick(e, seriesIndex, dataPointIndex) { + var w = this.w; + if (typeof w.config.chart.events.markerClick === 'function') { + w.config.chart.events.markerClick(e, this.ctx, { + seriesIndex: seriesIndex, + dataPointIndex: dataPointIndex, + w: w + }); + } + this.ctx.events.fireEvent('markerClick', [e, this.ctx, { + seriesIndex: seriesIndex, + dataPointIndex: dataPointIndex, + w: w + }]); + } + }, { + key: "create", + value: function create(e, context, capturedSeries, j, ttItems) { + var _w$globals$seriesRang, _w$globals$seriesRang2, _w$globals$seriesRang3, _w$globals$seriesRang4, _w$globals$seriesRang5, _w$globals$seriesRang6, _w$globals$seriesRang7, _w$globals$seriesRang8, _w$globals$seriesRang9, _w$globals$seriesRang10, _w$globals$seriesRang11, _w$globals$seriesRang12, _w$globals$seriesRang13, _w$globals$seriesRang14, _w$globals$seriesRang15, _w$globals$seriesRang16; + var shared = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null; + var w = this.w; + var ttCtx = context; + if (e.type === 'mouseup') { + this.markerClick(e, capturedSeries, j); + } + if (shared === null) shared = this.tConfig.shared; + var hasMarkers = this.tooltipUtil.hasMarkers(capturedSeries); + var bars = this.tooltipUtil.getElBars(); + var handlePoints = function handlePoints() { + if (w.globals.markers.largestSize > 0) { + ttCtx.marker.enlargePoints(j); + } else { + ttCtx.tooltipPosition.moveDynamicPointsOnHover(j); + } + }; + if (w.config.legend.tooltipHoverFormatter) { + var legendFormatter = w.config.legend.tooltipHoverFormatter; + var els = Array.from(this.legendLabels); + + // reset all legend values first + els.forEach(function (l) { + var legendName = l.getAttribute('data:default-text'); + l.innerHTML = decodeURIComponent(legendName); + }); + + // for irregular time series + for (var i = 0; i < els.length; i++) { + var l = els[i]; + var lsIndex = parseInt(l.getAttribute('i'), 10); + var legendName = decodeURIComponent(l.getAttribute('data:default-text')); + var text = legendFormatter(legendName, { + seriesIndex: shared ? lsIndex : capturedSeries, + dataPointIndex: j, + w: w + }); + if (!shared) { + l.innerHTML = lsIndex === capturedSeries ? text : legendName; + if (capturedSeries === lsIndex) { + break; + } + } else { + l.innerHTML = w.globals.collapsedSeriesIndices.indexOf(lsIndex) < 0 ? text : legendName; + } + } + } + var commonSeriesTextsParams = _objectSpread2(_objectSpread2({ + ttItems: ttItems, + i: capturedSeries, + j: j + }, typeof ((_w$globals$seriesRang = w.globals.seriesRange) === null || _w$globals$seriesRang === void 0 ? void 0 : (_w$globals$seriesRang2 = _w$globals$seriesRang[capturedSeries]) === null || _w$globals$seriesRang2 === void 0 ? void 0 : (_w$globals$seriesRang3 = _w$globals$seriesRang2[j]) === null || _w$globals$seriesRang3 === void 0 ? void 0 : (_w$globals$seriesRang4 = _w$globals$seriesRang3.y[0]) === null || _w$globals$seriesRang4 === void 0 ? void 0 : _w$globals$seriesRang4.y1) !== 'undefined' && { + y1: (_w$globals$seriesRang5 = w.globals.seriesRange) === null || _w$globals$seriesRang5 === void 0 ? void 0 : (_w$globals$seriesRang6 = _w$globals$seriesRang5[capturedSeries]) === null || _w$globals$seriesRang6 === void 0 ? void 0 : (_w$globals$seriesRang7 = _w$globals$seriesRang6[j]) === null || _w$globals$seriesRang7 === void 0 ? void 0 : (_w$globals$seriesRang8 = _w$globals$seriesRang7.y[0]) === null || _w$globals$seriesRang8 === void 0 ? void 0 : _w$globals$seriesRang8.y1 + }), typeof ((_w$globals$seriesRang9 = w.globals.seriesRange) === null || _w$globals$seriesRang9 === void 0 ? void 0 : (_w$globals$seriesRang10 = _w$globals$seriesRang9[capturedSeries]) === null || _w$globals$seriesRang10 === void 0 ? void 0 : (_w$globals$seriesRang11 = _w$globals$seriesRang10[j]) === null || _w$globals$seriesRang11 === void 0 ? void 0 : (_w$globals$seriesRang12 = _w$globals$seriesRang11.y[0]) === null || _w$globals$seriesRang12 === void 0 ? void 0 : _w$globals$seriesRang12.y2) !== 'undefined' && { + y2: (_w$globals$seriesRang13 = w.globals.seriesRange) === null || _w$globals$seriesRang13 === void 0 ? void 0 : (_w$globals$seriesRang14 = _w$globals$seriesRang13[capturedSeries]) === null || _w$globals$seriesRang14 === void 0 ? void 0 : (_w$globals$seriesRang15 = _w$globals$seriesRang14[j]) === null || _w$globals$seriesRang15 === void 0 ? void 0 : (_w$globals$seriesRang16 = _w$globals$seriesRang15.y[0]) === null || _w$globals$seriesRang16 === void 0 ? void 0 : _w$globals$seriesRang16.y2 + }); + if (shared) { + ttCtx.tooltipLabels.drawSeriesTexts(_objectSpread2(_objectSpread2({}, commonSeriesTextsParams), {}, { + shared: this.showOnIntersect ? false : this.tConfig.shared + })); + if (hasMarkers) { + handlePoints(); + } else if (this.tooltipUtil.hasBars()) { + this.barSeriesHeight = this.tooltipUtil.getBarsHeight(bars); + if (this.barSeriesHeight > 0) { + // hover state, activate snap filter + var graphics = new Graphics(this.ctx); + var paths = w.globals.dom.Paper.find(".apexcharts-bar-area[j='".concat(j, "']")); + + // de-activate first + this.deactivateHoverFilter(); + ttCtx.tooltipPosition.moveStickyTooltipOverBars(j, capturedSeries); + var points = ttCtx.tooltipUtil.getAllMarkers(true); + if (points.length) { + handlePoints(); + } + for (var b = 0; b < paths.length; b++) { + graphics.pathMouseEnter(paths[b]); + } + } + } + } else { + ttCtx.tooltipLabels.drawSeriesTexts(_objectSpread2({ + shared: false + }, commonSeriesTextsParams)); + if (this.tooltipUtil.hasBars()) { + ttCtx.tooltipPosition.moveStickyTooltipOverBars(j, capturedSeries); + } + if (hasMarkers) { + ttCtx.tooltipPosition.moveMarkers(capturedSeries, j); + } + } + } + }]); + return Tooltip; + }(); + + var BarDataLabels = /*#__PURE__*/function () { + function BarDataLabels(barCtx) { + _classCallCheck(this, BarDataLabels); + this.w = barCtx.w; + this.barCtx = barCtx; + this.totalFormatter = this.w.config.plotOptions.bar.dataLabels.total.formatter; + if (!this.totalFormatter) { + this.totalFormatter = this.w.config.dataLabels.formatter; + } + } + /** handleBarDataLabels is used to calculate the positions for the data-labels + * It also sets the element's data attr for bars and calls drawCalculatedBarDataLabels() + * After calculating, it also calls the function to draw data labels + * @memberof Bar + * @param {object} {barProps} most of the bar properties used throughout the bar + * drawing function + * @return {object} dataLabels node-element which you can append later + **/ + _createClass(BarDataLabels, [{ + key: "handleBarDataLabels", + value: function handleBarDataLabels(opts) { + var x = opts.x, + y = opts.y, + y1 = opts.y1, + y2 = opts.y2, + i = opts.i, + j = opts.j, + realIndex = opts.realIndex, + columnGroupIndex = opts.columnGroupIndex, + series = opts.series, + barHeight = opts.barHeight, + barWidth = opts.barWidth, + barXPosition = opts.barXPosition, + barYPosition = opts.barYPosition, + visibleSeries = opts.visibleSeries, + renderedPath = opts.renderedPath; + var w = this.w; + var graphics = new Graphics(this.barCtx.ctx); + var strokeWidth = Array.isArray(this.barCtx.strokeWidth) ? this.barCtx.strokeWidth[realIndex] : this.barCtx.strokeWidth; + var bcx; + var bcy; + if (w.globals.isXNumeric && !w.globals.isBarHorizontal) { + bcx = x + parseFloat(barWidth * (visibleSeries + 1)); + bcy = y + parseFloat(barHeight * (visibleSeries + 1)) - strokeWidth; + } else { + bcx = x + parseFloat(barWidth * visibleSeries); + bcy = y + parseFloat(barHeight * visibleSeries); + } + var dataLabels = null; + var totalDataLabels = null; + var dataLabelsX = x; + var dataLabelsY = y; + var dataLabelsPos = {}; + var dataLabelsConfig = w.config.dataLabels; + var barDataLabelsConfig = this.barCtx.barOptions.dataLabels; + var barTotalDataLabelsConfig = this.barCtx.barOptions.dataLabels.total; + if (typeof barYPosition !== 'undefined' && this.barCtx.isRangeBar) { + bcy = barYPosition; + dataLabelsY = barYPosition; + } + if (typeof barXPosition !== 'undefined' && this.barCtx.isVerticalGroupedRangeBar) { + bcx = barXPosition; + dataLabelsX = barXPosition; + } + var offX = dataLabelsConfig.offsetX; + var offY = dataLabelsConfig.offsetY; + var textRects = { + width: 0, + height: 0 + }; + if (w.config.dataLabels.enabled) { + var yLabel = w.globals.series[i][j]; + textRects = graphics.getTextRects(w.config.dataLabels.formatter ? w.config.dataLabels.formatter(yLabel, _objectSpread2(_objectSpread2({}, w), {}, { + seriesIndex: i, + dataPointIndex: j, + w: w + })) : w.globals.yLabelFormatters[0](yLabel), parseFloat(dataLabelsConfig.style.fontSize)); + } + var params = { + x: x, + y: y, + i: i, + j: j, + realIndex: realIndex, + columnGroupIndex: columnGroupIndex, + renderedPath: renderedPath, + bcx: bcx, + bcy: bcy, + barHeight: barHeight, + barWidth: barWidth, + textRects: textRects, + strokeWidth: strokeWidth, + dataLabelsX: dataLabelsX, + dataLabelsY: dataLabelsY, + dataLabelsConfig: dataLabelsConfig, + barDataLabelsConfig: barDataLabelsConfig, + barTotalDataLabelsConfig: barTotalDataLabelsConfig, + offX: offX, + offY: offY + }; + if (this.barCtx.isHorizontal) { + dataLabelsPos = this.calculateBarsDataLabelsPosition(params); + } else { + dataLabelsPos = this.calculateColumnsDataLabelsPosition(params); + } + renderedPath.attr({ + cy: dataLabelsPos.bcy, + cx: dataLabelsPos.bcx, + j: j, + val: w.globals.series[i][j], + barHeight: barHeight, + barWidth: barWidth + }); + dataLabels = this.drawCalculatedDataLabels({ + x: dataLabelsPos.dataLabelsX, + y: dataLabelsPos.dataLabelsY, + val: this.barCtx.isRangeBar ? [y1, y2] : w.config.chart.stackType === '100%' ? series[realIndex][j] : w.globals.series[realIndex][j], + i: realIndex, + j: j, + barWidth: barWidth, + barHeight: barHeight, + textRects: textRects, + dataLabelsConfig: dataLabelsConfig + }); + if (w.config.chart.stacked && barTotalDataLabelsConfig.enabled) { + totalDataLabels = this.drawTotalDataLabels({ + x: dataLabelsPos.totalDataLabelsX, + y: dataLabelsPos.totalDataLabelsY, + barWidth: barWidth, + barHeight: barHeight, + realIndex: realIndex, + textAnchor: dataLabelsPos.totalDataLabelsAnchor, + val: this.getStackedTotalDataLabel({ + realIndex: realIndex, + j: j + }), + dataLabelsConfig: dataLabelsConfig, + barTotalDataLabelsConfig: barTotalDataLabelsConfig + }); + } + return { + dataLabels: dataLabels, + totalDataLabels: totalDataLabels + }; + } + }, { + key: "getStackedTotalDataLabel", + value: function getStackedTotalDataLabel(_ref) { + var realIndex = _ref.realIndex, + j = _ref.j; + var w = this.w; + var val = this.barCtx.stackedSeriesTotals[j]; + if (this.totalFormatter) { + val = this.totalFormatter(val, _objectSpread2(_objectSpread2({}, w), {}, { + seriesIndex: realIndex, + dataPointIndex: j, + w: w + })); + } + return val; + } + }, { + key: "calculateColumnsDataLabelsPosition", + value: function calculateColumnsDataLabelsPosition(opts) { + var _this = this; + var w = this.w; + var i = opts.i, + j = opts.j, + realIndex = opts.realIndex; + opts.columnGroupIndex; + var y = opts.y, + bcx = opts.bcx, + barWidth = opts.barWidth, + barHeight = opts.barHeight, + textRects = opts.textRects, + dataLabelsX = opts.dataLabelsX, + dataLabelsY = opts.dataLabelsY, + dataLabelsConfig = opts.dataLabelsConfig, + barDataLabelsConfig = opts.barDataLabelsConfig, + barTotalDataLabelsConfig = opts.barTotalDataLabelsConfig, + strokeWidth = opts.strokeWidth, + offX = opts.offX, + offY = opts.offY; + var totalDataLabelsY; + var totalDataLabelsX; + var totalDataLabelsAnchor = 'middle'; + var totalDataLabelsBcx = bcx; + barHeight = Math.abs(barHeight); + var vertical = w.config.plotOptions.bar.dataLabels.orientation === 'vertical'; + var _this$barCtx$barHelpe = this.barCtx.barHelpers.getZeroValueEncounters({ + i: i, + j: j + }), + zeroEncounters = _this$barCtx$barHelpe.zeroEncounters; + bcx = bcx - strokeWidth / 2; + var dataPointsDividedWidth = w.globals.gridWidth / w.globals.dataPoints; + if (this.barCtx.isVerticalGroupedRangeBar) { + dataLabelsX += barWidth / 2; + } else { + if (w.globals.isXNumeric) { + dataLabelsX = bcx - barWidth / 2 + offX; + } else { + dataLabelsX = bcx - dataPointsDividedWidth + barWidth / 2 + offX; + } + if (!w.config.chart.stacked && zeroEncounters > 0 && w.config.plotOptions.bar.hideZeroBarsWhenGrouped) { + dataLabelsX -= barWidth * zeroEncounters; + } + } + if (vertical) { + var offsetDLX = 2; + dataLabelsX = dataLabelsX + textRects.height / 2 - strokeWidth / 2 - offsetDLX; + } + var valIsNegative = w.globals.series[i][j] < 0; + var newY = y; + if (this.barCtx.isReversed) { + newY = y + (valIsNegative ? barHeight : -barHeight); + } + switch (barDataLabelsConfig.position) { + case 'center': + if (vertical) { + if (valIsNegative) { + dataLabelsY = newY - barHeight / 2 + offY; + } else { + dataLabelsY = newY + barHeight / 2 - offY; + } + } else { + if (valIsNegative) { + dataLabelsY = newY - barHeight / 2 + textRects.height / 2 + offY; + } else { + dataLabelsY = newY + barHeight / 2 + textRects.height / 2 - offY; + } + } + break; + case 'bottom': + if (vertical) { + if (valIsNegative) { + dataLabelsY = newY - barHeight + offY; + } else { + dataLabelsY = newY + barHeight - offY; + } + } else { + if (valIsNegative) { + dataLabelsY = newY - barHeight + textRects.height + strokeWidth + offY; + } else { + dataLabelsY = newY + barHeight - textRects.height / 2 + strokeWidth - offY; + } + } + break; + case 'top': + if (vertical) { + if (valIsNegative) { + dataLabelsY = newY + offY; + } else { + dataLabelsY = newY - offY; + } + } else { + if (valIsNegative) { + dataLabelsY = newY - textRects.height / 2 - offY; + } else { + dataLabelsY = newY + textRects.height + offY; + } + } + break; + } + var lowestPrevY = newY; + w.globals.seriesGroups.forEach(function (sg) { + var _this$barCtx$sg$join; + (_this$barCtx$sg$join = _this.barCtx[sg.join(',')]) === null || _this$barCtx$sg$join === void 0 ? void 0 : _this$barCtx$sg$join.prevY.forEach(function (arr) { + if (valIsNegative) { + lowestPrevY = Math.max(arr[j], lowestPrevY); + } else { + lowestPrevY = Math.min(arr[j], lowestPrevY); + } + }); + }); + if (this.barCtx.lastActiveBarSerieIndex === realIndex && barTotalDataLabelsConfig.enabled) { + var ADDITIONAL_OFFY = 18; + var graphics = new Graphics(this.barCtx.ctx); + var totalLabeltextRects = graphics.getTextRects(this.getStackedTotalDataLabel({ + realIndex: realIndex, + j: j + }), dataLabelsConfig.fontSize); + if (valIsNegative) { + totalDataLabelsY = lowestPrevY - totalLabeltextRects.height / 2 - offY - barTotalDataLabelsConfig.offsetY + ADDITIONAL_OFFY; + } else { + totalDataLabelsY = lowestPrevY + totalLabeltextRects.height + offY + barTotalDataLabelsConfig.offsetY - ADDITIONAL_OFFY; + } + + // width divided into equal parts + var xDivision = dataPointsDividedWidth; + totalDataLabelsX = totalDataLabelsBcx + (w.globals.isXNumeric ? -barWidth * w.globals.barGroups.length / 2 : w.globals.barGroups.length * barWidth / 2 - (w.globals.barGroups.length - 1) * barWidth - xDivision) + barTotalDataLabelsConfig.offsetX; + } + if (!w.config.chart.stacked) { + if (dataLabelsY < 0) { + dataLabelsY = 0 + strokeWidth; + } else if (dataLabelsY + textRects.height / 3 > w.globals.gridHeight) { + dataLabelsY = w.globals.gridHeight - strokeWidth; + } + } + return { + bcx: bcx, + bcy: y, + dataLabelsX: dataLabelsX, + dataLabelsY: dataLabelsY, + totalDataLabelsX: totalDataLabelsX, + totalDataLabelsY: totalDataLabelsY, + totalDataLabelsAnchor: totalDataLabelsAnchor + }; + } + }, { + key: "calculateBarsDataLabelsPosition", + value: function calculateBarsDataLabelsPosition(opts) { + var _this2 = this; + var w = this.w; + var x = opts.x, + i = opts.i, + j = opts.j, + realIndex = opts.realIndex, + bcy = opts.bcy, + barHeight = opts.barHeight, + barWidth = opts.barWidth, + textRects = opts.textRects, + dataLabelsX = opts.dataLabelsX, + strokeWidth = opts.strokeWidth, + dataLabelsConfig = opts.dataLabelsConfig, + barDataLabelsConfig = opts.barDataLabelsConfig, + barTotalDataLabelsConfig = opts.barTotalDataLabelsConfig, + offX = opts.offX, + offY = opts.offY; + var dataPointsDividedHeight = w.globals.gridHeight / w.globals.dataPoints; + var _this$barCtx$barHelpe2 = this.barCtx.barHelpers.getZeroValueEncounters({ + i: i, + j: j + }), + zeroEncounters = _this$barCtx$barHelpe2.zeroEncounters; + barWidth = Math.abs(barWidth); + var dataLabelsY = bcy - (this.barCtx.isRangeBar ? 0 : dataPointsDividedHeight) + barHeight / 2 + textRects.height / 2 + offY - 3; + if (!w.config.chart.stacked && zeroEncounters > 0 && w.config.plotOptions.bar.hideZeroBarsWhenGrouped) { + dataLabelsY -= barHeight * zeroEncounters; + } + var totalDataLabelsX; + var totalDataLabelsY; + var totalDataLabelsAnchor = 'start'; + var valIsNegative = w.globals.series[i][j] < 0; + var newX = x; + if (this.barCtx.isReversed) { + newX = x + (valIsNegative ? -barWidth : barWidth); + totalDataLabelsAnchor = valIsNegative ? 'start' : 'end'; + } + switch (barDataLabelsConfig.position) { + case 'center': + if (valIsNegative) { + dataLabelsX = newX + barWidth / 2 - offX; + } else { + dataLabelsX = Math.max(textRects.width / 2, newX - barWidth / 2) + offX; + } + break; + case 'bottom': + if (valIsNegative) { + dataLabelsX = newX + barWidth - strokeWidth - offX; + } else { + dataLabelsX = newX - barWidth + strokeWidth + offX; + } + break; + case 'top': + if (valIsNegative) { + dataLabelsX = newX - strokeWidth - offX; + } else { + dataLabelsX = newX - strokeWidth + offX; + } + break; + } + var lowestPrevX = newX; + w.globals.seriesGroups.forEach(function (sg) { + var _this2$barCtx$sg$join; + (_this2$barCtx$sg$join = _this2.barCtx[sg.join(',')]) === null || _this2$barCtx$sg$join === void 0 ? void 0 : _this2$barCtx$sg$join.prevX.forEach(function (arr) { + if (valIsNegative) { + lowestPrevX = Math.min(arr[j], lowestPrevX); + } else { + lowestPrevX = Math.max(arr[j], lowestPrevX); + } + }); + }); + if (this.barCtx.lastActiveBarSerieIndex === realIndex && barTotalDataLabelsConfig.enabled) { + var graphics = new Graphics(this.barCtx.ctx); + var totalLabeltextRects = graphics.getTextRects(this.getStackedTotalDataLabel({ + realIndex: realIndex, + j: j + }), dataLabelsConfig.fontSize); + if (valIsNegative) { + totalDataLabelsX = lowestPrevX - strokeWidth - offX - barTotalDataLabelsConfig.offsetX; + totalDataLabelsAnchor = 'end'; + } else { + totalDataLabelsX = lowestPrevX + offX + barTotalDataLabelsConfig.offsetX + (this.barCtx.isReversed ? -(barWidth + strokeWidth) : strokeWidth); + } + totalDataLabelsY = dataLabelsY - textRects.height / 2 + totalLabeltextRects.height / 2 + barTotalDataLabelsConfig.offsetY + strokeWidth; + if (w.globals.barGroups.length > 1) { + totalDataLabelsY = totalDataLabelsY - w.globals.barGroups.length / 2 * (barHeight / 2); + } + } + if (!w.config.chart.stacked) { + if (dataLabelsConfig.textAnchor === 'start') { + if (dataLabelsX - textRects.width < 0) { + dataLabelsX = valIsNegative ? textRects.width + strokeWidth : strokeWidth; + } else if (dataLabelsX + textRects.width > w.globals.gridWidth) { + dataLabelsX = valIsNegative ? w.globals.gridWidth - strokeWidth : w.globals.gridWidth - textRects.width - strokeWidth; + } + } else if (dataLabelsConfig.textAnchor === 'middle') { + if (dataLabelsX - textRects.width / 2 < 0) { + dataLabelsX = textRects.width / 2 + strokeWidth; + } else if (dataLabelsX + textRects.width / 2 > w.globals.gridWidth) { + dataLabelsX = w.globals.gridWidth - textRects.width / 2 - strokeWidth; + } + } else if (dataLabelsConfig.textAnchor === 'end') { + if (dataLabelsX < 1) { + dataLabelsX = textRects.width + strokeWidth; + } else if (dataLabelsX + 1 > w.globals.gridWidth) { + dataLabelsX = w.globals.gridWidth - textRects.width - strokeWidth; + } + } + } + return { + bcx: x, + bcy: bcy, + dataLabelsX: dataLabelsX, + dataLabelsY: dataLabelsY, + totalDataLabelsX: totalDataLabelsX, + totalDataLabelsY: totalDataLabelsY, + totalDataLabelsAnchor: totalDataLabelsAnchor + }; + } + }, { + key: "drawCalculatedDataLabels", + value: function drawCalculatedDataLabels(_ref2) { + var x = _ref2.x, + y = _ref2.y, + val = _ref2.val, + i = _ref2.i, + j = _ref2.j, + textRects = _ref2.textRects, + barHeight = _ref2.barHeight, + barWidth = _ref2.barWidth, + dataLabelsConfig = _ref2.dataLabelsConfig; + var w = this.w; + var rotate = 'rotate(0)'; + if (w.config.plotOptions.bar.dataLabels.orientation === 'vertical') rotate = "rotate(-90, ".concat(x, ", ").concat(y, ")"); + var dataLabels = new DataLabels(this.barCtx.ctx); + var graphics = new Graphics(this.barCtx.ctx); + var formatter = dataLabelsConfig.formatter; + var elDataLabelsWrap = null; + var isSeriesNotCollapsed = w.globals.collapsedSeriesIndices.indexOf(i) > -1; + if (dataLabelsConfig.enabled && !isSeriesNotCollapsed) { + elDataLabelsWrap = graphics.group({ + class: 'apexcharts-data-labels', + transform: rotate + }); + var text = ''; + if (typeof val !== 'undefined') { + text = formatter(val, _objectSpread2(_objectSpread2({}, w), {}, { + seriesIndex: i, + dataPointIndex: j, + w: w + })); + } + if (!val && w.config.plotOptions.bar.hideZeroBarsWhenGrouped) { + text = ''; + } + var valIsNegative = w.globals.series[i][j] < 0; + var position = w.config.plotOptions.bar.dataLabels.position; + if (w.config.plotOptions.bar.dataLabels.orientation === 'vertical') { + if (position === 'top') { + if (valIsNegative) dataLabelsConfig.textAnchor = 'end';else dataLabelsConfig.textAnchor = 'start'; + } + if (position === 'center') { + dataLabelsConfig.textAnchor = 'middle'; + } + if (position === 'bottom') { + if (valIsNegative) dataLabelsConfig.textAnchor = 'end';else dataLabelsConfig.textAnchor = 'start'; + } + } + if (this.barCtx.isRangeBar && this.barCtx.barOptions.dataLabels.hideOverflowingLabels) { + // hide the datalabel if it cannot fit into the rect + var txRect = graphics.getTextRects(text, parseFloat(dataLabelsConfig.style.fontSize)); + if (barWidth < txRect.width) { + text = ''; + } + } + if (w.config.chart.stacked && this.barCtx.barOptions.dataLabels.hideOverflowingLabels) { + // if there is not enough space to draw the label in the bar/column rect, check hideOverflowingLabels property to prevent overflowing on wrong rect + // Note: This issue is only seen in stacked charts + if (this.barCtx.isHorizontal) { + if (textRects.width / 1.6 > Math.abs(barWidth)) { + text = ''; + } + } else { + if (textRects.height / 1.6 > Math.abs(barHeight)) { + text = ''; + } + } + } + var modifiedDataLabelsConfig = _objectSpread2({}, dataLabelsConfig); + if (this.barCtx.isHorizontal) { + if (val < 0) { + if (dataLabelsConfig.textAnchor === 'start') { + modifiedDataLabelsConfig.textAnchor = 'end'; + } else if (dataLabelsConfig.textAnchor === 'end') { + modifiedDataLabelsConfig.textAnchor = 'start'; + } + } + } + dataLabels.plotDataLabelsText({ + x: x, + y: y, + text: text, + i: i, + j: j, + parent: elDataLabelsWrap, + dataLabelsConfig: modifiedDataLabelsConfig, + alwaysDrawDataLabel: true, + offsetCorrection: true + }); + } + return elDataLabelsWrap; + } + }, { + key: "drawTotalDataLabels", + value: function drawTotalDataLabels(_ref3) { + var x = _ref3.x, + y = _ref3.y, + val = _ref3.val, + realIndex = _ref3.realIndex, + textAnchor = _ref3.textAnchor, + barTotalDataLabelsConfig = _ref3.barTotalDataLabelsConfig; + this.w; + var graphics = new Graphics(this.barCtx.ctx); + var totalDataLabelText; + if (barTotalDataLabelsConfig.enabled && typeof x !== 'undefined' && typeof y !== 'undefined' && this.barCtx.lastActiveBarSerieIndex === realIndex) { + totalDataLabelText = graphics.drawText({ + x: x, + y: y, + foreColor: barTotalDataLabelsConfig.style.color, + text: val, + textAnchor: textAnchor, + fontFamily: barTotalDataLabelsConfig.style.fontFamily, + fontSize: barTotalDataLabelsConfig.style.fontSize, + fontWeight: barTotalDataLabelsConfig.style.fontWeight + }); + } + return totalDataLabelText; + } + }]); + return BarDataLabels; + }(); + + var Helpers$1 = /*#__PURE__*/function () { + function Helpers(barCtx) { + _classCallCheck(this, Helpers); + this.w = barCtx.w; + this.barCtx = barCtx; + } + _createClass(Helpers, [{ + key: "initVariables", + value: function initVariables(series) { + var w = this.w; + this.barCtx.series = series; + this.barCtx.totalItems = 0; + this.barCtx.seriesLen = 0; + this.barCtx.visibleI = -1; // visible Series + this.barCtx.visibleItems = 1; // number of visible bars after user zoomed in/out + + for (var sl = 0; sl < series.length; sl++) { + if (series[sl].length > 0) { + this.barCtx.seriesLen = this.barCtx.seriesLen + 1; + this.barCtx.totalItems += series[sl].length; + } + if (w.globals.isXNumeric) { + // get max visible items + for (var _j = 0; _j < series[sl].length; _j++) { + if (w.globals.seriesX[sl][_j] > w.globals.minX && w.globals.seriesX[sl][_j] < w.globals.maxX) { + this.barCtx.visibleItems++; + } + } + } else { + this.barCtx.visibleItems = w.globals.dataPoints; + } + } + this.arrBorderRadius = this.createBorderRadiusArr(w.globals.series); + if (this.barCtx.seriesLen === 0) { + // A small adjustment when combo charts are used + this.barCtx.seriesLen = 1; + } + this.barCtx.zeroSerieses = []; + if (!w.globals.comboCharts) { + this.checkZeroSeries({ + series: series + }); + } + } + }, { + key: "initialPositions", + value: function initialPositions(realIndex) { + var w = this.w; + var x, y, yDivision, xDivision, barHeight, barWidth, zeroH, zeroW; + var dataPoints = w.globals.dataPoints; + if (this.barCtx.isRangeBar) { + // timeline rangebar chart + dataPoints = w.globals.labels.length; + } + var seriesLen = this.barCtx.seriesLen; + if (w.config.plotOptions.bar.rangeBarGroupRows) { + seriesLen = 1; + } + if (this.barCtx.isHorizontal) { + // height divided into equal parts + yDivision = w.globals.gridHeight / dataPoints; + barHeight = yDivision / seriesLen; + if (w.globals.isXNumeric) { + yDivision = w.globals.gridHeight / this.barCtx.totalItems; + barHeight = yDivision / this.barCtx.seriesLen; + } + barHeight = barHeight * parseInt(this.barCtx.barOptions.barHeight, 10) / 100; + if (String(this.barCtx.barOptions.barHeight).indexOf('%') === -1) { + barHeight = parseInt(this.barCtx.barOptions.barHeight, 10); + } + zeroW = this.barCtx.baseLineInvertedY + w.globals.padHorizontal + (this.barCtx.isReversed ? w.globals.gridWidth : 0) - (this.barCtx.isReversed ? this.barCtx.baseLineInvertedY * 2 : 0); + if (this.barCtx.isFunnel) { + zeroW = w.globals.gridWidth / 2; + } + y = (yDivision - barHeight * this.barCtx.seriesLen) / 2; + } else { + // width divided into equal parts + xDivision = w.globals.gridWidth / this.barCtx.visibleItems; + if (w.config.xaxis.convertedCatToNumeric) { + xDivision = w.globals.gridWidth / w.globals.dataPoints; + } + barWidth = xDivision / seriesLen * parseInt(this.barCtx.barOptions.columnWidth, 10) / 100; + if (w.globals.isXNumeric) { + // max barwidth should be equal to minXDiff to avoid overlap + var xRatio = this.barCtx.xRatio; + if (w.globals.minXDiff && w.globals.minXDiff !== 0.5 && w.globals.minXDiff / xRatio > 0) { + xDivision = w.globals.minXDiff / xRatio; + } + barWidth = xDivision / seriesLen * parseInt(this.barCtx.barOptions.columnWidth, 10) / 100; + if (barWidth < 1) { + barWidth = 1; + } + } + if (String(this.barCtx.barOptions.columnWidth).indexOf('%') === -1) { + barWidth = parseInt(this.barCtx.barOptions.columnWidth, 10); + } + zeroH = w.globals.gridHeight - this.barCtx.baseLineY[this.barCtx.translationsIndex] - (this.barCtx.isReversed ? w.globals.gridHeight : 0) + (this.barCtx.isReversed ? this.barCtx.baseLineY[this.barCtx.translationsIndex] * 2 : 0); + if (w.globals.isXNumeric) { + var xForNumericX = this.barCtx.getBarXForNumericXAxis({ + x: x, + j: 0, + realIndex: realIndex, + barWidth: barWidth + }); + x = xForNumericX.x; + } else { + x = w.globals.padHorizontal + Utils$1.noExponents(xDivision - barWidth * this.barCtx.seriesLen) / 2; + } + } + w.globals.barHeight = barHeight; + w.globals.barWidth = barWidth; + return { + x: x, + y: y, + yDivision: yDivision, + xDivision: xDivision, + barHeight: barHeight, + barWidth: barWidth, + zeroH: zeroH, + zeroW: zeroW + }; + } + }, { + key: "initializeStackedPrevVars", + value: function initializeStackedPrevVars(ctx) { + var w = ctx.w; + w.globals.seriesGroups.forEach(function (group) { + if (!ctx[group]) ctx[group] = {}; + ctx[group].prevY = []; + ctx[group].prevX = []; + ctx[group].prevYF = []; + ctx[group].prevXF = []; + ctx[group].prevYVal = []; + ctx[group].prevXVal = []; + }); + } + }, { + key: "initializeStackedXYVars", + value: function initializeStackedXYVars(ctx) { + var w = ctx.w; + w.globals.seriesGroups.forEach(function (group) { + if (!ctx[group]) ctx[group] = {}; + ctx[group].xArrj = []; + ctx[group].xArrjF = []; + ctx[group].xArrjVal = []; + ctx[group].yArrj = []; + ctx[group].yArrjF = []; + ctx[group].yArrjVal = []; + }); + } + }, { + key: "getPathFillColor", + value: function getPathFillColor(series, i, j, realIndex) { + var _w$config$series$i$da, _w$config$series$i$da2, _w$config$series$i$da3, _w$config$series$i$da4; + var w = this.w; + var fill = this.barCtx.ctx.fill; + var fillColor = null; + var seriesNumber = this.barCtx.barOptions.distributed ? j : i; + var useRangeColor = false; + if (this.barCtx.barOptions.colors.ranges.length > 0) { + var colorRange = this.barCtx.barOptions.colors.ranges; + colorRange.map(function (range) { + if (series[i][j] >= range.from && series[i][j] <= range.to) { + fillColor = range.color; + useRangeColor = true; + } + }); + } + var pathFill = fill.fillPath({ + seriesNumber: this.barCtx.barOptions.distributed ? seriesNumber : realIndex, + dataPointIndex: j, + color: fillColor, + value: series[i][j], + fillConfig: (_w$config$series$i$da = w.config.series[i].data[j]) === null || _w$config$series$i$da === void 0 ? void 0 : _w$config$series$i$da.fill, + fillType: (_w$config$series$i$da2 = w.config.series[i].data[j]) !== null && _w$config$series$i$da2 !== void 0 && (_w$config$series$i$da3 = _w$config$series$i$da2.fill) !== null && _w$config$series$i$da3 !== void 0 && _w$config$series$i$da3.type ? (_w$config$series$i$da4 = w.config.series[i].data[j]) === null || _w$config$series$i$da4 === void 0 ? void 0 : _w$config$series$i$da4.fill.type : Array.isArray(w.config.fill.type) ? w.config.fill.type[realIndex] : w.config.fill.type + }); + return { + color: pathFill, + useRangeColor: useRangeColor + }; + } + }, { + key: "getStrokeWidth", + value: function getStrokeWidth(i, j, realIndex) { + var strokeWidth = 0; + var w = this.w; + if (!this.barCtx.series[i][j]) { + this.barCtx.isNullValue = true; + } else { + this.barCtx.isNullValue = false; + } + if (w.config.stroke.show) { + if (!this.barCtx.isNullValue) { + strokeWidth = Array.isArray(this.barCtx.strokeWidth) ? this.barCtx.strokeWidth[realIndex] : this.barCtx.strokeWidth; + } + } + return strokeWidth; + } + }, { + key: "createBorderRadiusArr", + value: function createBorderRadiusArr(series) { + var _series$; + var w = this.w; + var alwaysApplyRadius = !this.w.config.chart.stacked || w.config.plotOptions.bar.borderRadius <= 0; + var numSeries = series.length; + var numColumns = ((_series$ = series[0]) === null || _series$ === void 0 ? void 0 : _series$.length) | 0; + var output = Array.from({ + length: numSeries + }, function () { + return Array(numColumns).fill(alwaysApplyRadius ? 'top' : 'none'); + }); + if (alwaysApplyRadius) return output; + for (var _j2 = 0; _j2 < numColumns; _j2++) { + var positiveIndices = []; + var negativeIndices = []; + var nonZeroCount = 0; + + // Collect positive and negative indices + for (var i = 0; i < numSeries; i++) { + var value = series[i][_j2]; + if (value > 0) { + positiveIndices.push(i); + nonZeroCount++; + } else if (value < 0) { + negativeIndices.push(i); + nonZeroCount++; + } + } + if (positiveIndices.length > 0 && negativeIndices.length === 0) { + // Only positive values in this column + if (positiveIndices.length === 1) { + // Single positive value + output[positiveIndices[0]][_j2] = 'both'; + } else { + // Multiple positive values + var firstPositiveIndex = positiveIndices[0]; + var lastPositiveIndex = positiveIndices[positiveIndices.length - 1]; + var _iterator = _createForOfIteratorHelper(positiveIndices), + _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var _i2 = _step.value; + if (_i2 === firstPositiveIndex) { + output[_i2][_j2] = 'bottom'; + } else if (_i2 === lastPositiveIndex) { + output[_i2][_j2] = 'top'; + } else { + output[_i2][_j2] = 'none'; + } + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + } + } else if (negativeIndices.length > 0 && positiveIndices.length === 0) { + // Only negative values in this column + if (negativeIndices.length === 1) { + // Single negative value + output[negativeIndices[0]][_j2] = 'both'; + } else { + // Multiple negative values + var highestNegativeIndex = Math.max.apply(Math, negativeIndices); + var lowestNegativeIndex = Math.min.apply(Math, negativeIndices); + var _iterator2 = _createForOfIteratorHelper(negativeIndices), + _step2; + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { + var _i3 = _step2.value; + if (_i3 === highestNegativeIndex) { + output[_i3][_j2] = 'bottom'; // Closest to axis + } else if (_i3 === lowestNegativeIndex) { + output[_i3][_j2] = 'top'; // Farthest from axis + } else { + output[_i3][_j2] = 'none'; + } + } + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); + } + } + } else if (positiveIndices.length > 0 && negativeIndices.length > 0) { + // Mixed positive and negative values + // Assign 'top' to the last positive bar + var _lastPositiveIndex = positiveIndices[positiveIndices.length - 1]; + var _iterator3 = _createForOfIteratorHelper(positiveIndices), + _step3; + try { + for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { + var _i4 = _step3.value; + if (_i4 === _lastPositiveIndex) { + output[_i4][_j2] = 'top'; + } else { + output[_i4][_j2] = 'none'; + } + } + // Assign 'bottom' to the highest negative index (closest to axis) + } catch (err) { + _iterator3.e(err); + } finally { + _iterator3.f(); + } + var _highestNegativeIndex = Math.max.apply(Math, negativeIndices); + var _iterator4 = _createForOfIteratorHelper(negativeIndices), + _step4; + try { + for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { + var _i5 = _step4.value; + if (_i5 === _highestNegativeIndex) { + output[_i5][_j2] = 'bottom'; + } else { + output[_i5][_j2] = 'none'; + } + } + } catch (err) { + _iterator4.e(err); + } finally { + _iterator4.f(); + } + } else if (nonZeroCount === 1) { + // Only one non-zero value (either positive or negative) + var index = positiveIndices[0] || negativeIndices[0]; + output[index][_j2] = 'both'; + } + } + return output; + } + }, { + key: "barBackground", + value: function barBackground(_ref) { + var j = _ref.j, + i = _ref.i, + x1 = _ref.x1, + x2 = _ref.x2, + y1 = _ref.y1, + y2 = _ref.y2, + elSeries = _ref.elSeries; + var w = this.w; + var graphics = new Graphics(this.barCtx.ctx); + var sr = new Series(this.barCtx.ctx); + var activeSeriesIndex = sr.getActiveConfigSeriesIndex(); + if (this.barCtx.barOptions.colors.backgroundBarColors.length > 0 && activeSeriesIndex === i) { + if (j >= this.barCtx.barOptions.colors.backgroundBarColors.length) { + j %= this.barCtx.barOptions.colors.backgroundBarColors.length; + } + var bcolor = this.barCtx.barOptions.colors.backgroundBarColors[j]; + var rect = graphics.drawRect(typeof x1 !== 'undefined' ? x1 : 0, typeof y1 !== 'undefined' ? y1 : 0, typeof x2 !== 'undefined' ? x2 : w.globals.gridWidth, typeof y2 !== 'undefined' ? y2 : w.globals.gridHeight, this.barCtx.barOptions.colors.backgroundBarRadius, bcolor, this.barCtx.barOptions.colors.backgroundBarOpacity); + elSeries.add(rect); + rect.node.classList.add('apexcharts-backgroundBar'); + } + } + }, { + key: "getColumnPaths", + value: function getColumnPaths(_ref2) { + var _w$config$series$real; + var barWidth = _ref2.barWidth, + barXPosition = _ref2.barXPosition, + y1 = _ref2.y1, + y2 = _ref2.y2, + strokeWidth = _ref2.strokeWidth, + isReversed = _ref2.isReversed, + series = _ref2.series, + seriesGroup = _ref2.seriesGroup, + realIndex = _ref2.realIndex, + i = _ref2.i, + j = _ref2.j, + w = _ref2.w; + var graphics = new Graphics(this.barCtx.ctx); + strokeWidth = Array.isArray(strokeWidth) ? strokeWidth[realIndex] : strokeWidth; + if (!strokeWidth) strokeWidth = 0; + var bW = barWidth; + var bXP = barXPosition; + if ((_w$config$series$real = w.config.series[realIndex].data[j]) !== null && _w$config$series$real !== void 0 && _w$config$series$real.columnWidthOffset) { + bXP = barXPosition - w.config.series[realIndex].data[j].columnWidthOffset / 2; + bW = barWidth + w.config.series[realIndex].data[j].columnWidthOffset; + } + + // Center the stroke on the coordinates + var strokeCenter = strokeWidth / 2; + var x1 = bXP + strokeCenter; + var x2 = bXP + bW - strokeCenter; + var direction = (series[i][j] >= 0 ? 1 : -1) * (isReversed ? -1 : 1); + + // append tiny pixels to avoid exponentials (which cause issues in border-radius) + y1 += 0.001 - strokeCenter * direction; + y2 += 0.001 + strokeCenter * direction; + var pathTo = graphics.move(x1, y1); + var pathFrom = graphics.move(x1, y1); + var sl = graphics.line(x2, y1); + if (w.globals.previousPaths.length > 0) { + pathFrom = this.barCtx.getPreviousPath(realIndex, j, false); + } + pathTo = pathTo + graphics.line(x1, y2) + graphics.line(x2, y2) + sl + (w.config.plotOptions.bar.borderRadiusApplication === 'around' || this.arrBorderRadius[realIndex][j] === 'both' ? ' Z' : ' z'); + + // the lines in pathFrom are repeated to equal it to the points of pathTo + // this is to avoid weird animation (bug in svg.js) + pathFrom = pathFrom + graphics.line(x1, y1) + sl + sl + sl + sl + sl + graphics.line(x1, y1) + (w.config.plotOptions.bar.borderRadiusApplication === 'around' || this.arrBorderRadius[realIndex][j] === 'both' ? ' Z' : ' z'); + if (this.arrBorderRadius[realIndex][j] !== 'none') { + pathTo = graphics.roundPathCorners(pathTo, w.config.plotOptions.bar.borderRadius); + } + if (w.config.chart.stacked) { + var _ctx = this.barCtx; + _ctx = this.barCtx[seriesGroup]; + _ctx.yArrj.push(y2 - strokeCenter * direction); + _ctx.yArrjF.push(Math.abs(y1 - y2 + strokeWidth * direction)); + _ctx.yArrjVal.push(this.barCtx.series[i][j]); + } + return { + pathTo: pathTo, + pathFrom: pathFrom + }; + } + }, { + key: "getBarpaths", + value: function getBarpaths(_ref3) { + var _w$config$series$real2; + var barYPosition = _ref3.barYPosition, + barHeight = _ref3.barHeight, + x1 = _ref3.x1, + x2 = _ref3.x2, + strokeWidth = _ref3.strokeWidth, + isReversed = _ref3.isReversed, + series = _ref3.series, + seriesGroup = _ref3.seriesGroup, + realIndex = _ref3.realIndex, + i = _ref3.i, + j = _ref3.j, + w = _ref3.w; + var graphics = new Graphics(this.barCtx.ctx); + strokeWidth = Array.isArray(strokeWidth) ? strokeWidth[realIndex] : strokeWidth; + if (!strokeWidth) strokeWidth = 0; + var bYP = barYPosition; + var bH = barHeight; + if ((_w$config$series$real2 = w.config.series[realIndex].data[j]) !== null && _w$config$series$real2 !== void 0 && _w$config$series$real2.barHeightOffset) { + bYP = barYPosition - w.config.series[realIndex].data[j].barHeightOffset / 2; + bH = barHeight + w.config.series[realIndex].data[j].barHeightOffset; + } + + // Center the stroke on the coordinates + var strokeCenter = strokeWidth / 2; + var y1 = bYP + strokeCenter; + var y2 = bYP + bH - strokeCenter; + var direction = (series[i][j] >= 0 ? 1 : -1) * (isReversed ? -1 : 1); + + // append tiny pixels to avoid exponentials (which cause issues in border-radius) + x1 += 0.001 + strokeCenter * direction; + x2 += 0.001 - strokeCenter * direction; + var pathTo = graphics.move(x1, y1); + var pathFrom = graphics.move(x1, y1); + if (w.globals.previousPaths.length > 0) { + pathFrom = this.barCtx.getPreviousPath(realIndex, j, false); + } + var sl = graphics.line(x1, y2); + pathTo = pathTo + graphics.line(x2, y1) + graphics.line(x2, y2) + sl + (w.config.plotOptions.bar.borderRadiusApplication === 'around' || this.arrBorderRadius[realIndex][j] === 'both' ? ' Z' : ' z'); + pathFrom = pathFrom + graphics.line(x1, y1) + sl + sl + sl + sl + sl + graphics.line(x1, y1) + (w.config.plotOptions.bar.borderRadiusApplication === 'around' || this.arrBorderRadius[realIndex][j] === 'both' ? ' Z' : ' z'); + if (this.arrBorderRadius[realIndex][j] !== 'none') { + pathTo = graphics.roundPathCorners(pathTo, w.config.plotOptions.bar.borderRadius); + } + if (w.config.chart.stacked) { + var _ctx = this.barCtx; + _ctx = this.barCtx[seriesGroup]; + _ctx.xArrj.push(x2 + strokeCenter * direction); + _ctx.xArrjF.push(Math.abs(x1 - x2 - strokeWidth * direction)); + _ctx.xArrjVal.push(this.barCtx.series[i][j]); + } + return { + pathTo: pathTo, + pathFrom: pathFrom + }; + } + }, { + key: "checkZeroSeries", + value: function checkZeroSeries(_ref4) { + var series = _ref4.series; + var w = this.w; + for (var zs = 0; zs < series.length; zs++) { + var total = 0; + for (var zsj = 0; zsj < series[w.globals.maxValsInArrayIndex].length; zsj++) { + total += series[zs][zsj]; + } + if (total === 0) { + this.barCtx.zeroSerieses.push(zs); + } + } + } + }, { + key: "getXForValue", + value: function getXForValue(value, zeroW) { + var zeroPositionForNull = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + var xForVal = zeroPositionForNull ? zeroW : null; + if (typeof value !== 'undefined' && value !== null) { + xForVal = zeroW + value / this.barCtx.invertedYRatio - (this.barCtx.isReversed ? value / this.barCtx.invertedYRatio : 0) * 2; + } + return xForVal; + } + }, { + key: "getYForValue", + value: function getYForValue(value, zeroH, translationsIndex) { + var zeroPositionForNull = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; + var yForVal = zeroPositionForNull ? zeroH : null; + if (typeof value !== 'undefined' && value !== null) { + yForVal = zeroH - value / this.barCtx.yRatio[translationsIndex] + (this.barCtx.isReversed ? value / this.barCtx.yRatio[translationsIndex] : 0) * 2; + } + return yForVal; + } + }, { + key: "getGoalValues", + value: function getGoalValues(type, zeroW, zeroH, i, j, translationsIndex) { + var _this = this; + var w = this.w; + var goals = []; + var pushGoal = function pushGoal(value, attrs) { + var _goals$push; + goals.push((_goals$push = {}, _defineProperty(_goals$push, type, type === 'x' ? _this.getXForValue(value, zeroW, false) : _this.getYForValue(value, zeroH, translationsIndex, false)), _defineProperty(_goals$push, "attrs", attrs), _goals$push)); + }; + if (w.globals.seriesGoals[i] && w.globals.seriesGoals[i][j] && Array.isArray(w.globals.seriesGoals[i][j])) { + w.globals.seriesGoals[i][j].forEach(function (goal) { + pushGoal(goal.value, goal); + }); + } + if (this.barCtx.barOptions.isDumbbell && w.globals.seriesRange.length) { + var colors = this.barCtx.barOptions.dumbbellColors ? this.barCtx.barOptions.dumbbellColors : w.globals.colors; + var commonAttrs = { + strokeHeight: type === 'x' ? 0 : w.globals.markers.size[i], + strokeWidth: type === 'x' ? w.globals.markers.size[i] : 0, + strokeDashArray: 0, + strokeLineCap: 'round', + strokeColor: Array.isArray(colors[i]) ? colors[i][0] : colors[i] + }; + pushGoal(w.globals.seriesRangeStart[i][j], commonAttrs); + pushGoal(w.globals.seriesRangeEnd[i][j], _objectSpread2(_objectSpread2({}, commonAttrs), {}, { + strokeColor: Array.isArray(colors[i]) ? colors[i][1] : colors[i] + })); + } + return goals; + } + }, { + key: "drawGoalLine", + value: function drawGoalLine(_ref5) { + var barXPosition = _ref5.barXPosition, + barYPosition = _ref5.barYPosition, + goalX = _ref5.goalX, + goalY = _ref5.goalY, + barWidth = _ref5.barWidth, + barHeight = _ref5.barHeight; + var graphics = new Graphics(this.barCtx.ctx); + var lineGroup = graphics.group({ + className: 'apexcharts-bar-goals-groups' + }); + lineGroup.node.classList.add('apexcharts-element-hidden'); + this.barCtx.w.globals.delayedElements.push({ + el: lineGroup.node + }); + lineGroup.attr('clip-path', "url(#gridRectMarkerMask".concat(this.barCtx.w.globals.cuid, ")")); + var line = null; + if (this.barCtx.isHorizontal) { + if (Array.isArray(goalX)) { + goalX.forEach(function (goal) { + // Need a tiny margin of 1 each side so goals don't disappear at extremeties + if (goal.x >= -1 && goal.x <= graphics.w.globals.gridWidth + 1) { + var sHeight = typeof goal.attrs.strokeHeight !== 'undefined' ? goal.attrs.strokeHeight : barHeight / 2; + var y = barYPosition + sHeight + barHeight / 2; + line = graphics.drawLine(goal.x, y - sHeight * 2, goal.x, y, goal.attrs.strokeColor ? goal.attrs.strokeColor : undefined, goal.attrs.strokeDashArray, goal.attrs.strokeWidth ? goal.attrs.strokeWidth : 2, goal.attrs.strokeLineCap); + lineGroup.add(line); + } + }); + } + } else { + if (Array.isArray(goalY)) { + goalY.forEach(function (goal) { + // Need a tiny margin of 1 each side so goals don't disappear at extremeties + if (goal.y >= -1 && goal.y <= graphics.w.globals.gridHeight + 1) { + var sWidth = typeof goal.attrs.strokeWidth !== 'undefined' ? goal.attrs.strokeWidth : barWidth / 2; + var x = barXPosition + sWidth + barWidth / 2; + line = graphics.drawLine(x - sWidth * 2, goal.y, x, goal.y, goal.attrs.strokeColor ? goal.attrs.strokeColor : undefined, goal.attrs.strokeDashArray, goal.attrs.strokeHeight ? goal.attrs.strokeHeight : 2, goal.attrs.strokeLineCap); + lineGroup.add(line); + } + }); + } + } + return lineGroup; + } + }, { + key: "drawBarShadow", + value: function drawBarShadow(_ref6) { + var prevPaths = _ref6.prevPaths, + currPaths = _ref6.currPaths, + color = _ref6.color; + var w = this.w; + var prevX2 = prevPaths.x, + prevX1 = prevPaths.x1, + prevY1 = prevPaths.barYPosition; + var currX2 = currPaths.x, + currX1 = currPaths.x1, + currY1 = currPaths.barYPosition; + var prevY2 = prevY1 + currPaths.barHeight; + var graphics = new Graphics(this.barCtx.ctx); + var utils = new Utils$1(); + var shadowPath = graphics.move(prevX1, prevY2) + graphics.line(prevX2, prevY2) + graphics.line(currX2, currY1) + graphics.line(currX1, currY1) + graphics.line(prevX1, prevY2) + (w.config.plotOptions.bar.borderRadiusApplication === 'around' || this.arrBorderRadius[realIndex][j] === 'both' ? ' Z' : ' z'); + return graphics.drawPath({ + d: shadowPath, + fill: utils.shadeColor(0.5, Utils$1.rgb2hex(color)), + stroke: 'none', + strokeWidth: 0, + fillOpacity: 1, + classes: 'apexcharts-bar-shadow apexcharts-decoration-element' + }); + } + }, { + key: "getZeroValueEncounters", + value: function getZeroValueEncounters(_ref7) { + var _w$globals$columnSeri; + var i = _ref7.i, + j = _ref7.j; + var w = this.w; + var nonZeroColumns = 0; + var zeroEncounters = 0; + var seriesIndices = w.config.plotOptions.bar.horizontal ? w.globals.series.map(function (_, _i) { + return _i; + }) : ((_w$globals$columnSeri = w.globals.columnSeries) === null || _w$globals$columnSeri === void 0 ? void 0 : _w$globals$columnSeri.i.map(function (_i) { + return _i; + })) || []; + seriesIndices.forEach(function (_si) { + var val = w.globals.seriesPercent[_si][j]; + if (val) { + nonZeroColumns++; + } + if (_si < i && val === 0) { + zeroEncounters++; + } + }); + return { + nonZeroColumns: nonZeroColumns, + zeroEncounters: zeroEncounters + }; + } + }, { + key: "getGroupIndex", + value: function getGroupIndex(seriesIndex) { + var w = this.w; + // groupIndex is the index of group buckets (group1, group2, ...) + var groupIndex = w.globals.seriesGroups.findIndex(function (group) { + return ( + // w.config.series[i].name may be undefined, so use + // w.globals.seriesNames[i], which has default names for those + // series. w.globals.seriesGroups[] uses the same default naming. + group.indexOf(w.globals.seriesNames[seriesIndex]) > -1 + ); + }); + // We need the column groups to be indexable as 0,1,2,... for their + // positioning relative to each other. + var cGI = this.barCtx.columnGroupIndices; + var columnGroupIndex = cGI.indexOf(groupIndex); + if (columnGroupIndex < 0) { + cGI.push(groupIndex); + columnGroupIndex = cGI.length - 1; + } + return { + groupIndex: groupIndex, + columnGroupIndex: columnGroupIndex + }; + } + }]); + return Helpers; + }(); + + /** + * ApexCharts Bar Class responsible for drawing both Columns and Bars. + * + * @module Bar + **/ + var Bar = /*#__PURE__*/function () { + function Bar(ctx, xyRatios) { + _classCallCheck(this, Bar); + this.ctx = ctx; + this.w = ctx.w; + var w = this.w; + this.barOptions = w.config.plotOptions.bar; + this.isHorizontal = this.barOptions.horizontal; + this.strokeWidth = w.config.stroke.width; + this.isNullValue = false; + this.isRangeBar = w.globals.seriesRange.length && this.isHorizontal; + this.isVerticalGroupedRangeBar = !w.globals.isBarHorizontal && w.globals.seriesRange.length && w.config.plotOptions.bar.rangeBarGroupRows; + this.isFunnel = this.barOptions.isFunnel; + this.xyRatios = xyRatios; + if (this.xyRatios !== null) { + this.xRatio = xyRatios.xRatio; + this.yRatio = xyRatios.yRatio; + this.invertedXRatio = xyRatios.invertedXRatio; + this.invertedYRatio = xyRatios.invertedYRatio; + this.baseLineY = xyRatios.baseLineY; + this.baseLineInvertedY = xyRatios.baseLineInvertedY; + } + this.yaxisIndex = 0; + this.translationsIndex = 0; + this.seriesLen = 0; + this.pathArr = []; + var ser = new Series(this.ctx); + this.lastActiveBarSerieIndex = ser.getActiveConfigSeriesIndex('desc', ['bar', 'column']); + this.columnGroupIndices = []; + var barSeriesIndices = ser.getBarSeriesIndices(); + var coreUtils = new CoreUtils(this.ctx); + this.stackedSeriesTotals = coreUtils.getStackedSeriesTotals(this.w.config.series.map(function (s, i) { + return barSeriesIndices.indexOf(i) === -1 ? i : -1; + }).filter(function (s) { + return s !== -1; + })); + this.barHelpers = new Helpers$1(this); + } + + /** primary draw method which is called on bar object + * @memberof Bar + * @param {array} series - user supplied series values + * @param {int} seriesIndex - the index by which series will be drawn on the svg + * @return {node} element which is supplied to parent chart draw method for appending + **/ + _createClass(Bar, [{ + key: "draw", + value: function draw(series, seriesIndex) { + var w = this.w; + var graphics = new Graphics(this.ctx); + var coreUtils = new CoreUtils(this.ctx, w); + series = coreUtils.getLogSeries(series); + this.series = series; + this.yRatio = coreUtils.getLogYRatios(this.yRatio); + this.barHelpers.initVariables(series); + var ret = graphics.group({ + class: 'apexcharts-bar-series apexcharts-plot-series' + }); + if (w.config.dataLabels.enabled) { + if (this.totalItems > this.barOptions.dataLabels.maxItems) { + console.warn('WARNING: DataLabels are enabled but there are too many to display. This may cause performance issue when rendering - ApexCharts'); + } + } + for (var i = 0, bc = 0; i < series.length; i++, bc++) { + var x = void 0, + y = void 0, + xDivision = void 0, + // xDivision is the GRIDWIDTH divided by number of datapoints (columns) + yDivision = void 0, + // yDivision is the GRIDHEIGHT divided by number of datapoints (bars) + zeroH = void 0, + // zeroH is the baseline where 0 meets y axis + zeroW = void 0; // zeroW is the baseline where 0 meets x axis + + var yArrj = []; // hold y values of current iterating series + var xArrj = []; // hold x values of current iterating series + + var realIndex = w.globals.comboCharts ? seriesIndex[i] : i; + var _this$barHelpers$getG = this.barHelpers.getGroupIndex(realIndex), + columnGroupIndex = _this$barHelpers$getG.columnGroupIndex; + + // el to which series will be drawn + var elSeries = graphics.group({ + class: "apexcharts-series", + rel: i + 1, + seriesName: Utils$1.escapeString(w.globals.seriesNames[realIndex]), + 'data:realIndex': realIndex + }); + this.ctx.series.addCollapsedClassToSeries(elSeries, realIndex); + if (series[i].length > 0) { + this.visibleI = this.visibleI + 1; + } + var barHeight = 0; + var barWidth = 0; + if (this.yRatio.length > 1) { + this.yaxisIndex = w.globals.seriesYAxisReverseMap[realIndex]; + this.translationsIndex = realIndex; + } + var translationsIndex = this.translationsIndex; + this.isReversed = w.config.yaxis[this.yaxisIndex] && w.config.yaxis[this.yaxisIndex].reversed; + var initPositions = this.barHelpers.initialPositions(realIndex); + y = initPositions.y; + barHeight = initPositions.barHeight; + yDivision = initPositions.yDivision; + zeroW = initPositions.zeroW; + x = initPositions.x; + barWidth = initPositions.barWidth; + xDivision = initPositions.xDivision; + zeroH = initPositions.zeroH; + if (!this.isHorizontal) { + xArrj.push(x + barWidth / 2); + } + + // eldatalabels + var elDataLabelsWrap = graphics.group({ + class: 'apexcharts-datalabels', + 'data:realIndex': realIndex + }); + w.globals.delayedElements.push({ + el: elDataLabelsWrap.node + }); + elDataLabelsWrap.node.classList.add('apexcharts-element-hidden'); + var elGoalsMarkers = graphics.group({ + class: 'apexcharts-bar-goals-markers' + }); + var elBarShadows = graphics.group({ + class: 'apexcharts-bar-shadows' + }); + w.globals.delayedElements.push({ + el: elBarShadows.node + }); + elBarShadows.node.classList.add('apexcharts-element-hidden'); + for (var j = 0; j < series[i].length; j++) { + var strokeWidth = this.barHelpers.getStrokeWidth(i, j, realIndex); + var paths = null; + var pathsParams = { + indexes: { + i: i, + j: j, + realIndex: realIndex, + translationsIndex: translationsIndex, + bc: bc + }, + x: x, + y: y, + strokeWidth: strokeWidth, + elSeries: elSeries + }; + if (this.isHorizontal) { + paths = this.drawBarPaths(_objectSpread2(_objectSpread2({}, pathsParams), {}, { + barHeight: barHeight, + zeroW: zeroW, + yDivision: yDivision + })); + barWidth = this.series[i][j] / this.invertedYRatio; + } else { + paths = this.drawColumnPaths(_objectSpread2(_objectSpread2({}, pathsParams), {}, { + xDivision: xDivision, + barWidth: barWidth, + zeroH: zeroH + })); + barHeight = this.series[i][j] / this.yRatio[translationsIndex]; + } + var pathFill = this.barHelpers.getPathFillColor(series, i, j, realIndex); + if (this.isFunnel && this.barOptions.isFunnel3d && this.pathArr.length && j > 0) { + var _pathFill$color; + var barShadow = this.barHelpers.drawBarShadow({ + color: typeof pathFill.color === 'string' && ((_pathFill$color = pathFill.color) === null || _pathFill$color === void 0 ? void 0 : _pathFill$color.indexOf('url')) === -1 ? pathFill.color : Utils$1.hexToRgba(w.globals.colors[i]), + prevPaths: this.pathArr[this.pathArr.length - 1], + currPaths: paths + }); + elBarShadows.add(barShadow); + if (w.config.chart.dropShadow.enabled) { + var filters = new Filters(this.ctx); + filters.dropShadow(barShadow, w.config.chart.dropShadow, realIndex); + } + } + this.pathArr.push(paths); + var barGoalLine = this.barHelpers.drawGoalLine({ + barXPosition: paths.barXPosition, + barYPosition: paths.barYPosition, + goalX: paths.goalX, + goalY: paths.goalY, + barHeight: barHeight, + barWidth: barWidth + }); + if (barGoalLine) { + elGoalsMarkers.add(barGoalLine); + } + y = paths.y; + x = paths.x; + + // push current X + if (j > 0) { + xArrj.push(x + barWidth / 2); + } + yArrj.push(y); + this.renderSeries(_objectSpread2(_objectSpread2({ + realIndex: realIndex, + pathFill: pathFill.color + }, pathFill.useRangeColor ? { + lineFill: pathFill.color + } : {}), {}, { + j: j, + i: i, + columnGroupIndex: columnGroupIndex, + pathFrom: paths.pathFrom, + pathTo: paths.pathTo, + strokeWidth: strokeWidth, + elSeries: elSeries, + x: x, + y: y, + series: series, + barHeight: Math.abs(paths.barHeight ? paths.barHeight : barHeight), + barWidth: Math.abs(paths.barWidth ? paths.barWidth : barWidth), + elDataLabelsWrap: elDataLabelsWrap, + elGoalsMarkers: elGoalsMarkers, + elBarShadows: elBarShadows, + visibleSeries: this.visibleI, + type: 'bar' + })); + } + + // push all x val arrays into main xArr + w.globals.seriesXvalues[realIndex] = xArrj; + w.globals.seriesYvalues[realIndex] = yArrj; + ret.add(elSeries); + } + return ret; + } + }, { + key: "renderSeries", + value: function renderSeries(_ref) { + var realIndex = _ref.realIndex, + pathFill = _ref.pathFill, + lineFill = _ref.lineFill, + j = _ref.j, + i = _ref.i, + columnGroupIndex = _ref.columnGroupIndex, + pathFrom = _ref.pathFrom, + pathTo = _ref.pathTo, + strokeWidth = _ref.strokeWidth, + elSeries = _ref.elSeries, + x = _ref.x, + y = _ref.y, + y1 = _ref.y1, + y2 = _ref.y2, + series = _ref.series, + barHeight = _ref.barHeight, + barWidth = _ref.barWidth, + barXPosition = _ref.barXPosition, + barYPosition = _ref.barYPosition, + elDataLabelsWrap = _ref.elDataLabelsWrap, + elGoalsMarkers = _ref.elGoalsMarkers, + elBarShadows = _ref.elBarShadows, + visibleSeries = _ref.visibleSeries, + type = _ref.type, + classes = _ref.classes; + var w = this.w; + var graphics = new Graphics(this.ctx); + if (!lineFill) { + // if user provided a function in colors, we need to eval here + // Note: the position of this function logic (ex. stroke: { colors: ["",function(){}] }) i.e array index 1 depicts the realIndex/seriesIndex. + var fetchColor = function fetchColor(i) { + var exp = w.config.stroke.colors; + var c; + if (Array.isArray(exp) && exp.length > 0) { + c = exp[i]; + if (!c) c = ''; + if (typeof c === 'function') { + return c({ + value: w.globals.series[i][j], + dataPointIndex: j, + w: w + }); + } + } + return c; + }; + var checkAvailableColor = typeof w.globals.stroke.colors[realIndex] === 'function' ? fetchColor(realIndex) : w.globals.stroke.colors[realIndex]; + + /* fix apexcharts#341 */ + lineFill = this.barOptions.distributed ? w.globals.stroke.colors[j] : checkAvailableColor; + } + if (w.config.series[i].data[j] && w.config.series[i].data[j].strokeColor) { + lineFill = w.config.series[i].data[j].strokeColor; + } + if (this.isNullValue) { + pathFill = 'none'; + } + var delay = j / w.config.chart.animations.animateGradually.delay * (w.config.chart.animations.speed / w.globals.dataPoints) / 2.4; + var renderedPath = graphics.renderPaths({ + i: i, + j: j, + realIndex: realIndex, + pathFrom: pathFrom, + pathTo: pathTo, + stroke: lineFill, + strokeWidth: strokeWidth, + strokeLineCap: w.config.stroke.lineCap, + fill: pathFill, + animationDelay: delay, + initialSpeed: w.config.chart.animations.speed, + dataChangeSpeed: w.config.chart.animations.dynamicAnimation.speed, + className: "apexcharts-".concat(type, "-area ").concat(classes), + chartType: type + }); + renderedPath.attr('clip-path', "url(#gridRectBarMask".concat(w.globals.cuid, ")")); + var forecast = w.config.forecastDataPoints; + if (forecast.count > 0) { + if (j >= w.globals.dataPoints - forecast.count) { + renderedPath.node.setAttribute('stroke-dasharray', forecast.dashArray); + renderedPath.node.setAttribute('stroke-width', forecast.strokeWidth); + renderedPath.node.setAttribute('fill-opacity', forecast.fillOpacity); + } + } + if (typeof y1 !== 'undefined' && typeof y2 !== 'undefined') { + renderedPath.attr('data-range-y1', y1); + renderedPath.attr('data-range-y2', y2); + } + var filters = new Filters(this.ctx); + filters.setSelectionFilter(renderedPath, realIndex, j); + elSeries.add(renderedPath); + var barDataLabels = new BarDataLabels(this); + var dataLabelsObj = barDataLabels.handleBarDataLabels({ + x: x, + y: y, + y1: y1, + y2: y2, + i: i, + j: j, + series: series, + realIndex: realIndex, + columnGroupIndex: columnGroupIndex, + barHeight: barHeight, + barWidth: barWidth, + barXPosition: barXPosition, + barYPosition: barYPosition, + renderedPath: renderedPath, + visibleSeries: visibleSeries + }); + if (dataLabelsObj.dataLabels !== null) { + elDataLabelsWrap.add(dataLabelsObj.dataLabels); + } + if (dataLabelsObj.totalDataLabels) { + elDataLabelsWrap.add(dataLabelsObj.totalDataLabels); + } + elSeries.add(elDataLabelsWrap); + if (elGoalsMarkers) { + elSeries.add(elGoalsMarkers); + } + if (elBarShadows) { + elSeries.add(elBarShadows); + } + return elSeries; + } + }, { + key: "drawBarPaths", + value: function drawBarPaths(_ref2) { + var indexes = _ref2.indexes, + barHeight = _ref2.barHeight, + strokeWidth = _ref2.strokeWidth, + zeroW = _ref2.zeroW, + x = _ref2.x, + y = _ref2.y, + yDivision = _ref2.yDivision, + elSeries = _ref2.elSeries; + var w = this.w; + var i = indexes.i; + var j = indexes.j; + var barYPosition; + if (w.globals.isXNumeric) { + y = (w.globals.seriesX[i][j] - w.globals.minX) / this.invertedXRatio - barHeight; + barYPosition = y + barHeight * this.visibleI; + } else { + if (w.config.plotOptions.bar.hideZeroBarsWhenGrouped) { + var _this$barHelpers$getZ = this.barHelpers.getZeroValueEncounters({ + i: i, + j: j + }), + nonZeroColumns = _this$barHelpers$getZ.nonZeroColumns, + zeroEncounters = _this$barHelpers$getZ.zeroEncounters; + if (nonZeroColumns > 0) { + barHeight = this.seriesLen * barHeight / nonZeroColumns; + } + barYPosition = y + barHeight * this.visibleI; + barYPosition -= barHeight * zeroEncounters; + } else { + barYPosition = y + barHeight * this.visibleI; + } + } + if (this.isFunnel) { + zeroW = zeroW - (this.barHelpers.getXForValue(this.series[i][j], zeroW) - zeroW) / 2; + } + x = this.barHelpers.getXForValue(this.series[i][j], zeroW); + var paths = this.barHelpers.getBarpaths({ + barYPosition: barYPosition, + barHeight: barHeight, + x1: zeroW, + x2: x, + strokeWidth: strokeWidth, + isReversed: this.isReversed, + series: this.series, + realIndex: indexes.realIndex, + i: i, + j: j, + w: w + }); + if (!w.globals.isXNumeric) { + y = y + yDivision; + } + this.barHelpers.barBackground({ + j: j, + i: i, + y1: barYPosition - barHeight * this.visibleI, + y2: barHeight * this.seriesLen, + elSeries: elSeries + }); + return { + pathTo: paths.pathTo, + pathFrom: paths.pathFrom, + x1: zeroW, + x: x, + y: y, + goalX: this.barHelpers.getGoalValues('x', zeroW, null, i, j), + barYPosition: barYPosition, + barHeight: barHeight + }; + } + }, { + key: "drawColumnPaths", + value: function drawColumnPaths(_ref3) { + var indexes = _ref3.indexes, + x = _ref3.x, + y = _ref3.y, + xDivision = _ref3.xDivision, + barWidth = _ref3.barWidth, + zeroH = _ref3.zeroH, + strokeWidth = _ref3.strokeWidth, + elSeries = _ref3.elSeries; + var w = this.w; + var realIndex = indexes.realIndex; + var translationsIndex = indexes.translationsIndex; + var i = indexes.i; + var j = indexes.j; + var bc = indexes.bc; + var barXPosition; + if (w.globals.isXNumeric) { + var xForNumericX = this.getBarXForNumericXAxis({ + x: x, + j: j, + realIndex: realIndex, + barWidth: barWidth + }); + x = xForNumericX.x; + barXPosition = xForNumericX.barXPosition; + } else { + if (w.config.plotOptions.bar.hideZeroBarsWhenGrouped) { + var _this$barHelpers$getZ2 = this.barHelpers.getZeroValueEncounters({ + i: i, + j: j + }), + nonZeroColumns = _this$barHelpers$getZ2.nonZeroColumns, + zeroEncounters = _this$barHelpers$getZ2.zeroEncounters; + if (nonZeroColumns > 0) { + barWidth = this.seriesLen * barWidth / nonZeroColumns; + } + barXPosition = x + barWidth * this.visibleI; + barXPosition -= barWidth * zeroEncounters; + } else { + barXPosition = x + barWidth * this.visibleI; + } + } + y = this.barHelpers.getYForValue(this.series[i][j], zeroH, translationsIndex); + var paths = this.barHelpers.getColumnPaths({ + barXPosition: barXPosition, + barWidth: barWidth, + y1: zeroH, + y2: y, + strokeWidth: strokeWidth, + isReversed: this.isReversed, + series: this.series, + realIndex: realIndex, + i: i, + j: j, + w: w + }); + if (!w.globals.isXNumeric) { + x = x + xDivision; + } + this.barHelpers.barBackground({ + bc: bc, + j: j, + i: i, + x1: barXPosition - strokeWidth / 2 - barWidth * this.visibleI, + x2: barWidth * this.seriesLen + strokeWidth / 2, + elSeries: elSeries + }); + return { + pathTo: paths.pathTo, + pathFrom: paths.pathFrom, + x: x, + y: y, + goalY: this.barHelpers.getGoalValues('y', null, zeroH, i, j, translationsIndex), + barXPosition: barXPosition, + barWidth: barWidth + }; + } + }, { + key: "getBarXForNumericXAxis", + value: function getBarXForNumericXAxis(_ref4) { + var x = _ref4.x, + barWidth = _ref4.barWidth, + realIndex = _ref4.realIndex, + j = _ref4.j; + var w = this.w; + var sxI = realIndex; + if (!w.globals.seriesX[realIndex].length) { + sxI = w.globals.maxValsInArrayIndex; + } + if (Utils$1.isNumber(w.globals.seriesX[sxI][j])) { + x = (w.globals.seriesX[sxI][j] - w.globals.minX) / this.xRatio - barWidth * this.seriesLen / 2; + } + return { + barXPosition: x + barWidth * this.visibleI, + x: x + }; + } + + /** getPreviousPath is a common function for bars/columns which is used to get previous paths when data changes. + * @memberof Bar + * @param {int} realIndex - current iterating i + * @param {int} j - current iterating series's j index + * @return {string} pathFrom is the string which will be appended in animations + **/ + }, { + key: "getPreviousPath", + value: function getPreviousPath(realIndex, j) { + var w = this.w; + var pathFrom; + for (var pp = 0; pp < w.globals.previousPaths.length; pp++) { + var gpp = w.globals.previousPaths[pp]; + if (gpp.paths && gpp.paths.length > 0 && parseInt(gpp.realIndex, 10) === parseInt(realIndex, 10)) { + if (typeof w.globals.previousPaths[pp].paths[j] !== 'undefined') { + pathFrom = w.globals.previousPaths[pp].paths[j].d; + } + } + } + return pathFrom; + } + }]); + return Bar; + }(); + + /** + * ApexCharts BarStacked Class responsible for drawing both Stacked Columns and Bars. + * + * @module BarStacked + * The whole calculation for stacked bar/column is different from normal bar/column, + * hence it makes sense to derive a new class for it extending most of the props of Parent Bar + **/ + var BarStacked = /*#__PURE__*/function (_Bar) { + _inherits(BarStacked, _Bar); + var _super = _createSuper(BarStacked); + function BarStacked() { + _classCallCheck(this, BarStacked); + return _super.apply(this, arguments); + } + _createClass(BarStacked, [{ + key: "draw", + value: function draw(series, seriesIndex) { + var _this = this; + var w = this.w; + this.graphics = new Graphics(this.ctx); + this.bar = new Bar(this.ctx, this.xyRatios); + var coreUtils = new CoreUtils(this.ctx, w); + series = coreUtils.getLogSeries(series); + this.yRatio = coreUtils.getLogYRatios(this.yRatio); + this.barHelpers.initVariables(series); + if (w.config.chart.stackType === '100%') { + series = w.globals.comboCharts ? seriesIndex.map(function (_) { + return w.globals.seriesPercent[_]; + }) : w.globals.seriesPercent.slice(); + } + this.series = series; + this.barHelpers.initializeStackedPrevVars(this); + var ret = this.graphics.group({ + class: 'apexcharts-bar-series apexcharts-plot-series' + }); + var x = 0; + var y = 0; + var _loop = function _loop(i, bc) { + var xDivision = void 0; // xDivision is the GRIDWIDTH divided by number of datapoints (columns) + var yDivision = void 0; // yDivision is the GRIDHEIGHT divided by number of datapoints (bars) + var zeroH = void 0; // zeroH is the baseline where 0 meets y axis + var zeroW = void 0; // zeroW is the baseline where 0 meets x axis + + var realIndex = w.globals.comboCharts ? seriesIndex[i] : i; + var _this$barHelpers$getG = _this.barHelpers.getGroupIndex(realIndex), + groupIndex = _this$barHelpers$getG.groupIndex, + columnGroupIndex = _this$barHelpers$getG.columnGroupIndex; + _this.groupCtx = _this[w.globals.seriesGroups[groupIndex]]; + var xArrValues = []; + var yArrValues = []; + var translationsIndex = 0; + if (_this.yRatio.length > 1) { + _this.yaxisIndex = w.globals.seriesYAxisReverseMap[realIndex][0]; + translationsIndex = realIndex; + } + _this.isReversed = w.config.yaxis[_this.yaxisIndex] && w.config.yaxis[_this.yaxisIndex].reversed; + + // el to which series will be drawn + var elSeries = _this.graphics.group({ + class: "apexcharts-series", + seriesName: Utils$1.escapeString(w.globals.seriesNames[realIndex]), + rel: i + 1, + 'data:realIndex': realIndex + }); + _this.ctx.series.addCollapsedClassToSeries(elSeries, realIndex); + + // eldatalabels + var elDataLabelsWrap = _this.graphics.group({ + class: 'apexcharts-datalabels', + 'data:realIndex': realIndex + }); + var elGoalsMarkers = _this.graphics.group({ + class: 'apexcharts-bar-goals-markers' + }); + var barHeight = 0; + var barWidth = 0; + var initPositions = _this.initialPositions(x, y, xDivision, yDivision, zeroH, zeroW, translationsIndex); + y = initPositions.y; + barHeight = initPositions.barHeight; + yDivision = initPositions.yDivision; + zeroW = initPositions.zeroW; + x = initPositions.x; + barWidth = initPositions.barWidth; + xDivision = initPositions.xDivision; + zeroH = initPositions.zeroH; + w.globals.barHeight = barHeight; + w.globals.barWidth = barWidth; + _this.barHelpers.initializeStackedXYVars(_this); + + // where all stack bar disappear after collapsing the first series + if (_this.groupCtx.prevY.length === 1 && _this.groupCtx.prevY[0].every(function (val) { + return isNaN(val); + })) { + _this.groupCtx.prevY[0] = _this.groupCtx.prevY[0].map(function () { + return zeroH; + }); + _this.groupCtx.prevYF[0] = _this.groupCtx.prevYF[0].map(function () { + return 0; + }); + } + for (var j = 0; j < w.globals.dataPoints; j++) { + var strokeWidth = _this.barHelpers.getStrokeWidth(i, j, realIndex); + var commonPathOpts = { + indexes: { + i: i, + j: j, + realIndex: realIndex, + translationsIndex: translationsIndex, + bc: bc + }, + strokeWidth: strokeWidth, + x: x, + y: y, + elSeries: elSeries, + columnGroupIndex: columnGroupIndex, + seriesGroup: w.globals.seriesGroups[groupIndex] + }; + var paths = null; + if (_this.isHorizontal) { + paths = _this.drawStackedBarPaths(_objectSpread2(_objectSpread2({}, commonPathOpts), {}, { + zeroW: zeroW, + barHeight: barHeight, + yDivision: yDivision + })); + barWidth = _this.series[i][j] / _this.invertedYRatio; + } else { + paths = _this.drawStackedColumnPaths(_objectSpread2(_objectSpread2({}, commonPathOpts), {}, { + xDivision: xDivision, + barWidth: barWidth, + zeroH: zeroH + })); + barHeight = _this.series[i][j] / _this.yRatio[translationsIndex]; + } + var barGoalLine = _this.barHelpers.drawGoalLine({ + barXPosition: paths.barXPosition, + barYPosition: paths.barYPosition, + goalX: paths.goalX, + goalY: paths.goalY, + barHeight: barHeight, + barWidth: barWidth + }); + if (barGoalLine) { + elGoalsMarkers.add(barGoalLine); + } + y = paths.y; + x = paths.x; + xArrValues.push(x); + yArrValues.push(y); + var pathFill = _this.barHelpers.getPathFillColor(series, i, j, realIndex); + var classes = ''; + var flipClass = w.globals.isBarHorizontal ? 'apexcharts-flip-x' : 'apexcharts-flip-y'; + if (_this.barHelpers.arrBorderRadius[realIndex][j] === 'bottom' && w.globals.series[realIndex][j] > 0 || _this.barHelpers.arrBorderRadius[realIndex][j] === 'top' && w.globals.series[realIndex][j] < 0) { + classes = flipClass; + } + elSeries = _this.renderSeries(_objectSpread2(_objectSpread2({ + realIndex: realIndex, + pathFill: pathFill.color + }, pathFill.useRangeColor ? { + lineFill: pathFill.color + } : {}), {}, { + j: j, + i: i, + columnGroupIndex: columnGroupIndex, + pathFrom: paths.pathFrom, + pathTo: paths.pathTo, + strokeWidth: strokeWidth, + elSeries: elSeries, + x: x, + y: y, + series: series, + barHeight: barHeight, + barWidth: barWidth, + elDataLabelsWrap: elDataLabelsWrap, + elGoalsMarkers: elGoalsMarkers, + type: 'bar', + visibleSeries: columnGroupIndex, + classes: classes + })); + } + + // push all x val arrays into main xArr + w.globals.seriesXvalues[realIndex] = xArrValues; + w.globals.seriesYvalues[realIndex] = yArrValues; + + // push all current y values array to main PrevY Array + _this.groupCtx.prevY.push(_this.groupCtx.yArrj); + _this.groupCtx.prevYF.push(_this.groupCtx.yArrjF); + _this.groupCtx.prevYVal.push(_this.groupCtx.yArrjVal); + _this.groupCtx.prevX.push(_this.groupCtx.xArrj); + _this.groupCtx.prevXF.push(_this.groupCtx.xArrjF); + _this.groupCtx.prevXVal.push(_this.groupCtx.xArrjVal); + ret.add(elSeries); + }; + for (var i = 0, bc = 0; i < series.length; i++, bc++) { + _loop(i, bc); + } + return ret; + } + }, { + key: "initialPositions", + value: function initialPositions(x, y, xDivision, yDivision, zeroH, zeroW, translationsIndex) { + var w = this.w; + var barHeight, barWidth; + if (this.isHorizontal) { + // height divided into equal parts + yDivision = w.globals.gridHeight / w.globals.dataPoints; + var userBarHeight = w.config.plotOptions.bar.barHeight; + if (String(userBarHeight).indexOf('%') === -1) { + barHeight = parseInt(userBarHeight, 10); + } else { + barHeight = yDivision * parseInt(userBarHeight, 10) / 100; + } + zeroW = w.globals.padHorizontal + (this.isReversed ? w.globals.gridWidth - this.baseLineInvertedY : this.baseLineInvertedY); + + // initial y position is half of barHeight * half of number of Bars + y = (yDivision - barHeight) / 2; + } else { + // width divided into equal parts + xDivision = w.globals.gridWidth / w.globals.dataPoints; + barWidth = xDivision; + var userColumnWidth = w.config.plotOptions.bar.columnWidth; + if (w.globals.isXNumeric && w.globals.dataPoints > 1) { + xDivision = w.globals.minXDiff / this.xRatio; + barWidth = xDivision * parseInt(this.barOptions.columnWidth, 10) / 100; + } else if (String(userColumnWidth).indexOf('%') === -1) { + barWidth = parseInt(userColumnWidth, 10); + } else { + barWidth *= parseInt(userColumnWidth, 10) / 100; + } + if (this.isReversed) { + zeroH = this.baseLineY[translationsIndex]; + } else { + zeroH = w.globals.gridHeight - this.baseLineY[translationsIndex]; + } + + // initial x position is the left-most edge of the first bar relative to + // the left-most side of the grid area. + x = w.globals.padHorizontal + (xDivision - barWidth) / 2; + } + + // Up to this point, barWidth is the width that will accommodate all bars + // at each datapoint or category. + + // The crude subdivision here assumes the series within each group are + // stacked. If there is no stacking then the barWidth/barHeight is + // further divided later by the number of series in the group. So, eg, two + // groups of three series would become six bars side-by-side unstacked, + // or two bars stacked. + var subDivisions = w.globals.barGroups.length || 1; + return { + x: x, + y: y, + yDivision: yDivision, + xDivision: xDivision, + barHeight: barHeight / subDivisions, + barWidth: barWidth / subDivisions, + zeroH: zeroH, + zeroW: zeroW + }; + } + }, { + key: "drawStackedBarPaths", + value: function drawStackedBarPaths(_ref) { + var indexes = _ref.indexes, + barHeight = _ref.barHeight, + strokeWidth = _ref.strokeWidth, + zeroW = _ref.zeroW, + x = _ref.x, + y = _ref.y, + columnGroupIndex = _ref.columnGroupIndex, + seriesGroup = _ref.seriesGroup, + yDivision = _ref.yDivision, + elSeries = _ref.elSeries; + var w = this.w; + var barYPosition = y + columnGroupIndex * barHeight; + var barXPosition; + var i = indexes.i; + var j = indexes.j; + var realIndex = indexes.realIndex; + var translationsIndex = indexes.translationsIndex; + var prevBarW = 0; + for (var k = 0; k < this.groupCtx.prevXF.length; k++) { + prevBarW = prevBarW + this.groupCtx.prevXF[k][j]; + } + var gsi = i; // an index to keep track of the series inside a group + if (w.config.series[realIndex].name) { + gsi = seriesGroup.indexOf(w.config.series[realIndex].name); + } + if (gsi > 0) { + var bXP = zeroW; + if (this.groupCtx.prevXVal[gsi - 1][j] < 0) { + bXP = this.series[i][j] >= 0 ? this.groupCtx.prevX[gsi - 1][j] + prevBarW - (this.isReversed ? prevBarW : 0) * 2 : this.groupCtx.prevX[gsi - 1][j]; + } else if (this.groupCtx.prevXVal[gsi - 1][j] >= 0) { + bXP = this.series[i][j] >= 0 ? this.groupCtx.prevX[gsi - 1][j] : this.groupCtx.prevX[gsi - 1][j] - prevBarW + (this.isReversed ? prevBarW : 0) * 2; + } + barXPosition = bXP; + } else { + // the first series will not have prevX values + barXPosition = zeroW; + } + if (this.series[i][j] === null) { + x = barXPosition; + } else { + x = barXPosition + this.series[i][j] / this.invertedYRatio - (this.isReversed ? this.series[i][j] / this.invertedYRatio : 0) * 2; + } + var paths = this.barHelpers.getBarpaths({ + barYPosition: barYPosition, + barHeight: barHeight, + x1: barXPosition, + x2: x, + strokeWidth: strokeWidth, + isReversed: this.isReversed, + series: this.series, + realIndex: indexes.realIndex, + seriesGroup: seriesGroup, + i: i, + j: j, + w: w + }); + this.barHelpers.barBackground({ + j: j, + i: i, + y1: barYPosition, + y2: barHeight, + elSeries: elSeries + }); + y = y + yDivision; + return { + pathTo: paths.pathTo, + pathFrom: paths.pathFrom, + goalX: this.barHelpers.getGoalValues('x', zeroW, null, i, j, translationsIndex), + barXPosition: barXPosition, + barYPosition: barYPosition, + x: x, + y: y + }; + } + }, { + key: "drawStackedColumnPaths", + value: function drawStackedColumnPaths(_ref2) { + var indexes = _ref2.indexes, + x = _ref2.x, + y = _ref2.y, + xDivision = _ref2.xDivision, + barWidth = _ref2.barWidth, + zeroH = _ref2.zeroH, + columnGroupIndex = _ref2.columnGroupIndex, + seriesGroup = _ref2.seriesGroup, + elSeries = _ref2.elSeries; + var w = this.w; + var i = indexes.i; + var j = indexes.j; + var bc = indexes.bc; + var realIndex = indexes.realIndex; + var translationsIndex = indexes.translationsIndex; + if (w.globals.isXNumeric) { + var seriesVal = w.globals.seriesX[realIndex][j]; + if (!seriesVal) seriesVal = 0; + // TODO: move the barWidth factor to barXPosition + x = (seriesVal - w.globals.minX) / this.xRatio - barWidth / 2 * w.globals.barGroups.length; + } + var barXPosition = x + columnGroupIndex * barWidth; + var barYPosition; + var prevBarH = 0; + for (var k = 0; k < this.groupCtx.prevYF.length; k++) { + // fix issue #1215 + // in case where this.groupCtx.prevYF[k][j] is NaN, use 0 instead + prevBarH = prevBarH + (!isNaN(this.groupCtx.prevYF[k][j]) ? this.groupCtx.prevYF[k][j] : 0); + } + var gsi = i; // an index to keep track of the series inside a group + if (seriesGroup) { + gsi = seriesGroup.indexOf(w.globals.seriesNames[realIndex]); + } + if (gsi > 0 && !w.globals.isXNumeric || gsi > 0 && w.globals.isXNumeric && w.globals.seriesX[realIndex - 1][j] === w.globals.seriesX[realIndex][j]) { + var _this$groupCtx$prevYF; + var bYP; + var prevYValue; + var p = Math.min(this.yRatio.length + 1, realIndex + 1); + if (this.groupCtx.prevY[gsi - 1] !== undefined && this.groupCtx.prevY[gsi - 1].length) { + for (var ii = 1; ii < p; ii++) { + var _this$groupCtx$prevY; + if (!isNaN((_this$groupCtx$prevY = this.groupCtx.prevY[gsi - ii]) === null || _this$groupCtx$prevY === void 0 ? void 0 : _this$groupCtx$prevY[j])) { + // find the previous available value to give prevYValue + prevYValue = this.groupCtx.prevY[gsi - ii][j]; + // if found it, break the loop + break; + } + } + } + for (var _ii = 1; _ii < p; _ii++) { + var _this$groupCtx$prevYV, _this$groupCtx$prevYV2; + // find the previous available value(non-NaN) to give bYP + if (((_this$groupCtx$prevYV = this.groupCtx.prevYVal[gsi - _ii]) === null || _this$groupCtx$prevYV === void 0 ? void 0 : _this$groupCtx$prevYV[j]) < 0) { + bYP = this.series[i][j] >= 0 ? prevYValue - prevBarH + (this.isReversed ? prevBarH : 0) * 2 : prevYValue; + // found it? break the loop + break; + } else if (((_this$groupCtx$prevYV2 = this.groupCtx.prevYVal[gsi - _ii]) === null || _this$groupCtx$prevYV2 === void 0 ? void 0 : _this$groupCtx$prevYV2[j]) >= 0) { + bYP = this.series[i][j] >= 0 ? prevYValue : prevYValue + prevBarH - (this.isReversed ? prevBarH : 0) * 2; + // found it? break the loop + break; + } + } + if (typeof bYP === 'undefined') bYP = w.globals.gridHeight; + + // if this.prevYF[0] is all 0 resulted from line #486 + // AND every arr starting from the second only contains NaN + if ((_this$groupCtx$prevYF = this.groupCtx.prevYF[0]) !== null && _this$groupCtx$prevYF !== void 0 && _this$groupCtx$prevYF.every(function (val) { + return val === 0; + }) && this.groupCtx.prevYF.slice(1, gsi).every(function (arr) { + return arr.every(function (val) { + return isNaN(val); + }); + })) { + barYPosition = zeroH; + } else { + // Nothing special + barYPosition = bYP; + } + } else { + // the first series will not have prevY values, also if the prev index's + // series X doesn't matches the current index's series X, then start from + // zero + barYPosition = zeroH; + } + if (this.series[i][j]) { + y = barYPosition - this.series[i][j] / this.yRatio[translationsIndex] + (this.isReversed ? this.series[i][j] / this.yRatio[translationsIndex] : 0) * 2; + } else { + // fixes #3610 + y = barYPosition; + } + var paths = this.barHelpers.getColumnPaths({ + barXPosition: barXPosition, + barWidth: barWidth, + y1: barYPosition, + y2: y, + yRatio: this.yRatio[translationsIndex], + strokeWidth: this.strokeWidth, + isReversed: this.isReversed, + series: this.series, + seriesGroup: seriesGroup, + realIndex: indexes.realIndex, + i: i, + j: j, + w: w + }); + this.barHelpers.barBackground({ + bc: bc, + j: j, + i: i, + x1: barXPosition, + x2: barWidth, + elSeries: elSeries + }); + return { + pathTo: paths.pathTo, + pathFrom: paths.pathFrom, + goalY: this.barHelpers.getGoalValues('y', null, zeroH, i, j), + barXPosition: barXPosition, + x: w.globals.isXNumeric ? x : x + xDivision, + y: y + }; + } + }]); + return BarStacked; + }(Bar); + + /** + * ApexCharts BoxCandleStick Class responsible for drawing both Stacked Columns and Bars. + * + * @module BoxCandleStick + **/ + var BoxCandleStick = /*#__PURE__*/function (_Bar) { + _inherits(BoxCandleStick, _Bar); + var _super = _createSuper(BoxCandleStick); + function BoxCandleStick() { + _classCallCheck(this, BoxCandleStick); + return _super.apply(this, arguments); + } + _createClass(BoxCandleStick, [{ + key: "draw", + value: function draw(series, ctype, seriesIndex) { + var _this = this; + var w = this.w; + var graphics = new Graphics(this.ctx); + var type = w.globals.comboCharts ? ctype : w.config.chart.type; + var fill = new Fill(this.ctx); + this.candlestickOptions = this.w.config.plotOptions.candlestick; + this.boxOptions = this.w.config.plotOptions.boxPlot; + this.isHorizontal = w.config.plotOptions.bar.horizontal; + var coreUtils = new CoreUtils(this.ctx, w); + series = coreUtils.getLogSeries(series); + this.series = series; + this.yRatio = coreUtils.getLogYRatios(this.yRatio); + this.barHelpers.initVariables(series); + var ret = graphics.group({ + class: "apexcharts-".concat(type, "-series apexcharts-plot-series") + }); + var _loop = function _loop(i) { + _this.isBoxPlot = w.config.chart.type === 'boxPlot' || w.config.series[i].type === 'boxPlot'; + var x = void 0, + y = void 0, + xDivision = void 0, + // xDivision is the GRIDWIDTH divided by number of datapoints (columns) + yDivision = void 0, + // yDivision is the GRIDHEIGHT divided by number of datapoints (bars) + zeroH = void 0, + // zeroH is the baseline where 0 meets y axis + zeroW = void 0; // zeroW is the baseline where 0 meets x axis + + var yArrj = []; // hold y values of current iterating series + var xArrj = []; // hold x values of current iterating series + + var realIndex = w.globals.comboCharts ? seriesIndex[i] : i; + // As BoxCandleStick derives from Bar, we need this to render. + var _this$barHelpers$getG = _this.barHelpers.getGroupIndex(realIndex), + columnGroupIndex = _this$barHelpers$getG.columnGroupIndex; + + // el to which series will be drawn + var elSeries = graphics.group({ + class: "apexcharts-series", + seriesName: Utils$1.escapeString(w.globals.seriesNames[realIndex]), + rel: i + 1, + 'data:realIndex': realIndex + }); + _this.ctx.series.addCollapsedClassToSeries(elSeries, realIndex); + if (series[i].length > 0) { + _this.visibleI = _this.visibleI + 1; + } + var barHeight = 0; + var barWidth = 0; + var translationsIndex = 0; + if (_this.yRatio.length > 1) { + _this.yaxisIndex = w.globals.seriesYAxisReverseMap[realIndex][0]; + translationsIndex = realIndex; + } + var initPositions = _this.barHelpers.initialPositions(realIndex); + y = initPositions.y; + barHeight = initPositions.barHeight; + yDivision = initPositions.yDivision; + zeroW = initPositions.zeroW; + x = initPositions.x; + barWidth = initPositions.barWidth; + xDivision = initPositions.xDivision; + zeroH = initPositions.zeroH; + xArrj.push(x + barWidth / 2); + + // eldatalabels + var elDataLabelsWrap = graphics.group({ + class: 'apexcharts-datalabels', + 'data:realIndex': realIndex + }); + var elGoalsMarkers = graphics.group({ + class: 'apexcharts-bar-goals-markers' + }); + var _loop2 = function _loop2(j) { + var strokeWidth = _this.barHelpers.getStrokeWidth(i, j, realIndex); + var paths = null; + var pathsParams = { + indexes: { + i: i, + j: j, + realIndex: realIndex, + translationsIndex: translationsIndex + }, + x: x, + y: y, + strokeWidth: strokeWidth, + elSeries: elSeries + }; + if (_this.isHorizontal) { + paths = _this.drawHorizontalBoxPaths(_objectSpread2(_objectSpread2({}, pathsParams), {}, { + yDivision: yDivision, + barHeight: barHeight, + zeroW: zeroW + })); + } else { + paths = _this.drawVerticalBoxPaths(_objectSpread2(_objectSpread2({}, pathsParams), {}, { + xDivision: xDivision, + barWidth: barWidth, + zeroH: zeroH + })); + } + y = paths.y; + x = paths.x; + var barGoalLine = _this.barHelpers.drawGoalLine({ + barXPosition: paths.barXPosition, + barYPosition: paths.barYPosition, + goalX: paths.goalX, + goalY: paths.goalY, + barHeight: barHeight, + barWidth: barWidth + }); + if (barGoalLine) { + elGoalsMarkers.add(barGoalLine); + } + + // push current X + if (j > 0) { + xArrj.push(x + barWidth / 2); + } + yArrj.push(y); + paths.pathTo.forEach(function (pathTo, pi) { + var lineFill = !_this.isBoxPlot && _this.candlestickOptions.wick.useFillColor ? paths.color[pi] : w.globals.stroke.colors[i]; + var pathFill = fill.fillPath({ + seriesNumber: realIndex, + dataPointIndex: j, + color: paths.color[pi], + value: series[i][j] + }); + _this.renderSeries({ + realIndex: realIndex, + pathFill: pathFill, + lineFill: lineFill, + j: j, + i: i, + pathFrom: paths.pathFrom, + pathTo: pathTo, + strokeWidth: strokeWidth, + elSeries: elSeries, + x: x, + y: y, + series: series, + columnGroupIndex: columnGroupIndex, + barHeight: barHeight, + barWidth: barWidth, + elDataLabelsWrap: elDataLabelsWrap, + elGoalsMarkers: elGoalsMarkers, + visibleSeries: _this.visibleI, + type: w.config.chart.type + }); + }); + }; + for (var j = 0; j < w.globals.dataPoints; j++) { + _loop2(j); + } + + // push all x val arrays into main xArr + w.globals.seriesXvalues[realIndex] = xArrj; + w.globals.seriesYvalues[realIndex] = yArrj; + ret.add(elSeries); + }; + for (var i = 0; i < series.length; i++) { + _loop(i); + } + return ret; + } + }, { + key: "drawVerticalBoxPaths", + value: function drawVerticalBoxPaths(_ref) { + var indexes = _ref.indexes, + x = _ref.x; + _ref.y; + var xDivision = _ref.xDivision, + barWidth = _ref.barWidth, + zeroH = _ref.zeroH, + strokeWidth = _ref.strokeWidth; + var w = this.w; + var graphics = new Graphics(this.ctx); + var i = indexes.i; + var j = indexes.j; + var candleColors = w.config.plotOptions.candlestick.colors; + var boxColors = this.boxOptions.colors; + var realIndex = indexes.realIndex; + var getColor = function getColor(color) { + return Array.isArray(color) ? color[realIndex] : color; + }; + var colorPos = getColor(candleColors.upward); + var colorNeg = getColor(candleColors.downward); + var yRatio = this.yRatio[indexes.translationsIndex]; + var ohlc = this.getOHLCValue(realIndex, j); + var l1 = zeroH; + var l2 = zeroH; + var color = ohlc.o < ohlc.c ? [colorPos] : [colorNeg]; + if (this.isBoxPlot) { + color = [getColor(boxColors.lower), getColor(boxColors.upper)]; + } + var y1 = Math.min(ohlc.o, ohlc.c); + var y2 = Math.max(ohlc.o, ohlc.c); + var m = ohlc.m; + if (w.globals.isXNumeric) { + x = (w.globals.seriesX[realIndex][j] - w.globals.minX) / this.xRatio - barWidth / 2; + } + var barXPosition = x + barWidth * this.visibleI; + if (typeof this.series[i][j] === 'undefined' || this.series[i][j] === null) { + y1 = zeroH; + y2 = zeroH; + } else { + y1 = zeroH - y1 / yRatio; + y2 = zeroH - y2 / yRatio; + l1 = zeroH - ohlc.h / yRatio; + l2 = zeroH - ohlc.l / yRatio; + m = zeroH - ohlc.m / yRatio; + } + var pathTo = graphics.move(barXPosition, zeroH); + var pathFrom = graphics.move(barXPosition + barWidth / 2, y1); + if (w.globals.previousPaths.length > 0) { + pathFrom = this.getPreviousPath(realIndex, j, true); + } + if (this.isBoxPlot) { + pathTo = [graphics.move(barXPosition, y1) + graphics.line(barXPosition + barWidth / 2, y1) + graphics.line(barXPosition + barWidth / 2, l1) + graphics.line(barXPosition + barWidth / 4, l1) + graphics.line(barXPosition + barWidth - barWidth / 4, l1) + graphics.line(barXPosition + barWidth / 2, l1) + graphics.line(barXPosition + barWidth / 2, y1) + graphics.line(barXPosition + barWidth, y1) + graphics.line(barXPosition + barWidth, m) + graphics.line(barXPosition, m) + graphics.line(barXPosition, y1 + strokeWidth / 2), graphics.move(barXPosition, m) + graphics.line(barXPosition + barWidth, m) + graphics.line(barXPosition + barWidth, y2) + graphics.line(barXPosition + barWidth / 2, y2) + graphics.line(barXPosition + barWidth / 2, l2) + graphics.line(barXPosition + barWidth - barWidth / 4, l2) + graphics.line(barXPosition + barWidth / 4, l2) + graphics.line(barXPosition + barWidth / 2, l2) + graphics.line(barXPosition + barWidth / 2, y2) + graphics.line(barXPosition, y2) + graphics.line(barXPosition, m) + 'z']; + } else { + // candlestick + pathTo = [graphics.move(barXPosition, y2) + graphics.line(barXPosition + barWidth / 2, y2) + graphics.line(barXPosition + barWidth / 2, l1) + graphics.line(barXPosition + barWidth / 2, y2) + graphics.line(barXPosition + barWidth, y2) + graphics.line(barXPosition + barWidth, y1) + graphics.line(barXPosition + barWidth / 2, y1) + graphics.line(barXPosition + barWidth / 2, l2) + graphics.line(barXPosition + barWidth / 2, y1) + graphics.line(barXPosition, y1) + graphics.line(barXPosition, y2 - strokeWidth / 2)]; + } + pathFrom = pathFrom + graphics.move(barXPosition, y1); + if (!w.globals.isXNumeric) { + x = x + xDivision; + } + return { + pathTo: pathTo, + pathFrom: pathFrom, + x: x, + y: y2, + goalY: this.barHelpers.getGoalValues('y', null, zeroH, i, j, indexes.translationsIndex), + barXPosition: barXPosition, + color: color + }; + } + }, { + key: "drawHorizontalBoxPaths", + value: function drawHorizontalBoxPaths(_ref2) { + var indexes = _ref2.indexes; + _ref2.x; + var y = _ref2.y, + yDivision = _ref2.yDivision, + barHeight = _ref2.barHeight, + zeroW = _ref2.zeroW, + strokeWidth = _ref2.strokeWidth; + var w = this.w; + var graphics = new Graphics(this.ctx); + var i = indexes.i; + var j = indexes.j; + var color = this.boxOptions.colors.lower; + if (this.isBoxPlot) { + color = [this.boxOptions.colors.lower, this.boxOptions.colors.upper]; + } + var yRatio = this.invertedYRatio; + var realIndex = indexes.realIndex; + var ohlc = this.getOHLCValue(realIndex, j); + var l1 = zeroW; + var l2 = zeroW; + var x1 = Math.min(ohlc.o, ohlc.c); + var x2 = Math.max(ohlc.o, ohlc.c); + var m = ohlc.m; + if (w.globals.isXNumeric) { + y = (w.globals.seriesX[realIndex][j] - w.globals.minX) / this.invertedXRatio - barHeight / 2; + } + var barYPosition = y + barHeight * this.visibleI; + if (typeof this.series[i][j] === 'undefined' || this.series[i][j] === null) { + x1 = zeroW; + x2 = zeroW; + } else { + x1 = zeroW + x1 / yRatio; + x2 = zeroW + x2 / yRatio; + l1 = zeroW + ohlc.h / yRatio; + l2 = zeroW + ohlc.l / yRatio; + m = zeroW + ohlc.m / yRatio; + } + var pathTo = graphics.move(zeroW, barYPosition); + var pathFrom = graphics.move(x1, barYPosition + barHeight / 2); + if (w.globals.previousPaths.length > 0) { + pathFrom = this.getPreviousPath(realIndex, j, true); + } + pathTo = [graphics.move(x1, barYPosition) + graphics.line(x1, barYPosition + barHeight / 2) + graphics.line(l1, barYPosition + barHeight / 2) + graphics.line(l1, barYPosition + barHeight / 2 - barHeight / 4) + graphics.line(l1, barYPosition + barHeight / 2 + barHeight / 4) + graphics.line(l1, barYPosition + barHeight / 2) + graphics.line(x1, barYPosition + barHeight / 2) + graphics.line(x1, barYPosition + barHeight) + graphics.line(m, barYPosition + barHeight) + graphics.line(m, barYPosition) + graphics.line(x1 + strokeWidth / 2, barYPosition), graphics.move(m, barYPosition) + graphics.line(m, barYPosition + barHeight) + graphics.line(x2, barYPosition + barHeight) + graphics.line(x2, barYPosition + barHeight / 2) + graphics.line(l2, barYPosition + barHeight / 2) + graphics.line(l2, barYPosition + barHeight - barHeight / 4) + graphics.line(l2, barYPosition + barHeight / 4) + graphics.line(l2, barYPosition + barHeight / 2) + graphics.line(x2, barYPosition + barHeight / 2) + graphics.line(x2, barYPosition) + graphics.line(m, barYPosition) + 'z']; + pathFrom = pathFrom + graphics.move(x1, barYPosition); + if (!w.globals.isXNumeric) { + y = y + yDivision; + } + return { + pathTo: pathTo, + pathFrom: pathFrom, + x: x2, + y: y, + goalX: this.barHelpers.getGoalValues('x', zeroW, null, i, j), + barYPosition: barYPosition, + color: color + }; + } + }, { + key: "getOHLCValue", + value: function getOHLCValue(i, j) { + var w = this.w; + var coreUtils = new CoreUtils(this.ctx, w); + var h = coreUtils.getLogValAtSeriesIndex(w.globals.seriesCandleH[i][j], i); + var o = coreUtils.getLogValAtSeriesIndex(w.globals.seriesCandleO[i][j], i); + var m = coreUtils.getLogValAtSeriesIndex(w.globals.seriesCandleM[i][j], i); + var c = coreUtils.getLogValAtSeriesIndex(w.globals.seriesCandleC[i][j], i); + var l = coreUtils.getLogValAtSeriesIndex(w.globals.seriesCandleL[i][j], i); + return { + o: this.isBoxPlot ? h : o, + h: this.isBoxPlot ? o : h, + m: m, + l: this.isBoxPlot ? c : l, + c: this.isBoxPlot ? l : c + }; + } + }]); + return BoxCandleStick; + }(Bar); + + var TreemapHelpers = /*#__PURE__*/function () { + function TreemapHelpers(ctx) { + _classCallCheck(this, TreemapHelpers); + this.ctx = ctx; + this.w = ctx.w; + } + _createClass(TreemapHelpers, [{ + key: "checkColorRange", + value: function checkColorRange() { + var w = this.w; + var negRange = false; + var chartOpts = w.config.plotOptions[w.config.chart.type]; + if (chartOpts.colorScale.ranges.length > 0) { + chartOpts.colorScale.ranges.map(function (range, index) { + if (range.from <= 0) { + negRange = true; + } + }); + } + return negRange; + } + }, { + key: "getShadeColor", + value: function getShadeColor(chartType, i, j, negRange) { + var w = this.w; + var colorShadePercent = 1; + var shadeIntensity = w.config.plotOptions[chartType].shadeIntensity; + var colorProps = this.determineColor(chartType, i, j); + if (w.globals.hasNegs || negRange) { + if (w.config.plotOptions[chartType].reverseNegativeShade) { + if (colorProps.percent < 0) { + colorShadePercent = colorProps.percent / 100 * (shadeIntensity * 1.25); + } else { + colorShadePercent = (1 - colorProps.percent / 100) * (shadeIntensity * 1.25); + } + } else { + if (colorProps.percent <= 0) { + colorShadePercent = 1 - (1 + colorProps.percent / 100) * shadeIntensity; + } else { + colorShadePercent = (1 - colorProps.percent / 100) * shadeIntensity; + } + } + } else { + colorShadePercent = 1 - colorProps.percent / 100; + if (chartType === 'treemap') { + colorShadePercent = (1 - colorProps.percent / 100) * (shadeIntensity * 1.25); + } + } + var color = colorProps.color; + var utils = new Utils$1(); + if (w.config.plotOptions[chartType].enableShades) { + // The shadeColor function may return either an RGB or a hex color value + // However, hexToRgba requires the input to be in hex format + // The ternary operator checks if the color is in RGB format, and if so, converts it to hex + if (this.w.config.theme.mode === 'dark') { + var shadeColor = utils.shadeColor(colorShadePercent * -1, colorProps.color); + color = Utils$1.hexToRgba(Utils$1.isColorHex(shadeColor) ? shadeColor : Utils$1.rgb2hex(shadeColor), w.config.fill.opacity); + } else { + var _shadeColor = utils.shadeColor(colorShadePercent, colorProps.color); + color = Utils$1.hexToRgba(Utils$1.isColorHex(_shadeColor) ? _shadeColor : Utils$1.rgb2hex(_shadeColor), w.config.fill.opacity); + } + } + return { + color: color, + colorProps: colorProps + }; + } + }, { + key: "determineColor", + value: function determineColor(chartType, i, j) { + var w = this.w; + var val = w.globals.series[i][j]; + var chartOpts = w.config.plotOptions[chartType]; + var seriesNumber = chartOpts.colorScale.inverse ? j : i; + if (chartOpts.distributed && w.config.chart.type === 'treemap') { + seriesNumber = j; + } + var color = w.globals.colors[seriesNumber]; + var foreColor = null; + var min = Math.min.apply(Math, _toConsumableArray(w.globals.series[i])); + var max = Math.max.apply(Math, _toConsumableArray(w.globals.series[i])); + if (!chartOpts.distributed && chartType === 'heatmap') { + min = w.globals.minY; + max = w.globals.maxY; + } + if (typeof chartOpts.colorScale.min !== 'undefined') { + min = chartOpts.colorScale.min < w.globals.minY ? chartOpts.colorScale.min : w.globals.minY; + max = chartOpts.colorScale.max > w.globals.maxY ? chartOpts.colorScale.max : w.globals.maxY; + } + var total = Math.abs(max) + Math.abs(min); + var percent = 100 * val / (total === 0 ? total - 0.000001 : total); + if (chartOpts.colorScale.ranges.length > 0) { + var colorRange = chartOpts.colorScale.ranges; + colorRange.map(function (range, index) { + if (val >= range.from && val <= range.to) { + color = range.color; + foreColor = range.foreColor ? range.foreColor : null; + min = range.from; + max = range.to; + var rTotal = Math.abs(max) + Math.abs(min); + percent = 100 * val / (rTotal === 0 ? rTotal - 0.000001 : rTotal); + } + }); + } + return { + color: color, + foreColor: foreColor, + percent: percent + }; + } + }, { + key: "calculateDataLabels", + value: function calculateDataLabels(_ref) { + var text = _ref.text, + x = _ref.x, + y = _ref.y, + i = _ref.i, + j = _ref.j, + colorProps = _ref.colorProps, + fontSize = _ref.fontSize; + var w = this.w; + var dataLabelsConfig = w.config.dataLabels; + var graphics = new Graphics(this.ctx); + var dataLabels = new DataLabels(this.ctx); + var elDataLabelsWrap = null; + if (dataLabelsConfig.enabled) { + elDataLabelsWrap = graphics.group({ + class: 'apexcharts-data-labels' + }); + var offX = dataLabelsConfig.offsetX; + var offY = dataLabelsConfig.offsetY; + var dataLabelsX = x + offX; + var dataLabelsY = y + parseFloat(dataLabelsConfig.style.fontSize) / 3 + offY; + dataLabels.plotDataLabelsText({ + x: dataLabelsX, + y: dataLabelsY, + text: text, + i: i, + j: j, + color: colorProps.foreColor, + parent: elDataLabelsWrap, + fontSize: fontSize, + dataLabelsConfig: dataLabelsConfig + }); + } + return elDataLabelsWrap; + } + }, { + key: "addListeners", + value: function addListeners(elRect) { + var graphics = new Graphics(this.ctx); + elRect.node.addEventListener('mouseenter', graphics.pathMouseEnter.bind(this, elRect)); + elRect.node.addEventListener('mouseleave', graphics.pathMouseLeave.bind(this, elRect)); + elRect.node.addEventListener('mousedown', graphics.pathMouseDown.bind(this, elRect)); + } + }]); + return TreemapHelpers; + }(); + + /** + * ApexCharts HeatMap Class. + * @module HeatMap + **/ + var HeatMap = /*#__PURE__*/function () { + function HeatMap(ctx, xyRatios) { + _classCallCheck(this, HeatMap); + this.ctx = ctx; + this.w = ctx.w; + this.xRatio = xyRatios.xRatio; + this.yRatio = xyRatios.yRatio; + this.dynamicAnim = this.w.config.chart.animations.dynamicAnimation; + this.helpers = new TreemapHelpers(ctx); + this.rectRadius = this.w.config.plotOptions.heatmap.radius; + this.strokeWidth = this.w.config.stroke.show ? this.w.config.stroke.width : 0; + } + _createClass(HeatMap, [{ + key: "draw", + value: function draw(series) { + var w = this.w; + var graphics = new Graphics(this.ctx); + var ret = graphics.group({ + class: 'apexcharts-heatmap' + }); + ret.attr('clip-path', "url(#gridRectMask".concat(w.globals.cuid, ")")); + + // width divided into equal parts + var xDivision = w.globals.gridWidth / w.globals.dataPoints; + var yDivision = w.globals.gridHeight / w.globals.series.length; + var y1 = 0; + var rev = false; + this.negRange = this.helpers.checkColorRange(); + var heatSeries = series.slice(); + if (w.config.yaxis[0].reversed) { + rev = true; + heatSeries.reverse(); + } + for (var i = rev ? 0 : heatSeries.length - 1; rev ? i < heatSeries.length : i >= 0; rev ? i++ : i--) { + // el to which series will be drawn + var elSeries = graphics.group({ + class: "apexcharts-series apexcharts-heatmap-series", + seriesName: Utils$1.escapeString(w.globals.seriesNames[i]), + rel: i + 1, + 'data:realIndex': i + }); + this.ctx.series.addCollapsedClassToSeries(elSeries, i); + if (w.config.chart.dropShadow.enabled) { + var shadow = w.config.chart.dropShadow; + var filters = new Filters(this.ctx); + filters.dropShadow(elSeries, shadow, i); + } + var x1 = 0; + var shadeIntensity = w.config.plotOptions.heatmap.shadeIntensity; + var j = 0; + for (var dIndex = 0; dIndex < w.globals.dataPoints; dIndex++) { + // Recognize gaps and align values based on x axis + + if (w.globals.seriesX.length && !w.globals.allSeriesHasEqualX) { + if (w.globals.minX + w.globals.minXDiff * dIndex < w.globals.seriesX[i][j]) { + x1 = x1 + xDivision; + continue; + } + } + + // Stop loop if index is out of array length + if (j >= heatSeries[i].length) break; + var heatColor = this.helpers.getShadeColor(w.config.chart.type, i, j, this.negRange); + var color = heatColor.color; + var heatColorProps = heatColor.colorProps; + if (w.config.fill.type === 'image') { + var fill = new Fill(this.ctx); + color = fill.fillPath({ + seriesNumber: i, + dataPointIndex: j, + opacity: w.globals.hasNegs ? heatColorProps.percent < 0 ? 1 - (1 + heatColorProps.percent / 100) : shadeIntensity + heatColorProps.percent / 100 : heatColorProps.percent / 100, + patternID: Utils$1.randomId(), + width: w.config.fill.image.width ? w.config.fill.image.width : xDivision, + height: w.config.fill.image.height ? w.config.fill.image.height : yDivision + }); + } + var radius = this.rectRadius; + var rect = graphics.drawRect(x1, y1, xDivision, yDivision, radius); + rect.attr({ + cx: x1, + cy: y1 + }); + rect.node.classList.add('apexcharts-heatmap-rect'); + elSeries.add(rect); + rect.attr({ + fill: color, + i: i, + index: i, + j: j, + val: series[i][j], + 'stroke-width': this.strokeWidth, + stroke: w.config.plotOptions.heatmap.useFillColorAsStroke ? color : w.globals.stroke.colors[0], + color: color + }); + this.helpers.addListeners(rect); + if (w.config.chart.animations.enabled && !w.globals.dataChanged) { + var speed = 1; + if (!w.globals.resized) { + speed = w.config.chart.animations.speed; + } + this.animateHeatMap(rect, x1, y1, xDivision, yDivision, speed); + } + if (w.globals.dataChanged) { + var _speed = 1; + if (this.dynamicAnim.enabled && w.globals.shouldAnimate) { + _speed = this.dynamicAnim.speed; + var colorFrom = w.globals.previousPaths[i] && w.globals.previousPaths[i][j] && w.globals.previousPaths[i][j].color; + if (!colorFrom) colorFrom = 'rgba(255, 255, 255, 0)'; + this.animateHeatColor(rect, Utils$1.isColorHex(colorFrom) ? colorFrom : Utils$1.rgb2hex(colorFrom), Utils$1.isColorHex(color) ? color : Utils$1.rgb2hex(color), _speed); + } + } + var formatter = w.config.dataLabels.formatter; + var formattedText = formatter(w.globals.series[i][j], { + value: w.globals.series[i][j], + seriesIndex: i, + dataPointIndex: j, + w: w + }); + var dataLabels = this.helpers.calculateDataLabels({ + text: formattedText, + x: x1 + xDivision / 2, + y: y1 + yDivision / 2, + i: i, + j: j, + colorProps: heatColorProps, + series: heatSeries + }); + if (dataLabels !== null) { + elSeries.add(dataLabels); + } + x1 = x1 + xDivision; + j++; + } + y1 = y1 + yDivision; + ret.add(elSeries); + } + + // adjust yaxis labels for heatmap + var yAxisScale = w.globals.yAxisScale[0].result.slice(); + if (w.config.yaxis[0].reversed) { + yAxisScale.unshift(''); + } else { + yAxisScale.push(''); + } + w.globals.yAxisScale[0].result = yAxisScale; + return ret; + } + }, { + key: "animateHeatMap", + value: function animateHeatMap(el, x, y, width, height, speed) { + var animations = new Animations(this.ctx); + animations.animateRect(el, { + x: x + width / 2, + y: y + height / 2, + width: 0, + height: 0 + }, { + x: x, + y: y, + width: width, + height: height + }, speed, function () { + animations.animationCompleted(el); + }); + } + }, { + key: "animateHeatColor", + value: function animateHeatColor(el, colorFrom, colorTo, speed) { + el.attr({ + fill: colorFrom + }).animate(speed).attr({ + fill: colorTo + }); + } + }]); + return HeatMap; + }(); + + var CircularChartsHelpers = /*#__PURE__*/function () { + function CircularChartsHelpers(ctx) { + _classCallCheck(this, CircularChartsHelpers); + this.ctx = ctx; + this.w = ctx.w; + } + _createClass(CircularChartsHelpers, [{ + key: "drawYAxisTexts", + value: function drawYAxisTexts(x, y, i, text) { + var w = this.w; + var yaxisConfig = w.config.yaxis[0]; + var formatter = w.globals.yLabelFormatters[0]; + var graphics = new Graphics(this.ctx); + var yaxisLabel = graphics.drawText({ + x: x + yaxisConfig.labels.offsetX, + y: y + yaxisConfig.labels.offsetY, + text: formatter(text, i), + textAnchor: 'middle', + fontSize: yaxisConfig.labels.style.fontSize, + fontFamily: yaxisConfig.labels.style.fontFamily, + foreColor: Array.isArray(yaxisConfig.labels.style.colors) ? yaxisConfig.labels.style.colors[i] : yaxisConfig.labels.style.colors + }); + return yaxisLabel; + } + }]); + return CircularChartsHelpers; + }(); + + /** + * ApexCharts Pie Class for drawing Pie / Donut Charts. + * @module Pie + **/ + var Pie = /*#__PURE__*/function () { + function Pie(ctx) { + _classCallCheck(this, Pie); + this.ctx = ctx; + this.w = ctx.w; + var w = this.w; + this.chartType = this.w.config.chart.type; + this.initialAnim = this.w.config.chart.animations.enabled; + this.dynamicAnim = this.initialAnim && this.w.config.chart.animations.dynamicAnimation.enabled; + this.animBeginArr = [0]; + this.animDur = 0; + this.donutDataLabels = this.w.config.plotOptions.pie.donut.labels; + this.lineColorArr = w.globals.stroke.colors !== undefined ? w.globals.stroke.colors : w.globals.colors; + this.defaultSize = Math.min(w.globals.gridWidth, w.globals.gridHeight); + this.centerY = this.defaultSize / 2; + this.centerX = w.globals.gridWidth / 2; + if (w.config.chart.type === 'radialBar') { + this.fullAngle = 360; + } else { + this.fullAngle = Math.abs(w.config.plotOptions.pie.endAngle - w.config.plotOptions.pie.startAngle); + } + this.initialAngle = w.config.plotOptions.pie.startAngle % this.fullAngle; + w.globals.radialSize = this.defaultSize / 2.05 - w.config.stroke.width - (!w.config.chart.sparkline.enabled ? w.config.chart.dropShadow.blur : 0); + this.donutSize = w.globals.radialSize * parseInt(w.config.plotOptions.pie.donut.size, 10) / 100; + var scaleSize = w.config.plotOptions.pie.customScale; + var halfW = w.globals.gridWidth / 2; + var halfH = w.globals.gridHeight / 2; + this.translateX = halfW - halfW * scaleSize; + this.translateY = halfH - halfH * scaleSize; + this.dataLabelsGroup = new Graphics(this.ctx).group({ + class: 'apexcharts-datalabels-group', + transform: "translate(".concat(this.translateX, ", ").concat(this.translateY, ") scale(").concat(scaleSize, ")") + }); + this.maxY = 0; + this.sliceLabels = []; + this.sliceSizes = []; + this.prevSectorAngleArr = []; // for dynamic animations + } + _createClass(Pie, [{ + key: "draw", + value: function draw(series) { + var _this = this; + var self = this; + var w = this.w; + var graphics = new Graphics(this.ctx); + var elPie = graphics.group({ + class: 'apexcharts-pie' + }); + if (w.globals.noData) return elPie; + var total = 0; + for (var k = 0; k < series.length; k++) { + // CALCULATE THE TOTAL + total += Utils$1.negToZero(series[k]); + } + var sectorAngleArr = []; + + // el to which series will be drawn + var elSeries = graphics.group(); + + // prevent division by zero error if there is no data + if (total === 0) { + total = 0.00001; + } + series.forEach(function (m) { + _this.maxY = Math.max(_this.maxY, m); + }); + + // override maxY if user provided in config + if (w.config.yaxis[0].max) { + this.maxY = w.config.yaxis[0].max; + } + if (w.config.grid.position === 'back' && this.chartType === 'polarArea') { + this.drawPolarElements(elPie); + } + for (var i = 0; i < series.length; i++) { + // CALCULATE THE ANGLES + var angle = this.fullAngle * Utils$1.negToZero(series[i]) / total; + sectorAngleArr.push(angle); + if (this.chartType === 'polarArea') { + sectorAngleArr[i] = this.fullAngle / series.length; + this.sliceSizes.push(w.globals.radialSize * series[i] / this.maxY); + } else { + this.sliceSizes.push(w.globals.radialSize); + } + } + if (w.globals.dataChanged) { + var prevTotal = 0; + for (var _k = 0; _k < w.globals.previousPaths.length; _k++) { + // CALCULATE THE PREV TOTAL + prevTotal += Utils$1.negToZero(w.globals.previousPaths[_k]); + } + var previousAngle; + for (var _i = 0; _i < w.globals.previousPaths.length; _i++) { + // CALCULATE THE PREVIOUS ANGLES + previousAngle = this.fullAngle * Utils$1.negToZero(w.globals.previousPaths[_i]) / prevTotal; + this.prevSectorAngleArr.push(previousAngle); + } + } + + // on small chart size after few count of resizes browser window donutSize can be negative + if (this.donutSize < 0) { + this.donutSize = 0; + } + if (this.chartType === 'donut') { + // draw the inner circle and add some text to it + var circle = graphics.drawCircle(this.donutSize); + circle.attr({ + cx: this.centerX, + cy: this.centerY, + fill: w.config.plotOptions.pie.donut.background ? w.config.plotOptions.pie.donut.background : 'transparent' + }); + elSeries.add(circle); + } + var elG = self.drawArcs(sectorAngleArr, series); + + // add slice dataLabels at the end + this.sliceLabels.forEach(function (s) { + elG.add(s); + }); + elSeries.attr({ + transform: "translate(".concat(this.translateX, ", ").concat(this.translateY, ") scale(").concat(w.config.plotOptions.pie.customScale, ")") + }); + elSeries.add(elG); + elPie.add(elSeries); + if (this.donutDataLabels.show) { + var dataLabels = this.renderInnerDataLabels(this.dataLabelsGroup, this.donutDataLabels, { + hollowSize: this.donutSize, + centerX: this.centerX, + centerY: this.centerY, + opacity: this.donutDataLabels.show + }); + elPie.add(dataLabels); + } + if (w.config.grid.position === 'front' && this.chartType === 'polarArea') { + this.drawPolarElements(elPie); + } + return elPie; + } + + // core function for drawing pie arcs + }, { + key: "drawArcs", + value: function drawArcs(sectorAngleArr, series) { + var w = this.w; + var filters = new Filters(this.ctx); + var graphics = new Graphics(this.ctx); + var fill = new Fill(this.ctx); + var g = graphics.group({ + class: 'apexcharts-slices' + }); + var startAngle = this.initialAngle; + var prevStartAngle = this.initialAngle; + var endAngle = this.initialAngle; + var prevEndAngle = this.initialAngle; + this.strokeWidth = w.config.stroke.show ? w.config.stroke.width : 0; + for (var i = 0; i < sectorAngleArr.length; i++) { + var elPieArc = graphics.group({ + class: "apexcharts-series apexcharts-pie-series", + seriesName: Utils$1.escapeString(w.globals.seriesNames[i]), + rel: i + 1, + 'data:realIndex': i + }); + g.add(elPieArc); + startAngle = endAngle; + prevStartAngle = prevEndAngle; + endAngle = startAngle + sectorAngleArr[i]; + prevEndAngle = prevStartAngle + this.prevSectorAngleArr[i]; + var angle = endAngle < startAngle ? this.fullAngle + endAngle - startAngle : endAngle - startAngle; + var pathFill = fill.fillPath({ + seriesNumber: i, + size: this.sliceSizes[i], + value: series[i] + }); // additionally, pass size for gradient drawing in the fillPath function + + var path = this.getChangedPath(prevStartAngle, prevEndAngle); + var elPath = graphics.drawPath({ + d: path, + stroke: Array.isArray(this.lineColorArr) ? this.lineColorArr[i] : this.lineColorArr, + strokeWidth: 0, + fill: pathFill, + fillOpacity: w.config.fill.opacity, + classes: "apexcharts-pie-area apexcharts-".concat(this.chartType.toLowerCase(), "-slice-").concat(i) + }); + elPath.attr({ + index: 0, + j: i + }); + filters.setSelectionFilter(elPath, 0, i); + if (w.config.chart.dropShadow.enabled) { + var shadow = w.config.chart.dropShadow; + filters.dropShadow(elPath, shadow, i); + } + this.addListeners(elPath, this.donutDataLabels); + Graphics.setAttrs(elPath.node, { + 'data:angle': angle, + 'data:startAngle': startAngle, + 'data:strokeWidth': this.strokeWidth, + 'data:value': series[i] + }); + var labelPosition = { + x: 0, + y: 0 + }; + if (this.chartType === 'pie' || this.chartType === 'polarArea') { + labelPosition = Utils$1.polarToCartesian(this.centerX, this.centerY, w.globals.radialSize / 1.25 + w.config.plotOptions.pie.dataLabels.offset, (startAngle + angle / 2) % this.fullAngle); + } else if (this.chartType === 'donut') { + labelPosition = Utils$1.polarToCartesian(this.centerX, this.centerY, (w.globals.radialSize + this.donutSize) / 2 + w.config.plotOptions.pie.dataLabels.offset, (startAngle + angle / 2) % this.fullAngle); + } + elPieArc.add(elPath); + + // Animation code starts + var dur = 0; + if (this.initialAnim && !w.globals.resized && !w.globals.dataChanged) { + dur = angle / this.fullAngle * w.config.chart.animations.speed; + if (dur === 0) dur = 1; + this.animDur = dur + this.animDur; + this.animBeginArr.push(this.animDur); + } else { + this.animBeginArr.push(0); + } + if (this.dynamicAnim && w.globals.dataChanged) { + this.animatePaths(elPath, { + size: this.sliceSizes[i], + endAngle: endAngle, + startAngle: startAngle, + prevStartAngle: prevStartAngle, + prevEndAngle: prevEndAngle, + animateStartingPos: true, + i: i, + animBeginArr: this.animBeginArr, + shouldSetPrevPaths: true, + dur: w.config.chart.animations.dynamicAnimation.speed + }); + } else { + this.animatePaths(elPath, { + size: this.sliceSizes[i], + endAngle: endAngle, + startAngle: startAngle, + i: i, + totalItems: sectorAngleArr.length - 1, + animBeginArr: this.animBeginArr, + dur: dur + }); + } + // animation code ends + + if (w.config.plotOptions.pie.expandOnClick && this.chartType !== 'polarArea') { + elPath.node.addEventListener('mouseup', this.pieClicked.bind(this, i)); + } + if (typeof w.globals.selectedDataPoints[0] !== 'undefined' && w.globals.selectedDataPoints[0].indexOf(i) > -1) { + this.pieClicked(i); + } + if (w.config.dataLabels.enabled) { + var xPos = labelPosition.x; + var yPos = labelPosition.y; + var text = 100 * angle / this.fullAngle + '%'; + if (angle !== 0 && w.config.plotOptions.pie.dataLabels.minAngleToShowLabel < sectorAngleArr[i]) { + var formatter = w.config.dataLabels.formatter; + if (formatter !== undefined) { + text = formatter(w.globals.seriesPercent[i][0], { + seriesIndex: i, + w: w + }); + } + var foreColor = w.globals.dataLabels.style.colors[i]; + var elPieLabelWrap = graphics.group({ + class: "apexcharts-datalabels" + }); + var elPieLabel = graphics.drawText({ + x: xPos, + y: yPos, + text: text, + textAnchor: 'middle', + fontSize: w.config.dataLabels.style.fontSize, + fontFamily: w.config.dataLabels.style.fontFamily, + fontWeight: w.config.dataLabels.style.fontWeight, + foreColor: foreColor + }); + elPieLabelWrap.add(elPieLabel); + if (w.config.dataLabels.dropShadow.enabled) { + var textShadow = w.config.dataLabels.dropShadow; + filters.dropShadow(elPieLabel, textShadow); + } + elPieLabel.node.classList.add('apexcharts-pie-label'); + if (w.config.chart.animations.animate && w.globals.resized === false) { + elPieLabel.node.classList.add('apexcharts-pie-label-delay'); + elPieLabel.node.style.animationDelay = w.config.chart.animations.speed / 940 + 's'; + } + this.sliceLabels.push(elPieLabelWrap); + } + } + } + return g; + } + }, { + key: "addListeners", + value: function addListeners(elPath, dataLabels) { + var graphics = new Graphics(this.ctx); + // append filters on mouseenter and mouseleave + elPath.node.addEventListener('mouseenter', graphics.pathMouseEnter.bind(this, elPath)); + elPath.node.addEventListener('mouseleave', graphics.pathMouseLeave.bind(this, elPath)); + elPath.node.addEventListener('mouseleave', this.revertDataLabelsInner.bind(this, elPath.node, dataLabels)); + elPath.node.addEventListener('mousedown', graphics.pathMouseDown.bind(this, elPath)); + if (!this.donutDataLabels.total.showAlways) { + elPath.node.addEventListener('mouseenter', this.printDataLabelsInner.bind(this, elPath.node, dataLabels)); + elPath.node.addEventListener('mousedown', this.printDataLabelsInner.bind(this, elPath.node, dataLabels)); + } + } + + // This function can be used for other circle charts too + }, { + key: "animatePaths", + value: function animatePaths(el, opts) { + var w = this.w; + var me = this; + var angle = opts.endAngle < opts.startAngle ? this.fullAngle + opts.endAngle - opts.startAngle : opts.endAngle - opts.startAngle; + var prevAngle = angle; + var fromStartAngle = opts.startAngle; + var toStartAngle = opts.startAngle; + if (opts.prevStartAngle !== undefined && opts.prevEndAngle !== undefined) { + fromStartAngle = opts.prevEndAngle; + prevAngle = opts.prevEndAngle < opts.prevStartAngle ? this.fullAngle + opts.prevEndAngle - opts.prevStartAngle : opts.prevEndAngle - opts.prevStartAngle; + } + if (opts.i === w.config.series.length - 1) { + // some adjustments for the last overlapping paths + if (angle + toStartAngle > this.fullAngle) { + opts.endAngle = opts.endAngle - (angle + toStartAngle); + } else if (angle + toStartAngle < this.fullAngle) { + opts.endAngle = opts.endAngle + (this.fullAngle - (angle + toStartAngle)); + } + } + if (angle === this.fullAngle) angle = this.fullAngle - 0.01; + me.animateArc(el, fromStartAngle, toStartAngle, angle, prevAngle, opts); + } + }, { + key: "animateArc", + value: function animateArc(el, fromStartAngle, toStartAngle, angle, prevAngle, opts) { + var me = this; + var w = this.w; + var animations = new Animations(this.ctx); + var size = opts.size; + var path; + if (isNaN(fromStartAngle) || isNaN(prevAngle)) { + fromStartAngle = toStartAngle; + prevAngle = angle; + opts.dur = 0; + } + var currAngle = angle; + var startAngle = toStartAngle; + var fromAngle = fromStartAngle < toStartAngle ? this.fullAngle + fromStartAngle - toStartAngle : fromStartAngle - toStartAngle; + if (w.globals.dataChanged && opts.shouldSetPrevPaths) { + // to avoid flicker when updating, set prev path first and then animate from there + if (opts.prevEndAngle) { + path = me.getPiePath({ + me: me, + startAngle: opts.prevStartAngle, + angle: opts.prevEndAngle < opts.prevStartAngle ? this.fullAngle + opts.prevEndAngle - opts.prevStartAngle : opts.prevEndAngle - opts.prevStartAngle, + size: size + }); + el.attr({ + d: path + }); + } + } + if (opts.dur !== 0) { + el.animate(opts.dur, opts.animBeginArr[opts.i]).after(function () { + if (me.chartType === 'pie' || me.chartType === 'donut' || me.chartType === 'polarArea') { + this.animate(w.config.chart.animations.dynamicAnimation.speed).attr({ + 'stroke-width': me.strokeWidth + }); + } + if (opts.i === w.config.series.length - 1) { + animations.animationCompleted(el); + } + }).during(function (pos) { + currAngle = fromAngle + (angle - fromAngle) * pos; + if (opts.animateStartingPos) { + currAngle = prevAngle + (angle - prevAngle) * pos; + startAngle = fromStartAngle - prevAngle + (toStartAngle - (fromStartAngle - prevAngle)) * pos; + } + path = me.getPiePath({ + me: me, + startAngle: startAngle, + angle: currAngle, + size: size + }); + el.node.setAttribute('data:pathOrig', path); + el.attr({ + d: path + }); + }); + } else { + path = me.getPiePath({ + me: me, + startAngle: startAngle, + angle: angle, + size: size + }); + if (!opts.isTrack) { + w.globals.animationEnded = true; + } + el.node.setAttribute('data:pathOrig', path); + el.attr({ + d: path, + 'stroke-width': me.strokeWidth + }); + } + } + }, { + key: "pieClicked", + value: function pieClicked(i) { + var w = this.w; + var me = this; + var path; + var size = me.sliceSizes[i] + (w.config.plotOptions.pie.expandOnClick ? 4 : 0); + var elPath = w.globals.dom.Paper.findOne(".apexcharts-".concat(me.chartType.toLowerCase(), "-slice-").concat(i)); + if (elPath.attr('data:pieClicked') === 'true') { + elPath.attr({ + 'data:pieClicked': 'false' + }); + this.revertDataLabelsInner(elPath.node, this.donutDataLabels); + var origPath = elPath.attr('data:pathOrig'); + elPath.attr({ + d: origPath + }); + return; + } else { + // reset all elems + var allEls = w.globals.dom.baseEl.getElementsByClassName('apexcharts-pie-area'); + Array.prototype.forEach.call(allEls, function (pieSlice) { + pieSlice.setAttribute('data:pieClicked', 'false'); + var origPath = pieSlice.getAttribute('data:pathOrig'); + if (origPath) { + pieSlice.setAttribute('d', origPath); + } + }); + w.globals.capturedDataPointIndex = i; + elPath.attr('data:pieClicked', 'true'); + } + var startAngle = parseInt(elPath.attr('data:startAngle'), 10); + var angle = parseInt(elPath.attr('data:angle'), 10); + path = me.getPiePath({ + me: me, + startAngle: startAngle, + angle: angle, + size: size + }); + if (angle === 360) return; + elPath.plot(path); + } + }, { + key: "getChangedPath", + value: function getChangedPath(prevStartAngle, prevEndAngle) { + var path = ''; + if (this.dynamicAnim && this.w.globals.dataChanged) { + path = this.getPiePath({ + me: this, + startAngle: prevStartAngle, + angle: prevEndAngle - prevStartAngle, + size: this.size + }); + } + return path; + } + }, { + key: "getPiePath", + value: function getPiePath(_ref) { + var me = _ref.me, + startAngle = _ref.startAngle, + angle = _ref.angle, + size = _ref.size; + var path; + var graphics = new Graphics(this.ctx); + var startDeg = startAngle; + var startRadians = Math.PI * (startDeg - 90) / 180; + var endDeg = angle + startAngle; + // prevent overlap + if (Math.ceil(endDeg) >= this.fullAngle + this.w.config.plotOptions.pie.startAngle % this.fullAngle) { + endDeg = this.fullAngle + this.w.config.plotOptions.pie.startAngle % this.fullAngle - 0.01; + } + if (Math.ceil(endDeg) > this.fullAngle) endDeg -= this.fullAngle; + var endRadians = Math.PI * (endDeg - 90) / 180; + var x1 = me.centerX + size * Math.cos(startRadians); + var y1 = me.centerY + size * Math.sin(startRadians); + var x2 = me.centerX + size * Math.cos(endRadians); + var y2 = me.centerY + size * Math.sin(endRadians); + var startInner = Utils$1.polarToCartesian(me.centerX, me.centerY, me.donutSize, endDeg); + var endInner = Utils$1.polarToCartesian(me.centerX, me.centerY, me.donutSize, startDeg); + var largeArc = angle > 180 ? 1 : 0; + var pathBeginning = ['M', x1, y1, 'A', size, size, 0, largeArc, 1, x2, y2]; + if (me.chartType === 'donut') { + path = [].concat(pathBeginning, ['L', startInner.x, startInner.y, 'A', me.donutSize, me.donutSize, 0, largeArc, 0, endInner.x, endInner.y, 'L', x1, y1, 'z']).join(' '); + } else if (me.chartType === 'pie' || me.chartType === 'polarArea') { + path = [].concat(pathBeginning, ['L', me.centerX, me.centerY, 'L', x1, y1]).join(' '); + } else { + path = [].concat(pathBeginning).join(' '); + } + return graphics.roundPathCorners(path, this.strokeWidth * 2); + } + }, { + key: "drawPolarElements", + value: function drawPolarElements(parent) { + var w = this.w; + var scale = new Scales(this.ctx); + var graphics = new Graphics(this.ctx); + var helpers = new CircularChartsHelpers(this.ctx); + var gCircles = graphics.group(); + var gYAxis = graphics.group(); + var yScale = scale.niceScale(0, Math.ceil(this.maxY), 0); + var yTexts = yScale.result.reverse(); + var len = yScale.result.length; + this.maxY = yScale.niceMax; + var circleSize = w.globals.radialSize; + var diff = circleSize / (len - 1); + for (var i = 0; i < len - 1; i++) { + var circle = graphics.drawCircle(circleSize); + circle.attr({ + cx: this.centerX, + cy: this.centerY, + fill: 'none', + 'stroke-width': w.config.plotOptions.polarArea.rings.strokeWidth, + stroke: w.config.plotOptions.polarArea.rings.strokeColor + }); + if (w.config.yaxis[0].show) { + var yLabel = helpers.drawYAxisTexts(this.centerX, this.centerY - circleSize + parseInt(w.config.yaxis[0].labels.style.fontSize, 10) / 2, i, yTexts[i]); + gYAxis.add(yLabel); + } + gCircles.add(circle); + circleSize = circleSize - diff; + } + this.drawSpokes(parent); + parent.add(gCircles); + parent.add(gYAxis); + } + }, { + key: "renderInnerDataLabels", + value: function renderInnerDataLabels(dataLabelsGroup, dataLabelsConfig, opts) { + var w = this.w; + var graphics = new Graphics(this.ctx); + var showTotal = dataLabelsConfig.total.show; + dataLabelsGroup.node.innerHTML = ''; + dataLabelsGroup.node.style.opacity = opts.opacity; + var x = opts.centerX; + var y = !this.donutDataLabels.total.label ? opts.centerY - opts.centerY / 6 : opts.centerY; + var labelColor, valueColor; + if (dataLabelsConfig.name.color === undefined) { + labelColor = w.globals.colors[0]; + } else { + labelColor = dataLabelsConfig.name.color; + } + var labelFontSize = dataLabelsConfig.name.fontSize; + var labelFontFamily = dataLabelsConfig.name.fontFamily; + var labelFontWeight = dataLabelsConfig.name.fontWeight; + if (dataLabelsConfig.value.color === undefined) { + valueColor = w.config.chart.foreColor; + } else { + valueColor = dataLabelsConfig.value.color; + } + var lbFormatter = dataLabelsConfig.value.formatter; + var val = ''; + var name = ''; + if (showTotal) { + labelColor = dataLabelsConfig.total.color; + labelFontSize = dataLabelsConfig.total.fontSize; + labelFontFamily = dataLabelsConfig.total.fontFamily; + labelFontWeight = dataLabelsConfig.total.fontWeight; + name = !this.donutDataLabels.total.label ? '' : dataLabelsConfig.total.label; + val = dataLabelsConfig.total.formatter(w); + } else { + if (w.globals.series.length === 1) { + val = lbFormatter(w.globals.series[0], w); + name = w.globals.seriesNames[0]; + } + } + if (name) { + name = dataLabelsConfig.name.formatter(name, dataLabelsConfig.total.show, w); + } + if (dataLabelsConfig.name.show) { + var elLabel = graphics.drawText({ + x: x, + y: y + parseFloat(dataLabelsConfig.name.offsetY), + text: name, + textAnchor: 'middle', + foreColor: labelColor, + fontSize: labelFontSize, + fontWeight: labelFontWeight, + fontFamily: labelFontFamily + }); + elLabel.node.classList.add('apexcharts-datalabel-label'); + dataLabelsGroup.add(elLabel); + } + if (dataLabelsConfig.value.show) { + var valOffset = dataLabelsConfig.name.show ? parseFloat(dataLabelsConfig.value.offsetY) + 16 : dataLabelsConfig.value.offsetY; + var elValue = graphics.drawText({ + x: x, + y: y + valOffset, + text: val, + textAnchor: 'middle', + foreColor: valueColor, + fontWeight: dataLabelsConfig.value.fontWeight, + fontSize: dataLabelsConfig.value.fontSize, + fontFamily: dataLabelsConfig.value.fontFamily + }); + elValue.node.classList.add('apexcharts-datalabel-value'); + dataLabelsGroup.add(elValue); + } + + // for a multi-series circle chart, we need to show total value instead of first series labels + + return dataLabelsGroup; + } + + /** + * + * @param {string} name - The name of the series + * @param {string} val - The value of that series + * @param {object} el - Optional el (indicates which series was hovered/clicked). If this param is not present, means we need to show total + */ + }, { + key: "printInnerLabels", + value: function printInnerLabels(labelsConfig, name, val, el) { + var w = this.w; + var labelColor; + if (el) { + if (labelsConfig.name.color === undefined) { + labelColor = w.globals.colors[parseInt(el.parentNode.getAttribute('rel'), 10) - 1]; + } else { + labelColor = labelsConfig.name.color; + } + } else { + if (w.globals.series.length > 1 && labelsConfig.total.show) { + labelColor = labelsConfig.total.color; + } + } + var elLabel = w.globals.dom.baseEl.querySelector('.apexcharts-datalabel-label'); + var elValue = w.globals.dom.baseEl.querySelector('.apexcharts-datalabel-value'); + var lbFormatter = labelsConfig.value.formatter; + val = lbFormatter(val, w); + + // we need to show Total Val - so get the formatter of it + if (!el && typeof labelsConfig.total.formatter === 'function') { + val = labelsConfig.total.formatter(w); + } + var isTotal = name === labelsConfig.total.label; + name = !this.donutDataLabels.total.label ? '' : labelsConfig.name.formatter(name, isTotal, w); + if (elLabel !== null) { + elLabel.textContent = name; + } + if (elValue !== null) { + elValue.textContent = val; + } + if (elLabel !== null) { + elLabel.style.fill = labelColor; + } + } + }, { + key: "printDataLabelsInner", + value: function printDataLabelsInner(el, dataLabelsConfig) { + var w = this.w; + var val = el.getAttribute('data:value'); + var name = w.globals.seriesNames[parseInt(el.parentNode.getAttribute('rel'), 10) - 1]; + if (w.globals.series.length > 1) { + this.printInnerLabels(dataLabelsConfig, name, val, el); + } + var dataLabelsGroup = w.globals.dom.baseEl.querySelector('.apexcharts-datalabels-group'); + if (dataLabelsGroup !== null) { + dataLabelsGroup.style.opacity = 1; + } + } + }, { + key: "drawSpokes", + value: function drawSpokes(parent) { + var _this2 = this; + var w = this.w; + var graphics = new Graphics(this.ctx); + var spokeConfig = w.config.plotOptions.polarArea.spokes; + if (spokeConfig.strokeWidth === 0) return; + var spokes = []; + var angleDivision = 360 / w.globals.series.length; + for (var i = 0; i < w.globals.series.length; i++) { + spokes.push(Utils$1.polarToCartesian(this.centerX, this.centerY, w.globals.radialSize, w.config.plotOptions.pie.startAngle + angleDivision * i)); + } + spokes.forEach(function (p, i) { + var line = graphics.drawLine(p.x, p.y, _this2.centerX, _this2.centerY, Array.isArray(spokeConfig.connectorColors) ? spokeConfig.connectorColors[i] : spokeConfig.connectorColors); + parent.add(line); + }); + } + }, { + key: "revertDataLabelsInner", + value: function revertDataLabelsInner() { + var w = this.w; + if (this.donutDataLabels.show) { + var dataLabelsGroup = w.globals.dom.Paper.findOne(".apexcharts-datalabels-group"); + var dataLabels = this.renderInnerDataLabels(dataLabelsGroup, this.donutDataLabels, { + hollowSize: this.donutSize, + centerX: this.centerX, + centerY: this.centerY, + opacity: this.donutDataLabels.show + }); + var elPie = w.globals.dom.Paper.findOne('.apexcharts-radialbar, .apexcharts-pie'); + elPie.add(dataLabels); + } + } + }]); + return Pie; + }(); + + /** + * ApexCharts Radar Class for Spider/Radar Charts. + * @module Radar + **/ + var Radar = /*#__PURE__*/function () { + function Radar(ctx) { + _classCallCheck(this, Radar); + this.ctx = ctx; + this.w = ctx.w; + this.chartType = this.w.config.chart.type; + this.initialAnim = this.w.config.chart.animations.enabled; + this.dynamicAnim = this.initialAnim && this.w.config.chart.animations.dynamicAnimation.enabled; + this.animDur = 0; + var w = this.w; + this.graphics = new Graphics(this.ctx); + this.lineColorArr = w.globals.stroke.colors !== undefined ? w.globals.stroke.colors : w.globals.colors; + this.defaultSize = w.globals.svgHeight < w.globals.svgWidth ? w.globals.gridHeight : w.globals.gridWidth; + this.isLog = w.config.yaxis[0].logarithmic; + this.logBase = w.config.yaxis[0].logBase; + this.coreUtils = new CoreUtils(this.ctx); + this.maxValue = this.isLog ? this.coreUtils.getLogVal(this.logBase, w.globals.maxY, 0) : w.globals.maxY; + this.minValue = this.isLog ? this.coreUtils.getLogVal(this.logBase, this.w.globals.minY, 0) : w.globals.minY; + this.polygons = w.config.plotOptions.radar.polygons; + this.strokeWidth = w.config.stroke.show ? w.config.stroke.width : 0; + this.size = this.defaultSize / 2.1 - this.strokeWidth - w.config.chart.dropShadow.blur; + if (w.config.xaxis.labels.show) { + this.size = this.size - w.globals.xAxisLabelsWidth / 1.75; + } + if (w.config.plotOptions.radar.size !== undefined) { + this.size = w.config.plotOptions.radar.size; + } + this.dataRadiusOfPercent = []; + this.dataRadius = []; + this.angleArr = []; + this.yaxisLabelsTextsPos = []; + } + _createClass(Radar, [{ + key: "draw", + value: function draw(series) { + var _this = this; + var w = this.w; + var fill = new Fill(this.ctx); + var allSeries = []; + var dataLabels = new DataLabels(this.ctx); + if (series.length) { + this.dataPointsLen = series[w.globals.maxValsInArrayIndex].length; + } + this.disAngle = Math.PI * 2 / this.dataPointsLen; + var halfW = w.globals.gridWidth / 2; + var halfH = w.globals.gridHeight / 2; + var translateX = halfW + w.config.plotOptions.radar.offsetX; + var translateY = halfH + w.config.plotOptions.radar.offsetY; + var ret = this.graphics.group({ + class: 'apexcharts-radar-series apexcharts-plot-series', + transform: "translate(".concat(translateX || 0, ", ").concat(translateY || 0, ")") + }); + var dataPointsPos = []; + var elPointsMain = null; + var elDataPointsMain = null; + this.yaxisLabels = this.graphics.group({ + class: 'apexcharts-yaxis' + }); + series.forEach(function (s, i) { + var longestSeries = s.length === w.globals.dataPoints; + + // el to which series will be drawn + var elSeries = _this.graphics.group().attr({ + class: "apexcharts-series", + 'data:longestSeries': longestSeries, + seriesName: Utils$1.escapeString(w.globals.seriesNames[i]), + rel: i + 1, + 'data:realIndex': i + }); + _this.dataRadiusOfPercent[i] = []; + _this.dataRadius[i] = []; + _this.angleArr[i] = []; + s.forEach(function (dv, j) { + var range = Math.abs(_this.maxValue - _this.minValue); + dv = dv - _this.minValue; + if (_this.isLog) { + dv = _this.coreUtils.getLogVal(_this.logBase, dv, 0); + } + _this.dataRadiusOfPercent[i][j] = dv / range; + _this.dataRadius[i][j] = _this.dataRadiusOfPercent[i][j] * _this.size; + _this.angleArr[i][j] = j * _this.disAngle; + }); + dataPointsPos = _this.getDataPointsPos(_this.dataRadius[i], _this.angleArr[i]); + var paths = _this.createPaths(dataPointsPos, { + x: 0, + y: 0 + }); + + // points + elPointsMain = _this.graphics.group({ + class: 'apexcharts-series-markers-wrap apexcharts-element-hidden' + }); + + // datapoints + elDataPointsMain = _this.graphics.group({ + class: "apexcharts-datalabels", + 'data:realIndex': i + }); + w.globals.delayedElements.push({ + el: elPointsMain.node, + index: i + }); + var defaultRenderedPathOptions = { + i: i, + realIndex: i, + animationDelay: i, + initialSpeed: w.config.chart.animations.speed, + dataChangeSpeed: w.config.chart.animations.dynamicAnimation.speed, + className: "apexcharts-radar", + shouldClipToGrid: false, + bindEventsOnPaths: false, + stroke: w.globals.stroke.colors[i], + strokeLineCap: w.config.stroke.lineCap + }; + var pathFrom = null; + if (w.globals.previousPaths.length > 0) { + pathFrom = _this.getPreviousPath(i); + } + for (var p = 0; p < paths.linePathsTo.length; p++) { + var renderedLinePath = _this.graphics.renderPaths(_objectSpread2(_objectSpread2({}, defaultRenderedPathOptions), {}, { + pathFrom: pathFrom === null ? paths.linePathsFrom[p] : pathFrom, + pathTo: paths.linePathsTo[p], + strokeWidth: Array.isArray(_this.strokeWidth) ? _this.strokeWidth[i] : _this.strokeWidth, + fill: 'none', + drawShadow: false + })); + elSeries.add(renderedLinePath); + var pathFill = fill.fillPath({ + seriesNumber: i + }); + var renderedAreaPath = _this.graphics.renderPaths(_objectSpread2(_objectSpread2({}, defaultRenderedPathOptions), {}, { + pathFrom: pathFrom === null ? paths.areaPathsFrom[p] : pathFrom, + pathTo: paths.areaPathsTo[p], + strokeWidth: 0, + fill: pathFill, + drawShadow: false + })); + if (w.config.chart.dropShadow.enabled) { + var filters = new Filters(_this.ctx); + var shadow = w.config.chart.dropShadow; + filters.dropShadow(renderedAreaPath, Object.assign({}, shadow, { + noUserSpaceOnUse: true + }), i); + } + elSeries.add(renderedAreaPath); + } + s.forEach(function (sj, j) { + var markers = new Markers(_this.ctx); + var opts = markers.getMarkerConfig({ + cssClass: 'apexcharts-marker', + seriesIndex: i, + dataPointIndex: j + }); + var point = _this.graphics.drawMarker(dataPointsPos[j].x, dataPointsPos[j].y, opts); + point.attr('rel', j); + point.attr('j', j); + point.attr('index', i); + point.node.setAttribute('default-marker-size', opts.pSize); + var elPointsWrap = _this.graphics.group({ + class: 'apexcharts-series-markers' + }); + if (elPointsWrap) { + elPointsWrap.add(point); + } + elPointsMain.add(elPointsWrap); + elSeries.add(elPointsMain); + var dataLabelsConfig = w.config.dataLabels; + if (dataLabelsConfig.enabled) { + var text = dataLabelsConfig.formatter(w.globals.series[i][j], { + seriesIndex: i, + dataPointIndex: j, + w: w + }); + dataLabels.plotDataLabelsText({ + x: dataPointsPos[j].x, + y: dataPointsPos[j].y, + text: text, + textAnchor: 'middle', + i: i, + j: i, + parent: elDataPointsMain, + offsetCorrection: false, + dataLabelsConfig: _objectSpread2({}, dataLabelsConfig) + }); + } + elSeries.add(elDataPointsMain); + }); + allSeries.push(elSeries); + }); + this.drawPolygons({ + parent: ret + }); + if (w.config.xaxis.labels.show) { + var xaxisTexts = this.drawXAxisTexts(); + ret.add(xaxisTexts); + } + allSeries.forEach(function (elS) { + ret.add(elS); + }); + ret.add(this.yaxisLabels); + return ret; + } + }, { + key: "drawPolygons", + value: function drawPolygons(opts) { + var _this2 = this; + var w = this.w; + var parent = opts.parent; + var helpers = new CircularChartsHelpers(this.ctx); + var yaxisTexts = w.globals.yAxisScale[0].result.reverse(); + var layers = yaxisTexts.length; + var radiusSizes = []; + var layerDis = this.size / (layers - 1); + for (var i = 0; i < layers; i++) { + radiusSizes[i] = layerDis * i; + } + radiusSizes.reverse(); + var polygonStrings = []; + var lines = []; + radiusSizes.forEach(function (radiusSize, r) { + var polygon = Utils$1.getPolygonPos(radiusSize, _this2.dataPointsLen); + var string = ''; + polygon.forEach(function (p, i) { + if (r === 0) { + var line = _this2.graphics.drawLine(p.x, p.y, 0, 0, Array.isArray(_this2.polygons.connectorColors) ? _this2.polygons.connectorColors[i] : _this2.polygons.connectorColors); + lines.push(line); + } + if (i === 0) { + _this2.yaxisLabelsTextsPos.push({ + x: p.x, + y: p.y + }); + } + string += p.x + ',' + p.y + ' '; + }); + polygonStrings.push(string); + }); + polygonStrings.forEach(function (p, i) { + var strokeColors = _this2.polygons.strokeColors; + var strokeWidth = _this2.polygons.strokeWidth; + var polygon = _this2.graphics.drawPolygon(p, Array.isArray(strokeColors) ? strokeColors[i] : strokeColors, Array.isArray(strokeWidth) ? strokeWidth[i] : strokeWidth, w.globals.radarPolygons.fill.colors[i]); + parent.add(polygon); + }); + lines.forEach(function (l) { + parent.add(l); + }); + if (w.config.yaxis[0].show) { + this.yaxisLabelsTextsPos.forEach(function (p, i) { + var yText = helpers.drawYAxisTexts(p.x, p.y, i, yaxisTexts[i]); + _this2.yaxisLabels.add(yText); + }); + } + } + }, { + key: "drawXAxisTexts", + value: function drawXAxisTexts() { + var _this3 = this; + var w = this.w; + var xaxisLabelsConfig = w.config.xaxis.labels; + var elXAxisWrap = this.graphics.group({ + class: 'apexcharts-xaxis' + }); + var polygonPos = Utils$1.getPolygonPos(this.size, this.dataPointsLen); + w.globals.labels.forEach(function (label, i) { + var formatter = w.config.xaxis.labels.formatter; + var dataLabels = new DataLabels(_this3.ctx); + if (polygonPos[i]) { + var textPos = _this3.getTextPos(polygonPos[i], _this3.size); + var text = formatter(label, { + seriesIndex: -1, + dataPointIndex: i, + w: w + }); + var dataLabelText = dataLabels.plotDataLabelsText({ + x: textPos.newX, + y: textPos.newY, + text: text, + textAnchor: textPos.textAnchor, + i: i, + j: i, + parent: elXAxisWrap, + className: 'apexcharts-xaxis-label', + color: Array.isArray(xaxisLabelsConfig.style.colors) && xaxisLabelsConfig.style.colors[i] ? xaxisLabelsConfig.style.colors[i] : '#a8a8a8', + dataLabelsConfig: _objectSpread2({ + textAnchor: textPos.textAnchor, + dropShadow: { + enabled: false + } + }, xaxisLabelsConfig), + offsetCorrection: false + }); + dataLabelText.on('click', function (e) { + if (typeof w.config.chart.events.xAxisLabelClick === 'function') { + var opts = Object.assign({}, w, { + labelIndex: i + }); + w.config.chart.events.xAxisLabelClick(e, _this3.ctx, opts); + } + }); + } + }); + return elXAxisWrap; + } + }, { + key: "createPaths", + value: function createPaths(pos, origin) { + var _this4 = this; + var linePathsTo = []; + var linePathsFrom = []; + var areaPathsTo = []; + var areaPathsFrom = []; + if (pos.length) { + linePathsFrom = [this.graphics.move(origin.x, origin.y)]; + areaPathsFrom = [this.graphics.move(origin.x, origin.y)]; + var linePathTo = this.graphics.move(pos[0].x, pos[0].y); + var areaPathTo = this.graphics.move(pos[0].x, pos[0].y); + pos.forEach(function (p, i) { + linePathTo += _this4.graphics.line(p.x, p.y); + areaPathTo += _this4.graphics.line(p.x, p.y); + if (i === pos.length - 1) { + linePathTo += 'Z'; + areaPathTo += 'Z'; + } + }); + linePathsTo.push(linePathTo); + areaPathsTo.push(areaPathTo); + } + return { + linePathsFrom: linePathsFrom, + linePathsTo: linePathsTo, + areaPathsFrom: areaPathsFrom, + areaPathsTo: areaPathsTo + }; + } + }, { + key: "getTextPos", + value: function getTextPos(pos, polygonSize) { + var limit = 10; + var textAnchor = 'middle'; + var newX = pos.x; + var newY = pos.y; + if (Math.abs(pos.x) >= limit) { + if (pos.x > 0) { + textAnchor = 'start'; + newX += 10; + } else if (pos.x < 0) { + textAnchor = 'end'; + newX -= 10; + } + } else { + textAnchor = 'middle'; + } + if (Math.abs(pos.y) >= polygonSize - limit) { + if (pos.y < 0) { + newY -= 10; + } else if (pos.y > 0) { + newY += 10; + } + } + return { + textAnchor: textAnchor, + newX: newX, + newY: newY + }; + } + }, { + key: "getPreviousPath", + value: function getPreviousPath(realIndex) { + var w = this.w; + var pathFrom = null; + for (var pp = 0; pp < w.globals.previousPaths.length; pp++) { + var gpp = w.globals.previousPaths[pp]; + if (gpp.paths.length > 0 && parseInt(gpp.realIndex, 10) === parseInt(realIndex, 10)) { + if (typeof w.globals.previousPaths[pp].paths[0] !== 'undefined') { + pathFrom = w.globals.previousPaths[pp].paths[0].d; + } + } + } + return pathFrom; + } + }, { + key: "getDataPointsPos", + value: function getDataPointsPos(dataRadiusArr, angleArr) { + var dataPointsLen = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.dataPointsLen; + dataRadiusArr = dataRadiusArr || []; + angleArr = angleArr || []; + var dataPointsPosArray = []; + for (var j = 0; j < dataPointsLen; j++) { + var curPointPos = {}; + curPointPos.x = dataRadiusArr[j] * Math.sin(angleArr[j]); + curPointPos.y = -dataRadiusArr[j] * Math.cos(angleArr[j]); + dataPointsPosArray.push(curPointPos); + } + return dataPointsPosArray; + } + }]); + return Radar; + }(); + + /** + * ApexCharts Radial Class for drawing Circle / Semi Circle Charts. + * @module Radial + **/ + var Radial = /*#__PURE__*/function (_Pie) { + _inherits(Radial, _Pie); + var _super = _createSuper(Radial); + function Radial(ctx) { + var _this; + _classCallCheck(this, Radial); + _this = _super.call(this, ctx); + _this.ctx = ctx; + _this.w = ctx.w; + _this.animBeginArr = [0]; + _this.animDur = 0; + var w = _this.w; + _this.startAngle = w.config.plotOptions.radialBar.startAngle; + _this.endAngle = w.config.plotOptions.radialBar.endAngle; + _this.totalAngle = Math.abs(w.config.plotOptions.radialBar.endAngle - w.config.plotOptions.radialBar.startAngle); + _this.trackStartAngle = w.config.plotOptions.radialBar.track.startAngle; + _this.trackEndAngle = w.config.plotOptions.radialBar.track.endAngle; + _this.barLabels = _this.w.config.plotOptions.radialBar.barLabels; + _this.donutDataLabels = _this.w.config.plotOptions.radialBar.dataLabels; + _this.radialDataLabels = _this.donutDataLabels; // make a copy for easy reference + + if (!_this.trackStartAngle) _this.trackStartAngle = _this.startAngle; + if (!_this.trackEndAngle) _this.trackEndAngle = _this.endAngle; + if (_this.endAngle === 360) _this.endAngle = 359.99; + _this.margin = parseInt(w.config.plotOptions.radialBar.track.margin, 10); + _this.onBarLabelClick = _this.onBarLabelClick.bind(_assertThisInitialized(_this)); + return _this; + } + _createClass(Radial, [{ + key: "draw", + value: function draw(series) { + var w = this.w; + var graphics = new Graphics(this.ctx); + var ret = graphics.group({ + class: 'apexcharts-radialbar' + }); + if (w.globals.noData) return ret; + var elSeries = graphics.group(); + var centerY = this.defaultSize / 2; + var centerX = w.globals.gridWidth / 2; + var size = this.defaultSize / 2.05; + if (!w.config.chart.sparkline.enabled) { + size = size - w.config.stroke.width - w.config.chart.dropShadow.blur; + } + var colorArr = w.globals.fill.colors; + if (w.config.plotOptions.radialBar.track.show) { + var elTracks = this.drawTracks({ + size: size, + centerX: centerX, + centerY: centerY, + colorArr: colorArr, + series: series + }); + elSeries.add(elTracks); + } + var elG = this.drawArcs({ + size: size, + centerX: centerX, + centerY: centerY, + colorArr: colorArr, + series: series + }); + var totalAngle = 360; + if (w.config.plotOptions.radialBar.startAngle < 0) { + totalAngle = this.totalAngle; + } + var angleRatio = (360 - totalAngle) / 360; + w.globals.radialSize = size - size * angleRatio; + if (this.radialDataLabels.value.show) { + var offset = Math.max(this.radialDataLabels.value.offsetY, this.radialDataLabels.name.offsetY); + w.globals.radialSize += offset * angleRatio; + } + elSeries.add(elG.g); + if (w.config.plotOptions.radialBar.hollow.position === 'front') { + elG.g.add(elG.elHollow); + if (elG.dataLabels) { + elG.g.add(elG.dataLabels); + } + } + ret.add(elSeries); + return ret; + } + }, { + key: "drawTracks", + value: function drawTracks(opts) { + var w = this.w; + var graphics = new Graphics(this.ctx); + var g = graphics.group({ + class: 'apexcharts-tracks' + }); + var filters = new Filters(this.ctx); + var fill = new Fill(this.ctx); + var strokeWidth = this.getStrokeWidth(opts); + opts.size = opts.size - strokeWidth / 2; + for (var i = 0; i < opts.series.length; i++) { + var elRadialBarTrack = graphics.group({ + class: 'apexcharts-radialbar-track apexcharts-track' + }); + g.add(elRadialBarTrack); + elRadialBarTrack.attr({ + rel: i + 1 + }); + opts.size = opts.size - strokeWidth - this.margin; + var trackConfig = w.config.plotOptions.radialBar.track; + var pathFill = fill.fillPath({ + seriesNumber: 0, + size: opts.size, + fillColors: Array.isArray(trackConfig.background) ? trackConfig.background[i] : trackConfig.background, + solid: true + }); + var startAngle = this.trackStartAngle; + var endAngle = this.trackEndAngle; + if (Math.abs(endAngle) + Math.abs(startAngle) >= 360) endAngle = 360 - Math.abs(this.startAngle) - 0.1; + var elPath = graphics.drawPath({ + d: '', + stroke: pathFill, + strokeWidth: strokeWidth * parseInt(trackConfig.strokeWidth, 10) / 100, + fill: 'none', + strokeOpacity: trackConfig.opacity, + classes: 'apexcharts-radialbar-area' + }); + if (trackConfig.dropShadow.enabled) { + var shadow = trackConfig.dropShadow; + filters.dropShadow(elPath, shadow); + } + elRadialBarTrack.add(elPath); + elPath.attr('id', 'apexcharts-radialbarTrack-' + i); + this.animatePaths(elPath, { + centerX: opts.centerX, + centerY: opts.centerY, + endAngle: endAngle, + startAngle: startAngle, + size: opts.size, + i: i, + totalItems: 2, + animBeginArr: 0, + dur: 0, + isTrack: true + }); + } + return g; + } + }, { + key: "drawArcs", + value: function drawArcs(opts) { + var w = this.w; + // size, donutSize, centerX, centerY, colorArr, lineColorArr, sectorAngleArr, series + + var graphics = new Graphics(this.ctx); + var fill = new Fill(this.ctx); + var filters = new Filters(this.ctx); + var g = graphics.group(); + var strokeWidth = this.getStrokeWidth(opts); + opts.size = opts.size - strokeWidth / 2; + var hollowFillID = w.config.plotOptions.radialBar.hollow.background; + var hollowSize = opts.size - strokeWidth * opts.series.length - this.margin * opts.series.length - strokeWidth * parseInt(w.config.plotOptions.radialBar.track.strokeWidth, 10) / 100 / 2; + var hollowRadius = hollowSize - w.config.plotOptions.radialBar.hollow.margin; + if (w.config.plotOptions.radialBar.hollow.image !== undefined) { + hollowFillID = this.drawHollowImage(opts, g, hollowSize, hollowFillID); + } + var elHollow = this.drawHollow({ + size: hollowRadius, + centerX: opts.centerX, + centerY: opts.centerY, + fill: hollowFillID ? hollowFillID : 'transparent' + }); + if (w.config.plotOptions.radialBar.hollow.dropShadow.enabled) { + var shadow = w.config.plotOptions.radialBar.hollow.dropShadow; + filters.dropShadow(elHollow, shadow); + } + var shown = 1; + if (!this.radialDataLabels.total.show && w.globals.series.length > 1) { + shown = 0; + } + var dataLabels = null; + if (this.radialDataLabels.show) { + var dataLabelsGroup = w.globals.dom.Paper.findOne(".apexcharts-datalabels-group"); + dataLabels = this.renderInnerDataLabels(dataLabelsGroup, this.radialDataLabels, { + hollowSize: hollowSize, + centerX: opts.centerX, + centerY: opts.centerY, + opacity: shown + }); + } + if (w.config.plotOptions.radialBar.hollow.position === 'back') { + g.add(elHollow); + if (dataLabels) { + g.add(dataLabels); + } + } + var reverseLoop = false; + if (w.config.plotOptions.radialBar.inverseOrder) { + reverseLoop = true; + } + for (var i = reverseLoop ? opts.series.length - 1 : 0; reverseLoop ? i >= 0 : i < opts.series.length; reverseLoop ? i-- : i++) { + var elRadialBarArc = graphics.group({ + class: "apexcharts-series apexcharts-radial-series", + seriesName: Utils$1.escapeString(w.globals.seriesNames[i]) + }); + g.add(elRadialBarArc); + elRadialBarArc.attr({ + rel: i + 1, + 'data:realIndex': i + }); + this.ctx.series.addCollapsedClassToSeries(elRadialBarArc, i); + opts.size = opts.size - strokeWidth - this.margin; + var pathFill = fill.fillPath({ + seriesNumber: i, + size: opts.size, + value: opts.series[i] + }); + var startAngle = this.startAngle; + var prevStartAngle = void 0; + + // if data exceeds 100, make it 100 + var dataValue = Utils$1.negToZero(opts.series[i] > 100 ? 100 : opts.series[i]) / 100; + var endAngle = Math.round(this.totalAngle * dataValue) + this.startAngle; + var prevEndAngle = void 0; + if (w.globals.dataChanged) { + prevStartAngle = this.startAngle; + prevEndAngle = Math.round(this.totalAngle * Utils$1.negToZero(w.globals.previousPaths[i]) / 100) + prevStartAngle; + } + var currFullAngle = Math.abs(endAngle) + Math.abs(startAngle); + if (currFullAngle > 360) { + endAngle = endAngle - 0.01; + } + var prevFullAngle = Math.abs(prevEndAngle) + Math.abs(prevStartAngle); + if (prevFullAngle > 360) { + prevEndAngle = prevEndAngle - 0.01; + } + var angle = endAngle - startAngle; + var dashArray = Array.isArray(w.config.stroke.dashArray) ? w.config.stroke.dashArray[i] : w.config.stroke.dashArray; + var elPath = graphics.drawPath({ + d: '', + stroke: pathFill, + strokeWidth: strokeWidth, + fill: 'none', + fillOpacity: w.config.fill.opacity, + classes: 'apexcharts-radialbar-area apexcharts-radialbar-slice-' + i, + strokeDashArray: dashArray + }); + Graphics.setAttrs(elPath.node, { + 'data:angle': angle, + 'data:value': opts.series[i] + }); + if (w.config.chart.dropShadow.enabled) { + var _shadow = w.config.chart.dropShadow; + filters.dropShadow(elPath, _shadow, i); + } + filters.setSelectionFilter(elPath, 0, i); + this.addListeners(elPath, this.radialDataLabels); + elRadialBarArc.add(elPath); + elPath.attr({ + index: 0, + j: i + }); + if (this.barLabels.enabled) { + var barStartCords = Utils$1.polarToCartesian(opts.centerX, opts.centerY, opts.size, startAngle); + var text = this.barLabels.formatter(w.globals.seriesNames[i], { + seriesIndex: i, + w: w + }); + var classes = ['apexcharts-radialbar-label']; + if (!this.barLabels.onClick) { + classes.push('apexcharts-no-click'); + } + var textColor = this.barLabels.useSeriesColors ? w.globals.colors[i] : w.config.chart.foreColor; + if (!textColor) { + textColor = w.config.chart.foreColor; + } + var x = barStartCords.x + this.barLabels.offsetX; + var y = barStartCords.y + this.barLabels.offsetY; + var elText = graphics.drawText({ + x: x, + y: y, + text: text, + textAnchor: 'end', + dominantBaseline: 'middle', + fontFamily: this.barLabels.fontFamily, + fontWeight: this.barLabels.fontWeight, + fontSize: this.barLabels.fontSize, + foreColor: textColor, + cssClass: classes.join(' ') + }); + elText.on('click', this.onBarLabelClick); + elText.attr({ + rel: i + 1 + }); + if (startAngle !== 0) { + elText.attr({ + 'transform-origin': "".concat(x, " ").concat(y), + transform: "rotate(".concat(startAngle, " 0 0)") + }); + } + elRadialBarArc.add(elText); + } + var dur = 0; + if (this.initialAnim && !w.globals.resized && !w.globals.dataChanged) { + dur = w.config.chart.animations.speed; + } + if (w.globals.dataChanged) { + dur = w.config.chart.animations.dynamicAnimation.speed; + } + this.animDur = dur / (opts.series.length * 1.2) + this.animDur; + this.animBeginArr.push(this.animDur); + this.animatePaths(elPath, { + centerX: opts.centerX, + centerY: opts.centerY, + endAngle: endAngle, + startAngle: startAngle, + prevEndAngle: prevEndAngle, + prevStartAngle: prevStartAngle, + size: opts.size, + i: i, + totalItems: 2, + animBeginArr: this.animBeginArr, + dur: dur, + shouldSetPrevPaths: true + }); + } + return { + g: g, + elHollow: elHollow, + dataLabels: dataLabels + }; + } + }, { + key: "drawHollow", + value: function drawHollow(opts) { + var graphics = new Graphics(this.ctx); + var circle = graphics.drawCircle(opts.size * 2); + circle.attr({ + class: 'apexcharts-radialbar-hollow', + cx: opts.centerX, + cy: opts.centerY, + r: opts.size, + fill: opts.fill + }); + return circle; + } + }, { + key: "drawHollowImage", + value: function drawHollowImage(opts, g, hollowSize, hollowFillID) { + var w = this.w; + var fill = new Fill(this.ctx); + var randID = Utils$1.randomId(); + var hollowFillImg = w.config.plotOptions.radialBar.hollow.image; + if (w.config.plotOptions.radialBar.hollow.imageClipped) { + fill.clippedImgArea({ + width: hollowSize, + height: hollowSize, + image: hollowFillImg, + patternID: "pattern".concat(w.globals.cuid).concat(randID) + }); + hollowFillID = "url(#pattern".concat(w.globals.cuid).concat(randID, ")"); + } else { + var imgWidth = w.config.plotOptions.radialBar.hollow.imageWidth; + var imgHeight = w.config.plotOptions.radialBar.hollow.imageHeight; + if (imgWidth === undefined && imgHeight === undefined) { + var image = w.globals.dom.Paper.image(hollowFillImg, function (loader) { + this.move(opts.centerX - loader.width / 2 + w.config.plotOptions.radialBar.hollow.imageOffsetX, opts.centerY - loader.height / 2 + w.config.plotOptions.radialBar.hollow.imageOffsetY); + }); + g.add(image); + } else { + var _image = w.globals.dom.Paper.image(hollowFillImg, function (loader) { + this.move(opts.centerX - imgWidth / 2 + w.config.plotOptions.radialBar.hollow.imageOffsetX, opts.centerY - imgHeight / 2 + w.config.plotOptions.radialBar.hollow.imageOffsetY); + this.size(imgWidth, imgHeight); + }); + g.add(_image); + } + } + return hollowFillID; + } + }, { + key: "getStrokeWidth", + value: function getStrokeWidth(opts) { + var w = this.w; + return opts.size * (100 - parseInt(w.config.plotOptions.radialBar.hollow.size, 10)) / 100 / (opts.series.length + 1) - this.margin; + } + }, { + key: "onBarLabelClick", + value: function onBarLabelClick(e) { + var seriesIndex = parseInt(e.target.getAttribute('rel'), 10) - 1; + var legendClick = this.barLabels.onClick; + var w = this.w; + if (legendClick) { + legendClick(w.globals.seriesNames[seriesIndex], { + w: w, + seriesIndex: seriesIndex + }); + } + } + }]); + return Radial; + }(Pie); + + /** + * ApexCharts RangeBar Class responsible for drawing Range/Timeline Bars. + * + * @module RangeBar + **/ + var RangeBar = /*#__PURE__*/function (_Bar) { + _inherits(RangeBar, _Bar); + var _super = _createSuper(RangeBar); + function RangeBar() { + _classCallCheck(this, RangeBar); + return _super.apply(this, arguments); + } + _createClass(RangeBar, [{ + key: "draw", + value: function draw(series, seriesIndex) { + var w = this.w; + var graphics = new Graphics(this.ctx); + this.rangeBarOptions = this.w.config.plotOptions.rangeBar; + this.series = series; + this.seriesRangeStart = w.globals.seriesRangeStart; + this.seriesRangeEnd = w.globals.seriesRangeEnd; + this.barHelpers.initVariables(series); + var ret = graphics.group({ + class: 'apexcharts-rangebar-series apexcharts-plot-series' + }); + for (var i = 0; i < series.length; i++) { + var x = void 0, + y = void 0, + xDivision = void 0, + // xDivision is the GRIDWIDTH divided by number of datapoints (columns) + yDivision = void 0, + // yDivision is the GRIDHEIGHT divided by number of datapoints (bars) + zeroH = void 0, + // zeroH is the baseline where 0 meets y axis + zeroW = void 0; // zeroW is the baseline where 0 meets x axis + + var realIndex = w.globals.comboCharts ? seriesIndex[i] : i; + var _this$barHelpers$getG = this.barHelpers.getGroupIndex(realIndex), + columnGroupIndex = _this$barHelpers$getG.columnGroupIndex; + + // el to which series will be drawn + var elSeries = graphics.group({ + class: "apexcharts-series", + seriesName: Utils$1.escapeString(w.globals.seriesNames[realIndex]), + rel: i + 1, + 'data:realIndex': realIndex + }); + this.ctx.series.addCollapsedClassToSeries(elSeries, realIndex); + if (series[i].length > 0) { + this.visibleI = this.visibleI + 1; + } + var barHeight = 0; + var barWidth = 0; + var translationsIndex = 0; + if (this.yRatio.length > 1) { + this.yaxisIndex = w.globals.seriesYAxisReverseMap[realIndex][0]; + translationsIndex = realIndex; + } + var initPositions = this.barHelpers.initialPositions(realIndex); + y = initPositions.y; + zeroW = initPositions.zeroW; + x = initPositions.x; + barWidth = initPositions.barWidth; + barHeight = initPositions.barHeight; + xDivision = initPositions.xDivision; + yDivision = initPositions.yDivision; + zeroH = initPositions.zeroH; + + // eldatalabels + var elDataLabelsWrap = graphics.group({ + class: 'apexcharts-datalabels', + 'data:realIndex': realIndex + }); + var elGoalsMarkers = graphics.group({ + class: 'apexcharts-rangebar-goals-markers' + }); + for (var j = 0; j < w.globals.dataPoints; j++) { + var strokeWidth = this.barHelpers.getStrokeWidth(i, j, realIndex); + var y1 = this.seriesRangeStart[i][j]; + var y2 = this.seriesRangeEnd[i][j]; + var paths = null; + var barXPosition = null; + var barYPosition = null; + var params = { + x: x, + y: y, + strokeWidth: strokeWidth, + elSeries: elSeries + }; + var seriesLen = this.seriesLen; + if (w.config.plotOptions.bar.rangeBarGroupRows) { + seriesLen = 1; + } + if (typeof w.config.series[i].data[j] === 'undefined') { + // no data exists for further indexes, hence we need to get out the innr loop. + // As we are iterating over total datapoints, there is a possiblity the series might not have data for j index + break; + } + if (this.isHorizontal) { + barYPosition = y + barHeight * this.visibleI; + var srty = (yDivision - barHeight * seriesLen) / 2; + if (w.config.series[i].data[j].x) { + var positions = this.detectOverlappingBars({ + i: i, + j: j, + barYPosition: barYPosition, + srty: srty, + barHeight: barHeight, + yDivision: yDivision, + initPositions: initPositions + }); + barHeight = positions.barHeight; + barYPosition = positions.barYPosition; + } + paths = this.drawRangeBarPaths(_objectSpread2({ + indexes: { + i: i, + j: j, + realIndex: realIndex + }, + barHeight: barHeight, + barYPosition: barYPosition, + zeroW: zeroW, + yDivision: yDivision, + y1: y1, + y2: y2 + }, params)); + barWidth = paths.barWidth; + } else { + if (w.globals.isXNumeric) { + x = (w.globals.seriesX[i][j] - w.globals.minX) / this.xRatio - barWidth / 2; + } + barXPosition = x + barWidth * this.visibleI; + var srtx = (xDivision - barWidth * seriesLen) / 2; + if (w.config.series[i].data[j].x) { + var _positions = this.detectOverlappingBars({ + i: i, + j: j, + barXPosition: barXPosition, + srtx: srtx, + barWidth: barWidth, + xDivision: xDivision, + initPositions: initPositions + }); + barWidth = _positions.barWidth; + barXPosition = _positions.barXPosition; + } + paths = this.drawRangeColumnPaths(_objectSpread2({ + indexes: { + i: i, + j: j, + realIndex: realIndex, + translationsIndex: translationsIndex + }, + barWidth: barWidth, + barXPosition: barXPosition, + zeroH: zeroH, + xDivision: xDivision + }, params)); + barHeight = paths.barHeight; + } + var barGoalLine = this.barHelpers.drawGoalLine({ + barXPosition: paths.barXPosition, + barYPosition: barYPosition, + goalX: paths.goalX, + goalY: paths.goalY, + barHeight: barHeight, + barWidth: barWidth + }); + if (barGoalLine) { + elGoalsMarkers.add(barGoalLine); + } + y = paths.y; + x = paths.x; + var pathFill = this.barHelpers.getPathFillColor(series, i, j, realIndex); + this.renderSeries({ + realIndex: realIndex, + pathFill: pathFill.color, + lineFill: pathFill.useRangeColor ? pathFill.color : w.globals.stroke.colors[realIndex], + j: j, + i: i, + x: x, + y: y, + y1: y1, + y2: y2, + pathFrom: paths.pathFrom, + pathTo: paths.pathTo, + strokeWidth: strokeWidth, + elSeries: elSeries, + series: series, + barHeight: barHeight, + barWidth: barWidth, + barXPosition: barXPosition, + barYPosition: barYPosition, + columnGroupIndex: columnGroupIndex, + elDataLabelsWrap: elDataLabelsWrap, + elGoalsMarkers: elGoalsMarkers, + visibleSeries: this.visibleI, + type: 'rangebar' + }); + } + ret.add(elSeries); + } + return ret; + } + }, { + key: "detectOverlappingBars", + value: function detectOverlappingBars(_ref) { + var i = _ref.i, + j = _ref.j, + barYPosition = _ref.barYPosition, + barXPosition = _ref.barXPosition, + srty = _ref.srty, + srtx = _ref.srtx, + barHeight = _ref.barHeight, + barWidth = _ref.barWidth, + yDivision = _ref.yDivision, + xDivision = _ref.xDivision, + initPositions = _ref.initPositions; + var w = this.w; + var overlaps = []; + var rangeName = w.config.series[i].data[j].rangeName; + var x = w.config.series[i].data[j].x; + var labelX = Array.isArray(x) ? x.join(' ') : x; + var rowIndex = w.globals.labels.map(function (_) { + return Array.isArray(_) ? _.join(' ') : _; + }).indexOf(labelX); + var overlappedIndex = w.globals.seriesRange[i].findIndex(function (tx) { + return tx.x === labelX && tx.overlaps.length > 0; + }); + if (this.isHorizontal) { + if (w.config.plotOptions.bar.rangeBarGroupRows) { + barYPosition = srty + yDivision * rowIndex; + } else { + barYPosition = srty + barHeight * this.visibleI + yDivision * rowIndex; + } + if (overlappedIndex > -1 && !w.config.plotOptions.bar.rangeBarOverlap) { + overlaps = w.globals.seriesRange[i][overlappedIndex].overlaps; + if (overlaps.indexOf(rangeName) > -1) { + barHeight = initPositions.barHeight / overlaps.length; + barYPosition = barHeight * this.visibleI + yDivision * (100 - parseInt(this.barOptions.barHeight, 10)) / 100 / 2 + barHeight * (this.visibleI + overlaps.indexOf(rangeName)) + yDivision * rowIndex; + } + } + } else { + if (rowIndex > -1 && !w.globals.timescaleLabels.length) { + if (w.config.plotOptions.bar.rangeBarGroupRows) { + barXPosition = srtx + xDivision * rowIndex; + } else { + barXPosition = srtx + barWidth * this.visibleI + xDivision * rowIndex; + } + } + if (overlappedIndex > -1 && !w.config.plotOptions.bar.rangeBarOverlap) { + overlaps = w.globals.seriesRange[i][overlappedIndex].overlaps; + if (overlaps.indexOf(rangeName) > -1) { + barWidth = initPositions.barWidth / overlaps.length; + barXPosition = barWidth * this.visibleI + xDivision * (100 - parseInt(this.barOptions.barWidth, 10)) / 100 / 2 + barWidth * (this.visibleI + overlaps.indexOf(rangeName)) + xDivision * rowIndex; + } + } + } + return { + barYPosition: barYPosition, + barXPosition: barXPosition, + barHeight: barHeight, + barWidth: barWidth + }; + } + }, { + key: "drawRangeColumnPaths", + value: function drawRangeColumnPaths(_ref2) { + var indexes = _ref2.indexes, + x = _ref2.x, + xDivision = _ref2.xDivision, + barWidth = _ref2.barWidth, + barXPosition = _ref2.barXPosition, + zeroH = _ref2.zeroH; + var w = this.w; + var i = indexes.i, + j = indexes.j, + realIndex = indexes.realIndex, + translationsIndex = indexes.translationsIndex; + var yRatio = this.yRatio[translationsIndex]; + var range = this.getRangeValue(realIndex, j); + var y1 = Math.min(range.start, range.end); + var y2 = Math.max(range.start, range.end); + if (typeof this.series[i][j] === 'undefined' || this.series[i][j] === null) { + y1 = zeroH; + } else { + y1 = zeroH - y1 / yRatio; + y2 = zeroH - y2 / yRatio; + } + var barHeight = Math.abs(y2 - y1); + var paths = this.barHelpers.getColumnPaths({ + barXPosition: barXPosition, + barWidth: barWidth, + y1: y1, + y2: y2, + strokeWidth: this.strokeWidth, + series: this.seriesRangeEnd, + realIndex: realIndex, + i: realIndex, + j: j, + w: w + }); + if (!w.globals.isXNumeric) { + x = x + xDivision; + } else { + var xForNumericXAxis = this.getBarXForNumericXAxis({ + x: x, + j: j, + realIndex: realIndex, + barWidth: barWidth + }); + x = xForNumericXAxis.x; + barXPosition = xForNumericXAxis.barXPosition; + } + return { + pathTo: paths.pathTo, + pathFrom: paths.pathFrom, + barHeight: barHeight, + x: x, + y: range.start < 0 && range.end < 0 ? y1 : y2, + goalY: this.barHelpers.getGoalValues('y', null, zeroH, i, j, translationsIndex), + barXPosition: barXPosition + }; + } + }, { + key: "preventBarOverflow", + value: function preventBarOverflow(val) { + var w = this.w; + if (val < 0) { + val = 0; + } + if (val > w.globals.gridWidth) { + val = w.globals.gridWidth; + } + return val; + } + }, { + key: "drawRangeBarPaths", + value: function drawRangeBarPaths(_ref3) { + var indexes = _ref3.indexes, + y = _ref3.y, + y1 = _ref3.y1, + y2 = _ref3.y2, + yDivision = _ref3.yDivision, + barHeight = _ref3.barHeight, + barYPosition = _ref3.barYPosition, + zeroW = _ref3.zeroW; + var w = this.w; + var realIndex = indexes.realIndex, + j = indexes.j; + var x1 = this.preventBarOverflow(zeroW + y1 / this.invertedYRatio); + var x2 = this.preventBarOverflow(zeroW + y2 / this.invertedYRatio); + var range = this.getRangeValue(realIndex, j); + var barWidth = Math.abs(x2 - x1); + var paths = this.barHelpers.getBarpaths({ + barYPosition: barYPosition, + barHeight: barHeight, + x1: x1, + x2: x2, + strokeWidth: this.strokeWidth, + series: this.seriesRangeEnd, + i: realIndex, + realIndex: realIndex, + j: j, + w: w + }); + if (!w.globals.isXNumeric) { + y = y + yDivision; + } + return { + pathTo: paths.pathTo, + pathFrom: paths.pathFrom, + barWidth: barWidth, + x: range.start < 0 && range.end < 0 ? x1 : x2, + goalX: this.barHelpers.getGoalValues('x', zeroW, null, realIndex, j), + y: y + }; + } + }, { + key: "getRangeValue", + value: function getRangeValue(i, j) { + var w = this.w; + return { + start: w.globals.seriesRangeStart[i][j], + end: w.globals.seriesRangeEnd[i][j] + }; + } + }]); + return RangeBar; + }(Bar); + + var Helpers = /*#__PURE__*/function () { + function Helpers(lineCtx) { + _classCallCheck(this, Helpers); + this.w = lineCtx.w; + this.lineCtx = lineCtx; + } + _createClass(Helpers, [{ + key: "sameValueSeriesFix", + value: function sameValueSeriesFix(i, series) { + var w = this.w; + if (w.config.fill.type === 'gradient' || w.config.fill.type[i] === 'gradient') { + var coreUtils = new CoreUtils(this.lineCtx.ctx, w); + + // applied only to LINE chart + // a small adjustment to allow gradient line to draw correctly for all same values + /* #fix https://github.com/apexcharts/apexcharts.js/issues/358 */ + if (coreUtils.seriesHaveSameValues(i)) { + var gSeries = series[i].slice(); + gSeries[gSeries.length - 1] = gSeries[gSeries.length - 1] + 0.000001; + series[i] = gSeries; + } + } + return series; + } + }, { + key: "calculatePoints", + value: function calculatePoints(_ref) { + var series = _ref.series, + realIndex = _ref.realIndex, + x = _ref.x, + y = _ref.y, + i = _ref.i, + j = _ref.j, + prevY = _ref.prevY; + var w = this.w; + var ptX = []; + var ptY = []; + var xPT1st = this.lineCtx.categoryAxisCorrection + w.config.markers.offsetX; + + // the first point for line series + // we need to check whether it's not a time series, because a time series may + // start from the middle of the x axis + if (w.globals.isXNumeric) { + xPT1st = (w.globals.seriesX[realIndex][0] - w.globals.minX) / this.lineCtx.xRatio + w.config.markers.offsetX; + } + + // push 2 points for the first data values + if (j === 0) { + ptX.push(xPT1st); + ptY.push(Utils$1.isNumber(series[i][0]) ? prevY + w.config.markers.offsetY : null); + } + ptX.push(x + w.config.markers.offsetX); + ptY.push(Utils$1.isNumber(series[i][j + 1]) ? y + w.config.markers.offsetY : null); + return { + x: ptX, + y: ptY + }; + } + }, { + key: "checkPreviousPaths", + value: function checkPreviousPaths(_ref2) { + var pathFromLine = _ref2.pathFromLine, + pathFromArea = _ref2.pathFromArea, + realIndex = _ref2.realIndex; + var w = this.w; + for (var pp = 0; pp < w.globals.previousPaths.length; pp++) { + var gpp = w.globals.previousPaths[pp]; + if ((gpp.type === 'line' || gpp.type === 'area') && gpp.paths.length > 0 && parseInt(gpp.realIndex, 10) === parseInt(realIndex, 10)) { + if (gpp.type === 'line') { + this.lineCtx.appendPathFrom = false; + pathFromLine = w.globals.previousPaths[pp].paths[0].d; + } else if (gpp.type === 'area') { + this.lineCtx.appendPathFrom = false; + pathFromArea = w.globals.previousPaths[pp].paths[0].d; + if (w.config.stroke.show && w.globals.previousPaths[pp].paths[1]) { + pathFromLine = w.globals.previousPaths[pp].paths[1].d; + } + } + } + } + return { + pathFromLine: pathFromLine, + pathFromArea: pathFromArea + }; + } + }, { + key: "determineFirstPrevY", + value: function determineFirstPrevY(_ref3) { + var _this$w$config$series, _this$w$config$series2, _series$i; + var i = _ref3.i, + realIndex = _ref3.realIndex, + series = _ref3.series, + prevY = _ref3.prevY, + lineYPosition = _ref3.lineYPosition, + translationsIndex = _ref3.translationsIndex; + var w = this.w; + var stackSeries = w.config.chart.stacked && !w.globals.comboCharts || w.config.chart.stacked && w.globals.comboCharts && (!this.w.config.chart.stackOnlyBar || ((_this$w$config$series = this.w.config.series[realIndex]) === null || _this$w$config$series === void 0 ? void 0 : _this$w$config$series.type) === 'bar' || ((_this$w$config$series2 = this.w.config.series[realIndex]) === null || _this$w$config$series2 === void 0 ? void 0 : _this$w$config$series2.type) === 'column'); + if (typeof ((_series$i = series[i]) === null || _series$i === void 0 ? void 0 : _series$i[0]) !== 'undefined') { + if (stackSeries) { + if (i > 0) { + // 1st y value of previous series + lineYPosition = this.lineCtx.prevSeriesY[i - 1][0]; + } else { + // the first series will not have prevY values + lineYPosition = this.lineCtx.zeroY; + } + } else { + lineYPosition = this.lineCtx.zeroY; + } + prevY = lineYPosition - series[i][0] / this.lineCtx.yRatio[translationsIndex] + (this.lineCtx.isReversed ? series[i][0] / this.lineCtx.yRatio[translationsIndex] : 0) * 2; + } else { + // the first value in the current series is null + if (stackSeries && i > 0 && typeof series[i][0] === 'undefined') { + // check for undefined value (undefined value will occur when we clear the series while user clicks on legend to hide serieses) + for (var s = i - 1; s >= 0; s--) { + // for loop to get to 1st previous value until we get it + if (series[s][0] !== null && typeof series[s][0] !== 'undefined') { + lineYPosition = this.lineCtx.prevSeriesY[s][0]; + prevY = lineYPosition; + break; + } + } + } + } + return { + prevY: prevY, + lineYPosition: lineYPosition + }; + } + }]); + return Helpers; + }(); + + /** + * + * @yr/monotone-cubic-spline (https://github.com/YR/monotone-cubic-spline) + * + * The MIT License (MIT) + * + * Copyright (c) 2015 yr.no + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + /** + * Generate tangents for 'points' + * @param {Array} points + * @returns {Array} + */ + var tangents = function tangents(points) { + var m = finiteDifferences(points); + var n = points.length - 1; + var ε = 1e-6; + var tgts = []; + var a, b, d, s; + for (var i = 0; i < n; i++) { + d = slope(points[i], points[i + 1]); + if (Math.abs(d) < ε) { + m[i] = m[i + 1] = 0; + } else { + a = m[i] / d; + b = m[i + 1] / d; + s = a * a + b * b; + if (s > 9) { + s = d * 3 / Math.sqrt(s); + m[i] = s * a; + m[i + 1] = s * b; + } + } + } + for (var _i = 0; _i <= n; _i++) { + s = (points[Math.min(n, _i + 1)][0] - points[Math.max(0, _i - 1)][0]) / (6 * (1 + m[_i] * m[_i])); + tgts.push([s || 0, m[_i] * s || 0]); + } + return tgts; + }; + + /** + * Convert 'points' to svg path + * @param {Array} points + * @returns {String} + */ + var svgPath = function svgPath(points) { + var p = ''; + for (var i = 0; i < points.length; i++) { + var point = points[i]; + var n = point.length; + if (n > 4) { + p += "C".concat(point[0], ", ").concat(point[1]); + p += ", ".concat(point[2], ", ").concat(point[3]); + p += ", ".concat(point[4], ", ").concat(point[5]); + } else if (n > 2) { + p += "S".concat(point[0], ", ").concat(point[1]); + p += ", ".concat(point[2], ", ").concat(point[3]); + } + } + return p; + }; + var spline = { + /** + * Convert 'points' to bezier + * @param {Array} points + * @returns {Array} + */ + points: function points(_points) { + var tgts = tangents(_points); + var p = _points[1]; + var p0 = _points[0]; + var pts = []; + var t = tgts[1]; + var t0 = tgts[0]; + + // Add starting 'M' and 'C' points + pts.push(p0, [p0[0] + t0[0], p0[1] + t0[1], p[0] - t[0], p[1] - t[1], p[0], p[1]]); + + // Add 'S' points + for (var i = 2, n = tgts.length; i < n; i++) { + var _p = _points[i]; + var _t = tgts[i]; + pts.push([_p[0] - _t[0], _p[1] - _t[1], _p[0], _p[1]]); + } + return pts; + }, + /** + * Slice out a segment of 'points' + * @param {Array} points + * @param {Number} start + * @param {Number} end + * @returns {Array} + */ + slice: function slice(points, start, end) { + var pts = points.slice(start, end); + if (start) { + // Add additional 'C' points + if (end - start > 1 && pts[1].length < 6) { + var n = pts[0].length; + pts[1] = [pts[0][n - 2] * 2 - pts[0][n - 4], pts[0][n - 1] * 2 - pts[0][n - 3]].concat(pts[1]); + } + // Remove control points for 'M' + pts[0] = pts[0].slice(-2); + } + return pts; + } + }; + + /** + * Compute slope from point 'p0' to 'p1' + * @param {Array} p0 + * @param {Array} p1 + * @returns {Number} + */ + function slope(p0, p1) { + return (p1[1] - p0[1]) / (p1[0] - p0[0]); + } + + /** + * Compute three-point differences for 'points' + * @param {Array} points + * @returns {Array} + */ + function finiteDifferences(points) { + var m = []; + var p0 = points[0]; + var p1 = points[1]; + var d = m[0] = slope(p0, p1); + var i = 1; + for (var n = points.length - 1; i < n; i++) { + p0 = p1; + p1 = points[i + 1]; + m[i] = (d + (d = slope(p0, p1))) * 0.5; + } + m[i] = d; + return m; + } + + /** + * ApexCharts Line Class responsible for drawing Line / Area / RangeArea Charts. + * This class is also responsible for generating values for Bubble/Scatter charts, so need to rename it to Axis Charts to avoid confusions + * @module Line + **/ + var Line = /*#__PURE__*/function () { + function Line(ctx, xyRatios, isPointsChart) { + _classCallCheck(this, Line); + this.ctx = ctx; + this.w = ctx.w; + this.xyRatios = xyRatios; + this.pointsChart = !(this.w.config.chart.type !== 'bubble' && this.w.config.chart.type !== 'scatter') || isPointsChart; + this.scatter = new Scatter(this.ctx); + this.noNegatives = this.w.globals.minX === Number.MAX_VALUE; + this.lineHelpers = new Helpers(this); + this.markers = new Markers(this.ctx); + this.prevSeriesY = []; + this.categoryAxisCorrection = 0; + this.yaxisIndex = 0; + } + _createClass(Line, [{ + key: "draw", + value: function draw(series, ctype, seriesIndex, seriesRangeEnd) { + var _w$config$series$; + var w = this.w; + var graphics = new Graphics(this.ctx); + var type = w.globals.comboCharts ? ctype : w.config.chart.type; + var ret = graphics.group({ + class: "apexcharts-".concat(type, "-series apexcharts-plot-series") + }); + var coreUtils = new CoreUtils(this.ctx, w); + this.yRatio = this.xyRatios.yRatio; + this.zRatio = this.xyRatios.zRatio; + this.xRatio = this.xyRatios.xRatio; + this.baseLineY = this.xyRatios.baseLineY; + series = coreUtils.getLogSeries(series); + this.yRatio = coreUtils.getLogYRatios(this.yRatio); + // We call draw() for each series group + this.prevSeriesY = []; + + // push all series in an array, so we can draw in reverse order + // (for stacked charts) + var allSeries = []; + for (var i = 0; i < series.length; i++) { + series = this.lineHelpers.sameValueSeriesFix(i, series); + var realIndex = w.globals.comboCharts ? seriesIndex[i] : i; + var translationsIndex = this.yRatio.length > 1 ? realIndex : 0; + this._initSerieVariables(series, i, realIndex); + var yArrj = []; // hold y values of current iterating series + var y2Arrj = []; // holds y2 values in range-area charts + var xArrj = []; // hold x values of current iterating series + + var x = w.globals.padHorizontal + this.categoryAxisCorrection; + var y = 1; + var linePaths = []; + var areaPaths = []; + this.ctx.series.addCollapsedClassToSeries(this.elSeries, realIndex); + if (w.globals.isXNumeric && w.globals.seriesX.length > 0) { + x = (w.globals.seriesX[realIndex][0] - w.globals.minX) / this.xRatio; + } + xArrj.push(x); + var pX = x; + var pY = void 0; + var pY2 = void 0; + var prevX = pX; + var prevY = this.zeroY; + var prevY2 = this.zeroY; + var lineYPosition = 0; + + // the first value in the current series is not null or undefined + var firstPrevY = this.lineHelpers.determineFirstPrevY({ + i: i, + realIndex: realIndex, + series: series, + prevY: prevY, + lineYPosition: lineYPosition, + translationsIndex: translationsIndex + }); + prevY = firstPrevY.prevY; + if (w.config.stroke.curve === 'monotoneCubic' && series[i][0] === null) { + // we have to discard the y position if 1st dataPoint is null as it + // causes issues with monotoneCubic path creation + yArrj.push(null); + } else { + yArrj.push(prevY); + } + pY = prevY; + + // y2 are needed for range-area charts + var firstPrevY2 = void 0; + if (type === 'rangeArea') { + firstPrevY2 = this.lineHelpers.determineFirstPrevY({ + i: i, + realIndex: realIndex, + series: seriesRangeEnd, + prevY: prevY2, + lineYPosition: lineYPosition, + translationsIndex: translationsIndex + }); + prevY2 = firstPrevY2.prevY; + pY2 = prevY2; + y2Arrj.push(yArrj[0] !== null ? prevY2 : null); + } + var pathsFrom = this._calculatePathsFrom({ + type: type, + series: series, + i: i, + realIndex: realIndex, + translationsIndex: translationsIndex, + prevX: prevX, + prevY: prevY, + prevY2: prevY2 + }); + + // RangeArea will resume with these for the upper path creation + var rYArrj = [yArrj[0]]; + var rY2Arrj = [y2Arrj[0]]; + var iteratingOpts = { + type: type, + series: series, + realIndex: realIndex, + translationsIndex: translationsIndex, + i: i, + x: x, + y: y, + pX: pX, + pY: pY, + pathsFrom: pathsFrom, + linePaths: linePaths, + areaPaths: areaPaths, + seriesIndex: seriesIndex, + lineYPosition: lineYPosition, + xArrj: xArrj, + yArrj: yArrj, + y2Arrj: y2Arrj, + seriesRangeEnd: seriesRangeEnd + }; + var paths = this._iterateOverDataPoints(_objectSpread2(_objectSpread2({}, iteratingOpts), {}, { + iterations: type === 'rangeArea' ? series[i].length - 1 : undefined, + isRangeStart: true + })); + if (type === 'rangeArea') { + var pathsFrom2 = this._calculatePathsFrom({ + series: seriesRangeEnd, + i: i, + realIndex: realIndex, + prevX: prevX, + prevY: prevY2 + }); + var rangePaths = this._iterateOverDataPoints(_objectSpread2(_objectSpread2({}, iteratingOpts), {}, { + series: seriesRangeEnd, + xArrj: [x], + yArrj: rYArrj, + y2Arrj: rY2Arrj, + pY: pY2, + areaPaths: paths.areaPaths, + pathsFrom: pathsFrom2, + iterations: seriesRangeEnd[i].length - 1, + isRangeStart: false + })); + + // Path may be segmented by nulls in data. + // paths.linePaths should hold (segments * 2) paths (upper and lower) + // the first n segments belong to the lower and the last n segments + // belong to the upper. + // paths.linePaths and rangePaths.linepaths are actually equivalent + // but we retain the distinction below for consistency with the + // unsegmented paths conditional branch. + var segments = paths.linePaths.length / 2; + for (var s = 0; s < segments; s++) { + paths.linePaths[s] = rangePaths.linePaths[s + segments] + paths.linePaths[s]; + } + paths.linePaths.splice(segments); + paths.pathFromLine = rangePaths.pathFromLine + paths.pathFromLine; + } else { + paths.pathFromArea += 'z'; + } + this._handlePaths({ + type: type, + realIndex: realIndex, + i: i, + paths: paths + }); + this.elSeries.add(this.elPointsMain); + this.elSeries.add(this.elDataLabelsWrap); + allSeries.push(this.elSeries); + } + if (typeof ((_w$config$series$ = w.config.series[0]) === null || _w$config$series$ === void 0 ? void 0 : _w$config$series$.zIndex) !== 'undefined') { + allSeries.sort(function (a, b) { + return Number(a.node.getAttribute('zIndex')) - Number(b.node.getAttribute('zIndex')); + }); + } + if (w.config.chart.stacked) { + for (var _s = allSeries.length - 1; _s >= 0; _s--) { + ret.add(allSeries[_s]); + } + } else { + for (var _s2 = 0; _s2 < allSeries.length; _s2++) { + ret.add(allSeries[_s2]); + } + } + return ret; + } + }, { + key: "_initSerieVariables", + value: function _initSerieVariables(series, i, realIndex) { + var w = this.w; + var graphics = new Graphics(this.ctx); + + // width divided into equal parts + this.xDivision = w.globals.gridWidth / (w.globals.dataPoints - (w.config.xaxis.tickPlacement === 'on' ? 1 : 0)); + this.strokeWidth = Array.isArray(w.config.stroke.width) ? w.config.stroke.width[realIndex] : w.config.stroke.width; + var translationsIndex = 0; + if (this.yRatio.length > 1) { + this.yaxisIndex = w.globals.seriesYAxisReverseMap[realIndex]; + translationsIndex = realIndex; + } + this.isReversed = w.config.yaxis[this.yaxisIndex] && w.config.yaxis[this.yaxisIndex].reversed; + + // zeroY is the 0 value in y series which can be used in negative charts + this.zeroY = w.globals.gridHeight - this.baseLineY[translationsIndex] - (this.isReversed ? w.globals.gridHeight : 0) + (this.isReversed ? this.baseLineY[translationsIndex] * 2 : 0); + this.areaBottomY = this.zeroY; + if (this.zeroY > w.globals.gridHeight || w.config.plotOptions.area.fillTo === 'end') { + this.areaBottomY = w.globals.gridHeight; + } + this.categoryAxisCorrection = this.xDivision / 2; + + // el to which series will be drawn + this.elSeries = graphics.group({ + class: "apexcharts-series", + zIndex: typeof w.config.series[realIndex].zIndex !== 'undefined' ? w.config.series[realIndex].zIndex : realIndex, + seriesName: Utils$1.escapeString(w.globals.seriesNames[realIndex]) + }); + + // points + this.elPointsMain = graphics.group({ + class: 'apexcharts-series-markers-wrap', + 'data:realIndex': realIndex + }); + if (w.globals.hasNullValues) { + // fixes https://github.com/apexcharts/apexcharts.js/issues/3641 + var firstPoint = this.markers.plotChartMarkers({ + pointsPos: { + x: [0], + y: [w.globals.gridHeight + w.globals.markers.largestSize] + }, + seriesIndex: i, + j: 0, + pSize: 0.1, + alwaysDrawMarker: true, + isVirtualPoint: true + }); + if (firstPoint !== null) { + // firstPoint is rendered for cases where there are null values and when dynamic markers are required + this.elPointsMain.add(firstPoint); + } + } + + // eldatalabels + this.elDataLabelsWrap = graphics.group({ + class: 'apexcharts-datalabels', + 'data:realIndex': realIndex + }); + var longestSeries = series[i].length === w.globals.dataPoints; + this.elSeries.attr({ + 'data:longestSeries': longestSeries, + rel: i + 1, + 'data:realIndex': realIndex + }); + this.appendPathFrom = true; + } + }, { + key: "_calculatePathsFrom", + value: function _calculatePathsFrom(_ref) { + var type = _ref.type, + series = _ref.series, + i = _ref.i, + realIndex = _ref.realIndex, + translationsIndex = _ref.translationsIndex, + prevX = _ref.prevX, + prevY = _ref.prevY, + prevY2 = _ref.prevY2; + var w = this.w; + var graphics = new Graphics(this.ctx); + var linePath, areaPath, pathFromLine, pathFromArea; + if (series[i][0] === null) { + // when the first value itself is null, we need to move the pointer to a location where a null value is not found + for (var s = 0; s < series[i].length; s++) { + if (series[i][s] !== null) { + prevX = this.xDivision * s; + prevY = this.zeroY - series[i][s] / this.yRatio[translationsIndex]; + linePath = graphics.move(prevX, prevY); + areaPath = graphics.move(prevX, this.areaBottomY); + break; + } + } + } else { + linePath = graphics.move(prevX, prevY); + if (type === 'rangeArea') { + linePath = graphics.move(prevX, prevY2) + graphics.line(prevX, prevY); + } + areaPath = graphics.move(prevX, this.areaBottomY) + graphics.line(prevX, prevY); + } + pathFromLine = graphics.move(0, this.areaBottomY) + graphics.line(0, this.areaBottomY); + pathFromArea = graphics.move(0, this.areaBottomY) + graphics.line(0, this.areaBottomY); + if (w.globals.previousPaths.length > 0) { + var pathFrom = this.lineHelpers.checkPreviousPaths({ + pathFromLine: pathFromLine, + pathFromArea: pathFromArea, + realIndex: realIndex + }); + pathFromLine = pathFrom.pathFromLine; + pathFromArea = pathFrom.pathFromArea; + } + return { + prevX: prevX, + prevY: prevY, + linePath: linePath, + areaPath: areaPath, + pathFromLine: pathFromLine, + pathFromArea: pathFromArea + }; + } + }, { + key: "_handlePaths", + value: function _handlePaths(_ref2) { + var type = _ref2.type, + realIndex = _ref2.realIndex, + i = _ref2.i, + paths = _ref2.paths; + var w = this.w; + var graphics = new Graphics(this.ctx); + var fill = new Fill(this.ctx); + + // push all current y values array to main PrevY Array + this.prevSeriesY.push(paths.yArrj); + + // push all x val arrays into main xArr + w.globals.seriesXvalues[realIndex] = paths.xArrj; + w.globals.seriesYvalues[realIndex] = paths.yArrj; + var forecast = w.config.forecastDataPoints; + if (forecast.count > 0 && type !== 'rangeArea') { + var forecastCutoff = w.globals.seriesXvalues[realIndex][w.globals.seriesXvalues[realIndex].length - forecast.count - 1]; + var elForecastMask = graphics.drawRect(forecastCutoff, 0, w.globals.gridWidth, w.globals.gridHeight, 0); + w.globals.dom.elForecastMask.appendChild(elForecastMask.node); + var elNonForecastMask = graphics.drawRect(0, 0, forecastCutoff, w.globals.gridHeight, 0); + w.globals.dom.elNonForecastMask.appendChild(elNonForecastMask.node); + } + + // these elements will be shown after area path animation completes + if (!this.pointsChart) { + w.globals.delayedElements.push({ + el: this.elPointsMain.node, + index: realIndex + }); + } + var defaultRenderedPathOptions = { + i: i, + realIndex: realIndex, + animationDelay: i, + initialSpeed: w.config.chart.animations.speed, + dataChangeSpeed: w.config.chart.animations.dynamicAnimation.speed, + className: "apexcharts-".concat(type) + }; + if (type === 'area') { + var pathFill = fill.fillPath({ + seriesNumber: realIndex + }); + for (var p = 0; p < paths.areaPaths.length; p++) { + var renderedPath = graphics.renderPaths(_objectSpread2(_objectSpread2({}, defaultRenderedPathOptions), {}, { + pathFrom: paths.pathFromArea, + pathTo: paths.areaPaths[p], + stroke: 'none', + strokeWidth: 0, + strokeLineCap: null, + fill: pathFill + })); + this.elSeries.add(renderedPath); + } + } + if (w.config.stroke.show && !this.pointsChart) { + var lineFill = null; + if (type === 'line') { + lineFill = fill.fillPath({ + seriesNumber: realIndex, + i: i + }); + } else { + if (w.config.stroke.fill.type === 'solid') { + lineFill = w.globals.stroke.colors[realIndex]; + } else { + var prevFill = w.config.fill; + w.config.fill = w.config.stroke.fill; + lineFill = fill.fillPath({ + seriesNumber: realIndex, + i: i + }); + w.config.fill = prevFill; + } + } + + // range-area paths are drawn using linePaths + for (var _p = 0; _p < paths.linePaths.length; _p++) { + var _pathFill = lineFill; + if (type === 'rangeArea') { + _pathFill = fill.fillPath({ + seriesNumber: realIndex + }); + } + var linePathCommonOpts = _objectSpread2(_objectSpread2({}, defaultRenderedPathOptions), {}, { + pathFrom: paths.pathFromLine, + pathTo: paths.linePaths[_p], + stroke: lineFill, + strokeWidth: this.strokeWidth, + strokeLineCap: w.config.stroke.lineCap, + fill: type === 'rangeArea' ? _pathFill : 'none' + }); + var _renderedPath = graphics.renderPaths(linePathCommonOpts); + this.elSeries.add(_renderedPath); + _renderedPath.attr('fill-rule', "evenodd"); + if (forecast.count > 0 && type !== 'rangeArea') { + var renderedForecastPath = graphics.renderPaths(linePathCommonOpts); + renderedForecastPath.node.setAttribute('stroke-dasharray', forecast.dashArray); + if (forecast.strokeWidth) { + renderedForecastPath.node.setAttribute('stroke-width', forecast.strokeWidth); + } + this.elSeries.add(renderedForecastPath); + renderedForecastPath.attr('clip-path', "url(#forecastMask".concat(w.globals.cuid, ")")); + _renderedPath.attr('clip-path', "url(#nonForecastMask".concat(w.globals.cuid, ")")); + } + } + } + } + }, { + key: "_iterateOverDataPoints", + value: function _iterateOverDataPoints(_ref3) { + var _this = this, + _this$w$config$series, + _this$w$config$series2; + var type = _ref3.type, + series = _ref3.series, + iterations = _ref3.iterations, + realIndex = _ref3.realIndex, + translationsIndex = _ref3.translationsIndex, + i = _ref3.i, + x = _ref3.x, + y = _ref3.y, + pX = _ref3.pX, + pY = _ref3.pY, + pathsFrom = _ref3.pathsFrom, + linePaths = _ref3.linePaths, + areaPaths = _ref3.areaPaths, + seriesIndex = _ref3.seriesIndex, + lineYPosition = _ref3.lineYPosition, + xArrj = _ref3.xArrj, + yArrj = _ref3.yArrj, + y2Arrj = _ref3.y2Arrj, + isRangeStart = _ref3.isRangeStart, + seriesRangeEnd = _ref3.seriesRangeEnd; + var w = this.w; + var graphics = new Graphics(this.ctx); + var yRatio = this.yRatio; + var prevY = pathsFrom.prevY, + linePath = pathsFrom.linePath, + areaPath = pathsFrom.areaPath, + pathFromLine = pathsFrom.pathFromLine, + pathFromArea = pathsFrom.pathFromArea; + var minY = Utils$1.isNumber(w.globals.minYArr[realIndex]) ? w.globals.minYArr[realIndex] : w.globals.minY; + if (!iterations) { + iterations = w.globals.dataPoints > 1 ? w.globals.dataPoints - 1 : w.globals.dataPoints; + } + var getY = function getY(_y, lineYPos) { + return lineYPos - _y / yRatio[translationsIndex] + (_this.isReversed ? _y / yRatio[translationsIndex] : 0) * 2; + }; + var y2 = y; + var stackSeries = w.config.chart.stacked && !w.globals.comboCharts || w.config.chart.stacked && w.globals.comboCharts && (!this.w.config.chart.stackOnlyBar || ((_this$w$config$series = this.w.config.series[realIndex]) === null || _this$w$config$series === void 0 ? void 0 : _this$w$config$series.type) === 'bar' || ((_this$w$config$series2 = this.w.config.series[realIndex]) === null || _this$w$config$series2 === void 0 ? void 0 : _this$w$config$series2.type) === 'column'); + var curve = w.config.stroke.curve; + if (Array.isArray(curve)) { + if (Array.isArray(seriesIndex)) { + curve = curve[seriesIndex[i]]; + } else { + curve = curve[i]; + } + } + var pathState = 0; + var segmentStartX; + for (var j = 0; j < iterations; j++) { + if (series[i].length === 0) break; + var isNull = typeof series[i][j + 1] === 'undefined' || series[i][j + 1] === null; + if (w.globals.isXNumeric) { + var sX = w.globals.seriesX[realIndex][j + 1]; + if (typeof w.globals.seriesX[realIndex][j + 1] === 'undefined') { + /* fix #374 */ + sX = w.globals.seriesX[realIndex][iterations - 1]; + } + x = (sX - w.globals.minX) / this.xRatio; + } else { + x = x + this.xDivision; + } + if (stackSeries) { + if (i > 0 && w.globals.collapsedSeries.length < w.config.series.length - 1) { + // a collapsed series in a stacked chart may provide wrong result + // for the next series, hence find the prevIndex of prev series + // which is not collapsed - fixes apexcharts.js#1372 + var prevIndex = function prevIndex(pi) { + for (var pii = pi; pii > 0; pii--) { + if (w.globals.collapsedSeriesIndices.indexOf((seriesIndex === null || seriesIndex === void 0 ? void 0 : seriesIndex[pii]) || pii) > -1) { + pii--; + } else { + return pii; + } + } + return 0; + }; + lineYPosition = this.prevSeriesY[prevIndex(i - 1)][j + 1]; + } else { + // the first series will not have prevY values + lineYPosition = this.zeroY; + } + } else { + lineYPosition = this.zeroY; + } + if (isNull) { + y = getY(minY, lineYPosition); + } else { + y = getY(series[i][j + 1], lineYPosition); + if (type === 'rangeArea') { + y2 = getY(seriesRangeEnd[i][j + 1], lineYPosition); + } + } + + // push current X + xArrj.push(series[i][j + 1] === null ? null : x); + + // push current Y that will be used as next series's bottom position + if (isNull && (w.config.stroke.curve === 'smooth' || w.config.stroke.curve === 'monotoneCubic')) { + yArrj.push(null); + y2Arrj.push(null); + } else { + yArrj.push(y); + y2Arrj.push(y2); + } + var pointsPos = this.lineHelpers.calculatePoints({ + series: series, + x: x, + y: y, + realIndex: realIndex, + i: i, + j: j, + prevY: prevY + }); + var calculatedPaths = this._createPaths({ + type: type, + series: series, + i: i, + realIndex: realIndex, + j: j, + x: x, + y: y, + y2: y2, + xArrj: xArrj, + yArrj: yArrj, + y2Arrj: y2Arrj, + pX: pX, + pY: pY, + pathState: pathState, + segmentStartX: segmentStartX, + linePath: linePath, + areaPath: areaPath, + linePaths: linePaths, + areaPaths: areaPaths, + curve: curve, + isRangeStart: isRangeStart + }); + areaPaths = calculatedPaths.areaPaths; + linePaths = calculatedPaths.linePaths; + pX = calculatedPaths.pX; + pY = calculatedPaths.pY; + pathState = calculatedPaths.pathState; + segmentStartX = calculatedPaths.segmentStartX; + areaPath = calculatedPaths.areaPath; + linePath = calculatedPaths.linePath; + if (this.appendPathFrom && !w.globals.hasNullValues && !(curve === 'monotoneCubic' && type === 'rangeArea')) { + pathFromLine += graphics.line(x, this.areaBottomY); + pathFromArea += graphics.line(x, this.areaBottomY); + } + this.handleNullDataPoints(series, pointsPos, i, j, realIndex); + this._handleMarkersAndLabels({ + type: type, + pointsPos: pointsPos, + i: i, + j: j, + realIndex: realIndex, + isRangeStart: isRangeStart + }); + } + return { + yArrj: yArrj, + xArrj: xArrj, + pathFromArea: pathFromArea, + areaPaths: areaPaths, + pathFromLine: pathFromLine, + linePaths: linePaths, + linePath: linePath, + areaPath: areaPath + }; + } + }, { + key: "_handleMarkersAndLabels", + value: function _handleMarkersAndLabels(_ref4) { + var type = _ref4.type, + pointsPos = _ref4.pointsPos, + isRangeStart = _ref4.isRangeStart, + i = _ref4.i, + j = _ref4.j, + realIndex = _ref4.realIndex; + var w = this.w; + var dataLabels = new DataLabels(this.ctx); + if (!this.pointsChart) { + if (w.globals.series[i].length > 1) { + this.elPointsMain.node.classList.add('apexcharts-element-hidden'); + } + var elPointsWrap = this.markers.plotChartMarkers({ + pointsPos: pointsPos, + seriesIndex: realIndex, + j: j + 1 + }); + if (elPointsWrap !== null) { + this.elPointsMain.add(elPointsWrap); + } + } else { + // scatter / bubble chart points creation + this.scatter.draw(this.elSeries, j, { + realIndex: realIndex, + pointsPos: pointsPos, + zRatio: this.zRatio, + elParent: this.elPointsMain + }); + } + var drawnLabels = dataLabels.drawDataLabel({ + type: type, + isRangeStart: isRangeStart, + pos: pointsPos, + i: realIndex, + j: j + 1 + }); + if (drawnLabels !== null) { + this.elDataLabelsWrap.add(drawnLabels); + } + } + }, { + key: "_createPaths", + value: function _createPaths(_ref5) { + var type = _ref5.type, + series = _ref5.series, + i = _ref5.i; + _ref5.realIndex; + var j = _ref5.j, + x = _ref5.x, + y = _ref5.y, + xArrj = _ref5.xArrj, + yArrj = _ref5.yArrj, + y2 = _ref5.y2, + y2Arrj = _ref5.y2Arrj, + pX = _ref5.pX, + pY = _ref5.pY, + pathState = _ref5.pathState, + segmentStartX = _ref5.segmentStartX, + linePath = _ref5.linePath, + areaPath = _ref5.areaPath, + linePaths = _ref5.linePaths, + areaPaths = _ref5.areaPaths, + curve = _ref5.curve, + isRangeStart = _ref5.isRangeStart; + var graphics = new Graphics(this.ctx); + var areaBottomY = this.areaBottomY; + var rangeArea = type === 'rangeArea'; + var isLowerRangeAreaPath = type === 'rangeArea' && isRangeStart; + switch (curve) { + case 'monotoneCubic': + var yAj = isRangeStart ? yArrj : y2Arrj; + var getSmoothInputs = function getSmoothInputs(xArr, yArr) { + return xArr.map(function (_, i) { + return [_, yArr[i]]; + }).filter(function (_) { + return _[1] !== null; + }); + }; + var getSegmentLengths = function getSegmentLengths(yArr) { + // Get the segment lengths so the segments can be extracted from + // the null-filtered smoothInputs array + var segLens = []; + var count = 0; + yArr.forEach(function (_) { + if (_ !== null) { + count++; + } else if (count > 0) { + segLens.push(count); + count = 0; + } + }); + if (count > 0) { + segLens.push(count); + } + return segLens; + }; + var getSegments = function getSegments(yArr, points) { + var segLens = getSegmentLengths(yArr); + var segments = []; + for (var _i = 0, len = 0; _i < segLens.length; len += segLens[_i++]) { + segments[_i] = spline.slice(points, len, len + segLens[_i]); + } + return segments; + }; + switch (pathState) { + case 0: + // Find start of segment + if (yAj[j + 1] === null) { + break; + } + pathState = 1; + // continue through to pathState 1 + case 1: + if (!(rangeArea ? xArrj.length === series[i].length : j === series[i].length - 2)) { + break; + } + // continue through to pathState 2 + case 2: + // Interpolate the full series with nulls excluded then extract the + // null delimited segments with interpolated points included. + var _xAj = isRangeStart ? xArrj : xArrj.slice().reverse(); + var _yAj = isRangeStart ? yAj : yAj.slice().reverse(); + var smoothInputs = getSmoothInputs(_xAj, _yAj); + var points = smoothInputs.length > 1 ? spline.points(smoothInputs) : smoothInputs; + var smoothInputsLower = []; + if (rangeArea) { + if (isLowerRangeAreaPath) { + // As we won't be needing it, borrow areaPaths to retain our + // rangeArea lower points. + areaPaths = smoothInputs; + } else { + // Retrieve the corresponding lower raw interpolated points so we + // can join onto its end points. Note: the upper Y2 segments will + // be in the reverse order relative to the lower segments. + smoothInputsLower = areaPaths.reverse(); + } + } + var segmentCount = 0; + var smoothInputsIndex = 0; + getSegments(_yAj, points).forEach(function (_) { + segmentCount++; + var svgPoints = svgPath(_); + var _start = smoothInputsIndex; + smoothInputsIndex += _.length; + var _end = smoothInputsIndex - 1; + if (isLowerRangeAreaPath) { + linePath = graphics.move(smoothInputs[_start][0], smoothInputs[_start][1]) + svgPoints; + } else if (rangeArea) { + linePath = graphics.move(smoothInputsLower[_start][0], smoothInputsLower[_start][1]) + graphics.line(smoothInputs[_start][0], smoothInputs[_start][1]) + svgPoints + graphics.line(smoothInputsLower[_end][0], smoothInputsLower[_end][1]); + } else { + linePath = graphics.move(smoothInputs[_start][0], smoothInputs[_start][1]) + svgPoints; + areaPath = linePath + graphics.line(smoothInputs[_end][0], areaBottomY) + graphics.line(smoothInputs[_start][0], areaBottomY) + 'z'; + areaPaths.push(areaPath); + } + linePaths.push(linePath); + }); + if (rangeArea && segmentCount > 1 && !isLowerRangeAreaPath) { + // Reverse the order of the upper path segments + var upperLinePaths = linePaths.slice(segmentCount).reverse(); + linePaths.splice(segmentCount); + upperLinePaths.forEach(function (u) { + return linePaths.push(u); + }); + } + pathState = 0; + break; + } + break; + case 'smooth': + var length = (x - pX) * 0.35; + if (series[i][j] === null) { + pathState = 0; + } else { + switch (pathState) { + case 0: + // Beginning of segment + segmentStartX = pX; + if (isLowerRangeAreaPath) { + // Need to add path portion that will join to the upper path + linePath = graphics.move(pX, y2Arrj[j]) + graphics.line(pX, pY); + } else { + linePath = graphics.move(pX, pY); + } + areaPath = graphics.move(pX, pY); + + // Check for single isolated point + if (series[i][j + 1] === null || typeof series[i][j + 1] === 'undefined') { + linePaths.push(linePath); + areaPaths.push(areaPath); + // Stay in pathState = 0; + break; + } + pathState = 1; + if (j < series[i].length - 2) { + var p = graphics.curve(pX + length, pY, x - length, y, x, y); + linePath += p; + areaPath += p; + break; + } + // Continue on with pathState 1 to finish the path and exit + case 1: + // Continuing with segment + if (series[i][j + 1] === null) { + // Segment ends here + if (isLowerRangeAreaPath) { + linePath += graphics.line(pX, y2); + } else { + linePath += graphics.move(pX, pY); + } + areaPath += graphics.line(pX, areaBottomY) + graphics.line(segmentStartX, areaBottomY) + 'z'; + linePaths.push(linePath); + areaPaths.push(areaPath); + pathState = -1; + } else { + var _p2 = graphics.curve(pX + length, pY, x - length, y, x, y); + linePath += _p2; + areaPath += _p2; + if (j >= series[i].length - 2) { + if (isLowerRangeAreaPath) { + // Need to add path portion that will join to the upper path + linePath += graphics.curve(x, y, x, y, x, y2) + graphics.move(x, y2); + } + areaPath += graphics.curve(x, y, x, y, x, areaBottomY) + graphics.line(segmentStartX, areaBottomY) + 'z'; + linePaths.push(linePath); + areaPaths.push(areaPath); + pathState = -1; + } + } + break; + } + } + pX = x; + pY = y; + break; + default: + var pathToPoint = function pathToPoint(curve, x, y) { + var path = []; + switch (curve) { + case 'stepline': + path = graphics.line(x, null, 'H') + graphics.line(null, y, 'V'); + break; + case 'linestep': + path = graphics.line(null, y, 'V') + graphics.line(x, null, 'H'); + break; + case 'straight': + path = graphics.line(x, y); + break; + } + return path; + }; + if (series[i][j] === null) { + pathState = 0; + } else { + switch (pathState) { + case 0: + // Beginning of segment + segmentStartX = pX; + if (isLowerRangeAreaPath) { + // Need to add path portion that will join to the upper path + linePath = graphics.move(pX, y2Arrj[j]) + graphics.line(pX, pY); + } else { + linePath = graphics.move(pX, pY); + } + areaPath = graphics.move(pX, pY); + + // Check for single isolated point + if (series[i][j + 1] === null || typeof series[i][j + 1] === 'undefined') { + linePaths.push(linePath); + areaPaths.push(areaPath); + // Stay in pathState = 0 + break; + } + pathState = 1; + if (j < series[i].length - 2) { + var _p3 = pathToPoint(curve, x, y); + linePath += _p3; + areaPath += _p3; + break; + } + // Continue on with pathState 1 to finish the path and exit + case 1: + // Continuing with segment + if (series[i][j + 1] === null) { + // Segment ends here + if (isLowerRangeAreaPath) { + linePath += graphics.line(pX, y2); + } else { + linePath += graphics.move(pX, pY); + } + areaPath += graphics.line(pX, areaBottomY) + graphics.line(segmentStartX, areaBottomY) + 'z'; + linePaths.push(linePath); + areaPaths.push(areaPath); + pathState = -1; + } else { + var _p4 = pathToPoint(curve, x, y); + linePath += _p4; + areaPath += _p4; + if (j >= series[i].length - 2) { + if (isLowerRangeAreaPath) { + // Need to add path portion that will join to the upper path + linePath += graphics.line(x, y2); + } + areaPath += graphics.line(x, areaBottomY) + graphics.line(segmentStartX, areaBottomY) + 'z'; + linePaths.push(linePath); + areaPaths.push(areaPath); + pathState = -1; + } + } + break; + } + } + pX = x; + pY = y; + break; + } + return { + linePaths: linePaths, + areaPaths: areaPaths, + pX: pX, + pY: pY, + pathState: pathState, + segmentStartX: segmentStartX, + linePath: linePath, + areaPath: areaPath + }; + } + }, { + key: "handleNullDataPoints", + value: function handleNullDataPoints(series, pointsPos, i, j, realIndex) { + var w = this.w; + if (series[i][j] === null && w.config.markers.showNullDataPoints || series[i].length === 1) { + var pSize = this.strokeWidth - w.config.markers.strokeWidth / 2; + if (!(pSize > 0)) { + pSize = 0; + } + + // fixes apexcharts.js#1282, #1252 + var elPointsWrap = this.markers.plotChartMarkers({ + pointsPos: pointsPos, + seriesIndex: realIndex, + j: j + 1, + pSize: pSize, + alwaysDrawMarker: true + }); + if (elPointsWrap !== null) { + this.elPointsMain.add(elPointsWrap); + } + } + } + }]); + return Line; + }(); + + /* + * treemap-squarify.js - open source implementation of squarified treemaps + * + * Treemap Squared 0.5 - Treemap Charting library + * + * https://github.com/imranghory/treemap-squared/ + * + * Copyright (c) 2012 Imran Ghory (imranghory@gmail.com) + * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license. + * + * + * Implementation of the squarify treemap algorithm described in: + * + * Bruls, Mark; Huizing, Kees; van Wijk, Jarke J. (2000), "Squarified treemaps" + * in de Leeuw, W.; van Liere, R., Data Visualization 2000: + * Proc. Joint Eurographics and IEEE TCVG Symp. on Visualization, Springer-Verlag, pp. 33–42. + * + * Paper is available online at: http://www.win.tue.nl/~vanwijk/stm.pdf + * + * The code in this file is completeley decoupled from the drawing code so it should be trivial + * to port it to any other vector drawing library. Given an array of datapoints this library returns + * an array of cartesian coordinates that represent the rectangles that make up the treemap. + * + * The library also supports multidimensional data (nested treemaps) and performs normalization on the data. + * + * See the README file for more details. + */ + + window.TreemapSquared = {}; + (function () { + + window.TreemapSquared.generate = function () { + function Container(xoffset, yoffset, width, height) { + this.xoffset = xoffset; // offset from the the top left hand corner + this.yoffset = yoffset; // ditto + this.height = height; + this.width = width; + this.shortestEdge = function () { + return Math.min(this.height, this.width); + }; + + // getCoordinates - for a row of boxes which we've placed + // return an array of their cartesian coordinates + this.getCoordinates = function (row) { + var coordinates = []; + var subxoffset = this.xoffset, + subyoffset = this.yoffset; //our offset within the container + var areawidth = sumArray(row) / this.height; + var areaheight = sumArray(row) / this.width; + var i; + if (this.width >= this.height) { + for (i = 0; i < row.length; i++) { + coordinates.push([subxoffset, subyoffset, subxoffset + areawidth, subyoffset + row[i] / areawidth]); + subyoffset = subyoffset + row[i] / areawidth; + } + } else { + for (i = 0; i < row.length; i++) { + coordinates.push([subxoffset, subyoffset, subxoffset + row[i] / areaheight, subyoffset + areaheight]); + subxoffset = subxoffset + row[i] / areaheight; + } + } + return coordinates; + }; + + // cutArea - once we've placed some boxes into an row we then need to identify the remaining area, + // this function takes the area of the boxes we've placed and calculates the location and + // dimensions of the remaining space and returns a container box defined by the remaining area + this.cutArea = function (area) { + var newcontainer; + if (this.width >= this.height) { + var areawidth = area / this.height; + var newwidth = this.width - areawidth; + newcontainer = new Container(this.xoffset + areawidth, this.yoffset, newwidth, this.height); + } else { + var areaheight = area / this.width; + var newheight = this.height - areaheight; + newcontainer = new Container(this.xoffset, this.yoffset + areaheight, this.width, newheight); + } + return newcontainer; + }; + } + + // normalize - the Bruls algorithm assumes we're passing in areas that nicely fit into our + // container box, this method takes our raw data and normalizes the data values into + // area values so that this assumption is valid. + function normalize(data, area) { + var normalizeddata = []; + var sum = sumArray(data); + var multiplier = area / sum; + var i; + for (i = 0; i < data.length; i++) { + normalizeddata[i] = data[i] * multiplier; + } + return normalizeddata; + } + + // treemapMultidimensional - takes multidimensional data (aka [[23,11],[11,32]] - nested array) + // and recursively calls itself using treemapSingledimensional + // to create a patchwork of treemaps and merge them + function treemapMultidimensional(data, width, height, xoffset, yoffset) { + xoffset = typeof xoffset === 'undefined' ? 0 : xoffset; + yoffset = typeof yoffset === 'undefined' ? 0 : yoffset; + var mergeddata = []; + var mergedtreemap; + var results = []; + var i; + if (isArray(data[0])) { + // if we've got more dimensions of depth + for (i = 0; i < data.length; i++) { + mergeddata[i] = sumMultidimensionalArray(data[i]); + } + mergedtreemap = treemapSingledimensional(mergeddata, width, height, xoffset, yoffset); + for (i = 0; i < data.length; i++) { + results.push(treemapMultidimensional(data[i], mergedtreemap[i][2] - mergedtreemap[i][0], mergedtreemap[i][3] - mergedtreemap[i][1], mergedtreemap[i][0], mergedtreemap[i][1])); + } + } else { + results = treemapSingledimensional(data, width, height, xoffset, yoffset); + } + return results; + } + + // treemapSingledimensional - simple wrapper around squarify + function treemapSingledimensional(data, width, height, xoffset, yoffset) { + xoffset = typeof xoffset === 'undefined' ? 0 : xoffset; + yoffset = typeof yoffset === 'undefined' ? 0 : yoffset; + var rawtreemap = squarify(normalize(data, width * height), [], new Container(xoffset, yoffset, width, height), []); + return flattenTreemap(rawtreemap); + } + + // flattenTreemap - squarify implementation returns an array of arrays of coordinates + // because we have a new array everytime we switch to building a new row + // this converts it into an array of coordinates. + function flattenTreemap(rawtreemap) { + var flattreemap = []; + var i, j; + for (i = 0; i < rawtreemap.length; i++) { + for (j = 0; j < rawtreemap[i].length; j++) { + flattreemap.push(rawtreemap[i][j]); + } + } + return flattreemap; + } + + // squarify - as per the Bruls paper + // plus coordinates stack and containers so we get + // usable data out of it + function squarify(data, currentrow, container, stack) { + var length; + var nextdatapoint; + var newcontainer; + if (data.length === 0) { + stack.push(container.getCoordinates(currentrow)); + return; + } + length = container.shortestEdge(); + nextdatapoint = data[0]; + if (improvesRatio(currentrow, nextdatapoint, length)) { + currentrow.push(nextdatapoint); + squarify(data.slice(1), currentrow, container, stack); + } else { + newcontainer = container.cutArea(sumArray(currentrow), stack); + stack.push(container.getCoordinates(currentrow)); + squarify(data, [], newcontainer, stack); + } + return stack; + } + + // improveRatio - implements the worse calculation and comparision as given in Bruls + // (note the error in the original paper; fixed here) + function improvesRatio(currentrow, nextnode, length) { + var newrow; + if (currentrow.length === 0) { + return true; + } + newrow = currentrow.slice(); + newrow.push(nextnode); + var currentratio = calculateRatio(currentrow, length); + var newratio = calculateRatio(newrow, length); + + // the pseudocode in the Bruls paper has the direction of the comparison + // wrong, this is the correct one. + return currentratio >= newratio; + } + + // calculateRatio - calculates the maximum width to height ratio of the + // boxes in this row + function calculateRatio(row, length) { + var min = Math.min.apply(Math, row); + var max = Math.max.apply(Math, row); + var sum = sumArray(row); + return Math.max(Math.pow(length, 2) * max / Math.pow(sum, 2), Math.pow(sum, 2) / (Math.pow(length, 2) * min)); + } + + // isArray - checks if arr is an array + function isArray(arr) { + return arr && arr.constructor === Array; + } + + // sumArray - sums a single dimensional array + function sumArray(arr) { + var sum = 0; + var i; + for (i = 0; i < arr.length; i++) { + sum += arr[i]; + } + return sum; + } + + // sumMultidimensionalArray - sums the values in a nested array (aka [[0,1],[[2,3]]]) + function sumMultidimensionalArray(arr) { + var i, + total = 0; + if (isArray(arr[0])) { + for (i = 0; i < arr.length; i++) { + total += sumMultidimensionalArray(arr[i]); + } + } else { + total = sumArray(arr); + } + return total; + } + return treemapMultidimensional; + }(); + })(); + + /** + * ApexCharts TreemapChart Class. + * @module TreemapChart + **/ + var TreemapChart = /*#__PURE__*/function () { + function TreemapChart(ctx, xyRatios) { + _classCallCheck(this, TreemapChart); + this.ctx = ctx; + this.w = ctx.w; + this.strokeWidth = this.w.config.stroke.width; + this.helpers = new TreemapHelpers(ctx); + this.dynamicAnim = this.w.config.chart.animations.dynamicAnimation; + this.labels = []; + } + _createClass(TreemapChart, [{ + key: "draw", + value: function draw(series) { + var _this = this; + var w = this.w; + var graphics = new Graphics(this.ctx); + var fill = new Fill(this.ctx); + var ret = graphics.group({ + class: 'apexcharts-treemap' + }); + if (w.globals.noData) return ret; + var ser = []; + series.forEach(function (s) { + var d = s.map(function (v) { + return Math.abs(v); + }); + ser.push(d); + }); + this.negRange = this.helpers.checkColorRange(); + w.config.series.forEach(function (s, i) { + s.data.forEach(function (l) { + if (!Array.isArray(_this.labels[i])) _this.labels[i] = []; + _this.labels[i].push(l.x); + }); + }); + var nodes = window.TreemapSquared.generate(ser, w.globals.gridWidth, w.globals.gridHeight); + nodes.forEach(function (node, i) { + var elSeries = graphics.group({ + class: "apexcharts-series apexcharts-treemap-series", + seriesName: Utils$1.escapeString(w.globals.seriesNames[i]), + rel: i + 1, + 'data:realIndex': i + }); + if (w.config.chart.dropShadow.enabled) { + var shadow = w.config.chart.dropShadow; + var filters = new Filters(_this.ctx); + filters.dropShadow(ret, shadow, i); + } + var elDataLabelWrap = graphics.group({ + class: 'apexcharts-data-labels' + }); + var bounds = { + xMin: Infinity, + yMin: Infinity, + xMax: -Infinity, + yMax: -Infinity + }; + node.forEach(function (r, j) { + var x1 = r[0]; + var y1 = r[1]; + var x2 = r[2]; + var y2 = r[3]; + bounds.xMin = Math.min(bounds.xMin, x1); + bounds.yMin = Math.min(bounds.yMin, y1); + bounds.xMax = Math.max(bounds.xMax, x2); + bounds.yMax = Math.max(bounds.yMax, y2); + var colorProps = _this.helpers.getShadeColor(w.config.chart.type, i, j, _this.negRange); + var color = colorProps.color; + var pathFill = fill.fillPath({ + color: color, + seriesNumber: i, + dataPointIndex: j + }); + var elRect = graphics.drawRect(x1, y1, x2 - x1, y2 - y1, w.config.plotOptions.treemap.borderRadius, '#fff', 1, _this.strokeWidth, w.config.plotOptions.treemap.useFillColorAsStroke ? color : w.globals.stroke.colors[i]); + elRect.attr({ + cx: x1, + cy: y1, + index: i, + i: i, + j: j, + width: x2 - x1, + height: y2 - y1, + fill: pathFill + }); + elRect.node.classList.add('apexcharts-treemap-rect'); + _this.helpers.addListeners(elRect); + var fromRect = { + x: x1 + (x2 - x1) / 2, + y: y1 + (y2 - y1) / 2, + width: 0, + height: 0 + }; + var toRect = { + x: x1, + y: y1, + width: x2 - x1, + height: y2 - y1 + }; + if (w.config.chart.animations.enabled && !w.globals.dataChanged) { + var speed = 1; + if (!w.globals.resized) { + speed = w.config.chart.animations.speed; + } + _this.animateTreemap(elRect, fromRect, toRect, speed); + } + if (w.globals.dataChanged) { + var _speed = 1; + if (_this.dynamicAnim.enabled && w.globals.shouldAnimate) { + _speed = _this.dynamicAnim.speed; + if (w.globals.previousPaths[i] && w.globals.previousPaths[i][j] && w.globals.previousPaths[i][j].rect) { + fromRect = w.globals.previousPaths[i][j].rect; + } + _this.animateTreemap(elRect, fromRect, toRect, _speed); + } + } + var fontSize = _this.getFontSize(r); + var formattedText = w.config.dataLabels.formatter(_this.labels[i][j], { + value: w.globals.series[i][j], + seriesIndex: i, + dataPointIndex: j, + w: w + }); + if (w.config.plotOptions.treemap.dataLabels.format === 'truncate') { + fontSize = parseInt(w.config.dataLabels.style.fontSize, 10); + formattedText = _this.truncateLabels(formattedText, fontSize, x1, y1, x2, y2); + } + var dataLabels = null; + if (w.globals.series[i][j]) { + dataLabels = _this.helpers.calculateDataLabels({ + text: formattedText, + x: (x1 + x2) / 2, + y: (y1 + y2) / 2 + _this.strokeWidth / 2 + fontSize / 3, + i: i, + j: j, + colorProps: colorProps, + fontSize: fontSize, + series: series + }); + } + if (w.config.dataLabels.enabled && dataLabels) { + _this.rotateToFitLabel(dataLabels, fontSize, formattedText, x1, y1, x2, y2); + } + elSeries.add(elRect); + if (dataLabels !== null) { + elSeries.add(dataLabels); + } + }); + var seriesTitle = w.config.plotOptions.treemap.seriesTitle; + if (w.config.series.length > 1 && seriesTitle && seriesTitle.show) { + var sName = w.config.series[i].name || ''; + if (sName && bounds.xMin < Infinity && bounds.yMin < Infinity) { + var offsetX = seriesTitle.offsetX, + offsetY = seriesTitle.offsetY, + borderColor = seriesTitle.borderColor, + borderWidth = seriesTitle.borderWidth, + borderRadius = seriesTitle.borderRadius, + style = seriesTitle.style; + var textColor = style.color || w.config.chart.foreColor; + var padding = { + left: style.padding.left, + right: style.padding.right, + top: style.padding.top, + bottom: style.padding.bottom + }; + var textSize = graphics.getTextRects(sName, style.fontSize, style.fontFamily); + var labelRectWidth = textSize.width + padding.left + padding.right; + var labelRectHeight = textSize.height + padding.top + padding.bottom; + + // Position + var labelX = bounds.xMin + (offsetX || 0); + var labelY = bounds.yMin + (offsetY || 0); + + // Draw background rect + var elLabelRect = graphics.drawRect(labelX, labelY, labelRectWidth, labelRectHeight, borderRadius, style.background, 1, borderWidth, borderColor); + var elLabelText = graphics.drawText({ + x: labelX + padding.left, + y: labelY + padding.top + textSize.height * 0.75, + text: sName, + fontSize: style.fontSize, + fontFamily: style.fontFamily, + fontWeight: style.fontWeight, + foreColor: textColor, + cssClass: style.cssClass || '' + }); + elSeries.add(elLabelRect); + elSeries.add(elLabelText); + } + } + elSeries.add(elDataLabelWrap); + ret.add(elSeries); + }); + return ret; + } + + // This calculates a font-size based upon + // average label length and the size of the box + }, { + key: "getFontSize", + value: function getFontSize(coordinates) { + var w = this.w; + + // total length of labels (i.e [["Italy"],["Spain", "Greece"]] -> 16) + function totalLabelLength(arr) { + var i, + total = 0; + if (Array.isArray(arr[0])) { + for (i = 0; i < arr.length; i++) { + total += totalLabelLength(arr[i]); + } + } else { + for (i = 0; i < arr.length; i++) { + total += arr[i].length; + } + } + return total; + } + + // count of labels (i.e [["Italy"],["Spain", "Greece"]] -> 3) + function countLabels(arr) { + var i, + total = 0; + if (Array.isArray(arr[0])) { + for (i = 0; i < arr.length; i++) { + total += countLabels(arr[i]); + } + } else { + for (i = 0; i < arr.length; i++) { + total += 1; + } + } + return total; + } + var averagelabelsize = totalLabelLength(this.labels) / countLabels(this.labels); + function fontSize(width, height) { + var area = width * height; + var arearoot = Math.pow(area, 0.5); + return Math.min(arearoot / averagelabelsize, parseInt(w.config.dataLabels.style.fontSize, 10)); + } + return fontSize(coordinates[2] - coordinates[0], coordinates[3] - coordinates[1]); + } + }, { + key: "rotateToFitLabel", + value: function rotateToFitLabel(elText, fontSize, text, x1, y1, x2, y2) { + var graphics = new Graphics(this.ctx); + var textRect = graphics.getTextRects(text, fontSize); + + // if the label fits better sideways then rotate it + if (textRect.width + this.w.config.stroke.width + 5 > x2 - x1 && textRect.width <= y2 - y1) { + var labelRotatingCenter = graphics.rotateAroundCenter(elText.node); + elText.node.setAttribute('transform', "rotate(-90 ".concat(labelRotatingCenter.x, " ").concat(labelRotatingCenter.y, ") translate(").concat(textRect.height / 3, ")")); + } + } + + // This is an alternative label formatting method that uses a + // consistent font size, and trims the edge of long labels + }, { + key: "truncateLabels", + value: function truncateLabels(text, fontSize, x1, y1, x2, y2) { + var graphics = new Graphics(this.ctx); + var textRect = graphics.getTextRects(text, fontSize); + + // Determine max width based on ideal orientation of text + var labelMaxWidth = textRect.width + this.w.config.stroke.width + 5 > x2 - x1 && y2 - y1 > x2 - x1 ? y2 - y1 : x2 - x1; + var truncatedText = graphics.getTextBasedOnMaxWidth({ + text: text, + maxWidth: labelMaxWidth, + fontSize: fontSize + }); + + // Return empty label when text has been trimmed for very small rects + if (text.length !== truncatedText.length && labelMaxWidth / fontSize < 5) { + return ''; + } else { + return truncatedText; + } + } + }, { + key: "animateTreemap", + value: function animateTreemap(el, fromRect, toRect, speed) { + var animations = new Animations(this.ctx); + animations.animateRect(el, fromRect, toRect, speed, function () { + animations.animationCompleted(el); + }); + } + }]); + return TreemapChart; + }(); + + var MINUTES_IN_DAY = 24 * 60; + var SECONDS_IN_DAY = MINUTES_IN_DAY * 60; + var MIN_ZOOM_DAYS = 10 / SECONDS_IN_DAY; + + /** + * ApexCharts TimeScale Class for generating time ticks for x-axis. + * + * @module TimeScale + **/ + var TimeScale = /*#__PURE__*/function () { + function TimeScale(ctx) { + _classCallCheck(this, TimeScale); + this.ctx = ctx; + this.w = ctx.w; + this.timeScaleArray = []; + this.utc = this.w.config.xaxis.labels.datetimeUTC; + } + _createClass(TimeScale, [{ + key: "calculateTimeScaleTicks", + value: function calculateTimeScaleTicks(minX, maxX) { + var _this = this; + var w = this.w; + + // null check when no series to show + if (w.globals.allSeriesCollapsed) { + w.globals.labels = []; + w.globals.timescaleLabels = []; + return []; + } + var dt = new DateTime(this.ctx); + var daysDiff = (maxX - minX) / (1000 * SECONDS_IN_DAY); + this.determineInterval(daysDiff); + w.globals.disableZoomIn = false; + w.globals.disableZoomOut = false; + if (daysDiff < MIN_ZOOM_DAYS) { + w.globals.disableZoomIn = true; + } else if (daysDiff > 50000) { + w.globals.disableZoomOut = true; + } + var timeIntervals = dt.getTimeUnitsfromTimestamp(minX, maxX, this.utc); + var daysWidthOnXAxis = w.globals.gridWidth / daysDiff; + var hoursWidthOnXAxis = daysWidthOnXAxis / 24; + var minutesWidthOnXAxis = hoursWidthOnXAxis / 60; + var secondsWidthOnXAxis = minutesWidthOnXAxis / 60; + var numberOfHours = Math.floor(daysDiff * 24); + var numberOfMinutes = Math.floor(daysDiff * MINUTES_IN_DAY); + var numberOfSeconds = Math.floor(daysDiff * SECONDS_IN_DAY); + var numberOfDays = Math.floor(daysDiff); + var numberOfMonths = Math.floor(daysDiff / 30); + var numberOfYears = Math.floor(daysDiff / 365); + var firstVal = { + minMillisecond: timeIntervals.minMillisecond, + minSecond: timeIntervals.minSecond, + minMinute: timeIntervals.minMinute, + minHour: timeIntervals.minHour, + minDate: timeIntervals.minDate, + minMonth: timeIntervals.minMonth, + minYear: timeIntervals.minYear + }; + var currentMillisecond = firstVal.minMillisecond; + var currentSecond = firstVal.minSecond; + var currentMinute = firstVal.minMinute; + var currentHour = firstVal.minHour; + var currentMonthDate = firstVal.minDate; + var currentDate = firstVal.minDate; + var currentMonth = firstVal.minMonth; + var currentYear = firstVal.minYear; + var params = { + firstVal: firstVal, + currentMillisecond: currentMillisecond, + currentSecond: currentSecond, + currentMinute: currentMinute, + currentHour: currentHour, + currentMonthDate: currentMonthDate, + currentDate: currentDate, + currentMonth: currentMonth, + currentYear: currentYear, + daysWidthOnXAxis: daysWidthOnXAxis, + hoursWidthOnXAxis: hoursWidthOnXAxis, + minutesWidthOnXAxis: minutesWidthOnXAxis, + secondsWidthOnXAxis: secondsWidthOnXAxis, + numberOfSeconds: numberOfSeconds, + numberOfMinutes: numberOfMinutes, + numberOfHours: numberOfHours, + numberOfDays: numberOfDays, + numberOfMonths: numberOfMonths, + numberOfYears: numberOfYears + }; + switch (this.tickInterval) { + case 'years': + { + this.generateYearScale(params); + break; + } + case 'months': + case 'half_year': + { + this.generateMonthScale(params); + break; + } + case 'months_days': + case 'months_fortnight': + case 'days': + case 'week_days': + { + this.generateDayScale(params); + break; + } + case 'hours': + { + this.generateHourScale(params); + break; + } + case 'minutes_fives': + case 'minutes': + this.generateMinuteScale(params); + break; + case 'seconds_tens': + case 'seconds_fives': + case 'seconds': + this.generateSecondScale(params); + break; + } + + // first, we will adjust the month values index + // as in the upper function, it is starting from 0 + // we will start them from 1 + var adjustedMonthInTimeScaleArray = this.timeScaleArray.map(function (ts) { + var defaultReturn = { + position: ts.position, + unit: ts.unit, + year: ts.year, + day: ts.day ? ts.day : 1, + hour: ts.hour ? ts.hour : 0, + month: ts.month + 1 + }; + if (ts.unit === 'month') { + return _objectSpread2(_objectSpread2({}, defaultReturn), {}, { + day: 1, + value: ts.value + 1 + }); + } else if (ts.unit === 'day' || ts.unit === 'hour') { + return _objectSpread2(_objectSpread2({}, defaultReturn), {}, { + value: ts.value + }); + } else if (ts.unit === 'minute') { + return _objectSpread2(_objectSpread2({}, defaultReturn), {}, { + value: ts.value, + minute: ts.value + }); + } else if (ts.unit === 'second') { + return _objectSpread2(_objectSpread2({}, defaultReturn), {}, { + value: ts.value, + minute: ts.minute, + second: ts.second + }); + } + return ts; + }); + var filteredTimeScale = adjustedMonthInTimeScaleArray.filter(function (ts) { + var modulo = 1; + var ticks = Math.ceil(w.globals.gridWidth / 120); + var value = ts.value; + if (w.config.xaxis.tickAmount !== undefined) { + ticks = w.config.xaxis.tickAmount; + } + if (adjustedMonthInTimeScaleArray.length > ticks) { + modulo = Math.floor(adjustedMonthInTimeScaleArray.length / ticks); + } + var shouldNotSkipUnit = false; // there is a big change in unit i.e days to months + var shouldNotPrint = false; // should skip these values + + switch (_this.tickInterval) { + case 'years': + // make years label denser + if (ts.unit === 'year') { + shouldNotSkipUnit = true; + } + break; + case 'half_year': + modulo = 7; + if (ts.unit === 'year') { + shouldNotSkipUnit = true; + } + break; + case 'months': + modulo = 1; + if (ts.unit === 'year') { + shouldNotSkipUnit = true; + } + break; + case 'months_fortnight': + modulo = 15; + if (ts.unit === 'year' || ts.unit === 'month') { + shouldNotSkipUnit = true; + } + if (value === 30) { + shouldNotPrint = true; + } + break; + case 'months_days': + modulo = 10; + if (ts.unit === 'month') { + shouldNotSkipUnit = true; + } + if (value === 30) { + shouldNotPrint = true; + } + break; + case 'week_days': + modulo = 8; + if (ts.unit === 'month') { + shouldNotSkipUnit = true; + } + break; + case 'days': + modulo = 1; + if (ts.unit === 'month') { + shouldNotSkipUnit = true; + } + break; + case 'hours': + if (ts.unit === 'day') { + shouldNotSkipUnit = true; + } + break; + case 'minutes_fives': + if (value % 5 !== 0) { + shouldNotPrint = true; + } + break; + case 'seconds_tens': + if (value % 10 !== 0) { + shouldNotPrint = true; + } + break; + case 'seconds_fives': + if (value % 5 !== 0) { + shouldNotPrint = true; + } + break; + } + if (_this.tickInterval === 'hours' || _this.tickInterval === 'minutes_fives' || _this.tickInterval === 'seconds_tens' || _this.tickInterval === 'seconds_fives') { + if (!shouldNotPrint) { + return true; + } + } else { + if ((value % modulo === 0 || shouldNotSkipUnit) && !shouldNotPrint) { + return true; + } + } + }); + return filteredTimeScale; + } + }, { + key: "recalcDimensionsBasedOnFormat", + value: function recalcDimensionsBasedOnFormat(filteredTimeScale, inverted) { + var w = this.w; + var reformattedTimescaleArray = this.formatDates(filteredTimeScale); + var removedOverlappingTS = this.removeOverlappingTS(reformattedTimescaleArray); + w.globals.timescaleLabels = removedOverlappingTS.slice(); + + // at this stage, we need to re-calculate coords of the grid as timeline labels may have altered the xaxis labels coords + // The reason we can't do this prior to this stage is because timeline labels depends on gridWidth, and as the ticks are calculated based on available gridWidth, there can be unknown number of ticks generated for different minX and maxX + // Dependency on Dimensions(), need to refactor correctly + // TODO - find an alternate way to avoid calling this Heavy method twice + var dimensions = new Dimensions(this.ctx); + dimensions.plotCoords(); + } + }, { + key: "determineInterval", + value: function determineInterval(daysDiff) { + var yearsDiff = daysDiff / 365; + var hoursDiff = daysDiff * 24; + var minutesDiff = hoursDiff * 60; + var secondsDiff = minutesDiff * 60; + switch (true) { + case yearsDiff > 5: + this.tickInterval = 'years'; + break; + case daysDiff > 800: + this.tickInterval = 'half_year'; + break; + case daysDiff > 180: + this.tickInterval = 'months'; + break; + case daysDiff > 90: + this.tickInterval = 'months_fortnight'; + break; + case daysDiff > 60: + this.tickInterval = 'months_days'; + break; + case daysDiff > 30: + this.tickInterval = 'week_days'; + break; + case daysDiff > 2: + this.tickInterval = 'days'; + break; + case hoursDiff > 2.4: + this.tickInterval = 'hours'; + break; + case minutesDiff > 15: + this.tickInterval = 'minutes_fives'; + break; + case minutesDiff > 5: + this.tickInterval = 'minutes'; + break; + case minutesDiff > 1: + this.tickInterval = 'seconds_tens'; + break; + case secondsDiff > 20: + this.tickInterval = 'seconds_fives'; + break; + default: + this.tickInterval = 'seconds'; + break; + } + } + }, { + key: "generateYearScale", + value: function generateYearScale(_ref) { + var firstVal = _ref.firstVal, + currentMonth = _ref.currentMonth, + currentYear = _ref.currentYear, + daysWidthOnXAxis = _ref.daysWidthOnXAxis, + numberOfYears = _ref.numberOfYears; + var firstTickValue = firstVal.minYear; + var firstTickPosition = 0; + var dt = new DateTime(this.ctx); + var unit = 'year'; + if (firstVal.minDate > 1 || firstVal.minMonth > 0) { + var remainingDays = dt.determineRemainingDaysOfYear(firstVal.minYear, firstVal.minMonth, firstVal.minDate); + + // remainingDaysofFirstMonth is used to reacht the 2nd tick position + var remainingDaysOfFirstYear = dt.determineDaysOfYear(firstVal.minYear) - remainingDays + 1; + + // calculate the first tick position + firstTickPosition = remainingDaysOfFirstYear * daysWidthOnXAxis; + firstTickValue = firstVal.minYear + 1; + // push the first tick in the array + this.timeScaleArray.push({ + position: firstTickPosition, + value: firstTickValue, + unit: unit, + year: firstTickValue, + month: Utils$1.monthMod(currentMonth + 1) + }); + } else if (firstVal.minDate === 1 && firstVal.minMonth === 0) { + // push the first tick in the array + this.timeScaleArray.push({ + position: firstTickPosition, + value: firstTickValue, + unit: unit, + year: currentYear, + month: Utils$1.monthMod(currentMonth + 1) + }); + } + var year = firstTickValue; + var pos = firstTickPosition; + + // keep drawing rest of the ticks + for (var i = 0; i < numberOfYears; i++) { + year++; + pos = dt.determineDaysOfYear(year - 1) * daysWidthOnXAxis + pos; + this.timeScaleArray.push({ + position: pos, + value: year, + unit: unit, + year: year, + month: 1 + }); + } + } + }, { + key: "generateMonthScale", + value: function generateMonthScale(_ref2) { + var firstVal = _ref2.firstVal, + currentMonthDate = _ref2.currentMonthDate, + currentMonth = _ref2.currentMonth, + currentYear = _ref2.currentYear, + daysWidthOnXAxis = _ref2.daysWidthOnXAxis, + numberOfMonths = _ref2.numberOfMonths; + var firstTickValue = currentMonth; + var firstTickPosition = 0; + var dt = new DateTime(this.ctx); + var unit = 'month'; + var yrCounter = 0; + if (firstVal.minDate > 1) { + // remainingDaysofFirstMonth is used to reacht the 2nd tick position + var remainingDaysOfFirstMonth = dt.determineDaysOfMonths(currentMonth + 1, firstVal.minYear) - currentMonthDate + 1; + + // calculate the first tick position + firstTickPosition = remainingDaysOfFirstMonth * daysWidthOnXAxis; + firstTickValue = Utils$1.monthMod(currentMonth + 1); + var year = currentYear + yrCounter; + var _month = Utils$1.monthMod(firstTickValue); + var value = firstTickValue; + // it's Jan, so update the year + if (firstTickValue === 0) { + unit = 'year'; + value = year; + _month = 1; + yrCounter += 1; + year = year + yrCounter; + } + + // push the first tick in the array + this.timeScaleArray.push({ + position: firstTickPosition, + value: value, + unit: unit, + year: year, + month: _month + }); + } else { + // push the first tick in the array + this.timeScaleArray.push({ + position: firstTickPosition, + value: firstTickValue, + unit: unit, + year: currentYear, + month: Utils$1.monthMod(currentMonth) + }); + } + var month = firstTickValue + 1; + var pos = firstTickPosition; + + // keep drawing rest of the ticks + for (var i = 0, j = 1; i < numberOfMonths; i++, j++) { + month = Utils$1.monthMod(month); + if (month === 0) { + unit = 'year'; + yrCounter += 1; + } else { + unit = 'month'; + } + var _year = this._getYear(currentYear, month, yrCounter); + pos = dt.determineDaysOfMonths(month, _year) * daysWidthOnXAxis + pos; + var monthVal = month === 0 ? _year : month; + this.timeScaleArray.push({ + position: pos, + value: monthVal, + unit: unit, + year: _year, + month: month === 0 ? 1 : month + }); + month++; + } + } + }, { + key: "generateDayScale", + value: function generateDayScale(_ref3) { + var firstVal = _ref3.firstVal, + currentMonth = _ref3.currentMonth, + currentYear = _ref3.currentYear, + hoursWidthOnXAxis = _ref3.hoursWidthOnXAxis, + numberOfDays = _ref3.numberOfDays; + var dt = new DateTime(this.ctx); + var unit = 'day'; + var firstTickValue = firstVal.minDate + 1; + var date = firstTickValue; + var changeMonth = function changeMonth(dateVal, month, year) { + var monthdays = dt.determineDaysOfMonths(month + 1, year); + if (dateVal > monthdays) { + month = month + 1; + date = 1; + unit = 'month'; + val = month; + return month; + } + return month; + }; + var remainingHours = 24 - firstVal.minHour; + var yrCounter = 0; + + // calculate the first tick position + var firstTickPosition = remainingHours * hoursWidthOnXAxis; + var val = firstTickValue; + var month = changeMonth(date, currentMonth, currentYear); + if (firstVal.minHour === 0 && firstVal.minDate === 1) { + // the first value is the first day of month + firstTickPosition = 0; + val = Utils$1.monthMod(firstVal.minMonth); + unit = 'month'; + date = firstVal.minDate; + // numberOfDays++ + // removed the above line to fix https://github.com/apexcharts/apexcharts.js/issues/305#issuecomment-1019520513 + } else if (firstVal.minDate !== 1 && firstVal.minHour === 0 && firstVal.minMinute === 0) { + // fixes apexcharts/apexcharts.js/issues/1730 + firstTickPosition = 0; + firstTickValue = firstVal.minDate; + date = firstTickValue; + val = firstTickValue; + // in case it's the last date of month, we need to check it + month = changeMonth(date, currentMonth, currentYear); + if (val !== 1) { + unit = 'day'; + } + } + + // push the first tick in the array + this.timeScaleArray.push({ + position: firstTickPosition, + value: val, + unit: unit, + year: this._getYear(currentYear, month, yrCounter), + month: Utils$1.monthMod(month), + day: date + }); + var pos = firstTickPosition; + // keep drawing rest of the ticks + for (var i = 0; i < numberOfDays; i++) { + date += 1; + unit = 'day'; + month = changeMonth(date, month, this._getYear(currentYear, month, yrCounter)); + var year = this._getYear(currentYear, month, yrCounter); + pos = 24 * hoursWidthOnXAxis + pos; + var value = date === 1 ? Utils$1.monthMod(month) : date; + this.timeScaleArray.push({ + position: pos, + value: value, + unit: unit, + year: year, + month: Utils$1.monthMod(month), + day: value + }); + } + } + }, { + key: "generateHourScale", + value: function generateHourScale(_ref4) { + var firstVal = _ref4.firstVal, + currentDate = _ref4.currentDate, + currentMonth = _ref4.currentMonth, + currentYear = _ref4.currentYear, + minutesWidthOnXAxis = _ref4.minutesWidthOnXAxis, + numberOfHours = _ref4.numberOfHours; + var dt = new DateTime(this.ctx); + var yrCounter = 0; + var unit = 'hour'; + var changeDate = function changeDate(dateVal, month) { + var monthdays = dt.determineDaysOfMonths(month + 1, currentYear); + if (dateVal > monthdays) { + date = 1; + month = month + 1; + } + return { + month: month, + date: date + }; + }; + var changeMonth = function changeMonth(dateVal, month) { + var monthdays = dt.determineDaysOfMonths(month + 1, currentYear); + if (dateVal > monthdays) { + month = month + 1; + return month; + } + return month; + }; + + // factor in minSeconds as well + var remainingMins = 60 - (firstVal.minMinute + firstVal.minSecond / 60.0); + var firstTickPosition = remainingMins * minutesWidthOnXAxis; + var firstTickValue = firstVal.minHour + 1; + var hour = firstTickValue; + if (remainingMins === 60) { + firstTickPosition = 0; + firstTickValue = firstVal.minHour; + hour = firstTickValue; + } + var date = currentDate; + + // we need to apply date switching logic here as well, to avoid duplicated labels + if (hour >= 24) { + hour = 0; + date += 1; + unit = 'day'; + // Unit changed to day , Value should align unit + firstTickValue = date; + } + var checkNextMonth = changeDate(date, currentMonth); + var month = checkNextMonth.month; + month = changeMonth(date, month); + + // Check if date is greater than 31 and change month if it is + if (firstTickValue > 31) { + date = 1; + firstTickValue = date; + } + + // push the first tick in the array + this.timeScaleArray.push({ + position: firstTickPosition, + value: firstTickValue, + unit: unit, + day: date, + hour: hour, + year: currentYear, + month: Utils$1.monthMod(month) + }); + hour++; + var pos = firstTickPosition; + // keep drawing rest of the ticks + for (var i = 0; i < numberOfHours; i++) { + unit = 'hour'; + if (hour >= 24) { + hour = 0; + date += 1; + unit = 'day'; + var _checkNextMonth = changeDate(date, month); + month = _checkNextMonth.month; + month = changeMonth(date, month); + } + var year = this._getYear(currentYear, month, yrCounter); + pos = 60 * minutesWidthOnXAxis + pos; + var val = hour === 0 ? date : hour; + this.timeScaleArray.push({ + position: pos, + value: val, + unit: unit, + hour: hour, + day: date, + year: year, + month: Utils$1.monthMod(month) + }); + hour++; + } + } + }, { + key: "generateMinuteScale", + value: function generateMinuteScale(_ref5) { + var currentMillisecond = _ref5.currentMillisecond, + currentSecond = _ref5.currentSecond, + currentMinute = _ref5.currentMinute, + currentHour = _ref5.currentHour, + currentDate = _ref5.currentDate, + currentMonth = _ref5.currentMonth, + currentYear = _ref5.currentYear, + minutesWidthOnXAxis = _ref5.minutesWidthOnXAxis, + secondsWidthOnXAxis = _ref5.secondsWidthOnXAxis, + numberOfMinutes = _ref5.numberOfMinutes; + var yrCounter = 0; + var unit = 'minute'; + var remainingSecs = 60 - currentSecond; + var firstTickPosition = (remainingSecs - currentMillisecond / 1000) * secondsWidthOnXAxis; + var minute = currentMinute + 1; + var date = currentDate; + var month = currentMonth; + var year = currentYear; + var hour = currentHour; + var pos = firstTickPosition; + for (var i = 0; i < numberOfMinutes; i++) { + if (minute >= 60) { + minute = 0; + hour += 1; + if (hour === 24) { + hour = 0; + } + } + this.timeScaleArray.push({ + position: pos, + value: minute, + unit: unit, + hour: hour, + minute: minute, + day: date, + year: this._getYear(year, month, yrCounter), + month: Utils$1.monthMod(month) + }); + pos += minutesWidthOnXAxis; + minute++; + } + } + }, { + key: "generateSecondScale", + value: function generateSecondScale(_ref6) { + var currentMillisecond = _ref6.currentMillisecond, + currentSecond = _ref6.currentSecond, + currentMinute = _ref6.currentMinute, + currentHour = _ref6.currentHour, + currentDate = _ref6.currentDate, + currentMonth = _ref6.currentMonth, + currentYear = _ref6.currentYear, + secondsWidthOnXAxis = _ref6.secondsWidthOnXAxis, + numberOfSeconds = _ref6.numberOfSeconds; + var yrCounter = 0; + var unit = 'second'; + var remainingMillisecs = 1000 - currentMillisecond; + var firstTickPosition = remainingMillisecs / 1000 * secondsWidthOnXAxis; + var second = currentSecond + 1; + var minute = currentMinute; + var date = currentDate; + var month = currentMonth; + var year = currentYear; + var hour = currentHour; + var pos = firstTickPosition; + for (var i = 0; i < numberOfSeconds; i++) { + if (second >= 60) { + minute++; + second = 0; + if (minute >= 60) { + hour++; + minute = 0; + if (hour === 24) { + hour = 0; + } + } + } + this.timeScaleArray.push({ + position: pos, + value: second, + unit: unit, + hour: hour, + minute: minute, + second: second, + day: date, + year: this._getYear(year, month, yrCounter), + month: Utils$1.monthMod(month) + }); + pos += secondsWidthOnXAxis; + second++; + } + } + }, { + key: "createRawDateString", + value: function createRawDateString(ts, value) { + var raw = ts.year; + if (ts.month === 0) { + // invalid month, correct it + ts.month = 1; + } + raw += '-' + ('0' + ts.month.toString()).slice(-2); + + // unit is day + if (ts.unit === 'day') { + raw += ts.unit === 'day' ? '-' + ('0' + value).slice(-2) : '-01'; + } else { + raw += '-' + ('0' + (ts.day ? ts.day : '1')).slice(-2); + } + + // unit is hour + if (ts.unit === 'hour') { + raw += ts.unit === 'hour' ? 'T' + ('0' + value).slice(-2) : 'T00'; + } else { + raw += 'T' + ('0' + (ts.hour ? ts.hour : '0')).slice(-2); + } + if (ts.unit === 'minute') { + raw += ':' + ('0' + value).slice(-2); + } else { + raw += ':' + (ts.minute ? ('0' + ts.minute).slice(-2) : '00'); + } + if (ts.unit === 'second') { + raw += ':' + ('0' + value).slice(-2); + } else { + raw += ':00'; + } + if (this.utc) { + raw += '.000Z'; + } + return raw; + } + }, { + key: "formatDates", + value: function formatDates(filteredTimeScale) { + var _this2 = this; + var w = this.w; + var reformattedTimescaleArray = filteredTimeScale.map(function (ts) { + var value = ts.value.toString(); + var dt = new DateTime(_this2.ctx); + var raw = _this2.createRawDateString(ts, value); + var dateToFormat = dt.getDate(dt.parseDate(raw)); + if (!_this2.utc) { + // Fixes #1726, #1544, #1485, #1255 + dateToFormat = dt.getDate(dt.parseDateWithTimezone(raw)); + } + if (w.config.xaxis.labels.format === undefined) { + var customFormat = 'dd MMM'; + var dtFormatter = w.config.xaxis.labels.datetimeFormatter; + if (ts.unit === 'year') customFormat = dtFormatter.year; + if (ts.unit === 'month') customFormat = dtFormatter.month; + if (ts.unit === 'day') customFormat = dtFormatter.day; + if (ts.unit === 'hour') customFormat = dtFormatter.hour; + if (ts.unit === 'minute') customFormat = dtFormatter.minute; + if (ts.unit === 'second') customFormat = dtFormatter.second; + value = dt.formatDate(dateToFormat, customFormat); + } else { + value = dt.formatDate(dateToFormat, w.config.xaxis.labels.format); + } + return { + dateString: raw, + position: ts.position, + value: value, + unit: ts.unit, + year: ts.year, + month: ts.month + }; + }); + return reformattedTimescaleArray; + } + }, { + key: "removeOverlappingTS", + value: function removeOverlappingTS(arr) { + var _this3 = this; + var graphics = new Graphics(this.ctx); + var equalLabelLengthFlag = false; // These labels got same length? + var constantLabelWidth; // If true, what is the constant length to use + if (arr.length > 0 && + // check arr length + arr[0].value && + // check arr[0] contains value + arr.every(function (lb) { + return lb.value.length === arr[0].value.length; + }) // check every arr label value is the same as the first one + ) { + equalLabelLengthFlag = true; // These labels got same length + constantLabelWidth = graphics.getTextRects(arr[0].value).width; // The constant label width to use + } + var lastDrawnIndex = 0; + var filteredArray = arr.map(function (item, index) { + if (index > 0 && _this3.w.config.xaxis.labels.hideOverlappingLabels) { + var prevLabelWidth = !equalLabelLengthFlag // if vary in label length + ? graphics.getTextRects(arr[lastDrawnIndex].value).width // get individual length + : constantLabelWidth; // else: use constant length + var prevPos = arr[lastDrawnIndex].position; + var pos = item.position; + if (pos > prevPos + prevLabelWidth + 10) { + lastDrawnIndex = index; + return item; + } else { + return null; + } + } else { + return item; + } + }); + filteredArray = filteredArray.filter(function (f) { + return f !== null; + }); + return filteredArray; + } + }, { + key: "_getYear", + value: function _getYear(currentYear, month, yrCounter) { + return currentYear + Math.floor(month / 12) + yrCounter; + } + }]); + return TimeScale; + }(); + + /** + * ApexCharts Core Class responsible for major calculations and creating elements. + * + * @module Core + **/ + var Core = /*#__PURE__*/function () { + function Core(el, ctx) { + _classCallCheck(this, Core); + this.ctx = ctx; + this.w = ctx.w; + this.el = el; + } + _createClass(Core, [{ + key: "setupElements", + value: function setupElements() { + var _this$w = this.w, + gl = _this$w.globals, + cnf = _this$w.config; + var ct = cnf.chart.type; + var axisChartsArrTypes = ['line', 'area', 'bar', 'rangeBar', 'rangeArea', 'candlestick', 'boxPlot', 'scatter', 'bubble', 'radar', 'heatmap', 'treemap']; + var xyChartsArrTypes = ['line', 'area', 'bar', 'rangeBar', 'rangeArea', 'candlestick', 'boxPlot', 'scatter', 'bubble']; + gl.axisCharts = axisChartsArrTypes.includes(ct); + gl.xyCharts = xyChartsArrTypes.includes(ct); + gl.isBarHorizontal = ['bar', 'rangeBar', 'boxPlot'].includes(ct) && cnf.plotOptions.bar.horizontal; + gl.chartClass = ".apexcharts".concat(gl.chartID); + gl.dom.baseEl = this.el; + gl.dom.elWrap = document.createElement('div'); + Graphics.setAttrs(gl.dom.elWrap, { + id: gl.chartClass.substring(1), + class: "apexcharts-canvas ".concat(gl.chartClass.substring(1)) + }); + this.el.appendChild(gl.dom.elWrap); + + // gl.dom.Paper = new window.SVG.Doc(gl.dom.elWrap) + gl.dom.Paper = window.SVG().addTo(gl.dom.elWrap); + gl.dom.Paper.attr({ + class: 'apexcharts-svg', + 'xmlns:data': 'ApexChartsNS', + transform: "translate(".concat(cnf.chart.offsetX, ", ").concat(cnf.chart.offsetY, ")") + }); + gl.dom.Paper.node.style.background = cnf.theme.mode === 'dark' && !cnf.chart.background ? '#424242' : cnf.theme.mode === 'light' && !cnf.chart.background ? '#fff' : cnf.chart.background; + this.setSVGDimensions(); + gl.dom.elLegendForeign = document.createElementNS(gl.SVGNS, 'foreignObject'); + Graphics.setAttrs(gl.dom.elLegendForeign, { + x: 0, + y: 0, + width: gl.svgWidth, + height: gl.svgHeight + }); + gl.dom.elLegendWrap = document.createElement('div'); + gl.dom.elLegendWrap.classList.add('apexcharts-legend'); + gl.dom.elWrap.appendChild(gl.dom.elLegendWrap); + gl.dom.Paper.node.appendChild(gl.dom.elLegendForeign); + gl.dom.elGraphical = gl.dom.Paper.group().attr({ + class: 'apexcharts-inner apexcharts-graphical' + }); + gl.dom.elDefs = gl.dom.Paper.defs(); + gl.dom.Paper.add(gl.dom.elGraphical); + gl.dom.elGraphical.add(gl.dom.elDefs); + } + }, { + key: "plotChartType", + value: function plotChartType(ser, xyRatios) { + var w = this.w, + ctx = this.ctx; + var cnf = w.config, + gl = w.globals; + var seriesTypes = { + line: { + series: [], + i: [] + }, + area: { + series: [], + i: [] + }, + scatter: { + series: [], + i: [] + }, + bubble: { + series: [], + i: [] + }, + bar: { + series: [], + i: [] + }, + candlestick: { + series: [], + i: [] + }, + boxPlot: { + series: [], + i: [] + }, + rangeBar: { + series: [], + i: [] + }, + rangeArea: { + series: [], + seriesRangeEnd: [], + i: [] + } + }; + var chartType = cnf.chart.type || 'line'; + var nonComboType = null; + var comboCount = 0; + gl.series.forEach(function (serie, st) { + var seriesType = ser[st].type === 'column' ? 'bar' : ser[st].type || (chartType === 'column' ? 'bar' : chartType); + if (seriesTypes[seriesType]) { + if (seriesType === 'rangeArea') { + seriesTypes[seriesType].series.push(gl.seriesRangeStart[st]); + seriesTypes[seriesType].seriesRangeEnd.push(gl.seriesRangeEnd[st]); + } else { + seriesTypes[seriesType].series.push(serie); + } + seriesTypes[seriesType].i.push(st); + if (seriesType === 'bar') w.globals.columnSeries = seriesTypes.bar; + } else if (['heatmap', 'treemap', 'pie', 'donut', 'polarArea', 'radialBar', 'radar'].includes(seriesType)) { + nonComboType = seriesType; + } else { + console.warn("You have specified an unrecognized series type (".concat(seriesType, ").")); + } + if (chartType !== seriesType && seriesType !== 'scatter') comboCount++; + }); + if (comboCount > 0) { + if (nonComboType) { + console.warn("Chart or series type ".concat(nonComboType, " cannot appear with other chart or series types.")); + } + if (seriesTypes.bar.series.length > 0 && cnf.plotOptions.bar.horizontal) { + comboCount -= seriesTypes.bar.series.length; + seriesTypes.bar = { + series: [], + i: [] + }; + w.globals.columnSeries = { + series: [], + i: [] + }; + console.warn('Horizontal bars are not supported in a mixed/combo chart. Please turn off `plotOptions.bar.horizontal`'); + } + } + gl.comboCharts || (gl.comboCharts = comboCount > 0); + var line = new Line(ctx, xyRatios); + var boxCandlestick = new BoxCandleStick(ctx, xyRatios); + ctx.pie = new Pie(ctx); + var radialBar = new Radial(ctx); + ctx.rangeBar = new RangeBar(ctx, xyRatios); + var radar = new Radar(ctx); + var elGraph = []; + if (gl.comboCharts) { + var coreUtils = new CoreUtils(ctx); + if (seriesTypes.area.series.length > 0) { + var _elGraph; + (_elGraph = elGraph).push.apply(_elGraph, _toConsumableArray(coreUtils.drawSeriesByGroup(seriesTypes.area, gl.areaGroups, 'area', line))); + } + if (seriesTypes.bar.series.length > 0) { + if (cnf.chart.stacked) { + var barStacked = new BarStacked(ctx, xyRatios); + elGraph.push(barStacked.draw(seriesTypes.bar.series, seriesTypes.bar.i)); + } else { + ctx.bar = new Bar(ctx, xyRatios); + elGraph.push(ctx.bar.draw(seriesTypes.bar.series, seriesTypes.bar.i)); + } + } + if (seriesTypes.rangeArea.series.length > 0) { + elGraph.push(line.draw(seriesTypes.rangeArea.series, 'rangeArea', seriesTypes.rangeArea.i, seriesTypes.rangeArea.seriesRangeEnd)); + } + if (seriesTypes.line.series.length > 0) { + var _elGraph2; + (_elGraph2 = elGraph).push.apply(_elGraph2, _toConsumableArray(coreUtils.drawSeriesByGroup(seriesTypes.line, gl.lineGroups, 'line', line))); + } + if (seriesTypes.candlestick.series.length > 0) { + elGraph.push(boxCandlestick.draw(seriesTypes.candlestick.series, 'candlestick', seriesTypes.candlestick.i)); + } + if (seriesTypes.boxPlot.series.length > 0) { + elGraph.push(boxCandlestick.draw(seriesTypes.boxPlot.series, 'boxPlot', seriesTypes.boxPlot.i)); + } + if (seriesTypes.rangeBar.series.length > 0) { + elGraph.push(ctx.rangeBar.draw(seriesTypes.rangeBar.series, seriesTypes.rangeBar.i)); + } + if (seriesTypes.scatter.series.length > 0) { + var scatterLine = new Line(ctx, xyRatios, true); + elGraph.push(scatterLine.draw(seriesTypes.scatter.series, 'scatter', seriesTypes.scatter.i)); + } + if (seriesTypes.bubble.series.length > 0) { + var bubbleLine = new Line(ctx, xyRatios, true); + elGraph.push(bubbleLine.draw(seriesTypes.bubble.series, 'bubble', seriesTypes.bubble.i)); + } + } else { + switch (cnf.chart.type) { + case 'line': + elGraph = line.draw(gl.series, 'line'); + break; + case 'area': + elGraph = line.draw(gl.series, 'area'); + break; + case 'bar': + if (cnf.chart.stacked) { + var _barStacked = new BarStacked(ctx, xyRatios); + elGraph = _barStacked.draw(gl.series); + } else { + ctx.bar = new Bar(ctx, xyRatios); + elGraph = ctx.bar.draw(gl.series); + } + break; + case 'candlestick': + var candleStick = new BoxCandleStick(ctx, xyRatios); + elGraph = candleStick.draw(gl.series, 'candlestick'); + break; + case 'boxPlot': + var boxPlot = new BoxCandleStick(ctx, xyRatios); + elGraph = boxPlot.draw(gl.series, cnf.chart.type); + break; + case 'rangeBar': + elGraph = ctx.rangeBar.draw(gl.series); + break; + case 'rangeArea': + elGraph = line.draw(gl.seriesRangeStart, 'rangeArea', undefined, gl.seriesRangeEnd); + break; + case 'heatmap': + var heatmap = new HeatMap(ctx, xyRatios); + elGraph = heatmap.draw(gl.series); + break; + case 'treemap': + var treemap = new TreemapChart(ctx, xyRatios); + elGraph = treemap.draw(gl.series); + break; + case 'pie': + case 'donut': + case 'polarArea': + elGraph = ctx.pie.draw(gl.series); + break; + case 'radialBar': + elGraph = radialBar.draw(gl.series); + break; + case 'radar': + elGraph = radar.draw(gl.series); + break; + default: + elGraph = line.draw(gl.series); + } + } + return elGraph; + } + }, { + key: "setSVGDimensions", + value: function setSVGDimensions() { + var _this$w2 = this.w, + gl = _this$w2.globals, + cnf = _this$w2.config; + cnf.chart.width = cnf.chart.width || '100%'; + cnf.chart.height = cnf.chart.height || 'auto'; + gl.svgWidth = cnf.chart.width; + gl.svgHeight = cnf.chart.height; + var elDim = Utils$1.getDimensions(this.el); + var widthUnit = cnf.chart.width.toString().split(/[0-9]+/g).pop(); + if (widthUnit === '%') { + if (Utils$1.isNumber(elDim[0])) { + if (elDim[0].width === 0) { + elDim = Utils$1.getDimensions(this.el.parentNode); + } + gl.svgWidth = elDim[0] * parseInt(cnf.chart.width, 10) / 100; + } + } else if (widthUnit === 'px' || widthUnit === '') { + gl.svgWidth = parseInt(cnf.chart.width, 10); + } + var heightUnit = String(cnf.chart.height).toString().split(/[0-9]+/g).pop(); + if (gl.svgHeight !== 'auto' && gl.svgHeight !== '') { + if (heightUnit === '%') { + var elParentDim = Utils$1.getDimensions(this.el.parentNode); + gl.svgHeight = elParentDim[1] * parseInt(cnf.chart.height, 10) / 100; + } else { + gl.svgHeight = parseInt(cnf.chart.height, 10); + } + } else { + gl.svgHeight = gl.axisCharts ? gl.svgWidth / 1.61 : gl.svgWidth / 1.2; + } + gl.svgWidth = Math.max(gl.svgWidth, 0); + gl.svgHeight = Math.max(gl.svgHeight, 0); + Graphics.setAttrs(gl.dom.Paper.node, { + width: gl.svgWidth, + height: gl.svgHeight + }); + if (heightUnit !== '%') { + var offsetY = cnf.chart.sparkline.enabled ? 0 : gl.axisCharts ? cnf.chart.parentHeightOffset : 0; + gl.dom.Paper.node.parentNode.parentNode.style.minHeight = "".concat(gl.svgHeight + offsetY, "px"); + } + gl.dom.elWrap.style.width = "".concat(gl.svgWidth, "px"); + gl.dom.elWrap.style.height = "".concat(gl.svgHeight, "px"); + } + }, { + key: "shiftGraphPosition", + value: function shiftGraphPosition() { + var gl = this.w.globals; + var tY = gl.translateY, + tX = gl.translateX; + Graphics.setAttrs(gl.dom.elGraphical.node, { + transform: "translate(".concat(tX, ", ").concat(tY, ")") + }); + } + }, { + key: "resizeNonAxisCharts", + value: function resizeNonAxisCharts() { + var w = this.w; + var gl = w.globals; + var legendHeight = 0; + var offY = w.config.chart.sparkline.enabled ? 1 : 15; + offY += w.config.grid.padding.bottom; + if (['top', 'bottom'].includes(w.config.legend.position) && w.config.legend.show && !w.config.legend.floating) { + legendHeight = new Legend(this.ctx).legendHelpers.getLegendDimensions().clwh + 7; + } + var el = w.globals.dom.baseEl.querySelector('.apexcharts-radialbar, .apexcharts-pie'); + var chartInnerDimensions = w.globals.radialSize * 2.05; + if (el && !w.config.chart.sparkline.enabled && w.config.plotOptions.radialBar.startAngle !== 0) { + var elRadialRect = Utils$1.getBoundingClientRect(el); + chartInnerDimensions = elRadialRect.bottom; + var maxHeight = elRadialRect.bottom - elRadialRect.top; + chartInnerDimensions = Math.max(w.globals.radialSize * 2.05, maxHeight); + } + var newHeight = Math.ceil(chartInnerDimensions + gl.translateY + legendHeight + offY); + if (gl.dom.elLegendForeign) { + gl.dom.elLegendForeign.setAttribute('height', newHeight); + } + if (w.config.chart.height && String(w.config.chart.height).includes('%')) return; + gl.dom.elWrap.style.height = "".concat(newHeight, "px"); + Graphics.setAttrs(gl.dom.Paper.node, { + height: newHeight + }); + gl.dom.Paper.node.parentNode.parentNode.style.minHeight = "".concat(newHeight, "px"); + } + }, { + key: "coreCalculations", + value: function coreCalculations() { + new Range(this.ctx).init(); + } + }, { + key: "resetGlobals", + value: function resetGlobals() { + var _this = this; + var resetxyValues = function resetxyValues() { + return _this.w.config.series.map(function () { + return []; + }); + }; + var globalObj = new Globals(); + var gl = this.w.globals; + globalObj.initGlobalVars(gl); + gl.seriesXvalues = resetxyValues(); + gl.seriesYvalues = resetxyValues(); + } + }, { + key: "isMultipleY", + value: function isMultipleY() { + if (Array.isArray(this.w.config.yaxis) && this.w.config.yaxis.length > 1) { + this.w.globals.isMultipleYAxis = true; + return true; + } + return false; + } + }, { + key: "xySettings", + value: function xySettings() { + var w = this.w; + var xyRatios = null; + if (w.globals.axisCharts) { + if (w.config.xaxis.crosshairs.position === 'back') { + new Crosshairs(this.ctx).drawXCrosshairs(); + } + if (w.config.yaxis[0].crosshairs.position === 'back') { + new Crosshairs(this.ctx).drawYCrosshairs(); + } + if (w.config.xaxis.type === 'datetime' && w.config.xaxis.labels.formatter === undefined) { + this.ctx.timeScale = new TimeScale(this.ctx); + var formattedTimeScale = []; + if (isFinite(w.globals.minX) && isFinite(w.globals.maxX) && !w.globals.isBarHorizontal) { + formattedTimeScale = this.ctx.timeScale.calculateTimeScaleTicks(w.globals.minX, w.globals.maxX); + } else if (w.globals.isBarHorizontal) { + formattedTimeScale = this.ctx.timeScale.calculateTimeScaleTicks(w.globals.minY, w.globals.maxY); + } + this.ctx.timeScale.recalcDimensionsBasedOnFormat(formattedTimeScale); + } + var coreUtils = new CoreUtils(this.ctx); + xyRatios = coreUtils.getCalculatedRatios(); + } + return xyRatios; + } + }, { + key: "updateSourceChart", + value: function updateSourceChart(targetChart) { + this.ctx.w.globals.selection = undefined; + this.ctx.updateHelpers._updateOptions({ + chart: { + selection: { + xaxis: { + min: targetChart.w.globals.minX, + max: targetChart.w.globals.maxX + } + } + } + }, false, false); + } + }, { + key: "setupBrushHandler", + value: function setupBrushHandler() { + var _this2 = this; + var ctx = this.ctx, + w = this.w; + if (!w.config.chart.brush.enabled) return; + if (typeof w.config.chart.events.selection !== 'function') { + var targets = Array.isArray(w.config.chart.brush.targets) ? w.config.chart.brush.targets : [w.config.chart.brush.target]; + targets.forEach(function (target) { + var targetChart = ctx.constructor.getChartByID(target); + targetChart.w.globals.brushSource = _this2.ctx; + if (typeof targetChart.w.config.chart.events.zoomed !== 'function') { + targetChart.w.config.chart.events.zoomed = function () { + return _this2.updateSourceChart(targetChart); + }; + } + if (typeof targetChart.w.config.chart.events.scrolled !== 'function') { + targetChart.w.config.chart.events.scrolled = function () { + return _this2.updateSourceChart(targetChart); + }; + } + }); + w.config.chart.events.selection = function (chart, e) { + targets.forEach(function (target) { + var targetChart = ctx.constructor.getChartByID(target); + targetChart.ctx.updateHelpers._updateOptions({ + xaxis: { + min: e.xaxis.min, + max: e.xaxis.max + } + }, false, false, false, false); + }); + }; + } + } + }]); + return Core; + }(); + + var UpdateHelpers = /*#__PURE__*/function () { + function UpdateHelpers(ctx) { + _classCallCheck(this, UpdateHelpers); + this.ctx = ctx; + this.w = ctx.w; + } + + /** + * private method to update Options. + * + * @param {object} options - A new config object can be passed which will be merged with the existing config object + * @param {boolean} redraw - should redraw from beginning or should use existing paths and redraw from there + * @param {boolean} animate - should animate or not on updating Options + * @param {boolean} overwriteInitialConfig - should update the initial config or not + */ + _createClass(UpdateHelpers, [{ + key: "_updateOptions", + value: function _updateOptions(options) { + var _this = this; + var redraw = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + var animate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + var updateSyncedCharts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; + var overwriteInitialConfig = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; + return new Promise(function (resolve) { + var charts = [_this.ctx]; + if (updateSyncedCharts) { + charts = _this.ctx.getSyncedCharts(); + } + if (_this.ctx.w.globals.isExecCalled) { + // If the user called exec method, we don't want to get grouped charts as user specifically provided a chartID to update + charts = [_this.ctx]; + _this.ctx.w.globals.isExecCalled = false; + } + charts.forEach(function (ch, chartIndex) { + var w = ch.w; + w.globals.shouldAnimate = animate; + if (!redraw) { + w.globals.resized = true; + w.globals.dataChanged = true; + if (animate) { + ch.series.getPreviousPaths(); + } + } + if (options && _typeof(options) === 'object') { + ch.config = new Config(options); + options = CoreUtils.extendArrayProps(ch.config, options, w); + + // fixes #914, #623 + if (ch.w.globals.chartID !== _this.ctx.w.globals.chartID) { + // don't overwrite series of synchronized charts + delete options.series; + } + w.config = Utils$1.extend(w.config, options); + if (overwriteInitialConfig) { + // we need to forget the lastXAxis and lastYAxis as user forcefully overwriteInitialConfig. If we do not do this, and next time when user zooms the chart after setting yaxis.min/max or xaxis.min/max - the stored lastXAxis will never allow the chart to use the updated min/max by user. + w.globals.lastXAxis = options.xaxis ? Utils$1.clone(options.xaxis) : []; + w.globals.lastYAxis = options.yaxis ? Utils$1.clone(options.yaxis) : []; + + // After forgetting lastAxes, we need to restore the new config in initialConfig/initialSeries + w.globals.initialConfig = Utils$1.extend({}, w.config); + w.globals.initialSeries = Utils$1.clone(w.config.series); + if (options.series) { + // Replace the collapsed series data + for (var i = 0; i < w.globals.collapsedSeriesIndices.length; i++) { + var series = w.config.series[w.globals.collapsedSeriesIndices[i]]; + w.globals.collapsedSeries[i].data = w.globals.axisCharts ? series.data.slice() : series; + } + for (var _i = 0; _i < w.globals.ancillaryCollapsedSeriesIndices.length; _i++) { + var _series = w.config.series[w.globals.ancillaryCollapsedSeriesIndices[_i]]; + w.globals.ancillaryCollapsedSeries[_i].data = w.globals.axisCharts ? _series.data.slice() : _series; + } + + // Ensure that auto-generated axes are scaled to the visible data + ch.series.emptyCollapsedSeries(w.config.series); + } + } + } + return ch.update(options).then(function () { + if (chartIndex === charts.length - 1) { + resolve(ch); + } + }); + }); + }); + } + + /** + * Private method to update Series. + * + * @param {array} series - New series which will override the existing + */ + }, { + key: "_updateSeries", + value: function _updateSeries(newSeries, animate) { + var _this2 = this; + var overwriteInitialSeries = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + return new Promise(function (resolve) { + var w = _this2.w; + w.globals.shouldAnimate = animate; + w.globals.dataChanged = true; + if (animate) { + _this2.ctx.series.getPreviousPaths(); + } + var existingSeries; + + // axis charts + if (w.globals.axisCharts) { + existingSeries = newSeries.map(function (s, i) { + return _this2._extendSeries(s, i); + }); + if (existingSeries.length === 0) { + existingSeries = [{ + data: [] + }]; + } + w.config.series = existingSeries; + } else { + // non-axis chart (pie/radialbar) + w.config.series = newSeries.slice(); + } + if (overwriteInitialSeries) { + w.globals.initialConfig.series = Utils$1.clone(w.config.series); + w.globals.initialSeries = Utils$1.clone(w.config.series); + } + return _this2.ctx.update().then(function () { + resolve(_this2.ctx); + }); + }); + } + }, { + key: "_extendSeries", + value: function _extendSeries(s, i) { + var w = this.w; + var ser = w.config.series[i]; + return _objectSpread2(_objectSpread2({}, w.config.series[i]), {}, { + name: s.name ? s.name : ser === null || ser === void 0 ? void 0 : ser.name, + color: s.color ? s.color : ser === null || ser === void 0 ? void 0 : ser.color, + type: s.type ? s.type : ser === null || ser === void 0 ? void 0 : ser.type, + group: s.group ? s.group : ser === null || ser === void 0 ? void 0 : ser.group, + hidden: typeof s.hidden !== 'undefined' ? s.hidden : ser === null || ser === void 0 ? void 0 : ser.hidden, + data: s.data ? s.data : ser === null || ser === void 0 ? void 0 : ser.data, + zIndex: typeof s.zIndex !== 'undefined' ? s.zIndex : i + }); + } + }, { + key: "toggleDataPointSelection", + value: function toggleDataPointSelection(seriesIndex, dataPointIndex) { + var w = this.w; + var elPath = null; + var parent = ".apexcharts-series[data\\:realIndex='".concat(seriesIndex, "']"); + if (w.globals.axisCharts) { + elPath = w.globals.dom.Paper.findOne("".concat(parent, " path[j='").concat(dataPointIndex, "'], ").concat(parent, " circle[j='").concat(dataPointIndex, "'], ").concat(parent, " rect[j='").concat(dataPointIndex, "']")); + } else { + // dataPointIndex will be undefined here, hence using seriesIndex + if (typeof dataPointIndex === 'undefined') { + elPath = w.globals.dom.Paper.findOne("".concat(parent, " path[j='").concat(seriesIndex, "']")); + if (w.config.chart.type === 'pie' || w.config.chart.type === 'polarArea' || w.config.chart.type === 'donut') { + this.ctx.pie.pieClicked(seriesIndex); + } + } + } + if (elPath) { + var graphics = new Graphics(this.ctx); + graphics.pathMouseDown(elPath, null); + } else { + console.warn('toggleDataPointSelection: Element not found'); + return null; + } + return elPath.node ? elPath.node : null; + } + }, { + key: "forceXAxisUpdate", + value: function forceXAxisUpdate(options) { + var w = this.w; + var minmax = ['min', 'max']; + minmax.forEach(function (a) { + if (typeof options.xaxis[a] !== 'undefined') { + w.config.xaxis[a] = options.xaxis[a]; + w.globals.lastXAxis[a] = options.xaxis[a]; + } + }); + if (options.xaxis.categories && options.xaxis.categories.length) { + w.config.xaxis.categories = options.xaxis.categories; + } + if (w.config.xaxis.convertedCatToNumeric) { + var defaults = new Defaults(options); + options = defaults.convertCatToNumericXaxis(options, this.ctx); + } + return options; + } + }, { + key: "forceYAxisUpdate", + value: function forceYAxisUpdate(options) { + if (options.chart && options.chart.stacked && options.chart.stackType === '100%') { + if (Array.isArray(options.yaxis)) { + options.yaxis.forEach(function (yaxe, index) { + options.yaxis[index].min = 0; + options.yaxis[index].max = 100; + }); + } else { + options.yaxis.min = 0; + options.yaxis.max = 100; + } + } + return options; + } + + /** + * This function reverts the yaxis and xaxis min/max values to what it was when the chart was defined. + * This function fixes an important bug where a user might load a new series after zooming in/out of previous series which resulted in wrong min/max + * Also, this should never be called internally on zoom/pan - the reset should only happen when user calls the updateSeries() function externally + * The function also accepts an object {xaxis, yaxis} which when present is set as the new xaxis/yaxis + */ + }, { + key: "revertDefaultAxisMinMax", + value: function revertDefaultAxisMinMax(opts) { + var _this3 = this; + var w = this.w; + var xaxis = w.globals.lastXAxis; + var yaxis = w.globals.lastYAxis; + if (opts && opts.xaxis) { + xaxis = opts.xaxis; + } + if (opts && opts.yaxis) { + yaxis = opts.yaxis; + } + w.config.xaxis.min = xaxis.min; + w.config.xaxis.max = xaxis.max; + var getLastYAxis = function getLastYAxis(index) { + if (typeof yaxis[index] !== 'undefined') { + w.config.yaxis[index].min = yaxis[index].min; + w.config.yaxis[index].max = yaxis[index].max; + } + }; + w.config.yaxis.map(function (yaxe, index) { + if (w.globals.zoomed) { + // user has zoomed, check the last yaxis + getLastYAxis(index); + } else { + // user hasn't zoomed, check the last yaxis first + if (typeof yaxis[index] !== 'undefined') { + getLastYAxis(index); + } else { + // if last y-axis don't exist, check the original yaxis + if (typeof _this3.ctx.opts.yaxis[index] !== 'undefined') { + yaxe.min = _this3.ctx.opts.yaxis[index].min; + yaxe.max = _this3.ctx.opts.yaxis[index].max; + } + } + } + }); + } + }]); + return UpdateHelpers; + }(); + + (function () { + + extend(PathArray, { + morph: function morph(fromArray, toArray, pos, stepper, context) { + var startArr = this.parse(fromArray), + destArr = this.parse(toArray); + var startOffsetM = 0, + destOffsetM = 0; + var startOffsetNextM = false, + destOffsetNextM = false; + while (true) { + // stop if there is no M anymore + if (startOffsetM === false && destOffsetM === false) break; + + // find the next M in path array + startOffsetNextM = findNextM(startArr, startOffsetM === false ? false : startOffsetM + 1); + destOffsetNextM = findNextM(destArr, destOffsetM === false ? false : destOffsetM + 1); + + // We have to add one M to the startArray + if (startOffsetM === false) { + var bbox = new PathArray(result.start).bbox(); + + // when the last block had no bounding box we simply take the first M we got + if (bbox.height == 0 || bbox.width == 0) { + startOffsetM = startArr.push(startArr[0]) - 1; + } else { + // we take the middle of the bbox instead when we got one + startOffsetM = startArr.push(['M', bbox.x + bbox.width / 2, bbox.y + bbox.height / 2]) - 1; + } + } + + // We have to add one M to the destArray + if (destOffsetM === false) { + var bbox = new PathArray(result.dest).bbox(); + if (bbox.height == 0 || bbox.width == 0) { + destOffsetM = destArr.push(destArr[0]) - 1; + } else { + destOffsetM = destArr.push(['M', bbox.x + bbox.width / 2, bbox.y + bbox.height / 2]) - 1; + } + } + + // handle block from M to next M + var result = handleBlock(startArr, startOffsetM, startOffsetNextM, destArr, destOffsetM, destOffsetNextM); + + // update the arrays to their new values + startArr = startArr.slice(0, startOffsetM).concat(result.start, startOffsetNextM === false ? [] : startArr.slice(startOffsetNextM)); + destArr = destArr.slice(0, destOffsetM).concat(result.dest, destOffsetNextM === false ? [] : destArr.slice(destOffsetNextM)); + + // update offsets + startOffsetM = startOffsetNextM === false ? false : startOffsetM + result.start.length; + destOffsetM = destOffsetNextM === false ? false : destOffsetM + result.dest.length; + } + + // copy back arrays + this._array = startArr; + this.destination = new PathArray(); + this.destination._array = destArr; + var finalArr = this.fromArray(startArr.map(function (from, fromIndex) { + var step = destArr[fromIndex].map(function (to, toIndex) { + if (toIndex === 0) return to; + return stepper.step(from[toIndex], destArr[fromIndex][toIndex], pos, context[fromIndex], context); + }); + return step; + })); + return finalArr; + } + }); + + // sorry for the long declaration + // slices out one block (from M to M) and syncronize it so the types and length match + function handleBlock() { + var startArr = arguments.length > 0 && arguments[0] !== undefined$1 ? arguments[0] : []; + var startOffsetM = arguments.length > 1 ? arguments[1] : undefined$1; + var startOffsetNextM = arguments.length > 2 ? arguments[2] : undefined$1; + var destArr = arguments.length > 3 ? arguments[3] : undefined$1; + var destOffsetM = arguments.length > 4 ? arguments[4] : undefined$1; + var destOffsetNextM = arguments.length > 5 ? arguments[5] : undefined$1; + var undefined$1 = arguments.length > 6 ? arguments[6] : undefined$1; + // slice out the block we need + var startArrTemp = startArr.slice(startOffsetM, startOffsetNextM || undefined$1), + destArrTemp = destArr.slice(destOffsetM, destOffsetNextM || undefined$1); + var i = 0, + posStart = { + pos: [0, 0], + start: [0, 0] + }, + posDest = { + pos: [0, 0], + start: [0, 0] + }; + do { + // convert shorthand types to long form + startArrTemp[i] = simplyfy.call(posStart, startArrTemp[i]); + destArrTemp[i] = simplyfy.call(posDest, destArrTemp[i]); + + // check if both shape types match + // 2 elliptical arc curve commands ('A'), are considered different if the + // flags (large-arc-flag, sweep-flag) don't match + if (startArrTemp[i][0] != destArrTemp[i][0] || startArrTemp[i][0] == 'M' || startArrTemp[i][0] == 'A' && (startArrTemp[i][4] != destArrTemp[i][4] || startArrTemp[i][5] != destArrTemp[i][5])) { + // if not, convert shapes to beziere + Array.prototype.splice.apply(startArrTemp, [i, 1].concat(toBeziere.call(posStart, startArrTemp[i]))); + Array.prototype.splice.apply(destArrTemp, [i, 1].concat(toBeziere.call(posDest, destArrTemp[i]))); + } else { + // only update positions otherwise + startArrTemp[i] = setPosAndReflection.call(posStart, startArrTemp[i]); + destArrTemp[i] = setPosAndReflection.call(posDest, destArrTemp[i]); + } + + // we are at the end at both arrays. stop here + if (++i == startArrTemp.length && i == destArrTemp.length) break; + + // destArray is longer. Add one element + if (i == startArrTemp.length) { + startArrTemp.push(['C', posStart.pos[0], posStart.pos[1], posStart.pos[0], posStart.pos[1], posStart.pos[0], posStart.pos[1]]); + } + + // startArr is longer. Add one element + if (i == destArrTemp.length) { + destArrTemp.push(['C', posDest.pos[0], posDest.pos[1], posDest.pos[0], posDest.pos[1], posDest.pos[0], posDest.pos[1]]); + } + } while (true); + + // return the updated block + return { + start: startArrTemp, + dest: destArrTemp + }; + } + + // converts shorthand types to long form + function simplyfy(val) { + switch (val[0]) { + case 'z': // shorthand line to start + case 'Z': + val[0] = 'L'; + val[1] = this.start[0]; + val[2] = this.start[1]; + break; + case 'H': + // shorthand horizontal line + val[0] = 'L'; + val[2] = this.pos[1]; + break; + case 'V': + // shorthand vertical line + val[0] = 'L'; + val[2] = val[1]; + val[1] = this.pos[0]; + break; + case 'T': + // shorthand quadratic beziere + val[0] = 'Q'; + val[3] = val[1]; + val[4] = val[2]; + val[1] = this.reflection[1]; + val[2] = this.reflection[0]; + break; + case 'S': + // shorthand cubic beziere + val[0] = 'C'; + val[6] = val[4]; + val[5] = val[3]; + val[4] = val[2]; + val[3] = val[1]; + val[2] = this.reflection[1]; + val[1] = this.reflection[0]; + break; + } + return val; + } + + // updates reflection point and current position + function setPosAndReflection(val) { + var len = val.length; + this.pos = [val[len - 2], val[len - 1]]; + if ('SCQT'.indexOf(val[0]) != -1) this.reflection = [2 * this.pos[0] - val[len - 4], 2 * this.pos[1] - val[len - 3]]; + return val; + } + + // converts all types to cubic beziere + function toBeziere(val) { + var retVal = [val]; + switch (val[0]) { + case 'M': + // special handling for M + this.pos = this.start = [val[1], val[2]]; + return retVal; + case 'L': + val[5] = val[3] = val[1]; + val[6] = val[4] = val[2]; + val[1] = this.pos[0]; + val[2] = this.pos[1]; + break; + case 'Q': + val[6] = val[4]; + val[5] = val[3]; + val[4] = val[4] * 1 / 3 + val[2] * 2 / 3; + val[3] = val[3] * 1 / 3 + val[1] * 2 / 3; + val[2] = this.pos[1] * 1 / 3 + val[2] * 2 / 3; + val[1] = this.pos[0] * 1 / 3 + val[1] * 2 / 3; + break; + case 'A': + retVal = arcToBeziere(this.pos, val); + val = retVal[0]; + break; + } + val[0] = 'C'; + this.pos = [val[5], val[6]]; + this.reflection = [2 * val[5] - val[3], 2 * val[6] - val[4]]; + return retVal; + } + + // finds the next position of type M + function findNextM() { + var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + var offset = arguments.length > 1 ? arguments[1] : undefined; + if (offset === false) return false; + for (var i = offset, len = arr.length; i < len; ++i) { + if (arr[i][0] == 'M') return i; + } + return false; + } + + // Convert an arc segment into equivalent cubic Bezier curves + // Depending on the arc, up to 4 curves might be used to represent it since a + // curve gives a good approximation for only a quarter of an ellipse + // The curves are returned as an array of SVG curve commands: + // [ ['C', x1, y1, x2, y2, x, y] ... ] + function arcToBeziere(pos, val) { + // Parameters extraction, handle out-of-range parameters as specified in the SVG spec + // See: https://www.w3.org/TR/SVG11/implnote.html#ArcOutOfRangeParameters + var rx = Math.abs(val[1]), + ry = Math.abs(val[2]), + xAxisRotation = val[3] % 360, + largeArcFlag = val[4], + sweepFlag = val[5], + x = val[6], + y = val[7], + A = new Point(pos), + B = new Point(x, y), + primedCoord, + lambda, + mat, + k, + c, + cSquare, + t, + O, + OA, + OB, + tetaStart, + tetaEnd, + deltaTeta, + nbSectors, + f, + arcSegPoints, + angle, + sinAngle, + cosAngle, + pt, + i, + il, + retVal = [], + x1, + y1, + x2, + y2; + + // Ensure radii are non-zero + if (rx === 0 || ry === 0 || A.x === B.x && A.y === B.y) { + // treat this arc as a straight line segment + return [['C', A.x, A.y, B.x, B.y, B.x, B.y]]; + } + + // Ensure radii are large enough using the algorithm provided in the SVG spec + // See: https://www.w3.org/TR/SVG11/implnote.html#ArcCorrectionOutOfRangeRadii + primedCoord = new Point((A.x - B.x) / 2, (A.y - B.y) / 2).transform(new Matrix().rotate(xAxisRotation)); + lambda = primedCoord.x * primedCoord.x / (rx * rx) + primedCoord.y * primedCoord.y / (ry * ry); + if (lambda > 1) { + lambda = Math.sqrt(lambda); + rx = lambda * rx; + ry = lambda * ry; + } + + // To simplify calculations, we make the arc part of a unit circle (rayon is 1) instead of an ellipse + mat = new Matrix().rotate(xAxisRotation).scale(1 / rx, 1 / ry).rotate(-xAxisRotation); + A = A.transform(mat); + B = B.transform(mat); + + // Calculate the horizontal and vertical distance between the initial and final point of the arc + k = [B.x - A.x, B.y - A.y]; + + // Find the length of the chord formed by A and B + cSquare = k[0] * k[0] + k[1] * k[1]; + c = Math.sqrt(cSquare); + + // Calculate the ratios of the horizontal and vertical distance on the length of the chord + k[0] /= c; + k[1] /= c; + + // Calculate the distance between the circle center and the chord midpoint + // using this formula: t = sqrt(r^2 - c^2 / 4) + // where t is the distance between the cirle center and the chord midpoint, + // r is the rayon of the circle and c is the chord length + // From: http://www.ajdesigner.com/phpcircle/circle_segment_chord_t.php + // Because of the imprecision of floating point numbers, cSquare might end + // up being slightly above 4 which would result in a negative radicand + // To prevent that, a test is made before computing the square root + t = cSquare < 4 ? Math.sqrt(1 - cSquare / 4) : 0; + + // For most situations, there are actually two different ellipses that + // satisfy the constraints imposed by the points A and B, the radii rx and ry, + // and the xAxisRotation + // When the flags largeArcFlag and sweepFlag are equal, it means that the + // second ellipse is used as a solution + // See: https://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands + if (largeArcFlag === sweepFlag) { + t *= -1; + } + + // Calculate the coordinates of the center of the circle from the midpoint of the chord + // This is done by multiplying the ratios calculated previously by the distance between + // the circle center and the chord midpoint and using these values to go from the midpoint + // to the center of the circle + // The negative of the vertical distance ratio is used to modify the x coordinate while + // the horizontal distance ratio is used to modify the y coordinate + // That is because the center of the circle is perpendicular to the chord and perpendicular + // lines are negative reciprocals + O = new Point((B.x + A.x) / 2 + t * -k[1], (B.y + A.y) / 2 + t * k[0]); + // Move the center of the circle at the origin + OA = new Point(A.x - O.x, A.y - O.y); + OB = new Point(B.x - O.x, B.y - O.y); + + // Calculate the start and end angle + tetaStart = Math.acos(OA.x / Math.sqrt(OA.x * OA.x + OA.y * OA.y)); + if (OA.y < 0) { + tetaStart *= -1; + } + tetaEnd = Math.acos(OB.x / Math.sqrt(OB.x * OB.x + OB.y * OB.y)); + if (OB.y < 0) { + tetaEnd *= -1; + } + + // If sweep-flag is '1', then the arc will be drawn in a "positive-angle" direction, + // make sure that the end angle is above the start angle + if (sweepFlag && tetaStart > tetaEnd) { + tetaEnd += 2 * Math.PI; + } + // If sweep-flag is '0', then the arc will be drawn in a "negative-angle" direction, + // make sure that the end angle is below the start angle + if (!sweepFlag && tetaStart < tetaEnd) { + tetaEnd -= 2 * Math.PI; + } + + // Find the number of Bezier curves that are required to represent the arc + // A cubic Bezier curve gives a good enough approximation when representing at most a quarter of a circle + nbSectors = Math.ceil(Math.abs(tetaStart - tetaEnd) * 2 / Math.PI); + + // Calculate the coordinates of the points of all the Bezier curves required to represent the arc + // For an in-depth explanation of this part see: http://pomax.github.io/bezierinfo/#circles_cubic + arcSegPoints = []; + angle = tetaStart; + deltaTeta = (tetaEnd - tetaStart) / nbSectors; + f = 4 * Math.tan(deltaTeta / 4) / 3; + for (i = 0; i <= nbSectors; i++) { + // The <= is because a Bezier curve have a start and a endpoint + cosAngle = Math.cos(angle); + sinAngle = Math.sin(angle); + pt = new Point(O.x + cosAngle, O.y + sinAngle); + arcSegPoints[i] = [new Point(pt.x + f * sinAngle, pt.y - f * cosAngle), pt, new Point(pt.x - f * sinAngle, pt.y + f * cosAngle)]; + angle += deltaTeta; + } + + // Remove the first control point of the first segment point and remove the second control point of the last segment point + // These two control points are not used in the approximation of the arc, that is why they are removed + arcSegPoints[0][0] = arcSegPoints[0][1].clone(); + arcSegPoints[arcSegPoints.length - 1][2] = arcSegPoints[arcSegPoints.length - 1][1].clone(); + + // Revert the transformation that was applied to make the arc part of a unit circle instead of an ellipse + mat = new Matrix().rotate(xAxisRotation).scale(rx, ry).rotate(-xAxisRotation); + for (i = 0, il = arcSegPoints.length; i < il; i++) { + arcSegPoints[i][0] = arcSegPoints[i][0].transform(mat); + arcSegPoints[i][1] = arcSegPoints[i][1].transform(mat); + arcSegPoints[i][2] = arcSegPoints[i][2].transform(mat); + } + + // Convert the segments points to SVG curve commands + for (i = 1, il = arcSegPoints.length; i < il; i++) { + pt = arcSegPoints[i - 1][2]; + x1 = pt.x; + y1 = pt.y; + pt = arcSegPoints[i][0]; + x2 = pt.x; + y2 = pt.y; + pt = arcSegPoints[i][1]; + x = pt.x; + y = pt.y; + retVal.push(['C', x1, y1, x2, y2, x, y]); + } + return retVal; + } + })(); + + const getCoordsFromEvent$1 = (ev) => { + if (ev.changedTouches) { + ev = ev.changedTouches[0]; + } + return { x: ev.clientX, y: ev.clientY } + }; + + // Creates handler, saves it + class DragHandler { + constructor(el) { + el.remember('_draggable', this); + this.el = el; + + this.drag = this.drag.bind(this); + this.startDrag = this.startDrag.bind(this); + this.endDrag = this.endDrag.bind(this); + } + + // Enables or disabled drag based on input + init(enabled) { + if (enabled) { + this.el.on('mousedown.drag', this.startDrag); + this.el.on('touchstart.drag', this.startDrag, { passive: false }); + } else { + this.el.off('mousedown.drag'); + this.el.off('touchstart.drag'); + } + } + + // Start dragging + startDrag(ev) { + const isMouse = !ev.type.indexOf('mouse'); + + // Check for left button + if (isMouse && ev.which !== 1 && ev.buttons !== 0) { + return + } + + // Fire beforedrag event + if ( + this.el.dispatch('beforedrag', { event: ev, handler: this }) + .defaultPrevented + ) { + return + } + + // Prevent browser drag behavior as soon as possible + ev.preventDefault(); + + // Prevent propagation to a parent that might also have dragging enabled + ev.stopPropagation(); + + // Make sure that start events are unbound so that one element + // is only dragged by one input only + this.init(false); + + this.box = this.el.bbox(); + this.lastClick = this.el.point(getCoordsFromEvent$1(ev)); + + const eventMove = (isMouse ? 'mousemove' : 'touchmove') + '.drag'; + const eventEnd = (isMouse ? 'mouseup' : 'touchend') + '.drag'; + + // Bind drag and end events to window + on(window, eventMove, this.drag, this, { passive: false }); + on(window, eventEnd, this.endDrag, this, { passive: false }); + + // Fire dragstart event + this.el.fire('dragstart', { event: ev, handler: this, box: this.box }); + } + + // While dragging + drag(ev) { + const { box, lastClick } = this; + + const currentClick = this.el.point(getCoordsFromEvent$1(ev)); + const dx = currentClick.x - lastClick.x; + const dy = currentClick.y - lastClick.y; + + if (!dx && !dy) return box + + const x = box.x + dx; + const y = box.y + dy; + this.box = new Box(x, y, box.w, box.h); + this.lastClick = currentClick; + + if ( + this.el.dispatch('dragmove', { + event: ev, + handler: this, + box: this.box, + }).defaultPrevented + ) { + return + } + + this.move(x, y); + } + + move(x, y) { + // Svg elements bbox depends on their content even though they have + // x, y, width and height - strange! + // Thats why we handle them the same as groups + if (this.el.type === 'svg') { + G.prototype.move.call(this.el, x, y); + } else { + this.el.move(x, y); + } + } + + endDrag(ev) { + // final drag + this.drag(ev); + + // fire dragend event + this.el.fire('dragend', { event: ev, handler: this, box: this.box }); + + // unbind events + off(window, 'mousemove.drag'); + off(window, 'touchmove.drag'); + off(window, 'mouseup.drag'); + off(window, 'touchend.drag'); + + // Rebind initial Events + this.init(true); + } + } + + extend(Element$1, { + draggable(enable = true) { + const dragHandler = this.remember('_draggable') || new DragHandler(this); + dragHandler.init(enable); + return this + }, + }); + + /*! + * @svgdotjs/svg.select.js - An extension of svg.js which allows to select elements with mouse + * @version 4.0.1 + * https://github.com/svgdotjs/svg.select.js + * + * @copyright Ulrich-Matthias Schäfer + * @license MIT + * + * BUILT: Mon Jul 01 2024 15:04:42 GMT+0200 (Central European Summer Time) + */ + function getMoseDownFunc$1(eventName, el, points, index = null) { + return function(ev) { + ev.preventDefault(); + ev.stopPropagation(); + var x = ev.pageX || ev.touches[0].pageX; + var y = ev.pageY || ev.touches[0].pageY; + el.fire(eventName, { x, y, event: ev, index, points }); + }; + } + function transformPoint$1([x, y], { a, b, c, d, e, f }) { + return [x * a + y * c + e, x * b + y * d + f]; + } + let SelectHandler$1 = class SelectHandler { + constructor(el) { + this.el = el; + el.remember("_selectHandler", this); + this.selection = new G(); + this.order = ["lt", "t", "rt", "r", "rb", "b", "lb", "l", "rot"]; + this.mutationHandler = this.mutationHandler.bind(this); + const win = getWindow(); + this.observer = new win.MutationObserver(this.mutationHandler); + } + init(options) { + this.createHandle = options.createHandle || this.createHandleFn; + this.createRot = options.createRot || this.createRotFn; + this.updateHandle = options.updateHandle || this.updateHandleFn; + this.updateRot = options.updateRot || this.updateRotFn; + this.el.root().put(this.selection); + this.updatePoints(); + this.createSelection(); + this.createResizeHandles(); + this.updateResizeHandles(); + this.createRotationHandle(); + this.updateRotationHandle(); + this.observer.observe(this.el.node, { attributes: true }); + } + active(val, options) { + if (!val) { + this.selection.clear().remove(); + this.observer.disconnect(); + return; + } + this.init(options); + } + createSelection() { + this.selection.polygon(this.handlePoints).addClass("svg_select_shape"); + } + updateSelection() { + this.selection.get(0).plot(this.handlePoints); + } + createResizeHandles() { + this.handlePoints.forEach((p, index, arr) => { + const name = this.order[index]; + this.createHandle.call(this, this.selection, p, index, arr, name); + this.selection.get(index + 1).addClass("svg_select_handle svg_select_handle_" + name).on("mousedown.selection touchstart.selection", getMoseDownFunc$1(name, this.el, this.handlePoints, index)); + }); + } + createHandleFn(group) { + group.polyline(); + } + updateHandleFn(shape, point, index, arr) { + const before = arr.at(index - 1); + const next = arr[(index + 1) % arr.length]; + const p = point; + const diff1 = [p[0] - before[0], p[1] - before[1]]; + const diff2 = [p[0] - next[0], p[1] - next[1]]; + const len1 = Math.sqrt(diff1[0] * diff1[0] + diff1[1] * diff1[1]); + const len2 = Math.sqrt(diff2[0] * diff2[0] + diff2[1] * diff2[1]); + const normalized1 = [diff1[0] / len1, diff1[1] / len1]; + const normalized2 = [diff2[0] / len2, diff2[1] / len2]; + const beforeNew = [p[0] - normalized1[0] * 10, p[1] - normalized1[1] * 10]; + const nextNew = [p[0] - normalized2[0] * 10, p[1] - normalized2[1] * 10]; + shape.plot([beforeNew, p, nextNew]); + } + updateResizeHandles() { + this.handlePoints.forEach((p, index, arr) => { + const name = this.order[index]; + this.updateHandle.call(this, this.selection.get(index + 1), p, index, arr, name); + }); + } + createRotFn(group) { + group.line(); + group.circle(5); + } + getPoint(name) { + return this.handlePoints[this.order.indexOf(name)]; + } + getPointHandle(name) { + return this.selection.get(this.order.indexOf(name) + 1); + } + updateRotFn(group, rotPoint) { + const topPoint = this.getPoint("t"); + group.get(0).plot(topPoint[0], topPoint[1], rotPoint[0], rotPoint[1]); + group.get(1).center(rotPoint[0], rotPoint[1]); + } + createRotationHandle() { + const handle = this.selection.group().addClass("svg_select_handle_rot").on("mousedown.selection touchstart.selection", getMoseDownFunc$1("rot", this.el, this.handlePoints)); + this.createRot.call(this, handle); + } + updateRotationHandle() { + const group = this.selection.findOne("g.svg_select_handle_rot"); + this.updateRot(group, this.rotationPoint, this.handlePoints); + } + // gets new bounding box points and transform them into the elements space + updatePoints() { + const bbox = this.el.bbox(); + const fromShapeToUiMatrix = this.el.parent().screenCTM().inverseO().multiplyO(this.el.screenCTM()); + this.handlePoints = this.getHandlePoints(bbox).map((p) => transformPoint$1(p, fromShapeToUiMatrix)); + this.rotationPoint = transformPoint$1(this.getRotationPoint(bbox), fromShapeToUiMatrix); + } + // A collection of all the points we need to draw our ui + getHandlePoints({ x, x2, y, y2, cx, cy } = this.el.bbox()) { + return [ + [x, y], + [cx, y], + [x2, y], + [x2, cy], + [x2, y2], + [cx, y2], + [x, y2], + [x, cy] + ]; + } + // A collection of all the points we need to draw our ui + getRotationPoint({ y, cx } = this.el.bbox()) { + return [cx, y - 20]; + } + mutationHandler() { + this.updatePoints(); + this.updateSelection(); + this.updateResizeHandles(); + this.updateRotationHandle(); + } + }; + let PointSelectHandler$1 = class PointSelectHandler { + constructor(el) { + this.el = el; + el.remember("_pointSelectHandler", this); + this.selection = new G(); + this.order = ["lt", "t", "rt", "r", "rb", "b", "lb", "l", "rot"]; + this.mutationHandler = this.mutationHandler.bind(this); + const win = getWindow(); + this.observer = new win.MutationObserver(this.mutationHandler); + } + init(options) { + this.createHandle = options.createHandle || this.createHandleFn; + this.updateHandle = options.updateHandle || this.updateHandleFn; + this.el.root().put(this.selection); + this.updatePoints(); + this.createSelection(); + this.createPointHandles(); + this.updatePointHandles(); + this.observer.observe(this.el.node, { attributes: true }); + } + active(val, options) { + if (!val) { + this.selection.clear().remove(); + this.observer.disconnect(); + return; + } + this.init(options); + } + createSelection() { + this.selection.polygon(this.points).addClass("svg_select_shape_pointSelect"); + } + updateSelection() { + this.selection.get(0).plot(this.points); + } + createPointHandles() { + this.points.forEach((p, index, arr) => { + this.createHandle.call(this, this.selection, p, index, arr); + this.selection.get(index + 1).addClass("svg_select_handle_point").on("mousedown.selection touchstart.selection", getMoseDownFunc$1("point", this.el, this.points, index)); + }); + } + createHandleFn(group) { + group.circle(5); + } + updateHandleFn(shape, point) { + shape.center(point[0], point[1]); + } + updatePointHandles() { + this.points.forEach((p, index, arr) => { + this.updateHandle.call(this, this.selection.get(index + 1), p, index, arr); + }); + } + // gets new bounding box points and transform them into the elements space + updatePoints() { + const fromShapeToUiMatrix = this.el.parent().screenCTM().inverseO().multiplyO(this.el.screenCTM()); + this.points = this.el.array().map((p) => transformPoint$1(p, fromShapeToUiMatrix)); + } + mutationHandler() { + this.updatePoints(); + this.updateSelection(); + this.updatePointHandles(); + } + }; + const getSelectFn$1 = (handleClass) => { + return function(enabled = true, options = {}) { + if (typeof enabled === "object") { + options = enabled; + enabled = true; + } + let selectHandler = this.remember("_" + handleClass.name); + if (!selectHandler) { + if (enabled.prototype instanceof SelectHandler$1) { + selectHandler = new enabled(this); + enabled = true; + } else { + selectHandler = new handleClass(this); + } + this.remember("_" + handleClass.name, selectHandler); + } + selectHandler.active(enabled, options); + return this; + }; + }; + extend(Element$1, { + select: getSelectFn$1(SelectHandler$1) + }); + extend([Polygon, Polyline, Line$1], { + pointSelect: getSelectFn$1(PointSelectHandler$1) + }); + + /*! + * @svgdotjs/svg.resize.js - An extension for svg.js which allows to resize elements which are selected + * @version 2.0.4 + * https://github.com/svgdotjs/svg.resize.js + * + * @copyright [object Object] + * @license MIT + * + * BUILT: Fri Sep 13 2024 12:43:14 GMT+0200 (Central European Summer Time) + */ + /*! + * @svgdotjs/svg.select.js - An extension of svg.js which allows to select elements with mouse + * @version 4.0.1 + * https://github.com/svgdotjs/svg.select.js + * + * @copyright Ulrich-Matthias Schäfer + * @license MIT + * + * BUILT: Mon Jul 01 2024 15:04:42 GMT+0200 (Central European Summer Time) + */ + function getMoseDownFunc(eventName, el, points, index = null) { + return function(ev) { + ev.preventDefault(); + ev.stopPropagation(); + var x = ev.pageX || ev.touches[0].pageX; + var y = ev.pageY || ev.touches[0].pageY; + el.fire(eventName, { x, y, event: ev, index, points }); + }; + } + function transformPoint([x, y], { a, b, c, d, e, f }) { + return [x * a + y * c + e, x * b + y * d + f]; + } + class SelectHandler { + constructor(el) { + this.el = el; + el.remember("_selectHandler", this); + this.selection = new G(); + this.order = ["lt", "t", "rt", "r", "rb", "b", "lb", "l", "rot"]; + this.mutationHandler = this.mutationHandler.bind(this); + const win = getWindow(); + this.observer = new win.MutationObserver(this.mutationHandler); + } + init(options) { + this.createHandle = options.createHandle || this.createHandleFn; + this.createRot = options.createRot || this.createRotFn; + this.updateHandle = options.updateHandle || this.updateHandleFn; + this.updateRot = options.updateRot || this.updateRotFn; + this.el.root().put(this.selection); + this.updatePoints(); + this.createSelection(); + this.createResizeHandles(); + this.updateResizeHandles(); + this.createRotationHandle(); + this.updateRotationHandle(); + this.observer.observe(this.el.node, { attributes: true }); + } + active(val, options) { + if (!val) { + this.selection.clear().remove(); + this.observer.disconnect(); + return; + } + this.init(options); + } + createSelection() { + this.selection.polygon(this.handlePoints).addClass("svg_select_shape"); + } + updateSelection() { + this.selection.get(0).plot(this.handlePoints); + } + createResizeHandles() { + this.handlePoints.forEach((p, index, arr) => { + const name = this.order[index]; + this.createHandle.call(this, this.selection, p, index, arr, name); + this.selection.get(index + 1).addClass("svg_select_handle svg_select_handle_" + name).on("mousedown.selection touchstart.selection", getMoseDownFunc(name, this.el, this.handlePoints, index)); + }); + } + createHandleFn(group) { + group.polyline(); + } + updateHandleFn(shape, point, index, arr) { + const before = arr.at(index - 1); + const next = arr[(index + 1) % arr.length]; + const p = point; + const diff1 = [p[0] - before[0], p[1] - before[1]]; + const diff2 = [p[0] - next[0], p[1] - next[1]]; + const len1 = Math.sqrt(diff1[0] * diff1[0] + diff1[1] * diff1[1]); + const len2 = Math.sqrt(diff2[0] * diff2[0] + diff2[1] * diff2[1]); + const normalized1 = [diff1[0] / len1, diff1[1] / len1]; + const normalized2 = [diff2[0] / len2, diff2[1] / len2]; + const beforeNew = [p[0] - normalized1[0] * 10, p[1] - normalized1[1] * 10]; + const nextNew = [p[0] - normalized2[0] * 10, p[1] - normalized2[1] * 10]; + shape.plot([beforeNew, p, nextNew]); + } + updateResizeHandles() { + this.handlePoints.forEach((p, index, arr) => { + const name = this.order[index]; + this.updateHandle.call(this, this.selection.get(index + 1), p, index, arr, name); + }); + } + createRotFn(group) { + group.line(); + group.circle(5); + } + getPoint(name) { + return this.handlePoints[this.order.indexOf(name)]; + } + getPointHandle(name) { + return this.selection.get(this.order.indexOf(name) + 1); + } + updateRotFn(group, rotPoint) { + const topPoint = this.getPoint("t"); + group.get(0).plot(topPoint[0], topPoint[1], rotPoint[0], rotPoint[1]); + group.get(1).center(rotPoint[0], rotPoint[1]); + } + createRotationHandle() { + const handle = this.selection.group().addClass("svg_select_handle_rot").on("mousedown.selection touchstart.selection", getMoseDownFunc("rot", this.el, this.handlePoints)); + this.createRot.call(this, handle); + } + updateRotationHandle() { + const group = this.selection.findOne("g.svg_select_handle_rot"); + this.updateRot(group, this.rotationPoint, this.handlePoints); + } + // gets new bounding box points and transform them into the elements space + updatePoints() { + const bbox = this.el.bbox(); + const fromShapeToUiMatrix = this.el.parent().screenCTM().inverseO().multiplyO(this.el.screenCTM()); + this.handlePoints = this.getHandlePoints(bbox).map((p) => transformPoint(p, fromShapeToUiMatrix)); + this.rotationPoint = transformPoint(this.getRotationPoint(bbox), fromShapeToUiMatrix); + } + // A collection of all the points we need to draw our ui + getHandlePoints({ x, x2, y, y2, cx, cy } = this.el.bbox()) { + return [ + [x, y], + [cx, y], + [x2, y], + [x2, cy], + [x2, y2], + [cx, y2], + [x, y2], + [x, cy] + ]; + } + // A collection of all the points we need to draw our ui + getRotationPoint({ y, cx } = this.el.bbox()) { + return [cx, y - 20]; + } + mutationHandler() { + this.updatePoints(); + this.updateSelection(); + this.updateResizeHandles(); + this.updateRotationHandle(); + } + } + class PointSelectHandler { + constructor(el) { + this.el = el; + el.remember("_pointSelectHandler", this); + this.selection = new G(); + this.order = ["lt", "t", "rt", "r", "rb", "b", "lb", "l", "rot"]; + this.mutationHandler = this.mutationHandler.bind(this); + const win = getWindow(); + this.observer = new win.MutationObserver(this.mutationHandler); + } + init(options) { + this.createHandle = options.createHandle || this.createHandleFn; + this.updateHandle = options.updateHandle || this.updateHandleFn; + this.el.root().put(this.selection); + this.updatePoints(); + this.createSelection(); + this.createPointHandles(); + this.updatePointHandles(); + this.observer.observe(this.el.node, { attributes: true }); + } + active(val, options) { + if (!val) { + this.selection.clear().remove(); + this.observer.disconnect(); + return; + } + this.init(options); + } + createSelection() { + this.selection.polygon(this.points).addClass("svg_select_shape_pointSelect"); + } + updateSelection() { + this.selection.get(0).plot(this.points); + } + createPointHandles() { + this.points.forEach((p, index, arr) => { + this.createHandle.call(this, this.selection, p, index, arr); + this.selection.get(index + 1).addClass("svg_select_handle_point").on("mousedown.selection touchstart.selection", getMoseDownFunc("point", this.el, this.points, index)); + }); + } + createHandleFn(group) { + group.circle(5); + } + updateHandleFn(shape, point) { + shape.center(point[0], point[1]); + } + updatePointHandles() { + this.points.forEach((p, index, arr) => { + this.updateHandle.call(this, this.selection.get(index + 1), p, index, arr); + }); + } + // gets new bounding box points and transform them into the elements space + updatePoints() { + const fromShapeToUiMatrix = this.el.parent().screenCTM().inverseO().multiplyO(this.el.screenCTM()); + this.points = this.el.array().map((p) => transformPoint(p, fromShapeToUiMatrix)); + } + mutationHandler() { + this.updatePoints(); + this.updateSelection(); + this.updatePointHandles(); + } + } + const getSelectFn = (handleClass) => { + return function(enabled = true, options = {}) { + if (typeof enabled === "object") { + options = enabled; + enabled = true; + } + let selectHandler = this.remember("_" + handleClass.name); + if (!selectHandler) { + if (enabled.prototype instanceof SelectHandler) { + selectHandler = new enabled(this); + enabled = true; + } else { + selectHandler = new handleClass(this); + } + this.remember("_" + handleClass.name, selectHandler); + } + selectHandler.active(enabled, options); + return this; + }; + }; + extend(Element$1, { + select: getSelectFn(SelectHandler) + }); + extend([Polygon, Polyline, Line$1], { + pointSelect: getSelectFn(PointSelectHandler) + }); + const getCoordsFromEvent = (ev) => { + if (ev.changedTouches) { + ev = ev.changedTouches[0]; + } + return { x: ev.clientX, y: ev.clientY }; + }; + const maxBoxFromPoints = (points) => { + let x = Infinity; + let y = Infinity; + let x2 = -Infinity; + let y2 = -Infinity; + for (let i = 0; i < points.length; i++) { + const p = points[i]; + x = Math.min(x, p[0]); + y = Math.min(y, p[1]); + x2 = Math.max(x2, p[0]); + y2 = Math.max(y2, p[1]); + } + return new Box(x, y, x2 - x, y2 - y); + }; + function scaleBox(box, origin, scale) { + const points = [ + [box.x, box.y], + [box.x + box.width, box.y], + [box.x + box.width, box.y + box.height], + [box.x, box.y + box.height] + ]; + const newPoints = points.map(([x, y]) => { + const translatedX = x - origin[0]; + const translatedY = y - origin[1]; + const scaledX = translatedX * scale; + const scaledY = translatedY * scale; + return [scaledX + origin[0], scaledY + origin[1]]; + }); + return maxBoxFromPoints(newPoints); + } + class ResizeHandler { + constructor(el) { + this.el = el; + el.remember("_ResizeHandler", this); + this.lastCoordinates = null; + this.eventType = ""; + this.lastEvent = null; + this.handleResize = this.handleResize.bind(this); + this.resize = this.resize.bind(this); + this.endResize = this.endResize.bind(this); + this.rotate = this.rotate.bind(this); + this.movePoint = this.movePoint.bind(this); + } + active(value, options) { + this.preserveAspectRatio = options.preserveAspectRatio ?? false; + this.aroundCenter = options.aroundCenter ?? false; + this.grid = options.grid ?? 0; + this.degree = options.degree ?? 0; + this.el.off(".resize"); + if (!value) return; + this.el.on( + [ + "lt.resize", + "rt.resize", + "rb.resize", + "lb.resize", + "t.resize", + "r.resize", + "b.resize", + "l.resize", + "rot.resize", + "point.resize" + ], + this.handleResize + ); + if (this.lastEvent) { + if (this.eventType === "rot") { + this.rotate(this.lastEvent); + } else if (this.eventType === "point") { + this.movePoint(this.lastEvent); + } else { + this.resize(this.lastEvent); + } + } + } + // This is called when a user clicks on one of the resize points + handleResize(e) { + this.eventType = e.type; + const { event, index, points } = e.detail; + const isMouse = !event.type.indexOf("mouse"); + if (isMouse && (event.which || event.buttons) !== 1) { + return; + } + if (this.el.dispatch("beforeresize", { event: e, handler: this }).defaultPrevented) { + return; + } + this.box = this.el.bbox(); + this.startPoint = this.el.point(getCoordsFromEvent(event)); + this.index = index; + this.points = points.slice(); + const eventMove = (isMouse ? "mousemove" : "touchmove") + ".resize"; + const eventEnd = (isMouse ? "mouseup" : "touchcancel.resize touchend") + ".resize"; + if (e.type === "point") { + on(window, eventMove, this.movePoint); + } else if (e.type === "rot") { + on(window, eventMove, this.rotate); + } else { + on(window, eventMove, this.resize); + } + on(window, eventEnd, this.endResize); + } + resize(e) { + this.lastEvent = e; + const endPoint = this.snapToGrid(this.el.point(getCoordsFromEvent(e))); + let dx = endPoint.x - this.startPoint.x; + let dy = endPoint.y - this.startPoint.y; + if (this.preserveAspectRatio && this.aroundCenter) { + dx *= 2; + dy *= 2; + } + const x = this.box.x + dx; + const y = this.box.y + dy; + const x2 = this.box.x2 + dx; + const y2 = this.box.y2 + dy; + let box = new Box(this.box); + if (this.eventType.includes("l")) { + box.x = Math.min(x, this.box.x2); + box.x2 = Math.max(x, this.box.x2); + } + if (this.eventType.includes("r")) { + box.x = Math.min(x2, this.box.x); + box.x2 = Math.max(x2, this.box.x); + } + if (this.eventType.includes("t")) { + box.y = Math.min(y, this.box.y2); + box.y2 = Math.max(y, this.box.y2); + } + if (this.eventType.includes("b")) { + box.y = Math.min(y2, this.box.y); + box.y2 = Math.max(y2, this.box.y); + } + box.width = box.x2 - box.x; + box.height = box.y2 - box.y; + if (this.preserveAspectRatio) { + const scaleX = box.width / this.box.width; + const scaleY = box.height / this.box.height; + const order = ["lt", "t", "rt", "r", "rb", "b", "lb", "l"]; + const origin = (order.indexOf(this.eventType) + 4) % order.length; + const constantPoint = this.aroundCenter ? [this.box.cx, this.box.cy] : this.points[origin]; + let scale = this.eventType.includes("t") || this.eventType.includes("b") ? scaleY : scaleX; + scale = this.eventType.length === 2 ? Math.max(scaleX, scaleY) : scale; + box = scaleBox(this.box, constantPoint, scale); + } + if (this.el.dispatch("resize", { + box: new Box(box), + angle: 0, + eventType: this.eventType, + event: e, + handler: this + }).defaultPrevented) { + return; + } + this.el.size(box.width, box.height).move(box.x, box.y); + } + movePoint(e) { + this.lastEvent = e; + const { x, y } = this.snapToGrid(this.el.point(getCoordsFromEvent(e))); + const pointArr = this.el.array().slice(); + pointArr[this.index] = [x, y]; + if (this.el.dispatch("resize", { + box: maxBoxFromPoints(pointArr), + angle: 0, + eventType: this.eventType, + event: e, + handler: this + }).defaultPrevented) { + return; + } + this.el.plot(pointArr); + } + rotate(e) { + this.lastEvent = e; + const startPoint = this.startPoint; + const endPoint = this.el.point(getCoordsFromEvent(e)); + const { cx, cy } = this.box; + const dx1 = startPoint.x - cx; + const dy1 = startPoint.y - cy; + const dx2 = endPoint.x - cx; + const dy2 = endPoint.y - cy; + const c = Math.sqrt(dx1 * dx1 + dy1 * dy1) * Math.sqrt(dx2 * dx2 + dy2 * dy2); + if (c === 0) { + return; + } + let angle = Math.acos((dx1 * dx2 + dy1 * dy2) / c) / Math.PI * 180; + if (!angle) return; + if (endPoint.x < startPoint.x) { + angle = -angle; + } + const matrix = new Matrix(this.el); + const { x: ox, y: oy } = new Point(cx, cy).transformO(matrix); + const { rotate } = matrix.decompose(); + const resultAngle = this.snapToAngle(rotate + angle) - rotate; + if (this.el.dispatch("resize", { + box: this.box, + angle: resultAngle, + eventType: this.eventType, + event: e, + handler: this + }).defaultPrevented) { + return; + } + this.el.transform(matrix.rotateO(resultAngle, ox, oy)); + } + endResize(ev) { + if (this.eventType !== "rot" && this.eventType !== "point") { + this.resize(ev); + } + this.lastEvent = null; + this.eventType = ""; + off(window, "mousemove.resize touchmove.resize"); + off(window, "mouseup.resize touchend.resize"); + } + snapToGrid(point) { + if (this.grid) { + point.x = Math.round(point.x / this.grid) * this.grid; + point.y = Math.round(point.y / this.grid) * this.grid; + } + return point; + } + snapToAngle(angle) { + if (this.degree) { + angle = Math.round(angle / this.degree) * this.degree; + } + return angle; + } + } + extend(Element$1, { + // Resize element with mouse + resize: function(enabled = true, options = {}) { + if (typeof enabled === "object") { + options = enabled; + enabled = true; + } + let resizeHandler = this.remember("_ResizeHandler"); + if (!resizeHandler) { + if (enabled.prototype instanceof ResizeHandler) { + resizeHandler = new enabled(this); + enabled = true; + } else { + resizeHandler = new ResizeHandler(this); + } + this.remember("_resizeHandler", resizeHandler); + } + resizeHandler.active(enabled, options); + return this; + } + }); + + if (typeof window.SVG === 'undefined') { + window.SVG = SVG; + } + + // global Apex object which user can use to override chart's defaults globally + if (typeof window.Apex === 'undefined') { + window.Apex = {}; + } + var InitCtxVariables = /*#__PURE__*/function () { + function InitCtxVariables(ctx) { + _classCallCheck(this, InitCtxVariables); + this.ctx = ctx; + this.w = ctx.w; + } + _createClass(InitCtxVariables, [{ + key: "initModules", + value: function initModules() { + this.ctx.publicMethods = ['updateOptions', 'updateSeries', 'appendData', 'appendSeries', 'isSeriesHidden', 'highlightSeries', 'toggleSeries', 'showSeries', 'hideSeries', 'setLocale', 'resetSeries', 'zoomX', 'toggleDataPointSelection', 'dataURI', 'exportToCSV', 'addXaxisAnnotation', 'addYaxisAnnotation', 'addPointAnnotation', 'clearAnnotations', 'removeAnnotation', 'paper', 'destroy']; + this.ctx.eventList = ['click', 'mousedown', 'mousemove', 'mouseleave', 'touchstart', 'touchmove', 'touchleave', 'mouseup', 'touchend']; + this.ctx.animations = new Animations(this.ctx); + this.ctx.axes = new Axes(this.ctx); + this.ctx.core = new Core(this.ctx.el, this.ctx); + this.ctx.config = new Config({}); + this.ctx.data = new Data(this.ctx); + this.ctx.grid = new Grid(this.ctx); + this.ctx.graphics = new Graphics(this.ctx); + this.ctx.coreUtils = new CoreUtils(this.ctx); + this.ctx.crosshairs = new Crosshairs(this.ctx); + this.ctx.events = new Events(this.ctx); + this.ctx.exports = new Exports(this.ctx); + this.ctx.fill = new Fill(this.ctx); + this.ctx.localization = new Localization(this.ctx); + this.ctx.options = new Options(); + this.ctx.responsive = new Responsive(this.ctx); + this.ctx.series = new Series(this.ctx); + this.ctx.theme = new Theme(this.ctx); + this.ctx.formatters = new Formatters(this.ctx); + this.ctx.titleSubtitle = new TitleSubtitle(this.ctx); + this.ctx.legend = new Legend(this.ctx); + this.ctx.toolbar = new Toolbar(this.ctx); + this.ctx.tooltip = new Tooltip(this.ctx); + this.ctx.dimensions = new Dimensions(this.ctx); + this.ctx.updateHelpers = new UpdateHelpers(this.ctx); + this.ctx.zoomPanSelection = new ZoomPanSelection(this.ctx); + this.ctx.w.globals.tooltip = new Tooltip(this.ctx); + } + }]); + return InitCtxVariables; + }(); + + var Destroy = /*#__PURE__*/function () { + function Destroy(ctx) { + _classCallCheck(this, Destroy); + this.ctx = ctx; + this.w = ctx.w; + } + _createClass(Destroy, [{ + key: "clear", + value: function clear(_ref) { + var isUpdating = _ref.isUpdating; + if (this.ctx.zoomPanSelection) { + this.ctx.zoomPanSelection.destroy(); + } + if (this.ctx.toolbar) { + this.ctx.toolbar.destroy(); + } + this.ctx.animations = null; + this.ctx.axes = null; + this.ctx.annotations = null; + this.ctx.core = null; + this.ctx.data = null; + this.ctx.grid = null; + this.ctx.series = null; + this.ctx.responsive = null; + this.ctx.theme = null; + this.ctx.formatters = null; + this.ctx.titleSubtitle = null; + this.ctx.legend = null; + this.ctx.dimensions = null; + this.ctx.options = null; + this.ctx.crosshairs = null; + this.ctx.zoomPanSelection = null; + this.ctx.updateHelpers = null; + this.ctx.toolbar = null; + this.ctx.localization = null; + this.ctx.w.globals.tooltip = null; + this.clearDomElements({ + isUpdating: isUpdating + }); + } + }, { + key: "killSVG", + value: function killSVG(draw) { + draw.each(function () { + this.removeClass('*'); + this.off(); + // this.stop() + }, true); + // draw.ungroup() + draw.clear(); + } + }, { + key: "clearDomElements", + value: function clearDomElements(_ref2) { + var _this = this; + var isUpdating = _ref2.isUpdating; + var elSVG = this.w.globals.dom.Paper.node; + // fixes apexcharts.js#1654 & vue-apexcharts#256 + if (elSVG.parentNode && elSVG.parentNode.parentNode && !isUpdating) { + elSVG.parentNode.parentNode.style.minHeight = 'unset'; + } + + // detach root event + var baseEl = this.w.globals.dom.baseEl; + if (baseEl) { + // see https://github.com/apexcharts/vue-apexcharts/issues/275 + this.ctx.eventList.forEach(function (event) { + baseEl.removeEventListener(event, _this.ctx.events.documentEvent); + }); + } + var domEls = this.w.globals.dom; + if (this.ctx.el !== null) { + // remove all child elements - resetting the whole chart + while (this.ctx.el.firstChild) { + this.ctx.el.removeChild(this.ctx.el.firstChild); + } + } + this.killSVG(domEls.Paper); + domEls.Paper.remove(); + domEls.elWrap = null; + domEls.elGraphical = null; + domEls.elLegendWrap = null; + domEls.elLegendForeign = null; + domEls.baseEl = null; + domEls.elGridRect = null; + domEls.elGridRectMask = null; + domEls.elGridRectBarMask = null; + domEls.elGridRectMarkerMask = null; + domEls.elForecastMask = null; + domEls.elNonForecastMask = null; + domEls.elDefs = null; + } + }]); + return Destroy; + }(); + + // Helpers to react to element resizes, regardless of what caused them + // TODO Currently this creates a new ResizeObserver every time we want to observe an element for resizes + // Ideally, we should be able to use a single observer for all elements + var ros = new WeakMap(); // Map callbacks to ResizeObserver instances for easy removal + + function addResizeListener(el, fn) { + var called = false; + if (el.nodeType !== Node.DOCUMENT_FRAGMENT_NODE) { + var elRect = el.getBoundingClientRect(); + if (el.style.display === 'none' || elRect.width === 0) { + // if elRect.width=0, the chart is not rendered at all + // (it has either display none or hidden in a different tab) + // fixes https://github.com/apexcharts/apexcharts.js/issues/2825 + // fixes https://github.com/apexcharts/apexcharts.js/issues/2991 + // fixes https://github.com/apexcharts/apexcharts.js/issues/2992 + called = true; + } + } + var ro = new ResizeObserver(function (r) { + // ROs fire immediately after being created, + // per spec: https://drafts.csswg.org/resize-observer/#ref-for-element%E2%91%A3 + // we don't want that so we just discard the first run + if (called) { + fn.call(el, r); + } + called = true; + }); + if (el.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { + // Document fragment, observe children instead (needed for Shadow DOM, see #1332) + Array.from(el.children).forEach(function (c) { + return ro.observe(c); + }); + } else { + ro.observe(el); + } + ros.set(fn, ro); + } + function removeResizeListener(el, fn) { + var ro = ros.get(fn); + if (ro) { + ro.disconnect(); + ros.delete(fn); + } + } + + var css_248z = "@keyframes opaque {\n 0% {\n opacity: 0\n }\n\n to {\n opacity: 1\n }\n}\n\n@keyframes resizeanim {\n\n 0%,\n to {\n opacity: 0\n }\n}\n\n.apexcharts-canvas {\n position: relative;\n direction: ltr !important;\n user-select: none\n}\n\n.apexcharts-canvas ::-webkit-scrollbar {\n -webkit-appearance: none;\n width: 6px\n}\n\n.apexcharts-canvas ::-webkit-scrollbar-thumb {\n border-radius: 4px;\n background-color: rgba(0, 0, 0, .5);\n box-shadow: 0 0 1px rgba(255, 255, 255, .5);\n -webkit-box-shadow: 0 0 1px rgba(255, 255, 255, .5)\n}\n\n.apexcharts-inner {\n position: relative\n}\n\n.apexcharts-text tspan {\n font-family: inherit\n}\n\nrect.legend-mouseover-inactive,\n.legend-mouseover-inactive rect,\n.legend-mouseover-inactive path,\n.legend-mouseover-inactive circle,\n.legend-mouseover-inactive line,\n.legend-mouseover-inactive text.apexcharts-yaxis-title-text,\n.legend-mouseover-inactive text.apexcharts-yaxis-label {\n transition: .15s ease all;\n opacity: .2\n}\n\n.apexcharts-legend-text {\n padding-left: 15px;\n margin-left: -15px;\n}\n\n.apexcharts-series-collapsed {\n opacity: 0\n}\n\n.apexcharts-tooltip {\n border-radius: 5px;\n box-shadow: 2px 2px 6px -4px #999;\n cursor: default;\n font-size: 14px;\n left: 62px;\n opacity: 0;\n pointer-events: none;\n position: absolute;\n top: 20px;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n white-space: nowrap;\n z-index: 12;\n transition: .15s ease all\n}\n\n.apexcharts-tooltip.apexcharts-active {\n opacity: 1;\n transition: .15s ease all\n}\n\n.apexcharts-tooltip.apexcharts-theme-light {\n border: 1px solid #e3e3e3;\n background: rgba(255, 255, 255, .96)\n}\n\n.apexcharts-tooltip.apexcharts-theme-dark {\n color: #fff;\n background: rgba(30, 30, 30, .8)\n}\n\n.apexcharts-tooltip * {\n font-family: inherit\n}\n\n.apexcharts-tooltip-title {\n padding: 6px;\n font-size: 15px;\n margin-bottom: 4px\n}\n\n.apexcharts-tooltip.apexcharts-theme-light .apexcharts-tooltip-title {\n background: #eceff1;\n border-bottom: 1px solid #ddd\n}\n\n.apexcharts-tooltip.apexcharts-theme-dark .apexcharts-tooltip-title {\n background: rgba(0, 0, 0, .7);\n border-bottom: 1px solid #333\n}\n\n.apexcharts-tooltip-text-goals-value,\n.apexcharts-tooltip-text-y-value,\n.apexcharts-tooltip-text-z-value {\n display: inline-block;\n margin-left: 5px;\n font-weight: 600\n}\n\n.apexcharts-tooltip-text-goals-label:empty,\n.apexcharts-tooltip-text-goals-value:empty,\n.apexcharts-tooltip-text-y-label:empty,\n.apexcharts-tooltip-text-y-value:empty,\n.apexcharts-tooltip-text-z-value:empty,\n.apexcharts-tooltip-title:empty {\n display: none\n}\n\n.apexcharts-tooltip-text-goals-label,\n.apexcharts-tooltip-text-goals-value {\n padding: 6px 0 5px\n}\n\n.apexcharts-tooltip-goals-group,\n.apexcharts-tooltip-text-goals-label,\n.apexcharts-tooltip-text-goals-value {\n display: flex\n}\n\n.apexcharts-tooltip-text-goals-label:not(:empty),\n.apexcharts-tooltip-text-goals-value:not(:empty) {\n margin-top: -6px\n}\n\n.apexcharts-tooltip-marker {\n display: inline-block;\n position: relative;\n width: 16px;\n height: 16px;\n font-size: 16px;\n line-height: 16px;\n margin-right: 4px;\n text-align: center;\n vertical-align: middle;\n color: inherit;\n}\n\n.apexcharts-tooltip-marker::before {\n content: \"\";\n display: inline-block;\n width: 100%;\n text-align: center;\n color: currentcolor;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n font-size: 26px;\n font-family: Arial, Helvetica, sans-serif;\n line-height: 14px;\n font-weight: 900;\n}\n\n.apexcharts-tooltip-marker[shape=\"circle\"]::before {\n content: \"\\25CF\";\n}\n\n.apexcharts-tooltip-marker[shape=\"square\"]::before,\n.apexcharts-tooltip-marker[shape=\"rect\"]::before {\n content: \"\\25A0\";\n transform: translate(-1px, -2px);\n}\n\n.apexcharts-tooltip-marker[shape=\"line\"]::before {\n content: \"\\2500\";\n}\n\n.apexcharts-tooltip-marker[shape=\"diamond\"]::before {\n content: \"\\25C6\";\n font-size: 28px;\n}\n\n.apexcharts-tooltip-marker[shape=\"triangle\"]::before {\n content: \"\\25B2\";\n font-size: 22px;\n}\n\n.apexcharts-tooltip-marker[shape=\"cross\"]::before {\n content: \"\\2715\";\n font-size: 18px;\n}\n\n.apexcharts-tooltip-marker[shape=\"plus\"]::before {\n content: \"\\2715\";\n transform: rotate(45deg) translate(-1px, -1px);\n font-size: 18px;\n}\n\n.apexcharts-tooltip-marker[shape=\"star\"]::before {\n content: \"\\2605\";\n font-size: 18px;\n}\n\n.apexcharts-tooltip-marker[shape=\"sparkle\"]::before {\n content: \"\\2726\";\n font-size: 20px;\n}\n\n.apexcharts-tooltip-series-group {\n padding: 0 10px;\n display: none;\n text-align: left;\n justify-content: left;\n align-items: center\n}\n\n.apexcharts-tooltip-series-group.apexcharts-active .apexcharts-tooltip-marker {\n opacity: 1\n}\n\n.apexcharts-tooltip-series-group.apexcharts-active,\n.apexcharts-tooltip-series-group:last-child {\n padding-bottom: 4px\n}\n\n.apexcharts-tooltip-y-group {\n padding: 6px 0 5px\n}\n\n.apexcharts-custom-tooltip,\n.apexcharts-tooltip-box {\n padding: 4px 8px\n}\n\n.apexcharts-tooltip-boxPlot {\n display: flex;\n flex-direction: column-reverse\n}\n\n.apexcharts-tooltip-box>div {\n margin: 4px 0\n}\n\n.apexcharts-tooltip-box span.value {\n font-weight: 700\n}\n\n.apexcharts-tooltip-rangebar {\n padding: 5px 8px\n}\n\n.apexcharts-tooltip-rangebar .category {\n font-weight: 600;\n color: #777\n}\n\n.apexcharts-tooltip-rangebar .series-name {\n font-weight: 700;\n display: block;\n margin-bottom: 5px\n}\n\n.apexcharts-xaxistooltip,\n.apexcharts-yaxistooltip {\n opacity: 0;\n pointer-events: none;\n color: #373d3f;\n font-size: 13px;\n text-align: center;\n border-radius: 2px;\n position: absolute;\n z-index: 10;\n background: #eceff1;\n border: 1px solid #90a4ae\n}\n\n.apexcharts-xaxistooltip {\n padding: 9px 10px;\n transition: .15s ease all\n}\n\n.apexcharts-xaxistooltip.apexcharts-theme-dark {\n background: rgba(0, 0, 0, .7);\n border: 1px solid rgba(0, 0, 0, .5);\n color: #fff\n}\n\n.apexcharts-xaxistooltip:after,\n.apexcharts-xaxistooltip:before {\n left: 50%;\n border: solid transparent;\n content: \" \";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none\n}\n\n.apexcharts-xaxistooltip:after {\n border-color: transparent;\n border-width: 6px;\n margin-left: -6px\n}\n\n.apexcharts-xaxistooltip:before {\n border-color: transparent;\n border-width: 7px;\n margin-left: -7px\n}\n\n.apexcharts-xaxistooltip-bottom:after,\n.apexcharts-xaxistooltip-bottom:before {\n bottom: 100%\n}\n\n.apexcharts-xaxistooltip-top:after,\n.apexcharts-xaxistooltip-top:before {\n top: 100%\n}\n\n.apexcharts-xaxistooltip-bottom:after {\n border-bottom-color: #eceff1\n}\n\n.apexcharts-xaxistooltip-bottom:before {\n border-bottom-color: #90a4ae\n}\n\n.apexcharts-xaxistooltip-bottom.apexcharts-theme-dark:after,\n.apexcharts-xaxistooltip-bottom.apexcharts-theme-dark:before {\n border-bottom-color: rgba(0, 0, 0, .5)\n}\n\n.apexcharts-xaxistooltip-top:after {\n border-top-color: #eceff1\n}\n\n.apexcharts-xaxistooltip-top:before {\n border-top-color: #90a4ae\n}\n\n.apexcharts-xaxistooltip-top.apexcharts-theme-dark:after,\n.apexcharts-xaxistooltip-top.apexcharts-theme-dark:before {\n border-top-color: rgba(0, 0, 0, .5)\n}\n\n.apexcharts-xaxistooltip.apexcharts-active {\n opacity: 1;\n transition: .15s ease all\n}\n\n.apexcharts-yaxistooltip {\n padding: 4px 10px\n}\n\n.apexcharts-yaxistooltip.apexcharts-theme-dark {\n background: rgba(0, 0, 0, .7);\n border: 1px solid rgba(0, 0, 0, .5);\n color: #fff\n}\n\n.apexcharts-yaxistooltip:after,\n.apexcharts-yaxistooltip:before {\n top: 50%;\n border: solid transparent;\n content: \" \";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none\n}\n\n.apexcharts-yaxistooltip:after {\n border-color: transparent;\n border-width: 6px;\n margin-top: -6px\n}\n\n.apexcharts-yaxistooltip:before {\n border-color: transparent;\n border-width: 7px;\n margin-top: -7px\n}\n\n.apexcharts-yaxistooltip-left:after,\n.apexcharts-yaxistooltip-left:before {\n left: 100%\n}\n\n.apexcharts-yaxistooltip-right:after,\n.apexcharts-yaxistooltip-right:before {\n right: 100%\n}\n\n.apexcharts-yaxistooltip-left:after {\n border-left-color: #eceff1\n}\n\n.apexcharts-yaxistooltip-left:before {\n border-left-color: #90a4ae\n}\n\n.apexcharts-yaxistooltip-left.apexcharts-theme-dark:after,\n.apexcharts-yaxistooltip-left.apexcharts-theme-dark:before {\n border-left-color: rgba(0, 0, 0, .5)\n}\n\n.apexcharts-yaxistooltip-right:after {\n border-right-color: #eceff1\n}\n\n.apexcharts-yaxistooltip-right:before {\n border-right-color: #90a4ae\n}\n\n.apexcharts-yaxistooltip-right.apexcharts-theme-dark:after,\n.apexcharts-yaxistooltip-right.apexcharts-theme-dark:before {\n border-right-color: rgba(0, 0, 0, .5)\n}\n\n.apexcharts-yaxistooltip.apexcharts-active {\n opacity: 1\n}\n\n.apexcharts-yaxistooltip-hidden {\n display: none\n}\n\n.apexcharts-xcrosshairs,\n.apexcharts-ycrosshairs {\n pointer-events: none;\n opacity: 0;\n transition: .15s ease all\n}\n\n.apexcharts-xcrosshairs.apexcharts-active,\n.apexcharts-ycrosshairs.apexcharts-active {\n opacity: 1;\n transition: .15s ease all\n}\n\n.apexcharts-ycrosshairs-hidden {\n opacity: 0\n}\n\n.apexcharts-selection-rect {\n cursor: move\n}\n\n.svg_select_shape {\n stroke-width: 1;\n stroke-dasharray: 10 10;\n stroke: black;\n stroke-opacity: 0.1;\n pointer-events: none;\n fill: none;\n}\n\n.svg_select_handle {\n stroke-width: 3;\n stroke: black;\n fill: none;\n}\n\n.svg_select_handle_r {\n cursor: e-resize;\n}\n\n.svg_select_handle_l {\n cursor: w-resize;\n}\n\n.apexcharts-svg.apexcharts-zoomable.hovering-zoom {\n cursor: crosshair\n}\n\n.apexcharts-svg.apexcharts-zoomable.hovering-pan {\n cursor: move\n}\n\n.apexcharts-menu-icon,\n.apexcharts-pan-icon,\n.apexcharts-reset-icon,\n.apexcharts-selection-icon,\n.apexcharts-toolbar-custom-icon,\n.apexcharts-zoom-icon,\n.apexcharts-zoomin-icon,\n.apexcharts-zoomout-icon {\n cursor: pointer;\n width: 20px;\n height: 20px;\n line-height: 24px;\n color: #6e8192;\n text-align: center\n}\n\n.apexcharts-menu-icon svg,\n.apexcharts-reset-icon svg,\n.apexcharts-zoom-icon svg,\n.apexcharts-zoomin-icon svg,\n.apexcharts-zoomout-icon svg {\n fill: #6e8192\n}\n\n.apexcharts-selection-icon svg {\n fill: #444;\n transform: scale(.76)\n}\n\n.apexcharts-theme-dark .apexcharts-menu-icon svg,\n.apexcharts-theme-dark .apexcharts-pan-icon svg,\n.apexcharts-theme-dark .apexcharts-reset-icon svg,\n.apexcharts-theme-dark .apexcharts-selection-icon svg,\n.apexcharts-theme-dark .apexcharts-toolbar-custom-icon svg,\n.apexcharts-theme-dark .apexcharts-zoom-icon svg,\n.apexcharts-theme-dark .apexcharts-zoomin-icon svg,\n.apexcharts-theme-dark .apexcharts-zoomout-icon svg {\n fill: #f3f4f5\n}\n\n.apexcharts-canvas .apexcharts-reset-zoom-icon.apexcharts-selected svg,\n.apexcharts-canvas .apexcharts-selection-icon.apexcharts-selected svg,\n.apexcharts-canvas .apexcharts-zoom-icon.apexcharts-selected svg {\n fill: #008ffb\n}\n\n.apexcharts-theme-light .apexcharts-menu-icon:hover svg,\n.apexcharts-theme-light .apexcharts-reset-icon:hover svg,\n.apexcharts-theme-light .apexcharts-selection-icon:not(.apexcharts-selected):hover svg,\n.apexcharts-theme-light .apexcharts-zoom-icon:not(.apexcharts-selected):hover svg,\n.apexcharts-theme-light .apexcharts-zoomin-icon:hover svg,\n.apexcharts-theme-light .apexcharts-zoomout-icon:hover svg {\n fill: #333\n}\n\n.apexcharts-menu-icon,\n.apexcharts-selection-icon {\n position: relative\n}\n\n.apexcharts-reset-icon {\n margin-left: 5px\n}\n\n.apexcharts-menu-icon,\n.apexcharts-reset-icon,\n.apexcharts-zoom-icon {\n transform: scale(.85)\n}\n\n.apexcharts-zoomin-icon,\n.apexcharts-zoomout-icon {\n transform: scale(.7)\n}\n\n.apexcharts-zoomout-icon {\n margin-right: 3px\n}\n\n.apexcharts-pan-icon {\n transform: scale(.62);\n position: relative;\n left: 1px;\n top: 0\n}\n\n.apexcharts-pan-icon svg {\n fill: #fff;\n stroke: #6e8192;\n stroke-width: 2\n}\n\n.apexcharts-pan-icon.apexcharts-selected svg {\n stroke: #008ffb\n}\n\n.apexcharts-pan-icon:not(.apexcharts-selected):hover svg {\n stroke: #333\n}\n\n.apexcharts-toolbar {\n position: absolute;\n z-index: 11;\n max-width: 176px;\n text-align: right;\n border-radius: 3px;\n padding: 0 6px 2px;\n display: flex;\n justify-content: space-between;\n align-items: center\n}\n\n.apexcharts-menu {\n background: #fff;\n position: absolute;\n top: 100%;\n border: 1px solid #ddd;\n border-radius: 3px;\n padding: 3px;\n right: 10px;\n opacity: 0;\n min-width: 110px;\n transition: .15s ease all;\n pointer-events: none\n}\n\n.apexcharts-menu.apexcharts-menu-open {\n opacity: 1;\n pointer-events: all;\n transition: .15s ease all\n}\n\n.apexcharts-menu-item {\n padding: 6px 7px;\n font-size: 12px;\n cursor: pointer\n}\n\n.apexcharts-theme-light .apexcharts-menu-item:hover {\n background: #eee\n}\n\n.apexcharts-theme-dark .apexcharts-menu {\n background: rgba(0, 0, 0, .7);\n color: #fff\n}\n\n@media screen and (min-width:768px) {\n .apexcharts-canvas:hover .apexcharts-toolbar {\n opacity: 1\n }\n}\n\n.apexcharts-canvas .apexcharts-element-hidden,\n.apexcharts-datalabel.apexcharts-element-hidden,\n.apexcharts-hide .apexcharts-series-points {\n opacity: 0;\n}\n\n.apexcharts-hidden-element-shown {\n opacity: 1;\n transition: 0.25s ease all;\n}\n\n.apexcharts-datalabel,\n.apexcharts-datalabel-label,\n.apexcharts-datalabel-value,\n.apexcharts-datalabels,\n.apexcharts-pie-label {\n cursor: default;\n pointer-events: none\n}\n\n.apexcharts-pie-label-delay {\n opacity: 0;\n animation-name: opaque;\n animation-duration: .3s;\n animation-fill-mode: forwards;\n animation-timing-function: ease\n}\n\n.apexcharts-radialbar-label {\n cursor: pointer;\n}\n\n.apexcharts-annotation-rect,\n.apexcharts-area-series .apexcharts-area,\n.apexcharts-gridline,\n.apexcharts-line,\n.apexcharts-point-annotation-label,\n.apexcharts-radar-series path:not(.apexcharts-marker),\n.apexcharts-radar-series polygon,\n.apexcharts-toolbar svg,\n.apexcharts-tooltip .apexcharts-marker,\n.apexcharts-xaxis-annotation-label,\n.apexcharts-yaxis-annotation-label,\n.apexcharts-zoom-rect,\n.no-pointer-events {\n pointer-events: none\n}\n\n.apexcharts-tooltip-active .apexcharts-marker {\n transition: .15s ease all\n}\n\n.apexcharts-radar-series .apexcharts-yaxis {\n pointer-events: none;\n}\n\n.resize-triggers {\n animation: 1ms resizeanim;\n visibility: hidden;\n opacity: 0;\n height: 100%;\n width: 100%;\n overflow: hidden\n}\n\n.contract-trigger:before,\n.resize-triggers,\n.resize-triggers>div {\n content: \" \";\n display: block;\n position: absolute;\n top: 0;\n left: 0\n}\n\n.resize-triggers>div {\n height: 100%;\n width: 100%;\n background: #eee;\n overflow: auto\n}\n\n.contract-trigger:before {\n overflow: hidden;\n width: 200%;\n height: 200%\n}\n\n.apexcharts-bar-goals-markers {\n pointer-events: none\n}\n\n.apexcharts-bar-shadows {\n pointer-events: none\n}\n\n.apexcharts-rangebar-goals-markers {\n pointer-events: none\n}"; + + /** + * + * @module ApexCharts + **/ + var ApexCharts = /*#__PURE__*/function () { + function ApexCharts(el, opts) { + _classCallCheck(this, ApexCharts); + this.opts = opts; + this.ctx = this; + + // Pass the user supplied options to the Base Class where these options will be extended with defaults. The returned object from Base Class will become the config object in the entire codebase. + this.w = new Base(opts).init(); + this.el = el; + this.w.globals.cuid = Utils$1.randomId(); + this.w.globals.chartID = this.w.config.chart.id ? Utils$1.escapeString(this.w.config.chart.id) : this.w.globals.cuid; + var initCtx = new InitCtxVariables(this); + initCtx.initModules(); + this.create = Utils$1.bind(this.create, this); + this.windowResizeHandler = this._windowResizeHandler.bind(this); + this.parentResizeHandler = this._parentResizeCallback.bind(this); + } + + /** + * The primary method user will call to render the chart. + */ + _createClass(ApexCharts, [{ + key: "render", + value: function render() { + var _this = this; + // main method + return new Promise(function (resolve, reject) { + // only draw chart, if element found + if (Utils$1.elementExists(_this.el)) { + if (typeof Apex._chartInstances === 'undefined') { + Apex._chartInstances = []; + } + if (_this.w.config.chart.id) { + Apex._chartInstances.push({ + id: _this.w.globals.chartID, + group: _this.w.config.chart.group, + chart: _this + }); + } + + // set the locale here + _this.setLocale(_this.w.config.chart.defaultLocale); + var beforeMount = _this.w.config.chart.events.beforeMount; + if (typeof beforeMount === 'function') { + beforeMount(_this, _this.w); + } + _this.events.fireEvent('beforeMount', [_this, _this.w]); + window.addEventListener('resize', _this.windowResizeHandler); + addResizeListener(_this.el.parentNode, _this.parentResizeHandler); + var rootNode = _this.el.getRootNode && _this.el.getRootNode(); + var inShadowRoot = Utils$1.is('ShadowRoot', rootNode); + var doc = _this.el.ownerDocument; + var css = inShadowRoot ? rootNode.getElementById('apexcharts-css') : doc.getElementById('apexcharts-css'); + if (!css) { + var _this$opts$chart; + css = document.createElement('style'); + css.id = 'apexcharts-css'; + css.textContent = css_248z; + var nonce = ((_this$opts$chart = _this.opts.chart) === null || _this$opts$chart === void 0 ? void 0 : _this$opts$chart.nonce) || _this.w.config.chart.nonce; + if (nonce) { + css.setAttribute('nonce', nonce); + } + if (inShadowRoot) { + // We are in Shadow DOM, add to shadow root + rootNode.prepend(css); + } else { + // Add to of element's document + doc.head.appendChild(css); + } + } + var graphData = _this.create(_this.w.config.series, {}); + if (!graphData) return resolve(_this); + _this.mount(graphData).then(function () { + if (typeof _this.w.config.chart.events.mounted === 'function') { + _this.w.config.chart.events.mounted(_this, _this.w); + } + _this.events.fireEvent('mounted', [_this, _this.w]); + resolve(graphData); + }).catch(function (e) { + reject(e); + // handle error in case no data or element not found + }); + } else { + reject(new Error('Element not found')); + } + }); + } + }, { + key: "create", + value: function create(ser, opts) { + var _this2 = this; + var w = this.w; + var initCtx = new InitCtxVariables(this); + initCtx.initModules(); + var gl = this.w.globals; + gl.noData = false; + gl.animationEnded = false; + if (!Utils$1.elementExists(this.el)) { + gl.animationEnded = true; + this.destroy(); + return null; + } + this.responsive.checkResponsiveConfig(opts); + if (w.config.xaxis.convertedCatToNumeric) { + var defaults = new Defaults(w.config); + defaults.convertCatToNumericXaxis(w.config, this.ctx); + } + this.core.setupElements(); + if (w.config.chart.type === 'treemap') { + w.config.grid.show = false; + w.config.yaxis[0].show = false; + } + if (gl.svgWidth === 0) { + // if the element is hidden, skip drawing + gl.animationEnded = true; + return null; + } + var series = ser; + ser.forEach(function (s, realIndex) { + if (s.hidden) { + series = _this2.legend.legendHelpers.getSeriesAfterCollapsing({ + realIndex: realIndex + }); + } + }); + var combo = CoreUtils.checkComboSeries(series, w.config.chart.type); + gl.comboCharts = combo.comboCharts; + gl.comboBarCount = combo.comboBarCount; + var allSeriesAreEmpty = series.every(function (s) { + return s.data && s.data.length === 0; + }); + if (series.length === 0 || allSeriesAreEmpty && gl.collapsedSeries.length < 1) { + this.series.handleNoData(); + } + this.events.setupEventHandlers(); + + // Handle the data inputted by user and set some of the global variables (for eg, if data is datetime / numeric / category). Don't calculate the range / min / max at this time + this.data.parseData(series); + + // this is a good time to set theme colors first + this.theme.init(); + + // as markers accepts array, we need to setup global markers for easier access + var markers = new Markers(this); + markers.setGlobalMarkerSize(); + + // labelFormatters should be called before dimensions as in dimensions we need text labels width + this.formatters.setLabelFormatters(); + this.titleSubtitle.draw(); + + // legend is calculated here before coreCalculations because it affects the plottable area + // if there is some data to show or user collapsed all series, then proceed drawing legend + if (!gl.noData || gl.collapsedSeries.length === gl.series.length || w.config.legend.showForSingleSeries) { + this.legend.init(); + } + + // check whether in multiple series, all series share the same X + this.series.hasAllSeriesEqualX(); + + // coreCalculations will give the min/max range and yaxis/axis values. It should be called here to set series variable from config to globals + if (gl.axisCharts) { + this.core.coreCalculations(); + if (w.config.xaxis.type !== 'category') { + // as we have minX and maxX values, determine the default DateTimeFormat for time series + this.formatters.setLabelFormatters(); + } + this.ctx.toolbar.minX = w.globals.minX; + this.ctx.toolbar.maxX = w.globals.maxX; + } + + // we need to generate yaxis for heatmap separately as we are not showing numerics there, but seriesNames. There are some tweaks which are required for heatmap to align labels correctly which are done in below function + // Also we need to do this before calculating Dimensions plotCoords() method of Dimensions + this.formatters.heatmapLabelFormatters(); + + // get the largest marker size which will be needed in dimensions calc + var coreUtils = new CoreUtils(this); + coreUtils.getLargestMarkerSize(); + + // We got plottable area here, next task would be to calculate axis areas + this.dimensions.plotCoords(); + var xyRatios = this.core.xySettings(); + this.grid.createGridMask(); + var elGraph = this.core.plotChartType(series, xyRatios); + var dataLabels = new DataLabels(this); + dataLabels.bringForward(); + if (w.config.dataLabels.background.enabled) { + dataLabels.dataLabelsBackground(); + } + + // after all the drawing calculations, shift the graphical area (actual charts/bars) excluding legends + this.core.shiftGraphPosition(); + var dim = { + plot: { + left: w.globals.translateX, + top: w.globals.translateY, + width: w.globals.gridWidth, + height: w.globals.gridHeight + } + }; + return { + elGraph: elGraph, + xyRatios: xyRatios, + dimensions: dim + }; + } + }, { + key: "mount", + value: function mount() { + var _this3 = this; + var graphData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + var me = this; + var w = me.w; + return new Promise(function (resolve, reject) { + // no data to display + if (me.el === null) { + return reject(new Error('Not enough data to display or target element not found')); + } else if (graphData === null || w.globals.allSeriesCollapsed) { + me.series.handleNoData(); + } + me.grid = new Grid(me); + var elgrid = me.grid.drawGrid(); + me.annotations = new Annotations(me); + me.annotations.drawImageAnnos(); + me.annotations.drawTextAnnos(); + if (w.config.grid.position === 'back') { + var _elgrid$elGridBorders; + if (elgrid) { + w.globals.dom.elGraphical.add(elgrid.el); + } + if (elgrid !== null && elgrid !== void 0 && (_elgrid$elGridBorders = elgrid.elGridBorders) !== null && _elgrid$elGridBorders !== void 0 && _elgrid$elGridBorders.node) { + w.globals.dom.elGraphical.add(elgrid.elGridBorders); + } + } + if (Array.isArray(graphData.elGraph)) { + for (var g = 0; g < graphData.elGraph.length; g++) { + w.globals.dom.elGraphical.add(graphData.elGraph[g]); + } + } else { + w.globals.dom.elGraphical.add(graphData.elGraph); + } + if (w.config.grid.position === 'front') { + var _elgrid$elGridBorders2; + if (elgrid) { + w.globals.dom.elGraphical.add(elgrid.el); + } + if (elgrid !== null && elgrid !== void 0 && (_elgrid$elGridBorders2 = elgrid.elGridBorders) !== null && _elgrid$elGridBorders2 !== void 0 && _elgrid$elGridBorders2.node) { + w.globals.dom.elGraphical.add(elgrid.elGridBorders); + } + } + if (w.config.xaxis.crosshairs.position === 'front') { + me.crosshairs.drawXCrosshairs(); + } + if (w.config.yaxis[0].crosshairs.position === 'front') { + me.crosshairs.drawYCrosshairs(); + } + if (w.config.chart.type !== 'treemap') { + me.axes.drawAxis(w.config.chart.type, elgrid); + } + var xAxis = new XAxis(_this3.ctx, elgrid); + var yaxis = new YAxis(_this3.ctx, elgrid); + if (elgrid !== null) { + xAxis.xAxisLabelCorrections(elgrid.xAxisTickWidth); + yaxis.setYAxisTextAlignments(); + w.config.yaxis.map(function (yaxe, index) { + if (w.globals.ignoreYAxisIndexes.indexOf(index) === -1) { + yaxis.yAxisTitleRotate(index, yaxe.opposite); + } + }); + } + me.annotations.drawAxesAnnotations(); + if (!w.globals.noData) { + // draw tooltips at the end + if (w.config.tooltip.enabled && !w.globals.noData) { + me.w.globals.tooltip.drawTooltip(graphData.xyRatios); + } + if (w.globals.axisCharts && (w.globals.isXNumeric || w.config.xaxis.convertedCatToNumeric || w.globals.isRangeBar)) { + if (w.config.chart.zoom.enabled || w.config.chart.selection && w.config.chart.selection.enabled || w.config.chart.pan && w.config.chart.pan.enabled) { + me.zoomPanSelection.init({ + xyRatios: graphData.xyRatios + }); + } + } else { + var tools = w.config.chart.toolbar.tools; + var toolsArr = ['zoom', 'zoomin', 'zoomout', 'selection', 'pan', 'reset']; + toolsArr.forEach(function (t) { + tools[t] = false; + }); + } + if (w.config.chart.toolbar.show && !w.globals.allSeriesCollapsed) { + me.toolbar.createToolbar(); + } + } + if (w.globals.memory.methodsToExec.length > 0) { + w.globals.memory.methodsToExec.forEach(function (fn) { + fn.method(fn.params, false, fn.context); + }); + } + if (!w.globals.axisCharts && !w.globals.noData) { + me.core.resizeNonAxisCharts(); + } + resolve(me); + }); + } + + /** + * Destroy the chart instance by removing all elements which also clean up event listeners on those elements. + */ + }, { + key: "destroy", + value: function destroy() { + window.removeEventListener('resize', this.windowResizeHandler); + removeResizeListener(this.el.parentNode, this.parentResizeHandler); + // remove the chart's instance from the global Apex._chartInstances + var chartID = this.w.config.chart.id; + if (chartID) { + Apex._chartInstances.forEach(function (c, i) { + if (c.id === Utils$1.escapeString(chartID)) { + Apex._chartInstances.splice(i, 1); + } + }); + } + new Destroy(this.ctx).clear({ + isUpdating: false + }); + } + + /** + * Allows users to update Options after the chart has rendered. + * + * @param {object} options - A new config object can be passed which will be merged with the existing config object + * @param {boolean} redraw - should redraw from beginning or should use existing paths and redraw from there + * @param {boolean} animate - should animate or not on updating Options + */ + }, { + key: "updateOptions", + value: function updateOptions(options) { + var _this4 = this; + var redraw = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + var animate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + var updateSyncedCharts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; + var overwriteInitialConfig = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true; + var w = this.w; + + // when called externally, clear some global variables + // fixes apexcharts.js#1488 + w.globals.selection = undefined; + if (options.series) { + this.series.resetSeries(false, true, false); + if (options.series.length && options.series[0].data) { + options.series = options.series.map(function (s, i) { + return _this4.updateHelpers._extendSeries(s, i); + }); + } + + // user updated the series via updateOptions() function. + // Hence, we need to reset axis min/max to avoid zooming issues + this.updateHelpers.revertDefaultAxisMinMax(); + } + // user has set x-axis min/max externally - hence we need to forcefully set the xaxis min/max + if (options.xaxis) { + options = this.updateHelpers.forceXAxisUpdate(options); + } + if (options.yaxis) { + options = this.updateHelpers.forceYAxisUpdate(options); + } + if (w.globals.collapsedSeriesIndices.length > 0) { + this.series.clearPreviousPaths(); + } + /* update theme mode#459 */ + if (options.theme) { + options = this.theme.updateThemeOptions(options); + } + return this.updateHelpers._updateOptions(options, redraw, animate, updateSyncedCharts, overwriteInitialConfig); + } + + /** + * Allows users to update Series after the chart has rendered. + * + * @param {array} series - New series which will override the existing + */ + }, { + key: "updateSeries", + value: function updateSeries() { + var newSeries = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + var animate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + var overwriteInitialSeries = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + this.series.resetSeries(false); + this.updateHelpers.revertDefaultAxisMinMax(); + return this.updateHelpers._updateSeries(newSeries, animate, overwriteInitialSeries); + } + + /** + * Allows users to append a new series after the chart has rendered. + * + * @param {array} newSerie - New serie which will be appended to the existing series + */ + }, { + key: "appendSeries", + value: function appendSeries(newSerie) { + var animate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + var overwriteInitialSeries = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + var newSeries = this.w.config.series.slice(); + newSeries.push(newSerie); + this.series.resetSeries(false); + this.updateHelpers.revertDefaultAxisMinMax(); + return this.updateHelpers._updateSeries(newSeries, animate, overwriteInitialSeries); + } + + /** + * Allows users to append Data to series. + * + * @param {array} newData - New data in the same format as series + */ + }, { + key: "appendData", + value: function appendData(newData) { + var overwriteInitialSeries = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + var me = this; + me.w.globals.dataChanged = true; + me.series.getPreviousPaths(); + var newSeries = me.w.config.series.slice(); + for (var i = 0; i < newSeries.length; i++) { + if (newData[i] !== null && typeof newData[i] !== 'undefined') { + for (var j = 0; j < newData[i].data.length; j++) { + newSeries[i].data.push(newData[i].data[j]); + } + } + } + me.w.config.series = newSeries; + if (overwriteInitialSeries) { + me.w.globals.initialSeries = Utils$1.clone(me.w.config.series); + } + return this.update(); + } + }, { + key: "update", + value: function update(options) { + var _this5 = this; + return new Promise(function (resolve, reject) { + new Destroy(_this5.ctx).clear({ + isUpdating: true + }); + var graphData = _this5.create(_this5.w.config.series, options); + if (!graphData) return resolve(_this5); + _this5.mount(graphData).then(function () { + if (typeof _this5.w.config.chart.events.updated === 'function') { + _this5.w.config.chart.events.updated(_this5, _this5.w); + } + _this5.events.fireEvent('updated', [_this5, _this5.w]); + _this5.w.globals.isDirty = true; + resolve(_this5); + }).catch(function (e) { + reject(e); + }); + }); + } + + /** + * Get all charts in the same "group" (including the instance which is called upon) to sync them when user zooms in/out or pan. + */ + }, { + key: "getSyncedCharts", + value: function getSyncedCharts() { + var chartGroups = this.getGroupedCharts(); + var allCharts = [this]; + if (chartGroups.length) { + allCharts = []; + chartGroups.forEach(function (ch) { + allCharts.push(ch); + }); + } + return allCharts; + } + + /** + * Get charts in the same "group" (excluding the instance which is called upon) to perform operations on the other charts of the same group (eg., tooltip hovering) + */ + }, { + key: "getGroupedCharts", + value: function getGroupedCharts() { + var _this6 = this; + return Apex._chartInstances.filter(function (ch) { + if (ch.group) { + return true; + } + }).map(function (ch) { + return _this6.w.config.chart.group === ch.group ? ch.chart : _this6; + }); + } + }, { + key: "toggleSeries", + value: function toggleSeries(seriesName) { + return this.series.toggleSeries(seriesName); + } + }, { + key: "highlightSeriesOnLegendHover", + value: function highlightSeriesOnLegendHover(e, targetElement) { + return this.series.toggleSeriesOnHover(e, targetElement); + } + }, { + key: "showSeries", + value: function showSeries(seriesName) { + this.series.showSeries(seriesName); + } + }, { + key: "hideSeries", + value: function hideSeries(seriesName) { + this.series.hideSeries(seriesName); + } + }, { + key: "highlightSeries", + value: function highlightSeries(seriesName) { + this.series.highlightSeries(seriesName); + } + }, { + key: "isSeriesHidden", + value: function isSeriesHidden(seriesName) { + this.series.isSeriesHidden(seriesName); + } + }, { + key: "resetSeries", + value: function resetSeries() { + var shouldUpdateChart = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; + var shouldResetZoom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + this.series.resetSeries(shouldUpdateChart, shouldResetZoom); + } + + // Public method to add event listener on chart context + }, { + key: "addEventListener", + value: function addEventListener(name, handler) { + this.events.addEventListener(name, handler); + } + + // Public method to remove event listener on chart context + }, { + key: "removeEventListener", + value: function removeEventListener(name, handler) { + this.events.removeEventListener(name, handler); + } + }, { + key: "addXaxisAnnotation", + value: function addXaxisAnnotation(opts) { + var pushToMemory = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + var context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined; + var me = this; + if (context) { + me = context; + } + me.annotations.addXaxisAnnotationExternal(opts, pushToMemory, me); + } + }, { + key: "addYaxisAnnotation", + value: function addYaxisAnnotation(opts) { + var pushToMemory = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + var context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined; + var me = this; + if (context) { + me = context; + } + me.annotations.addYaxisAnnotationExternal(opts, pushToMemory, me); + } + }, { + key: "addPointAnnotation", + value: function addPointAnnotation(opts) { + var pushToMemory = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + var context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined; + var me = this; + if (context) { + me = context; + } + me.annotations.addPointAnnotationExternal(opts, pushToMemory, me); + } + }, { + key: "clearAnnotations", + value: function clearAnnotations() { + var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined; + var me = this; + if (context) { + me = context; + } + me.annotations.clearAnnotations(me); + } + }, { + key: "removeAnnotation", + value: function removeAnnotation(id) { + var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; + var me = this; + if (context) { + me = context; + } + me.annotations.removeAnnotation(me, id); + } + }, { + key: "getChartArea", + value: function getChartArea() { + var el = this.w.globals.dom.baseEl.querySelector('.apexcharts-inner'); + return el; + } + }, { + key: "getSeriesTotalXRange", + value: function getSeriesTotalXRange(minX, maxX) { + return this.coreUtils.getSeriesTotalsXRange(minX, maxX); + } + }, { + key: "getHighestValueInSeries", + value: function getHighestValueInSeries() { + var seriesIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + var range = new Range(this.ctx); + return range.getMinYMaxY(seriesIndex).highestY; + } + }, { + key: "getLowestValueInSeries", + value: function getLowestValueInSeries() { + var seriesIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + var range = new Range(this.ctx); + return range.getMinYMaxY(seriesIndex).lowestY; + } + }, { + key: "getSeriesTotal", + value: function getSeriesTotal() { + return this.w.globals.seriesTotals; + } + }, { + key: "toggleDataPointSelection", + value: function toggleDataPointSelection(seriesIndex, dataPointIndex) { + return this.updateHelpers.toggleDataPointSelection(seriesIndex, dataPointIndex); + } + }, { + key: "zoomX", + value: function zoomX(min, max) { + this.ctx.toolbar.zoomUpdateOptions(min, max); + } + }, { + key: "setLocale", + value: function setLocale(localeName) { + this.localization.setCurrentLocaleValues(localeName); + } + }, { + key: "dataURI", + value: function dataURI(options) { + var exp = new Exports(this.ctx); + return exp.dataURI(options); + } + }, { + key: "getSvgString", + value: function getSvgString(scale) { + return new Exports(this.ctx).getSvgString(scale); + } + }, { + key: "exportToCSV", + value: function exportToCSV() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + var exp = new Exports(this.ctx); + return exp.exportToCSV(options); + } + }, { + key: "paper", + value: function paper() { + return this.w.globals.dom.Paper; + } + }, { + key: "_parentResizeCallback", + value: function _parentResizeCallback() { + if (this.w.globals.animationEnded && this.w.config.chart.redrawOnParentResize) { + this._windowResize(); + } + } + + /** + * Handle window resize and re-draw the whole chart. + */ + }, { + key: "_windowResize", + value: function _windowResize() { + var _this7 = this; + clearTimeout(this.w.globals.resizeTimer); + this.w.globals.resizeTimer = window.setTimeout(function () { + _this7.w.globals.resized = true; + _this7.w.globals.dataChanged = false; + + // we need to redraw the whole chart on window resize (with a small delay). + _this7.ctx.update(); + }, 150); + } + }, { + key: "_windowResizeHandler", + value: function _windowResizeHandler() { + var redraw = this.w.config.chart.redrawOnWindowResize; + if (typeof redraw === 'function') { + redraw = redraw(); + } + redraw && this._windowResize(); + } + }], [{ + key: "getChartByID", + value: function getChartByID(id) { + var chartId = Utils$1.escapeString(id); + if (!Apex._chartInstances) return undefined; + var c = Apex._chartInstances.filter(function (ch) { + return ch.id === chartId; + })[0]; + return c && c.chart; + } + + /** + * Allows the user to provide data attrs in the element and the chart will render automatically when this method is called by searching for the elements containing 'data-apexcharts' attribute + */ + }, { + key: "initOnLoad", + value: function initOnLoad() { + var els = document.querySelectorAll('[data-apexcharts]'); + for (var i = 0; i < els.length; i++) { + var el = els[i]; + var options = JSON.parse(els[i].getAttribute('data-options')); + var apexChart = new ApexCharts(el, options); + apexChart.render(); + } + } + + /** + * This static method allows users to call chart methods without necessarily from the + * instance of the chart in case user has assigned chartID to the targeted chart. + * The chartID is used for mapping the instance stored in Apex._chartInstances global variable + * + * This is helpful in cases when you don't have reference of the chart instance + * easily and need to call the method from anywhere. + * For eg, in React/Vue applications when you have many parent/child components, + * and need easy reference to other charts for performing dynamic operations + * + * @param {string} chartID - The unique identifier which will be used to call methods + * on that chart instance + * @param {function} fn - The method name to call + * @param {object} opts - The parameters which are accepted in the original method will be passed here in the same order. + */ + }, { + key: "exec", + value: function exec(chartID, fn) { + var chart = this.getChartByID(chartID); + if (!chart) return; + + // turn on the global exec flag to indicate this method was called + chart.w.globals.isExecCalled = true; + var ret = null; + if (chart.publicMethods.indexOf(fn) !== -1) { + for (var _len = arguments.length, opts = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { + opts[_key - 2] = arguments[_key]; + } + ret = chart[fn].apply(chart, opts); + } + return ret; + } + }, { + key: "merge", + value: function merge(target, source) { + return Utils$1.extend(target, source); + } + }]); + return ApexCharts; + }(); + + return ApexCharts; + +})); diff --git a/node_modules/apexcharts/dist/apexcharts.min.js b/node_modules/apexcharts/dist/apexcharts.min.js new file mode 100644 index 0000000..f54b6a3 --- /dev/null +++ b/node_modules/apexcharts/dist/apexcharts.min.js @@ -0,0 +1,38 @@ +/*! + * ApexCharts v4.5.0 + * (c) 2018-2025 ApexCharts + * Released under the MIT License. + */ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).ApexCharts=e()}(this,(function(){"use strict";function t(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,a=Array(e);i=t.length?{done:!0}:{done:!1,value:t[a++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,n=!0,o=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return n=t.done,t},e:function(t){o=!0,r=t},f:function(){try{n||null==i.return||i.return()}finally{if(o)throw r}}}}function n(t){var i=c();return function(){var a,s=l(t);if(i){var r=l(this).constructor;a=Reflect.construct(s,arguments,r)}else a=s.apply(this,arguments);return function(t,i){if(i&&("object"==typeof i||"function"==typeof i))return i;if(void 0!==i)throw new TypeError("Derived constructors may only return object or undefined");return e(t)}(this,a)}}function o(t,e,i){return(e=x(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function l(t){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},l(t)}function h(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&g(t,e)}function c(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(c=function(){return!!t})()}function d(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,a)}return i}function u(t){for(var e=1;e>16,n=i>>8&255,o=255&i;return"#"+(16777216+65536*(Math.round((a-r)*s)+r)+256*(Math.round((a-n)*s)+n)+(Math.round((a-o)*s)+o)).toString(16).slice(1)}},{key:"shadeColor",value:function(e,i){return t.isColorHex(i)?this.shadeHexColor(e,i):this.shadeRGBColor(e,i)}}],[{key:"bind",value:function(t,e){return function(){return t.apply(e,arguments)}}},{key:"isObject",value:function(t){return t&&"object"===b(t)&&!Array.isArray(t)&&null!=t}},{key:"is",value:function(t,e){return Object.prototype.toString.call(e)==="[object "+t+"]"}},{key:"listToArray",value:function(t){var e,i=[];for(e=0;e1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if(null===t||"object"!==b(t))return t;if(i.has(t))return i.get(t);if(Array.isArray(t)){e=[],i.set(t,e);for(var a=0;a1&&void 0!==arguments[1]?arguments[1]:2;return Number.isInteger(t)?t:parseFloat(t.toPrecision(e))}},{key:"randomId",value:function(){return(Math.random()+1).toString(36).substring(4)}},{key:"noExponents",value:function(t){return t.toString().includes("e")?Math.round(t):t}},{key:"elementExists",value:function(t){return!(!t||!t.isConnected)}},{key:"getDimensions",value:function(t){var e=getComputedStyle(t,null),i=t.clientHeight,a=t.clientWidth;return i-=parseFloat(e.paddingTop)+parseFloat(e.paddingBottom),[a-=parseFloat(e.paddingLeft)+parseFloat(e.paddingRight),i]}},{key:"getBoundingClientRect",value:function(t){var e=t.getBoundingClientRect();return{top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:t.clientWidth,height:t.clientHeight,x:e.left,y:e.top}}},{key:"getLargestStringFromArr",value:function(t){return t.reduce((function(t,e){return Array.isArray(e)&&(e=e.reduce((function(t,e){return t.length>e.length?t:e}))),t.length>e.length?t:e}),0)}},{key:"hexToRgba",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"#999999",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.6;"#"!==t.substring(0,1)&&(t="#999999");var i=t.replace("#","");i=i.match(new RegExp("(.{"+i.length/3+"})","g"));for(var a=0;a1&&void 0!==arguments[1]?arguments[1]:"x",i=t.toString().slice();return i=i.replace(/[` ~!@#$%^&*()|+\=?;:'",.<>{}[\]\\/]/gi,e)}},{key:"negToZero",value:function(t){return t<0?0:t}},{key:"moveIndexInArray",value:function(t,e,i){if(i>=t.length)for(var a=i-t.length+1;a--;)t.push(void 0);return t.splice(i,0,t.splice(e,1)[0]),t}},{key:"extractNumber",value:function(t){return parseFloat(t.replace(/[^\d.]*/g,""))}},{key:"findAncestor",value:function(t,e){for(;(t=t.parentElement)&&!t.classList.contains(e););return t}},{key:"setELstyles",value:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t.style.key=e[i])}},{key:"preciseAddition",value:function(t,e){var i=(String(t).split(".")[1]||"").length,a=(String(e).split(".")[1]||"").length,s=Math.pow(10,Math.max(i,a));return(Math.round(t*s)+Math.round(e*s))/s}},{key:"isNumber",value:function(t){return!isNaN(t)&&parseFloat(Number(t))===t&&!isNaN(parseInt(t,10))}},{key:"isFloat",value:function(t){return Number(t)===t&&t%1!=0}},{key:"isMsEdge",value:function(){var t=window.navigator.userAgent,e=t.indexOf("Edge/");return e>0&&parseInt(t.substring(e+5,t.indexOf(".",e)),10)}},{key:"getGCD",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:7,a=Math.pow(10,i-Math.floor(Math.log10(Math.max(t,e))));for(t=Math.round(Math.abs(t)*a),e=Math.round(Math.abs(e)*a);e;){var s=e;e=t%e,t=s}return t/a}},{key:"getPrimeFactors",value:function(t){for(var e=[],i=2;t>=2;)t%i==0?(e.push(i),t/=i):i++;return e}},{key:"mod",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:7,a=Math.pow(10,i-Math.floor(Math.log10(Math.max(t,e))));return(t=Math.round(Math.abs(t)*a))%(e=Math.round(Math.abs(e)*a))/a}}]),t}(),y=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"animateLine",value:function(t,e,i,a){t.attr(e).animate(a).attr(i)}},{key:"animateMarker",value:function(t,e,i,a){t.attr({opacity:0}).animate(e).attr({opacity:1}).after((function(){a()}))}},{key:"animateRect",value:function(t,e,i,a,s){t.attr(e).animate(a).attr(i).after((function(){return s()}))}},{key:"animatePathsGradually",value:function(t){var e=t.el,i=t.realIndex,a=t.j,s=t.fill,r=t.pathFrom,n=t.pathTo,o=t.speed,l=t.delay,h=this.w,c=0;h.config.chart.animations.animateGradually.enabled&&(c=h.config.chart.animations.animateGradually.delay),h.config.chart.animations.dynamicAnimation.enabled&&h.globals.dataChanged&&"bar"!==h.config.chart.type&&(c=0),this.morphSVG(e,i,a,"line"!==h.config.chart.type||h.globals.comboCharts?s:"stroke",r,n,o,l*c)}},{key:"showDelayedElements",value:function(){this.w.globals.delayedElements.forEach((function(t){var e=t.el;e.classList.remove("apexcharts-element-hidden"),e.classList.add("apexcharts-hidden-element-shown")}))}},{key:"animationCompleted",value:function(t){var e=this.w;e.globals.animationEnded||(e.globals.animationEnded=!0,this.showDelayedElements(),"function"==typeof e.config.chart.events.animationEnd&&e.config.chart.events.animationEnd(this.ctx,{el:t,w:e}))}},{key:"morphSVG",value:function(t,e,i,a,s,r,n,o){var l=this,h=this.w;s||(s=t.attr("pathFrom")),r||(r=t.attr("pathTo"));var c=function(t){return"radar"===h.config.chart.type&&(n=1),"M 0 ".concat(h.globals.gridHeight)};(!s||s.indexOf("undefined")>-1||s.indexOf("NaN")>-1)&&(s=c()),(!r.trim()||r.indexOf("undefined")>-1||r.indexOf("NaN")>-1)&&(r=c()),h.globals.shouldAnimate||(n=1),t.plot(s).animate(1,o).plot(s).animate(n,o).plot(r).after((function(){v.isNumber(i)?i===h.globals.series[h.globals.maxValsInArrayIndex].length-2&&h.globals.shouldAnimate&&l.animationCompleted(t):"none"!==a&&h.globals.shouldAnimate&&(!h.globals.comboCharts&&e===h.globals.series.length-1||h.globals.comboCharts)&&l.animationCompleted(t),l.showDelayedElements()}))}}]),t}();const w={},k=[];function A(t,e){if(Array.isArray(t))for(const i of t)A(i,e);else if("object"!=typeof t)S(Object.getOwnPropertyNames(e)),w[t]=Object.assign(w[t]||{},e);else for(const e in t)A(e,t[e])}function C(t){return w[t]||{}}function S(t){k.push(...t)}function L(t,e){let i;const a=t.length,s=[];for(i=0;iz.has(t.nodeName),R=(t,e,i={})=>{const a={...e};for(const t in a)a[t].valueOf()===i[t]&&delete a[t];Object.keys(a).length?t.node.setAttribute("data-svgjs",JSON.stringify(a)):(t.node.removeAttribute("data-svgjs"),t.node.removeAttribute("svgjs:data"))},E="http://www.w3.org/2000/svg",Y="http://www.w3.org/2000/xmlns/",H="http://www.w3.org/1999/xlink",O={window:"undefined"==typeof window?null:window,document:"undefined"==typeof document?null:document};function F(){return O.window}let D=class{};const _={},N="___SYMBOL___ROOT___";function W(t,e=E){return O.document.createElementNS(e,t)}function B(t,e=!1){if(t instanceof D)return t;if("object"==typeof t)return U(t);if(null==t)return new _[N];if("string"==typeof t&&"<"!==t.charAt(0))return U(O.document.querySelector(t));const i=e?O.document.createElement("div"):W("svg");return i.innerHTML=t,t=U(i.firstChild),i.removeChild(i.firstChild),t}function G(t,e){return e&&(e instanceof O.window.Node||e.ownerDocument&&e instanceof e.ownerDocument.defaultView.Node)?e:W(t)}function V(t){if(!t)return null;if(t.instance instanceof D)return t.instance;if("#document-fragment"===t.nodeName)return new _.Fragment(t);let e=P(t.nodeName||"Dom");return"LinearGradient"===e||"RadialGradient"===e?e="Gradient":_[e]||(e="Dom"),new _[e](t)}let U=V;function q(t,e=t.name,i=!1){return _[e]=t,i&&(_[N]=t),S(Object.getOwnPropertyNames(t.prototype)),t}let Z=1e3;function $(t){return"Svgjs"+P(t)+Z++}function J(t){for(let e=t.children.length-1;e>=0;e--)J(t.children[e]);return t.id?(t.id=$(t.nodeName),t):t}function Q(t,e){let i,a;for(a=(t=Array.isArray(t)?t:[t]).length-1;a>=0;a--)for(i in e)t[a].prototype[i]=e[i]}function K(t){return function(...e){const i=e[e.length-1];return!i||i.constructor!==Object||i instanceof Array?t.apply(this,e):t.apply(this,e.slice(0,-1)).attr(i)}}A("Dom",{siblings:function(){return this.parent().children()},position:function(){return this.parent().index(this)},next:function(){return this.siblings()[this.position()+1]},prev:function(){return this.siblings()[this.position()-1]},forward:function(){const t=this.position();return this.parent().add(this.remove(),t+1),this},backward:function(){const t=this.position();return this.parent().add(this.remove(),t?t-1:0),this},front:function(){return this.parent().add(this.remove()),this},back:function(){return this.parent().add(this.remove(),0),this},before:function(t){(t=B(t)).remove();const e=this.position();return this.parent().add(t,e),this},after:function(t){(t=B(t)).remove();const e=this.position();return this.parent().add(t,e+1),this},insertBefore:function(t){return(t=B(t)).before(this),this},insertAfter:function(t){return(t=B(t)).after(this),this}});const tt=/^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i,et=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,it=/rgb\((\d+),(\d+),(\d+)\)/,at=/(#[a-z_][a-z0-9\-_]*)/i,st=/\)\s*,?\s*/,rt=/\s/g,nt=/^#[a-f0-9]{3}$|^#[a-f0-9]{6}$/i,ot=/^rgb\(/,lt=/^(\s+)?$/,ht=/^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ct=/\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i,dt=/[\s,]+/,ut=/[MLHVCSQTAZ]/i;function gt(t){const e=Math.round(t),i=Math.max(0,Math.min(255,e)).toString(16);return 1===i.length?"0"+i:i}function pt(t,e){for(let i=e.length;i--;)if(null==t[e[i]])return!1;return!0}function ft(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}A("Dom",{classes:function(){const t=this.attr("class");return null==t?[]:t.trim().split(dt)},hasClass:function(t){return-1!==this.classes().indexOf(t)},addClass:function(t){if(!this.hasClass(t)){const e=this.classes();e.push(t),this.attr("class",e.join(" "))}return this},removeClass:function(t){return this.hasClass(t)&&this.attr("class",this.classes().filter((function(e){return e!==t})).join(" ")),this},toggleClass:function(t){return this.hasClass(t)?this.removeClass(t):this.addClass(t)}}),A("Dom",{css:function(t,e){const i={};if(0===arguments.length)return this.node.style.cssText.split(/\s*;\s*/).filter((function(t){return!!t.length})).forEach((function(t){const e=t.split(/\s*:\s*/);i[e[0]]=e[1]})),i;if(arguments.length<2){if(Array.isArray(t)){for(const e of t){const t=e;i[e]=this.node.style.getPropertyValue(t)}return i}if("string"==typeof t)return this.node.style.getPropertyValue(t);if("object"==typeof t)for(const e in t)this.node.style.setProperty(e,null==t[e]||lt.test(t[e])?"":t[e])}return 2===arguments.length&&this.node.style.setProperty(t,null==e||lt.test(e)?"":e),this},show:function(){return this.css("display","")},hide:function(){return this.css("display","none")},visible:function(){return"none"!==this.css("display")}}),A("Dom",{data:function(t,e,i){if(null==t)return this.data(L(function(t,e){let i;const a=t.length,s=[];for(i=0;i0===t.nodeName.indexOf("data-"))),(t=>t.nodeName.slice(5))));if(t instanceof Array){const e={};for(const i of t)e[i]=this.data(i);return e}if("object"==typeof t)for(e in t)this.data(e,t[e]);else if(arguments.length<2)try{return JSON.parse(this.attr("data-"+t))}catch(e){return this.attr("data-"+t)}else this.attr("data-"+t,null===e?null:!0===i||"string"==typeof e||"number"==typeof e?e:JSON.stringify(e));return this}}),A("Dom",{remember:function(t,e){if("object"==typeof arguments[0])for(const e in t)this.remember(e,t[e]);else{if(1===arguments.length)return this.memory()[t];this.memory()[t]=e}return this},forget:function(){if(0===arguments.length)this._memory={};else for(let t=arguments.length-1;t>=0;t--)delete this.memory()[arguments[t]];return this},memory:function(){return this._memory=this._memory||{}}});class xt{constructor(...t){this.init(...t)}static isColor(t){return t&&(t instanceof xt||this.isRgb(t)||this.test(t))}static isRgb(t){return t&&"number"==typeof t.r&&"number"==typeof t.g&&"number"==typeof t.b}static random(t="vibrant",e){const{random:i,round:a,sin:s,PI:r}=Math;if("vibrant"===t){const t=24*i()+57,e=38*i()+45,a=360*i();return new xt(t,e,a,"lch")}if("sine"===t){const t=a(80*s(2*r*(e=null==e?i():e)/.5+.01)+150),n=a(50*s(2*r*e/.5+4.6)+200),o=a(100*s(2*r*e/.5+2.3)+150);return new xt(t,n,o)}if("pastel"===t){const t=8*i()+86,e=17*i()+9,a=360*i();return new xt(t,e,a,"lch")}if("dark"===t){const t=10+10*i(),e=50*i()+86,a=360*i();return new xt(t,e,a,"lch")}if("rgb"===t){const t=255*i(),e=255*i(),a=255*i();return new xt(t,e,a)}if("lab"===t){const t=100*i(),e=256*i()-128,a=256*i()-128;return new xt(t,e,a,"lab")}if("grey"===t){const t=255*i();return new xt(t,t,t)}throw new Error("Unsupported random color mode")}static test(t){return"string"==typeof t&&(nt.test(t)||ot.test(t))}cmyk(){const{_a:t,_b:e,_c:i}=this.rgb(),[a,s,r]=[t,e,i].map((t=>t/255)),n=Math.min(1-a,1-s,1-r);if(1===n)return new xt(0,0,0,1,"cmyk");return new xt((1-a-n)/(1-n),(1-s-n)/(1-n),(1-r-n)/(1-n),n,"cmyk")}hsl(){const{_a:t,_b:e,_c:i}=this.rgb(),[a,s,r]=[t,e,i].map((t=>t/255)),n=Math.max(a,s,r),o=Math.min(a,s,r),l=(n+o)/2,h=n===o,c=n-o;return new xt(360*(h?0:n===a?((s-r)/c+(s.5?c/(2-n-o):c/(n+o)),100*l,"hsl")}init(t=0,e=0,i=0,a=0,s="rgb"){if(t=t||0,this.space)for(const t in this.space)delete this[this.space[t]];if("number"==typeof t)s="string"==typeof a?a:s,a="string"==typeof a?0:a,Object.assign(this,{_a:t,_b:e,_c:i,_d:a,space:s});else if(t instanceof Array)this.space=e||("string"==typeof t[3]?t[3]:t[4])||"rgb",Object.assign(this,{_a:t[0],_b:t[1],_c:t[2],_d:t[3]||0});else if(t instanceof Object){const i=function(t,e){const i=pt(t,"rgb")?{_a:t.r,_b:t.g,_c:t.b,_d:0,space:"rgb"}:pt(t,"xyz")?{_a:t.x,_b:t.y,_c:t.z,_d:0,space:"xyz"}:pt(t,"hsl")?{_a:t.h,_b:t.s,_c:t.l,_d:0,space:"hsl"}:pt(t,"lab")?{_a:t.l,_b:t.a,_c:t.b,_d:0,space:"lab"}:pt(t,"lch")?{_a:t.l,_b:t.c,_c:t.h,_d:0,space:"lch"}:pt(t,"cmyk")?{_a:t.c,_b:t.m,_c:t.y,_d:t.k,space:"cmyk"}:{_a:0,_b:0,_c:0,space:"rgb"};return i.space=e||i.space,i}(t,e);Object.assign(this,i)}else if("string"==typeof t)if(ot.test(t)){const e=t.replace(rt,""),[i,a,s]=it.exec(e).slice(1,4).map((t=>parseInt(t)));Object.assign(this,{_a:i,_b:a,_c:s,_d:0,space:"rgb"})}else{if(!nt.test(t))throw Error("Unsupported string format, can't construct Color");{const e=t=>parseInt(t,16),[,i,a,s]=et.exec(function(t){return 4===t.length?["#",t.substring(1,2),t.substring(1,2),t.substring(2,3),t.substring(2,3),t.substring(3,4),t.substring(3,4)].join(""):t}(t)).map(e);Object.assign(this,{_a:i,_b:a,_c:s,_d:0,space:"rgb"})}}const{_a:r,_b:n,_c:o,_d:l}=this,h="rgb"===this.space?{r:r,g:n,b:o}:"xyz"===this.space?{x:r,y:n,z:o}:"hsl"===this.space?{h:r,s:n,l:o}:"lab"===this.space?{l:r,a:n,b:o}:"lch"===this.space?{l:r,c:n,h:o}:"cmyk"===this.space?{c:r,m:n,y:o,k:l}:{};Object.assign(this,h)}lab(){const{x:t,y:e,z:i}=this.xyz();return new xt(116*e-16,500*(t-e),200*(e-i),"lab")}lch(){const{l:t,a:e,b:i}=this.lab(),a=Math.sqrt(e**2+i**2);let s=180*Math.atan2(i,e)/Math.PI;s<0&&(s*=-1,s=360-s);return new xt(t,a,s,"lch")}rgb(){if("rgb"===this.space)return this;if("lab"===(t=this.space)||"xyz"===t||"lch"===t){let{x:t,y:e,z:i}=this;if("lab"===this.space||"lch"===this.space){let{l:a,a:s,b:r}=this;if("lch"===this.space){const{c:t,h:e}=this,i=Math.PI/180;s=t*Math.cos(i*e),r=t*Math.sin(i*e)}const n=(a+16)/116,o=s/500+n,l=n-r/200,h=16/116,c=.008856,d=7.787;t=.95047*(o**3>c?o**3:(o-h)/d),e=1*(n**3>c?n**3:(n-h)/d),i=1.08883*(l**3>c?l**3:(l-h)/d)}const a=3.2406*t+-1.5372*e+-.4986*i,s=-.9689*t+1.8758*e+.0415*i,r=.0557*t+-.204*e+1.057*i,n=Math.pow,o=.0031308,l=a>o?1.055*n(a,1/2.4)-.055:12.92*a,h=s>o?1.055*n(s,1/2.4)-.055:12.92*s,c=r>o?1.055*n(r,1/2.4)-.055:12.92*r;return new xt(255*l,255*h,255*c)}if("hsl"===this.space){let{h:t,s:e,l:i}=this;if(t/=360,e/=100,i/=100,0===e){i*=255;return new xt(i,i,i)}const a=i<.5?i*(1+e):i+e-i*e,s=2*i-a,r=255*ft(s,a,t+1/3),n=255*ft(s,a,t),o=255*ft(s,a,t-1/3);return new xt(r,n,o)}if("cmyk"===this.space){const{c:t,m:e,y:i,k:a}=this,s=255*(1-Math.min(1,t*(1-a)+a)),r=255*(1-Math.min(1,e*(1-a)+a)),n=255*(1-Math.min(1,i*(1-a)+a));return new xt(s,r,n)}return this;var t}toArray(){const{_a:t,_b:e,_c:i,_d:a,space:s}=this;return[t,e,i,a,s]}toHex(){const[t,e,i]=this._clamped().map(gt);return`#${t}${e}${i}`}toRgb(){const[t,e,i]=this._clamped();return`rgb(${t},${e},${i})`}toString(){return this.toHex()}xyz(){const{_a:t,_b:e,_c:i}=this.rgb(),[a,s,r]=[t,e,i].map((t=>t/255)),n=a>.04045?Math.pow((a+.055)/1.055,2.4):a/12.92,o=s>.04045?Math.pow((s+.055)/1.055,2.4):s/12.92,l=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92,h=(.4124*n+.3576*o+.1805*l)/.95047,c=(.2126*n+.7152*o+.0722*l)/1,d=(.0193*n+.1192*o+.9505*l)/1.08883,u=h>.008856?Math.pow(h,1/3):7.787*h+16/116,g=c>.008856?Math.pow(c,1/3):7.787*c+16/116,p=d>.008856?Math.pow(d,1/3):7.787*d+16/116;return new xt(u,g,p,"xyz")}_clamped(){const{_a:t,_b:e,_c:i}=this.rgb(),{max:a,min:s,round:r}=Math;return[t,e,i].map((t=>a(0,s(r(t),255))))}}class bt{constructor(...t){this.init(...t)}clone(){return new bt(this)}init(t,e){const i=0,a=0,s=Array.isArray(t)?{x:t[0],y:t[1]}:"object"==typeof t?{x:t.x,y:t.y}:{x:t,y:e};return this.x=null==s.x?i:s.x,this.y=null==s.y?a:s.y,this}toArray(){return[this.x,this.y]}transform(t){return this.clone().transformO(t)}transformO(t){vt.isMatrixLike(t)||(t=new vt(t));const{x:e,y:i}=this;return this.x=t.a*e+t.c*i+t.e,this.y=t.b*e+t.d*i+t.f,this}}function mt(t,e,i){return Math.abs(e-t)<(i||1e-6)}class vt{constructor(...t){this.init(...t)}static formatTransforms(t){const e="both"===t.flip||!0===t.flip,i=t.flip&&(e||"x"===t.flip)?-1:1,a=t.flip&&(e||"y"===t.flip)?-1:1,s=t.skew&&t.skew.length?t.skew[0]:isFinite(t.skew)?t.skew:isFinite(t.skewX)?t.skewX:0,r=t.skew&&t.skew.length?t.skew[1]:isFinite(t.skew)?t.skew:isFinite(t.skewY)?t.skewY:0,n=t.scale&&t.scale.length?t.scale[0]*i:isFinite(t.scale)?t.scale*i:isFinite(t.scaleX)?t.scaleX*i:i,o=t.scale&&t.scale.length?t.scale[1]*a:isFinite(t.scale)?t.scale*a:isFinite(t.scaleY)?t.scaleY*a:a,l=t.shear||0,h=t.rotate||t.theta||0,c=new bt(t.origin||t.around||t.ox||t.originX,t.oy||t.originY),d=c.x,u=c.y,g=new bt(t.position||t.px||t.positionX||NaN,t.py||t.positionY||NaN),p=g.x,f=g.y,x=new bt(t.translate||t.tx||t.translateX,t.ty||t.translateY),b=x.x,m=x.y,v=new bt(t.relative||t.rx||t.relativeX,t.ry||t.relativeY);return{scaleX:n,scaleY:o,skewX:s,skewY:r,shear:l,theta:h,rx:v.x,ry:v.y,tx:b,ty:m,ox:d,oy:u,px:p,py:f}}static fromArray(t){return{a:t[0],b:t[1],c:t[2],d:t[3],e:t[4],f:t[5]}}static isMatrixLike(t){return null!=t.a||null!=t.b||null!=t.c||null!=t.d||null!=t.e||null!=t.f}static matrixMultiply(t,e,i){const a=t.a*e.a+t.c*e.b,s=t.b*e.a+t.d*e.b,r=t.a*e.c+t.c*e.d,n=t.b*e.c+t.d*e.d,o=t.e+t.a*e.e+t.c*e.f,l=t.f+t.b*e.e+t.d*e.f;return i.a=a,i.b=s,i.c=r,i.d=n,i.e=o,i.f=l,i}around(t,e,i){return this.clone().aroundO(t,e,i)}aroundO(t,e,i){const a=t||0,s=e||0;return this.translateO(-a,-s).lmultiplyO(i).translateO(a,s)}clone(){return new vt(this)}decompose(t=0,e=0){const i=this.a,a=this.b,s=this.c,r=this.d,n=this.e,o=this.f,l=i*r-a*s,h=l>0?1:-1,c=h*Math.sqrt(i*i+a*a),d=Math.atan2(h*a,h*i),u=180/Math.PI*d,g=Math.cos(d),p=Math.sin(d),f=(i*s+a*r)/l,x=s*c/(f*i-a)||r*c/(f*a+i);return{scaleX:c,scaleY:x,shear:f,rotate:u,translateX:n-t+t*g*c+e*(f*g*c-p*x),translateY:o-e+t*p*c+e*(f*p*c+g*x),originX:t,originY:e,a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}equals(t){if(t===this)return!0;const e=new vt(t);return mt(this.a,e.a)&&mt(this.b,e.b)&&mt(this.c,e.c)&&mt(this.d,e.d)&&mt(this.e,e.e)&&mt(this.f,e.f)}flip(t,e){return this.clone().flipO(t,e)}flipO(t,e){return"x"===t?this.scaleO(-1,1,e,0):"y"===t?this.scaleO(1,-1,0,e):this.scaleO(-1,-1,t,e||t)}init(t){const e=vt.fromArray([1,0,0,1,0,0]);return t=t instanceof Gt?t.matrixify():"string"==typeof t?vt.fromArray(t.split(dt).map(parseFloat)):Array.isArray(t)?vt.fromArray(t):"object"==typeof t&&vt.isMatrixLike(t)?t:"object"==typeof t?(new vt).transform(t):6===arguments.length?vt.fromArray([].slice.call(arguments)):e,this.a=null!=t.a?t.a:e.a,this.b=null!=t.b?t.b:e.b,this.c=null!=t.c?t.c:e.c,this.d=null!=t.d?t.d:e.d,this.e=null!=t.e?t.e:e.e,this.f=null!=t.f?t.f:e.f,this}inverse(){return this.clone().inverseO()}inverseO(){const t=this.a,e=this.b,i=this.c,a=this.d,s=this.e,r=this.f,n=t*a-e*i;if(!n)throw new Error("Cannot invert "+this);const o=a/n,l=-e/n,h=-i/n,c=t/n,d=-(o*s+h*r),u=-(l*s+c*r);return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}lmultiply(t){return this.clone().lmultiplyO(t)}lmultiplyO(t){const e=t instanceof vt?t:new vt(t);return vt.matrixMultiply(e,this,this)}multiply(t){return this.clone().multiplyO(t)}multiplyO(t){const e=t instanceof vt?t:new vt(t);return vt.matrixMultiply(this,e,this)}rotate(t,e,i){return this.clone().rotateO(t,e,i)}rotateO(t,e=0,i=0){t=M(t);const a=Math.cos(t),s=Math.sin(t),{a:r,b:n,c:o,d:l,e:h,f:c}=this;return this.a=r*a-n*s,this.b=n*a+r*s,this.c=o*a-l*s,this.d=l*a+o*s,this.e=h*a-c*s+i*s-e*a+e,this.f=c*a+h*s-e*s-i*a+i,this}scale(){return this.clone().scaleO(...arguments)}scaleO(t,e=t,i=0,a=0){3===arguments.length&&(a=i,i=e,e=t);const{a:s,b:r,c:n,d:o,e:l,f:h}=this;return this.a=s*t,this.b=r*e,this.c=n*t,this.d=o*e,this.e=l*t-i*t+i,this.f=h*e-a*e+a,this}shear(t,e,i){return this.clone().shearO(t,e,i)}shearO(t,e=0,i=0){const{a:a,b:s,c:r,d:n,e:o,f:l}=this;return this.a=a+s*t,this.c=r+n*t,this.e=o+l*t-i*t,this}skew(){return this.clone().skewO(...arguments)}skewO(t,e=t,i=0,a=0){3===arguments.length&&(a=i,i=e,e=t),t=M(t),e=M(e);const s=Math.tan(t),r=Math.tan(e),{a:n,b:o,c:l,d:h,e:c,f:d}=this;return this.a=n+o*s,this.b=o+n*r,this.c=l+h*s,this.d=h+l*r,this.e=c+d*s-a*s,this.f=d+c*r-i*r,this}skewX(t,e,i){return this.skew(t,0,e,i)}skewY(t,e,i){return this.skew(0,t,e,i)}toArray(){return[this.a,this.b,this.c,this.d,this.e,this.f]}toString(){return"matrix("+this.a+","+this.b+","+this.c+","+this.d+","+this.e+","+this.f+")"}transform(t){if(vt.isMatrixLike(t)){return new vt(t).multiplyO(this)}const e=vt.formatTransforms(t),{x:i,y:a}=new bt(e.ox,e.oy).transform(this),s=(new vt).translateO(e.rx,e.ry).lmultiplyO(this).translateO(-i,-a).scaleO(e.scaleX,e.scaleY).skewO(e.skewX,e.skewY).shearO(e.shear).rotateO(e.theta).translateO(i,a);if(isFinite(e.px)||isFinite(e.py)){const t=new bt(i,a).transform(s),r=isFinite(e.px)?e.px-t.x:0,n=isFinite(e.py)?e.py-t.y:0;s.translateO(r,n)}return s.translateO(e.tx,e.ty),s}translate(t,e){return this.clone().translateO(t,e)}translateO(t,e){return this.e+=t||0,this.f+=e||0,this}valueOf(){return{a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}}function yt(){if(!yt.nodes){const t=B().size(2,0);t.node.style.cssText=["opacity: 0","position: absolute","left: -100%","top: -100%","overflow: hidden"].join(";"),t.attr("focusable","false"),t.attr("aria-hidden","true");const e=t.path().node;yt.nodes={svg:t,path:e}}if(!yt.nodes.svg.node.parentNode){const t=O.document.body||O.document.documentElement;yt.nodes.svg.addTo(t)}return yt.nodes}function wt(t){return!(t.width||t.height||t.x||t.y)}q(vt,"Matrix");class kt{constructor(...t){this.init(...t)}addOffset(){return this.x+=O.window.pageXOffset,this.y+=O.window.pageYOffset,new kt(this)}init(t){return t="string"==typeof t?t.split(dt).map(parseFloat):Array.isArray(t)?t:"object"==typeof t?[null!=t.left?t.left:t.x,null!=t.top?t.top:t.y,t.width,t.height]:4===arguments.length?[].slice.call(arguments):[0,0,0,0],this.x=t[0]||0,this.y=t[1]||0,this.width=this.w=t[2]||0,this.height=this.h=t[3]||0,this.x2=this.x+this.w,this.y2=this.y+this.h,this.cx=this.x+this.w/2,this.cy=this.y+this.h/2,this}isNulled(){return wt(this)}merge(t){const e=Math.min(this.x,t.x),i=Math.min(this.y,t.y),a=Math.max(this.x+this.width,t.x+t.width)-e,s=Math.max(this.y+this.height,t.y+t.height)-i;return new kt(e,i,a,s)}toArray(){return[this.x,this.y,this.width,this.height]}toString(){return this.x+" "+this.y+" "+this.width+" "+this.height}transform(t){t instanceof vt||(t=new vt(t));let e=1/0,i=-1/0,a=1/0,s=-1/0;return[new bt(this.x,this.y),new bt(this.x2,this.y),new bt(this.x,this.y2),new bt(this.x2,this.y2)].forEach((function(r){r=r.transform(t),e=Math.min(e,r.x),i=Math.max(i,r.x),a=Math.min(a,r.y),s=Math.max(s,r.y)})),new kt(e,a,i-e,s-a)}}function At(t,e,i){let a;try{if(a=e(t.node),wt(a)&&((s=t.node)!==O.document&&!(O.document.documentElement.contains||function(t){for(;t.parentNode;)t=t.parentNode;return t===O.document}).call(O.document.documentElement,s)))throw new Error("Element not in the dom")}catch(e){a=i(t)}var s;return a}A({viewbox:{viewbox(t,e,i,a){return null==t?new kt(this.attr("viewBox")):this.attr("viewBox",new kt(t,e,i,a))},zoom(t,e){let{width:i,height:a}=this.attr(["width","height"]);if((i||a)&&"string"!=typeof i&&"string"!=typeof a||(i=this.node.clientWidth,a=this.node.clientHeight),!i||!a)throw new Error("Impossible to get absolute width and height. Please provide an absolute width and height attribute on the zooming element");const s=this.viewbox(),r=i/s.width,n=a/s.height,o=Math.min(r,n);if(null==t)return o;let l=o/t;l===1/0&&(l=Number.MAX_SAFE_INTEGER/100),e=e||new bt(i/2/r+s.x,a/2/n+s.y);const h=new kt(s).transform(new vt({scale:l,origin:e}));return this.viewbox(h)}}}),q(kt,"Box");class Ct extends Array{constructor(t=[],...e){if(super(t,...e),"number"==typeof t)return this;this.length=0,this.push(...t)}}Q([Ct],{each(t,...e){return"function"==typeof t?this.map(((e,i,a)=>t.call(e,e,i,a))):this.map((i=>i[t](...e)))},toArray(){return Array.prototype.concat.apply([],this)}});const St=["toArray","constructor","each"];function Lt(t,e){return new Ct(L((e||O.document).querySelectorAll(t),(function(t){return V(t)})))}Ct.extend=function(t){t=t.reduce(((t,e)=>(St.includes(e)||"_"===e[0]||(e in Array.prototype&&(t["$"+e]=Array.prototype[e]),t[e]=function(...t){return this.each(e,...t)}),t)),{}),Q([Ct],t)};let Mt=0;const Pt={};function It(t){let e=t.getEventHolder();return e===O.window&&(e=Pt),e.events||(e.events={}),e.events}function Tt(t){return t.getEventTarget()}function zt(t,e,i,a,s){const r=i.bind(a||t),n=B(t),o=It(n),l=Tt(n);e=Array.isArray(e)?e:e.split(dt),i._svgjsListenerId||(i._svgjsListenerId=++Mt),e.forEach((function(t){const e=t.split(".")[0],a=t.split(".")[1]||"*";o[e]=o[e]||{},o[e][a]=o[e][a]||{},o[e][a][i._svgjsListenerId]=r,l.addEventListener(e,r,s||!1)}))}function Xt(t,e,i,a){const s=B(t),r=It(s),n=Tt(s);("function"!=typeof i||(i=i._svgjsListenerId))&&(e=Array.isArray(e)?e:(e||"").split(dt)).forEach((function(t){const e=t&&t.split(".")[0],o=t&&t.split(".")[1];let l,h;if(i)r[e]&&r[e][o||"*"]&&(n.removeEventListener(e,r[e][o||"*"][i],a||!1),delete r[e][o||"*"][i]);else if(e&&o){if(r[e]&&r[e][o]){for(h in r[e][o])Xt(n,[e,o].join("."),h);delete r[e][o]}}else if(o)for(t in r)for(l in r[t])o===l&&Xt(n,[t,o].join("."));else if(e){if(r[e]){for(l in r[e])Xt(n,[e,l].join("."));delete r[e]}}else{for(t in r)Xt(n,t);!function(t){let e=t.getEventHolder();e===O.window&&(e=Pt),e.events&&(e.events={})}(s)}}))}class Rt extends D{addEventListener(){}dispatch(t,e,i){return function(t,e,i,a){const s=Tt(t);return e instanceof O.window.Event||(e=new O.window.CustomEvent(e,{detail:i,cancelable:!0,...a})),s.dispatchEvent(e),e}(this,t,e,i)}dispatchEvent(t){const e=this.getEventHolder().events;if(!e)return!0;const i=e[t.type];for(const e in i)for(const a in i[e])i[e][a](t);return!t.defaultPrevented}fire(t,e,i){return this.dispatch(t,e,i),this}getEventHolder(){return this}getEventTarget(){return this}off(t,e,i){return Xt(this,t,e,i),this}on(t,e,i,a){return zt(this,t,e,i,a),this}removeEventListener(){}}function Et(){}q(Rt,"EventTarget");const Yt=400,Ht=">",Ot=0,Ft={"fill-opacity":1,"stroke-opacity":1,"stroke-width":0,"stroke-linejoin":"miter","stroke-linecap":"butt",fill:"#000000",stroke:"#000000",opacity:1,x:0,y:0,cx:0,cy:0,width:0,height:0,r:0,rx:0,ry:0,offset:0,"stop-opacity":1,"stop-color":"#000000","text-anchor":"start"};class Dt extends Array{constructor(...t){super(...t),this.init(...t)}clone(){return new this.constructor(this)}init(t){return"number"==typeof t||(this.length=0,this.push(...this.parse(t))),this}parse(t=[]){return t instanceof Array?t:t.trim().split(dt).map(parseFloat)}toArray(){return Array.prototype.concat.apply([],this)}toSet(){return new Set(this)}toString(){return this.join(" ")}valueOf(){const t=[];return t.push(...this),t}}class _t{constructor(...t){this.init(...t)}convert(t){return new _t(this.value,t)}divide(t){return t=new _t(t),new _t(this/t,this.unit||t.unit)}init(t,e){return e=Array.isArray(t)?t[1]:e,t=Array.isArray(t)?t[0]:t,this.value=0,this.unit=e||"","number"==typeof t?this.value=isNaN(t)?0:isFinite(t)?t:t<0?-34e37:34e37:"string"==typeof t?(e=t.match(tt))&&(this.value=parseFloat(e[1]),"%"===e[5]?this.value/=100:"s"===e[5]&&(this.value*=1e3),this.unit=e[5]):t instanceof _t&&(this.value=t.valueOf(),this.unit=t.unit),this}minus(t){return t=new _t(t),new _t(this-t,this.unit||t.unit)}plus(t){return t=new _t(t),new _t(this+t,this.unit||t.unit)}times(t){return t=new _t(t),new _t(this*t,this.unit||t.unit)}toArray(){return[this.value,this.unit]}toJSON(){return this.toString()}toString(){return("%"===this.unit?~~(1e8*this.value)/1e6:"s"===this.unit?this.value/1e3:this.value)+this.unit}valueOf(){return this.value}}const Nt=new Set(["fill","stroke","color","bgcolor","stop-color","flood-color","lighting-color"]),Wt=[];class Bt extends Rt{constructor(t,e){super(),this.node=t,this.type=t.nodeName,e&&t!==e&&this.attr(e)}add(t,e){return(t=B(t)).removeNamespace&&this.node instanceof O.window.SVGElement&&t.removeNamespace(),null==e?this.node.appendChild(t.node):t.node!==this.node.childNodes[e]&&this.node.insertBefore(t.node,this.node.childNodes[e]),this}addTo(t,e){return B(t).put(this,e)}children(){return new Ct(L(this.node.children,(function(t){return V(t)})))}clear(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return this}clone(t=!0,e=!0){this.writeDataToDom();let i=this.node.cloneNode(t);return e&&(i=J(i)),new this.constructor(i)}each(t,e){const i=this.children();let a,s;for(a=0,s=i.length;a=0}html(t,e){return this.xml(t,e,"http://www.w3.org/1999/xhtml")}id(t){return void 0!==t||this.node.id||(this.node.id=$(this.type)),this.attr("id",t)}index(t){return[].slice.call(this.node.childNodes).indexOf(t.node)}last(){return V(this.node.lastChild)}matches(t){const e=this.node,i=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector||null;return i&&i.call(e,t)}parent(t){let e=this;if(!e.node.parentNode)return null;if(e=V(e.node.parentNode),!t)return e;do{if("string"==typeof t?e.matches(t):e instanceof t)return e}while(e=V(e.node.parentNode));return e}put(t,e){return t=B(t),this.add(t,e),t}putIn(t,e){return B(t).add(this,e)}remove(){return this.parent()&&this.parent().removeElement(this),this}removeElement(t){return this.node.removeChild(t.node),this}replace(t){return t=B(t),this.node.parentNode&&this.node.parentNode.replaceChild(t.node,this.node),t}round(t=2,e=null){const i=10**t,a=this.attr(e);for(const t in a)"number"==typeof a[t]&&(a[t]=Math.round(a[t]*i)/i);return this.attr(a),this}svg(t,e){return this.xml(t,e,E)}toString(){return this.id()}words(t){return this.node.textContent=t,this}wrap(t){const e=this.parent();if(!e)return this.addTo(t);const i=e.index(this);return e.put(t,i).put(this)}writeDataToDom(){return this.each((function(){this.writeDataToDom()})),this}xml(t,e,i){if("boolean"==typeof t&&(i=e,e=t,t=null),null==t||"function"==typeof t){e=null==e||e,this.writeDataToDom();let i=this;if(null!=t){if(i=V(i.node.cloneNode(!0)),e){const e=t(i);if(i=e||i,!1===e)return""}i.each((function(){const e=t(this),i=e||this;!1===e?this.remove():e&&this!==i&&this.replace(i)}),!0)}return e?i.node.outerHTML:i.node.innerHTML}e=null!=e&&e;const a=W("wrapper",i),s=O.document.createDocumentFragment();a.innerHTML=t;for(let t=a.children.length;t--;)s.appendChild(a.firstElementChild);const r=this.parent();return e?this.replace(s)&&r:this.add(s)}}Q(Bt,{attr:function(t,e,i){if(null==t){t={},e=this.node.attributes;for(const i of e)t[i.nodeName]=ht.test(i.nodeValue)?parseFloat(i.nodeValue):i.nodeValue;return t}if(t instanceof Array)return t.reduce(((t,e)=>(t[e]=this.attr(e),t)),{});if("object"==typeof t&&t.constructor===Object)for(e in t)this.attr(e,t[e]);else if(null===e)this.node.removeAttribute(t);else{if(null==e)return null==(e=this.node.getAttribute(t))?Ft[t]:ht.test(e)?parseFloat(e):e;"number"==typeof(e=Wt.reduce(((e,i)=>i(t,e,this)),e))?e=new _t(e):Nt.has(t)&&xt.isColor(e)?e=new xt(e):e.constructor===Array&&(e=new Dt(e)),"leading"===t?this.leading&&this.leading(e):"string"==typeof i?this.node.setAttributeNS(i,t,e.toString()):this.node.setAttribute(t,e.toString()),!this.rebuild||"font-size"!==t&&"x"!==t||this.rebuild()}return this},find:function(t){return Lt(t,this.node)},findOne:function(t){return V(this.node.querySelector(t))}}),q(Bt,"Dom");let Gt=class extends Bt{constructor(t,e){super(t,e),this.dom={},this.node.instance=this,(t.hasAttribute("data-svgjs")||t.hasAttribute("svgjs:data"))&&this.setData(JSON.parse(t.getAttribute("data-svgjs"))??JSON.parse(t.getAttribute("svgjs:data"))??{})}center(t,e){return this.cx(t).cy(e)}cx(t){return null==t?this.x()+this.width()/2:this.x(t-this.width()/2)}cy(t){return null==t?this.y()+this.height()/2:this.y(t-this.height()/2)}defs(){const t=this.root();return t&&t.defs()}dmove(t,e){return this.dx(t).dy(e)}dx(t=0){return this.x(new _t(t).plus(this.x()))}dy(t=0){return this.y(new _t(t).plus(this.y()))}getEventHolder(){return this}height(t){return this.attr("height",t)}move(t,e){return this.x(t).y(e)}parents(t=this.root()){const e="string"==typeof t;e||(t=B(t));const i=new Ct;let a=this;for(;(a=a.parent())&&a.node!==O.document&&"#document-fragment"!==a.nodeName&&(i.push(a),e||a.node!==t.node)&&(!e||!a.matches(t));)if(a.node===this.root().node)return null;return i}reference(t){if(!(t=this.attr(t)))return null;const e=(t+"").match(at);return e?B(e[1]):null}root(){const t=this.parent(function(t){return _[t]}(N));return t&&t.root()}setData(t){return this.dom=t,this}size(t,e){const i=I(this,t,e);return this.width(new _t(i.width)).height(new _t(i.height))}width(t){return this.attr("width",t)}writeDataToDom(){return R(this,this.dom),super.writeDataToDom()}x(t){return this.attr("x",t)}y(t){return this.attr("y",t)}};Q(Gt,{bbox:function(){const t=At(this,(t=>t.getBBox()),(t=>{try{const e=t.clone().addTo(yt().svg).show(),i=e.node.getBBox();return e.remove(),i}catch(e){throw new Error(`Getting bbox of element "${t.node.nodeName}" is not possible: ${e.toString()}`)}}));return new kt(t)},rbox:function(t){const e=At(this,(t=>t.getBoundingClientRect()),(t=>{throw new Error(`Getting rbox of element "${t.node.nodeName}" is not possible`)})),i=new kt(e);return t?i.transform(t.screenCTM().inverseO()):i.addOffset()},inside:function(t,e){const i=this.bbox();return t>i.x&&e>i.y&&t=0;i--)null!=e[jt[t][i]]&&this.attr(jt.prefix(t,jt[t][i]),e[jt[t][i]]);return this},A(["Element","Runner"],e)})),A(["Element","Runner"],{matrix:function(t,e,i,a,s,r){return null==t?new vt(this):this.attr("transform",new vt(t,e,i,a,s,r))},rotate:function(t,e,i){return this.transform({rotate:t,ox:e,oy:i},!0)},skew:function(t,e,i,a){return 1===arguments.length||3===arguments.length?this.transform({skew:t,ox:e,oy:i},!0):this.transform({skew:[t,e],ox:i,oy:a},!0)},shear:function(t,e,i){return this.transform({shear:t,ox:e,oy:i},!0)},scale:function(t,e,i,a){return 1===arguments.length||3===arguments.length?this.transform({scale:t,ox:e,oy:i},!0):this.transform({scale:[t,e],ox:i,oy:a},!0)},translate:function(t,e){return this.transform({translate:[t,e]},!0)},relative:function(t,e){return this.transform({relative:[t,e]},!0)},flip:function(t="both",e="center"){return-1==="xybothtrue".indexOf(t)&&(e=t,t="both"),this.transform({flip:t,origin:e},!0)},opacity:function(t){return this.attr("opacity",t)}}),A("radius",{radius:function(t,e=t){return"radialGradient"===(this._element||this).type?this.attr("r",new _t(t)):this.rx(t).ry(e)}}),A("Path",{length:function(){return this.node.getTotalLength()},pointAt:function(t){return new bt(this.node.getPointAtLength(t))}}),A(["Element","Runner"],{font:function(t,e){if("object"==typeof t){for(e in t)this.font(e,t[e]);return this}return"leading"===t?this.leading(e):"anchor"===t?this.attr("text-anchor",e):"size"===t||"family"===t||"weight"===t||"stretch"===t||"variant"===t||"style"===t?this.attr("font-"+t,e):this.attr(t,e)}});A("Element",["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","mouseenter","mouseleave","touchstart","touchmove","touchleave","touchend","touchcancel","contextmenu","wheel","pointerdown","pointermove","pointerup","pointerleave","pointercancel"].reduce((function(t,e){return t[e]=function(t){return null===t?this.off(e):this.on(e,t),this},t}),{})),A("Element",{untransform:function(){return this.attr("transform",null)},matrixify:function(){const t=(this.attr("transform")||"").split(st).slice(0,-1).map((function(t){const e=t.trim().split("(");return[e[0],e[1].split(dt).map((function(t){return parseFloat(t)}))]})).reverse().reduce((function(t,e){return"matrix"===e[0]?t.lmultiply(vt.fromArray(e[1])):t[e[0]].apply(t,e[1])}),new vt);return t},toParent:function(t,e){if(this===t)return this;if(X(this.node))return this.addTo(t,e);const i=this.screenCTM(),a=t.screenCTM().inverse();return this.addTo(t,e).untransform().transform(a.multiply(i)),this},toRoot:function(t){return this.toParent(this.root(),t)},transform:function(t,e){if(null==t||"string"==typeof t){const e=new vt(this).decompose();return null==t?e:e[t]}vt.isMatrixLike(t)||(t={...t,origin:T(t,this)});const i=new vt(!0===e?this:e||!1).transform(t);return this.attr("transform",i)}});class Vt extends Gt{flatten(){return this.each((function(){if(this instanceof Vt)return this.flatten().ungroup()})),this}ungroup(t=this.parent(),e=t.index(this)){return e=-1===e?t.children().length:e,this.each((function(i,a){return a[a.length-i-1].toParent(t,e)})),this.remove()}}q(Vt,"Container");class Ut extends Vt{constructor(t,e=t){super(G("defs",t),e)}flatten(){return this}ungroup(){return this}}q(Ut,"Defs");class qt extends Gt{}function Zt(t){return this.attr("rx",t)}function $t(t){return this.attr("ry",t)}function Jt(t){return null==t?this.cx()-this.rx():this.cx(t+this.rx())}function Qt(t){return null==t?this.cy()-this.ry():this.cy(t+this.ry())}function Kt(t){return this.attr("cx",t)}function te(t){return this.attr("cy",t)}function ee(t){return null==t?2*this.rx():this.rx(new _t(t).divide(2))}function ie(t){return null==t?2*this.ry():this.ry(new _t(t).divide(2))}q(qt,"Shape");var ae=Object.freeze({__proto__:null,cx:Kt,cy:te,height:ie,rx:Zt,ry:$t,width:ee,x:Jt,y:Qt});class se extends qt{constructor(t,e=t){super(G("ellipse",t),e)}size(t,e){const i=I(this,t,e);return this.rx(new _t(i.width).divide(2)).ry(new _t(i.height).divide(2))}}Q(se,ae),A("Container",{ellipse:K((function(t=0,e=t){return this.put(new se).size(t,e).move(0,0)}))}),q(se,"Ellipse");class re extends Bt{constructor(t=O.document.createDocumentFragment()){super(t)}xml(t,e,i){if("boolean"==typeof t&&(i=e,e=t,t=null),null==t||"function"==typeof t){const t=new Bt(W("wrapper",i));return t.add(this.node.cloneNode(!0)),t.xml(!1,i)}return super.xml(t,!1,i)}}function ne(t,e){return"radialGradient"===(this._element||this).type?this.attr({fx:new _t(t),fy:new _t(e)}):this.attr({x1:new _t(t),y1:new _t(e)})}function oe(t,e){return"radialGradient"===(this._element||this).type?this.attr({cx:new _t(t),cy:new _t(e)}):this.attr({x2:new _t(t),y2:new _t(e)})}q(re,"Fragment");var le=Object.freeze({__proto__:null,from:ne,to:oe});class he extends Vt{constructor(t,e){super(G(t+"Gradient","string"==typeof t?null:t),e)}attr(t,e,i){return"transform"===t&&(t="gradientTransform"),super.attr(t,e,i)}bbox(){return new kt}targets(){return Lt("svg [fill*="+this.id()+"]")}toString(){return this.url()}update(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}url(){return"url(#"+this.id()+")"}}Q(he,le),A({Container:{gradient(...t){return this.defs().gradient(...t)}},Defs:{gradient:K((function(t,e){return this.put(new he(t)).update(e)}))}}),q(he,"Gradient");class ce extends Vt{constructor(t,e=t){super(G("pattern",t),e)}attr(t,e,i){return"transform"===t&&(t="patternTransform"),super.attr(t,e,i)}bbox(){return new kt}targets(){return Lt("svg [fill*="+this.id()+"]")}toString(){return this.url()}update(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}url(){return"url(#"+this.id()+")"}}A({Container:{pattern(...t){return this.defs().pattern(...t)}},Defs:{pattern:K((function(t,e,i){return this.put(new ce).update(i).attr({x:0,y:0,width:t,height:e,patternUnits:"userSpaceOnUse"})}))}}),q(ce,"Pattern");let de=class extends qt{constructor(t,e=t){super(G("image",t),e)}load(t,e){if(!t)return this;const i=new O.window.Image;return zt(i,"load",(function(t){const a=this.parent(ce);0===this.width()&&0===this.height()&&this.size(i.width,i.height),a instanceof ce&&0===a.width()&&0===a.height()&&a.size(this.width(),this.height()),"function"==typeof e&&e.call(this,t)}),this),zt(i,"load error",(function(){Xt(i)})),this.attr("href",i.src=t,H)}};var ue;ue=function(t,e,i){return"fill"!==t&&"stroke"!==t||ct.test(e)&&(e=i.root().defs().image(e)),e instanceof de&&(e=i.root().defs().pattern(0,0,(t=>{t.add(e)}))),e},Wt.push(ue),A({Container:{image:K((function(t,e){return this.put(new de).size(0,0).load(t,e)}))}}),q(de,"Image");class ge extends Dt{bbox(){let t=-1/0,e=-1/0,i=1/0,a=1/0;return this.forEach((function(s){t=Math.max(s[0],t),e=Math.max(s[1],e),i=Math.min(s[0],i),a=Math.min(s[1],a)})),new kt(i,a,t-i,e-a)}move(t,e){const i=this.bbox();if(t-=i.x,e-=i.y,!isNaN(t)&&!isNaN(e))for(let i=this.length-1;i>=0;i--)this[i]=[this[i][0]+t,this[i][1]+e];return this}parse(t=[0,0]){const e=[];(t=t instanceof Array?Array.prototype.concat.apply([],t):t.trim().split(dt).map(parseFloat)).length%2!=0&&t.pop();for(let i=0,a=t.length;i=0;i--)a.width&&(this[i][0]=(this[i][0]-a.x)*t/a.width+a.x),a.height&&(this[i][1]=(this[i][1]-a.y)*e/a.height+a.y);return this}toLine(){return{x1:this[0][0],y1:this[0][1],x2:this[1][0],y2:this[1][1]}}toString(){const t=[];for(let e=0,i=this.length;e":function(t){return-Math.cos(t*Math.PI)/2+.5},">":function(t){return Math.sin(t*Math.PI/2)},"<":function(t){return 1-Math.cos(t*Math.PI/2)},bezier:function(t,e,i,a){return function(s){return s<0?t>0?e/t*s:i>0?a/i*s:0:s>1?i<1?(1-a)/(1-i)*s+(a-i)/(1-i):t<1?(1-e)/(1-t)*s+(e-t)/(1-t):1:3*s*(1-s)**2*e+3*s**2*(1-s)*a+s**3}},steps:function(t,e="end"){e=e.split("-").reverse()[0];let i=t;return"none"===e?--i:"both"===e&&++i,(a,s=!1)=>{let r=Math.floor(a*t);const n=a*r%1==0;return"start"!==e&&"both"!==e||++r,s&&n&&--r,a>=0&&r<0&&(r=0),a<=1&&r>i&&(r=i),r/i}}};class ye{done(){return!1}}class we extends ye{constructor(t=Ht){super(),this.ease=ve[t]||t}step(t,e,i){return"number"!=typeof t?i<1?t:e:t+(e-t)*this.ease(i)}}class ke extends ye{constructor(t){super(),this.stepper=t}done(t){return t.done}step(t,e,i,a){return this.stepper(t,e,i,a)}}function Ae(){const t=(this._duration||500)/1e3,e=this._overshoot||0,i=Math.PI,a=Math.log(e/100+1e-10),s=-a/Math.sqrt(i*i+a*a),r=3.9/(s*t);this.d=2*s*r,this.k=r*r}Q(class extends ke{constructor(t=500,e=0){super(),this.duration(t).overshoot(e)}step(t,e,i,a){if("string"==typeof t)return t;if(a.done=i===1/0,i===1/0)return e;if(0===i)return t;i>100&&(i=16),i/=1e3;const s=a.velocity||0,r=-this.d*s-this.k*(t-e),n=t+s*i+r*i*i/2;return a.velocity=s+r*i,a.done=Math.abs(e-n)+Math.abs(s)<.002,a.done?e:n}},{duration:me("_duration",Ae),overshoot:me("_overshoot",Ae)});Q(class extends ke{constructor(t=.1,e=.01,i=0,a=1e3){super(),this.p(t).i(e).d(i).windup(a)}step(t,e,i,a){if("string"==typeof t)return t;if(a.done=i===1/0,i===1/0)return e;if(0===i)return t;const s=e-t;let r=(a.integral||0)+s*i;const n=(s-(a.error||0))/i,o=this._windup;return!1!==o&&(r=Math.max(-o,Math.min(r,o))),a.error=s,a.integral=r,a.done=Math.abs(s)<.001,a.done?e:t+(this.P*s+this.I*r+this.D*n)}},{windup:me("_windup"),p:me("P"),i:me("I"),d:me("D")});const Ce={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0},Se={M:function(t,e,i){return e.x=i.x=t[0],e.y=i.y=t[1],["M",e.x,e.y]},L:function(t,e){return e.x=t[0],e.y=t[1],["L",t[0],t[1]]},H:function(t,e){return e.x=t[0],["H",t[0]]},V:function(t,e){return e.y=t[0],["V",t[0]]},C:function(t,e){return e.x=t[4],e.y=t[5],["C",t[0],t[1],t[2],t[3],t[4],t[5]]},S:function(t,e){return e.x=t[2],e.y=t[3],["S",t[0],t[1],t[2],t[3]]},Q:function(t,e){return e.x=t[2],e.y=t[3],["Q",t[0],t[1],t[2],t[3]]},T:function(t,e){return e.x=t[0],e.y=t[1],["T",t[0],t[1]]},Z:function(t,e,i){return e.x=i.x,e.y=i.y,["Z"]},A:function(t,e){return e.x=t[5],e.y=t[6],["A",t[0],t[1],t[2],t[3],t[4],t[5],t[6]]}},Le="mlhvqtcsaz".split("");for(let t=0,e=Le.length;t=0;a--)i=this[a][0],"M"===i||"L"===i||"T"===i?(this[a][1]+=t,this[a][2]+=e):"H"===i?this[a][1]+=t:"V"===i?this[a][1]+=e:"C"===i||"S"===i||"Q"===i?(this[a][1]+=t,this[a][2]+=e,this[a][3]+=t,this[a][4]+=e,"C"===i&&(this[a][5]+=t,this[a][6]+=e)):"A"===i&&(this[a][6]+=t,this[a][7]+=e);return this}parse(t="M0 0"){return Array.isArray(t)&&(t=Array.prototype.concat.apply([],t).toString()),function(t,e=!0){let i=0,a="";const s={segment:[],inNumber:!1,number:"",lastToken:"",inSegment:!1,segments:[],pointSeen:!1,hasExponent:!1,absolute:e,p0:new bt,p:new bt};for(;s.lastToken=a,a=t.charAt(i++);)if(s.inSegment||!Pe(s,a))if("."!==a)if(isNaN(parseInt(a)))if(Re.has(a))s.inNumber&&Ie(s,!1);else if("-"!==a&&"+"!==a)if("E"!==a.toUpperCase()){if(ut.test(a)){if(s.inNumber)Ie(s,!1);else{if(!Me(s))throw new Error("parser Error");Te(s)}--i}}else s.number+=a,s.hasExponent=!0;else{if(s.inNumber&&!Xe(s)){Ie(s,!1),--i;continue}s.number+=a,s.inNumber=!0}else{if("0"===s.number||ze(s)){s.inNumber=!0,s.number=a,Ie(s,!0);continue}s.inNumber=!0,s.number+=a}else{if(s.pointSeen||s.hasExponent){Ie(s,!1),--i;continue}s.inNumber=!0,s.pointSeen=!0,s.number+=a}return s.inNumber&&Ie(s,!1),s.inSegment&&Me(s)&&Te(s),s.segments}(t)}size(t,e){const i=this.bbox();let a,s;for(i.width=0===i.width?1:i.width,i.height=0===i.height?1:i.height,a=this.length-1;a>=0;a--)s=this[a][0],"M"===s||"L"===s||"T"===s?(this[a][1]=(this[a][1]-i.x)*t/i.width+i.x,this[a][2]=(this[a][2]-i.y)*e/i.height+i.y):"H"===s?this[a][1]=(this[a][1]-i.x)*t/i.width+i.x:"V"===s?this[a][1]=(this[a][1]-i.y)*e/i.height+i.y:"C"===s||"S"===s||"Q"===s?(this[a][1]=(this[a][1]-i.x)*t/i.width+i.x,this[a][2]=(this[a][2]-i.y)*e/i.height+i.y,this[a][3]=(this[a][3]-i.x)*t/i.width+i.x,this[a][4]=(this[a][4]-i.y)*e/i.height+i.y,"C"===s&&(this[a][5]=(this[a][5]-i.x)*t/i.width+i.x,this[a][6]=(this[a][6]-i.y)*e/i.height+i.y)):"A"===s&&(this[a][1]=this[a][1]*t/i.width,this[a][2]=this[a][2]*e/i.height,this[a][6]=(this[a][6]-i.x)*t/i.width+i.x,this[a][7]=(this[a][7]-i.y)*e/i.height+i.y);return this}toString(){return function(t){let e="";for(let i=0,a=t.length;i{const e=typeof t;return"number"===e?_t:"string"===e?xt.isColor(t)?xt:dt.test(t)?ut.test(t)?Ee:Dt:tt.test(t)?_t:Oe:Ne.indexOf(t.constructor)>-1?t.constructor:Array.isArray(t)?Dt:"object"===e?_e:Oe};class He{constructor(t){this._stepper=t||new we("-"),this._from=null,this._to=null,this._type=null,this._context=null,this._morphObj=null}at(t){return this._morphObj.morph(this._from,this._to,t,this._stepper,this._context)}done(){return this._context.map(this._stepper.done).reduce((function(t,e){return t&&e}),!0)}from(t){return null==t?this._from:(this._from=this._set(t),this)}stepper(t){return null==t?this._stepper:(this._stepper=t,this)}to(t){return null==t?this._to:(this._to=this._set(t),this)}type(t){return null==t?this._type:(this._type=t,this)}_set(t){this._type||this.type(Ye(t));let e=new this._type(t);return this._type===xt&&(e=this._to?e[this._to[4]]():this._from?e[this._from[4]]():e),this._type===_e&&(e=this._to?e.align(this._to):this._from?e.align(this._from):e),e=e.toConsumable(),this._morphObj=this._morphObj||new this._type,this._context=this._context||Array.apply(null,Array(e.length)).map(Object).map((function(t){return t.done=!0,t})),e}}class Oe{constructor(...t){this.init(...t)}init(t){return t=Array.isArray(t)?t[0]:t,this.value=t,this}toArray(){return[this.value]}valueOf(){return this.value}}class Fe{constructor(...t){this.init(...t)}init(t){return Array.isArray(t)&&(t={scaleX:t[0],scaleY:t[1],shear:t[2],rotate:t[3],translateX:t[4],translateY:t[5],originX:t[6],originY:t[7]}),Object.assign(this,Fe.defaults,t),this}toArray(){const t=this;return[t.scaleX,t.scaleY,t.shear,t.rotate,t.translateX,t.translateY,t.originX,t.originY]}}Fe.defaults={scaleX:1,scaleY:1,shear:0,rotate:0,translateX:0,translateY:0,originX:0,originY:0};const De=(t,e)=>t[0]e[0]?1:0;class _e{constructor(...t){this.init(...t)}align(t){const e=this.values;for(let i=0,a=e.length;it.concat(e)),[]),this}toArray(){return this.values}valueOf(){const t={},e=this.values;for(;e.length;){const i=e.shift(),a=e.shift(),s=e.shift(),r=e.splice(0,s);t[i]=new a(r)}return t}}const Ne=[Oe,Fe,_e];class We extends qt{constructor(t,e=t){super(G("path",t),e)}array(){return this._array||(this._array=new Ee(this.attr("d")))}clear(){return delete this._array,this}height(t){return null==t?this.bbox().height:this.size(this.bbox().width,t)}move(t,e){return this.attr("d",this.array().move(t,e))}plot(t){return null==t?this.array():this.clear().attr("d","string"==typeof t?t:this._array=new Ee(t))}size(t,e){const i=I(this,t,e);return this.attr("d",this.array().size(i.width,i.height))}width(t){return null==t?this.bbox().width:this.size(t,this.bbox().height)}x(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)}y(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)}}We.prototype.MorphArray=Ee,A({Container:{path:K((function(t){return this.put(new We).plot(t||new Ee)}))}}),q(We,"Path");var Be=Object.freeze({__proto__:null,array:function(){return this._array||(this._array=new ge(this.attr("points")))},clear:function(){return delete this._array,this},move:function(t,e){return this.attr("points",this.array().move(t,e))},plot:function(t){return null==t?this.array():this.clear().attr("points","string"==typeof t?t:this._array=new ge(t))},size:function(t,e){const i=I(this,t,e);return this.attr("points",this.array().size(i.width,i.height))}});class Ge extends qt{constructor(t,e=t){super(G("polygon",t),e)}}A({Container:{polygon:K((function(t){return this.put(new Ge).plot(t||new ge)}))}}),Q(Ge,fe),Q(Ge,Be),q(Ge,"Polygon");class je extends qt{constructor(t,e=t){super(G("polyline",t),e)}}A({Container:{polyline:K((function(t){return this.put(new je).plot(t||new ge)}))}}),Q(je,fe),Q(je,Be),q(je,"Polyline");class Ve extends qt{constructor(t,e=t){super(G("rect",t),e)}}Q(Ve,{rx:Zt,ry:$t}),A({Container:{rect:K((function(t,e){return this.put(new Ve).size(t,e)}))}}),q(Ve,"Rect");class Ue{constructor(){this._first=null,this._last=null}first(){return this._first&&this._first.value}last(){return this._last&&this._last.value}push(t){const e=void 0!==t.next?t:{value:t,next:null,prev:null};return this._last?(e.prev=this._last,this._last.next=e,this._last=e):(this._last=e,this._first=e),e}remove(t){t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t===this._last&&(this._last=t.prev),t===this._first&&(this._first=t.next),t.prev=null,t.next=null}shift(){const t=this._first;return t?(this._first=t.next,this._first&&(this._first.prev=null),this._last=this._first?this._last:null,t.value):null}}const qe={nextDraw:null,frames:new Ue,timeouts:new Ue,immediates:new Ue,timer:()=>O.window.performance||O.window.Date,transforms:[],frame(t){const e=qe.frames.push({run:t});return null===qe.nextDraw&&(qe.nextDraw=O.window.requestAnimationFrame(qe._draw)),e},timeout(t,e){e=e||0;const i=qe.timer().now()+e,a=qe.timeouts.push({run:t,time:i});return null===qe.nextDraw&&(qe.nextDraw=O.window.requestAnimationFrame(qe._draw)),a},immediate(t){const e=qe.immediates.push(t);return null===qe.nextDraw&&(qe.nextDraw=O.window.requestAnimationFrame(qe._draw)),e},cancelFrame(t){null!=t&&qe.frames.remove(t)},clearTimeout(t){null!=t&&qe.timeouts.remove(t)},cancelImmediate(t){null!=t&&qe.immediates.remove(t)},_draw(t){let e=null;const i=qe.timeouts.last();for(;(e=qe.timeouts.shift())&&(t>=e.time?e.run():qe.timeouts.push(e),e!==i););let a=null;const s=qe.frames.last();for(;a!==s&&(a=qe.frames.shift());)a.run(t);let r=null;for(;r=qe.immediates.shift();)r();qe.nextDraw=qe.timeouts.first()||qe.frames.first()?O.window.requestAnimationFrame(qe._draw):null}},Ze=function(t){const e=t.start,i=t.runner.duration();return{start:e,duration:i,end:e+i,runner:t.runner}},$e=function(){const t=O.window;return(t.performance||t.Date).now()};class Je extends Rt{constructor(t=$e){super(),this._timeSource=t,this.terminate()}active(){return!!this._nextFrame}finish(){return this.time(this.getEndTimeOfTimeline()+1),this.pause()}getEndTime(){const t=this.getLastRunnerInfo(),e=t?t.runner.duration():0;return(t?t.start:this._time)+e}getEndTimeOfTimeline(){const t=this._runners.map((t=>t.start+t.runner.duration()));return Math.max(0,...t)}getLastRunnerInfo(){return this.getRunnerInfoById(this._lastRunnerId)}getRunnerInfoById(t){return this._runners[this._runnerIds.indexOf(t)]||null}pause(){return this._paused=!0,this._continue()}persist(t){return null==t?this._persist:(this._persist=t,this)}play(){return this._paused=!1,this.updateTime()._continue()}reverse(t){const e=this.speed();if(null==t)return this.speed(-e);const i=Math.abs(e);return this.speed(t?-i:i)}schedule(t,e,i){if(null==t)return this._runners.map(Ze);let a=0;const s=this.getEndTime();if(e=e||0,null==i||"last"===i||"after"===i)a=s;else if("absolute"===i||"start"===i)a=e,e=0;else if("now"===i)a=this._time;else if("relative"===i){const i=this.getRunnerInfoById(t.id);i&&(a=i.start+e,e=0)}else{if("with-last"!==i)throw new Error('Invalid value for the "when" parameter');{const t=this.getLastRunnerInfo();a=t?t.start:this._time}}t.unschedule(),t.timeline(this);const r=t.persist(),n={persist:null===r?this._persist:r,start:a+e,runner:t};return this._lastRunnerId=t.id,this._runners.push(n),this._runners.sort(((t,e)=>t.start-e.start)),this._runnerIds=this._runners.map((t=>t.runner.id)),this.updateTime()._continue(),this}seek(t){return this.time(this._time+t)}source(t){return null==t?this._timeSource:(this._timeSource=t,this)}speed(t){return null==t?this._speed:(this._speed=t,this)}stop(){return this.time(0),this.pause()}time(t){return null==t?this._time:(this._time=t,this._continue(!0))}unschedule(t){const e=this._runnerIds.indexOf(t.id);return e<0||(this._runners.splice(e,1),this._runnerIds.splice(e,1),t.timeline(null)),this}updateTime(){return this.active()||(this._lastSourceTime=this._timeSource()),this}_continue(t=!1){return qe.cancelFrame(this._nextFrame),this._nextFrame=null,t?this._stepImmediate():(this._paused||(this._nextFrame=qe.frame(this._step)),this)}_stepFn(t=!1){const e=this._timeSource();let i=e-this._lastSourceTime;t&&(i=0);const a=this._speed*i+(this._time-this._lastStepTime);this._lastSourceTime=e,t||(this._time+=a,this._time=this._time<0?0:this._time),this._lastStepTime=this._time,this.fire("time",this._time);for(let t=this._runners.length;t--;){const e=this._runners[t],i=e.runner;this._time-e.start<=0&&i.reset()}let s=!1;for(let t=0,e=this._runners.length;t0?this._continue():(this.pause(),this.fire("finished")),this}terminate(){this._startTime=0,this._speed=1,this._persist=0,this._nextFrame=null,this._paused=!0,this._runners=[],this._runnerIds=[],this._lastRunnerId=-1,this._time=0,this._lastSourceTime=0,this._lastStepTime=0,this._step=this._stepFn.bind(this,!1),this._stepImmediate=this._stepFn.bind(this,!0)}}A({Element:{timeline:function(t){return null==t?(this._timeline=this._timeline||new Je,this._timeline):(this._timeline=t,this)}}});class Qe extends Rt{constructor(t){super(),this.id=Qe.id++,t="function"==typeof(t=null==t?Yt:t)?new ke(t):t,this._element=null,this._timeline=null,this.done=!1,this._queue=[],this._duration="number"==typeof t&&t,this._isDeclarative=t instanceof ke,this._stepper=this._isDeclarative?t:new we,this._history={},this.enabled=!0,this._time=0,this._lastTime=0,this._reseted=!0,this.transforms=new vt,this.transformId=1,this._haveReversed=!1,this._reverse=!1,this._loopsDone=0,this._swing=!1,this._wait=0,this._times=1,this._frameId=null,this._persist=!!this._isDeclarative||null}static sanitise(t,e,i){let a=1,s=!1,r=0;return e=e??Ot,i=i||"last","object"!=typeof(t=t??Yt)||t instanceof ye||(e=t.delay??e,i=t.when??i,s=t.swing||s,a=t.times??a,r=t.wait??r,t=t.duration??Yt),{duration:t,delay:e,swing:s,times:a,wait:r,when:i}}active(t){return null==t?this.enabled:(this.enabled=t,this)}addTransform(t){return this.transforms.lmultiplyO(t),this}after(t){return this.on("finished",t)}animate(t,e,i){const a=Qe.sanitise(t,e,i),s=new Qe(a.duration);return this._timeline&&s.timeline(this._timeline),this._element&&s.element(this._element),s.loop(a).schedule(a.delay,a.when)}clearTransform(){return this.transforms=new vt,this}clearTransformsFromQueue(){this.done&&this._timeline&&this._timeline._runnerIds.includes(this.id)||(this._queue=this._queue.filter((t=>!t.isTransform)))}delay(t){return this.animate(0,t)}duration(){return this._times*(this._wait+this._duration)-this._wait}during(t){return this.queue(null,t)}ease(t){return this._stepper=new we(t),this}element(t){return null==t?this._element:(this._element=t,t._prepareRunner(),this)}finish(){return this.step(1/0)}loop(t,e,i){return"object"==typeof t&&(e=t.swing,i=t.wait,t=t.times),this._times=t||1/0,this._swing=e||!1,this._wait=i||0,!0===this._times&&(this._times=1/0),this}loops(t){const e=this._duration+this._wait;if(null==t){const t=Math.floor(this._time/e),i=(this._time-t*e)/this._duration;return Math.min(t+i,this._times)}const i=t%1,a=e*Math.floor(t)+this._duration*i;return this.time(a)}persist(t){return null==t?this._persist:(this._persist=t,this)}position(t){const e=this._time,i=this._duration,a=this._wait,s=this._times,r=this._swing,n=this._reverse;let o;if(null==t){const t=function(t){const e=r*Math.floor(t%(2*(a+i))/(a+i)),s=e&&!n||!e&&n,o=Math.pow(-1,s)*(t%(a+i))/i+s;return Math.max(Math.min(o,1),0)},l=s*(a+i)-a;return o=e<=0?Math.round(t(1e-5)):e=0;this._lastPosition=e;const a=this.duration(),s=this._lastTime<=0&&this._time>0,r=this._lastTime=a;this._lastTime=this._time,s&&this.fire("start",this);const n=this._isDeclarative;this.done=!n&&!r&&this._time>=a,this._reseted=!1;let o=!1;return(i||n)&&(this._initialise(i),this.transforms=new vt,o=this._run(n?t:e),this.fire("step",this)),this.done=this.done||o&&n,r&&this.fire("finished",this),this}time(t){if(null==t)return this._time;const e=t-this._time;return this.step(e),this}timeline(t){return void 0===t?this._timeline:(this._timeline=t,this)}unschedule(){const t=this.timeline();return t&&t.unschedule(this),this}_initialise(t){if(t||this._isDeclarative)for(let e=0,i=this._queue.length;et.lmultiplyO(e),ei=t=>t.transforms;function ii(){const t=this._transformationRunners.runners.map(ei).reduce(ti,new vt);this.transform(t),this._transformationRunners.merge(),1===this._transformationRunners.length()&&(this._frameId=null)}class ai{constructor(){this.runners=[],this.ids=[]}add(t){if(this.runners.includes(t))return;const e=t.id+1;return this.runners.push(t),this.ids.push(e),this}clearBefore(t){const e=this.ids.indexOf(t+1)||1;return this.ids.splice(0,e,0),this.runners.splice(0,e,new Ke).forEach((t=>t.clearTransformsFromQueue())),this}edit(t,e){const i=this.ids.indexOf(t+1);return this.ids.splice(i,1,t+1),this.runners.splice(i,1,e),this}getByID(t){return this.runners[this.ids.indexOf(t+1)]}length(){return this.ids.length}merge(){let t=null;for(let e=0;ee.id<=t.id)).map(ei).reduce(ti,new vt)},_addRunner(t){this._transformationRunners.add(t),qe.cancelImmediate(this._frameId),this._frameId=qe.immediate(ii.bind(this))},_prepareRunner(){null==this._frameId&&(this._transformationRunners=(new ai).add(new Ke(new vt(this))))}}});Q(Qe,{attr(t,e){return this.styleAttr("attr",t,e)},css(t,e){return this.styleAttr("css",t,e)},styleAttr(t,e,i){if("string"==typeof e)return this.styleAttr(t,{[e]:i});let a=e;if(this._tryRetarget(t,a))return this;let s=new He(this._stepper).to(a),r=Object.keys(a);return this.queue((function(){s=s.from(this.element()[t](r))}),(function(e){return this.element()[t](s.at(e).valueOf()),s.done()}),(function(e){const i=Object.keys(e),n=(o=r,i.filter((t=>!o.includes(t))));var o;if(n.length){const e=this.element()[t](n),i=new _e(s.from()).valueOf();Object.assign(i,e),s.from(i)}const l=new _e(s.to()).valueOf();Object.assign(l,e),s.to(l),r=i,a=e})),this._rememberMorpher(t,s),this},zoom(t,e){if(this._tryRetarget("zoom",t,e))return this;let i=new He(this._stepper).to(new _t(t));return this.queue((function(){i=i.from(this.element().zoom())}),(function(t){return this.element().zoom(i.at(t),e),i.done()}),(function(t,a){e=a,i.to(t)})),this._rememberMorpher("zoom",i),this},transform(t,e,i){if(e=t.relative||e,this._isDeclarative&&!e&&this._tryRetarget("transform",t))return this;const a=vt.isMatrixLike(t);i=null!=t.affine?t.affine:null!=i?i:!a;const s=new He(this._stepper).type(i?Fe:vt);let r,n,o,l,h;return this.queue((function(){n=n||this.element(),r=r||T(t,n),h=new vt(e?void 0:n),n._addRunner(this),e||n._clearTransformRunnersBefore(this)}),(function(c){e||this.clearTransform();const{x:d,y:u}=new bt(r).transform(n._currentTransform(this));let g=new vt({...t,origin:[d,u]}),p=this._isDeclarative&&o?o:h;if(i){g=g.decompose(d,u),p=p.decompose(d,u);const t=g.rotate,e=p.rotate,i=[t-360,t,t+360],a=i.map((t=>Math.abs(t-e))),s=Math.min(...a),r=a.indexOf(s);g.rotate=i[r]}e&&(a||(g.rotate=t.rotate||0),this._isDeclarative&&l&&(p.rotate=l)),s.from(p),s.to(g);const f=s.at(c);return l=f.rotate,o=new vt(f),this.addTransform(o),n._addRunner(this),s.done()}),(function(e){(e.origin||"center").toString()!==(t.origin||"center").toString()&&(r=T(e,n)),t={...e,origin:r}}),!0),this._isDeclarative&&this._rememberMorpher("transform",s),this},x(t){return this._queueNumber("x",t)},y(t){return this._queueNumber("y",t)},ax(t){return this._queueNumber("ax",t)},ay(t){return this._queueNumber("ay",t)},dx(t=0){return this._queueNumberDelta("x",t)},dy(t=0){return this._queueNumberDelta("y",t)},dmove(t,e){return this.dx(t).dy(e)},_queueNumberDelta(t,e){if(e=new _t(e),this._tryRetarget(t,e))return this;const i=new He(this._stepper).to(e);let a=null;return this.queue((function(){a=this.element()[t](),i.from(a),i.to(a+e)}),(function(e){return this.element()[t](i.at(e)),i.done()}),(function(t){i.to(a+new _t(t))})),this._rememberMorpher(t,i),this},_queueObject(t,e){if(this._tryRetarget(t,e))return this;const i=new He(this._stepper).to(e);return this.queue((function(){i.from(this.element()[t]())}),(function(e){return this.element()[t](i.at(e)),i.done()})),this._rememberMorpher(t,i),this},_queueNumber(t,e){return this._queueObject(t,new _t(e))},cx(t){return this._queueNumber("cx",t)},cy(t){return this._queueNumber("cy",t)},move(t,e){return this.x(t).y(e)},amove(t,e){return this.ax(t).ay(e)},center(t,e){return this.cx(t).cy(e)},size(t,e){let i;return t&&e||(i=this._element.bbox()),t||(t=i.width/i.height*e),e||(e=i.height/i.width*t),this.width(t).height(e)},width(t){return this._queueNumber("width",t)},height(t){return this._queueNumber("height",t)},plot(t,e,i,a){if(4===arguments.length)return this.plot([t,e,i,a]);if(this._tryRetarget("plot",t))return this;const s=new He(this._stepper).type(this._element.MorphArray).to(t);return this.queue((function(){s.from(this._element.array())}),(function(t){return this._element.plot(s.at(t)),s.done()})),this._rememberMorpher("plot",s),this},leading(t){return this._queueNumber("leading",t)},viewbox(t,e,i,a){return this._queueObject("viewbox",new kt(t,e,i,a))},update(t){return"object"!=typeof t?this.update({offset:arguments[0],color:arguments[1],opacity:arguments[2]}):(null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",t.offset),this)}}),Q(Qe,{rx:Zt,ry:$t,from:ne,to:oe}),q(Qe,"Runner");class si extends Vt{constructor(t,e=t){super(G("svg",t),e),this.namespace()}defs(){return this.isRoot()?V(this.node.querySelector("defs"))||this.put(new Ut):this.root().defs()}isRoot(){return!this.node.parentNode||!(this.node.parentNode instanceof O.window.SVGElement)&&"#document-fragment"!==this.node.parentNode.nodeName}namespace(){return this.isRoot()?this.attr({xmlns:E,version:"1.1"}).attr("xmlns:xlink",H,Y):this.root().namespace()}removeNamespace(){return this.attr({xmlns:null,version:null}).attr("xmlns:xlink",null,Y).attr("xmlns:svgjs",null,Y)}root(){return this.isRoot()?this:super.root()}}A({Container:{nested:K((function(){return this.put(new si)}))}}),q(si,"Svg",!0);let ri=class extends Vt{constructor(t,e=t){super(G("symbol",t),e)}};A({Container:{symbol:K((function(){return this.put(new ri)}))}}),q(ri,"Symbol");var ni=Object.freeze({__proto__:null,amove:function(t,e){return this.ax(t).ay(e)},ax:function(t){return this.attr("x",t)},ay:function(t){return this.attr("y",t)},build:function(t){return this._build=!!t,this},center:function(t,e,i=this.bbox()){return this.cx(t,i).cy(e,i)},cx:function(t,e=this.bbox()){return null==t?e.cx:this.attr("x",this.attr("x")+t-e.cx)},cy:function(t,e=this.bbox()){return null==t?e.cy:this.attr("y",this.attr("y")+t-e.cy)},length:function(){return this.node.getComputedTextLength()},move:function(t,e,i=this.bbox()){return this.x(t,i).y(e,i)},plain:function(t){return!1===this._build&&this.clear(),this.node.appendChild(O.document.createTextNode(t)),this},x:function(t,e=this.bbox()){return null==t?e.x:this.attr("x",this.attr("x")+t-e.x)},y:function(t,e=this.bbox()){return null==t?e.y:this.attr("y",this.attr("y")+t-e.y)}});class oi extends qt{constructor(t,e=t){super(G("text",t),e),this.dom.leading=this.dom.leading??new _t(1.3),this._rebuild=!0,this._build=!1}leading(t){return null==t?this.dom.leading:(this.dom.leading=new _t(t),this.rebuild())}rebuild(t){if("boolean"==typeof t&&(this._rebuild=t),this._rebuild){const t=this;let e=0;const i=this.dom.leading;this.each((function(a){if(X(this.node))return;const s=O.window.getComputedStyle(this.node).getPropertyValue("font-size"),r=i*new _t(s);this.dom.newLined&&(this.attr("x",t.attr("x")),"\n"===this.text()?e+=r:(this.attr("dy",a?r+e:0),e=0))})),this.fire("rebuild")}return this}setData(t){return this.dom=t,this.dom.leading=new _t(t.leading||1.3),this}writeDataToDom(){return R(this,this.dom,{leading:1.3}),this}text(t){if(void 0===t){const e=this.node.childNodes;let i=0;t="";for(let a=0,s=e.length;a{let a;try{a=i.node instanceof F().SVGSVGElement?new kt(i.attr(["x","y","width","height"])):i.bbox()}catch(t){return}const s=new vt(i),r=s.translate(t,e).transform(s.inverse()),n=new bt(a.x,a.y).transform(r);i.move(n.x,n.y)})),this},dx:function(t){return this.dmove(t,0)},dy:function(t){return this.dmove(0,t)},height:function(t,e=this.bbox()){return null==t?e.height:this.size(e.width,t,e)},move:function(t=0,e=0,i=this.bbox()){const a=t-i.x,s=e-i.y;return this.dmove(a,s)},size:function(t,e,i=this.bbox()){const a=I(this,t,e,i),s=a.width/i.width,r=a.height/i.height;return this.children().forEach((t=>{const e=new bt(i).transform(new vt(t).inverse());t.scale(s,r,e.x,e.y)})),this},width:function(t,e=this.bbox()){return null==t?e.width:this.size(t,e.height,e)},x:function(t,e=this.bbox()){return null==t?e.x:this.move(t,e.y,e)},y:function(t,e=this.bbox()){return null==t?e.y:this.move(e.x,t,e)}});class gi extends Vt{constructor(t,e=t){super(G("g",t),e)}}Q(gi,ui),A({Container:{group:K((function(){return this.put(new gi)}))}}),q(gi,"G");class pi extends Vt{constructor(t,e=t){super(G("a",t),e)}target(t){return this.attr("target",t)}to(t){return this.attr("href",t,H)}}Q(pi,ui),A({Container:{link:K((function(t){return this.put(new pi).to(t)}))},Element:{unlink(){const t=this.linker();if(!t)return this;const e=t.parent();if(!e)return this.remove();const i=e.index(t);return e.add(this,i),t.remove(),this},linkTo(t){let e=this.linker();return e||(e=new pi,this.wrap(e)),"function"==typeof t?t.call(e,e):e.to(t),this},linker(){const t=this.parent();return t&&"a"===t.node.nodeName.toLowerCase()?t:null}}}),q(pi,"A");class fi extends Vt{constructor(t,e=t){super(G("mask",t),e)}remove(){return this.targets().forEach((function(t){t.unmask()})),super.remove()}targets(){return Lt("svg [mask*="+this.id()+"]")}}A({Container:{mask:K((function(){return this.defs().put(new fi)}))},Element:{masker(){return this.reference("mask")},maskWith(t){const e=t instanceof fi?t:this.parent().mask().add(t);return this.attr("mask","url(#"+e.id()+")")},unmask(){return this.attr("mask",null)}}}),q(fi,"Mask");class xi extends Gt{constructor(t,e=t){super(G("stop",t),e)}update(t){return("number"==typeof t||t instanceof _t)&&(t={offset:arguments[0],color:arguments[1],opacity:arguments[2]}),null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",new _t(t.offset)),this}}A({Gradient:{stop:function(t,e,i){return this.put(new xi).update(t,e,i)}}}),q(xi,"Stop");class bi extends Gt{constructor(t,e=t){super(G("style",t),e)}addText(t=""){return this.node.textContent+=t,this}font(t,e,i={}){return this.rule("@font-face",{fontFamily:t,src:e,...i})}rule(t,e){return this.addText(function(t,e){if(!t)return"";if(!e)return t;let i=t+"{";for(const t in e)i+=t.replace(/([A-Z])/g,(function(t,e){return"-"+e.toLowerCase()}))+":"+e[t]+";";return i+="}",i}(t,e))}}A("Dom",{style(t,e){return this.put(new bi).rule(t,e)},fontface(t,e,i){return this.put(new bi).font(t,e,i)}}),q(bi,"Style");class mi extends oi{constructor(t,e=t){super(G("textPath",t),e)}array(){const t=this.track();return t?t.array():null}plot(t){const e=this.track();let i=null;return e&&(i=e.plot(t)),null==t?i:this}track(){return this.reference("href")}}A({Container:{textPath:K((function(t,e){return t instanceof oi||(t=this.text(t)),t.path(e)}))},Text:{path:K((function(t,e=!0){const i=new mi;let a;if(t instanceof We||(t=this.defs().path(t)),i.attr("href","#"+t,H),e)for(;a=this.node.firstChild;)i.node.appendChild(a);return this.put(i)})),textPath(){return this.findOne("textPath")}},Path:{text:K((function(t){return t instanceof oi||(t=(new oi).addTo(this.parent()).text(t)),t.path(this)})),targets(){return Lt("svg textPath").filter((t=>(t.attr("href")||"").includes(this.id())))}}}),mi.prototype.MorphArray=Ee,q(mi,"TextPath");class vi extends qt{constructor(t,e=t){super(G("use",t),e)}use(t,e){return this.attr("href",(e||"")+"#"+t,H)}}A({Container:{use:K((function(t,e){return this.put(new vi).use(t,e)}))}}),q(vi,"Use");const yi=B;Q([si,ri,de,ce,be],C("viewbox")),Q([xe,je,Ge,We],C("marker")),Q(oi,C("Text")),Q(We,C("Path")),Q(Ut,C("Defs")),Q([oi,li],C("Tspan")),Q([Ve,se,he,Qe],C("radius")),Q(Rt,C("EventTarget")),Q(Bt,C("Dom")),Q(Gt,C("Element")),Q(qt,C("Shape")),Q([Vt,re],C("Container")),Q(he,C("Gradient")),Q(Qe,C("Runner")),Ct.extend([...new Set(k)]),function(t=[]){Ne.push(...[].concat(t))}([_t,xt,kt,vt,Dt,ge,Ee,bt]),Q(Ne,{to(t){return(new He).type(this.constructor).from(this.toArray()).to(t)},fromArray(t){return this.init(t),this},toConsumable(){return this.toArray()},morph(t,e,i,a,s){return this.fromArray(t.map((function(t,r){return a.step(t,e[r],i,s[r],s)})))}});class wi extends Gt{constructor(t){super(G("filter",t),t),this.$source="SourceGraphic",this.$sourceAlpha="SourceAlpha",this.$background="BackgroundImage",this.$backgroundAlpha="BackgroundAlpha",this.$fill="FillPaint",this.$stroke="StrokePaint",this.$autoSetIn=!0}put(t,e){return!(t=super.put(t,e)).attr("in")&&this.$autoSetIn&&t.attr("in",this.$source),t.attr("result")||t.attr("result",t.id()),t}remove(){return this.targets().each("unfilter"),super.remove()}targets(){return Lt('svg [filter*="'+this.id()+'"]')}toString(){return"url(#"+this.id()+")"}}class ki extends Gt{constructor(t,e){super(t,e),this.result(this.id())}in(t){if(null==t){const t=this.attr("in");return this.parent()&&this.parent().find(`[result="${t}"]`)[0]||t}return this.attr("in",t)}result(t){return this.attr("result",t)}toString(){return this.result()}}const Ai=t=>function(...e){for(let i=t.length;i--;)null!=e[i]&&this.attr(t[i],e[i])},Ci={blend:Ai(["in","in2","mode"]),colorMatrix:Ai(["type","values"]),composite:Ai(["in","in2","operator"]),convolveMatrix:function(t){t=new Dt(t).toString(),this.attr({order:Math.sqrt(t.split(" ").length),kernelMatrix:t})},diffuseLighting:Ai(["surfaceScale","lightingColor","diffuseConstant","kernelUnitLength"]),displacementMap:Ai(["in","in2","scale","xChannelSelector","yChannelSelector"]),dropShadow:Ai(["in","dx","dy","stdDeviation"]),flood:Ai(["flood-color","flood-opacity"]),gaussianBlur:function(t=0,e=t){this.attr("stdDeviation",t+" "+e)},image:function(t){this.attr("href",t,H)},morphology:Ai(["operator","radius"]),offset:Ai(["dx","dy"]),specularLighting:Ai(["surfaceScale","lightingColor","diffuseConstant","specularExponent","kernelUnitLength"]),tile:Ai([]),turbulence:Ai(["baseFrequency","numOctaves","seed","stitchTiles","type"])};["blend","colorMatrix","componentTransfer","composite","convolveMatrix","diffuseLighting","displacementMap","dropShadow","flood","gaussianBlur","image","merge","morphology","offset","specularLighting","tile","turbulence"].forEach((t=>{const e=P(t),i=Ci[t];wi[e+"Effect"]=class extends ki{constructor(t){super(G("fe"+e,t),t)}update(t){return i.apply(this,t),this}},wi.prototype[t]=K((function(t,...i){const a=new wi[e+"Effect"];return null==t?this.put(a):("function"==typeof t?t.call(a,a):i.unshift(t),this.put(a).update(i))}))})),Q(wi,{merge(t){const e=this.put(new wi.MergeEffect);if("function"==typeof t)return t.call(e,e),e;return(t instanceof Array?t:[...arguments]).forEach((t=>{t instanceof wi.MergeNode?e.put(t):e.mergeNode(t)})),e},componentTransfer(t={}){const e=this.put(new wi.ComponentTransferEffect);if("function"==typeof t)return t.call(e,e),e;if(!(t.r||t.g||t.b||t.a)){t={r:t,g:t,b:t,a:t}}for(const i in t)e.add(new(wi["Func"+i.toUpperCase()])(t[i]));return e}});["distantLight","pointLight","spotLight","mergeNode","FuncR","FuncG","FuncB","FuncA"].forEach((t=>{const e=P(t);wi[e]=class extends ki{constructor(t){super(G("fe"+e,t),t)}}}));["funcR","funcG","funcB","funcA"].forEach((function(t){const e=wi[P(t)],i=K((function(){return this.put(new e)}));wi.ComponentTransferEffect.prototype[t]=i}));["distantLight","pointLight","spotLight"].forEach((t=>{const e=wi[P(t)],i=K((function(){return this.put(new e)}));wi.DiffuseLightingEffect.prototype[t]=i,wi.SpecularLightingEffect.prototype[t]=i})),Q(wi.MergeEffect,{mergeNode(t){return this.put(new wi.MergeNode).attr("in",t)}}),Q(Ut,{filter:function(t){const e=this.put(new wi);return"function"==typeof t&&t.call(e,e),e}}),Q(Vt,{filter:function(t){return this.defs().filter(t)}}),Q(Gt,{filterWith:function(t){const e=t instanceof wi?t:this.defs().filter(t);return this.attr("filter",e)},unfilter:function(t){return this.attr("filter",null)},filterer(){return this.reference("filter")}});const Si={blend:function(t,e){return this.parent()&&this.parent().blend(this,t,e)},colorMatrix:function(t,e){return this.parent()&&this.parent().colorMatrix(t,e).in(this)},componentTransfer:function(t){return this.parent()&&this.parent().componentTransfer(t).in(this)},composite:function(t,e){return this.parent()&&this.parent().composite(this,t,e)},convolveMatrix:function(t){return this.parent()&&this.parent().convolveMatrix(t).in(this)},diffuseLighting:function(t,e,i,a){return this.parent()&&this.parent().diffuseLighting(t,i,a).in(this)},displacementMap:function(t,e,i,a){return this.parent()&&this.parent().displacementMap(this,t,e,i,a)},dropShadow:function(t,e,i){return this.parent()&&this.parent().dropShadow(this,t,e,i).in(this)},flood:function(t,e){return this.parent()&&this.parent().flood(t,e)},gaussianBlur:function(t,e){return this.parent()&&this.parent().gaussianBlur(t,e).in(this)},image:function(t){return this.parent()&&this.parent().image(t)},merge:function(t){return t=t instanceof Array?t:[...t],this.parent()&&this.parent().merge(this,...t)},morphology:function(t,e){return this.parent()&&this.parent().morphology(t,e).in(this)},offset:function(t,e){return this.parent()&&this.parent().offset(t,e).in(this)},specularLighting:function(t,e,i,a,s){return this.parent()&&this.parent().specularLighting(t,i,a,s).in(this)},tile:function(){return this.parent()&&this.parent().tile().in(this)},turbulence:function(t,e,i,a,s){return this.parent()&&this.parent().turbulence(t,e,i,a,s).in(this)}};Q(ki,Si),Q(wi.MergeEffect,{in:function(t){return t instanceof wi.MergeNode?this.add(t,0):this.add((new wi.MergeNode).in(t),0),this}}),Q([wi.CompositeEffect,wi.BlendEffect,wi.DisplacementMapEffect],{in2:function(t){if(null==t){const t=this.attr("in2");return this.parent()&&this.parent().find(`[result="${t}"]`)[0]||t}return this.attr("in2",t)}}),wi.filter={sepiatone:[.343,.669,.119,0,0,.249,.626,.13,0,0,.172,.334,.111,0,0,0,0,0,1,0]};var Li=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"getDefaultFilter",value:function(t,e){var i=this.w;t.unfilter(!0),(new wi).size("120%","180%","-5%","-40%"),i.config.chart.dropShadow.enabled&&this.dropShadow(t,i.config.chart.dropShadow,e)}},{key:"applyFilter",value:function(t,e,i){var a,s=this,r=this.w;if(t.unfilter(!0),"none"!==i){var n,o,l=r.config.chart.dropShadow,h="lighten"===i?2:.3;if(t.filterWith((function(t){t.colorMatrix({type:"matrix",values:"\n ".concat(h," 0 0 0 0\n 0 ").concat(h," 0 0 0\n 0 0 ").concat(h," 0 0\n 0 0 0 1 0\n "),in:"SourceGraphic",result:"brightness"}),l.enabled&&s.addShadow(t,e,l,"brightness")})),!l.noUserSpaceOnUse)null===(n=t.filterer())||void 0===n||null===(o=n.node)||void 0===o||o.setAttribute("filterUnits","userSpaceOnUse");this._scaleFilterSize(null===(a=t.filterer())||void 0===a?void 0:a.node)}else this.getDefaultFilter(t,e)}},{key:"addShadow",value:function(t,e,i,a){var s,r=this.w,n=i.blur,o=i.top,l=i.left,h=i.color,c=i.opacity;if(h=Array.isArray(h)?h[e]:h,(null===(s=r.config.chart.dropShadow.enabledOnSeries)||void 0===s?void 0:s.length)>0&&-1===r.config.chart.dropShadow.enabledOnSeries.indexOf(e))return t;t.offset({in:a,dx:l,dy:o,result:"offset"}),t.gaussianBlur({in:"offset",stdDeviation:n,result:"blur"}),t.flood({"flood-color":h,"flood-opacity":c,result:"flood"}),t.composite({in:"flood",in2:"blur",operator:"in",result:"shadow"}),t.merge(["shadow",a])}},{key:"dropShadow",value:function(t,e){var i,a,s,r,n,o=this,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,h=this.w;if(t.unfilter(!0),v.isMsEdge()&&"radialBar"===h.config.chart.type)return t;if((null===(i=h.config.chart.dropShadow.enabledOnSeries)||void 0===i?void 0:i.length)>0&&-1===(null===(s=h.config.chart.dropShadow.enabledOnSeries)||void 0===s?void 0:s.indexOf(l)))return t;(t.filterWith((function(t){o.addShadow(t,l,e,"SourceGraphic")})),e.noUserSpaceOnUse)||(null===(r=t.filterer())||void 0===r||null===(n=r.node)||void 0===n||n.setAttribute("filterUnits","userSpaceOnUse"));return this._scaleFilterSize(null===(a=t.filterer())||void 0===a?void 0:a.node),t}},{key:"setSelectionFilter",value:function(t,e,i){var a=this.w;if(void 0!==a.globals.selectedDataPoints[e]&&a.globals.selectedDataPoints[e].indexOf(i)>-1){t.node.setAttribute("selected",!0);var s=a.config.states.active.filter;"none"!==s&&this.applyFilter(t,e,s.type)}}},{key:"_scaleFilterSize",value:function(t){if(t){!function(e){for(var i in e)e.hasOwnProperty(i)&&t.setAttribute(i,e[i])}({width:"200%",height:"200%",x:"-50%",y:"-50%"})}}}]),t}(),Mi=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"roundPathCorners",value:function(t,e){function i(t,e,i){var s=e.x-t.x,r=e.y-t.y,n=Math.sqrt(s*s+r*r);return a(t,e,Math.min(1,i/n))}function a(t,e,i){return{x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i}}function s(t,e){t.length>2&&(t[t.length-2]=e.x,t[t.length-1]=e.y)}function r(t){return{x:parseFloat(t[t.length-2]),y:parseFloat(t[t.length-1])}}t.indexOf("NaN")>-1&&(t="");var n=t.split(/[,\s]/).reduce((function(t,e){var i=e.match("([a-zA-Z])(.+)");return i?(t.push(i[1]),t.push(i[2])):t.push(e),t}),[]).reduce((function(t,e){return parseFloat(e)==e&&t.length?t[t.length-1].push(e):t.push([e]),t}),[]),o=[];if(n.length>1){var l=r(n[0]),h=null;"Z"==n[n.length-1][0]&&n[0].length>2&&(h=["L",l.x,l.y],n[n.length-1]=h),o.push(n[0]);for(var c=1;c2&&"L"==u[0]&&g.length>2&&"L"==g[0]){var p,f,x=r(d),b=r(u),m=r(g);p=i(b,x,e),f=i(b,m,e),s(u,p),u.origPoint=b,o.push(u);var v=a(p,b,.5),y=a(b,f,.5),w=["C",v.x,v.y,y.x,y.y,f.x,f.y];w.origPoint=b,o.push(w)}else o.push(u)}if(h){var k=r(o[o.length-1]);o.push(["Z"]),s(o[0],k)}}else o=n;return o.reduce((function(t,e){return t+e.join(" ")+" "}),"")}},{key:"drawLine",value:function(t,e,i,a){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"#a8a8a8",r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,n=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"butt";return this.w.globals.dom.Paper.line().attr({x1:t,y1:e,x2:i,y2:a,stroke:s,"stroke-dasharray":r,"stroke-width":n,"stroke-linecap":o})}},{key:"drawRect",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"#fefefe",n=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null,l=arguments.length>8&&void 0!==arguments[8]?arguments[8]:null,h=arguments.length>9&&void 0!==arguments[9]?arguments[9]:0,c=this.w.globals.dom.Paper.rect();return c.attr({x:t,y:e,width:i>0?i:0,height:a>0?a:0,rx:s,ry:s,opacity:n,"stroke-width":null!==o?o:0,stroke:null!==l?l:"none","stroke-dasharray":h}),c.node.setAttribute("fill",r),c}},{key:"drawPolygon",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#e1e1e1",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"none";return this.w.globals.dom.Paper.polygon(t).attr({fill:a,stroke:e,"stroke-width":i})}},{key:"drawCircle",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;t<0&&(t=0);var i=this.w.globals.dom.Paper.circle(2*t);return null!==e&&i.attr(e),i}},{key:"drawPath",value:function(t){var e=t.d,i=void 0===e?"":e,a=t.stroke,s=void 0===a?"#a8a8a8":a,r=t.strokeWidth,n=void 0===r?1:r,o=t.fill,l=t.fillOpacity,h=void 0===l?1:l,c=t.strokeOpacity,d=void 0===c?1:c,u=t.classes,g=t.strokeLinecap,p=void 0===g?null:g,f=t.strokeDashArray,x=void 0===f?0:f,b=this.w;return null===p&&(p=b.config.stroke.lineCap),(i.indexOf("undefined")>-1||i.indexOf("NaN")>-1)&&(i="M 0 ".concat(b.globals.gridHeight)),b.globals.dom.Paper.path(i).attr({fill:o,"fill-opacity":h,stroke:s,"stroke-opacity":d,"stroke-linecap":p,"stroke-width":n,"stroke-dasharray":x,class:u})}},{key:"group",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=this.w.globals.dom.Paper.group();return null!==t&&e.attr(t),e}},{key:"move",value:function(t,e){var i=["M",t,e].join(" ");return i}},{key:"line",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=null;return null===i?a=[" L",t,e].join(" "):"H"===i?a=[" H",t].join(" "):"V"===i&&(a=[" V",e].join(" ")),a}},{key:"curve",value:function(t,e,i,a,s,r){var n=["C",t,e,i,a,s,r].join(" ");return n}},{key:"quadraticCurve",value:function(t,e,i,a){return["Q",t,e,i,a].join(" ")}},{key:"arc",value:function(t,e,i,a,s,r,n){var o="A";arguments.length>7&&void 0!==arguments[7]&&arguments[7]&&(o="a");var l=[o,t,e,i,a,s,r,n].join(" ");return l}},{key:"renderPaths",value:function(t){var e,i=t.j,a=t.realIndex,s=t.pathFrom,r=t.pathTo,n=t.stroke,o=t.strokeWidth,l=t.strokeLinecap,h=t.fill,c=t.animationDelay,d=t.initialSpeed,g=t.dataChangeSpeed,p=t.className,f=t.chartType,x=t.shouldClipToGrid,b=void 0===x||x,m=t.bindEventsOnPaths,v=void 0===m||m,w=t.drawShadow,k=void 0===w||w,A=this.w,C=new Li(this.ctx),S=new y(this.ctx),L=this.w.config.chart.animations.enabled,M=L&&this.w.config.chart.animations.dynamicAnimation.enabled,P=!!(L&&!A.globals.resized||M&&A.globals.dataChanged&&A.globals.shouldAnimate);P?e=s:(e=r,A.globals.animationEnded=!0);var I=A.config.stroke.dashArray,T=0;T=Array.isArray(I)?I[a]:A.config.stroke.dashArray;var z=this.drawPath({d:e,stroke:n,strokeWidth:o,fill:h,fillOpacity:1,classes:p,strokeLinecap:l,strokeDashArray:T});z.attr("index",a),b&&("bar"===f&&!A.globals.isHorizontal||A.globals.comboCharts?z.attr({"clip-path":"url(#gridRectBarMask".concat(A.globals.cuid,")")}):z.attr({"clip-path":"url(#gridRectMask".concat(A.globals.cuid,")")})),A.config.chart.dropShadow.enabled&&k&&C.dropShadow(z,A.config.chart.dropShadow,a),v&&(z.node.addEventListener("mouseenter",this.pathMouseEnter.bind(this,z)),z.node.addEventListener("mouseleave",this.pathMouseLeave.bind(this,z)),z.node.addEventListener("mousedown",this.pathMouseDown.bind(this,z))),z.attr({pathTo:r,pathFrom:s});var X={el:z,j:i,realIndex:a,pathFrom:s,pathTo:r,fill:h,strokeWidth:o,delay:c};return!L||A.globals.resized||A.globals.dataChanged?!A.globals.resized&&A.globals.dataChanged||S.showDelayedElements():S.animatePathsGradually(u(u({},X),{},{speed:d})),A.globals.dataChanged&&M&&P&&S.animatePathsGradually(u(u({},X),{},{speed:g})),z}},{key:"drawPattern",value:function(t,e,i){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"#a8a8a8",s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return this.w.globals.dom.Paper.pattern(e,i,(function(r){"horizontalLines"===t?r.line(0,0,i,0).stroke({color:a,width:s+1}):"verticalLines"===t?r.line(0,0,0,e).stroke({color:a,width:s+1}):"slantedLines"===t?r.line(0,0,e,i).stroke({color:a,width:s}):"squares"===t?r.rect(e,i).fill("none").stroke({color:a,width:s}):"circles"===t&&r.circle(e).fill("none").stroke({color:a,width:s})}))}},{key:"drawGradient",value:function(t,e,i,a,s){var r,n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:[],h=arguments.length>8&&void 0!==arguments[8]?arguments[8]:0,c=this.w;e.length<9&&0===e.indexOf("#")&&(e=v.hexToRgba(e,a)),i.length<9&&0===i.indexOf("#")&&(i=v.hexToRgba(i,s));var d=0,u=1,g=1,p=null;null!==o&&(d=void 0!==o[0]?o[0]/100:0,u=void 0!==o[1]?o[1]/100:1,g=void 0!==o[2]?o[2]/100:1,p=void 0!==o[3]?o[3]/100:null);var f=!("donut"!==c.config.chart.type&&"pie"!==c.config.chart.type&&"polarArea"!==c.config.chart.type&&"bubble"!==c.config.chart.type);if(r=l&&0!==l.length?c.globals.dom.Paper.gradient(f?"radial":"linear",(function(t){(Array.isArray(l[h])?l[h]:l).forEach((function(e){t.stop(e.offset/100,e.color,e.opacity)}))})):c.globals.dom.Paper.gradient(f?"radial":"linear",(function(t){t.stop(d,e,a),t.stop(u,i,s),t.stop(g,i,s),null!==p&&t.stop(p,e,a)})),f){var x=c.globals.gridWidth/2,b=c.globals.gridHeight/2;"bubble"!==c.config.chart.type?r.attr({gradientUnits:"userSpaceOnUse",cx:x,cy:b,r:n}):r.attr({cx:.5,cy:.5,r:.8,fx:.2,fy:.2})}else"vertical"===t?r.from(0,0).to(0,1):"diagonal"===t?r.from(0,0).to(1,1):"horizontal"===t?r.from(0,1).to(1,1):"diagonal2"===t&&r.from(1,0).to(0,1);return r}},{key:"getTextBasedOnMaxWidth",value:function(t){var e=t.text,i=t.maxWidth,a=t.fontSize,s=t.fontFamily,r=this.getTextRects(e,a,s),n=r.width/e.length,o=Math.floor(i/n);return i-1){var o=i.globals.selectedDataPoints[s].indexOf(r);i.globals.selectedDataPoints[s].splice(o,1)}}else{if(!i.config.states.active.allowMultipleDataPointsSelection&&i.globals.selectedDataPoints.length>0){i.globals.selectedDataPoints=[];var l=i.globals.dom.Paper.find(".apexcharts-series path:not(.apexcharts-decoration-element)"),h=i.globals.dom.Paper.find(".apexcharts-series circle:not(.apexcharts-decoration-element), .apexcharts-series rect:not(.apexcharts-decoration-element)"),c=function(t){Array.prototype.forEach.call(t,(function(t){t.node.setAttribute("selected","false"),a.getDefaultFilter(t,s)}))};c(l),c(h)}t.node.setAttribute("selected","true"),n="true",void 0===i.globals.selectedDataPoints[s]&&(i.globals.selectedDataPoints[s]=[]),i.globals.selectedDataPoints[s].push(r)}if("true"===n){var d=i.config.states.active.filter;if("none"!==d)a.applyFilter(t,s,d.type);else if("none"!==i.config.states.hover.filter&&!i.globals.isTouchDevice){var u=i.config.states.hover.filter;a.applyFilter(t,s,u.type)}}else if("none"!==i.config.states.active.filter.type)if("none"===i.config.states.hover.filter.type||i.globals.isTouchDevice)a.getDefaultFilter(t,s);else{u=i.config.states.hover.filter;a.applyFilter(t,s,u.type)}"function"==typeof i.config.chart.events.dataPointSelection&&i.config.chart.events.dataPointSelection(e,this.ctx,{selectedDataPoints:i.globals.selectedDataPoints,seriesIndex:s,dataPointIndex:r,w:i}),e&&this.ctx.events.fireEvent("dataPointSelection",[e,this.ctx,{selectedDataPoints:i.globals.selectedDataPoints,seriesIndex:s,dataPointIndex:r,w:i}])}},{key:"rotateAroundCenter",value:function(t){var e={};return t&&"function"==typeof t.getBBox&&(e=t.getBBox()),{x:e.x+e.width/2,y:e.y+e.height/2}}},{key:"getTextRects",value:function(t,e,i,a){var s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],r=this.w,n=this.drawText({x:-200,y:-200,text:t,textAnchor:"start",fontSize:e,fontFamily:i,foreColor:"#fff",opacity:0});a&&n.attr("transform",a),r.globals.dom.Paper.add(n);var o=n.bbox();return s||(o=n.node.getBoundingClientRect()),n.remove(),{width:o.width,height:o.height}}},{key:"placeTextWithEllipsis",value:function(t,e,i){if("function"==typeof t.getComputedTextLength&&(t.textContent=e,e.length>0&&t.getComputedTextLength()>=i/1.1)){for(var a=e.length-3;a>0;a-=3)if(t.getSubStringLength(0,a)<=i/1.1)return void(t.textContent=e.substring(0,a)+"...");t.textContent="."}}}],[{key:"setAttrs",value:function(t,e){for(var i in e)e.hasOwnProperty(i)&&t.setAttribute(i,e[i])}}]),t}(),Pi=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"getStackedSeriesTotals",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=this.w,i=[];if(0===e.globals.series.length)return i;for(var a=0;a0&&void 0!==arguments[0]?arguments[0]:null;return null===t?this.w.config.series.reduce((function(t,e){return t+e}),0):this.w.globals.series[t].reduce((function(t,e){return t+e}),0)}},{key:"getStackedSeriesTotalsByGroups",value:function(){var t=this,e=this.w,i=[];return e.globals.seriesGroups.forEach((function(a){var s=[];e.config.series.forEach((function(t,i){a.indexOf(e.globals.seriesNames[i])>-1&&s.push(i)}));var r=e.globals.series.map((function(t,e){return-1===s.indexOf(e)?e:-1})).filter((function(t){return-1!==t}));i.push(t.getStackedSeriesTotals(r))})),i}},{key:"setSeriesYAxisMappings",value:function(){var t=this.w.globals,e=this.w.config,i=[],a=[],s=[],r=t.series.length>e.yaxis.length||e.yaxis.some((function(t){return Array.isArray(t.seriesName)}));e.series.forEach((function(t,e){s.push(e),a.push(null)})),e.yaxis.forEach((function(t,e){i[e]=[]}));var n=[];e.yaxis.forEach((function(t,a){var o=!1;if(t.seriesName){var l=[];Array.isArray(t.seriesName)?l=t.seriesName:l.push(t.seriesName),l.forEach((function(t){e.series.forEach((function(e,n){if(e.name===t){var l=n;a===n||r?!r||s.indexOf(n)>-1?i[a].push([a,n]):console.warn("Series '"+e.name+"' referenced more than once in what looks like the new style. That is, when using either seriesName: [], or when there are more series than yaxes."):(i[n].push([n,a]),l=a),o=!0,-1!==(l=s.indexOf(l))&&s.splice(l,1)}}))}))}o||n.push(a)})),i=i.map((function(t,e){var i=[];return t.forEach((function(t){a[t[1]]=t[0],i.push(t[1])})),i}));for(var o=e.yaxis.length-1,l=0;l0&&void 0!==arguments[0]?arguments[0]:null;return 0===(null===t?this.w.config.series.filter((function(t){return null!==t})):this.w.config.series[t].data.filter((function(t){return null!==t}))).length}},{key:"seriesHaveSameValues",value:function(t){return this.w.globals.series[t].every((function(t,e,i){return t===i[0]}))}},{key:"getCategoryLabels",value:function(t){var e=this.w,i=t.slice();return e.config.xaxis.convertedCatToNumeric&&(i=t.map((function(t,i){return e.config.xaxis.labels.formatter(t-e.globals.minX+1)}))),i}},{key:"getLargestSeries",value:function(){var t=this.w;t.globals.maxValsInArrayIndex=t.globals.series.map((function(t){return t.length})).indexOf(Math.max.apply(Math,t.globals.series.map((function(t){return t.length}))))}},{key:"getLargestMarkerSize",value:function(){var t=this.w,e=0;return t.globals.markers.size.forEach((function(t){e=Math.max(e,t)})),t.config.markers.discrete&&t.config.markers.discrete.length&&t.config.markers.discrete.forEach((function(t){e=Math.max(e,t.size)})),e>0&&(t.config.markers.hover.size>0?e=t.config.markers.hover.size:e+=t.config.markers.hover.sizeOffset),t.globals.markers.largestSize=e,e}},{key:"getSeriesTotals",value:function(){var t=this.w;t.globals.seriesTotals=t.globals.series.map((function(t,e){var i=0;if(Array.isArray(t))for(var a=0;at&&i.globals.seriesX[s][n]0){var g=function(t,e){var i=s.config.yaxis[s.globals.seriesYAxisReverseMap[e]],r=t<0?-1:1;return t=Math.abs(t),i.logarithmic&&(t=a.getBaseLog(i.logBase,t)),-r*t/n[e]};if(r.isMultipleYAxis){l=[];for(var p=0;p0&&e.forEach((function(e){var n=[],o=[];t.i.forEach((function(i,a){s.config.series[i].group===e&&(n.push(t.series[a]),o.push(i))})),n.length>0&&r.push(a.draw(n,i,o))})),r}}],[{key:"checkComboSeries",value:function(t,e){var i=!1,a=0,s=0;return void 0===e&&(e="line"),t.length&&void 0!==t[0].type&&t.forEach((function(t){"bar"!==t.type&&"column"!==t.type&&"candlestick"!==t.type&&"boxPlot"!==t.type||a++,void 0!==t.type&&t.type!==e&&s++})),s>0&&(i=!0),{comboBarCount:a,comboCharts:i}}},{key:"extendArrayProps",value:function(t,e,i){var a,s,r,n,o,l;(null!==(a=e)&&void 0!==a&&a.yaxis&&(e=t.extendYAxis(e,i)),null!==(s=e)&&void 0!==s&&s.annotations)&&(e.annotations.yaxis&&(e=t.extendYAxisAnnotations(e)),null!==(r=e)&&void 0!==r&&null!==(n=r.annotations)&&void 0!==n&&n.xaxis&&(e=t.extendXAxisAnnotations(e)),null!==(o=e)&&void 0!==o&&null!==(l=o.annotations)&&void 0!==l&&l.points&&(e=t.extendPointAnnotations(e)));return e}}]),t}(),Ii=function(){function t(e){i(this,t),this.w=e.w,this.annoCtx=e}return s(t,[{key:"setOrientations",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=this.w;if("vertical"===t.label.orientation){var a=null!==e?e:0,s=i.globals.dom.baseEl.querySelector(".apexcharts-xaxis-annotations .apexcharts-xaxis-annotation-label[rel='".concat(a,"']"));if(null!==s){var r=s.getBoundingClientRect();s.setAttribute("x",parseFloat(s.getAttribute("x"))-r.height+4);var n="top"===t.label.position?r.width:-r.width;s.setAttribute("y",parseFloat(s.getAttribute("y"))+n);var o=this.annoCtx.graphics.rotateAroundCenter(s),l=o.x,h=o.y;s.setAttribute("transform","rotate(-90 ".concat(l," ").concat(h,")"))}}}},{key:"addBackgroundToAnno",value:function(t,e){var i=this.w;if(!t||!e.label.text||!String(e.label.text).trim())return null;var a=i.globals.dom.baseEl.querySelector(".apexcharts-grid").getBoundingClientRect(),s=t.getBoundingClientRect(),r=e.label.style.padding,n=r.left,o=r.right,l=r.top,h=r.bottom;if("vertical"===e.label.orientation){var c=[n,o,l,h];l=c[0],h=c[1],n=c[2],o=c[3]}var d=s.left-a.left-n,u=s.top-a.top-l,g=this.annoCtx.graphics.drawRect(d-i.globals.barPadForNumericAxis,u,s.width+n+o,s.height+l+h,e.label.borderRadius,e.label.style.background,1,e.label.borderWidth,e.label.borderColor,0);return e.id&&g.node.classList.add(e.id),g}},{key:"annotationsBackground",value:function(){var t=this,e=this.w,i=function(i,a,s){var r=e.globals.dom.baseEl.querySelector(".apexcharts-".concat(s,"-annotations .apexcharts-").concat(s,"-annotation-label[rel='").concat(a,"']"));if(r){var n=r.parentNode,o=t.addBackgroundToAnno(r,i);o&&(n.insertBefore(o.node,r),i.label.mouseEnter&&o.node.addEventListener("mouseenter",i.label.mouseEnter.bind(t,i)),i.label.mouseLeave&&o.node.addEventListener("mouseleave",i.label.mouseLeave.bind(t,i)),i.label.click&&o.node.addEventListener("click",i.label.click.bind(t,i)))}};e.config.annotations.xaxis.forEach((function(t,e){return i(t,e,"xaxis")})),e.config.annotations.yaxis.forEach((function(t,e){return i(t,e,"yaxis")})),e.config.annotations.points.forEach((function(t,e){return i(t,e,"point")}))}},{key:"getY1Y2",value:function(t,e){var i,a=this.w,s="y1"===t?e.y:e.y2,r=!1;if(this.annoCtx.invertAxis){var n=a.config.xaxis.convertedCatToNumeric?a.globals.categoryLabels:a.globals.labels,o=n.indexOf(s),l=a.globals.dom.baseEl.querySelector(".apexcharts-yaxis-texts-g text:nth-child(".concat(o+1,")"));i=l?parseFloat(l.getAttribute("y")):(a.globals.gridHeight/n.length-1)*(o+1)-a.globals.barHeight,void 0!==e.seriesIndex&&a.globals.barHeight&&(i-=a.globals.barHeight/2*(a.globals.series.length-1)-a.globals.barHeight*e.seriesIndex)}else{var h,c=a.globals.seriesYAxisMap[e.yAxisIndex][0],d=a.config.yaxis[e.yAxisIndex].logarithmic?new Pi(this.annoCtx.ctx).getLogVal(a.config.yaxis[e.yAxisIndex].logBase,s,c)/a.globals.yLogRatio[c]:(s-a.globals.minYArr[c])/(a.globals.yRange[c]/a.globals.gridHeight);i=a.globals.gridHeight-Math.min(Math.max(d,0),a.globals.gridHeight),r=d>a.globals.gridHeight||d<0,!e.marker||void 0!==e.y&&null!==e.y||(i=0),null!==(h=a.config.yaxis[e.yAxisIndex])&&void 0!==h&&h.reversed&&(i=d)}return"string"==typeof s&&s.includes("px")&&(i=parseFloat(s)),{yP:i,clipped:r}}},{key:"getX1X2",value:function(t,e){var i=this.w,a="x1"===t?e.x:e.x2,s=this.annoCtx.invertAxis?i.globals.minY:i.globals.minX,r=this.annoCtx.invertAxis?i.globals.maxY:i.globals.maxX,n=this.annoCtx.invertAxis?i.globals.yRange[0]:i.globals.xRange,o=!1,l=this.annoCtx.inversedReversedAxis?(r-a)/(n/i.globals.gridWidth):(a-s)/(n/i.globals.gridWidth);return"category"!==i.config.xaxis.type&&!i.config.xaxis.convertedCatToNumeric||this.annoCtx.invertAxis||i.globals.dataFormatXNumeric||i.config.chart.sparkline.enabled||(l=this.getStringX(a)),"string"==typeof a&&a.includes("px")&&(l=parseFloat(a)),null==a&&e.marker&&(l=i.globals.gridWidth),void 0!==e.seriesIndex&&i.globals.barWidth&&!this.annoCtx.invertAxis&&(l-=i.globals.barWidth/2*(i.globals.series.length-1)-i.globals.barWidth*e.seriesIndex),l>i.globals.gridWidth?(l=i.globals.gridWidth,o=!0):l<0&&(l=0,o=!0),{x:l,clipped:o}}},{key:"getStringX",value:function(t){var e=this.w,i=t;e.config.xaxis.convertedCatToNumeric&&e.globals.categoryLabels.length&&(t=e.globals.categoryLabels.indexOf(t)+1);var a=e.globals.labels.map((function(t){return Array.isArray(t)?t.join(" "):t})).indexOf(t),s=e.globals.dom.baseEl.querySelector(".apexcharts-xaxis-texts-g text:nth-child(".concat(a+1,")"));return s&&(i=parseFloat(s.getAttribute("x"))),i}}]),t}(),Ti=function(){function t(e){i(this,t),this.w=e.w,this.annoCtx=e,this.invertAxis=this.annoCtx.invertAxis,this.helpers=new Ii(this.annoCtx)}return s(t,[{key:"addXaxisAnnotation",value:function(t,e,i){var a,s=this.w,r=this.helpers.getX1X2("x1",t),n=r.x,o=r.clipped,l=!0,h=t.label.text,c=t.strokeDashArray;if(v.isNumber(n)){if(null===t.x2||void 0===t.x2){if(!o){var d=this.annoCtx.graphics.drawLine(n+t.offsetX,0+t.offsetY,n+t.offsetX,s.globals.gridHeight+t.offsetY,t.borderColor,c,t.borderWidth);e.appendChild(d.node),t.id&&d.node.classList.add(t.id)}}else{var u=this.helpers.getX1X2("x2",t);if(a=u.x,l=u.clipped,a12?u-12:0===u?12:u;e=(e=(e=(e=e.replace(/(^|[^\\])HH+/g,"$1"+l(u))).replace(/(^|[^\\])H/g,"$1"+u)).replace(/(^|[^\\])hh+/g,"$1"+l(g))).replace(/(^|[^\\])h/g,"$1"+g);var p=a?t.getUTCMinutes():t.getMinutes();e=(e=e.replace(/(^|[^\\])mm+/g,"$1"+l(p))).replace(/(^|[^\\])m/g,"$1"+p);var x=a?t.getUTCSeconds():t.getSeconds();e=(e=e.replace(/(^|[^\\])ss+/g,"$1"+l(x))).replace(/(^|[^\\])s/g,"$1"+x);var b=a?t.getUTCMilliseconds():t.getMilliseconds();e=e.replace(/(^|[^\\])fff+/g,"$1"+l(b,3)),b=Math.round(b/10),e=e.replace(/(^|[^\\])ff/g,"$1"+l(b)),b=Math.round(b/10);var m=u<12?"AM":"PM";e=(e=(e=e.replace(/(^|[^\\])f/g,"$1"+b)).replace(/(^|[^\\])TT+/g,"$1"+m)).replace(/(^|[^\\])T/g,"$1"+m.charAt(0));var v=m.toLowerCase();e=(e=e.replace(/(^|[^\\])tt+/g,"$1"+v)).replace(/(^|[^\\])t/g,"$1"+v.charAt(0));var y=-t.getTimezoneOffset(),w=a||!y?"Z":y>0?"+":"-";if(!a){var k=(y=Math.abs(y))%60;w+=l(Math.floor(y/60))+":"+l(k)}e=e.replace(/(^|[^\\])K/g,"$1"+w);var A=(a?t.getUTCDay():t.getDay())+1;return e=(e=(e=(e=(e=e.replace(new RegExp(n[0],"g"),n[A])).replace(new RegExp(o[0],"g"),o[A])).replace(new RegExp(s[0],"g"),s[c])).replace(new RegExp(r[0],"g"),r[c])).replace(/\\(.)/g,"$1")}},{key:"getTimeUnitsfromTimestamp",value:function(t,e,i){var a=this.w;void 0!==a.config.xaxis.min&&(t=a.config.xaxis.min),void 0!==a.config.xaxis.max&&(e=a.config.xaxis.max);var s=this.getDate(t),r=this.getDate(e),n=this.formatDate(s,"yyyy MM dd HH mm ss fff").split(" "),o=this.formatDate(r,"yyyy MM dd HH mm ss fff").split(" ");return{minMillisecond:parseInt(n[6],10),maxMillisecond:parseInt(o[6],10),minSecond:parseInt(n[5],10),maxSecond:parseInt(o[5],10),minMinute:parseInt(n[4],10),maxMinute:parseInt(o[4],10),minHour:parseInt(n[3],10),maxHour:parseInt(o[3],10),minDate:parseInt(n[2],10),maxDate:parseInt(o[2],10),minMonth:parseInt(n[1],10)-1,maxMonth:parseInt(o[1],10)-1,minYear:parseInt(n[0],10),maxYear:parseInt(o[0],10)}}},{key:"isLeapYear",value:function(t){return t%4==0&&t%100!=0||t%400==0}},{key:"calculcateLastDaysOfMonth",value:function(t,e,i){return this.determineDaysOfMonths(t,e)-i}},{key:"determineDaysOfYear",value:function(t){var e=365;return this.isLeapYear(t)&&(e=366),e}},{key:"determineRemainingDaysOfYear",value:function(t,e,i){var a=this.daysCntOfYear[e]+i;return e>1&&this.isLeapYear()&&a++,a}},{key:"determineDaysOfMonths",value:function(t,e){var i=30;switch(t=v.monthMod(t),!0){case this.months30.indexOf(t)>-1:2===t&&(i=this.isLeapYear(e)?29:28);break;case this.months31.indexOf(t)>-1:default:i=31}return i}}]),t}(),Xi=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.tooltipKeyFormat="dd MMM"}return s(t,[{key:"xLabelFormat",value:function(t,e,i,a){var s=this.w;if("datetime"===s.config.xaxis.type&&void 0===s.config.xaxis.labels.formatter&&void 0===s.config.tooltip.x.formatter){var r=new zi(this.ctx);return r.formatDate(r.getDate(e),s.config.tooltip.x.format)}return t(e,i,a)}},{key:"defaultGeneralFormatter",value:function(t){return Array.isArray(t)?t.map((function(t){return t})):t}},{key:"defaultYFormatter",value:function(t,e,i){var a=this.w;if(v.isNumber(t))if(0!==a.globals.yValueDecimal)t=t.toFixed(void 0!==e.decimalsInFloat?e.decimalsInFloat:a.globals.yValueDecimal);else{var s=t.toFixed(0);t=t==s?s:t.toFixed(1)}return t}},{key:"setLabelFormatters",value:function(){var t=this,e=this.w;return e.globals.xaxisTooltipFormatter=function(e){return t.defaultGeneralFormatter(e)},e.globals.ttKeyFormatter=function(e){return t.defaultGeneralFormatter(e)},e.globals.ttZFormatter=function(t){return t},e.globals.legendFormatter=function(e){return t.defaultGeneralFormatter(e)},void 0!==e.config.xaxis.labels.formatter?e.globals.xLabelFormatter=e.config.xaxis.labels.formatter:e.globals.xLabelFormatter=function(t){if(v.isNumber(t)){if(!e.config.xaxis.convertedCatToNumeric&&"numeric"===e.config.xaxis.type){if(v.isNumber(e.config.xaxis.decimalsInFloat))return t.toFixed(e.config.xaxis.decimalsInFloat);var i=e.globals.maxX-e.globals.minX;return i>0&&i<100?t.toFixed(1):t.toFixed(0)}if(e.globals.isBarHorizontal)if(e.globals.maxY-e.globals.minYArr<4)return t.toFixed(1);return t.toFixed(0)}return t},"function"==typeof e.config.tooltip.x.formatter?e.globals.ttKeyFormatter=e.config.tooltip.x.formatter:e.globals.ttKeyFormatter=e.globals.xLabelFormatter,"function"==typeof e.config.xaxis.tooltip.formatter&&(e.globals.xaxisTooltipFormatter=e.config.xaxis.tooltip.formatter),(Array.isArray(e.config.tooltip.y)||void 0!==e.config.tooltip.y.formatter)&&(e.globals.ttVal=e.config.tooltip.y),void 0!==e.config.tooltip.z.formatter&&(e.globals.ttZFormatter=e.config.tooltip.z.formatter),void 0!==e.config.legend.formatter&&(e.globals.legendFormatter=e.config.legend.formatter),e.config.yaxis.forEach((function(i,a){void 0!==i.labels.formatter?e.globals.yLabelFormatters[a]=i.labels.formatter:e.globals.yLabelFormatters[a]=function(s){return e.globals.xyCharts?Array.isArray(s)?s.map((function(e){return t.defaultYFormatter(e,i,a)})):t.defaultYFormatter(s,i,a):s}})),e.globals}},{key:"heatmapLabelFormatters",value:function(){var t=this.w;if("heatmap"===t.config.chart.type){t.globals.yAxisScale[0].result=t.globals.seriesNames.slice();var e=t.globals.seriesNames.reduce((function(t,e){return t.length>e.length?t:e}),0);t.globals.yAxisScale[0].niceMax=e,t.globals.yAxisScale[0].niceMin=e}}}]),t}(),Ri=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"getLabel",value:function(t,e,i,a){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"12px",n=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=this.w,l=void 0===t[a]?"":t[a],h=l,c=o.globals.xLabelFormatter,d=o.config.xaxis.labels.formatter,u=!1,g=new Xi(this.ctx),p=l;n&&(h=g.xLabelFormat(c,l,p,{i:a,dateFormatter:new zi(this.ctx).formatDate,w:o}),void 0!==d&&(h=d(l,t[a],{i:a,dateFormatter:new zi(this.ctx).formatDate,w:o})));var f,x;e.length>0?(f=e[a].unit,x=null,e.forEach((function(t){"month"===t.unit?x="year":"day"===t.unit?x="month":"hour"===t.unit?x="day":"minute"===t.unit&&(x="hour")})),u=x===f,i=e[a].position,h=e[a].value):"datetime"===o.config.xaxis.type&&void 0===d&&(h=""),void 0===h&&(h=""),h=Array.isArray(h)?h:h.toString();var b=new Mi(this.ctx),m={};m=o.globals.rotateXLabels&&n?b.getTextRects(h,parseInt(r,10),null,"rotate(".concat(o.config.xaxis.labels.rotate," 0 0)"),!1):b.getTextRects(h,parseInt(r,10));var v=!o.config.xaxis.labels.showDuplicates&&this.ctx.timeScale;return!Array.isArray(h)&&("NaN"===String(h)||s.indexOf(h)>=0&&v)&&(h=""),{x:i,text:h,textRect:m,isBold:u}}},{key:"checkLabelBasedOnTickamount",value:function(t,e,i){var a=this.w,s=a.config.xaxis.tickAmount;return"dataPoints"===s&&(s=Math.round(a.globals.gridWidth/120)),s>i||t%Math.round(i/(s+1))==0||(e.text=""),e}},{key:"checkForOverflowingLabels",value:function(t,e,i,a,s){var r=this.w;if(0===t&&r.globals.skipFirstTimelinelabel&&(e.text=""),t===i-1&&r.globals.skipLastTimelinelabel&&(e.text=""),r.config.xaxis.labels.hideOverlappingLabels&&a.length>0){var n=s[s.length-1];e.xa.length||a.some((function(t){return Array.isArray(t.seriesName)}))?t:i.seriesYAxisReverseMap[t]}},{key:"isYAxisHidden",value:function(t){var e=this.w,i=e.config.yaxis[t];if(!i.show||this.yAxisAllSeriesCollapsed(t))return!0;if(!i.showForNullSeries){var a=e.globals.seriesYAxisMap[t],s=new Pi(this.ctx);return a.every((function(t){return s.isSeriesNull(t)}))}return!1}},{key:"getYAxisForeColor",value:function(t,e){var i=this.w;return Array.isArray(t)&&i.globals.yAxisScale[e]&&this.ctx.theme.pushExtraColors(t,i.globals.yAxisScale[e].result.length,!1),t}},{key:"drawYAxisTicks",value:function(t,e,i,a,s,r,n){var o=this.w,l=new Mi(this.ctx),h=o.globals.translateY+o.config.yaxis[s].labels.offsetY;if(o.globals.isBarHorizontal?h=0:"heatmap"===o.config.chart.type&&(h+=r/2),a.show&&e>0){!0===o.config.yaxis[s].opposite&&(t+=a.width);for(var c=e;c>=0;c--){var d=l.drawLine(t+i.offsetX-a.width+a.offsetX,h+a.offsetY,t+i.offsetX+a.offsetX,h+a.offsetY,a.color);n.add(d),h+=r}}}}]),t}(),Ei=function(){function t(e){i(this,t),this.w=e.w,this.annoCtx=e,this.helpers=new Ii(this.annoCtx),this.axesUtils=new Ri(this.annoCtx)}return s(t,[{key:"addYaxisAnnotation",value:function(t,e,i){var a,s=this.w,r=t.strokeDashArray,n=this.helpers.getY1Y2("y1",t),o=n.yP,l=n.clipped,h=!0,c=!1,d=t.label.text;if(null===t.y2||void 0===t.y2){if(!l){c=!0;var u=this.annoCtx.graphics.drawLine(0+t.offsetX,o+t.offsetY,this._getYAxisAnnotationWidth(t),o+t.offsetY,t.borderColor,r,t.borderWidth);e.appendChild(u.node),t.id&&u.node.classList.add(t.id)}}else{if(a=(n=this.helpers.getY1Y2("y2",t)).yP,h=n.clipped,a>o){var g=o;o=a,a=g}if(!l||!h){c=!0;var p=this.annoCtx.graphics.drawRect(0+t.offsetX,a+t.offsetY,this._getYAxisAnnotationWidth(t),o-a,0,t.fillColor,t.opacity,1,t.borderColor,r);p.node.classList.add("apexcharts-annotation-rect"),p.attr("clip-path","url(#gridRectMask".concat(s.globals.cuid,")")),e.appendChild(p.node),t.id&&p.node.classList.add(t.id)}}if(c){var f="right"===t.label.position?s.globals.gridWidth:"center"===t.label.position?s.globals.gridWidth/2:0,x=this.annoCtx.graphics.drawText({x:f+t.label.offsetX,y:(null!=a?a:o)+t.label.offsetY-3,text:d,textAnchor:t.label.textAnchor,fontSize:t.label.style.fontSize,fontFamily:t.label.style.fontFamily,fontWeight:t.label.style.fontWeight,foreColor:t.label.style.color,cssClass:"apexcharts-yaxis-annotation-label ".concat(t.label.style.cssClass," ").concat(t.id?t.id:"")});x.attr({rel:i}),e.appendChild(x.node)}}},{key:"_getYAxisAnnotationWidth",value:function(t){var e=this.w;e.globals.gridWidth;return(t.width.indexOf("%")>-1?e.globals.gridWidth*parseInt(t.width,10)/100:parseInt(t.width,10))+t.offsetX}},{key:"drawYAxisAnnotations",value:function(){var t=this,e=this.w,i=this.annoCtx.graphics.group({class:"apexcharts-yaxis-annotations"});return e.config.annotations.yaxis.forEach((function(e,a){e.yAxisIndex=t.axesUtils.translateYAxisIndex(e.yAxisIndex),t.axesUtils.isYAxisHidden(e.yAxisIndex)&&t.axesUtils.yAxisAllSeriesCollapsed(e.yAxisIndex)||t.addYaxisAnnotation(e,i.node,a)})),i}}]),t}(),Yi=function(){function t(e){i(this,t),this.w=e.w,this.annoCtx=e,this.helpers=new Ii(this.annoCtx)}return s(t,[{key:"addPointAnnotation",value:function(t,e,i){if(!(this.w.globals.collapsedSeriesIndices.indexOf(t.seriesIndex)>-1)){var a=this.helpers.getX1X2("x1",t),s=a.x,r=a.clipped,n=(a=this.helpers.getY1Y2("y1",t)).yP,o=a.clipped;if(v.isNumber(s)&&!o&&!r){var l={pSize:t.marker.size,pointStrokeWidth:t.marker.strokeWidth,pointFillColor:t.marker.fillColor,pointStrokeColor:t.marker.strokeColor,shape:t.marker.shape,pRadius:t.marker.radius,class:"apexcharts-point-annotation-marker ".concat(t.marker.cssClass," ").concat(t.id?t.id:"")},h=this.annoCtx.graphics.drawMarker(s+t.marker.offsetX,n+t.marker.offsetY,l);e.appendChild(h.node);var c=t.label.text?t.label.text:"",d=this.annoCtx.graphics.drawText({x:s+t.label.offsetX,y:n+t.label.offsetY-t.marker.size-parseFloat(t.label.style.fontSize)/1.6,text:c,textAnchor:t.label.textAnchor,fontSize:t.label.style.fontSize,fontFamily:t.label.style.fontFamily,fontWeight:t.label.style.fontWeight,foreColor:t.label.style.color,cssClass:"apexcharts-point-annotation-label ".concat(t.label.style.cssClass," ").concat(t.id?t.id:"")});if(d.attr({rel:i}),e.appendChild(d.node),t.customSVG.SVG){var u=this.annoCtx.graphics.group({class:"apexcharts-point-annotations-custom-svg "+t.customSVG.cssClass});u.attr({transform:"translate(".concat(s+t.customSVG.offsetX,", ").concat(n+t.customSVG.offsetY,")")}),u.node.innerHTML=t.customSVG.SVG,e.appendChild(u.node)}if(t.image.path){var g=t.image.width?t.image.width:20,p=t.image.height?t.image.height:20;h=this.annoCtx.addImage({x:s+t.image.offsetX-g/2,y:n+t.image.offsetY-p/2,width:g,height:p,path:t.image.path,appendTo:".apexcharts-point-annotations"})}t.mouseEnter&&h.node.addEventListener("mouseenter",t.mouseEnter.bind(this,t)),t.mouseLeave&&h.node.addEventListener("mouseleave",t.mouseLeave.bind(this,t)),t.click&&h.node.addEventListener("click",t.click.bind(this,t))}}}},{key:"drawPointAnnotations",value:function(){var t=this,e=this.w,i=this.annoCtx.graphics.group({class:"apexcharts-point-annotations"});return e.config.annotations.points.map((function(e,a){t.addPointAnnotation(e,i.node,a)})),i}}]),t}();var Hi={name:"en",options:{months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],toolbar:{exportToSVG:"Download SVG",exportToPNG:"Download PNG",exportToCSV:"Download CSV",menu:"Menu",selection:"Selection",selectionZoom:"Selection Zoom",zoomIn:"Zoom In",zoomOut:"Zoom Out",pan:"Panning",reset:"Reset Zoom"}}},Oi=function(){function t(){i(this,t),this.yAxis={show:!0,showAlways:!1,showForNullSeries:!0,seriesName:void 0,opposite:!1,reversed:!1,logarithmic:!1,logBase:10,tickAmount:void 0,stepSize:void 0,forceNiceScale:!1,max:void 0,min:void 0,floating:!1,decimalsInFloat:void 0,labels:{show:!0,showDuplicates:!1,minWidth:0,maxWidth:160,offsetX:0,offsetY:0,align:void 0,rotate:0,padding:20,style:{colors:[],fontSize:"11px",fontWeight:400,fontFamily:void 0,cssClass:""},formatter:void 0},axisBorder:{show:!1,color:"#e0e0e0",width:1,offsetX:0,offsetY:0},axisTicks:{show:!1,color:"#e0e0e0",width:6,offsetX:0,offsetY:0},title:{text:void 0,rotate:-90,offsetY:0,offsetX:0,style:{color:void 0,fontSize:"11px",fontWeight:900,fontFamily:void 0,cssClass:""}},tooltip:{enabled:!1,offsetX:0},crosshairs:{show:!0,position:"front",stroke:{color:"#b6b6b6",width:1,dashArray:0}}},this.pointAnnotation={id:void 0,x:0,y:null,yAxisIndex:0,seriesIndex:void 0,mouseEnter:void 0,mouseLeave:void 0,click:void 0,marker:{size:4,fillColor:"#fff",strokeWidth:2,strokeColor:"#333",shape:"circle",offsetX:0,offsetY:0,cssClass:""},label:{borderColor:"#c2c2c2",borderWidth:1,borderRadius:2,text:void 0,textAnchor:"middle",offsetX:0,offsetY:0,mouseEnter:void 0,mouseLeave:void 0,click:void 0,style:{background:"#fff",color:void 0,fontSize:"11px",fontFamily:void 0,fontWeight:400,cssClass:"",padding:{left:5,right:5,top:2,bottom:2}}},customSVG:{SVG:void 0,cssClass:void 0,offsetX:0,offsetY:0},image:{path:void 0,width:20,height:20,offsetX:0,offsetY:0}},this.yAxisAnnotation={id:void 0,y:0,y2:null,strokeDashArray:1,fillColor:"#c2c2c2",borderColor:"#c2c2c2",borderWidth:1,opacity:.3,offsetX:0,offsetY:0,width:"100%",yAxisIndex:0,label:{borderColor:"#c2c2c2",borderWidth:1,borderRadius:2,text:void 0,textAnchor:"end",position:"right",offsetX:0,offsetY:-3,mouseEnter:void 0,mouseLeave:void 0,click:void 0,style:{background:"#fff",color:void 0,fontSize:"11px",fontFamily:void 0,fontWeight:400,cssClass:"",padding:{left:5,right:5,top:2,bottom:2}}}},this.xAxisAnnotation={id:void 0,x:0,x2:null,strokeDashArray:1,fillColor:"#c2c2c2",borderColor:"#c2c2c2",borderWidth:1,opacity:.3,offsetX:0,offsetY:0,label:{borderColor:"#c2c2c2",borderWidth:1,borderRadius:2,text:void 0,textAnchor:"middle",orientation:"vertical",position:"top",offsetX:0,offsetY:0,mouseEnter:void 0,mouseLeave:void 0,click:void 0,style:{background:"#fff",color:void 0,fontSize:"11px",fontFamily:void 0,fontWeight:400,cssClass:"",padding:{left:5,right:5,top:2,bottom:2}}}},this.text={x:0,y:0,text:"",textAnchor:"start",foreColor:void 0,fontSize:"13px",fontFamily:void 0,fontWeight:400,appendTo:".apexcharts-annotations",backgroundColor:"transparent",borderColor:"#c2c2c2",borderRadius:0,borderWidth:0,paddingLeft:4,paddingRight:4,paddingTop:2,paddingBottom:2}}return s(t,[{key:"init",value:function(){return{annotations:{yaxis:[this.yAxisAnnotation],xaxis:[this.xAxisAnnotation],points:[this.pointAnnotation],texts:[],images:[],shapes:[]},chart:{animations:{enabled:!0,speed:800,animateGradually:{delay:150,enabled:!0},dynamicAnimation:{enabled:!0,speed:350}},background:"",locales:[Hi],defaultLocale:"en",dropShadow:{enabled:!1,enabledOnSeries:void 0,top:2,left:2,blur:4,color:"#000",opacity:.7},events:{animationEnd:void 0,beforeMount:void 0,mounted:void 0,updated:void 0,click:void 0,mouseMove:void 0,mouseLeave:void 0,xAxisLabelClick:void 0,legendClick:void 0,markerClick:void 0,selection:void 0,dataPointSelection:void 0,dataPointMouseEnter:void 0,dataPointMouseLeave:void 0,beforeZoom:void 0,beforeResetZoom:void 0,zoomed:void 0,scrolled:void 0,brushScrolled:void 0},foreColor:"#373d3f",fontFamily:"Helvetica, Arial, sans-serif",height:"auto",parentHeightOffset:15,redrawOnParentResize:!0,redrawOnWindowResize:!0,id:void 0,group:void 0,nonce:void 0,offsetX:0,offsetY:0,selection:{enabled:!1,type:"x",fill:{color:"#24292e",opacity:.1},stroke:{width:1,color:"#24292e",opacity:.4,dashArray:3},xaxis:{min:void 0,max:void 0},yaxis:{min:void 0,max:void 0}},sparkline:{enabled:!1},brush:{enabled:!1,autoScaleYaxis:!0,target:void 0,targets:void 0},stacked:!1,stackOnlyBar:!0,stackType:"normal",toolbar:{show:!0,offsetX:0,offsetY:0,tools:{download:!0,selection:!0,zoom:!0,zoomin:!0,zoomout:!0,pan:!0,reset:!0,customIcons:[]},export:{csv:{filename:void 0,columnDelimiter:",",headerCategory:"category",headerValue:"value",categoryFormatter:void 0,valueFormatter:void 0},png:{filename:void 0},svg:{filename:void 0},scale:void 0,width:void 0},autoSelected:"zoom"},type:"line",width:"100%",zoom:{enabled:!0,type:"x",autoScaleYaxis:!1,allowMouseWheelZoom:!0,zoomedArea:{fill:{color:"#90CAF9",opacity:.4},stroke:{color:"#0D47A1",opacity:.4,width:1}}}},plotOptions:{line:{isSlopeChart:!1,colors:{threshold:0,colorAboveThreshold:void 0,colorBelowThreshold:void 0}},area:{fillTo:"origin"},bar:{horizontal:!1,columnWidth:"70%",barHeight:"70%",distributed:!1,borderRadius:0,borderRadiusApplication:"around",borderRadiusWhenStacked:"last",rangeBarOverlap:!0,rangeBarGroupRows:!1,hideZeroBarsWhenGrouped:!1,isDumbbell:!1,dumbbellColors:void 0,isFunnel:!1,isFunnel3d:!0,colors:{ranges:[],backgroundBarColors:[],backgroundBarOpacity:1,backgroundBarRadius:0},dataLabels:{position:"top",maxItems:100,hideOverflowingLabels:!0,orientation:"horizontal",total:{enabled:!1,formatter:void 0,offsetX:0,offsetY:0,style:{color:"#373d3f",fontSize:"12px",fontFamily:void 0,fontWeight:600}}}},bubble:{zScaling:!0,minBubbleRadius:void 0,maxBubbleRadius:void 0},candlestick:{colors:{upward:"#00B746",downward:"#EF403C"},wick:{useFillColor:!0}},boxPlot:{colors:{upper:"#00E396",lower:"#008FFB"}},heatmap:{radius:2,enableShades:!0,shadeIntensity:.5,reverseNegativeShade:!1,distributed:!1,useFillColorAsStroke:!1,colorScale:{inverse:!1,ranges:[],min:void 0,max:void 0}},treemap:{enableShades:!0,shadeIntensity:.5,distributed:!1,reverseNegativeShade:!1,useFillColorAsStroke:!1,borderRadius:4,dataLabels:{format:"scale"},colorScale:{inverse:!1,ranges:[],min:void 0,max:void 0},seriesTitle:{show:!0,offsetY:1,offsetX:1,borderColor:"#000",borderWidth:1,borderRadius:2,style:{background:"rgba(0, 0, 0, 0.6)",color:"#fff",fontSize:"12px",fontFamily:void 0,fontWeight:400,cssClass:"",padding:{left:6,right:6,top:2,bottom:2}}}},radialBar:{inverseOrder:!1,startAngle:0,endAngle:360,offsetX:0,offsetY:0,hollow:{margin:5,size:"50%",background:"transparent",image:void 0,imageWidth:150,imageHeight:150,imageOffsetX:0,imageOffsetY:0,imageClipped:!0,position:"front",dropShadow:{enabled:!1,top:0,left:0,blur:3,color:"#000",opacity:.5}},track:{show:!0,startAngle:void 0,endAngle:void 0,background:"#f2f2f2",strokeWidth:"97%",opacity:1,margin:5,dropShadow:{enabled:!1,top:0,left:0,blur:3,color:"#000",opacity:.5}},dataLabels:{show:!0,name:{show:!0,fontSize:"16px",fontFamily:void 0,fontWeight:600,color:void 0,offsetY:0,formatter:function(t){return t}},value:{show:!0,fontSize:"14px",fontFamily:void 0,fontWeight:400,color:void 0,offsetY:16,formatter:function(t){return t+"%"}},total:{show:!1,label:"Total",fontSize:"16px",fontWeight:600,fontFamily:void 0,color:void 0,formatter:function(t){return t.globals.seriesTotals.reduce((function(t,e){return t+e}),0)/t.globals.series.length+"%"}}},barLabels:{enabled:!1,offsetX:0,offsetY:0,useSeriesColors:!0,fontFamily:void 0,fontWeight:600,fontSize:"16px",formatter:function(t){return t},onClick:void 0}},pie:{customScale:1,offsetX:0,offsetY:0,startAngle:0,endAngle:360,expandOnClick:!0,dataLabels:{offset:0,minAngleToShowLabel:10},donut:{size:"65%",background:"transparent",labels:{show:!1,name:{show:!0,fontSize:"16px",fontFamily:void 0,fontWeight:600,color:void 0,offsetY:-10,formatter:function(t){return t}},value:{show:!0,fontSize:"20px",fontFamily:void 0,fontWeight:400,color:void 0,offsetY:10,formatter:function(t){return t}},total:{show:!1,showAlways:!1,label:"Total",fontSize:"16px",fontWeight:400,fontFamily:void 0,color:void 0,formatter:function(t){return t.globals.seriesTotals.reduce((function(t,e){return t+e}),0)}}}}},polarArea:{rings:{strokeWidth:1,strokeColor:"#e8e8e8"},spokes:{strokeWidth:1,connectorColors:"#e8e8e8"}},radar:{size:void 0,offsetX:0,offsetY:0,polygons:{strokeWidth:1,strokeColors:"#e8e8e8",connectorColors:"#e8e8e8",fill:{colors:void 0}}}},colors:void 0,dataLabels:{enabled:!0,enabledOnSeries:void 0,formatter:function(t){return null!==t?t:""},textAnchor:"middle",distributed:!1,offsetX:0,offsetY:0,style:{fontSize:"12px",fontFamily:void 0,fontWeight:600,colors:void 0},background:{enabled:!0,foreColor:"#fff",borderRadius:2,padding:4,opacity:.9,borderWidth:1,borderColor:"#fff",dropShadow:{enabled:!1,top:1,left:1,blur:1,color:"#000",opacity:.8}},dropShadow:{enabled:!1,top:1,left:1,blur:1,color:"#000",opacity:.8}},fill:{type:"solid",colors:void 0,opacity:.85,gradient:{shade:"dark",type:"horizontal",shadeIntensity:.5,gradientToColors:void 0,inverseColors:!0,opacityFrom:1,opacityTo:1,stops:[0,50,100],colorStops:[]},image:{src:[],width:void 0,height:void 0},pattern:{style:"squares",width:6,height:6,strokeWidth:2}},forecastDataPoints:{count:0,fillOpacity:.5,strokeWidth:void 0,dashArray:4},grid:{show:!0,borderColor:"#e0e0e0",strokeDashArray:0,position:"back",xaxis:{lines:{show:!1}},yaxis:{lines:{show:!0}},row:{colors:void 0,opacity:.5},column:{colors:void 0,opacity:.5},padding:{top:0,right:10,bottom:0,left:12}},labels:[],legend:{show:!0,showForSingleSeries:!1,showForNullSeries:!0,showForZeroSeries:!0,floating:!1,position:"bottom",horizontalAlign:"center",inverseOrder:!1,fontSize:"12px",fontFamily:void 0,fontWeight:400,width:void 0,height:void 0,formatter:void 0,tooltipHoverFormatter:void 0,offsetX:-20,offsetY:4,customLegendItems:[],clusterGroupedSeries:!0,clusterGroupedSeriesOrientation:"vertical",labels:{colors:void 0,useSeriesColors:!1},markers:{size:7,fillColors:void 0,strokeWidth:1,shape:void 0,offsetX:0,offsetY:0,customHTML:void 0,onClick:void 0},itemMargin:{horizontal:5,vertical:4},onItemClick:{toggleDataSeries:!0},onItemHover:{highlightDataSeries:!0}},markers:{discrete:[],size:0,colors:void 0,strokeColors:"#fff",strokeWidth:2,strokeOpacity:.9,strokeDashArray:0,fillOpacity:1,shape:"circle",offsetX:0,offsetY:0,showNullDataPoints:!0,onClick:void 0,onDblClick:void 0,hover:{size:void 0,sizeOffset:3}},noData:{text:void 0,align:"center",verticalAlign:"middle",offsetX:0,offsetY:0,style:{color:void 0,fontSize:"14px",fontFamily:void 0}},responsive:[],series:void 0,states:{hover:{filter:{type:"lighten"}},active:{allowMultipleDataPointsSelection:!1,filter:{type:"darken"}}},title:{text:void 0,align:"left",margin:5,offsetX:0,offsetY:0,floating:!1,style:{fontSize:"14px",fontWeight:900,fontFamily:void 0,color:void 0}},subtitle:{text:void 0,align:"left",margin:5,offsetX:0,offsetY:30,floating:!1,style:{fontSize:"12px",fontWeight:400,fontFamily:void 0,color:void 0}},stroke:{show:!0,curve:"smooth",lineCap:"butt",width:2,colors:void 0,dashArray:0,fill:{type:"solid",colors:void 0,opacity:.85,gradient:{shade:"dark",type:"horizontal",shadeIntensity:.5,gradientToColors:void 0,inverseColors:!0,opacityFrom:1,opacityTo:1,stops:[0,50,100],colorStops:[]}}},tooltip:{enabled:!0,enabledOnSeries:void 0,shared:!0,hideEmptySeries:!1,followCursor:!1,intersect:!1,inverseOrder:!1,custom:void 0,fillSeriesColor:!1,theme:"light",cssClass:"",style:{fontSize:"12px",fontFamily:void 0},onDatasetHover:{highlightDataSeries:!1},x:{show:!0,format:"dd MMM",formatter:void 0},y:{formatter:void 0,title:{formatter:function(t){return t?t+": ":""}}},z:{formatter:void 0,title:"Size: "},marker:{show:!0,fillColors:void 0},items:{display:"flex"},fixed:{enabled:!1,position:"topRight",offsetX:0,offsetY:0}},xaxis:{type:"category",categories:[],convertedCatToNumeric:!1,offsetX:0,offsetY:0,overwriteCategories:void 0,labels:{show:!0,rotate:-45,rotateAlways:!1,hideOverlappingLabels:!0,trim:!1,minHeight:void 0,maxHeight:120,showDuplicates:!0,style:{colors:[],fontSize:"12px",fontWeight:400,fontFamily:void 0,cssClass:""},offsetX:0,offsetY:0,format:void 0,formatter:void 0,datetimeUTC:!0,datetimeFormatter:{year:"yyyy",month:"MMM 'yy",day:"dd MMM",hour:"HH:mm",minute:"HH:mm:ss",second:"HH:mm:ss"}},group:{groups:[],style:{colors:[],fontSize:"12px",fontWeight:400,fontFamily:void 0,cssClass:""}},axisBorder:{show:!0,color:"#e0e0e0",width:"100%",height:1,offsetX:0,offsetY:0},axisTicks:{show:!0,color:"#e0e0e0",height:6,offsetX:0,offsetY:0},stepSize:void 0,tickAmount:void 0,tickPlacement:"on",min:void 0,max:void 0,range:void 0,floating:!1,decimalsInFloat:void 0,position:"bottom",title:{text:void 0,offsetX:0,offsetY:0,style:{color:void 0,fontSize:"12px",fontWeight:900,fontFamily:void 0,cssClass:""}},crosshairs:{show:!0,width:1,position:"back",opacity:.9,stroke:{color:"#b6b6b6",width:1,dashArray:3},fill:{type:"solid",color:"#B1B9C4",gradient:{colorFrom:"#D8E3F0",colorTo:"#BED1E6",stops:[0,100],opacityFrom:.4,opacityTo:.5}},dropShadow:{enabled:!1,left:0,top:0,blur:1,opacity:.8}},tooltip:{enabled:!0,offsetY:0,formatter:void 0,style:{fontSize:"12px",fontFamily:void 0}}},yaxis:this.yAxis,theme:{mode:"",palette:"palette1",monochrome:{enabled:!1,color:"#008FFB",shadeTo:"light",shadeIntensity:.65}}}}}]),t}(),Fi=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.graphics=new Mi(this.ctx),this.w.globals.isBarHorizontal&&(this.invertAxis=!0),this.helpers=new Ii(this),this.xAxisAnnotations=new Ti(this),this.yAxisAnnotations=new Ei(this),this.pointsAnnotations=new Yi(this),this.w.globals.isBarHorizontal&&this.w.config.yaxis[0].reversed&&(this.inversedReversedAxis=!0),this.xDivision=this.w.globals.gridWidth/this.w.globals.dataPoints}return s(t,[{key:"drawAxesAnnotations",value:function(){var t=this.w;if(t.globals.axisCharts&&t.globals.dataPoints){for(var e=this.yAxisAnnotations.drawYAxisAnnotations(),i=this.xAxisAnnotations.drawXAxisAnnotations(),a=this.pointsAnnotations.drawPointAnnotations(),s=t.config.chart.animations.enabled,r=[e,i,a],n=[i.node,e.node,a.node],o=0;o<3;o++)t.globals.dom.elGraphical.add(r[o]),!s||t.globals.resized||t.globals.dataChanged||"scatter"!==t.config.chart.type&&"bubble"!==t.config.chart.type&&t.globals.dataPoints>1&&n[o].classList.add("apexcharts-element-hidden"),t.globals.delayedElements.push({el:n[o],index:0});this.helpers.annotationsBackground()}}},{key:"drawImageAnnos",value:function(){var t=this;this.w.config.annotations.images.map((function(e,i){t.addImage(e,i)}))}},{key:"drawTextAnnos",value:function(){var t=this;this.w.config.annotations.texts.map((function(e,i){t.addText(e,i)}))}},{key:"addXaxisAnnotation",value:function(t,e,i){this.xAxisAnnotations.addXaxisAnnotation(t,e,i)}},{key:"addYaxisAnnotation",value:function(t,e,i){this.yAxisAnnotations.addYaxisAnnotation(t,e,i)}},{key:"addPointAnnotation",value:function(t,e,i){this.pointsAnnotations.addPointAnnotation(t,e,i)}},{key:"addText",value:function(t,e){var i=t.x,a=t.y,s=t.text,r=t.textAnchor,n=t.foreColor,o=t.fontSize,l=t.fontFamily,h=t.fontWeight,c=t.cssClass,d=t.backgroundColor,u=t.borderWidth,g=t.strokeDashArray,p=t.borderRadius,f=t.borderColor,x=t.appendTo,b=void 0===x?".apexcharts-svg":x,m=t.paddingLeft,v=void 0===m?4:m,y=t.paddingRight,w=void 0===y?4:y,k=t.paddingBottom,A=void 0===k?2:k,C=t.paddingTop,S=void 0===C?2:C,L=this.w,M=this.graphics.drawText({x:i,y:a,text:s,textAnchor:r||"start",fontSize:o||"12px",fontWeight:h||"regular",fontFamily:l||L.config.chart.fontFamily,foreColor:n||L.config.chart.foreColor,cssClass:c}),P=L.globals.dom.baseEl.querySelector(b);P&&P.appendChild(M.node);var I=M.bbox();if(s){var T=this.graphics.drawRect(I.x-v,I.y-S,I.width+v+w,I.height+A+S,p,d||"transparent",1,u,f,g);P.insertBefore(T.node,M.node)}}},{key:"addImage",value:function(t,e){var i=this.w,a=t.path,s=t.x,r=void 0===s?0:s,n=t.y,o=void 0===n?0:n,l=t.width,h=void 0===l?20:l,c=t.height,d=void 0===c?20:c,u=t.appendTo,g=void 0===u?".apexcharts-svg":u,p=i.globals.dom.Paper.image(a);p.size(h,d).move(r,o);var f=i.globals.dom.baseEl.querySelector(g);return f&&f.appendChild(p.node),p}},{key:"addXaxisAnnotationExternal",value:function(t,e,i){return this.addAnnotationExternal({params:t,pushToMemory:e,context:i,type:"xaxis",contextMethod:i.addXaxisAnnotation}),i}},{key:"addYaxisAnnotationExternal",value:function(t,e,i){return this.addAnnotationExternal({params:t,pushToMemory:e,context:i,type:"yaxis",contextMethod:i.addYaxisAnnotation}),i}},{key:"addPointAnnotationExternal",value:function(t,e,i){return void 0===this.invertAxis&&(this.invertAxis=i.w.globals.isBarHorizontal),this.addAnnotationExternal({params:t,pushToMemory:e,context:i,type:"point",contextMethod:i.addPointAnnotation}),i}},{key:"addAnnotationExternal",value:function(t){var e=t.params,i=t.pushToMemory,a=t.context,s=t.type,r=t.contextMethod,n=a,o=n.w,l=o.globals.dom.baseEl.querySelector(".apexcharts-".concat(s,"-annotations")),h=l.childNodes.length+1,c=new Oi,d=Object.assign({},"xaxis"===s?c.xAxisAnnotation:"yaxis"===s?c.yAxisAnnotation:c.pointAnnotation),u=v.extend(d,e);switch(s){case"xaxis":this.addXaxisAnnotation(u,l,h);break;case"yaxis":this.addYaxisAnnotation(u,l,h);break;case"point":this.addPointAnnotation(u,l,h)}var g=o.globals.dom.baseEl.querySelector(".apexcharts-".concat(s,"-annotations .apexcharts-").concat(s,"-annotation-label[rel='").concat(h,"']")),p=this.helpers.addBackgroundToAnno(g,u);return p&&l.insertBefore(p.node,g),i&&o.globals.memory.methodsToExec.push({context:n,id:u.id?u.id:v.randomId(),method:r,label:"addAnnotation",params:e}),a}},{key:"clearAnnotations",value:function(t){for(var e=t.w,i=e.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxis-annotations, .apexcharts-xaxis-annotations, .apexcharts-point-annotations"),a=e.globals.memory.methodsToExec.length-1;a>=0;a--)"addText"!==e.globals.memory.methodsToExec[a].label&&"addAnnotation"!==e.globals.memory.methodsToExec[a].label||e.globals.memory.methodsToExec.splice(a,1);i=v.listToArray(i),Array.prototype.forEach.call(i,(function(t){for(;t.firstChild;)t.removeChild(t.firstChild)}))}},{key:"removeAnnotation",value:function(t,e){var i=t.w,a=i.globals.dom.baseEl.querySelectorAll(".".concat(e));a&&(i.globals.memory.methodsToExec.map((function(t,a){t.id===e&&i.globals.memory.methodsToExec.splice(a,1)})),Array.prototype.forEach.call(a,(function(t){t.parentElement.removeChild(t)})))}}]),t}(),Di=function(t){var e,i=t.isTimeline,a=t.ctx,s=t.seriesIndex,r=t.dataPointIndex,n=t.y1,o=t.y2,l=t.w,h=l.globals.seriesRangeStart[s][r],c=l.globals.seriesRangeEnd[s][r],d=l.globals.labels[r],u=l.config.series[s].name?l.config.series[s].name:"",g=l.globals.ttKeyFormatter,p=l.config.tooltip.y.title.formatter,f={w:l,seriesIndex:s,dataPointIndex:r,start:h,end:c};("function"==typeof p&&(u=p(u,f)),null!==(e=l.config.series[s].data[r])&&void 0!==e&&e.x&&(d=l.config.series[s].data[r].x),i)||"datetime"===l.config.xaxis.type&&(d=new Xi(a).xLabelFormat(l.globals.ttKeyFormatter,d,d,{i:void 0,dateFormatter:new zi(a).formatDate,w:l}));"function"==typeof g&&(d=g(d,f)),Number.isFinite(n)&&Number.isFinite(o)&&(h=n,c=o);var x="",b="",m=l.globals.colors[s];if(void 0===l.config.tooltip.x.formatter)if("datetime"===l.config.xaxis.type){var v=new zi(a);x=v.formatDate(v.getDate(h),l.config.tooltip.x.format),b=v.formatDate(v.getDate(c),l.config.tooltip.x.format)}else x=h,b=c;else x=l.config.tooltip.x.formatter(h),b=l.config.tooltip.x.formatter(c);return{start:h,end:c,startVal:x,endVal:b,ylabel:d,color:m,seriesName:u}},_i=function(t){var e=t.color,i=t.seriesName,a=t.ylabel,s=t.start,r=t.end,n=t.seriesIndex,o=t.dataPointIndex,l=t.ctx.tooltip.tooltipLabels.getFormatters(n);s=l.yLbFormatter(s),r=l.yLbFormatter(r);var h=l.yLbFormatter(t.w.globals.series[n][o]),c='\n '.concat(s,'\n - \n ').concat(r,"\n ");return'
'+(i||"")+'
'+a+": "+(t.w.globals.comboCharts?"rangeArea"===t.w.config.series[n].type||"rangeBar"===t.w.config.series[n].type?c:"".concat(h,""):c)+"
"},Ni=function(){function t(e){i(this,t),this.opts=e}return s(t,[{key:"hideYAxis",value:function(){this.opts.yaxis[0].show=!1,this.opts.yaxis[0].title.text="",this.opts.yaxis[0].axisBorder.show=!1,this.opts.yaxis[0].axisTicks.show=!1,this.opts.yaxis[0].floating=!0}},{key:"line",value:function(){return{dataLabels:{enabled:!1},stroke:{width:5,curve:"straight"},markers:{size:0,hover:{sizeOffset:6}},xaxis:{crosshairs:{width:1}}}}},{key:"sparkline",value:function(t){this.hideYAxis();return v.extend(t,{grid:{show:!1,padding:{left:0,right:0,top:0,bottom:0}},legend:{show:!1},xaxis:{labels:{show:!1},tooltip:{enabled:!1},axisBorder:{show:!1},axisTicks:{show:!1}},chart:{toolbar:{show:!1},zoom:{enabled:!1}},dataLabels:{enabled:!1}})}},{key:"slope",value:function(){return this.hideYAxis(),{chart:{toolbar:{show:!1},zoom:{enabled:!1}},dataLabels:{enabled:!0,formatter:function(t,e){var i=e.w.config.series[e.seriesIndex].name;return null!==t?i+": "+t:""},background:{enabled:!1},offsetX:-5},grid:{xaxis:{lines:{show:!0}},yaxis:{lines:{show:!1}}},xaxis:{position:"top",labels:{style:{fontSize:14,fontWeight:900}},tooltip:{enabled:!1},crosshairs:{show:!1}},markers:{size:8,hover:{sizeOffset:1}},legend:{show:!1},tooltip:{shared:!1,intersect:!0,followCursor:!0},stroke:{width:5,curve:"straight"}}}},{key:"bar",value:function(){return{chart:{stacked:!1},plotOptions:{bar:{dataLabels:{position:"center"}}},dataLabels:{style:{colors:["#fff"]},background:{enabled:!1}},stroke:{width:0,lineCap:"square"},fill:{opacity:.85},legend:{markers:{shape:"square"}},tooltip:{shared:!1,intersect:!0},xaxis:{tooltip:{enabled:!1},tickPlacement:"between",crosshairs:{width:"barWidth",position:"back",fill:{type:"gradient"},dropShadow:{enabled:!1},stroke:{width:0}}}}}},{key:"funnel",value:function(){return this.hideYAxis(),u(u({},this.bar()),{},{chart:{animations:{speed:800,animateGradually:{enabled:!1}}},plotOptions:{bar:{horizontal:!0,borderRadiusApplication:"around",borderRadius:0,dataLabels:{position:"center"}}},grid:{show:!1,padding:{left:0,right:0}},xaxis:{labels:{show:!1},tooltip:{enabled:!1},axisBorder:{show:!1},axisTicks:{show:!1}}})}},{key:"candlestick",value:function(){var t=this;return{stroke:{width:1,colors:["#333"]},fill:{opacity:1},dataLabels:{enabled:!1},tooltip:{shared:!0,custom:function(e){var i=e.seriesIndex,a=e.dataPointIndex,s=e.w;return t._getBoxTooltip(s,i,a,["Open","High","","Low","Close"],"candlestick")}},states:{active:{filter:{type:"none"}}},xaxis:{crosshairs:{width:1}}}}},{key:"boxPlot",value:function(){var t=this;return{chart:{animations:{dynamicAnimation:{enabled:!1}}},stroke:{width:1,colors:["#24292e"]},dataLabels:{enabled:!1},tooltip:{shared:!0,custom:function(e){var i=e.seriesIndex,a=e.dataPointIndex,s=e.w;return t._getBoxTooltip(s,i,a,["Minimum","Q1","Median","Q3","Maximum"],"boxPlot")}},markers:{size:7,strokeWidth:1,strokeColors:"#111"},xaxis:{crosshairs:{width:1}}}}},{key:"rangeBar",value:function(){return{chart:{animations:{animateGradually:!1}},stroke:{width:0,lineCap:"square"},plotOptions:{bar:{borderRadius:0,dataLabels:{position:"center"}}},dataLabels:{enabled:!1,formatter:function(t,e){e.ctx;var i=e.seriesIndex,a=e.dataPointIndex,s=e.w,r=function(){var t=s.globals.seriesRangeStart[i][a];return s.globals.seriesRangeEnd[i][a]-t};return s.globals.comboCharts?"rangeBar"===s.config.series[i].type||"rangeArea"===s.config.series[i].type?r():t:r()},background:{enabled:!1},style:{colors:["#fff"]}},markers:{size:10},tooltip:{shared:!1,followCursor:!0,custom:function(t){return t.w.config.plotOptions&&t.w.config.plotOptions.bar&&t.w.config.plotOptions.bar.horizontal?function(t){var e=Di(u(u({},t),{},{isTimeline:!0})),i=e.color,a=e.seriesName,s=e.ylabel,r=e.startVal,n=e.endVal;return _i(u(u({},t),{},{color:i,seriesName:a,ylabel:s,start:r,end:n}))}(t):function(t){var e=Di(t),i=e.color,a=e.seriesName,s=e.ylabel,r=e.start,n=e.end;return _i(u(u({},t),{},{color:i,seriesName:a,ylabel:s,start:r,end:n}))}(t)}},xaxis:{tickPlacement:"between",tooltip:{enabled:!1},crosshairs:{stroke:{width:0}}}}}},{key:"dumbbell",value:function(t){var e,i;return null!==(e=t.plotOptions.bar)&&void 0!==e&&e.barHeight||(t.plotOptions.bar.barHeight=2),null!==(i=t.plotOptions.bar)&&void 0!==i&&i.columnWidth||(t.plotOptions.bar.columnWidth=2),t}},{key:"area",value:function(){return{stroke:{width:4,fill:{type:"solid",gradient:{inverseColors:!1,shade:"light",type:"vertical",opacityFrom:.65,opacityTo:.5,stops:[0,100,100]}}},fill:{type:"gradient",gradient:{inverseColors:!1,shade:"light",type:"vertical",opacityFrom:.65,opacityTo:.5,stops:[0,100,100]}},markers:{size:0,hover:{sizeOffset:6}},tooltip:{followCursor:!1}}}},{key:"rangeArea",value:function(){return{stroke:{curve:"straight",width:0},fill:{type:"solid",opacity:.6},markers:{size:0},states:{hover:{filter:{type:"none"}},active:{filter:{type:"none"}}},tooltip:{intersect:!1,shared:!0,followCursor:!0,custom:function(t){return function(t){var e=Di(t),i=e.color,a=e.seriesName,s=e.ylabel,r=e.start,n=e.end;return _i(u(u({},t),{},{color:i,seriesName:a,ylabel:s,start:r,end:n}))}(t)}}}}},{key:"brush",value:function(t){return v.extend(t,{chart:{toolbar:{autoSelected:"selection",show:!1},zoom:{enabled:!1}},dataLabels:{enabled:!1},stroke:{width:1},tooltip:{enabled:!1},xaxis:{tooltip:{enabled:!1}}})}},{key:"stacked100",value:function(t){t.dataLabels=t.dataLabels||{},t.dataLabels.formatter=t.dataLabels.formatter||void 0;var e=t.dataLabels.formatter;return t.yaxis.forEach((function(e,i){t.yaxis[i].min=0,t.yaxis[i].max=100})),"bar"===t.chart.type&&(t.dataLabels.formatter=e||function(t){return"number"==typeof t&&t?t.toFixed(0)+"%":t}),t}},{key:"stackedBars",value:function(){var t=this.bar();return u(u({},t),{},{plotOptions:u(u({},t.plotOptions),{},{bar:u(u({},t.plotOptions.bar),{},{borderRadiusApplication:"end",borderRadiusWhenStacked:"last"})})})}},{key:"convertCatToNumeric",value:function(t){return t.xaxis.convertedCatToNumeric=!0,t}},{key:"convertCatToNumericXaxis",value:function(t,e,i){t.xaxis.type="numeric",t.xaxis.labels=t.xaxis.labels||{},t.xaxis.labels.formatter=t.xaxis.labels.formatter||function(t){return v.isNumber(t)?Math.floor(t):t};var a=t.xaxis.labels.formatter,s=t.xaxis.categories&&t.xaxis.categories.length?t.xaxis.categories:t.labels;return i&&i.length&&(s=i.map((function(t){return Array.isArray(t)?t:String(t)}))),s&&s.length&&(t.xaxis.labels.formatter=function(t){return v.isNumber(t)?a(s[Math.floor(t)-1]):a(t)}),t.xaxis.categories=[],t.labels=[],t.xaxis.tickAmount=t.xaxis.tickAmount||"dataPoints",t}},{key:"bubble",value:function(){return{dataLabels:{style:{colors:["#fff"]}},tooltip:{shared:!1,intersect:!0},xaxis:{crosshairs:{width:0}},fill:{type:"solid",gradient:{shade:"light",inverse:!0,shadeIntensity:.55,opacityFrom:.4,opacityTo:.8}}}}},{key:"scatter",value:function(){return{dataLabels:{enabled:!1},tooltip:{shared:!1,intersect:!0},markers:{size:6,strokeWidth:1,hover:{sizeOffset:2}}}}},{key:"heatmap",value:function(){return{chart:{stacked:!1},fill:{opacity:1},dataLabels:{style:{colors:["#fff"]}},stroke:{colors:["#fff"]},tooltip:{followCursor:!0,marker:{show:!1},x:{show:!1}},legend:{position:"top",markers:{shape:"square"}},grid:{padding:{right:20}}}}},{key:"treemap",value:function(){return{chart:{zoom:{enabled:!1}},dataLabels:{style:{fontSize:14,fontWeight:600,colors:["#fff"]}},stroke:{show:!0,width:2,colors:["#fff"]},legend:{show:!1},fill:{opacity:1,gradient:{stops:[0,100]}},tooltip:{followCursor:!0,x:{show:!1}},grid:{padding:{left:0,right:0}},xaxis:{crosshairs:{show:!1},tooltip:{enabled:!1}}}}},{key:"pie",value:function(){return{chart:{toolbar:{show:!1}},plotOptions:{pie:{donut:{labels:{show:!1}}}},dataLabels:{formatter:function(t){return t.toFixed(1)+"%"},style:{colors:["#fff"]},background:{enabled:!1},dropShadow:{enabled:!0}},stroke:{colors:["#fff"]},fill:{opacity:1,gradient:{shade:"light",stops:[0,100]}},tooltip:{theme:"dark",fillSeriesColor:!0},legend:{position:"right"},grid:{padding:{left:0,right:0,top:0,bottom:0}}}}},{key:"donut",value:function(){return{chart:{toolbar:{show:!1}},dataLabels:{formatter:function(t){return t.toFixed(1)+"%"},style:{colors:["#fff"]},background:{enabled:!1},dropShadow:{enabled:!0}},stroke:{colors:["#fff"]},fill:{opacity:1,gradient:{shade:"light",shadeIntensity:.35,stops:[80,100],opacityFrom:1,opacityTo:1}},tooltip:{theme:"dark",fillSeriesColor:!0},legend:{position:"right"},grid:{padding:{left:0,right:0,top:0,bottom:0}}}}},{key:"polarArea",value:function(){return{chart:{toolbar:{show:!1}},dataLabels:{formatter:function(t){return t.toFixed(1)+"%"},enabled:!1},stroke:{show:!0,width:2},fill:{opacity:.7},tooltip:{theme:"dark",fillSeriesColor:!0},legend:{position:"right"},grid:{padding:{left:0,right:0,top:0,bottom:0}}}}},{key:"radar",value:function(){return this.opts.yaxis[0].labels.offsetY=this.opts.yaxis[0].labels.offsetY?this.opts.yaxis[0].labels.offsetY:6,{dataLabels:{enabled:!1,style:{fontSize:"11px"}},stroke:{width:2},markers:{size:5,strokeWidth:1,strokeOpacity:1},fill:{opacity:.2},tooltip:{shared:!1,intersect:!0,followCursor:!0},grid:{show:!1,padding:{left:0,right:0,top:0,bottom:0}},xaxis:{labels:{formatter:function(t){return t},style:{colors:["#a8a8a8"],fontSize:"11px"}},tooltip:{enabled:!1},crosshairs:{show:!1}}}}},{key:"radialBar",value:function(){return{chart:{animations:{dynamicAnimation:{enabled:!0,speed:800}},toolbar:{show:!1}},fill:{gradient:{shade:"dark",shadeIntensity:.4,inverseColors:!1,type:"diagonal2",opacityFrom:1,opacityTo:1,stops:[70,98,100]}},legend:{show:!1,position:"right"},tooltip:{enabled:!1,fillSeriesColor:!0},grid:{padding:{left:0,right:0,top:0,bottom:0}}}}},{key:"_getBoxTooltip",value:function(t,e,i,a,s){var r=t.globals.seriesCandleO[e][i],n=t.globals.seriesCandleH[e][i],o=t.globals.seriesCandleM[e][i],l=t.globals.seriesCandleL[e][i],h=t.globals.seriesCandleC[e][i];return t.config.series[e].type&&t.config.series[e].type!==s?'
\n '.concat(t.config.series[e].name?t.config.series[e].name:"series-"+(e+1),": ").concat(t.globals.series[e][i],"\n
"):'
')+"
".concat(a[0],': ')+r+"
"+"
".concat(a[1],': ')+n+"
"+(o?"
".concat(a[2],': ')+o+"
":"")+"
".concat(a[3],': ')+l+"
"+"
".concat(a[4],': ')+h+"
"}}]),t}(),Wi=function(){function t(e){i(this,t),this.opts=e}return s(t,[{key:"init",value:function(t){var e=t.responsiveOverride,i=this.opts,a=new Oi,s=new Ni(i);this.chartType=i.chart.type,i=this.extendYAxis(i),i=this.extendAnnotations(i);var r=a.init(),n={};if(i&&"object"===b(i)){var o,l,h,c,d,u,g,p,f,x,m={};m=-1!==["line","area","bar","candlestick","boxPlot","rangeBar","rangeArea","bubble","scatter","heatmap","treemap","pie","polarArea","donut","radar","radialBar"].indexOf(i.chart.type)?s[i.chart.type]():s.line(),null!==(o=i.plotOptions)&&void 0!==o&&null!==(l=o.bar)&&void 0!==l&&l.isFunnel&&(m=s.funnel()),i.chart.stacked&&"bar"===i.chart.type&&(m=s.stackedBars()),null!==(h=i.chart.brush)&&void 0!==h&&h.enabled&&(m=s.brush(m)),null!==(c=i.plotOptions)&&void 0!==c&&null!==(d=c.line)&&void 0!==d&&d.isSlopeChart&&(m=s.slope()),i.chart.stacked&&"100%"===i.chart.stackType&&(i=s.stacked100(i)),null!==(u=i.plotOptions)&&void 0!==u&&null!==(g=u.bar)&&void 0!==g&&g.isDumbbell&&(i=s.dumbbell(i)),this.checkForDarkTheme(window.Apex),this.checkForDarkTheme(i),i.xaxis=i.xaxis||window.Apex.xaxis||{},e||(i.xaxis.convertedCatToNumeric=!1),(null!==(p=(i=this.checkForCatToNumericXAxis(this.chartType,m,i)).chart.sparkline)&&void 0!==p&&p.enabled||null!==(f=window.Apex.chart)&&void 0!==f&&null!==(x=f.sparkline)&&void 0!==x&&x.enabled)&&(m=s.sparkline(m)),n=v.extend(r,m)}var y=v.extend(n,window.Apex);return r=v.extend(y,i),r=this.handleUserInputErrors(r)}},{key:"checkForCatToNumericXAxis",value:function(t,e,i){var a,s,r=new Ni(i),n=("bar"===t||"boxPlot"===t)&&(null===(a=i.plotOptions)||void 0===a||null===(s=a.bar)||void 0===s?void 0:s.horizontal),o="pie"===t||"polarArea"===t||"donut"===t||"radar"===t||"radialBar"===t||"heatmap"===t,l="datetime"!==i.xaxis.type&&"numeric"!==i.xaxis.type,h=i.xaxis.tickPlacement?i.xaxis.tickPlacement:e.xaxis&&e.xaxis.tickPlacement;return n||o||!l||"between"===h||(i=r.convertCatToNumeric(i)),i}},{key:"extendYAxis",value:function(t,e){var i=new Oi;(void 0===t.yaxis||!t.yaxis||Array.isArray(t.yaxis)&&0===t.yaxis.length)&&(t.yaxis={}),t.yaxis.constructor!==Array&&window.Apex.yaxis&&window.Apex.yaxis.constructor!==Array&&(t.yaxis=v.extend(t.yaxis,window.Apex.yaxis)),t.yaxis.constructor!==Array?t.yaxis=[v.extend(i.yAxis,t.yaxis)]:t.yaxis=v.extendArray(t.yaxis,i.yAxis);var a=!1;t.yaxis.forEach((function(t){t.logarithmic&&(a=!0)}));var s=t.series;return e&&!s&&(s=e.config.series),a&&s.length!==t.yaxis.length&&s.length&&(t.yaxis=s.map((function(e,a){if(e.name||(s[a].name="series-".concat(a+1)),t.yaxis[a])return t.yaxis[a].seriesName=s[a].name,t.yaxis[a];var r=v.extend(i.yAxis,t.yaxis[0]);return r.show=!1,r}))),a&&s.length>1&&s.length!==t.yaxis.length&&console.warn("A multi-series logarithmic chart should have equal number of series and y-axes"),t}},{key:"extendAnnotations",value:function(t){return void 0===t.annotations&&(t.annotations={},t.annotations.yaxis=[],t.annotations.xaxis=[],t.annotations.points=[]),t=this.extendYAxisAnnotations(t),t=this.extendXAxisAnnotations(t),t=this.extendPointAnnotations(t)}},{key:"extendYAxisAnnotations",value:function(t){var e=new Oi;return t.annotations.yaxis=v.extendArray(void 0!==t.annotations.yaxis?t.annotations.yaxis:[],e.yAxisAnnotation),t}},{key:"extendXAxisAnnotations",value:function(t){var e=new Oi;return t.annotations.xaxis=v.extendArray(void 0!==t.annotations.xaxis?t.annotations.xaxis:[],e.xAxisAnnotation),t}},{key:"extendPointAnnotations",value:function(t){var e=new Oi;return t.annotations.points=v.extendArray(void 0!==t.annotations.points?t.annotations.points:[],e.pointAnnotation),t}},{key:"checkForDarkTheme",value:function(t){t.theme&&"dark"===t.theme.mode&&(t.tooltip||(t.tooltip={}),"light"!==t.tooltip.theme&&(t.tooltip.theme="dark"),t.chart.foreColor||(t.chart.foreColor="#f6f7f8"),t.theme.palette||(t.theme.palette="palette4"))}},{key:"handleUserInputErrors",value:function(t){var e=t;if(e.tooltip.shared&&e.tooltip.intersect)throw new Error("tooltip.shared cannot be enabled when tooltip.intersect is true. Turn off any other option by setting it to false.");if("bar"===e.chart.type&&e.plotOptions.bar.horizontal){if(e.yaxis.length>1)throw new Error("Multiple Y Axis for bars are not supported. Switch to column chart by setting plotOptions.bar.horizontal=false");e.yaxis[0].reversed&&(e.yaxis[0].opposite=!0),e.xaxis.tooltip.enabled=!1,e.yaxis[0].tooltip.enabled=!1,e.chart.zoom.enabled=!1}return"bar"!==e.chart.type&&"rangeBar"!==e.chart.type||e.tooltip.shared&&"barWidth"===e.xaxis.crosshairs.width&&e.series.length>1&&(e.xaxis.crosshairs.width="tickWidth"),"candlestick"!==e.chart.type&&"boxPlot"!==e.chart.type||e.yaxis[0].reversed&&(console.warn("Reversed y-axis in ".concat(e.chart.type," chart is not supported.")),e.yaxis[0].reversed=!1),e}}]),t}(),Bi=function(){function t(){i(this,t)}return s(t,[{key:"initGlobalVars",value:function(t){t.series=[],t.seriesCandleO=[],t.seriesCandleH=[],t.seriesCandleM=[],t.seriesCandleL=[],t.seriesCandleC=[],t.seriesRangeStart=[],t.seriesRangeEnd=[],t.seriesRange=[],t.seriesPercent=[],t.seriesGoals=[],t.seriesX=[],t.seriesZ=[],t.seriesNames=[],t.seriesTotals=[],t.seriesLog=[],t.seriesColors=[],t.stackedSeriesTotals=[],t.seriesXvalues=[],t.seriesYvalues=[],t.labels=[],t.hasXaxisGroups=!1,t.groups=[],t.barGroups=[],t.lineGroups=[],t.areaGroups=[],t.hasSeriesGroups=!1,t.seriesGroups=[],t.categoryLabels=[],t.timescaleLabels=[],t.noLabelsProvided=!1,t.resizeTimer=null,t.selectionResizeTimer=null,t.lastWheelExecution=0,t.delayedElements=[],t.pointsArray=[],t.dataLabelsRects=[],t.isXNumeric=!1,t.skipLastTimelinelabel=!1,t.skipFirstTimelinelabel=!1,t.isDataXYZ=!1,t.isMultiLineX=!1,t.isMultipleYAxis=!1,t.maxY=-Number.MAX_VALUE,t.minY=Number.MIN_VALUE,t.minYArr=[],t.maxYArr=[],t.maxX=-Number.MAX_VALUE,t.minX=Number.MAX_VALUE,t.initialMaxX=-Number.MAX_VALUE,t.initialMinX=Number.MAX_VALUE,t.maxDate=0,t.minDate=Number.MAX_VALUE,t.minZ=Number.MAX_VALUE,t.maxZ=-Number.MAX_VALUE,t.minXDiff=Number.MAX_VALUE,t.yAxisScale=[],t.xAxisScale=null,t.xAxisTicksPositions=[],t.yLabelsCoords=[],t.yTitleCoords=[],t.barPadForNumericAxis=0,t.padHorizontal=0,t.xRange=0,t.yRange=[],t.zRange=0,t.dataPoints=0,t.xTickAmount=0,t.multiAxisTickAmount=0}},{key:"globalVars",value:function(t){return{chartID:null,cuid:null,events:{beforeMount:[],mounted:[],updated:[],clicked:[],selection:[],dataPointSelection:[],zoomed:[],scrolled:[]},colors:[],clientX:null,clientY:null,fill:{colors:[]},stroke:{colors:[]},dataLabels:{style:{colors:[]}},radarPolygons:{fill:{colors:[]}},markers:{colors:[],size:t.markers.size,largestSize:0},animationEnded:!1,isTouchDevice:"ontouchstart"in window||navigator.msMaxTouchPoints,isDirty:!1,isExecCalled:!1,initialConfig:null,initialSeries:[],lastXAxis:[],lastYAxis:[],columnSeries:null,labels:[],timescaleLabels:[],noLabelsProvided:!1,allSeriesCollapsed:!1,collapsedSeries:[],collapsedSeriesIndices:[],ancillaryCollapsedSeries:[],ancillaryCollapsedSeriesIndices:[],risingSeries:[],dataFormatXNumeric:!1,capturedSeriesIndex:-1,capturedDataPointIndex:-1,selectedDataPoints:[],invalidLogScale:!1,ignoreYAxisIndexes:[],maxValsInArrayIndex:0,radialSize:0,selection:void 0,zoomEnabled:"zoom"===t.chart.toolbar.autoSelected&&t.chart.toolbar.tools.zoom&&t.chart.zoom.enabled,panEnabled:"pan"===t.chart.toolbar.autoSelected&&t.chart.toolbar.tools.pan,selectionEnabled:"selection"===t.chart.toolbar.autoSelected&&t.chart.toolbar.tools.selection,yaxis:null,mousedown:!1,lastClientPosition:{},visibleXRange:void 0,yValueDecimal:0,total:0,SVGNS:"http://www.w3.org/2000/svg",svgWidth:0,svgHeight:0,noData:!1,locale:{},dom:{},memory:{methodsToExec:[]},shouldAnimate:!0,skipLastTimelinelabel:!1,skipFirstTimelinelabel:!1,delayedElements:[],axisCharts:!0,isDataXYZ:!1,isSlopeChart:t.plotOptions.line.isSlopeChart,resized:!1,resizeTimer:null,comboCharts:!1,dataChanged:!1,previousPaths:[],allSeriesHasEqualX:!0,pointsArray:[],dataLabelsRects:[],lastDrawnDataLabelsIndexes:[],hasNullValues:!1,zoomed:!1,gridWidth:0,gridHeight:0,rotateXLabels:!1,defaultLabels:!1,xLabelFormatter:void 0,yLabelFormatters:[],xaxisTooltipFormatter:void 0,ttKeyFormatter:void 0,ttVal:void 0,ttZFormatter:void 0,LINE_HEIGHT_RATIO:1.618,xAxisLabelsHeight:0,xAxisGroupLabelsHeight:0,xAxisLabelsWidth:0,yAxisLabelsWidth:0,scaleX:1,scaleY:1,translateX:0,translateY:0,translateYAxisX:[],yAxisWidths:[],translateXAxisY:0,translateXAxisX:0,tooltip:null,niceScaleAllowedMagMsd:[[1,1,2,5,5,5,10,10,10,10,10],[1,1,2,5,5,5,10,10,10,10,10]],niceScaleDefaultTicks:[1,2,4,4,6,6,6,6,6,6,6,6,6,6,6,6,6,6,12,12,12,12,12,12,12,12,12,24],seriesYAxisMap:[],seriesYAxisReverseMap:[]}}},{key:"init",value:function(t){var e=this.globalVars(t);return this.initGlobalVars(e),e.initialConfig=v.extend({},t),e.initialSeries=v.clone(t.series),e.lastXAxis=v.clone(e.initialConfig.xaxis),e.lastYAxis=v.clone(e.initialConfig.yaxis),e}}]),t}(),Gi=function(){function t(e){i(this,t),this.opts=e}return s(t,[{key:"init",value:function(){var t=new Wi(this.opts).init({responsiveOverride:!1});return{config:t,globals:(new Bi).init(t)}}}]),t}(),ji=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.opts=null,this.seriesIndex=0,this.patternIDs=[]}return s(t,[{key:"clippedImgArea",value:function(t){var e=this.w,i=e.config,a=parseInt(e.globals.gridWidth,10),s=parseInt(e.globals.gridHeight,10),r=a>s?a:s,n=t.image,o=0,l=0;void 0===t.width&&void 0===t.height?void 0!==i.fill.image.width&&void 0!==i.fill.image.height?(o=i.fill.image.width+1,l=i.fill.image.height):(o=r+1,l=r):(o=t.width,l=t.height);var h=document.createElementNS(e.globals.SVGNS,"pattern");Mi.setAttrs(h,{id:t.patternID,patternUnits:t.patternUnits?t.patternUnits:"userSpaceOnUse",width:o+"px",height:l+"px"});var c=document.createElementNS(e.globals.SVGNS,"image");h.appendChild(c),c.setAttributeNS(window.SVG.xlink,"href",n),Mi.setAttrs(c,{x:0,y:0,preserveAspectRatio:"none",width:o+"px",height:l+"px"}),c.style.opacity=t.opacity,e.globals.dom.elDefs.node.appendChild(h)}},{key:"getSeriesIndex",value:function(t){var e=this.w,i=e.config.chart.type;return("bar"===i||"rangeBar"===i)&&e.config.plotOptions.bar.distributed||"heatmap"===i||"treemap"===i?this.seriesIndex=t.seriesNumber:this.seriesIndex=t.seriesNumber%e.globals.series.length,this.seriesIndex}},{key:"computeColorStops",value:function(t,e){var i,a=this.w,s=null,n=null,o=r(t);try{for(o.s();!(i=o.n()).done;){var l=i.value;l>=e.threshold?(null===s||l>s)&&(s=l):(null===n||l-1?x=v.getOpacityFromRGBA(c):m=v.hexToRgba(v.rgb2hex(c),x),t.opacity&&(x=t.opacity),"pattern"===p&&(n=this.handlePatternFill({fillConfig:t.fillConfig,patternFill:n,fillColor:c,fillOpacity:x,defaultColor:m})),b){var y=f(l.fill.gradient.colorStops)||[],w=l.fill.gradient.type;h&&(y[this.seriesIndex]=this.computeColorStops(s.globals.series[this.seriesIndex],l.plotOptions.line.colors),w="vertical"),o=this.handleGradientFill({type:w,fillConfig:t.fillConfig,fillColor:c,fillOpacity:x,colorStops:y,i:this.seriesIndex})}if("image"===p){var k=l.fill.image.src,A=t.patternID?t.patternID:"",C="pattern".concat(s.globals.cuid).concat(t.seriesNumber+1).concat(A);-1===this.patternIDs.indexOf(C)&&(this.clippedImgArea({opacity:x,image:Array.isArray(k)?t.seriesNumber-1&&(p=v.getOpacityFromRGBA(g));var f=void 0===o.gradient.opacityTo?a:Array.isArray(o.gradient.opacityTo)?o.gradient.opacityTo[n]:o.gradient.opacityTo;if(void 0===o.gradient.gradientToColors||0===o.gradient.gradientToColors.length)d="dark"===o.gradient.shade?c.shadeColor(-1*parseFloat(o.gradient.shadeIntensity),i.indexOf("rgb")>-1?v.rgb2hex(i):i):c.shadeColor(parseFloat(o.gradient.shadeIntensity),i.indexOf("rgb")>-1?v.rgb2hex(i):i);else if(o.gradient.gradientToColors[l.seriesNumber]){var x=o.gradient.gradientToColors[l.seriesNumber];d=x,x.indexOf("rgba")>-1&&(f=v.getOpacityFromRGBA(x))}else d=i;if(o.gradient.gradientFrom&&(g=o.gradient.gradientFrom),o.gradient.gradientTo&&(d=o.gradient.gradientTo),o.gradient.inverseColors){var b=g;g=d,d=b}return g.indexOf("rgb")>-1&&(g=v.rgb2hex(g)),d.indexOf("rgb")>-1&&(d=v.rgb2hex(d)),h.drawGradient(e,g,d,p,f,l.size,o.gradient.stops,r,n)}}]),t}(),Vi=function(){function t(e,a){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"setGlobalMarkerSize",value:function(){var t=this.w;if(t.globals.markers.size=Array.isArray(t.config.markers.size)?t.config.markers.size:[t.config.markers.size],t.globals.markers.size.length>0){if(t.globals.markers.size.length0:h.config.markers.size>0)||n||p){m||(y+=" w".concat(v.randomId()));var w=this.getMarkerConfig({cssClass:y,seriesIndex:i,dataPointIndex:b});if(h.config.series[c].data[b]&&(h.config.series[c].data[b].fillColor&&(w.pointFillColor=h.config.series[c].data[b].fillColor),h.config.series[c].data[b].strokeColor&&(w.pointStrokeColor=h.config.series[c].data[b].strokeColor)),void 0!==s&&(w.pSize=s),(d.x[f]<-h.globals.markers.largestSize||d.x[f]>h.globals.gridWidth+h.globals.markers.largestSize||d.y[f]<-h.globals.markers.largestSize||d.y[f]>h.globals.gridHeight+h.globals.markers.largestSize)&&(w.pSize=0),!m)(h.globals.markers.size[i]>0||n||p)&&!u&&(u=g.group({class:n||p?"":"apexcharts-series-markers"})).attr("clip-path","url(#gridRectMarkerMask".concat(h.globals.cuid,")")),(x=g.drawMarker(d.x[f],d.y[f],w)).attr("rel",b),x.attr("j",b),x.attr("index",i),x.node.setAttribute("default-marker-size",w.pSize),new Li(this.ctx).setSelectionFilter(x,i,b),this.addEvents(x),u&&u.add(x)}else void 0===h.globals.pointsArray[i]&&(h.globals.pointsArray[i]=[]),h.globals.pointsArray[i].push([d.x[f],d.y[f]])}return u}},{key:"getMarkerConfig",value:function(t){var e=t.cssClass,i=t.seriesIndex,a=t.dataPointIndex,s=void 0===a?null:a,r=t.radius,n=void 0===r?null:r,o=t.size,l=void 0===o?null:o,h=t.strokeWidth,c=void 0===h?null:h,d=this.w,u=this.getMarkerStyle(i),g=null===l?d.globals.markers.size[i]:l,p=d.config.markers;return null!==s&&p.discrete.length&&p.discrete.map((function(t){t.seriesIndex===i&&t.dataPointIndex===s&&(u.pointStrokeColor=t.strokeColor,u.pointFillColor=t.fillColor,g=t.size,u.pointShape=t.shape)})),{pSize:null===n?g:n,pRadius:null!==n?n:p.radius,pointStrokeWidth:null!==c?c:Array.isArray(p.strokeWidth)?p.strokeWidth[i]:p.strokeWidth,pointStrokeColor:u.pointStrokeColor,pointFillColor:u.pointFillColor,shape:u.pointShape||(Array.isArray(p.shape)?p.shape[i]:p.shape),class:e,pointStrokeOpacity:Array.isArray(p.strokeOpacity)?p.strokeOpacity[i]:p.strokeOpacity,pointStrokeDashArray:Array.isArray(p.strokeDashArray)?p.strokeDashArray[i]:p.strokeDashArray,pointFillOpacity:Array.isArray(p.fillOpacity)?p.fillOpacity[i]:p.fillOpacity,seriesIndex:i}}},{key:"addEvents",value:function(t){var e=this.w,i=new Mi(this.ctx);t.node.addEventListener("mouseenter",i.pathMouseEnter.bind(this.ctx,t)),t.node.addEventListener("mouseleave",i.pathMouseLeave.bind(this.ctx,t)),t.node.addEventListener("mousedown",i.pathMouseDown.bind(this.ctx,t)),t.node.addEventListener("click",e.config.markers.onClick),t.node.addEventListener("dblclick",e.config.markers.onDblClick),t.node.addEventListener("touchstart",i.pathMouseDown.bind(this.ctx,t),{passive:!0})}},{key:"getMarkerStyle",value:function(t){var e=this.w,i=e.globals.markers.colors,a=e.config.markers.strokeColor||e.config.markers.strokeColors;return{pointStrokeColor:Array.isArray(a)?a[t]:a,pointFillColor:Array.isArray(i)?i[t]:i}}}]),t}(),Ui=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.initialAnim=this.w.config.chart.animations.enabled}return s(t,[{key:"draw",value:function(t,e,i){var a=this.w,s=new Mi(this.ctx),r=i.realIndex,n=i.pointsPos,o=i.zRatio,l=i.elParent,h=s.group({class:"apexcharts-series-markers apexcharts-series-".concat(a.config.chart.type)});if(h.attr("clip-path","url(#gridRectMarkerMask".concat(a.globals.cuid,")")),Array.isArray(n.x))for(var c=0;cp.maxBubbleRadius&&(g=p.maxBubbleRadius)}var f=n.x[c],x=n.y[c];if(g=g||0,null!==x&&void 0!==a.globals.series[r][d]||(u=!1),u){var b=this.drawPoint(f,x,g,r,d,e);h.add(b)}l.add(h)}}},{key:"drawPoint",value:function(t,e,i,a,s,r){var n=this.w,o=a,l=new y(this.ctx),h=new Li(this.ctx),c=new ji(this.ctx),d=new Vi(this.ctx),u=new Mi(this.ctx),g=d.getMarkerConfig({cssClass:"apexcharts-marker",seriesIndex:o,dataPointIndex:s,radius:"bubble"===n.config.chart.type||n.globals.comboCharts&&n.config.series[a]&&"bubble"===n.config.series[a].type?i:null}),p=c.fillPath({seriesNumber:a,dataPointIndex:s,color:g.pointFillColor,patternUnits:"objectBoundingBox",value:n.globals.series[a][r]}),f=u.drawMarker(t,e,g);if(n.config.series[o].data[s]&&n.config.series[o].data[s].fillColor&&(p=n.config.series[o].data[s].fillColor),f.attr({fill:p}),n.config.chart.dropShadow.enabled){var x=n.config.chart.dropShadow;h.dropShadow(f,x,a)}if(!this.initialAnim||n.globals.dataChanged||n.globals.resized)n.globals.animationEnded=!0;else{var b=n.config.chart.animations.speed;l.animateMarker(f,b,n.globals.easing,(function(){window.setTimeout((function(){l.animationCompleted(f)}),100)}))}return f.attr({rel:s,j:s,index:a,"default-marker-size":g.pSize}),h.setSelectionFilter(f,a,s),d.addEvents(f),f.node.classList.add("apexcharts-marker"),f}},{key:"centerTextInBubble",value:function(t){var e=this.w;return{y:t+=parseInt(e.config.dataLabels.style.fontSize,10)/4}}}]),t}(),qi=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"dataLabelsCorrection",value:function(t,e,i,a,s,r,n){var o=this.w,l=!1,h=new Mi(this.ctx).getTextRects(i,n),c=h.width,d=h.height;e<0&&(e=0),e>o.globals.gridHeight+d&&(e=o.globals.gridHeight+d/2),void 0===o.globals.dataLabelsRects[a]&&(o.globals.dataLabelsRects[a]=[]),o.globals.dataLabelsRects[a].push({x:t,y:e,width:c,height:d});var u=o.globals.dataLabelsRects[a].length-2,g=void 0!==o.globals.lastDrawnDataLabelsIndexes[a]?o.globals.lastDrawnDataLabelsIndexes[a][o.globals.lastDrawnDataLabelsIndexes[a].length-1]:0;if(void 0!==o.globals.dataLabelsRects[a][u]){var p=o.globals.dataLabelsRects[a][g];(t>p.x+p.width||e>p.y+p.height||e+de.globals.gridWidth+b.textRects.width+30)&&(o="");var m=e.globals.dataLabels.style.colors[r];(("bar"===e.config.chart.type||"rangeBar"===e.config.chart.type)&&e.config.plotOptions.bar.distributed||e.config.dataLabels.distributed)&&(m=e.globals.dataLabels.style.colors[n]),"function"==typeof m&&(m=m({series:e.globals.series,seriesIndex:r,dataPointIndex:n,w:e})),u&&(m=u);var v=d.offsetX,y=d.offsetY;if("bar"!==e.config.chart.type&&"rangeBar"!==e.config.chart.type||(v=0,y=0),e.globals.isSlopeChart&&(0!==n&&(v=-2*d.offsetX+5),0!==n&&n!==e.config.series[r].data.length-1&&(v=0)),b.drawnextLabel){if((x=i.drawText({width:100,height:parseInt(d.style.fontSize,10),x:a+v,y:s+y,foreColor:m,textAnchor:l||d.textAnchor,text:o,fontSize:h||d.style.fontSize,fontFamily:d.style.fontFamily,fontWeight:d.style.fontWeight||"normal"})).attr({class:f||"apexcharts-datalabel",cx:a,cy:s}),d.dropShadow.enabled){var w=d.dropShadow;new Li(this.ctx).dropShadow(x,w)}c.add(x),void 0===e.globals.lastDrawnDataLabelsIndexes[r]&&(e.globals.lastDrawnDataLabelsIndexes[r]=[]),e.globals.lastDrawnDataLabelsIndexes[r].push(n)}return x}},{key:"addBackgroundToDataLabel",value:function(t,e){var i=this.w,a=i.config.dataLabels.background,s=a.padding,r=a.padding/2,n=e.width,o=e.height,l=new Mi(this.ctx).drawRect(e.x-s,e.y-r/2,n+2*s,o+r,a.borderRadius,"transparent"!==i.config.chart.background&&i.config.chart.background?i.config.chart.background:"#fff",a.opacity,a.borderWidth,a.borderColor);a.dropShadow.enabled&&new Li(this.ctx).dropShadow(l,a.dropShadow);return l}},{key:"dataLabelsBackground",value:function(){var t=this.w;if("bubble"!==t.config.chart.type)for(var e=t.globals.dom.baseEl.querySelectorAll(".apexcharts-datalabels text"),i=0;i0&&void 0!==arguments[0])||arguments[0],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=this.w,s=v.clone(a.globals.initialSeries);a.globals.previousPaths=[],i?(a.globals.collapsedSeries=[],a.globals.ancillaryCollapsedSeries=[],a.globals.collapsedSeriesIndices=[],a.globals.ancillaryCollapsedSeriesIndices=[]):s=this.emptyCollapsedSeries(s),a.config.series=s,t&&(e&&(a.globals.zoomed=!1,this.ctx.updateHelpers.revertDefaultAxisMinMax()),this.ctx.updateHelpers._updateSeries(s,a.config.chart.animations.dynamicAnimation.enabled))}},{key:"emptyCollapsedSeries",value:function(t){for(var e=this.w,i=0;i-1&&(t[i].data=[]);return t}},{key:"highlightSeries",value:function(t){var e=this.w,i=this.getSeriesByName(t),a=parseInt(null==i?void 0:i.getAttribute("data:realIndex"),10),s=e.globals.dom.baseEl.querySelectorAll(".apexcharts-series, .apexcharts-datalabels, .apexcharts-yaxis"),r=null,n=null,o=null;if(e.globals.axisCharts||"radialBar"===e.config.chart.type)if(e.globals.axisCharts){r=e.globals.dom.baseEl.querySelector(".apexcharts-series[data\\:realIndex='".concat(a,"']")),n=e.globals.dom.baseEl.querySelector(".apexcharts-datalabels[data\\:realIndex='".concat(a,"']"));var l=e.globals.seriesYAxisReverseMap[a];o=e.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(l,"']"))}else r=e.globals.dom.baseEl.querySelector(".apexcharts-series[rel='".concat(a+1,"']"));else r=e.globals.dom.baseEl.querySelector(".apexcharts-series[rel='".concat(a+1,"'] path"));for(var h=0;h=t.from&&(r0&&void 0!==arguments[0]?arguments[0]:"asc",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=this.w,a=0;if(i.config.series.length>1)for(var s=i.config.series.map((function(t,a){return t.data&&t.data.length>0&&-1===i.globals.collapsedSeriesIndices.indexOf(a)&&(!i.globals.comboCharts||0===e.length||e.length&&e.indexOf(i.config.series[a].type)>-1)?a:-1})),r="asc"===t?0:s.length-1;"asc"===t?r=0;"asc"===t?r++:r--)if(-1!==s[r]){a=s[r];break}return a}},{key:"getBarSeriesIndices",value:function(){return this.w.globals.comboCharts?this.w.config.series.map((function(t,e){return"bar"===t.type||"column"===t.type?e:-1})).filter((function(t){return-1!==t})):this.w.config.series.map((function(t,e){return e}))}},{key:"getPreviousPaths",value:function(){var t=this.w;function e(e,i,a){for(var s=e[i].childNodes,r={type:a,paths:[],realIndex:e[i].getAttribute("data:realIndex")},n=0;n0)for(var a=function(e){for(var i=t.globals.dom.baseEl.querySelectorAll(".apexcharts-".concat(t.config.chart.type," .apexcharts-series[data\\:realIndex='").concat(e,"'] rect")),a=[],s=function(t){var e=function(e){return i[t].getAttribute(e)},s={x:parseFloat(e("x")),y:parseFloat(e("y")),width:parseFloat(e("width")),height:parseFloat(e("height"))};a.push({rect:s,color:i[t].getAttribute("color")})},r=0;r0?t:[]}));return t}}]),t}(),$i=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.twoDSeries=[],this.threeDSeries=[],this.twoDSeriesX=[],this.seriesGoals=[],this.coreUtils=new Pi(this.ctx)}return s(t,[{key:"isMultiFormat",value:function(){return this.isFormatXY()||this.isFormat2DArray()}},{key:"isFormatXY",value:function(){var t=this.w.config.series.slice(),e=new Zi(this.ctx);if(this.activeSeriesIndex=e.getActiveConfigSeriesIndex(),void 0!==t[this.activeSeriesIndex].data&&t[this.activeSeriesIndex].data.length>0&&null!==t[this.activeSeriesIndex].data[0]&&void 0!==t[this.activeSeriesIndex].data[0].x&&null!==t[this.activeSeriesIndex].data[0])return!0}},{key:"isFormat2DArray",value:function(){var t=this.w.config.series.slice(),e=new Zi(this.ctx);if(this.activeSeriesIndex=e.getActiveConfigSeriesIndex(),void 0!==t[this.activeSeriesIndex].data&&t[this.activeSeriesIndex].data.length>0&&void 0!==t[this.activeSeriesIndex].data[0]&&null!==t[this.activeSeriesIndex].data[0]&&t[this.activeSeriesIndex].data[0].constructor===Array)return!0}},{key:"handleFormat2DArray",value:function(t,e){for(var i=this.w.config,a=this.w.globals,s="boxPlot"===i.chart.type||"boxPlot"===i.series[e].type,r=0;r=5?this.twoDSeries.push(v.parseNumber(t[e].data[r][4])):this.twoDSeries.push(v.parseNumber(t[e].data[r][1])),a.dataFormatXNumeric=!0),"datetime"===i.xaxis.type){var n=new Date(t[e].data[r][0]);n=new Date(n).getTime(),this.twoDSeriesX.push(n)}else this.twoDSeriesX.push(t[e].data[r][0]);for(var o=0;o-1&&(r=this.activeSeriesIndex);for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:this.ctx,a=this.w.config,s=this.w.globals,r=new zi(i),n=a.labels.length>0?a.labels.slice():a.xaxis.categories.slice();s.isRangeBar="rangeBar"===a.chart.type&&s.isBarHorizontal,s.hasXaxisGroups="category"===a.xaxis.type&&a.xaxis.group.groups.length>0,s.hasXaxisGroups&&(s.groups=a.xaxis.group.groups),t.forEach((function(t,e){void 0!==t.name?s.seriesNames.push(t.name):s.seriesNames.push("series-"+parseInt(e+1,10))})),this.coreUtils.setSeriesYAxisMappings();var o=[],l=f(new Set(a.series.map((function(t){return t.group}))));a.series.forEach((function(t,e){var i=l.indexOf(t.group);o[i]||(o[i]=[]),o[i].push(s.seriesNames[e])})),s.seriesGroups=o;for(var h=function(){for(var t=0;t0&&(this.twoDSeriesX=n,s.seriesX.push(this.twoDSeriesX))),s.labels.push(this.twoDSeriesX);var d=t[c].data.map((function(t){return v.parseNumber(t)}));s.series.push(d)}s.seriesZ.push(this.threeDSeries),void 0!==t[c].color?s.seriesColors.push(t[c].color):s.seriesColors.push(void 0)}return this.w}},{key:"parseDataNonAxisCharts",value:function(t){var e=this.w.globals,i=this.w.config;e.series=t.slice(),e.seriesNames=i.labels.slice();for(var a=0;a0)i.labels=e.xaxis.categories;else if(e.labels.length>0)i.labels=e.labels.slice();else if(this.fallbackToCategory){if(i.labels=i.labels[0],i.seriesRange.length&&(i.seriesRange.map((function(t){t.forEach((function(t){i.labels.indexOf(t.x)<0&&t.x&&i.labels.push(t.x)}))})),i.labels=Array.from(new Set(i.labels.map(JSON.stringify)),JSON.parse)),e.xaxis.convertedCatToNumeric)new Ni(e).convertCatToNumericXaxis(e,this.ctx,i.seriesX[0]),this._generateExternalLabels(t)}else this._generateExternalLabels(t)}},{key:"_generateExternalLabels",value:function(t){var e=this.w.globals,i=this.w.config,a=[];if(e.axisCharts){if(e.series.length>0)if(this.isFormatXY())for(var s=i.series.map((function(t,e){return t.data.filter((function(t,e,i){return i.findIndex((function(e){return e.x===t.x}))===e}))})),r=s.reduce((function(t,e,i,a){return a[t].length>e.length?t:i}),0),n=0;n0&&s==i.length&&e.push(a)})),t.globals.ignoreYAxisIndexes=e.map((function(t){return t}))}}]),t}(),Ji=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"svgStringToNode",value:function(t){return(new DOMParser).parseFromString(t,"image/svg+xml").documentElement}},{key:"scaleSvgNode",value:function(t,e){var i=parseFloat(t.getAttributeNS(null,"width")),a=parseFloat(t.getAttributeNS(null,"height"));t.setAttributeNS(null,"width",i*e),t.setAttributeNS(null,"height",a*e),t.setAttributeNS(null,"viewBox","0 0 "+i+" "+a)}},{key:"getSvgString",value:function(t){var e=this;return new Promise((function(i){var a=e.w,s=t||a.config.chart.toolbar.export.scale||a.config.chart.toolbar.export.width/a.globals.svgWidth;s||(s=1);var r=a.globals.svgWidth*s,n=a.globals.svgHeight*s,o=a.globals.dom.elWrap.cloneNode(!0);o.style.width=r+"px",o.style.height=n+"px";var l=(new XMLSerializer).serializeToString(o),h='\n \n \n
\n \n ').concat(l,"\n
\n
\n
\n "),c=e.svgStringToNode(h);1!==s&&e.scaleSvgNode(c,s),e.convertImagesToBase64(c).then((function(){h=(new XMLSerializer).serializeToString(c),i(h.replace(/ /g," "))}))}))}},{key:"convertImagesToBase64",value:function(t){var e=this,i=t.getElementsByTagName("image"),a=Array.from(i).map((function(t){var i=t.getAttributeNS("http://www.w3.org/1999/xlink","href");return i&&!i.startsWith("data:")?e.getBase64FromUrl(i).then((function(e){t.setAttributeNS("http://www.w3.org/1999/xlink","href",e)})).catch((function(t){console.error("Error converting image to base64:",t)})):Promise.resolve()}));return Promise.all(a)}},{key:"getBase64FromUrl",value:function(t){return new Promise((function(e,i){var a=new Image;a.crossOrigin="Anonymous",a.onload=function(){var t=document.createElement("canvas");t.width=a.width,t.height=a.height,t.getContext("2d").drawImage(a,0,0),e(t.toDataURL())},a.onerror=i,a.src=t}))}},{key:"svgUrl",value:function(){var t=this;return new Promise((function(e){t.getSvgString().then((function(t){var i=new Blob([t],{type:"image/svg+xml;charset=utf-8"});e(URL.createObjectURL(i))}))}))}},{key:"dataURI",value:function(t){var e=this;return new Promise((function(i){var a=e.w,s=t?t.scale||t.width/a.globals.svgWidth:1,r=document.createElement("canvas");r.width=a.globals.svgWidth*s,r.height=parseInt(a.globals.dom.elWrap.style.height,10)*s;var n="transparent"!==a.config.chart.background&&a.config.chart.background?a.config.chart.background:"#fff",o=r.getContext("2d");o.fillStyle=n,o.fillRect(0,0,r.width*s,r.height*s),e.getSvgString(s).then((function(t){var e="data:image/svg+xml,"+encodeURIComponent(t),a=new Image;a.crossOrigin="anonymous",a.onload=function(){if(o.drawImage(a,0,0),r.msToBlob){var t=r.msToBlob();i({blob:t})}else{var e=r.toDataURL("image/png");i({imgURI:e})}},a.src=e}))}))}},{key:"exportToSVG",value:function(){var t=this;this.svgUrl().then((function(e){t.triggerDownload(e,t.w.config.chart.toolbar.export.svg.filename,".svg")}))}},{key:"exportToPng",value:function(){var t=this,e=this.w.config.chart.toolbar.export.scale,i=this.w.config.chart.toolbar.export.width,a=e?{scale:e}:i?{width:i}:void 0;this.dataURI(a).then((function(e){var i=e.imgURI,a=e.blob;a?navigator.msSaveOrOpenBlob(a,t.w.globals.chartID+".png"):t.triggerDownload(i,t.w.config.chart.toolbar.export.png.filename,".png")}))}},{key:"exportToCSV",value:function(t){var e=this,i=t.series,a=t.fileName,s=t.columnDelimiter,r=void 0===s?",":s,n=t.lineDelimiter,o=void 0===n?"\n":n,l=this.w;i||(i=l.config.series);var h=[],c=[],d="",u=l.globals.series.map((function(t,e){return-1===l.globals.collapsedSeriesIndices.indexOf(e)?t:[]})),g=function(t){return"function"==typeof l.config.chart.toolbar.export.csv.categoryFormatter?l.config.chart.toolbar.export.csv.categoryFormatter(t):"datetime"===l.config.xaxis.type&&String(t).length>=10?new Date(t).toDateString():v.isNumber(t)?t:t.split(r).join("")},p=function(t){return"function"==typeof l.config.chart.toolbar.export.csv.valueFormatter?l.config.chart.toolbar.export.csv.valueFormatter(t):t},x=Math.max.apply(Math,f(i.map((function(t){return t.data?t.data.length:0})))),b=new $i(this.ctx),m=new Ri(this.ctx),y=function(t){var i="";if(l.globals.axisCharts){if("category"===l.config.xaxis.type||l.config.xaxis.convertedCatToNumeric)if(l.globals.isBarHorizontal){var a=l.globals.yLabelFormatters[0],s=new Zi(e.ctx).getActiveConfigSeriesIndex();i=a(l.globals.labels[t],{seriesIndex:s,dataPointIndex:t,w:l})}else i=m.getLabel(l.globals.labels,l.globals.timescaleLabels,0,t).text;"datetime"===l.config.xaxis.type&&(l.config.xaxis.categories.length?i=l.config.xaxis.categories[t]:l.config.labels.length&&(i=l.config.labels[t]))}else i=l.config.labels[t];return null===i?"nullvalue":(Array.isArray(i)&&(i=i.join(" ")),v.isNumber(i)?i:i.split(r).join(""))},w=function(t,e){if(h.length&&0===e&&c.push(h.join(r)),t.data){t.data=t.data.length&&t.data||f(Array(x)).map((function(){return""}));for(var a=0;a0&&!s.globals.isBarHorizontal&&(this.xaxisLabels=s.globals.timescaleLabels.slice()),s.config.xaxis.overwriteCategories&&(this.xaxisLabels=s.config.xaxis.overwriteCategories),this.drawnLabels=[],this.drawnLabelsRects=[],"top"===s.config.xaxis.position?this.offY=0:this.offY=s.globals.gridHeight,this.offY=this.offY+s.config.xaxis.axisBorder.offsetY,this.isCategoryBarHorizontal="bar"===s.config.chart.type&&s.config.plotOptions.bar.horizontal,this.xaxisFontSize=s.config.xaxis.labels.style.fontSize,this.xaxisFontFamily=s.config.xaxis.labels.style.fontFamily,this.xaxisForeColors=s.config.xaxis.labels.style.colors,this.xaxisBorderWidth=s.config.xaxis.axisBorder.width,this.isCategoryBarHorizontal&&(this.xaxisBorderWidth=s.config.yaxis[0].axisBorder.width.toString()),this.xaxisBorderWidth.indexOf("%")>-1?this.xaxisBorderWidth=s.globals.gridWidth*parseInt(this.xaxisBorderWidth,10)/100:this.xaxisBorderWidth=parseInt(this.xaxisBorderWidth,10),this.xaxisBorderHeight=s.config.xaxis.axisBorder.height,this.yaxis=s.config.yaxis[0]}return s(t,[{key:"drawXaxis",value:function(){var t=this.w,e=new Mi(this.ctx),i=e.group({class:"apexcharts-xaxis",transform:"translate(".concat(t.config.xaxis.offsetX,", ").concat(t.config.xaxis.offsetY,")")}),a=e.group({class:"apexcharts-xaxis-texts-g",transform:"translate(".concat(t.globals.translateXAxisX,", ").concat(t.globals.translateXAxisY,")")});i.add(a);for(var s=[],r=0;r6&&void 0!==arguments[6]?arguments[6]:{},h=[],c=[],d=this.w,u=l.xaxisFontSize||this.xaxisFontSize,g=l.xaxisFontFamily||this.xaxisFontFamily,p=l.xaxisForeColors||this.xaxisForeColors,f=l.fontWeight||d.config.xaxis.labels.style.fontWeight,x=l.cssClass||d.config.xaxis.labels.style.cssClass,b=d.globals.padHorizontal,m=a.length,v="category"===d.config.xaxis.type?d.globals.dataPoints:m;if(0===v&&m>v&&(v=m),s){var y=Math.max(Number(d.config.xaxis.tickAmount)||1,v>1?v-1:v);n=d.globals.gridWidth/Math.min(y,m-1),b=b+r(0,n)/2+d.config.xaxis.labels.offsetX}else n=d.globals.gridWidth/v,b=b+r(0,n)+d.config.xaxis.labels.offsetX;for(var w=function(s){var l=b-r(s,n)/2+d.config.xaxis.labels.offsetX;0===s&&1===m&&n/2===b&&1===v&&(l=d.globals.gridWidth/2);var y=o.axesUtils.getLabel(a,d.globals.timescaleLabels,l,s,h,u,t),w=28;d.globals.rotateXLabels&&t&&(w=22),d.config.xaxis.title.text&&"top"===d.config.xaxis.position&&(w+=parseFloat(d.config.xaxis.title.style.fontSize)+2),t||(w=w+parseFloat(u)+(d.globals.xAxisLabelsHeight-d.globals.xAxisGroupLabelsHeight)+(d.globals.rotateXLabels?10:0)),y=void 0!==d.config.xaxis.tickAmount&&"dataPoints"!==d.config.xaxis.tickAmount&&"datetime"!==d.config.xaxis.type?o.axesUtils.checkLabelBasedOnTickamount(s,y,m):o.axesUtils.checkForOverflowingLabels(s,y,m,h,c);if(d.config.xaxis.labels.show){var k=e.drawText({x:y.x,y:o.offY+d.config.xaxis.labels.offsetY+w-("top"===d.config.xaxis.position?d.globals.xAxisHeight+d.config.xaxis.axisTicks.height-2:0),text:y.text,textAnchor:"middle",fontWeight:y.isBold?600:f,fontSize:u,fontFamily:g,foreColor:Array.isArray(p)?t&&d.config.xaxis.convertedCatToNumeric?p[d.globals.minX+s-1]:p[s]:p,isPlainText:!1,cssClass:(t?"apexcharts-xaxis-label ":"apexcharts-xaxis-group-label ")+x});if(i.add(k),k.on("click",(function(t){if("function"==typeof d.config.chart.events.xAxisLabelClick){var e=Object.assign({},d,{labelIndex:s});d.config.chart.events.xAxisLabelClick(t,o.ctx,e)}})),t){var A=document.createElementNS(d.globals.SVGNS,"title");A.textContent=Array.isArray(y.text)?y.text.join(" "):y.text,k.node.appendChild(A),""!==y.text&&(h.push(y.text),c.push(y))}}sa.globals.gridWidth)){var r=this.offY+a.config.xaxis.axisTicks.offsetY;if(e=e+r+a.config.xaxis.axisTicks.height,"top"===a.config.xaxis.position&&(e=r-a.config.xaxis.axisTicks.height),a.config.xaxis.axisTicks.show){var n=new Mi(this.ctx).drawLine(t+a.config.xaxis.axisTicks.offsetX,r+a.config.xaxis.offsetY,s+a.config.xaxis.axisTicks.offsetX,e+a.config.xaxis.offsetY,a.config.xaxis.axisTicks.color);i.add(n),n.node.classList.add("apexcharts-xaxis-tick")}}}},{key:"getXAxisTicksPositions",value:function(){var t=this.w,e=[],i=this.xaxisLabels.length,a=t.globals.padHorizontal;if(t.globals.timescaleLabels.length>0)for(var s=0;s0){var h=s[s.length-1].getBBox(),c=s[0].getBBox();h.x<-20&&s[s.length-1].parentNode.removeChild(s[s.length-1]),c.x+c.width>t.globals.gridWidth&&!t.globals.isBarHorizontal&&s[0].parentNode.removeChild(s[0]);for(var d=0;d0&&(this.xaxisLabels=a.globals.timescaleLabels.slice())}return s(t,[{key:"drawGridArea",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=this.w,i=new Mi(this.ctx);t||(t=i.group({class:"apexcharts-grid"}));var a=i.drawLine(e.globals.padHorizontal,1,e.globals.padHorizontal,e.globals.gridHeight,"transparent"),s=i.drawLine(e.globals.padHorizontal,e.globals.gridHeight,e.globals.gridWidth,e.globals.gridHeight,"transparent");return t.add(s),t.add(a),t}},{key:"drawGrid",value:function(){if(this.w.globals.axisCharts){var t=this.renderGrid();return this.drawGridArea(t.el),t}return null}},{key:"createGridMask",value:function(){var t=this.w,e=t.globals,i=new Mi(this.ctx),a=Array.isArray(t.config.stroke.width)?Math.max.apply(Math,f(t.config.stroke.width)):t.config.stroke.width,s=function(t){var i=document.createElementNS(e.SVGNS,"clipPath");return i.setAttribute("id",t),i};e.dom.elGridRectMask=s("gridRectMask".concat(e.cuid)),e.dom.elGridRectBarMask=s("gridRectBarMask".concat(e.cuid)),e.dom.elGridRectMarkerMask=s("gridRectMarkerMask".concat(e.cuid)),e.dom.elForecastMask=s("forecastMask".concat(e.cuid)),e.dom.elNonForecastMask=s("nonForecastMask".concat(e.cuid));var r=0,n=0;(["bar","rangeBar","candlestick","boxPlot"].includes(t.config.chart.type)||t.globals.comboBarCount>0)&&t.globals.isXNumeric&&!t.globals.isBarHorizontal&&(r=Math.max(t.config.grid.padding.left,e.barPadForNumericAxis),n=Math.max(t.config.grid.padding.right,e.barPadForNumericAxis)),e.dom.elGridRect=i.drawRect(-a/2-2,-a/2-2,e.gridWidth+a+4,e.gridHeight+a+4,0,"#fff"),e.dom.elGridRectBar=i.drawRect(-a/2-r-2,-a/2-2,e.gridWidth+a+n+r+4,e.gridHeight+a+4,0,"#fff");var o=t.globals.markers.largestSize;e.dom.elGridRectMarker=i.drawRect(-o,-o,e.gridWidth+2*o,e.gridHeight+2*o,0,"#fff"),e.dom.elGridRectMask.appendChild(e.dom.elGridRect.node),e.dom.elGridRectBarMask.appendChild(e.dom.elGridRectBar.node),e.dom.elGridRectMarkerMask.appendChild(e.dom.elGridRectMarker.node);var l=e.dom.baseEl.querySelector("defs");l.appendChild(e.dom.elGridRectMask),l.appendChild(e.dom.elGridRectBarMask),l.appendChild(e.dom.elGridRectMarkerMask),l.appendChild(e.dom.elForecastMask),l.appendChild(e.dom.elNonForecastMask)}},{key:"_drawGridLines",value:function(t){var e=t.i,i=t.x1,a=t.y1,s=t.x2,r=t.y2,n=t.xCount,o=t.parent,l=this.w;if(!(0===e&&l.globals.skipFirstTimelinelabel||e===n-1&&l.globals.skipLastTimelinelabel&&!l.config.xaxis.labels.formatter||"radar"===l.config.chart.type)){l.config.grid.xaxis.lines.show&&this._drawGridLine({i:e,x1:i,y1:a,x2:s,y2:r,xCount:n,parent:o});var h=0;if(l.globals.hasXaxisGroups&&"between"===l.config.xaxis.tickPlacement){var c=l.globals.groups;if(c){for(var d=0,u=0;d0&&"datetime"!==t.config.xaxis.type&&(s=e.yAxisScale[a].result.length-1);this._drawXYLines({xCount:s,tickAmount:r})}else s=r,r=e.xTickAmount,this._drawInvertedXYLines({xCount:s,tickAmount:r});return this.drawGridBands(s,r),{el:this.elg,elGridBorders:this.elGridBorders,xAxisTickWidth:e.gridWidth/s}}},{key:"drawGridBands",value:function(t,e){var i,a,s=this,r=this.w;if((null===(i=r.config.grid.row.colors)||void 0===i?void 0:i.length)>0&&function(t,i,a,n,o,l){for(var h=0,c=0;h=r.config.grid[t].colors.length&&(c=0),s._drawGridBandRect({c:c,x1:a,y1:n,x2:o,y2:l,type:t}),n+=r.globals.gridHeight/e}("row",e,0,0,r.globals.gridWidth,r.globals.gridHeight/e),(null===(a=r.config.grid.column.colors)||void 0===a?void 0:a.length)>0){var n=r.globals.isBarHorizontal||"on"!==r.config.xaxis.tickPlacement||"category"!==r.config.xaxis.type&&!r.config.xaxis.convertedCatToNumeric?t:t-1;r.globals.isXNumeric&&(n=r.globals.xAxisScale.result.length-1);for(var o=r.globals.padHorizontal,l=r.globals.padHorizontal+r.globals.gridWidth/n,h=r.globals.gridHeight,c=0,d=0;c=r.config.grid.column.colors.length&&(d=0),"datetime"===r.config.xaxis.type)o=this.xaxisLabels[c].position,l=((null===(u=this.xaxisLabels[c+1])||void 0===u?void 0:u.position)||r.globals.gridWidth)-this.xaxisLabels[c].position;this._drawGridBandRect({c:d,x1:o,y1:0,x2:l,y2:h,type:"column"}),o+=r.globals.gridWidth/n}}}}]),t}(),ta=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.coreUtils=new Pi(this.ctx)}return s(t,[{key:"niceScale",value:function(t,e){var i,a,s,r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=1e-11,l=this.w,h=l.globals;h.isBarHorizontal?(i=l.config.xaxis,a=Math.max((h.svgWidth-100)/25,2)):(i=l.config.yaxis[n],a=Math.max((h.svgHeight-100)/15,2)),v.isNumber(a)||(a=10),s=void 0!==i.min&&null!==i.min,r=void 0!==i.max&&null!==i.min;var c=void 0!==i.stepSize&&null!==i.stepSize,d=void 0!==i.tickAmount&&null!==i.tickAmount,u=d?i.tickAmount:h.niceScaleDefaultTicks[Math.min(Math.round(a/2),h.niceScaleDefaultTicks.length-1)];if(h.isMultipleYAxis&&!d&&h.multiAxisTickAmount>0&&(u=h.multiAxisTickAmount,d=!0),u="dataPoints"===u?h.dataPoints-1:Math.abs(Math.round(u)),(t===Number.MIN_VALUE&&0===e||!v.isNumber(t)&&!v.isNumber(e)||t===Number.MIN_VALUE&&e===-Number.MAX_VALUE)&&(t=v.isNumber(i.min)?i.min:0,e=v.isNumber(i.max)?i.max:t+u,h.allSeriesCollapsed=!1),t>e){console.warn("axis.min cannot be greater than axis.max: swapping min and max");var g=e;e=t,t=g}else t===e&&(t=0===t?0:t-1,e=0===e?2:e+1);var p=[];u<1&&(u=1);var f=u,x=Math.abs(e-t);!s&&t>0&&t/x<.15&&(t=0,s=!0),!r&&e<0&&-e/x<.15&&(e=0,r=!0);var b=(x=Math.abs(e-t))/f,m=b,y=Math.floor(Math.log10(m)),w=Math.pow(10,y),k=Math.ceil(m/w);if(b=m=(k=h.niceScaleAllowedMagMsd[0===h.yValueDecimal?0:1][k])*w,h.isBarHorizontal&&i.stepSize&&"datetime"!==i.type?(b=i.stepSize,c=!0):c&&(b=i.stepSize),c&&i.forceNiceScale){var A=Math.floor(Math.log10(b));b*=Math.pow(10,y-A)}if(s&&r){var C=x/f;if(d)if(c)if(0!=v.mod(x,b)){var S=v.getGCD(b,C);b=C/S<10?S:C}else 0==v.mod(b,C)?b=C:(C=b,d=!1);else b=C;else if(c)0==v.mod(x,b)?C=b:b=C;else if(0==v.mod(x,b))C=b;else{C=x/(f=Math.ceil(x/b));var L=v.getGCD(x,b);x/La&&(t=e-b*u,t+=b*Math.floor((M-t)/b))}else if(s)if(d)e=t+b*f;else{var P=e;e=b*Math.ceil(e/b),Math.abs(e-t)/v.getGCD(x,b)>a&&(e=t+b*u,e+=b*Math.ceil((P-e)/b))}}else if(h.isMultipleYAxis&&d){var I=b*Math.floor(t/b),T=I+b*f;T0&&t16&&v.getPrimeFactors(f).length<2&&f++,!d&&i.forceNiceScale&&0===h.yValueDecimal&&f>x&&(f=x,b=Math.round(x/f)),f>a&&(!d&&!c||i.forceNiceScale)){var z=v.getPrimeFactors(f),X=z.length-1,R=f;t:for(var E=0;EN);return{result:p,niceMin:p[0],niceMax:p[p.length-1]}}},{key:"linearScale",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0,r=Math.abs(e-t),n=[];if(t===e)return{result:n=[t],niceMin:n[0],niceMax:n[n.length-1]};"dataPoints"===(i=this._adjustTicksForSmallRange(i,a,r))&&(i=this.w.globals.dataPoints-1),s||(s=r/i),s=Math.round(100*(s+Number.EPSILON))/100,i===Number.MAX_VALUE&&(i=5,s=1);for(var o=t;i>=0;)n.push(o),o=v.preciseAddition(o,s),i-=1;return{result:n,niceMin:n[0],niceMax:n[n.length-1]}}},{key:"logarithmicScaleNice",value:function(t,e,i){e<=0&&(e=Math.max(t,i)),t<=0&&(t=Math.min(e,i));for(var a=[],s=Math.ceil(Math.log(e)/Math.log(i)+1),r=Math.floor(Math.log(t)/Math.log(i));r5?(a.allSeriesCollapsed=!1,a.yAxisScale[t]=r.forceNiceScale?this.logarithmicScaleNice(e,i,r.logBase):this.logarithmicScale(e,i,r.logBase)):i!==-Number.MAX_VALUE&&v.isNumber(i)&&e!==Number.MAX_VALUE&&v.isNumber(e)?(a.allSeriesCollapsed=!1,a.yAxisScale[t]=this.niceScale(e,i,t)):a.yAxisScale[t]=this.niceScale(Number.MIN_VALUE,0,t)}},{key:"setXScale",value:function(t,e){var i=this.w,a=i.globals;if(e!==-Number.MAX_VALUE&&v.isNumber(e)){var s=a.xTickAmount;a.xAxisScale=this.linearScale(t,e,s,0,i.config.xaxis.stepSize)}else a.xAxisScale=this.linearScale(0,10,10);return a.xAxisScale}},{key:"scaleMultipleYAxes",value:function(){var t=this,e=this.w.config,i=this.w.globals;this.coreUtils.setSeriesYAxisMappings();var a=i.seriesYAxisMap,s=i.minYArr,r=i.maxYArr;i.allSeriesCollapsed=!0,i.barGroups=[],a.forEach((function(a,n){var o=[];a.forEach((function(t){var i,a=null===(i=e.series[t])||void 0===i?void 0:i.group;o.indexOf(a)<0&&o.push(a)})),a.length>0?function(){var l,h,c=Number.MAX_VALUE,d=-Number.MAX_VALUE,u=c,g=d;if(e.chart.stacked)!function(){var t=new Array(i.dataPoints).fill(0),s=[],r=[],p=[];o.forEach((function(){s.push(t.map((function(){return Number.MIN_VALUE}))),r.push(t.map((function(){return Number.MIN_VALUE}))),p.push(t.map((function(){return Number.MIN_VALUE})))}));for(var f=function(t){!l&&e.series[a[t]].type&&(l=e.series[a[t]].type);var c=a[t];h=e.series[c].group?e.series[c].group:"axis-".concat(n),!(i.collapsedSeriesIndices.indexOf(c)<0&&i.ancillaryCollapsedSeriesIndices.indexOf(c)<0)||(i.allSeriesCollapsed=!1,o.forEach((function(t,a){if(e.series[c].group===t)for(var n=0;n=0?r[a][n]+=o:p[a][n]+=o,s[a][n]+=o,u=Math.min(u,o),g=Math.max(g,o)}}))),"bar"!==l&&"column"!==l||i.barGroups.push(h)},x=0;x1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-Number.MAX_VALUE,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,s=this.w.config,r=this.w.globals,n=-Number.MAX_VALUE,o=Number.MIN_VALUE;null===a&&(a=t+1);var l=r.series,h=l,c=l;"candlestick"===s.chart.type?(h=r.seriesCandleL,c=r.seriesCandleH):"boxPlot"===s.chart.type?(h=r.seriesCandleO,c=r.seriesCandleC):r.isRangeData&&(h=r.seriesRangeStart,c=r.seriesRangeEnd);var d=!1;if(r.seriesX.length>=a){var u,g=null===(u=r.brushSource)||void 0===u?void 0:u.w.config.chart.brush;(s.chart.zoom.enabled&&s.chart.zoom.autoScaleYaxis||null!=g&&g.enabled&&null!=g&&g.autoScaleYaxis)&&(d=!0)}for(var p=t;px&&r.seriesX[p][b]>s.xaxis.max;b--);}for(var m=x;m<=b&&mh[p][m]&&h[p][m]<0&&(o=h[p][m])}else r.hasNullValues=!0}"bar"!==f&&"column"!==f||(o<0&&n<0&&(n=0,i=Math.max(i,0)),o===Number.MIN_VALUE&&(o=0,e=Math.min(e,0)))}return"rangeBar"===s.chart.type&&r.seriesRangeStart.length&&r.isBarHorizontal&&(o=e),"bar"===s.chart.type&&(o<0&&n<0&&(n=0),o===Number.MIN_VALUE&&(o=0)),{minY:o,maxY:n,lowestY:e,highestY:i}}},{key:"setYRange",value:function(){var t=this.w.globals,e=this.w.config;t.maxY=-Number.MAX_VALUE,t.minY=Number.MIN_VALUE;var i,a=Number.MAX_VALUE;if(t.isMultipleYAxis){a=Number.MAX_VALUE;for(var s=0;st.dataPoints&&0!==t.dataPoints&&(a=t.dataPoints-1);else if("dataPoints"===e.xaxis.tickAmount){if(t.series.length>1&&(a=t.series[t.maxValsInArrayIndex].length-1),t.isXNumeric){var s=Math.round(t.maxX-t.minX);s<30&&(a=s-1)}}else a=e.xaxis.tickAmount;if(t.xTickAmount=a,void 0!==e.xaxis.max&&"number"==typeof e.xaxis.max&&(t.maxX=e.xaxis.max),void 0!==e.xaxis.min&&"number"==typeof e.xaxis.min&&(t.minX=e.xaxis.min),void 0!==e.xaxis.range&&(t.minX=t.maxX-e.xaxis.range),t.minX!==Number.MAX_VALUE&&t.maxX!==-Number.MAX_VALUE)if(e.xaxis.convertedCatToNumeric&&!t.dataFormatXNumeric){for(var r=[],n=t.minX-1;n0&&(t.xAxisScale=this.scales.linearScale(1,t.labels.length,a-1,0,e.xaxis.stepSize),t.seriesX=t.labels.slice());i&&(t.labels=t.xAxisScale.result.slice())}return t.isBarHorizontal&&t.labels.length&&(t.xTickAmount=t.labels.length),this._handleSingleDataPoint(),this._getMinXDiff(),{minX:t.minX,maxX:t.maxX}}},{key:"setZRange",value:function(){var t=this.w.globals;if(t.isDataXYZ)for(var e=0;e0){var s=e-a[i-1];s>0&&(t.minXDiff=Math.min(s,t.minXDiff))}})),1!==t.dataPoints&&t.minXDiff!==Number.MAX_VALUE||(t.minXDiff=.5)}}))}},{key:"_setStackedMinMax",value:function(){var t=this,e=this.w.globals;if(e.series.length){var i=e.seriesGroups;i.length||(i=[this.w.globals.seriesNames.map((function(t){return t}))]);var a={},s={};i.forEach((function(i){a[i]=[],s[i]=[],t.w.config.series.map((function(t,a){return i.indexOf(e.seriesNames[a])>-1?a:null})).filter((function(t){return null!==t})).forEach((function(r){for(var n=0;n0?a[i][n]+=parseFloat(e.series[r][n])+1e-4:s[i][n]+=parseFloat(e.series[r][n]))}}))})),Object.entries(a).forEach((function(t){var i=p(t,1)[0];a[i].forEach((function(t,r){e.maxY=Math.max(e.maxY,a[i][r]),e.minY=Math.min(e.minY,s[i][r])}))}))}}}]),t}(),ia=function(){function t(e,a){i(this,t),this.ctx=e,this.elgrid=a,this.w=e.w;var s=this.w;this.xaxisFontSize=s.config.xaxis.labels.style.fontSize,this.axisFontFamily=s.config.xaxis.labels.style.fontFamily,this.xaxisForeColors=s.config.xaxis.labels.style.colors,this.isCategoryBarHorizontal="bar"===s.config.chart.type&&s.config.plotOptions.bar.horizontal,this.xAxisoffX="bottom"===s.config.xaxis.position?s.globals.gridHeight:0,this.drawnLabels=[],this.axesUtils=new Ri(e)}return s(t,[{key:"drawYaxis",value:function(t){var e=this.w,i=new Mi(this.ctx),a=e.config.yaxis[t].labels.style,s=a.fontSize,r=a.fontFamily,n=a.fontWeight,o=i.group({class:"apexcharts-yaxis",rel:t,transform:"translate(".concat(e.globals.translateYAxisX[t],", 0)")});if(this.axesUtils.isYAxisHidden(t))return o;var l=i.group({class:"apexcharts-yaxis-texts-g"});o.add(l);var h=e.globals.yAxisScale[t].result.length-1,c=e.globals.gridHeight/h,d=e.globals.yLabelFormatters[t],u=this.axesUtils.checkForReversedLabels(t,e.globals.yAxisScale[t].result.slice());if(e.config.yaxis[t].labels.show){var g=e.globals.translateY+e.config.yaxis[t].labels.offsetY;e.globals.isBarHorizontal?g=0:"heatmap"===e.config.chart.type&&(g-=c/2),g+=parseInt(s,10)/3;for(var p=h;p>=0;p--){var f=d(u[p],p,e),x=e.config.yaxis[t].labels.padding;e.config.yaxis[t].opposite&&0!==e.config.yaxis.length&&(x*=-1);var b=this.getTextAnchor(e.config.yaxis[t].labels.align,e.config.yaxis[t].opposite),m=this.axesUtils.getYAxisForeColor(a.colors,t),y=Array.isArray(m)?m[p]:m,w=v.listToArray(e.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxis[rel='".concat(t,"'] .apexcharts-yaxis-label tspan"))).map((function(t){return t.textContent})),k=i.drawText({x:x,y:g,text:w.includes(f)&&!e.config.yaxis[t].labels.showDuplicates?"":f,textAnchor:b,fontSize:s,fontFamily:r,fontWeight:n,maxWidth:e.config.yaxis[t].labels.maxWidth,foreColor:y,isPlainText:!1,cssClass:"apexcharts-yaxis-label ".concat(a.cssClass)});l.add(k),this.addTooltip(k,f),0!==e.config.yaxis[t].labels.rotate&&this.rotateLabel(i,k,firstLabel,e.config.yaxis[t].labels.rotate),g+=c}}return this.addYAxisTitle(i,o,t),this.addAxisBorder(i,o,t,h,c),o}},{key:"getTextAnchor",value:function(t,e){return"left"===t?"start":"center"===t?"middle":"right"===t?"end":e?"start":"end"}},{key:"addTooltip",value:function(t,e){var i=document.createElementNS(this.w.globals.SVGNS,"title");i.textContent=Array.isArray(e)?e.join(" "):e,t.node.appendChild(i)}},{key:"rotateLabel",value:function(t,e,i,a){var s=t.rotateAroundCenter(i.node),r=t.rotateAroundCenter(e.node);e.node.setAttribute("transform","rotate(".concat(a," ").concat(s.x," ").concat(r.y,")"))}},{key:"addYAxisTitle",value:function(t,e,i){var a=this.w;if(void 0!==a.config.yaxis[i].title.text){var s=t.group({class:"apexcharts-yaxis-title"}),r=a.config.yaxis[i].opposite?a.globals.translateYAxisX[i]:0,n=t.drawText({x:r,y:a.globals.gridHeight/2+a.globals.translateY+a.config.yaxis[i].title.offsetY,text:a.config.yaxis[i].title.text,textAnchor:"end",foreColor:a.config.yaxis[i].title.style.color,fontSize:a.config.yaxis[i].title.style.fontSize,fontWeight:a.config.yaxis[i].title.style.fontWeight,fontFamily:a.config.yaxis[i].title.style.fontFamily,cssClass:"apexcharts-yaxis-title-text ".concat(a.config.yaxis[i].title.style.cssClass)});s.add(n),e.add(s)}}},{key:"addAxisBorder",value:function(t,e,i,a,s){var r=this.w,n=r.config.yaxis[i].axisBorder,o=31+n.offsetX;if(r.config.yaxis[i].opposite&&(o=-31-n.offsetX),n.show){var l=t.drawLine(o,r.globals.translateY+n.offsetY-2,o,r.globals.gridHeight+r.globals.translateY+n.offsetY+2,n.color,0,n.width);e.add(l)}r.config.yaxis[i].axisTicks.show&&this.axesUtils.drawYAxisTicks(o,a,n,r.config.yaxis[i].axisTicks,i,s,e)}},{key:"drawYaxisInversed",value:function(t){var e=this.w,i=new Mi(this.ctx),a=i.group({class:"apexcharts-xaxis apexcharts-yaxis-inversed"}),s=i.group({class:"apexcharts-xaxis-texts-g",transform:"translate(".concat(e.globals.translateXAxisX,", ").concat(e.globals.translateXAxisY,")")});a.add(s);var r=e.globals.yAxisScale[t].result.length-1,n=e.globals.gridWidth/r+.1,o=n+e.config.xaxis.labels.offsetX,l=e.globals.xLabelFormatter,h=this.axesUtils.checkForReversedLabels(t,e.globals.yAxisScale[t].result.slice()),c=e.globals.timescaleLabels;if(c.length>0&&(this.xaxisLabels=c.slice(),r=(h=c.slice()).length),e.config.xaxis.labels.show)for(var d=c.length?0:r;c.length?d=0;c.length?d++:d--){var u=l(h[d],d,e),g=e.globals.gridWidth+e.globals.padHorizontal-(o-n+e.config.xaxis.labels.offsetX);if(c.length){var p=this.axesUtils.getLabel(h,c,g,d,this.drawnLabels,this.xaxisFontSize);g=p.x,u=p.text,this.drawnLabels.push(p.text),0===d&&e.globals.skipFirstTimelinelabel&&(u=""),d===h.length-1&&e.globals.skipLastTimelinelabel&&(u="")}var f=i.drawText({x:g,y:this.xAxisoffX+e.config.xaxis.labels.offsetY+30-("top"===e.config.xaxis.position?e.globals.xAxisHeight+e.config.xaxis.axisTicks.height-2:0),text:u,textAnchor:"middle",foreColor:Array.isArray(this.xaxisForeColors)?this.xaxisForeColors[t]:this.xaxisForeColors,fontSize:this.xaxisFontSize,fontFamily:this.xaxisFontFamily,fontWeight:e.config.xaxis.labels.style.fontWeight,isPlainText:!1,cssClass:"apexcharts-xaxis-label ".concat(e.config.xaxis.labels.style.cssClass)});s.add(f),f.tspan(u),this.addTooltip(f,u),o+=n}return this.inversedYAxisTitleText(a),this.inversedYAxisBorder(a),a}},{key:"inversedYAxisBorder",value:function(t){var e=this.w,i=new Mi(this.ctx),a=e.config.xaxis.axisBorder;if(a.show){var s=0;"bar"===e.config.chart.type&&e.globals.isXNumeric&&(s-=15);var r=i.drawLine(e.globals.padHorizontal+s+a.offsetX,this.xAxisoffX,e.globals.gridWidth,this.xAxisoffX,a.color,0,a.height);this.elgrid&&this.elgrid.elGridBorders&&e.config.grid.show?this.elgrid.elGridBorders.add(r):t.add(r)}}},{key:"inversedYAxisTitleText",value:function(t){var e=this.w,i=new Mi(this.ctx);if(void 0!==e.config.xaxis.title.text){var a=i.group({class:"apexcharts-xaxis-title apexcharts-yaxis-title-inversed"}),s=i.drawText({x:e.globals.gridWidth/2+e.config.xaxis.title.offsetX,y:this.xAxisoffX+parseFloat(this.xaxisFontSize)+parseFloat(e.config.xaxis.title.style.fontSize)+e.config.xaxis.title.offsetY+20,text:e.config.xaxis.title.text,textAnchor:"middle",fontSize:e.config.xaxis.title.style.fontSize,fontFamily:e.config.xaxis.title.style.fontFamily,fontWeight:e.config.xaxis.title.style.fontWeight,foreColor:e.config.xaxis.title.style.color,cssClass:"apexcharts-xaxis-title-text ".concat(e.config.xaxis.title.style.cssClass)});a.add(s),t.add(a)}}},{key:"yAxisTitleRotate",value:function(t,e){var i=this.w,a=new Mi(this.ctx),s=i.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(t,"'] .apexcharts-yaxis-texts-g")),r=s?s.getBoundingClientRect():{width:0,height:0},n=i.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(t,"'] .apexcharts-yaxis-title text")),o=n?n.getBoundingClientRect():{width:0,height:0};if(n){var l=this.xPaddingForYAxisTitle(t,r,o,e);n.setAttribute("x",l.xPos-(e?10:0));var h=a.rotateAroundCenter(n);n.setAttribute("transform","rotate(".concat(e?-1*i.config.yaxis[t].title.rotate:i.config.yaxis[t].title.rotate," ").concat(h.x," ").concat(h.y,")"))}}},{key:"xPaddingForYAxisTitle",value:function(t,e,i,a){var s=this.w,r=0,n=10;return void 0===s.config.yaxis[t].title.text||t<0?{xPos:r,padd:0}:(a?r=e.width+s.config.yaxis[t].title.offsetX+i.width/2+n/2:(r=-1*e.width+s.config.yaxis[t].title.offsetX+n/2+i.width/2,s.globals.isBarHorizontal&&(n=25,r=-1*e.width-s.config.yaxis[t].title.offsetX-n)),{xPos:r,padd:n})}},{key:"setYAxisXPosition",value:function(t,e){var i=this.w,a=0,s=0,r=18,n=1;i.config.yaxis.length>1&&(this.multipleYs=!0),i.config.yaxis.forEach((function(o,l){var h=i.globals.ignoreYAxisIndexes.includes(l)||!o.show||o.floating||0===t[l].width,c=t[l].width+e[l].width;o.opposite?i.globals.isBarHorizontal?(s=i.globals.gridWidth+i.globals.translateX-1,i.globals.translateYAxisX[l]=s-o.labels.offsetX):(s=i.globals.gridWidth+i.globals.translateX+n,h||(n+=c+20),i.globals.translateYAxisX[l]=s-o.labels.offsetX+20):(a=i.globals.translateX-r,h||(r+=c+20),i.globals.translateYAxisX[l]=a+o.labels.offsetX)}))}},{key:"setYAxisTextAlignments",value:function(){var t=this.w;v.listToArray(t.globals.dom.baseEl.getElementsByClassName("apexcharts-yaxis")).forEach((function(e,i){var a=t.config.yaxis[i];if(a&&!a.floating&&void 0!==a.labels.align){var s=t.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(i,"'] .apexcharts-yaxis-texts-g")),r=v.listToArray(t.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxis[rel='".concat(i,"'] .apexcharts-yaxis-label"))),n=s.getBoundingClientRect();r.forEach((function(t){t.setAttribute("text-anchor",a.labels.align)})),"left"!==a.labels.align||a.opposite?"center"===a.labels.align?s.setAttribute("transform","translate(".concat(n.width/2*(a.opposite?1:-1),", 0)")):"right"===a.labels.align&&a.opposite&&s.setAttribute("transform","translate(".concat(n.width,", 0)")):s.setAttribute("transform","translate(-".concat(n.width,", 0)"))}}))}}]),t}(),aa=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.documentEvent=v.bind(this.documentEvent,this)}return s(t,[{key:"addEventListener",value:function(t,e){var i=this.w;i.globals.events.hasOwnProperty(t)?i.globals.events[t].push(e):i.globals.events[t]=[e]}},{key:"removeEventListener",value:function(t,e){var i=this.w;if(i.globals.events.hasOwnProperty(t)){var a=i.globals.events[t].indexOf(e);-1!==a&&i.globals.events[t].splice(a,1)}}},{key:"fireEvent",value:function(t,e){var i=this.w;if(i.globals.events.hasOwnProperty(t)){e&&e.length||(e=[]);for(var a=i.globals.events[t],s=a.length,r=0;r0&&(e=this.w.config.chart.locales.concat(window.Apex.chart.locales));var i=e.filter((function(e){return e.name===t}))[0];if(!i)throw new Error("Wrong locale name provided. Please make sure you set the correct locale name in options");var a=v.extend(Hi,i);this.w.globals.locale=a.options}}]),t}(),ra=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"drawAxis",value:function(t,e){var i,a,s=this,r=this.w.globals,n=this.w.config,o=new Qi(this.ctx,e),l=new ia(this.ctx,e);r.axisCharts&&"radar"!==t&&(r.isBarHorizontal?(a=l.drawYaxisInversed(0),i=o.drawXaxisInversed(0),r.dom.elGraphical.add(i),r.dom.elGraphical.add(a)):(i=o.drawXaxis(),r.dom.elGraphical.add(i),n.yaxis.map((function(t,e){if(-1===r.ignoreYAxisIndexes.indexOf(e)&&(a=l.drawYaxis(e),r.dom.Paper.add(a),"back"===s.w.config.grid.position)){var i=r.dom.Paper.children()[1];i.remove(),r.dom.Paper.add(i)}}))))}}]),t}(),na=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"drawXCrosshairs",value:function(){var t=this.w,e=new Mi(this.ctx),i=new Li(this.ctx),a=t.config.xaxis.crosshairs.fill.gradient,s=t.config.xaxis.crosshairs.dropShadow,r=t.config.xaxis.crosshairs.fill.type,n=a.colorFrom,o=a.colorTo,l=a.opacityFrom,h=a.opacityTo,c=a.stops,d=s.enabled,u=s.left,g=s.top,p=s.blur,f=s.color,x=s.opacity,b=t.config.xaxis.crosshairs.fill.color;if(t.config.xaxis.crosshairs.show){"gradient"===r&&(b=e.drawGradient("vertical",n,o,l,h,null,c,null));var m=e.drawRect();1===t.config.xaxis.crosshairs.width&&(m=e.drawLine());var y=t.globals.gridHeight;(!v.isNumber(y)||y<0)&&(y=0);var w=t.config.xaxis.crosshairs.width;(!v.isNumber(w)||w<0)&&(w=0),m.attr({class:"apexcharts-xcrosshairs",x:0,y:0,y2:y,width:w,height:y,fill:b,filter:"none","fill-opacity":t.config.xaxis.crosshairs.opacity,stroke:t.config.xaxis.crosshairs.stroke.color,"stroke-width":t.config.xaxis.crosshairs.stroke.width,"stroke-dasharray":t.config.xaxis.crosshairs.stroke.dashArray}),d&&(m=i.dropShadow(m,{left:u,top:g,blur:p,color:f,opacity:x})),t.globals.dom.elGraphical.add(m)}}},{key:"drawYCrosshairs",value:function(){var t=this.w,e=new Mi(this.ctx),i=t.config.yaxis[0].crosshairs,a=t.globals.barPadForNumericAxis;if(t.config.yaxis[0].crosshairs.show){var s=e.drawLine(-a,0,t.globals.gridWidth+a,0,i.stroke.color,i.stroke.dashArray,i.stroke.width);s.attr({class:"apexcharts-ycrosshairs"}),t.globals.dom.elGraphical.add(s)}var r=e.drawLine(-a,0,t.globals.gridWidth+a,0,i.stroke.color,0,0);r.attr({class:"apexcharts-ycrosshairs-hidden"}),t.globals.dom.elGraphical.add(r)}}]),t}(),oa=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"checkResponsiveConfig",value:function(t){var e=this,i=this.w,a=i.config;if(0!==a.responsive.length){var s=a.responsive.slice();s.sort((function(t,e){return t.breakpoint>e.breakpoint?1:e.breakpoint>t.breakpoint?-1:0})).reverse();var r=new Wi({}),n=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=s[0].breakpoint,n=window.innerWidth>0?window.innerWidth:screen.width;if(n>a){var o=v.clone(i.globals.initialConfig);o.series=v.clone(i.config.series);var l=Pi.extendArrayProps(r,o,i);t=v.extend(l,t),t=v.extend(i.config,t),e.overrideResponsiveOptions(t)}else for(var h=0;h0&&"function"==typeof t[0]?(this.isColorFn=!0,i.config.series.map((function(a,s){var r=t[s]||t[0];return"function"==typeof r?r({value:i.globals.axisCharts?i.globals.series[s][0]||0:i.globals.series[s],seriesIndex:s,dataPointIndex:s,w:e.w}):r}))):t:this.predefined()}},{key:"applySeriesColors",value:function(t,e){t.forEach((function(t,i){t&&(e[i]=t)}))}},{key:"getMonochromeColors",value:function(t,e,i){var a=t.color,s=t.shadeIntensity,r=t.shadeTo,n=this.isBarDistributed||this.isHeatmapDistributed?e[0].length*e.length:e.length,o=1/(n/s),l=0;return Array.from({length:n},(function(){var t="dark"===r?i.shadeColor(-1*l,a):i.shadeColor(l,a);return l+=o,t}))}},{key:"applyColorTypes",value:function(t,e){var i=this,a=this.w;t.forEach((function(t){a.globals[t].colors=void 0===a.config[t].colors?i.isColorFn?a.config.colors:e:a.config[t].colors.slice(),i.pushExtraColors(a.globals[t].colors)}))}},{key:"applyDataLabelsColors",value:function(t){var e=this.w;e.globals.dataLabels.style.colors=void 0===e.config.dataLabels.style.colors?t:e.config.dataLabels.style.colors.slice(),this.pushExtraColors(e.globals.dataLabels.style.colors,50)}},{key:"applyRadarPolygonsColors",value:function(){var t=this.w;t.globals.radarPolygons.fill.colors=void 0===t.config.plotOptions.radar.polygons.fill.colors?["dark"===t.config.theme.mode?"#424242":"none"]:t.config.plotOptions.radar.polygons.fill.colors.slice(),this.pushExtraColors(t.globals.radarPolygons.fill.colors,20)}},{key:"applyMarkersColors",value:function(t){var e=this.w;e.globals.markers.colors=void 0===e.config.markers.colors?t:e.config.markers.colors.slice(),this.pushExtraColors(e.globals.markers.colors)}},{key:"pushExtraColors",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=this.w,s=e||a.globals.series.length;if(null===i&&(i=this.isBarDistributed||this.isHeatmapDistributed||"heatmap"===a.config.chart.type&&a.config.plotOptions.heatmap&&a.config.plotOptions.heatmap.colorScale.inverse),i&&a.globals.series.length&&(s=a.globals.series[a.globals.maxValsInArrayIndex].length*a.globals.series.length),t.lengtht.globals.svgWidth&&(this.dCtx.lgRect.width=t.globals.svgWidth/1.5),this.dCtx.lgRect}},{key:"getDatalabelsRect",value:function(){var t=this,e=this.w,i=[];e.config.series.forEach((function(s,r){s.data.forEach((function(s,n){var o;o=e.globals.series[r][n],a=e.config.dataLabels.formatter(o,{ctx:t.dCtx.ctx,seriesIndex:r,dataPointIndex:n,w:e}),i.push(a)}))}));var a=v.getLargestStringFromArr(i),s=new Mi(this.dCtx.ctx),r=e.config.dataLabels.style,n=s.getTextRects(a,parseInt(r.fontSize),r.fontFamily);return{width:1.05*n.width,height:n.height}}},{key:"getLargestStringFromMultiArr",value:function(t,e){var i=t;if(this.w.globals.isMultiLineX){var a=e.map((function(t,e){return Array.isArray(t)?t.length:1})),s=Math.max.apply(Math,f(a));i=e[a.indexOf(s)]}return i}}]),t}(),da=function(){function t(e){i(this,t),this.w=e.w,this.dCtx=e}return s(t,[{key:"getxAxisLabelsCoords",value:function(){var t,e=this.w,i=e.globals.labels.slice();if(e.config.xaxis.convertedCatToNumeric&&0===i.length&&(i=e.globals.categoryLabels),e.globals.timescaleLabels.length>0){var a=this.getxAxisTimeScaleLabelsCoords();t={width:a.width,height:a.height},e.globals.rotateXLabels=!1}else{this.dCtx.lgWidthForSideLegends="left"!==e.config.legend.position&&"right"!==e.config.legend.position||e.config.legend.floating?0:this.dCtx.lgRect.width;var s=e.globals.xLabelFormatter,r=v.getLargestStringFromArr(i),n=this.dCtx.dimHelpers.getLargestStringFromMultiArr(r,i);e.globals.isBarHorizontal&&(n=r=e.globals.yAxisScale[0].result.reduce((function(t,e){return t.length>e.length?t:e}),0));var o=new Xi(this.dCtx.ctx),l=r;r=o.xLabelFormat(s,r,l,{i:void 0,dateFormatter:new zi(this.dCtx.ctx).formatDate,w:e}),n=o.xLabelFormat(s,n,l,{i:void 0,dateFormatter:new zi(this.dCtx.ctx).formatDate,w:e}),(e.config.xaxis.convertedCatToNumeric&&void 0===r||""===String(r).trim())&&(n=r="1");var h=new Mi(this.dCtx.ctx),c=h.getTextRects(r,e.config.xaxis.labels.style.fontSize),d=c;if(r!==n&&(d=h.getTextRects(n,e.config.xaxis.labels.style.fontSize)),(t={width:c.width>=d.width?c.width:d.width,height:c.height>=d.height?c.height:d.height}).width*i.length>e.globals.svgWidth-this.dCtx.lgWidthForSideLegends-this.dCtx.yAxisWidth-this.dCtx.gridPad.left-this.dCtx.gridPad.right&&0!==e.config.xaxis.labels.rotate||e.config.xaxis.labels.rotateAlways){if(!e.globals.isBarHorizontal){e.globals.rotateXLabels=!0;var u=function(t){return h.getTextRects(t,e.config.xaxis.labels.style.fontSize,e.config.xaxis.labels.style.fontFamily,"rotate(".concat(e.config.xaxis.labels.rotate," 0 0)"),!1)};c=u(r),r!==n&&(d=u(n)),t.height=(c.height>d.height?c.height:d.height)/1.5,t.width=c.width>d.width?c.width:d.width}}else e.globals.rotateXLabels=!1}return e.config.xaxis.labels.show||(t={width:0,height:0}),{width:t.width,height:t.height}}},{key:"getxAxisGroupLabelsCoords",value:function(){var t,e=this.w;if(!e.globals.hasXaxisGroups)return{width:0,height:0};var i,a=(null===(t=e.config.xaxis.group.style)||void 0===t?void 0:t.fontSize)||e.config.xaxis.labels.style.fontSize,s=e.globals.groups.map((function(t){return t.title})),r=v.getLargestStringFromArr(s),n=this.dCtx.dimHelpers.getLargestStringFromMultiArr(r,s),o=new Mi(this.dCtx.ctx),l=o.getTextRects(r,a),h=l;return r!==n&&(h=o.getTextRects(n,a)),i={width:l.width>=h.width?l.width:h.width,height:l.height>=h.height?l.height:h.height},e.config.xaxis.labels.show||(i={width:0,height:0}),{width:i.width,height:i.height}}},{key:"getxAxisTitleCoords",value:function(){var t=this.w,e=0,i=0;if(void 0!==t.config.xaxis.title.text){var a=new Mi(this.dCtx.ctx).getTextRects(t.config.xaxis.title.text,t.config.xaxis.title.style.fontSize);e=a.width,i=a.height}return{width:e,height:i}}},{key:"getxAxisTimeScaleLabelsCoords",value:function(){var t,e=this.w;this.dCtx.timescaleLabels=e.globals.timescaleLabels.slice();var i=this.dCtx.timescaleLabels.map((function(t){return t.value})),a=i.reduce((function(t,e){return void 0===t?(console.error("You have possibly supplied invalid Date format. Please supply a valid JavaScript Date"),0):t.length>e.length?t:e}),0);return 1.05*(t=new Mi(this.dCtx.ctx).getTextRects(a,e.config.xaxis.labels.style.fontSize)).width*i.length>e.globals.gridWidth&&0!==e.config.xaxis.labels.rotate&&(e.globals.overlappingXLabels=!0),t}},{key:"additionalPaddingXLabels",value:function(t){var e=this,i=this.w,a=i.globals,s=i.config,r=s.xaxis.type,n=t.width;a.skipLastTimelinelabel=!1,a.skipFirstTimelinelabel=!1;var o=i.config.yaxis[0].opposite&&i.globals.isBarHorizontal,l=function(t,o){s.yaxis.length>1&&function(t){return-1!==a.collapsedSeriesIndices.indexOf(t)}(o)||function(t){if(e.dCtx.timescaleLabels&&e.dCtx.timescaleLabels.length){var o=e.dCtx.timescaleLabels[0],l=e.dCtx.timescaleLabels[e.dCtx.timescaleLabels.length-1].position+n/1.75-e.dCtx.yAxisWidthRight,h=o.position-n/1.75+e.dCtx.yAxisWidthLeft,c="right"===i.config.legend.position&&e.dCtx.lgRect.width>0?e.dCtx.lgRect.width:0;l>a.svgWidth-a.translateX-c&&(a.skipLastTimelinelabel=!0),h<-(t.show&&!t.floating||"bar"!==s.chart.type&&"candlestick"!==s.chart.type&&"rangeBar"!==s.chart.type&&"boxPlot"!==s.chart.type?10:n/1.75)&&(a.skipFirstTimelinelabel=!0)}else"datetime"===r?e.dCtx.gridPad.right(null===(a=String(c(e,o)))||void 0===a?void 0:a.length)?t:e}),d),g=u=c(u,o);if(void 0!==u&&0!==u.length||(u=l.niceMax),e.globals.isBarHorizontal){a=0;var p=e.globals.labels.slice();u=v.getLargestStringFromArr(p),u=c(u,{seriesIndex:n,dataPointIndex:-1,w:e}),g=t.dCtx.dimHelpers.getLargestStringFromMultiArr(u,p)}var f=new Mi(t.dCtx.ctx),x="rotate(".concat(r.labels.rotate," 0 0)"),b=f.getTextRects(u,r.labels.style.fontSize,r.labels.style.fontFamily,x,!1),m=b;u!==g&&(m=f.getTextRects(g,r.labels.style.fontSize,r.labels.style.fontFamily,x,!1)),i.push({width:(h>m.width||h>b.width?h:m.width>b.width?m.width:b.width)+a,height:m.height>b.height?m.height:b.height})}else i.push({width:0,height:0})})),i}},{key:"getyAxisTitleCoords",value:function(){var t=this,e=this.w,i=[];return e.config.yaxis.map((function(e,a){if(e.show&&void 0!==e.title.text){var s=new Mi(t.dCtx.ctx),r="rotate(".concat(e.title.rotate," 0 0)"),n=s.getTextRects(e.title.text,e.title.style.fontSize,e.title.style.fontFamily,r,!1);i.push({width:n.width,height:n.height})}else i.push({width:0,height:0})})),i}},{key:"getTotalYAxisWidth",value:function(){var t=this.w,e=0,i=0,a=0,s=t.globals.yAxisScale.length>1?10:0,r=new Ri(this.dCtx.ctx),n=function(n,o){var l=t.config.yaxis[o].floating,h=0;n.width>0&&!l?(h=n.width+s,function(e){return t.globals.ignoreYAxisIndexes.indexOf(e)>-1}(o)&&(h=h-n.width-s)):h=l||r.isYAxisHidden(o)?0:5,t.config.yaxis[o].opposite?a+=h:i+=h,e+=h};return t.globals.yLabelsCoords.map((function(t,e){n(t,e)})),t.globals.yTitleCoords.map((function(t,e){n(t,e)})),t.globals.isBarHorizontal&&!t.config.yaxis[0].floating&&(e=t.globals.yLabelsCoords[0].width+t.globals.yTitleCoords[0].width+15),this.dCtx.yAxisWidthLeft=i,this.dCtx.yAxisWidthRight=a,e}}]),t}(),ga=function(){function t(e){i(this,t),this.w=e.w,this.dCtx=e}return s(t,[{key:"gridPadForColumnsInNumericAxis",value:function(t){var e=this.w,i=e.config,a=e.globals;if(a.noData||a.collapsedSeries.length+a.ancillaryCollapsedSeries.length===i.series.length)return 0;var s=function(t){return["bar","rangeBar","candlestick","boxPlot"].includes(t)},r=i.chart.type,n=0,o=s(r)?i.series.length:1;a.comboBarCount>0&&(o=a.comboBarCount),a.collapsedSeries.forEach((function(t){s(t.type)&&(o-=1)})),i.chart.stacked&&(o=1);var l=s(r)||a.comboBarCount>0,h=Math.abs(a.initialMaxX-a.initialMinX);if(l&&a.isXNumeric&&!a.isBarHorizontal&&o>0&&0!==h){h<=3&&(h=a.dataPoints);var c=h/t,d=a.minXDiff&&a.minXDiff/c>0?a.minXDiff/c:0;d>t/2&&(d/=2),(n=d*parseInt(i.plotOptions.bar.columnWidth,10)/100)<1&&(n=1),a.barPadForNumericAxis=n}return n}},{key:"gridPadFortitleSubtitle",value:function(){var t=this,e=this.w,i=e.globals,a=this.dCtx.isSparkline||!i.axisCharts?0:10;["title","subtitle"].forEach((function(s){void 0!==e.config[s].text?a+=e.config[s].margin:a+=t.dCtx.isSparkline||!i.axisCharts?0:5})),!e.config.legend.show||"bottom"!==e.config.legend.position||e.config.legend.floating||i.axisCharts||(a+=10);var s=this.dCtx.dimHelpers.getTitleSubtitleCoords("title"),r=this.dCtx.dimHelpers.getTitleSubtitleCoords("subtitle");i.gridHeight-=s.height+r.height+a,i.translateY+=s.height+r.height+a}},{key:"setGridXPosForDualYAxis",value:function(t,e){var i=this.w,a=new Ri(this.dCtx.ctx);i.config.yaxis.forEach((function(s,r){-1!==i.globals.ignoreYAxisIndexes.indexOf(r)||s.floating||a.isYAxisHidden(r)||(s.opposite&&(i.globals.translateX-=e[r].width+t[r].width+parseInt(s.labels.style.fontSize,10)/1.2+12),i.globals.translateX<2&&(i.globals.translateX=2))}))}}]),t}(),pa=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.lgRect={},this.yAxisWidth=0,this.yAxisWidthLeft=0,this.yAxisWidthRight=0,this.xAxisHeight=0,this.isSparkline=this.w.config.chart.sparkline.enabled,this.dimHelpers=new ca(this),this.dimYAxis=new ua(this),this.dimXAxis=new da(this),this.dimGrid=new ga(this),this.lgWidthForSideLegends=0,this.gridPad=this.w.config.grid.padding,this.xPadRight=0,this.xPadLeft=0}return s(t,[{key:"plotCoords",value:function(){var t=this,e=this.w,i=e.globals;this.lgRect=this.dimHelpers.getLegendsRect(),this.datalabelsCoords={width:0,height:0};var a=Array.isArray(e.config.stroke.width)?Math.max.apply(Math,f(e.config.stroke.width)):e.config.stroke.width;this.isSparkline&&((e.config.markers.discrete.length>0||e.config.markers.size>0)&&Object.entries(this.gridPad).forEach((function(e){var i=p(e,2),a=i[0],s=i[1];t.gridPad[a]=Math.max(s,t.w.globals.markers.largestSize/1.5)})),this.gridPad.top=Math.max(a/2,this.gridPad.top),this.gridPad.bottom=Math.max(a/2,this.gridPad.bottom)),i.axisCharts?this.setDimensionsForAxisCharts():this.setDimensionsForNonAxisCharts(),this.dimGrid.gridPadFortitleSubtitle(),i.gridHeight=i.gridHeight-this.gridPad.top-this.gridPad.bottom,i.gridWidth=i.gridWidth-this.gridPad.left-this.gridPad.right-this.xPadRight-this.xPadLeft;var s=this.dimGrid.gridPadForColumnsInNumericAxis(i.gridWidth);i.gridWidth=i.gridWidth-2*s,i.translateX=i.translateX+this.gridPad.left+this.xPadLeft+(s>0?s:0),i.translateY=i.translateY+this.gridPad.top}},{key:"setDimensionsForAxisCharts",value:function(){var t=this,e=this.w,i=e.globals,a=this.dimYAxis.getyAxisLabelsCoords(),s=this.dimYAxis.getyAxisTitleCoords();i.isSlopeChart&&(this.datalabelsCoords=this.dimHelpers.getDatalabelsRect()),e.globals.yLabelsCoords=[],e.globals.yTitleCoords=[],e.config.yaxis.map((function(t,i){e.globals.yLabelsCoords.push({width:a[i].width,index:i}),e.globals.yTitleCoords.push({width:s[i].width,index:i})})),this.yAxisWidth=this.dimYAxis.getTotalYAxisWidth();var r=this.dimXAxis.getxAxisLabelsCoords(),n=this.dimXAxis.getxAxisGroupLabelsCoords(),o=this.dimXAxis.getxAxisTitleCoords();this.conditionalChecksForAxisCoords(r,o,n),i.translateXAxisY=e.globals.rotateXLabels?this.xAxisHeight/8:-4,i.translateXAxisX=e.globals.rotateXLabels&&e.globals.isXNumeric&&e.config.xaxis.labels.rotate<=-45?-this.xAxisWidth/4:0,e.globals.isBarHorizontal&&(i.rotateXLabels=!1,i.translateXAxisY=parseInt(e.config.xaxis.labels.style.fontSize,10)/1.5*-1),i.translateXAxisY=i.translateXAxisY+e.config.xaxis.labels.offsetY,i.translateXAxisX=i.translateXAxisX+e.config.xaxis.labels.offsetX;var l=this.yAxisWidth,h=this.xAxisHeight;i.xAxisLabelsHeight=this.xAxisHeight-o.height,i.xAxisGroupLabelsHeight=i.xAxisLabelsHeight-r.height,i.xAxisLabelsWidth=this.xAxisWidth,i.xAxisHeight=this.xAxisHeight;var c=10;("radar"===e.config.chart.type||this.isSparkline)&&(l=0,h=0),this.isSparkline&&(this.lgRect={height:0,width:0}),(this.isSparkline||"treemap"===e.config.chart.type)&&(l=0,h=0,c=0),this.isSparkline||"treemap"===e.config.chart.type||this.dimXAxis.additionalPaddingXLabels(r);var d=function(){i.translateX=l+t.datalabelsCoords.width,i.gridHeight=i.svgHeight-t.lgRect.height-h-(t.isSparkline||"treemap"===e.config.chart.type?0:e.globals.rotateXLabels?10:15),i.gridWidth=i.svgWidth-l-2*t.datalabelsCoords.width};switch("top"===e.config.xaxis.position&&(c=i.xAxisHeight-e.config.xaxis.axisTicks.height-5),e.config.legend.position){case"bottom":i.translateY=c,d();break;case"top":i.translateY=this.lgRect.height+c,d();break;case"left":i.translateY=c,i.translateX=this.lgRect.width+l+this.datalabelsCoords.width,i.gridHeight=i.svgHeight-h-12,i.gridWidth=i.svgWidth-this.lgRect.width-l-2*this.datalabelsCoords.width;break;case"right":i.translateY=c,i.translateX=l+this.datalabelsCoords.width,i.gridHeight=i.svgHeight-h-12,i.gridWidth=i.svgWidth-this.lgRect.width-l-2*this.datalabelsCoords.width-5;break;default:throw new Error("Legend position not supported")}this.dimGrid.setGridXPosForDualYAxis(s,a),new ia(this.ctx).setYAxisXPosition(a,s)}},{key:"setDimensionsForNonAxisCharts",value:function(){var t=this.w,e=t.globals,i=t.config,a=0;t.config.legend.show&&!t.config.legend.floating&&(a=20);var s="pie"===i.chart.type||"polarArea"===i.chart.type||"donut"===i.chart.type?"pie":"radialBar",r=i.plotOptions[s].offsetY,n=i.plotOptions[s].offsetX;if(!i.legend.show||i.legend.floating){e.gridHeight=e.svgHeight;var o=e.dom.elWrap.getBoundingClientRect().width;return e.gridWidth=Math.min(o,e.gridHeight),e.translateY=r,void(e.translateX=n+(e.svgWidth-e.gridWidth)/2)}switch(i.legend.position){case"bottom":e.gridHeight=e.svgHeight-this.lgRect.height,e.gridWidth=e.svgWidth,e.translateY=r-10,e.translateX=n+(e.svgWidth-e.gridWidth)/2;break;case"top":e.gridHeight=e.svgHeight-this.lgRect.height,e.gridWidth=e.svgWidth,e.translateY=this.lgRect.height+r+10,e.translateX=n+(e.svgWidth-e.gridWidth)/2;break;case"left":e.gridWidth=e.svgWidth-this.lgRect.width-a,e.gridHeight="auto"!==i.chart.height?e.svgHeight:e.gridWidth,e.translateY=r,e.translateX=n+this.lgRect.width+a;break;case"right":e.gridWidth=e.svgWidth-this.lgRect.width-a-5,e.gridHeight="auto"!==i.chart.height?e.svgHeight:e.gridWidth,e.translateY=r,e.translateX=n+10;break;default:throw new Error("Legend position not supported")}}},{key:"conditionalChecksForAxisCoords",value:function(t,e,i){var a=this.w,s=a.globals.hasXaxisGroups?2:1,r=i.height+t.height+e.height,n=a.globals.isMultiLineX?1.2:a.globals.LINE_HEIGHT_RATIO,o=a.globals.rotateXLabels?22:10,l=a.globals.rotateXLabels&&"bottom"===a.config.legend.position?10:0;this.xAxisHeight=r*n+s*o+l,this.xAxisWidth=t.width,this.xAxisHeight-e.height>a.config.xaxis.labels.maxHeight&&(this.xAxisHeight=a.config.xaxis.labels.maxHeight),a.config.xaxis.labels.minHeight&&this.xAxisHeightc&&(this.yAxisWidth=c)}}]),t}(),fa=function(){function t(e){i(this,t),this.w=e.w,this.lgCtx=e}return s(t,[{key:"getLegendStyles",value:function(){var t,e,i,a=document.createElement("style");a.setAttribute("type","text/css");var s=(null===(t=this.lgCtx.ctx)||void 0===t||null===(e=t.opts)||void 0===e||null===(i=e.chart)||void 0===i?void 0:i.nonce)||this.w.config.chart.nonce;s&&a.setAttribute("nonce",s);var r=document.createTextNode("\n .apexcharts-flip-y {\n transform: scaleY(-1) translateY(-100%);\n transform-origin: top;\n transform-box: fill-box;\n }\n .apexcharts-flip-x {\n transform: scaleX(-1);\n transform-origin: center;\n transform-box: fill-box;\n }\n .apexcharts-legend {\n display: flex;\n overflow: auto;\n padding: 0 10px;\n }\n .apexcharts-legend.apexcharts-legend-group-horizontal {\n flex-direction: column;\n }\n .apexcharts-legend-group {\n display: flex;\n }\n .apexcharts-legend-group-vertical {\n flex-direction: column-reverse;\n }\n .apexcharts-legend.apx-legend-position-bottom, .apexcharts-legend.apx-legend-position-top {\n flex-wrap: wrap\n }\n .apexcharts-legend.apx-legend-position-right, .apexcharts-legend.apx-legend-position-left {\n flex-direction: column;\n bottom: 0;\n }\n .apexcharts-legend.apx-legend-position-bottom.apexcharts-align-left, .apexcharts-legend.apx-legend-position-top.apexcharts-align-left, .apexcharts-legend.apx-legend-position-right, .apexcharts-legend.apx-legend-position-left {\n justify-content: flex-start;\n align-items: flex-start;\n }\n .apexcharts-legend.apx-legend-position-bottom.apexcharts-align-center, .apexcharts-legend.apx-legend-position-top.apexcharts-align-center {\n justify-content: center;\n align-items: center;\n }\n .apexcharts-legend.apx-legend-position-bottom.apexcharts-align-right, .apexcharts-legend.apx-legend-position-top.apexcharts-align-right {\n justify-content: flex-end;\n align-items: flex-end;\n }\n .apexcharts-legend-series {\n cursor: pointer;\n line-height: normal;\n display: flex;\n align-items: center;\n }\n .apexcharts-legend-text {\n position: relative;\n font-size: 14px;\n }\n .apexcharts-legend-text *, .apexcharts-legend-marker * {\n pointer-events: none;\n }\n .apexcharts-legend-marker {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n margin-right: 1px;\n }\n\n .apexcharts-legend-series.apexcharts-no-click {\n cursor: auto;\n }\n .apexcharts-legend .apexcharts-hidden-zero-series, .apexcharts-legend .apexcharts-hidden-null-series {\n display: none !important;\n }\n .apexcharts-inactive-legend {\n opacity: 0.45;\n }\n\n ");return a.appendChild(r),a}},{key:"getLegendDimensions",value:function(){var t=this.w.globals.dom.baseEl.querySelector(".apexcharts-legend").getBoundingClientRect(),e=t.width;return{clwh:t.height,clww:e}}},{key:"appendToForeignObject",value:function(){this.w.globals.dom.elLegendForeign.appendChild(this.getLegendStyles())}},{key:"toggleDataSeries",value:function(t,e){var i=this,a=this.w;if(a.globals.axisCharts||"radialBar"===a.config.chart.type){a.globals.resized=!0;var s=null,r=null;if(a.globals.risingSeries=[],a.globals.axisCharts?(s=a.globals.dom.baseEl.querySelector(".apexcharts-series[data\\:realIndex='".concat(t,"']")),r=parseInt(s.getAttribute("data:realIndex"),10)):(s=a.globals.dom.baseEl.querySelector(".apexcharts-series[rel='".concat(t+1,"']")),r=parseInt(s.getAttribute("rel"),10)-1),e)[{cs:a.globals.collapsedSeries,csi:a.globals.collapsedSeriesIndices},{cs:a.globals.ancillaryCollapsedSeries,csi:a.globals.ancillaryCollapsedSeriesIndices}].forEach((function(t){i.riseCollapsedSeries(t.cs,t.csi,r)}));else this.hideSeries({seriesEl:s,realIndex:r})}else{var n=a.globals.dom.Paper.findOne(" .apexcharts-series[rel='".concat(t+1,"'] path")),o=a.config.chart.type;if("pie"===o||"polarArea"===o||"donut"===o){var l=a.config.plotOptions.pie.donut.labels;new Mi(this.lgCtx.ctx).pathMouseDown(n,null),this.lgCtx.ctx.pie.printDataLabelsInner(n.node,l)}n.fire("click")}}},{key:"getSeriesAfterCollapsing",value:function(t){var e=t.realIndex,i=this.w,a=i.globals,s=v.clone(i.config.series);if(a.axisCharts){var r=i.config.yaxis[a.seriesYAxisReverseMap[e]],n={index:e,data:s[e].data.slice(),type:s[e].type||i.config.chart.type};if(r&&r.show&&r.showAlways)a.ancillaryCollapsedSeriesIndices.indexOf(e)<0&&(a.ancillaryCollapsedSeries.push(n),a.ancillaryCollapsedSeriesIndices.push(e));else if(a.collapsedSeriesIndices.indexOf(e)<0){a.collapsedSeries.push(n),a.collapsedSeriesIndices.push(e);var o=a.risingSeries.indexOf(e);a.risingSeries.splice(o,1)}}else a.collapsedSeries.push({index:e,data:s[e]}),a.collapsedSeriesIndices.push(e);return a.allSeriesCollapsed=a.collapsedSeries.length+a.ancillaryCollapsedSeries.length===i.config.series.length,this._getSeriesBasedOnCollapsedState(s)}},{key:"hideSeries",value:function(t){for(var e=t.seriesEl,i=t.realIndex,a=this.w,s=this.getSeriesAfterCollapsing({realIndex:i}),r=e.childNodes,n=0;n0){for(var r=0;r1;if(this.legendHelpers.appendToForeignObject(),(a||!e.axisCharts)&&i.legend.show){for(;e.dom.elLegendWrap.firstChild;)e.dom.elLegendWrap.removeChild(e.dom.elLegendWrap.firstChild);this.drawLegends(),"bottom"===i.legend.position||"top"===i.legend.position?this.legendAlignHorizontal():"right"!==i.legend.position&&"left"!==i.legend.position||this.legendAlignVertical()}}},{key:"createLegendMarker",value:function(t){var e=t.i,i=t.fillcolor,a=this.w,s=document.createElement("span");s.classList.add("apexcharts-legend-marker");var r=a.config.legend.markers.shape||a.config.markers.shape,n=r;Array.isArray(r)&&(n=r[e]);var o=Array.isArray(a.config.legend.markers.size)?parseFloat(a.config.legend.markers.size[e]):parseFloat(a.config.legend.markers.size),l=Array.isArray(a.config.legend.markers.offsetX)?parseFloat(a.config.legend.markers.offsetX[e]):parseFloat(a.config.legend.markers.offsetX),h=Array.isArray(a.config.legend.markers.offsetY)?parseFloat(a.config.legend.markers.offsetY[e]):parseFloat(a.config.legend.markers.offsetY),c=Array.isArray(a.config.legend.markers.strokeWidth)?parseFloat(a.config.legend.markers.strokeWidth[e]):parseFloat(a.config.legend.markers.strokeWidth),d=s.style;if(d.height=2*(o+c)+"px",d.width=2*(o+c)+"px",d.left=l+"px",d.top=h+"px",a.config.legend.markers.customHTML)d.background="transparent",d.color=i[e],Array.isArray(a.config.legend.markers.customHTML)?a.config.legend.markers.customHTML[e]&&(s.innerHTML=a.config.legend.markers.customHTML[e]()):s.innerHTML=a.config.legend.markers.customHTML();else{var g=new Vi(this.ctx).getMarkerConfig({cssClass:"apexcharts-legend-marker apexcharts-marker apexcharts-marker-".concat(n),seriesIndex:e,strokeWidth:c,size:o}),p=window.SVG().addTo(s).size("100%","100%"),f=new Mi(this.ctx).drawMarker(0,0,u(u({},g),{},{pointFillColor:Array.isArray(i)?i[e]:g.pointFillColor,shape:n}));a.globals.dom.Paper.find(".apexcharts-legend-marker.apexcharts-marker").forEach((function(t){t.node.classList.contains("apexcharts-marker-triangle")?t.node.style.transform="translate(50%, 45%)":t.node.style.transform="translate(50%, 50%)"})),p.add(f)}return s}},{key:"drawLegends",value:function(){var t=this,e=this,i=this.w,a=i.config.legend.fontFamily,s=i.globals.seriesNames,r=i.config.legend.markers.fillColors?i.config.legend.markers.fillColors.slice():i.globals.colors.slice();if("heatmap"===i.config.chart.type){var n=i.config.plotOptions.heatmap.colorScale.ranges;s=n.map((function(t){return t.name?t.name:t.from+" - "+t.to})),r=n.map((function(t){return t.color}))}else this.isBarsDistributed&&(s=i.globals.labels.slice());i.config.legend.customLegendItems.length&&(s=i.config.legend.customLegendItems);var o=i.globals.legendFormatter,l=i.config.legend.inverseOrder,h=[];i.globals.seriesGroups.length>1&&i.config.legend.clusterGroupedSeries&&i.globals.seriesGroups.forEach((function(t,e){h[e]=document.createElement("div"),h[e].classList.add("apexcharts-legend-group","apexcharts-legend-group-".concat(e)),"horizontal"===i.config.legend.clusterGroupedSeriesOrientation?i.globals.dom.elLegendWrap.classList.add("apexcharts-legend-group-horizontal"):h[e].classList.add("apexcharts-legend-group-vertical")}));for(var c=function(e){var n,l=o(s[e],{seriesIndex:e,w:i}),c=!1,d=!1;if(i.globals.collapsedSeries.length>0)for(var u=0;u0)for(var g=0;g=0:d<=s.length-1;l?d--:d++)c(d);i.globals.dom.elWrap.addEventListener("click",e.onLegendClick,!0),i.config.legend.onItemHover.highlightDataSeries&&0===i.config.legend.customLegendItems.length&&(i.globals.dom.elWrap.addEventListener("mousemove",e.onLegendHovered,!0),i.globals.dom.elWrap.addEventListener("mouseout",e.onLegendHovered,!0))}},{key:"setLegendWrapXY",value:function(t,e){var i=this.w,a=i.globals.dom.elLegendWrap,s=a.clientHeight,r=0,n=0;if("bottom"===i.config.legend.position)n=i.globals.svgHeight-Math.min(s,i.globals.svgHeight/2)-5;else if("top"===i.config.legend.position){var o=new pa(this.ctx),l=o.dimHelpers.getTitleSubtitleCoords("title").height,h=o.dimHelpers.getTitleSubtitleCoords("subtitle").height;n=(l>0?l-10:0)+(h>0?h-10:0)}a.style.position="absolute",r=r+t+i.config.legend.offsetX,n=n+e+i.config.legend.offsetY,a.style.left=r+"px",a.style.top=n+"px","right"===i.config.legend.position&&(a.style.left="auto",a.style.right=25+i.config.legend.offsetX+"px");["width","height"].forEach((function(t){a.style[t]&&(a.style[t]=parseInt(i.config.legend[t],10)+"px")}))}},{key:"legendAlignHorizontal",value:function(){var t=this.w;t.globals.dom.elLegendWrap.style.right=0;var e=new pa(this.ctx),i=e.dimHelpers.getTitleSubtitleCoords("title"),a=e.dimHelpers.getTitleSubtitleCoords("subtitle"),s=0;"top"===t.config.legend.position&&(s=i.height+a.height+t.config.title.margin+t.config.subtitle.margin-10),this.setLegendWrapXY(20,s)}},{key:"legendAlignVertical",value:function(){var t=this.w,e=this.legendHelpers.getLegendDimensions(),i=0;"left"===t.config.legend.position&&(i=20),"right"===t.config.legend.position&&(i=t.globals.svgWidth-e.clww-10),this.setLegendWrapXY(i,20)}},{key:"onLegendHovered",value:function(t){var e=this.w,i=t.target.classList.contains("apexcharts-legend-series")||t.target.classList.contains("apexcharts-legend-text")||t.target.classList.contains("apexcharts-legend-marker");if("heatmap"===e.config.chart.type||this.isBarsDistributed){if(i){var a=parseInt(t.target.getAttribute("rel"),10)-1;this.ctx.events.fireEvent("legendHover",[this.ctx,a,this.w]),new Zi(this.ctx).highlightRangeInSeries(t,t.target)}}else!t.target.classList.contains("apexcharts-inactive-legend")&&i&&new Zi(this.ctx).toggleSeriesOnHover(t,t.target)}},{key:"onLegendClick",value:function(t){var e=this.w;if(!e.config.legend.customLegendItems.length&&(t.target.classList.contains("apexcharts-legend-series")||t.target.classList.contains("apexcharts-legend-text")||t.target.classList.contains("apexcharts-legend-marker"))){var i=parseInt(t.target.getAttribute("rel"),10)-1,a="true"===t.target.getAttribute("data:collapsed"),s=this.w.config.chart.events.legendClick;"function"==typeof s&&s(this.ctx,i,this.w),this.ctx.events.fireEvent("legendClick",[this.ctx,i,this.w]);var r=this.w.config.legend.markers.onClick;"function"==typeof r&&t.target.classList.contains("apexcharts-legend-marker")&&(r(this.ctx,i,this.w),this.ctx.events.fireEvent("legendMarkerClick",[this.ctx,i,this.w])),"treemap"!==e.config.chart.type&&"heatmap"!==e.config.chart.type&&!this.isBarsDistributed&&e.config.legend.onItemClick.toggleDataSeries&&this.legendHelpers.toggleDataSeries(i,a)}}}]),t}(),ba=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w;var a=this.w;this.ev=this.w.config.chart.events,this.selectedClass="apexcharts-selected",this.localeValues=this.w.globals.locale.toolbar,this.minX=a.globals.minX,this.maxX=a.globals.maxX}return s(t,[{key:"createToolbar",value:function(){var t=this,e=this.w,i=function(){return document.createElement("div")},a=i();if(a.setAttribute("class","apexcharts-toolbar"),a.style.top=e.config.chart.toolbar.offsetY+"px",a.style.right=3-e.config.chart.toolbar.offsetX+"px",e.globals.dom.elWrap.appendChild(a),this.elZoom=i(),this.elZoomIn=i(),this.elZoomOut=i(),this.elPan=i(),this.elSelection=i(),this.elZoomReset=i(),this.elMenuIcon=i(),this.elMenu=i(),this.elCustomIcons=[],this.t=e.config.chart.toolbar.tools,Array.isArray(this.t.customIcons))for(var s=0;s\n \n \n\n'),n("zoomOut",this.elZoomOut,'\n \n \n\n');var o=function(i){t.t[i]&&e.config.chart[i].enabled&&r.push({el:"zoom"===i?t.elZoom:t.elSelection,icon:"string"==typeof t.t[i]?t.t[i]:"zoom"===i?'\n \n \n \n':'\n \n \n',title:t.localeValues["zoom"===i?"selectionZoom":"selection"],class:e.globals.isTouchDevice?"apexcharts-element-hidden":"apexcharts-".concat(i,"-icon")})};o("zoom"),o("selection"),this.t.pan&&e.config.chart.zoom.enabled&&r.push({el:this.elPan,icon:"string"==typeof this.t.pan?this.t.pan:'\n \n \n \n \n \n \n \n',title:this.localeValues.pan,class:e.globals.isTouchDevice?"apexcharts-element-hidden":"apexcharts-pan-icon"}),n("reset",this.elZoomReset,'\n \n \n'),this.t.download&&r.push({el:this.elMenuIcon,icon:"string"==typeof this.t.download?this.t.download:'',title:this.localeValues.menu,class:"apexcharts-menu-icon"});for(var l=0;lthis.wheelDelay&&(this.executeMouseWheelZoom(t),i.globals.lastWheelExecution=a),this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout((function(){a-i.globals.lastWheelExecution>e.wheelDelay&&(e.executeMouseWheelZoom(t),i.globals.lastWheelExecution=a)}),this.debounceDelay)}},{key:"executeMouseWheelZoom",value:function(t){var e,i=this.w;this.minX=i.globals.isRangeBar?i.globals.minY:i.globals.minX,this.maxX=i.globals.isRangeBar?i.globals.maxY:i.globals.maxX;var a=null===(e=this.gridRect)||void 0===e?void 0:e.getBoundingClientRect();if(a){var s,r,n,o=(t.clientX-a.left)/a.width,l=this.minX,h=this.maxX,c=h-l;if(t.deltaY<0){var d=l+o*c;r=d-(s=.5*c)/2,n=d+s/2}else r=l-(s=1.5*c)/2,n=h+s/2;if(!i.globals.isRangeBar){r=Math.max(r,i.globals.initialMinX),n=Math.min(n,i.globals.initialMaxX);var u=.01*(i.globals.initialMaxX-i.globals.initialMinX);if(n-r0&&i.height>0&&(this.selectionRect.select(!1).resize(!1),this.selectionRect.select({createRot:function(){},updateRot:function(){},createHandle:function(t,e,i,a,s){return"l"===s||"r"===s?t.circle(8).css({"stroke-width":1,stroke:"#333",fill:"#fff"}):t.circle(0)},updateHandle:function(t,e){return t.center(e[0],e[1])}}).resize().on("resize",(function(){var i=e.globals.zoomEnabled?e.config.chart.zoom.type:e.config.chart.selection.type;t.handleMouseUp({zoomtype:i,isResized:!0})})))}}},{key:"preselectedSelection",value:function(){var t=this.w,e=this.xyRatios;if(!t.globals.zoomEnabled)if(void 0!==t.globals.selection&&null!==t.globals.selection)this.drawSelectionRect(u(u({},t.globals.selection),{},{translateX:t.globals.translateX,translateY:t.globals.translateY}));else if(void 0!==t.config.chart.selection.xaxis.min&&void 0!==t.config.chart.selection.xaxis.max){var i=(t.config.chart.selection.xaxis.min-t.globals.minX)/e.xRatio,a=t.globals.gridWidth-(t.globals.maxX-t.config.chart.selection.xaxis.max)/e.xRatio-i;t.globals.isRangeBar&&(i=(t.config.chart.selection.xaxis.min-t.globals.yAxisScale[0].niceMin)/e.invertedYRatio,a=(t.config.chart.selection.xaxis.max-t.config.chart.selection.xaxis.min)/e.invertedYRatio);var s={x:i,y:0,width:a,height:t.globals.gridHeight,translateX:t.globals.translateX,translateY:t.globals.translateY,selectionEnabled:!0};this.drawSelectionRect(s),this.makeSelectionRectDraggable(),"function"==typeof t.config.chart.events.selection&&t.config.chart.events.selection(this.ctx,{xaxis:{min:t.config.chart.selection.xaxis.min,max:t.config.chart.selection.xaxis.max},yaxis:{}})}}},{key:"drawSelectionRect",value:function(t){var e=t.x,i=t.y,a=t.width,s=t.height,r=t.translateX,n=void 0===r?0:r,o=t.translateY,l=void 0===o?0:o,h=this.w,c=this.zoomRect,d=this.selectionRect;if(this.dragged||null!==h.globals.selection){var u={transform:"translate("+n+", "+l+")"};h.globals.zoomEnabled&&this.dragged&&(a<0&&(a=1),c.attr({x:e,y:i,width:a,height:s,fill:h.config.chart.zoom.zoomedArea.fill.color,"fill-opacity":h.config.chart.zoom.zoomedArea.fill.opacity,stroke:h.config.chart.zoom.zoomedArea.stroke.color,"stroke-width":h.config.chart.zoom.zoomedArea.stroke.width,"stroke-opacity":h.config.chart.zoom.zoomedArea.stroke.opacity}),Mi.setAttrs(c.node,u)),h.globals.selectionEnabled&&(d.attr({x:e,y:i,width:a>0?a:0,height:s>0?s:0,fill:h.config.chart.selection.fill.color,"fill-opacity":h.config.chart.selection.fill.opacity,stroke:h.config.chart.selection.stroke.color,"stroke-width":h.config.chart.selection.stroke.width,"stroke-dasharray":h.config.chart.selection.stroke.dashArray,"stroke-opacity":h.config.chart.selection.stroke.opacity}),Mi.setAttrs(d.node,u))}}},{key:"hideSelectionRect",value:function(t){t&&t.attr({x:0,y:0,width:0,height:0})}},{key:"selectionDrawing",value:function(t){var e=t.context,i=t.zoomtype,a=this.w,s=e,r=this.gridRect.getBoundingClientRect(),n=s.startX-1,o=s.startY,l=!1,h=!1,c=s.clientX-r.left-a.globals.barPadForNumericAxis,d=s.clientY-r.top,g=c-n,p=d-o,f={translateX:a.globals.translateX,translateY:a.globals.translateY};return Math.abs(g+n)>a.globals.gridWidth?g=a.globals.gridWidth-n:c<0&&(g=n),n>c&&(l=!0,g=Math.abs(g)),o>d&&(h=!0,p=Math.abs(p)),f=u(u({},f="x"===i?{x:l?n-g:n,y:0,width:g,height:a.globals.gridHeight}:"y"===i?{x:0,y:h?o-p:o,width:a.globals.gridWidth,height:p}:{x:l?n-g:n,y:h?o-p:o,width:g,height:p}),{},{translateX:a.globals.translateX,translateY:a.globals.translateY}),s.drawSelectionRect(f),s.selectionDragging("resizing"),f}},{key:"selectionDragging",value:function(t,e){var i=this,a=this.w;if(e){e.preventDefault();var s=e.detail,r=s.handler,n=s.box,o=n.x,l=n.y;othis.constraints.x2&&(o=this.constraints.x2-n.w),n.y2>this.constraints.y2&&(l=this.constraints.y2-n.h),r.move(o,l);var h=this.xyRatios,c=this.selectionRect,d=0;"resizing"===t&&(d=30);var u=function(t){return parseFloat(c.node.getAttribute(t))},g={x:u("x"),y:u("y"),width:u("width"),height:u("height")};a.globals.selection=g,"function"==typeof a.config.chart.events.selection&&a.globals.selectionEnabled&&(clearTimeout(this.w.globals.selectionResizeTimer),this.w.globals.selectionResizeTimer=window.setTimeout((function(){var t,e,s,r,n=i.gridRect.getBoundingClientRect(),o=c.node.getBoundingClientRect();a.globals.isRangeBar?(t=a.globals.yAxisScale[0].niceMin+(o.left-n.left)*h.invertedYRatio,e=a.globals.yAxisScale[0].niceMin+(o.right-n.left)*h.invertedYRatio,s=0,r=1):(t=a.globals.xAxisScale.niceMin+(o.left-n.left)*h.xRatio,e=a.globals.xAxisScale.niceMin+(o.right-n.left)*h.xRatio,s=a.globals.yAxisScale[0].niceMin+(n.bottom-o.bottom)*h.yRatio[0],r=a.globals.yAxisScale[0].niceMax-(o.top-n.top)*h.yRatio[0]);var l={xaxis:{min:t,max:e},yaxis:{min:s,max:r}};a.config.chart.events.selection(i.ctx,l),a.config.chart.brush.enabled&&void 0!==a.config.chart.events.brushScrolled&&a.config.chart.events.brushScrolled(i.ctx,l)}),d))}}},{key:"selectionDrawn",value:function(t){var e,i,a=t.context,s=t.zoomtype,r=this.w,n=a,o=this.xyRatios,l=this.ctx.toolbar,h=r.globals.zoomEnabled?n.zoomRect.node.getBoundingClientRect():n.selectionRect.node.getBoundingClientRect(),c=n.gridRect.getBoundingClientRect(),d=h.left-c.left-r.globals.barPadForNumericAxis,u=h.right-c.left-r.globals.barPadForNumericAxis,g=h.top-c.top,p=h.bottom-c.top;r.globals.isRangeBar?(e=r.globals.yAxisScale[0].niceMin+d*o.invertedYRatio,i=r.globals.yAxisScale[0].niceMin+u*o.invertedYRatio):(e=r.globals.xAxisScale.niceMin+d*o.xRatio,i=r.globals.xAxisScale.niceMin+u*o.xRatio);var f=[],x=[];if(r.config.yaxis.forEach((function(t,e){var i=r.globals.seriesYAxisMap[e][0],a=r.globals.yAxisScale[e].niceMax-o.yRatio[i]*g,s=r.globals.yAxisScale[e].niceMax-o.yRatio[i]*p;f.push(a),x.push(s)})),n.dragged&&(n.dragX>10||n.dragY>10)&&e!==i)if(r.globals.zoomEnabled){var b=v.clone(r.globals.initialConfig.yaxis),m=v.clone(r.globals.initialConfig.xaxis);if(r.globals.zoomed=!0,r.config.xaxis.convertedCatToNumeric&&(e=Math.floor(e),i=Math.floor(i),e<1&&(e=1,i=r.globals.dataPoints),i-e<2&&(i=e+1)),"xy"!==s&&"x"!==s||(m={min:e,max:i}),"xy"!==s&&"y"!==s||b.forEach((function(t,e){b[e].min=x[e],b[e].max=f[e]})),l){var y=l.getBeforeZoomRange(m,b);y&&(m=y.xaxis?y.xaxis:m,b=y.yaxis?y.yaxis:b)}var w={xaxis:m};r.config.chart.group||(w.yaxis=b),n.ctx.updateHelpers._updateOptions(w,!1,n.w.config.chart.animations.dynamicAnimation.enabled),"function"==typeof r.config.chart.events.zoomed&&l.zoomCallback(m,b)}else if(r.globals.selectionEnabled){var k,A=null;k={min:e,max:i},"xy"!==s&&"y"!==s||(A=v.clone(r.config.yaxis)).forEach((function(t,e){A[e].min=x[e],A[e].max=f[e]})),r.globals.selection=n.selection,"function"==typeof r.config.chart.events.selection&&r.config.chart.events.selection(n.ctx,{xaxis:k,yaxis:A})}}},{key:"panDragging",value:function(t){var e=t.context,i=this.w,a=e;if(void 0!==i.globals.lastClientPosition.x){var s=i.globals.lastClientPosition.x-a.clientX,r=i.globals.lastClientPosition.y-a.clientY;Math.abs(s)>Math.abs(r)&&s>0?this.moveDirection="left":Math.abs(s)>Math.abs(r)&&s<0?this.moveDirection="right":Math.abs(r)>Math.abs(s)&&r>0?this.moveDirection="up":Math.abs(r)>Math.abs(s)&&r<0&&(this.moveDirection="down")}i.globals.lastClientPosition={x:a.clientX,y:a.clientY};var n=i.globals.isRangeBar?i.globals.minY:i.globals.minX,o=i.globals.isRangeBar?i.globals.maxY:i.globals.maxX;i.config.xaxis.convertedCatToNumeric||a.panScrolled(n,o)}},{key:"delayedPanScrolled",value:function(){var t=this.w,e=t.globals.minX,i=t.globals.maxX,a=(t.globals.maxX-t.globals.minX)/2;"left"===this.moveDirection?(e=t.globals.minX+a,i=t.globals.maxX+a):"right"===this.moveDirection&&(e=t.globals.minX-a,i=t.globals.maxX-a),e=Math.floor(e),i=Math.floor(i),this.updateScrolledChart({xaxis:{min:e,max:i}},e,i)}},{key:"panScrolled",value:function(t,e){var i=this.w,a=this.xyRatios,s=v.clone(i.globals.initialConfig.yaxis),r=a.xRatio,n=i.globals.minX,o=i.globals.maxX;i.globals.isRangeBar&&(r=a.invertedYRatio,n=i.globals.minY,o=i.globals.maxY),"left"===this.moveDirection?(t=n+i.globals.gridWidth/15*r,e=o+i.globals.gridWidth/15*r):"right"===this.moveDirection&&(t=n-i.globals.gridWidth/15*r,e=o-i.globals.gridWidth/15*r),i.globals.isRangeBar||(ti.globals.initialMaxX)&&(t=n,e=o);var l={xaxis:{min:t,max:e}};i.config.chart.group||(l.yaxis=s),this.updateScrolledChart(l,t,e)}},{key:"updateScrolledChart",value:function(t,e,i){var a=this.w;this.ctx.updateHelpers._updateOptions(t,!1,!1),"function"==typeof a.config.chart.events.scrolled&&a.config.chart.events.scrolled(this.ctx,{xaxis:{min:e,max:i}})}}]),a}(ba),va=function(){function t(e){i(this,t),this.w=e.w,this.ttCtx=e,this.ctx=e.ctx}return s(t,[{key:"getNearestValues",value:function(t){var e=t.hoverArea,i=t.elGrid,a=t.clientX,s=t.clientY,r=this.w,n=i.getBoundingClientRect(),o=n.width,l=n.height,h=o/(r.globals.dataPoints-1),c=l/r.globals.dataPoints,d=this.hasBars();!r.globals.comboCharts&&!d||r.config.xaxis.convertedCatToNumeric||(h=o/r.globals.dataPoints);var u=a-n.left-r.globals.barPadForNumericAxis,g=s-n.top;u<0||g<0||u>o||g>l?(e.classList.remove("hovering-zoom"),e.classList.remove("hovering-pan")):r.globals.zoomEnabled?(e.classList.remove("hovering-pan"),e.classList.add("hovering-zoom")):r.globals.panEnabled&&(e.classList.remove("hovering-zoom"),e.classList.add("hovering-pan"));var p=Math.round(u/h),f=Math.floor(g/c);d&&!r.config.xaxis.convertedCatToNumeric&&(p=Math.ceil(u/h),p-=1);var x=null,b=null,m=r.globals.seriesXvalues.map((function(t){return t.filter((function(t){return v.isNumber(t)}))})),y=r.globals.seriesYvalues.map((function(t){return t.filter((function(t){return v.isNumber(t)}))}));if(r.globals.isXNumeric){var w=this.ttCtx.getElGrid().getBoundingClientRect(),k=u*(w.width/o),A=g*(w.height/l);x=(b=this.closestInMultiArray(k,A,m,y)).index,p=b.j,null!==x&&r.globals.hasNullValues&&(m=r.globals.seriesXvalues[x],p=(b=this.closestInArray(k,m)).j)}return r.globals.capturedSeriesIndex=null===x?-1:x,(!p||p<1)&&(p=0),r.globals.isBarHorizontal?r.globals.capturedDataPointIndex=f:r.globals.capturedDataPointIndex=p,{capturedSeries:x,j:r.globals.isBarHorizontal?f:p,hoverX:u,hoverY:g}}},{key:"getFirstActiveXArray",value:function(t){for(var e=this.w,i=0,a=t.map((function(t,e){return t.length>0?e:-1})),s=0;s0)for(var a=0;a *")):this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-series-markers-wrap > *")}},{key:"getAllMarkers",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-series-markers-wrap");i=f(i),e&&(i=i.filter((function(e){var i=Number(e.getAttribute("data:realIndex"));return-1===t.w.globals.collapsedSeriesIndices.indexOf(i)}))),i.sort((function(t,e){var i=Number(t.getAttribute("data:realIndex")),a=Number(e.getAttribute("data:realIndex"));return ai?-1:0}));var a=[];return i.forEach((function(t){a.push(t.querySelector(".apexcharts-marker"))})),a}},{key:"hasMarkers",value:function(t){return this.getElMarkers(t).length>0}},{key:"getPathFromPoint",value:function(t,e){var i=Number(t.getAttribute("cx")),a=Number(t.getAttribute("cy")),s=t.getAttribute("shape");return new Mi(this.ctx).getMarkerPath(i,a,s,e)}},{key:"getElBars",value:function(){return this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-bar-series, .apexcharts-candlestick-series, .apexcharts-boxPlot-series, .apexcharts-rangebar-series")}},{key:"hasBars",value:function(){return this.getElBars().length>0}},{key:"getHoverMarkerSize",value:function(t){var e=this.w,i=e.config.markers.hover.size;return void 0===i&&(i=e.globals.markers.size[t]+e.config.markers.hover.sizeOffset),i}},{key:"toggleAllTooltipSeriesGroups",value:function(t){var e=this.w,i=this.ttCtx;0===i.allTooltipSeriesGroups.length&&(i.allTooltipSeriesGroups=e.globals.dom.baseEl.querySelectorAll(".apexcharts-tooltip-series-group"));for(var a=i.allTooltipSeriesGroups,s=0;s ').concat(i.attrs.name,""),e+="
".concat(i.val,"
")})),m.innerHTML=t+"",v.innerHTML=e+""};n?l.globals.seriesGoals[e][i]&&Array.isArray(l.globals.seriesGoals[e][i])?y():(m.innerHTML="",v.innerHTML=""):y()}else m.innerHTML="",v.innerHTML="";null!==p&&(a[e].querySelector(".apexcharts-tooltip-text-z-label").innerHTML=l.config.tooltip.z.title,a[e].querySelector(".apexcharts-tooltip-text-z-value").innerHTML=void 0!==p?p:"");if(n&&f[0]){if(l.config.tooltip.hideEmptySeries){var w=a[e].querySelector(".apexcharts-tooltip-marker"),k=a[e].querySelector(".apexcharts-tooltip-text");0==parseFloat(c)?(w.style.display="none",k.style.display="none"):(w.style.display="block",k.style.display="block")}null==c||l.globals.ancillaryCollapsedSeriesIndices.indexOf(e)>-1||l.globals.collapsedSeriesIndices.indexOf(e)>-1||Array.isArray(h.tConfig.enabledOnSeries)&&-1===h.tConfig.enabledOnSeries.indexOf(e)?f[0].parentNode.style.display="none":f[0].parentNode.style.display=l.config.tooltip.items.display}else Array.isArray(h.tConfig.enabledOnSeries)&&-1===h.tConfig.enabledOnSeries.indexOf(e)&&(f[0].parentNode.style.display="none")}},{key:"toggleActiveInactiveSeries",value:function(t,e){var i=this.w;if(t)this.tooltipUtil.toggleAllTooltipSeriesGroups("enable");else{this.tooltipUtil.toggleAllTooltipSeriesGroups("disable");var a=i.globals.dom.baseEl.querySelector(".apexcharts-tooltip-series-group-".concat(e));a&&(a.classList.add("apexcharts-active"),a.style.display=i.config.tooltip.items.display)}}},{key:"getValuesToPrint",value:function(t){var e=t.i,i=t.j,a=this.w,s=this.ctx.series.filteredSeriesX(),r="",n="",o=null,l=null,h={series:a.globals.series,seriesIndex:e,dataPointIndex:i,w:a},c=a.globals.ttZFormatter;null===i?l=a.globals.series[e]:a.globals.isXNumeric&&"treemap"!==a.config.chart.type?(r=s[e][i],0===s[e].length&&(r=s[this.tooltipUtil.getFirstActiveXArray(s)][i])):r=new $i(this.ctx).isFormatXY()?void 0!==a.config.series[e].data[i]?a.config.series[e].data[i].x:"":void 0!==a.globals.labels[i]?a.globals.labels[i]:"";var d=r;a.globals.isXNumeric&&"datetime"===a.config.xaxis.type?r=new Xi(this.ctx).xLabelFormat(a.globals.ttKeyFormatter,d,d,{i:void 0,dateFormatter:new zi(this.ctx).formatDate,w:this.w}):r=a.globals.isBarHorizontal?a.globals.yLabelFormatters[0](d,h):a.globals.xLabelFormatter(d,h);return void 0!==a.config.tooltip.x.formatter&&(r=a.globals.ttKeyFormatter(d,h)),a.globals.seriesZ.length>0&&a.globals.seriesZ[e].length>0&&(o=c(a.globals.seriesZ[e][i],a)),n="function"==typeof a.config.xaxis.tooltip.formatter?a.globals.xaxisTooltipFormatter(d,h):r,{val:Array.isArray(l)?l.join(" "):l,xVal:Array.isArray(r)?r.join(" "):r,xAxisTTVal:Array.isArray(n)?n.join(" "):n,zVal:o}}},{key:"handleCustomTooltip",value:function(t){var e=t.i,i=t.j,a=t.y1,s=t.y2,r=t.w,n=this.ttCtx.getElTooltip(),o=r.config.tooltip.custom;Array.isArray(o)&&o[e]&&(o=o[e]);var l=o({ctx:this.ctx,series:r.globals.series,seriesIndex:e,dataPointIndex:i,y1:a,y2:s,w:r});"string"==typeof l?n.innerHTML=l:(l instanceof Element||"string"==typeof l.nodeName)&&(n.innerHTML="",n.appendChild(l.cloneNode(!0)))}}]),t}(),wa=function(){function t(e){i(this,t),this.ttCtx=e,this.ctx=e.ctx,this.w=e.w}return s(t,[{key:"moveXCrosshairs",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=this.ttCtx,a=this.w,s=i.getElXCrosshairs(),r=t-i.xcrosshairsWidth/2,n=a.globals.labels.slice().length;if(null!==e&&(r=a.globals.gridWidth/n*e),null===s||a.globals.isBarHorizontal||(s.setAttribute("x",r),s.setAttribute("x1",r),s.setAttribute("x2",r),s.setAttribute("y2",a.globals.gridHeight),s.classList.add("apexcharts-active")),r<0&&(r=0),r>a.globals.gridWidth&&(r=a.globals.gridWidth),i.isXAxisTooltipEnabled){var o=r;"tickWidth"!==a.config.xaxis.crosshairs.width&&"barWidth"!==a.config.xaxis.crosshairs.width||(o=r+i.xcrosshairsWidth/2),this.moveXAxisTooltip(o)}}},{key:"moveYCrosshairs",value:function(t){var e=this.ttCtx;null!==e.ycrosshairs&&Mi.setAttrs(e.ycrosshairs,{y1:t,y2:t}),null!==e.ycrosshairsHidden&&Mi.setAttrs(e.ycrosshairsHidden,{y1:t,y2:t})}},{key:"moveXAxisTooltip",value:function(t){var e=this.w,i=this.ttCtx;if(null!==i.xaxisTooltip&&0!==i.xcrosshairsWidth){i.xaxisTooltip.classList.add("apexcharts-active");var a=i.xaxisOffY+e.config.xaxis.tooltip.offsetY+e.globals.translateY+1+e.config.xaxis.offsetY;if(t-=i.xaxisTooltip.getBoundingClientRect().width/2,!isNaN(t)){t+=e.globals.translateX;var s;s=new Mi(this.ctx).getTextRects(i.xaxisTooltipText.innerHTML),i.xaxisTooltipText.style.minWidth=s.width+"px",i.xaxisTooltip.style.left=t+"px",i.xaxisTooltip.style.top=a+"px"}}}},{key:"moveYAxisTooltip",value:function(t){var e=this.w,i=this.ttCtx;null===i.yaxisTTEls&&(i.yaxisTTEls=e.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxistooltip"));var a=parseInt(i.ycrosshairsHidden.getAttribute("y1"),10),s=e.globals.translateY+a,r=i.yaxisTTEls[t].getBoundingClientRect().height,n=e.globals.translateYAxisX[t]-2;e.config.yaxis[t].opposite&&(n-=26),s-=r/2,-1===e.globals.ignoreYAxisIndexes.indexOf(t)?(i.yaxisTTEls[t].classList.add("apexcharts-active"),i.yaxisTTEls[t].style.top=s+"px",i.yaxisTTEls[t].style.left=n+e.config.yaxis[t].tooltip.offsetX+"px"):i.yaxisTTEls[t].classList.remove("apexcharts-active")}},{key:"moveTooltip",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=this.w,s=this.ttCtx,r=s.getElTooltip(),n=s.tooltipRect,o=null!==i?parseFloat(i):1,l=parseFloat(t)+o+5,h=parseFloat(e)+o/2;if(l>a.globals.gridWidth/2&&(l=l-n.ttWidth-o-10),l>a.globals.gridWidth-n.ttWidth-10&&(l=a.globals.gridWidth-n.ttWidth),l<-20&&(l=-20),a.config.tooltip.followCursor){var c=s.getElGrid().getBoundingClientRect();(l=s.e.clientX-c.left)>a.globals.gridWidth/2&&(l-=s.tooltipRect.ttWidth),(h=s.e.clientY+a.globals.translateY-c.top)>a.globals.gridHeight/2&&(h-=s.tooltipRect.ttHeight)}else a.globals.isBarHorizontal||n.ttHeight/2+h>a.globals.gridHeight&&(h=a.globals.gridHeight-n.ttHeight+a.globals.translateY);isNaN(l)||(l+=a.globals.translateX,r.style.left=l+"px",r.style.top=h+"px")}},{key:"moveMarkers",value:function(t,e){var i=this.w,a=this.ttCtx;if(i.globals.markers.size[t]>0)for(var s=i.globals.dom.baseEl.querySelectorAll(" .apexcharts-series[data\\:realIndex='".concat(t,"'] .apexcharts-marker")),r=0;r0){var g=u.getAttribute("shape"),p=l.getMarkerPath(s,r,g,1.5*c);u.setAttribute("d",p)}this.moveXCrosshairs(s),o.fixedTooltip||this.moveTooltip(s,r,c)}}},{key:"moveDynamicPointsOnHover",value:function(t){var e,i=this.ttCtx,a=i.w,s=0,r=0,n=a.globals.pointsArray,o=new Zi(this.ctx),l=new Mi(this.ctx);e=o.getActiveConfigSeriesIndex("asc",["line","area","scatter","bubble"]);var h=i.tooltipUtil.getHoverMarkerSize(e);if(n[e]&&(s=n[e][t][0],r=n[e][t][1]),!isNaN(s)){var c=i.tooltipUtil.getAllMarkers();if(c.length)for(var d=0;d0){var b=l.getMarkerPath(s,g,f,h);c[d].setAttribute("d",b)}else c[d].setAttribute("d","")}}this.moveXCrosshairs(s),i.fixedTooltip||this.moveTooltip(s,r||a.globals.gridHeight,h)}}},{key:"moveStickyTooltipOverBars",value:function(t,e){var i=this.w,a=this.ttCtx,s=i.globals.columnSeries?i.globals.columnSeries.length:i.globals.series.length;i.config.chart.stacked&&(s=i.globals.barGroups.length);var r=s>=2&&s%2==0?Math.floor(s/2):Math.floor(s/2)+1;i.globals.isBarHorizontal&&(r=new Zi(this.ctx).getActiveConfigSeriesIndex("desc")+1);var n=i.globals.dom.baseEl.querySelector(".apexcharts-bar-series .apexcharts-series[rel='".concat(r,"'] path[j='").concat(t,"'], .apexcharts-candlestick-series .apexcharts-series[rel='").concat(r,"'] path[j='").concat(t,"'], .apexcharts-boxPlot-series .apexcharts-series[rel='").concat(r,"'] path[j='").concat(t,"'], .apexcharts-rangebar-series .apexcharts-series[rel='").concat(r,"'] path[j='").concat(t,"']"));n||"number"!=typeof e||(n=i.globals.dom.baseEl.querySelector(".apexcharts-bar-series .apexcharts-series[data\\:realIndex='".concat(e,"'] path[j='").concat(t,"'],\n .apexcharts-candlestick-series .apexcharts-series[data\\:realIndex='").concat(e,"'] path[j='").concat(t,"'],\n .apexcharts-boxPlot-series .apexcharts-series[data\\:realIndex='").concat(e,"'] path[j='").concat(t,"'],\n .apexcharts-rangebar-series .apexcharts-series[data\\:realIndex='").concat(e,"'] path[j='").concat(t,"']")));var o=n?parseFloat(n.getAttribute("cx")):0,l=n?parseFloat(n.getAttribute("cy")):0,h=n?parseFloat(n.getAttribute("barWidth")):0,c=a.getElGrid().getBoundingClientRect(),d=n&&(n.classList.contains("apexcharts-candlestick-area")||n.classList.contains("apexcharts-boxPlot-area"));i.globals.isXNumeric?(n&&!d&&(o-=s%2!=0?h/2:0),n&&d&&(o-=h/2)):i.globals.isBarHorizontal||(o=a.xAxisTicksPositions[t-1]+a.dataPointsDividedWidth/2,isNaN(o)&&(o=a.xAxisTicksPositions[t]-a.dataPointsDividedWidth/2)),i.globals.isBarHorizontal?l-=a.tooltipRect.ttHeight:i.config.tooltip.followCursor?l=a.e.clientY-c.top-a.tooltipRect.ttHeight/2:l+a.tooltipRect.ttHeight+15>i.globals.gridHeight&&(l=i.globals.gridHeight),i.globals.isBarHorizontal||this.moveXCrosshairs(o),a.fixedTooltip||this.moveTooltip(o,l||i.globals.gridHeight)}}]),t}(),ka=function(){function t(e){i(this,t),this.w=e.w,this.ttCtx=e,this.ctx=e.ctx,this.tooltipPosition=new wa(e)}return s(t,[{key:"drawDynamicPoints",value:function(){var t=this.w,e=new Mi(this.ctx),i=new Vi(this.ctx),a=t.globals.dom.baseEl.querySelectorAll(".apexcharts-series");a=f(a),t.config.chart.stacked&&a.sort((function(t,e){return parseFloat(t.getAttribute("data:realIndex"))-parseFloat(e.getAttribute("data:realIndex"))}));for(var s=0;s2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,s=this.w;"bubble"!==s.config.chart.type&&this.newPointSize(t,e);var r=e.getAttribute("cx"),n=e.getAttribute("cy");if(null!==i&&null!==a&&(r=i,n=a),this.tooltipPosition.moveXCrosshairs(r),!this.fixedTooltip){if("radar"===s.config.chart.type){var o=this.ttCtx.getElGrid().getBoundingClientRect();r=this.ttCtx.e.clientX-o.left}this.tooltipPosition.moveTooltip(r,n,s.config.markers.hover.size)}}},{key:"enlargePoints",value:function(t){for(var e=this.w,i=this,a=this.ttCtx,s=t,r=e.globals.dom.baseEl.querySelectorAll(".apexcharts-series:not(.apexcharts-series-collapsed) .apexcharts-marker"),n=e.config.markers.hover.size,o=0;o0){var a=this.ttCtx.tooltipUtil.getPathFromPoint(t[e],i);t[e].setAttribute("d",a)}else t[e].setAttribute("d","M0,0")}}}]),t}(),Aa=function(){function t(e){i(this,t),this.w=e.w;var a=this.w;this.ttCtx=e,this.isVerticalGroupedRangeBar=!a.globals.isBarHorizontal&&"rangeBar"===a.config.chart.type&&a.config.plotOptions.bar.rangeBarGroupRows}return s(t,[{key:"getAttr",value:function(t,e){return parseFloat(t.target.getAttribute(e))}},{key:"handleHeatTreeTooltip",value:function(t){var e=t.e,i=t.opt,a=t.x,s=t.y,r=t.type,n=this.ttCtx,o=this.w;if(e.target.classList.contains("apexcharts-".concat(r,"-rect"))){var l=this.getAttr(e,"i"),h=this.getAttr(e,"j"),c=this.getAttr(e,"cx"),d=this.getAttr(e,"cy"),u=this.getAttr(e,"width"),g=this.getAttr(e,"height");if(n.tooltipLabels.drawSeriesTexts({ttItems:i.ttItems,i:l,j:h,shared:!1,e:e}),o.globals.capturedSeriesIndex=l,o.globals.capturedDataPointIndex=h,a=c+n.tooltipRect.ttWidth/2+u,s=d+n.tooltipRect.ttHeight/2-g/2,n.tooltipPosition.moveXCrosshairs(c+u/2),a>o.globals.gridWidth/2&&(a=c-n.tooltipRect.ttWidth/2+u),n.w.config.tooltip.followCursor){var p=o.globals.dom.elWrap.getBoundingClientRect();a=o.globals.clientX-p.left-(a>o.globals.gridWidth/2?n.tooltipRect.ttWidth:0),s=o.globals.clientY-p.top-(s>o.globals.gridHeight/2?n.tooltipRect.ttHeight:0)}}return{x:a,y:s}}},{key:"handleMarkerTooltip",value:function(t){var e,i,a=t.e,s=t.opt,r=t.x,n=t.y,o=this.w,l=this.ttCtx;if(a.target.classList.contains("apexcharts-marker")){var h=parseInt(s.paths.getAttribute("cx"),10),c=parseInt(s.paths.getAttribute("cy"),10),d=parseFloat(s.paths.getAttribute("val"));if(i=parseInt(s.paths.getAttribute("rel"),10),e=parseInt(s.paths.parentNode.parentNode.parentNode.getAttribute("rel"),10)-1,l.intersect){var u=v.findAncestor(s.paths,"apexcharts-series");u&&(e=parseInt(u.getAttribute("data:realIndex"),10))}if(l.tooltipLabels.drawSeriesTexts({ttItems:s.ttItems,i:e,j:i,shared:!l.showOnIntersect&&o.config.tooltip.shared,e:a}),"mouseup"===a.type&&l.markerClick(a,e,i),o.globals.capturedSeriesIndex=e,o.globals.capturedDataPointIndex=i,r=h,n=c+o.globals.translateY-1.4*l.tooltipRect.ttHeight,l.w.config.tooltip.followCursor){var g=l.getElGrid().getBoundingClientRect();n=l.e.clientY+o.globals.translateY-g.top}d<0&&(n=c),l.marker.enlargeCurrentPoint(i,s.paths,r,n)}return{x:r,y:n}}},{key:"handleBarTooltip",value:function(t){var e,i,a=t.e,s=t.opt,r=this.w,n=this.ttCtx,o=n.getElTooltip(),l=0,h=0,c=0,d=this.getBarTooltipXY({e:a,opt:s});if(null!==d.j||0!==d.barHeight||0!==d.barWidth){e=d.i;var u=d.j;if(r.globals.capturedSeriesIndex=e,r.globals.capturedDataPointIndex=u,r.globals.isBarHorizontal&&n.tooltipUtil.hasBars()||!r.config.tooltip.shared?(h=d.x,c=d.y,i=Array.isArray(r.config.stroke.width)?r.config.stroke.width[e]:r.config.stroke.width,l=h):r.globals.comboCharts||r.config.tooltip.shared||(l/=2),isNaN(c)&&(c=r.globals.svgHeight-n.tooltipRect.ttHeight),parseInt(s.paths.parentNode.getAttribute("data:realIndex"),10),h+n.tooltipRect.ttWidth>r.globals.gridWidth?h-=n.tooltipRect.ttWidth:h<0&&(h=0),n.w.config.tooltip.followCursor){var g=n.getElGrid().getBoundingClientRect();c=n.e.clientY-g.top}null===n.tooltip&&(n.tooltip=r.globals.dom.baseEl.querySelector(".apexcharts-tooltip")),r.config.tooltip.shared||(r.globals.comboBarCount>0?n.tooltipPosition.moveXCrosshairs(l+i/2):n.tooltipPosition.moveXCrosshairs(l)),!n.fixedTooltip&&(!r.config.tooltip.shared||r.globals.isBarHorizontal&&n.tooltipUtil.hasBars())&&(c=c+r.globals.translateY-n.tooltipRect.ttHeight/2,o.style.left=h+r.globals.translateX+"px",o.style.top=c+"px")}}},{key:"getBarTooltipXY",value:function(t){var e=this,i=t.e,a=t.opt,s=this.w,r=null,n=this.ttCtx,o=0,l=0,h=0,c=0,d=0,u=i.target.classList;if(u.contains("apexcharts-bar-area")||u.contains("apexcharts-candlestick-area")||u.contains("apexcharts-boxPlot-area")||u.contains("apexcharts-rangebar-area")){var g=i.target,p=g.getBoundingClientRect(),f=a.elGrid.getBoundingClientRect(),x=p.height;d=p.height;var b=p.width,m=parseInt(g.getAttribute("cx"),10),v=parseInt(g.getAttribute("cy"),10);c=parseFloat(g.getAttribute("barWidth"));var y="touchmove"===i.type?i.touches[0].clientX:i.clientX;r=parseInt(g.getAttribute("j"),10),o=parseInt(g.parentNode.getAttribute("rel"),10)-1;var w=g.getAttribute("data-range-y1"),k=g.getAttribute("data-range-y2");s.globals.comboCharts&&(o=parseInt(g.parentNode.getAttribute("data:realIndex"),10));var A=function(t){return s.globals.isXNumeric?m-b/2:e.isVerticalGroupedRangeBar?m+b/2:m-n.dataPointsDividedWidth+b/2},C=function(){return v-n.dataPointsDividedHeight+x/2-n.tooltipRect.ttHeight/2};n.tooltipLabels.drawSeriesTexts({ttItems:a.ttItems,i:o,j:r,y1:w?parseInt(w,10):null,y2:k?parseInt(k,10):null,shared:!n.showOnIntersect&&s.config.tooltip.shared,e:i}),s.config.tooltip.followCursor?s.globals.isBarHorizontal?(l=y-f.left+15,h=C()):(l=A(),h=i.clientY-f.top-n.tooltipRect.ttHeight/2-15):s.globals.isBarHorizontal?((l=m)0&&i.setAttribute("width",e.xcrosshairsWidth)}},{key:"handleYCrosshair",value:function(){var t=this.w,e=this.ttCtx;e.ycrosshairs=t.globals.dom.baseEl.querySelector(".apexcharts-ycrosshairs"),e.ycrosshairsHidden=t.globals.dom.baseEl.querySelector(".apexcharts-ycrosshairs-hidden")}},{key:"drawYaxisTooltipText",value:function(t,e,i){var a=this.ttCtx,s=this.w,r=s.globals,n=r.seriesYAxisMap[t];if(a.yaxisTooltips[t]&&n.length>0){var o=r.yLabelFormatters[t],l=a.getElGrid().getBoundingClientRect(),h=n[0],c=0;i.yRatio.length>1&&(c=h);var d=(e-l.top)*i.yRatio[c],u=r.maxYArr[h]-r.minYArr[h],g=r.minYArr[h]+(u-d);s.config.yaxis[t].reversed&&(g=r.maxYArr[h]-(u-d)),a.tooltipPosition.moveYCrosshairs(e-l.top),a.yaxisTooltipText[t].innerHTML=o(g),a.tooltipPosition.moveYAxisTooltip(t)}}}]),t}(),Sa=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w;var a=this.w;this.tConfig=a.config.tooltip,this.tooltipUtil=new va(this),this.tooltipLabels=new ya(this),this.tooltipPosition=new wa(this),this.marker=new ka(this),this.intersect=new Aa(this),this.axesTooltip=new Ca(this),this.showOnIntersect=this.tConfig.intersect,this.showTooltipTitle=this.tConfig.x.show,this.fixedTooltip=this.tConfig.fixed.enabled,this.xaxisTooltip=null,this.yaxisTTEls=null,this.isBarShared=!a.globals.isBarHorizontal&&this.tConfig.shared,this.lastHoverTime=Date.now()}return s(t,[{key:"getElTooltip",value:function(t){return t||(t=this),t.w.globals.dom.baseEl?t.w.globals.dom.baseEl.querySelector(".apexcharts-tooltip"):null}},{key:"getElXCrosshairs",value:function(){return this.w.globals.dom.baseEl.querySelector(".apexcharts-xcrosshairs")}},{key:"getElGrid",value:function(){return this.w.globals.dom.baseEl.querySelector(".apexcharts-grid")}},{key:"drawTooltip",value:function(t){var e=this.w;this.xyRatios=t,this.isXAxisTooltipEnabled=e.config.xaxis.tooltip.enabled&&e.globals.axisCharts,this.yaxisTooltips=e.config.yaxis.map((function(t,i){return!!(t.show&&t.tooltip.enabled&&e.globals.axisCharts)})),this.allTooltipSeriesGroups=[],e.globals.axisCharts||(this.showTooltipTitle=!1);var i=document.createElement("div");if(i.classList.add("apexcharts-tooltip"),e.config.tooltip.cssClass&&i.classList.add(e.config.tooltip.cssClass),i.classList.add("apexcharts-theme-".concat(this.tConfig.theme)),e.globals.dom.elWrap.appendChild(i),e.globals.axisCharts){this.axesTooltip.drawXaxisTooltip(),this.axesTooltip.drawYaxisTooltip(),this.axesTooltip.setXCrosshairWidth(),this.axesTooltip.handleYCrosshair();var a=new Qi(this.ctx);this.xAxisTicksPositions=a.getXAxisTicksPositions()}if(!e.globals.comboCharts&&!this.tConfig.intersect&&"rangeBar"!==e.config.chart.type||this.tConfig.shared||(this.showOnIntersect=!0),0!==e.config.markers.size&&0!==e.globals.markers.largestSize||this.marker.drawDynamicPoints(this),e.globals.collapsedSeries.length!==e.globals.series.length){this.dataPointsDividedHeight=e.globals.gridHeight/e.globals.dataPoints,this.dataPointsDividedWidth=e.globals.gridWidth/e.globals.dataPoints,this.showTooltipTitle&&(this.tooltipTitle=document.createElement("div"),this.tooltipTitle.classList.add("apexcharts-tooltip-title"),this.tooltipTitle.style.fontFamily=this.tConfig.style.fontFamily||e.config.chart.fontFamily,this.tooltipTitle.style.fontSize=this.tConfig.style.fontSize,i.appendChild(this.tooltipTitle));var s=e.globals.series.length;(e.globals.xyCharts||e.globals.comboCharts)&&this.tConfig.shared&&(s=this.showOnIntersect?1:e.globals.series.length),this.legendLabels=e.globals.dom.baseEl.querySelectorAll(".apexcharts-legend-text"),this.ttItems=this.createTTElements(s),this.addSVGEvents()}}},{key:"createTTElements",value:function(t){for(var e=this,i=this.w,a=[],s=this.getElTooltip(),r=function(r){var n=document.createElement("div");n.classList.add("apexcharts-tooltip-series-group","apexcharts-tooltip-series-group-".concat(r)),n.style.order=i.config.tooltip.inverseOrder?t-r:r+1;var o=document.createElement("span");o.classList.add("apexcharts-tooltip-marker"),i.config.tooltip.fillSeriesColor?o.style.backgroundColor=i.globals.colors[r]:o.style.color=i.globals.colors[r];var l=i.config.markers.shape,h=l;Array.isArray(l)&&(h=l[r]),o.setAttribute("shape",h),n.appendChild(o);var c=document.createElement("div");c.classList.add("apexcharts-tooltip-text"),c.style.fontFamily=e.tConfig.style.fontFamily||i.config.chart.fontFamily,c.style.fontSize=e.tConfig.style.fontSize,["y","goals","z"].forEach((function(t){var e=document.createElement("div");e.classList.add("apexcharts-tooltip-".concat(t,"-group"));var i=document.createElement("span");i.classList.add("apexcharts-tooltip-text-".concat(t,"-label")),e.appendChild(i);var a=document.createElement("span");a.classList.add("apexcharts-tooltip-text-".concat(t,"-value")),e.appendChild(a),c.appendChild(e)})),n.appendChild(c),s.appendChild(n),a.push(n)},n=0;n0&&this.addPathsEventListeners(g,c),this.tooltipUtil.hasBars()&&!this.tConfig.shared&&this.addDatapointEventsListeners(c)}}},{key:"drawFixedTooltipRect",value:function(){var t=this.w,e=this.getElTooltip(),i=e.getBoundingClientRect(),a=i.width+10,s=i.height+10,r=this.tConfig.fixed.offsetX,n=this.tConfig.fixed.offsetY,o=this.tConfig.fixed.position.toLowerCase();return o.indexOf("right")>-1&&(r=r+t.globals.svgWidth-a+10),o.indexOf("bottom")>-1&&(n=n+t.globals.svgHeight-s-10),e.style.left=r+"px",e.style.top=n+"px",{x:r,y:n,ttWidth:a,ttHeight:s}}},{key:"addDatapointEventsListeners",value:function(t){var e=this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-series-markers .apexcharts-marker, .apexcharts-bar-area, .apexcharts-candlestick-area, .apexcharts-boxPlot-area, .apexcharts-rangebar-area");this.addPathsEventListeners(e,t)}},{key:"addPathsEventListeners",value:function(t,e){for(var i=this,a=function(a){var s={paths:t[a],tooltipEl:e.tooltipEl,tooltipY:e.tooltipY,tooltipX:e.tooltipX,elGrid:e.elGrid,hoverArea:e.hoverArea,ttItems:e.ttItems};["mousemove","mouseup","touchmove","mouseout","touchend"].map((function(e){return t[a].addEventListener(e,i.onSeriesHover.bind(i,s),{capture:!1,passive:!0})}))},s=0;s=20?this.seriesHover(t,e):(clearTimeout(this.seriesHoverTimeout),this.seriesHoverTimeout=setTimeout((function(){i.seriesHover(t,e)}),20-a))}},{key:"seriesHover",value:function(t,e){var i=this;this.lastHoverTime=Date.now();var a=[],s=this.w;s.config.chart.group&&(a=this.ctx.getGroupedCharts()),s.globals.axisCharts&&(s.globals.minX===-1/0&&s.globals.maxX===1/0||0===s.globals.dataPoints)||(a.length?a.forEach((function(a){var s=i.getElTooltip(a),r={paths:t.paths,tooltipEl:s,tooltipY:t.tooltipY,tooltipX:t.tooltipX,elGrid:t.elGrid,hoverArea:t.hoverArea,ttItems:a.w.globals.tooltip.ttItems};a.w.globals.minX===i.w.globals.minX&&a.w.globals.maxX===i.w.globals.maxX&&a.w.globals.tooltip.seriesHoverByContext({chartCtx:a,ttCtx:a.w.globals.tooltip,opt:r,e:e})})):this.seriesHoverByContext({chartCtx:this.ctx,ttCtx:this.w.globals.tooltip,opt:t,e:e}))}},{key:"seriesHoverByContext",value:function(t){var e=t.chartCtx,i=t.ttCtx,a=t.opt,s=t.e,r=e.w,n=this.getElTooltip(e);if(n){if(i.tooltipRect={x:0,y:0,ttWidth:n.getBoundingClientRect().width,ttHeight:n.getBoundingClientRect().height},i.e=s,i.tooltipUtil.hasBars()&&!r.globals.comboCharts&&!i.isBarShared)if(this.tConfig.onDatasetHover.highlightDataSeries)new Zi(e).toggleSeriesOnHover(s,s.target.parentNode);i.fixedTooltip&&i.drawFixedTooltipRect(),r.globals.axisCharts?i.axisChartsTooltips({e:s,opt:a,tooltipRect:i.tooltipRect}):i.nonAxisChartsTooltips({e:s,opt:a,tooltipRect:i.tooltipRect})}}},{key:"axisChartsTooltips",value:function(t){var e,i,a=t.e,s=t.opt,r=this.w,n=s.elGrid.getBoundingClientRect(),o="touchmove"===a.type?a.touches[0].clientX:a.clientX,l="touchmove"===a.type?a.touches[0].clientY:a.clientY;if(this.clientY=l,this.clientX=o,r.globals.capturedSeriesIndex=-1,r.globals.capturedDataPointIndex=-1,ln.top+n.height)this.handleMouseOut(s);else{if(Array.isArray(this.tConfig.enabledOnSeries)&&!r.config.tooltip.shared){var h=parseInt(s.paths.getAttribute("index"),10);if(this.tConfig.enabledOnSeries.indexOf(h)<0)return void this.handleMouseOut(s)}var c=this.getElTooltip(),d=this.getElXCrosshairs(),u=[];r.config.chart.group&&(u=this.ctx.getSyncedCharts());var g=r.globals.xyCharts||"bar"===r.config.chart.type&&!r.globals.isBarHorizontal&&this.tooltipUtil.hasBars()&&this.tConfig.shared||r.globals.comboCharts&&this.tooltipUtil.hasBars();if("mousemove"===a.type||"touchmove"===a.type||"mouseup"===a.type){if(r.globals.collapsedSeries.length+r.globals.ancillaryCollapsedSeries.length===r.globals.series.length)return;null!==d&&d.classList.add("apexcharts-active");var p=this.yaxisTooltips.filter((function(t){return!0===t}));if(null!==this.ycrosshairs&&p.length&&this.ycrosshairs.classList.add("apexcharts-active"),g&&!this.showOnIntersect||u.length>1)this.handleStickyTooltip(a,o,l,s);else if("heatmap"===r.config.chart.type||"treemap"===r.config.chart.type){var f=this.intersect.handleHeatTreeTooltip({e:a,opt:s,x:e,y:i,type:r.config.chart.type});e=f.x,i=f.y,c.style.left=e+"px",c.style.top=i+"px"}else this.tooltipUtil.hasBars()&&this.intersect.handleBarTooltip({e:a,opt:s}),this.tooltipUtil.hasMarkers()&&this.intersect.handleMarkerTooltip({e:a,opt:s,x:e,y:i});if(this.yaxisTooltips.length)for(var x=0;xl.width)this.handleMouseOut(a);else if(null!==o)this.handleStickyCapturedSeries(t,o,a,n);else if(this.tooltipUtil.isXoverlap(n)||s.globals.isBarHorizontal){var h=s.globals.series.findIndex((function(t,e){return!s.globals.collapsedSeriesIndices.includes(e)}));this.create(t,this,h,n,a.ttItems)}}},{key:"handleStickyCapturedSeries",value:function(t,e,i,a){var s=this.w;if(!this.tConfig.shared&&null===s.globals.series[e][a])return void this.handleMouseOut(i);if(void 0!==s.globals.series[e][a])this.tConfig.shared&&this.tooltipUtil.isXoverlap(a)&&this.tooltipUtil.isInitialSeriesSameLen()?this.create(t,this,e,a,i.ttItems):this.create(t,this,e,a,i.ttItems,!1);else if(this.tooltipUtil.isXoverlap(a)){var r=s.globals.series.findIndex((function(t,e){return!s.globals.collapsedSeriesIndices.includes(e)}));this.create(t,this,r,a,i.ttItems)}}},{key:"deactivateHoverFilter",value:function(){for(var t=this.w,e=new Mi(this.ctx),i=t.globals.dom.Paper.find(".apexcharts-bar-area"),a=0;a5&&void 0!==arguments[5]?arguments[5]:null,A=this.w,C=e;"mouseup"===t.type&&this.markerClick(t,i,a),null===k&&(k=this.tConfig.shared);var S=this.tooltipUtil.hasMarkers(i),L=this.tooltipUtil.getElBars(),M=function(){A.globals.markers.largestSize>0?C.marker.enlargePoints(a):C.tooltipPosition.moveDynamicPointsOnHover(a)};if(A.config.legend.tooltipHoverFormatter){var P=A.config.legend.tooltipHoverFormatter,I=Array.from(this.legendLabels);I.forEach((function(t){var e=t.getAttribute("data:default-text");t.innerHTML=decodeURIComponent(e)}));for(var T=0;T0)){var H=new Mi(this.ctx),O=A.globals.dom.Paper.find(".apexcharts-bar-area[j='".concat(a,"']"));this.deactivateHoverFilter(),C.tooltipPosition.moveStickyTooltipOverBars(a,i),C.tooltipUtil.getAllMarkers(!0).length&&M();for(var F=0;F0&&i.config.plotOptions.bar.hideZeroBarsWhenGrouped&&(g-=c*A)),k){g=g+u.height/2-m/2-2}var S=i.globals.series[a][s]<0,L=l;switch(this.barCtx.isReversed&&(L=l+(S?d:-d)),x.position){case"center":p=k?S?L-d/2+y:L+d/2-y:S?L-d/2+u.height/2+y:L+d/2+u.height/2-y;break;case"bottom":p=k?S?L-d+y:L+d-y:S?L-d+u.height+m+y:L+d-u.height/2+m-y;break;case"top":p=k?S?L+y:L-y:S?L-u.height/2-y:L+u.height+y}var M=L;if(i.globals.seriesGroups.forEach((function(t){var i;null===(i=e.barCtx[t.join(",")])||void 0===i||i.prevY.forEach((function(t){M=S?Math.max(t[s],M):Math.min(t[s],M)}))})),this.barCtx.lastActiveBarSerieIndex===r&&b.enabled){var P=new Mi(this.barCtx.ctx).getTextRects(this.getStackedTotalDataLabel({realIndex:r,j:s}),f.fontSize);n=S?M-P.height/2-y-b.offsetY+18:M+P.height+y+b.offsetY-18;var I=C;o=w+(i.globals.isXNumeric?-c*i.globals.barGroups.length/2:i.globals.barGroups.length*c/2-(i.globals.barGroups.length-1)*c-I)+b.offsetX}return i.config.chart.stacked||(p<0?p=0+m:p+u.height/3>i.globals.gridHeight&&(p=i.globals.gridHeight-m)),{bcx:h,bcy:l,dataLabelsX:g,dataLabelsY:p,totalDataLabelsX:o,totalDataLabelsY:n,totalDataLabelsAnchor:"middle"}}},{key:"calculateBarsDataLabelsPosition",value:function(t){var e=this,i=this.w,a=t.x,s=t.i,r=t.j,n=t.realIndex,o=t.bcy,l=t.barHeight,h=t.barWidth,c=t.textRects,d=t.dataLabelsX,u=t.strokeWidth,g=t.dataLabelsConfig,p=t.barDataLabelsConfig,f=t.barTotalDataLabelsConfig,x=t.offX,b=t.offY,m=i.globals.gridHeight/i.globals.dataPoints,v=this.barCtx.barHelpers.getZeroValueEncounters({i:s,j:r}).zeroEncounters;h=Math.abs(h);var y,w,k=o-(this.barCtx.isRangeBar?0:m)+l/2+c.height/2+b-3;!i.config.chart.stacked&&v>0&&i.config.plotOptions.bar.hideZeroBarsWhenGrouped&&(k-=l*v);var A="start",C=i.globals.series[s][r]<0,S=a;switch(this.barCtx.isReversed&&(S=a+(C?-h:h),A=C?"start":"end"),p.position){case"center":d=C?S+h/2-x:Math.max(c.width/2,S-h/2)+x;break;case"bottom":d=C?S+h-u-x:S-h+u+x;break;case"top":d=C?S-u-x:S-u+x}var L=S;if(i.globals.seriesGroups.forEach((function(t){var i;null===(i=e.barCtx[t.join(",")])||void 0===i||i.prevX.forEach((function(t){L=C?Math.min(t[r],L):Math.max(t[r],L)}))})),this.barCtx.lastActiveBarSerieIndex===n&&f.enabled){var M=new Mi(this.barCtx.ctx).getTextRects(this.getStackedTotalDataLabel({realIndex:n,j:r}),g.fontSize);C?(y=L-u-x-f.offsetX,A="end"):y=L+x+f.offsetX+(this.barCtx.isReversed?-(h+u):u),w=k-c.height/2+M.height/2+f.offsetY+u,i.globals.barGroups.length>1&&(w-=i.globals.barGroups.length/2*(l/2))}return i.config.chart.stacked||("start"===g.textAnchor?d-c.width<0?d=C?c.width+u:u:d+c.width>i.globals.gridWidth&&(d=C?i.globals.gridWidth-u:i.globals.gridWidth-c.width-u):"middle"===g.textAnchor?d-c.width/2<0?d=c.width/2+u:d+c.width/2>i.globals.gridWidth&&(d=i.globals.gridWidth-c.width/2-u):"end"===g.textAnchor&&(d<1?d=c.width+u:d+1>i.globals.gridWidth&&(d=i.globals.gridWidth-c.width-u))),{bcx:a,bcy:o,dataLabelsX:d,dataLabelsY:k,totalDataLabelsX:y,totalDataLabelsY:w,totalDataLabelsAnchor:A}}},{key:"drawCalculatedDataLabels",value:function(t){var e=t.x,i=t.y,a=t.val,s=t.i,r=t.j,n=t.textRects,o=t.barHeight,l=t.barWidth,h=t.dataLabelsConfig,c=this.w,d="rotate(0)";"vertical"===c.config.plotOptions.bar.dataLabels.orientation&&(d="rotate(-90, ".concat(e,", ").concat(i,")"));var g=new qi(this.barCtx.ctx),p=new Mi(this.barCtx.ctx),f=h.formatter,x=null,b=c.globals.collapsedSeriesIndices.indexOf(s)>-1;if(h.enabled&&!b){x=p.group({class:"apexcharts-data-labels",transform:d});var m="";void 0!==a&&(m=f(a,u(u({},c),{},{seriesIndex:s,dataPointIndex:r,w:c}))),!a&&c.config.plotOptions.bar.hideZeroBarsWhenGrouped&&(m="");var v=c.globals.series[s][r]<0,y=c.config.plotOptions.bar.dataLabels.position;if("vertical"===c.config.plotOptions.bar.dataLabels.orientation&&("top"===y&&(h.textAnchor=v?"end":"start"),"center"===y&&(h.textAnchor="middle"),"bottom"===y&&(h.textAnchor=v?"end":"start")),this.barCtx.isRangeBar&&this.barCtx.barOptions.dataLabels.hideOverflowingLabels)lMath.abs(l)&&(m=""):n.height/1.6>Math.abs(o)&&(m=""));var w=u({},h);this.barCtx.isHorizontal&&a<0&&("start"===h.textAnchor?w.textAnchor="end":"end"===h.textAnchor&&(w.textAnchor="start")),g.plotDataLabelsText({x:e,y:i,text:m,i:s,j:r,parent:x,dataLabelsConfig:w,alwaysDrawDataLabel:!0,offsetCorrection:!0})}return x}},{key:"drawTotalDataLabels",value:function(t){var e=t.x,i=t.y,a=t.val,s=t.realIndex,r=t.textAnchor,n=t.barTotalDataLabelsConfig;this.w;var o,l=new Mi(this.barCtx.ctx);return n.enabled&&void 0!==e&&void 0!==i&&this.barCtx.lastActiveBarSerieIndex===s&&(o=l.drawText({x:e,y:i,foreColor:n.style.color,text:a,textAnchor:r,fontFamily:n.style.fontFamily,fontSize:n.style.fontSize,fontWeight:n.style.fontWeight})),o}}]),t}(),Ma=function(){function t(e){i(this,t),this.w=e.w,this.barCtx=e}return s(t,[{key:"initVariables",value:function(t){var e=this.w;this.barCtx.series=t,this.barCtx.totalItems=0,this.barCtx.seriesLen=0,this.barCtx.visibleI=-1,this.barCtx.visibleItems=1;for(var i=0;i0&&(this.barCtx.seriesLen=this.barCtx.seriesLen+1,this.barCtx.totalItems+=t[i].length),e.globals.isXNumeric)for(var a=0;ae.globals.minX&&e.globals.seriesX[i][a]0&&(s=h.globals.minXDiff/u),(n=s/d*parseInt(this.barCtx.barOptions.columnWidth,10)/100)<1&&(n=1)}if(-1===String(this.barCtx.barOptions.columnWidth).indexOf("%")&&(n=parseInt(this.barCtx.barOptions.columnWidth,10)),o=h.globals.gridHeight-this.barCtx.baseLineY[this.barCtx.translationsIndex]-(this.barCtx.isReversed?h.globals.gridHeight:0)+(this.barCtx.isReversed?2*this.barCtx.baseLineY[this.barCtx.translationsIndex]:0),h.globals.isXNumeric)e=this.barCtx.getBarXForNumericXAxis({x:e,j:0,realIndex:t,barWidth:n}).x;else e=h.globals.padHorizontal+v.noExponents(s-n*this.barCtx.seriesLen)/2}return h.globals.barHeight=r,h.globals.barWidth=n,{x:e,y:i,yDivision:a,xDivision:s,barHeight:r,barWidth:n,zeroH:o,zeroW:l}}},{key:"initializeStackedPrevVars",value:function(t){t.w.globals.seriesGroups.forEach((function(e){t[e]||(t[e]={}),t[e].prevY=[],t[e].prevX=[],t[e].prevYF=[],t[e].prevXF=[],t[e].prevYVal=[],t[e].prevXVal=[]}))}},{key:"initializeStackedXYVars",value:function(t){t.w.globals.seriesGroups.forEach((function(e){t[e]||(t[e]={}),t[e].xArrj=[],t[e].xArrjF=[],t[e].xArrjVal=[],t[e].yArrj=[],t[e].yArrjF=[],t[e].yArrjVal=[]}))}},{key:"getPathFillColor",value:function(t,e,i,a){var s,r,n,o,l=this.w,h=this.barCtx.ctx.fill,c=null,d=this.barCtx.barOptions.distributed?i:e,u=!1;this.barCtx.barOptions.colors.ranges.length>0&&this.barCtx.barOptions.colors.ranges.map((function(a){t[e][i]>=a.from&&t[e][i]<=a.to&&(c=a.color,u=!0)}));return{color:h.fillPath({seriesNumber:this.barCtx.barOptions.distributed?d:a,dataPointIndex:i,color:c,value:t[e][i],fillConfig:null===(s=l.config.series[e].data[i])||void 0===s?void 0:s.fill,fillType:null!==(r=l.config.series[e].data[i])&&void 0!==r&&null!==(n=r.fill)&&void 0!==n&&n.type?null===(o=l.config.series[e].data[i])||void 0===o?void 0:o.fill.type:Array.isArray(l.config.fill.type)?l.config.fill.type[a]:l.config.fill.type}),useRangeColor:u}}},{key:"getStrokeWidth",value:function(t,e,i){var a=0,s=this.w;return this.barCtx.series[t][e]?this.barCtx.isNullValue=!1:this.barCtx.isNullValue=!0,s.config.stroke.show&&(this.barCtx.isNullValue||(a=Array.isArray(this.barCtx.strokeWidth)?this.barCtx.strokeWidth[i]:this.barCtx.strokeWidth)),a}},{key:"createBorderRadiusArr",value:function(t){var e,i=this.w,a=!this.w.config.chart.stacked||i.config.plotOptions.bar.borderRadius<=0,s=t.length,n=0|(null===(e=t[0])||void 0===e?void 0:e.length),o=Array.from({length:s},(function(){return Array(n).fill(a?"top":"none")}));if(a)return o;for(var l=0;l0?(h.push(u),d++):g<0&&(c.push(u),d++)}if(h.length>0&&0===c.length)if(1===h.length)o[h[0]][l]="both";else{var p,f=h[0],x=h[h.length-1],b=r(h);try{for(b.s();!(p=b.n()).done;){var m=p.value;o[m][l]=m===f?"bottom":m===x?"top":"none"}}catch(t){b.e(t)}finally{b.f()}}else if(c.length>0&&0===h.length)if(1===c.length)o[c[0]][l]="both";else{var v,y=Math.max.apply(Math,c),w=Math.min.apply(Math,c),k=r(c);try{for(k.s();!(v=k.n()).done;){var A=v.value;o[A][l]=A===y?"bottom":A===w?"top":"none"}}catch(t){k.e(t)}finally{k.f()}}else if(h.length>0&&c.length>0){var C,S=h[h.length-1],L=r(h);try{for(L.s();!(C=L.n()).done;){var M=C.value;o[M][l]=M===S?"top":"none"}}catch(t){L.e(t)}finally{L.f()}var P,I=Math.max.apply(Math,c),T=r(c);try{for(T.s();!(P=T.n()).done;){var z=P.value;o[z][l]=z===I?"bottom":"none"}}catch(t){T.e(t)}finally{T.f()}}else if(1===d){o[h[0]||c[0]][l]="both"}}return o}},{key:"barBackground",value:function(t){var e=t.j,i=t.i,a=t.x1,s=t.x2,r=t.y1,n=t.y2,o=t.elSeries,l=this.w,h=new Mi(this.barCtx.ctx),c=new Zi(this.barCtx.ctx).getActiveConfigSeriesIndex();if(this.barCtx.barOptions.colors.backgroundBarColors.length>0&&c===i){e>=this.barCtx.barOptions.colors.backgroundBarColors.length&&(e%=this.barCtx.barOptions.colors.backgroundBarColors.length);var d=this.barCtx.barOptions.colors.backgroundBarColors[e],u=h.drawRect(void 0!==a?a:0,void 0!==r?r:0,void 0!==s?s:l.globals.gridWidth,void 0!==n?n:l.globals.gridHeight,this.barCtx.barOptions.colors.backgroundBarRadius,d,this.barCtx.barOptions.colors.backgroundBarOpacity);o.add(u),u.node.classList.add("apexcharts-backgroundBar")}}},{key:"getColumnPaths",value:function(t){var e,i=t.barWidth,a=t.barXPosition,s=t.y1,r=t.y2,n=t.strokeWidth,o=t.isReversed,l=t.series,h=t.seriesGroup,c=t.realIndex,d=t.i,u=t.j,g=t.w,p=new Mi(this.barCtx.ctx);(n=Array.isArray(n)?n[c]:n)||(n=0);var f=i,x=a;null!==(e=g.config.series[c].data[u])&&void 0!==e&&e.columnWidthOffset&&(x=a-g.config.series[c].data[u].columnWidthOffset/2,f=i+g.config.series[c].data[u].columnWidthOffset);var b=n/2,m=x+b,v=x+f-b,y=(l[d][u]>=0?1:-1)*(o?-1:1);s+=.001-b*y,r+=.001+b*y;var w=p.move(m,s),k=p.move(m,s),A=p.line(v,s);if(g.globals.previousPaths.length>0&&(k=this.barCtx.getPreviousPath(c,u,!1)),w=w+p.line(m,r)+p.line(v,r)+A+("around"===g.config.plotOptions.bar.borderRadiusApplication||"both"===this.arrBorderRadius[c][u]?" Z":" z"),k=k+p.line(m,s)+A+A+A+A+A+p.line(m,s)+("around"===g.config.plotOptions.bar.borderRadiusApplication||"both"===this.arrBorderRadius[c][u]?" Z":" z"),"none"!==this.arrBorderRadius[c][u]&&(w=p.roundPathCorners(w,g.config.plotOptions.bar.borderRadius)),g.config.chart.stacked){var C=this.barCtx;(C=this.barCtx[h]).yArrj.push(r-b*y),C.yArrjF.push(Math.abs(s-r+n*y)),C.yArrjVal.push(this.barCtx.series[d][u])}return{pathTo:w,pathFrom:k}}},{key:"getBarpaths",value:function(t){var e,i=t.barYPosition,a=t.barHeight,s=t.x1,r=t.x2,n=t.strokeWidth,o=t.isReversed,l=t.series,h=t.seriesGroup,c=t.realIndex,d=t.i,u=t.j,g=t.w,p=new Mi(this.barCtx.ctx);(n=Array.isArray(n)?n[c]:n)||(n=0);var f=i,x=a;null!==(e=g.config.series[c].data[u])&&void 0!==e&&e.barHeightOffset&&(f=i-g.config.series[c].data[u].barHeightOffset/2,x=a+g.config.series[c].data[u].barHeightOffset);var b=n/2,m=f+b,v=f+x-b,y=(l[d][u]>=0?1:-1)*(o?-1:1);s+=.001+b*y,r+=.001-b*y;var w=p.move(s,m),k=p.move(s,m);g.globals.previousPaths.length>0&&(k=this.barCtx.getPreviousPath(c,u,!1));var A=p.line(s,v);if(w=w+p.line(r,m)+p.line(r,v)+A+("around"===g.config.plotOptions.bar.borderRadiusApplication||"both"===this.arrBorderRadius[c][u]?" Z":" z"),k=k+p.line(s,m)+A+A+A+A+A+p.line(s,m)+("around"===g.config.plotOptions.bar.borderRadiusApplication||"both"===this.arrBorderRadius[c][u]?" Z":" z"),"none"!==this.arrBorderRadius[c][u]&&(w=p.roundPathCorners(w,g.config.plotOptions.bar.borderRadius)),g.config.chart.stacked){var C=this.barCtx;(C=this.barCtx[h]).xArrj.push(r+b*y),C.xArrjF.push(Math.abs(s-r-n*y)),C.xArrjVal.push(this.barCtx.series[d][u])}return{pathTo:w,pathFrom:k}}},{key:"checkZeroSeries",value:function(t){for(var e=t.series,i=this.w,a=0;a2&&void 0!==arguments[2])||arguments[2]?e:null;return null!=t&&(i=e+t/this.barCtx.invertedYRatio-2*(this.barCtx.isReversed?t/this.barCtx.invertedYRatio:0)),i}},{key:"getYForValue",value:function(t,e,i){var a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3]?e:null;return null!=t&&(a=e-t/this.barCtx.yRatio[i]+2*(this.barCtx.isReversed?t/this.barCtx.yRatio[i]:0)),a}},{key:"getGoalValues",value:function(t,e,i,a,s,r){var n=this,l=this.w,h=[],c=function(a,s){var l;h.push((o(l={},t,"x"===t?n.getXForValue(a,e,!1):n.getYForValue(a,i,r,!1)),o(l,"attrs",s),l))};if(l.globals.seriesGoals[a]&&l.globals.seriesGoals[a][s]&&Array.isArray(l.globals.seriesGoals[a][s])&&l.globals.seriesGoals[a][s].forEach((function(t){c(t.value,t)})),this.barCtx.barOptions.isDumbbell&&l.globals.seriesRange.length){var d=this.barCtx.barOptions.dumbbellColors?this.barCtx.barOptions.dumbbellColors:l.globals.colors,g={strokeHeight:"x"===t?0:l.globals.markers.size[a],strokeWidth:"x"===t?l.globals.markers.size[a]:0,strokeDashArray:0,strokeLineCap:"round",strokeColor:Array.isArray(d[a])?d[a][0]:d[a]};c(l.globals.seriesRangeStart[a][s],g),c(l.globals.seriesRangeEnd[a][s],u(u({},g),{},{strokeColor:Array.isArray(d[a])?d[a][1]:d[a]}))}return h}},{key:"drawGoalLine",value:function(t){var e=t.barXPosition,i=t.barYPosition,a=t.goalX,s=t.goalY,r=t.barWidth,n=t.barHeight,o=new Mi(this.barCtx.ctx),l=o.group({className:"apexcharts-bar-goals-groups"});l.node.classList.add("apexcharts-element-hidden"),this.barCtx.w.globals.delayedElements.push({el:l.node}),l.attr("clip-path","url(#gridRectMarkerMask".concat(this.barCtx.w.globals.cuid,")"));var h=null;return this.barCtx.isHorizontal?Array.isArray(a)&&a.forEach((function(t){if(t.x>=-1&&t.x<=o.w.globals.gridWidth+1){var e=void 0!==t.attrs.strokeHeight?t.attrs.strokeHeight:n/2,a=i+e+n/2;h=o.drawLine(t.x,a-2*e,t.x,a,t.attrs.strokeColor?t.attrs.strokeColor:void 0,t.attrs.strokeDashArray,t.attrs.strokeWidth?t.attrs.strokeWidth:2,t.attrs.strokeLineCap),l.add(h)}})):Array.isArray(s)&&s.forEach((function(t){if(t.y>=-1&&t.y<=o.w.globals.gridHeight+1){var i=void 0!==t.attrs.strokeWidth?t.attrs.strokeWidth:r/2,a=e+i+r/2;h=o.drawLine(a-2*i,t.y,a,t.y,t.attrs.strokeColor?t.attrs.strokeColor:void 0,t.attrs.strokeDashArray,t.attrs.strokeHeight?t.attrs.strokeHeight:2,t.attrs.strokeLineCap),l.add(h)}})),l}},{key:"drawBarShadow",value:function(t){var e=t.prevPaths,i=t.currPaths,a=t.color,s=this.w,r=e.x,n=e.x1,o=e.barYPosition,l=i.x,h=i.x1,c=i.barYPosition,d=o+i.barHeight,u=new Mi(this.barCtx.ctx),g=new v,p=u.move(n,d)+u.line(r,d)+u.line(l,c)+u.line(h,c)+u.line(n,d)+("around"===s.config.plotOptions.bar.borderRadiusApplication||"both"===this.arrBorderRadius[realIndex][j]?" Z":" z");return u.drawPath({d:p,fill:g.shadeColor(.5,v.rgb2hex(a)),stroke:"none",strokeWidth:0,fillOpacity:1,classes:"apexcharts-bar-shadow apexcharts-decoration-element"})}},{key:"getZeroValueEncounters",value:function(t){var e,i=t.i,a=t.j,s=this.w,r=0,n=0;return(s.config.plotOptions.bar.horizontal?s.globals.series.map((function(t,e){return e})):(null===(e=s.globals.columnSeries)||void 0===e?void 0:e.i.map((function(t){return t})))||[]).forEach((function(t){var e=s.globals.seriesPercent[t][a];e&&r++,t-1})),a=this.barCtx.columnGroupIndices,s=a.indexOf(i);return s<0&&(a.push(i),s=a.length-1),{groupIndex:i,columnGroupIndex:s}}}]),t}(),Pa=function(){function t(e,a){i(this,t),this.ctx=e,this.w=e.w;var s=this.w;this.barOptions=s.config.plotOptions.bar,this.isHorizontal=this.barOptions.horizontal,this.strokeWidth=s.config.stroke.width,this.isNullValue=!1,this.isRangeBar=s.globals.seriesRange.length&&this.isHorizontal,this.isVerticalGroupedRangeBar=!s.globals.isBarHorizontal&&s.globals.seriesRange.length&&s.config.plotOptions.bar.rangeBarGroupRows,this.isFunnel=this.barOptions.isFunnel,this.xyRatios=a,null!==this.xyRatios&&(this.xRatio=a.xRatio,this.yRatio=a.yRatio,this.invertedXRatio=a.invertedXRatio,this.invertedYRatio=a.invertedYRatio,this.baseLineY=a.baseLineY,this.baseLineInvertedY=a.baseLineInvertedY),this.yaxisIndex=0,this.translationsIndex=0,this.seriesLen=0,this.pathArr=[];var r=new Zi(this.ctx);this.lastActiveBarSerieIndex=r.getActiveConfigSeriesIndex("desc",["bar","column"]),this.columnGroupIndices=[];var n=r.getBarSeriesIndices(),o=new Pi(this.ctx);this.stackedSeriesTotals=o.getStackedSeriesTotals(this.w.config.series.map((function(t,e){return-1===n.indexOf(e)?e:-1})).filter((function(t){return-1!==t}))),this.barHelpers=new Ma(this)}return s(t,[{key:"draw",value:function(t,e){var i=this.w,a=new Mi(this.ctx),s=new Pi(this.ctx,i);t=s.getLogSeries(t),this.series=t,this.yRatio=s.getLogYRatios(this.yRatio),this.barHelpers.initVariables(t);var r=a.group({class:"apexcharts-bar-series apexcharts-plot-series"});i.config.dataLabels.enabled&&this.totalItems>this.barOptions.dataLabels.maxItems&&console.warn("WARNING: DataLabels are enabled but there are too many to display. This may cause performance issue when rendering - ApexCharts");for(var n=0,o=0;n0&&(this.visibleI=this.visibleI+1);var w=0,k=0;this.yRatio.length>1&&(this.yaxisIndex=i.globals.seriesYAxisReverseMap[b],this.translationsIndex=b);var A=this.translationsIndex;this.isReversed=i.config.yaxis[this.yaxisIndex]&&i.config.yaxis[this.yaxisIndex].reversed;var C=this.barHelpers.initialPositions(b);p=C.y,w=C.barHeight,h=C.yDivision,d=C.zeroW,g=C.x,k=C.barWidth,l=C.xDivision,c=C.zeroH,this.isHorizontal||x.push(g+k/2);var S=a.group({class:"apexcharts-datalabels","data:realIndex":b});i.globals.delayedElements.push({el:S.node}),S.node.classList.add("apexcharts-element-hidden");var L=a.group({class:"apexcharts-bar-goals-markers"}),M=a.group({class:"apexcharts-bar-shadows"});i.globals.delayedElements.push({el:M.node}),M.node.classList.add("apexcharts-element-hidden");for(var P=0;P0){var R,E=this.barHelpers.drawBarShadow({color:"string"==typeof X.color&&-1===(null===(R=X.color)||void 0===R?void 0:R.indexOf("url"))?X.color:v.hexToRgba(i.globals.colors[n]),prevPaths:this.pathArr[this.pathArr.length-1],currPaths:T});if(M.add(E),i.config.chart.dropShadow.enabled)new Li(this.ctx).dropShadow(E,i.config.chart.dropShadow,b)}this.pathArr.push(T);var Y=this.barHelpers.drawGoalLine({barXPosition:T.barXPosition,barYPosition:T.barYPosition,goalX:T.goalX,goalY:T.goalY,barHeight:w,barWidth:k});Y&&L.add(Y),p=T.y,g=T.x,P>0&&x.push(g+k/2),f.push(p),this.renderSeries(u(u({realIndex:b,pathFill:X.color},X.useRangeColor?{lineFill:X.color}:{}),{},{j:P,i:n,columnGroupIndex:m,pathFrom:T.pathFrom,pathTo:T.pathTo,strokeWidth:I,elSeries:y,x:g,y:p,series:t,barHeight:Math.abs(T.barHeight?T.barHeight:w),barWidth:Math.abs(T.barWidth?T.barWidth:k),elDataLabelsWrap:S,elGoalsMarkers:L,elBarShadows:M,visibleSeries:this.visibleI,type:"bar"}))}i.globals.seriesXvalues[b]=x,i.globals.seriesYvalues[b]=f,r.add(y)}return r}},{key:"renderSeries",value:function(t){var e=t.realIndex,i=t.pathFill,a=t.lineFill,s=t.j,r=t.i,n=t.columnGroupIndex,o=t.pathFrom,l=t.pathTo,h=t.strokeWidth,c=t.elSeries,d=t.x,u=t.y,g=t.y1,p=t.y2,f=t.series,x=t.barHeight,b=t.barWidth,m=t.barXPosition,v=t.barYPosition,y=t.elDataLabelsWrap,w=t.elGoalsMarkers,k=t.elBarShadows,A=t.visibleSeries,C=t.type,S=t.classes,L=this.w,M=new Mi(this.ctx);if(!a){var P="function"==typeof L.globals.stroke.colors[e]?function(t){var e,i=L.config.stroke.colors;return Array.isArray(i)&&i.length>0&&((e=i[t])||(e=""),"function"==typeof e)?e({value:L.globals.series[t][s],dataPointIndex:s,w:L}):e}(e):L.globals.stroke.colors[e];a=this.barOptions.distributed?L.globals.stroke.colors[s]:P}L.config.series[r].data[s]&&L.config.series[r].data[s].strokeColor&&(a=L.config.series[r].data[s].strokeColor),this.isNullValue&&(i="none");var I=s/L.config.chart.animations.animateGradually.delay*(L.config.chart.animations.speed/L.globals.dataPoints)/2.4,T=M.renderPaths({i:r,j:s,realIndex:e,pathFrom:o,pathTo:l,stroke:a,strokeWidth:h,strokeLineCap:L.config.stroke.lineCap,fill:i,animationDelay:I,initialSpeed:L.config.chart.animations.speed,dataChangeSpeed:L.config.chart.animations.dynamicAnimation.speed,className:"apexcharts-".concat(C,"-area ").concat(S),chartType:C});T.attr("clip-path","url(#gridRectBarMask".concat(L.globals.cuid,")"));var z=L.config.forecastDataPoints;z.count>0&&s>=L.globals.dataPoints-z.count&&(T.node.setAttribute("stroke-dasharray",z.dashArray),T.node.setAttribute("stroke-width",z.strokeWidth),T.node.setAttribute("fill-opacity",z.fillOpacity)),void 0!==g&&void 0!==p&&(T.attr("data-range-y1",g),T.attr("data-range-y2",p)),new Li(this.ctx).setSelectionFilter(T,e,s),c.add(T);var X=new La(this).handleBarDataLabels({x:d,y:u,y1:g,y2:p,i:r,j:s,series:f,realIndex:e,columnGroupIndex:n,barHeight:x,barWidth:b,barXPosition:m,barYPosition:v,renderedPath:T,visibleSeries:A});return null!==X.dataLabels&&y.add(X.dataLabels),X.totalDataLabels&&y.add(X.totalDataLabels),c.add(y),w&&c.add(w),k&&c.add(k),c}},{key:"drawBarPaths",value:function(t){var e,i=t.indexes,a=t.barHeight,s=t.strokeWidth,r=t.zeroW,n=t.x,o=t.y,l=t.yDivision,h=t.elSeries,c=this.w,d=i.i,u=i.j;if(c.globals.isXNumeric)e=(o=(c.globals.seriesX[d][u]-c.globals.minX)/this.invertedXRatio-a)+a*this.visibleI;else if(c.config.plotOptions.bar.hideZeroBarsWhenGrouped){var g=this.barHelpers.getZeroValueEncounters({i:d,j:u}),p=g.nonZeroColumns,f=g.zeroEncounters;p>0&&(a=this.seriesLen*a/p),e=o+a*this.visibleI,e-=a*f}else e=o+a*this.visibleI;this.isFunnel&&(r-=(this.barHelpers.getXForValue(this.series[d][u],r)-r)/2),n=this.barHelpers.getXForValue(this.series[d][u],r);var x=this.barHelpers.getBarpaths({barYPosition:e,barHeight:a,x1:r,x2:n,strokeWidth:s,isReversed:this.isReversed,series:this.series,realIndex:i.realIndex,i:d,j:u,w:c});return c.globals.isXNumeric||(o+=l),this.barHelpers.barBackground({j:u,i:d,y1:e-a*this.visibleI,y2:a*this.seriesLen,elSeries:h}),{pathTo:x.pathTo,pathFrom:x.pathFrom,x1:r,x:n,y:o,goalX:this.barHelpers.getGoalValues("x",r,null,d,u),barYPosition:e,barHeight:a}}},{key:"drawColumnPaths",value:function(t){var e,i=t.indexes,a=t.x,s=t.y,r=t.xDivision,n=t.barWidth,o=t.zeroH,l=t.strokeWidth,h=t.elSeries,c=this.w,d=i.realIndex,u=i.translationsIndex,g=i.i,p=i.j,f=i.bc;if(c.globals.isXNumeric){var x=this.getBarXForNumericXAxis({x:a,j:p,realIndex:d,barWidth:n});a=x.x,e=x.barXPosition}else if(c.config.plotOptions.bar.hideZeroBarsWhenGrouped){var b=this.barHelpers.getZeroValueEncounters({i:g,j:p}),m=b.nonZeroColumns,v=b.zeroEncounters;m>0&&(n=this.seriesLen*n/m),e=a+n*this.visibleI,e-=n*v}else e=a+n*this.visibleI;s=this.barHelpers.getYForValue(this.series[g][p],o,u);var y=this.barHelpers.getColumnPaths({barXPosition:e,barWidth:n,y1:o,y2:s,strokeWidth:l,isReversed:this.isReversed,series:this.series,realIndex:d,i:g,j:p,w:c});return c.globals.isXNumeric||(a+=r),this.barHelpers.barBackground({bc:f,j:p,i:g,x1:e-l/2-n*this.visibleI,x2:n*this.seriesLen+l/2,elSeries:h}),{pathTo:y.pathTo,pathFrom:y.pathFrom,x:a,y:s,goalY:this.barHelpers.getGoalValues("y",null,o,g,p,u),barXPosition:e,barWidth:n}}},{key:"getBarXForNumericXAxis",value:function(t){var e=t.x,i=t.barWidth,a=t.realIndex,s=t.j,r=this.w,n=a;return r.globals.seriesX[a].length||(n=r.globals.maxValsInArrayIndex),v.isNumber(r.globals.seriesX[n][s])&&(e=(r.globals.seriesX[n][s]-r.globals.minX)/this.xRatio-i*this.seriesLen/2),{barXPosition:e+i*this.visibleI,x:e}}},{key:"getPreviousPath",value:function(t,e){for(var i,a=this.w,s=0;s0&&parseInt(r.realIndex,10)===parseInt(t,10)&&void 0!==a.globals.previousPaths[s].paths[e]&&(i=a.globals.previousPaths[s].paths[e].d)}return i}}]),t}(),Ia=function(t){h(a,t);var e=n(a);function a(){return i(this,a),e.apply(this,arguments)}return s(a,[{key:"draw",value:function(t,e){var i=this,a=this.w;this.graphics=new Mi(this.ctx),this.bar=new Pa(this.ctx,this.xyRatios);var s=new Pi(this.ctx,a);t=s.getLogSeries(t),this.yRatio=s.getLogYRatios(this.yRatio),this.barHelpers.initVariables(t),"100%"===a.config.chart.stackType&&(t=a.globals.comboCharts?e.map((function(t){return a.globals.seriesPercent[t]})):a.globals.seriesPercent.slice()),this.series=t,this.barHelpers.initializeStackedPrevVars(this);for(var r=this.graphics.group({class:"apexcharts-bar-series apexcharts-plot-series"}),n=0,o=0,l=function(s,l){var h=void 0,c=void 0,d=void 0,g=void 0,p=a.globals.comboCharts?e[s]:s,f=i.barHelpers.getGroupIndex(p),x=f.groupIndex,b=f.columnGroupIndex;i.groupCtx=i[a.globals.seriesGroups[x]];var m=[],y=[],w=0;i.yRatio.length>1&&(i.yaxisIndex=a.globals.seriesYAxisReverseMap[p][0],w=p),i.isReversed=a.config.yaxis[i.yaxisIndex]&&a.config.yaxis[i.yaxisIndex].reversed;var k=i.graphics.group({class:"apexcharts-series",seriesName:v.escapeString(a.globals.seriesNames[p]),rel:s+1,"data:realIndex":p});i.ctx.series.addCollapsedClassToSeries(k,p);var A=i.graphics.group({class:"apexcharts-datalabels","data:realIndex":p}),C=i.graphics.group({class:"apexcharts-bar-goals-markers"}),S=0,L=0,M=i.initialPositions(n,o,h,c,d,g,w);o=M.y,S=M.barHeight,c=M.yDivision,g=M.zeroW,n=M.x,L=M.barWidth,h=M.xDivision,d=M.zeroH,a.globals.barHeight=S,a.globals.barWidth=L,i.barHelpers.initializeStackedXYVars(i),1===i.groupCtx.prevY.length&&i.groupCtx.prevY[0].every((function(t){return isNaN(t)}))&&(i.groupCtx.prevY[0]=i.groupCtx.prevY[0].map((function(){return d})),i.groupCtx.prevYF[0]=i.groupCtx.prevYF[0].map((function(){return 0})));for(var P=0;P0||"top"===i.barHelpers.arrBorderRadius[p][P]&&a.globals.series[p][P]<0)&&(E=Y),k=i.renderSeries(u(u({realIndex:p,pathFill:R.color},R.useRangeColor?{lineFill:R.color}:{}),{},{j:P,i:s,columnGroupIndex:b,pathFrom:z.pathFrom,pathTo:z.pathTo,strokeWidth:I,elSeries:k,x:n,y:o,series:t,barHeight:S,barWidth:L,elDataLabelsWrap:A,elGoalsMarkers:C,type:"bar",visibleSeries:b,classes:E}))}a.globals.seriesXvalues[p]=m,a.globals.seriesYvalues[p]=y,i.groupCtx.prevY.push(i.groupCtx.yArrj),i.groupCtx.prevYF.push(i.groupCtx.yArrjF),i.groupCtx.prevYVal.push(i.groupCtx.yArrjVal),i.groupCtx.prevX.push(i.groupCtx.xArrj),i.groupCtx.prevXF.push(i.groupCtx.xArrjF),i.groupCtx.prevXVal.push(i.groupCtx.xArrjVal),r.add(k)},h=0,c=0;h1?l=(i=h.globals.minXDiff/this.xRatio)*parseInt(this.barOptions.columnWidth,10)/100:-1===String(d).indexOf("%")?l=parseInt(d,10):l*=parseInt(d,10)/100,s=this.isReversed?this.baseLineY[n]:h.globals.gridHeight-this.baseLineY[n],t=h.globals.padHorizontal+(i-l)/2}var u=h.globals.barGroups.length||1;return{x:t,y:e,yDivision:a,xDivision:i,barHeight:o/u,barWidth:l/u,zeroH:s,zeroW:r}}},{key:"drawStackedBarPaths",value:function(t){for(var e,i=t.indexes,a=t.barHeight,s=t.strokeWidth,r=t.zeroW,n=t.x,o=t.y,l=t.columnGroupIndex,h=t.seriesGroup,c=t.yDivision,d=t.elSeries,u=this.w,g=o+l*a,p=i.i,f=i.j,x=i.realIndex,b=i.translationsIndex,m=0,v=0;v0){var w=r;this.groupCtx.prevXVal[y-1][f]<0?w=this.series[p][f]>=0?this.groupCtx.prevX[y-1][f]+m-2*(this.isReversed?m:0):this.groupCtx.prevX[y-1][f]:this.groupCtx.prevXVal[y-1][f]>=0&&(w=this.series[p][f]>=0?this.groupCtx.prevX[y-1][f]:this.groupCtx.prevX[y-1][f]-m+2*(this.isReversed?m:0)),e=w}else e=r;n=null===this.series[p][f]?e:e+this.series[p][f]/this.invertedYRatio-2*(this.isReversed?this.series[p][f]/this.invertedYRatio:0);var k=this.barHelpers.getBarpaths({barYPosition:g,barHeight:a,x1:e,x2:n,strokeWidth:s,isReversed:this.isReversed,series:this.series,realIndex:i.realIndex,seriesGroup:h,i:p,j:f,w:u});return this.barHelpers.barBackground({j:f,i:p,y1:g,y2:a,elSeries:d}),o+=c,{pathTo:k.pathTo,pathFrom:k.pathFrom,goalX:this.barHelpers.getGoalValues("x",r,null,p,f,b),barXPosition:e,barYPosition:g,x:n,y:o}}},{key:"drawStackedColumnPaths",value:function(t){var e=t.indexes,i=t.x,a=t.y,s=t.xDivision,r=t.barWidth,n=t.zeroH,o=t.columnGroupIndex,l=t.seriesGroup,h=t.elSeries,c=this.w,d=e.i,u=e.j,g=e.bc,p=e.realIndex,f=e.translationsIndex;if(c.globals.isXNumeric){var x=c.globals.seriesX[p][u];x||(x=0),i=(x-c.globals.minX)/this.xRatio-r/2*c.globals.barGroups.length}for(var b,m=i+o*r,v=0,y=0;y0&&!c.globals.isXNumeric||w>0&&c.globals.isXNumeric&&c.globals.seriesX[p-1][u]===c.globals.seriesX[p][u]){var k,A,C,S=Math.min(this.yRatio.length+1,p+1);if(void 0!==this.groupCtx.prevY[w-1]&&this.groupCtx.prevY[w-1].length)for(var L=1;L=0?C-v+2*(this.isReversed?v:0):C;break}if((null===(T=this.groupCtx.prevYVal[w-P])||void 0===T?void 0:T[u])>=0){A=this.series[d][u]>=0?C:C+v-2*(this.isReversed?v:0);break}}void 0===A&&(A=c.globals.gridHeight),b=null!==(k=this.groupCtx.prevYF[0])&&void 0!==k&&k.every((function(t){return 0===t}))&&this.groupCtx.prevYF.slice(1,w).every((function(t){return t.every((function(t){return isNaN(t)}))}))?n:A}else b=n;a=this.series[d][u]?b-this.series[d][u]/this.yRatio[f]+2*(this.isReversed?this.series[d][u]/this.yRatio[f]:0):b;var z=this.barHelpers.getColumnPaths({barXPosition:m,barWidth:r,y1:b,y2:a,yRatio:this.yRatio[f],strokeWidth:this.strokeWidth,isReversed:this.isReversed,series:this.series,seriesGroup:l,realIndex:e.realIndex,i:d,j:u,w:c});return this.barHelpers.barBackground({bc:g,j:u,i:d,x1:m,x2:r,elSeries:h}),{pathTo:z.pathTo,pathFrom:z.pathFrom,goalY:this.barHelpers.getGoalValues("y",null,n,d,u),barXPosition:m,x:c.globals.isXNumeric?i:i+s,y:a}}}]),a}(Pa),Ta=function(t){h(a,t);var e=n(a);function a(){return i(this,a),e.apply(this,arguments)}return s(a,[{key:"draw",value:function(t,e,i){var a=this,s=this.w,r=new Mi(this.ctx),n=s.globals.comboCharts?e:s.config.chart.type,o=new ji(this.ctx);this.candlestickOptions=this.w.config.plotOptions.candlestick,this.boxOptions=this.w.config.plotOptions.boxPlot,this.isHorizontal=s.config.plotOptions.bar.horizontal;var l=new Pi(this.ctx,s);t=l.getLogSeries(t),this.series=t,this.yRatio=l.getLogYRatios(this.yRatio),this.barHelpers.initVariables(t);for(var h=r.group({class:"apexcharts-".concat(n,"-series apexcharts-plot-series")}),c=function(e){a.isBoxPlot="boxPlot"===s.config.chart.type||"boxPlot"===s.config.series[e].type;var n,l,c,d,g=void 0,p=void 0,f=[],x=[],b=s.globals.comboCharts?i[e]:e,m=a.barHelpers.getGroupIndex(b).columnGroupIndex,y=r.group({class:"apexcharts-series",seriesName:v.escapeString(s.globals.seriesNames[b]),rel:e+1,"data:realIndex":b});a.ctx.series.addCollapsedClassToSeries(y,b),t[e].length>0&&(a.visibleI=a.visibleI+1);var w,k,A=0;a.yRatio.length>1&&(a.yaxisIndex=s.globals.seriesYAxisReverseMap[b][0],A=b);var C=a.barHelpers.initialPositions(b);p=C.y,w=C.barHeight,l=C.yDivision,d=C.zeroW,g=C.x,k=C.barWidth,n=C.xDivision,c=C.zeroH,x.push(g+k/2);for(var S=r.group({class:"apexcharts-datalabels","data:realIndex":b}),L=r.group({class:"apexcharts-bar-goals-markers"}),M=function(i){var r=a.barHelpers.getStrokeWidth(e,i,b),h=null,v={indexes:{i:e,j:i,realIndex:b,translationsIndex:A},x:g,y:p,strokeWidth:r,elSeries:y};h=a.isHorizontal?a.drawHorizontalBoxPaths(u(u({},v),{},{yDivision:l,barHeight:w,zeroW:d})):a.drawVerticalBoxPaths(u(u({},v),{},{xDivision:n,barWidth:k,zeroH:c})),p=h.y,g=h.x;var C=a.barHelpers.drawGoalLine({barXPosition:h.barXPosition,barYPosition:h.barYPosition,goalX:h.goalX,goalY:h.goalY,barHeight:w,barWidth:k});C&&L.add(C),i>0&&x.push(g+k/2),f.push(p),h.pathTo.forEach((function(n,l){var c=!a.isBoxPlot&&a.candlestickOptions.wick.useFillColor?h.color[l]:s.globals.stroke.colors[e],d=o.fillPath({seriesNumber:b,dataPointIndex:i,color:h.color[l],value:t[e][i]});a.renderSeries({realIndex:b,pathFill:d,lineFill:c,j:i,i:e,pathFrom:h.pathFrom,pathTo:n,strokeWidth:r,elSeries:y,x:g,y:p,series:t,columnGroupIndex:m,barHeight:w,barWidth:k,elDataLabelsWrap:S,elGoalsMarkers:L,visibleSeries:a.visibleI,type:s.config.chart.type})}))},P=0;P0&&(M=this.getPreviousPath(g,c,!0)),L=this.isBoxPlot?[l.move(S,k)+l.line(S+s/2,k)+l.line(S+s/2,v)+l.line(S+s/4,v)+l.line(S+s-s/4,v)+l.line(S+s/2,v)+l.line(S+s/2,k)+l.line(S+s,k)+l.line(S+s,C)+l.line(S,C)+l.line(S,k+n/2),l.move(S,C)+l.line(S+s,C)+l.line(S+s,A)+l.line(S+s/2,A)+l.line(S+s/2,y)+l.line(S+s-s/4,y)+l.line(S+s/4,y)+l.line(S+s/2,y)+l.line(S+s/2,A)+l.line(S,A)+l.line(S,C)+"z"]:[l.move(S,A)+l.line(S+s/2,A)+l.line(S+s/2,v)+l.line(S+s/2,A)+l.line(S+s,A)+l.line(S+s,k)+l.line(S+s/2,k)+l.line(S+s/2,y)+l.line(S+s/2,k)+l.line(S,k)+l.line(S,A-n/2)],M+=l.move(S,k),o.globals.isXNumeric||(i+=a),{pathTo:L,pathFrom:M,x:i,y:A,goalY:this.barHelpers.getGoalValues("y",null,r,h,c,e.translationsIndex),barXPosition:S,color:w}}},{key:"drawHorizontalBoxPaths",value:function(t){var e=t.indexes;t.x;var i=t.y,a=t.yDivision,s=t.barHeight,r=t.zeroW,n=t.strokeWidth,o=this.w,l=new Mi(this.ctx),h=e.i,c=e.j,d=this.boxOptions.colors.lower;this.isBoxPlot&&(d=[this.boxOptions.colors.lower,this.boxOptions.colors.upper]);var u=this.invertedYRatio,g=e.realIndex,p=this.getOHLCValue(g,c),f=r,x=r,b=Math.min(p.o,p.c),m=Math.max(p.o,p.c),v=p.m;o.globals.isXNumeric&&(i=(o.globals.seriesX[g][c]-o.globals.minX)/this.invertedXRatio-s/2);var y=i+s*this.visibleI;void 0===this.series[h][c]||null===this.series[h][c]?(b=r,m=r):(b=r+b/u,m=r+m/u,f=r+p.h/u,x=r+p.l/u,v=r+p.m/u);var w=l.move(r,y),k=l.move(b,y+s/2);return o.globals.previousPaths.length>0&&(k=this.getPreviousPath(g,c,!0)),w=[l.move(b,y)+l.line(b,y+s/2)+l.line(f,y+s/2)+l.line(f,y+s/2-s/4)+l.line(f,y+s/2+s/4)+l.line(f,y+s/2)+l.line(b,y+s/2)+l.line(b,y+s)+l.line(v,y+s)+l.line(v,y)+l.line(b+n/2,y),l.move(v,y)+l.line(v,y+s)+l.line(m,y+s)+l.line(m,y+s/2)+l.line(x,y+s/2)+l.line(x,y+s-s/4)+l.line(x,y+s/4)+l.line(x,y+s/2)+l.line(m,y+s/2)+l.line(m,y)+l.line(v,y)+"z"],k+=l.move(b,y),o.globals.isXNumeric||(i+=a),{pathTo:w,pathFrom:k,x:m,y:i,goalX:this.barHelpers.getGoalValues("x",r,null,h,c),barYPosition:y,color:d}}},{key:"getOHLCValue",value:function(t,e){var i=this.w,a=new Pi(this.ctx,i),s=a.getLogValAtSeriesIndex(i.globals.seriesCandleH[t][e],t),r=a.getLogValAtSeriesIndex(i.globals.seriesCandleO[t][e],t),n=a.getLogValAtSeriesIndex(i.globals.seriesCandleM[t][e],t),o=a.getLogValAtSeriesIndex(i.globals.seriesCandleC[t][e],t),l=a.getLogValAtSeriesIndex(i.globals.seriesCandleL[t][e],t);return{o:this.isBoxPlot?s:r,h:this.isBoxPlot?r:s,m:n,l:this.isBoxPlot?o:l,c:this.isBoxPlot?l:o}}}]),a}(Pa),za=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"checkColorRange",value:function(){var t=this.w,e=!1,i=t.config.plotOptions[t.config.chart.type];return i.colorScale.ranges.length>0&&i.colorScale.ranges.map((function(t,i){t.from<=0&&(e=!0)})),e}},{key:"getShadeColor",value:function(t,e,i,a){var s=this.w,r=1,n=s.config.plotOptions[t].shadeIntensity,o=this.determineColor(t,e,i);s.globals.hasNegs||a?r=s.config.plotOptions[t].reverseNegativeShade?o.percent<0?o.percent/100*(1.25*n):(1-o.percent/100)*(1.25*n):o.percent<=0?1-(1+o.percent/100)*n:(1-o.percent/100)*n:(r=1-o.percent/100,"treemap"===t&&(r=(1-o.percent/100)*(1.25*n)));var l=o.color,h=new v;if(s.config.plotOptions[t].enableShades)if("dark"===this.w.config.theme.mode){var c=h.shadeColor(-1*r,o.color);l=v.hexToRgba(v.isColorHex(c)?c:v.rgb2hex(c),s.config.fill.opacity)}else{var d=h.shadeColor(r,o.color);l=v.hexToRgba(v.isColorHex(d)?d:v.rgb2hex(d),s.config.fill.opacity)}return{color:l,colorProps:o}}},{key:"determineColor",value:function(t,e,i){var a=this.w,s=a.globals.series[e][i],r=a.config.plotOptions[t],n=r.colorScale.inverse?i:e;r.distributed&&"treemap"===a.config.chart.type&&(n=i);var o=a.globals.colors[n],l=null,h=Math.min.apply(Math,f(a.globals.series[e])),c=Math.max.apply(Math,f(a.globals.series[e]));r.distributed||"heatmap"!==t||(h=a.globals.minY,c=a.globals.maxY),void 0!==r.colorScale.min&&(h=r.colorScale.mina.globals.maxY?r.colorScale.max:a.globals.maxY);var d=Math.abs(c)+Math.abs(h),u=100*s/(0===d?d-1e-6:d);r.colorScale.ranges.length>0&&r.colorScale.ranges.map((function(t,e){if(s>=t.from&&s<=t.to){o=t.color,l=t.foreColor?t.foreColor:null,h=t.from,c=t.to;var i=Math.abs(c)+Math.abs(h);u=100*s/(0===i?i-1e-6:i)}}));return{color:o,foreColor:l,percent:u}}},{key:"calculateDataLabels",value:function(t){var e=t.text,i=t.x,a=t.y,s=t.i,r=t.j,n=t.colorProps,o=t.fontSize,l=this.w.config.dataLabels,h=new Mi(this.ctx),c=new qi(this.ctx),d=null;if(l.enabled){d=h.group({class:"apexcharts-data-labels"});var u=l.offsetX,g=l.offsetY,p=i+u,f=a+parseFloat(l.style.fontSize)/3+g;c.plotDataLabelsText({x:p,y:f,text:e,i:s,j:r,color:n.foreColor,parent:d,fontSize:o,dataLabelsConfig:l})}return d}},{key:"addListeners",value:function(t){var e=new Mi(this.ctx);t.node.addEventListener("mouseenter",e.pathMouseEnter.bind(this,t)),t.node.addEventListener("mouseleave",e.pathMouseLeave.bind(this,t)),t.node.addEventListener("mousedown",e.pathMouseDown.bind(this,t))}}]),t}(),Xa=function(){function t(e,a){i(this,t),this.ctx=e,this.w=e.w,this.xRatio=a.xRatio,this.yRatio=a.yRatio,this.dynamicAnim=this.w.config.chart.animations.dynamicAnimation,this.helpers=new za(e),this.rectRadius=this.w.config.plotOptions.heatmap.radius,this.strokeWidth=this.w.config.stroke.show?this.w.config.stroke.width:0}return s(t,[{key:"draw",value:function(t){var e=this.w,i=new Mi(this.ctx),a=i.group({class:"apexcharts-heatmap"});a.attr("clip-path","url(#gridRectMask".concat(e.globals.cuid,")"));var s=e.globals.gridWidth/e.globals.dataPoints,r=e.globals.gridHeight/e.globals.series.length,n=0,o=!1;this.negRange=this.helpers.checkColorRange();var l=t.slice();e.config.yaxis[0].reversed&&(o=!0,l.reverse());for(var h=o?0:l.length-1;o?h=0;o?h++:h--){var c=i.group({class:"apexcharts-series apexcharts-heatmap-series",seriesName:v.escapeString(e.globals.seriesNames[h]),rel:h+1,"data:realIndex":h});if(this.ctx.series.addCollapsedClassToSeries(c,h),e.config.chart.dropShadow.enabled){var d=e.config.chart.dropShadow;new Li(this.ctx).dropShadow(c,d,h)}for(var u=0,g=e.config.plotOptions.heatmap.shadeIntensity,p=0,f=0;f=l[h].length)break;var x=this.helpers.getShadeColor(e.config.chart.type,h,p,this.negRange),b=x.color,m=x.colorProps;if("image"===e.config.fill.type)b=new ji(this.ctx).fillPath({seriesNumber:h,dataPointIndex:p,opacity:e.globals.hasNegs?m.percent<0?1-(1+m.percent/100):g+m.percent/100:m.percent/100,patternID:v.randomId(),width:e.config.fill.image.width?e.config.fill.image.width:s,height:e.config.fill.image.height?e.config.fill.image.height:r});var y=this.rectRadius,w=i.drawRect(u,n,s,r,y);if(w.attr({cx:u,cy:n}),w.node.classList.add("apexcharts-heatmap-rect"),c.add(w),w.attr({fill:b,i:h,index:h,j:p,val:t[h][p],"stroke-width":this.strokeWidth,stroke:e.config.plotOptions.heatmap.useFillColorAsStroke?b:e.globals.stroke.colors[0],color:b}),this.helpers.addListeners(w),e.config.chart.animations.enabled&&!e.globals.dataChanged){var k=1;e.globals.resized||(k=e.config.chart.animations.speed),this.animateHeatMap(w,u,n,s,r,k)}if(e.globals.dataChanged){var A=1;if(this.dynamicAnim.enabled&&e.globals.shouldAnimate){A=this.dynamicAnim.speed;var C=e.globals.previousPaths[h]&&e.globals.previousPaths[h][p]&&e.globals.previousPaths[h][p].color;C||(C="rgba(255, 255, 255, 0)"),this.animateHeatColor(w,v.isColorHex(C)?C:v.rgb2hex(C),v.isColorHex(b)?b:v.rgb2hex(b),A)}}var S=(0,e.config.dataLabels.formatter)(e.globals.series[h][p],{value:e.globals.series[h][p],seriesIndex:h,dataPointIndex:p,w:e}),L=this.helpers.calculateDataLabels({text:S,x:u+s/2,y:n+r/2,i:h,j:p,colorProps:m,series:l});null!==L&&c.add(L),u+=s,p++}n+=r,a.add(c)}var M=e.globals.yAxisScale[0].result.slice();return e.config.yaxis[0].reversed?M.unshift(""):M.push(""),e.globals.yAxisScale[0].result=M,a}},{key:"animateHeatMap",value:function(t,e,i,a,s,r){var n=new y(this.ctx);n.animateRect(t,{x:e+a/2,y:i+s/2,width:0,height:0},{x:e,y:i,width:a,height:s},r,(function(){n.animationCompleted(t)}))}},{key:"animateHeatColor",value:function(t,e,i,a){t.attr({fill:e}).animate(a).attr({fill:i})}}]),t}(),Ra=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"drawYAxisTexts",value:function(t,e,i,a){var s=this.w,r=s.config.yaxis[0],n=s.globals.yLabelFormatters[0];return new Mi(this.ctx).drawText({x:t+r.labels.offsetX,y:e+r.labels.offsetY,text:n(a,i),textAnchor:"middle",fontSize:r.labels.style.fontSize,fontFamily:r.labels.style.fontFamily,foreColor:Array.isArray(r.labels.style.colors)?r.labels.style.colors[i]:r.labels.style.colors})}}]),t}(),Ea=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w;var a=this.w;this.chartType=this.w.config.chart.type,this.initialAnim=this.w.config.chart.animations.enabled,this.dynamicAnim=this.initialAnim&&this.w.config.chart.animations.dynamicAnimation.enabled,this.animBeginArr=[0],this.animDur=0,this.donutDataLabels=this.w.config.plotOptions.pie.donut.labels,this.lineColorArr=void 0!==a.globals.stroke.colors?a.globals.stroke.colors:a.globals.colors,this.defaultSize=Math.min(a.globals.gridWidth,a.globals.gridHeight),this.centerY=this.defaultSize/2,this.centerX=a.globals.gridWidth/2,"radialBar"===a.config.chart.type?this.fullAngle=360:this.fullAngle=Math.abs(a.config.plotOptions.pie.endAngle-a.config.plotOptions.pie.startAngle),this.initialAngle=a.config.plotOptions.pie.startAngle%this.fullAngle,a.globals.radialSize=this.defaultSize/2.05-a.config.stroke.width-(a.config.chart.sparkline.enabled?0:a.config.chart.dropShadow.blur),this.donutSize=a.globals.radialSize*parseInt(a.config.plotOptions.pie.donut.size,10)/100;var s=a.config.plotOptions.pie.customScale,r=a.globals.gridWidth/2,n=a.globals.gridHeight/2;this.translateX=r-r*s,this.translateY=n-n*s,this.dataLabelsGroup=new Mi(this.ctx).group({class:"apexcharts-datalabels-group",transform:"translate(".concat(this.translateX,", ").concat(this.translateY,") scale(").concat(s,")")}),this.maxY=0,this.sliceLabels=[],this.sliceSizes=[],this.prevSectorAngleArr=[]}return s(t,[{key:"draw",value:function(t){var e=this,i=this.w,a=new Mi(this.ctx),s=a.group({class:"apexcharts-pie"});if(i.globals.noData)return s;for(var r=0,n=0;n-1&&this.pieClicked(d),i.config.dataLabels.enabled){var w=m.x,k=m.y,A=100*g/this.fullAngle+"%";if(0!==g&&i.config.plotOptions.pie.dataLabels.minAngleToShowLabelthis.fullAngle?e.endAngle=e.endAngle-(a+n):a+n=this.fullAngle+this.w.config.plotOptions.pie.startAngle%this.fullAngle&&(h=this.fullAngle+this.w.config.plotOptions.pie.startAngle%this.fullAngle-.01),Math.ceil(h)>this.fullAngle&&(h-=this.fullAngle);var c=Math.PI*(h-90)/180,d=i.centerX+r*Math.cos(l),u=i.centerY+r*Math.sin(l),g=i.centerX+r*Math.cos(c),p=i.centerY+r*Math.sin(c),f=v.polarToCartesian(i.centerX,i.centerY,i.donutSize,h),x=v.polarToCartesian(i.centerX,i.centerY,i.donutSize,o),b=s>180?1:0,m=["M",d,u,"A",r,r,0,b,1,g,p];return e="donut"===i.chartType?[].concat(m,["L",f.x,f.y,"A",i.donutSize,i.donutSize,0,b,0,x.x,x.y,"L",d,u,"z"]).join(" "):"pie"===i.chartType||"polarArea"===i.chartType?[].concat(m,["L",i.centerX,i.centerY,"L",d,u]).join(" "):[].concat(m).join(" "),n.roundPathCorners(e,2*this.strokeWidth)}},{key:"drawPolarElements",value:function(t){var e=this.w,i=new ta(this.ctx),a=new Mi(this.ctx),s=new Ra(this.ctx),r=a.group(),n=a.group(),o=i.niceScale(0,Math.ceil(this.maxY),0),l=o.result.reverse(),h=o.result.length;this.maxY=o.niceMax;for(var c=e.globals.radialSize,d=c/(h-1),u=0;u1&&t.total.show&&(s=t.total.color);var n=r.globals.dom.baseEl.querySelector(".apexcharts-datalabel-label"),o=r.globals.dom.baseEl.querySelector(".apexcharts-datalabel-value");i=(0,t.value.formatter)(i,r),a||"function"!=typeof t.total.formatter||(i=t.total.formatter(r));var l=e===t.total.label;e=this.donutDataLabels.total.label?t.name.formatter(e,l,r):"",null!==n&&(n.textContent=e),null!==o&&(o.textContent=i),null!==n&&(n.style.fill=s)}},{key:"printDataLabelsInner",value:function(t,e){var i=this.w,a=t.getAttribute("data:value"),s=i.globals.seriesNames[parseInt(t.parentNode.getAttribute("rel"),10)-1];i.globals.series.length>1&&this.printInnerLabels(e,s,a,t);var r=i.globals.dom.baseEl.querySelector(".apexcharts-datalabels-group");null!==r&&(r.style.opacity=1)}},{key:"drawSpokes",value:function(t){var e=this,i=this.w,a=new Mi(this.ctx),s=i.config.plotOptions.polarArea.spokes;if(0!==s.strokeWidth){for(var r=[],n=360/i.globals.series.length,o=0;o0&&(f=e.getPreviousPath(n));for(var x=0;x=10?t.x>0?(i="start",a+=10):t.x<0&&(i="end",a-=10):i="middle",Math.abs(t.y)>=e-10&&(t.y<0?s-=10:t.y>0&&(s+=10)),{textAnchor:i,newX:a,newY:s}}},{key:"getPreviousPath",value:function(t){for(var e=this.w,i=null,a=0;a0&&parseInt(s.realIndex,10)===parseInt(t,10)&&void 0!==e.globals.previousPaths[a].paths[0]&&(i=e.globals.previousPaths[a].paths[0].d)}return i}},{key:"getDataPointsPos",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dataPointsLen;t=t||[],e=e||[];for(var a=[],s=0;s=360&&(u=360-Math.abs(this.startAngle)-.1);var g=i.drawPath({d:"",stroke:c,strokeWidth:n*parseInt(h.strokeWidth,10)/100,fill:"none",strokeOpacity:h.opacity,classes:"apexcharts-radialbar-area"});if(h.dropShadow.enabled){var p=h.dropShadow;s.dropShadow(g,p)}l.add(g),g.attr("id","apexcharts-radialbarTrack-"+o),this.animatePaths(g,{centerX:t.centerX,centerY:t.centerY,endAngle:u,startAngle:d,size:t.size,i:o,totalItems:2,animBeginArr:0,dur:0,isTrack:!0})}return a}},{key:"drawArcs",value:function(t){var e=this.w,i=new Mi(this.ctx),a=new ji(this.ctx),s=new Li(this.ctx),r=i.group(),n=this.getStrokeWidth(t);t.size=t.size-n/2;var o=e.config.plotOptions.radialBar.hollow.background,l=t.size-n*t.series.length-this.margin*t.series.length-n*parseInt(e.config.plotOptions.radialBar.track.strokeWidth,10)/100/2,h=l-e.config.plotOptions.radialBar.hollow.margin;void 0!==e.config.plotOptions.radialBar.hollow.image&&(o=this.drawHollowImage(t,r,l,o));var c=this.drawHollow({size:h,centerX:t.centerX,centerY:t.centerY,fill:o||"transparent"});if(e.config.plotOptions.radialBar.hollow.dropShadow.enabled){var d=e.config.plotOptions.radialBar.hollow.dropShadow;s.dropShadow(c,d)}var u=1;!this.radialDataLabels.total.show&&e.globals.series.length>1&&(u=0);var g=null;if(this.radialDataLabels.show){var p=e.globals.dom.Paper.findOne(".apexcharts-datalabels-group");g=this.renderInnerDataLabels(p,this.radialDataLabels,{hollowSize:l,centerX:t.centerX,centerY:t.centerY,opacity:u})}"back"===e.config.plotOptions.radialBar.hollow.position&&(r.add(c),g&&r.add(g));var f=!1;e.config.plotOptions.radialBar.inverseOrder&&(f=!0);for(var x=f?t.series.length-1:0;f?x>=0:x100?100:t.series[x])/100,A=Math.round(this.totalAngle*k)+this.startAngle,C=void 0;e.globals.dataChanged&&(w=this.startAngle,C=Math.round(this.totalAngle*v.negToZero(e.globals.previousPaths[x])/100)+w),Math.abs(A)+Math.abs(y)>360&&(A-=.01),Math.abs(C)+Math.abs(w)>360&&(C-=.01);var S=A-y,L=Array.isArray(e.config.stroke.dashArray)?e.config.stroke.dashArray[x]:e.config.stroke.dashArray,M=i.drawPath({d:"",stroke:m,strokeWidth:n,fill:"none",fillOpacity:e.config.fill.opacity,classes:"apexcharts-radialbar-area apexcharts-radialbar-slice-"+x,strokeDashArray:L});if(Mi.setAttrs(M.node,{"data:angle":S,"data:value":t.series[x]}),e.config.chart.dropShadow.enabled){var P=e.config.chart.dropShadow;s.dropShadow(M,P,x)}if(s.setSelectionFilter(M,0,x),this.addListeners(M,this.radialDataLabels),b.add(M),M.attr({index:0,j:x}),this.barLabels.enabled){var I=v.polarToCartesian(t.centerX,t.centerY,t.size,y),T=this.barLabels.formatter(e.globals.seriesNames[x],{seriesIndex:x,w:e}),z=["apexcharts-radialbar-label"];this.barLabels.onClick||z.push("apexcharts-no-click");var X=this.barLabels.useSeriesColors?e.globals.colors[x]:e.config.chart.foreColor;X||(X=e.config.chart.foreColor);var R=I.x+this.barLabels.offsetX,E=I.y+this.barLabels.offsetY,Y=i.drawText({x:R,y:E,text:T,textAnchor:"end",dominantBaseline:"middle",fontFamily:this.barLabels.fontFamily,fontWeight:this.barLabels.fontWeight,fontSize:this.barLabels.fontSize,foreColor:X,cssClass:z.join(" ")});Y.on("click",this.onBarLabelClick),Y.attr({rel:x+1}),0!==y&&Y.attr({"transform-origin":"".concat(R," ").concat(E),transform:"rotate(".concat(y," 0 0)")}),b.add(Y)}var H=0;!this.initialAnim||e.globals.resized||e.globals.dataChanged||(H=e.config.chart.animations.speed),e.globals.dataChanged&&(H=e.config.chart.animations.dynamicAnimation.speed),this.animDur=H/(1.2*t.series.length)+this.animDur,this.animBeginArr.push(this.animDur),this.animatePaths(M,{centerX:t.centerX,centerY:t.centerY,endAngle:A,startAngle:y,prevEndAngle:C,prevStartAngle:w,size:t.size,i:x,totalItems:2,animBeginArr:this.animBeginArr,dur:H,shouldSetPrevPaths:!0})}return{g:r,elHollow:c,dataLabels:g}}},{key:"drawHollow",value:function(t){var e=new Mi(this.ctx).drawCircle(2*t.size);return e.attr({class:"apexcharts-radialbar-hollow",cx:t.centerX,cy:t.centerY,r:t.size,fill:t.fill}),e}},{key:"drawHollowImage",value:function(t,e,i,a){var s=this.w,r=new ji(this.ctx),n=v.randomId(),o=s.config.plotOptions.radialBar.hollow.image;if(s.config.plotOptions.radialBar.hollow.imageClipped)r.clippedImgArea({width:i,height:i,image:o,patternID:"pattern".concat(s.globals.cuid).concat(n)}),a="url(#pattern".concat(s.globals.cuid).concat(n,")");else{var l=s.config.plotOptions.radialBar.hollow.imageWidth,h=s.config.plotOptions.radialBar.hollow.imageHeight;if(void 0===l&&void 0===h){var c=s.globals.dom.Paper.image(o,(function(e){this.move(t.centerX-e.width/2+s.config.plotOptions.radialBar.hollow.imageOffsetX,t.centerY-e.height/2+s.config.plotOptions.radialBar.hollow.imageOffsetY)}));e.add(c)}else{var d=s.globals.dom.Paper.image(o,(function(e){this.move(t.centerX-l/2+s.config.plotOptions.radialBar.hollow.imageOffsetX,t.centerY-h/2+s.config.plotOptions.radialBar.hollow.imageOffsetY),this.size(l,h)}));e.add(d)}}return a}},{key:"getStrokeWidth",value:function(t){var e=this.w;return t.size*(100-parseInt(e.config.plotOptions.radialBar.hollow.size,10))/100/(t.series.length+1)-this.margin}},{key:"onBarLabelClick",value:function(t){var e=parseInt(t.target.getAttribute("rel"),10)-1,i=this.barLabels.onClick,a=this.w;i&&i(a.globals.seriesNames[e],{w:a,seriesIndex:e})}}]),r}(Ea),Oa=function(t){h(a,t);var e=n(a);function a(){return i(this,a),e.apply(this,arguments)}return s(a,[{key:"draw",value:function(t,e){var i=this.w,a=new Mi(this.ctx);this.rangeBarOptions=this.w.config.plotOptions.rangeBar,this.series=t,this.seriesRangeStart=i.globals.seriesRangeStart,this.seriesRangeEnd=i.globals.seriesRangeEnd,this.barHelpers.initVariables(t);for(var s=a.group({class:"apexcharts-rangebar-series apexcharts-plot-series"}),r=0;r0&&(this.visibleI=this.visibleI+1);var x=0,b=0,m=0;this.yRatio.length>1&&(this.yaxisIndex=i.globals.seriesYAxisReverseMap[g][0],m=g);var y=this.barHelpers.initialPositions(g);d=y.y,h=y.zeroW,c=y.x,b=y.barWidth,x=y.barHeight,n=y.xDivision,o=y.yDivision,l=y.zeroH;for(var w=a.group({class:"apexcharts-datalabels","data:realIndex":g}),k=a.group({class:"apexcharts-rangebar-goals-markers"}),A=0;A0}));return this.isHorizontal?(a=u.config.plotOptions.bar.rangeBarGroupRows?r+h*b:r+o*this.visibleI+h*b,m>-1&&!u.config.plotOptions.bar.rangeBarOverlap&&(g=u.globals.seriesRange[e][m].overlaps).indexOf(p)>-1&&(a=(o=d.barHeight/g.length)*this.visibleI+h*(100-parseInt(this.barOptions.barHeight,10))/100/2+o*(this.visibleI+g.indexOf(p))+h*b)):(b>-1&&!u.globals.timescaleLabels.length&&(s=u.config.plotOptions.bar.rangeBarGroupRows?n+c*b:n+l*this.visibleI+c*b),m>-1&&!u.config.plotOptions.bar.rangeBarOverlap&&(g=u.globals.seriesRange[e][m].overlaps).indexOf(p)>-1&&(s=(l=d.barWidth/g.length)*this.visibleI+c*(100-parseInt(this.barOptions.barWidth,10))/100/2+l*(this.visibleI+g.indexOf(p))+c*b)),{barYPosition:a,barXPosition:s,barHeight:o,barWidth:l}}},{key:"drawRangeColumnPaths",value:function(t){var e=t.indexes,i=t.x,a=t.xDivision,s=t.barWidth,r=t.barXPosition,n=t.zeroH,o=this.w,l=e.i,h=e.j,c=e.realIndex,d=e.translationsIndex,u=this.yRatio[d],g=this.getRangeValue(c,h),p=Math.min(g.start,g.end),f=Math.max(g.start,g.end);void 0===this.series[l][h]||null===this.series[l][h]?p=n:(p=n-p/u,f=n-f/u);var x=Math.abs(f-p),b=this.barHelpers.getColumnPaths({barXPosition:r,barWidth:s,y1:p,y2:f,strokeWidth:this.strokeWidth,series:this.seriesRangeEnd,realIndex:c,i:c,j:h,w:o});if(o.globals.isXNumeric){var m=this.getBarXForNumericXAxis({x:i,j:h,realIndex:c,barWidth:s});i=m.x,r=m.barXPosition}else i+=a;return{pathTo:b.pathTo,pathFrom:b.pathFrom,barHeight:x,x:i,y:g.start<0&&g.end<0?p:f,goalY:this.barHelpers.getGoalValues("y",null,n,l,h,d),barXPosition:r}}},{key:"preventBarOverflow",value:function(t){var e=this.w;return t<0&&(t=0),t>e.globals.gridWidth&&(t=e.globals.gridWidth),t}},{key:"drawRangeBarPaths",value:function(t){var e=t.indexes,i=t.y,a=t.y1,s=t.y2,r=t.yDivision,n=t.barHeight,o=t.barYPosition,l=t.zeroW,h=this.w,c=e.realIndex,d=e.j,u=this.preventBarOverflow(l+a/this.invertedYRatio),g=this.preventBarOverflow(l+s/this.invertedYRatio),p=this.getRangeValue(c,d),f=Math.abs(g-u),x=this.barHelpers.getBarpaths({barYPosition:o,barHeight:n,x1:u,x2:g,strokeWidth:this.strokeWidth,series:this.seriesRangeEnd,i:c,realIndex:c,j:d,w:h});return h.globals.isXNumeric||(i+=r),{pathTo:x.pathTo,pathFrom:x.pathFrom,barWidth:f,x:p.start<0&&p.end<0?u:g,goalX:this.barHelpers.getGoalValues("x",l,null,c,d),y:i}}},{key:"getRangeValue",value:function(t,e){var i=this.w;return{start:i.globals.seriesRangeStart[t][e],end:i.globals.seriesRangeEnd[t][e]}}}]),a}(Pa),Fa=function(){function t(e){i(this,t),this.w=e.w,this.lineCtx=e}return s(t,[{key:"sameValueSeriesFix",value:function(t,e){var i=this.w;if(("gradient"===i.config.fill.type||"gradient"===i.config.fill.type[t])&&new Pi(this.lineCtx.ctx,i).seriesHaveSameValues(t)){var a=e[t].slice();a[a.length-1]=a[a.length-1]+1e-6,e[t]=a}return e}},{key:"calculatePoints",value:function(t){var e=t.series,i=t.realIndex,a=t.x,s=t.y,r=t.i,n=t.j,o=t.prevY,l=this.w,h=[],c=[],d=this.lineCtx.categoryAxisCorrection+l.config.markers.offsetX;return l.globals.isXNumeric&&(d=(l.globals.seriesX[i][0]-l.globals.minX)/this.lineCtx.xRatio+l.config.markers.offsetX),0===n&&(h.push(d),c.push(v.isNumber(e[r][0])?o+l.config.markers.offsetY:null)),h.push(a+l.config.markers.offsetX),c.push(v.isNumber(e[r][n+1])?s+l.config.markers.offsetY:null),{x:h,y:c}}},{key:"checkPreviousPaths",value:function(t){for(var e=t.pathFromLine,i=t.pathFromArea,a=t.realIndex,s=this.w,r=0;r0&&parseInt(n.realIndex,10)===parseInt(a,10)&&("line"===n.type?(this.lineCtx.appendPathFrom=!1,e=s.globals.previousPaths[r].paths[0].d):"area"===n.type&&(this.lineCtx.appendPathFrom=!1,i=s.globals.previousPaths[r].paths[0].d,s.config.stroke.show&&s.globals.previousPaths[r].paths[1]&&(e=s.globals.previousPaths[r].paths[1].d)))}return{pathFromLine:e,pathFromArea:i}}},{key:"determineFirstPrevY",value:function(t){var e,i,a,s=t.i,r=t.realIndex,n=t.series,o=t.prevY,l=t.lineYPosition,h=t.translationsIndex,c=this.w,d=c.config.chart.stacked&&!c.globals.comboCharts||c.config.chart.stacked&&c.globals.comboCharts&&(!this.w.config.chart.stackOnlyBar||"bar"===(null===(e=this.w.config.series[r])||void 0===e?void 0:e.type)||"column"===(null===(i=this.w.config.series[r])||void 0===i?void 0:i.type));if(void 0!==(null===(a=n[s])||void 0===a?void 0:a[0]))o=(l=d&&s>0?this.lineCtx.prevSeriesY[s-1][0]:this.lineCtx.zeroY)-n[s][0]/this.lineCtx.yRatio[h]+2*(this.lineCtx.isReversed?n[s][0]/this.lineCtx.yRatio[h]:0);else if(d&&s>0&&void 0===n[s][0])for(var u=s-1;u>=0;u--)if(null!==n[u][0]&&void 0!==n[u][0]){o=l=this.lineCtx.prevSeriesY[u][0];break}return{prevY:o,lineYPosition:l}}}]),t}(),Da=function(t){for(var e,i,a,s,r=function(t){for(var e=[],i=t[0],a=t[1],s=e[0]=Wa(i,a),r=1,n=t.length-1;r9&&(s=3*a/Math.sqrt(s),r[l]=s*e,r[l+1]=s*i);for(var h=0;h<=n;h++)s=(t[Math.min(n,h+1)][0]-t[Math.max(0,h-1)][0])/(6*(1+r[h]*r[h])),o.push([s||0,r[h]*s||0]);return o},_a=function(t){var e=Da(t),i=t[1],a=t[0],s=[],r=e[1],n=e[0];s.push(a,[a[0]+n[0],a[1]+n[1],i[0]-r[0],i[1]-r[1],i[0],i[1]]);for(var o=2,l=e.length;o1&&a[1].length<6){var s=a[0].length;a[1]=[2*a[0][s-2]-a[0][s-4],2*a[0][s-1]-a[0][s-3]].concat(a[1])}a[0]=a[0].slice(-2)}return a};function Wa(t,e){return(e[1]-t[1])/(e[0]-t[0])}var Ba=function(){function t(e,a,s){i(this,t),this.ctx=e,this.w=e.w,this.xyRatios=a,this.pointsChart=!("bubble"!==this.w.config.chart.type&&"scatter"!==this.w.config.chart.type)||s,this.scatter=new Ui(this.ctx),this.noNegatives=this.w.globals.minX===Number.MAX_VALUE,this.lineHelpers=new Fa(this),this.markers=new Vi(this.ctx),this.prevSeriesY=[],this.categoryAxisCorrection=0,this.yaxisIndex=0}return s(t,[{key:"draw",value:function(t,e,i,a){var s,r=this.w,n=new Mi(this.ctx),o=r.globals.comboCharts?e:r.config.chart.type,l=n.group({class:"apexcharts-".concat(o,"-series apexcharts-plot-series")}),h=new Pi(this.ctx,r);this.yRatio=this.xyRatios.yRatio,this.zRatio=this.xyRatios.zRatio,this.xRatio=this.xyRatios.xRatio,this.baseLineY=this.xyRatios.baseLineY,t=h.getLogSeries(t),this.yRatio=h.getLogYRatios(this.yRatio),this.prevSeriesY=[];for(var c=[],d=0;d1?g:0;this._initSerieVariables(t,d,g);var f=[],x=[],b=[],m=r.globals.padHorizontal+this.categoryAxisCorrection;this.ctx.series.addCollapsedClassToSeries(this.elSeries,g),r.globals.isXNumeric&&r.globals.seriesX.length>0&&(m=(r.globals.seriesX[g][0]-r.globals.minX)/this.xRatio),b.push(m);var v,y=m,w=void 0,k=y,A=this.zeroY,C=this.zeroY;A=this.lineHelpers.determineFirstPrevY({i:d,realIndex:g,series:t,prevY:A,lineYPosition:0,translationsIndex:p}).prevY,"monotoneCubic"===r.config.stroke.curve&&null===t[d][0]?f.push(null):f.push(A),v=A;"rangeArea"===o&&(w=C=this.lineHelpers.determineFirstPrevY({i:d,realIndex:g,series:a,prevY:C,lineYPosition:0,translationsIndex:p}).prevY,x.push(null!==f[0]?C:null));var S=this._calculatePathsFrom({type:o,series:t,i:d,realIndex:g,translationsIndex:p,prevX:k,prevY:A,prevY2:C}),L=[f[0]],M=[x[0]],P={type:o,series:t,realIndex:g,translationsIndex:p,i:d,x:m,y:1,pX:y,pY:v,pathsFrom:S,linePaths:[],areaPaths:[],seriesIndex:i,lineYPosition:0,xArrj:b,yArrj:f,y2Arrj:x,seriesRangeEnd:a},I=this._iterateOverDataPoints(u(u({},P),{},{iterations:"rangeArea"===o?t[d].length-1:void 0,isRangeStart:!0}));if("rangeArea"===o){for(var T=this._calculatePathsFrom({series:a,i:d,realIndex:g,prevX:k,prevY:C}),z=this._iterateOverDataPoints(u(u({},P),{},{series:a,xArrj:[m],yArrj:L,y2Arrj:M,pY:w,areaPaths:I.areaPaths,pathsFrom:T,iterations:a[d].length-1,isRangeStart:!1})),X=I.linePaths.length/2,R=0;R=0;E--)l.add(c[E]);else for(var Y=0;Y1&&(this.yaxisIndex=a.globals.seriesYAxisReverseMap[i],r=i),this.isReversed=a.config.yaxis[this.yaxisIndex]&&a.config.yaxis[this.yaxisIndex].reversed,this.zeroY=a.globals.gridHeight-this.baseLineY[r]-(this.isReversed?a.globals.gridHeight:0)+(this.isReversed?2*this.baseLineY[r]:0),this.areaBottomY=this.zeroY,(this.zeroY>a.globals.gridHeight||"end"===a.config.plotOptions.area.fillTo)&&(this.areaBottomY=a.globals.gridHeight),this.categoryAxisCorrection=this.xDivision/2,this.elSeries=s.group({class:"apexcharts-series",zIndex:void 0!==a.config.series[i].zIndex?a.config.series[i].zIndex:i,seriesName:v.escapeString(a.globals.seriesNames[i])}),this.elPointsMain=s.group({class:"apexcharts-series-markers-wrap","data:realIndex":i}),a.globals.hasNullValues){var n=this.markers.plotChartMarkers({pointsPos:{x:[0],y:[a.globals.gridHeight+a.globals.markers.largestSize]},seriesIndex:e,j:0,pSize:.1,alwaysDrawMarker:!0,isVirtualPoint:!0});null!==n&&this.elPointsMain.add(n)}this.elDataLabelsWrap=s.group({class:"apexcharts-datalabels","data:realIndex":i});var o=t[e].length===a.globals.dataPoints;this.elSeries.attr({"data:longestSeries":o,rel:e+1,"data:realIndex":i}),this.appendPathFrom=!0}},{key:"_calculatePathsFrom",value:function(t){var e,i,a,s,r=t.type,n=t.series,o=t.i,l=t.realIndex,h=t.translationsIndex,c=t.prevX,d=t.prevY,u=t.prevY2,g=this.w,p=new Mi(this.ctx);if(null===n[o][0]){for(var f=0;f0){var x=this.lineHelpers.checkPreviousPaths({pathFromLine:a,pathFromArea:s,realIndex:l});a=x.pathFromLine,s=x.pathFromArea}return{prevX:c,prevY:d,linePath:e,areaPath:i,pathFromLine:a,pathFromArea:s}}},{key:"_handlePaths",value:function(t){var e=t.type,i=t.realIndex,a=t.i,s=t.paths,r=this.w,n=new Mi(this.ctx),o=new ji(this.ctx);this.prevSeriesY.push(s.yArrj),r.globals.seriesXvalues[i]=s.xArrj,r.globals.seriesYvalues[i]=s.yArrj;var l=r.config.forecastDataPoints;if(l.count>0&&"rangeArea"!==e){var h=r.globals.seriesXvalues[i][r.globals.seriesXvalues[i].length-l.count-1],c=n.drawRect(h,0,r.globals.gridWidth,r.globals.gridHeight,0);r.globals.dom.elForecastMask.appendChild(c.node);var d=n.drawRect(0,0,h,r.globals.gridHeight,0);r.globals.dom.elNonForecastMask.appendChild(d.node)}this.pointsChart||r.globals.delayedElements.push({el:this.elPointsMain.node,index:i});var g={i:a,realIndex:i,animationDelay:a,initialSpeed:r.config.chart.animations.speed,dataChangeSpeed:r.config.chart.animations.dynamicAnimation.speed,className:"apexcharts-".concat(e)};if("area"===e)for(var p=o.fillPath({seriesNumber:i}),f=0;f0&&"rangeArea"!==e){var A=n.renderPaths(w);A.node.setAttribute("stroke-dasharray",l.dashArray),l.strokeWidth&&A.node.setAttribute("stroke-width",l.strokeWidth),this.elSeries.add(A),A.attr("clip-path","url(#forecastMask".concat(r.globals.cuid,")")),k.attr("clip-path","url(#nonForecastMask".concat(r.globals.cuid,")"))}}}}},{key:"_iterateOverDataPoints",value:function(t){var e,i,a=this,s=t.type,r=t.series,n=t.iterations,o=t.realIndex,l=t.translationsIndex,h=t.i,c=t.x,d=t.y,u=t.pX,g=t.pY,p=t.pathsFrom,f=t.linePaths,x=t.areaPaths,b=t.seriesIndex,m=t.lineYPosition,y=t.xArrj,w=t.yArrj,k=t.y2Arrj,A=t.isRangeStart,C=t.seriesRangeEnd,S=this.w,L=new Mi(this.ctx),M=this.yRatio,P=p.prevY,I=p.linePath,T=p.areaPath,z=p.pathFromLine,X=p.pathFromArea,R=v.isNumber(S.globals.minYArr[o])?S.globals.minYArr[o]:S.globals.minY;n||(n=S.globals.dataPoints>1?S.globals.dataPoints-1:S.globals.dataPoints);var E=function(t,e){return e-t/M[l]+2*(a.isReversed?t/M[l]:0)},Y=d,H=S.config.chart.stacked&&!S.globals.comboCharts||S.config.chart.stacked&&S.globals.comboCharts&&(!this.w.config.chart.stackOnlyBar||"bar"===(null===(e=this.w.config.series[o])||void 0===e?void 0:e.type)||"column"===(null===(i=this.w.config.series[o])||void 0===i?void 0:i.type)),O=S.config.stroke.curve;Array.isArray(O)&&(O=Array.isArray(b)?O[b[h]]:O[h]);for(var F,D=0,_=0;_0&&S.globals.collapsedSeries.length0;e--){if(!(S.globals.collapsedSeriesIndices.indexOf((null==b?void 0:b[e])||e)>-1))return e;e--}return 0}(h-1)][_+1]}else m=this.zeroY;else m=this.zeroY;N?d=E(R,m):(d=E(r[h][_+1],m),"rangeArea"===s&&(Y=E(C[h][_+1],m))),y.push(null===r[h][_+1]?null:c),!N||"smooth"!==S.config.stroke.curve&&"monotoneCubic"!==S.config.stroke.curve?(w.push(d),k.push(Y)):(w.push(null),k.push(null));var B=this.lineHelpers.calculatePoints({series:r,x:c,y:d,realIndex:o,i:h,j:_,prevY:P}),G=this._createPaths({type:s,series:r,i:h,realIndex:o,j:_,x:c,y:d,y2:Y,xArrj:y,yArrj:w,y2Arrj:k,pX:u,pY:g,pathState:D,segmentStartX:F,linePath:I,areaPath:T,linePaths:f,areaPaths:x,curve:O,isRangeStart:A});x=G.areaPaths,f=G.linePaths,u=G.pX,g=G.pY,D=G.pathState,F=G.segmentStartX,T=G.areaPath,I=G.linePath,!this.appendPathFrom||S.globals.hasNullValues||"monotoneCubic"===O&&"rangeArea"===s||(z+=L.line(c,this.areaBottomY),X+=L.line(c,this.areaBottomY)),this.handleNullDataPoints(r,B,h,_,o),this._handleMarkersAndLabels({type:s,pointsPos:B,i:h,j:_,realIndex:o,isRangeStart:A})}return{yArrj:w,xArrj:y,pathFromArea:X,areaPaths:x,pathFromLine:z,linePaths:f,linePath:I,areaPath:T}}},{key:"_handleMarkersAndLabels",value:function(t){var e=t.type,i=t.pointsPos,a=t.isRangeStart,s=t.i,r=t.j,n=t.realIndex,o=this.w,l=new qi(this.ctx);if(this.pointsChart)this.scatter.draw(this.elSeries,r,{realIndex:n,pointsPos:i,zRatio:this.zRatio,elParent:this.elPointsMain});else{o.globals.series[s].length>1&&this.elPointsMain.node.classList.add("apexcharts-element-hidden");var h=this.markers.plotChartMarkers({pointsPos:i,seriesIndex:n,j:r+1});null!==h&&this.elPointsMain.add(h)}var c=l.drawDataLabel({type:e,isRangeStart:a,pos:i,i:n,j:r+1});null!==c&&this.elDataLabelsWrap.add(c)}},{key:"_createPaths",value:function(t){var e=t.type,i=t.series,a=t.i;t.realIndex;var s,r=t.j,n=t.x,o=t.y,l=t.xArrj,h=t.yArrj,c=t.y2,d=t.y2Arrj,u=t.pX,g=t.pY,p=t.pathState,f=t.segmentStartX,x=t.linePath,b=t.areaPath,m=t.linePaths,v=t.areaPaths,y=t.curve,w=t.isRangeStart,k=new Mi(this.ctx),A=this.areaBottomY,C="rangeArea"===e,S="rangeArea"===e&&w;switch(y){case"monotoneCubic":var L=w?h:d;switch(p){case 0:if(null===L[r+1])break;p=1;case 1:if(!(C?l.length===i[a].length:r===i[a].length-2))break;case 2:var M=w?l:l.slice().reverse(),P=w?L:L.slice().reverse(),I=(s=P,M.map((function(t,e){return[t,s[e]]})).filter((function(t){return null!==t[1]}))),T=I.length>1?_a(I):I,z=[];C&&(S?v=I:z=v.reverse());var X=0,R=0;if(function(t,e){for(var i=function(t){var e=[],i=0;return t.forEach((function(t){null!==t?i++:i>0&&(e.push(i),i=0)})),i>0&&e.push(i),e}(t),a=[],s=0,r=0;s4?(e+="C".concat(a[0],", ").concat(a[1]),e+=", ".concat(a[2],", ").concat(a[3]),e+=", ".concat(a[4],", ").concat(a[5])):s>2&&(e+="S".concat(a[0],", ").concat(a[1]),e+=", ".concat(a[2],", ").concat(a[3]))}return e}(t),i=R,a=(R+=t.length)-1;S?x=k.move(I[i][0],I[i][1])+e:C?x=k.move(z[i][0],z[i][1])+k.line(I[i][0],I[i][1])+e+k.line(z[a][0],z[a][1]):(x=k.move(I[i][0],I[i][1])+e,b=x+k.line(I[a][0],A)+k.line(I[i][0],A)+"z",v.push(b)),m.push(x)})),C&&X>1&&!S){var E=m.slice(X).reverse();m.splice(X),E.forEach((function(t){return m.push(t)}))}p=0}break;case"smooth":var Y=.35*(n-u);if(null===i[a][r])p=0;else switch(p){case 0:if(f=u,x=S?k.move(u,d[r])+k.line(u,g):k.move(u,g),b=k.move(u,g),null===i[a][r+1]||void 0===i[a][r+1]){m.push(x),v.push(b);break}if(p=1,r=i[a].length-2&&(S&&(x+=k.curve(n,o,n,o,n,c)+k.move(n,c)),b+=k.curve(n,o,n,o,n,A)+k.line(f,A)+"z",m.push(x),v.push(b),p=-1)}}u=n,g=o;break;default:var F=function(t,e,i){var a=[];switch(t){case"stepline":a=k.line(e,null,"H")+k.line(null,i,"V");break;case"linestep":a=k.line(null,i,"V")+k.line(e,null,"H");break;case"straight":a=k.line(e,i)}return a};if(null===i[a][r])p=0;else switch(p){case 0:if(f=u,x=S?k.move(u,d[r])+k.line(u,g):k.move(u,g),b=k.move(u,g),null===i[a][r+1]||void 0===i[a][r+1]){m.push(x),v.push(b);break}if(p=1,r=i[a].length-2&&(S&&(x+=k.line(n,c)),b+=k.line(n,A)+k.line(f,A)+"z",m.push(x),v.push(b),p=-1)}}u=n,g=o}return{linePaths:m,areaPaths:v,pX:u,pY:g,pathState:p,segmentStartX:f,linePath:x,areaPath:b}}},{key:"handleNullDataPoints",value:function(t,e,i,a,s){var r=this.w;if(null===t[i][a]&&r.config.markers.showNullDataPoints||1===t[i].length){var n=this.strokeWidth-r.config.markers.strokeWidth/2;n>0||(n=0);var o=this.markers.plotChartMarkers({pointsPos:e,seriesIndex:s,j:a+1,pSize:n,alwaysDrawMarker:!0});null!==o&&this.elPointsMain.add(o)}}}]),t}();window.TreemapSquared={},window.TreemapSquared.generate=function(){function t(e,i,a,s){this.xoffset=e,this.yoffset=i,this.height=s,this.width=a,this.shortestEdge=function(){return Math.min(this.height,this.width)},this.getCoordinates=function(t){var e,i=[],a=this.xoffset,s=this.yoffset,n=r(t)/this.height,o=r(t)/this.width;if(this.width>=this.height)for(e=0;e=this.height){var a=e/this.height,s=this.width-a;i=new t(this.xoffset+a,this.yoffset,s,this.height)}else{var r=e/this.width,n=this.height-r;i=new t(this.xoffset,this.yoffset+r,this.width,n)}return i}}function e(e,a,s,n,o){n=void 0===n?0:n,o=void 0===o?0:o;var l=i(function(t,e){var i,a=[],s=e/r(t);for(i=0;i=n}(e,l=t[0],o)?(e.push(l),i(t.slice(1),e,s,n)):(h=s.cutArea(r(e),n),n.push(s.getCoordinates(e)),i(t,[],h,n)),n;n.push(s.getCoordinates(e))}function a(t,e){var i=Math.min.apply(Math,t),a=Math.max.apply(Math,t),s=r(t);return Math.max(Math.pow(e,2)*a/Math.pow(s,2),Math.pow(s,2)/(Math.pow(e,2)*i))}function s(t){return t&&t.constructor===Array}function r(t){var e,i=0;for(e=0;e1&&u&&u.show){var g=i.config.series[o].name||"";if(g&&d.xMin<1/0&&d.yMin<1/0){var p=u.offsetX,f=u.offsetY,x=u.borderColor,b=u.borderWidth,m=u.borderRadius,y=u.style,w=y.color||i.config.chart.foreColor,k={left:y.padding.left,right:y.padding.right,top:y.padding.top,bottom:y.padding.bottom},A=a.getTextRects(g,y.fontSize,y.fontFamily),C=A.width+k.left+k.right,S=A.height+k.top+k.bottom,L=d.xMin+(p||0),M=d.yMin+(f||0),P=a.drawRect(L,M,C,S,m,y.background,1,b,x),I=a.drawText({x:L+k.left,y:M+k.top+.75*A.height,text:g,fontSize:y.fontSize,fontFamily:y.fontFamily,fontWeight:y.fontWeight,foreColor:w,cssClass:y.cssClass||""});l.add(P),l.add(I)}}l.add(c),r.add(l)})),r}},{key:"getFontSize",value:function(t){var e=this.w;var i=function t(e){var i,a=0;if(Array.isArray(e[0]))for(i=0;ir-a&&l.width<=n-s){var h=o.rotateAroundCenter(t.node);t.node.setAttribute("transform","rotate(-90 ".concat(h.x," ").concat(h.y,") translate(").concat(l.height/3,")"))}}},{key:"truncateLabels",value:function(t,e,i,a,s,r){var n=new Mi(this.ctx),o=n.getTextRects(t,e).width+this.w.config.stroke.width+5>s-i&&r-a>s-i?r-a:s-i,l=n.getTextBasedOnMaxWidth({text:t,maxWidth:o,fontSize:e});return t.length!==l.length&&o/e<5?"":l}},{key:"animateTreemap",value:function(t,e,i,a){var s=new y(this.ctx);s.animateRect(t,e,i,a,(function(){s.animationCompleted(t)}))}}]),t}(),ja=86400,Va=10/ja,Ua=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.timeScaleArray=[],this.utc=this.w.config.xaxis.labels.datetimeUTC}return s(t,[{key:"calculateTimeScaleTicks",value:function(t,e){var i=this,a=this.w;if(a.globals.allSeriesCollapsed)return a.globals.labels=[],a.globals.timescaleLabels=[],[];var s=new zi(this.ctx),r=(e-t)/864e5;this.determineInterval(r),a.globals.disableZoomIn=!1,a.globals.disableZoomOut=!1,r5e4&&(a.globals.disableZoomOut=!0);var n=s.getTimeUnitsfromTimestamp(t,e,this.utc),o=a.globals.gridWidth/r,l=o/24,h=l/60,c=h/60,d=Math.floor(24*r),g=Math.floor(1440*r),p=Math.floor(r*ja),f=Math.floor(r),x=Math.floor(r/30),b=Math.floor(r/365),m={minMillisecond:n.minMillisecond,minSecond:n.minSecond,minMinute:n.minMinute,minHour:n.minHour,minDate:n.minDate,minMonth:n.minMonth,minYear:n.minYear},v={firstVal:m,currentMillisecond:m.minMillisecond,currentSecond:m.minSecond,currentMinute:m.minMinute,currentHour:m.minHour,currentMonthDate:m.minDate,currentDate:m.minDate,currentMonth:m.minMonth,currentYear:m.minYear,daysWidthOnXAxis:o,hoursWidthOnXAxis:l,minutesWidthOnXAxis:h,secondsWidthOnXAxis:c,numberOfSeconds:p,numberOfMinutes:g,numberOfHours:d,numberOfDays:f,numberOfMonths:x,numberOfYears:b};switch(this.tickInterval){case"years":this.generateYearScale(v);break;case"months":case"half_year":this.generateMonthScale(v);break;case"months_days":case"months_fortnight":case"days":case"week_days":this.generateDayScale(v);break;case"hours":this.generateHourScale(v);break;case"minutes_fives":case"minutes":this.generateMinuteScale(v);break;case"seconds_tens":case"seconds_fives":case"seconds":this.generateSecondScale(v)}var y=this.timeScaleArray.map((function(t){var e={position:t.position,unit:t.unit,year:t.year,day:t.day?t.day:1,hour:t.hour?t.hour:0,month:t.month+1};return"month"===t.unit?u(u({},e),{},{day:1,value:t.value+1}):"day"===t.unit||"hour"===t.unit?u(u({},e),{},{value:t.value}):"minute"===t.unit?u(u({},e),{},{value:t.value,minute:t.value}):"second"===t.unit?u(u({},e),{},{value:t.value,minute:t.minute,second:t.second}):t}));return y.filter((function(t){var e=1,s=Math.ceil(a.globals.gridWidth/120),r=t.value;void 0!==a.config.xaxis.tickAmount&&(s=a.config.xaxis.tickAmount),y.length>s&&(e=Math.floor(y.length/s));var n=!1,o=!1;switch(i.tickInterval){case"years":"year"===t.unit&&(n=!0);break;case"half_year":e=7,"year"===t.unit&&(n=!0);break;case"months":e=1,"year"===t.unit&&(n=!0);break;case"months_fortnight":e=15,"year"!==t.unit&&"month"!==t.unit||(n=!0),30===r&&(o=!0);break;case"months_days":e=10,"month"===t.unit&&(n=!0),30===r&&(o=!0);break;case"week_days":e=8,"month"===t.unit&&(n=!0);break;case"days":e=1,"month"===t.unit&&(n=!0);break;case"hours":"day"===t.unit&&(n=!0);break;case"minutes_fives":case"seconds_fives":r%5!=0&&(o=!0);break;case"seconds_tens":r%10!=0&&(o=!0)}if("hours"===i.tickInterval||"minutes_fives"===i.tickInterval||"seconds_tens"===i.tickInterval||"seconds_fives"===i.tickInterval){if(!o)return!0}else if((r%e==0||n)&&!o)return!0}))}},{key:"recalcDimensionsBasedOnFormat",value:function(t,e){var i=this.w,a=this.formatDates(t),s=this.removeOverlappingTS(a);i.globals.timescaleLabels=s.slice(),new pa(this.ctx).plotCoords()}},{key:"determineInterval",value:function(t){var e=24*t,i=60*e;switch(!0){case t/365>5:this.tickInterval="years";break;case t>800:this.tickInterval="half_year";break;case t>180:this.tickInterval="months";break;case t>90:this.tickInterval="months_fortnight";break;case t>60:this.tickInterval="months_days";break;case t>30:this.tickInterval="week_days";break;case t>2:this.tickInterval="days";break;case e>2.4:this.tickInterval="hours";break;case i>15:this.tickInterval="minutes_fives";break;case i>5:this.tickInterval="minutes";break;case i>1:this.tickInterval="seconds_tens";break;case 60*i>20:this.tickInterval="seconds_fives";break;default:this.tickInterval="seconds"}}},{key:"generateYearScale",value:function(t){var e=t.firstVal,i=t.currentMonth,a=t.currentYear,s=t.daysWidthOnXAxis,r=t.numberOfYears,n=e.minYear,o=0,l=new zi(this.ctx),h="year";if(e.minDate>1||e.minMonth>0){var c=l.determineRemainingDaysOfYear(e.minYear,e.minMonth,e.minDate);o=(l.determineDaysOfYear(e.minYear)-c+1)*s,n=e.minYear+1,this.timeScaleArray.push({position:o,value:n,unit:h,year:n,month:v.monthMod(i+1)})}else 1===e.minDate&&0===e.minMonth&&this.timeScaleArray.push({position:o,value:n,unit:h,year:a,month:v.monthMod(i+1)});for(var d=n,u=o,g=0;g1){l=(h.determineDaysOfMonths(a+1,e.minYear)-i+1)*r,o=v.monthMod(a+1);var u=s+d,g=v.monthMod(o),p=o;0===o&&(c="year",p=u,g=1,u+=d+=1),this.timeScaleArray.push({position:l,value:p,unit:c,year:u,month:g})}else this.timeScaleArray.push({position:l,value:o,unit:c,year:s,month:v.monthMod(a)});for(var f=o+1,x=l,b=0,m=1;bn.determineDaysOfMonths(e+1,i)?(h=1,o="month",u=e+=1,e):e},d=(24-e.minHour)*s,u=l,g=c(h,i,a);0===e.minHour&&1===e.minDate?(d=0,u=v.monthMod(e.minMonth),o="month",h=e.minDate):1!==e.minDate&&0===e.minHour&&0===e.minMinute&&(d=0,l=e.minDate,u=l,g=c(h=l,i,a),1!==u&&(o="day")),this.timeScaleArray.push({position:d,value:u,unit:o,year:this._getYear(a,g,0),month:v.monthMod(g),day:h});for(var p=d,f=0;fo.determineDaysOfMonths(e+1,s)&&(f=1,e+=1),{month:e,date:f}},c=function(t,e){return t>o.determineDaysOfMonths(e+1,s)?e+=1:e},d=60-(e.minMinute+e.minSecond/60),u=d*r,g=e.minHour+1,p=g;60===d&&(u=0,p=g=e.minHour);var f=i;p>=24&&(p=0,l="day",g=f+=1);var x=h(f,a).month;x=c(f,x),g>31&&(g=f=1),this.timeScaleArray.push({position:u,value:g,unit:l,day:f,hour:p,year:s,month:v.monthMod(x)}),p++;for(var b=u,m=0;m=24)p=0,l="day",x=h(f+=1,x).month,x=c(f,x);var y=this._getYear(s,x,0);b=60*r+b;var w=0===p?f:p;this.timeScaleArray.push({position:b,value:w,unit:l,hour:p,day:f,year:y,month:v.monthMod(x)}),p++}}},{key:"generateMinuteScale",value:function(t){for(var e=t.currentMillisecond,i=t.currentSecond,a=t.currentMinute,s=t.currentHour,r=t.currentDate,n=t.currentMonth,o=t.currentYear,l=t.minutesWidthOnXAxis,h=t.secondsWidthOnXAxis,c=t.numberOfMinutes,d=a+1,u=r,g=n,p=o,f=s,x=(60-i-e/1e3)*h,b=0;b=60&&(d=0,24===(f+=1)&&(f=0)),this.timeScaleArray.push({position:x,value:d,unit:"minute",hour:f,minute:d,day:u,year:this._getYear(p,g,0),month:v.monthMod(g)}),x+=l,d++}},{key:"generateSecondScale",value:function(t){for(var e=t.currentMillisecond,i=t.currentSecond,a=t.currentMinute,s=t.currentHour,r=t.currentDate,n=t.currentMonth,o=t.currentYear,l=t.secondsWidthOnXAxis,h=t.numberOfSeconds,c=i+1,d=a,u=r,g=n,p=o,f=s,x=(1e3-e)/1e3*l,b=0;b=60&&(c=0,++d>=60&&(d=0,24===++f&&(f=0))),this.timeScaleArray.push({position:x,value:c,unit:"second",hour:f,minute:d,second:c,day:u,year:this._getYear(p,g,0),month:v.monthMod(g)}),x+=l,c++}},{key:"createRawDateString",value:function(t,e){var i=t.year;return 0===t.month&&(t.month=1),i+="-"+("0"+t.month.toString()).slice(-2),"day"===t.unit?i+="day"===t.unit?"-"+("0"+e).slice(-2):"-01":i+="-"+("0"+(t.day?t.day:"1")).slice(-2),"hour"===t.unit?i+="hour"===t.unit?"T"+("0"+e).slice(-2):"T00":i+="T"+("0"+(t.hour?t.hour:"0")).slice(-2),"minute"===t.unit?i+=":"+("0"+e).slice(-2):i+=":"+(t.minute?("0"+t.minute).slice(-2):"00"),"second"===t.unit?i+=":"+("0"+e).slice(-2):i+=":00",this.utc&&(i+=".000Z"),i}},{key:"formatDates",value:function(t){var e=this,i=this.w;return t.map((function(t){var a=t.value.toString(),s=new zi(e.ctx),r=e.createRawDateString(t,a),n=s.getDate(s.parseDate(r));if(e.utc||(n=s.getDate(s.parseDateWithTimezone(r))),void 0===i.config.xaxis.labels.format){var o="dd MMM",l=i.config.xaxis.labels.datetimeFormatter;"year"===t.unit&&(o=l.year),"month"===t.unit&&(o=l.month),"day"===t.unit&&(o=l.day),"hour"===t.unit&&(o=l.hour),"minute"===t.unit&&(o=l.minute),"second"===t.unit&&(o=l.second),a=s.formatDate(n,o)}else a=s.formatDate(n,i.config.xaxis.labels.format);return{dateString:r,position:t.position,value:a,unit:t.unit,year:t.year,month:t.month}}))}},{key:"removeOverlappingTS",value:function(t){var e,i=this,a=new Mi(this.ctx),s=!1;t.length>0&&t[0].value&&t.every((function(e){return e.value.length===t[0].value.length}))&&(s=!0,e=a.getTextRects(t[0].value).width);var r=0,n=t.map((function(n,o){if(o>0&&i.w.config.xaxis.labels.hideOverlappingLabels){var l=s?e:a.getTextRects(t[r].value).width,h=t[r].position;return n.position>h+l+10?(r=o,n):null}return n}));return n=n.filter((function(t){return null!==t}))}},{key:"_getYear",value:function(t,e,i){return t+Math.floor(e/12)+i}}]),t}(),qa=function(){function t(e,a){i(this,t),this.ctx=a,this.w=a.w,this.el=e}return s(t,[{key:"setupElements",value:function(){var t=this.w,e=t.globals,i=t.config,a=i.chart.type;e.axisCharts=["line","area","bar","rangeBar","rangeArea","candlestick","boxPlot","scatter","bubble","radar","heatmap","treemap"].includes(a),e.xyCharts=["line","area","bar","rangeBar","rangeArea","candlestick","boxPlot","scatter","bubble"].includes(a),e.isBarHorizontal=["bar","rangeBar","boxPlot"].includes(a)&&i.plotOptions.bar.horizontal,e.chartClass=".apexcharts".concat(e.chartID),e.dom.baseEl=this.el,e.dom.elWrap=document.createElement("div"),Mi.setAttrs(e.dom.elWrap,{id:e.chartClass.substring(1),class:"apexcharts-canvas ".concat(e.chartClass.substring(1))}),this.el.appendChild(e.dom.elWrap),e.dom.Paper=window.SVG().addTo(e.dom.elWrap),e.dom.Paper.attr({class:"apexcharts-svg","xmlns:data":"ApexChartsNS",transform:"translate(".concat(i.chart.offsetX,", ").concat(i.chart.offsetY,")")}),e.dom.Paper.node.style.background="dark"!==i.theme.mode||i.chart.background?"light"!==i.theme.mode||i.chart.background?i.chart.background:"#fff":"#424242",this.setSVGDimensions(),e.dom.elLegendForeign=document.createElementNS(e.SVGNS,"foreignObject"),Mi.setAttrs(e.dom.elLegendForeign,{x:0,y:0,width:e.svgWidth,height:e.svgHeight}),e.dom.elLegendWrap=document.createElement("div"),e.dom.elLegendWrap.classList.add("apexcharts-legend"),e.dom.elWrap.appendChild(e.dom.elLegendWrap),e.dom.Paper.node.appendChild(e.dom.elLegendForeign),e.dom.elGraphical=e.dom.Paper.group().attr({class:"apexcharts-inner apexcharts-graphical"}),e.dom.elDefs=e.dom.Paper.defs(),e.dom.Paper.add(e.dom.elGraphical),e.dom.elGraphical.add(e.dom.elDefs)}},{key:"plotChartType",value:function(t,e){var i=this.w,a=this.ctx,s=i.config,r=i.globals,n={line:{series:[],i:[]},area:{series:[],i:[]},scatter:{series:[],i:[]},bubble:{series:[],i:[]},bar:{series:[],i:[]},candlestick:{series:[],i:[]},boxPlot:{series:[],i:[]},rangeBar:{series:[],i:[]},rangeArea:{series:[],seriesRangeEnd:[],i:[]}},o=s.chart.type||"line",l=null,h=0;r.series.forEach((function(e,a){var s="column"===t[a].type?"bar":t[a].type||("column"===o?"bar":o);n[s]?("rangeArea"===s?(n[s].series.push(r.seriesRangeStart[a]),n[s].seriesRangeEnd.push(r.seriesRangeEnd[a])):n[s].series.push(e),n[s].i.push(a),"bar"===s&&(i.globals.columnSeries=n.bar)):["heatmap","treemap","pie","donut","polarArea","radialBar","radar"].includes(s)?l=s:console.warn("You have specified an unrecognized series type (".concat(s,").")),o!==s&&"scatter"!==s&&h++})),h>0&&(l&&console.warn("Chart or series type ".concat(l," cannot appear with other chart or series types.")),n.bar.series.length>0&&s.plotOptions.bar.horizontal&&(h-=n.bar.series.length,n.bar={series:[],i:[]},i.globals.columnSeries={series:[],i:[]},console.warn("Horizontal bars are not supported in a mixed/combo chart. Please turn off `plotOptions.bar.horizontal`"))),r.comboCharts||(r.comboCharts=h>0);var c=new Ba(a,e),d=new Ta(a,e);a.pie=new Ea(a);var u=new Ha(a);a.rangeBar=new Oa(a,e);var g=new Ya(a),p=[];if(r.comboCharts){var x,b,m=new Pi(a);if(n.area.series.length>0)(x=p).push.apply(x,f(m.drawSeriesByGroup(n.area,r.areaGroups,"area",c)));if(n.bar.series.length>0)if(s.chart.stacked){var v=new Ia(a,e);p.push(v.draw(n.bar.series,n.bar.i))}else a.bar=new Pa(a,e),p.push(a.bar.draw(n.bar.series,n.bar.i));if(n.rangeArea.series.length>0&&p.push(c.draw(n.rangeArea.series,"rangeArea",n.rangeArea.i,n.rangeArea.seriesRangeEnd)),n.line.series.length>0)(b=p).push.apply(b,f(m.drawSeriesByGroup(n.line,r.lineGroups,"line",c)));if(n.candlestick.series.length>0&&p.push(d.draw(n.candlestick.series,"candlestick",n.candlestick.i)),n.boxPlot.series.length>0&&p.push(d.draw(n.boxPlot.series,"boxPlot",n.boxPlot.i)),n.rangeBar.series.length>0&&p.push(a.rangeBar.draw(n.rangeBar.series,n.rangeBar.i)),n.scatter.series.length>0){var y=new Ba(a,e,!0);p.push(y.draw(n.scatter.series,"scatter",n.scatter.i))}if(n.bubble.series.length>0){var w=new Ba(a,e,!0);p.push(w.draw(n.bubble.series,"bubble",n.bubble.i))}}else switch(s.chart.type){case"line":p=c.draw(r.series,"line");break;case"area":p=c.draw(r.series,"area");break;case"bar":if(s.chart.stacked)p=new Ia(a,e).draw(r.series);else a.bar=new Pa(a,e),p=a.bar.draw(r.series);break;case"candlestick":p=new Ta(a,e).draw(r.series,"candlestick");break;case"boxPlot":p=new Ta(a,e).draw(r.series,s.chart.type);break;case"rangeBar":p=a.rangeBar.draw(r.series);break;case"rangeArea":p=c.draw(r.seriesRangeStart,"rangeArea",void 0,r.seriesRangeEnd);break;case"heatmap":p=new Xa(a,e).draw(r.series);break;case"treemap":p=new Ga(a,e).draw(r.series);break;case"pie":case"donut":case"polarArea":p=a.pie.draw(r.series);break;case"radialBar":p=u.draw(r.series);break;case"radar":p=g.draw(r.series);break;default:p=c.draw(r.series)}return p}},{key:"setSVGDimensions",value:function(){var t=this.w,e=t.globals,i=t.config;i.chart.width=i.chart.width||"100%",i.chart.height=i.chart.height||"auto",e.svgWidth=i.chart.width,e.svgHeight=i.chart.height;var a=v.getDimensions(this.el),s=i.chart.width.toString().split(/[0-9]+/g).pop();"%"===s?v.isNumber(a[0])&&(0===a[0].width&&(a=v.getDimensions(this.el.parentNode)),e.svgWidth=a[0]*parseInt(i.chart.width,10)/100):"px"!==s&&""!==s||(e.svgWidth=parseInt(i.chart.width,10));var r=String(i.chart.height).toString().split(/[0-9]+/g).pop();if("auto"!==e.svgHeight&&""!==e.svgHeight)if("%"===r){var n=v.getDimensions(this.el.parentNode);e.svgHeight=n[1]*parseInt(i.chart.height,10)/100}else e.svgHeight=parseInt(i.chart.height,10);else e.svgHeight=e.axisCharts?e.svgWidth/1.61:e.svgWidth/1.2;if(e.svgWidth=Math.max(e.svgWidth,0),e.svgHeight=Math.max(e.svgHeight,0),Mi.setAttrs(e.dom.Paper.node,{width:e.svgWidth,height:e.svgHeight}),"%"!==r){var o=i.chart.sparkline.enabled?0:e.axisCharts?i.chart.parentHeightOffset:0;e.dom.Paper.node.parentNode.parentNode.style.minHeight="".concat(e.svgHeight+o,"px")}e.dom.elWrap.style.width="".concat(e.svgWidth,"px"),e.dom.elWrap.style.height="".concat(e.svgHeight,"px")}},{key:"shiftGraphPosition",value:function(){var t=this.w.globals,e=t.translateY,i=t.translateX;Mi.setAttrs(t.dom.elGraphical.node,{transform:"translate(".concat(i,", ").concat(e,")")})}},{key:"resizeNonAxisCharts",value:function(){var t=this.w,e=t.globals,i=0,a=t.config.chart.sparkline.enabled?1:15;a+=t.config.grid.padding.bottom,["top","bottom"].includes(t.config.legend.position)&&t.config.legend.show&&!t.config.legend.floating&&(i=new xa(this.ctx).legendHelpers.getLegendDimensions().clwh+7);var s=t.globals.dom.baseEl.querySelector(".apexcharts-radialbar, .apexcharts-pie"),r=2.05*t.globals.radialSize;if(s&&!t.config.chart.sparkline.enabled&&0!==t.config.plotOptions.radialBar.startAngle){var n=v.getBoundingClientRect(s);r=n.bottom;var o=n.bottom-n.top;r=Math.max(2.05*t.globals.radialSize,o)}var l=Math.ceil(r+e.translateY+i+a);e.dom.elLegendForeign&&e.dom.elLegendForeign.setAttribute("height",l),t.config.chart.height&&String(t.config.chart.height).includes("%")||(e.dom.elWrap.style.height="".concat(l,"px"),Mi.setAttrs(e.dom.Paper.node,{height:l}),e.dom.Paper.node.parentNode.parentNode.style.minHeight="".concat(l,"px"))}},{key:"coreCalculations",value:function(){new ea(this.ctx).init()}},{key:"resetGlobals",value:function(){var t=this,e=function(){return t.w.config.series.map((function(){return[]}))},i=new Bi,a=this.w.globals;i.initGlobalVars(a),a.seriesXvalues=e(),a.seriesYvalues=e()}},{key:"isMultipleY",value:function(){return!!(Array.isArray(this.w.config.yaxis)&&this.w.config.yaxis.length>1)&&(this.w.globals.isMultipleYAxis=!0,!0)}},{key:"xySettings",value:function(){var t=this.w,e=null;if(t.globals.axisCharts){if("back"===t.config.xaxis.crosshairs.position&&new na(this.ctx).drawXCrosshairs(),"back"===t.config.yaxis[0].crosshairs.position&&new na(this.ctx).drawYCrosshairs(),"datetime"===t.config.xaxis.type&&void 0===t.config.xaxis.labels.formatter){this.ctx.timeScale=new Ua(this.ctx);var i=[];isFinite(t.globals.minX)&&isFinite(t.globals.maxX)&&!t.globals.isBarHorizontal?i=this.ctx.timeScale.calculateTimeScaleTicks(t.globals.minX,t.globals.maxX):t.globals.isBarHorizontal&&(i=this.ctx.timeScale.calculateTimeScaleTicks(t.globals.minY,t.globals.maxY)),this.ctx.timeScale.recalcDimensionsBasedOnFormat(i)}e=new Pi(this.ctx).getCalculatedRatios()}return e}},{key:"updateSourceChart",value:function(t){this.ctx.w.globals.selection=void 0,this.ctx.updateHelpers._updateOptions({chart:{selection:{xaxis:{min:t.w.globals.minX,max:t.w.globals.maxX}}}},!1,!1)}},{key:"setupBrushHandler",value:function(){var t=this,e=this.ctx,i=this.w;if(i.config.chart.brush.enabled&&"function"!=typeof i.config.chart.events.selection){var a=Array.isArray(i.config.chart.brush.targets)?i.config.chart.brush.targets:[i.config.chart.brush.target];a.forEach((function(i){var a=e.constructor.getChartByID(i);a.w.globals.brushSource=t.ctx,"function"!=typeof a.w.config.chart.events.zoomed&&(a.w.config.chart.events.zoomed=function(){return t.updateSourceChart(a)}),"function"!=typeof a.w.config.chart.events.scrolled&&(a.w.config.chart.events.scrolled=function(){return t.updateSourceChart(a)})})),i.config.chart.events.selection=function(t,i){a.forEach((function(t){e.constructor.getChartByID(t).ctx.updateHelpers._updateOptions({xaxis:{min:i.xaxis.min,max:i.xaxis.max}},!1,!1,!1,!1)}))}}}}]),t}(),Za=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return s(t,[{key:"_updateOptions",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return new Promise((function(n){var o=[e.ctx];s&&(o=e.ctx.getSyncedCharts()),e.ctx.w.globals.isExecCalled&&(o=[e.ctx],e.ctx.w.globals.isExecCalled=!1),o.forEach((function(s,l){var h=s.w;if(h.globals.shouldAnimate=a,i||(h.globals.resized=!0,h.globals.dataChanged=!0,a&&s.series.getPreviousPaths()),t&&"object"===b(t)&&(s.config=new Wi(t),t=Pi.extendArrayProps(s.config,t,h),s.w.globals.chartID!==e.ctx.w.globals.chartID&&delete t.series,h.config=v.extend(h.config,t),r&&(h.globals.lastXAxis=t.xaxis?v.clone(t.xaxis):[],h.globals.lastYAxis=t.yaxis?v.clone(t.yaxis):[],h.globals.initialConfig=v.extend({},h.config),h.globals.initialSeries=v.clone(h.config.series),t.series))){for(var c=0;c2&&void 0!==arguments[2]&&arguments[2];return new Promise((function(s){var r,n=i.w;return n.globals.shouldAnimate=e,n.globals.dataChanged=!0,e&&i.ctx.series.getPreviousPaths(),n.globals.axisCharts?(0===(r=t.map((function(t,e){return i._extendSeries(t,e)}))).length&&(r=[{data:[]}]),n.config.series=r):n.config.series=t.slice(),a&&(n.globals.initialConfig.series=v.clone(n.config.series),n.globals.initialSeries=v.clone(n.config.series)),i.ctx.update().then((function(){s(i.ctx)}))}))}},{key:"_extendSeries",value:function(t,e){var i=this.w,a=i.config.series[e];return u(u({},i.config.series[e]),{},{name:t.name?t.name:null==a?void 0:a.name,color:t.color?t.color:null==a?void 0:a.color,type:t.type?t.type:null==a?void 0:a.type,group:t.group?t.group:null==a?void 0:a.group,hidden:void 0!==t.hidden?t.hidden:null==a?void 0:a.hidden,data:t.data?t.data:null==a?void 0:a.data,zIndex:void 0!==t.zIndex?t.zIndex:e})}},{key:"toggleDataPointSelection",value:function(t,e){var i=this.w,a=null,s=".apexcharts-series[data\\:realIndex='".concat(t,"']");return i.globals.axisCharts?a=i.globals.dom.Paper.findOne("".concat(s," path[j='").concat(e,"'], ").concat(s," circle[j='").concat(e,"'], ").concat(s," rect[j='").concat(e,"']")):void 0===e&&(a=i.globals.dom.Paper.findOne("".concat(s," path[j='").concat(t,"']")),"pie"!==i.config.chart.type&&"polarArea"!==i.config.chart.type&&"donut"!==i.config.chart.type||this.ctx.pie.pieClicked(t)),a?(new Mi(this.ctx).pathMouseDown(a,null),a.node?a.node:null):(console.warn("toggleDataPointSelection: Element not found"),null)}},{key:"forceXAxisUpdate",value:function(t){var e=this.w;if(["min","max"].forEach((function(i){void 0!==t.xaxis[i]&&(e.config.xaxis[i]=t.xaxis[i],e.globals.lastXAxis[i]=t.xaxis[i])})),t.xaxis.categories&&t.xaxis.categories.length&&(e.config.xaxis.categories=t.xaxis.categories),e.config.xaxis.convertedCatToNumeric){var i=new Ni(t);t=i.convertCatToNumericXaxis(t,this.ctx)}return t}},{key:"forceYAxisUpdate",value:function(t){return t.chart&&t.chart.stacked&&"100%"===t.chart.stackType&&(Array.isArray(t.yaxis)?t.yaxis.forEach((function(e,i){t.yaxis[i].min=0,t.yaxis[i].max=100})):(t.yaxis.min=0,t.yaxis.max=100)),t}},{key:"revertDefaultAxisMinMax",value:function(t){var e=this,i=this.w,a=i.globals.lastXAxis,s=i.globals.lastYAxis;t&&t.xaxis&&(a=t.xaxis),t&&t.yaxis&&(s=t.yaxis),i.config.xaxis.min=a.min,i.config.xaxis.max=a.max;var r=function(t){void 0!==s[t]&&(i.config.yaxis[t].min=s[t].min,i.config.yaxis[t].max=s[t].max)};i.config.yaxis.map((function(t,a){i.globals.zoomed||void 0!==s[a]?r(a):void 0!==e.ctx.opts.yaxis[a]&&(t.min=e.ctx.opts.yaxis[a].min,t.max=e.ctx.opts.yaxis[a].max)}))}}]),t}();!function(){function t(){for(var t=arguments.length>0&&arguments[0]!==h?arguments[0]:[],s=arguments.length>1?arguments[1]:h,r=arguments.length>2?arguments[2]:h,n=arguments.length>3?arguments[3]:h,o=arguments.length>4?arguments[4]:h,l=arguments.length>5?arguments[5]:h,h=arguments.length>6?arguments[6]:h,c=t.slice(s,r||h),d=n.slice(o,l||h),u=0,g={pos:[0,0],start:[0,0]},p={pos:[0,0],start:[0,0]};;){if(c[u]=e.call(g,c[u]),d[u]=e.call(p,d[u]),c[u][0]!=d[u][0]||"M"==c[u][0]||"A"==c[u][0]&&(c[u][4]!=d[u][4]||c[u][5]!=d[u][5])?(Array.prototype.splice.apply(c,[u,1].concat(a.call(g,c[u]))),Array.prototype.splice.apply(d,[u,1].concat(a.call(p,d[u])))):(c[u]=i.call(g,c[u]),d[u]=i.call(p,d[u])),++u==c.length&&u==d.length)break;u==c.length&&c.push(["C",g.pos[0],g.pos[1],g.pos[0],g.pos[1],g.pos[0],g.pos[1]]),u==d.length&&d.push(["C",p.pos[0],p.pos[1],p.pos[0],p.pos[1],p.pos[0],p.pos[1]])}return{start:c,dest:d}}function e(t){switch(t[0]){case"z":case"Z":t[0]="L",t[1]=this.start[0],t[2]=this.start[1];break;case"H":t[0]="L",t[2]=this.pos[1];break;case"V":t[0]="L",t[2]=t[1],t[1]=this.pos[0];break;case"T":t[0]="Q",t[3]=t[1],t[4]=t[2],t[1]=this.reflection[1],t[2]=this.reflection[0];break;case"S":t[0]="C",t[6]=t[4],t[5]=t[3],t[4]=t[2],t[3]=t[1],t[2]=this.reflection[1],t[1]=this.reflection[0]}return t}function i(t){var e=t.length;return this.pos=[t[e-2],t[e-1]],-1!="SCQT".indexOf(t[0])&&(this.reflection=[2*this.pos[0]-t[e-4],2*this.pos[1]-t[e-3]]),t}function a(t){var e=[t];switch(t[0]){case"M":return this.pos=this.start=[t[1],t[2]],e;case"L":t[5]=t[3]=t[1],t[6]=t[4]=t[2],t[1]=this.pos[0],t[2]=this.pos[1];break;case"Q":t[6]=t[4],t[5]=t[3],t[4]=1*t[4]/3+2*t[2]/3,t[3]=1*t[3]/3+2*t[1]/3,t[2]=1*this.pos[1]/3+2*t[2]/3,t[1]=1*this.pos[0]/3+2*t[1]/3;break;case"A":e=function(t,e){var i,a,s,r,n,o,l,h,c,d,u,g,p,f,x,b,m,v,y,w,k,A,C,S,L,M,P=Math.abs(e[1]),I=Math.abs(e[2]),T=e[3]%360,z=e[4],X=e[5],R=e[6],E=e[7],Y=new bt(t),H=new bt(R,E),O=[];if(0===P||0===I||Y.x===H.x&&Y.y===H.y)return[["C",Y.x,Y.y,H.x,H.y,H.x,H.y]];i=new bt((Y.x-H.x)/2,(Y.y-H.y)/2).transform((new vt).rotate(T)),a=i.x*i.x/(P*P)+i.y*i.y/(I*I),a>1&&(P*=a=Math.sqrt(a),I*=a);s=(new vt).rotate(T).scale(1/P,1/I).rotate(-T),Y=Y.transform(s),H=H.transform(s),r=[H.x-Y.x,H.y-Y.y],o=r[0]*r[0]+r[1]*r[1],n=Math.sqrt(o),r[0]/=n,r[1]/=n,l=o<4?Math.sqrt(1-o/4):0,z===X&&(l*=-1);h=new bt((H.x+Y.x)/2+l*-r[1],(H.y+Y.y)/2+l*r[0]),c=new bt(Y.x-h.x,Y.y-h.y),d=new bt(H.x-h.x,H.y-h.y),u=Math.acos(c.x/Math.sqrt(c.x*c.x+c.y*c.y)),c.y<0&&(u*=-1);g=Math.acos(d.x/Math.sqrt(d.x*d.x+d.y*d.y)),d.y<0&&(g*=-1);X&&u>g&&(g+=2*Math.PI);!X&&u0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1?arguments[1]:void 0;if(!1===e)return!1;for(var i=e,a=t.length;i(t.changedTouches&&(t=t.changedTouches[0]),{x:t.clientX,y:t.clientY});class Ja{constructor(t){t.remember("_draggable",this),this.el=t,this.drag=this.drag.bind(this),this.startDrag=this.startDrag.bind(this),this.endDrag=this.endDrag.bind(this)}init(t){t?(this.el.on("mousedown.drag",this.startDrag),this.el.on("touchstart.drag",this.startDrag,{passive:!1})):(this.el.off("mousedown.drag"),this.el.off("touchstart.drag"))}startDrag(t){const e=!t.type.indexOf("mouse");if(e&&1!==t.which&&0!==t.buttons)return;if(this.el.dispatch("beforedrag",{event:t,handler:this}).defaultPrevented)return;t.preventDefault(),t.stopPropagation(),this.init(!1),this.box=this.el.bbox(),this.lastClick=this.el.point($a(t));const i=(e?"mouseup":"touchend")+".drag";zt(window,(e?"mousemove":"touchmove")+".drag",this.drag,this,{passive:!1}),zt(window,i,this.endDrag,this,{passive:!1}),this.el.fire("dragstart",{event:t,handler:this,box:this.box})}drag(t){const{box:e,lastClick:i}=this,a=this.el.point($a(t)),s=a.x-i.x,r=a.y-i.y;if(!s&&!r)return e;const n=e.x+s,o=e.y+r;this.box=new kt(n,o,e.w,e.h),this.lastClick=a,this.el.dispatch("dragmove",{event:t,handler:this,box:this.box}).defaultPrevented||this.move(n,o)}move(t,e){"svg"===this.el.type?gi.prototype.move.call(this.el,t,e):this.el.move(t,e)}endDrag(t){this.drag(t),this.el.fire("dragend",{event:t,handler:this,box:this.box}),Xt(window,"mousemove.drag"),Xt(window,"touchmove.drag"),Xt(window,"mouseup.drag"),Xt(window,"touchend.drag"),this.init(!0)}} +/*! + * @svgdotjs/svg.select.js - An extension of svg.js which allows to select elements with mouse + * @version 4.0.1 + * https://github.com/svgdotjs/svg.select.js + * + * @copyright Ulrich-Matthias Schäfer + * @license MIT + * + * BUILT: Mon Jul 01 2024 15:04:42 GMT+0200 (Central European Summer Time) + */ +function Qa(t,e,i,a=null){return function(s){s.preventDefault(),s.stopPropagation();var r=s.pageX||s.touches[0].pageX,n=s.pageY||s.touches[0].pageY;e.fire(t,{x:r,y:n,event:s,index:a,points:i})}}function Ka([t,e],{a:i,b:a,c:s,d:r,e:n,f:o}){return[t*i+e*s+n,t*a+e*r+o]}Q(Gt,{draggable(t=!0){return(this.remember("_draggable")||new Ja(this)).init(t),this}});let ts=class{constructor(t){this.el=t,t.remember("_selectHandler",this),this.selection=new gi,this.order=["lt","t","rt","r","rb","b","lb","l","rot"],this.mutationHandler=this.mutationHandler.bind(this);const e=F();this.observer=new e.MutationObserver(this.mutationHandler)}init(t){this.createHandle=t.createHandle||this.createHandleFn,this.createRot=t.createRot||this.createRotFn,this.updateHandle=t.updateHandle||this.updateHandleFn,this.updateRot=t.updateRot||this.updateRotFn,this.el.root().put(this.selection),this.updatePoints(),this.createSelection(),this.createResizeHandles(),this.updateResizeHandles(),this.createRotationHandle(),this.updateRotationHandle(),this.observer.observe(this.el.node,{attributes:!0})}active(t,e){if(!t)return this.selection.clear().remove(),void this.observer.disconnect();this.init(e)}createSelection(){this.selection.polygon(this.handlePoints).addClass("svg_select_shape")}updateSelection(){this.selection.get(0).plot(this.handlePoints)}createResizeHandles(){this.handlePoints.forEach(((t,e,i)=>{const a=this.order[e];this.createHandle.call(this,this.selection,t,e,i,a),this.selection.get(e+1).addClass("svg_select_handle svg_select_handle_"+a).on("mousedown.selection touchstart.selection",Qa(a,this.el,this.handlePoints,e))}))}createHandleFn(t){t.polyline()}updateHandleFn(t,e,i,a){const s=a.at(i-1),r=a[(i+1)%a.length],n=e,o=[n[0]-s[0],n[1]-s[1]],l=[n[0]-r[0],n[1]-r[1]],h=Math.sqrt(o[0]*o[0]+o[1]*o[1]),c=Math.sqrt(l[0]*l[0]+l[1]*l[1]),d=[o[0]/h,o[1]/h],u=[l[0]/c,l[1]/c],g=[n[0]-10*d[0],n[1]-10*d[1]],p=[n[0]-10*u[0],n[1]-10*u[1]];t.plot([g,n,p])}updateResizeHandles(){this.handlePoints.forEach(((t,e,i)=>{const a=this.order[e];this.updateHandle.call(this,this.selection.get(e+1),t,e,i,a)}))}createRotFn(t){t.line(),t.circle(5)}getPoint(t){return this.handlePoints[this.order.indexOf(t)]}getPointHandle(t){return this.selection.get(this.order.indexOf(t)+1)}updateRotFn(t,e){const i=this.getPoint("t");t.get(0).plot(i[0],i[1],e[0],e[1]),t.get(1).center(e[0],e[1])}createRotationHandle(){const t=this.selection.group().addClass("svg_select_handle_rot").on("mousedown.selection touchstart.selection",Qa("rot",this.el,this.handlePoints));this.createRot.call(this,t)}updateRotationHandle(){const t=this.selection.findOne("g.svg_select_handle_rot");this.updateRot(t,this.rotationPoint,this.handlePoints)}updatePoints(){const t=this.el.bbox(),e=this.el.parent().screenCTM().inverseO().multiplyO(this.el.screenCTM());this.handlePoints=this.getHandlePoints(t).map((t=>Ka(t,e))),this.rotationPoint=Ka(this.getRotationPoint(t),e)}getHandlePoints({x:t,x2:e,y:i,y2:a,cx:s,cy:r}=this.el.bbox()){return[[t,i],[s,i],[e,i],[e,r],[e,a],[s,a],[t,a],[t,r]]}getRotationPoint({y:t,cx:e}=this.el.bbox()){return[e,t-20]}mutationHandler(){this.updatePoints(),this.updateSelection(),this.updateResizeHandles(),this.updateRotationHandle()}};const es=t=>function(e=!0,i={}){"object"==typeof e&&(i=e,e=!0);let a=this.remember("_"+t.name);return a||(e.prototype instanceof ts?(a=new e(this),e=!0):a=new t(this),this.remember("_"+t.name,a)),a.active(e,i),this}; +/*! + * @svgdotjs/svg.resize.js - An extension for svg.js which allows to resize elements which are selected + * @version 2.0.4 + * https://github.com/svgdotjs/svg.resize.js + * + * @copyright [object Object] + * @license MIT + * + * BUILT: Fri Sep 13 2024 12:43:14 GMT+0200 (Central European Summer Time) + */ +/*! + * @svgdotjs/svg.select.js - An extension of svg.js which allows to select elements with mouse + * @version 4.0.1 + * https://github.com/svgdotjs/svg.select.js + * + * @copyright Ulrich-Matthias Schäfer + * @license MIT + * + * BUILT: Mon Jul 01 2024 15:04:42 GMT+0200 (Central European Summer Time) + */ +function is(t,e,i,a=null){return function(s){s.preventDefault(),s.stopPropagation();var r=s.pageX||s.touches[0].pageX,n=s.pageY||s.touches[0].pageY;e.fire(t,{x:r,y:n,event:s,index:a,points:i})}}function as([t,e],{a:i,b:a,c:s,d:r,e:n,f:o}){return[t*i+e*s+n,t*a+e*r+o]}Q(Gt,{select:es(ts)}),Q([Ge,je,xe],{pointSelect:es(class{constructor(t){this.el=t,t.remember("_pointSelectHandler",this),this.selection=new gi,this.order=["lt","t","rt","r","rb","b","lb","l","rot"],this.mutationHandler=this.mutationHandler.bind(this);const e=F();this.observer=new e.MutationObserver(this.mutationHandler)}init(t){this.createHandle=t.createHandle||this.createHandleFn,this.updateHandle=t.updateHandle||this.updateHandleFn,this.el.root().put(this.selection),this.updatePoints(),this.createSelection(),this.createPointHandles(),this.updatePointHandles(),this.observer.observe(this.el.node,{attributes:!0})}active(t,e){if(!t)return this.selection.clear().remove(),void this.observer.disconnect();this.init(e)}createSelection(){this.selection.polygon(this.points).addClass("svg_select_shape_pointSelect")}updateSelection(){this.selection.get(0).plot(this.points)}createPointHandles(){this.points.forEach(((t,e,i)=>{this.createHandle.call(this,this.selection,t,e,i),this.selection.get(e+1).addClass("svg_select_handle_point").on("mousedown.selection touchstart.selection",Qa("point",this.el,this.points,e))}))}createHandleFn(t){t.circle(5)}updateHandleFn(t,e){t.center(e[0],e[1])}updatePointHandles(){this.points.forEach(((t,e,i)=>{this.updateHandle.call(this,this.selection.get(e+1),t,e,i)}))}updatePoints(){const t=this.el.parent().screenCTM().inverseO().multiplyO(this.el.screenCTM());this.points=this.el.array().map((e=>Ka(e,t)))}mutationHandler(){this.updatePoints(),this.updateSelection(),this.updatePointHandles()}})});class ss{constructor(t){this.el=t,t.remember("_selectHandler",this),this.selection=new gi,this.order=["lt","t","rt","r","rb","b","lb","l","rot"],this.mutationHandler=this.mutationHandler.bind(this);const e=F();this.observer=new e.MutationObserver(this.mutationHandler)}init(t){this.createHandle=t.createHandle||this.createHandleFn,this.createRot=t.createRot||this.createRotFn,this.updateHandle=t.updateHandle||this.updateHandleFn,this.updateRot=t.updateRot||this.updateRotFn,this.el.root().put(this.selection),this.updatePoints(),this.createSelection(),this.createResizeHandles(),this.updateResizeHandles(),this.createRotationHandle(),this.updateRotationHandle(),this.observer.observe(this.el.node,{attributes:!0})}active(t,e){if(!t)return this.selection.clear().remove(),void this.observer.disconnect();this.init(e)}createSelection(){this.selection.polygon(this.handlePoints).addClass("svg_select_shape")}updateSelection(){this.selection.get(0).plot(this.handlePoints)}createResizeHandles(){this.handlePoints.forEach(((t,e,i)=>{const a=this.order[e];this.createHandle.call(this,this.selection,t,e,i,a),this.selection.get(e+1).addClass("svg_select_handle svg_select_handle_"+a).on("mousedown.selection touchstart.selection",is(a,this.el,this.handlePoints,e))}))}createHandleFn(t){t.polyline()}updateHandleFn(t,e,i,a){const s=a.at(i-1),r=a[(i+1)%a.length],n=e,o=[n[0]-s[0],n[1]-s[1]],l=[n[0]-r[0],n[1]-r[1]],h=Math.sqrt(o[0]*o[0]+o[1]*o[1]),c=Math.sqrt(l[0]*l[0]+l[1]*l[1]),d=[o[0]/h,o[1]/h],u=[l[0]/c,l[1]/c],g=[n[0]-10*d[0],n[1]-10*d[1]],p=[n[0]-10*u[0],n[1]-10*u[1]];t.plot([g,n,p])}updateResizeHandles(){this.handlePoints.forEach(((t,e,i)=>{const a=this.order[e];this.updateHandle.call(this,this.selection.get(e+1),t,e,i,a)}))}createRotFn(t){t.line(),t.circle(5)}getPoint(t){return this.handlePoints[this.order.indexOf(t)]}getPointHandle(t){return this.selection.get(this.order.indexOf(t)+1)}updateRotFn(t,e){const i=this.getPoint("t");t.get(0).plot(i[0],i[1],e[0],e[1]),t.get(1).center(e[0],e[1])}createRotationHandle(){const t=this.selection.group().addClass("svg_select_handle_rot").on("mousedown.selection touchstart.selection",is("rot",this.el,this.handlePoints));this.createRot.call(this,t)}updateRotationHandle(){const t=this.selection.findOne("g.svg_select_handle_rot");this.updateRot(t,this.rotationPoint,this.handlePoints)}updatePoints(){const t=this.el.bbox(),e=this.el.parent().screenCTM().inverseO().multiplyO(this.el.screenCTM());this.handlePoints=this.getHandlePoints(t).map((t=>as(t,e))),this.rotationPoint=as(this.getRotationPoint(t),e)}getHandlePoints({x:t,x2:e,y:i,y2:a,cx:s,cy:r}=this.el.bbox()){return[[t,i],[s,i],[e,i],[e,r],[e,a],[s,a],[t,a],[t,r]]}getRotationPoint({y:t,cx:e}=this.el.bbox()){return[e,t-20]}mutationHandler(){this.updatePoints(),this.updateSelection(),this.updateResizeHandles(),this.updateRotationHandle()}}const rs=t=>function(e=!0,i={}){"object"==typeof e&&(i=e,e=!0);let a=this.remember("_"+t.name);return a||(e.prototype instanceof ss?(a=new e(this),e=!0):a=new t(this),this.remember("_"+t.name,a)),a.active(e,i),this};Q(Gt,{select:rs(ss)}),Q([Ge,je,xe],{pointSelect:rs(class{constructor(t){this.el=t,t.remember("_pointSelectHandler",this),this.selection=new gi,this.order=["lt","t","rt","r","rb","b","lb","l","rot"],this.mutationHandler=this.mutationHandler.bind(this);const e=F();this.observer=new e.MutationObserver(this.mutationHandler)}init(t){this.createHandle=t.createHandle||this.createHandleFn,this.updateHandle=t.updateHandle||this.updateHandleFn,this.el.root().put(this.selection),this.updatePoints(),this.createSelection(),this.createPointHandles(),this.updatePointHandles(),this.observer.observe(this.el.node,{attributes:!0})}active(t,e){if(!t)return this.selection.clear().remove(),void this.observer.disconnect();this.init(e)}createSelection(){this.selection.polygon(this.points).addClass("svg_select_shape_pointSelect")}updateSelection(){this.selection.get(0).plot(this.points)}createPointHandles(){this.points.forEach(((t,e,i)=>{this.createHandle.call(this,this.selection,t,e,i),this.selection.get(e+1).addClass("svg_select_handle_point").on("mousedown.selection touchstart.selection",is("point",this.el,this.points,e))}))}createHandleFn(t){t.circle(5)}updateHandleFn(t,e){t.center(e[0],e[1])}updatePointHandles(){this.points.forEach(((t,e,i)=>{this.updateHandle.call(this,this.selection.get(e+1),t,e,i)}))}updatePoints(){const t=this.el.parent().screenCTM().inverseO().multiplyO(this.el.screenCTM());this.points=this.el.array().map((e=>as(e,t)))}mutationHandler(){this.updatePoints(),this.updateSelection(),this.updatePointHandles()}})});const ns=t=>(t.changedTouches&&(t=t.changedTouches[0]),{x:t.clientX,y:t.clientY}),os=t=>{let e=1/0,i=1/0,a=-1/0,s=-1/0;for(let r=0;r{const s=t-e[0],r=(a-e[1])*i;return[s*i+e[0],r+e[1]]}));return os(a)}(this.box,s,r)}this.el.dispatch("resize",{box:new kt(l),angle:0,eventType:this.eventType,event:t,handler:this}).defaultPrevented||this.el.size(l.width,l.height).move(l.x,l.y)}movePoint(t){this.lastEvent=t;const{x:e,y:i}=this.snapToGrid(this.el.point(ns(t))),a=this.el.array().slice();a[this.index]=[e,i],this.el.dispatch("resize",{box:os(a),angle:0,eventType:this.eventType,event:t,handler:this}).defaultPrevented||this.el.plot(a)}rotate(t){this.lastEvent=t;const e=this.startPoint,i=this.el.point(ns(t)),{cx:a,cy:s}=this.box,r=e.x-a,n=e.y-s,o=i.x-a,l=i.y-s,h=Math.sqrt(r*r+n*n)*Math.sqrt(o*o+l*l);if(0===h)return;let c=Math.acos((r*o+n*l)/h)/Math.PI*180;if(!c)return;i.xdiv {\n margin: 4px 0\n}\n\n.apexcharts-tooltip-box span.value {\n font-weight: 700\n}\n\n.apexcharts-tooltip-rangebar {\n padding: 5px 8px\n}\n\n.apexcharts-tooltip-rangebar .category {\n font-weight: 600;\n color: #777\n}\n\n.apexcharts-tooltip-rangebar .series-name {\n font-weight: 700;\n display: block;\n margin-bottom: 5px\n}\n\n.apexcharts-xaxistooltip,\n.apexcharts-yaxistooltip {\n opacity: 0;\n pointer-events: none;\n color: #373d3f;\n font-size: 13px;\n text-align: center;\n border-radius: 2px;\n position: absolute;\n z-index: 10;\n background: #eceff1;\n border: 1px solid #90a4ae\n}\n\n.apexcharts-xaxistooltip {\n padding: 9px 10px;\n transition: .15s ease all\n}\n\n.apexcharts-xaxistooltip.apexcharts-theme-dark {\n background: rgba(0, 0, 0, .7);\n border: 1px solid rgba(0, 0, 0, .5);\n color: #fff\n}\n\n.apexcharts-xaxistooltip:after,\n.apexcharts-xaxistooltip:before {\n left: 50%;\n border: solid transparent;\n content: " ";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none\n}\n\n.apexcharts-xaxistooltip:after {\n border-color: transparent;\n border-width: 6px;\n margin-left: -6px\n}\n\n.apexcharts-xaxistooltip:before {\n border-color: transparent;\n border-width: 7px;\n margin-left: -7px\n}\n\n.apexcharts-xaxistooltip-bottom:after,\n.apexcharts-xaxistooltip-bottom:before {\n bottom: 100%\n}\n\n.apexcharts-xaxistooltip-top:after,\n.apexcharts-xaxistooltip-top:before {\n top: 100%\n}\n\n.apexcharts-xaxistooltip-bottom:after {\n border-bottom-color: #eceff1\n}\n\n.apexcharts-xaxistooltip-bottom:before {\n border-bottom-color: #90a4ae\n}\n\n.apexcharts-xaxistooltip-bottom.apexcharts-theme-dark:after,\n.apexcharts-xaxistooltip-bottom.apexcharts-theme-dark:before {\n border-bottom-color: rgba(0, 0, 0, .5)\n}\n\n.apexcharts-xaxistooltip-top:after {\n border-top-color: #eceff1\n}\n\n.apexcharts-xaxistooltip-top:before {\n border-top-color: #90a4ae\n}\n\n.apexcharts-xaxistooltip-top.apexcharts-theme-dark:after,\n.apexcharts-xaxistooltip-top.apexcharts-theme-dark:before {\n border-top-color: rgba(0, 0, 0, .5)\n}\n\n.apexcharts-xaxistooltip.apexcharts-active {\n opacity: 1;\n transition: .15s ease all\n}\n\n.apexcharts-yaxistooltip {\n padding: 4px 10px\n}\n\n.apexcharts-yaxistooltip.apexcharts-theme-dark {\n background: rgba(0, 0, 0, .7);\n border: 1px solid rgba(0, 0, 0, .5);\n color: #fff\n}\n\n.apexcharts-yaxistooltip:after,\n.apexcharts-yaxistooltip:before {\n top: 50%;\n border: solid transparent;\n content: " ";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none\n}\n\n.apexcharts-yaxistooltip:after {\n border-color: transparent;\n border-width: 6px;\n margin-top: -6px\n}\n\n.apexcharts-yaxistooltip:before {\n border-color: transparent;\n border-width: 7px;\n margin-top: -7px\n}\n\n.apexcharts-yaxistooltip-left:after,\n.apexcharts-yaxistooltip-left:before {\n left: 100%\n}\n\n.apexcharts-yaxistooltip-right:after,\n.apexcharts-yaxistooltip-right:before {\n right: 100%\n}\n\n.apexcharts-yaxistooltip-left:after {\n border-left-color: #eceff1\n}\n\n.apexcharts-yaxistooltip-left:before {\n border-left-color: #90a4ae\n}\n\n.apexcharts-yaxistooltip-left.apexcharts-theme-dark:after,\n.apexcharts-yaxistooltip-left.apexcharts-theme-dark:before {\n border-left-color: rgba(0, 0, 0, .5)\n}\n\n.apexcharts-yaxistooltip-right:after {\n border-right-color: #eceff1\n}\n\n.apexcharts-yaxistooltip-right:before {\n border-right-color: #90a4ae\n}\n\n.apexcharts-yaxistooltip-right.apexcharts-theme-dark:after,\n.apexcharts-yaxistooltip-right.apexcharts-theme-dark:before {\n border-right-color: rgba(0, 0, 0, .5)\n}\n\n.apexcharts-yaxistooltip.apexcharts-active {\n opacity: 1\n}\n\n.apexcharts-yaxistooltip-hidden {\n display: none\n}\n\n.apexcharts-xcrosshairs,\n.apexcharts-ycrosshairs {\n pointer-events: none;\n opacity: 0;\n transition: .15s ease all\n}\n\n.apexcharts-xcrosshairs.apexcharts-active,\n.apexcharts-ycrosshairs.apexcharts-active {\n opacity: 1;\n transition: .15s ease all\n}\n\n.apexcharts-ycrosshairs-hidden {\n opacity: 0\n}\n\n.apexcharts-selection-rect {\n cursor: move\n}\n\n.svg_select_shape {\n stroke-width: 1;\n stroke-dasharray: 10 10;\n stroke: black;\n stroke-opacity: 0.1;\n pointer-events: none;\n fill: none;\n}\n\n.svg_select_handle {\n stroke-width: 3;\n stroke: black;\n fill: none;\n}\n\n.svg_select_handle_r {\n cursor: e-resize;\n}\n\n.svg_select_handle_l {\n cursor: w-resize;\n}\n\n.apexcharts-svg.apexcharts-zoomable.hovering-zoom {\n cursor: crosshair\n}\n\n.apexcharts-svg.apexcharts-zoomable.hovering-pan {\n cursor: move\n}\n\n.apexcharts-menu-icon,\n.apexcharts-pan-icon,\n.apexcharts-reset-icon,\n.apexcharts-selection-icon,\n.apexcharts-toolbar-custom-icon,\n.apexcharts-zoom-icon,\n.apexcharts-zoomin-icon,\n.apexcharts-zoomout-icon {\n cursor: pointer;\n width: 20px;\n height: 20px;\n line-height: 24px;\n color: #6e8192;\n text-align: center\n}\n\n.apexcharts-menu-icon svg,\n.apexcharts-reset-icon svg,\n.apexcharts-zoom-icon svg,\n.apexcharts-zoomin-icon svg,\n.apexcharts-zoomout-icon svg {\n fill: #6e8192\n}\n\n.apexcharts-selection-icon svg {\n fill: #444;\n transform: scale(.76)\n}\n\n.apexcharts-theme-dark .apexcharts-menu-icon svg,\n.apexcharts-theme-dark .apexcharts-pan-icon svg,\n.apexcharts-theme-dark .apexcharts-reset-icon svg,\n.apexcharts-theme-dark .apexcharts-selection-icon svg,\n.apexcharts-theme-dark .apexcharts-toolbar-custom-icon svg,\n.apexcharts-theme-dark .apexcharts-zoom-icon svg,\n.apexcharts-theme-dark .apexcharts-zoomin-icon svg,\n.apexcharts-theme-dark .apexcharts-zoomout-icon svg {\n fill: #f3f4f5\n}\n\n.apexcharts-canvas .apexcharts-reset-zoom-icon.apexcharts-selected svg,\n.apexcharts-canvas .apexcharts-selection-icon.apexcharts-selected svg,\n.apexcharts-canvas .apexcharts-zoom-icon.apexcharts-selected svg {\n fill: #008ffb\n}\n\n.apexcharts-theme-light .apexcharts-menu-icon:hover svg,\n.apexcharts-theme-light .apexcharts-reset-icon:hover svg,\n.apexcharts-theme-light .apexcharts-selection-icon:not(.apexcharts-selected):hover svg,\n.apexcharts-theme-light .apexcharts-zoom-icon:not(.apexcharts-selected):hover svg,\n.apexcharts-theme-light .apexcharts-zoomin-icon:hover svg,\n.apexcharts-theme-light .apexcharts-zoomout-icon:hover svg {\n fill: #333\n}\n\n.apexcharts-menu-icon,\n.apexcharts-selection-icon {\n position: relative\n}\n\n.apexcharts-reset-icon {\n margin-left: 5px\n}\n\n.apexcharts-menu-icon,\n.apexcharts-reset-icon,\n.apexcharts-zoom-icon {\n transform: scale(.85)\n}\n\n.apexcharts-zoomin-icon,\n.apexcharts-zoomout-icon {\n transform: scale(.7)\n}\n\n.apexcharts-zoomout-icon {\n margin-right: 3px\n}\n\n.apexcharts-pan-icon {\n transform: scale(.62);\n position: relative;\n left: 1px;\n top: 0\n}\n\n.apexcharts-pan-icon svg {\n fill: #fff;\n stroke: #6e8192;\n stroke-width: 2\n}\n\n.apexcharts-pan-icon.apexcharts-selected svg {\n stroke: #008ffb\n}\n\n.apexcharts-pan-icon:not(.apexcharts-selected):hover svg {\n stroke: #333\n}\n\n.apexcharts-toolbar {\n position: absolute;\n z-index: 11;\n max-width: 176px;\n text-align: right;\n border-radius: 3px;\n padding: 0 6px 2px;\n display: flex;\n justify-content: space-between;\n align-items: center\n}\n\n.apexcharts-menu {\n background: #fff;\n position: absolute;\n top: 100%;\n border: 1px solid #ddd;\n border-radius: 3px;\n padding: 3px;\n right: 10px;\n opacity: 0;\n min-width: 110px;\n transition: .15s ease all;\n pointer-events: none\n}\n\n.apexcharts-menu.apexcharts-menu-open {\n opacity: 1;\n pointer-events: all;\n transition: .15s ease all\n}\n\n.apexcharts-menu-item {\n padding: 6px 7px;\n font-size: 12px;\n cursor: pointer\n}\n\n.apexcharts-theme-light .apexcharts-menu-item:hover {\n background: #eee\n}\n\n.apexcharts-theme-dark .apexcharts-menu {\n background: rgba(0, 0, 0, .7);\n color: #fff\n}\n\n@media screen and (min-width:768px) {\n .apexcharts-canvas:hover .apexcharts-toolbar {\n opacity: 1\n }\n}\n\n.apexcharts-canvas .apexcharts-element-hidden,\n.apexcharts-datalabel.apexcharts-element-hidden,\n.apexcharts-hide .apexcharts-series-points {\n opacity: 0;\n}\n\n.apexcharts-hidden-element-shown {\n opacity: 1;\n transition: 0.25s ease all;\n}\n\n.apexcharts-datalabel,\n.apexcharts-datalabel-label,\n.apexcharts-datalabel-value,\n.apexcharts-datalabels,\n.apexcharts-pie-label {\n cursor: default;\n pointer-events: none\n}\n\n.apexcharts-pie-label-delay {\n opacity: 0;\n animation-name: opaque;\n animation-duration: .3s;\n animation-fill-mode: forwards;\n animation-timing-function: ease\n}\n\n.apexcharts-radialbar-label {\n cursor: pointer;\n}\n\n.apexcharts-annotation-rect,\n.apexcharts-area-series .apexcharts-area,\n.apexcharts-gridline,\n.apexcharts-line,\n.apexcharts-point-annotation-label,\n.apexcharts-radar-series path:not(.apexcharts-marker),\n.apexcharts-radar-series polygon,\n.apexcharts-toolbar svg,\n.apexcharts-tooltip .apexcharts-marker,\n.apexcharts-xaxis-annotation-label,\n.apexcharts-yaxis-annotation-label,\n.apexcharts-zoom-rect,\n.no-pointer-events {\n pointer-events: none\n}\n\n.apexcharts-tooltip-active .apexcharts-marker {\n transition: .15s ease all\n}\n\n.apexcharts-radar-series .apexcharts-yaxis {\n pointer-events: none;\n}\n\n.resize-triggers {\n animation: 1ms resizeanim;\n visibility: hidden;\n opacity: 0;\n height: 100%;\n width: 100%;\n overflow: hidden\n}\n\n.contract-trigger:before,\n.resize-triggers,\n.resize-triggers>div {\n content: " ";\n display: block;\n position: absolute;\n top: 0;\n left: 0\n}\n\n.resize-triggers>div {\n height: 100%;\n width: 100%;\n background: #eee;\n overflow: auto\n}\n\n.contract-trigger:before {\n overflow: hidden;\n width: 200%;\n height: 200%\n}\n\n.apexcharts-bar-goals-markers {\n pointer-events: none\n}\n\n.apexcharts-bar-shadows {\n pointer-events: none\n}\n\n.apexcharts-rangebar-goals-markers {\n pointer-events: none\n}';var h=(null===(l=t.opts.chart)||void 0===l?void 0:l.nonce)||t.w.config.chart.nonce;h&&o.setAttribute("nonce",h),r?s.prepend(o):n.head.appendChild(o)}var c=t.create(t.w.config.series,{});if(!c)return e(t);t.mount(c).then((function(){"function"==typeof t.w.config.chart.events.mounted&&t.w.config.chart.events.mounted(t,t.w),t.events.fireEvent("mounted",[t,t.w]),e(c)})).catch((function(t){i(t)}))}else i(new Error("Element not found"))}))}},{key:"create",value:function(t,e){var i=this,a=this.w;new hs(this).initModules();var s=this.w.globals;if(s.noData=!1,s.animationEnded=!1,!v.elementExists(this.el))return s.animationEnded=!0,this.destroy(),null;(this.responsive.checkResponsiveConfig(e),a.config.xaxis.convertedCatToNumeric)&&new Ni(a.config).convertCatToNumericXaxis(a.config,this.ctx);if(this.core.setupElements(),"treemap"===a.config.chart.type&&(a.config.grid.show=!1,a.config.yaxis[0].show=!1),0===s.svgWidth)return s.animationEnded=!0,null;var r=t;t.forEach((function(t,e){t.hidden&&(r=i.legend.legendHelpers.getSeriesAfterCollapsing({realIndex:e}))}));var n=Pi.checkComboSeries(r,a.config.chart.type);s.comboCharts=n.comboCharts,s.comboBarCount=n.comboBarCount;var o=r.every((function(t){return t.data&&0===t.data.length}));(0===r.length||o&&s.collapsedSeries.length<1)&&this.series.handleNoData(),this.events.setupEventHandlers(),this.data.parseData(r),this.theme.init(),new Vi(this).setGlobalMarkerSize(),this.formatters.setLabelFormatters(),this.titleSubtitle.draw(),s.noData&&s.collapsedSeries.length!==s.series.length&&!a.config.legend.showForSingleSeries||this.legend.init(),this.series.hasAllSeriesEqualX(),s.axisCharts&&(this.core.coreCalculations(),"category"!==a.config.xaxis.type&&this.formatters.setLabelFormatters(),this.ctx.toolbar.minX=a.globals.minX,this.ctx.toolbar.maxX=a.globals.maxX),this.formatters.heatmapLabelFormatters(),new Pi(this).getLargestMarkerSize(),this.dimensions.plotCoords();var l=this.core.xySettings();this.grid.createGridMask();var h=this.core.plotChartType(r,l),c=new qi(this);return c.bringForward(),a.config.dataLabels.background.enabled&&c.dataLabelsBackground(),this.core.shiftGraphPosition(),{elGraph:h,xyRatios:l,dimensions:{plot:{left:a.globals.translateX,top:a.globals.translateY,width:a.globals.gridWidth,height:a.globals.gridHeight}}}}},{key:"mount",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=this,a=i.w;return new Promise((function(s,r){if(null===i.el)return r(new Error("Not enough data to display or target element not found"));(null===e||a.globals.allSeriesCollapsed)&&i.series.handleNoData(),i.grid=new Ki(i);var n,o,l=i.grid.drawGrid();(i.annotations=new Fi(i),i.annotations.drawImageAnnos(),i.annotations.drawTextAnnos(),"back"===a.config.grid.position)&&(l&&a.globals.dom.elGraphical.add(l.el),null!=l&&null!==(n=l.elGridBorders)&&void 0!==n&&n.node&&a.globals.dom.elGraphical.add(l.elGridBorders));if(Array.isArray(e.elGraph))for(var h=0;h0&&a.globals.memory.methodsToExec.forEach((function(t){t.method(t.params,!1,t.context)})),a.globals.axisCharts||a.globals.noData||i.core.resizeNonAxisCharts(),s(i)}))}},{key:"destroy",value:function(){window.removeEventListener("resize",this.windowResizeHandler),function(t,e){var i=ds.get(e);i&&(i.disconnect(),ds.delete(e))}(this.el.parentNode,this.parentResizeHandler);var t=this.w.config.chart.id;t&&Apex._chartInstances.forEach((function(e,i){e.id===v.escapeString(t)&&Apex._chartInstances.splice(i,1)})),new cs(this.ctx).clear({isUpdating:!1})}},{key:"updateOptions",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=this.w;return n.globals.selection=void 0,t.series&&(this.series.resetSeries(!1,!0,!1),t.series.length&&t.series[0].data&&(t.series=t.series.map((function(t,i){return e.updateHelpers._extendSeries(t,i)}))),this.updateHelpers.revertDefaultAxisMinMax()),t.xaxis&&(t=this.updateHelpers.forceXAxisUpdate(t)),t.yaxis&&(t=this.updateHelpers.forceYAxisUpdate(t)),n.globals.collapsedSeriesIndices.length>0&&this.series.clearPreviousPaths(),t.theme&&(t=this.theme.updateThemeOptions(t)),this.updateHelpers._updateOptions(t,i,a,s,r)}},{key:"updateSeries",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return this.series.resetSeries(!1),this.updateHelpers.revertDefaultAxisMinMax(),this.updateHelpers._updateSeries(t,e,i)}},{key:"appendSeries",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=this.w.config.series.slice();return a.push(t),this.series.resetSeries(!1),this.updateHelpers.revertDefaultAxisMinMax(),this.updateHelpers._updateSeries(a,e,i)}},{key:"appendData",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this;i.w.globals.dataChanged=!0,i.series.getPreviousPaths();for(var a=i.w.config.series.slice(),s=0;s0&&void 0!==arguments[0])||arguments[0],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.series.resetSeries(t,e)}},{key:"addEventListener",value:function(t,e){this.events.addEventListener(t,e)}},{key:"removeEventListener",value:function(t,e){this.events.removeEventListener(t,e)}},{key:"addXaxisAnnotation",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,a=this;i&&(a=i),a.annotations.addXaxisAnnotationExternal(t,e,a)}},{key:"addYaxisAnnotation",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,a=this;i&&(a=i),a.annotations.addYaxisAnnotationExternal(t,e,a)}},{key:"addPointAnnotation",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,a=this;i&&(a=i),a.annotations.addPointAnnotationExternal(t,e,a)}},{key:"clearAnnotations",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,e=this;t&&(e=t),e.annotations.clearAnnotations(e)}},{key:"removeAnnotation",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,i=this;e&&(i=e),i.annotations.removeAnnotation(i,t)}},{key:"getChartArea",value:function(){return this.w.globals.dom.baseEl.querySelector(".apexcharts-inner")}},{key:"getSeriesTotalXRange",value:function(t,e){return this.coreUtils.getSeriesTotalsXRange(t,e)}},{key:"getHighestValueInSeries",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new ea(this.ctx).getMinYMaxY(t).highestY}},{key:"getLowestValueInSeries",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new ea(this.ctx).getMinYMaxY(t).lowestY}},{key:"getSeriesTotal",value:function(){return this.w.globals.seriesTotals}},{key:"toggleDataPointSelection",value:function(t,e){return this.updateHelpers.toggleDataPointSelection(t,e)}},{key:"zoomX",value:function(t,e){this.ctx.toolbar.zoomUpdateOptions(t,e)}},{key:"setLocale",value:function(t){this.localization.setCurrentLocaleValues(t)}},{key:"dataURI",value:function(t){return new Ji(this.ctx).dataURI(t)}},{key:"getSvgString",value:function(t){return new Ji(this.ctx).getSvgString(t)}},{key:"exportToCSV",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Ji(this.ctx).exportToCSV(t)}},{key:"paper",value:function(){return this.w.globals.dom.Paper}},{key:"_parentResizeCallback",value:function(){this.w.globals.animationEnded&&this.w.config.chart.redrawOnParentResize&&this._windowResize()}},{key:"_windowResize",value:function(){var t=this;clearTimeout(this.w.globals.resizeTimer),this.w.globals.resizeTimer=window.setTimeout((function(){t.w.globals.resized=!0,t.w.globals.dataChanged=!1,t.ctx.update()}),150)}},{key:"_windowResizeHandler",value:function(){var t=this.w.config.chart.redrawOnWindowResize;"function"==typeof t&&(t=t()),t&&this._windowResize()}}],[{key:"getChartByID",value:function(t){var e=v.escapeString(t);if(Apex._chartInstances){var i=Apex._chartInstances.filter((function(t){return t.id===e}))[0];return i&&i.chart}}},{key:"initOnLoad",value:function(){for(var e=document.querySelectorAll("[data-apexcharts]"),i=0;i2?s-2:0),n=2;n { + // only draw chart, if element found + if (Utils.elementExists(this.el)) { + if (typeof Apex._chartInstances === 'undefined') { + Apex._chartInstances = [] + } + if (this.w.config.chart.id) { + Apex._chartInstances.push({ + id: this.w.globals.chartID, + group: this.w.config.chart.group, + chart: this, + }) + } + + // set the locale here + this.setLocale(this.w.config.chart.defaultLocale) + const beforeMount = this.w.config.chart.events.beforeMount + if (typeof beforeMount === 'function') { + beforeMount(this, this.w) + } + + this.events.fireEvent('beforeMount', [this, this.w]) + window.addEventListener('resize', this.windowResizeHandler) + addResizeListener(this.el.parentNode, this.parentResizeHandler) + + let rootNode = this.el.getRootNode && this.el.getRootNode() + let inShadowRoot = Utils.is('ShadowRoot', rootNode) + let doc = this.el.ownerDocument + let css = inShadowRoot + ? rootNode.getElementById('apexcharts-css') + : doc.getElementById('apexcharts-css') + + if (!css) { + css = document.createElement('style') + css.id = 'apexcharts-css' + css.textContent = apexCSS + const nonce = this.opts.chart?.nonce || this.w.config.chart.nonce + if (nonce) { + css.setAttribute('nonce', nonce) + } + + if (inShadowRoot) { + // We are in Shadow DOM, add to shadow root + rootNode.prepend(css) + } else { + // Add to of element's document + doc.head.appendChild(css) + } + } + + let graphData = this.create(this.w.config.series, {}) + if (!graphData) return resolve(this) + this.mount(graphData) + .then(() => { + if (typeof this.w.config.chart.events.mounted === 'function') { + this.w.config.chart.events.mounted(this, this.w) + } + + this.events.fireEvent('mounted', [this, this.w]) + resolve(graphData) + }) + .catch((e) => { + reject(e) + // handle error in case no data or element not found + }) + } else { + reject(new Error('Element not found')) + } + }) + } + + create(ser, opts) { + let w = this.w + + const initCtx = new InitCtxVariables(this) + initCtx.initModules() + let gl = this.w.globals + + gl.noData = false + gl.animationEnded = false + + if (!Utils.elementExists(this.el)) { + gl.animationEnded = true + this.destroy() + return null + } + + this.responsive.checkResponsiveConfig(opts) + + if (w.config.xaxis.convertedCatToNumeric) { + const defaults = new Defaults(w.config) + defaults.convertCatToNumericXaxis(w.config, this.ctx) + } + + this.core.setupElements() + + if (w.config.chart.type === 'treemap') { + w.config.grid.show = false + w.config.yaxis[0].show = false + } + + if (gl.svgWidth === 0) { + // if the element is hidden, skip drawing + gl.animationEnded = true + return null + } + + let series = ser + ser.forEach((s, realIndex) => { + if (s.hidden) { + series = this.legend.legendHelpers.getSeriesAfterCollapsing({ + realIndex, + }) + } + }) + + const combo = CoreUtils.checkComboSeries(series, w.config.chart.type) + gl.comboCharts = combo.comboCharts + gl.comboBarCount = combo.comboBarCount + + const allSeriesAreEmpty = series.every((s) => s.data && s.data.length === 0) + + if ( + series.length === 0 || + (allSeriesAreEmpty && gl.collapsedSeries.length < 1) + ) { + this.series.handleNoData() + } + + this.events.setupEventHandlers() + + // Handle the data inputted by user and set some of the global variables (for eg, if data is datetime / numeric / category). Don't calculate the range / min / max at this time + this.data.parseData(series) + + // this is a good time to set theme colors first + this.theme.init() + + // as markers accepts array, we need to setup global markers for easier access + const markers = new Markers(this) + markers.setGlobalMarkerSize() + + // labelFormatters should be called before dimensions as in dimensions we need text labels width + this.formatters.setLabelFormatters() + this.titleSubtitle.draw() + + // legend is calculated here before coreCalculations because it affects the plottable area + // if there is some data to show or user collapsed all series, then proceed drawing legend + if ( + !gl.noData || + gl.collapsedSeries.length === gl.series.length || + w.config.legend.showForSingleSeries + ) { + this.legend.init() + } + + // check whether in multiple series, all series share the same X + this.series.hasAllSeriesEqualX() + + // coreCalculations will give the min/max range and yaxis/axis values. It should be called here to set series variable from config to globals + if (gl.axisCharts) { + this.core.coreCalculations() + if (w.config.xaxis.type !== 'category') { + // as we have minX and maxX values, determine the default DateTimeFormat for time series + this.formatters.setLabelFormatters() + } + this.ctx.toolbar.minX = w.globals.minX + this.ctx.toolbar.maxX = w.globals.maxX + } + + // we need to generate yaxis for heatmap separately as we are not showing numerics there, but seriesNames. There are some tweaks which are required for heatmap to align labels correctly which are done in below function + // Also we need to do this before calculating Dimensions plotCoords() method of Dimensions + this.formatters.heatmapLabelFormatters() + + // get the largest marker size which will be needed in dimensions calc + const coreUtils = new CoreUtils(this) + coreUtils.getLargestMarkerSize() + + // We got plottable area here, next task would be to calculate axis areas + this.dimensions.plotCoords() + + const xyRatios = this.core.xySettings() + + this.grid.createGridMask() + + const elGraph = this.core.plotChartType(series, xyRatios) + + const dataLabels = new DataLabels(this) + dataLabels.bringForward() + if (w.config.dataLabels.background.enabled) { + dataLabels.dataLabelsBackground() + } + + // after all the drawing calculations, shift the graphical area (actual charts/bars) excluding legends + this.core.shiftGraphPosition() + + const dim = { + plot: { + left: w.globals.translateX, + top: w.globals.translateY, + width: w.globals.gridWidth, + height: w.globals.gridHeight, + }, + } + + return { + elGraph, + xyRatios, + dimensions: dim, + } + } + + mount(graphData = null) { + let me = this + let w = me.w + + return new Promise((resolve, reject) => { + // no data to display + if (me.el === null) { + return reject( + new Error('Not enough data to display or target element not found') + ) + } else if (graphData === null || w.globals.allSeriesCollapsed) { + me.series.handleNoData() + } + + me.grid = new Grid(me) + let elgrid = me.grid.drawGrid() + + me.annotations = new Annotations(me) + me.annotations.drawImageAnnos() + me.annotations.drawTextAnnos() + + if (w.config.grid.position === 'back') { + if (elgrid) { + w.globals.dom.elGraphical.add(elgrid.el) + } + if (elgrid?.elGridBorders?.node) { + w.globals.dom.elGraphical.add(elgrid.elGridBorders) + } + } + + if (Array.isArray(graphData.elGraph)) { + for (let g = 0; g < graphData.elGraph.length; g++) { + w.globals.dom.elGraphical.add(graphData.elGraph[g]) + } + } else { + w.globals.dom.elGraphical.add(graphData.elGraph) + } + + if (w.config.grid.position === 'front') { + if (elgrid) { + w.globals.dom.elGraphical.add(elgrid.el) + } + if (elgrid?.elGridBorders?.node) { + w.globals.dom.elGraphical.add(elgrid.elGridBorders) + } + } + + if (w.config.xaxis.crosshairs.position === 'front') { + me.crosshairs.drawXCrosshairs() + } + + if (w.config.yaxis[0].crosshairs.position === 'front') { + me.crosshairs.drawYCrosshairs() + } + + if (w.config.chart.type !== 'treemap') { + me.axes.drawAxis(w.config.chart.type, elgrid) + } + + let xAxis = new XAxis(this.ctx, elgrid) + let yaxis = new YAxis(this.ctx, elgrid) + if (elgrid !== null) { + xAxis.xAxisLabelCorrections(elgrid.xAxisTickWidth) + yaxis.setYAxisTextAlignments() + + w.config.yaxis.map((yaxe, index) => { + if (w.globals.ignoreYAxisIndexes.indexOf(index) === -1) { + yaxis.yAxisTitleRotate(index, yaxe.opposite) + } + }) + } + + me.annotations.drawAxesAnnotations() + + if (!w.globals.noData) { + // draw tooltips at the end + if (w.config.tooltip.enabled && !w.globals.noData) { + me.w.globals.tooltip.drawTooltip(graphData.xyRatios) + } + + if ( + w.globals.axisCharts && + (w.globals.isXNumeric || + w.config.xaxis.convertedCatToNumeric || + w.globals.isRangeBar) + ) { + if ( + w.config.chart.zoom.enabled || + (w.config.chart.selection && w.config.chart.selection.enabled) || + (w.config.chart.pan && w.config.chart.pan.enabled) + ) { + me.zoomPanSelection.init({ + xyRatios: graphData.xyRatios, + }) + } + } else { + const tools = w.config.chart.toolbar.tools + let toolsArr = [ + 'zoom', + 'zoomin', + 'zoomout', + 'selection', + 'pan', + 'reset', + ] + toolsArr.forEach((t) => { + tools[t] = false + }) + } + + if (w.config.chart.toolbar.show && !w.globals.allSeriesCollapsed) { + me.toolbar.createToolbar() + } + } + + if (w.globals.memory.methodsToExec.length > 0) { + w.globals.memory.methodsToExec.forEach((fn) => { + fn.method(fn.params, false, fn.context) + }) + } + + if (!w.globals.axisCharts && !w.globals.noData) { + me.core.resizeNonAxisCharts() + } + resolve(me) + }) + } + + /** + * Destroy the chart instance by removing all elements which also clean up event listeners on those elements. + */ + destroy() { + window.removeEventListener('resize', this.windowResizeHandler) + + removeResizeListener(this.el.parentNode, this.parentResizeHandler) + // remove the chart's instance from the global Apex._chartInstances + const chartID = this.w.config.chart.id + if (chartID) { + Apex._chartInstances.forEach((c, i) => { + if (c.id === Utils.escapeString(chartID)) { + Apex._chartInstances.splice(i, 1) + } + }) + } + new Destroy(this.ctx).clear({ isUpdating: false }) + } + + /** + * Allows users to update Options after the chart has rendered. + * + * @param {object} options - A new config object can be passed which will be merged with the existing config object + * @param {boolean} redraw - should redraw from beginning or should use existing paths and redraw from there + * @param {boolean} animate - should animate or not on updating Options + */ + updateOptions( + options, + redraw = false, + animate = true, + updateSyncedCharts = true, + overwriteInitialConfig = true + ) { + const w = this.w + + // when called externally, clear some global variables + // fixes apexcharts.js#1488 + w.globals.selection = undefined + + if (options.series) { + this.series.resetSeries(false, true, false) + if (options.series.length && options.series[0].data) { + options.series = options.series.map((s, i) => { + return this.updateHelpers._extendSeries(s, i) + }) + } + + // user updated the series via updateOptions() function. + // Hence, we need to reset axis min/max to avoid zooming issues + this.updateHelpers.revertDefaultAxisMinMax() + } + // user has set x-axis min/max externally - hence we need to forcefully set the xaxis min/max + if (options.xaxis) { + options = this.updateHelpers.forceXAxisUpdate(options) + } + if (options.yaxis) { + options = this.updateHelpers.forceYAxisUpdate(options) + } + if (w.globals.collapsedSeriesIndices.length > 0) { + this.series.clearPreviousPaths() + } + /* update theme mode#459 */ + if (options.theme) { + options = this.theme.updateThemeOptions(options) + } + return this.updateHelpers._updateOptions( + options, + redraw, + animate, + updateSyncedCharts, + overwriteInitialConfig + ) + } + + /** + * Allows users to update Series after the chart has rendered. + * + * @param {array} series - New series which will override the existing + */ + updateSeries(newSeries = [], animate = true, overwriteInitialSeries = true) { + this.series.resetSeries(false) + this.updateHelpers.revertDefaultAxisMinMax() + return this.updateHelpers._updateSeries( + newSeries, + animate, + overwriteInitialSeries + ) + } + + /** + * Allows users to append a new series after the chart has rendered. + * + * @param {array} newSerie - New serie which will be appended to the existing series + */ + appendSeries(newSerie, animate = true, overwriteInitialSeries = true) { + const newSeries = this.w.config.series.slice() + newSeries.push(newSerie) + this.series.resetSeries(false) + this.updateHelpers.revertDefaultAxisMinMax() + return this.updateHelpers._updateSeries( + newSeries, + animate, + overwriteInitialSeries + ) + } + + /** + * Allows users to append Data to series. + * + * @param {array} newData - New data in the same format as series + */ + appendData(newData, overwriteInitialSeries = true) { + let me = this + + me.w.globals.dataChanged = true + + me.series.getPreviousPaths() + + let newSeries = me.w.config.series.slice() + + for (let i = 0; i < newSeries.length; i++) { + if (newData[i] !== null && typeof newData[i] !== 'undefined') { + for (let j = 0; j < newData[i].data.length; j++) { + newSeries[i].data.push(newData[i].data[j]) + } + } + } + me.w.config.series = newSeries + if (overwriteInitialSeries) { + me.w.globals.initialSeries = Utils.clone(me.w.config.series) + } + + return this.update() + } + + update(options) { + return new Promise((resolve, reject) => { + new Destroy(this.ctx).clear({ isUpdating: true }) + + const graphData = this.create(this.w.config.series, options) + if (!graphData) return resolve(this) + this.mount(graphData) + .then(() => { + if (typeof this.w.config.chart.events.updated === 'function') { + this.w.config.chart.events.updated(this, this.w) + } + this.events.fireEvent('updated', [this, this.w]) + + this.w.globals.isDirty = true + + resolve(this) + }) + .catch((e) => { + reject(e) + }) + }) + } + + /** + * Get all charts in the same "group" (including the instance which is called upon) to sync them when user zooms in/out or pan. + */ + getSyncedCharts() { + const chartGroups = this.getGroupedCharts() + let allCharts = [this] + if (chartGroups.length) { + allCharts = [] + chartGroups.forEach((ch) => { + allCharts.push(ch) + }) + } + + return allCharts + } + + /** + * Get charts in the same "group" (excluding the instance which is called upon) to perform operations on the other charts of the same group (eg., tooltip hovering) + */ + getGroupedCharts() { + return Apex._chartInstances + .filter((ch) => { + if (ch.group) { + return true + } + }) + .map((ch) => (this.w.config.chart.group === ch.group ? ch.chart : this)) + } + + static getChartByID(id) { + const chartId = Utils.escapeString(id) + if (!Apex._chartInstances) return undefined + + const c = Apex._chartInstances.filter((ch) => ch.id === chartId)[0] + return c && c.chart + } + + /** + * Allows the user to provide data attrs in the element and the chart will render automatically when this method is called by searching for the elements containing 'data-apexcharts' attribute + */ + static initOnLoad() { + const els = document.querySelectorAll('[data-apexcharts]') + + for (let i = 0; i < els.length; i++) { + const el = els[i] + const options = JSON.parse(els[i].getAttribute('data-options')) + const apexChart = new ApexCharts(el, options) + apexChart.render() + } + } + + /** + * This static method allows users to call chart methods without necessarily from the + * instance of the chart in case user has assigned chartID to the targeted chart. + * The chartID is used for mapping the instance stored in Apex._chartInstances global variable + * + * This is helpful in cases when you don't have reference of the chart instance + * easily and need to call the method from anywhere. + * For eg, in React/Vue applications when you have many parent/child components, + * and need easy reference to other charts for performing dynamic operations + * + * @param {string} chartID - The unique identifier which will be used to call methods + * on that chart instance + * @param {function} fn - The method name to call + * @param {object} opts - The parameters which are accepted in the original method will be passed here in the same order. + */ + static exec(chartID, fn, ...opts) { + const chart = this.getChartByID(chartID) + if (!chart) return + + // turn on the global exec flag to indicate this method was called + chart.w.globals.isExecCalled = true + + let ret = null + if (chart.publicMethods.indexOf(fn) !== -1) { + ret = chart[fn](...opts) + } + return ret + } + + static merge(target, source) { + return Utils.extend(target, source) + } + + toggleSeries(seriesName) { + return this.series.toggleSeries(seriesName) + } + + highlightSeriesOnLegendHover(e, targetElement) { + return this.series.toggleSeriesOnHover(e, targetElement) + } + + showSeries(seriesName) { + this.series.showSeries(seriesName) + } + + hideSeries(seriesName) { + this.series.hideSeries(seriesName) + } + + highlightSeries(seriesName) { + this.series.highlightSeries(seriesName) + } + + isSeriesHidden(seriesName) { + this.series.isSeriesHidden(seriesName) + } + + resetSeries(shouldUpdateChart = true, shouldResetZoom = true) { + this.series.resetSeries(shouldUpdateChart, shouldResetZoom) + } + + // Public method to add event listener on chart context + addEventListener(name, handler) { + this.events.addEventListener(name, handler) + } + + // Public method to remove event listener on chart context + removeEventListener(name, handler) { + this.events.removeEventListener(name, handler) + } + + addXaxisAnnotation(opts, pushToMemory = true, context = undefined) { + let me = this + if (context) { + me = context + } + me.annotations.addXaxisAnnotationExternal(opts, pushToMemory, me) + } + + addYaxisAnnotation(opts, pushToMemory = true, context = undefined) { + let me = this + if (context) { + me = context + } + me.annotations.addYaxisAnnotationExternal(opts, pushToMemory, me) + } + + addPointAnnotation(opts, pushToMemory = true, context = undefined) { + let me = this + if (context) { + me = context + } + me.annotations.addPointAnnotationExternal(opts, pushToMemory, me) + } + + clearAnnotations(context = undefined) { + let me = this + if (context) { + me = context + } + me.annotations.clearAnnotations(me) + } + + removeAnnotation(id, context = undefined) { + let me = this + if (context) { + me = context + } + me.annotations.removeAnnotation(me, id) + } + + getChartArea() { + const el = this.w.globals.dom.baseEl.querySelector('.apexcharts-inner') + + return el + } + + getSeriesTotalXRange(minX, maxX) { + return this.coreUtils.getSeriesTotalsXRange(minX, maxX) + } + + getHighestValueInSeries(seriesIndex = 0) { + const range = new Range(this.ctx) + return range.getMinYMaxY(seriesIndex).highestY + } + + getLowestValueInSeries(seriesIndex = 0) { + const range = new Range(this.ctx) + return range.getMinYMaxY(seriesIndex).lowestY + } + + getSeriesTotal() { + return this.w.globals.seriesTotals + } + + toggleDataPointSelection(seriesIndex, dataPointIndex) { + return this.updateHelpers.toggleDataPointSelection( + seriesIndex, + dataPointIndex + ) + } + + zoomX(min, max) { + this.ctx.toolbar.zoomUpdateOptions(min, max) + } + + setLocale(localeName) { + this.localization.setCurrentLocaleValues(localeName) + } + + dataURI(options) { + const exp = new Exports(this.ctx) + return exp.dataURI(options) + } + + getSvgString(scale) { + return new Exports(this.ctx).getSvgString(scale) + } + + exportToCSV(options = {}) { + const exp = new Exports(this.ctx) + return exp.exportToCSV(options) + } + + paper() { + return this.w.globals.dom.Paper + } + + _parentResizeCallback() { + if ( + this.w.globals.animationEnded && + this.w.config.chart.redrawOnParentResize + ) { + this._windowResize() + } + } + + /** + * Handle window resize and re-draw the whole chart. + */ + _windowResize() { + clearTimeout(this.w.globals.resizeTimer) + this.w.globals.resizeTimer = window.setTimeout(() => { + this.w.globals.resized = true + this.w.globals.dataChanged = false + + // we need to redraw the whole chart on window resize (with a small delay). + this.ctx.update() + }, 150) + } + + _windowResizeHandler() { + let { redrawOnWindowResize: redraw } = this.w.config.chart + + if (typeof redraw === 'function') { + redraw = redraw() + } + + redraw && this._windowResize() + } +} diff --git a/node_modules/apexcharts/src/assets/apexcharts.css b/node_modules/apexcharts/src/assets/apexcharts.css new file mode 100644 index 0000000..636390b --- /dev/null +++ b/node_modules/apexcharts/src/assets/apexcharts.css @@ -0,0 +1,746 @@ +@keyframes opaque { + 0% { + opacity: 0 + } + + to { + opacity: 1 + } +} + +@keyframes resizeanim { + + 0%, + to { + opacity: 0 + } +} + +.apexcharts-canvas { + position: relative; + direction: ltr !important; + user-select: none +} + +.apexcharts-canvas ::-webkit-scrollbar { + -webkit-appearance: none; + width: 6px +} + +.apexcharts-canvas ::-webkit-scrollbar-thumb { + border-radius: 4px; + background-color: rgba(0, 0, 0, .5); + box-shadow: 0 0 1px rgba(255, 255, 255, .5); + -webkit-box-shadow: 0 0 1px rgba(255, 255, 255, .5) +} + +.apexcharts-inner { + position: relative +} + +.apexcharts-text tspan { + font-family: inherit +} + +rect.legend-mouseover-inactive, +.legend-mouseover-inactive rect, +.legend-mouseover-inactive path, +.legend-mouseover-inactive circle, +.legend-mouseover-inactive line, +.legend-mouseover-inactive text.apexcharts-yaxis-title-text, +.legend-mouseover-inactive text.apexcharts-yaxis-label { + transition: .15s ease all; + opacity: .2 +} + +.apexcharts-legend-text { + padding-left: 15px; + margin-left: -15px; +} + +.apexcharts-series-collapsed { + opacity: 0 +} + +.apexcharts-tooltip { + border-radius: 5px; + box-shadow: 2px 2px 6px -4px #999; + cursor: default; + font-size: 14px; + left: 62px; + opacity: 0; + pointer-events: none; + position: absolute; + top: 20px; + display: flex; + flex-direction: column; + overflow: hidden; + white-space: nowrap; + z-index: 12; + transition: .15s ease all +} + +.apexcharts-tooltip.apexcharts-active { + opacity: 1; + transition: .15s ease all +} + +.apexcharts-tooltip.apexcharts-theme-light { + border: 1px solid #e3e3e3; + background: rgba(255, 255, 255, .96) +} + +.apexcharts-tooltip.apexcharts-theme-dark { + color: #fff; + background: rgba(30, 30, 30, .8) +} + +.apexcharts-tooltip * { + font-family: inherit +} + +.apexcharts-tooltip-title { + padding: 6px; + font-size: 15px; + margin-bottom: 4px +} + +.apexcharts-tooltip.apexcharts-theme-light .apexcharts-tooltip-title { + background: #eceff1; + border-bottom: 1px solid #ddd +} + +.apexcharts-tooltip.apexcharts-theme-dark .apexcharts-tooltip-title { + background: rgba(0, 0, 0, .7); + border-bottom: 1px solid #333 +} + +.apexcharts-tooltip-text-goals-value, +.apexcharts-tooltip-text-y-value, +.apexcharts-tooltip-text-z-value { + display: inline-block; + margin-left: 5px; + font-weight: 600 +} + +.apexcharts-tooltip-text-goals-label:empty, +.apexcharts-tooltip-text-goals-value:empty, +.apexcharts-tooltip-text-y-label:empty, +.apexcharts-tooltip-text-y-value:empty, +.apexcharts-tooltip-text-z-value:empty, +.apexcharts-tooltip-title:empty { + display: none +} + +.apexcharts-tooltip-text-goals-label, +.apexcharts-tooltip-text-goals-value { + padding: 6px 0 5px +} + +.apexcharts-tooltip-goals-group, +.apexcharts-tooltip-text-goals-label, +.apexcharts-tooltip-text-goals-value { + display: flex +} + +.apexcharts-tooltip-text-goals-label:not(:empty), +.apexcharts-tooltip-text-goals-value:not(:empty) { + margin-top: -6px +} + +.apexcharts-tooltip-marker { + display: inline-block; + position: relative; + width: 16px; + height: 16px; + font-size: 16px; + line-height: 16px; + margin-right: 4px; + text-align: center; + vertical-align: middle; + color: inherit; +} + +.apexcharts-tooltip-marker::before { + content: ""; + display: inline-block; + width: 100%; + text-align: center; + color: currentcolor; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + font-size: 26px; + font-family: Arial, Helvetica, sans-serif; + line-height: 14px; + font-weight: 900; +} + +.apexcharts-tooltip-marker[shape="circle"]::before { + content: "\25CF"; +} + +.apexcharts-tooltip-marker[shape="square"]::before, +.apexcharts-tooltip-marker[shape="rect"]::before { + content: "\25A0"; + transform: translate(-1px, -2px); +} + +.apexcharts-tooltip-marker[shape="line"]::before { + content: "\2500"; +} + +.apexcharts-tooltip-marker[shape="diamond"]::before { + content: "\25C6"; + font-size: 28px; +} + +.apexcharts-tooltip-marker[shape="triangle"]::before { + content: "\25B2"; + font-size: 22px; +} + +.apexcharts-tooltip-marker[shape="cross"]::before { + content: "\2715"; + font-size: 18px; +} + +.apexcharts-tooltip-marker[shape="plus"]::before { + content: "\2715"; + transform: rotate(45deg) translate(-1px, -1px); + font-size: 18px; +} + +.apexcharts-tooltip-marker[shape="star"]::before { + content: "\2605"; + font-size: 18px; +} + +.apexcharts-tooltip-marker[shape="sparkle"]::before { + content: "\2726"; + font-size: 20px; +} + +.apexcharts-tooltip-series-group { + padding: 0 10px; + display: none; + text-align: left; + justify-content: left; + align-items: center +} + +.apexcharts-tooltip-series-group.apexcharts-active .apexcharts-tooltip-marker { + opacity: 1 +} + +.apexcharts-tooltip-series-group.apexcharts-active, +.apexcharts-tooltip-series-group:last-child { + padding-bottom: 4px +} + +.apexcharts-tooltip-y-group { + padding: 6px 0 5px +} + +.apexcharts-custom-tooltip, +.apexcharts-tooltip-box { + padding: 4px 8px +} + +.apexcharts-tooltip-boxPlot { + display: flex; + flex-direction: column-reverse +} + +.apexcharts-tooltip-box>div { + margin: 4px 0 +} + +.apexcharts-tooltip-box span.value { + font-weight: 700 +} + +.apexcharts-tooltip-rangebar { + padding: 5px 8px +} + +.apexcharts-tooltip-rangebar .category { + font-weight: 600; + color: #777 +} + +.apexcharts-tooltip-rangebar .series-name { + font-weight: 700; + display: block; + margin-bottom: 5px +} + +.apexcharts-xaxistooltip, +.apexcharts-yaxistooltip { + opacity: 0; + pointer-events: none; + color: #373d3f; + font-size: 13px; + text-align: center; + border-radius: 2px; + position: absolute; + z-index: 10; + background: #eceff1; + border: 1px solid #90a4ae +} + +.apexcharts-xaxistooltip { + padding: 9px 10px; + transition: .15s ease all +} + +.apexcharts-xaxistooltip.apexcharts-theme-dark { + background: rgba(0, 0, 0, .7); + border: 1px solid rgba(0, 0, 0, .5); + color: #fff +} + +.apexcharts-xaxistooltip:after, +.apexcharts-xaxistooltip:before { + left: 50%; + border: solid transparent; + content: " "; + height: 0; + width: 0; + position: absolute; + pointer-events: none +} + +.apexcharts-xaxistooltip:after { + border-color: transparent; + border-width: 6px; + margin-left: -6px +} + +.apexcharts-xaxistooltip:before { + border-color: transparent; + border-width: 7px; + margin-left: -7px +} + +.apexcharts-xaxistooltip-bottom:after, +.apexcharts-xaxistooltip-bottom:before { + bottom: 100% +} + +.apexcharts-xaxistooltip-top:after, +.apexcharts-xaxistooltip-top:before { + top: 100% +} + +.apexcharts-xaxistooltip-bottom:after { + border-bottom-color: #eceff1 +} + +.apexcharts-xaxistooltip-bottom:before { + border-bottom-color: #90a4ae +} + +.apexcharts-xaxistooltip-bottom.apexcharts-theme-dark:after, +.apexcharts-xaxistooltip-bottom.apexcharts-theme-dark:before { + border-bottom-color: rgba(0, 0, 0, .5) +} + +.apexcharts-xaxistooltip-top:after { + border-top-color: #eceff1 +} + +.apexcharts-xaxistooltip-top:before { + border-top-color: #90a4ae +} + +.apexcharts-xaxistooltip-top.apexcharts-theme-dark:after, +.apexcharts-xaxistooltip-top.apexcharts-theme-dark:before { + border-top-color: rgba(0, 0, 0, .5) +} + +.apexcharts-xaxistooltip.apexcharts-active { + opacity: 1; + transition: .15s ease all +} + +.apexcharts-yaxistooltip { + padding: 4px 10px +} + +.apexcharts-yaxistooltip.apexcharts-theme-dark { + background: rgba(0, 0, 0, .7); + border: 1px solid rgba(0, 0, 0, .5); + color: #fff +} + +.apexcharts-yaxistooltip:after, +.apexcharts-yaxistooltip:before { + top: 50%; + border: solid transparent; + content: " "; + height: 0; + width: 0; + position: absolute; + pointer-events: none +} + +.apexcharts-yaxistooltip:after { + border-color: transparent; + border-width: 6px; + margin-top: -6px +} + +.apexcharts-yaxistooltip:before { + border-color: transparent; + border-width: 7px; + margin-top: -7px +} + +.apexcharts-yaxistooltip-left:after, +.apexcharts-yaxistooltip-left:before { + left: 100% +} + +.apexcharts-yaxistooltip-right:after, +.apexcharts-yaxistooltip-right:before { + right: 100% +} + +.apexcharts-yaxistooltip-left:after { + border-left-color: #eceff1 +} + +.apexcharts-yaxistooltip-left:before { + border-left-color: #90a4ae +} + +.apexcharts-yaxistooltip-left.apexcharts-theme-dark:after, +.apexcharts-yaxistooltip-left.apexcharts-theme-dark:before { + border-left-color: rgba(0, 0, 0, .5) +} + +.apexcharts-yaxistooltip-right:after { + border-right-color: #eceff1 +} + +.apexcharts-yaxistooltip-right:before { + border-right-color: #90a4ae +} + +.apexcharts-yaxistooltip-right.apexcharts-theme-dark:after, +.apexcharts-yaxistooltip-right.apexcharts-theme-dark:before { + border-right-color: rgba(0, 0, 0, .5) +} + +.apexcharts-yaxistooltip.apexcharts-active { + opacity: 1 +} + +.apexcharts-yaxistooltip-hidden { + display: none +} + +.apexcharts-xcrosshairs, +.apexcharts-ycrosshairs { + pointer-events: none; + opacity: 0; + transition: .15s ease all +} + +.apexcharts-xcrosshairs.apexcharts-active, +.apexcharts-ycrosshairs.apexcharts-active { + opacity: 1; + transition: .15s ease all +} + +.apexcharts-ycrosshairs-hidden { + opacity: 0 +} + +.apexcharts-selection-rect { + cursor: move +} + +.svg_select_shape { + stroke-width: 1; + stroke-dasharray: 10 10; + stroke: black; + stroke-opacity: 0.1; + pointer-events: none; + fill: none; +} + +.svg_select_handle { + stroke-width: 3; + stroke: black; + fill: none; +} + +.svg_select_handle_r { + cursor: e-resize; +} + +.svg_select_handle_l { + cursor: w-resize; +} + +.apexcharts-svg.apexcharts-zoomable.hovering-zoom { + cursor: crosshair +} + +.apexcharts-svg.apexcharts-zoomable.hovering-pan { + cursor: move +} + +.apexcharts-menu-icon, +.apexcharts-pan-icon, +.apexcharts-reset-icon, +.apexcharts-selection-icon, +.apexcharts-toolbar-custom-icon, +.apexcharts-zoom-icon, +.apexcharts-zoomin-icon, +.apexcharts-zoomout-icon { + cursor: pointer; + width: 20px; + height: 20px; + line-height: 24px; + color: #6e8192; + text-align: center +} + +.apexcharts-menu-icon svg, +.apexcharts-reset-icon svg, +.apexcharts-zoom-icon svg, +.apexcharts-zoomin-icon svg, +.apexcharts-zoomout-icon svg { + fill: #6e8192 +} + +.apexcharts-selection-icon svg { + fill: #444; + transform: scale(.76) +} + +.apexcharts-theme-dark .apexcharts-menu-icon svg, +.apexcharts-theme-dark .apexcharts-pan-icon svg, +.apexcharts-theme-dark .apexcharts-reset-icon svg, +.apexcharts-theme-dark .apexcharts-selection-icon svg, +.apexcharts-theme-dark .apexcharts-toolbar-custom-icon svg, +.apexcharts-theme-dark .apexcharts-zoom-icon svg, +.apexcharts-theme-dark .apexcharts-zoomin-icon svg, +.apexcharts-theme-dark .apexcharts-zoomout-icon svg { + fill: #f3f4f5 +} + +.apexcharts-canvas .apexcharts-reset-zoom-icon.apexcharts-selected svg, +.apexcharts-canvas .apexcharts-selection-icon.apexcharts-selected svg, +.apexcharts-canvas .apexcharts-zoom-icon.apexcharts-selected svg { + fill: #008ffb +} + +.apexcharts-theme-light .apexcharts-menu-icon:hover svg, +.apexcharts-theme-light .apexcharts-reset-icon:hover svg, +.apexcharts-theme-light .apexcharts-selection-icon:not(.apexcharts-selected):hover svg, +.apexcharts-theme-light .apexcharts-zoom-icon:not(.apexcharts-selected):hover svg, +.apexcharts-theme-light .apexcharts-zoomin-icon:hover svg, +.apexcharts-theme-light .apexcharts-zoomout-icon:hover svg { + fill: #333 +} + +.apexcharts-menu-icon, +.apexcharts-selection-icon { + position: relative +} + +.apexcharts-reset-icon { + margin-left: 5px +} + +.apexcharts-menu-icon, +.apexcharts-reset-icon, +.apexcharts-zoom-icon { + transform: scale(.85) +} + +.apexcharts-zoomin-icon, +.apexcharts-zoomout-icon { + transform: scale(.7) +} + +.apexcharts-zoomout-icon { + margin-right: 3px +} + +.apexcharts-pan-icon { + transform: scale(.62); + position: relative; + left: 1px; + top: 0 +} + +.apexcharts-pan-icon svg { + fill: #fff; + stroke: #6e8192; + stroke-width: 2 +} + +.apexcharts-pan-icon.apexcharts-selected svg { + stroke: #008ffb +} + +.apexcharts-pan-icon:not(.apexcharts-selected):hover svg { + stroke: #333 +} + +.apexcharts-toolbar { + position: absolute; + z-index: 11; + max-width: 176px; + text-align: right; + border-radius: 3px; + padding: 0 6px 2px; + display: flex; + justify-content: space-between; + align-items: center +} + +.apexcharts-menu { + background: #fff; + position: absolute; + top: 100%; + border: 1px solid #ddd; + border-radius: 3px; + padding: 3px; + right: 10px; + opacity: 0; + min-width: 110px; + transition: .15s ease all; + pointer-events: none +} + +.apexcharts-menu.apexcharts-menu-open { + opacity: 1; + pointer-events: all; + transition: .15s ease all +} + +.apexcharts-menu-item { + padding: 6px 7px; + font-size: 12px; + cursor: pointer +} + +.apexcharts-theme-light .apexcharts-menu-item:hover { + background: #eee +} + +.apexcharts-theme-dark .apexcharts-menu { + background: rgba(0, 0, 0, .7); + color: #fff +} + +@media screen and (min-width:768px) { + .apexcharts-canvas:hover .apexcharts-toolbar { + opacity: 1 + } +} + +.apexcharts-canvas .apexcharts-element-hidden, +.apexcharts-datalabel.apexcharts-element-hidden, +.apexcharts-hide .apexcharts-series-points { + opacity: 0; +} + +.apexcharts-hidden-element-shown { + opacity: 1; + transition: 0.25s ease all; +} + +.apexcharts-datalabel, +.apexcharts-datalabel-label, +.apexcharts-datalabel-value, +.apexcharts-datalabels, +.apexcharts-pie-label { + cursor: default; + pointer-events: none +} + +.apexcharts-pie-label-delay { + opacity: 0; + animation-name: opaque; + animation-duration: .3s; + animation-fill-mode: forwards; + animation-timing-function: ease +} + +.apexcharts-radialbar-label { + cursor: pointer; +} + +.apexcharts-annotation-rect, +.apexcharts-area-series .apexcharts-area, +.apexcharts-gridline, +.apexcharts-line, +.apexcharts-point-annotation-label, +.apexcharts-radar-series path:not(.apexcharts-marker), +.apexcharts-radar-series polygon, +.apexcharts-toolbar svg, +.apexcharts-tooltip .apexcharts-marker, +.apexcharts-xaxis-annotation-label, +.apexcharts-yaxis-annotation-label, +.apexcharts-zoom-rect, +.no-pointer-events { + pointer-events: none +} + +.apexcharts-tooltip-active .apexcharts-marker { + transition: .15s ease all +} + +.apexcharts-radar-series .apexcharts-yaxis { + pointer-events: none; +} + +.resize-triggers { + animation: 1ms resizeanim; + visibility: hidden; + opacity: 0; + height: 100%; + width: 100%; + overflow: hidden +} + +.contract-trigger:before, +.resize-triggers, +.resize-triggers>div { + content: " "; + display: block; + position: absolute; + top: 0; + left: 0 +} + +.resize-triggers>div { + height: 100%; + width: 100%; + background: #eee; + overflow: auto +} + +.contract-trigger:before { + overflow: hidden; + width: 200%; + height: 200% +} + +.apexcharts-bar-goals-markers { + pointer-events: none +} + +.apexcharts-bar-shadows { + pointer-events: none +} + +.apexcharts-rangebar-goals-markers { + pointer-events: none +} \ No newline at end of file diff --git a/node_modules/apexcharts/src/assets/ico-camera.svg b/node_modules/apexcharts/src/assets/ico-camera.svg new file mode 100644 index 0000000..3f052f2 --- /dev/null +++ b/node_modules/apexcharts/src/assets/ico-camera.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/node_modules/apexcharts/src/assets/ico-home.svg b/node_modules/apexcharts/src/assets/ico-home.svg new file mode 100644 index 0000000..676d2d3 --- /dev/null +++ b/node_modules/apexcharts/src/assets/ico-home.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/node_modules/apexcharts/src/assets/ico-menu.svg b/node_modules/apexcharts/src/assets/ico-menu.svg new file mode 100644 index 0000000..770b192 --- /dev/null +++ b/node_modules/apexcharts/src/assets/ico-menu.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/node_modules/apexcharts/src/assets/ico-minus-square.svg b/node_modules/apexcharts/src/assets/ico-minus-square.svg new file mode 100644 index 0000000..c4988e8 --- /dev/null +++ b/node_modules/apexcharts/src/assets/ico-minus-square.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/node_modules/apexcharts/src/assets/ico-minus.svg b/node_modules/apexcharts/src/assets/ico-minus.svg new file mode 100644 index 0000000..f0a7ec8 --- /dev/null +++ b/node_modules/apexcharts/src/assets/ico-minus.svg @@ -0,0 +1,4 @@ + + + + diff --git a/node_modules/apexcharts/src/assets/ico-pan-hand.svg b/node_modules/apexcharts/src/assets/ico-pan-hand.svg new file mode 100644 index 0000000..1768e5e --- /dev/null +++ b/node_modules/apexcharts/src/assets/ico-pan-hand.svg @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/node_modules/apexcharts/src/assets/ico-pan.svg b/node_modules/apexcharts/src/assets/ico-pan.svg new file mode 100644 index 0000000..ae65a94 --- /dev/null +++ b/node_modules/apexcharts/src/assets/ico-pan.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/node_modules/apexcharts/src/assets/ico-plus-square.svg b/node_modules/apexcharts/src/assets/ico-plus-square.svg new file mode 100644 index 0000000..f1b885f --- /dev/null +++ b/node_modules/apexcharts/src/assets/ico-plus-square.svg @@ -0,0 +1,4 @@ + + + + diff --git a/node_modules/apexcharts/src/assets/ico-plus.svg b/node_modules/apexcharts/src/assets/ico-plus.svg new file mode 100644 index 0000000..b376ab5 --- /dev/null +++ b/node_modules/apexcharts/src/assets/ico-plus.svg @@ -0,0 +1,4 @@ + + + + diff --git a/node_modules/apexcharts/src/assets/ico-refresh.svg b/node_modules/apexcharts/src/assets/ico-refresh.svg new file mode 100644 index 0000000..81c46c6 --- /dev/null +++ b/node_modules/apexcharts/src/assets/ico-refresh.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/node_modules/apexcharts/src/assets/ico-reset.svg b/node_modules/apexcharts/src/assets/ico-reset.svg new file mode 100644 index 0000000..2ee1dc3 --- /dev/null +++ b/node_modules/apexcharts/src/assets/ico-reset.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/node_modules/apexcharts/src/assets/ico-select.svg b/node_modules/apexcharts/src/assets/ico-select.svg new file mode 100644 index 0000000..326ab03 --- /dev/null +++ b/node_modules/apexcharts/src/assets/ico-select.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/node_modules/apexcharts/src/assets/ico-select1.svg b/node_modules/apexcharts/src/assets/ico-select1.svg new file mode 100644 index 0000000..529a226 --- /dev/null +++ b/node_modules/apexcharts/src/assets/ico-select1.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/node_modules/apexcharts/src/assets/ico-zoom-in.svg b/node_modules/apexcharts/src/assets/ico-zoom-in.svg new file mode 100644 index 0000000..3d9355a --- /dev/null +++ b/node_modules/apexcharts/src/assets/ico-zoom-in.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/node_modules/apexcharts/src/assets/ico-zoom-out.svg b/node_modules/apexcharts/src/assets/ico-zoom-out.svg new file mode 100644 index 0000000..74310b6 --- /dev/null +++ b/node_modules/apexcharts/src/assets/ico-zoom-out.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/node_modules/apexcharts/src/assets/ico-zoom.svg b/node_modules/apexcharts/src/assets/ico-zoom.svg new file mode 100644 index 0000000..346fdb4 --- /dev/null +++ b/node_modules/apexcharts/src/assets/ico-zoom.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/node_modules/apexcharts/src/charts/Bar.js b/node_modules/apexcharts/src/charts/Bar.js new file mode 100644 index 0000000..f2a6b42 --- /dev/null +++ b/node_modules/apexcharts/src/charts/Bar.js @@ -0,0 +1,670 @@ +import BarDataLabels from './common/bar/DataLabels' +import BarHelpers from './common/bar/Helpers' +import CoreUtils from '../modules/CoreUtils' +import Utils from '../utils/Utils' +import Filters from '../modules/Filters' +import Graphics from '../modules/Graphics' +import Series from '../modules/Series' + +/** + * ApexCharts Bar Class responsible for drawing both Columns and Bars. + * + * @module Bar + **/ + +class Bar { + constructor(ctx, xyRatios) { + this.ctx = ctx + this.w = ctx.w + const w = this.w + this.barOptions = w.config.plotOptions.bar + + this.isHorizontal = this.barOptions.horizontal + this.strokeWidth = w.config.stroke.width + this.isNullValue = false + + this.isRangeBar = w.globals.seriesRange.length && this.isHorizontal + + this.isVerticalGroupedRangeBar = + !w.globals.isBarHorizontal && + w.globals.seriesRange.length && + w.config.plotOptions.bar.rangeBarGroupRows + + this.isFunnel = this.barOptions.isFunnel + this.xyRatios = xyRatios + + if (this.xyRatios !== null) { + this.xRatio = xyRatios.xRatio + this.yRatio = xyRatios.yRatio + this.invertedXRatio = xyRatios.invertedXRatio + this.invertedYRatio = xyRatios.invertedYRatio + this.baseLineY = xyRatios.baseLineY + this.baseLineInvertedY = xyRatios.baseLineInvertedY + } + this.yaxisIndex = 0 + this.translationsIndex = 0 + this.seriesLen = 0 + this.pathArr = [] + + const ser = new Series(this.ctx) + this.lastActiveBarSerieIndex = ser.getActiveConfigSeriesIndex('desc', [ + 'bar', + 'column', + ]) + + this.columnGroupIndices = [] + const barSeriesIndices = ser.getBarSeriesIndices() + const coreUtils = new CoreUtils(this.ctx) + this.stackedSeriesTotals = coreUtils.getStackedSeriesTotals( + this.w.config.series + .map((s, i) => { + return barSeriesIndices.indexOf(i) === -1 ? i : -1 + }) + .filter((s) => { + return s !== -1 + }) + ) + + this.barHelpers = new BarHelpers(this) + } + + /** primary draw method which is called on bar object + * @memberof Bar + * @param {array} series - user supplied series values + * @param {int} seriesIndex - the index by which series will be drawn on the svg + * @return {node} element which is supplied to parent chart draw method for appending + **/ + draw(series, seriesIndex) { + let w = this.w + let graphics = new Graphics(this.ctx) + + const coreUtils = new CoreUtils(this.ctx, w) + series = coreUtils.getLogSeries(series) + this.series = series + this.yRatio = coreUtils.getLogYRatios(this.yRatio) + + this.barHelpers.initVariables(series) + + let ret = graphics.group({ + class: 'apexcharts-bar-series apexcharts-plot-series', + }) + + if (w.config.dataLabels.enabled) { + if (this.totalItems > this.barOptions.dataLabels.maxItems) { + console.warn( + 'WARNING: DataLabels are enabled but there are too many to display. This may cause performance issue when rendering - ApexCharts' + ) + } + } + + for (let i = 0, bc = 0; i < series.length; i++, bc++) { + let x, + y, + xDivision, // xDivision is the GRIDWIDTH divided by number of datapoints (columns) + yDivision, // yDivision is the GRIDHEIGHT divided by number of datapoints (bars) + zeroH, // zeroH is the baseline where 0 meets y axis + zeroW // zeroW is the baseline where 0 meets x axis + + let yArrj = [] // hold y values of current iterating series + let xArrj = [] // hold x values of current iterating series + + let realIndex = w.globals.comboCharts ? seriesIndex[i] : i + + let { columnGroupIndex } = this.barHelpers.getGroupIndex(realIndex) + + // el to which series will be drawn + let elSeries = graphics.group({ + class: `apexcharts-series`, + rel: i + 1, + seriesName: Utils.escapeString(w.globals.seriesNames[realIndex]), + 'data:realIndex': realIndex, + }) + + this.ctx.series.addCollapsedClassToSeries(elSeries, realIndex) + + if (series[i].length > 0) { + this.visibleI = this.visibleI + 1 + } + + let barHeight = 0 + let barWidth = 0 + + if (this.yRatio.length > 1) { + this.yaxisIndex = w.globals.seriesYAxisReverseMap[realIndex] + this.translationsIndex = realIndex + } + let translationsIndex = this.translationsIndex + + this.isReversed = + w.config.yaxis[this.yaxisIndex] && + w.config.yaxis[this.yaxisIndex].reversed + + let initPositions = this.barHelpers.initialPositions(realIndex) + + y = initPositions.y + barHeight = initPositions.barHeight + yDivision = initPositions.yDivision + zeroW = initPositions.zeroW + + x = initPositions.x + barWidth = initPositions.barWidth + xDivision = initPositions.xDivision + zeroH = initPositions.zeroH + + if (!this.isHorizontal) { + xArrj.push(x + barWidth / 2) + } + + // eldatalabels + let elDataLabelsWrap = graphics.group({ + class: 'apexcharts-datalabels', + 'data:realIndex': realIndex, + }) + + w.globals.delayedElements.push({ + el: elDataLabelsWrap.node, + }) + elDataLabelsWrap.node.classList.add('apexcharts-element-hidden') + + let elGoalsMarkers = graphics.group({ + class: 'apexcharts-bar-goals-markers', + }) + + let elBarShadows = graphics.group({ + class: 'apexcharts-bar-shadows', + }) + + w.globals.delayedElements.push({ + el: elBarShadows.node, + }) + elBarShadows.node.classList.add('apexcharts-element-hidden') + + for (let j = 0; j < series[i].length; j++) { + const strokeWidth = this.barHelpers.getStrokeWidth(i, j, realIndex) + + let paths = null + const pathsParams = { + indexes: { + i, + j, + realIndex, + translationsIndex, + bc, + }, + x, + y, + strokeWidth, + elSeries, + } + if (this.isHorizontal) { + paths = this.drawBarPaths({ + ...pathsParams, + barHeight, + zeroW, + yDivision, + }) + barWidth = this.series[i][j] / this.invertedYRatio + } else { + paths = this.drawColumnPaths({ + ...pathsParams, + xDivision, + barWidth, + zeroH, + }) + barHeight = this.series[i][j] / this.yRatio[translationsIndex] + } + + let pathFill = this.barHelpers.getPathFillColor(series, i, j, realIndex) + + if ( + this.isFunnel && + this.barOptions.isFunnel3d && + this.pathArr.length && + j > 0 + ) { + const barShadow = this.barHelpers.drawBarShadow({ + color: + typeof pathFill.color === 'string' && + pathFill.color?.indexOf('url') === -1 + ? pathFill.color + : Utils.hexToRgba(w.globals.colors[i]), + prevPaths: this.pathArr[this.pathArr.length - 1], + currPaths: paths, + }) + + elBarShadows.add(barShadow) + + if (w.config.chart.dropShadow.enabled) { + const filters = new Filters(this.ctx) + filters.dropShadow(barShadow, w.config.chart.dropShadow, realIndex) + } + } + this.pathArr.push(paths) + + const barGoalLine = this.barHelpers.drawGoalLine({ + barXPosition: paths.barXPosition, + barYPosition: paths.barYPosition, + goalX: paths.goalX, + goalY: paths.goalY, + barHeight, + barWidth, + }) + + if (barGoalLine) { + elGoalsMarkers.add(barGoalLine) + } + + y = paths.y + x = paths.x + + // push current X + if (j > 0) { + xArrj.push(x + barWidth / 2) + } + + yArrj.push(y) + + this.renderSeries({ + realIndex, + pathFill: pathFill.color, + ...(pathFill.useRangeColor ? { lineFill: pathFill.color } : {}), + j, + i, + columnGroupIndex, + pathFrom: paths.pathFrom, + pathTo: paths.pathTo, + strokeWidth, + elSeries, + x, + y, + series, + barHeight: Math.abs(paths.barHeight ? paths.barHeight : barHeight), + barWidth: Math.abs(paths.barWidth ? paths.barWidth : barWidth), + elDataLabelsWrap, + elGoalsMarkers, + elBarShadows, + visibleSeries: this.visibleI, + type: 'bar', + }) + } + + // push all x val arrays into main xArr + w.globals.seriesXvalues[realIndex] = xArrj + w.globals.seriesYvalues[realIndex] = yArrj + + ret.add(elSeries) + } + + return ret + } + + renderSeries({ + realIndex, + pathFill, + lineFill, + j, + i, + columnGroupIndex, + pathFrom, + pathTo, + strokeWidth, + elSeries, + x, // x pos + y, // y pos + y1, // absolute value + y2, // absolute value + series, + barHeight, + barWidth, + barXPosition, + barYPosition, + elDataLabelsWrap, + elGoalsMarkers, + elBarShadows, + visibleSeries, + type, + classes, + }) { + const w = this.w + const graphics = new Graphics(this.ctx) + + if (!lineFill) { + // if user provided a function in colors, we need to eval here + // Note: the position of this function logic (ex. stroke: { colors: ["",function(){}] }) i.e array index 1 depicts the realIndex/seriesIndex. + function fetchColor(i) { + const exp = w.config.stroke.colors + let c + if (Array.isArray(exp) && exp.length > 0) { + c = exp[i] + if (!c) c = '' + if (typeof c === 'function') { + return c({ + value: w.globals.series[i][j], + dataPointIndex: j, + w, + }) + } + } + return c + } + + const checkAvailableColor = + typeof w.globals.stroke.colors[realIndex] === 'function' + ? fetchColor(realIndex) + : w.globals.stroke.colors[realIndex] + + /* fix apexcharts#341 */ + lineFill = this.barOptions.distributed + ? w.globals.stroke.colors[j] + : checkAvailableColor + } + + if (w.config.series[i].data[j] && w.config.series[i].data[j].strokeColor) { + lineFill = w.config.series[i].data[j].strokeColor + } + + if (this.isNullValue) { + pathFill = 'none' + } + + let delay = + ((j / w.config.chart.animations.animateGradually.delay) * + (w.config.chart.animations.speed / w.globals.dataPoints)) / + 2.4 + + let renderedPath = graphics.renderPaths({ + i, + j, + realIndex, + pathFrom, + pathTo, + stroke: lineFill, + strokeWidth, + strokeLineCap: w.config.stroke.lineCap, + fill: pathFill, + animationDelay: delay, + initialSpeed: w.config.chart.animations.speed, + dataChangeSpeed: w.config.chart.animations.dynamicAnimation.speed, + className: `apexcharts-${type}-area ${classes}`, + chartType: type, + }) + + renderedPath.attr('clip-path', `url(#gridRectBarMask${w.globals.cuid})`) + + const forecast = w.config.forecastDataPoints + if (forecast.count > 0) { + if (j >= w.globals.dataPoints - forecast.count) { + renderedPath.node.setAttribute('stroke-dasharray', forecast.dashArray) + renderedPath.node.setAttribute('stroke-width', forecast.strokeWidth) + renderedPath.node.setAttribute('fill-opacity', forecast.fillOpacity) + } + } + + if (typeof y1 !== 'undefined' && typeof y2 !== 'undefined') { + renderedPath.attr('data-range-y1', y1) + renderedPath.attr('data-range-y2', y2) + } + + const filters = new Filters(this.ctx) + filters.setSelectionFilter(renderedPath, realIndex, j) + elSeries.add(renderedPath) + + let barDataLabels = new BarDataLabels(this) + let dataLabelsObj = barDataLabels.handleBarDataLabels({ + x, + y, + y1, + y2, + i, + j, + series, + realIndex, + columnGroupIndex, + barHeight, + barWidth, + barXPosition, + barYPosition, + renderedPath, + visibleSeries, + }) + if (dataLabelsObj.dataLabels !== null) { + elDataLabelsWrap.add(dataLabelsObj.dataLabels) + } + + if (dataLabelsObj.totalDataLabels) { + elDataLabelsWrap.add(dataLabelsObj.totalDataLabels) + } + + elSeries.add(elDataLabelsWrap) + + if (elGoalsMarkers) { + elSeries.add(elGoalsMarkers) + } + + if (elBarShadows) { + elSeries.add(elBarShadows) + } + return elSeries + } + + drawBarPaths({ + indexes, + barHeight, + strokeWidth, + zeroW, + x, + y, + yDivision, + elSeries, + }) { + let w = this.w + + let i = indexes.i + let j = indexes.j + let barYPosition + + if (w.globals.isXNumeric) { + y = + (w.globals.seriesX[i][j] - w.globals.minX) / this.invertedXRatio - + barHeight + barYPosition = y + barHeight * this.visibleI + } else { + if (w.config.plotOptions.bar.hideZeroBarsWhenGrouped) { + const { nonZeroColumns, zeroEncounters } = + this.barHelpers.getZeroValueEncounters({ i, j }) + + if (nonZeroColumns > 0) { + barHeight = (this.seriesLen * barHeight) / nonZeroColumns + } + barYPosition = y + barHeight * this.visibleI + barYPosition -= barHeight * zeroEncounters + } else { + barYPosition = y + barHeight * this.visibleI + } + } + + if (this.isFunnel) { + zeroW = + zeroW - + (this.barHelpers.getXForValue(this.series[i][j], zeroW) - zeroW) / 2 + } + + x = this.barHelpers.getXForValue(this.series[i][j], zeroW) + + const paths = this.barHelpers.getBarpaths({ + barYPosition, + barHeight, + x1: zeroW, + x2: x, + strokeWidth, + isReversed: this.isReversed, + series: this.series, + realIndex: indexes.realIndex, + i, + j, + w, + }) + + if (!w.globals.isXNumeric) { + y = y + yDivision + } + + this.barHelpers.barBackground({ + j, + i, + y1: barYPosition - barHeight * this.visibleI, + y2: barHeight * this.seriesLen, + elSeries, + }) + + return { + pathTo: paths.pathTo, + pathFrom: paths.pathFrom, + x1: zeroW, + x, + y, + goalX: this.barHelpers.getGoalValues('x', zeroW, null, i, j), + barYPosition, + barHeight, + } + } + + drawColumnPaths({ + indexes, + x, + y, + xDivision, + barWidth, + zeroH, + strokeWidth, + elSeries, + }) { + let w = this.w + + let realIndex = indexes.realIndex + let translationsIndex = indexes.translationsIndex + let i = indexes.i + let j = indexes.j + let bc = indexes.bc + let barXPosition + + if (w.globals.isXNumeric) { + const xForNumericX = this.getBarXForNumericXAxis({ + x, + j, + realIndex, + barWidth, + }) + x = xForNumericX.x + barXPosition = xForNumericX.barXPosition + } else { + if (w.config.plotOptions.bar.hideZeroBarsWhenGrouped) { + const { nonZeroColumns, zeroEncounters } = + this.barHelpers.getZeroValueEncounters({ i, j }) + + if (nonZeroColumns > 0) { + barWidth = (this.seriesLen * barWidth) / nonZeroColumns + } + barXPosition = x + barWidth * this.visibleI + barXPosition -= barWidth * zeroEncounters + } else { + barXPosition = x + barWidth * this.visibleI + } + } + + y = this.barHelpers.getYForValue( + this.series[i][j], + zeroH, + translationsIndex + ) + + const paths = this.barHelpers.getColumnPaths({ + barXPosition, + barWidth, + y1: zeroH, + y2: y, + strokeWidth, + isReversed: this.isReversed, + series: this.series, + realIndex: realIndex, + i, + j, + w, + }) + + if (!w.globals.isXNumeric) { + x = x + xDivision + } + + this.barHelpers.barBackground({ + bc, + j, + i, + x1: barXPosition - strokeWidth / 2 - barWidth * this.visibleI, + x2: barWidth * this.seriesLen + strokeWidth / 2, + elSeries, + }) + + return { + pathTo: paths.pathTo, + pathFrom: paths.pathFrom, + x, + y, + goalY: this.barHelpers.getGoalValues( + 'y', + null, + zeroH, + i, + j, + translationsIndex + ), + barXPosition, + barWidth, + } + } + + getBarXForNumericXAxis({ x, barWidth, realIndex, j }) { + const w = this.w + let sxI = realIndex + if (!w.globals.seriesX[realIndex].length) { + sxI = w.globals.maxValsInArrayIndex + } + if (Utils.isNumber(w.globals.seriesX[sxI][j])) { + x = + (w.globals.seriesX[sxI][j] - w.globals.minX) / this.xRatio - + (barWidth * this.seriesLen) / 2 + } + + return { + barXPosition: x + barWidth * this.visibleI, + x, + } + } + + /** getPreviousPath is a common function for bars/columns which is used to get previous paths when data changes. + * @memberof Bar + * @param {int} realIndex - current iterating i + * @param {int} j - current iterating series's j index + * @return {string} pathFrom is the string which will be appended in animations + **/ + getPreviousPath(realIndex, j) { + let w = this.w + let pathFrom + for (let pp = 0; pp < w.globals.previousPaths.length; pp++) { + let gpp = w.globals.previousPaths[pp] + + if ( + gpp.paths && + gpp.paths.length > 0 && + parseInt(gpp.realIndex, 10) === parseInt(realIndex, 10) + ) { + if (typeof w.globals.previousPaths[pp].paths[j] !== 'undefined') { + pathFrom = w.globals.previousPaths[pp].paths[j].d + } + } + } + return pathFrom + } +} + +export default Bar diff --git a/node_modules/apexcharts/src/charts/BarStacked.js b/node_modules/apexcharts/src/charts/BarStacked.js new file mode 100644 index 0000000..64fc454 --- /dev/null +++ b/node_modules/apexcharts/src/charts/BarStacked.js @@ -0,0 +1,569 @@ +import CoreUtils from '../modules/CoreUtils' +import Bar from './Bar' +import Graphics from '../modules/Graphics' +import Utils from '../utils/Utils' + +/** + * ApexCharts BarStacked Class responsible for drawing both Stacked Columns and Bars. + * + * @module BarStacked + * The whole calculation for stacked bar/column is different from normal bar/column, + * hence it makes sense to derive a new class for it extending most of the props of Parent Bar + **/ + +class BarStacked extends Bar { + draw(series, seriesIndex) { + let w = this.w + this.graphics = new Graphics(this.ctx) + this.bar = new Bar(this.ctx, this.xyRatios) + + const coreUtils = new CoreUtils(this.ctx, w) + series = coreUtils.getLogSeries(series) + this.yRatio = coreUtils.getLogYRatios(this.yRatio) + + this.barHelpers.initVariables(series) + + if (w.config.chart.stackType === '100%') { + series = w.globals.comboCharts + ? seriesIndex.map((_) => w.globals.seriesPercent[_]) + : w.globals.seriesPercent.slice() + } + + this.series = series + this.barHelpers.initializeStackedPrevVars(this) + + let ret = this.graphics.group({ + class: 'apexcharts-bar-series apexcharts-plot-series', + }) + + let x = 0 + let y = 0 + + for (let i = 0, bc = 0; i < series.length; i++, bc++) { + let xDivision // xDivision is the GRIDWIDTH divided by number of datapoints (columns) + let yDivision // yDivision is the GRIDHEIGHT divided by number of datapoints (bars) + let zeroH // zeroH is the baseline where 0 meets y axis + let zeroW // zeroW is the baseline where 0 meets x axis + + let realIndex = w.globals.comboCharts ? seriesIndex[i] : i + let { groupIndex, columnGroupIndex } = + this.barHelpers.getGroupIndex(realIndex) + this.groupCtx = this[w.globals.seriesGroups[groupIndex]] + + let xArrValues = [] + let yArrValues = [] + + let translationsIndex = 0 + if (this.yRatio.length > 1) { + this.yaxisIndex = w.globals.seriesYAxisReverseMap[realIndex][0] + translationsIndex = realIndex + } + + this.isReversed = + w.config.yaxis[this.yaxisIndex] && + w.config.yaxis[this.yaxisIndex].reversed + + // el to which series will be drawn + let elSeries = this.graphics.group({ + class: `apexcharts-series`, + seriesName: Utils.escapeString(w.globals.seriesNames[realIndex]), + rel: i + 1, + 'data:realIndex': realIndex, + }) + this.ctx.series.addCollapsedClassToSeries(elSeries, realIndex) + + // eldatalabels + let elDataLabelsWrap = this.graphics.group({ + class: 'apexcharts-datalabels', + 'data:realIndex': realIndex, + }) + + let elGoalsMarkers = this.graphics.group({ + class: 'apexcharts-bar-goals-markers', + }) + + let barHeight = 0 + let barWidth = 0 + + let initPositions = this.initialPositions( + x, + y, + xDivision, + yDivision, + zeroH, + zeroW, + translationsIndex + ) + y = initPositions.y + barHeight = initPositions.barHeight + yDivision = initPositions.yDivision + zeroW = initPositions.zeroW + + x = initPositions.x + barWidth = initPositions.barWidth + xDivision = initPositions.xDivision + zeroH = initPositions.zeroH + + w.globals.barHeight = barHeight + w.globals.barWidth = barWidth + + this.barHelpers.initializeStackedXYVars(this) + + // where all stack bar disappear after collapsing the first series + if ( + this.groupCtx.prevY.length === 1 && + this.groupCtx.prevY[0].every((val) => isNaN(val)) + ) { + this.groupCtx.prevY[0] = this.groupCtx.prevY[0].map(() => zeroH) + this.groupCtx.prevYF[0] = this.groupCtx.prevYF[0].map(() => 0) + } + + for (let j = 0; j < w.globals.dataPoints; j++) { + const strokeWidth = this.barHelpers.getStrokeWidth(i, j, realIndex) + const commonPathOpts = { + indexes: { i, j, realIndex, translationsIndex, bc }, + strokeWidth, + x, + y, + elSeries, + columnGroupIndex, + seriesGroup: w.globals.seriesGroups[groupIndex], + } + let paths = null + if (this.isHorizontal) { + paths = this.drawStackedBarPaths({ + ...commonPathOpts, + zeroW, + barHeight, + yDivision, + }) + barWidth = this.series[i][j] / this.invertedYRatio + } else { + paths = this.drawStackedColumnPaths({ + ...commonPathOpts, + xDivision, + barWidth, + zeroH, + }) + barHeight = this.series[i][j] / this.yRatio[translationsIndex] + } + + const barGoalLine = this.barHelpers.drawGoalLine({ + barXPosition: paths.barXPosition, + barYPosition: paths.barYPosition, + goalX: paths.goalX, + goalY: paths.goalY, + barHeight, + barWidth, + }) + + if (barGoalLine) { + elGoalsMarkers.add(barGoalLine) + } + + y = paths.y + x = paths.x + + xArrValues.push(x) + yArrValues.push(y) + + let pathFill = this.barHelpers.getPathFillColor(series, i, j, realIndex) + + let classes = '' + + const flipClass = w.globals.isBarHorizontal + ? 'apexcharts-flip-x' + : 'apexcharts-flip-y' + if ( + (this.barHelpers.arrBorderRadius[realIndex][j] === 'bottom' && + w.globals.series[realIndex][j] > 0) || + (this.barHelpers.arrBorderRadius[realIndex][j] === 'top' && + w.globals.series[realIndex][j] < 0) + ) { + classes = flipClass + } + elSeries = this.renderSeries({ + realIndex, + pathFill: pathFill.color, + ...(pathFill.useRangeColor ? { lineFill: pathFill.color } : {}), + j, + i, + columnGroupIndex, + pathFrom: paths.pathFrom, + pathTo: paths.pathTo, + strokeWidth, + elSeries, + x, + y, + series, + barHeight, + barWidth, + elDataLabelsWrap, + elGoalsMarkers, + type: 'bar', + visibleSeries: columnGroupIndex, + classes, + }) + } + + // push all x val arrays into main xArr + w.globals.seriesXvalues[realIndex] = xArrValues + w.globals.seriesYvalues[realIndex] = yArrValues + + // push all current y values array to main PrevY Array + this.groupCtx.prevY.push(this.groupCtx.yArrj) + this.groupCtx.prevYF.push(this.groupCtx.yArrjF) + this.groupCtx.prevYVal.push(this.groupCtx.yArrjVal) + this.groupCtx.prevX.push(this.groupCtx.xArrj) + this.groupCtx.prevXF.push(this.groupCtx.xArrjF) + this.groupCtx.prevXVal.push(this.groupCtx.xArrjVal) + + ret.add(elSeries) + } + + return ret + } + + initialPositions( + x, + y, + xDivision, + yDivision, + zeroH, + zeroW, + translationsIndex + ) { + let w = this.w + + let barHeight, barWidth + if (this.isHorizontal) { + // height divided into equal parts + yDivision = w.globals.gridHeight / w.globals.dataPoints + + let userBarHeight = w.config.plotOptions.bar.barHeight + if (String(userBarHeight).indexOf('%') === -1) { + barHeight = parseInt(userBarHeight, 10) + } else { + barHeight = (yDivision * parseInt(userBarHeight, 10)) / 100 + } + zeroW = + w.globals.padHorizontal + + (this.isReversed + ? w.globals.gridWidth - this.baseLineInvertedY + : this.baseLineInvertedY) + + // initial y position is half of barHeight * half of number of Bars + y = (yDivision - barHeight) / 2 + } else { + // width divided into equal parts + xDivision = w.globals.gridWidth / w.globals.dataPoints + + barWidth = xDivision + + let userColumnWidth = w.config.plotOptions.bar.columnWidth + if (w.globals.isXNumeric && w.globals.dataPoints > 1) { + xDivision = w.globals.minXDiff / this.xRatio + barWidth = (xDivision * parseInt(this.barOptions.columnWidth, 10)) / 100 + } else if (String(userColumnWidth).indexOf('%') === -1) { + barWidth = parseInt(userColumnWidth, 10) + } else { + barWidth *= parseInt(userColumnWidth, 10) / 100 + } + + if (this.isReversed) { + zeroH = this.baseLineY[translationsIndex] + } else { + zeroH = w.globals.gridHeight - this.baseLineY[translationsIndex] + } + + // initial x position is the left-most edge of the first bar relative to + // the left-most side of the grid area. + x = w.globals.padHorizontal + (xDivision - barWidth) / 2 + } + + // Up to this point, barWidth is the width that will accommodate all bars + // at each datapoint or category. + + // The crude subdivision here assumes the series within each group are + // stacked. If there is no stacking then the barWidth/barHeight is + // further divided later by the number of series in the group. So, eg, two + // groups of three series would become six bars side-by-side unstacked, + // or two bars stacked. + let subDivisions = w.globals.barGroups.length || 1 + + return { + x, + y, + yDivision, + xDivision, + barHeight: barHeight / subDivisions, + barWidth: barWidth / subDivisions, + zeroH, + zeroW, + } + } + + drawStackedBarPaths({ + indexes, + barHeight, + strokeWidth, + zeroW, + x, + y, + columnGroupIndex, + seriesGroup, + yDivision, + elSeries, + }) { + let w = this.w + let barYPosition = y + columnGroupIndex * barHeight + let barXPosition + let i = indexes.i + let j = indexes.j + let realIndex = indexes.realIndex + let translationsIndex = indexes.translationsIndex + + let prevBarW = 0 + for (let k = 0; k < this.groupCtx.prevXF.length; k++) { + prevBarW = prevBarW + this.groupCtx.prevXF[k][j] + } + + let gsi = i // an index to keep track of the series inside a group + if (w.config.series[realIndex].name) { + gsi = seriesGroup.indexOf(w.config.series[realIndex].name) + } + + if (gsi > 0) { + let bXP = zeroW + + if (this.groupCtx.prevXVal[gsi - 1][j] < 0) { + bXP = + this.series[i][j] >= 0 + ? this.groupCtx.prevX[gsi - 1][j] + + prevBarW - + (this.isReversed ? prevBarW : 0) * 2 + : this.groupCtx.prevX[gsi - 1][j] + } else if (this.groupCtx.prevXVal[gsi - 1][j] >= 0) { + bXP = + this.series[i][j] >= 0 + ? this.groupCtx.prevX[gsi - 1][j] + : this.groupCtx.prevX[gsi - 1][j] - + prevBarW + + (this.isReversed ? prevBarW : 0) * 2 + } + + barXPosition = bXP + } else { + // the first series will not have prevX values + barXPosition = zeroW + } + + if (this.series[i][j] === null) { + x = barXPosition + } else { + x = + barXPosition + + this.series[i][j] / this.invertedYRatio - + (this.isReversed ? this.series[i][j] / this.invertedYRatio : 0) * 2 + } + + const paths = this.barHelpers.getBarpaths({ + barYPosition, + barHeight, + x1: barXPosition, + x2: x, + strokeWidth, + isReversed: this.isReversed, + series: this.series, + realIndex: indexes.realIndex, + seriesGroup, + i, + j, + w, + }) + + this.barHelpers.barBackground({ + j, + i, + y1: barYPosition, + y2: barHeight, + elSeries, + }) + + y = y + yDivision + + return { + pathTo: paths.pathTo, + pathFrom: paths.pathFrom, + goalX: this.barHelpers.getGoalValues( + 'x', + zeroW, + null, + i, + j, + translationsIndex + ), + barXPosition, + barYPosition, + x, + y, + } + } + + drawStackedColumnPaths({ + indexes, + x, + y, + xDivision, + barWidth, + zeroH, + columnGroupIndex, + seriesGroup, + elSeries, + }) { + let w = this.w + let i = indexes.i + let j = indexes.j + let bc = indexes.bc + let realIndex = indexes.realIndex + let translationsIndex = indexes.translationsIndex + + if (w.globals.isXNumeric) { + let seriesVal = w.globals.seriesX[realIndex][j] + if (!seriesVal) seriesVal = 0 + // TODO: move the barWidth factor to barXPosition + x = + (seriesVal - w.globals.minX) / this.xRatio - + (barWidth / 2) * w.globals.barGroups.length + } + + let barXPosition = x + columnGroupIndex * barWidth + let barYPosition + + let prevBarH = 0 + for (let k = 0; k < this.groupCtx.prevYF.length; k++) { + // fix issue #1215 + // in case where this.groupCtx.prevYF[k][j] is NaN, use 0 instead + prevBarH = + prevBarH + + (!isNaN(this.groupCtx.prevYF[k][j]) ? this.groupCtx.prevYF[k][j] : 0) + } + + let gsi = i // an index to keep track of the series inside a group + if (seriesGroup) { + gsi = seriesGroup.indexOf(w.globals.seriesNames[realIndex]) + } + if ( + (gsi > 0 && !w.globals.isXNumeric) || + (gsi > 0 && + w.globals.isXNumeric && + w.globals.seriesX[realIndex - 1][j] === w.globals.seriesX[realIndex][j]) + ) { + let bYP + let prevYValue + const p = Math.min(this.yRatio.length + 1, realIndex + 1) + if ( + this.groupCtx.prevY[gsi - 1] !== undefined && + this.groupCtx.prevY[gsi - 1].length + ) { + for (let ii = 1; ii < p; ii++) { + if (!isNaN(this.groupCtx.prevY[gsi - ii]?.[j])) { + // find the previous available value to give prevYValue + prevYValue = this.groupCtx.prevY[gsi - ii][j] + // if found it, break the loop + break + } + } + } + + for (let ii = 1; ii < p; ii++) { + // find the previous available value(non-NaN) to give bYP + if (this.groupCtx.prevYVal[gsi - ii]?.[j] < 0) { + bYP = + this.series[i][j] >= 0 + ? prevYValue - prevBarH + (this.isReversed ? prevBarH : 0) * 2 + : prevYValue + // found it? break the loop + break + } else if (this.groupCtx.prevYVal[gsi - ii]?.[j] >= 0) { + bYP = + this.series[i][j] >= 0 + ? prevYValue + : prevYValue + prevBarH - (this.isReversed ? prevBarH : 0) * 2 + // found it? break the loop + break + } + } + + if (typeof bYP === 'undefined') bYP = w.globals.gridHeight + + // if this.prevYF[0] is all 0 resulted from line #486 + // AND every arr starting from the second only contains NaN + if ( + this.groupCtx.prevYF[0]?.every((val) => val === 0) && + this.groupCtx.prevYF + .slice(1, gsi) + .every((arr) => arr.every((val) => isNaN(val))) + ) { + barYPosition = zeroH + } else { + // Nothing special + barYPosition = bYP + } + } else { + // the first series will not have prevY values, also if the prev index's + // series X doesn't matches the current index's series X, then start from + // zero + barYPosition = zeroH + } + + if (this.series[i][j]) { + y = + barYPosition - + this.series[i][j] / this.yRatio[translationsIndex] + + (this.isReversed + ? this.series[i][j] / this.yRatio[translationsIndex] + : 0) * + 2 + } else { + // fixes #3610 + y = barYPosition + } + + const paths = this.barHelpers.getColumnPaths({ + barXPosition, + barWidth, + y1: barYPosition, + y2: y, + yRatio: this.yRatio[translationsIndex], + strokeWidth: this.strokeWidth, + isReversed: this.isReversed, + series: this.series, + seriesGroup, + realIndex: indexes.realIndex, + i, + j, + w, + }) + + this.barHelpers.barBackground({ + bc, + j, + i, + x1: barXPosition, + x2: barWidth, + elSeries, + }) + + return { + pathTo: paths.pathTo, + pathFrom: paths.pathFrom, + goalY: this.barHelpers.getGoalValues('y', null, zeroH, i, j), + barXPosition, + x: w.globals.isXNumeric ? x : x + xDivision, + y, + } + } +} + +export default BarStacked diff --git a/node_modules/apexcharts/src/charts/BoxCandleStick.js b/node_modules/apexcharts/src/charts/BoxCandleStick.js new file mode 100644 index 0000000..dcf416c --- /dev/null +++ b/node_modules/apexcharts/src/charts/BoxCandleStick.js @@ -0,0 +1,461 @@ +import CoreUtils from '../modules/CoreUtils' +import Bar from './Bar' +import Fill from '../modules/Fill' +import Graphics from '../modules/Graphics' +import Utils from '../utils/Utils' + +/** + * ApexCharts BoxCandleStick Class responsible for drawing both Stacked Columns and Bars. + * + * @module BoxCandleStick + **/ + +class BoxCandleStick extends Bar { + draw(series, ctype, seriesIndex) { + let w = this.w + let graphics = new Graphics(this.ctx) + let type = w.globals.comboCharts ? ctype : w.config.chart.type + let fill = new Fill(this.ctx) + + this.candlestickOptions = this.w.config.plotOptions.candlestick + this.boxOptions = this.w.config.plotOptions.boxPlot + this.isHorizontal = w.config.plotOptions.bar.horizontal + + const coreUtils = new CoreUtils(this.ctx, w) + series = coreUtils.getLogSeries(series) + this.series = series + this.yRatio = coreUtils.getLogYRatios(this.yRatio) + + this.barHelpers.initVariables(series) + + let ret = graphics.group({ + class: `apexcharts-${type}-series apexcharts-plot-series`, + }) + + for (let i = 0; i < series.length; i++) { + this.isBoxPlot = + w.config.chart.type === 'boxPlot' || + w.config.series[i].type === 'boxPlot' + + let x, + y, + xDivision, // xDivision is the GRIDWIDTH divided by number of datapoints (columns) + yDivision, // yDivision is the GRIDHEIGHT divided by number of datapoints (bars) + zeroH, // zeroH is the baseline where 0 meets y axis + zeroW // zeroW is the baseline where 0 meets x axis + + let yArrj = [] // hold y values of current iterating series + let xArrj = [] // hold x values of current iterating series + + let realIndex = w.globals.comboCharts ? seriesIndex[i] : i + // As BoxCandleStick derives from Bar, we need this to render. + let { columnGroupIndex } = this.barHelpers.getGroupIndex(realIndex) + + // el to which series will be drawn + let elSeries = graphics.group({ + class: `apexcharts-series`, + seriesName: Utils.escapeString(w.globals.seriesNames[realIndex]), + rel: i + 1, + 'data:realIndex': realIndex, + }) + + this.ctx.series.addCollapsedClassToSeries(elSeries, realIndex) + + if (series[i].length > 0) { + this.visibleI = this.visibleI + 1 + } + + let barHeight = 0 + let barWidth = 0 + + let translationsIndex = 0 + if (this.yRatio.length > 1) { + this.yaxisIndex = w.globals.seriesYAxisReverseMap[realIndex][0] + translationsIndex = realIndex + } + + let initPositions = this.barHelpers.initialPositions(realIndex) + + y = initPositions.y + barHeight = initPositions.barHeight + yDivision = initPositions.yDivision + zeroW = initPositions.zeroW + + x = initPositions.x + barWidth = initPositions.barWidth + xDivision = initPositions.xDivision + zeroH = initPositions.zeroH + + xArrj.push(x + barWidth / 2) + + // eldatalabels + let elDataLabelsWrap = graphics.group({ + class: 'apexcharts-datalabels', + 'data:realIndex': realIndex, + }) + + let elGoalsMarkers = graphics.group({ + class: 'apexcharts-bar-goals-markers', + }) + + for (let j = 0; j < w.globals.dataPoints; j++) { + const strokeWidth = this.barHelpers.getStrokeWidth(i, j, realIndex) + + let paths = null + const pathsParams = { + indexes: { + i, + j, + realIndex, + translationsIndex, + }, + x, + y, + strokeWidth, + elSeries, + } + + if (this.isHorizontal) { + paths = this.drawHorizontalBoxPaths({ + ...pathsParams, + yDivision, + barHeight, + zeroW, + }) + } else { + paths = this.drawVerticalBoxPaths({ + ...pathsParams, + xDivision, + barWidth, + zeroH, + }) + } + + y = paths.y + x = paths.x + + const barGoalLine = this.barHelpers.drawGoalLine({ + barXPosition: paths.barXPosition, + barYPosition: paths.barYPosition, + goalX: paths.goalX, + goalY: paths.goalY, + barHeight, + barWidth, + }) + + if (barGoalLine) { + elGoalsMarkers.add(barGoalLine) + } + + // push current X + if (j > 0) { + xArrj.push(x + barWidth / 2) + } + + yArrj.push(y) + + paths.pathTo.forEach((pathTo, pi) => { + let lineFill = + !this.isBoxPlot && this.candlestickOptions.wick.useFillColor + ? paths.color[pi] + : w.globals.stroke.colors[i] + + let pathFill = fill.fillPath({ + seriesNumber: realIndex, + dataPointIndex: j, + color: paths.color[pi], + value: series[i][j], + }) + + this.renderSeries({ + realIndex, + pathFill, + lineFill, + j, + i, + pathFrom: paths.pathFrom, + pathTo, + strokeWidth, + elSeries, + x, + y, + series, + columnGroupIndex, + barHeight, + barWidth, + elDataLabelsWrap, + elGoalsMarkers, + visibleSeries: this.visibleI, + type: w.config.chart.type, + }) + }) + } + + // push all x val arrays into main xArr + w.globals.seriesXvalues[realIndex] = xArrj + w.globals.seriesYvalues[realIndex] = yArrj + + ret.add(elSeries) + } + + return ret + } + + drawVerticalBoxPaths({ + indexes, + x, + y, + xDivision, + barWidth, + zeroH, + strokeWidth, + }) { + let w = this.w + let graphics = new Graphics(this.ctx) + + let i = indexes.i + let j = indexes.j + + const { colors: candleColors } = w.config.plotOptions.candlestick + const { colors: boxColors } = this.boxOptions + const realIndex = indexes.realIndex + + const getColor = (color) => + Array.isArray(color) ? color[realIndex] : color + + const colorPos = getColor(candleColors.upward) + const colorNeg = getColor(candleColors.downward) + + const yRatio = this.yRatio[indexes.translationsIndex] + + const ohlc = this.getOHLCValue(realIndex, j) + let l1 = zeroH + let l2 = zeroH + + let color = ohlc.o < ohlc.c ? [colorPos] : [colorNeg] + + if (this.isBoxPlot) { + color = [getColor(boxColors.lower), getColor(boxColors.upper)] + } + + let y1 = Math.min(ohlc.o, ohlc.c) + let y2 = Math.max(ohlc.o, ohlc.c) + let m = ohlc.m + + if (w.globals.isXNumeric) { + x = + (w.globals.seriesX[realIndex][j] - w.globals.minX) / this.xRatio - + barWidth / 2 + } + + let barXPosition = x + barWidth * this.visibleI + + if ( + typeof this.series[i][j] === 'undefined' || + this.series[i][j] === null + ) { + y1 = zeroH + y2 = zeroH + } else { + y1 = zeroH - y1 / yRatio + y2 = zeroH - y2 / yRatio + l1 = zeroH - ohlc.h / yRatio + l2 = zeroH - ohlc.l / yRatio + m = zeroH - ohlc.m / yRatio + } + + let pathTo = graphics.move(barXPosition, zeroH) + let pathFrom = graphics.move(barXPosition + barWidth / 2, y1) + if (w.globals.previousPaths.length > 0) { + pathFrom = this.getPreviousPath(realIndex, j, true) + } + + if (this.isBoxPlot) { + pathTo = [ + graphics.move(barXPosition, y1) + + graphics.line(barXPosition + barWidth / 2, y1) + + graphics.line(barXPosition + barWidth / 2, l1) + + graphics.line(barXPosition + barWidth / 4, l1) + + graphics.line(barXPosition + barWidth - barWidth / 4, l1) + + graphics.line(barXPosition + barWidth / 2, l1) + + graphics.line(barXPosition + barWidth / 2, y1) + + graphics.line(barXPosition + barWidth, y1) + + graphics.line(barXPosition + barWidth, m) + + graphics.line(barXPosition, m) + + graphics.line(barXPosition, y1 + strokeWidth / 2), + graphics.move(barXPosition, m) + + graphics.line(barXPosition + barWidth, m) + + graphics.line(barXPosition + barWidth, y2) + + graphics.line(barXPosition + barWidth / 2, y2) + + graphics.line(barXPosition + barWidth / 2, l2) + + graphics.line(barXPosition + barWidth - barWidth / 4, l2) + + graphics.line(barXPosition + barWidth / 4, l2) + + graphics.line(barXPosition + barWidth / 2, l2) + + graphics.line(barXPosition + barWidth / 2, y2) + + graphics.line(barXPosition, y2) + + graphics.line(barXPosition, m) + + 'z', + ] + } else { + // candlestick + pathTo = [ + graphics.move(barXPosition, y2) + + graphics.line(barXPosition + barWidth / 2, y2) + + graphics.line(barXPosition + barWidth / 2, l1) + + graphics.line(barXPosition + barWidth / 2, y2) + + graphics.line(barXPosition + barWidth, y2) + + graphics.line(barXPosition + barWidth, y1) + + graphics.line(barXPosition + barWidth / 2, y1) + + graphics.line(barXPosition + barWidth / 2, l2) + + graphics.line(barXPosition + barWidth / 2, y1) + + graphics.line(barXPosition, y1) + + graphics.line(barXPosition, y2 - strokeWidth / 2), + ] + } + + pathFrom = pathFrom + graphics.move(barXPosition, y1) + + if (!w.globals.isXNumeric) { + x = x + xDivision + } + + return { + pathTo, + pathFrom, + x, + y: y2, + goalY: this.barHelpers.getGoalValues( + 'y', + null, + zeroH, + i, + j, + indexes.translationsIndex + ), + barXPosition, + color, + } + } + + drawHorizontalBoxPaths({ + indexes, + x, + y, + yDivision, + barHeight, + zeroW, + strokeWidth, + }) { + let w = this.w + let graphics = new Graphics(this.ctx) + + let i = indexes.i + let j = indexes.j + + let color = this.boxOptions.colors.lower + + if (this.isBoxPlot) { + color = [this.boxOptions.colors.lower, this.boxOptions.colors.upper] + } + + const yRatio = this.invertedYRatio + let realIndex = indexes.realIndex + + const ohlc = this.getOHLCValue(realIndex, j) + let l1 = zeroW + let l2 = zeroW + + let x1 = Math.min(ohlc.o, ohlc.c) + let x2 = Math.max(ohlc.o, ohlc.c) + let m = ohlc.m + + if (w.globals.isXNumeric) { + y = + (w.globals.seriesX[realIndex][j] - w.globals.minX) / + this.invertedXRatio - + barHeight / 2 + } + + let barYPosition = y + barHeight * this.visibleI + + if ( + typeof this.series[i][j] === 'undefined' || + this.series[i][j] === null + ) { + x1 = zeroW + x2 = zeroW + } else { + x1 = zeroW + x1 / yRatio + x2 = zeroW + x2 / yRatio + l1 = zeroW + ohlc.h / yRatio + l2 = zeroW + ohlc.l / yRatio + m = zeroW + ohlc.m / yRatio + } + + let pathTo = graphics.move(zeroW, barYPosition) + let pathFrom = graphics.move(x1, barYPosition + barHeight / 2) + if (w.globals.previousPaths.length > 0) { + pathFrom = this.getPreviousPath(realIndex, j, true) + } + + pathTo = [ + graphics.move(x1, barYPosition) + + graphics.line(x1, barYPosition + barHeight / 2) + + graphics.line(l1, barYPosition + barHeight / 2) + + graphics.line(l1, barYPosition + barHeight / 2 - barHeight / 4) + + graphics.line(l1, barYPosition + barHeight / 2 + barHeight / 4) + + graphics.line(l1, barYPosition + barHeight / 2) + + graphics.line(x1, barYPosition + barHeight / 2) + + graphics.line(x1, barYPosition + barHeight) + + graphics.line(m, barYPosition + barHeight) + + graphics.line(m, barYPosition) + + graphics.line(x1 + strokeWidth / 2, barYPosition), + graphics.move(m, barYPosition) + + graphics.line(m, barYPosition + barHeight) + + graphics.line(x2, barYPosition + barHeight) + + graphics.line(x2, barYPosition + barHeight / 2) + + graphics.line(l2, barYPosition + barHeight / 2) + + graphics.line(l2, barYPosition + barHeight - barHeight / 4) + + graphics.line(l2, barYPosition + barHeight / 4) + + graphics.line(l2, barYPosition + barHeight / 2) + + graphics.line(x2, barYPosition + barHeight / 2) + + graphics.line(x2, barYPosition) + + graphics.line(m, barYPosition) + + 'z', + ] + + pathFrom = pathFrom + graphics.move(x1, barYPosition) + + if (!w.globals.isXNumeric) { + y = y + yDivision + } + + return { + pathTo, + pathFrom, + x: x2, + y, + goalX: this.barHelpers.getGoalValues('x', zeroW, null, i, j), + barYPosition, + color, + } + } + getOHLCValue(i, j) { + const w = this.w + const coreUtils = new CoreUtils(this.ctx, w) + const h = coreUtils.getLogValAtSeriesIndex(w.globals.seriesCandleH[i][j], i) + const o = coreUtils.getLogValAtSeriesIndex(w.globals.seriesCandleO[i][j], i) + const m = coreUtils.getLogValAtSeriesIndex(w.globals.seriesCandleM[i][j], i) + const c = coreUtils.getLogValAtSeriesIndex(w.globals.seriesCandleC[i][j], i) + const l = coreUtils.getLogValAtSeriesIndex(w.globals.seriesCandleL[i][j], i) + return { + o: this.isBoxPlot ? h : o, + h: this.isBoxPlot ? o : h, + m: m, + l: this.isBoxPlot ? c : l, + c: this.isBoxPlot ? l : c, + } + } +} + +export default BoxCandleStick diff --git a/node_modules/apexcharts/src/charts/HeatMap.js b/node_modules/apexcharts/src/charts/HeatMap.js new file mode 100644 index 0000000..143a859 --- /dev/null +++ b/node_modules/apexcharts/src/charts/HeatMap.js @@ -0,0 +1,256 @@ +import Animations from '../modules/Animations' +import Graphics from '../modules/Graphics' +import Fill from '../modules/Fill' +import Utils from '../utils/Utils' +import Helpers from './common/treemap/Helpers' +import Filters from '../modules/Filters' + +/** + * ApexCharts HeatMap Class. + * @module HeatMap + **/ + +export default class HeatMap { + constructor(ctx, xyRatios) { + this.ctx = ctx + this.w = ctx.w + + this.xRatio = xyRatios.xRatio + this.yRatio = xyRatios.yRatio + + this.dynamicAnim = this.w.config.chart.animations.dynamicAnimation + + this.helpers = new Helpers(ctx) + this.rectRadius = this.w.config.plotOptions.heatmap.radius + this.strokeWidth = this.w.config.stroke.show + ? this.w.config.stroke.width + : 0 + } + + draw(series) { + let w = this.w + const graphics = new Graphics(this.ctx) + + let ret = graphics.group({ + class: 'apexcharts-heatmap', + }) + + ret.attr('clip-path', `url(#gridRectMask${w.globals.cuid})`) + + // width divided into equal parts + let xDivision = w.globals.gridWidth / w.globals.dataPoints + let yDivision = w.globals.gridHeight / w.globals.series.length + + let y1 = 0 + let rev = false + + this.negRange = this.helpers.checkColorRange() + + let heatSeries = series.slice() + + if (w.config.yaxis[0].reversed) { + rev = true + heatSeries.reverse() + } + + for ( + let i = rev ? 0 : heatSeries.length - 1; + rev ? i < heatSeries.length : i >= 0; + rev ? i++ : i-- + ) { + // el to which series will be drawn + let elSeries = graphics.group({ + class: `apexcharts-series apexcharts-heatmap-series`, + seriesName: Utils.escapeString(w.globals.seriesNames[i]), + rel: i + 1, + 'data:realIndex': i, + }) + this.ctx.series.addCollapsedClassToSeries(elSeries, i) + + if (w.config.chart.dropShadow.enabled) { + const shadow = w.config.chart.dropShadow + const filters = new Filters(this.ctx) + filters.dropShadow(elSeries, shadow, i) + } + + let x1 = 0 + let shadeIntensity = w.config.plotOptions.heatmap.shadeIntensity + + let j = 0 + for (let dIndex = 0; dIndex < w.globals.dataPoints; dIndex++) { + // Recognize gaps and align values based on x axis + + if (w.globals.seriesX.length && !w.globals.allSeriesHasEqualX) { + if ( + w.globals.minX + w.globals.minXDiff * dIndex < + w.globals.seriesX[i][j] + ) { + x1 = x1 + xDivision + continue + } + } + + // Stop loop if index is out of array length + if (j >= heatSeries[i].length) break + + let heatColor = this.helpers.getShadeColor( + w.config.chart.type, + i, + j, + this.negRange + ) + let color = heatColor.color + let heatColorProps = heatColor.colorProps + + if (w.config.fill.type === 'image') { + const fill = new Fill(this.ctx) + + color = fill.fillPath({ + seriesNumber: i, + dataPointIndex: j, + opacity: w.globals.hasNegs + ? heatColorProps.percent < 0 + ? 1 - (1 + heatColorProps.percent / 100) + : shadeIntensity + heatColorProps.percent / 100 + : heatColorProps.percent / 100, + patternID: Utils.randomId(), + width: w.config.fill.image.width + ? w.config.fill.image.width + : xDivision, + height: w.config.fill.image.height + ? w.config.fill.image.height + : yDivision, + }) + } + + let radius = this.rectRadius + + let rect = graphics.drawRect(x1, y1, xDivision, yDivision, radius) + rect.attr({ + cx: x1, + cy: y1, + }) + rect.node.classList.add('apexcharts-heatmap-rect') + elSeries.add(rect) + + rect.attr({ + fill: color, + i, + index: i, + j, + val: series[i][j], + 'stroke-width': this.strokeWidth, + stroke: w.config.plotOptions.heatmap.useFillColorAsStroke + ? color + : w.globals.stroke.colors[0], + color, + }) + + this.helpers.addListeners(rect) + + if (w.config.chart.animations.enabled && !w.globals.dataChanged) { + let speed = 1 + if (!w.globals.resized) { + speed = w.config.chart.animations.speed + } + this.animateHeatMap(rect, x1, y1, xDivision, yDivision, speed) + } + + if (w.globals.dataChanged) { + let speed = 1 + if (this.dynamicAnim.enabled && w.globals.shouldAnimate) { + speed = this.dynamicAnim.speed + + let colorFrom = + w.globals.previousPaths[i] && + w.globals.previousPaths[i][j] && + w.globals.previousPaths[i][j].color + + if (!colorFrom) colorFrom = 'rgba(255, 255, 255, 0)' + + this.animateHeatColor( + rect, + Utils.isColorHex(colorFrom) + ? colorFrom + : Utils.rgb2hex(colorFrom), + Utils.isColorHex(color) ? color : Utils.rgb2hex(color), + speed + ) + } + } + + let formatter = w.config.dataLabels.formatter + let formattedText = formatter(w.globals.series[i][j], { + value: w.globals.series[i][j], + seriesIndex: i, + dataPointIndex: j, + w, + }) + + let dataLabels = this.helpers.calculateDataLabels({ + text: formattedText, + x: x1 + xDivision / 2, + y: y1 + yDivision / 2, + i, + j, + colorProps: heatColorProps, + series: heatSeries, + }) + if (dataLabels !== null) { + elSeries.add(dataLabels) + } + + x1 = x1 + xDivision + j++ + } + + y1 = y1 + yDivision + + ret.add(elSeries) + } + + // adjust yaxis labels for heatmap + let yAxisScale = w.globals.yAxisScale[0].result.slice() + if (w.config.yaxis[0].reversed) { + yAxisScale.unshift('') + } else { + yAxisScale.push('') + } + w.globals.yAxisScale[0].result = yAxisScale + + return ret + } + + animateHeatMap(el, x, y, width, height, speed) { + const animations = new Animations(this.ctx) + animations.animateRect( + el, + { + x: x + width / 2, + y: y + height / 2, + width: 0, + height: 0, + }, + { + x, + y, + width, + height, + }, + speed, + () => { + animations.animationCompleted(el) + } + ) + } + + animateHeatColor(el, colorFrom, colorTo, speed) { + el.attr({ + fill: colorFrom, + }) + .animate(speed) + .attr({ + fill: colorTo, + }) + } +} diff --git a/node_modules/apexcharts/src/charts/Line.js b/node_modules/apexcharts/src/charts/Line.js new file mode 100644 index 0000000..cafd7f8 --- /dev/null +++ b/node_modules/apexcharts/src/charts/Line.js @@ -0,0 +1,1170 @@ +import CoreUtils from '../modules/CoreUtils' +import Graphics from '../modules/Graphics' +import Fill from '../modules/Fill' +import DataLabels from '../modules/DataLabels' +import Markers from '../modules/Markers' +import Scatter from './Scatter' +import Utils from '../utils/Utils' +import Helpers from './common/line/Helpers' +import { svgPath, spline } from '../libs/monotone-cubic' +/** + * ApexCharts Line Class responsible for drawing Line / Area / RangeArea Charts. + * This class is also responsible for generating values for Bubble/Scatter charts, so need to rename it to Axis Charts to avoid confusions + * @module Line + **/ + +class Line { + constructor(ctx, xyRatios, isPointsChart) { + this.ctx = ctx + this.w = ctx.w + + this.xyRatios = xyRatios + + this.pointsChart = + !( + this.w.config.chart.type !== 'bubble' && + this.w.config.chart.type !== 'scatter' + ) || isPointsChart + + this.scatter = new Scatter(this.ctx) + + this.noNegatives = this.w.globals.minX === Number.MAX_VALUE + + this.lineHelpers = new Helpers(this) + this.markers = new Markers(this.ctx) + + this.prevSeriesY = [] + this.categoryAxisCorrection = 0 + this.yaxisIndex = 0 + } + + draw(series, ctype, seriesIndex, seriesRangeEnd) { + let w = this.w + let graphics = new Graphics(this.ctx) + let type = w.globals.comboCharts ? ctype : w.config.chart.type + let ret = graphics.group({ + class: `apexcharts-${type}-series apexcharts-plot-series`, + }) + + const coreUtils = new CoreUtils(this.ctx, w) + this.yRatio = this.xyRatios.yRatio + this.zRatio = this.xyRatios.zRatio + this.xRatio = this.xyRatios.xRatio + this.baseLineY = this.xyRatios.baseLineY + + series = coreUtils.getLogSeries(series) + this.yRatio = coreUtils.getLogYRatios(this.yRatio) + // We call draw() for each series group + this.prevSeriesY = [] + + // push all series in an array, so we can draw in reverse order + // (for stacked charts) + let allSeries = [] + + for (let i = 0; i < series.length; i++) { + series = this.lineHelpers.sameValueSeriesFix(i, series) + + let realIndex = w.globals.comboCharts ? seriesIndex[i] : i + let translationsIndex = this.yRatio.length > 1 ? realIndex : 0 + + this._initSerieVariables(series, i, realIndex) + + let yArrj = [] // hold y values of current iterating series + let y2Arrj = [] // holds y2 values in range-area charts + let xArrj = [] // hold x values of current iterating series + + let x = w.globals.padHorizontal + this.categoryAxisCorrection + let y = 1 + + let linePaths = [] + let areaPaths = [] + + this.ctx.series.addCollapsedClassToSeries(this.elSeries, realIndex) + + if (w.globals.isXNumeric && w.globals.seriesX.length > 0) { + x = (w.globals.seriesX[realIndex][0] - w.globals.minX) / this.xRatio + } + + xArrj.push(x) + + let pX = x + let pY + let pY2 + let prevX = pX + let prevY = this.zeroY + let prevY2 = this.zeroY + let lineYPosition = 0 + + // the first value in the current series is not null or undefined + let firstPrevY = this.lineHelpers.determineFirstPrevY({ + i, + realIndex, + series, + prevY, + lineYPosition, + translationsIndex, + }) + prevY = firstPrevY.prevY + if (w.config.stroke.curve === 'monotoneCubic' && series[i][0] === null) { + // we have to discard the y position if 1st dataPoint is null as it + // causes issues with monotoneCubic path creation + yArrj.push(null) + } else { + yArrj.push(prevY) + } + pY = prevY + + // y2 are needed for range-area charts + let firstPrevY2 + + if (type === 'rangeArea') { + firstPrevY2 = this.lineHelpers.determineFirstPrevY({ + i, + realIndex, + series: seriesRangeEnd, + prevY: prevY2, + lineYPosition, + translationsIndex, + }) + prevY2 = firstPrevY2.prevY + pY2 = prevY2 + y2Arrj.push(yArrj[0] !== null ? prevY2 : null) + } + + let pathsFrom = this._calculatePathsFrom({ + type, + series, + i, + realIndex, + translationsIndex, + prevX, + prevY, + prevY2, + }) + + // RangeArea will resume with these for the upper path creation + let rYArrj = [yArrj[0]] + let rY2Arrj = [y2Arrj[0]] + + const iteratingOpts = { + type, + series, + realIndex, + translationsIndex, + i, + x, + y, + pX, + pY, + pathsFrom, + linePaths, + areaPaths, + seriesIndex, + lineYPosition, + xArrj, + yArrj, + y2Arrj, + seriesRangeEnd, + } + + let paths = this._iterateOverDataPoints({ + ...iteratingOpts, + iterations: type === 'rangeArea' ? series[i].length - 1 : undefined, + isRangeStart: true, + }) + + if (type === 'rangeArea') { + let pathsFrom2 = this._calculatePathsFrom({ + series: seriesRangeEnd, + i, + realIndex, + prevX, + prevY: prevY2, + }) + let rangePaths = this._iterateOverDataPoints({ + ...iteratingOpts, + series: seriesRangeEnd, + xArrj: [x], + yArrj: rYArrj, + y2Arrj: rY2Arrj, + pY: pY2, + areaPaths: paths.areaPaths, + pathsFrom: pathsFrom2, + iterations: seriesRangeEnd[i].length - 1, + isRangeStart: false, + }) + + // Path may be segmented by nulls in data. + // paths.linePaths should hold (segments * 2) paths (upper and lower) + // the first n segments belong to the lower and the last n segments + // belong to the upper. + // paths.linePaths and rangePaths.linepaths are actually equivalent + // but we retain the distinction below for consistency with the + // unsegmented paths conditional branch. + let segments = paths.linePaths.length / 2 + for (let s = 0; s < segments; s++) { + paths.linePaths[s] = + rangePaths.linePaths[s + segments] + paths.linePaths[s] + } + paths.linePaths.splice(segments) + paths.pathFromLine = rangePaths.pathFromLine + paths.pathFromLine + } else { + paths.pathFromArea += 'z' + } + + this._handlePaths({ type, realIndex, i, paths }) + + this.elSeries.add(this.elPointsMain) + this.elSeries.add(this.elDataLabelsWrap) + + allSeries.push(this.elSeries) + } + + if (typeof w.config.series[0]?.zIndex !== 'undefined') { + allSeries.sort( + (a, b) => + Number(a.node.getAttribute('zIndex')) - + Number(b.node.getAttribute('zIndex')) + ) + } + + if (w.config.chart.stacked) { + for (let s = allSeries.length - 1; s >= 0; s--) { + ret.add(allSeries[s]) + } + } else { + for (let s = 0; s < allSeries.length; s++) { + ret.add(allSeries[s]) + } + } + + return ret + } + + _initSerieVariables(series, i, realIndex) { + const w = this.w + const graphics = new Graphics(this.ctx) + + // width divided into equal parts + this.xDivision = + w.globals.gridWidth / + (w.globals.dataPoints - (w.config.xaxis.tickPlacement === 'on' ? 1 : 0)) + + this.strokeWidth = Array.isArray(w.config.stroke.width) + ? w.config.stroke.width[realIndex] + : w.config.stroke.width + + let translationsIndex = 0 + if (this.yRatio.length > 1) { + this.yaxisIndex = w.globals.seriesYAxisReverseMap[realIndex] + translationsIndex = realIndex + } + + this.isReversed = + w.config.yaxis[this.yaxisIndex] && + w.config.yaxis[this.yaxisIndex].reversed + + // zeroY is the 0 value in y series which can be used in negative charts + this.zeroY = + w.globals.gridHeight - + this.baseLineY[translationsIndex] - + (this.isReversed ? w.globals.gridHeight : 0) + + (this.isReversed ? this.baseLineY[translationsIndex] * 2 : 0) + + this.areaBottomY = this.zeroY + if ( + this.zeroY > w.globals.gridHeight || + w.config.plotOptions.area.fillTo === 'end' + ) { + this.areaBottomY = w.globals.gridHeight + } + + this.categoryAxisCorrection = this.xDivision / 2 + + // el to which series will be drawn + this.elSeries = graphics.group({ + class: `apexcharts-series`, + zIndex: + typeof w.config.series[realIndex].zIndex !== 'undefined' + ? w.config.series[realIndex].zIndex + : realIndex, + seriesName: Utils.escapeString(w.globals.seriesNames[realIndex]), + }) + + // points + this.elPointsMain = graphics.group({ + class: 'apexcharts-series-markers-wrap', + 'data:realIndex': realIndex, + }) + + if (w.globals.hasNullValues) { + // fixes https://github.com/apexcharts/apexcharts.js/issues/3641 + const firstPoint = this.markers.plotChartMarkers({ + pointsPos: { + x: [0], + y: [w.globals.gridHeight + w.globals.markers.largestSize], + }, + seriesIndex: i, + j: 0, + pSize: 0.1, + alwaysDrawMarker: true, + isVirtualPoint: true, + }) + + if (firstPoint !== null) { + // firstPoint is rendered for cases where there are null values and when dynamic markers are required + this.elPointsMain.add(firstPoint) + } + } + + // eldatalabels + this.elDataLabelsWrap = graphics.group({ + class: 'apexcharts-datalabels', + 'data:realIndex': realIndex, + }) + + let longestSeries = series[i].length === w.globals.dataPoints + this.elSeries.attr({ + 'data:longestSeries': longestSeries, + rel: i + 1, + 'data:realIndex': realIndex, + }) + + this.appendPathFrom = true + } + + _calculatePathsFrom({ + type, + series, + i, + realIndex, + translationsIndex, + prevX, + prevY, + prevY2, + }) { + const w = this.w + const graphics = new Graphics(this.ctx) + let linePath, areaPath, pathFromLine, pathFromArea + + if (series[i][0] === null) { + // when the first value itself is null, we need to move the pointer to a location where a null value is not found + for (let s = 0; s < series[i].length; s++) { + if (series[i][s] !== null) { + prevX = this.xDivision * s + prevY = this.zeroY - series[i][s] / this.yRatio[translationsIndex] + linePath = graphics.move(prevX, prevY) + areaPath = graphics.move(prevX, this.areaBottomY) + break + } + } + } else { + linePath = graphics.move(prevX, prevY) + + if (type === 'rangeArea') { + linePath = graphics.move(prevX, prevY2) + graphics.line(prevX, prevY) + } + areaPath = + graphics.move(prevX, this.areaBottomY) + graphics.line(prevX, prevY) + } + + pathFromLine = + graphics.move(0, this.areaBottomY) + graphics.line(0, this.areaBottomY) + pathFromArea = + graphics.move(0, this.areaBottomY) + graphics.line(0, this.areaBottomY) + + if (w.globals.previousPaths.length > 0) { + const pathFrom = this.lineHelpers.checkPreviousPaths({ + pathFromLine, + pathFromArea, + realIndex, + }) + pathFromLine = pathFrom.pathFromLine + pathFromArea = pathFrom.pathFromArea + } + + return { + prevX, + prevY, + linePath, + areaPath, + pathFromLine, + pathFromArea, + } + } + + _handlePaths({ type, realIndex, i, paths }) { + const w = this.w + const graphics = new Graphics(this.ctx) + const fill = new Fill(this.ctx) + + // push all current y values array to main PrevY Array + this.prevSeriesY.push(paths.yArrj) + + // push all x val arrays into main xArr + w.globals.seriesXvalues[realIndex] = paths.xArrj + w.globals.seriesYvalues[realIndex] = paths.yArrj + + const forecast = w.config.forecastDataPoints + if (forecast.count > 0 && type !== 'rangeArea') { + const forecastCutoff = + w.globals.seriesXvalues[realIndex][ + w.globals.seriesXvalues[realIndex].length - forecast.count - 1 + ] + const elForecastMask = graphics.drawRect( + forecastCutoff, + 0, + w.globals.gridWidth, + w.globals.gridHeight, + 0 + ) + w.globals.dom.elForecastMask.appendChild(elForecastMask.node) + + const elNonForecastMask = graphics.drawRect( + 0, + 0, + forecastCutoff, + w.globals.gridHeight, + 0 + ) + w.globals.dom.elNonForecastMask.appendChild(elNonForecastMask.node) + } + + // these elements will be shown after area path animation completes + if (!this.pointsChart) { + w.globals.delayedElements.push({ + el: this.elPointsMain.node, + index: realIndex, + }) + } + + const defaultRenderedPathOptions = { + i, + realIndex, + animationDelay: i, + initialSpeed: w.config.chart.animations.speed, + dataChangeSpeed: w.config.chart.animations.dynamicAnimation.speed, + className: `apexcharts-${type}`, + } + + if (type === 'area') { + let pathFill = fill.fillPath({ + seriesNumber: realIndex, + }) + + for (let p = 0; p < paths.areaPaths.length; p++) { + let renderedPath = graphics.renderPaths({ + ...defaultRenderedPathOptions, + pathFrom: paths.pathFromArea, + pathTo: paths.areaPaths[p], + stroke: 'none', + strokeWidth: 0, + strokeLineCap: null, + fill: pathFill, + }) + this.elSeries.add(renderedPath) + } + } + + if (w.config.stroke.show && !this.pointsChart) { + let lineFill = null + if (type === 'line') { + lineFill = fill.fillPath({ + seriesNumber: realIndex, + i, + }) + } else { + if (w.config.stroke.fill.type === 'solid') { + lineFill = w.globals.stroke.colors[realIndex] + } else { + const prevFill = w.config.fill + w.config.fill = w.config.stroke.fill + + lineFill = fill.fillPath({ + seriesNumber: realIndex, + i, + }) + w.config.fill = prevFill + } + } + + // range-area paths are drawn using linePaths + for (let p = 0; p < paths.linePaths.length; p++) { + let pathFill = lineFill + if (type === 'rangeArea') { + pathFill = fill.fillPath({ + seriesNumber: realIndex, + }) + } + const linePathCommonOpts = { + ...defaultRenderedPathOptions, + pathFrom: paths.pathFromLine, + pathTo: paths.linePaths[p], + stroke: lineFill, + strokeWidth: this.strokeWidth, + strokeLineCap: w.config.stroke.lineCap, + fill: type === 'rangeArea' ? pathFill : 'none', + } + let renderedPath = graphics.renderPaths(linePathCommonOpts) + this.elSeries.add(renderedPath) + renderedPath.attr('fill-rule', `evenodd`) + + if (forecast.count > 0 && type !== 'rangeArea') { + let renderedForecastPath = graphics.renderPaths(linePathCommonOpts) + + renderedForecastPath.node.setAttribute( + 'stroke-dasharray', + forecast.dashArray + ) + + if (forecast.strokeWidth) { + renderedForecastPath.node.setAttribute( + 'stroke-width', + forecast.strokeWidth + ) + } + + this.elSeries.add(renderedForecastPath) + renderedForecastPath.attr( + 'clip-path', + `url(#forecastMask${w.globals.cuid})` + ) + renderedPath.attr( + 'clip-path', + `url(#nonForecastMask${w.globals.cuid})` + ) + } + } + } + } + + _iterateOverDataPoints({ + type, + series, + iterations, + realIndex, + translationsIndex, + i, + x, + y, + pX, + pY, + pathsFrom, + linePaths, + areaPaths, + seriesIndex, + lineYPosition, + xArrj, + yArrj, + y2Arrj, + isRangeStart, + seriesRangeEnd, + }) { + const w = this.w + let graphics = new Graphics(this.ctx) + let yRatio = this.yRatio + let { prevY, linePath, areaPath, pathFromLine, pathFromArea } = pathsFrom + + const minY = Utils.isNumber(w.globals.minYArr[realIndex]) + ? w.globals.minYArr[realIndex] + : w.globals.minY + + if (!iterations) { + iterations = + w.globals.dataPoints > 1 + ? w.globals.dataPoints - 1 + : w.globals.dataPoints + } + + const getY = (_y, lineYPos) => { + return ( + lineYPos - + _y / yRatio[translationsIndex] + + (this.isReversed ? _y / yRatio[translationsIndex] : 0) * 2 + ) + } + + let y2 = y + + let stackSeries = + (w.config.chart.stacked && !w.globals.comboCharts) || + (w.config.chart.stacked && + w.globals.comboCharts && + (!this.w.config.chart.stackOnlyBar || + this.w.config.series[realIndex]?.type === 'bar' || + this.w.config.series[realIndex]?.type === 'column')) + + let curve = w.config.stroke.curve + if (Array.isArray(curve)) { + if (Array.isArray(seriesIndex)) { + curve = curve[seriesIndex[i]] + } else { + curve = curve[i] + } + } + + let pathState = 0 + let segmentStartX + + for (let j = 0; j < iterations; j++) { + if (series[i].length === 0) break + + const isNull = + typeof series[i][j + 1] === 'undefined' || series[i][j + 1] === null + + if (w.globals.isXNumeric) { + let sX = w.globals.seriesX[realIndex][j + 1] + if (typeof w.globals.seriesX[realIndex][j + 1] === 'undefined') { + /* fix #374 */ + sX = w.globals.seriesX[realIndex][iterations - 1] + } + x = (sX - w.globals.minX) / this.xRatio + } else { + x = x + this.xDivision + } + + if (stackSeries) { + if ( + i > 0 && + w.globals.collapsedSeries.length < w.config.series.length - 1 + ) { + // a collapsed series in a stacked chart may provide wrong result + // for the next series, hence find the prevIndex of prev series + // which is not collapsed - fixes apexcharts.js#1372 + const prevIndex = (pi) => { + for (let pii = pi; pii > 0; pii--) { + if ( + w.globals.collapsedSeriesIndices.indexOf( + seriesIndex?.[pii] || pii + ) > -1 + ) { + pii-- + } else { + return pii + } + } + return 0 + } + lineYPosition = this.prevSeriesY[prevIndex(i - 1)][j + 1] + } else { + // the first series will not have prevY values + lineYPosition = this.zeroY + } + } else { + lineYPosition = this.zeroY + } + + if (isNull) { + y = getY(minY, lineYPosition) + } else { + y = getY(series[i][j + 1], lineYPosition) + + if (type === 'rangeArea') { + y2 = getY(seriesRangeEnd[i][j + 1], lineYPosition) + } + } + + // push current X + xArrj.push(series[i][j + 1] === null ? null : x) + + // push current Y that will be used as next series's bottom position + if ( + isNull && + (w.config.stroke.curve === 'smooth' || + w.config.stroke.curve === 'monotoneCubic') + ) { + yArrj.push(null) + y2Arrj.push(null) + } else { + yArrj.push(y) + y2Arrj.push(y2) + } + + let pointsPos = this.lineHelpers.calculatePoints({ + series, + x, + y, + realIndex, + i, + j, + prevY, + }) + + let calculatedPaths = this._createPaths({ + type, + series, + i, + realIndex, + j, + x, + y, + y2, + xArrj, + yArrj, + y2Arrj, + pX, + pY, + pathState, + segmentStartX, + linePath, + areaPath, + linePaths, + areaPaths, + curve, + isRangeStart, + }) + + areaPaths = calculatedPaths.areaPaths + linePaths = calculatedPaths.linePaths + pX = calculatedPaths.pX + pY = calculatedPaths.pY + pathState = calculatedPaths.pathState + segmentStartX = calculatedPaths.segmentStartX + areaPath = calculatedPaths.areaPath + linePath = calculatedPaths.linePath + + if ( + this.appendPathFrom && + !w.globals.hasNullValues && + !(curve === 'monotoneCubic' && type === 'rangeArea') + ) { + pathFromLine += graphics.line(x, this.areaBottomY) + pathFromArea += graphics.line(x, this.areaBottomY) + } + + this.handleNullDataPoints(series, pointsPos, i, j, realIndex) + + this._handleMarkersAndLabels({ + type, + pointsPos, + i, + j, + realIndex, + isRangeStart, + }) + } + + return { + yArrj, + xArrj, + pathFromArea, + areaPaths, + pathFromLine, + linePaths, + linePath, + areaPath, + } + } + + _handleMarkersAndLabels({ type, pointsPos, isRangeStart, i, j, realIndex }) { + const w = this.w + let dataLabels = new DataLabels(this.ctx) + + if (!this.pointsChart) { + if (w.globals.series[i].length > 1) { + this.elPointsMain.node.classList.add('apexcharts-element-hidden') + } + + let elPointsWrap = this.markers.plotChartMarkers({ + pointsPos, + seriesIndex: realIndex, + j: j + 1, + }) + if (elPointsWrap !== null) { + this.elPointsMain.add(elPointsWrap) + } + } else { + // scatter / bubble chart points creation + this.scatter.draw(this.elSeries, j, { + realIndex, + pointsPos, + zRatio: this.zRatio, + elParent: this.elPointsMain, + }) + } + + let drawnLabels = dataLabels.drawDataLabel({ + type, + isRangeStart, + pos: pointsPos, + i: realIndex, + j: j + 1, + }) + if (drawnLabels !== null) { + this.elDataLabelsWrap.add(drawnLabels) + } + } + + _createPaths({ + type, + series, + i, + realIndex, + j, + x, + y, + xArrj, + yArrj, + y2, + y2Arrj, + pX, + pY, + pathState, + segmentStartX, + linePath, + areaPath, + linePaths, + areaPaths, + curve, + isRangeStart, + }) { + let graphics = new Graphics(this.ctx) + const areaBottomY = this.areaBottomY + let rangeArea = type === 'rangeArea' + let isLowerRangeAreaPath = type === 'rangeArea' && isRangeStart + + switch (curve) { + case 'monotoneCubic': + let yAj = isRangeStart ? yArrj : y2Arrj + let getSmoothInputs = (xArr, yArr) => { + return xArr + .map((_, i) => { + return [_, yArr[i]] + }) + .filter((_) => _[1] !== null) + } + let getSegmentLengths = (yArr) => { + // Get the segment lengths so the segments can be extracted from + // the null-filtered smoothInputs array + let segLens = [] + let count = 0 + yArr.forEach((_) => { + if (_ !== null) { + count++ + } else if (count > 0) { + segLens.push(count) + count = 0 + } + }) + if (count > 0) { + segLens.push(count) + } + return segLens + } + let getSegments = (yArr, points) => { + let segLens = getSegmentLengths(yArr) + let segments = [] + for (let i = 0, len = 0; i < segLens.length; len += segLens[i++]) { + segments[i] = spline.slice(points, len, len + segLens[i]) + } + return segments + } + + switch (pathState) { + case 0: + // Find start of segment + if (yAj[j + 1] === null) { + break + } + pathState = 1 + // continue through to pathState 1 + case 1: + if ( + !(rangeArea + ? xArrj.length === series[i].length + : j === series[i].length - 2) + ) { + break + } + // continue through to pathState 2 + case 2: + // Interpolate the full series with nulls excluded then extract the + // null delimited segments with interpolated points included. + const _xAj = isRangeStart ? xArrj : xArrj.slice().reverse() + const _yAj = isRangeStart ? yAj : yAj.slice().reverse() + + const smoothInputs = getSmoothInputs(_xAj, _yAj) + const points = + smoothInputs.length > 1 + ? spline.points(smoothInputs) + : smoothInputs + + let smoothInputsLower = [] + if (rangeArea) { + if (isLowerRangeAreaPath) { + // As we won't be needing it, borrow areaPaths to retain our + // rangeArea lower points. + areaPaths = smoothInputs + } else { + // Retrieve the corresponding lower raw interpolated points so we + // can join onto its end points. Note: the upper Y2 segments will + // be in the reverse order relative to the lower segments. + smoothInputsLower = areaPaths.reverse() + } + } + + let segmentCount = 0 + let smoothInputsIndex = 0 + getSegments(_yAj, points).forEach((_) => { + segmentCount++ + let svgPoints = svgPath(_) + let _start = smoothInputsIndex + smoothInputsIndex += _.length + let _end = smoothInputsIndex - 1 + if (isLowerRangeAreaPath) { + linePath = + graphics.move( + smoothInputs[_start][0], + smoothInputs[_start][1] + ) + svgPoints + } else if (rangeArea) { + linePath = + graphics.move( + smoothInputsLower[_start][0], + smoothInputsLower[_start][1] + ) + + graphics.line( + smoothInputs[_start][0], + smoothInputs[_start][1] + ) + + svgPoints + + graphics.line( + smoothInputsLower[_end][0], + smoothInputsLower[_end][1] + ) + } else { + linePath = + graphics.move( + smoothInputs[_start][0], + smoothInputs[_start][1] + ) + svgPoints + areaPath = + linePath + + graphics.line(smoothInputs[_end][0], areaBottomY) + + graphics.line(smoothInputs[_start][0], areaBottomY) + + 'z' + areaPaths.push(areaPath) + } + linePaths.push(linePath) + }) + + if (rangeArea && segmentCount > 1 && !isLowerRangeAreaPath) { + // Reverse the order of the upper path segments + let upperLinePaths = linePaths.slice(segmentCount).reverse() + linePaths.splice(segmentCount) + upperLinePaths.forEach((u) => linePaths.push(u)) + } + pathState = 0 + break + } + break + case 'smooth': + let length = (x - pX) * 0.35 + if (series[i][j] === null) { + pathState = 0 + } else { + switch (pathState) { + case 0: + // Beginning of segment + segmentStartX = pX + if (isLowerRangeAreaPath) { + // Need to add path portion that will join to the upper path + linePath = graphics.move(pX, y2Arrj[j]) + graphics.line(pX, pY) + } else { + linePath = graphics.move(pX, pY) + } + areaPath = graphics.move(pX, pY) + + // Check for single isolated point + if ( + series[i][j + 1] === null || + typeof series[i][j + 1] === 'undefined' + ) { + linePaths.push(linePath) + areaPaths.push(areaPath) + // Stay in pathState = 0; + break + } + pathState = 1 + if (j < series[i].length - 2) { + let p = graphics.curve(pX + length, pY, x - length, y, x, y) + linePath += p + areaPath += p + break + } + // Continue on with pathState 1 to finish the path and exit + case 1: + // Continuing with segment + if (series[i][j + 1] === null) { + // Segment ends here + if (isLowerRangeAreaPath) { + linePath += graphics.line(pX, y2) + } else { + linePath += graphics.move(pX, pY) + } + areaPath += + graphics.line(pX, areaBottomY) + + graphics.line(segmentStartX, areaBottomY) + + 'z' + linePaths.push(linePath) + areaPaths.push(areaPath) + pathState = -1 + } else { + let p = graphics.curve(pX + length, pY, x - length, y, x, y) + linePath += p + areaPath += p + if (j >= series[i].length - 2) { + if (isLowerRangeAreaPath) { + // Need to add path portion that will join to the upper path + linePath += + graphics.curve(x, y, x, y, x, y2) + graphics.move(x, y2) + } + areaPath += + graphics.curve(x, y, x, y, x, areaBottomY) + + graphics.line(segmentStartX, areaBottomY) + + 'z' + linePaths.push(linePath) + areaPaths.push(areaPath) + pathState = -1 + } + } + break + } + } + + pX = x + pY = y + + break + default: + let pathToPoint = (curve, x, y) => { + let path = [] + switch (curve) { + case 'stepline': + path = graphics.line(x, null, 'H') + graphics.line(null, y, 'V') + break + case 'linestep': + path = graphics.line(null, y, 'V') + graphics.line(x, null, 'H') + break + case 'straight': + path = graphics.line(x, y) + break + } + return path + } + if (series[i][j] === null) { + pathState = 0 + } else { + switch (pathState) { + case 0: + // Beginning of segment + segmentStartX = pX + if (isLowerRangeAreaPath) { + // Need to add path portion that will join to the upper path + linePath = graphics.move(pX, y2Arrj[j]) + graphics.line(pX, pY) + } else { + linePath = graphics.move(pX, pY) + } + areaPath = graphics.move(pX, pY) + + // Check for single isolated point + if ( + series[i][j + 1] === null || + typeof series[i][j + 1] === 'undefined' + ) { + linePaths.push(linePath) + areaPaths.push(areaPath) + // Stay in pathState = 0 + break + } + pathState = 1 + if (j < series[i].length - 2) { + let p = pathToPoint(curve, x, y) + linePath += p + areaPath += p + break + } + // Continue on with pathState 1 to finish the path and exit + case 1: + // Continuing with segment + if (series[i][j + 1] === null) { + // Segment ends here + if (isLowerRangeAreaPath) { + linePath += graphics.line(pX, y2) + } else { + linePath += graphics.move(pX, pY) + } + areaPath += + graphics.line(pX, areaBottomY) + + graphics.line(segmentStartX, areaBottomY) + + 'z' + linePaths.push(linePath) + areaPaths.push(areaPath) + pathState = -1 + } else { + let p = pathToPoint(curve, x, y) + linePath += p + areaPath += p + if (j >= series[i].length - 2) { + if (isLowerRangeAreaPath) { + // Need to add path portion that will join to the upper path + linePath += graphics.line(x, y2) + } + areaPath += + graphics.line(x, areaBottomY) + + graphics.line(segmentStartX, areaBottomY) + + 'z' + linePaths.push(linePath) + areaPaths.push(areaPath) + pathState = -1 + } + } + break + } + } + + pX = x + pY = y + + break + } + + return { + linePaths, + areaPaths, + pX, + pY, + pathState, + segmentStartX, + linePath, + areaPath, + } + } + + handleNullDataPoints(series, pointsPos, i, j, realIndex) { + const w = this.w + if ( + (series[i][j] === null && w.config.markers.showNullDataPoints) || + series[i].length === 1 + ) { + let pSize = this.strokeWidth - w.config.markers.strokeWidth / 2 + if (!(pSize > 0)) { + pSize = 0 + } + + // fixes apexcharts.js#1282, #1252 + let elPointsWrap = this.markers.plotChartMarkers({ + pointsPos, + seriesIndex: realIndex, + j: j + 1, + pSize, + alwaysDrawMarker: true, + }) + if (elPointsWrap !== null) { + this.elPointsMain.add(elPointsWrap) + } + } + } +} + +export default Line diff --git a/node_modules/apexcharts/src/charts/Pie.js b/node_modules/apexcharts/src/charts/Pie.js new file mode 100644 index 0000000..e47f20e --- /dev/null +++ b/node_modules/apexcharts/src/charts/Pie.js @@ -0,0 +1,1021 @@ +import Animations from '../modules/Animations' +import Fill from '../modules/Fill' +import Utils from '../utils/Utils' +import Graphics from '../modules/Graphics' +import Filters from '../modules/Filters' +import Scales from '../modules/Scales' +import Helpers from './common/circle/Helpers' +/** + * ApexCharts Pie Class for drawing Pie / Donut Charts. + * @module Pie + **/ + +class Pie { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + const w = this.w + + this.chartType = this.w.config.chart.type + + this.initialAnim = this.w.config.chart.animations.enabled + this.dynamicAnim = + this.initialAnim && + this.w.config.chart.animations.dynamicAnimation.enabled + + this.animBeginArr = [0] + this.animDur = 0 + + this.donutDataLabels = this.w.config.plotOptions.pie.donut.labels + + this.lineColorArr = + w.globals.stroke.colors !== undefined + ? w.globals.stroke.colors + : w.globals.colors + + this.defaultSize = Math.min(w.globals.gridWidth, w.globals.gridHeight) + + this.centerY = this.defaultSize / 2 + this.centerX = w.globals.gridWidth / 2 + + if (w.config.chart.type === 'radialBar') { + this.fullAngle = 360 + } else { + this.fullAngle = Math.abs( + w.config.plotOptions.pie.endAngle - w.config.plotOptions.pie.startAngle + ) + } + this.initialAngle = w.config.plotOptions.pie.startAngle % this.fullAngle + + w.globals.radialSize = + this.defaultSize / 2.05 - + w.config.stroke.width - + (!w.config.chart.sparkline.enabled ? w.config.chart.dropShadow.blur : 0) + + this.donutSize = + (w.globals.radialSize * + parseInt(w.config.plotOptions.pie.donut.size, 10)) / + 100 + + let scaleSize = w.config.plotOptions.pie.customScale + let halfW = w.globals.gridWidth / 2 + let halfH = w.globals.gridHeight / 2 + this.translateX = halfW - halfW * scaleSize + this.translateY = halfH - halfH * scaleSize + + this.dataLabelsGroup = new Graphics(this.ctx).group({ + class: 'apexcharts-datalabels-group', + transform: `translate(${this.translateX}, ${this.translateY}) scale(${scaleSize})`, + }) + + this.maxY = 0 + this.sliceLabels = [] + this.sliceSizes = [] + + this.prevSectorAngleArr = [] // for dynamic animations + } + + draw(series) { + let self = this + let w = this.w + + const graphics = new Graphics(this.ctx) + + let elPie = graphics.group({ + class: 'apexcharts-pie', + }) + + if (w.globals.noData) return elPie + + let total = 0 + for (let k = 0; k < series.length; k++) { + // CALCULATE THE TOTAL + total += Utils.negToZero(series[k]) + } + + let sectorAngleArr = [] + + // el to which series will be drawn + let elSeries = graphics.group() + + // prevent division by zero error if there is no data + if (total === 0) { + total = 0.00001 + } + + series.forEach((m) => { + this.maxY = Math.max(this.maxY, m) + }) + + // override maxY if user provided in config + if (w.config.yaxis[0].max) { + this.maxY = w.config.yaxis[0].max + } + + if (w.config.grid.position === 'back' && this.chartType === 'polarArea') { + this.drawPolarElements(elPie) + } + + for (let i = 0; i < series.length; i++) { + // CALCULATE THE ANGLES + let angle = (this.fullAngle * Utils.negToZero(series[i])) / total + sectorAngleArr.push(angle) + + if (this.chartType === 'polarArea') { + sectorAngleArr[i] = this.fullAngle / series.length + this.sliceSizes.push((w.globals.radialSize * series[i]) / this.maxY) + } else { + this.sliceSizes.push(w.globals.radialSize) + } + } + + if (w.globals.dataChanged) { + let prevTotal = 0 + for (let k = 0; k < w.globals.previousPaths.length; k++) { + // CALCULATE THE PREV TOTAL + prevTotal += Utils.negToZero(w.globals.previousPaths[k]) + } + + let previousAngle + + for (let i = 0; i < w.globals.previousPaths.length; i++) { + // CALCULATE THE PREVIOUS ANGLES + previousAngle = + (this.fullAngle * Utils.negToZero(w.globals.previousPaths[i])) / + prevTotal + this.prevSectorAngleArr.push(previousAngle) + } + } + + // on small chart size after few count of resizes browser window donutSize can be negative + if (this.donutSize < 0) { + this.donutSize = 0 + } + + if (this.chartType === 'donut') { + // draw the inner circle and add some text to it + const circle = graphics.drawCircle(this.donutSize) + + circle.attr({ + cx: this.centerX, + cy: this.centerY, + fill: w.config.plotOptions.pie.donut.background + ? w.config.plotOptions.pie.donut.background + : 'transparent', + }) + + elSeries.add(circle) + } + + let elG = self.drawArcs(sectorAngleArr, series) + + // add slice dataLabels at the end + this.sliceLabels.forEach((s) => { + elG.add(s) + }) + + elSeries.attr({ + transform: `translate(${this.translateX}, ${this.translateY}) scale(${w.config.plotOptions.pie.customScale})`, + }) + + elSeries.add(elG) + + elPie.add(elSeries) + + if (this.donutDataLabels.show) { + let dataLabels = this.renderInnerDataLabels( + this.dataLabelsGroup, + this.donutDataLabels, + { + hollowSize: this.donutSize, + centerX: this.centerX, + centerY: this.centerY, + opacity: this.donutDataLabels.show, + } + ) + + elPie.add(dataLabels) + } + + if (w.config.grid.position === 'front' && this.chartType === 'polarArea') { + this.drawPolarElements(elPie) + } + + return elPie + } + + // core function for drawing pie arcs + drawArcs(sectorAngleArr, series) { + let w = this.w + const filters = new Filters(this.ctx) + + let graphics = new Graphics(this.ctx) + let fill = new Fill(this.ctx) + let g = graphics.group({ + class: 'apexcharts-slices', + }) + + let startAngle = this.initialAngle + let prevStartAngle = this.initialAngle + let endAngle = this.initialAngle + let prevEndAngle = this.initialAngle + + this.strokeWidth = w.config.stroke.show ? w.config.stroke.width : 0 + + for (let i = 0; i < sectorAngleArr.length; i++) { + let elPieArc = graphics.group({ + class: `apexcharts-series apexcharts-pie-series`, + seriesName: Utils.escapeString(w.globals.seriesNames[i]), + rel: i + 1, + 'data:realIndex': i, + }) + + g.add(elPieArc) + + startAngle = endAngle + prevStartAngle = prevEndAngle + + endAngle = startAngle + sectorAngleArr[i] + prevEndAngle = prevStartAngle + this.prevSectorAngleArr[i] + + const angle = + endAngle < startAngle + ? this.fullAngle + endAngle - startAngle + : endAngle - startAngle + + let pathFill = fill.fillPath({ + seriesNumber: i, + size: this.sliceSizes[i], + value: series[i], + }) // additionally, pass size for gradient drawing in the fillPath function + + let path = this.getChangedPath(prevStartAngle, prevEndAngle) + + let elPath = graphics.drawPath({ + d: path, + stroke: Array.isArray(this.lineColorArr) + ? this.lineColorArr[i] + : this.lineColorArr, + strokeWidth: 0, + fill: pathFill, + fillOpacity: w.config.fill.opacity, + classes: `apexcharts-pie-area apexcharts-${this.chartType.toLowerCase()}-slice-${i}`, + }) + + elPath.attr({ + index: 0, + j: i, + }) + + filters.setSelectionFilter(elPath, 0, i) + + if (w.config.chart.dropShadow.enabled) { + const shadow = w.config.chart.dropShadow + filters.dropShadow(elPath, shadow, i) + } + + this.addListeners(elPath, this.donutDataLabels) + + Graphics.setAttrs(elPath.node, { + 'data:angle': angle, + 'data:startAngle': startAngle, + 'data:strokeWidth': this.strokeWidth, + 'data:value': series[i], + }) + + let labelPosition = { + x: 0, + y: 0, + } + + if (this.chartType === 'pie' || this.chartType === 'polarArea') { + labelPosition = Utils.polarToCartesian( + this.centerX, + this.centerY, + w.globals.radialSize / 1.25 + + w.config.plotOptions.pie.dataLabels.offset, + (startAngle + angle / 2) % this.fullAngle + ) + } else if (this.chartType === 'donut') { + labelPosition = Utils.polarToCartesian( + this.centerX, + this.centerY, + (w.globals.radialSize + this.donutSize) / 2 + + w.config.plotOptions.pie.dataLabels.offset, + (startAngle + angle / 2) % this.fullAngle + ) + } + + elPieArc.add(elPath) + + // Animation code starts + let dur = 0 + if (this.initialAnim && !w.globals.resized && !w.globals.dataChanged) { + dur = (angle / this.fullAngle) * w.config.chart.animations.speed + + if (dur === 0) dur = 1 + this.animDur = dur + this.animDur + this.animBeginArr.push(this.animDur) + } else { + this.animBeginArr.push(0) + } + + if (this.dynamicAnim && w.globals.dataChanged) { + this.animatePaths(elPath, { + size: this.sliceSizes[i], + endAngle, + startAngle, + prevStartAngle, + prevEndAngle, + animateStartingPos: true, + i, + animBeginArr: this.animBeginArr, + shouldSetPrevPaths: true, + dur: w.config.chart.animations.dynamicAnimation.speed, + }) + } else { + this.animatePaths(elPath, { + size: this.sliceSizes[i], + endAngle, + startAngle, + i, + totalItems: sectorAngleArr.length - 1, + animBeginArr: this.animBeginArr, + dur, + }) + } + // animation code ends + + if ( + w.config.plotOptions.pie.expandOnClick && + this.chartType !== 'polarArea' + ) { + elPath.node.addEventListener('mouseup', this.pieClicked.bind(this, i)) + } + + if ( + typeof w.globals.selectedDataPoints[0] !== 'undefined' && + w.globals.selectedDataPoints[0].indexOf(i) > -1 + ) { + this.pieClicked(i) + } + + if (w.config.dataLabels.enabled) { + let xPos = labelPosition.x + let yPos = labelPosition.y + let text = (100 * angle) / this.fullAngle + '%' + + if ( + angle !== 0 && + w.config.plotOptions.pie.dataLabels.minAngleToShowLabel < + sectorAngleArr[i] + ) { + let formatter = w.config.dataLabels.formatter + if (formatter !== undefined) { + text = formatter(w.globals.seriesPercent[i][0], { + seriesIndex: i, + w, + }) + } + let foreColor = w.globals.dataLabels.style.colors[i] + + const elPieLabelWrap = graphics.group({ + class: `apexcharts-datalabels`, + }) + let elPieLabel = graphics.drawText({ + x: xPos, + y: yPos, + text, + textAnchor: 'middle', + fontSize: w.config.dataLabels.style.fontSize, + fontFamily: w.config.dataLabels.style.fontFamily, + fontWeight: w.config.dataLabels.style.fontWeight, + foreColor, + }) + + elPieLabelWrap.add(elPieLabel) + if (w.config.dataLabels.dropShadow.enabled) { + const textShadow = w.config.dataLabels.dropShadow + filters.dropShadow(elPieLabel, textShadow) + } + + elPieLabel.node.classList.add('apexcharts-pie-label') + if ( + w.config.chart.animations.animate && + w.globals.resized === false + ) { + elPieLabel.node.classList.add('apexcharts-pie-label-delay') + elPieLabel.node.style.animationDelay = + w.config.chart.animations.speed / 940 + 's' + } + + this.sliceLabels.push(elPieLabelWrap) + } + } + } + + return g + } + + addListeners(elPath, dataLabels) { + const graphics = new Graphics(this.ctx) + // append filters on mouseenter and mouseleave + elPath.node.addEventListener( + 'mouseenter', + graphics.pathMouseEnter.bind(this, elPath) + ) + + elPath.node.addEventListener( + 'mouseleave', + graphics.pathMouseLeave.bind(this, elPath) + ) + elPath.node.addEventListener( + 'mouseleave', + this.revertDataLabelsInner.bind(this, elPath.node, dataLabels) + ) + elPath.node.addEventListener( + 'mousedown', + graphics.pathMouseDown.bind(this, elPath) + ) + + if (!this.donutDataLabels.total.showAlways) { + elPath.node.addEventListener( + 'mouseenter', + this.printDataLabelsInner.bind(this, elPath.node, dataLabels) + ) + + elPath.node.addEventListener( + 'mousedown', + this.printDataLabelsInner.bind(this, elPath.node, dataLabels) + ) + } + } + + // This function can be used for other circle charts too + animatePaths(el, opts) { + let w = this.w + let me = this + + let angle = + opts.endAngle < opts.startAngle + ? this.fullAngle + opts.endAngle - opts.startAngle + : opts.endAngle - opts.startAngle + let prevAngle = angle + + let fromStartAngle = opts.startAngle + let toStartAngle = opts.startAngle + + if (opts.prevStartAngle !== undefined && opts.prevEndAngle !== undefined) { + fromStartAngle = opts.prevEndAngle + prevAngle = + opts.prevEndAngle < opts.prevStartAngle + ? this.fullAngle + opts.prevEndAngle - opts.prevStartAngle + : opts.prevEndAngle - opts.prevStartAngle + } + if (opts.i === w.config.series.length - 1) { + // some adjustments for the last overlapping paths + if (angle + toStartAngle > this.fullAngle) { + opts.endAngle = opts.endAngle - (angle + toStartAngle) + } else if (angle + toStartAngle < this.fullAngle) { + opts.endAngle = + opts.endAngle + (this.fullAngle - (angle + toStartAngle)) + } + } + + if (angle === this.fullAngle) angle = this.fullAngle - 0.01 + + me.animateArc(el, fromStartAngle, toStartAngle, angle, prevAngle, opts) + } + + animateArc(el, fromStartAngle, toStartAngle, angle, prevAngle, opts) { + let me = this + const w = this.w + const animations = new Animations(this.ctx) + + let size = opts.size + + let path + + if (isNaN(fromStartAngle) || isNaN(prevAngle)) { + fromStartAngle = toStartAngle + prevAngle = angle + opts.dur = 0 + } + + let currAngle = angle + let startAngle = toStartAngle + let fromAngle = + fromStartAngle < toStartAngle + ? this.fullAngle + fromStartAngle - toStartAngle + : fromStartAngle - toStartAngle + + if (w.globals.dataChanged && opts.shouldSetPrevPaths) { + // to avoid flicker when updating, set prev path first and then animate from there + if (opts.prevEndAngle) { + path = me.getPiePath({ + me, + startAngle: opts.prevStartAngle, + angle: + opts.prevEndAngle < opts.prevStartAngle + ? this.fullAngle + opts.prevEndAngle - opts.prevStartAngle + : opts.prevEndAngle - opts.prevStartAngle, + size, + }) + el.attr({ d: path }) + } + } + + if (opts.dur !== 0) { + el.animate(opts.dur, opts.animBeginArr[opts.i]) + .after(function () { + if ( + me.chartType === 'pie' || + me.chartType === 'donut' || + me.chartType === 'polarArea' + ) { + this.animate(w.config.chart.animations.dynamicAnimation.speed).attr( + { + 'stroke-width': me.strokeWidth, + } + ) + } + + if (opts.i === w.config.series.length - 1) { + animations.animationCompleted(el) + } + }) + .during((pos) => { + currAngle = fromAngle + (angle - fromAngle) * pos + if (opts.animateStartingPos) { + currAngle = prevAngle + (angle - prevAngle) * pos + startAngle = + fromStartAngle - + prevAngle + + (toStartAngle - (fromStartAngle - prevAngle)) * pos + } + + path = me.getPiePath({ + me, + startAngle, + angle: currAngle, + size, + }) + + el.node.setAttribute('data:pathOrig', path) + + el.attr({ + d: path, + }) + }) + } else { + path = me.getPiePath({ + me, + startAngle, + angle, + size, + }) + + if (!opts.isTrack) { + w.globals.animationEnded = true + } + el.node.setAttribute('data:pathOrig', path) + + el.attr({ + d: path, + 'stroke-width': me.strokeWidth, + }) + } + } + + pieClicked(i) { + let w = this.w + let me = this + let path + + let size = + me.sliceSizes[i] + (w.config.plotOptions.pie.expandOnClick ? 4 : 0) + let elPath = w.globals.dom.Paper.findOne( + `.apexcharts-${me.chartType.toLowerCase()}-slice-${i}` + ) + + if (elPath.attr('data:pieClicked') === 'true') { + elPath.attr({ + 'data:pieClicked': 'false', + }) + this.revertDataLabelsInner(elPath.node, this.donutDataLabels) + + let origPath = elPath.attr('data:pathOrig') + elPath.attr({ + d: origPath, + }) + return + } else { + // reset all elems + let allEls = w.globals.dom.baseEl.getElementsByClassName( + 'apexcharts-pie-area' + ) + Array.prototype.forEach.call(allEls, (pieSlice) => { + pieSlice.setAttribute('data:pieClicked', 'false') + let origPath = pieSlice.getAttribute('data:pathOrig') + if (origPath) { + pieSlice.setAttribute('d', origPath) + } + }) + w.globals.capturedDataPointIndex = i + + elPath.attr('data:pieClicked', 'true') + } + + let startAngle = parseInt(elPath.attr('data:startAngle'), 10) + let angle = parseInt(elPath.attr('data:angle'), 10) + + path = me.getPiePath({ + me, + startAngle, + angle, + size, + }) + + if (angle === 360) return + + elPath.plot(path) + } + + getChangedPath(prevStartAngle, prevEndAngle) { + let path = '' + if (this.dynamicAnim && this.w.globals.dataChanged) { + path = this.getPiePath({ + me: this, + startAngle: prevStartAngle, + angle: prevEndAngle - prevStartAngle, + size: this.size, + }) + } + return path + } + + getPiePath({ me, startAngle, angle, size }) { + let path + const graphics = new Graphics(this.ctx) + + let startDeg = startAngle + let startRadians = (Math.PI * (startDeg - 90)) / 180 + + let endDeg = angle + startAngle + // prevent overlap + if ( + Math.ceil(endDeg) >= + this.fullAngle + + (this.w.config.plotOptions.pie.startAngle % this.fullAngle) + ) { + endDeg = + this.fullAngle + + (this.w.config.plotOptions.pie.startAngle % this.fullAngle) - + 0.01 + } + if (Math.ceil(endDeg) > this.fullAngle) endDeg -= this.fullAngle + + let endRadians = (Math.PI * (endDeg - 90)) / 180 + + let x1 = me.centerX + size * Math.cos(startRadians) + let y1 = me.centerY + size * Math.sin(startRadians) + let x2 = me.centerX + size * Math.cos(endRadians) + let y2 = me.centerY + size * Math.sin(endRadians) + + let startInner = Utils.polarToCartesian( + me.centerX, + me.centerY, + me.donutSize, + endDeg + ) + let endInner = Utils.polarToCartesian( + me.centerX, + me.centerY, + me.donutSize, + startDeg + ) + + let largeArc = angle > 180 ? 1 : 0 + + const pathBeginning = ['M', x1, y1, 'A', size, size, 0, largeArc, 1, x2, y2] + + if (me.chartType === 'donut') { + path = [ + ...pathBeginning, + 'L', + startInner.x, + startInner.y, + 'A', + me.donutSize, + me.donutSize, + 0, + largeArc, + 0, + endInner.x, + endInner.y, + 'L', + x1, + y1, + 'z', + ].join(' ') + } else if (me.chartType === 'pie' || me.chartType === 'polarArea') { + path = [...pathBeginning, 'L', me.centerX, me.centerY, 'L', x1, y1].join( + ' ' + ) + } else { + path = [...pathBeginning].join(' ') + } + + return graphics.roundPathCorners(path, this.strokeWidth * 2) + } + + drawPolarElements(parent) { + const w = this.w + const scale = new Scales(this.ctx) + const graphics = new Graphics(this.ctx) + const helpers = new Helpers(this.ctx) + + const gCircles = graphics.group() + const gYAxis = graphics.group() + + const yScale = scale.niceScale(0, Math.ceil(this.maxY), 0) + + const yTexts = yScale.result.reverse() + let len = yScale.result.length + + this.maxY = yScale.niceMax + + let circleSize = w.globals.radialSize + let diff = circleSize / (len - 1) + + for (let i = 0; i < len - 1; i++) { + const circle = graphics.drawCircle(circleSize) + + circle.attr({ + cx: this.centerX, + cy: this.centerY, + fill: 'none', + 'stroke-width': w.config.plotOptions.polarArea.rings.strokeWidth, + stroke: w.config.plotOptions.polarArea.rings.strokeColor, + }) + + if (w.config.yaxis[0].show) { + const yLabel = helpers.drawYAxisTexts( + this.centerX, + this.centerY - + circleSize + + parseInt(w.config.yaxis[0].labels.style.fontSize, 10) / 2, + i, + yTexts[i] + ) + + gYAxis.add(yLabel) + } + + gCircles.add(circle) + + circleSize = circleSize - diff + } + + this.drawSpokes(parent) + + parent.add(gCircles) + parent.add(gYAxis) + } + + renderInnerDataLabels(dataLabelsGroup, dataLabelsConfig, opts) { + let w = this.w + const graphics = new Graphics(this.ctx) + + const showTotal = dataLabelsConfig.total.show + + dataLabelsGroup.node.innerHTML = '' + dataLabelsGroup.node.style.opacity = opts.opacity + + let x = opts.centerX + let y = !this.donutDataLabels.total.label + ? opts.centerY - opts.centerY / 6 + : opts.centerY + + let labelColor, valueColor + + if (dataLabelsConfig.name.color === undefined) { + labelColor = w.globals.colors[0] + } else { + labelColor = dataLabelsConfig.name.color + } + let labelFontSize = dataLabelsConfig.name.fontSize + let labelFontFamily = dataLabelsConfig.name.fontFamily + let labelFontWeight = dataLabelsConfig.name.fontWeight + + if (dataLabelsConfig.value.color === undefined) { + valueColor = w.config.chart.foreColor + } else { + valueColor = dataLabelsConfig.value.color + } + + let lbFormatter = dataLabelsConfig.value.formatter + let val = '' + let name = '' + + if (showTotal) { + labelColor = dataLabelsConfig.total.color + labelFontSize = dataLabelsConfig.total.fontSize + labelFontFamily = dataLabelsConfig.total.fontFamily + labelFontWeight = dataLabelsConfig.total.fontWeight + name = !this.donutDataLabels.total.label + ? '' + : dataLabelsConfig.total.label + val = dataLabelsConfig.total.formatter(w) + } else { + if (w.globals.series.length === 1) { + val = lbFormatter(w.globals.series[0], w) + name = w.globals.seriesNames[0] + } + } + + if (name) { + name = dataLabelsConfig.name.formatter( + name, + dataLabelsConfig.total.show, + w + ) + } + + if (dataLabelsConfig.name.show) { + let elLabel = graphics.drawText({ + x, + y: y + parseFloat(dataLabelsConfig.name.offsetY), + text: name, + textAnchor: 'middle', + foreColor: labelColor, + fontSize: labelFontSize, + fontWeight: labelFontWeight, + fontFamily: labelFontFamily, + }) + elLabel.node.classList.add('apexcharts-datalabel-label') + dataLabelsGroup.add(elLabel) + } + + if (dataLabelsConfig.value.show) { + let valOffset = dataLabelsConfig.name.show + ? parseFloat(dataLabelsConfig.value.offsetY) + 16 + : dataLabelsConfig.value.offsetY + + let elValue = graphics.drawText({ + x, + y: y + valOffset, + text: val, + textAnchor: 'middle', + foreColor: valueColor, + fontWeight: dataLabelsConfig.value.fontWeight, + fontSize: dataLabelsConfig.value.fontSize, + fontFamily: dataLabelsConfig.value.fontFamily, + }) + elValue.node.classList.add('apexcharts-datalabel-value') + dataLabelsGroup.add(elValue) + } + + // for a multi-series circle chart, we need to show total value instead of first series labels + + return dataLabelsGroup + } + + /** + * + * @param {string} name - The name of the series + * @param {string} val - The value of that series + * @param {object} el - Optional el (indicates which series was hovered/clicked). If this param is not present, means we need to show total + */ + printInnerLabels(labelsConfig, name, val, el) { + const w = this.w + + let labelColor + + if (el) { + if (labelsConfig.name.color === undefined) { + labelColor = + w.globals.colors[parseInt(el.parentNode.getAttribute('rel'), 10) - 1] + } else { + labelColor = labelsConfig.name.color + } + } else { + if (w.globals.series.length > 1 && labelsConfig.total.show) { + labelColor = labelsConfig.total.color + } + } + + let elLabel = w.globals.dom.baseEl.querySelector( + '.apexcharts-datalabel-label' + ) + let elValue = w.globals.dom.baseEl.querySelector( + '.apexcharts-datalabel-value' + ) + + let lbFormatter = labelsConfig.value.formatter + val = lbFormatter(val, w) + + // we need to show Total Val - so get the formatter of it + if (!el && typeof labelsConfig.total.formatter === 'function') { + val = labelsConfig.total.formatter(w) + } + + const isTotal = name === labelsConfig.total.label + name = !this.donutDataLabels.total.label + ? '' + : labelsConfig.name.formatter(name, isTotal, w) + + if (elLabel !== null) { + elLabel.textContent = name + } + + if (elValue !== null) { + elValue.textContent = val + } + if (elLabel !== null) { + elLabel.style.fill = labelColor + } + } + + printDataLabelsInner(el, dataLabelsConfig) { + let w = this.w + + let val = el.getAttribute('data:value') + let name = + w.globals.seriesNames[parseInt(el.parentNode.getAttribute('rel'), 10) - 1] + + if (w.globals.series.length > 1) { + this.printInnerLabels(dataLabelsConfig, name, val, el) + } + + let dataLabelsGroup = w.globals.dom.baseEl.querySelector( + '.apexcharts-datalabels-group' + ) + if (dataLabelsGroup !== null) { + dataLabelsGroup.style.opacity = 1 + } + } + + drawSpokes(parent) { + const w = this.w + const graphics = new Graphics(this.ctx) + const spokeConfig = w.config.plotOptions.polarArea.spokes + + if (spokeConfig.strokeWidth === 0) return + + let spokes = [] + + let angleDivision = 360 / w.globals.series.length + for (let i = 0; i < w.globals.series.length; i++) { + spokes.push( + Utils.polarToCartesian( + this.centerX, + this.centerY, + w.globals.radialSize, + w.config.plotOptions.pie.startAngle + angleDivision * i + ) + ) + } + + spokes.forEach((p, i) => { + const line = graphics.drawLine( + p.x, + p.y, + this.centerX, + this.centerY, + Array.isArray(spokeConfig.connectorColors) + ? spokeConfig.connectorColors[i] + : spokeConfig.connectorColors + ) + + parent.add(line) + }) + } + + revertDataLabelsInner() { + const w = this.w + if (this.donutDataLabels.show) { + let dataLabelsGroup = w.globals.dom.Paper.findOne( + `.apexcharts-datalabels-group` + ) + + let dataLabels = this.renderInnerDataLabels( + dataLabelsGroup, + this.donutDataLabels, + { + hollowSize: this.donutSize, + centerX: this.centerX, + centerY: this.centerY, + opacity: this.donutDataLabels.show, + } + ) + + let elPie = w.globals.dom.Paper.findOne( + '.apexcharts-radialbar, .apexcharts-pie' + ) + elPie.add(dataLabels) + } + } +} + +export default Pie diff --git a/node_modules/apexcharts/src/charts/Radar.js b/node_modules/apexcharts/src/charts/Radar.js new file mode 100644 index 0000000..6afb01b --- /dev/null +++ b/node_modules/apexcharts/src/charts/Radar.js @@ -0,0 +1,536 @@ +import Fill from '../modules/Fill' +import Graphics from '../modules/Graphics' +import Markers from '../modules/Markers' +import DataLabels from '../modules/DataLabels' +import Filters from '../modules/Filters' +import Utils from '../utils/Utils' +import Helpers from './common/circle/Helpers' +import CoreUtils from '../modules/CoreUtils' + +/** + * ApexCharts Radar Class for Spider/Radar Charts. + * @module Radar + **/ + +class Radar { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + + this.chartType = this.w.config.chart.type + + this.initialAnim = this.w.config.chart.animations.enabled + this.dynamicAnim = + this.initialAnim && + this.w.config.chart.animations.dynamicAnimation.enabled + + this.animDur = 0 + + const w = this.w + this.graphics = new Graphics(this.ctx) + + this.lineColorArr = + w.globals.stroke.colors !== undefined + ? w.globals.stroke.colors + : w.globals.colors + + this.defaultSize = + w.globals.svgHeight < w.globals.svgWidth + ? w.globals.gridHeight + : w.globals.gridWidth + + this.isLog = w.config.yaxis[0].logarithmic + this.logBase = w.config.yaxis[0].logBase + + this.coreUtils = new CoreUtils(this.ctx) + this.maxValue = this.isLog + ? this.coreUtils.getLogVal(this.logBase, w.globals.maxY, 0) + : w.globals.maxY + this.minValue = this.isLog + ? this.coreUtils.getLogVal(this.logBase, this.w.globals.minY, 0) + : w.globals.minY + + this.polygons = w.config.plotOptions.radar.polygons + + this.strokeWidth = w.config.stroke.show ? w.config.stroke.width : 0 + + this.size = + this.defaultSize / 2.1 - this.strokeWidth - w.config.chart.dropShadow.blur + + if (w.config.xaxis.labels.show) { + this.size = this.size - w.globals.xAxisLabelsWidth / 1.75 + } + + if (w.config.plotOptions.radar.size !== undefined) { + this.size = w.config.plotOptions.radar.size + } + + this.dataRadiusOfPercent = [] + this.dataRadius = [] + this.angleArr = [] + + this.yaxisLabelsTextsPos = [] + } + + draw(series) { + let w = this.w + const fill = new Fill(this.ctx) + + const allSeries = [] + const dataLabels = new DataLabels(this.ctx) + + if (series.length) { + this.dataPointsLen = series[w.globals.maxValsInArrayIndex].length + } + this.disAngle = (Math.PI * 2) / this.dataPointsLen + + let halfW = w.globals.gridWidth / 2 + let halfH = w.globals.gridHeight / 2 + let translateX = halfW + w.config.plotOptions.radar.offsetX + let translateY = halfH + w.config.plotOptions.radar.offsetY + + let ret = this.graphics.group({ + class: 'apexcharts-radar-series apexcharts-plot-series', + transform: `translate(${translateX || 0}, ${translateY || 0})`, + }) + + let dataPointsPos = [] + let elPointsMain = null + let elDataPointsMain = null + + this.yaxisLabels = this.graphics.group({ + class: 'apexcharts-yaxis', + }) + + series.forEach((s, i) => { + let longestSeries = s.length === w.globals.dataPoints + + // el to which series will be drawn + let elSeries = this.graphics.group().attr({ + class: `apexcharts-series`, + 'data:longestSeries': longestSeries, + seriesName: Utils.escapeString(w.globals.seriesNames[i]), + rel: i + 1, + 'data:realIndex': i, + }) + + this.dataRadiusOfPercent[i] = [] + this.dataRadius[i] = [] + this.angleArr[i] = [] + + s.forEach((dv, j) => { + const range = Math.abs(this.maxValue - this.minValue) + dv = dv - this.minValue + + if (this.isLog) { + dv = this.coreUtils.getLogVal(this.logBase, dv, 0) + } + + this.dataRadiusOfPercent[i][j] = dv / range + + this.dataRadius[i][j] = this.dataRadiusOfPercent[i][j] * this.size + this.angleArr[i][j] = j * this.disAngle + }) + + dataPointsPos = this.getDataPointsPos( + this.dataRadius[i], + this.angleArr[i] + ) + const paths = this.createPaths(dataPointsPos, { + x: 0, + y: 0, + }) + + // points + elPointsMain = this.graphics.group({ + class: 'apexcharts-series-markers-wrap apexcharts-element-hidden', + }) + + // datapoints + elDataPointsMain = this.graphics.group({ + class: `apexcharts-datalabels`, + 'data:realIndex': i, + }) + + w.globals.delayedElements.push({ + el: elPointsMain.node, + index: i, + }) + + const defaultRenderedPathOptions = { + i, + realIndex: i, + animationDelay: i, + initialSpeed: w.config.chart.animations.speed, + dataChangeSpeed: w.config.chart.animations.dynamicAnimation.speed, + className: `apexcharts-radar`, + shouldClipToGrid: false, + bindEventsOnPaths: false, + stroke: w.globals.stroke.colors[i], + strokeLineCap: w.config.stroke.lineCap, + } + + let pathFrom = null + + if (w.globals.previousPaths.length > 0) { + pathFrom = this.getPreviousPath(i) + } + + for (let p = 0; p < paths.linePathsTo.length; p++) { + let renderedLinePath = this.graphics.renderPaths({ + ...defaultRenderedPathOptions, + pathFrom: pathFrom === null ? paths.linePathsFrom[p] : pathFrom, + pathTo: paths.linePathsTo[p], + strokeWidth: Array.isArray(this.strokeWidth) + ? this.strokeWidth[i] + : this.strokeWidth, + fill: 'none', + drawShadow: false, + }) + + elSeries.add(renderedLinePath) + + let pathFill = fill.fillPath({ + seriesNumber: i, + }) + + let renderedAreaPath = this.graphics.renderPaths({ + ...defaultRenderedPathOptions, + pathFrom: pathFrom === null ? paths.areaPathsFrom[p] : pathFrom, + pathTo: paths.areaPathsTo[p], + strokeWidth: 0, + fill: pathFill, + drawShadow: false, + }) + + if (w.config.chart.dropShadow.enabled) { + const filters = new Filters(this.ctx) + + const shadow = w.config.chart.dropShadow + filters.dropShadow( + renderedAreaPath, + Object.assign({}, shadow, { noUserSpaceOnUse: true }), + i + ) + } + + elSeries.add(renderedAreaPath) + } + + s.forEach((sj, j) => { + let markers = new Markers(this.ctx) + + let opts = markers.getMarkerConfig({ + cssClass: 'apexcharts-marker', + seriesIndex: i, + dataPointIndex: j, + }) + + let point = this.graphics.drawMarker( + dataPointsPos[j].x, + dataPointsPos[j].y, + opts + ) + + point.attr('rel', j) + point.attr('j', j) + point.attr('index', i) + point.node.setAttribute('default-marker-size', opts.pSize) + + let elPointsWrap = this.graphics.group({ + class: 'apexcharts-series-markers', + }) + + if (elPointsWrap) { + elPointsWrap.add(point) + } + + elPointsMain.add(elPointsWrap) + + elSeries.add(elPointsMain) + + const dataLabelsConfig = w.config.dataLabels + + if (dataLabelsConfig.enabled) { + let text = dataLabelsConfig.formatter(w.globals.series[i][j], { + seriesIndex: i, + dataPointIndex: j, + w, + }) + + dataLabels.plotDataLabelsText({ + x: dataPointsPos[j].x, + y: dataPointsPos[j].y, + text, + textAnchor: 'middle', + i, + j: i, + parent: elDataPointsMain, + offsetCorrection: false, + dataLabelsConfig: { + ...dataLabelsConfig, + }, + }) + } + elSeries.add(elDataPointsMain) + }) + + allSeries.push(elSeries) + }) + + this.drawPolygons({ + parent: ret, + }) + + if (w.config.xaxis.labels.show) { + const xaxisTexts = this.drawXAxisTexts() + ret.add(xaxisTexts) + } + + allSeries.forEach((elS) => { + ret.add(elS) + }) + + ret.add(this.yaxisLabels) + + return ret + } + + drawPolygons(opts) { + const w = this.w + const { parent } = opts + const helpers = new Helpers(this.ctx) + + const yaxisTexts = w.globals.yAxisScale[0].result.reverse() + const layers = yaxisTexts.length + + let radiusSizes = [] + let layerDis = this.size / (layers - 1) + for (let i = 0; i < layers; i++) { + radiusSizes[i] = layerDis * i + } + radiusSizes.reverse() + + let polygonStrings = [] + let lines = [] + + radiusSizes.forEach((radiusSize, r) => { + const polygon = Utils.getPolygonPos(radiusSize, this.dataPointsLen) + let string = '' + + polygon.forEach((p, i) => { + if (r === 0) { + const line = this.graphics.drawLine( + p.x, + p.y, + 0, + 0, + Array.isArray(this.polygons.connectorColors) + ? this.polygons.connectorColors[i] + : this.polygons.connectorColors + ) + + lines.push(line) + } + + if (i === 0) { + this.yaxisLabelsTextsPos.push({ + x: p.x, + y: p.y, + }) + } + + string += p.x + ',' + p.y + ' ' + }) + + polygonStrings.push(string) + }) + + polygonStrings.forEach((p, i) => { + const strokeColors = this.polygons.strokeColors + const strokeWidth = this.polygons.strokeWidth + const polygon = this.graphics.drawPolygon( + p, + Array.isArray(strokeColors) ? strokeColors[i] : strokeColors, + Array.isArray(strokeWidth) ? strokeWidth[i] : strokeWidth, + w.globals.radarPolygons.fill.colors[i] + ) + parent.add(polygon) + }) + + lines.forEach((l) => { + parent.add(l) + }) + + if (w.config.yaxis[0].show) { + this.yaxisLabelsTextsPos.forEach((p, i) => { + const yText = helpers.drawYAxisTexts(p.x, p.y, i, yaxisTexts[i]) + this.yaxisLabels.add(yText) + }) + } + } + + drawXAxisTexts() { + const w = this.w + + const xaxisLabelsConfig = w.config.xaxis.labels + let elXAxisWrap = this.graphics.group({ + class: 'apexcharts-xaxis', + }) + + let polygonPos = Utils.getPolygonPos(this.size, this.dataPointsLen) + + w.globals.labels.forEach((label, i) => { + let formatter = w.config.xaxis.labels.formatter + let dataLabels = new DataLabels(this.ctx) + + if (polygonPos[i]) { + let textPos = this.getTextPos(polygonPos[i], this.size) + + let text = formatter(label, { + seriesIndex: -1, + dataPointIndex: i, + w, + }) + + const dataLabelText = dataLabels.plotDataLabelsText({ + x: textPos.newX, + y: textPos.newY, + text, + textAnchor: textPos.textAnchor, + i, + j: i, + parent: elXAxisWrap, + className: 'apexcharts-xaxis-label', + color: + Array.isArray(xaxisLabelsConfig.style.colors) && + xaxisLabelsConfig.style.colors[i] + ? xaxisLabelsConfig.style.colors[i] + : '#a8a8a8', + dataLabelsConfig: { + textAnchor: textPos.textAnchor, + dropShadow: { enabled: false }, + ...xaxisLabelsConfig, + }, + offsetCorrection: false, + }) + + dataLabelText.on('click', (e) => { + if (typeof w.config.chart.events.xAxisLabelClick === 'function') { + const opts = Object.assign({}, w, { + labelIndex: i, + }) + + w.config.chart.events.xAxisLabelClick(e, this.ctx, opts) + } + }) + } + }) + + return elXAxisWrap + } + + createPaths(pos, origin) { + let linePathsTo = [] + let linePathsFrom = [] + let areaPathsTo = [] + let areaPathsFrom = [] + + if (pos.length) { + linePathsFrom = [this.graphics.move(origin.x, origin.y)] + areaPathsFrom = [this.graphics.move(origin.x, origin.y)] + + let linePathTo = this.graphics.move(pos[0].x, pos[0].y) + let areaPathTo = this.graphics.move(pos[0].x, pos[0].y) + + pos.forEach((p, i) => { + linePathTo += this.graphics.line(p.x, p.y) + areaPathTo += this.graphics.line(p.x, p.y) + if (i === pos.length - 1) { + linePathTo += 'Z' + areaPathTo += 'Z' + } + }) + + linePathsTo.push(linePathTo) + areaPathsTo.push(areaPathTo) + } + + return { + linePathsFrom, + linePathsTo, + areaPathsFrom, + areaPathsTo, + } + } + + getTextPos(pos, polygonSize) { + let limit = 10 + let textAnchor = 'middle' + + let newX = pos.x + let newY = pos.y + + if (Math.abs(pos.x) >= limit) { + if (pos.x > 0) { + textAnchor = 'start' + newX += 10 + } else if (pos.x < 0) { + textAnchor = 'end' + newX -= 10 + } + } else { + textAnchor = 'middle' + } + if (Math.abs(pos.y) >= polygonSize - limit) { + if (pos.y < 0) { + newY -= 10 + } else if (pos.y > 0) { + newY += 10 + } + } + + return { + textAnchor, + newX, + newY, + } + } + + getPreviousPath(realIndex) { + let w = this.w + let pathFrom = null + for (let pp = 0; pp < w.globals.previousPaths.length; pp++) { + let gpp = w.globals.previousPaths[pp] + + if ( + gpp.paths.length > 0 && + parseInt(gpp.realIndex, 10) === parseInt(realIndex, 10) + ) { + if (typeof w.globals.previousPaths[pp].paths[0] !== 'undefined') { + pathFrom = w.globals.previousPaths[pp].paths[0].d + } + } + } + return pathFrom + } + + getDataPointsPos( + dataRadiusArr, + angleArr, + dataPointsLen = this.dataPointsLen + ) { + dataRadiusArr = dataRadiusArr || [] + angleArr = angleArr || [] + let dataPointsPosArray = [] + for (let j = 0; j < dataPointsLen; j++) { + let curPointPos = {} + curPointPos.x = dataRadiusArr[j] * Math.sin(angleArr[j]) + curPointPos.y = -dataRadiusArr[j] * Math.cos(angleArr[j]) + dataPointsPosArray.push(curPointPos) + } + return dataPointsPosArray + } +} + +export default Radar diff --git a/node_modules/apexcharts/src/charts/Radial.js b/node_modules/apexcharts/src/charts/Radial.js new file mode 100644 index 0000000..4d39686 --- /dev/null +++ b/node_modules/apexcharts/src/charts/Radial.js @@ -0,0 +1,539 @@ +import Pie from './Pie' +import Utils from '../utils/Utils' +import Fill from '../modules/Fill' +import Graphics from '../modules/Graphics' +import Filters from '../modules/Filters' + +/** + * ApexCharts Radial Class for drawing Circle / Semi Circle Charts. + * @module Radial + **/ + +class Radial extends Pie { + constructor(ctx) { + super(ctx) + + this.ctx = ctx + this.w = ctx.w + this.animBeginArr = [0] + this.animDur = 0 + + const w = this.w + this.startAngle = w.config.plotOptions.radialBar.startAngle + this.endAngle = w.config.plotOptions.radialBar.endAngle + + this.totalAngle = Math.abs( + w.config.plotOptions.radialBar.endAngle - + w.config.plotOptions.radialBar.startAngle + ) + + this.trackStartAngle = w.config.plotOptions.radialBar.track.startAngle + this.trackEndAngle = w.config.plotOptions.radialBar.track.endAngle + + this.barLabels = this.w.config.plotOptions.radialBar.barLabels + + this.donutDataLabels = this.w.config.plotOptions.radialBar.dataLabels + this.radialDataLabels = this.donutDataLabels // make a copy for easy reference + + if (!this.trackStartAngle) this.trackStartAngle = this.startAngle + if (!this.trackEndAngle) this.trackEndAngle = this.endAngle + + if (this.endAngle === 360) this.endAngle = 359.99 + + this.margin = parseInt(w.config.plotOptions.radialBar.track.margin, 10) + this.onBarLabelClick = this.onBarLabelClick.bind(this) + } + + draw(series) { + let w = this.w + const graphics = new Graphics(this.ctx) + + let ret = graphics.group({ + class: 'apexcharts-radialbar', + }) + + if (w.globals.noData) return ret + + let elSeries = graphics.group() + + let centerY = this.defaultSize / 2 + let centerX = w.globals.gridWidth / 2 + + let size = this.defaultSize / 2.05 + if (!w.config.chart.sparkline.enabled) { + size = size - w.config.stroke.width - w.config.chart.dropShadow.blur + } + let colorArr = w.globals.fill.colors + + if (w.config.plotOptions.radialBar.track.show) { + let elTracks = this.drawTracks({ + size, + centerX, + centerY, + colorArr, + series, + }) + elSeries.add(elTracks) + } + + let elG = this.drawArcs({ + size, + centerX, + centerY, + colorArr, + series, + }) + + let totalAngle = 360 + + if (w.config.plotOptions.radialBar.startAngle < 0) { + totalAngle = this.totalAngle + } + + let angleRatio = (360 - totalAngle) / 360 + w.globals.radialSize = size - size * angleRatio + + if (this.radialDataLabels.value.show) { + let offset = Math.max( + this.radialDataLabels.value.offsetY, + this.radialDataLabels.name.offsetY + ) + w.globals.radialSize += offset * angleRatio + } + + elSeries.add(elG.g) + + if (w.config.plotOptions.radialBar.hollow.position === 'front') { + elG.g.add(elG.elHollow) + if (elG.dataLabels) { + elG.g.add(elG.dataLabels) + } + } + + ret.add(elSeries) + + return ret + } + + drawTracks(opts) { + let w = this.w + const graphics = new Graphics(this.ctx) + + let g = graphics.group({ + class: 'apexcharts-tracks', + }) + + let filters = new Filters(this.ctx) + let fill = new Fill(this.ctx) + + let strokeWidth = this.getStrokeWidth(opts) + + opts.size = opts.size - strokeWidth / 2 + + for (let i = 0; i < opts.series.length; i++) { + let elRadialBarTrack = graphics.group({ + class: 'apexcharts-radialbar-track apexcharts-track', + }) + g.add(elRadialBarTrack) + + elRadialBarTrack.attr({ + rel: i + 1, + }) + + opts.size = opts.size - strokeWidth - this.margin + + const trackConfig = w.config.plotOptions.radialBar.track + let pathFill = fill.fillPath({ + seriesNumber: 0, + size: opts.size, + fillColors: Array.isArray(trackConfig.background) + ? trackConfig.background[i] + : trackConfig.background, + solid: true, + }) + + let startAngle = this.trackStartAngle + let endAngle = this.trackEndAngle + + if (Math.abs(endAngle) + Math.abs(startAngle) >= 360) + endAngle = 360 - Math.abs(this.startAngle) - 0.1 + + let elPath = graphics.drawPath({ + d: '', + stroke: pathFill, + strokeWidth: + (strokeWidth * parseInt(trackConfig.strokeWidth, 10)) / 100, + fill: 'none', + strokeOpacity: trackConfig.opacity, + classes: 'apexcharts-radialbar-area', + }) + + if (trackConfig.dropShadow.enabled) { + const shadow = trackConfig.dropShadow + filters.dropShadow(elPath, shadow) + } + + elRadialBarTrack.add(elPath) + + elPath.attr('id', 'apexcharts-radialbarTrack-' + i) + + this.animatePaths(elPath, { + centerX: opts.centerX, + centerY: opts.centerY, + endAngle, + startAngle, + size: opts.size, + i, + totalItems: 2, + animBeginArr: 0, + dur: 0, + isTrack: true, + }) + } + + return g + } + + drawArcs(opts) { + let w = this.w + // size, donutSize, centerX, centerY, colorArr, lineColorArr, sectorAngleArr, series + + let graphics = new Graphics(this.ctx) + let fill = new Fill(this.ctx) + let filters = new Filters(this.ctx) + let g = graphics.group() + + let strokeWidth = this.getStrokeWidth(opts) + opts.size = opts.size - strokeWidth / 2 + + let hollowFillID = w.config.plotOptions.radialBar.hollow.background + let hollowSize = + opts.size - + strokeWidth * opts.series.length - + this.margin * opts.series.length - + (strokeWidth * + parseInt(w.config.plotOptions.radialBar.track.strokeWidth, 10)) / + 100 / + 2 + + let hollowRadius = hollowSize - w.config.plotOptions.radialBar.hollow.margin + + if (w.config.plotOptions.radialBar.hollow.image !== undefined) { + hollowFillID = this.drawHollowImage(opts, g, hollowSize, hollowFillID) + } + + let elHollow = this.drawHollow({ + size: hollowRadius, + centerX: opts.centerX, + centerY: opts.centerY, + fill: hollowFillID ? hollowFillID : 'transparent', + }) + + if (w.config.plotOptions.radialBar.hollow.dropShadow.enabled) { + const shadow = w.config.plotOptions.radialBar.hollow.dropShadow + filters.dropShadow(elHollow, shadow) + } + + let shown = 1 + if (!this.radialDataLabels.total.show && w.globals.series.length > 1) { + shown = 0 + } + + let dataLabels = null + + if (this.radialDataLabels.show) { + let dataLabelsGroup = w.globals.dom.Paper.findOne( + `.apexcharts-datalabels-group` + ) + + dataLabels = this.renderInnerDataLabels( + dataLabelsGroup, + this.radialDataLabels, + { + hollowSize, + centerX: opts.centerX, + centerY: opts.centerY, + opacity: shown, + } + ) + } + + if (w.config.plotOptions.radialBar.hollow.position === 'back') { + g.add(elHollow) + if (dataLabels) { + g.add(dataLabels) + } + } + + let reverseLoop = false + if (w.config.plotOptions.radialBar.inverseOrder) { + reverseLoop = true + } + + for ( + let i = reverseLoop ? opts.series.length - 1 : 0; + reverseLoop ? i >= 0 : i < opts.series.length; + reverseLoop ? i-- : i++ + ) { + let elRadialBarArc = graphics.group({ + class: `apexcharts-series apexcharts-radial-series`, + seriesName: Utils.escapeString(w.globals.seriesNames[i]), + }) + g.add(elRadialBarArc) + + elRadialBarArc.attr({ + rel: i + 1, + 'data:realIndex': i, + }) + + this.ctx.series.addCollapsedClassToSeries(elRadialBarArc, i) + + opts.size = opts.size - strokeWidth - this.margin + + let pathFill = fill.fillPath({ + seriesNumber: i, + size: opts.size, + value: opts.series[i], + }) + + let startAngle = this.startAngle + let prevStartAngle + + // if data exceeds 100, make it 100 + const dataValue = + Utils.negToZero(opts.series[i] > 100 ? 100 : opts.series[i]) / 100 + + let endAngle = Math.round(this.totalAngle * dataValue) + this.startAngle + + let prevEndAngle + if (w.globals.dataChanged) { + prevStartAngle = this.startAngle + prevEndAngle = + Math.round( + (this.totalAngle * Utils.negToZero(w.globals.previousPaths[i])) / + 100 + ) + prevStartAngle + } + + const currFullAngle = Math.abs(endAngle) + Math.abs(startAngle) + if (currFullAngle > 360) { + endAngle = endAngle - 0.01 + } + + const prevFullAngle = Math.abs(prevEndAngle) + Math.abs(prevStartAngle) + if (prevFullAngle > 360) { + prevEndAngle = prevEndAngle - 0.01 + } + + let angle = endAngle - startAngle + + const dashArray = Array.isArray(w.config.stroke.dashArray) + ? w.config.stroke.dashArray[i] + : w.config.stroke.dashArray + + let elPath = graphics.drawPath({ + d: '', + stroke: pathFill, + strokeWidth, + fill: 'none', + fillOpacity: w.config.fill.opacity, + classes: 'apexcharts-radialbar-area apexcharts-radialbar-slice-' + i, + strokeDashArray: dashArray, + }) + + Graphics.setAttrs(elPath.node, { + 'data:angle': angle, + 'data:value': opts.series[i], + }) + + if (w.config.chart.dropShadow.enabled) { + const shadow = w.config.chart.dropShadow + filters.dropShadow(elPath, shadow, i) + } + filters.setSelectionFilter(elPath, 0, i) + + this.addListeners(elPath, this.radialDataLabels) + + elRadialBarArc.add(elPath) + + elPath.attr({ + index: 0, + j: i, + }) + + if (this.barLabels.enabled) { + let barStartCords = Utils.polarToCartesian( + opts.centerX, + opts.centerY, + opts.size, + startAngle + ) + let text = this.barLabels.formatter(w.globals.seriesNames[i], { + seriesIndex: i, + w, + }) + let classes = ['apexcharts-radialbar-label'] + if (!this.barLabels.onClick) { + classes.push('apexcharts-no-click') + } + + let textColor = this.barLabels.useSeriesColors + ? w.globals.colors[i] + : w.config.chart.foreColor + + if (!textColor) { + textColor = w.config.chart.foreColor + } + + const x = barStartCords.x + this.barLabels.offsetX + const y = barStartCords.y + this.barLabels.offsetY + let elText = graphics.drawText({ + x, + y, + text, + textAnchor: 'end', + dominantBaseline: 'middle', + fontFamily: this.barLabels.fontFamily, + fontWeight: this.barLabels.fontWeight, + fontSize: this.barLabels.fontSize, + foreColor: textColor, + cssClass: classes.join(' '), + }) + + elText.on('click', this.onBarLabelClick) + + elText.attr({ + rel: i + 1, + }) + + if (startAngle !== 0) { + elText.attr({ + 'transform-origin': `${x} ${y}`, + transform: `rotate(${startAngle} 0 0)`, + }) + } + + elRadialBarArc.add(elText) + } + + let dur = 0 + if (this.initialAnim && !w.globals.resized && !w.globals.dataChanged) { + dur = w.config.chart.animations.speed + } + + if (w.globals.dataChanged) { + dur = w.config.chart.animations.dynamicAnimation.speed + } + this.animDur = dur / (opts.series.length * 1.2) + this.animDur + this.animBeginArr.push(this.animDur) + + this.animatePaths(elPath, { + centerX: opts.centerX, + centerY: opts.centerY, + endAngle, + startAngle, + prevEndAngle, + prevStartAngle, + size: opts.size, + i, + totalItems: 2, + animBeginArr: this.animBeginArr, + dur, + shouldSetPrevPaths: true, + }) + } + + return { + g, + elHollow, + dataLabels, + } + } + + drawHollow(opts) { + const graphics = new Graphics(this.ctx) + + let circle = graphics.drawCircle(opts.size * 2) + + circle.attr({ + class: 'apexcharts-radialbar-hollow', + cx: opts.centerX, + cy: opts.centerY, + r: opts.size, + fill: opts.fill, + }) + + return circle + } + + drawHollowImage(opts, g, hollowSize, hollowFillID) { + const w = this.w + let fill = new Fill(this.ctx) + + let randID = Utils.randomId() + let hollowFillImg = w.config.plotOptions.radialBar.hollow.image + + if (w.config.plotOptions.radialBar.hollow.imageClipped) { + fill.clippedImgArea({ + width: hollowSize, + height: hollowSize, + image: hollowFillImg, + patternID: `pattern${w.globals.cuid}${randID}`, + }) + hollowFillID = `url(#pattern${w.globals.cuid}${randID})` + } else { + const imgWidth = w.config.plotOptions.radialBar.hollow.imageWidth + const imgHeight = w.config.plotOptions.radialBar.hollow.imageHeight + if (imgWidth === undefined && imgHeight === undefined) { + let image = w.globals.dom.Paper.image(hollowFillImg, function (loader) { + this.move( + opts.centerX - + loader.width / 2 + + w.config.plotOptions.radialBar.hollow.imageOffsetX, + opts.centerY - + loader.height / 2 + + w.config.plotOptions.radialBar.hollow.imageOffsetY + ) + }) + g.add(image) + } else { + let image = w.globals.dom.Paper.image(hollowFillImg, function (loader) { + this.move( + opts.centerX - + imgWidth / 2 + + w.config.plotOptions.radialBar.hollow.imageOffsetX, + opts.centerY - + imgHeight / 2 + + w.config.plotOptions.radialBar.hollow.imageOffsetY + ) + this.size(imgWidth, imgHeight) + }) + g.add(image) + } + } + return hollowFillID + } + + getStrokeWidth(opts) { + const w = this.w + return ( + (opts.size * + (100 - parseInt(w.config.plotOptions.radialBar.hollow.size, 10))) / + 100 / + (opts.series.length + 1) - + this.margin + ) + } + + onBarLabelClick(e) { + let seriesIndex = parseInt(e.target.getAttribute('rel'), 10) - 1 + const legendClick = this.barLabels.onClick + const w = this.w + + if (legendClick) { + legendClick(w.globals.seriesNames[seriesIndex], { w, seriesIndex }) + } + } +} + +export default Radial diff --git a/node_modules/apexcharts/src/charts/RangeBar.js b/node_modules/apexcharts/src/charts/RangeBar.js new file mode 100644 index 0000000..0196312 --- /dev/null +++ b/node_modules/apexcharts/src/charts/RangeBar.js @@ -0,0 +1,456 @@ +import Bar from './Bar' +import Graphics from '../modules/Graphics' +import Utils from '../utils/Utils' + +/** + * ApexCharts RangeBar Class responsible for drawing Range/Timeline Bars. + * + * @module RangeBar + **/ + +class RangeBar extends Bar { + draw(series, seriesIndex) { + let w = this.w + let graphics = new Graphics(this.ctx) + + this.rangeBarOptions = this.w.config.plotOptions.rangeBar + + this.series = series + this.seriesRangeStart = w.globals.seriesRangeStart + this.seriesRangeEnd = w.globals.seriesRangeEnd + + this.barHelpers.initVariables(series) + + let ret = graphics.group({ + class: 'apexcharts-rangebar-series apexcharts-plot-series', + }) + + for (let i = 0; i < series.length; i++) { + let x, + y, + xDivision, // xDivision is the GRIDWIDTH divided by number of datapoints (columns) + yDivision, // yDivision is the GRIDHEIGHT divided by number of datapoints (bars) + zeroH, // zeroH is the baseline where 0 meets y axis + zeroW // zeroW is the baseline where 0 meets x axis + + let realIndex = w.globals.comboCharts ? seriesIndex[i] : i + let { columnGroupIndex } = this.barHelpers.getGroupIndex(realIndex) + + // el to which series will be drawn + let elSeries = graphics.group({ + class: `apexcharts-series`, + seriesName: Utils.escapeString(w.globals.seriesNames[realIndex]), + rel: i + 1, + 'data:realIndex': realIndex, + }) + + this.ctx.series.addCollapsedClassToSeries(elSeries, realIndex) + + if (series[i].length > 0) { + this.visibleI = this.visibleI + 1 + } + + let barHeight = 0 + let barWidth = 0 + + let translationsIndex = 0 + if (this.yRatio.length > 1) { + this.yaxisIndex = w.globals.seriesYAxisReverseMap[realIndex][0] + translationsIndex = realIndex + } + + let initPositions = this.barHelpers.initialPositions(realIndex) + + y = initPositions.y + zeroW = initPositions.zeroW + + x = initPositions.x + barWidth = initPositions.barWidth + barHeight = initPositions.barHeight + xDivision = initPositions.xDivision + yDivision = initPositions.yDivision + zeroH = initPositions.zeroH + + // eldatalabels + let elDataLabelsWrap = graphics.group({ + class: 'apexcharts-datalabels', + 'data:realIndex': realIndex, + }) + + let elGoalsMarkers = graphics.group({ + class: 'apexcharts-rangebar-goals-markers', + }) + + for (let j = 0; j < w.globals.dataPoints; j++) { + const strokeWidth = this.barHelpers.getStrokeWidth(i, j, realIndex) + + const y1 = this.seriesRangeStart[i][j] + const y2 = this.seriesRangeEnd[i][j] + + let paths = null + let barXPosition = null + let barYPosition = null + const params = { x, y, strokeWidth, elSeries } + + let seriesLen = this.seriesLen + if (w.config.plotOptions.bar.rangeBarGroupRows) { + seriesLen = 1 + } + + if (typeof w.config.series[i].data[j] === 'undefined') { + // no data exists for further indexes, hence we need to get out the innr loop. + // As we are iterating over total datapoints, there is a possiblity the series might not have data for j index + break + } + + if (this.isHorizontal) { + barYPosition = y + barHeight * this.visibleI + + let srty = (yDivision - barHeight * seriesLen) / 2 + + if (w.config.series[i].data[j].x) { + let positions = this.detectOverlappingBars({ + i, + j, + barYPosition, + srty, + barHeight, + yDivision, + initPositions, + }) + + barHeight = positions.barHeight + barYPosition = positions.barYPosition + } + + paths = this.drawRangeBarPaths({ + indexes: { i, j, realIndex }, + barHeight, + barYPosition, + zeroW, + yDivision, + y1, + y2, + ...params, + }) + + barWidth = paths.barWidth + } else { + if (w.globals.isXNumeric) { + x = + (w.globals.seriesX[i][j] - w.globals.minX) / this.xRatio - + barWidth / 2 + } + + barXPosition = x + barWidth * this.visibleI + + let srtx = (xDivision - barWidth * seriesLen) / 2 + + if (w.config.series[i].data[j].x) { + let positions = this.detectOverlappingBars({ + i, + j, + barXPosition, + srtx, + barWidth, + xDivision, + initPositions, + }) + + barWidth = positions.barWidth + barXPosition = positions.barXPosition + } + + paths = this.drawRangeColumnPaths({ + indexes: { i, j, realIndex, translationsIndex }, + barWidth, + barXPosition, + zeroH, + xDivision, + ...params, + }) + + barHeight = paths.barHeight + } + + const barGoalLine = this.barHelpers.drawGoalLine({ + barXPosition: paths.barXPosition, + barYPosition, + goalX: paths.goalX, + goalY: paths.goalY, + barHeight, + barWidth, + }) + + if (barGoalLine) { + elGoalsMarkers.add(barGoalLine) + } + + y = paths.y + x = paths.x + + let pathFill = this.barHelpers.getPathFillColor(series, i, j, realIndex) + + this.renderSeries({ + realIndex, + pathFill: pathFill.color, + lineFill: pathFill.useRangeColor + ? pathFill.color + : w.globals.stroke.colors[realIndex], + j, + i, + x, + y, + y1, + y2, + pathFrom: paths.pathFrom, + pathTo: paths.pathTo, + strokeWidth, + elSeries, + series, + barHeight, + barWidth, + barXPosition, + barYPosition, + columnGroupIndex, + elDataLabelsWrap, + elGoalsMarkers, + visibleSeries: this.visibleI, + type: 'rangebar', + }) + } + + ret.add(elSeries) + } + + return ret + } + + detectOverlappingBars({ + i, + j, + barYPosition, + barXPosition, + srty, + srtx, + barHeight, + barWidth, + yDivision, + xDivision, + initPositions, + }) { + const w = this.w + let overlaps = [] + let rangeName = w.config.series[i].data[j].rangeName + + const x = w.config.series[i].data[j].x + const labelX = Array.isArray(x) ? x.join(' ') : x + + const rowIndex = w.globals.labels + .map((_) => (Array.isArray(_) ? _.join(' ') : _)) + .indexOf(labelX) + const overlappedIndex = w.globals.seriesRange[i].findIndex( + (tx) => tx.x === labelX && tx.overlaps.length > 0 + ) + + if (this.isHorizontal) { + if (w.config.plotOptions.bar.rangeBarGroupRows) { + barYPosition = srty + yDivision * rowIndex + } else { + barYPosition = srty + barHeight * this.visibleI + yDivision * rowIndex + } + + if (overlappedIndex > -1 && !w.config.plotOptions.bar.rangeBarOverlap) { + overlaps = w.globals.seriesRange[i][overlappedIndex].overlaps + + if (overlaps.indexOf(rangeName) > -1) { + barHeight = initPositions.barHeight / overlaps.length + + barYPosition = + barHeight * this.visibleI + + (yDivision * (100 - parseInt(this.barOptions.barHeight, 10))) / + 100 / + 2 + + barHeight * (this.visibleI + overlaps.indexOf(rangeName)) + + yDivision * rowIndex + } + } + } else { + if (rowIndex > -1 && !w.globals.timescaleLabels.length) { + if (w.config.plotOptions.bar.rangeBarGroupRows) { + barXPosition = srtx + xDivision * rowIndex + } else { + barXPosition = srtx + barWidth * this.visibleI + xDivision * rowIndex + } + } + + if (overlappedIndex > -1 && !w.config.plotOptions.bar.rangeBarOverlap) { + overlaps = w.globals.seriesRange[i][overlappedIndex].overlaps + + if (overlaps.indexOf(rangeName) > -1) { + barWidth = initPositions.barWidth / overlaps.length + + barXPosition = + barWidth * this.visibleI + + (xDivision * (100 - parseInt(this.barOptions.barWidth, 10))) / + 100 / + 2 + + barWidth * (this.visibleI + overlaps.indexOf(rangeName)) + + xDivision * rowIndex + } + } + } + + return { + barYPosition, + barXPosition, + barHeight, + barWidth, + } + } + + drawRangeColumnPaths({ + indexes, + x, + xDivision, + barWidth, + barXPosition, + zeroH, + }) { + let w = this.w + + const { i, j, realIndex, translationsIndex } = indexes + + const yRatio = this.yRatio[translationsIndex] + + const range = this.getRangeValue(realIndex, j) + + let y1 = Math.min(range.start, range.end) + let y2 = Math.max(range.start, range.end) + + if ( + typeof this.series[i][j] === 'undefined' || + this.series[i][j] === null + ) { + y1 = zeroH + } else { + y1 = zeroH - y1 / yRatio + y2 = zeroH - y2 / yRatio + } + const barHeight = Math.abs(y2 - y1) + + const paths = this.barHelpers.getColumnPaths({ + barXPosition, + barWidth, + y1, + y2, + strokeWidth: this.strokeWidth, + series: this.seriesRangeEnd, + realIndex: realIndex, + i: realIndex, + j, + w, + }) + + if (!w.globals.isXNumeric) { + x = x + xDivision + } else { + const xForNumericXAxis = this.getBarXForNumericXAxis({ + x, + j, + realIndex, + barWidth, + }) + x = xForNumericXAxis.x + barXPosition = xForNumericXAxis.barXPosition + } + + return { + pathTo: paths.pathTo, + pathFrom: paths.pathFrom, + barHeight, + x, + y: range.start < 0 && range.end < 0 ? y1 : y2, + goalY: this.barHelpers.getGoalValues( + 'y', + null, + zeroH, + i, + j, + translationsIndex + ), + barXPosition, + } + } + + preventBarOverflow(val) { + const w = this.w + + if (val < 0) { + val = 0 + } + if (val > w.globals.gridWidth) { + val = w.globals.gridWidth + } + + return val + } + + drawRangeBarPaths({ + indexes, + y, + y1, + y2, + yDivision, + barHeight, + barYPosition, + zeroW, + }) { + let w = this.w + + const { realIndex, j } = indexes + + let x1 = this.preventBarOverflow(zeroW + y1 / this.invertedYRatio) + let x2 = this.preventBarOverflow(zeroW + y2 / this.invertedYRatio) + + const range = this.getRangeValue(realIndex, j) + + const barWidth = Math.abs(x2 - x1) + + const paths = this.barHelpers.getBarpaths({ + barYPosition, + barHeight, + x1, + x2, + strokeWidth: this.strokeWidth, + series: this.seriesRangeEnd, + i: realIndex, + realIndex, + j, + w, + }) + + if (!w.globals.isXNumeric) { + y = y + yDivision + } + + return { + pathTo: paths.pathTo, + pathFrom: paths.pathFrom, + barWidth, + x: range.start < 0 && range.end < 0 ? x1 : x2, + goalX: this.barHelpers.getGoalValues('x', zeroW, null, realIndex, j), + y, + } + } + + getRangeValue(i, j) { + const w = this.w + return { + start: w.globals.seriesRangeStart[i][j], + end: w.globals.seriesRangeEnd[i][j], + } + } +} + +export default RangeBar diff --git a/node_modules/apexcharts/src/charts/Scatter.js b/node_modules/apexcharts/src/charts/Scatter.js new file mode 100644 index 0000000..074b0cd --- /dev/null +++ b/node_modules/apexcharts/src/charts/Scatter.js @@ -0,0 +1,177 @@ +import Animations from '../modules/Animations' +import Fill from '../modules/Fill' +import Filters from '../modules/Filters' +import Graphics from '../modules/Graphics' +import Markers from '../modules/Markers' + +/** + * ApexCharts Scatter Class. + * This Class also handles bubbles chart as currently there is no major difference in drawing them, + * @module Scatter + **/ +export default class Scatter { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + + this.initialAnim = this.w.config.chart.animations.enabled + } + + draw(elSeries, j, opts) { + let w = this.w + + let graphics = new Graphics(this.ctx) + + let realIndex = opts.realIndex + let pointsPos = opts.pointsPos + let zRatio = opts.zRatio + let elPointsMain = opts.elParent + + let elPointsWrap = graphics.group({ + class: `apexcharts-series-markers apexcharts-series-${w.config.chart.type}`, + }) + + elPointsWrap.attr('clip-path', `url(#gridRectMarkerMask${w.globals.cuid})`) + + if (Array.isArray(pointsPos.x)) { + for (let q = 0; q < pointsPos.x.length; q++) { + let dataPointIndex = j + 1 + let shouldDraw = true + + // a small hack as we have 2 points for the first val to connect it + if (j === 0 && q === 0) dataPointIndex = 0 + if (j === 0 && q === 1) dataPointIndex = 1 + + let radius = w.globals.markers.size[realIndex] + + if (zRatio !== Infinity) { + // means we have a bubble + const bubble = w.config.plotOptions.bubble + radius = w.globals.seriesZ[realIndex][dataPointIndex] + + if (bubble.zScaling) { + radius /= zRatio + } + + if (bubble.minBubbleRadius && radius < bubble.minBubbleRadius) { + radius = bubble.minBubbleRadius + } + + if (bubble.maxBubbleRadius && radius > bubble.maxBubbleRadius) { + radius = bubble.maxBubbleRadius + } + } + + let x = pointsPos.x[q] + let y = pointsPos.y[q] + + radius = radius || 0 + + if ( + y === null || + typeof w.globals.series[realIndex][dataPointIndex] === 'undefined' + ) { + shouldDraw = false + } + + if (shouldDraw) { + const point = this.drawPoint( + x, + y, + radius, + realIndex, + dataPointIndex, + j + ) + elPointsWrap.add(point) + } + + elPointsMain.add(elPointsWrap) + } + } + } + + drawPoint(x, y, radius, realIndex, dataPointIndex, j) { + const w = this.w + + let i = realIndex + let anim = new Animations(this.ctx) + let filters = new Filters(this.ctx) + let fill = new Fill(this.ctx) + let markers = new Markers(this.ctx) + const graphics = new Graphics(this.ctx) + + const markerConfig = markers.getMarkerConfig({ + cssClass: 'apexcharts-marker', + seriesIndex: i, + dataPointIndex, + radius: + w.config.chart.type === 'bubble' || + (w.globals.comboCharts && + w.config.series[realIndex] && + w.config.series[realIndex].type === 'bubble') + ? radius + : null, + }) + + let pathFillCircle = fill.fillPath({ + seriesNumber: realIndex, + dataPointIndex, + color: markerConfig.pointFillColor, + patternUnits: 'objectBoundingBox', + value: w.globals.series[realIndex][j], + }) + + let el = graphics.drawMarker(x, y, markerConfig) + + if (w.config.series[i].data[dataPointIndex]) { + if (w.config.series[i].data[dataPointIndex].fillColor) { + pathFillCircle = w.config.series[i].data[dataPointIndex].fillColor + } + } + + el.attr({ + fill: pathFillCircle, + }) + + if (w.config.chart.dropShadow.enabled) { + const dropShadow = w.config.chart.dropShadow + filters.dropShadow(el, dropShadow, realIndex) + } + + if (this.initialAnim && !w.globals.dataChanged && !w.globals.resized) { + let speed = w.config.chart.animations.speed + + anim.animateMarker(el, speed, w.globals.easing, () => { + window.setTimeout(() => { + anim.animationCompleted(el) + }, 100) + }) + } else { + w.globals.animationEnded = true + } + + el.attr({ + rel: dataPointIndex, + j: dataPointIndex, + index: realIndex, + 'default-marker-size': markerConfig.pSize, + }) + + filters.setSelectionFilter(el, realIndex, dataPointIndex) + markers.addEvents(el) + + el.node.classList.add('apexcharts-marker') + + return el + } + + centerTextInBubble(y) { + let w = this.w + y = y + parseInt(w.config.dataLabels.style.fontSize, 10) / 4 + + return { + y, + } + } +} diff --git a/node_modules/apexcharts/src/charts/Treemap.js b/node_modules/apexcharts/src/charts/Treemap.js new file mode 100644 index 0000000..ffe026d --- /dev/null +++ b/node_modules/apexcharts/src/charts/Treemap.js @@ -0,0 +1,403 @@ +import '../libs/Treemap-squared' +import Graphics from '../modules/Graphics' +import Animations from '../modules/Animations' +import Fill from '../modules/Fill' +import Helpers from './common/treemap/Helpers' +import Filters from '../modules/Filters' + +import Utils from '../utils/Utils' + +/** + * ApexCharts TreemapChart Class. + * @module TreemapChart + **/ + +export default class TreemapChart { + constructor(ctx, xyRatios) { + this.ctx = ctx + this.w = ctx.w + + this.strokeWidth = this.w.config.stroke.width + this.helpers = new Helpers(ctx) + this.dynamicAnim = this.w.config.chart.animations.dynamicAnimation + + this.labels = [] + } + + draw(series) { + let w = this.w + const graphics = new Graphics(this.ctx) + const fill = new Fill(this.ctx) + + let ret = graphics.group({ + class: 'apexcharts-treemap', + }) + + if (w.globals.noData) return ret + + let ser = [] + series.forEach((s) => { + let d = s.map((v) => { + return Math.abs(v) + }) + ser.push(d) + }) + + this.negRange = this.helpers.checkColorRange() + + w.config.series.forEach((s, i) => { + s.data.forEach((l) => { + if (!Array.isArray(this.labels[i])) this.labels[i] = [] + this.labels[i].push(l.x) + }) + }) + + const nodes = window.TreemapSquared.generate( + ser, + w.globals.gridWidth, + w.globals.gridHeight + ) + + nodes.forEach((node, i) => { + let elSeries = graphics.group({ + class: `apexcharts-series apexcharts-treemap-series`, + seriesName: Utils.escapeString(w.globals.seriesNames[i]), + rel: i + 1, + 'data:realIndex': i, + }) + + if (w.config.chart.dropShadow.enabled) { + const shadow = w.config.chart.dropShadow + const filters = new Filters(this.ctx) + filters.dropShadow(ret, shadow, i) + } + + let elDataLabelWrap = graphics.group({ + class: 'apexcharts-data-labels', + }) + + let bounds = { + xMin: Infinity, + yMin: Infinity, + xMax: -Infinity, + yMax: -Infinity, + } + + node.forEach((r, j) => { + const x1 = r[0] + const y1 = r[1] + const x2 = r[2] + const y2 = r[3] + + bounds.xMin = Math.min(bounds.xMin, x1) + bounds.yMin = Math.min(bounds.yMin, y1) + bounds.xMax = Math.max(bounds.xMax, x2) + bounds.yMax = Math.max(bounds.yMax, y2) + + let colorProps = this.helpers.getShadeColor( + w.config.chart.type, + i, + j, + this.negRange + ) + let color = colorProps.color + + let pathFill = fill.fillPath({ + color, + seriesNumber: i, + dataPointIndex: j, + }) + + let elRect = graphics.drawRect( + x1, + y1, + x2 - x1, + y2 - y1, + w.config.plotOptions.treemap.borderRadius, + '#fff', + 1, + this.strokeWidth, + w.config.plotOptions.treemap.useFillColorAsStroke + ? color + : w.globals.stroke.colors[i] + ) + + elRect.attr({ + cx: x1, + cy: y1, + index: i, + i, + j, + width: x2 - x1, + height: y2 - y1, + fill: pathFill, + }) + + elRect.node.classList.add('apexcharts-treemap-rect') + + this.helpers.addListeners(elRect) + + let fromRect = { + x: x1 + (x2 - x1) / 2, + y: y1 + (y2 - y1) / 2, + width: 0, + height: 0, + } + let toRect = { + x: x1, + y: y1, + width: x2 - x1, + height: y2 - y1, + } + + if (w.config.chart.animations.enabled && !w.globals.dataChanged) { + let speed = 1 + if (!w.globals.resized) { + speed = w.config.chart.animations.speed + } + this.animateTreemap(elRect, fromRect, toRect, speed) + } + if (w.globals.dataChanged) { + let speed = 1 + if (this.dynamicAnim.enabled && w.globals.shouldAnimate) { + speed = this.dynamicAnim.speed + + if ( + w.globals.previousPaths[i] && + w.globals.previousPaths[i][j] && + w.globals.previousPaths[i][j].rect + ) { + fromRect = w.globals.previousPaths[i][j].rect + } + + this.animateTreemap(elRect, fromRect, toRect, speed) + } + } + + let fontSize = this.getFontSize(r) + + let formattedText = w.config.dataLabels.formatter(this.labels[i][j], { + value: w.globals.series[i][j], + seriesIndex: i, + dataPointIndex: j, + w, + }) + if (w.config.plotOptions.treemap.dataLabels.format === 'truncate') { + fontSize = parseInt(w.config.dataLabels.style.fontSize, 10) + formattedText = this.truncateLabels( + formattedText, + fontSize, + x1, + y1, + x2, + y2 + ) + } + let dataLabels = null + if (w.globals.series[i][j]) { + dataLabels = this.helpers.calculateDataLabels({ + text: formattedText, + x: (x1 + x2) / 2, + y: (y1 + y2) / 2 + this.strokeWidth / 2 + fontSize / 3, + i, + j, + colorProps, + fontSize, + series, + }) + } + if (w.config.dataLabels.enabled && dataLabels) { + this.rotateToFitLabel( + dataLabels, + fontSize, + formattedText, + x1, + y1, + x2, + y2 + ) + } + elSeries.add(elRect) + if (dataLabels !== null) { + elSeries.add(dataLabels) + } + }) + + const seriesTitle = w.config.plotOptions.treemap.seriesTitle + if (w.config.series.length > 1 && seriesTitle && seriesTitle.show) { + const sName = w.config.series[i].name || '' + + if (sName && bounds.xMin < Infinity && bounds.yMin < Infinity) { + const { + offsetX, + offsetY, + borderColor, + borderWidth, + borderRadius, + style, + } = seriesTitle + + const textColor = style.color || w.config.chart.foreColor + const padding = { + left: style.padding.left, + right: style.padding.right, + top: style.padding.top, + bottom: style.padding.bottom, + } + + const textSize = graphics.getTextRects( + sName, + style.fontSize, + style.fontFamily + ) + const labelRectWidth = textSize.width + padding.left + padding.right + const labelRectHeight = textSize.height + padding.top + padding.bottom + + // Position + const labelX = bounds.xMin + (offsetX || 0) + const labelY = bounds.yMin + (offsetY || 0) + + // Draw background rect + const elLabelRect = graphics.drawRect( + labelX, + labelY, + labelRectWidth, + labelRectHeight, + borderRadius, + style.background, + 1, + borderWidth, + borderColor + ) + + const elLabelText = graphics.drawText({ + x: labelX + padding.left, + y: labelY + padding.top + textSize.height * 0.75, + text: sName, + fontSize: style.fontSize, + fontFamily: style.fontFamily, + fontWeight: style.fontWeight, + foreColor: textColor, + cssClass: style.cssClass || '', + }) + + elSeries.add(elLabelRect) + elSeries.add(elLabelText) + } + } + + elSeries.add(elDataLabelWrap) + ret.add(elSeries) + }) + + return ret + } + + // This calculates a font-size based upon + // average label length and the size of the box + getFontSize(coordinates) { + const w = this.w + + // total length of labels (i.e [["Italy"],["Spain", "Greece"]] -> 16) + function totalLabelLength(arr) { + let i, + total = 0 + if (Array.isArray(arr[0])) { + for (i = 0; i < arr.length; i++) { + total += totalLabelLength(arr[i]) + } + } else { + for (i = 0; i < arr.length; i++) { + total += arr[i].length + } + } + return total + } + + // count of labels (i.e [["Italy"],["Spain", "Greece"]] -> 3) + function countLabels(arr) { + let i, + total = 0 + if (Array.isArray(arr[0])) { + for (i = 0; i < arr.length; i++) { + total += countLabels(arr[i]) + } + } else { + for (i = 0; i < arr.length; i++) { + total += 1 + } + } + return total + } + + let averagelabelsize = + totalLabelLength(this.labels) / countLabels(this.labels) + + function fontSize(width, height) { + let area = width * height + let arearoot = Math.pow(area, 0.5) + return Math.min( + arearoot / averagelabelsize, + parseInt(w.config.dataLabels.style.fontSize, 10) + ) + } + + return fontSize( + coordinates[2] - coordinates[0], + coordinates[3] - coordinates[1] + ) + } + + rotateToFitLabel(elText, fontSize, text, x1, y1, x2, y2) { + const graphics = new Graphics(this.ctx) + const textRect = graphics.getTextRects(text, fontSize) + + // if the label fits better sideways then rotate it + if ( + textRect.width + this.w.config.stroke.width + 5 > x2 - x1 && + textRect.width <= y2 - y1 + ) { + let labelRotatingCenter = graphics.rotateAroundCenter(elText.node) + + elText.node.setAttribute( + 'transform', + `rotate(-90 ${labelRotatingCenter.x} ${ + labelRotatingCenter.y + }) translate(${textRect.height / 3})` + ) + } + } + + // This is an alternative label formatting method that uses a + // consistent font size, and trims the edge of long labels + truncateLabels(text, fontSize, x1, y1, x2, y2) { + const graphics = new Graphics(this.ctx) + const textRect = graphics.getTextRects(text, fontSize) + + // Determine max width based on ideal orientation of text + const labelMaxWidth = + textRect.width + this.w.config.stroke.width + 5 > x2 - x1 && + y2 - y1 > x2 - x1 + ? y2 - y1 + : x2 - x1 + const truncatedText = graphics.getTextBasedOnMaxWidth({ + text: text, + maxWidth: labelMaxWidth, + fontSize: fontSize, + }) + + // Return empty label when text has been trimmed for very small rects + if (text.length !== truncatedText.length && labelMaxWidth / fontSize < 5) { + return '' + } else { + return truncatedText + } + } + + animateTreemap(el, fromRect, toRect, speed) { + const animations = new Animations(this.ctx) + animations.animateRect(el, fromRect, toRect, speed, () => { + animations.animationCompleted(el) + }) + } +} diff --git a/node_modules/apexcharts/src/charts/common/bar/DataLabels.js b/node_modules/apexcharts/src/charts/common/bar/DataLabels.js new file mode 100644 index 0000000..e82b970 --- /dev/null +++ b/node_modules/apexcharts/src/charts/common/bar/DataLabels.js @@ -0,0 +1,701 @@ +import Graphics from '../../../modules/Graphics' +import DataLabels from '../../../modules/DataLabels' + +export default class BarDataLabels { + constructor(barCtx) { + this.w = barCtx.w + this.barCtx = barCtx + + this.totalFormatter = + this.w.config.plotOptions.bar.dataLabels.total.formatter + + if (!this.totalFormatter) { + this.totalFormatter = this.w.config.dataLabels.formatter + } + } + /** handleBarDataLabels is used to calculate the positions for the data-labels + * It also sets the element's data attr for bars and calls drawCalculatedBarDataLabels() + * After calculating, it also calls the function to draw data labels + * @memberof Bar + * @param {object} {barProps} most of the bar properties used throughout the bar + * drawing function + * @return {object} dataLabels node-element which you can append later + **/ + handleBarDataLabels(opts) { + let { + x, + y, + y1, + y2, + i, + j, + realIndex, + columnGroupIndex, + series, + barHeight, + barWidth, + barXPosition, + barYPosition, + visibleSeries, + renderedPath, + } = opts + let w = this.w + let graphics = new Graphics(this.barCtx.ctx) + + let strokeWidth = Array.isArray(this.barCtx.strokeWidth) + ? this.barCtx.strokeWidth[realIndex] + : this.barCtx.strokeWidth + + let bcx + let bcy + if (w.globals.isXNumeric && !w.globals.isBarHorizontal) { + bcx = x + parseFloat(barWidth * (visibleSeries + 1)) + bcy = y + parseFloat(barHeight * (visibleSeries + 1)) - strokeWidth + } else { + bcx = x + parseFloat(barWidth * visibleSeries) + bcy = y + parseFloat(barHeight * visibleSeries) + } + + let dataLabels = null + let totalDataLabels = null + let dataLabelsX = x + let dataLabelsY = y + let dataLabelsPos = {} + let dataLabelsConfig = w.config.dataLabels + let barDataLabelsConfig = this.barCtx.barOptions.dataLabels + let barTotalDataLabelsConfig = this.barCtx.barOptions.dataLabels.total + + if (typeof barYPosition !== 'undefined' && this.barCtx.isRangeBar) { + bcy = barYPosition + dataLabelsY = barYPosition + } + + if ( + typeof barXPosition !== 'undefined' && + this.barCtx.isVerticalGroupedRangeBar + ) { + bcx = barXPosition + dataLabelsX = barXPosition + } + + const offX = dataLabelsConfig.offsetX + const offY = dataLabelsConfig.offsetY + + let textRects = { + width: 0, + height: 0, + } + if (w.config.dataLabels.enabled) { + const yLabel = w.globals.series[i][j] + + textRects = graphics.getTextRects( + w.config.dataLabels.formatter + ? w.config.dataLabels.formatter(yLabel, { + ...w, + seriesIndex: i, + dataPointIndex: j, + w, + }) + : w.globals.yLabelFormatters[0](yLabel), + parseFloat(dataLabelsConfig.style.fontSize) + ) + } + + const params = { + x, + y, + i, + j, + realIndex, + columnGroupIndex, + renderedPath, + bcx, + bcy, + barHeight, + barWidth, + textRects, + strokeWidth, + dataLabelsX, + dataLabelsY, + dataLabelsConfig, + barDataLabelsConfig, + barTotalDataLabelsConfig, + offX, + offY, + } + + if (this.barCtx.isHorizontal) { + dataLabelsPos = this.calculateBarsDataLabelsPosition(params) + } else { + dataLabelsPos = this.calculateColumnsDataLabelsPosition(params) + } + + renderedPath.attr({ + cy: dataLabelsPos.bcy, + cx: dataLabelsPos.bcx, + j, + val: w.globals.series[i][j], + barHeight, + barWidth, + }) + + dataLabels = this.drawCalculatedDataLabels({ + x: dataLabelsPos.dataLabelsX, + y: dataLabelsPos.dataLabelsY, + val: this.barCtx.isRangeBar + ? [y1, y2] + : w.config.chart.stackType === '100%' + ? series[realIndex][j] + : w.globals.series[realIndex][j], + i: realIndex, + j, + barWidth, + barHeight, + textRects, + dataLabelsConfig, + }) + + if (w.config.chart.stacked && barTotalDataLabelsConfig.enabled) { + totalDataLabels = this.drawTotalDataLabels({ + x: dataLabelsPos.totalDataLabelsX, + y: dataLabelsPos.totalDataLabelsY, + barWidth, + barHeight, + realIndex, + textAnchor: dataLabelsPos.totalDataLabelsAnchor, + val: this.getStackedTotalDataLabel({ realIndex, j }), + dataLabelsConfig, + barTotalDataLabelsConfig, + }) + } + + return { + dataLabels, + totalDataLabels, + } + } + + getStackedTotalDataLabel({ realIndex, j }) { + const w = this.w + + let val = this.barCtx.stackedSeriesTotals[j] + if (this.totalFormatter) { + val = this.totalFormatter(val, { + ...w, + seriesIndex: realIndex, + dataPointIndex: j, + w, + }) + } + + return val + } + + calculateColumnsDataLabelsPosition(opts) { + const w = this.w + let { + i, + j, + realIndex, + columnGroupIndex, + y, + bcx, + barWidth, + barHeight, + textRects, + dataLabelsX, + dataLabelsY, + dataLabelsConfig, + barDataLabelsConfig, + barTotalDataLabelsConfig, + strokeWidth, + offX, + offY, + } = opts + + let totalDataLabelsY + let totalDataLabelsX + let totalDataLabelsAnchor = 'middle' + let totalDataLabelsBcx = bcx + barHeight = Math.abs(barHeight) + + let vertical = + w.config.plotOptions.bar.dataLabels.orientation === 'vertical' + + const { zeroEncounters } = this.barCtx.barHelpers.getZeroValueEncounters({ + i, + j, + }) + + bcx = bcx - strokeWidth / 2 + + let dataPointsDividedWidth = w.globals.gridWidth / w.globals.dataPoints + + if (this.barCtx.isVerticalGroupedRangeBar) { + dataLabelsX += barWidth / 2 + } else { + if (w.globals.isXNumeric) { + dataLabelsX = bcx - barWidth / 2 + offX + } else { + dataLabelsX = bcx - dataPointsDividedWidth + barWidth / 2 + offX + } + if ( + !w.config.chart.stacked && + zeroEncounters > 0 && + w.config.plotOptions.bar.hideZeroBarsWhenGrouped + ) { + dataLabelsX -= barWidth * zeroEncounters + } + } + + if (vertical) { + const offsetDLX = 2 + dataLabelsX = + dataLabelsX + textRects.height / 2 - strokeWidth / 2 - offsetDLX + } + + let valIsNegative = w.globals.series[i][j] < 0 + + let newY = y + if (this.barCtx.isReversed) { + newY = y + (valIsNegative ? barHeight : -barHeight) + } + + switch (barDataLabelsConfig.position) { + case 'center': + if (vertical) { + if (valIsNegative) { + dataLabelsY = newY - barHeight / 2 + offY + } else { + dataLabelsY = newY + barHeight / 2 - offY + } + } else { + if (valIsNegative) { + dataLabelsY = newY - barHeight / 2 + textRects.height / 2 + offY + } else { + dataLabelsY = newY + barHeight / 2 + textRects.height / 2 - offY + } + } + break + case 'bottom': + if (vertical) { + if (valIsNegative) { + dataLabelsY = newY - barHeight + offY + } else { + dataLabelsY = newY + barHeight - offY + } + } else { + if (valIsNegative) { + dataLabelsY = + newY - barHeight + textRects.height + strokeWidth + offY + } else { + dataLabelsY = + newY + barHeight - textRects.height / 2 + strokeWidth - offY + } + } + break + case 'top': + if (vertical) { + if (valIsNegative) { + dataLabelsY = newY + offY + } else { + dataLabelsY = newY - offY + } + } else { + if (valIsNegative) { + dataLabelsY = newY - textRects.height / 2 - offY + } else { + dataLabelsY = newY + textRects.height + offY + } + } + break + } + + let lowestPrevY = newY + w.globals.seriesGroups.forEach((sg) => { + this.barCtx[sg.join(',')]?.prevY.forEach((arr) => { + if (valIsNegative) { + lowestPrevY = Math.max(arr[j], lowestPrevY) + } else { + lowestPrevY = Math.min(arr[j], lowestPrevY) + } + }) + }) + + if ( + this.barCtx.lastActiveBarSerieIndex === realIndex && + barTotalDataLabelsConfig.enabled + ) { + const ADDITIONAL_OFFY = 18 + + const graphics = new Graphics(this.barCtx.ctx) + const totalLabeltextRects = graphics.getTextRects( + this.getStackedTotalDataLabel({ realIndex, j }), + dataLabelsConfig.fontSize + ) + + if (valIsNegative) { + totalDataLabelsY = + lowestPrevY - + totalLabeltextRects.height / 2 - + offY - + barTotalDataLabelsConfig.offsetY + + ADDITIONAL_OFFY + } else { + totalDataLabelsY = + lowestPrevY + + totalLabeltextRects.height + + offY + + barTotalDataLabelsConfig.offsetY - + ADDITIONAL_OFFY + } + + // width divided into equal parts + let xDivision = dataPointsDividedWidth + + totalDataLabelsX = + totalDataLabelsBcx + + (w.globals.isXNumeric + ? (-barWidth * w.globals.barGroups.length) / 2 + : (w.globals.barGroups.length * barWidth) / 2 - + (w.globals.barGroups.length - 1) * barWidth - + xDivision) + + barTotalDataLabelsConfig.offsetX + } + + if (!w.config.chart.stacked) { + if (dataLabelsY < 0) { + dataLabelsY = 0 + strokeWidth + } else if (dataLabelsY + textRects.height / 3 > w.globals.gridHeight) { + dataLabelsY = w.globals.gridHeight - strokeWidth + } + } + + return { + bcx, + bcy: y, + dataLabelsX, + dataLabelsY, + totalDataLabelsX, + totalDataLabelsY, + totalDataLabelsAnchor, + } + } + + calculateBarsDataLabelsPosition(opts) { + const w = this.w + let { + x, + i, + j, + realIndex, + bcy, + barHeight, + barWidth, + textRects, + dataLabelsX, + strokeWidth, + dataLabelsConfig, + barDataLabelsConfig, + barTotalDataLabelsConfig, + offX, + offY, + } = opts + + let dataPointsDividedHeight = w.globals.gridHeight / w.globals.dataPoints + const { zeroEncounters } = this.barCtx.barHelpers.getZeroValueEncounters({ + i, + j, + }) + + barWidth = Math.abs(barWidth) + + let dataLabelsY = + bcy - + (this.barCtx.isRangeBar ? 0 : dataPointsDividedHeight) + + barHeight / 2 + + textRects.height / 2 + + offY - + 3 + + if ( + !w.config.chart.stacked && + zeroEncounters > 0 && + w.config.plotOptions.bar.hideZeroBarsWhenGrouped + ) { + dataLabelsY -= barHeight * zeroEncounters + } + let totalDataLabelsX + let totalDataLabelsY + let totalDataLabelsAnchor = 'start' + + let valIsNegative = w.globals.series[i][j] < 0 + + let newX = x + if (this.barCtx.isReversed) { + newX = x + (valIsNegative ? -barWidth : barWidth) + totalDataLabelsAnchor = valIsNegative ? 'start' : 'end' + } + + switch (barDataLabelsConfig.position) { + case 'center': + if (valIsNegative) { + dataLabelsX = newX + barWidth / 2 - offX + } else { + dataLabelsX = + Math.max(textRects.width / 2, newX - barWidth / 2) + offX + } + break + case 'bottom': + if (valIsNegative) { + dataLabelsX = newX + barWidth - strokeWidth - offX + } else { + dataLabelsX = newX - barWidth + strokeWidth + offX + } + break + case 'top': + if (valIsNegative) { + dataLabelsX = newX - strokeWidth - offX + } else { + dataLabelsX = newX - strokeWidth + offX + } + break + } + + let lowestPrevX = newX + w.globals.seriesGroups.forEach((sg) => { + this.barCtx[sg.join(',')]?.prevX.forEach((arr) => { + if (valIsNegative) { + lowestPrevX = Math.min(arr[j], lowestPrevX) + } else { + lowestPrevX = Math.max(arr[j], lowestPrevX) + } + }) + }) + + if ( + this.barCtx.lastActiveBarSerieIndex === realIndex && + barTotalDataLabelsConfig.enabled + ) { + const graphics = new Graphics(this.barCtx.ctx) + const totalLabeltextRects = graphics.getTextRects( + this.getStackedTotalDataLabel({ realIndex, j }), + dataLabelsConfig.fontSize + ) + if (valIsNegative) { + totalDataLabelsX = + lowestPrevX - strokeWidth - offX - barTotalDataLabelsConfig.offsetX + + totalDataLabelsAnchor = 'end' + } else { + totalDataLabelsX = + lowestPrevX + + offX + + barTotalDataLabelsConfig.offsetX + + (this.barCtx.isReversed ? -(barWidth + strokeWidth) : strokeWidth) + } + totalDataLabelsY = + dataLabelsY - + textRects.height / 2 + + totalLabeltextRects.height / 2 + + barTotalDataLabelsConfig.offsetY + + strokeWidth + + if (w.globals.barGroups.length > 1) { + totalDataLabelsY = + totalDataLabelsY - (w.globals.barGroups.length / 2) * (barHeight / 2) + } + } + + if (!w.config.chart.stacked) { + if (dataLabelsConfig.textAnchor === 'start') { + if (dataLabelsX - textRects.width < 0) { + dataLabelsX = valIsNegative + ? textRects.width + strokeWidth + : strokeWidth + } else if (dataLabelsX + textRects.width > w.globals.gridWidth) { + dataLabelsX = valIsNegative + ? w.globals.gridWidth - strokeWidth + : w.globals.gridWidth - textRects.width - strokeWidth + } + } else if (dataLabelsConfig.textAnchor === 'middle') { + if (dataLabelsX - textRects.width / 2 < 0) { + dataLabelsX = textRects.width / 2 + strokeWidth + } else if (dataLabelsX + textRects.width / 2 > w.globals.gridWidth) { + dataLabelsX = w.globals.gridWidth - textRects.width / 2 - strokeWidth + } + } else if (dataLabelsConfig.textAnchor === 'end') { + if (dataLabelsX < 1) { + dataLabelsX = textRects.width + strokeWidth + } else if (dataLabelsX + 1 > w.globals.gridWidth) { + dataLabelsX = w.globals.gridWidth - textRects.width - strokeWidth + } + } + } + + return { + bcx: x, + bcy, + dataLabelsX, + dataLabelsY, + totalDataLabelsX, + totalDataLabelsY, + totalDataLabelsAnchor, + } + } + + drawCalculatedDataLabels({ + x, + y, + val, + i, // = realIndex + j, + textRects, + barHeight, + barWidth, + dataLabelsConfig, + }) { + const w = this.w + let rotate = 'rotate(0)' + if (w.config.plotOptions.bar.dataLabels.orientation === 'vertical') + rotate = `rotate(-90, ${x}, ${y})` + + const dataLabels = new DataLabels(this.barCtx.ctx) + const graphics = new Graphics(this.barCtx.ctx) + const formatter = dataLabelsConfig.formatter + + let elDataLabelsWrap = null + + const isSeriesNotCollapsed = + w.globals.collapsedSeriesIndices.indexOf(i) > -1 + + if (dataLabelsConfig.enabled && !isSeriesNotCollapsed) { + elDataLabelsWrap = graphics.group({ + class: 'apexcharts-data-labels', + transform: rotate, + }) + + let text = '' + if (typeof val !== 'undefined') { + text = formatter(val, { + ...w, + seriesIndex: i, + dataPointIndex: j, + w, + }) + } + + if (!val && w.config.plotOptions.bar.hideZeroBarsWhenGrouped) { + text = '' + } + + let valIsNegative = w.globals.series[i][j] < 0 + let position = w.config.plotOptions.bar.dataLabels.position + if (w.config.plotOptions.bar.dataLabels.orientation === 'vertical') { + if (position === 'top') { + if (valIsNegative) dataLabelsConfig.textAnchor = 'end' + else dataLabelsConfig.textAnchor = 'start' + } + if (position === 'center') { + dataLabelsConfig.textAnchor = 'middle' + } + if (position === 'bottom') { + if (valIsNegative) dataLabelsConfig.textAnchor = 'end' + else dataLabelsConfig.textAnchor = 'start' + } + } + + if ( + this.barCtx.isRangeBar && + this.barCtx.barOptions.dataLabels.hideOverflowingLabels + ) { + // hide the datalabel if it cannot fit into the rect + const txRect = graphics.getTextRects( + text, + parseFloat(dataLabelsConfig.style.fontSize) + ) + if (barWidth < txRect.width) { + text = '' + } + } + + if ( + w.config.chart.stacked && + this.barCtx.barOptions.dataLabels.hideOverflowingLabels + ) { + // if there is not enough space to draw the label in the bar/column rect, check hideOverflowingLabels property to prevent overflowing on wrong rect + // Note: This issue is only seen in stacked charts + if (this.barCtx.isHorizontal) { + if (textRects.width / 1.6 > Math.abs(barWidth)) { + text = '' + } + } else { + if (textRects.height / 1.6 > Math.abs(barHeight)) { + text = '' + } + } + } + + let modifiedDataLabelsConfig = { + ...dataLabelsConfig, + } + if (this.barCtx.isHorizontal) { + if (val < 0) { + if (dataLabelsConfig.textAnchor === 'start') { + modifiedDataLabelsConfig.textAnchor = 'end' + } else if (dataLabelsConfig.textAnchor === 'end') { + modifiedDataLabelsConfig.textAnchor = 'start' + } + } + } + + dataLabels.plotDataLabelsText({ + x, + y, + text, + i, + j, + parent: elDataLabelsWrap, + dataLabelsConfig: modifiedDataLabelsConfig, + alwaysDrawDataLabel: true, + offsetCorrection: true, + }) + } + + return elDataLabelsWrap + } + + drawTotalDataLabels({ + x, + y, + val, + realIndex, + textAnchor, + barTotalDataLabelsConfig, + }) { + const w = this.w + const graphics = new Graphics(this.barCtx.ctx) + + let totalDataLabelText + + if ( + barTotalDataLabelsConfig.enabled && + typeof x !== 'undefined' && + typeof y !== 'undefined' && + this.barCtx.lastActiveBarSerieIndex === realIndex + ) { + totalDataLabelText = graphics.drawText({ + x: x, + y: y, + foreColor: barTotalDataLabelsConfig.style.color, + text: val, + textAnchor, + fontFamily: barTotalDataLabelsConfig.style.fontFamily, + fontSize: barTotalDataLabelsConfig.style.fontSize, + fontWeight: barTotalDataLabelsConfig.style.fontWeight, + }) + } + + return totalDataLabelText + } +} diff --git a/node_modules/apexcharts/src/charts/common/bar/Helpers.js b/node_modules/apexcharts/src/charts/common/bar/Helpers.js new file mode 100644 index 0000000..ad2c7fc --- /dev/null +++ b/node_modules/apexcharts/src/charts/common/bar/Helpers.js @@ -0,0 +1,815 @@ +import Fill from '../../../modules/Fill' +import Graphics from '../../../modules/Graphics' +import Series from '../../../modules/Series' +import Utils from '../../../utils/Utils' + +export default class Helpers { + constructor(barCtx) { + this.w = barCtx.w + this.barCtx = barCtx + } + + initVariables(series) { + const w = this.w + this.barCtx.series = series + this.barCtx.totalItems = 0 + this.barCtx.seriesLen = 0 + this.barCtx.visibleI = -1 // visible Series + this.barCtx.visibleItems = 1 // number of visible bars after user zoomed in/out + + for (let sl = 0; sl < series.length; sl++) { + if (series[sl].length > 0) { + this.barCtx.seriesLen = this.barCtx.seriesLen + 1 + this.barCtx.totalItems += series[sl].length + } + if (w.globals.isXNumeric) { + // get max visible items + for (let j = 0; j < series[sl].length; j++) { + if ( + w.globals.seriesX[sl][j] > w.globals.minX && + w.globals.seriesX[sl][j] < w.globals.maxX + ) { + this.barCtx.visibleItems++ + } + } + } else { + this.barCtx.visibleItems = w.globals.dataPoints + } + } + + this.arrBorderRadius = this.createBorderRadiusArr(w.globals.series) + + if (this.barCtx.seriesLen === 0) { + // A small adjustment when combo charts are used + this.barCtx.seriesLen = 1 + } + this.barCtx.zeroSerieses = [] + + if (!w.globals.comboCharts) { + this.checkZeroSeries({ series }) + } + } + + initialPositions(realIndex) { + let w = this.w + let x, y, yDivision, xDivision, barHeight, barWidth, zeroH, zeroW + + let dataPoints = w.globals.dataPoints + if (this.barCtx.isRangeBar) { + // timeline rangebar chart + dataPoints = w.globals.labels.length + } + + let seriesLen = this.barCtx.seriesLen + if (w.config.plotOptions.bar.rangeBarGroupRows) { + seriesLen = 1 + } + + if (this.barCtx.isHorizontal) { + // height divided into equal parts + yDivision = w.globals.gridHeight / dataPoints + barHeight = yDivision / seriesLen + + if (w.globals.isXNumeric) { + yDivision = w.globals.gridHeight / this.barCtx.totalItems + barHeight = yDivision / this.barCtx.seriesLen + } + + barHeight = + (barHeight * parseInt(this.barCtx.barOptions.barHeight, 10)) / 100 + + if (String(this.barCtx.barOptions.barHeight).indexOf('%') === -1) { + barHeight = parseInt(this.barCtx.barOptions.barHeight, 10) + } + + zeroW = + this.barCtx.baseLineInvertedY + + w.globals.padHorizontal + + (this.barCtx.isReversed ? w.globals.gridWidth : 0) - + (this.barCtx.isReversed ? this.barCtx.baseLineInvertedY * 2 : 0) + + if (this.barCtx.isFunnel) { + zeroW = w.globals.gridWidth / 2 + } + y = (yDivision - barHeight * this.barCtx.seriesLen) / 2 + } else { + // width divided into equal parts + xDivision = w.globals.gridWidth / this.barCtx.visibleItems + if (w.config.xaxis.convertedCatToNumeric) { + xDivision = w.globals.gridWidth / w.globals.dataPoints + } + barWidth = + ((xDivision / seriesLen) * + parseInt(this.barCtx.barOptions.columnWidth, 10)) / + 100 + + if (w.globals.isXNumeric) { + // max barwidth should be equal to minXDiff to avoid overlap + let xRatio = this.barCtx.xRatio + + if ( + w.globals.minXDiff && + w.globals.minXDiff !== 0.5 && + w.globals.minXDiff / xRatio > 0 + ) { + xDivision = w.globals.minXDiff / xRatio + } + + barWidth = + ((xDivision / seriesLen) * + parseInt(this.barCtx.barOptions.columnWidth, 10)) / + 100 + + if (barWidth < 1) { + barWidth = 1 + } + } + if (String(this.barCtx.barOptions.columnWidth).indexOf('%') === -1) { + barWidth = parseInt(this.barCtx.barOptions.columnWidth, 10) + } + + zeroH = + w.globals.gridHeight - + this.barCtx.baseLineY[this.barCtx.translationsIndex] - + (this.barCtx.isReversed ? w.globals.gridHeight : 0) + + (this.barCtx.isReversed + ? this.barCtx.baseLineY[this.barCtx.translationsIndex] * 2 + : 0) + + if (w.globals.isXNumeric) { + const xForNumericX = this.barCtx.getBarXForNumericXAxis({ + x, + j: 0, + realIndex, + barWidth, + }) + x = xForNumericX.x + } else { + x = + w.globals.padHorizontal + + Utils.noExponents(xDivision - barWidth * this.barCtx.seriesLen) / 2 + } + } + + w.globals.barHeight = barHeight + w.globals.barWidth = barWidth + + return { + x, + y, + yDivision, + xDivision, + barHeight, + barWidth, + zeroH, + zeroW, + } + } + + initializeStackedPrevVars(ctx) { + const w = ctx.w + w.globals.seriesGroups.forEach((group) => { + if (!ctx[group]) ctx[group] = {} + + ctx[group].prevY = [] + ctx[group].prevX = [] + ctx[group].prevYF = [] + ctx[group].prevXF = [] + ctx[group].prevYVal = [] + ctx[group].prevXVal = [] + }) + } + + initializeStackedXYVars(ctx) { + const w = ctx.w + + w.globals.seriesGroups.forEach((group) => { + if (!ctx[group]) ctx[group] = {} + + ctx[group].xArrj = [] + ctx[group].xArrjF = [] + ctx[group].xArrjVal = [] + ctx[group].yArrj = [] + ctx[group].yArrjF = [] + ctx[group].yArrjVal = [] + }) + } + + getPathFillColor(series, i, j, realIndex) { + const w = this.w + let fill = this.barCtx.ctx.fill + + let fillColor = null + let seriesNumber = this.barCtx.barOptions.distributed ? j : i + let useRangeColor = false + + if (this.barCtx.barOptions.colors.ranges.length > 0) { + const colorRange = this.barCtx.barOptions.colors.ranges + colorRange.map((range) => { + if (series[i][j] >= range.from && series[i][j] <= range.to) { + fillColor = range.color + useRangeColor = true + } + }) + } + + let pathFill = fill.fillPath({ + seriesNumber: this.barCtx.barOptions.distributed + ? seriesNumber + : realIndex, + dataPointIndex: j, + color: fillColor, + value: series[i][j], + fillConfig: w.config.series[i].data[j]?.fill, + fillType: w.config.series[i].data[j]?.fill?.type + ? w.config.series[i].data[j]?.fill.type + : Array.isArray(w.config.fill.type) + ? w.config.fill.type[realIndex] + : w.config.fill.type, + }) + + return { + color: pathFill, + useRangeColor, + } + } + + getStrokeWidth(i, j, realIndex) { + let strokeWidth = 0 + const w = this.w + + if (!this.barCtx.series[i][j]) { + this.barCtx.isNullValue = true + } else { + this.barCtx.isNullValue = false + } + if (w.config.stroke.show) { + if (!this.barCtx.isNullValue) { + strokeWidth = Array.isArray(this.barCtx.strokeWidth) + ? this.barCtx.strokeWidth[realIndex] + : this.barCtx.strokeWidth + } + } + return strokeWidth + } + + createBorderRadiusArr(series) { + const w = this.w + + const alwaysApplyRadius = + !this.w.config.chart.stacked || w.config.plotOptions.bar.borderRadius <= 0 + + const numSeries = series.length + const numColumns = series[0]?.length | 0 + const output = Array.from({ length: numSeries }, () => + Array(numColumns).fill(alwaysApplyRadius ? 'top' : 'none') + ) + + if (alwaysApplyRadius) return output + + for (let j = 0; j < numColumns; j++) { + let positiveIndices = [] + let negativeIndices = [] + let nonZeroCount = 0 + + // Collect positive and negative indices + for (let i = 0; i < numSeries; i++) { + const value = series[i][j] + if (value > 0) { + positiveIndices.push(i) + nonZeroCount++ + } else if (value < 0) { + negativeIndices.push(i) + nonZeroCount++ + } + } + + if (positiveIndices.length > 0 && negativeIndices.length === 0) { + // Only positive values in this column + if (positiveIndices.length === 1) { + // Single positive value + output[positiveIndices[0]][j] = 'both' + } else { + // Multiple positive values + const firstPositiveIndex = positiveIndices[0] + const lastPositiveIndex = positiveIndices[positiveIndices.length - 1] + for (let i of positiveIndices) { + if (i === firstPositiveIndex) { + output[i][j] = 'bottom' + } else if (i === lastPositiveIndex) { + output[i][j] = 'top' + } else { + output[i][j] = 'none' + } + } + } + } else if (negativeIndices.length > 0 && positiveIndices.length === 0) { + // Only negative values in this column + if (negativeIndices.length === 1) { + // Single negative value + output[negativeIndices[0]][j] = 'both' + } else { + // Multiple negative values + const highestNegativeIndex = Math.max(...negativeIndices) + const lowestNegativeIndex = Math.min(...negativeIndices) + for (let i of negativeIndices) { + if (i === highestNegativeIndex) { + output[i][j] = 'bottom' // Closest to axis + } else if (i === lowestNegativeIndex) { + output[i][j] = 'top' // Farthest from axis + } else { + output[i][j] = 'none' + } + } + } + } else if (positiveIndices.length > 0 && negativeIndices.length > 0) { + // Mixed positive and negative values + // Assign 'top' to the last positive bar + const lastPositiveIndex = positiveIndices[positiveIndices.length - 1] + for (let i of positiveIndices) { + if (i === lastPositiveIndex) { + output[i][j] = 'top' + } else { + output[i][j] = 'none' + } + } + // Assign 'bottom' to the highest negative index (closest to axis) + const highestNegativeIndex = Math.max(...negativeIndices) + for (let i of negativeIndices) { + if (i === highestNegativeIndex) { + output[i][j] = 'bottom' + } else { + output[i][j] = 'none' + } + } + } else if (nonZeroCount === 1) { + // Only one non-zero value (either positive or negative) + const index = positiveIndices[0] || negativeIndices[0] + output[index][j] = 'both' + } + } + + return output + } + + barBackground({ j, i, x1, x2, y1, y2, elSeries }) { + const w = this.w + const graphics = new Graphics(this.barCtx.ctx) + + const sr = new Series(this.barCtx.ctx) + let activeSeriesIndex = sr.getActiveConfigSeriesIndex() + + if ( + this.barCtx.barOptions.colors.backgroundBarColors.length > 0 && + activeSeriesIndex === i + ) { + if (j >= this.barCtx.barOptions.colors.backgroundBarColors.length) { + j %= this.barCtx.barOptions.colors.backgroundBarColors.length + } + + let bcolor = this.barCtx.barOptions.colors.backgroundBarColors[j] + let rect = graphics.drawRect( + typeof x1 !== 'undefined' ? x1 : 0, + typeof y1 !== 'undefined' ? y1 : 0, + typeof x2 !== 'undefined' ? x2 : w.globals.gridWidth, + typeof y2 !== 'undefined' ? y2 : w.globals.gridHeight, + this.barCtx.barOptions.colors.backgroundBarRadius, + bcolor, + this.barCtx.barOptions.colors.backgroundBarOpacity + ) + elSeries.add(rect) + rect.node.classList.add('apexcharts-backgroundBar') + } + } + + getColumnPaths({ + barWidth, + barXPosition, + y1, + y2, + strokeWidth, + isReversed, + series, + seriesGroup, + realIndex, + i, + j, + w, + }) { + const graphics = new Graphics(this.barCtx.ctx) + strokeWidth = Array.isArray(strokeWidth) + ? strokeWidth[realIndex] + : strokeWidth + if (!strokeWidth) strokeWidth = 0 + + let bW = barWidth + let bXP = barXPosition + + if (w.config.series[realIndex].data[j]?.columnWidthOffset) { + bXP = + barXPosition - w.config.series[realIndex].data[j].columnWidthOffset / 2 + bW = barWidth + w.config.series[realIndex].data[j].columnWidthOffset + } + + // Center the stroke on the coordinates + let strokeCenter = strokeWidth / 2 + + const x1 = bXP + strokeCenter + const x2 = bXP + bW - strokeCenter + + let direction = (series[i][j] >= 0 ? 1 : -1) * (isReversed ? -1 : 1) + + // append tiny pixels to avoid exponentials (which cause issues in border-radius) + y1 += 0.001 - strokeCenter * direction + y2 += 0.001 + strokeCenter * direction + + let pathTo = graphics.move(x1, y1) + let pathFrom = graphics.move(x1, y1) + + const sl = graphics.line(x2, y1) + if (w.globals.previousPaths.length > 0) { + pathFrom = this.barCtx.getPreviousPath(realIndex, j, false) + } + + pathTo = + pathTo + + graphics.line(x1, y2) + + graphics.line(x2, y2) + + sl + + (w.config.plotOptions.bar.borderRadiusApplication === 'around' || + this.arrBorderRadius[realIndex][j] === 'both' + ? ' Z' + : ' z') + + // the lines in pathFrom are repeated to equal it to the points of pathTo + // this is to avoid weird animation (bug in svg.js) + pathFrom = + pathFrom + + graphics.line(x1, y1) + + sl + + sl + + sl + + sl + + sl + + graphics.line(x1, y1) + + (w.config.plotOptions.bar.borderRadiusApplication === 'around' || + this.arrBorderRadius[realIndex][j] === 'both' + ? ' Z' + : ' z') + + if (this.arrBorderRadius[realIndex][j] !== 'none') { + pathTo = graphics.roundPathCorners( + pathTo, + w.config.plotOptions.bar.borderRadius + ) + } + + if (w.config.chart.stacked) { + let _ctx = this.barCtx + _ctx = this.barCtx[seriesGroup] + _ctx.yArrj.push(y2 - strokeCenter * direction) + _ctx.yArrjF.push(Math.abs(y1 - y2 + strokeWidth * direction)) + _ctx.yArrjVal.push(this.barCtx.series[i][j]) + } + + return { + pathTo, + pathFrom, + } + } + + getBarpaths({ + barYPosition, + barHeight, + x1, + x2, + strokeWidth, + isReversed, + series, + seriesGroup, + realIndex, + i, + j, + w, + }) { + const graphics = new Graphics(this.barCtx.ctx) + strokeWidth = Array.isArray(strokeWidth) + ? strokeWidth[realIndex] + : strokeWidth + if (!strokeWidth) strokeWidth = 0 + + let bYP = barYPosition + let bH = barHeight + + if (w.config.series[realIndex].data[j]?.barHeightOffset) { + bYP = + barYPosition - w.config.series[realIndex].data[j].barHeightOffset / 2 + bH = barHeight + w.config.series[realIndex].data[j].barHeightOffset + } + + // Center the stroke on the coordinates + let strokeCenter = strokeWidth / 2 + + const y1 = bYP + strokeCenter + const y2 = bYP + bH - strokeCenter + + let direction = (series[i][j] >= 0 ? 1 : -1) * (isReversed ? -1 : 1) + + // append tiny pixels to avoid exponentials (which cause issues in border-radius) + x1 += 0.001 + strokeCenter * direction + x2 += 0.001 - strokeCenter * direction + + let pathTo = graphics.move(x1, y1) + let pathFrom = graphics.move(x1, y1) + + if (w.globals.previousPaths.length > 0) { + pathFrom = this.barCtx.getPreviousPath(realIndex, j, false) + } + + const sl = graphics.line(x1, y2) + pathTo = + pathTo + + graphics.line(x2, y1) + + graphics.line(x2, y2) + + sl + + (w.config.plotOptions.bar.borderRadiusApplication === 'around' || + this.arrBorderRadius[realIndex][j] === 'both' + ? ' Z' + : ' z') + + pathFrom = + pathFrom + + graphics.line(x1, y1) + + sl + + sl + + sl + + sl + + sl + + graphics.line(x1, y1) + + (w.config.plotOptions.bar.borderRadiusApplication === 'around' || + this.arrBorderRadius[realIndex][j] === 'both' + ? ' Z' + : ' z') + + if (this.arrBorderRadius[realIndex][j] !== 'none') { + pathTo = graphics.roundPathCorners( + pathTo, + w.config.plotOptions.bar.borderRadius + ) + } + + if (w.config.chart.stacked) { + let _ctx = this.barCtx + _ctx = this.barCtx[seriesGroup] + _ctx.xArrj.push(x2 + strokeCenter * direction) + _ctx.xArrjF.push(Math.abs(x1 - x2 - strokeWidth * direction)) + _ctx.xArrjVal.push(this.barCtx.series[i][j]) + } + return { + pathTo, + pathFrom, + } + } + + checkZeroSeries({ series }) { + let w = this.w + for (let zs = 0; zs < series.length; zs++) { + let total = 0 + for ( + let zsj = 0; + zsj < series[w.globals.maxValsInArrayIndex].length; + zsj++ + ) { + total += series[zs][zsj] + } + if (total === 0) { + this.barCtx.zeroSerieses.push(zs) + } + } + } + + getXForValue(value, zeroW, zeroPositionForNull = true) { + let xForVal = zeroPositionForNull ? zeroW : null + if (typeof value !== 'undefined' && value !== null) { + xForVal = + zeroW + + value / this.barCtx.invertedYRatio - + (this.barCtx.isReversed ? value / this.barCtx.invertedYRatio : 0) * 2 + } + return xForVal + } + + getYForValue(value, zeroH, translationsIndex, zeroPositionForNull = true) { + let yForVal = zeroPositionForNull ? zeroH : null + if (typeof value !== 'undefined' && value !== null) { + yForVal = + zeroH - + value / this.barCtx.yRatio[translationsIndex] + + (this.barCtx.isReversed + ? value / this.barCtx.yRatio[translationsIndex] + : 0) * + 2 + } + return yForVal + } + + getGoalValues(type, zeroW, zeroH, i, j, translationsIndex) { + const w = this.w + + let goals = [] + + const pushGoal = (value, attrs) => { + goals.push({ + [type]: + type === 'x' + ? this.getXForValue(value, zeroW, false) + : this.getYForValue(value, zeroH, translationsIndex, false), + attrs, + }) + } + if ( + w.globals.seriesGoals[i] && + w.globals.seriesGoals[i][j] && + Array.isArray(w.globals.seriesGoals[i][j]) + ) { + w.globals.seriesGoals[i][j].forEach((goal) => { + pushGoal(goal.value, goal) + }) + } + if (this.barCtx.barOptions.isDumbbell && w.globals.seriesRange.length) { + let colors = this.barCtx.barOptions.dumbbellColors + ? this.barCtx.barOptions.dumbbellColors + : w.globals.colors + const commonAttrs = { + strokeHeight: type === 'x' ? 0 : w.globals.markers.size[i], + strokeWidth: type === 'x' ? w.globals.markers.size[i] : 0, + strokeDashArray: 0, + strokeLineCap: 'round', + strokeColor: Array.isArray(colors[i]) ? colors[i][0] : colors[i], + } + + pushGoal(w.globals.seriesRangeStart[i][j], commonAttrs) + pushGoal(w.globals.seriesRangeEnd[i][j], { + ...commonAttrs, + strokeColor: Array.isArray(colors[i]) ? colors[i][1] : colors[i], + }) + } + return goals + } + + drawGoalLine({ + barXPosition, + barYPosition, + goalX, + goalY, + barWidth, + barHeight, + }) { + let graphics = new Graphics(this.barCtx.ctx) + const lineGroup = graphics.group({ + className: 'apexcharts-bar-goals-groups', + }) + + lineGroup.node.classList.add('apexcharts-element-hidden') + this.barCtx.w.globals.delayedElements.push({ + el: lineGroup.node, + }) + + lineGroup.attr( + 'clip-path', + `url(#gridRectMarkerMask${this.barCtx.w.globals.cuid})` + ) + + let line = null + if (this.barCtx.isHorizontal) { + if (Array.isArray(goalX)) { + goalX.forEach((goal) => { + // Need a tiny margin of 1 each side so goals don't disappear at extremeties + if (goal.x >= -1 && goal.x <= graphics.w.globals.gridWidth + 1) { + let sHeight = + typeof goal.attrs.strokeHeight !== 'undefined' + ? goal.attrs.strokeHeight + : barHeight / 2 + let y = barYPosition + sHeight + barHeight / 2 + + line = graphics.drawLine( + goal.x, + y - sHeight * 2, + goal.x, + y, + goal.attrs.strokeColor ? goal.attrs.strokeColor : undefined, + goal.attrs.strokeDashArray, + goal.attrs.strokeWidth ? goal.attrs.strokeWidth : 2, + goal.attrs.strokeLineCap + ) + lineGroup.add(line) + } + }) + } + } else { + if (Array.isArray(goalY)) { + goalY.forEach((goal) => { + // Need a tiny margin of 1 each side so goals don't disappear at extremeties + if (goal.y >= -1 && goal.y <= graphics.w.globals.gridHeight + 1) { + let sWidth = + typeof goal.attrs.strokeWidth !== 'undefined' + ? goal.attrs.strokeWidth + : barWidth / 2 + let x = barXPosition + sWidth + barWidth / 2 + + line = graphics.drawLine( + x - sWidth * 2, + goal.y, + x, + goal.y, + goal.attrs.strokeColor ? goal.attrs.strokeColor : undefined, + goal.attrs.strokeDashArray, + goal.attrs.strokeHeight ? goal.attrs.strokeHeight : 2, + goal.attrs.strokeLineCap + ) + lineGroup.add(line) + } + }) + } + } + + return lineGroup + } + + drawBarShadow({ prevPaths, currPaths, color }) { + const w = this.w + const { x: prevX2, x1: prevX1, barYPosition: prevY1 } = prevPaths + const { x: currX2, x1: currX1, barYPosition: currY1 } = currPaths + + const prevY2 = prevY1 + currPaths.barHeight + + const graphics = new Graphics(this.barCtx.ctx) + const utils = new Utils() + + const shadowPath = + graphics.move(prevX1, prevY2) + + graphics.line(prevX2, prevY2) + + graphics.line(currX2, currY1) + + graphics.line(currX1, currY1) + + graphics.line(prevX1, prevY2) + + (w.config.plotOptions.bar.borderRadiusApplication === 'around' || + this.arrBorderRadius[realIndex][j] === 'both' + ? ' Z' + : ' z') + + return graphics.drawPath({ + d: shadowPath, + fill: utils.shadeColor(0.5, Utils.rgb2hex(color)), + stroke: 'none', + strokeWidth: 0, + fillOpacity: 1, + classes: 'apexcharts-bar-shadow apexcharts-decoration-element', + }) + } + + getZeroValueEncounters({ i, j }) { + const w = this.w + + let nonZeroColumns = 0 + let zeroEncounters = 0 + let seriesIndices = w.config.plotOptions.bar.horizontal + ? w.globals.series.map((_, _i) => _i) + : w.globals.columnSeries?.i.map((_i) => _i) || [] + + seriesIndices.forEach((_si) => { + let val = w.globals.seriesPercent[_si][j] + if (val) { + nonZeroColumns++ + } + if (_si < i && val === 0) { + zeroEncounters++ + } + }) + + return { + nonZeroColumns, + zeroEncounters, + } + } + + getGroupIndex(seriesIndex) { + const w = this.w + // groupIndex is the index of group buckets (group1, group2, ...) + let groupIndex = w.globals.seriesGroups.findIndex( + (group) => + // w.config.series[i].name may be undefined, so use + // w.globals.seriesNames[i], which has default names for those + // series. w.globals.seriesGroups[] uses the same default naming. + group.indexOf(w.globals.seriesNames[seriesIndex]) > -1 + ) + // We need the column groups to be indexable as 0,1,2,... for their + // positioning relative to each other. + let cGI = this.barCtx.columnGroupIndices + let columnGroupIndex = cGI.indexOf(groupIndex) + if (columnGroupIndex < 0) { + cGI.push(groupIndex) + columnGroupIndex = cGI.length - 1 + } + return { groupIndex, columnGroupIndex } + } +} diff --git a/node_modules/apexcharts/src/charts/common/circle/Helpers.js b/node_modules/apexcharts/src/charts/common/circle/Helpers.js new file mode 100644 index 0000000..522a353 --- /dev/null +++ b/node_modules/apexcharts/src/charts/common/circle/Helpers.js @@ -0,0 +1,30 @@ +import Graphics from '../../../modules/Graphics' + +export default class CircularChartsHelpers { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + } + + drawYAxisTexts(x, y, i, text) { + const w = this.w + + const yaxisConfig = w.config.yaxis[0] + const formatter = w.globals.yLabelFormatters[0] + + const graphics = new Graphics(this.ctx) + const yaxisLabel = graphics.drawText({ + x: x + yaxisConfig.labels.offsetX, + y: y + yaxisConfig.labels.offsetY, + text: formatter(text, i), + textAnchor: 'middle', + fontSize: yaxisConfig.labels.style.fontSize, + fontFamily: yaxisConfig.labels.style.fontFamily, + foreColor: Array.isArray(yaxisConfig.labels.style.colors) + ? yaxisConfig.labels.style.colors[i] + : yaxisConfig.labels.style.colors + }) + + return yaxisLabel + } +} diff --git a/node_modules/apexcharts/src/charts/common/line/Helpers.js b/node_modules/apexcharts/src/charts/common/line/Helpers.js new file mode 100644 index 0000000..70a3510 --- /dev/null +++ b/node_modules/apexcharts/src/charts/common/line/Helpers.js @@ -0,0 +1,154 @@ +import CoreUtils from '../../../modules/CoreUtils' +import Utils from '../../../utils/Utils' + +export default class Helpers { + constructor(lineCtx) { + this.w = lineCtx.w + this.lineCtx = lineCtx + } + + sameValueSeriesFix(i, series) { + const w = this.w + + if ( + w.config.fill.type === 'gradient' || + w.config.fill.type[i] === 'gradient' + ) { + const coreUtils = new CoreUtils(this.lineCtx.ctx, w) + + // applied only to LINE chart + // a small adjustment to allow gradient line to draw correctly for all same values + /* #fix https://github.com/apexcharts/apexcharts.js/issues/358 */ + if (coreUtils.seriesHaveSameValues(i)) { + let gSeries = series[i].slice() + gSeries[gSeries.length - 1] = gSeries[gSeries.length - 1] + 0.000001 + series[i] = gSeries + } + } + return series + } + + calculatePoints({ series, realIndex, x, y, i, j, prevY }) { + let w = this.w + + let ptX = [] + let ptY = [] + + let xPT1st = this.lineCtx.categoryAxisCorrection + w.config.markers.offsetX + + // the first point for line series + // we need to check whether it's not a time series, because a time series may + // start from the middle of the x axis + if (w.globals.isXNumeric) { + xPT1st = + (w.globals.seriesX[realIndex][0] - w.globals.minX) / + this.lineCtx.xRatio + + w.config.markers.offsetX + } + + // push 2 points for the first data values + if (j === 0) { + ptX.push(xPT1st) + ptY.push( + Utils.isNumber(series[i][0]) ? prevY + w.config.markers.offsetY : null + ) + } + + ptX.push(x + w.config.markers.offsetX) + ptY.push( + Utils.isNumber(series[i][j + 1]) ? y + w.config.markers.offsetY : null + ) + + return { + x: ptX, + y: ptY, + } + } + + checkPreviousPaths({ pathFromLine, pathFromArea, realIndex }) { + let w = this.w + + for (let pp = 0; pp < w.globals.previousPaths.length; pp++) { + let gpp = w.globals.previousPaths[pp] + + if ( + (gpp.type === 'line' || gpp.type === 'area') && + gpp.paths.length > 0 && + parseInt(gpp.realIndex, 10) === parseInt(realIndex, 10) + ) { + if (gpp.type === 'line') { + this.lineCtx.appendPathFrom = false + pathFromLine = w.globals.previousPaths[pp].paths[0].d + } else if (gpp.type === 'area') { + this.lineCtx.appendPathFrom = false + pathFromArea = w.globals.previousPaths[pp].paths[0].d + + if (w.config.stroke.show && w.globals.previousPaths[pp].paths[1]) { + pathFromLine = w.globals.previousPaths[pp].paths[1].d + } + } + } + } + + return { + pathFromLine, + pathFromArea, + } + } + + determineFirstPrevY({ + i, + realIndex, + series, + prevY, + lineYPosition, + translationsIndex, + }) { + let w = this.w + let stackSeries = + (w.config.chart.stacked && !w.globals.comboCharts) || + (w.config.chart.stacked && + w.globals.comboCharts && + (!this.w.config.chart.stackOnlyBar || + this.w.config.series[realIndex]?.type === 'bar' || + this.w.config.series[realIndex]?.type === 'column')) + + if (typeof series[i]?.[0] !== 'undefined') { + if (stackSeries) { + if (i > 0) { + // 1st y value of previous series + lineYPosition = this.lineCtx.prevSeriesY[i - 1][0] + } else { + // the first series will not have prevY values + lineYPosition = this.lineCtx.zeroY + } + } else { + lineYPosition = this.lineCtx.zeroY + } + prevY = + lineYPosition - + series[i][0] / this.lineCtx.yRatio[translationsIndex] + + (this.lineCtx.isReversed + ? series[i][0] / this.lineCtx.yRatio[translationsIndex] + : 0) * + 2 + } else { + // the first value in the current series is null + if (stackSeries && i > 0 && typeof series[i][0] === 'undefined') { + // check for undefined value (undefined value will occur when we clear the series while user clicks on legend to hide serieses) + for (let s = i - 1; s >= 0; s--) { + // for loop to get to 1st previous value until we get it + if (series[s][0] !== null && typeof series[s][0] !== 'undefined') { + lineYPosition = this.lineCtx.prevSeriesY[s][0] + prevY = lineYPosition + break + } + } + } + } + return { + prevY, + lineYPosition, + } + } +} diff --git a/node_modules/apexcharts/src/charts/common/treemap/Helpers.js b/node_modules/apexcharts/src/charts/common/treemap/Helpers.js new file mode 100644 index 0000000..56af126 --- /dev/null +++ b/node_modules/apexcharts/src/charts/common/treemap/Helpers.js @@ -0,0 +1,200 @@ +import Utils from '../../../utils/Utils' +import Graphics from '../../../modules/Graphics' +import DataLabels from '../../../modules/DataLabels' + +export default class TreemapHelpers { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + } + + checkColorRange() { + const w = this.w + + let negRange = false + let chartOpts = w.config.plotOptions[w.config.chart.type] + + if (chartOpts.colorScale.ranges.length > 0) { + chartOpts.colorScale.ranges.map((range, index) => { + if (range.from <= 0) { + negRange = true + } + }) + } + return negRange + } + + getShadeColor(chartType, i, j, negRange) { + const w = this.w + + let colorShadePercent = 1 + let shadeIntensity = w.config.plotOptions[chartType].shadeIntensity + + const colorProps = this.determineColor(chartType, i, j) + + if (w.globals.hasNegs || negRange) { + if (w.config.plotOptions[chartType].reverseNegativeShade) { + if (colorProps.percent < 0) { + colorShadePercent = + (colorProps.percent / 100) * (shadeIntensity * 1.25) + } else { + colorShadePercent = + (1 - colorProps.percent / 100) * (shadeIntensity * 1.25) + } + } else { + if (colorProps.percent <= 0) { + colorShadePercent = + 1 - (1 + colorProps.percent / 100) * shadeIntensity + } else { + colorShadePercent = (1 - colorProps.percent / 100) * shadeIntensity + } + } + } else { + colorShadePercent = 1 - colorProps.percent / 100 + if (chartType === 'treemap') { + colorShadePercent = + (1 - colorProps.percent / 100) * (shadeIntensity * 1.25) + } + } + + let color = colorProps.color + let utils = new Utils() + + if (w.config.plotOptions[chartType].enableShades) { + // The shadeColor function may return either an RGB or a hex color value + // However, hexToRgba requires the input to be in hex format + // The ternary operator checks if the color is in RGB format, and if so, converts it to hex + if (this.w.config.theme.mode === 'dark') { + const shadeColor = utils.shadeColor( + colorShadePercent * -1, + colorProps.color + ) + color = Utils.hexToRgba( + Utils.isColorHex(shadeColor) ? shadeColor : Utils.rgb2hex(shadeColor), + w.config.fill.opacity + ) + } else { + const shadeColor = utils.shadeColor(colorShadePercent, colorProps.color) + color = Utils.hexToRgba( + Utils.isColorHex(shadeColor) ? shadeColor : Utils.rgb2hex(shadeColor), + w.config.fill.opacity + ) + } + } + + return { color, colorProps } + } + + determineColor(chartType, i, j) { + const w = this.w + + let val = w.globals.series[i][j] + + let chartOpts = w.config.plotOptions[chartType] + + let seriesNumber = chartOpts.colorScale.inverse ? j : i + + if (chartOpts.distributed && w.config.chart.type === 'treemap') { + seriesNumber = j + } + + let color = w.globals.colors[seriesNumber] + let foreColor = null + let min = Math.min(...w.globals.series[i]) + let max = Math.max(...w.globals.series[i]) + + if (!chartOpts.distributed && chartType === 'heatmap') { + min = w.globals.minY + max = w.globals.maxY + } + + if (typeof chartOpts.colorScale.min !== 'undefined') { + min = + chartOpts.colorScale.min < w.globals.minY + ? chartOpts.colorScale.min + : w.globals.minY + max = + chartOpts.colorScale.max > w.globals.maxY + ? chartOpts.colorScale.max + : w.globals.maxY + } + + let total = Math.abs(max) + Math.abs(min) + + let percent = (100 * val) / (total === 0 ? total - 0.000001 : total) + + if (chartOpts.colorScale.ranges.length > 0) { + const colorRange = chartOpts.colorScale.ranges + colorRange.map((range, index) => { + if (val >= range.from && val <= range.to) { + color = range.color + foreColor = range.foreColor ? range.foreColor : null + min = range.from + max = range.to + let rTotal = Math.abs(max) + Math.abs(min) + percent = (100 * val) / (rTotal === 0 ? rTotal - 0.000001 : rTotal) + } + }) + } + + return { + color, + foreColor, + percent, + } + } + + calculateDataLabels({ text, x, y, i, j, colorProps, fontSize }) { + let w = this.w + let dataLabelsConfig = w.config.dataLabels + + const graphics = new Graphics(this.ctx) + + let dataLabels = new DataLabels(this.ctx) + + let elDataLabelsWrap = null + + if (dataLabelsConfig.enabled) { + elDataLabelsWrap = graphics.group({ + class: 'apexcharts-data-labels', + }) + + const offX = dataLabelsConfig.offsetX + const offY = dataLabelsConfig.offsetY + + let dataLabelsX = x + offX + let dataLabelsY = + y + parseFloat(dataLabelsConfig.style.fontSize) / 3 + offY + + dataLabels.plotDataLabelsText({ + x: dataLabelsX, + y: dataLabelsY, + text, + i, + j, + color: colorProps.foreColor, + parent: elDataLabelsWrap, + fontSize, + dataLabelsConfig, + }) + } + + return elDataLabelsWrap + } + + addListeners(elRect) { + const graphics = new Graphics(this.ctx) + elRect.node.addEventListener( + 'mouseenter', + graphics.pathMouseEnter.bind(this, elRect) + ) + elRect.node.addEventListener( + 'mouseleave', + graphics.pathMouseLeave.bind(this, elRect) + ) + elRect.node.addEventListener( + 'mousedown', + graphics.pathMouseDown.bind(this, elRect) + ) + } +} diff --git a/node_modules/apexcharts/src/libs/Treemap-squared.js b/node_modules/apexcharts/src/libs/Treemap-squared.js new file mode 100644 index 0000000..a9ae841 --- /dev/null +++ b/node_modules/apexcharts/src/libs/Treemap-squared.js @@ -0,0 +1,290 @@ +/* + * treemap-squarify.js - open source implementation of squarified treemaps + * + * Treemap Squared 0.5 - Treemap Charting library + * + * https://github.com/imranghory/treemap-squared/ + * + * Copyright (c) 2012 Imran Ghory (imranghory@gmail.com) + * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license. + * + * + * Implementation of the squarify treemap algorithm described in: + * + * Bruls, Mark; Huizing, Kees; van Wijk, Jarke J. (2000), "Squarified treemaps" + * in de Leeuw, W.; van Liere, R., Data Visualization 2000: + * Proc. Joint Eurographics and IEEE TCVG Symp. on Visualization, Springer-Verlag, pp. 33–42. + * + * Paper is available online at: http://www.win.tue.nl/~vanwijk/stm.pdf + * + * The code in this file is completeley decoupled from the drawing code so it should be trivial + * to port it to any other vector drawing library. Given an array of datapoints this library returns + * an array of cartesian coordinates that represent the rectangles that make up the treemap. + * + * The library also supports multidimensional data (nested treemaps) and performs normalization on the data. + * + * See the README file for more details. + */ + +window.TreemapSquared = {} +;(function() { + 'use strict' + window.TreemapSquared.generate = (function() { + function Container(xoffset, yoffset, width, height) { + this.xoffset = xoffset // offset from the the top left hand corner + this.yoffset = yoffset // ditto + this.height = height + this.width = width + + this.shortestEdge = function() { + return Math.min(this.height, this.width) + } + + // getCoordinates - for a row of boxes which we've placed + // return an array of their cartesian coordinates + this.getCoordinates = function(row) { + let coordinates = [] + let subxoffset = this.xoffset, + subyoffset = this.yoffset //our offset within the container + let areawidth = sumArray(row) / this.height + let areaheight = sumArray(row) / this.width + let i + + if (this.width >= this.height) { + for (i = 0; i < row.length; i++) { + coordinates.push([ + subxoffset, + subyoffset, + subxoffset + areawidth, + subyoffset + row[i] / areawidth + ]) + subyoffset = subyoffset + row[i] / areawidth + } + } else { + for (i = 0; i < row.length; i++) { + coordinates.push([ + subxoffset, + subyoffset, + subxoffset + row[i] / areaheight, + subyoffset + areaheight + ]) + subxoffset = subxoffset + row[i] / areaheight + } + } + return coordinates + } + + // cutArea - once we've placed some boxes into an row we then need to identify the remaining area, + // this function takes the area of the boxes we've placed and calculates the location and + // dimensions of the remaining space and returns a container box defined by the remaining area + this.cutArea = function(area) { + let newcontainer + + if (this.width >= this.height) { + let areawidth = area / this.height + let newwidth = this.width - areawidth + newcontainer = new Container( + this.xoffset + areawidth, + this.yoffset, + newwidth, + this.height + ) + } else { + let areaheight = area / this.width + let newheight = this.height - areaheight + newcontainer = new Container( + this.xoffset, + this.yoffset + areaheight, + this.width, + newheight + ) + } + return newcontainer + } + } + + // normalize - the Bruls algorithm assumes we're passing in areas that nicely fit into our + // container box, this method takes our raw data and normalizes the data values into + // area values so that this assumption is valid. + function normalize(data, area) { + let normalizeddata = [] + let sum = sumArray(data) + let multiplier = area / sum + let i + + for (i = 0; i < data.length; i++) { + normalizeddata[i] = data[i] * multiplier + } + return normalizeddata + } + + // treemapMultidimensional - takes multidimensional data (aka [[23,11],[11,32]] - nested array) + // and recursively calls itself using treemapSingledimensional + // to create a patchwork of treemaps and merge them + function treemapMultidimensional(data, width, height, xoffset, yoffset) { + xoffset = typeof xoffset === 'undefined' ? 0 : xoffset + yoffset = typeof yoffset === 'undefined' ? 0 : yoffset + + let mergeddata = [] + let mergedtreemap + let results = [] + let i + + if (isArray(data[0])) { + // if we've got more dimensions of depth + for (i = 0; i < data.length; i++) { + mergeddata[i] = sumMultidimensionalArray(data[i]) + } + mergedtreemap = treemapSingledimensional( + mergeddata, + width, + height, + xoffset, + yoffset + ) + + for (i = 0; i < data.length; i++) { + results.push( + treemapMultidimensional( + data[i], + mergedtreemap[i][2] - mergedtreemap[i][0], + mergedtreemap[i][3] - mergedtreemap[i][1], + mergedtreemap[i][0], + mergedtreemap[i][1] + ) + ) + } + } else { + results = treemapSingledimensional( + data, + width, + height, + xoffset, + yoffset + ) + } + return results + } + + // treemapSingledimensional - simple wrapper around squarify + function treemapSingledimensional(data, width, height, xoffset, yoffset) { + xoffset = typeof xoffset === 'undefined' ? 0 : xoffset + yoffset = typeof yoffset === 'undefined' ? 0 : yoffset + + let rawtreemap = squarify( + normalize(data, width * height), + [], + new Container(xoffset, yoffset, width, height), + [] + ) + return flattenTreemap(rawtreemap) + } + + // flattenTreemap - squarify implementation returns an array of arrays of coordinates + // because we have a new array everytime we switch to building a new row + // this converts it into an array of coordinates. + function flattenTreemap(rawtreemap) { + let flattreemap = [] + let i, j + + for (i = 0; i < rawtreemap.length; i++) { + for (j = 0; j < rawtreemap[i].length; j++) { + flattreemap.push(rawtreemap[i][j]) + } + } + return flattreemap + } + + // squarify - as per the Bruls paper + // plus coordinates stack and containers so we get + // usable data out of it + function squarify(data, currentrow, container, stack) { + let length + let nextdatapoint + let newcontainer + + if (data.length === 0) { + stack.push(container.getCoordinates(currentrow)) + return + } + + length = container.shortestEdge() + nextdatapoint = data[0] + + if (improvesRatio(currentrow, nextdatapoint, length)) { + currentrow.push(nextdatapoint) + squarify(data.slice(1), currentrow, container, stack) + } else { + newcontainer = container.cutArea(sumArray(currentrow), stack) + stack.push(container.getCoordinates(currentrow)) + squarify(data, [], newcontainer, stack) + } + return stack + } + + // improveRatio - implements the worse calculation and comparision as given in Bruls + // (note the error in the original paper; fixed here) + function improvesRatio(currentrow, nextnode, length) { + let newrow + + if (currentrow.length === 0) { + return true + } + + newrow = currentrow.slice() + newrow.push(nextnode) + + let currentratio = calculateRatio(currentrow, length) + let newratio = calculateRatio(newrow, length) + + // the pseudocode in the Bruls paper has the direction of the comparison + // wrong, this is the correct one. + return currentratio >= newratio + } + + // calculateRatio - calculates the maximum width to height ratio of the + // boxes in this row + function calculateRatio(row, length) { + let min = Math.min.apply(Math, row) + let max = Math.max.apply(Math, row) + let sum = sumArray(row) + return Math.max( + (Math.pow(length, 2) * max) / Math.pow(sum, 2), + Math.pow(sum, 2) / (Math.pow(length, 2) * min) + ) + } + + // isArray - checks if arr is an array + function isArray(arr) { + return arr && arr.constructor === Array + } + + // sumArray - sums a single dimensional array + function sumArray(arr) { + let sum = 0 + let i + + for (i = 0; i < arr.length; i++) { + sum += arr[i] + } + return sum + } + + // sumMultidimensionalArray - sums the values in a nested array (aka [[0,1],[[2,3]]]) + function sumMultidimensionalArray(arr) { + let i, + total = 0 + + if (isArray(arr[0])) { + for (i = 0; i < arr.length; i++) { + total += sumMultidimensionalArray(arr[i]) + } + } else { + total = sumArray(arr) + } + return total + } + + return treemapMultidimensional + })() +})() diff --git a/node_modules/apexcharts/src/libs/monotone-cubic.js b/node_modules/apexcharts/src/libs/monotone-cubic.js new file mode 100644 index 0000000..9298565 --- /dev/null +++ b/node_modules/apexcharts/src/libs/monotone-cubic.js @@ -0,0 +1,186 @@ +/** + * + * @yr/monotone-cubic-spline (https://github.com/YR/monotone-cubic-spline) + * + * The MIT License (MIT) + * + * Copyright (c) 2015 yr.no + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +/** + * Generate tangents for 'points' + * @param {Array} points + * @returns {Array} + */ +export const tangents = (points) => { + const m = finiteDifferences(points) + const n = points.length - 1 + + const ε = 1e-6 + + const tgts = [] + let a, b, d, s + + for (let i = 0; i < n; i++) { + d = slope(points[i], points[i + 1]) + + if (Math.abs(d) < ε) { + m[i] = m[i + 1] = 0 + } else { + a = m[i] / d + b = m[i + 1] / d + s = a * a + b * b + if (s > 9) { + s = (d * 3) / Math.sqrt(s) + m[i] = s * a + m[i + 1] = s * b + } + } + } + + for (let i = 0; i <= n; i++) { + s = + (points[Math.min(n, i + 1)][0] - points[Math.max(0, i - 1)][0]) / + (6 * (1 + m[i] * m[i])) + tgts.push([s || 0, m[i] * s || 0]) + } + + return tgts +} + +/** + * Convert 'points' to svg path + * @param {Array} points + * @returns {String} + */ +export const svgPath = (points) => { + let p = '' + + for (let i = 0; i < points.length; i++) { + const point = points[i] + const n = point.length + + if (n > 4) { + p += `C${point[0]}, ${point[1]}` + p += `, ${point[2]}, ${point[3]}` + p += `, ${point[4]}, ${point[5]}` + } else if (n > 2) { + p += `S${point[0]}, ${point[1]}` + p += `, ${point[2]}, ${point[3]}` + } + } + + return p +} + +export const spline = { + /** + * Convert 'points' to bezier + * @param {Array} points + * @returns {Array} + */ + points(points) { + const tgts = tangents(points) + + const p = points[1] + const p0 = points[0] + const pts = [] + const t = tgts[1] + const t0 = tgts[0] + + // Add starting 'M' and 'C' points + pts.push(p0, [ + p0[0] + t0[0], + p0[1] + t0[1], + p[0] - t[0], + p[1] - t[1], + p[0], + p[1], + ]) + + // Add 'S' points + for (let i = 2, n = tgts.length; i < n; i++) { + const p = points[i] + const t = tgts[i] + + pts.push([p[0] - t[0], p[1] - t[1], p[0], p[1]]) + } + + return pts + }, + + /** + * Slice out a segment of 'points' + * @param {Array} points + * @param {Number} start + * @param {Number} end + * @returns {Array} + */ + slice(points, start, end) { + const pts = points.slice(start, end) + + if (start) { + // Add additional 'C' points + if (end - start > 1 && pts[1].length < 6) { + const n = pts[0].length + + pts[1] = [ + pts[0][n - 2] * 2 - pts[0][n - 4], + pts[0][n - 1] * 2 - pts[0][n - 3], + ].concat(pts[1]) + } + // Remove control points for 'M' + pts[0] = pts[0].slice(-2) + } + + return pts + }, +} + +/** + * Compute slope from point 'p0' to 'p1' + * @param {Array} p0 + * @param {Array} p1 + * @returns {Number} + */ +function slope(p0, p1) { + return (p1[1] - p0[1]) / (p1[0] - p0[0]) +} + +/** + * Compute three-point differences for 'points' + * @param {Array} points + * @returns {Array} + */ +function finiteDifferences(points) { + const m = [] + let p0 = points[0] + let p1 = points[1] + let d = (m[0] = slope(p0, p1)) + let i = 1 + + for (let n = points.length - 1; i < n; i++) { + p0 = p1 + p1 = points[i + 1] + m[i] = (d + (d = slope(p0, p1))) * 0.5 + } + m[i] = d + + return m +} diff --git a/node_modules/apexcharts/src/locales/ar.json b/node_modules/apexcharts/src/locales/ar.json new file mode 100644 index 0000000..f13eab3 --- /dev/null +++ b/node_modules/apexcharts/src/locales/ar.json @@ -0,0 +1,63 @@ +{ +"name": "ar", +"options": { +"months": [ +"يناير", +"فبراير", +"مارس", +"أبريل", +"مايو", +"يونيو", +"يوليو", +"أغسطس", +"سبتمبر", +"أكتوبر", +"نوفمبر", +"ديسمبر" +], +"shortMonths": [ +"يناير", +"فبراير", +"مارس", +"أبريل", +"مايو", +"يونيو", +"يوليو", +"أغسطس", +"سبتمبر", +"أكتوبر", +"نوفمبر", +"ديسمبر" +], +"days": [ +"الأحد", +"الإثنين", +"الثلاثاء", +"الأربعاء", +"الخميس", +"الجمعة", +"السبت" +], +"shortDays": [ +"أحد", +"إثنين", +"ثلاثاء", +"أربعاء", +"خميس", +"جمعة", +"سبت" +], +"toolbar": { +"exportToSVG": "تحميل بصيغة SVG", +"exportToPNG": "تحميل بصيغة PNG", +"exportToCSV": "تحميل بصيغة CSV", +"menu": "القائمة", +"selection": "تحديد", +"selectionZoom": "تكبير التحديد", +"zoomIn": "تكبير", +"zoomOut": "تصغير", +"pan": "تحريك", +"reset": "إعادة التعيين" +} +} +} diff --git a/node_modules/apexcharts/src/locales/be-cyrl.json b/node_modules/apexcharts/src/locales/be-cyrl.json new file mode 100644 index 0000000..89805d3 --- /dev/null +++ b/node_modules/apexcharts/src/locales/be-cyrl.json @@ -0,0 +1,55 @@ +{ + "name": "be-cyrl", + "options": { + "months": [ + "Студзень", + "Люты", + "Сакавік", + "Красавік", + "Травень", + "Чэрвень", + "Ліпень", + "Жнівень", + "Верасень", + "Кастрычнік", + "Лістапад", + "Сьнежань" + ], + "shortMonths": [ + "Сту", + "Лют", + "Сак", + "Кра", + "Тра", + "Чэр", + "Ліп", + "Жні", + "Вер", + "Кас", + "Ліс", + "Сьн" + ], + "days": [ + "Нядзеля", + "Панядзелак", + "Аўторак", + "Серада", + "Чацьвер", + "Пятніца", + "Субота" + ], + "shortDays": ["Нд", "Пн", "Аў", "Ср", "Чц", "Пт", "Сб"], + "toolbar": { + "exportToSVG": "Спампаваць SVG", + "exportToPNG": "Спампаваць PNG", + "exportToCSV": "Спампаваць CSV", + "menu": "Мэню", + "selection": "Вылучэньне", + "selectionZoom": "Вылучэньне з маштабаваньнем", + "zoomIn": "Наблізіць", + "zoomOut": "Аддаліць", + "pan": "Ссоўваньне", + "reset": "Скінуць маштабаваньне" + } + } +} diff --git a/node_modules/apexcharts/src/locales/be-latn.json b/node_modules/apexcharts/src/locales/be-latn.json new file mode 100644 index 0000000..864b47c --- /dev/null +++ b/node_modules/apexcharts/src/locales/be-latn.json @@ -0,0 +1,55 @@ +{ + "name": "be-latn", + "options": { + "months": [ + "Studzień", + "Luty", + "Sakavik", + "Krasavik", + "Travień", + "Červień", + "Lipień", + "Žnivień", + "Vierasień", + "Kastryčnik", + "Listapad", + "Śniežań" + ], + "shortMonths": [ + "Stu", + "Lut", + "Sak", + "Kra", + "Tra", + "Čer", + "Lip", + "Žni", + "Vie", + "Kas", + "Lis", + "Śni" + ], + "days": [ + "Niadziela", + "Paniadziełak", + "Aŭtorak", + "Sierada", + "Čaćvier", + "Piatnica", + "Subota" + ], + "shortDays": ["Nd", "Pn", "Aŭ", "Sr", "Čć", "Pt", "Sb"], + "toolbar": { + "exportToSVG": "Spampavać SVG", + "exportToPNG": "Spampavać PNG", + "exportToCSV": "Spampavać CSV", + "menu": "Meniu", + "selection": "Vyłučeńnie", + "selectionZoom": "Vyłučeńnie z maštabavańniem", + "zoomIn": "Nablizić", + "zoomOut": "Addalić", + "pan": "Ssoŭvańnie", + "reset": "Skinuć maštabavańnie" + } + } +} diff --git a/node_modules/apexcharts/src/locales/ca.json b/node_modules/apexcharts/src/locales/ca.json new file mode 100644 index 0000000..cef7d1a --- /dev/null +++ b/node_modules/apexcharts/src/locales/ca.json @@ -0,0 +1,55 @@ +{ + "name": "ca", + "options": { + "months": [ + "Gener", + "Febrer", + "Març", + "Abril", + "Maig", + "Juny", + "Juliol", + "Agost", + "Setembre", + "Octubre", + "Novembre", + "Desembre" + ], + "shortMonths": [ + "Gen.", + "Febr.", + "Març", + "Abr.", + "Maig", + "Juny", + "Jul.", + "Ag.", + "Set.", + "Oct.", + "Nov.", + "Des." + ], + "days": [ + "Diumenge", + "Dilluns", + "Dimarts", + "Dimecres", + "Dijous", + "Divendres", + "Dissabte" + ], + "shortDays": ["Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds"], + "toolbar": { + "exportToSVG": "Descarregar SVG", + "exportToPNG": "Descarregar PNG", + "exportToCSV": "Descarregar CSV", + "menu": "Menú", + "selection": "Seleccionar", + "selectionZoom": "Seleccionar Zoom", + "zoomIn": "Augmentar", + "zoomOut": "Disminuir", + "pan": "Navegació", + "reset": "Reiniciar Zoom" + } + } +} diff --git a/node_modules/apexcharts/src/locales/cs.json b/node_modules/apexcharts/src/locales/cs.json new file mode 100644 index 0000000..b8d9d40 --- /dev/null +++ b/node_modules/apexcharts/src/locales/cs.json @@ -0,0 +1,55 @@ +{ + "name": "cs", + "options": { + "months": [ + "Leden", + "Únor", + "Březen", + "Duben", + "Květen", + "Červen", + "Červenec", + "Srpen", + "Září", + "Říjen", + "Listopad", + "Prosinec" + ], + "shortMonths": [ + "Led", + "Úno", + "Bře", + "Dub", + "Kvě", + "Čvn", + "Čvc", + "Srp", + "Zář", + "Říj", + "Lis", + "Pro" + ], + "days": [ + "Neděle", + "Pondělí", + "Úterý", + "Středa", + "Čtvrtek", + "Pátek", + "Sobota" + ], + "shortDays": ["Ne", "Po", "Út", "St", "Čt", "Pá", "So"], + "toolbar": { + "exportToSVG": "Stáhnout SVG", + "exportToPNG": "Stáhnout PNG", + "exportToCSV": "Stáhnout CSV", + "menu": "Menu", + "selection": "Vybrat", + "selectionZoom": "Zoom: Vybrat", + "zoomIn": "Zoom: Přiblížit", + "zoomOut": "Zoom: Oddálit", + "pan": "Přesouvat", + "reset": "Resetovat" + } + } +} diff --git a/node_modules/apexcharts/src/locales/da.json b/node_modules/apexcharts/src/locales/da.json new file mode 100644 index 0000000..e6861c0 --- /dev/null +++ b/node_modules/apexcharts/src/locales/da.json @@ -0,0 +1,55 @@ +{ + "name": "da", + "options": { + "months": [ + "januar", + "februar", + "marts", + "april", + "maj", + "juni", + "juli", + "august", + "september", + "oktober", + "november", + "december" + ], + "shortMonths": [ + "jan", + "feb", + "mar", + "apr", + "maj", + "jun", + "jul", + "aug", + "sep", + "okt", + "nov", + "dec" + ], + "days": [ + "Søndag", + "Mandag", + "Tirsdag", + "Onsdag", + "Torsdag", + "Fredag", + "Lørdag" + ], + "shortDays": ["Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"], + "toolbar": { + "exportToSVG": "Download SVG", + "exportToPNG": "Download PNG", + "exportToCSV": "Download CSV", + "menu": "Menu", + "selection": "Valg", + "selectionZoom": "Zoom til valg", + "zoomIn": "Zoom ind", + "zoomOut": "Zoom ud", + "pan": "Panorér", + "reset": "Nulstil zoom" + } + } +} diff --git a/node_modules/apexcharts/src/locales/de.json b/node_modules/apexcharts/src/locales/de.json new file mode 100644 index 0000000..af625e3 --- /dev/null +++ b/node_modules/apexcharts/src/locales/de.json @@ -0,0 +1,55 @@ +{ + "name": "de", + "options": { + "months": [ + "Januar", + "Februar", + "März", + "April", + "Mai", + "Juni", + "Juli", + "August", + "September", + "Oktober", + "November", + "Dezember" + ], + "shortMonths": [ + "Jan", + "Feb", + "Mär", + "Apr", + "Mai", + "Jun", + "Jul", + "Aug", + "Sep", + "Okt", + "Nov", + "Dez" + ], + "days": [ + "Sonntag", + "Montag", + "Dienstag", + "Mittwoch", + "Donnerstag", + "Freitag", + "Samstag" + ], + "shortDays": ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"], + "toolbar": { + "exportToSVG": "SVG speichern", + "exportToPNG": "PNG speichern", + "exportToCSV": "CSV speichern", + "menu": "Menü", + "selection": "Auswahl", + "selectionZoom": "Auswahl vergrößern", + "zoomIn": "Vergrößern", + "zoomOut": "Verkleinern", + "pan": "Verschieben", + "reset": "Zoom zurücksetzen" + } + } +} diff --git a/node_modules/apexcharts/src/locales/el.json b/node_modules/apexcharts/src/locales/el.json new file mode 100644 index 0000000..e547e54 --- /dev/null +++ b/node_modules/apexcharts/src/locales/el.json @@ -0,0 +1,55 @@ +{ + "name": "el", + "options": { + "months": [ + "Ιανουάριος", + "Φεβρουάριος", + "Μάρτιος", + "Απρίλιος", + "Μάιος", + "Ιούνιος", + "Ιούλιος", + "Αύγουστος", + "Σεπτέμβριος", + "Οκτώβριος", + "Νοέμβριος", + "Δεκέμβριος" + ], + "shortMonths": [ + "Ιαν", + "Φευ", + "Μαρ", + "Απρ", + "Μάι", + "Ιουν", + "Ιουλ", + "Αυγ", + "Σεπ", + "Οκτ", + "Νοε", + "Δεκ" + ], + "days": [ + "Κυριακή", + "Δευτέρα", + "Τρίτη", + "Τετάρτη", + "Πέμπτη", + "Παρασκευή", + "Σάββατο" + ], + "shortDays": ["Κυρ", "Δευ", "Τρι", "Τετ", "Πεμ", "Παρ", "Σαβ"], + "toolbar": { + "exportToSVG": "Λήψη SVG", + "exportToPNG": "Λήψη PNG", + "exportToCSV": "Λήψη CSV", + "menu": "Menu", + "selection": "Επιλογή", + "selectionZoom": "Μεγένθυση βάση επιλογής", + "zoomIn": "Μεγένθυνση", + "zoomOut": "Σμίκρυνση", + "pan": "Μετατόπιση", + "reset": "Επαναφορά μεγένθυνσης" + } + } +} diff --git a/node_modules/apexcharts/src/locales/en.json b/node_modules/apexcharts/src/locales/en.json new file mode 100644 index 0000000..7b12481 --- /dev/null +++ b/node_modules/apexcharts/src/locales/en.json @@ -0,0 +1,55 @@ +{ + "name": "en", + "options": { + "months": [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December" + ], + "shortMonths": [ + "Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec" + ], + "days": [ + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday" + ], + "shortDays": ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + "toolbar": { + "exportToSVG": "Download SVG", + "exportToPNG": "Download PNG", + "exportToCSV": "Download CSV", + "menu": "Menu", + "selection": "Selection", + "selectionZoom": "Selection Zoom", + "zoomIn": "Zoom In", + "zoomOut": "Zoom Out", + "pan": "Panning", + "reset": "Reset Zoom" + } + } +} diff --git a/node_modules/apexcharts/src/locales/es.json b/node_modules/apexcharts/src/locales/es.json new file mode 100644 index 0000000..8c465f6 --- /dev/null +++ b/node_modules/apexcharts/src/locales/es.json @@ -0,0 +1,55 @@ +{ + "name": "es", + "options": { + "months": [ + "Enero", + "Febrero", + "Marzo", + "Abril", + "Mayo", + "Junio", + "Julio", + "Agosto", + "Septiembre", + "Octubre", + "Noviembre", + "Diciembre" + ], + "shortMonths": [ + "Ene", + "Feb", + "Mar", + "Abr", + "May", + "Jun", + "Jul", + "Ago", + "Sep", + "Oct", + "Nov", + "Dic" + ], + "days": [ + "Domingo", + "Lunes", + "Martes", + "Miércoles", + "Jueves", + "Viernes", + "Sábado" + ], + "shortDays": ["Dom", "Lun", "Mar", "Mie", "Jue", "Vie", "Sab"], + "toolbar": { + "exportToSVG": "Descargar SVG", + "exportToPNG": "Descargar PNG", + "exportToCSV": "Descargar CSV", + "menu": "Menu", + "selection": "Seleccionar", + "selectionZoom": "Seleccionar Zoom", + "zoomIn": "Aumentar", + "zoomOut": "Disminuir", + "pan": "Navegación", + "reset": "Reiniciar Zoom" + } + } +} diff --git a/node_modules/apexcharts/src/locales/et.json b/node_modules/apexcharts/src/locales/et.json new file mode 100644 index 0000000..5aa5248 --- /dev/null +++ b/node_modules/apexcharts/src/locales/et.json @@ -0,0 +1,63 @@ +{ + "name": "et", + "options": { + "months": [ + "jaanuar", + "veebruar", + "märts", + "aprill", + "mai", + "juuni", + "juuli", + "august", + "september", + "oktoober", + "november", + "detsember" + ], + "shortMonths": [ + "jaan", + "veebr", + "märts", + "apr", + "mai", + "juuni", + "juuli", + "aug", + "sept", + "okt", + "nov", + "dets" + ], + "days": [ + "pühapäev", + "esmaspäev", + "teisipäev", + "kolmapäev", + "neljapäev", + "reede", + "laupäev" + ], + "shortDays": [ + "P", + "E", + "T", + "K", + "N", + "R", + "L" + ], + "toolbar": { + "exportToSVG": "Lae alla SVG", + "exportToPNG": "Lae alla PNG", + "exportToCSV": "Lae alla CSV", + "menu": "Menüü", + "selection": "Valik", + "selectionZoom": "Valiku suum", + "zoomIn": "Suurenda", + "zoomOut": "Vähenda", + "pan": "Panoraamimine", + "reset": "Lähtesta suum" + } + } +} diff --git a/node_modules/apexcharts/src/locales/fa.json b/node_modules/apexcharts/src/locales/fa.json new file mode 100644 index 0000000..a4c38f7 --- /dev/null +++ b/node_modules/apexcharts/src/locales/fa.json @@ -0,0 +1,55 @@ +{ + "name": "fa", + "options": { + "months": [ + "فروردین", + "اردیبهشت", + "خرداد", + "تیر", + "مرداد", + "شهریور", + "مهر", + "آبان", + "آذر", + "دی", + "بهمن", + "اسفند" + ], + "shortMonths": [ + "فرو", + "ارد", + "خرد", + "تیر", + "مرد", + "شهر", + "مهر", + "آبا", + "آذر", + "دی", + "بهمـ", + "اسفـ" + ], + "days": [ + "یکشنبه", + "دوشنبه", + "سه شنبه", + "چهارشنبه", + "پنجشنبه", + "جمعه", + "شنبه" + ], + "shortDays": ["ی", "د", "س", "چ", "پ", "ج", "ش"], + "toolbar": { + "exportToSVG": "دانلود SVG", + "exportToPNG": "دانلود PNG", + "exportToCSV": "دانلود CSV", + "menu": "منو", + "selection": "انتخاب", + "selectionZoom": "بزرگنمایی انتخابی", + "zoomIn": "بزرگنمایی", + "zoomOut": "کوچکنمایی", + "pan": "پیمایش", + "reset": "بازنشانی بزرگنمایی" + } + } +} diff --git a/node_modules/apexcharts/src/locales/fi.json b/node_modules/apexcharts/src/locales/fi.json new file mode 100644 index 0000000..73df095 --- /dev/null +++ b/node_modules/apexcharts/src/locales/fi.json @@ -0,0 +1,55 @@ +{ + "name": "fi", + "options": { + "months": [ + "Tammikuu", + "Helmikuu", + "Maaliskuu", + "Huhtikuu", + "Toukokuu", + "Kesäkuu", + "Heinäkuu", + "Elokuu", + "Syyskuu", + "Lokakuu", + "Marraskuu", + "Joulukuu" + ], + "shortMonths": [ + "Tammi", + "Helmi", + "Maalis", + "Huhti", + "Touko", + "Kesä", + "Heinä", + "Elo", + "Syys", + "Loka", + "Marras", + "Joulu" + ], + "days": [ + "Sunnuntai", + "Maanantai", + "Tiistai", + "Keskiviikko", + "Torstai", + "Perjantai", + "Lauantai" + ], + "shortDays": ["Su", "Ma", "Ti", "Ke", "To", "Pe", "La"], + "toolbar": { + "exportToSVG": "Lataa SVG", + "exportToPNG": "Lataa PNG", + "exportToCSV": "Lataa CSV", + "menu": "Valikko", + "selection": "Valinta", + "selectionZoom": "Valinnan zoomaus", + "zoomIn": "Lähennä", + "zoomOut": "Loitonna", + "pan": "Panoroi", + "reset": "Nollaa zoomaus" + } + } +} diff --git a/node_modules/apexcharts/src/locales/fr.json b/node_modules/apexcharts/src/locales/fr.json new file mode 100644 index 0000000..959ce0b --- /dev/null +++ b/node_modules/apexcharts/src/locales/fr.json @@ -0,0 +1,55 @@ +{ + "name": "fr", + "options": { + "months": [ + "janvier", + "février", + "mars", + "avril", + "mai", + "juin", + "juillet", + "août", + "septembre", + "octobre", + "novembre", + "décembre" + ], + "shortMonths": [ + "janv.", + "févr.", + "mars", + "avr.", + "mai", + "juin", + "juill.", + "août", + "sept.", + "oct.", + "nov.", + "déc." + ], + "days": [ + "dimanche", + "lundi", + "mardi", + "mercredi", + "jeudi", + "vendredi", + "samedi" + ], + "shortDays": ["dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam."], + "toolbar": { + "exportToSVG": "Télécharger au format SVG", + "exportToPNG": "Télécharger au format PNG", + "exportToCSV": "Télécharger au format CSV", + "menu": "Menu", + "selection": "Sélection", + "selectionZoom": "Sélection et zoom", + "zoomIn": "Zoomer", + "zoomOut": "Dézoomer", + "pan": "Navigation", + "reset": "Réinitialiser le zoom" + } + } +} diff --git a/node_modules/apexcharts/src/locales/he.json b/node_modules/apexcharts/src/locales/he.json new file mode 100644 index 0000000..bafff3e --- /dev/null +++ b/node_modules/apexcharts/src/locales/he.json @@ -0,0 +1,55 @@ +{ + "name": "he", + "options": { + "months": [ + "ינואר", + "פברואר", + "מרץ", + "אפריל", + "מאי", + "יוני", + "יולי", + "אוגוסט", + "ספטמבר", + "אוקטובר", + "נובמבר", + "דצמבר" + ], + "shortMonths": [ + "ינו׳", + "פבר׳", + "מרץ", + "אפר׳", + "מאי", + "יוני", + "יולי", + "אוג׳", + "ספט׳", + "אוק׳", + "נוב׳", + "דצמ׳" + ], + "days": [ + "ראשון", + "שני", + "שלישי", + "רביעי", + "חמישי", + "שישי", + "שבת" + ], + "shortDays": ["א׳", "ב׳", "ג׳", "ד׳", "ה׳", "ו׳", "ש׳"], + "toolbar": { + "exportToSVG": "הורד SVG", + "exportToPNG": "הורד PNG", + "exportToCSV": "הורד CSV", + "menu": "תפריט", + "selection": "בחירה", + "selectionZoom": "זום בחירה", + "zoomIn": "הגדלה", + "zoomOut": "הקטנה", + "pan": "הזזה", + "reset": "איפוס תצוגה" + } + } +} diff --git a/node_modules/apexcharts/src/locales/hi.json b/node_modules/apexcharts/src/locales/hi.json new file mode 100644 index 0000000..2191342 --- /dev/null +++ b/node_modules/apexcharts/src/locales/hi.json @@ -0,0 +1,55 @@ +{ + "name": "hi", + "options": { + "months": [ + "जनवरी", + "फ़रवरी", + "मार्च", + "अप्रैल", + "मई", + "जून", + "जुलाई", + "अगस्त", + "सितंबर", + "अक्टूबर", + "नवंबर", + "दिसंबर" + ], + "shortMonths": [ + "जनवरी", + "फ़रवरी", + "मार्च", + "अप्रैल", + "मई", + "जून", + "जुलाई", + "अगस्त", + "सितंबर", + "अक्टूबर", + "नवंबर", + "दिसंबर" + ], + "days": [ + "रविवार", + "सोमवार", + "मंगलवार", + "बुधवार", + "गुरुवार", + "शुक्रवार", + "शनिवार" + ], + "shortDays": ["रवि", "सोम", "मंगल", "बुध", "गुरु", "शुक्र", "शनि"], + "toolbar": { + "exportToSVG": "निर्यात SVG", + "exportToPNG": "निर्यात PNG", + "exportToCSV": "निर्यात CSV", + "menu": "सूची", + "selection": "चयन", + "selectionZoom": "ज़ूम करना", + "zoomIn": "ज़ूम इन", + "zoomOut": "ज़ूम आउट", + "pan": "पैनिंग", + "reset": "फिर से कायम करना" + } + } +} diff --git a/node_modules/apexcharts/src/locales/hr.json b/node_modules/apexcharts/src/locales/hr.json new file mode 100644 index 0000000..52ab2fc --- /dev/null +++ b/node_modules/apexcharts/src/locales/hr.json @@ -0,0 +1,55 @@ +{ + "name": "hr", + "options": { + "months": [ + "Siječanj", + "Veljača", + "Ožujak", + "Travanj", + "Svibanj", + "Lipanj", + "Srpanj", + "Kolovoz", + "Rujan", + "Listopad", + "Studeni", + "Prosinac" + ], + "shortMonths": [ + "Sij", + "Velj", + "Ožu", + "Tra", + "Svi", + "Lip", + "Srp", + "Kol", + "Ruj", + "Lis", + "Stu", + "Pro" + ], + "days": [ + "Nedjelja", + "Ponedjeljak", + "Utorak", + "Srijeda", + "Četvrtak", + "Petak", + "Subota" + ], + "shortDays": ["Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub"], + "toolbar": { + "exportToSVG": "Preuzmi SVG", + "exportToPNG": "Preuzmi PNG", + "exportToCSV": "Preuzmi CSV", + "menu": "Izbornik", + "selection": "Odabir", + "selectionZoom": "Odabirno povećanje", + "zoomIn": "Uvećajte prikaz", + "zoomOut": "Umanjite prikaz", + "pan": "Pomicanje", + "reset": "Povratak na zadani prikaz" + } + } +} diff --git a/node_modules/apexcharts/src/locales/hu.json b/node_modules/apexcharts/src/locales/hu.json new file mode 100644 index 0000000..04142a0 --- /dev/null +++ b/node_modules/apexcharts/src/locales/hu.json @@ -0,0 +1,64 @@ +{ + "name": "hu", + "options": { + "months": [ + "január", + "február", + "március", + "április", + "május", + "június", + "július", + "augusztus", + "szeptember", + "október", + "november", + "december" + ], + "shortMonths": [ + "jan", + "feb", + "mar", + "ápr", + "máj", + "jún", + "júl", + "aug", + "szept", + "okt", + "nov", + "dec" + ], + "days": [ + "hétfő", + "kedd", + "szerda", + "csütörtök", + "péntek", + "szombat", + "vasárnap" + ], + "shortDays": [ + "H", + "K", + "Sze", + "Cs", + "P", + "Szo", + "V" + ], + "toolbar": { + "exportToSVG": "Exportálás SVG-be", + "exportToPNG": "Exportálás PNG-be", + "exportToCSV": "Exportálás CSV-be", + "menu": "Fő ajánlat", + "download": "SVG letöltése", + "selection": "Kiválasztás", + "selectionZoom": "Nagyító kiválasztása", + "zoomIn": "Nagyítás", + "zoomOut": "Kicsinyítés", + "pan": "Képcsúsztatás", + "reset": "Nagyító visszaállítása" + } + } +} diff --git a/node_modules/apexcharts/src/locales/hy.json b/node_modules/apexcharts/src/locales/hy.json new file mode 100644 index 0000000..cdbe469 --- /dev/null +++ b/node_modules/apexcharts/src/locales/hy.json @@ -0,0 +1,55 @@ +{ + "name": "hy", + "options": { + "months": [ + "Հունվար", + "Փետրվար", + "Մարտ", + "Ապրիլ", + "Մայիս", + "Հունիս", + "Հուլիս", + "Օգոստոս", + "Սեպտեմբեր", + "Հոկտեմբեր", + "Նոյեմբեր", + "Դեկտեմբեր" + ], + "shortMonths": [ + "Հնվ", + "Փտվ", + "Մրտ", + "Ապր", + "Մյս", + "Հնս", + "Հլիս", + "Օգս", + "Սեպ", + "Հոկ", + "Նոյ", + "Դեկ" + ], + "days": [ + "Կիրակի", + "Երկուշաբթի", + "Երեքշաբթի", + "Չորեքշաբթի", + "Հինգշաբթի", + "Ուրբաթ", + "Շաբաթ" + ], + "shortDays": ["Կիր", "Երկ", "Երք", "Չրք", "Հնգ", "Ուրբ", "Շբթ"], + "toolbar": { + "exportToSVG": "Բեռնել SVG", + "exportToPNG": "Բեռնել PNG", + "exportToCSV": "Բեռնել CSV", + "menu": "Մենյու", + "selection": "Ընտրված", + "selectionZoom": "Ընտրված հատվածի խոշորացում", + "zoomIn": "Խոշորացնել", + "zoomOut": "Մանրացնել", + "pan": "Տեղափոխում", + "reset": "Բերել սկզբնական վիճակի" + } + } +} diff --git a/node_modules/apexcharts/src/locales/id.json b/node_modules/apexcharts/src/locales/id.json new file mode 100644 index 0000000..52a34b6 --- /dev/null +++ b/node_modules/apexcharts/src/locales/id.json @@ -0,0 +1,47 @@ +{ + "name": "id", + "options": { + "months": [ + "Januari", + "Februari", + "Maret", + "April", + "Mei", + "Juni", + "Juli", + "Agustus", + "September", + "Oktober", + "November", + "Desember" + ], + "shortMonths": [ + "Jan", + "Feb", + "Mar", + "Apr", + "Mei", + "Jun", + "Jul", + "Agu", + "Sep", + "Okt", + "Nov", + "Des" + ], + "days": ["Minggu", "Senin", "Selasa", "Rabu", "kamis", "Jumat", "Sabtu"], + "shortDays": ["Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab"], + "toolbar": { + "exportToSVG": "Unduh SVG", + "exportToPNG": "Unduh PNG", + "exportToCSV": "Unduh CSV", + "menu": "Menu", + "selection": "Pilihan", + "selectionZoom": "Perbesar Pilihan", + "zoomIn": "Perbesar", + "zoomOut": "Perkecil", + "pan": "Geser", + "reset": "Atur Ulang Zoom" + } + } +} diff --git a/node_modules/apexcharts/src/locales/it.json b/node_modules/apexcharts/src/locales/it.json new file mode 100644 index 0000000..7facfea --- /dev/null +++ b/node_modules/apexcharts/src/locales/it.json @@ -0,0 +1,55 @@ +{ + "name": "it", + "options": { + "months": [ + "Gennaio", + "Febbraio", + "Marzo", + "Aprile", + "Maggio", + "Giugno", + "Luglio", + "Agosto", + "Settembre", + "Ottobre", + "Novembre", + "Dicembre" + ], + "shortMonths": [ + "Gen", + "Feb", + "Mar", + "Apr", + "Mag", + "Giu", + "Lug", + "Ago", + "Set", + "Ott", + "Nov", + "Dic" + ], + "days": [ + "Domenica", + "Lunedì", + "Martedì", + "Mercoledì", + "Giovedì", + "Venerdì", + "Sabato" + ], + "shortDays": ["Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"], + "toolbar": { + "exportToSVG": "Scarica SVG", + "exportToPNG": "Scarica PNG", + "exportToCSV": "Scarica CSV", + "menu": "Menu", + "selection": "Selezione", + "selectionZoom": "Seleziona Zoom", + "zoomIn": "Zoom In", + "zoomOut": "Zoom Out", + "pan": "Sposta", + "reset": "Reimposta Zoom" + } + } +} diff --git a/node_modules/apexcharts/src/locales/ja.json b/node_modules/apexcharts/src/locales/ja.json new file mode 100644 index 0000000..2b3af52 --- /dev/null +++ b/node_modules/apexcharts/src/locales/ja.json @@ -0,0 +1,55 @@ +{ + "name": "ja", + "options": { + "months": [ + "1月", + "2月", + "3月", + "4月", + "5月", + "6月", + "7月", + "8月", + "9月", + "10月", + "11月", + "12月" + ], + "shortMonths": [ + "1月", + "2月", + "3月", + "4月", + "5月", + "6月", + "7月", + "8月", + "9月", + "10月", + "11月", + "12月" + ], + "days": [ + "日曜日", + "月曜日", + "火曜日", + "水曜日", + "木曜日", + "金曜日", + "土曜日" + ], + "shortDays": ["日", "月", "火", "水", "木", "金", "土"], + "toolbar": { + "exportToSVG": "SVGダウンロード", + "exportToPNG": "PNGダウンロード", + "exportToCSV": "CSVダウンロード", + "menu": "メニュー", + "selection": "選択", + "selectionZoom": "選択ズーム", + "zoomIn": "拡大", + "zoomOut": "縮小", + "pan": "パン", + "reset": "ズームリセット" + } + } +} diff --git a/node_modules/apexcharts/src/locales/ka.json b/node_modules/apexcharts/src/locales/ka.json new file mode 100644 index 0000000..b3c8a0f --- /dev/null +++ b/node_modules/apexcharts/src/locales/ka.json @@ -0,0 +1,55 @@ +{ + "name": "ka", + "options": { + "months": [ + "იანვარი", + "თებერვალი", + "მარტი", + "აპრილი", + "მაისი", + "ივნისი", + "ივლისი", + "აგვისტო", + "სექტემბერი", + "ოქტომბერი", + "ნოემბერი", + "დეკემბერი" + ], + "shortMonths": [ + "იან", + "თებ", + "მარ", + "აპრ", + "მაი", + "ივნ", + "ივლ", + "აგვ", + "სექ", + "ოქტ", + "ნოე", + "დეკ" + ], + "days": [ + "კვირა", + "ორშაბათი", + "სამშაბათი", + "ოთხშაბათი", + "ხუთშაბათი", + "პარასკევი", + "შაბათი" + ], + "shortDays": ["კვი", "ორშ", "სამ", "ოთხ", "ხუთ", "პარ", "შაბ"], + "toolbar": { + "exportToSVG": "გადმოქაჩე SVG", + "exportToPNG": "გადმოქაჩე PNG", + "exportToCSV": "გადმოქაჩე CSV", + "menu": "მენიუ", + "selection": "არჩევა", + "selectionZoom": "არჩეულის გადიდება", + "zoomIn": "გადიდება", + "zoomOut": "დაპატარაება", + "pan": "გადაჩოჩება", + "reset": "გადიდების გაუქმება" + } + } +} diff --git a/node_modules/apexcharts/src/locales/ko.json b/node_modules/apexcharts/src/locales/ko.json new file mode 100644 index 0000000..181196d --- /dev/null +++ b/node_modules/apexcharts/src/locales/ko.json @@ -0,0 +1,55 @@ +{ + "name": "ko", + "options": { + "months": [ + "1월", + "2월", + "3월", + "4월", + "5월", + "6월", + "7월", + "8월", + "9월", + "10월", + "11월", + "12월" + ], + "shortMonths": [ + "1월", + "2월", + "3월", + "4월", + "5월", + "6월", + "7월", + "8월", + "9월", + "10월", + "11월", + "12월" + ], + "days": [ + "일요일", + "월요일", + "화요일", + "수요일", + "목요일", + "금요일", + "토요일" + ], + "shortDays": ["일", "월", "화", "수", "목", "금", "토"], + "toolbar": { + "exportToSVG": "SVG 다운로드", + "exportToPNG": "PNG 다운로드", + "exportToCSV": "CSV 다운로드", + "menu": "메뉴", + "selection": "선택", + "selectionZoom": "선택영역 확대", + "zoomIn": "확대", + "zoomOut": "축소", + "pan": "패닝", + "reset": "원래대로" + } + } +} diff --git a/node_modules/apexcharts/src/locales/lt.json b/node_modules/apexcharts/src/locales/lt.json new file mode 100644 index 0000000..4ed1520 --- /dev/null +++ b/node_modules/apexcharts/src/locales/lt.json @@ -0,0 +1,55 @@ +{ + "name": "lt", + "options": { + "months": [ + "Sausis", + "Vasaris", + "Kovas", + "Balandis", + "Gegužė", + "Birželis", + "Liepa", + "Rugpjūtis", + "Rugsėjis", + "Spalis", + "Lapkritis", + "Gruodis" + ], + "shortMonths": [ + "Sau", + "Vas", + "Kov", + "Bal", + "Geg", + "Bir", + "Lie", + "Rgp", + "Rgs", + "Spl", + "Lap", + "Grd" + ], + "days": [ + "Sekmadienis", + "Pirmadienis", + "Antradienis", + "Trečiadienis", + "Ketvirtadienis", + "Penktadienis", + "Šeštadienis" + ], + "shortDays": ["Sk", "Per", "An", "Tr", "Kt", "Pn", "Št"], + "toolbar": { + "exportToSVG": "Atsisiųsti SVG", + "exportToPNG": "Atsisiųsti PNG", + "exportToCSV": "Atsisiųsti CSV", + "menu": "Menu", + "selection": "Pasirinkimas", + "selectionZoom": "Zoom: Pasirinkimas", + "zoomIn": "Zoom: Priartinti", + "zoomOut": "Zoom: Atitolinti", + "pan": "Perkėlimas", + "reset": "Atstatyti" + } + } +} diff --git a/node_modules/apexcharts/src/locales/lv.json b/node_modules/apexcharts/src/locales/lv.json new file mode 100644 index 0000000..8a845dd --- /dev/null +++ b/node_modules/apexcharts/src/locales/lv.json @@ -0,0 +1,64 @@ +{ + "name": "lv", + "options": { + "months": [ + "janvāris", + "februāris", + "marts", + "aprīlis", + "maijs", + "jūnijs", + "jūlijs", + "augusts", + "septembris", + "oktobris", + "novembris", + "decembris" + ], + "shortMonths": [ + "janv", + "febr", + "marts", + "apr", + "maijs", + "jūn", + "jūl", + "aug", + "sept", + "okt", + "nov", + "dec" + ], + "days": [ + "svētdiena", + "pirmdiena", + "otrdiena", + "trešdiena", + "ceturtdiena", + "piektdiena", + "sestdiena" + ], + "shortDays": [ + "Sv", + "P", + "O", + "T", + "C", + "P", + "S" + ], + "toolbar": { + "exportToSVG": "Lejuplādēt SVG", + "exportToPNG": "Lejuplādēt PNG", + "exportToCSV": "Lejuplādēt CSV", + "menu": "Izvēlne", + "selection": "Atlase", + "selectionZoom": "Pietuvināt atlasi", + "zoomIn": "Pietuvināt", + "zoomOut": "Attālināt", + "pan": "Pārvietoties diagrammā", + "reset": "Atiestatīt pietuvinājumu" + } + } +} + diff --git a/node_modules/apexcharts/src/locales/ms.json b/node_modules/apexcharts/src/locales/ms.json new file mode 100644 index 0000000..eef8ca2 --- /dev/null +++ b/node_modules/apexcharts/src/locales/ms.json @@ -0,0 +1,63 @@ +{ + "name": "ms", + "options": { + "months": [ + "Januari", + "Februari", + "Mac", + "April", + "Mei", + "Jun", + "Julai", + "Ogos", + "September", + "Oktober", + "November", + "Disember" + ], + "shortMonths": [ + "Jan", + "Feb", + "Mac", + "Apr", + "Mei", + "Jun", + "Jul", + "Ogos", + "Sep", + "Okt", + "Nov", + "Dis" + ], + "days": [ + "Ahad", + "Isnin", + "Selasa", + "Rabu", + "Khamis", + "Jumaat", + "Sabtu" + ], + "shortDays": [ + "Ahd", + "Isn", + "Sel", + "Rab", + "Kha", + "Jum", + "Sab" + ], + "toolbar": { + "exportToSVG": "Muat turun SVG", + "exportToPNG": "Muat turun PNG", + "exportToCSV": "Muat turun CSV", + "menu": "Menu", + "selection": "Pilihan", + "selectionZoom": "Zum Pilihan", + "zoomIn": "Zoom Masuk", + "zoomOut": "Zoom Keluar", + "pan": "Pemusingan", + "reset": "Tetapkan Semula Zum" + } + } +} \ No newline at end of file diff --git a/node_modules/apexcharts/src/locales/nb.json b/node_modules/apexcharts/src/locales/nb.json new file mode 100644 index 0000000..3339d2c --- /dev/null +++ b/node_modules/apexcharts/src/locales/nb.json @@ -0,0 +1,55 @@ +{ + "name": "nb", + "options": { + "months": [ + "Januar", + "Februar", + "Mars", + "April", + "Mai", + "Juni", + "Juli", + "August", + "September", + "Oktober", + "November", + "Desember" + ], + "shortMonths": [ + "Jan", + "Feb", + "Mar", + "Apr", + "Mai", + "Jun", + "Jul", + "Aug", + "Sep", + "Okt", + "Nov", + "Des" + ], + "days": [ + "Søndag", + "Mandag", + "Tirsdag", + "Onsdag", + "Torsdag", + "Fredag", + "Lørdag" + ], + "shortDays": ["Sø", "Ma", "Ti", "On", "To", "Fr", "Lø"], + "toolbar": { + "exportToSVG": "Last ned SVG", + "exportToPNG": "Last ned PNG", + "exportToCSV": "Last ned CSV", + "menu": "Menu", + "selection": "Velg", + "selectionZoom": "Zoom: Velg", + "zoomIn": "Zoome inn", + "zoomOut": "Zoome ut", + "pan": "Skyving", + "reset": "Start på nytt" + } + } +} diff --git a/node_modules/apexcharts/src/locales/nl.json b/node_modules/apexcharts/src/locales/nl.json new file mode 100644 index 0000000..a94e0fa --- /dev/null +++ b/node_modules/apexcharts/src/locales/nl.json @@ -0,0 +1,63 @@ +{ + "name": "nl", + "options": { + "months": [ + "januari", + "februari", + "maart", + "april", + "mei", + "juni", + "juli", + "augustus", + "september", + "oktober", + "november", + "december" + ], + "shortMonths": [ + "jan.", + "feb.", + "mrt.", + "apr.", + "mei.", + "jun.", + "jul.", + "aug.", + "sep.", + "okt.", + "nov.", + "dec." + ], + "days": [ + "zondag", + "maandag", + "dinsdag", + "woensdag", + "donderdag", + "vrijdag", + "zaterdag" + ], + "shortDays": [ + "zo.", + "ma.", + "di.", + "wo.", + "do.", + "vr.", + "za." + ], + "toolbar": { + "exportToSVG": "Download SVG", + "exportToPNG": "Download PNG", + "exportToCSV": "Download CSV", + "menu": "Menu", + "selection": "Selectie", + "selectionZoom": "Zoom selectie", + "zoomIn": "Zoom in", + "zoomOut": "Zoom out", + "pan": "Verplaatsen", + "reset": "Standaardwaarden" + } + } +} \ No newline at end of file diff --git a/node_modules/apexcharts/src/locales/pl.json b/node_modules/apexcharts/src/locales/pl.json new file mode 100644 index 0000000..3df3c16 --- /dev/null +++ b/node_modules/apexcharts/src/locales/pl.json @@ -0,0 +1,55 @@ +{ + "name": "pl", + "options": { + "months": [ + "Styczeń", + "Luty", + "Marzec", + "Kwiecień", + "Maj", + "Czerwiec", + "Lipiec", + "Sierpień", + "Wrzesień", + "Październik", + "Listopad", + "Grudzień" + ], + "shortMonths": [ + "Sty", + "Lut", + "Mar", + "Kwi", + "Maj", + "Cze", + "Lip", + "Sie", + "Wrz", + "Paź", + "Lis", + "Gru" + ], + "days": [ + "Niedziela", + "Poniedziałek", + "Wtorek", + "Środa", + "Czwartek", + "Piątek", + "Sobota" + ], + "shortDays": ["Nd", "Pn", "Wt", "Śr", "Cz", "Pt", "Sb"], + "toolbar": { + "exportToSVG": "Pobierz SVG", + "exportToPNG": "Pobierz PNG", + "exportToCSV": "Pobierz CSV", + "menu": "Menu", + "selection": "Wybieranie", + "selectionZoom": "Zoom: Wybieranie", + "zoomIn": "Zoom: Przybliż", + "zoomOut": "Zoom: Oddal", + "pan": "Przesuwanie", + "reset": "Resetuj" + } + } +} diff --git a/node_modules/apexcharts/src/locales/pt-br.json b/node_modules/apexcharts/src/locales/pt-br.json new file mode 100644 index 0000000..a2932fc --- /dev/null +++ b/node_modules/apexcharts/src/locales/pt-br.json @@ -0,0 +1,55 @@ +{ + "name": "pt-br", + "options": { + "months": [ + "Janeiro", + "Fevereiro", + "Março", + "Abril", + "Maio", + "Junho", + "Julho", + "Agosto", + "Setembro", + "Outubro", + "Novembro", + "Dezembro" + ], + "shortMonths": [ + "Jan", + "Fev", + "Mar", + "Abr", + "Mai", + "Jun", + "Jul", + "Ago", + "Set", + "Out", + "Nov", + "Dez" + ], + "days": [ + "Domingo", + "Segunda", + "Terça", + "Quarta", + "Quinta", + "Sexta", + "Sábado" + ], + "shortDays": ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab"], + "toolbar": { + "exportToSVG": "Baixar SVG", + "exportToPNG": "Baixar PNG", + "exportToCSV": "Baixar CSV", + "menu": "Menu", + "selection": "Selecionar", + "selectionZoom": "Selecionar Zoom", + "zoomIn": "Aumentar", + "zoomOut": "Diminuir", + "pan": "Navegação", + "reset": "Reiniciar Zoom" + } + } +} diff --git a/node_modules/apexcharts/src/locales/pt.json b/node_modules/apexcharts/src/locales/pt.json new file mode 100644 index 0000000..c76cee6 --- /dev/null +++ b/node_modules/apexcharts/src/locales/pt.json @@ -0,0 +1,55 @@ +{ + "name": "pt", + "options": { + "months": [ + "Janeiro", + "Fevereiro", + "Março", + "Abril", + "Maio", + "Junho", + "Julho", + "Agosto", + "Setembro", + "Outubro", + "Novembro", + "Dezembro" + ], + "shortMonths": [ + "Jan", + "Fev", + "Mar", + "Abr", + "Mai", + "Jun", + "Jul", + "Ag", + "Set", + "Out", + "Nov", + "Dez" + ], + "days": [ + "Domingo", + "Segunda-feira", + "Terça-feira", + "Quarta-feira", + "Quinta-feira", + "Sexta-feira", + "Sábado" + ], + "shortDays": ["Do", "Se", "Te", "Qa", "Qi", "Sx", "Sa"], + "toolbar": { + "exportToSVG": "Transferir SVG", + "exportToPNG": "Transferir PNG", + "exportToCSV": "Transferir CSV", + "menu": "Menu", + "selection": "Selecionar", + "selectionZoom": "Zoom: Selecionar", + "zoomIn": "Zoom: Aumentar", + "zoomOut": "Zoom: Diminuir", + "pan": "Deslocamento", + "reset": "Redefinir" + } + } +} diff --git a/node_modules/apexcharts/src/locales/rs.json b/node_modules/apexcharts/src/locales/rs.json new file mode 100644 index 0000000..c4fff61 --- /dev/null +++ b/node_modules/apexcharts/src/locales/rs.json @@ -0,0 +1,55 @@ +{ + "name": "rs", + "options": { + "months": [ + "Januar", + "Februar", + "Mart", + "April", + "Maj", + "Jun", + "Jul", + "Avgust", + "Septembar", + "Oktobar", + "Novembar", + "Decembar" + ], + "shortMonths": [ + "Jan", + "Feb", + "Mar", + "Apr", + "Maj", + "Jun", + "Jul", + "Avg", + "Sep", + "Okt", + "Nov", + "Dec" + ], + "days": [ + "Nedelja", + "Ponedeljak", + "Utorak", + "Sreda", + "Četvrtak", + "Petak", + "Subota" + ], + "shortDays": ["Ned", "Pon", "Uto", "Sre", "Čet", "Pet", "Sub"], + "toolbar": { + "exportToSVG": "Preuzmi SVG", + "exportToPNG": "Preuzmi PNG", + "exportToCSV": "Preuzmi CSV", + "menu": "Meni", + "selection": "Odabir", + "selectionZoom": "Odabirno povećanje", + "zoomIn": "Uvećajte prikaz", + "zoomOut": "Umanjite prikaz", + "pan": "Pomeranje", + "reset": "Resetuj prikaz" + } + } +} diff --git a/node_modules/apexcharts/src/locales/ru.json b/node_modules/apexcharts/src/locales/ru.json new file mode 100644 index 0000000..55f3a0c --- /dev/null +++ b/node_modules/apexcharts/src/locales/ru.json @@ -0,0 +1,55 @@ +{ + "name": "ru", + "options": { + "months": [ + "Январь", + "Февраль", + "Март", + "Апрель", + "Май", + "Июнь", + "Июль", + "Август", + "Сентябрь", + "Октябрь", + "Ноябрь", + "Декабрь" + ], + "shortMonths": [ + "Янв", + "Фев", + "Мар", + "Апр", + "Май", + "Июн", + "Июл", + "Авг", + "Сен", + "Окт", + "Ноя", + "Дек" + ], + "days": [ + "Воскресенье", + "Понедельник", + "Вторник", + "Среда", + "Четверг", + "Пятница", + "Суббота" + ], + "shortDays": ["Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"], + "toolbar": { + "exportToSVG": "Сохранить SVG", + "exportToPNG": "Сохранить PNG", + "exportToCSV": "Сохранить CSV", + "menu": "Меню", + "selection": "Выбор", + "selectionZoom": "Выбор с увеличением", + "zoomIn": "Увеличить", + "zoomOut": "Уменьшить", + "pan": "Перемещение", + "reset": "Сбросить увеличение" + } + } +} diff --git a/node_modules/apexcharts/src/locales/se.json b/node_modules/apexcharts/src/locales/se.json new file mode 100644 index 0000000..e9409e5 --- /dev/null +++ b/node_modules/apexcharts/src/locales/se.json @@ -0,0 +1,55 @@ +{ + "name": "se", + "options": { + "months": [ + "Januari", + "Februari", + "Mars", + "April", + "Maj", + "Juni", + "Juli", + "Augusti", + "September", + "Oktober", + "November", + "December" + ], + "shortMonths": [ + "Jan", + "Feb", + "Mar", + "Apr", + "Maj", + "Juni", + "Juli", + "Aug", + "Sep", + "Okt", + "Nov", + "Dec" + ], + "days": [ + "Söndag", + "Måndag", + "Tisdag", + "Onsdag", + "Torsdag", + "Fredag", + "Lördag" + ], + "shortDays": ["Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"], + "toolbar": { + "exportToSVG": "Ladda SVG", + "exportToPNG": "Ladda PNG", + "exportToCSV": "Ladda CSV", + "menu": "Meny", + "selection": "Selektion", + "selectionZoom": "Val av zoom", + "zoomIn": "Zooma in", + "zoomOut": "Zooma ut", + "pan": "Panorering", + "reset": "Återställ zoomning" + } + } +} diff --git a/node_modules/apexcharts/src/locales/sk.json b/node_modules/apexcharts/src/locales/sk.json new file mode 100644 index 0000000..03e69aa --- /dev/null +++ b/node_modules/apexcharts/src/locales/sk.json @@ -0,0 +1,55 @@ +{ + "name": "sk", + "options": { + "months": [ + "Január", + "Február", + "Marec", + "Apríl", + "Máj", + "Jún", + "Júl", + "August", + "September", + "Október", + "November", + "December" + ], + "shortMonths": [ + "Jan", + "Feb", + "Mar", + "Apr", + "Máj", + "Jún", + "Júl", + "Aug", + "Sep", + "Okt", + "Nov", + "Dec" + ], + "days": [ + "Nedeľa", + "Pondelok", + "Utorok", + "Streda", + "Štvrtok", + "Piatok", + "Sobota" + ], + "shortDays": ["Ne", "Po", "Ut", "St", "Št", "Pi", "So"], + "toolbar": { + "exportToSVG": "Stiahnuť SVG", + "exportToPNG": "Stiahnuť PNG", + "exportToCSV": "Stiahnuť CSV", + "menu": "Menu", + "selection": "Vyberanie", + "selectionZoom": "Zoom: Vyberanie", + "zoomIn": "Zoom: Priblížiť", + "zoomOut": "Zoom: Vzdialiť", + "pan": "Presúvanie", + "reset": "Resetovať" + } + } +} diff --git a/node_modules/apexcharts/src/locales/sl.json b/node_modules/apexcharts/src/locales/sl.json new file mode 100644 index 0000000..793ff56 --- /dev/null +++ b/node_modules/apexcharts/src/locales/sl.json @@ -0,0 +1,55 @@ +{ + "name": "sl", + "options": { + "months": [ + "Januar", + "Februar", + "Marec", + "April", + "Maj", + "Junij", + "Julij", + "Avgust", + "Septemer", + "Oktober", + "November", + "December" + ], + "shortMonths": [ + "Jan", + "Feb", + "Mar", + "Apr", + "Maj", + "Jun", + "Jul", + "Avg", + "Sep", + "Okt", + "Nov", + "Dec" + ], + "days": [ + "Nedelja", + "Ponedeljek", + "Torek", + "Sreda", + "Četrtek", + "Petek", + "Sobota" + ], + "shortDays": ["Ne", "Po", "To", "Sr", "Če", "Pe", "So"], + "toolbar": { + "exportToSVG": "Prenesi SVG", + "exportToPNG": "Prenesi PNG", + "exportToCSV": "Prenesi CSV", + "menu": "Menu", + "selection": "Izbiranje", + "selectionZoom": "Zoom: Izbira", + "zoomIn": "Zoom: Približaj", + "zoomOut": "Zoom: Oddalji", + "pan": "Pomikanje", + "reset": "Resetiraj" + } + } +} diff --git a/node_modules/apexcharts/src/locales/sq.json b/node_modules/apexcharts/src/locales/sq.json new file mode 100644 index 0000000..a478591 --- /dev/null +++ b/node_modules/apexcharts/src/locales/sq.json @@ -0,0 +1,55 @@ +{ + "name": "sq", + "options": { + "months": [ + "Janar", + "Shkurt", + "Mars", + "Prill", + "Maj", + "Qershor", + "Korrik", + "Gusht", + "Shtator", + "Tetor", + "Nëntor", + "Dhjetor" + ], + "shortMonths": [ + "Jan", + "Shk", + "Mar", + "Pr", + "Maj", + "Qer", + "Korr", + "Gush", + "Sht", + "Tet", + "Nën", + "Dhj" + ], + "days": [ + "e Dielë", + "e Hënë", + "e Martë", + "e Mërkurë", + "e Enjte", + "e Premte", + "e Shtunë" + ], + "shortDays": ["Die", "Hën", "Mar", "Mër", "Enj", "Pre", "Sht"], + "toolbar": { + "exportToSVG": "Shkarko SVG", + "exportToPNG": "Shkarko PNG", + "exportToCSV": "Shkarko CSV", + "menu": "Menu", + "selection": "Seleksiono", + "selectionZoom": "Seleksiono Zmadhim", + "zoomIn": "Zmadho", + "zoomOut": "Zvogëlo", + "pan": "Spostoje", + "reset": "Rikthe dimensionin" + } + } +} diff --git a/node_modules/apexcharts/src/locales/th.json b/node_modules/apexcharts/src/locales/th.json new file mode 100644 index 0000000..2b3b109 --- /dev/null +++ b/node_modules/apexcharts/src/locales/th.json @@ -0,0 +1,55 @@ +{ + "name": "th", + "options": { + "months": [ + "มกราคม", + "กุมภาพันธ์", + "มีนาคม", + "เมษายน", + "พฤษภาคม", + "มิถุนายน", + "กรกฎาคม", + "สิงหาคม", + "กันยายน", + "ตุลาคม", + "พฤศจิกายน", + "ธันวาคม" + ], + "shortMonths": [ + "ม.ค.", + "ก.พ.", + "มี.ค.", + "เม.ย.", + "พ.ค.", + "มิ.ย.", + "ก.ค.", + "ส.ค.", + "ก.ย.", + "ต.ค.", + "พ.ย.", + "ธ.ค." + ], + "days": [ + "อาทิตย์", + "จันทร์", + "อังคาร", + "พุธ", + "พฤหัสบดี", + "ศุกร์", + "เสาร์" + ], + "shortDays": ["อา", "จ", "อ", "พ", "พฤ", "ศ", "ส"], + "toolbar": { + "exportToSVG": "ดาวน์โหลด SVG", + "exportToPNG": "ดาวน์โหลด PNG", + "exportToCSV": "ดาวน์โหลด CSV", + "menu": "เมนู", + "selection": "เลือก", + "selectionZoom": "เลือกจุดที่จะซูม", + "zoomIn": "ซูมเข้า", + "zoomOut": "ซูมออก", + "pan": "ปรากฎว่า", + "reset": "รีเซ็ตการซูม" + } + } +} diff --git a/node_modules/apexcharts/src/locales/tr.json b/node_modules/apexcharts/src/locales/tr.json new file mode 100644 index 0000000..dda01e8 --- /dev/null +++ b/node_modules/apexcharts/src/locales/tr.json @@ -0,0 +1,55 @@ +{ + "name": "tr", + "options": { + "months": [ + "Ocak", + "Şubat", + "Mart", + "Nisan", + "Mayıs", + "Haziran", + "Temmuz", + "Ağustos", + "Eylül", + "Ekim", + "Kasım", + "Aralık" + ], + "shortMonths": [ + "Oca", + "Şub", + "Mar", + "Nis", + "May", + "Haz", + "Tem", + "Ağu", + "Eyl", + "Eki", + "Kas", + "Ara" + ], + "days": [ + "Pazar", + "Pazartesi", + "Salı", + "Çarşamba", + "Perşembe", + "Cuma", + "Cumartesi" + ], + "shortDays": ["Paz", "Pzt", "Sal", "Çar", "Per", "Cum", "Cmt"], + "toolbar": { + "exportToSVG": "SVG İndir", + "exportToPNG": "PNG İndir", + "exportToCSV": "CSV İndir", + "menu": "Menü", + "selection": "Seçim", + "selectionZoom": "Seçim Yakınlaştır", + "zoomIn": "Yakınlaştır", + "zoomOut": "Uzaklaştır", + "pan": "Kaydır", + "reset": "Yakınlaştırmayı Sıfırla" + } + } +} diff --git a/node_modules/apexcharts/src/locales/ua.json b/node_modules/apexcharts/src/locales/ua.json new file mode 100644 index 0000000..d6f81de --- /dev/null +++ b/node_modules/apexcharts/src/locales/ua.json @@ -0,0 +1,55 @@ +{ + "name": "ua", + "options": { + "months": [ + "Січень", + "Лютий", + "Березень", + "Квітень", + "Травень", + "Червень", + "Липень", + "Серпень", + "Вересень", + "Жовтень", + "Листопад", + "Грудень" + ], + "shortMonths": [ + "Січ", + "Лют", + "Бер", + "Кві", + "Тра", + "Чер", + "Лип", + "Сер", + "Вер", + "Жов", + "Лис", + "Гру" + ], + "days": [ + "Неділя", + "Понеділок", + "Вівторок", + "Середа", + "Четвер", + "П'ятниця", + "Субота" + ], + "shortDays": ["Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"], + "toolbar": { + "exportToSVG": "Зберегти SVG", + "exportToPNG": "Зберегти PNG", + "exportToCSV": "Зберегти CSV", + "menu": "Меню", + "selection": "Вибір", + "selectionZoom": "Вибір із збільшенням", + "zoomIn": "Збільшити", + "zoomOut": "Зменшити", + "pan": "Переміщення", + "reset": "Скинути збільшення" + } + } +} diff --git a/node_modules/apexcharts/src/locales/vi.json b/node_modules/apexcharts/src/locales/vi.json new file mode 100644 index 0000000..9323583 --- /dev/null +++ b/node_modules/apexcharts/src/locales/vi.json @@ -0,0 +1,63 @@ +{ + "name": "vi", + "options": { + "months": [ + "Tháng 01", + "Tháng 02", + "Tháng 03", + "Tháng 04", + "Tháng 05", + "Tháng 06", + "Tháng 07", + "Tháng 08", + "Tháng 09", + "Tháng 10", + "Tháng 11", + "Tháng 12" + ], + "shortMonths": [ + "Th01", + "Th02", + "Th03", + "Th04", + "Th05", + "Th06", + "Th07", + "Th08", + "Th09", + "Th10", + "Th11", + "Th12" + ], + "days": [ + "Chủ nhật", + "Thứ hai", + "Thứ ba", + "Thứ Tư", + "Thứ năm", + "Thứ sáu", + "Thứ bảy" + ], + "shortDays": [ + "CN", + "T2", + "T3", + "T4", + "T5", + "T6", + "T7" + ], + "toolbar": { + "exportToSVG": "Tải xuống SVG", + "exportToPNG": "Tải xuống PNG", + "exportToCSV": "Tải xuống CSV", + "menu": "Tuỳ chọn", + "selection": "Vùng chọn", + "selectionZoom": "Vùng chọn phóng to", + "zoomIn": "Phóng to", + "zoomOut": "Thu nhỏ", + "pan": "Di chuyển", + "reset": "Đặt lại thu phóng" + } + } +} \ No newline at end of file diff --git a/node_modules/apexcharts/src/locales/zh-cn.json b/node_modules/apexcharts/src/locales/zh-cn.json new file mode 100644 index 0000000..8944659 --- /dev/null +++ b/node_modules/apexcharts/src/locales/zh-cn.json @@ -0,0 +1,55 @@ +{ + "name": "zh-cn", + "options": { + "months": [ + "一月", + "二月", + "三月", + "四月", + "五月", + "六月", + "七月", + "八月", + "九月", + "十月", + "十一月", + "十二月" + ], + "shortMonths": [ + "一月", + "二月", + "三月", + "四月", + "五月", + "六月", + "七月", + "八月", + "九月", + "十月", + "十一月", + "十二月" + ], + "days": [ + "星期天", + "星期一", + "星期二", + "星期三", + "星期四", + "星期五", + "星期六" + ], + "shortDays": ["周日", "周一", "周二", "周三", "周四", "周五", "周六"], + "toolbar": { + "exportToSVG": "下载 SVG", + "exportToPNG": "下载 PNG", + "exportToCSV": "下载 CSV", + "menu": "菜单", + "selection": "选择", + "selectionZoom": "选择缩放", + "zoomIn": "放大", + "zoomOut": "缩小", + "pan": "平移", + "reset": "重置缩放" + } + } +} diff --git a/node_modules/apexcharts/src/locales/zh-tw.json b/node_modules/apexcharts/src/locales/zh-tw.json new file mode 100644 index 0000000..2444b46 --- /dev/null +++ b/node_modules/apexcharts/src/locales/zh-tw.json @@ -0,0 +1,55 @@ +{ + "name": "zh-tw", + "options": { + "months": [ + "一月", + "二月", + "三月", + "四月", + "五月", + "六月", + "七月", + "八月", + "九月", + "十月", + "十一月", + "十二月" + ], + "shortMonths": [ + "一月", + "二月", + "三月", + "四月", + "五月", + "六月", + "七月", + "八月", + "九月", + "十月", + "十一月", + "十二月" + ], + "days": [ + "星期日", + "星期一", + "星期二", + "星期三", + "星期四", + "星期五", + "星期六" + ], + "shortDays": ["週日", "週一", "週二", "週三", "週四", "週五", "週六"], + "toolbar": { + "exportToSVG": "下載 SVG", + "exportToPNG": "下載 PNG", + "exportToCSV": "下載 CSV", + "menu": "選單", + "selection": "選擇", + "selectionZoom": "選擇縮放", + "zoomIn": "放大", + "zoomOut": "縮小", + "pan": "平移", + "reset": "重置縮放" + } + } +} diff --git a/node_modules/apexcharts/src/modules/Animations.js b/node_modules/apexcharts/src/modules/Animations.js new file mode 100644 index 0000000..d16d62c --- /dev/null +++ b/node_modules/apexcharts/src/modules/Animations.js @@ -0,0 +1,166 @@ +import Utils from '../utils/Utils' + +/** + * ApexCharts Animation Class. + * + * @module Animations + **/ + +export default class Animations { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + } + + animateLine(el, from, to, speed) { + el.attr(from).animate(speed).attr(to) + } + + /* + ** Animate radius of a circle element + */ + animateMarker(el, speed, easing, cb) { + el.attr({ + opacity: 0, + }) + .animate(speed) + .attr({ + opacity: 1, + }) + .after(() => { + cb() + }) + } + + /* + ** Animate rect properties + */ + animateRect(el, from, to, speed, fn) { + el.attr(from) + .animate(speed) + .attr(to) + .after(() => fn()) + } + + animatePathsGradually(params) { + let { el, realIndex, j, fill, pathFrom, pathTo, speed, delay } = params + + let me = this + let w = this.w + + let delayFactor = 0 + + if (w.config.chart.animations.animateGradually.enabled) { + delayFactor = w.config.chart.animations.animateGradually.delay + } + + if ( + w.config.chart.animations.dynamicAnimation.enabled && + w.globals.dataChanged && + w.config.chart.type !== 'bar' + ) { + // disabled due to this bug - https://github.com/apexcharts/vue-apexcharts/issues/75 + delayFactor = 0 + } + me.morphSVG( + el, + realIndex, + j, + w.config.chart.type === 'line' && !w.globals.comboCharts + ? 'stroke' + : fill, + pathFrom, + pathTo, + speed, + delay * delayFactor + ) + } + + showDelayedElements() { + this.w.globals.delayedElements.forEach((d) => { + const ele = d.el + ele.classList.remove('apexcharts-element-hidden') + ele.classList.add('apexcharts-hidden-element-shown') + }) + } + + animationCompleted(el) { + const w = this.w + if (w.globals.animationEnded) return + + w.globals.animationEnded = true + this.showDelayedElements() + + if (typeof w.config.chart.events.animationEnd === 'function') { + w.config.chart.events.animationEnd(this.ctx, { el, w }) + } + } + + // SVG.js animation for morphing one path to another + morphSVG(el, realIndex, j, fill, pathFrom, pathTo, speed, delay) { + let w = this.w + + if (!pathFrom) { + pathFrom = el.attr('pathFrom') + } + + if (!pathTo) { + pathTo = el.attr('pathTo') + } + + const disableAnimationForCorrupPath = (path) => { + if (w.config.chart.type === 'radar') { + // radar chart drops the path to bottom and hence a corrup path looks ugly + // therefore, disable animation for such a case + speed = 1 + } + return `M 0 ${w.globals.gridHeight}` + } + + if ( + !pathFrom || + pathFrom.indexOf('undefined') > -1 || + pathFrom.indexOf('NaN') > -1 + ) { + pathFrom = disableAnimationForCorrupPath() + } + + if ( + !pathTo.trim() || + pathTo.indexOf('undefined') > -1 || + pathTo.indexOf('NaN') > -1 + ) { + pathTo = disableAnimationForCorrupPath() + } + if (!w.globals.shouldAnimate) { + speed = 1 + } + + el.plot(pathFrom) + .animate(1, delay) + .plot(pathFrom) + .animate(speed, delay) + .plot(pathTo) + .after(() => { + // a flag to indicate that the original mount function can return true now as animation finished here + if (Utils.isNumber(j)) { + if ( + j === w.globals.series[w.globals.maxValsInArrayIndex].length - 2 && + w.globals.shouldAnimate + ) { + this.animationCompleted(el) + } + } else if (fill !== 'none' && w.globals.shouldAnimate) { + if ( + (!w.globals.comboCharts && + realIndex === w.globals.series.length - 1) || + w.globals.comboCharts + ) { + this.animationCompleted(el) + } + } + + this.showDelayedElements() + }) + } +} diff --git a/node_modules/apexcharts/src/modules/Base.js b/node_modules/apexcharts/src/modules/Base.js new file mode 100644 index 0000000..87cdfb1 --- /dev/null +++ b/node_modules/apexcharts/src/modules/Base.js @@ -0,0 +1,25 @@ +import Config from './settings/Config' +import Globals from './settings/Globals' + +/** + * ApexCharts Base Class for extending user options with pre-defined ApexCharts config. + * + * @module Base + **/ +export default class Base { + constructor(opts) { + this.opts = opts + } + + init() { + const config = new Config(this.opts).init({ responsiveOverride: false }) + const globals = new Globals().init(config) + + const w = { + config, + globals + } + + return w + } +} diff --git a/node_modules/apexcharts/src/modules/Core.js b/node_modules/apexcharts/src/modules/Core.js new file mode 100644 index 0000000..9f02f5e --- /dev/null +++ b/node_modules/apexcharts/src/modules/Core.js @@ -0,0 +1,598 @@ +import Bar from '../charts/Bar' +import BarStacked from '../charts/BarStacked' +import BoxCandleStick from '../charts/BoxCandleStick' +import CoreUtils from './CoreUtils' +import Crosshairs from './Crosshairs' +import HeatMap from '../charts/HeatMap' +import Globals from '../modules/settings/Globals' +import Pie from '../charts/Pie' +import Radar from '../charts/Radar' +import Radial from '../charts/Radial' +import RangeBar from '../charts/RangeBar' +import Legend from './legend/Legend' +import Line from '../charts/Line' +import Treemap from '../charts/Treemap' +import Graphics from './Graphics' +import Range from './Range' +import Utils from '../utils/Utils' +import TimeScale from './TimeScale' + +/** + * ApexCharts Core Class responsible for major calculations and creating elements. + * + * @module Core + **/ + +export default class Core { + constructor(el, ctx) { + this.ctx = ctx + this.w = ctx.w + this.el = el + } + + setupElements() { + const { globals: gl, config: cnf } = this.w + + const ct = cnf.chart.type + const axisChartsArrTypes = [ + 'line', + 'area', + 'bar', + 'rangeBar', + 'rangeArea', + 'candlestick', + 'boxPlot', + 'scatter', + 'bubble', + 'radar', + 'heatmap', + 'treemap', + ] + + const xyChartsArrTypes = [ + 'line', + 'area', + 'bar', + 'rangeBar', + 'rangeArea', + 'candlestick', + 'boxPlot', + 'scatter', + 'bubble', + ] + + gl.axisCharts = axisChartsArrTypes.includes(ct) + gl.xyCharts = xyChartsArrTypes.includes(ct) + + gl.isBarHorizontal = + ['bar', 'rangeBar', 'boxPlot'].includes(ct) && + cnf.plotOptions.bar.horizontal + + gl.chartClass = `.apexcharts${gl.chartID}` + gl.dom.baseEl = this.el + + gl.dom.elWrap = document.createElement('div') + Graphics.setAttrs(gl.dom.elWrap, { + id: gl.chartClass.substring(1), + class: `apexcharts-canvas ${gl.chartClass.substring(1)}`, + }) + this.el.appendChild(gl.dom.elWrap) + + // gl.dom.Paper = new window.SVG.Doc(gl.dom.elWrap) + gl.dom.Paper = window.SVG().addTo(gl.dom.elWrap) + + gl.dom.Paper.attr({ + class: 'apexcharts-svg', + 'xmlns:data': 'ApexChartsNS', + transform: `translate(${cnf.chart.offsetX}, ${cnf.chart.offsetY})`, + }) + + gl.dom.Paper.node.style.background = + cnf.theme.mode === 'dark' && !cnf.chart.background + ? '#424242' + : cnf.theme.mode === 'light' && !cnf.chart.background + ? '#fff' + : cnf.chart.background + + this.setSVGDimensions() + + gl.dom.elLegendForeign = document.createElementNS(gl.SVGNS, 'foreignObject') + Graphics.setAttrs(gl.dom.elLegendForeign, { + x: 0, + y: 0, + width: gl.svgWidth, + height: gl.svgHeight, + }) + + gl.dom.elLegendWrap = document.createElement('div') + gl.dom.elLegendWrap.classList.add('apexcharts-legend') + + gl.dom.elWrap.appendChild(gl.dom.elLegendWrap) + gl.dom.Paper.node.appendChild(gl.dom.elLegendForeign) + + gl.dom.elGraphical = gl.dom.Paper.group().attr({ + class: 'apexcharts-inner apexcharts-graphical', + }) + + gl.dom.elDefs = gl.dom.Paper.defs() + gl.dom.Paper.add(gl.dom.elGraphical) + gl.dom.elGraphical.add(gl.dom.elDefs) + } + + plotChartType(ser, xyRatios) { + const { w, ctx } = this + const { config: cnf, globals: gl } = w + + const seriesTypes = { + line: { series: [], i: [] }, + area: { series: [], i: [] }, + scatter: { series: [], i: [] }, + bubble: { series: [], i: [] }, + bar: { series: [], i: [] }, + candlestick: { series: [], i: [] }, + boxPlot: { series: [], i: [] }, + rangeBar: { series: [], i: [] }, + rangeArea: { series: [], seriesRangeEnd: [], i: [] }, + } + + const chartType = cnf.chart.type || 'line' + let nonComboType = null + let comboCount = 0 + + gl.series.forEach((serie, st) => { + const seriesType = + ser[st].type === 'column' + ? 'bar' + : ser[st].type || (chartType === 'column' ? 'bar' : chartType) + + if (seriesTypes[seriesType]) { + if (seriesType === 'rangeArea') { + seriesTypes[seriesType].series.push(gl.seriesRangeStart[st]) + seriesTypes[seriesType].seriesRangeEnd.push(gl.seriesRangeEnd[st]) + } else { + seriesTypes[seriesType].series.push(serie) + } + seriesTypes[seriesType].i.push(st) + + if (seriesType === 'bar') w.globals.columnSeries = seriesTypes.bar + } else if ( + [ + 'heatmap', + 'treemap', + 'pie', + 'donut', + 'polarArea', + 'radialBar', + 'radar', + ].includes(seriesType) + ) { + nonComboType = seriesType + } else { + console.warn( + `You have specified an unrecognized series type (${seriesType}).` + ) + } + if (chartType !== seriesType && seriesType !== 'scatter') comboCount++ + }) + + if (comboCount > 0) { + if (nonComboType) { + console.warn( + `Chart or series type ${nonComboType} cannot appear with other chart or series types.` + ) + } + if (seriesTypes.bar.series.length > 0 && cnf.plotOptions.bar.horizontal) { + comboCount -= seriesTypes.bar.series.length + seriesTypes.bar = { series: [], i: [] } + w.globals.columnSeries = { series: [], i: [] } + console.warn( + 'Horizontal bars are not supported in a mixed/combo chart. Please turn off `plotOptions.bar.horizontal`' + ) + } + } + gl.comboCharts ||= comboCount > 0 + + const line = new Line(ctx, xyRatios) + const boxCandlestick = new BoxCandleStick(ctx, xyRatios) + ctx.pie = new Pie(ctx) + const radialBar = new Radial(ctx) + ctx.rangeBar = new RangeBar(ctx, xyRatios) + const radar = new Radar(ctx) + let elGraph = [] + + if (gl.comboCharts) { + const coreUtils = new CoreUtils(ctx) + if (seriesTypes.area.series.length > 0) { + elGraph.push( + ...coreUtils.drawSeriesByGroup( + seriesTypes.area, + gl.areaGroups, + 'area', + line + ) + ) + } + if (seriesTypes.bar.series.length > 0) { + if (cnf.chart.stacked) { + const barStacked = new BarStacked(ctx, xyRatios) + elGraph.push( + barStacked.draw(seriesTypes.bar.series, seriesTypes.bar.i) + ) + } else { + ctx.bar = new Bar(ctx, xyRatios) + elGraph.push(ctx.bar.draw(seriesTypes.bar.series, seriesTypes.bar.i)) + } + } + if (seriesTypes.rangeArea.series.length > 0) { + elGraph.push( + line.draw( + seriesTypes.rangeArea.series, + 'rangeArea', + seriesTypes.rangeArea.i, + seriesTypes.rangeArea.seriesRangeEnd + ) + ) + } + if (seriesTypes.line.series.length > 0) { + elGraph.push( + ...coreUtils.drawSeriesByGroup( + seriesTypes.line, + gl.lineGroups, + 'line', + line + ) + ) + } + if (seriesTypes.candlestick.series.length > 0) { + elGraph.push( + boxCandlestick.draw( + seriesTypes.candlestick.series, + 'candlestick', + seriesTypes.candlestick.i + ) + ) + } + if (seriesTypes.boxPlot.series.length > 0) { + elGraph.push( + boxCandlestick.draw( + seriesTypes.boxPlot.series, + 'boxPlot', + seriesTypes.boxPlot.i + ) + ) + } + if (seriesTypes.rangeBar.series.length > 0) { + elGraph.push( + ctx.rangeBar.draw(seriesTypes.rangeBar.series, seriesTypes.rangeBar.i) + ) + } + if (seriesTypes.scatter.series.length > 0) { + const scatterLine = new Line(ctx, xyRatios, true) + elGraph.push( + scatterLine.draw( + seriesTypes.scatter.series, + 'scatter', + seriesTypes.scatter.i + ) + ) + } + if (seriesTypes.bubble.series.length > 0) { + const bubbleLine = new Line(ctx, xyRatios, true) + elGraph.push( + bubbleLine.draw( + seriesTypes.bubble.series, + 'bubble', + seriesTypes.bubble.i + ) + ) + } + } else { + switch (cnf.chart.type) { + case 'line': + elGraph = line.draw(gl.series, 'line') + break + case 'area': + elGraph = line.draw(gl.series, 'area') + break + case 'bar': + if (cnf.chart.stacked) { + const barStacked = new BarStacked(ctx, xyRatios) + elGraph = barStacked.draw(gl.series) + } else { + ctx.bar = new Bar(ctx, xyRatios) + elGraph = ctx.bar.draw(gl.series) + } + break + case 'candlestick': + const candleStick = new BoxCandleStick(ctx, xyRatios) + elGraph = candleStick.draw(gl.series, 'candlestick') + break + case 'boxPlot': + const boxPlot = new BoxCandleStick(ctx, xyRatios) + elGraph = boxPlot.draw(gl.series, cnf.chart.type) + break + case 'rangeBar': + elGraph = ctx.rangeBar.draw(gl.series) + break + case 'rangeArea': + elGraph = line.draw( + gl.seriesRangeStart, + 'rangeArea', + undefined, + gl.seriesRangeEnd + ) + break + case 'heatmap': + const heatmap = new HeatMap(ctx, xyRatios) + elGraph = heatmap.draw(gl.series) + break + case 'treemap': + const treemap = new Treemap(ctx, xyRatios) + elGraph = treemap.draw(gl.series) + break + case 'pie': + case 'donut': + case 'polarArea': + elGraph = ctx.pie.draw(gl.series) + break + case 'radialBar': + elGraph = radialBar.draw(gl.series) + break + case 'radar': + elGraph = radar.draw(gl.series) + break + default: + elGraph = line.draw(gl.series) + } + } + + return elGraph + } + + setSVGDimensions() { + const { globals: gl, config: cnf } = this.w + + cnf.chart.width = cnf.chart.width || '100%' + cnf.chart.height = cnf.chart.height || 'auto' + + gl.svgWidth = cnf.chart.width + gl.svgHeight = cnf.chart.height + + let elDim = Utils.getDimensions(this.el) + const widthUnit = cnf.chart.width + .toString() + .split(/[0-9]+/g) + .pop() + + if (widthUnit === '%') { + if (Utils.isNumber(elDim[0])) { + if (elDim[0].width === 0) { + elDim = Utils.getDimensions(this.el.parentNode) + } + gl.svgWidth = (elDim[0] * parseInt(cnf.chart.width, 10)) / 100 + } + } else if (widthUnit === 'px' || widthUnit === '') { + gl.svgWidth = parseInt(cnf.chart.width, 10) + } + + const heightUnit = String(cnf.chart.height) + .toString() + .split(/[0-9]+/g) + .pop() + if (gl.svgHeight !== 'auto' && gl.svgHeight !== '') { + if (heightUnit === '%') { + const elParentDim = Utils.getDimensions(this.el.parentNode) + gl.svgHeight = (elParentDim[1] * parseInt(cnf.chart.height, 10)) / 100 + } else { + gl.svgHeight = parseInt(cnf.chart.height, 10) + } + } else { + gl.svgHeight = gl.axisCharts ? gl.svgWidth / 1.61 : gl.svgWidth / 1.2 + } + + gl.svgWidth = Math.max(gl.svgWidth, 0) + gl.svgHeight = Math.max(gl.svgHeight, 0) + + Graphics.setAttrs(gl.dom.Paper.node, { + width: gl.svgWidth, + height: gl.svgHeight, + }) + + if (heightUnit !== '%') { + const offsetY = cnf.chart.sparkline.enabled + ? 0 + : gl.axisCharts + ? cnf.chart.parentHeightOffset + : 0 + gl.dom.Paper.node.parentNode.parentNode.style.minHeight = `${ + gl.svgHeight + offsetY + }px` + } + + gl.dom.elWrap.style.width = `${gl.svgWidth}px` + gl.dom.elWrap.style.height = `${gl.svgHeight}px` + } + + shiftGraphPosition() { + const { globals: gl } = this.w + const { translateY: tY, translateX: tX } = gl + + Graphics.setAttrs(gl.dom.elGraphical.node, { + transform: `translate(${tX}, ${tY})`, + }) + } + + resizeNonAxisCharts() { + const { w } = this + const { globals: gl } = w + + let legendHeight = 0 + let offY = w.config.chart.sparkline.enabled ? 1 : 15 + offY += w.config.grid.padding.bottom + + if ( + ['top', 'bottom'].includes(w.config.legend.position) && + w.config.legend.show && + !w.config.legend.floating + ) { + legendHeight = + new Legend(this.ctx).legendHelpers.getLegendDimensions().clwh + 7 + } + + const el = w.globals.dom.baseEl.querySelector( + '.apexcharts-radialbar, .apexcharts-pie' + ) + let chartInnerDimensions = w.globals.radialSize * 2.05 + + if ( + el && + !w.config.chart.sparkline.enabled && + w.config.plotOptions.radialBar.startAngle !== 0 + ) { + const elRadialRect = Utils.getBoundingClientRect(el) + chartInnerDimensions = elRadialRect.bottom + const maxHeight = elRadialRect.bottom - elRadialRect.top + chartInnerDimensions = Math.max(w.globals.radialSize * 2.05, maxHeight) + } + + const newHeight = Math.ceil( + chartInnerDimensions + gl.translateY + legendHeight + offY + ) + + if (gl.dom.elLegendForeign) { + gl.dom.elLegendForeign.setAttribute('height', newHeight) + } + + if (w.config.chart.height && String(w.config.chart.height).includes('%')) + return + + gl.dom.elWrap.style.height = `${newHeight}px` + Graphics.setAttrs(gl.dom.Paper.node, { height: newHeight }) + gl.dom.Paper.node.parentNode.parentNode.style.minHeight = `${newHeight}px` + } + + coreCalculations() { + new Range(this.ctx).init() + } + + resetGlobals() { + const resetxyValues = () => this.w.config.series.map(() => []) + const globalObj = new Globals() + + const { globals: gl } = this.w + globalObj.initGlobalVars(gl) + gl.seriesXvalues = resetxyValues() + gl.seriesYvalues = resetxyValues() + } + + isMultipleY() { + if (Array.isArray(this.w.config.yaxis) && this.w.config.yaxis.length > 1) { + this.w.globals.isMultipleYAxis = true + return true + } + return false + } + + xySettings() { + const { w } = this + let xyRatios = null + + if (w.globals.axisCharts) { + if (w.config.xaxis.crosshairs.position === 'back') { + new Crosshairs(this.ctx).drawXCrosshairs() + } + if (w.config.yaxis[0].crosshairs.position === 'back') { + new Crosshairs(this.ctx).drawYCrosshairs() + } + + if ( + w.config.xaxis.type === 'datetime' && + w.config.xaxis.labels.formatter === undefined + ) { + this.ctx.timeScale = new TimeScale(this.ctx) + let formattedTimeScale = [] + if ( + isFinite(w.globals.minX) && + isFinite(w.globals.maxX) && + !w.globals.isBarHorizontal + ) { + formattedTimeScale = this.ctx.timeScale.calculateTimeScaleTicks( + w.globals.minX, + w.globals.maxX + ) + } else if (w.globals.isBarHorizontal) { + formattedTimeScale = this.ctx.timeScale.calculateTimeScaleTicks( + w.globals.minY, + w.globals.maxY + ) + } + this.ctx.timeScale.recalcDimensionsBasedOnFormat(formattedTimeScale) + } + + const coreUtils = new CoreUtils(this.ctx) + xyRatios = coreUtils.getCalculatedRatios() + } + return xyRatios + } + + updateSourceChart(targetChart) { + this.ctx.w.globals.selection = undefined + this.ctx.updateHelpers._updateOptions( + { + chart: { + selection: { + xaxis: { + min: targetChart.w.globals.minX, + max: targetChart.w.globals.maxX, + }, + }, + }, + }, + false, + false + ) + } + + setupBrushHandler() { + const { ctx, w } = this + + if (!w.config.chart.brush.enabled) return + + if (typeof w.config.chart.events.selection !== 'function') { + const targets = Array.isArray(w.config.chart.brush.targets) + ? w.config.chart.brush.targets + : [w.config.chart.brush.target] + targets.forEach((target) => { + const targetChart = ctx.constructor.getChartByID(target) + targetChart.w.globals.brushSource = this.ctx + + if (typeof targetChart.w.config.chart.events.zoomed !== 'function') { + targetChart.w.config.chart.events.zoomed = () => + this.updateSourceChart(targetChart) + } + if (typeof targetChart.w.config.chart.events.scrolled !== 'function') { + targetChart.w.config.chart.events.scrolled = () => + this.updateSourceChart(targetChart) + } + }) + + w.config.chart.events.selection = (chart, e) => { + targets.forEach((target) => { + const targetChart = ctx.constructor.getChartByID(target) + targetChart.ctx.updateHelpers._updateOptions( + { + xaxis: { + min: e.xaxis.min, + max: e.xaxis.max, + }, + }, + false, + false, + false, + false + ) + }) + } + } + } +} diff --git a/node_modules/apexcharts/src/modules/CoreUtils.js b/node_modules/apexcharts/src/modules/CoreUtils.js new file mode 100644 index 0000000..3e5986e --- /dev/null +++ b/node_modules/apexcharts/src/modules/CoreUtils.js @@ -0,0 +1,657 @@ +/* + ** Util functions which are dependent on ApexCharts instance + */ + +class CoreUtils { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + } + + static checkComboSeries(series, chartType) { + let comboCharts = false + let comboBarCount = 0 + let comboCount = 0 + + if (chartType === undefined) { + chartType = 'line' + } + + // Check if user specified a type in series that may make us a combo chart. + // The default type for chart is "line" and the default for series is the + // chart type, therefore, if the types of all series match the chart type, + // this should not be considered a combo chart. + if (series.length && typeof series[0].type !== 'undefined') { + series.forEach((s) => { + if ( + s.type === 'bar' || + s.type === 'column' || + s.type === 'candlestick' || + s.type === 'boxPlot' + ) { + comboBarCount++ + } + if (typeof s.type !== 'undefined' && s.type !== chartType) { + comboCount++ + } + }) + } + if (comboCount > 0) { + comboCharts = true + } + + return { + comboBarCount, + comboCharts, + } + } + + /** + * @memberof CoreUtils + * returns the sum of all individual values in a multiple stacked series + * Eg. w.globals.series = [[32,33,43,12], [2,3,5,1]] + * @return [34,36,48,13] + **/ + getStackedSeriesTotals(excludedSeriesIndices = []) { + const w = this.w + let total = [] + + if (w.globals.series.length === 0) return total + + for ( + let i = 0; + i < w.globals.series[w.globals.maxValsInArrayIndex].length; + i++ + ) { + let t = 0 + for (let j = 0; j < w.globals.series.length; j++) { + if ( + typeof w.globals.series[j][i] !== 'undefined' && + excludedSeriesIndices.indexOf(j) === -1 + ) { + t += w.globals.series[j][i] + } + } + total.push(t) + } + return total + } + + // get total of the all values inside all series + getSeriesTotalByIndex(index = null) { + if (index === null) { + // non-plot chart types - pie / donut / circle + return this.w.config.series.reduce((acc, cur) => acc + cur, 0) + } else { + // axis charts - supporting multiple series + return this.w.globals.series[index].reduce((acc, cur) => acc + cur, 0) + } + } + + /** + * @memberof CoreUtils + * returns the sum of values in a multiple stacked grouped charts + * Eg. w.globals.series = [[32,33,43,12], [2,3,5,1], [43, 23, 34, 22]] + * series 1 and 2 are in a group, while series 3 is in another group + * @return [[34, 36, 48, 12], [43, 23, 34, 22]] + **/ + getStackedSeriesTotalsByGroups() { + const w = this.w + let total = [] + + w.globals.seriesGroups.forEach((sg) => { + let includedIndexes = [] + w.config.series.forEach((s, si) => { + if (sg.indexOf(w.globals.seriesNames[si]) > -1) { + includedIndexes.push(si) + } + }) + + const excludedIndices = w.globals.series + .map((_, fi) => (includedIndexes.indexOf(fi) === -1 ? fi : -1)) + .filter((f) => f !== -1) + + total.push(this.getStackedSeriesTotals(excludedIndices)) + }) + return total + } + + setSeriesYAxisMappings() { + const gl = this.w.globals + const cnf = this.w.config + + // The old config method to map multiple series to a y axis is to + // include one yaxis config per series but set each yaxis seriesName to the + // same series name. This relies on indexing equivalence to map series to + // an axis: series[n] => yaxis[n]. This needs to be retained for compatibility. + // But we introduce an alternative that explicitly configures yaxis elements + // with the series that will be referenced to them (seriesName: []). This + // only requires including the yaxis elements that will be seen on the chart. + // Old way: + // ya: s + // 0: 0 + // 1: 1 + // 2: 1 + // 3: 1 + // 4: 1 + // Axes 0..4 are all scaled and all will be rendered unless the axes are + // show: false. If the chart is stacked, it's assumed that series 1..4 are + // the contributing series. This is not particularly intuitive. + // New way: + // ya: s + // 0: [0] + // 1: [1,2,3,4] + // If the chart is stacked, it can be assumed that any axis with multiple + // series is stacked. + // + // If this is an old chart and we are being backward compatible, it will be + // expected that each series is associated with it's corresponding yaxis + // through their indices, one-to-one. + // If yaxis.seriesName matches series.name, we have indices yi and si. + // A name match where yi != si is interpretted as yaxis[yi] and yaxis[si] + // will both be scaled to fit the combined series[si] and series[yi]. + // Consider series named: S0,S1,S2 and yaxes A0,A1,A2. + // + // Example 1: A0 and A1 scaled the same. + // A0.seriesName: S0 + // A1.seriesName: S0 + // A2.seriesName: S2 + // Then A1 <-> A0 + // + // Example 2: A0, A1 and A2 all scaled the same. + // A0.seriesName: S2 + // A1.seriesName: S0 + // A2.seriesName: S1 + // A0 <-> A2, A1 <-> A0, A2 <-> A1 --->>> A0 <-> A1 <-> A2 + + let axisSeriesMap = [] + let seriesYAxisReverseMap = [] + let unassignedSeriesIndices = [] + let seriesNameArrayStyle = + gl.series.length > cnf.yaxis.length || + cnf.yaxis.some((a) => Array.isArray(a.seriesName)) + + cnf.series.forEach((s, i) => { + unassignedSeriesIndices.push(i) + seriesYAxisReverseMap.push(null) + }) + cnf.yaxis.forEach((yaxe, yi) => { + axisSeriesMap[yi] = [] + }) + + let unassignedYAxisIndices = [] + + // here, we loop through the yaxis array and find the item which has "seriesName" property + cnf.yaxis.forEach((yaxe, yi) => { + let assigned = false + // Allow seriesName to be either a string (for backward compatibility), + // in which case, handle multiple yaxes referencing the same series. + // or an array of strings so that a yaxis can reference multiple series. + // Feature request #4237 + if (yaxe.seriesName) { + let seriesNames = [] + if (Array.isArray(yaxe.seriesName)) { + seriesNames = yaxe.seriesName + } else { + seriesNames.push(yaxe.seriesName) + } + seriesNames.forEach((name) => { + cnf.series.forEach((s, si) => { + if (s.name === name) { + let remove = si + if (yi === si || seriesNameArrayStyle) { + // New style, don't allow series to be double referenced + if ( + !seriesNameArrayStyle || + unassignedSeriesIndices.indexOf(si) > -1 + ) { + axisSeriesMap[yi].push([yi, si]) + } else { + console.warn( + "Series '" + + s.name + + "' referenced more than once in what looks like the new style." + + ' That is, when using either seriesName: [],' + + ' or when there are more series than yaxes.' + ) + } + } else { + // The series index refers to the target yaxis and the current + // yaxis index refers to the actual referenced series. + axisSeriesMap[si].push([si, yi]) + remove = yi + } + assigned = true + remove = unassignedSeriesIndices.indexOf(remove) + if (remove !== -1) { + unassignedSeriesIndices.splice(remove, 1) + } + } + }) + }) + } + if (!assigned) { + unassignedYAxisIndices.push(yi) + } + }) + axisSeriesMap = axisSeriesMap.map((yaxe, yi) => { + let ra = [] + yaxe.forEach((sa) => { + seriesYAxisReverseMap[sa[1]] = sa[0] + ra.push(sa[1]) + }) + return ra + }) + + // All series referenced directly by yaxes have been assigned to those axes. + // Any series so far unassigned will be assigned to any yaxes that have yet + // to reference series directly, one-for-one in order of appearance, with + // all left-over series assigned to either the last unassigned yaxis, or the + // last yaxis if all have assigned series. This captures the + // default single and multiaxis config options which simply includes zero, + // one or as many yaxes as there are series but do not reference them by name. + let lastUnassignedYAxis = cnf.yaxis.length - 1 + for (let i = 0; i < unassignedYAxisIndices.length; i++) { + lastUnassignedYAxis = unassignedYAxisIndices[i] + axisSeriesMap[lastUnassignedYAxis] = [] + if (unassignedSeriesIndices) { + let si = unassignedSeriesIndices[0] + unassignedSeriesIndices.shift() + axisSeriesMap[lastUnassignedYAxis].push(si) + seriesYAxisReverseMap[si] = lastUnassignedYAxis + } else { + break + } + } + + unassignedSeriesIndices.forEach((i) => { + axisSeriesMap[lastUnassignedYAxis].push(i) + seriesYAxisReverseMap[i] = lastUnassignedYAxis + }) + + // For the old-style seriesName-as-string-only, leave the zero-length yaxis + // array elements in for compatibility so that series.length == yaxes.length + // for multi axis charts. + gl.seriesYAxisMap = axisSeriesMap.map((x) => x) + gl.seriesYAxisReverseMap = seriesYAxisReverseMap.map((x) => x) + // Set default series group names + gl.seriesYAxisMap.forEach((axisSeries, ai) => { + axisSeries.forEach((si) => { + // series may be bare until loaded in realtime + if (cnf.series[si] && cnf.series[si].group === undefined) { + // A series with no group defined will be named after the axis that + // referenced it and thus form a group automatically. + cnf.series[si].group = 'apexcharts-axis-'.concat(ai.toString()) + } + }) + }) + } + + isSeriesNull(index = null) { + let r = [] + if (index === null) { + // non-plot chart types - pie / donut / circle + r = this.w.config.series.filter((d) => d !== null) + } else { + // axis charts - supporting multiple series + r = this.w.config.series[index].data.filter((d) => d !== null) + } + + return r.length === 0 + } + + seriesHaveSameValues(index) { + return this.w.globals.series[index].every((val, i, arr) => val === arr[0]) + } + + getCategoryLabels(labels) { + const w = this.w + let catLabels = labels.slice() + if (w.config.xaxis.convertedCatToNumeric) { + catLabels = labels.map((i, li) => { + return w.config.xaxis.labels.formatter(i - w.globals.minX + 1) + }) + } + return catLabels + } + // maxValsInArrayIndex is the index of series[] which has the largest number of items + getLargestSeries() { + const w = this.w + w.globals.maxValsInArrayIndex = w.globals.series + .map((a) => a.length) + .indexOf( + Math.max.apply( + Math, + w.globals.series.map((a) => a.length) + ) + ) + } + + getLargestMarkerSize() { + const w = this.w + let size = 0 + + w.globals.markers.size.forEach((m) => { + size = Math.max(size, m) + }) + + if (w.config.markers.discrete && w.config.markers.discrete.length) { + w.config.markers.discrete.forEach((m) => { + size = Math.max(size, m.size) + }) + } + + if (size > 0) { + if (w.config.markers.hover.size > 0) { + size = w.config.markers.hover.size + } else { + size += w.config.markers.hover.sizeOffset + } + } + + w.globals.markers.largestSize = size + + return size + } + + /** + * @memberof Core + * returns the sum of all values in a series + * Eg. w.globals.series = [[32,33,43,12], [2,3,5,1]] + * @return [120, 11] + **/ + getSeriesTotals() { + const w = this.w + + w.globals.seriesTotals = w.globals.series.map((ser, index) => { + let total = 0 + + if (Array.isArray(ser)) { + for (let j = 0; j < ser.length; j++) { + total += ser[j] + } + } else { + // for pie/donuts/gauges + total += ser + } + + return total + }) + } + + getSeriesTotalsXRange(minX, maxX) { + const w = this.w + + const seriesTotalsXRange = w.globals.series.map((ser, index) => { + let total = 0 + + for (let j = 0; j < ser.length; j++) { + if ( + w.globals.seriesX[index][j] > minX && + w.globals.seriesX[index][j] < maxX + ) { + total += ser[j] + } + } + + return total + }) + + return seriesTotalsXRange + } + + /** + * @memberof CoreUtils + * returns the percentage value of all individual values which can be used in a 100% stacked series + * Eg. w.globals.series = [[32, 33, 43, 12], [2, 3, 5, 1]] + * @return [[94.11, 91.66, 89.58, 92.30], [5.88, 8.33, 10.41, 7.7]] + **/ + getPercentSeries() { + const w = this.w + + w.globals.seriesPercent = w.globals.series.map((ser, index) => { + let seriesPercent = [] + if (Array.isArray(ser)) { + for (let j = 0; j < ser.length; j++) { + let total = w.globals.stackedSeriesTotals[j] + let percent = 0 + if (total) { + percent = (100 * ser[j]) / total + } + seriesPercent.push(percent) + } + } else { + const total = w.globals.seriesTotals.reduce((acc, val) => acc + val, 0) + let percent = (100 * ser) / total + seriesPercent.push(percent) + } + + return seriesPercent + }) + } + + getCalculatedRatios() { + let w = this.w + let gl = w.globals + + let yRatio = [] + let invertedYRatio = 0 + let xRatio = 0 + let invertedXRatio = 0 + let zRatio = 0 + let baseLineY = [] + let baseLineInvertedY = 0.1 + let baseLineX = 0 + + gl.yRange = [] + if (gl.isMultipleYAxis) { + for (let i = 0; i < gl.minYArr.length; i++) { + gl.yRange.push(Math.abs(gl.minYArr[i] - gl.maxYArr[i])) + baseLineY.push(0) + } + } else { + gl.yRange.push(Math.abs(gl.minY - gl.maxY)) + } + gl.xRange = Math.abs(gl.maxX - gl.minX) + gl.zRange = Math.abs(gl.maxZ - gl.minZ) + + // multiple y axis + for (let i = 0; i < gl.yRange.length; i++) { + yRatio.push(gl.yRange[i] / gl.gridHeight) + } + + xRatio = gl.xRange / gl.gridWidth + + invertedYRatio = gl.yRange / gl.gridWidth + invertedXRatio = gl.xRange / gl.gridHeight + zRatio = (gl.zRange / gl.gridHeight) * 16 + + if (!zRatio) { + zRatio = 1 + } + + if (gl.minY !== Number.MIN_VALUE && Math.abs(gl.minY) !== 0) { + // Negative numbers present in series + gl.hasNegs = true + } + + // Check we have a map as series may still to be added/updated. + if (w.globals.seriesYAxisReverseMap.length > 0) { + let scaleBaseLineYScale = (y, i) => { + let yAxis = w.config.yaxis[w.globals.seriesYAxisReverseMap[i]] + let sign = y < 0 ? -1 : 1 + y = Math.abs(y) + if (yAxis.logarithmic) { + y = this.getBaseLog(yAxis.logBase, y) + } + return (-sign * y) / yRatio[i] + } + if (gl.isMultipleYAxis) { + baseLineY = [] + // baseline variables is the 0 of the yaxis which will be needed when there are negatives + for (let i = 0; i < yRatio.length; i++) { + baseLineY.push(scaleBaseLineYScale(gl.minYArr[i], i)) + } + } else { + baseLineY = [] + baseLineY.push(scaleBaseLineYScale(gl.minY, 0)) + + if (gl.minY !== Number.MIN_VALUE && Math.abs(gl.minY) !== 0) { + baseLineInvertedY = -gl.minY / invertedYRatio // this is for bar chart + baseLineX = gl.minX / xRatio + } + } + } else { + baseLineY = [] + baseLineY.push(0) + baseLineInvertedY = 0 + baseLineX = 0 + } + + return { + yRatio, + invertedYRatio, + zRatio, + xRatio, + invertedXRatio, + baseLineInvertedY, + baseLineY, + baseLineX, + } + } + + getLogSeries(series) { + const w = this.w + + w.globals.seriesLog = series.map((s, i) => { + let yAxisIndex = w.globals.seriesYAxisReverseMap[i] + if ( + w.config.yaxis[yAxisIndex] && + w.config.yaxis[yAxisIndex].logarithmic + ) { + return s.map((d) => { + if (d === null) return null + return this.getLogVal(w.config.yaxis[yAxisIndex].logBase, d, i) + }) + } else { + return s + } + }) + + return w.globals.invalidLogScale ? series : w.globals.seriesLog + } + + getLogValAtSeriesIndex(val, seriesIndex) { + if (val === null) return null + const w = this.w + let yAxisIndex = w.globals.seriesYAxisReverseMap[seriesIndex] + if (w.config.yaxis[yAxisIndex] && w.config.yaxis[yAxisIndex].logarithmic) { + return this.getLogVal( + w.config.yaxis[yAxisIndex].logBase, + val, + seriesIndex + ) + } + return val + } + + getBaseLog(base, value) { + return Math.log(value) / Math.log(base) + } + getLogVal(b, d, seriesIndex) { + if (d <= 0) { + return 0 // Should be Number.NEGATIVE_INFINITY + } + const w = this.w + const min_log_val = + w.globals.minYArr[seriesIndex] === 0 + ? -1 // make sure we dont calculate log of 0 + : this.getBaseLog(b, w.globals.minYArr[seriesIndex]) + const max_log_val = + w.globals.maxYArr[seriesIndex] === 0 + ? 0 // make sure we dont calculate log of 0 + : this.getBaseLog(b, w.globals.maxYArr[seriesIndex]) + const number_of_height_levels = max_log_val - min_log_val + if (d < 1) return d / number_of_height_levels + const log_height_value = this.getBaseLog(b, d) - min_log_val + return log_height_value / number_of_height_levels + } + + getLogYRatios(yRatio) { + const w = this.w + const gl = this.w.globals + + gl.yLogRatio = yRatio.slice() + + gl.logYRange = gl.yRange.map((_, i) => { + let yAxisIndex = w.globals.seriesYAxisReverseMap[i] + if ( + w.config.yaxis[yAxisIndex] && + this.w.config.yaxis[yAxisIndex].logarithmic + ) { + let maxY = -Number.MAX_VALUE + let minY = Number.MIN_VALUE + let range = 1 + gl.seriesLog.forEach((s, si) => { + s.forEach((v) => { + if (w.config.yaxis[si] && w.config.yaxis[si].logarithmic) { + maxY = Math.max(v, maxY) + minY = Math.min(v, minY) + } + }) + }) + + range = Math.pow(gl.yRange[i], Math.abs(minY - maxY) / gl.yRange[i]) + + gl.yLogRatio[i] = range / gl.gridHeight + return range + } + }) + + return gl.invalidLogScale ? yRatio.slice() : gl.yLogRatio + } + + // Some config objects can be array - and we need to extend them correctly + static extendArrayProps(configInstance, options, w) { + if (options?.yaxis) { + options = configInstance.extendYAxis(options, w) + } + if (options?.annotations) { + if (options.annotations.yaxis) { + options = configInstance.extendYAxisAnnotations(options) + } + if (options?.annotations?.xaxis) { + options = configInstance.extendXAxisAnnotations(options) + } + if (options?.annotations?.points) { + options = configInstance.extendPointAnnotations(options) + } + } + + return options + } + + // Series of the same group and type can be stacked together distinct from + // other series of the same type on the same axis. + drawSeriesByGroup(typeSeries, typeGroups, type, chartClass) { + let w = this.w + let graph = [] + if (typeSeries.series.length > 0) { + // draw each group separately + typeGroups.forEach((gn) => { + let gs = [] + let gi = [] + typeSeries.i.forEach((i, ii) => { + if (w.config.series[i].group === gn) { + gs.push(typeSeries.series[ii]) + gi.push(i) + } + }) + gs.length > 0 && graph.push(chartClass.draw(gs, type, gi)) + }) + } + return graph + } +} + +export default CoreUtils diff --git a/node_modules/apexcharts/src/modules/Crosshairs.js b/node_modules/apexcharts/src/modules/Crosshairs.js new file mode 100644 index 0000000..3f77823 --- /dev/null +++ b/node_modules/apexcharts/src/modules/Crosshairs.js @@ -0,0 +1,138 @@ +import Graphics from './Graphics' +import Filters from './Filters' +import Utils from '../utils/Utils' + +class Crosshairs { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + } + + drawXCrosshairs() { + const w = this.w + + let graphics = new Graphics(this.ctx) + let filters = new Filters(this.ctx) + + let crosshairGradient = w.config.xaxis.crosshairs.fill.gradient + let crosshairShadow = w.config.xaxis.crosshairs.dropShadow + + let fillType = w.config.xaxis.crosshairs.fill.type + let gradientFrom = crosshairGradient.colorFrom + let gradientTo = crosshairGradient.colorTo + let opacityFrom = crosshairGradient.opacityFrom + let opacityTo = crosshairGradient.opacityTo + let stops = crosshairGradient.stops + + let shadow = 'none' + let dropShadow = crosshairShadow.enabled + let shadowLeft = crosshairShadow.left + let shadowTop = crosshairShadow.top + let shadowBlur = crosshairShadow.blur + let shadowColor = crosshairShadow.color + let shadowOpacity = crosshairShadow.opacity + + let xcrosshairsFill = w.config.xaxis.crosshairs.fill.color + + if (w.config.xaxis.crosshairs.show) { + if (fillType === 'gradient') { + xcrosshairsFill = graphics.drawGradient( + 'vertical', + gradientFrom, + gradientTo, + opacityFrom, + opacityTo, + null, + stops, + null + ) + } + + let xcrosshairs = graphics.drawRect() + if (w.config.xaxis.crosshairs.width === 1) { + // to prevent drawing 2 lines, convert rect to line + xcrosshairs = graphics.drawLine() + } + + let gridHeight = w.globals.gridHeight + if (!Utils.isNumber(gridHeight) || gridHeight < 0) { + gridHeight = 0 + } + let crosshairsWidth = w.config.xaxis.crosshairs.width + if (!Utils.isNumber(crosshairsWidth) || crosshairsWidth < 0) { + crosshairsWidth = 0 + } + + xcrosshairs.attr({ + class: 'apexcharts-xcrosshairs', + x: 0, + y: 0, + y2: gridHeight, + width: crosshairsWidth, + height: gridHeight, + fill: xcrosshairsFill, + filter: shadow, + 'fill-opacity': w.config.xaxis.crosshairs.opacity, + stroke: w.config.xaxis.crosshairs.stroke.color, + 'stroke-width': w.config.xaxis.crosshairs.stroke.width, + 'stroke-dasharray': w.config.xaxis.crosshairs.stroke.dashArray + }) + + if (dropShadow) { + xcrosshairs = filters.dropShadow(xcrosshairs, { + left: shadowLeft, + top: shadowTop, + blur: shadowBlur, + color: shadowColor, + opacity: shadowOpacity + }) + } + + w.globals.dom.elGraphical.add(xcrosshairs) + } + } + + drawYCrosshairs() { + const w = this.w + + let graphics = new Graphics(this.ctx) + + let crosshair = w.config.yaxis[0].crosshairs + const offX = w.globals.barPadForNumericAxis + + if (w.config.yaxis[0].crosshairs.show) { + let ycrosshairs = graphics.drawLine( + -offX, + 0, + w.globals.gridWidth + offX, + 0, + crosshair.stroke.color, + crosshair.stroke.dashArray, + crosshair.stroke.width + ) + ycrosshairs.attr({ + class: 'apexcharts-ycrosshairs' + }) + + w.globals.dom.elGraphical.add(ycrosshairs) + } + + // draw an invisible crosshair to help in positioning the yaxis tooltip + let ycrosshairsHidden = graphics.drawLine( + -offX, + 0, + w.globals.gridWidth + offX, + 0, + crosshair.stroke.color, + 0, + 0 + ) + ycrosshairsHidden.attr({ + class: 'apexcharts-ycrosshairs-hidden' + }) + + w.globals.dom.elGraphical.add(ycrosshairsHidden) + } +} + +export default Crosshairs diff --git a/node_modules/apexcharts/src/modules/Data.js b/node_modules/apexcharts/src/modules/Data.js new file mode 100644 index 0000000..dc4f299 --- /dev/null +++ b/node_modules/apexcharts/src/modules/Data.js @@ -0,0 +1,743 @@ +import CoreUtils from './CoreUtils' +import DateTime from './../utils/DateTime' +import Series from './Series' +import Utils from '../utils/Utils' +import Defaults from './settings/Defaults' + +export default class Data { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + + this.twoDSeries = [] + this.threeDSeries = [] + this.twoDSeriesX = [] + this.seriesGoals = [] + this.coreUtils = new CoreUtils(this.ctx) + } + + isMultiFormat() { + return this.isFormatXY() || this.isFormat2DArray() + } + + // given format is [{x, y}, {x, y}] + isFormatXY() { + const series = this.w.config.series.slice() + + const sr = new Series(this.ctx) + this.activeSeriesIndex = sr.getActiveConfigSeriesIndex() + + if ( + typeof series[this.activeSeriesIndex].data !== 'undefined' && + series[this.activeSeriesIndex].data.length > 0 && + series[this.activeSeriesIndex].data[0] !== null && + typeof series[this.activeSeriesIndex].data[0].x !== 'undefined' && + series[this.activeSeriesIndex].data[0] !== null + ) { + return true + } + } + + // given format is [[x, y], [x, y]] + isFormat2DArray() { + const series = this.w.config.series.slice() + + const sr = new Series(this.ctx) + this.activeSeriesIndex = sr.getActiveConfigSeriesIndex() + + if ( + typeof series[this.activeSeriesIndex].data !== 'undefined' && + series[this.activeSeriesIndex].data.length > 0 && + typeof series[this.activeSeriesIndex].data[0] !== 'undefined' && + series[this.activeSeriesIndex].data[0] !== null && + series[this.activeSeriesIndex].data[0].constructor === Array + ) { + return true + } + } + + handleFormat2DArray(ser, i) { + const cnf = this.w.config + const gl = this.w.globals + + const isBoxPlot = + cnf.chart.type === 'boxPlot' || cnf.series[i].type === 'boxPlot' + + for (let j = 0; j < ser[i].data.length; j++) { + if (typeof ser[i].data[j][1] !== 'undefined') { + if ( + Array.isArray(ser[i].data[j][1]) && + ser[i].data[j][1].length === 4 && + !isBoxPlot + ) { + // candlestick nested ohlc format + this.twoDSeries.push(Utils.parseNumber(ser[i].data[j][1][3])) + } else if (ser[i].data[j].length >= 5) { + // candlestick non-nested ohlc format + this.twoDSeries.push(Utils.parseNumber(ser[i].data[j][4])) + } else { + this.twoDSeries.push(Utils.parseNumber(ser[i].data[j][1])) + } + gl.dataFormatXNumeric = true + } + if (cnf.xaxis.type === 'datetime') { + // if timestamps are provided and xaxis type is datetime, + + let ts = new Date(ser[i].data[j][0]) + ts = new Date(ts).getTime() + this.twoDSeriesX.push(ts) + } else { + this.twoDSeriesX.push(ser[i].data[j][0]) + } + } + + for (let j = 0; j < ser[i].data.length; j++) { + if (typeof ser[i].data[j][2] !== 'undefined') { + this.threeDSeries.push(ser[i].data[j][2]) + gl.isDataXYZ = true + } + } + } + + handleFormatXY(ser, i) { + const cnf = this.w.config + const gl = this.w.globals + + const dt = new DateTime(this.ctx) + + let activeI = i + if (gl.collapsedSeriesIndices.indexOf(i) > -1) { + // fix #368 + activeI = this.activeSeriesIndex + } + + // get series + for (let j = 0; j < ser[i].data.length; j++) { + if (typeof ser[i].data[j].y !== 'undefined') { + if (Array.isArray(ser[i].data[j].y)) { + this.twoDSeries.push( + Utils.parseNumber(ser[i].data[j].y[ser[i].data[j].y.length - 1]) + ) + } else { + this.twoDSeries.push(Utils.parseNumber(ser[i].data[j].y)) + } + } + + if ( + typeof ser[i].data[j].goals !== 'undefined' && + Array.isArray(ser[i].data[j].goals) + ) { + if (typeof this.seriesGoals[i] === 'undefined') { + this.seriesGoals[i] = [] + } + this.seriesGoals[i].push(ser[i].data[j].goals) + } else { + if (typeof this.seriesGoals[i] === 'undefined') { + this.seriesGoals[i] = [] + } + this.seriesGoals[i].push(null) + } + } + + // get seriesX + for (let j = 0; j < ser[activeI].data.length; j++) { + const isXString = typeof ser[activeI].data[j].x === 'string' + const isXArr = Array.isArray(ser[activeI].data[j].x) + const isXDate = !isXArr && !!dt.isValidDate(ser[activeI].data[j].x) + + if (isXString || isXDate) { + // user supplied '01/01/2017' or a date string (a JS date object is not supported) + if (isXString || cnf.xaxis.convertedCatToNumeric) { + const isRangeColumn = gl.isBarHorizontal && gl.isRangeData + + if (cnf.xaxis.type === 'datetime' && !isRangeColumn) { + this.twoDSeriesX.push(dt.parseDate(ser[activeI].data[j].x)) + } else { + // a category and not a numeric x value + this.fallbackToCategory = true + this.twoDSeriesX.push(ser[activeI].data[j].x) + + if ( + !isNaN(ser[activeI].data[j].x) && + this.w.config.xaxis.type !== 'category' && + typeof ser[activeI].data[j].x !== 'string' + ) { + gl.isXNumeric = true + } + } + } else { + if (cnf.xaxis.type === 'datetime') { + this.twoDSeriesX.push( + dt.parseDate(ser[activeI].data[j].x.toString()) + ) + } else { + gl.dataFormatXNumeric = true + gl.isXNumeric = true + this.twoDSeriesX.push(parseFloat(ser[activeI].data[j].x)) + } + } + } else if (isXArr) { + // a multiline label described in array format + this.fallbackToCategory = true + this.twoDSeriesX.push(ser[activeI].data[j].x) + } else { + // a numeric value in x property + gl.isXNumeric = true + gl.dataFormatXNumeric = true + this.twoDSeriesX.push(ser[activeI].data[j].x) + } + } + + if (ser[i].data[0] && typeof ser[i].data[0].z !== 'undefined') { + for (let t = 0; t < ser[i].data.length; t++) { + this.threeDSeries.push(ser[i].data[t].z) + } + gl.isDataXYZ = true + } + } + + handleRangeData(ser, i) { + const gl = this.w.globals + + let range = {} + if (this.isFormat2DArray()) { + range = this.handleRangeDataFormat('array', ser, i) + } else if (this.isFormatXY()) { + range = this.handleRangeDataFormat('xy', ser, i) + } + + // Fix: RangeArea Chart: hide all series results in a crash #3984 + gl.seriesRangeStart.push(range.start === undefined ? [] : range.start) + gl.seriesRangeEnd.push(range.end === undefined ? [] : range.end) + + gl.seriesRange.push(range.rangeUniques) + + // check for overlaps to avoid clashes in a timeline chart + gl.seriesRange.forEach((sr, si) => { + if (sr) { + sr.forEach((sarr, sarri) => { + sarr.y.forEach((arr, arri) => { + for (let sri = 0; sri < sarr.y.length; sri++) { + if (arri !== sri) { + const range1y1 = arr.y1 + const range1y2 = arr.y2 + const range2y1 = sarr.y[sri].y1 + const range2y2 = sarr.y[sri].y2 + if (range1y1 <= range2y2 && range2y1 <= range1y2) { + if (sarr.overlaps.indexOf(arr.rangeName) < 0) { + sarr.overlaps.push(arr.rangeName) + } + if (sarr.overlaps.indexOf(sarr.y[sri].rangeName) < 0) { + sarr.overlaps.push(sarr.y[sri].rangeName) + } + } + } + } + }) + }) + } + }) + + return range + } + + handleCandleStickBoxData(ser, i) { + const gl = this.w.globals + + let ohlc = {} + if (this.isFormat2DArray()) { + ohlc = this.handleCandleStickBoxDataFormat('array', ser, i) + } else if (this.isFormatXY()) { + ohlc = this.handleCandleStickBoxDataFormat('xy', ser, i) + } + + gl.seriesCandleO[i] = ohlc.o + gl.seriesCandleH[i] = ohlc.h + gl.seriesCandleM[i] = ohlc.m + gl.seriesCandleL[i] = ohlc.l + gl.seriesCandleC[i] = ohlc.c + + return ohlc + } + + handleRangeDataFormat(format, ser, i) { + const rangeStart = [] + const rangeEnd = [] + + const uniqueKeys = ser[i].data + .filter( + (thing, index, self) => index === self.findIndex((t) => t.x === thing.x) + ) + .map((r, index) => { + return { + x: r.x, + overlaps: [], + y: [], + } + }) + + if (format === 'array') { + for (let j = 0; j < ser[i].data.length; j++) { + if (Array.isArray(ser[i].data[j])) { + rangeStart.push(ser[i].data[j][1][0]) + rangeEnd.push(ser[i].data[j][1][1]) + } else { + rangeStart.push(ser[i].data[j]) + rangeEnd.push(ser[i].data[j]) + } + } + } else if (format === 'xy') { + for (let j = 0; j < ser[i].data.length; j++) { + let isDataPoint2D = Array.isArray(ser[i].data[j].y) + const id = Utils.randomId() + const x = ser[i].data[j].x + const y = { + y1: isDataPoint2D ? ser[i].data[j].y[0] : ser[i].data[j].y, + y2: isDataPoint2D ? ser[i].data[j].y[1] : ser[i].data[j].y, + rangeName: id, + } + + // CAUTION: mutating config object by adding a new property + // TODO: As this is specifically for timeline rangebar charts, update the docs mentioning the series only supports xy format + ser[i].data[j].rangeName = id + + const uI = uniqueKeys.findIndex((t) => t.x === x) + uniqueKeys[uI].y.push(y) + + rangeStart.push(y.y1) + rangeEnd.push(y.y2) + } + } + + return { + start: rangeStart, + end: rangeEnd, + rangeUniques: uniqueKeys, + } + } + + handleCandleStickBoxDataFormat(format, ser, i) { + const w = this.w + const isBoxPlot = + w.config.chart.type === 'boxPlot' || w.config.series[i].type === 'boxPlot' + + const serO = [] + const serH = [] + const serM = [] + const serL = [] + const serC = [] + + if (format === 'array') { + if ( + (isBoxPlot && ser[i].data[0].length === 6) || + (!isBoxPlot && ser[i].data[0].length === 5) + ) { + for (let j = 0; j < ser[i].data.length; j++) { + serO.push(ser[i].data[j][1]) + serH.push(ser[i].data[j][2]) + + if (isBoxPlot) { + serM.push(ser[i].data[j][3]) + serL.push(ser[i].data[j][4]) + serC.push(ser[i].data[j][5]) + } else { + serL.push(ser[i].data[j][3]) + serC.push(ser[i].data[j][4]) + } + } + } else { + for (let j = 0; j < ser[i].data.length; j++) { + if (Array.isArray(ser[i].data[j][1])) { + serO.push(ser[i].data[j][1][0]) + serH.push(ser[i].data[j][1][1]) + if (isBoxPlot) { + serM.push(ser[i].data[j][1][2]) + serL.push(ser[i].data[j][1][3]) + serC.push(ser[i].data[j][1][4]) + } else { + serL.push(ser[i].data[j][1][2]) + serC.push(ser[i].data[j][1][3]) + } + } + } + } + } else if (format === 'xy') { + for (let j = 0; j < ser[i].data.length; j++) { + if (Array.isArray(ser[i].data[j].y)) { + serO.push(ser[i].data[j].y[0]) + serH.push(ser[i].data[j].y[1]) + if (isBoxPlot) { + serM.push(ser[i].data[j].y[2]) + serL.push(ser[i].data[j].y[3]) + serC.push(ser[i].data[j].y[4]) + } else { + serL.push(ser[i].data[j].y[2]) + serC.push(ser[i].data[j].y[3]) + } + } + } + } + + return { + o: serO, + h: serH, + m: serM, + l: serL, + c: serC, + } + } + + parseDataAxisCharts(ser, ctx = this.ctx) { + const cnf = this.w.config + const gl = this.w.globals + + const dt = new DateTime(ctx) + + const xlabels = + cnf.labels.length > 0 ? cnf.labels.slice() : cnf.xaxis.categories.slice() + + gl.isRangeBar = cnf.chart.type === 'rangeBar' && gl.isBarHorizontal + + gl.hasXaxisGroups = + cnf.xaxis.type === 'category' && cnf.xaxis.group.groups.length > 0 + if (gl.hasXaxisGroups) { + gl.groups = cnf.xaxis.group.groups + } + + ser.forEach((s, i) => { + if (s.name !== undefined) { + gl.seriesNames.push(s.name) + } else { + gl.seriesNames.push('series-' + parseInt(i + 1, 10)) + } + }) + + this.coreUtils.setSeriesYAxisMappings() + // At this point, every series that didn't have a user defined group name + // has been given a name according to the yaxis the series is referenced by. + // This fits the existing behaviour where all series associated with an axis + // are defacto presented as a single group. It is now formalised. + let buckets = [] + let groups = [...new Set(cnf.series.map((s) => s.group))] + cnf.series.forEach((s, i) => { + let index = groups.indexOf(s.group) + if (!buckets[index]) buckets[index] = [] + + buckets[index].push(gl.seriesNames[i]) + }) + gl.seriesGroups = buckets + + const handleDates = () => { + for (let j = 0; j < xlabels.length; j++) { + if (typeof xlabels[j] === 'string') { + // user provided date strings + let isDate = dt.isValidDate(xlabels[j]) + if (isDate) { + this.twoDSeriesX.push(dt.parseDate(xlabels[j])) + } else { + throw new Error( + 'You have provided invalid Date format. Please provide a valid JavaScript Date' + ) + } + } else { + // user provided timestamps + this.twoDSeriesX.push(xlabels[j]) + } + } + } + + for (let i = 0; i < ser.length; i++) { + this.twoDSeries = [] + this.twoDSeriesX = [] + this.threeDSeries = [] + + if (typeof ser[i].data === 'undefined') { + console.error( + "It is a possibility that you may have not included 'data' property in series." + ) + return + } + + if ( + cnf.chart.type === 'rangeBar' || + cnf.chart.type === 'rangeArea' || + ser[i].type === 'rangeBar' || + ser[i].type === 'rangeArea' + ) { + gl.isRangeData = true + if (cnf.chart.type === 'rangeBar' || cnf.chart.type === 'rangeArea') { + this.handleRangeData(ser, i) + } + } + + if (this.isMultiFormat()) { + if (this.isFormat2DArray()) { + this.handleFormat2DArray(ser, i) + } else if (this.isFormatXY()) { + this.handleFormatXY(ser, i) + } + + if ( + cnf.chart.type === 'candlestick' || + ser[i].type === 'candlestick' || + cnf.chart.type === 'boxPlot' || + ser[i].type === 'boxPlot' + ) { + this.handleCandleStickBoxData(ser, i) + } + + gl.series.push(this.twoDSeries) + gl.labels.push(this.twoDSeriesX) + gl.seriesX.push(this.twoDSeriesX) + gl.seriesGoals = this.seriesGoals + + if (i === this.activeSeriesIndex && !this.fallbackToCategory) { + gl.isXNumeric = true + } + } else { + if (cnf.xaxis.type === 'datetime') { + // user didn't supplied [{x,y}] or [[x,y]], but single array in data. + // Also labels/categories were supplied differently + gl.isXNumeric = true + + handleDates() + + gl.seriesX.push(this.twoDSeriesX) + } else if (cnf.xaxis.type === 'numeric') { + gl.isXNumeric = true + + if (xlabels.length > 0) { + this.twoDSeriesX = xlabels + gl.seriesX.push(this.twoDSeriesX) + } + } + gl.labels.push(this.twoDSeriesX) + const singleArray = ser[i].data.map((d) => Utils.parseNumber(d)) + gl.series.push(singleArray) + } + + gl.seriesZ.push(this.threeDSeries) + + // overrided default color if user inputs color with series data + if (ser[i].color !== undefined) { + gl.seriesColors.push(ser[i].color) + } else { + gl.seriesColors.push(undefined) + } + } + + return this.w + } + + parseDataNonAxisCharts(ser) { + const gl = this.w.globals + const cnf = this.w.config + + gl.series = ser.slice() + gl.seriesNames = cnf.labels.slice() + for (let i = 0; i < gl.series.length; i++) { + if (gl.seriesNames[i] === undefined) { + gl.seriesNames.push('series-' + (i + 1)) + } + } + + return this.w + } + + /** User possibly set string categories in xaxis.categories or labels prop + * Or didn't set xaxis labels at all - in which case we manually do it. + * If user passed series data as [[3, 2], [4, 5]] or [{ x: 3, y: 55 }], + * this shouldn't be called + * @param {array} ser - the series which user passed to the config + */ + handleExternalLabelsData(ser) { + const cnf = this.w.config + const gl = this.w.globals + + if (cnf.xaxis.categories.length > 0) { + // user provided labels in xaxis.category prop + gl.labels = cnf.xaxis.categories + } else if (cnf.labels.length > 0) { + // user provided labels in labels props + gl.labels = cnf.labels.slice() + } else if (this.fallbackToCategory) { + // user provided labels in x prop in [{ x: 3, y: 55 }] data, and those labels are already stored in gl.labels[0], so just re-arrange the gl.labels array + gl.labels = gl.labels[0] + + if (gl.seriesRange.length) { + gl.seriesRange.map((srt) => { + srt.forEach((sr) => { + if (gl.labels.indexOf(sr.x) < 0 && sr.x) { + gl.labels.push(sr.x) + } + }) + }) + // remove duplicate x-axis labels + gl.labels = Array.from( + new Set(gl.labels.map(JSON.stringify)), + JSON.parse + ) + } + + if (cnf.xaxis.convertedCatToNumeric) { + const defaults = new Defaults(cnf) + defaults.convertCatToNumericXaxis(cnf, this.ctx, gl.seriesX[0]) + this._generateExternalLabels(ser) + } + } else { + this._generateExternalLabels(ser) + } + } + + _generateExternalLabels(ser) { + const gl = this.w.globals + const cnf = this.w.config + // user didn't provided any labels, fallback to 1-2-3-4-5 + let labelArr = [] + + if (gl.axisCharts) { + if (gl.series.length > 0) { + if (this.isFormatXY()) { + // in case there is a combo chart (boxplot/scatter) + // and there are duplicated x values, we need to eliminate duplicates + const seriesDataFiltered = cnf.series.map((serie, s) => { + return serie.data.filter( + (v, i, a) => a.findIndex((t) => t.x === v.x) === i + ) + }) + + const len = seriesDataFiltered.reduce( + (p, c, i, a) => (a[p].length > c.length ? p : i), + 0 + ) + + for (let i = 0; i < seriesDataFiltered[len].length; i++) { + labelArr.push(i + 1) + } + } else { + for (let i = 0; i < gl.series[gl.maxValsInArrayIndex].length; i++) { + labelArr.push(i + 1) + } + } + } + + gl.seriesX = [] + // create gl.seriesX as it will be used in calculations of x positions + for (let i = 0; i < ser.length; i++) { + gl.seriesX.push(labelArr) + } + + // turn on the isXNumeric flag to allow minX and maxX to function properly + if (!this.w.globals.isBarHorizontal) { + gl.isXNumeric = true + } + } + + // no series to pull labels from, put a 0-10 series + // possibly, user collapsed all series. Hence we can't work with above calc + if (labelArr.length === 0) { + labelArr = gl.axisCharts + ? [] + : gl.series.map((gls, glsi) => { + return glsi + 1 + }) + for (let i = 0; i < ser.length; i++) { + gl.seriesX.push(labelArr) + } + } + + // Finally, pass the labelArr in gl.labels which will be printed on x-axis + gl.labels = labelArr + + if (cnf.xaxis.convertedCatToNumeric) { + gl.categoryLabels = labelArr.map((l) => { + return cnf.xaxis.labels.formatter(l) + }) + } + + // Turn on this global flag to indicate no labels were provided by user + gl.noLabelsProvided = true + } + + // Segregate user provided data into appropriate vars + parseData(ser) { + let w = this.w + let cnf = w.config + let gl = w.globals + this.excludeCollapsedSeriesInYAxis() + + // If we detected string in X prop of series, we fallback to category x-axis + this.fallbackToCategory = false + + this.ctx.core.resetGlobals() + this.ctx.core.isMultipleY() + + if (gl.axisCharts) { + // axisCharts includes line / area / column / scatter + this.parseDataAxisCharts(ser) + this.coreUtils.getLargestSeries() + } else { + // non-axis charts are pie / donut + this.parseDataNonAxisCharts(ser) + } + + // set Null values to 0 in all series when user hides/shows some series + if (cnf.chart.stacked) { + const series = new Series(this.ctx) + gl.series = series.setNullSeriesToZeroValues(gl.series) + } + + this.coreUtils.getSeriesTotals() + if (gl.axisCharts) { + gl.stackedSeriesTotals = this.coreUtils.getStackedSeriesTotals() + gl.stackedSeriesTotalsByGroups = + this.coreUtils.getStackedSeriesTotalsByGroups() + } + + this.coreUtils.getPercentSeries() + + if ( + !gl.dataFormatXNumeric && + (!gl.isXNumeric || + (cnf.xaxis.type === 'numeric' && + cnf.labels.length === 0 && + cnf.xaxis.categories.length === 0)) + ) { + // x-axis labels couldn't be detected; hence try searching every option in config + this.handleExternalLabelsData(ser) + } + + // check for multiline xaxis + const catLabels = this.coreUtils.getCategoryLabels(gl.labels) + for (let l = 0; l < catLabels.length; l++) { + if (Array.isArray(catLabels[l])) { + gl.isMultiLineX = true + break + } + } + } + + excludeCollapsedSeriesInYAxis() { + const w = this.w + // Post revision 3.46.0 there is no longer a strict one-to-one + // correspondence between series and Y axes. + // An axis can be ignored only while all series referenced by it + // are collapsed. + let yAxisIndexes = [] + w.globals.seriesYAxisMap.forEach((yAxisArr, yi) => { + let collapsedCount = 0 + yAxisArr.forEach((seriesIndex) => { + if (w.globals.collapsedSeriesIndices.indexOf(seriesIndex) !== -1) { + collapsedCount++ + } + }) + // It's possible to have a yaxis that doesn't reference any series yet, + // eg, because there are no series' yet, so don't list it as ignored + // prematurely. + if (collapsedCount > 0 && collapsedCount == yAxisArr.length) { + yAxisIndexes.push(yi) + } + }) + w.globals.ignoreYAxisIndexes = yAxisIndexes.map((x) => x) + } +} diff --git a/node_modules/apexcharts/src/modules/DataLabels.js b/node_modules/apexcharts/src/modules/DataLabels.js new file mode 100644 index 0000000..673c668 --- /dev/null +++ b/node_modules/apexcharts/src/modules/DataLabels.js @@ -0,0 +1,411 @@ +import Scatter from './../charts/Scatter' +import Graphics from './Graphics' +import Filters from './Filters' + +/** + * ApexCharts DataLabels Class for drawing dataLabels on Axes based Charts. + * + * @module DataLabels + **/ + +class DataLabels { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + } + + // When there are many datalabels to be printed, and some of them overlaps each other in the same series, this method will take care of that + // Also, when datalabels exceeds the drawable area and get clipped off, we need to adjust and move some pixels to make them visible again + dataLabelsCorrection( + x, + y, + val, + i, + dataPointIndex, + alwaysDrawDataLabel, + fontSize + ) { + let w = this.w + let graphics = new Graphics(this.ctx) + let drawnextLabel = false // + + let textRects = graphics.getTextRects(val, fontSize) + let width = textRects.width + let height = textRects.height + + if (y < 0) y = 0 + if (y > w.globals.gridHeight + height) y = w.globals.gridHeight + height / 2 + + // first value in series, so push an empty array + if (typeof w.globals.dataLabelsRects[i] === 'undefined') + w.globals.dataLabelsRects[i] = [] + + // then start pushing actual rects in that sub-array + w.globals.dataLabelsRects[i].push({ x, y, width, height }) + + let len = w.globals.dataLabelsRects[i].length - 2 + let lastDrawnIndex = + typeof w.globals.lastDrawnDataLabelsIndexes[i] !== 'undefined' + ? w.globals.lastDrawnDataLabelsIndexes[i][ + w.globals.lastDrawnDataLabelsIndexes[i].length - 1 + ] + : 0 + + if (typeof w.globals.dataLabelsRects[i][len] !== 'undefined') { + let lastDataLabelRect = w.globals.dataLabelsRects[i][lastDrawnIndex] + if ( + // next label forward and x not intersecting + x > lastDataLabelRect.x + lastDataLabelRect.width || + y > lastDataLabelRect.y + lastDataLabelRect.height || + y + height < lastDataLabelRect.y || + x + width < lastDataLabelRect.x // next label is going to be drawn backwards + ) { + // the 2 indexes don't override, so OK to draw next label + drawnextLabel = true + } + } + + if (dataPointIndex === 0 || alwaysDrawDataLabel) { + drawnextLabel = true + } + + return { + x, + y, + textRects, + drawnextLabel, + } + } + + drawDataLabel({ type, pos, i, j, isRangeStart, strokeWidth = 2 }) { + // this method handles line, area, bubble, scatter charts as those charts contains markers/points which have pre-defined x/y positions + // all other charts like radar / bars / heatmaps will define their own drawDataLabel routine + let w = this.w + + const graphics = new Graphics(this.ctx) + + let dataLabelsConfig = w.config.dataLabels + + let x = 0 + let y = 0 + + let dataPointIndex = j + + let elDataLabelsWrap = null + + const seriesCollapsed = w.globals.collapsedSeriesIndices.indexOf(i) !== -1 + + if (seriesCollapsed || !dataLabelsConfig.enabled || !Array.isArray(pos.x)) { + return elDataLabelsWrap + } + + elDataLabelsWrap = graphics.group({ + class: 'apexcharts-data-labels', + }) + + for (let q = 0; q < pos.x.length; q++) { + x = pos.x[q] + dataLabelsConfig.offsetX + y = pos.y[q] + dataLabelsConfig.offsetY + strokeWidth + + if (!isNaN(x)) { + // a small hack as we have 2 points for the first val to connect it + if (j === 1 && q === 0) dataPointIndex = 0 + if (j === 1 && q === 1) dataPointIndex = 1 + + let val = w.globals.series[i][dataPointIndex] + + if (type === 'rangeArea') { + if (isRangeStart) { + val = w.globals.seriesRangeStart[i][dataPointIndex] + } else { + val = w.globals.seriesRangeEnd[i][dataPointIndex] + } + } + + let text = '' + + const getText = (v) => { + return w.config.dataLabels.formatter(v, { + ctx: this.ctx, + seriesIndex: i, + dataPointIndex, + w, + }) + } + + if (w.config.chart.type === 'bubble') { + val = w.globals.seriesZ[i][dataPointIndex] + text = getText(val) + + y = pos.y[q] + const scatter = new Scatter(this.ctx) + let centerTextInBubbleCoords = scatter.centerTextInBubble( + y, + i, + dataPointIndex + ) + y = centerTextInBubbleCoords.y + } else { + if (typeof val !== 'undefined') { + text = getText(val) + } + } + + let textAnchor = w.config.dataLabels.textAnchor + + if (w.globals.isSlopeChart) { + if (dataPointIndex === 0) { + textAnchor = 'end' + } else if (dataPointIndex === w.config.series[i].data.length - 1) { + textAnchor = 'start' + } else { + textAnchor = 'middle' + } + } + + this.plotDataLabelsText({ + x, + y, + text, + i, + j: dataPointIndex, + parent: elDataLabelsWrap, + offsetCorrection: true, + dataLabelsConfig: w.config.dataLabels, + textAnchor, + }) + } + } + + return elDataLabelsWrap + } + + plotDataLabelsText(opts) { + let w = this.w + let graphics = new Graphics(this.ctx) + let { + x, + y, + i, + j, + text, + textAnchor, + fontSize, + parent, + dataLabelsConfig, + color, + alwaysDrawDataLabel, + offsetCorrection, + className, + } = opts + + let dataLabelText = null + if (Array.isArray(w.config.dataLabels.enabledOnSeries)) { + if (w.config.dataLabels.enabledOnSeries.indexOf(i) < 0) { + return dataLabelText + } + } + + let correctedLabels = { + x, + y, + drawnextLabel: true, + textRects: null, + } + + if (offsetCorrection) { + correctedLabels = this.dataLabelsCorrection( + x, + y, + text, + i, + j, + alwaysDrawDataLabel, + parseInt(dataLabelsConfig.style.fontSize, 10) + ) + } + + // when zoomed, we don't need to correct labels offsets, + // but if normally, labels get cropped, correct them + if (!w.globals.zoomed) { + x = correctedLabels.x + y = correctedLabels.y + } + + if (correctedLabels.textRects) { + // fixes #2264 + if ( + x < -20 - correctedLabels.textRects.width || + x > w.globals.gridWidth + correctedLabels.textRects.width + 30 + ) { + // datalabels fall outside drawing area, so draw a blank label + text = '' + } + } + + let dataLabelColor = w.globals.dataLabels.style.colors[i] + if ( + ((w.config.chart.type === 'bar' || w.config.chart.type === 'rangeBar') && + w.config.plotOptions.bar.distributed) || + w.config.dataLabels.distributed + ) { + dataLabelColor = w.globals.dataLabels.style.colors[j] + } + if (typeof dataLabelColor === 'function') { + dataLabelColor = dataLabelColor({ + series: w.globals.series, + seriesIndex: i, + dataPointIndex: j, + w, + }) + } + if (color) { + dataLabelColor = color + } + + let offX = dataLabelsConfig.offsetX + let offY = dataLabelsConfig.offsetY + + if (w.config.chart.type === 'bar' || w.config.chart.type === 'rangeBar') { + // for certain chart types, we handle offsets while calculating datalabels pos + // why? because bars/column may have negative values and based on that + // offsets becomes reversed + offX = 0 + offY = 0 + } + + if (w.globals.isSlopeChart) { + if (j !== 0) { + offX = dataLabelsConfig.offsetX * -2 + 5 + } + if (j !== 0 && j !== w.config.series[i].data.length - 1) { + offX = 0 + } + } + + if (correctedLabels.drawnextLabel) { + dataLabelText = graphics.drawText({ + width: 100, + height: parseInt(dataLabelsConfig.style.fontSize, 10), + x: x + offX, + y: y + offY, + foreColor: dataLabelColor, + textAnchor: textAnchor || dataLabelsConfig.textAnchor, + text, + fontSize: fontSize || dataLabelsConfig.style.fontSize, + fontFamily: dataLabelsConfig.style.fontFamily, + fontWeight: dataLabelsConfig.style.fontWeight || 'normal', + }) + + dataLabelText.attr({ + class: className || 'apexcharts-datalabel', + cx: x, + cy: y, + }) + + if (dataLabelsConfig.dropShadow.enabled) { + const textShadow = dataLabelsConfig.dropShadow + const filters = new Filters(this.ctx) + filters.dropShadow(dataLabelText, textShadow) + } + + parent.add(dataLabelText) + + if (typeof w.globals.lastDrawnDataLabelsIndexes[i] === 'undefined') { + w.globals.lastDrawnDataLabelsIndexes[i] = [] + } + + w.globals.lastDrawnDataLabelsIndexes[i].push(j) + } + + return dataLabelText + } + + addBackgroundToDataLabel(el, coords) { + const w = this.w + + const bCnf = w.config.dataLabels.background + + const paddingH = bCnf.padding + const paddingV = bCnf.padding / 2 + + const width = coords.width + const height = coords.height + const graphics = new Graphics(this.ctx) + const elRect = graphics.drawRect( + coords.x - paddingH, + coords.y - paddingV / 2, + width + paddingH * 2, + height + paddingV, + bCnf.borderRadius, + w.config.chart.background === 'transparent' || !w.config.chart.background + ? '#fff' + : w.config.chart.background, + bCnf.opacity, + bCnf.borderWidth, + bCnf.borderColor + ) + + if (bCnf.dropShadow.enabled) { + const filters = new Filters(this.ctx) + filters.dropShadow(elRect, bCnf.dropShadow) + } + + return elRect + } + + dataLabelsBackground() { + const w = this.w + + if (w.config.chart.type === 'bubble') return + + const elDataLabels = w.globals.dom.baseEl.querySelectorAll( + '.apexcharts-datalabels text' + ) + + for (let i = 0; i < elDataLabels.length; i++) { + const el = elDataLabels[i] + const coords = el.getBBox() + let elRect = null + + if (coords.width && coords.height) { + elRect = this.addBackgroundToDataLabel(el, coords) + } + if (elRect) { + el.parentNode.insertBefore(elRect.node, el) + const background = el.getAttribute('fill') + + const shouldAnim = + w.config.chart.animations.enabled && + !w.globals.resized && + !w.globals.dataChanged + + if (shouldAnim) { + elRect.animate().attr({ fill: background }) + } else { + elRect.attr({ fill: background }) + } + el.setAttribute('fill', w.config.dataLabels.background.foreColor) + } + } + } + + bringForward() { + const w = this.w + const elDataLabelsNodes = w.globals.dom.baseEl.querySelectorAll( + '.apexcharts-datalabels' + ) + + const elSeries = w.globals.dom.baseEl.querySelector( + '.apexcharts-plot-series:last-child' + ) + + for (let i = 0; i < elDataLabelsNodes.length; i++) { + if (elSeries) { + elSeries.insertBefore(elDataLabelsNodes[i], elSeries.nextSibling) + } + } + } +} + +export default DataLabels diff --git a/node_modules/apexcharts/src/modules/Events.js b/node_modules/apexcharts/src/modules/Events.js new file mode 100644 index 0000000..eb742be --- /dev/null +++ b/node_modules/apexcharts/src/modules/Events.js @@ -0,0 +1,120 @@ +import Utils from '../utils/Utils' + +export default class Events { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + + this.documentEvent = Utils.bind(this.documentEvent, this) + } + + addEventListener(name, handler) { + const w = this.w + + if (w.globals.events.hasOwnProperty(name)) { + w.globals.events[name].push(handler) + } else { + w.globals.events[name] = [handler] + } + } + + removeEventListener(name, handler) { + const w = this.w + if (!w.globals.events.hasOwnProperty(name)) { + return + } + + let index = w.globals.events[name].indexOf(handler) + if (index !== -1) { + w.globals.events[name].splice(index, 1) + } + } + + fireEvent(name, args) { + const w = this.w + + if (!w.globals.events.hasOwnProperty(name)) { + return + } + + if (!args || !args.length) { + args = [] + } + + let evs = w.globals.events[name] + let l = evs.length + + for (let i = 0; i < l; i++) { + evs[i].apply(null, args) + } + } + + setupEventHandlers() { + const w = this.w + const me = this.ctx + + let clickableArea = w.globals.dom.baseEl.querySelector(w.globals.chartClass) + + this.ctx.eventList.forEach((event) => { + clickableArea.addEventListener( + event, + (e) => { + const opts = Object.assign({}, w, { + seriesIndex: w.globals.axisCharts + ? w.globals.capturedSeriesIndex + : 0, + dataPointIndex: w.globals.capturedDataPointIndex, + }) + + if (e.type === 'mousemove' || e.type === 'touchmove') { + if (typeof w.config.chart.events.mouseMove === 'function') { + w.config.chart.events.mouseMove(e, me, opts) + } + } else if (e.type === 'mouseleave' || e.type === 'touchleave') { + if (typeof w.config.chart.events.mouseLeave === 'function') { + w.config.chart.events.mouseLeave(e, me, opts) + } + } else if ( + (e.type === 'mouseup' && e.which === 1) || + e.type === 'touchend' + ) { + if (typeof w.config.chart.events.click === 'function') { + w.config.chart.events.click(e, me, opts) + } + me.ctx.events.fireEvent('click', [e, me, opts]) + } + }, + { capture: false, passive: true } + ) + }) + + this.ctx.eventList.forEach((event) => { + w.globals.dom.baseEl.addEventListener(event, this.documentEvent, { + passive: true, + }) + }) + + this.ctx.core.setupBrushHandler() + } + + documentEvent(e) { + const w = this.w + const target = e.target.className + + if (e.type === 'click') { + let elMenu = w.globals.dom.baseEl.querySelector('.apexcharts-menu') + if ( + elMenu && + elMenu.classList.contains('apexcharts-menu-open') && + target !== 'apexcharts-menu-icon' + ) { + elMenu.classList.remove('apexcharts-menu-open') + } + } + + w.globals.clientX = + e.type === 'touchmove' ? e.touches[0].clientX : e.clientX + w.globals.clientY = + e.type === 'touchmove' ? e.touches[0].clientY : e.clientY + } +} diff --git a/node_modules/apexcharts/src/modules/Exports.js b/node_modules/apexcharts/src/modules/Exports.js new file mode 100644 index 0000000..06f93cd --- /dev/null +++ b/node_modules/apexcharts/src/modules/Exports.js @@ -0,0 +1,499 @@ +import Data from '../modules/Data' +import AxesUtils from '../modules/axes/AxesUtils' +import Series from '../modules/Series' +import Utils from '../utils/Utils' + +class Exports { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + } + + svgStringToNode(svgString) { + const parser = new DOMParser() + const svgDoc = parser.parseFromString(svgString, 'image/svg+xml') + return svgDoc.documentElement + } + + scaleSvgNode(svg, scale) { + // get current both width and height of the svg + let svgWidth = parseFloat(svg.getAttributeNS(null, 'width')) + let svgHeight = parseFloat(svg.getAttributeNS(null, 'height')) + // set new width and height based on the scale + svg.setAttributeNS(null, 'width', svgWidth * scale) + svg.setAttributeNS(null, 'height', svgHeight * scale) + svg.setAttributeNS(null, 'viewBox', '0 0 ' + svgWidth + ' ' + svgHeight) + } + + getSvgString(_scale) { + return new Promise((resolve) => { + const w = this.w + let scale = + _scale || + w.config.chart.toolbar.export.scale || + w.config.chart.toolbar.export.width / w.globals.svgWidth + + if (!scale) { + scale = 1 // if no scale is specified, don't scale... + } + + const width = w.globals.svgWidth * scale + const height = w.globals.svgHeight * scale + + const clonedNode = w.globals.dom.elWrap.cloneNode(true) + clonedNode.style.width = width + 'px' + clonedNode.style.height = height + 'px' + const serializedNode = new XMLSerializer().serializeToString(clonedNode) + + let svgString = ` + + +
+ + ${serializedNode} +
+
+
+ ` + + const svgNode = this.svgStringToNode(svgString) + + if (scale !== 1) { + // scale the image + this.scaleSvgNode(svgNode, scale) + } + + this.convertImagesToBase64(svgNode).then(() => { + svgString = new XMLSerializer().serializeToString(svgNode) + resolve(svgString.replace(/ /g, ' ')) + }) + }) + } + + convertImagesToBase64(svgNode) { + const images = svgNode.getElementsByTagName('image') + const promises = Array.from(images).map((img) => { + const href = img.getAttributeNS('http://www.w3.org/1999/xlink', 'href') + if (href && !href.startsWith('data:')) { + return this.getBase64FromUrl(href) + .then((base64) => { + img.setAttributeNS('http://www.w3.org/1999/xlink', 'href', base64) + }) + .catch((error) => { + console.error('Error converting image to base64:', error) + }) + } + return Promise.resolve() + }) + return Promise.all(promises) + } + + getBase64FromUrl(url) { + return new Promise((resolve, reject) => { + const img = new Image() + img.crossOrigin = 'Anonymous' + img.onload = () => { + const canvas = document.createElement('canvas') + canvas.width = img.width + canvas.height = img.height + const ctx = canvas.getContext('2d') + ctx.drawImage(img, 0, 0) + resolve(canvas.toDataURL()) + } + img.onerror = reject + img.src = url + }) + } + + svgUrl() { + return new Promise((resolve) => { + this.getSvgString().then((svgData) => { + const svgBlob = new Blob([svgData], { + type: 'image/svg+xml;charset=utf-8', + }) + resolve(URL.createObjectURL(svgBlob)) + }) + }) + } + + dataURI(options) { + return new Promise((resolve) => { + const w = this.w + + const scale = options + ? options.scale || options.width / w.globals.svgWidth + : 1 + + const canvas = document.createElement('canvas') + canvas.width = w.globals.svgWidth * scale + canvas.height = parseInt(w.globals.dom.elWrap.style.height, 10) * scale // because of resizeNonAxisCharts + + const canvasBg = + w.config.chart.background === 'transparent' || + !w.config.chart.background + ? '#fff' + : w.config.chart.background + + let ctx = canvas.getContext('2d') + ctx.fillStyle = canvasBg + ctx.fillRect(0, 0, canvas.width * scale, canvas.height * scale) + + this.getSvgString(scale).then((svgData) => { + const svgUrl = 'data:image/svg+xml,' + encodeURIComponent(svgData) + let img = new Image() + img.crossOrigin = 'anonymous' + + img.onload = () => { + ctx.drawImage(img, 0, 0) + + if (canvas.msToBlob) { + // Microsoft Edge can't navigate to data urls, so we return the blob instead + let blob = canvas.msToBlob() + resolve({ blob }) + } else { + let imgURI = canvas.toDataURL('image/png') + resolve({ imgURI }) + } + } + + img.src = svgUrl + }) + }) + } + + exportToSVG() { + this.svgUrl().then((url) => { + this.triggerDownload( + url, + this.w.config.chart.toolbar.export.svg.filename, + '.svg' + ) + }) + } + + exportToPng() { + const scale = this.w.config.chart.toolbar.export.scale + const width = this.w.config.chart.toolbar.export.width + const option = scale + ? { scale: scale } + : width + ? { width: width } + : undefined + this.dataURI(option).then(({ imgURI, blob }) => { + if (blob) { + navigator.msSaveOrOpenBlob(blob, this.w.globals.chartID + '.png') + } else { + this.triggerDownload( + imgURI, + this.w.config.chart.toolbar.export.png.filename, + '.png' + ) + } + }) + } + + exportToCSV({ + series, + fileName, + columnDelimiter = ',', + lineDelimiter = '\n', + }) { + const w = this.w + + if (!series) series = w.config.series + + let columns = [] + let rows = [] + let result = '' + let universalBOM = '\uFEFF' + let gSeries = w.globals.series.map((s, i) => { + return w.globals.collapsedSeriesIndices.indexOf(i) === -1 ? s : [] + }) + + const getFormattedCategory = (cat) => { + if ( + typeof w.config.chart.toolbar.export.csv.categoryFormatter === + 'function' + ) { + return w.config.chart.toolbar.export.csv.categoryFormatter(cat) + } + + if (w.config.xaxis.type === 'datetime' && String(cat).length >= 10) { + return new Date(cat).toDateString() + } + return Utils.isNumber(cat) ? cat : cat.split(columnDelimiter).join('') + } + + const getFormattedValue = (value) => { + return typeof w.config.chart.toolbar.export.csv.valueFormatter === + 'function' + ? w.config.chart.toolbar.export.csv.valueFormatter(value) + : value + } + + const seriesMaxDataLength = Math.max( + ...series.map((s) => { + return s.data ? s.data.length : 0 + }) + ) + const dataFormat = new Data(this.ctx) + + const axesUtils = new AxesUtils(this.ctx) + const getCat = (i) => { + let cat = '' + + // pie / donut/ radial + if (!w.globals.axisCharts) { + cat = w.config.labels[i] + } else { + // xy charts + + // non datetime + if ( + w.config.xaxis.type === 'category' || + w.config.xaxis.convertedCatToNumeric + ) { + if (w.globals.isBarHorizontal) { + let lbFormatter = w.globals.yLabelFormatters[0] + let sr = new Series(this.ctx) + let activeSeries = sr.getActiveConfigSeriesIndex() + + cat = lbFormatter(w.globals.labels[i], { + seriesIndex: activeSeries, + dataPointIndex: i, + w, + }) + } else { + cat = axesUtils.getLabel( + w.globals.labels, + w.globals.timescaleLabels, + 0, + i + ).text + } + } + + // datetime, but labels specified in categories or labels + if (w.config.xaxis.type === 'datetime') { + if (w.config.xaxis.categories.length) { + cat = w.config.xaxis.categories[i] + } else if (w.config.labels.length) { + cat = w.config.labels[i] + } + } + } + + // let the caller know the current category is null. this can happen for example + // when dealing with line charts having inconsistent time series data + if (cat === null) return 'nullvalue' + + if (Array.isArray(cat)) { + cat = cat.join(' ') + } + + return Utils.isNumber(cat) ? cat : cat.split(columnDelimiter).join('') + } + + // Fix https://github.com/apexcharts/apexcharts.js/issues/3365 + const getEmptyDataForCsvColumn = () => { + return [...Array(seriesMaxDataLength)].map(() => '') + } + + const handleAxisRowsColumns = (s, sI) => { + if (columns.length && sI === 0) { + // It's the first series. Go ahead and create the first row with header information. + rows.push(columns.join(columnDelimiter)) + } + + if (s.data) { + // Use the data we have, or generate a properly sized empty array with empty data if some data is missing. + s.data = (s.data.length && s.data) || getEmptyDataForCsvColumn() + for (let i = 0; i < s.data.length; i++) { + // Reset the columns array so that we can start building columns for this row. + columns = [] + + let cat = getCat(i) + + // current category is null, let's move on to the next one + if (cat === 'nullvalue') continue + + if (!cat) { + if (dataFormat.isFormatXY()) { + cat = series[sI].data[i].x + } else if (dataFormat.isFormat2DArray()) { + cat = series[sI].data[i] ? series[sI].data[i][0] : '' + } + } + + if (sI === 0) { + // It's the first series. Also handle the category. + columns.push(getFormattedCategory(cat)) + + for (let ci = 0; ci < w.globals.series.length; ci++) { + const value = dataFormat.isFormatXY() + ? series[ci].data[i]?.y + : gSeries[ci][i] + columns.push(getFormattedValue(value)) + } + } + + if ( + w.config.chart.type === 'candlestick' || + (s.type && s.type === 'candlestick') + ) { + columns.pop() + columns.push(w.globals.seriesCandleO[sI][i]) + columns.push(w.globals.seriesCandleH[sI][i]) + columns.push(w.globals.seriesCandleL[sI][i]) + columns.push(w.globals.seriesCandleC[sI][i]) + } + + if ( + w.config.chart.type === 'boxPlot' || + (s.type && s.type === 'boxPlot') + ) { + columns.pop() + columns.push(w.globals.seriesCandleO[sI][i]) + columns.push(w.globals.seriesCandleH[sI][i]) + columns.push(w.globals.seriesCandleM[sI][i]) + columns.push(w.globals.seriesCandleL[sI][i]) + columns.push(w.globals.seriesCandleC[sI][i]) + } + + if (w.config.chart.type === 'rangeBar') { + columns.pop() + columns.push(w.globals.seriesRangeStart[sI][i]) + columns.push(w.globals.seriesRangeEnd[sI][i]) + } + + if (columns.length) { + rows.push(columns.join(columnDelimiter)) + } + } + } + } + + const handleUnequalXValues = () => { + const categories = new Set() + const data = {} + + series.forEach((s, sI) => { + s?.data.forEach((dataItem) => { + let cat, value + if (dataFormat.isFormatXY()) { + cat = dataItem.x + value = dataItem.y + } else if (dataFormat.isFormat2DArray()) { + cat = dataItem[0] + value = dataItem[1] + } else { + return + } + if (!data[cat]) { + data[cat] = Array(series.length).fill('') + } + data[cat][sI] = getFormattedValue(value) + categories.add(cat) + }) + }) + + if (columns.length) { + rows.push(columns.join(columnDelimiter)) + } + + Array.from(categories) + .sort() + .forEach((cat) => { + rows.push([ + getFormattedCategory(cat), + data[cat].join(columnDelimiter), + ]) + }) + } + + columns.push(w.config.chart.toolbar.export.csv.headerCategory) + + if (w.config.chart.type === 'boxPlot') { + columns.push('minimum') + columns.push('q1') + columns.push('median') + columns.push('q3') + columns.push('maximum') + } else if (w.config.chart.type === 'candlestick') { + columns.push('open') + columns.push('high') + columns.push('low') + columns.push('close') + } else if (w.config.chart.type === 'rangeBar') { + columns.push('minimum') + columns.push('maximum') + } else { + series.map((s, sI) => { + const sname = (s.name ? s.name : `series-${sI}`) + '' + if (w.globals.axisCharts) { + columns.push( + sname.split(columnDelimiter).join('') + ? sname.split(columnDelimiter).join('') + : `series-${sI}` + ) + } + }) + } + + if (!w.globals.axisCharts) { + columns.push(w.config.chart.toolbar.export.csv.headerValue) + rows.push(columns.join(columnDelimiter)) + } + + if ( + !w.globals.allSeriesHasEqualX && + w.globals.axisCharts && + !w.config.xaxis.categories.length && + !w.config.labels.length + ) { + handleUnequalXValues() + } else { + series.map((s, sI) => { + if (w.globals.axisCharts) { + handleAxisRowsColumns(s, sI) + } else { + columns = [] + + columns.push(getFormattedCategory(w.globals.labels[sI])) + columns.push(getFormattedValue(gSeries[sI])) + rows.push(columns.join(columnDelimiter)) + } + }) + } + + result += rows.join(lineDelimiter) + + this.triggerDownload( + 'data:text/csv; charset=utf-8,' + + encodeURIComponent(universalBOM + result), + fileName ? fileName : w.config.chart.toolbar.export.csv.filename, + '.csv' + ) + } + + triggerDownload(href, filename, ext) { + const downloadLink = document.createElement('a') + downloadLink.href = href + downloadLink.download = (filename ? filename : this.w.globals.chartID) + ext + document.body.appendChild(downloadLink) + downloadLink.click() + document.body.removeChild(downloadLink) + } +} + +export default Exports diff --git a/node_modules/apexcharts/src/modules/Fill.js b/node_modules/apexcharts/src/modules/Fill.js new file mode 100644 index 0000000..f8c215f --- /dev/null +++ b/node_modules/apexcharts/src/modules/Fill.js @@ -0,0 +1,512 @@ +import Graphics from './Graphics' +import Utils from '../utils/Utils' + +/** + * ApexCharts Fill Class for setting fill options of the paths. + * + * @module Fill + **/ + +class Fill { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + + this.opts = null + this.seriesIndex = 0 + this.patternIDs = [] + } + + clippedImgArea(params) { + let w = this.w + let cnf = w.config + + let svgW = parseInt(w.globals.gridWidth, 10) + let svgH = parseInt(w.globals.gridHeight, 10) + + let size = svgW > svgH ? svgW : svgH + + let fillImg = params.image + + let imgWidth = 0 + let imgHeight = 0 + if ( + typeof params.width === 'undefined' && + typeof params.height === 'undefined' + ) { + if ( + cnf.fill.image.width !== undefined && + cnf.fill.image.height !== undefined + ) { + imgWidth = cnf.fill.image.width + 1 + imgHeight = cnf.fill.image.height + } else { + imgWidth = size + 1 + imgHeight = size + } + } else { + imgWidth = params.width + imgHeight = params.height + } + + let elPattern = document.createElementNS(w.globals.SVGNS, 'pattern') + + Graphics.setAttrs(elPattern, { + id: params.patternID, + patternUnits: params.patternUnits + ? params.patternUnits + : 'userSpaceOnUse', + width: imgWidth + 'px', + height: imgHeight + 'px', + }) + + let elImage = document.createElementNS(w.globals.SVGNS, 'image') + elPattern.appendChild(elImage) + + elImage.setAttributeNS(window.SVG.xlink, 'href', fillImg) + + Graphics.setAttrs(elImage, { + x: 0, + y: 0, + preserveAspectRatio: 'none', + width: imgWidth + 'px', + height: imgHeight + 'px', + }) + + elImage.style.opacity = params.opacity + + w.globals.dom.elDefs.node.appendChild(elPattern) + } + + getSeriesIndex(opts) { + const w = this.w + const cType = w.config.chart.type + + if ( + ((cType === 'bar' || cType === 'rangeBar') && + w.config.plotOptions.bar.distributed) || + cType === 'heatmap' || + cType === 'treemap' + ) { + this.seriesIndex = opts.seriesNumber + } else { + this.seriesIndex = opts.seriesNumber % w.globals.series.length + } + + return this.seriesIndex + } + + computeColorStops(data, multiColorConfig) { + const w = this.w + let maxPositive = null + let minNegative = null + + for (let value of data) { + if (value >= multiColorConfig.threshold) { + if (maxPositive === null || value > maxPositive) { + maxPositive = value + } + } else { + if (minNegative === null || value < minNegative) { + minNegative = value + } + } + } + + if (maxPositive === null) { + maxPositive = multiColorConfig.threshold + } + if (minNegative === null) { + minNegative = multiColorConfig.threshold + } + + let totalRange = + maxPositive - + multiColorConfig.threshold + + (multiColorConfig.threshold - minNegative) + + if (totalRange === 0) { + totalRange = 1 + } + + let negativePercentage = + ((multiColorConfig.threshold - minNegative) / totalRange) * 100 + + let offset = 100 - negativePercentage + + offset = Math.max(0, Math.min(offset, 100)) + + return [ + { + offset: offset, + color: multiColorConfig.colorAboveThreshold, + opacity: w.config.fill.opacity, + }, + { + offset: 0, + color: multiColorConfig.colorBelowThreshold, + opacity: w.config.fill.opacity, + }, + ] + } + + fillPath(opts) { + let w = this.w + this.opts = opts + + let cnf = this.w.config + let pathFill + + let patternFill, gradientFill + + this.seriesIndex = this.getSeriesIndex(opts) + + const drawMultiColorLine = + cnf.plotOptions.line.colors.colorAboveThreshold && + cnf.plotOptions.line.colors.colorBelowThreshold + + let fillColors = this.getFillColors() + let fillColor = fillColors[this.seriesIndex] + + //override fillcolor if user inputted color with data + if (w.globals.seriesColors[this.seriesIndex] !== undefined) { + fillColor = w.globals.seriesColors[this.seriesIndex] + } + + if (typeof fillColor === 'function') { + fillColor = fillColor({ + seriesIndex: this.seriesIndex, + dataPointIndex: opts.dataPointIndex, + value: opts.value, + w, + }) + } + let fillType = opts.fillType + ? opts.fillType + : this.getFillType(this.seriesIndex) + let fillOpacity = Array.isArray(cnf.fill.opacity) + ? cnf.fill.opacity[this.seriesIndex] + : cnf.fill.opacity + + // when line colors needs to be different based on values, we use gradient config to achieve this + const useGradient = fillType === 'gradient' || drawMultiColorLine + + if (opts.color) { + fillColor = opts.color + } + + if ( + w.config.series[this.seriesIndex]?.data?.[opts.dataPointIndex]?.fillColor + ) { + fillColor = + w.config.series[this.seriesIndex]?.data?.[opts.dataPointIndex] + ?.fillColor + } + + // in case a color is undefined, fallback to white color to prevent runtime error + if (!fillColor) { + fillColor = '#fff' + console.warn('undefined color - ApexCharts') + } + + let defaultColor = fillColor + + if (fillColor.indexOf('rgb') === -1) { + if (fillColor.indexOf('#') === -1) { + defaultColor = fillColor + } else if (fillColor.length < 9) { + // if the hex contains alpha and is of 9 digit, skip the opacity + defaultColor = Utils.hexToRgba(fillColor, fillOpacity) + } + } else { + if (fillColor.indexOf('rgba') > -1) { + fillOpacity = Utils.getOpacityFromRGBA(fillColor) + } else { + defaultColor = Utils.hexToRgba(Utils.rgb2hex(fillColor), fillOpacity) + } + } + if (opts.opacity) fillOpacity = opts.opacity + + if (fillType === 'pattern') { + patternFill = this.handlePatternFill({ + fillConfig: opts.fillConfig, + patternFill, + fillColor, + fillOpacity, + defaultColor, + }) + } + + if (useGradient) { + let colorStops = [...cnf.fill.gradient.colorStops] || [] + let type = cnf.fill.gradient.type + if (drawMultiColorLine) { + colorStops[this.seriesIndex] = this.computeColorStops( + w.globals.series[this.seriesIndex], + cnf.plotOptions.line.colors + ) + type = 'vertical' + } + + gradientFill = this.handleGradientFill({ + type, + fillConfig: opts.fillConfig, + fillColor, + fillOpacity, + colorStops, + i: this.seriesIndex, + }) + } + + if (fillType === 'image') { + let imgSrc = cnf.fill.image.src + + let patternID = opts.patternID ? opts.patternID : '' + const patternKey = `pattern${w.globals.cuid}${ + opts.seriesNumber + 1 + }${patternID}` + + if (this.patternIDs.indexOf(patternKey) === -1) { + this.clippedImgArea({ + opacity: fillOpacity, + image: Array.isArray(imgSrc) + ? opts.seriesNumber < imgSrc.length + ? imgSrc[opts.seriesNumber] + : imgSrc[0] + : imgSrc, + width: opts.width ? opts.width : undefined, + height: opts.height ? opts.height : undefined, + patternUnits: opts.patternUnits, + patternID: patternKey, + }) + + this.patternIDs.push(patternKey) + } + + pathFill = `url(#${patternKey})` + } else if (useGradient) { + pathFill = gradientFill + } else if (fillType === 'pattern') { + pathFill = patternFill + } else { + pathFill = defaultColor + } + + // override pattern/gradient if opts.solid is true + if (opts.solid) { + pathFill = defaultColor + } + + return pathFill + } + + getFillType(seriesIndex) { + const w = this.w + + if (Array.isArray(w.config.fill.type)) { + return w.config.fill.type[seriesIndex] + } else { + return w.config.fill.type + } + } + + getFillColors() { + const w = this.w + const cnf = w.config + const opts = this.opts + + let fillColors = [] + + if (w.globals.comboCharts) { + if (w.config.series[this.seriesIndex].type === 'line') { + if (Array.isArray(w.globals.stroke.colors)) { + fillColors = w.globals.stroke.colors + } else { + fillColors.push(w.globals.stroke.colors) + } + } else { + if (Array.isArray(w.globals.fill.colors)) { + fillColors = w.globals.fill.colors + } else { + fillColors.push(w.globals.fill.colors) + } + } + } else { + if (cnf.chart.type === 'line') { + if (Array.isArray(w.globals.stroke.colors)) { + fillColors = w.globals.stroke.colors + } else { + fillColors.push(w.globals.stroke.colors) + } + } else { + if (Array.isArray(w.globals.fill.colors)) { + fillColors = w.globals.fill.colors + } else { + fillColors.push(w.globals.fill.colors) + } + } + } + + // colors passed in arguments + if (typeof opts.fillColors !== 'undefined') { + fillColors = [] + if (Array.isArray(opts.fillColors)) { + fillColors = opts.fillColors.slice() + } else { + fillColors.push(opts.fillColors) + } + } + + return fillColors + } + + handlePatternFill({ + fillConfig, + patternFill, + fillColor, + fillOpacity, + defaultColor, + }) { + let fillCnf = this.w.config.fill + + if (fillConfig) { + fillCnf = fillConfig + } + + const opts = this.opts + let graphics = new Graphics(this.ctx) + + let patternStrokeWidth = Array.isArray(fillCnf.pattern.strokeWidth) + ? fillCnf.pattern.strokeWidth[this.seriesIndex] + : fillCnf.pattern.strokeWidth + let patternLineColor = fillColor + + if (Array.isArray(fillCnf.pattern.style)) { + if (typeof fillCnf.pattern.style[opts.seriesNumber] !== 'undefined') { + let pf = graphics.drawPattern( + fillCnf.pattern.style[opts.seriesNumber], + fillCnf.pattern.width, + fillCnf.pattern.height, + patternLineColor, + patternStrokeWidth, + fillOpacity + ) + patternFill = pf + } else { + patternFill = defaultColor + } + } else { + patternFill = graphics.drawPattern( + fillCnf.pattern.style, + fillCnf.pattern.width, + fillCnf.pattern.height, + patternLineColor, + patternStrokeWidth, + fillOpacity + ) + } + return patternFill + } + + handleGradientFill({ + type, + fillColor, + fillOpacity, + fillConfig, + colorStops, + i, + }) { + let fillCnf = this.w.config.fill + + if (fillConfig) { + fillCnf = { + ...fillCnf, + ...fillConfig, + } + } + const opts = this.opts + let graphics = new Graphics(this.ctx) + let utils = new Utils() + + type = type || fillCnf.gradient.type + let gradientFrom = fillColor + let gradientTo + let opacityFrom = + fillCnf.gradient.opacityFrom === undefined + ? fillOpacity + : Array.isArray(fillCnf.gradient.opacityFrom) + ? fillCnf.gradient.opacityFrom[i] + : fillCnf.gradient.opacityFrom + + if (gradientFrom.indexOf('rgba') > -1) { + opacityFrom = Utils.getOpacityFromRGBA(gradientFrom) + } + let opacityTo = + fillCnf.gradient.opacityTo === undefined + ? fillOpacity + : Array.isArray(fillCnf.gradient.opacityTo) + ? fillCnf.gradient.opacityTo[i] + : fillCnf.gradient.opacityTo + + if ( + fillCnf.gradient.gradientToColors === undefined || + fillCnf.gradient.gradientToColors.length === 0 + ) { + if (fillCnf.gradient.shade === 'dark') { + gradientTo = utils.shadeColor( + parseFloat(fillCnf.gradient.shadeIntensity) * -1, + fillColor.indexOf('rgb') > -1 ? Utils.rgb2hex(fillColor) : fillColor + ) + } else { + gradientTo = utils.shadeColor( + parseFloat(fillCnf.gradient.shadeIntensity), + fillColor.indexOf('rgb') > -1 ? Utils.rgb2hex(fillColor) : fillColor + ) + } + } else { + if (fillCnf.gradient.gradientToColors[opts.seriesNumber]) { + const gToColor = fillCnf.gradient.gradientToColors[opts.seriesNumber] + gradientTo = gToColor + if (gToColor.indexOf('rgba') > -1) { + opacityTo = Utils.getOpacityFromRGBA(gToColor) + } + } else { + gradientTo = fillColor + } + } + + if (fillCnf.gradient.gradientFrom) { + gradientFrom = fillCnf.gradient.gradientFrom + } + if (fillCnf.gradient.gradientTo) { + gradientTo = fillCnf.gradient.gradientTo + } + + if (fillCnf.gradient.inverseColors) { + let t = gradientFrom + gradientFrom = gradientTo + gradientTo = t + } + + if (gradientFrom.indexOf('rgb') > -1) { + gradientFrom = Utils.rgb2hex(gradientFrom) + } + if (gradientTo.indexOf('rgb') > -1) { + gradientTo = Utils.rgb2hex(gradientTo) + } + + return graphics.drawGradient( + type, + gradientFrom, + gradientTo, + opacityFrom, + opacityTo, + opts.size, + fillCnf.gradient.stops, + colorStops, + i + ) + } +} + +export default Fill diff --git a/node_modules/apexcharts/src/modules/Filters.js b/node_modules/apexcharts/src/modules/Filters.js new file mode 100644 index 0000000..08b7233 --- /dev/null +++ b/node_modules/apexcharts/src/modules/Filters.js @@ -0,0 +1,172 @@ +import Filter from '@svgdotjs/svg.filter.js' + +import Utils from './../utils/Utils' + +/** + * ApexCharts Filters Class for setting hover/active states on the paths. + * + * @module Formatters + **/ +class Filters { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + } + + // create a re-usable filter which can be appended other filter effects and applied to multiple elements + getDefaultFilter(el, i) { + const w = this.w + el.unfilter(true) + + let filter = new Filter() + filter.size('120%', '180%', '-5%', '-40%') + + if (w.config.chart.dropShadow.enabled) { + this.dropShadow(el, w.config.chart.dropShadow, i) + } + } + + applyFilter(el, i, filterType) { + const w = this.w + el.unfilter(true) + + if (filterType === 'none') { + this.getDefaultFilter(el, i) + return + } + + const shadowAttr = w.config.chart.dropShadow + const brightnessFactor = filterType === 'lighten' ? 2 : 0.3 + + el.filterWith((add) => { + add.colorMatrix({ + type: 'matrix', + values: ` + ${brightnessFactor} 0 0 0 0 + 0 ${brightnessFactor} 0 0 0 + 0 0 ${brightnessFactor} 0 0 + 0 0 0 1 0 + `, + in: 'SourceGraphic', + result: 'brightness', + }) + + if (shadowAttr.enabled) { + this.addShadow(add, i, shadowAttr, 'brightness') + } + }) + + if (!shadowAttr.noUserSpaceOnUse) { + el.filterer()?.node?.setAttribute('filterUnits', 'userSpaceOnUse') + } + + // this scales the filter to a bigger size so that the dropshadow doesn't crops + this._scaleFilterSize(el.filterer()?.node) + } + + // appends dropShadow to the filter object which can be chained with other filter effects + addShadow(add, i, attrs, source) { + const w = this.w + let { blur, top, left, color, opacity } = attrs + color = Array.isArray(color) ? color[i] : color + + if (w.config.chart.dropShadow.enabledOnSeries?.length > 0) { + if (w.config.chart.dropShadow.enabledOnSeries.indexOf(i) === -1) { + return add + } + } + + add.offset({ + in: source, + dx: left, + dy: top, + result: 'offset', + }) + + add.gaussianBlur({ + in: 'offset', + stdDeviation: blur, + result: 'blur', + }) + + add.flood({ + 'flood-color': color, + 'flood-opacity': opacity, + result: 'flood', + }) + + add.composite({ + in: 'flood', + in2: 'blur', + operator: 'in', + result: 'shadow', + }) + + add.merge(['shadow', source]) + } + + // directly adds dropShadow to the element and returns the same element. + dropShadow(el, attrs, i = 0) { + const w = this.w + + el.unfilter(true) + + if (Utils.isMsEdge() && w.config.chart.type === 'radialBar') { + // in radialbar charts, dropshadow is clipping actual drawing in IE + return el + } + + if (w.config.chart.dropShadow.enabledOnSeries?.length > 0) { + if (w.config.chart.dropShadow.enabledOnSeries?.indexOf(i) === -1) { + return el + } + } + + el.filterWith((add) => { + this.addShadow(add, i, attrs, 'SourceGraphic') + }) + + if (!attrs.noUserSpaceOnUse) { + el.filterer()?.node?.setAttribute('filterUnits', 'userSpaceOnUse') + } + + // this scales the filter to a bigger size so that the dropshadow doesn't crops + this._scaleFilterSize(el.filterer()?.node) + + return el + } + + setSelectionFilter(el, realIndex, dataPointIndex) { + const w = this.w + if (typeof w.globals.selectedDataPoints[realIndex] !== 'undefined') { + if ( + w.globals.selectedDataPoints[realIndex].indexOf(dataPointIndex) > -1 + ) { + el.node.setAttribute('selected', true) + let activeFilter = w.config.states.active.filter + if (activeFilter !== 'none') { + this.applyFilter(el, realIndex, activeFilter.type) + } + } + } + } + + _scaleFilterSize(el) { + if (!el) return + const setAttributes = (attrs) => { + for (let key in attrs) { + if (attrs.hasOwnProperty(key)) { + el.setAttribute(key, attrs[key]) + } + } + } + setAttributes({ + width: '200%', + height: '200%', + x: '-50%', + y: '-50%', + }) + } +} + +export default Filters diff --git a/node_modules/apexcharts/src/modules/Formatters.js b/node_modules/apexcharts/src/modules/Formatters.js new file mode 100644 index 0000000..31112f4 --- /dev/null +++ b/node_modules/apexcharts/src/modules/Formatters.js @@ -0,0 +1,185 @@ +import DateTime from '../utils/DateTime' +import Utils from '../utils/Utils' + +/** + * ApexCharts Formatter Class for setting value formatters for axes as well as tooltips. + * + * @module Formatters + **/ + +class Formatters { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + this.tooltipKeyFormat = 'dd MMM' + } + + xLabelFormat(fn, val, timestamp, opts) { + let w = this.w + + if (w.config.xaxis.type === 'datetime') { + if (w.config.xaxis.labels.formatter === undefined) { + // if user has not specified a custom formatter, use the default tooltip.x.format + if (w.config.tooltip.x.formatter === undefined) { + let datetimeObj = new DateTime(this.ctx) + return datetimeObj.formatDate( + datetimeObj.getDate(val), + w.config.tooltip.x.format + ) + } + } + } + + return fn(val, timestamp, opts) + } + + defaultGeneralFormatter(val) { + if (Array.isArray(val)) { + return val.map((v) => { + return v + }) + } else { + return val + } + } + + defaultYFormatter(v, yaxe, i) { + let w = this.w + + if (Utils.isNumber(v)) { + if (w.globals.yValueDecimal !== 0) { + v = v.toFixed( + yaxe.decimalsInFloat !== undefined + ? yaxe.decimalsInFloat + : w.globals.yValueDecimal + ) + } else { + // We have an integer value but the label is not an integer. We can + // deduce this is due to the number of ticks exceeding the even lower + // integer range. Add an additional decimal place only in this case. + const f = v.toFixed(0) + // Do not change the == to === + v = v == f ? f : v.toFixed(1) + } + } + return v + } + + setLabelFormatters() { + let w = this.w + + w.globals.xaxisTooltipFormatter = (val) => { + return this.defaultGeneralFormatter(val) + } + + w.globals.ttKeyFormatter = (val) => { + return this.defaultGeneralFormatter(val) + } + + w.globals.ttZFormatter = (val) => { + return val + } + + w.globals.legendFormatter = (val) => { + return this.defaultGeneralFormatter(val) + } + + // formatter function will always overwrite format property + if (w.config.xaxis.labels.formatter !== undefined) { + w.globals.xLabelFormatter = w.config.xaxis.labels.formatter + } else { + w.globals.xLabelFormatter = (val) => { + if (Utils.isNumber(val)) { + if ( + !w.config.xaxis.convertedCatToNumeric && + w.config.xaxis.type === 'numeric' + ) { + if (Utils.isNumber(w.config.xaxis.decimalsInFloat)) { + return val.toFixed(w.config.xaxis.decimalsInFloat) + } else { + const diff = w.globals.maxX - w.globals.minX + if (diff > 0 && diff < 100) { + return val.toFixed(1) + } + return val.toFixed(0) + } + } + + if (w.globals.isBarHorizontal) { + const range = w.globals.maxY - w.globals.minYArr + if (range < 4) { + return val.toFixed(1) + } + } + return val.toFixed(0) + } + return val + } + } + + if (typeof w.config.tooltip.x.formatter === 'function') { + w.globals.ttKeyFormatter = w.config.tooltip.x.formatter + } else { + w.globals.ttKeyFormatter = w.globals.xLabelFormatter + } + + if (typeof w.config.xaxis.tooltip.formatter === 'function') { + w.globals.xaxisTooltipFormatter = w.config.xaxis.tooltip.formatter + } + + if (Array.isArray(w.config.tooltip.y)) { + w.globals.ttVal = w.config.tooltip.y + } else { + if (w.config.tooltip.y.formatter !== undefined) { + w.globals.ttVal = w.config.tooltip.y + } + } + + if (w.config.tooltip.z.formatter !== undefined) { + w.globals.ttZFormatter = w.config.tooltip.z.formatter + } + + // legend formatter - if user wants to append any global values of series to legend text + if (w.config.legend.formatter !== undefined) { + w.globals.legendFormatter = w.config.legend.formatter + } + + // formatter function will always overwrite format property + w.config.yaxis.forEach((yaxe, i) => { + if (yaxe.labels.formatter !== undefined) { + w.globals.yLabelFormatters[i] = yaxe.labels.formatter + } else { + w.globals.yLabelFormatters[i] = (val) => { + if (!w.globals.xyCharts) return val + + if (Array.isArray(val)) { + return val.map((v) => { + return this.defaultYFormatter(v, yaxe, i) + }) + } else { + return this.defaultYFormatter(val, yaxe, i) + } + } + } + }) + + return w.globals + } + + heatmapLabelFormatters() { + const w = this.w + if (w.config.chart.type === 'heatmap') { + w.globals.yAxisScale[0].result = w.globals.seriesNames.slice() + + // get the longest string from the labels array and also apply label formatter to it + let longest = w.globals.seriesNames.reduce( + (a, b) => (a.length > b.length ? a : b), + 0 + ) + w.globals.yAxisScale[0].niceMax = longest + w.globals.yAxisScale[0].niceMin = longest + } + } +} + +export default Formatters diff --git a/node_modules/apexcharts/src/modules/Graphics.js b/node_modules/apexcharts/src/modules/Graphics.js new file mode 100644 index 0000000..420e59d --- /dev/null +++ b/node_modules/apexcharts/src/modules/Graphics.js @@ -0,0 +1,1095 @@ +import Animations from './Animations' +import Filters from './Filters' +import Utils from '../utils/Utils' + +/** + * ApexCharts Graphics Class for all drawing operations. + * + * @module Graphics + **/ + +class Graphics { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + } + + /***************************************************************************** + * * + * SVG Path Rounding Function * + * Copyright (C) 2014 Yona Appletree * + * * + * Licensed under the Apache License, Version 2.0 (the "License"); * + * you may not use this file except in compliance with the License. * + * You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, software * + * distributed under the License is distributed on an "AS IS" BASIS, * + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * + * See the License for the specific language governing permissions and * + * limitations under the License. * + * * + *****************************************************************************/ + + /** + * SVG Path rounding function. Takes an input path string and outputs a path + * string where all line-line corners have been rounded. Only supports absolute + * commands at the moment. + * + * @param pathString The SVG input path + * @param radius The amount to round the corners, either a value in the SVG + * coordinate space, or, if useFractionalRadius is true, a value + * from 0 to 1. + * @returns A new SVG path string with the rounding + */ + roundPathCorners(pathString, radius) { + if (pathString.indexOf('NaN') > -1) pathString = '' + + function moveTowardsLength(movingPoint, targetPoint, amount) { + var width = targetPoint.x - movingPoint.x + var height = targetPoint.y - movingPoint.y + + var distance = Math.sqrt(width * width + height * height) + + return moveTowardsFractional( + movingPoint, + targetPoint, + Math.min(1, amount / distance) + ) + } + function moveTowardsFractional(movingPoint, targetPoint, fraction) { + return { + x: movingPoint.x + (targetPoint.x - movingPoint.x) * fraction, + y: movingPoint.y + (targetPoint.y - movingPoint.y) * fraction, + } + } + + // Adjusts the ending position of a command + function adjustCommand(cmd, newPoint) { + if (cmd.length > 2) { + cmd[cmd.length - 2] = newPoint.x + cmd[cmd.length - 1] = newPoint.y + } + } + + // Gives an {x, y} object for a command's ending position + function pointForCommand(cmd) { + return { + x: parseFloat(cmd[cmd.length - 2]), + y: parseFloat(cmd[cmd.length - 1]), + } + } + + // Split apart the path, handing concatonated letters and numbers + var pathParts = pathString.split(/[,\s]/).reduce(function (parts, part) { + var match = part.match('([a-zA-Z])(.+)') + if (match) { + parts.push(match[1]) + parts.push(match[2]) + } else { + parts.push(part) + } + + return parts + }, []) + + // Group the commands with their arguments for easier handling + var commands = pathParts.reduce(function (commands, part) { + if (parseFloat(part) == part && commands.length) { + commands[commands.length - 1].push(part) + } else { + commands.push([part]) + } + + return commands + }, []) + + // The resulting commands, also grouped + var resultCommands = [] + + if (commands.length > 1) { + var startPoint = pointForCommand(commands[0]) + + // Handle the close path case with a "virtual" closing line + var virtualCloseLine = null + if (commands[commands.length - 1][0] == 'Z' && commands[0].length > 2) { + virtualCloseLine = ['L', startPoint.x, startPoint.y] + commands[commands.length - 1] = virtualCloseLine + } + + // We always use the first command (but it may be mutated) + resultCommands.push(commands[0]) + + for (var cmdIndex = 1; cmdIndex < commands.length; cmdIndex++) { + var prevCmd = resultCommands[resultCommands.length - 1] + + var curCmd = commands[cmdIndex] + + // Handle closing case + var nextCmd = + curCmd == virtualCloseLine ? commands[1] : commands[cmdIndex + 1] + + // Nasty logic to decide if this path is a candidite. + if ( + nextCmd && + prevCmd && + prevCmd.length > 2 && + curCmd[0] == 'L' && + nextCmd.length > 2 && + nextCmd[0] == 'L' + ) { + // Calc the points we're dealing with + var prevPoint = pointForCommand(prevCmd) + var curPoint = pointForCommand(curCmd) + var nextPoint = pointForCommand(nextCmd) + + // The start and end of the cuve are just our point moved towards the previous and next points, respectivly + var curveStart, curveEnd + + curveStart = moveTowardsLength(curPoint, prevPoint, radius) + curveEnd = moveTowardsLength(curPoint, nextPoint, radius) + + // Adjust the current command and add it + adjustCommand(curCmd, curveStart) + curCmd.origPoint = curPoint + resultCommands.push(curCmd) + + // The curve control points are halfway between the start/end of the curve and + // the original point + var startControl = moveTowardsFractional(curveStart, curPoint, 0.5) + var endControl = moveTowardsFractional(curPoint, curveEnd, 0.5) + + // Create the curve + var curveCmd = [ + 'C', + startControl.x, + startControl.y, + endControl.x, + endControl.y, + curveEnd.x, + curveEnd.y, + ] + // Save the original point for fractional calculations + curveCmd.origPoint = curPoint + resultCommands.push(curveCmd) + } else { + // Pass through commands that don't qualify + resultCommands.push(curCmd) + } + } + + // Fix up the starting point and restore the close path if the path was orignally closed + if (virtualCloseLine) { + var newStartPoint = pointForCommand( + resultCommands[resultCommands.length - 1] + ) + resultCommands.push(['Z']) + adjustCommand(resultCommands[0], newStartPoint) + } + } else { + resultCommands = commands + } + + return resultCommands.reduce(function (str, c) { + return str + c.join(' ') + ' ' + }, '') + } + + drawLine( + x1, + y1, + x2, + y2, + lineColor = '#a8a8a8', + dashArray = 0, + strokeWidth = null, + strokeLineCap = 'butt' + ) { + let w = this.w + let line = w.globals.dom.Paper.line().attr({ + x1, + y1, + x2, + y2, + stroke: lineColor, + 'stroke-dasharray': dashArray, + 'stroke-width': strokeWidth, + 'stroke-linecap': strokeLineCap, + }) + + return line + } + + drawRect( + x1 = 0, + y1 = 0, + x2 = 0, + y2 = 0, + radius = 0, + color = '#fefefe', + opacity = 1, + strokeWidth = null, + strokeColor = null, + strokeDashArray = 0 + ) { + let w = this.w + let rect = w.globals.dom.Paper.rect() + + rect.attr({ + x: x1, + y: y1, + width: x2 > 0 ? x2 : 0, + height: y2 > 0 ? y2 : 0, + rx: radius, + ry: radius, + opacity, + 'stroke-width': strokeWidth !== null ? strokeWidth : 0, + stroke: strokeColor !== null ? strokeColor : 'none', + 'stroke-dasharray': strokeDashArray, + }) + + // fix apexcharts.js#1410 + rect.node.setAttribute('fill', color) + + return rect + } + + drawPolygon( + polygonString, + stroke = '#e1e1e1', + strokeWidth = 1, + fill = 'none' + ) { + const w = this.w + const polygon = w.globals.dom.Paper.polygon(polygonString).attr({ + fill, + stroke, + 'stroke-width': strokeWidth, + }) + + return polygon + } + + drawCircle(radius, attrs = null) { + const w = this.w + + if (radius < 0) radius = 0 + const c = w.globals.dom.Paper.circle(radius * 2) + if (attrs !== null) { + c.attr(attrs) + } + return c + } + + drawPath({ + d = '', + stroke = '#a8a8a8', + strokeWidth = 1, + fill, + fillOpacity = 1, + strokeOpacity = 1, + classes, + strokeLinecap = null, + strokeDashArray = 0, + }) { + let w = this.w + + if (strokeLinecap === null) { + strokeLinecap = w.config.stroke.lineCap + } + + if (d.indexOf('undefined') > -1 || d.indexOf('NaN') > -1) { + d = `M 0 ${w.globals.gridHeight}` + } + let p = w.globals.dom.Paper.path(d).attr({ + fill, + 'fill-opacity': fillOpacity, + stroke, + 'stroke-opacity': strokeOpacity, + 'stroke-linecap': strokeLinecap, + 'stroke-width': strokeWidth, + 'stroke-dasharray': strokeDashArray, + class: classes, + }) + + return p + } + + group(attrs = null) { + const w = this.w + const g = w.globals.dom.Paper.group() + + if (attrs !== null) { + g.attr(attrs) + } + return g + } + + move(x, y) { + let move = ['M', x, y].join(' ') + return move + } + + line(x, y, hORv = null) { + let line = null + if (hORv === null) { + line = [' L', x, y].join(' ') + } else if (hORv === 'H') { + line = [' H', x].join(' ') + } else if (hORv === 'V') { + line = [' V', y].join(' ') + } + return line + } + + curve(x1, y1, x2, y2, x, y) { + let curve = ['C', x1, y1, x2, y2, x, y].join(' ') + return curve + } + + quadraticCurve(x1, y1, x, y) { + let curve = ['Q', x1, y1, x, y].join(' ') + return curve + } + + arc(rx, ry, axisRotation, largeArcFlag, sweepFlag, x, y, relative = false) { + let coord = 'A' + if (relative) coord = 'a' + + let arc = [coord, rx, ry, axisRotation, largeArcFlag, sweepFlag, x, y].join( + ' ' + ) + return arc + } + + /** + * @memberof Graphics + * @param {object} + * i = series's index + * realIndex = realIndex is series's actual index when it was drawn time. After several redraws, the iterating "i" may change in loops, but realIndex doesn't + * pathFrom = existing pathFrom to animateTo + * pathTo = new Path to which d attr will be animated from pathFrom to pathTo + * stroke = line Color + * strokeWidth = width of path Line + * fill = it can be gradient, single color, pattern or image + * animationDelay = how much to delay when starting animation (in milliseconds) + * dataChangeSpeed = for dynamic animations, when data changes + * className = class attribute to add + * @return {object} svg.js path object + **/ + renderPaths({ + j, + realIndex, + pathFrom, + pathTo, + stroke, + strokeWidth, + strokeLinecap, + fill, + animationDelay, + initialSpeed, + dataChangeSpeed, + className, + chartType, + shouldClipToGrid = true, + bindEventsOnPaths = true, + drawShadow = true, + }) { + let w = this.w + const filters = new Filters(this.ctx) + const anim = new Animations(this.ctx) + + let initialAnim = this.w.config.chart.animations.enabled + let dynamicAnim = + initialAnim && this.w.config.chart.animations.dynamicAnimation.enabled + + let d + let shouldAnimate = !!( + (initialAnim && !w.globals.resized) || + (dynamicAnim && w.globals.dataChanged && w.globals.shouldAnimate) + ) + + if (shouldAnimate) { + d = pathFrom + } else { + d = pathTo + w.globals.animationEnded = true + } + + let strokeDashArrayOpt = w.config.stroke.dashArray + let strokeDashArray = 0 + if (Array.isArray(strokeDashArrayOpt)) { + strokeDashArray = strokeDashArrayOpt[realIndex] + } else { + strokeDashArray = w.config.stroke.dashArray + } + + let el = this.drawPath({ + d, + stroke, + strokeWidth, + fill, + fillOpacity: 1, + classes: className, + strokeLinecap, + strokeDashArray, + }) + + el.attr('index', realIndex) + + if (shouldClipToGrid) { + if ( + (chartType === 'bar' && !w.globals.isHorizontal) || + w.globals.comboCharts + ) { + el.attr({ + 'clip-path': `url(#gridRectBarMask${w.globals.cuid})`, + }) + } else { + el.attr({ + 'clip-path': `url(#gridRectMask${w.globals.cuid})`, + }) + } + } + + if (w.config.chart.dropShadow.enabled && drawShadow) { + filters.dropShadow(el, w.config.chart.dropShadow, realIndex) + } + + if (bindEventsOnPaths) { + el.node.addEventListener('mouseenter', this.pathMouseEnter.bind(this, el)) + el.node.addEventListener('mouseleave', this.pathMouseLeave.bind(this, el)) + el.node.addEventListener('mousedown', this.pathMouseDown.bind(this, el)) + } + + el.attr({ + pathTo, + pathFrom, + }) + + const defaultAnimateOpts = { + el, + j, + realIndex, + pathFrom, + pathTo, + fill, + strokeWidth, + delay: animationDelay, + } + + if (initialAnim && !w.globals.resized && !w.globals.dataChanged) { + anim.animatePathsGradually({ + ...defaultAnimateOpts, + speed: initialSpeed, + }) + } else { + if (w.globals.resized || !w.globals.dataChanged) { + anim.showDelayedElements() + } + } + + if (w.globals.dataChanged && dynamicAnim && shouldAnimate) { + anim.animatePathsGradually({ + ...defaultAnimateOpts, + speed: dataChangeSpeed, + }) + } + + return el + } + + drawPattern( + style, + width, + height, + stroke = '#a8a8a8', + strokeWidth = 0, + opacity = 1 + ) { + let w = this.w + + let p = w.globals.dom.Paper.pattern(width, height, (add) => { + if (style === 'horizontalLines') { + add + .line(0, 0, height, 0) + .stroke({ color: stroke, width: strokeWidth + 1 }) + } else if (style === 'verticalLines') { + add + .line(0, 0, 0, width) + .stroke({ color: stroke, width: strokeWidth + 1 }) + } else if (style === 'slantedLines') { + add + .line(0, 0, width, height) + .stroke({ color: stroke, width: strokeWidth }) + } else if (style === 'squares') { + add + .rect(width, height) + .fill('none') + .stroke({ color: stroke, width: strokeWidth }) + } else if (style === 'circles') { + add + .circle(width) + .fill('none') + .stroke({ color: stroke, width: strokeWidth }) + } + }) + + return p + } + + drawGradient( + style, + gfrom, + gto, + opacityFrom, + opacityTo, + size = null, + stops = null, + colorStops = [], + i = 0 + ) { + let w = this.w + let g + + if (gfrom.length < 9 && gfrom.indexOf('#') === 0) { + // if the hex contains alpha and is of 9 digit, skip the opacity + gfrom = Utils.hexToRgba(gfrom, opacityFrom) + } + if (gto.length < 9 && gto.indexOf('#') === 0) { + gto = Utils.hexToRgba(gto, opacityTo) + } + + let stop1 = 0 + let stop2 = 1 + let stop3 = 1 + let stop4 = null + + if (stops !== null) { + stop1 = typeof stops[0] !== 'undefined' ? stops[0] / 100 : 0 + stop2 = typeof stops[1] !== 'undefined' ? stops[1] / 100 : 1 + stop3 = typeof stops[2] !== 'undefined' ? stops[2] / 100 : 1 + stop4 = typeof stops[3] !== 'undefined' ? stops[3] / 100 : null + } + + let radial = !!( + w.config.chart.type === 'donut' || + w.config.chart.type === 'pie' || + w.config.chart.type === 'polarArea' || + w.config.chart.type === 'bubble' + ) + + if (!colorStops || colorStops.length === 0) { + g = w.globals.dom.Paper.gradient(radial ? 'radial' : 'linear', (add) => { + add.stop(stop1, gfrom, opacityFrom) + add.stop(stop2, gto, opacityTo) + add.stop(stop3, gto, opacityTo) + if (stop4 !== null) { + add.stop(stop4, gfrom, opacityFrom) + } + }) + } else { + g = w.globals.dom.Paper.gradient(radial ? 'radial' : 'linear', (add) => { + let gradientStops = Array.isArray(colorStops[i]) + ? colorStops[i] + : colorStops + gradientStops.forEach((s) => { + add.stop(s.offset / 100, s.color, s.opacity) + }) + }) + } + + if (!radial) { + if (style === 'vertical') { + g.from(0, 0).to(0, 1) + } else if (style === 'diagonal') { + g.from(0, 0).to(1, 1) + } else if (style === 'horizontal') { + g.from(0, 1).to(1, 1) + } else if (style === 'diagonal2') { + g.from(1, 0).to(0, 1) + } + } else { + let offx = w.globals.gridWidth / 2 + let offy = w.globals.gridHeight / 2 + + if (w.config.chart.type !== 'bubble') { + g.attr({ + gradientUnits: 'userSpaceOnUse', + cx: offx, + cy: offy, + r: size, + }) + } else { + g.attr({ + cx: 0.5, + cy: 0.5, + r: 0.8, + fx: 0.2, + fy: 0.2, + }) + } + } + + return g + } + + getTextBasedOnMaxWidth({ text, maxWidth, fontSize, fontFamily }) { + const tRects = this.getTextRects(text, fontSize, fontFamily) + const wordWidth = tRects.width / text.length + const wordsBasedOnWidth = Math.floor(maxWidth / wordWidth) + if (maxWidth < tRects.width) { + return text.slice(0, wordsBasedOnWidth - 3) + '...' + } + return text + } + + drawText({ + x, + y, + text, + textAnchor, + fontSize, + fontFamily, + fontWeight, + foreColor, + opacity, + maxWidth, + cssClass = '', + isPlainText = true, + dominantBaseline = 'auto', + }) { + let w = this.w + + if (typeof text === 'undefined') text = '' + + let truncatedText = text + if (!textAnchor) { + textAnchor = 'start' + } + + if (!foreColor || !foreColor.length) { + foreColor = w.config.chart.foreColor + } + fontFamily = fontFamily || w.config.chart.fontFamily + fontSize = fontSize || '11px' + fontWeight = fontWeight || 'regular' + + const commonProps = { + maxWidth, + fontSize, + fontFamily, + } + let elText + if (Array.isArray(text)) { + elText = w.globals.dom.Paper.text((add) => { + for (let i = 0; i < text.length; i++) { + truncatedText = text[i] + if (maxWidth) { + truncatedText = this.getTextBasedOnMaxWidth({ + text: text[i], + ...commonProps, + }) + } + i === 0 + ? add.tspan(truncatedText) + : add.tspan(truncatedText).newLine() + } + }) + } else { + if (maxWidth) { + truncatedText = this.getTextBasedOnMaxWidth({ + text, + ...commonProps, + }) + } + elText = isPlainText + ? w.globals.dom.Paper.plain(text) + : w.globals.dom.Paper.text((add) => add.tspan(truncatedText)) + } + + elText.attr({ + x, + y, + 'text-anchor': textAnchor, + 'dominant-baseline': dominantBaseline, + 'font-size': fontSize, + 'font-family': fontFamily, + 'font-weight': fontWeight, + fill: foreColor, + class: 'apexcharts-text ' + cssClass, + }) + + elText.node.style.fontFamily = fontFamily + elText.node.style.opacity = opacity + + return elText + } + + getMarkerPath(x, y, type, size) { + let d = '' + switch (type) { + case 'cross': + size = size / 1.4 + d = `M ${x - size} ${y - size} L ${x + size} ${y + size} M ${ + x - size + } ${y + size} L ${x + size} ${y - size}` + break + case 'plus': + size = size / 1.12 + d = `M ${x - size} ${y} L ${x + size} ${y} M ${x} ${y - size} L ${x} ${ + y + size + }` + break + case 'star': + case 'sparkle': + let points = 5 + size = size * 1.15 + if (type === 'sparkle') { + size = size / 1.1 + points = 4 + } + const step = Math.PI / points + + for (let i = 0; i <= 2 * points; i++) { + const angle = i * step + const radius = i % 2 === 0 ? size : size / 2 + const xPos = x + radius * Math.sin(angle) + const yPos = y - radius * Math.cos(angle) + + d += (i === 0 ? 'M' : 'L') + xPos + ',' + yPos + } + d += 'Z' + break + case 'triangle': + d = `M ${x} ${y - size} + L ${x + size} ${y + size} + L ${x - size} ${y + size} + Z` + break + case 'square': + case 'rect': + size = size / 1.125 + d = `M ${x - size} ${y - size} + L ${x + size} ${y - size} + L ${x + size} ${y + size} + L ${x - size} ${y + size} + Z` + break + case 'diamond': + size = size * 1.05 + d = `M ${x} ${y - size} + L ${x + size} ${y} + L ${x} ${y + size} + L ${x - size} ${y} + Z` + break + case 'line': + size = size / 1.1 + d = `M ${x - size} ${y} + L ${x + size} ${y}` + break + case 'circle': + default: + size = size * 2 + d = `M ${x}, ${y} + m -${size / 2}, 0 + a ${size / 2},${size / 2} 0 1,0 ${size},0 + a ${size / 2},${size / 2} 0 1,0 -${size},0` + break + } + return d + } + + /** + * @param {number} x - The x-coordinate of the marker + * @param {number} y - The y-coordinate of the marker. + * @param {number} size - The size of the marker + * @param {Object} opts - The options for the marker. + * @returns {Object} The created marker. + */ + drawMarkerShape(x, y, type, size, opts) { + const path = this.drawPath({ + d: this.getMarkerPath(x, y, type, size, opts), + stroke: opts.pointStrokeColor, + strokeDashArray: opts.pointStrokeDashArray, + strokeWidth: opts.pointStrokeWidth, + fill: opts.pointFillColor, + fillOpacity: opts.pointFillOpacity, + strokeOpacity: opts.pointStrokeOpacity, + }) + + path.attr({ + cx: x, + cy: y, + shape: opts.shape, + class: opts.class ? opts.class : '', + }) + + return path + } + + drawMarker(x, y, opts) { + x = x || 0 + let size = opts.pSize || 0 + + if (!Utils.isNumber(y)) { + size = 0 + y = 0 + } + + return this.drawMarkerShape(x, y, opts?.shape, size, { + ...opts, + ...(opts.shape === 'line' || + opts.shape === 'plus' || + opts.shape === 'cross' + ? { + pointStrokeColor: opts.pointFillColor, + pointStrokeOpacity: opts.pointFillOpacity, + } + : {}), + }) + } + + pathMouseEnter(path, e) { + let w = this.w + const filters = new Filters(this.ctx) + + const i = parseInt(path.node.getAttribute('index'), 10) + const j = parseInt(path.node.getAttribute('j'), 10) + + if (typeof w.config.chart.events.dataPointMouseEnter === 'function') { + w.config.chart.events.dataPointMouseEnter(e, this.ctx, { + seriesIndex: i, + dataPointIndex: j, + w, + }) + } + this.ctx.events.fireEvent('dataPointMouseEnter', [ + e, + this.ctx, + { seriesIndex: i, dataPointIndex: j, w }, + ]) + + if (w.config.states.active.filter.type !== 'none') { + if (path.node.getAttribute('selected') === 'true') { + return + } + } + + if (w.config.states.hover.filter.type !== 'none') { + if (!w.globals.isTouchDevice) { + let hoverFilter = w.config.states.hover.filter + filters.applyFilter(path, i, hoverFilter.type) + } + } + } + + pathMouseLeave(path, e) { + let w = this.w + const filters = new Filters(this.ctx) + + const i = parseInt(path.node.getAttribute('index'), 10) + const j = parseInt(path.node.getAttribute('j'), 10) + + if (typeof w.config.chart.events.dataPointMouseLeave === 'function') { + w.config.chart.events.dataPointMouseLeave(e, this.ctx, { + seriesIndex: i, + dataPointIndex: j, + w, + }) + } + this.ctx.events.fireEvent('dataPointMouseLeave', [ + e, + this.ctx, + { seriesIndex: i, dataPointIndex: j, w }, + ]) + + if (w.config.states.active.filter.type !== 'none') { + if (path.node.getAttribute('selected') === 'true') { + return + } + } + + if (w.config.states.hover.filter.type !== 'none') { + filters.getDefaultFilter(path, i) + } + } + + pathMouseDown(path, e) { + let w = this.w + const filters = new Filters(this.ctx) + + const i = parseInt(path.node.getAttribute('index'), 10) + const j = parseInt(path.node.getAttribute('j'), 10) + + let selected = 'false' + if (path.node.getAttribute('selected') === 'true') { + path.node.setAttribute('selected', 'false') + + if (w.globals.selectedDataPoints[i].indexOf(j) > -1) { + let index = w.globals.selectedDataPoints[i].indexOf(j) + w.globals.selectedDataPoints[i].splice(index, 1) + } + } else { + if ( + !w.config.states.active.allowMultipleDataPointsSelection && + w.globals.selectedDataPoints.length > 0 + ) { + w.globals.selectedDataPoints = [] + const elPaths = w.globals.dom.Paper.find( + '.apexcharts-series path:not(.apexcharts-decoration-element)' + ) + const elCircles = w.globals.dom.Paper.find( + '.apexcharts-series circle:not(.apexcharts-decoration-element), .apexcharts-series rect:not(.apexcharts-decoration-element)' + ) + + const deSelect = (els) => { + Array.prototype.forEach.call(els, (el) => { + el.node.setAttribute('selected', 'false') + filters.getDefaultFilter(el, i) + }) + } + deSelect(elPaths) + deSelect(elCircles) + } + + path.node.setAttribute('selected', 'true') + selected = 'true' + + if (typeof w.globals.selectedDataPoints[i] === 'undefined') { + w.globals.selectedDataPoints[i] = [] + } + w.globals.selectedDataPoints[i].push(j) + } + + if (selected === 'true') { + let activeFilter = w.config.states.active.filter + if (activeFilter !== 'none') { + filters.applyFilter(path, i, activeFilter.type) + } else { + // Reapply the hover filter in case it was removed by `deselect`when there is no active filter and it is not a touch device + if (w.config.states.hover.filter !== 'none') { + if (!w.globals.isTouchDevice) { + var hoverFilter = w.config.states.hover.filter + filters.applyFilter(path, i, hoverFilter.type) + } + } + } + } else { + // If the item was deselected, apply hover state filter if it is not a touch device + if (w.config.states.active.filter.type !== 'none') { + if ( + w.config.states.hover.filter.type !== 'none' && + !w.globals.isTouchDevice + ) { + var hoverFilter = w.config.states.hover.filter + filters.applyFilter(path, i, hoverFilter.type) + } else { + filters.getDefaultFilter(path, i) + } + } + } + + if (typeof w.config.chart.events.dataPointSelection === 'function') { + w.config.chart.events.dataPointSelection(e, this.ctx, { + selectedDataPoints: w.globals.selectedDataPoints, + seriesIndex: i, + dataPointIndex: j, + w, + }) + } + + if (e) { + this.ctx.events.fireEvent('dataPointSelection', [ + e, + this.ctx, + { + selectedDataPoints: w.globals.selectedDataPoints, + seriesIndex: i, + dataPointIndex: j, + w, + }, + ]) + } + } + + rotateAroundCenter(el) { + let coord = {} + if (el && typeof el.getBBox === 'function') { + coord = el.getBBox() + } + let x = coord.x + coord.width / 2 + let y = coord.y + coord.height / 2 + + return { + x, + y, + } + } + + static setAttrs(el, attrs) { + for (let key in attrs) { + if (attrs.hasOwnProperty(key)) { + el.setAttribute(key, attrs[key]) + } + } + } + + getTextRects(text, fontSize, fontFamily, transform, useBBox = true) { + let w = this.w + let virtualText = this.drawText({ + x: -200, + y: -200, + text, + textAnchor: 'start', + fontSize, + fontFamily, + foreColor: '#fff', + opacity: 0, + }) + + if (transform) { + virtualText.attr('transform', transform) + } + w.globals.dom.Paper.add(virtualText) + + let rect = virtualText.bbox() + if (!useBBox) { + rect = virtualText.node.getBoundingClientRect() + } + + virtualText.remove() + + return { + width: rect.width, + height: rect.height, + } + } + + /** + * append ... to long text + * http://stackoverflow.com/questions/9241315/trimming-text-to-a-given-pixel-width-in-svg + * @memberof Graphics + **/ + placeTextWithEllipsis(textObj, textString, width) { + if (typeof textObj.getComputedTextLength !== 'function') return + textObj.textContent = textString + if (textString.length > 0) { + // ellipsis is needed + if (textObj.getComputedTextLength() >= width / 1.1) { + for (let x = textString.length - 3; x > 0; x -= 3) { + if (textObj.getSubStringLength(0, x) <= width / 1.1) { + textObj.textContent = textString.substring(0, x) + '...' + return + } + } + textObj.textContent = '.' // can't place at all + } + } + } +} + +export default Graphics diff --git a/node_modules/apexcharts/src/modules/Markers.js b/node_modules/apexcharts/src/modules/Markers.js new file mode 100644 index 0000000..9aa31eb --- /dev/null +++ b/node_modules/apexcharts/src/modules/Markers.js @@ -0,0 +1,277 @@ +import Filters from './Filters' +import Graphics from './Graphics' +import Utils from '../utils/Utils' + +/** + * ApexCharts Markers Class for drawing markers on y values in axes charts. + * + * @module Markers + **/ + +export default class Markers { + constructor(ctx, opts) { + this.ctx = ctx + this.w = ctx.w + } + + setGlobalMarkerSize() { + const w = this.w + + w.globals.markers.size = Array.isArray(w.config.markers.size) + ? w.config.markers.size + : [w.config.markers.size] + + if (w.globals.markers.size.length > 0) { + if (w.globals.markers.size.length < w.globals.series.length + 1) { + for (let i = 0; i <= w.globals.series.length; i++) { + if (typeof w.globals.markers.size[i] === 'undefined') { + w.globals.markers.size.push(w.globals.markers.size[0]) + } + } + } + } else { + w.globals.markers.size = w.config.series.map((s) => w.config.markers.size) + } + } + + plotChartMarkers({ + pointsPos, + seriesIndex, + j, + pSize, + alwaysDrawMarker = false, + isVirtualPoint = false, + }) { + let w = this.w + + let i = seriesIndex + let p = pointsPos + let elMarkersWrap = null + + let graphics = new Graphics(this.ctx) + + const hasDiscreteMarkers = + w.config.markers.discrete && w.config.markers.discrete.length + + if (Array.isArray(p.x)) { + for (let q = 0; q < p.x.length; q++) { + let markerElement + + let dataPointIndex = j + let invalidMarker = !Utils.isNumber(p.y[q]) + + if ( + w.globals.markers.largestSize === 0 && + w.globals.hasNullValues && + w.globals.series[i][j + 1] !== null && + !isVirtualPoint + ) { + invalidMarker = true + } + + // a small hack as we have 2 points for the first val to connect it + if (j === 1 && q === 0) dataPointIndex = 0 + if (j === 1 && q === 1) dataPointIndex = 1 + + let markerClasses = 'apexcharts-marker' + if ( + (w.config.chart.type === 'line' || w.config.chart.type === 'area') && + !w.globals.comboCharts && + !w.config.tooltip.intersect + ) { + markerClasses += ' no-pointer-events' + } + + const shouldMarkerDraw = Array.isArray(w.config.markers.size) + ? w.globals.markers.size[seriesIndex] > 0 + : w.config.markers.size > 0 + + if (shouldMarkerDraw || alwaysDrawMarker || hasDiscreteMarkers) { + if (!invalidMarker) { + markerClasses += ` w${Utils.randomId()}` + } + + let opts = this.getMarkerConfig({ + cssClass: markerClasses, + seriesIndex, + dataPointIndex, + }) + + if (w.config.series[i].data[dataPointIndex]) { + if (w.config.series[i].data[dataPointIndex].fillColor) { + opts.pointFillColor = + w.config.series[i].data[dataPointIndex].fillColor + } + + if (w.config.series[i].data[dataPointIndex].strokeColor) { + opts.pointStrokeColor = + w.config.series[i].data[dataPointIndex].strokeColor + } + } + + if (typeof pSize !== 'undefined') { + opts.pSize = pSize + } + + if ( + p.x[q] < -w.globals.markers.largestSize || + p.x[q] > w.globals.gridWidth + w.globals.markers.largestSize || + p.y[q] < -w.globals.markers.largestSize || + p.y[q] > w.globals.gridHeight + w.globals.markers.largestSize + ) { + opts.pSize = 0 + } + + if (!invalidMarker) { + const shouldCreateMarkerWrap = + w.globals.markers.size[seriesIndex] > 0 || + alwaysDrawMarker || + hasDiscreteMarkers + if (shouldCreateMarkerWrap && !elMarkersWrap) { + elMarkersWrap = graphics.group({ + class: + alwaysDrawMarker || hasDiscreteMarkers + ? '' + : 'apexcharts-series-markers', + }) + elMarkersWrap.attr( + 'clip-path', + `url(#gridRectMarkerMask${w.globals.cuid})` + ) + } + markerElement = graphics.drawMarker(p.x[q], p.y[q], opts) + + markerElement.attr('rel', dataPointIndex) + markerElement.attr('j', dataPointIndex) + markerElement.attr('index', seriesIndex) + markerElement.node.setAttribute('default-marker-size', opts.pSize) + + const filters = new Filters(this.ctx) + filters.setSelectionFilter( + markerElement, + seriesIndex, + dataPointIndex + ) + this.addEvents(markerElement) + + if (elMarkersWrap) { + elMarkersWrap.add(markerElement) + } + } + } else { + // dynamic array creation - multidimensional + if (typeof w.globals.pointsArray[seriesIndex] === 'undefined') + w.globals.pointsArray[seriesIndex] = [] + + w.globals.pointsArray[seriesIndex].push([p.x[q], p.y[q]]) + } + } + } + + return elMarkersWrap + } + + getMarkerConfig({ + cssClass, + seriesIndex, + dataPointIndex = null, + radius = null, + size = null, + strokeWidth = null, + }) { + const w = this.w + let pStyle = this.getMarkerStyle(seriesIndex) + let pSize = size === null ? w.globals.markers.size[seriesIndex] : size + + const m = w.config.markers + + // discrete markers is an option where user can specify a particular marker with different shape, size and color + + if (dataPointIndex !== null && m.discrete.length) { + m.discrete.map((marker) => { + if ( + marker.seriesIndex === seriesIndex && + marker.dataPointIndex === dataPointIndex + ) { + pStyle.pointStrokeColor = marker.strokeColor + pStyle.pointFillColor = marker.fillColor + pSize = marker.size + pStyle.pointShape = marker.shape + } + }) + } + + return { + pSize: radius === null ? pSize : radius, + pRadius: radius !== null ? radius : m.radius, + pointStrokeWidth: + strokeWidth !== null + ? strokeWidth + : Array.isArray(m.strokeWidth) + ? m.strokeWidth[seriesIndex] + : m.strokeWidth, + pointStrokeColor: pStyle.pointStrokeColor, + pointFillColor: pStyle.pointFillColor, + shape: + pStyle.pointShape || + (Array.isArray(m.shape) ? m.shape[seriesIndex] : m.shape), + class: cssClass, + pointStrokeOpacity: Array.isArray(m.strokeOpacity) + ? m.strokeOpacity[seriesIndex] + : m.strokeOpacity, + pointStrokeDashArray: Array.isArray(m.strokeDashArray) + ? m.strokeDashArray[seriesIndex] + : m.strokeDashArray, + pointFillOpacity: Array.isArray(m.fillOpacity) + ? m.fillOpacity[seriesIndex] + : m.fillOpacity, + seriesIndex, + } + } + + addEvents(marker) { + const w = this.w + + const graphics = new Graphics(this.ctx) + marker.node.addEventListener( + 'mouseenter', + graphics.pathMouseEnter.bind(this.ctx, marker) + ) + marker.node.addEventListener( + 'mouseleave', + graphics.pathMouseLeave.bind(this.ctx, marker) + ) + + marker.node.addEventListener( + 'mousedown', + graphics.pathMouseDown.bind(this.ctx, marker) + ) + + marker.node.addEventListener('click', w.config.markers.onClick) + marker.node.addEventListener('dblclick', w.config.markers.onDblClick) + + marker.node.addEventListener( + 'touchstart', + graphics.pathMouseDown.bind(this.ctx, marker), + { passive: true } + ) + } + + getMarkerStyle(seriesIndex) { + let w = this.w + + let colors = w.globals.markers.colors + let strokeColors = + w.config.markers.strokeColor || w.config.markers.strokeColors + + let pointStrokeColor = Array.isArray(strokeColors) + ? strokeColors[seriesIndex] + : strokeColors + let pointFillColor = Array.isArray(colors) ? colors[seriesIndex] : colors + + return { + pointStrokeColor, + pointFillColor, + } + } +} diff --git a/node_modules/apexcharts/src/modules/Range.js b/node_modules/apexcharts/src/modules/Range.js new file mode 100644 index 0000000..3afd7a2 --- /dev/null +++ b/node_modules/apexcharts/src/modules/Range.js @@ -0,0 +1,661 @@ +import Utils from '../utils/Utils' +import DateTime from '../utils/DateTime' +import Scales from './Scales' + +/** + * Range is used to generates values between min and max. + * + * @module Range + **/ + +class Range { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + + this.scales = new Scales(ctx) + } + + init() { + this.setYRange() + this.setXRange() + this.setZRange() + } + + getMinYMaxY( + startingSeriesIndex, + lowestY = Number.MAX_VALUE, + highestY = -Number.MAX_VALUE, + endingSeriesIndex = null + ) { + const cnf = this.w.config + const gl = this.w.globals + let maxY = -Number.MAX_VALUE + let minY = Number.MIN_VALUE + + if (endingSeriesIndex === null) { + endingSeriesIndex = startingSeriesIndex + 1 + } + let series = gl.series + let seriesMin = series + let seriesMax = series + + if (cnf.chart.type === 'candlestick') { + seriesMin = gl.seriesCandleL + seriesMax = gl.seriesCandleH + } else if (cnf.chart.type === 'boxPlot') { + seriesMin = gl.seriesCandleO + seriesMax = gl.seriesCandleC + } else if (gl.isRangeData) { + seriesMin = gl.seriesRangeStart + seriesMax = gl.seriesRangeEnd + } + let autoScaleYaxis = false + if (gl.seriesX.length >= endingSeriesIndex) { + // Eventually brushSource will be set if the current chart is a target. + // That is, after the appropriate event causes us to update. + let brush = gl.brushSource?.w.config.chart.brush + if ( + (cnf.chart.zoom.enabled && cnf.chart.zoom.autoScaleYaxis) || + (brush?.enabled && brush?.autoScaleYaxis) + ) { + autoScaleYaxis = true + } + } + + for (let i = startingSeriesIndex; i < endingSeriesIndex; i++) { + gl.dataPoints = Math.max(gl.dataPoints, series[i].length) + + const seriesType = cnf.series[i].type + + if (gl.categoryLabels.length) { + gl.dataPoints = gl.categoryLabels.filter( + (label) => typeof label !== 'undefined' + ).length + } + + if ( + gl.labels.length && + cnf.xaxis.type !== 'datetime' && + gl.series.reduce((a, c) => a + c.length, 0) !== 0 + ) { + // the condition cnf.xaxis.type !== 'datetime' fixes #3897 and #3905 + gl.dataPoints = Math.max(gl.dataPoints, gl.labels.length) + } + let firstXIndex = 0 + let lastXIndex = series[i].length - 1 + if (autoScaleYaxis) { + // Scale the Y axis to the min..max within the possibly zoomed X axis domain. + if (cnf.xaxis.min) { + for ( + ; + firstXIndex < lastXIndex && + gl.seriesX[i][firstXIndex] < cnf.xaxis.min; + firstXIndex++ + ) {} + } + if (cnf.xaxis.max) { + for ( + ; + lastXIndex > firstXIndex && + gl.seriesX[i][lastXIndex] > cnf.xaxis.max; + lastXIndex-- + ) {} + } + } + for ( + let j = firstXIndex; + j <= lastXIndex && j < gl.series[i].length; + j++ + ) { + let val = series[i][j] + if (val !== null && Utils.isNumber(val)) { + if (typeof seriesMax[i][j] !== 'undefined') { + maxY = Math.max(maxY, seriesMax[i][j]) + lowestY = Math.min(lowestY, seriesMax[i][j]) + } + if (typeof seriesMin[i][j] !== 'undefined') { + lowestY = Math.min(lowestY, seriesMin[i][j]) + highestY = Math.max(highestY, seriesMin[i][j]) + } + + // These series arrays are dual purpose: + // Array : CandleO, CandleH, CandleM, CandleL, CandleC + // Candlestick: O H L C + // Boxplot : Min Q1 Median Q3 Max + switch (seriesType) { + case 'candlestick': + { + if (typeof gl.seriesCandleC[i][j] !== 'undefined') { + maxY = Math.max(maxY, gl.seriesCandleH[i][j]) + lowestY = Math.min(lowestY, gl.seriesCandleL[i][j]) + } + } + break + case 'boxPlot': + { + if (typeof gl.seriesCandleC[i][j] !== 'undefined') { + maxY = Math.max(maxY, gl.seriesCandleC[i][j]) + lowestY = Math.min(lowestY, gl.seriesCandleO[i][j]) + } + } + break + } + + // there is a combo chart and the specified series in not either + // candlestick, boxplot, or rangeArea/rangeBar; find the max there. + if ( + seriesType && + seriesType !== 'candlestick' && + seriesType !== 'boxPlot' && + seriesType !== 'rangeArea' && + seriesType !== 'rangeBar' + ) { + maxY = Math.max(maxY, gl.series[i][j]) + lowestY = Math.min(lowestY, gl.series[i][j]) + } + + if ( + gl.seriesGoals[i] && + gl.seriesGoals[i][j] && + Array.isArray(gl.seriesGoals[i][j]) + ) { + gl.seriesGoals[i][j].forEach((g) => { + maxY = Math.max(maxY, g.value) + lowestY = Math.min(lowestY, g.value) + }) + } + highestY = maxY + + val = Utils.noExponents(val) + if (Utils.isFloat(val)) { + gl.yValueDecimal = Math.max( + gl.yValueDecimal, + val.toString().split('.')[1].length + ) + } + if (minY > seriesMin[i][j] && seriesMin[i][j] < 0) { + minY = seriesMin[i][j] + } + } else { + gl.hasNullValues = true + } + } + if (seriesType === 'bar' || seriesType === 'column') { + if (minY < 0 && maxY < 0) { + // all negative values in a bar series, hence make the max to 0 + maxY = 0 + highestY = Math.max(highestY, 0) + } + if (minY === Number.MIN_VALUE) { + minY = 0 + lowestY = Math.min(lowestY, 0) + } + } + } + + if ( + cnf.chart.type === 'rangeBar' && + gl.seriesRangeStart.length && + gl.isBarHorizontal + ) { + minY = lowestY + } + + if (cnf.chart.type === 'bar') { + if (minY < 0 && maxY < 0) { + // all negative values in a bar chart, hence make the max to 0 + maxY = 0 + } + if (minY === Number.MIN_VALUE) { + minY = 0 + } + } + + return { + minY, + maxY, + lowestY, + highestY, + } + } + + setYRange() { + let gl = this.w.globals + let cnf = this.w.config + gl.maxY = -Number.MAX_VALUE + gl.minY = Number.MIN_VALUE + + let lowestYInAllSeries = Number.MAX_VALUE + let minYMaxY + + if (gl.isMultipleYAxis) { + // we need to get minY and maxY for multiple y axis + lowestYInAllSeries = Number.MAX_VALUE + for (let i = 0; i < gl.series.length; i++) { + minYMaxY = this.getMinYMaxY(i) + gl.minYArr[i] = minYMaxY.lowestY + gl.maxYArr[i] = minYMaxY.highestY + lowestYInAllSeries = Math.min(lowestYInAllSeries, minYMaxY.lowestY) + } + } + + // and then, get the minY and maxY from all series + minYMaxY = this.getMinYMaxY(0, lowestYInAllSeries, null, gl.series.length) + if (cnf.chart.type === 'bar') { + gl.minY = minYMaxY.minY + gl.maxY = minYMaxY.maxY + } else { + gl.minY = minYMaxY.lowestY + gl.maxY = minYMaxY.highestY + } + lowestYInAllSeries = minYMaxY.lowestY + + if (cnf.chart.stacked) { + this._setStackedMinMax() + } + + // if the numbers are too big, reduce the range + // for eg, if number is between 100000-110000, putting 0 as the lowest + // value is not so good idea. So change the gl.minY for + // line/area/scatter/candlesticks/boxPlot/vertical rangebar + if ( + cnf.chart.type === 'line' || + cnf.chart.type === 'area' || + cnf.chart.type === 'scatter' || + cnf.chart.type === 'candlestick' || + cnf.chart.type === 'boxPlot' || + (cnf.chart.type === 'rangeBar' && !gl.isBarHorizontal) + ) { + if ( + gl.minY === Number.MIN_VALUE && + lowestYInAllSeries !== -Number.MAX_VALUE && + lowestYInAllSeries !== gl.maxY // single value possibility + ) { + gl.minY = lowestYInAllSeries + } + } else { + gl.minY = + gl.minY !== Number.MIN_VALUE + ? Math.min(minYMaxY.minY, gl.minY) + : minYMaxY.minY + } + + cnf.yaxis.forEach((yaxe, index) => { + // override all min/max values by user defined values (y axis) + if (yaxe.max !== undefined) { + if (typeof yaxe.max === 'number') { + gl.maxYArr[index] = yaxe.max + } else if (typeof yaxe.max === 'function') { + // fixes apexcharts.js/issues/2098 + gl.maxYArr[index] = yaxe.max( + gl.isMultipleYAxis ? gl.maxYArr[index] : gl.maxY + ) + } + + // gl.maxY is for single y-axis chart, it will be ignored in multi-yaxis + gl.maxY = gl.maxYArr[index] + } + if (yaxe.min !== undefined) { + if (typeof yaxe.min === 'number') { + gl.minYArr[index] = yaxe.min + } else if (typeof yaxe.min === 'function') { + // fixes apexcharts.js/issues/2098 + gl.minYArr[index] = yaxe.min( + gl.isMultipleYAxis + ? gl.minYArr[index] === Number.MIN_VALUE + ? 0 + : gl.minYArr[index] + : gl.minY + ) + } + // gl.minY is for single y-axis chart, it will be ignored in multi-yaxis + gl.minY = gl.minYArr[index] + } + }) + + // for horizontal bar charts, we need to check xaxis min/max as user may have specified there + if (gl.isBarHorizontal) { + const minmax = ['min', 'max'] + minmax.forEach((m) => { + if (cnf.xaxis[m] !== undefined && typeof cnf.xaxis[m] === 'number') { + m === 'min' ? (gl.minY = cnf.xaxis[m]) : (gl.maxY = cnf.xaxis[m]) + } + }) + } + + if (gl.isMultipleYAxis) { + this.scales.scaleMultipleYAxes() + gl.minY = lowestYInAllSeries + } else { + this.scales.setYScaleForIndex(0, gl.minY, gl.maxY) + gl.minY = gl.yAxisScale[0].niceMin + gl.maxY = gl.yAxisScale[0].niceMax + gl.minYArr[0] = gl.minY + gl.maxYArr[0] = gl.maxY + } + + gl.barGroups = [] + gl.lineGroups = [] + gl.areaGroups = [] + cnf.series.forEach((s) => { + let type = s.type || cnf.chart.type + switch (type) { + case 'bar': + case 'column': + gl.barGroups.push(s.group) + break + case 'line': + gl.lineGroups.push(s.group) + break + case 'area': + gl.areaGroups.push(s.group) + break + } + }) + // Uniquify the group names in each stackable chart type. + gl.barGroups = gl.barGroups.filter((v, i, a) => a.indexOf(v) === i) + gl.lineGroups = gl.lineGroups.filter((v, i, a) => a.indexOf(v) === i) + gl.areaGroups = gl.areaGroups.filter((v, i, a) => a.indexOf(v) === i) + + return { + minY: gl.minY, + maxY: gl.maxY, + minYArr: gl.minYArr, + maxYArr: gl.maxYArr, + yAxisScale: gl.yAxisScale, + } + } + + setXRange() { + let gl = this.w.globals + let cnf = this.w.config + + const isXNumeric = + cnf.xaxis.type === 'numeric' || + cnf.xaxis.type === 'datetime' || + (cnf.xaxis.type === 'category' && !gl.noLabelsProvided) || + gl.noLabelsProvided || + gl.isXNumeric + + const getInitialMinXMaxX = () => { + for (let i = 0; i < gl.series.length; i++) { + if (gl.labels[i]) { + for (let j = 0; j < gl.labels[i].length; j++) { + if (gl.labels[i][j] !== null && Utils.isNumber(gl.labels[i][j])) { + gl.maxX = Math.max(gl.maxX, gl.labels[i][j]) + gl.initialMaxX = Math.max(gl.maxX, gl.labels[i][j]) + gl.minX = Math.min(gl.minX, gl.labels[i][j]) + gl.initialMinX = Math.min(gl.minX, gl.labels[i][j]) + } + } + } + } + } + // minX maxX starts here + if (gl.isXNumeric) { + getInitialMinXMaxX() + } + + if (gl.noLabelsProvided) { + if (cnf.xaxis.categories.length === 0) { + gl.maxX = gl.labels[gl.labels.length - 1] + gl.initialMaxX = gl.labels[gl.labels.length - 1] + gl.minX = 1 + gl.initialMinX = 1 + } + } + + if (gl.isXNumeric || gl.noLabelsProvided || gl.dataFormatXNumeric) { + let ticks = 10 + + if (cnf.xaxis.tickAmount === undefined) { + ticks = Math.round(gl.svgWidth / 150) + + // no labels provided and total number of dataPoints is less than 30 + if (cnf.xaxis.type === 'numeric' && gl.dataPoints < 30) { + ticks = gl.dataPoints - 1 + } + + // this check is for when ticks exceeds total datapoints and that would result in duplicate labels + if (ticks > gl.dataPoints && gl.dataPoints !== 0) { + ticks = gl.dataPoints - 1 + } + } else if (cnf.xaxis.tickAmount === 'dataPoints') { + if (gl.series.length > 1) { + ticks = gl.series[gl.maxValsInArrayIndex].length - 1 + } + if (gl.isXNumeric) { + const diff = Math.round(gl.maxX - gl.minX) + if (diff < 30) { + ticks = diff - 1 + } + } + } else { + ticks = cnf.xaxis.tickAmount + } + gl.xTickAmount = ticks + + // override all min/max values by user defined values (x axis) + if (cnf.xaxis.max !== undefined && typeof cnf.xaxis.max === 'number') { + gl.maxX = cnf.xaxis.max + } + if (cnf.xaxis.min !== undefined && typeof cnf.xaxis.min === 'number') { + gl.minX = cnf.xaxis.min + } + + // if range is provided, adjust the new minX + if (cnf.xaxis.range !== undefined) { + gl.minX = gl.maxX - cnf.xaxis.range + } + + if (gl.minX !== Number.MAX_VALUE && gl.maxX !== -Number.MAX_VALUE) { + if (cnf.xaxis.convertedCatToNumeric && !gl.dataFormatXNumeric) { + let catScale = [] + for (let i = gl.minX - 1; i < gl.maxX; i++) { + catScale.push(i + 1) + } + gl.xAxisScale = { + result: catScale, + niceMin: catScale[0], + niceMax: catScale[catScale.length - 1], + } + } else { + gl.xAxisScale = this.scales.setXScale(gl.minX, gl.maxX) + } + } else { + gl.xAxisScale = this.scales.linearScale( + 0, + ticks, + ticks, + 0, + cnf.xaxis.stepSize + ) + if (gl.noLabelsProvided && gl.labels.length > 0) { + gl.xAxisScale = this.scales.linearScale( + 1, + gl.labels.length, + ticks - 1, + 0, + cnf.xaxis.stepSize + ) + + // this is the only place seriesX is again mutated + gl.seriesX = gl.labels.slice() + } + } + // we will still store these labels as the count for this will be different (to draw grid and labels placement) + if (isXNumeric) { + gl.labels = gl.xAxisScale.result.slice() + } + } + + if (gl.isBarHorizontal && gl.labels.length) { + gl.xTickAmount = gl.labels.length + } + + // single dataPoint + this._handleSingleDataPoint() + + // minimum x difference to calculate bar width in numeric bars + this._getMinXDiff() + + return { + minX: gl.minX, + maxX: gl.maxX, + } + } + + setZRange() { + // minZ, maxZ starts here + let gl = this.w.globals + + if (!gl.isDataXYZ) return + for (let i = 0; i < gl.series.length; i++) { + if (typeof gl.seriesZ[i] !== 'undefined') { + for (let j = 0; j < gl.seriesZ[i].length; j++) { + if (gl.seriesZ[i][j] !== null && Utils.isNumber(gl.seriesZ[i][j])) { + gl.maxZ = Math.max(gl.maxZ, gl.seriesZ[i][j]) + gl.minZ = Math.min(gl.minZ, gl.seriesZ[i][j]) + } + } + } + } + } + + _handleSingleDataPoint() { + const gl = this.w.globals + const cnf = this.w.config + + if (gl.minX === gl.maxX) { + let datetimeObj = new DateTime(this.ctx) + + if (cnf.xaxis.type === 'datetime') { + const newMinX = datetimeObj.getDate(gl.minX) + if (cnf.xaxis.labels.datetimeUTC) { + newMinX.setUTCDate(newMinX.getUTCDate() - 2) + } else { + newMinX.setDate(newMinX.getDate() - 2) + } + + gl.minX = new Date(newMinX).getTime() + + const newMaxX = datetimeObj.getDate(gl.maxX) + if (cnf.xaxis.labels.datetimeUTC) { + newMaxX.setUTCDate(newMaxX.getUTCDate() + 2) + } else { + newMaxX.setDate(newMaxX.getDate() + 2) + } + gl.maxX = new Date(newMaxX).getTime() + } else if ( + cnf.xaxis.type === 'numeric' || + (cnf.xaxis.type === 'category' && !gl.noLabelsProvided) + ) { + gl.minX = gl.minX - 2 + gl.initialMinX = gl.minX + gl.maxX = gl.maxX + 2 + gl.initialMaxX = gl.maxX + } + } + } + + _getMinXDiff() { + const gl = this.w.globals + + if (gl.isXNumeric) { + // get the least x diff if numeric x axis is present + gl.seriesX.forEach((sX, i) => { + if (sX.length) { + if (sX.length === 1) { + // a small hack to prevent overlapping multiple bars when there is just 1 datapoint in bar series. + // fix #811 + sX.push( + gl.seriesX[gl.maxValsInArrayIndex][ + gl.seriesX[gl.maxValsInArrayIndex].length - 1 + ] + ) + } + + // fix #983 (clone the array to avoid side effects) + const seriesX = sX.slice() + seriesX.sort((a, b) => a - b) + + seriesX.forEach((s, j) => { + if (j > 0) { + let xDiff = s - seriesX[j - 1] + if (xDiff > 0) { + gl.minXDiff = Math.min(xDiff, gl.minXDiff) + } + } + }) + + if (gl.dataPoints === 1 || gl.minXDiff === Number.MAX_VALUE) { + // fixes apexcharts.js #1221 + gl.minXDiff = 0.5 + } + } + }) + } + } + + _setStackedMinMax() { + const gl = this.w.globals + // for stacked charts, we calculate each series's parallel values. + // i.e, series[0][j] + series[1][j] .... [series[i.length][j]] + // and get the max out of it + + if (!gl.series.length) return + let seriesGroups = gl.seriesGroups + + if (!seriesGroups.length) { + seriesGroups = [this.w.globals.seriesNames.map((name) => name)] + } + let stackedPoss = {} + let stackedNegs = {} + + seriesGroups.forEach((group) => { + stackedPoss[group] = [] + stackedNegs[group] = [] + const indicesOfSeriesInGroup = this.w.config.series + .map((serie, si) => + group.indexOf(gl.seriesNames[si]) > -1 ? si : null + ) + .filter((f) => f !== null) + + indicesOfSeriesInGroup.forEach((i) => { + for (let j = 0; j < gl.series[gl.maxValsInArrayIndex].length; j++) { + if (typeof stackedPoss[group][j] === 'undefined') { + stackedPoss[group][j] = 0 + stackedNegs[group][j] = 0 + } + + let stackSeries = + (this.w.config.chart.stacked && !gl.comboCharts) || + (this.w.config.chart.stacked && + gl.comboCharts && + (!this.w.config.chart.stackOnlyBar || + this.w.config.series?.[i]?.type === 'bar' || + this.w.config.series?.[i]?.type === 'column')) + + if (stackSeries) { + if (gl.series[i][j] !== null && Utils.isNumber(gl.series[i][j])) { + gl.series[i][j] > 0 + ? (stackedPoss[group][j] += + parseFloat(gl.series[i][j]) + 0.0001) + : (stackedNegs[group][j] += parseFloat(gl.series[i][j])) + } + } + } + }) + }) + + Object.entries(stackedPoss).forEach(([key]) => { + stackedPoss[key].forEach((_, stgi) => { + gl.maxY = Math.max(gl.maxY, stackedPoss[key][stgi]) + gl.minY = Math.min(gl.minY, stackedNegs[key][stgi]) + }) + }) + } +} + +export default Range diff --git a/node_modules/apexcharts/src/modules/Responsive.js b/node_modules/apexcharts/src/modules/Responsive.js new file mode 100644 index 0000000..5311f05 --- /dev/null +++ b/node_modules/apexcharts/src/modules/Responsive.js @@ -0,0 +1,78 @@ +import Config from './settings/Config' +import Utils from '../utils/Utils' +import CoreUtils from './CoreUtils' + +/** + * ApexCharts Responsive Class to override options for different screen sizes. + * + * @module Responsive + **/ + +export default class Responsive { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + } + + // the opts parameter if not null has to be set overriding everything + // as the opts is set by user externally + checkResponsiveConfig(opts) { + const w = this.w + const cnf = w.config + + // check if responsive config exists + if (cnf.responsive.length === 0) return + + let res = cnf.responsive.slice() + res + .sort((a, b) => + a.breakpoint > b.breakpoint ? 1 : b.breakpoint > a.breakpoint ? -1 : 0 + ) + .reverse() + + let config = new Config({}) + + const iterateResponsiveOptions = (newOptions = {}) => { + let largestBreakpoint = res[0].breakpoint + const width = window.innerWidth > 0 ? window.innerWidth : screen.width + + if (width > largestBreakpoint) { + let initialConfig = Utils.clone(w.globals.initialConfig) + // Retain state of series in case any have been collapsed + // (indicated by series.data === [], these series' will be zeroed later + // enabling stacking to work correctly) + initialConfig.series = Utils.clone(w.config.series) + let options = CoreUtils.extendArrayProps( + config, + initialConfig, + w + ) + newOptions = Utils.extend(options, newOptions) + newOptions = Utils.extend(w.config, newOptions) + this.overrideResponsiveOptions(newOptions) + } else { + for (let i = 0; i < res.length; i++) { + if (width < res[i].breakpoint) { + newOptions = CoreUtils.extendArrayProps(config, res[i].options, w) + newOptions = Utils.extend(w.config, newOptions) + this.overrideResponsiveOptions(newOptions) + } + } + } + } + + if (opts) { + let options = CoreUtils.extendArrayProps(config, opts, w) + options = Utils.extend(w.config, options) + options = Utils.extend(options, opts) + iterateResponsiveOptions(options) + } else { + iterateResponsiveOptions({}) + } + } + + overrideResponsiveOptions(newOptions) { + let newConfig = new Config(newOptions).init({ responsiveOverride: true }) + this.w.config = newConfig + } +} diff --git a/node_modules/apexcharts/src/modules/Scales.js b/node_modules/apexcharts/src/modules/Scales.js new file mode 100644 index 0000000..31e7dea --- /dev/null +++ b/node_modules/apexcharts/src/modules/Scales.js @@ -0,0 +1,751 @@ +import CoreUtils from './CoreUtils' +import Utils from '../utils/Utils' + +export default class Scales { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + this.coreUtils = new CoreUtils(this.ctx) + } + + // http://stackoverflow.com/questions/326679/choosing-an-attractive-linear-scale-for-a-graphs-y-axis + // This routine creates the Y axis values for a graph. + niceScale(yMin, yMax, index = 0) { + // Calculate Min amd Max graphical labels and graph + // increments. + // + // Output will be an array of the Y axis values that + // encompass the Y values. + const jsPrecision = 1e-11 // JS precision errors + const w = this.w + const gl = w.globals + let axisCnf + let maxTicks + let gotMin + let gotMax + if (gl.isBarHorizontal) { + axisCnf = w.config.xaxis + // The most ticks we can fit into the svg chart dimensions + maxTicks = Math.max((gl.svgWidth - 100) / 25, 2) // Guestimate + } else { + axisCnf = w.config.yaxis[index] + maxTicks = Math.max((gl.svgHeight - 100) / 15, 2) + } + if (!Utils.isNumber(maxTicks)) { + maxTicks = 10 + } + gotMin = axisCnf.min !== undefined && axisCnf.min !== null + gotMax = axisCnf.max !== undefined && axisCnf.min !== null + let gotStepSize = + axisCnf.stepSize !== undefined && axisCnf.stepSize !== null + let gotTickAmount = + axisCnf.tickAmount !== undefined && axisCnf.tickAmount !== null + let ticks = gotTickAmount + ? axisCnf.tickAmount + : gl.niceScaleDefaultTicks[ + Math.min( + Math.round(maxTicks / 2), + gl.niceScaleDefaultTicks.length - 1 + ) + ] + + // In case we have a multi axis chart: + // Ensure subsequent series start with the same tickAmount as series[0], + // because the tick lines are drawn based on series[0]. This does not + // override user defined options for any yaxis. + if (gl.isMultipleYAxis && !gotTickAmount && gl.multiAxisTickAmount > 0) { + ticks = gl.multiAxisTickAmount + gotTickAmount = true + } + + if (ticks === 'dataPoints') { + ticks = gl.dataPoints - 1 + } else { + // Ensure ticks is an integer + ticks = Math.abs(Math.round(ticks)) + } + + if ( + (yMin === Number.MIN_VALUE && yMax === 0) || + (!Utils.isNumber(yMin) && !Utils.isNumber(yMax)) || + (yMin === Number.MIN_VALUE && yMax === -Number.MAX_VALUE) + ) { + // when all values are 0 + yMin = Utils.isNumber(axisCnf.min) ? axisCnf.min : 0 + yMax = Utils.isNumber(axisCnf.max) ? axisCnf.max : yMin + ticks + gl.allSeriesCollapsed = false + } + + if (yMin > yMax) { + // if somehow due to some wrong config, user sent max less than min, + // adjust the min/max again + console.warn( + 'axis.min cannot be greater than axis.max: swapping min and max' + ) + let temp = yMax + yMax = yMin + yMin = temp + } else if (yMin === yMax) { + // If yMin and yMax are identical, then + // adjust the yMin and yMax values to actually + // make a graph. Also avoids division by zero errors. + yMin = yMin === 0 ? 0 : yMin - 1 // choose an integer in case yValueDecimals=0 + yMax = yMax === 0 ? 2 : yMax + 1 // choose an integer in case yValueDecimals=0 + } + + let result = [] + + if (ticks < 1) { + ticks = 1 + } + let tiks = ticks + + // Determine Range + let range = Math.abs(yMax - yMin) + + // Snap min or max to zero if close + let proximityRatio = 0.15 + if (!gotMin && yMin > 0 && yMin / range < proximityRatio) { + yMin = 0 + gotMin = true + } + if (!gotMax && yMax < 0 && -yMax / range < proximityRatio) { + yMax = 0 + gotMax = true + } + range = Math.abs(yMax - yMin) + + // Calculate a pretty step value based on ticks + + // Initial stepSize + let stepSize = range / tiks + let niceStep = stepSize + let mag = Math.floor(Math.log10(niceStep)) + let magPow = Math.pow(10, mag) + // ceil() is used below in conjunction with the values populating + // niceScaleAllowedMagMsd[][] to ensure that (niceStep * tiks) + // produces a range that doesn't clip data points after stretching + // the raw range out a little to match the prospective new range. + let magMsd = Math.ceil(niceStep / magPow) + // See globals.js for info on what niceScaleAllowedMagMsd does + magMsd = gl.niceScaleAllowedMagMsd[gl.yValueDecimal === 0 ? 0 : 1][magMsd] + niceStep = magMsd * magPow + + // Initial stepSize + stepSize = niceStep + + // Get step value + if (gl.isBarHorizontal && axisCnf.stepSize && axisCnf.type !== 'datetime') { + stepSize = axisCnf.stepSize + gotStepSize = true + } else if (gotStepSize) { + stepSize = axisCnf.stepSize + } + if (gotStepSize) { + if (axisCnf.forceNiceScale) { + // Check that given stepSize is sane with respect to the range. + // + // The user can, by setting forceNiceScale = true, + // define a stepSize that will be scaled to a useful value before + // it's checked for consistency. + // + // If, for example, the range = 4 and the user defined stepSize = 8 + // (or 8000 or 0.0008, etc), then stepSize is inapplicable as + // it is. Reducing it to 0.8 will fit with 5 ticks. + // + let stepMag = Math.floor(Math.log10(stepSize)) + stepSize *= Math.pow(10, mag - stepMag) + } + } + + // Start applying some rules + if (gotMin && gotMax) { + let crudeStep = range / tiks + // min and max (range) cannot be changed + if (gotTickAmount) { + if (gotStepSize) { + if (Utils.mod(range, stepSize) != 0) { + // stepSize conflicts with range + let gcdStep = Utils.getGCD(stepSize, crudeStep) + // gcdStep is a multiple of range because crudeStep is a multiple. + // gcdStep is also a multiple of stepSize, so it partially honoured + // All three could be equal, which would be very nice + // if the computed stepSize generates too many ticks they will be + // reduced later, unless the number is prime, in which case, + // the chart will display all of them or just one (plus the X axis) + // depending on svg dimensions. Setting forceNiceScale: true will force + // the display of at least the default number of ticks. + if (crudeStep / gcdStep < 10) { + stepSize = gcdStep + } else { + // stepSize conflicts and no reasonable adjustment, but must + // honour tickAmount + stepSize = crudeStep + } + } else { + // stepSize fits + if (Utils.mod(stepSize, crudeStep) == 0) { + // crudeStep is a multiple of stepSize, or vice versa + // but we know that crudeStep will generate tickAmount ticks + stepSize = crudeStep + } else { + // stepSize conflicts with tickAmount + // if the user is setting up a multi-axis chart and wants + // synced axis ticks then they should not define stepSize + // or ensure there is no conflict between any of their options + // on any axis. + crudeStep = stepSize + // De-prioritizing ticks from now on + gotTickAmount = false + } + } + } else { + // no user stepSize, honour tickAmount + stepSize = crudeStep + } + } else { + // default ticks in use, tiks can change + if (gotStepSize) { + if (Utils.mod(range, stepSize) == 0) { + // user stepSize fits + crudeStep = stepSize + } else { + stepSize = crudeStep + } + } else { + // no user stepSize + if (Utils.mod(range, stepSize) == 0) { + // generated nice stepSize fits + crudeStep = stepSize + } else { + tiks = Math.ceil(range / stepSize) + crudeStep = range / tiks + let gcdStep = Utils.getGCD(range, stepSize) + if (range / gcdStep < maxTicks) { + crudeStep = gcdStep + } + stepSize = crudeStep + } + } + } + tiks = Math.round(range / stepSize) + } else { + // Snap range to ticks + if (!gotMin && !gotMax) { + if (gl.isMultipleYAxis && gotTickAmount) { + // Ensure graph doesn't clip. + let tMin = stepSize * Math.floor(yMin / stepSize) + let tMax = tMin + stepSize * tiks + if (tMax < yMax) { + stepSize *= 2 + } + yMin = tMin + tMax = yMax + yMax = yMin + stepSize * tiks + // Snap min or max to zero if possible + range = Math.abs(yMax - yMin) + if (yMin > 0 && yMin < Math.abs(tMax - yMax)) { + yMin = 0 + yMax = stepSize * tiks + } + if (yMax < 0 && -yMax < Math.abs(tMin - yMin)) { + yMax = 0 + yMin = -stepSize * tiks + } + } else { + yMin = stepSize * Math.floor(yMin / stepSize) + yMax = stepSize * Math.ceil(yMax / stepSize) + } + } else if (gotMax) { + if (gotTickAmount) { + yMin = yMax - stepSize * tiks + } else { + let yMinPrev = yMin + yMin = stepSize * Math.floor(yMin / stepSize) + if ( + Math.abs(yMax - yMin) / Utils.getGCD(range, stepSize) > + maxTicks + ) { + // Use default ticks to compute yMin then shrinkwrap + yMin = yMax - stepSize * ticks + yMin += stepSize * Math.floor((yMinPrev - yMin) / stepSize) + } + } + } else if (gotMin) { + if (gotTickAmount) { + yMax = yMin + stepSize * tiks + } else { + let yMaxPrev = yMax + yMax = stepSize * Math.ceil(yMax / stepSize) + if ( + Math.abs(yMax - yMin) / Utils.getGCD(range, stepSize) > + maxTicks + ) { + // Use default ticks to compute yMin then shrinkwrap + yMax = yMin + stepSize * ticks + yMax += stepSize * Math.ceil((yMaxPrev - yMax) / stepSize) + } + } + } + range = Math.abs(yMax - yMin) + // Final check and possible adjustment of stepSize to prevent + // overriding the user's min or max choice. + stepSize = Utils.getGCD(range, stepSize) + tiks = Math.round(range / stepSize) + } + + // Shrinkwrap ticks to the range + if (!gotTickAmount && !(gotMin || gotMax)) { + tiks = Math.ceil((range - jsPrecision) / (stepSize + jsPrecision)) + // No user tickAmount, or min or max, we are free to adjust to avoid a + // prime number. This helps when reducing ticks for small svg dimensions. + if (tiks > 16 && Utils.getPrimeFactors(tiks).length < 2) { + tiks++ + } + } + + // Prune tiks down to range if series is all integers. Since tiks > range, + // range is very low (< 10 or so). Skip this step if gotTickAmount is true + // because either the user set tickAmount or the chart is multiscale and + // this axis is not determining the number of grid lines. + if ( + !gotTickAmount && + axisCnf.forceNiceScale && + gl.yValueDecimal === 0 && + tiks > range + ) { + tiks = range + stepSize = Math.round(range / tiks) + } + + if ( + tiks > maxTicks && + (!(gotTickAmount || gotStepSize) || axisCnf.forceNiceScale) + ) { + // Reduce the number of ticks nicely if chart svg dimensions shrink too far. + // The reduced tick set should always be a subset of the full set. + // + // This following products of prime factors method works as follows: + // We compute the prime factors of the full tick count (tiks), then all the + // possible products of those factors in order from smallest to biggest, + // until we find a product P such that: tiks/P < maxTicks. + // + // Example: + // Computing products of the prime factors of 30. + // + // tiks | pf | 1 2 3 4 5 6 <-- compute order + // -------------------------------------------------- + // 30 | 5 | 5 5 5 <-- Multiply all + // | 3 | 3 3 3 3 <-- primes in each + // | 2 | 2 2 2 <-- column = P + // -------------------------------------------------- + // 15 10 6 5 2 1 <-- tiks/P + // + // tiks = 30 has prime factors [2, 3, 5] + // The loop below computes the products [2,3,5,6,15,30]. + // The last product of P = 2*3*5 is skipped since 30/P = 1. + // This yields tiks/P = [15,10,6,5,2,1], checked in order until + // tiks/P < maxTicks. + // + // Pros: + // 1) The ticks in the reduced set are always members of the + // full set of ticks. + // Cons: + // 1) None: if tiks is prime, we get all or one, nothing between, so + // the worst case is to display all, which is the status quo. Really + // only a problem visually for larger tick numbers, say, > 7. + // + let pf = Utils.getPrimeFactors(tiks) + let last = pf.length - 1 + let tt = tiks + reduceLoop: for (var xFactors = 0; xFactors < last; xFactors++) { + for (var lowest = 0; lowest <= last - xFactors; lowest++) { + let stop = Math.min(lowest + xFactors, last) + let t = tt + let div = 1 + for (var next = lowest; next <= stop; next++) { + div *= pf[next] + } + t /= div + if (t < maxTicks) { + tt = t + break reduceLoop + } + } + } + if (tt === tiks) { + // Could not reduce ticks at all, go all in and display just the + // X axis and one tick. + stepSize = range + } else { + stepSize = range / tt + } + tiks = Math.round(range / stepSize) + } + + // Record final tiks for use by other series that call niceScale(). + // Note: some don't, like logarithmicScale(), etc. + if ( + gl.isMultipleYAxis && + gl.multiAxisTickAmount == 0 && + gl.ignoreYAxisIndexes.indexOf(index) < 0 + ) { + gl.multiAxisTickAmount = tiks + } + + // build Y label array. + + let val = yMin - stepSize + // Ensure we don't under/over shoot due to JS precision errors. + // This also fixes (amongst others): + // https://github.com/apexcharts/apexcharts.js/issues/430 + let err = stepSize * jsPrecision + do { + val += stepSize + result.push(Utils.stripNumber(val, 7)) + } while (yMax - val > err) + + return { + result, + niceMin: result[0], + niceMax: result[result.length - 1], + } + } + + linearScale(yMin, yMax, ticks = 10, index = 0, step = undefined) { + let range = Math.abs(yMax - yMin) + let result = [] + + if (yMin === yMax) { + result = [yMin] + + return { + result, + niceMin: result[0], + niceMax: result[result.length - 1], + } + } + + ticks = this._adjustTicksForSmallRange(ticks, index, range) + + if (ticks === 'dataPoints') { + ticks = this.w.globals.dataPoints - 1 + } + + if (!step) { + step = range / ticks + } + + step = Math.round((step + Number.EPSILON) * 100) / 100 + + if (ticks === Number.MAX_VALUE) { + ticks = 5 + step = 1 + } + + let v = yMin + + while (ticks >= 0) { + result.push(v) + v = Utils.preciseAddition(v, step) + ticks -= 1 + } + + return { + result, + niceMin: result[0], + niceMax: result[result.length - 1], + } + } + + logarithmicScaleNice(yMin, yMax, base) { + // Basic validation to avoid for loop starting at -inf. + if (yMax <= 0) yMax = Math.max(yMin, base) + if (yMin <= 0) yMin = Math.min(yMax, base) + + const logs = [] + + // Get powers of base for our max and min + const logMax = Math.ceil(Math.log(yMax) / Math.log(base) + 1) + const logMin = Math.floor(Math.log(yMin) / Math.log(base)) + + for (let i = logMin; i < logMax; i++) { + logs.push(Math.pow(base, i)) + } + + return { + result: logs, + niceMin: logs[0], + niceMax: logs[logs.length - 1], + } + } + + logarithmicScale(yMin, yMax, base) { + // Basic validation to avoid for loop starting at -inf. + if (yMax <= 0) yMax = Math.max(yMin, base) + if (yMin <= 0) yMin = Math.min(yMax, base) + + const logs = [] + + // Get the logarithmic range. + const logMax = Math.log(yMax) / Math.log(base) + const logMin = Math.log(yMin) / Math.log(base) + + // Get the exact logarithmic range. + // (This is the exact number of multiples of the base there are between yMin and yMax). + const logRange = logMax - logMin + + // Round the logarithmic range to get the number of ticks we will create. + // If the chosen min/max values are multiples of each other WRT the base, this will be neat. + // If the chosen min/max aren't, we will at least still provide USEFUL ticks. + const ticks = Math.round(logRange) + + // Get the logarithmic spacing between ticks. + const logTickSpacing = logRange / ticks + + // Create as many ticks as there is range in the logs. + for ( + let i = 0, logTick = logMin; + i < ticks; + i++, logTick += logTickSpacing + ) { + logs.push(Math.pow(base, logTick)) + } + + // Add a final tick at the yMax. + logs.push(Math.pow(base, logMax)) + + return { + result: logs, + niceMin: yMin, + niceMax: yMax, + } + } + + _adjustTicksForSmallRange(ticks, index, range) { + let newTicks = ticks + if ( + typeof index !== 'undefined' && + this.w.config.yaxis[index].labels.formatter && + this.w.config.yaxis[index].tickAmount === undefined + ) { + const formattedVal = Number( + this.w.config.yaxis[index].labels.formatter(1) + ) + if (Utils.isNumber(formattedVal) && this.w.globals.yValueDecimal === 0) { + newTicks = Math.ceil(range) + } + } + return newTicks < ticks ? newTicks : ticks + } + + setYScaleForIndex(index, minY, maxY) { + const gl = this.w.globals + const cnf = this.w.config + + let y = gl.isBarHorizontal ? cnf.xaxis : cnf.yaxis[index] + + if (typeof gl.yAxisScale[index] === 'undefined') { + gl.yAxisScale[index] = [] + } + + let range = Math.abs(maxY - minY) + + if (y.logarithmic && range <= 5) { + gl.invalidLogScale = true + } + + if (y.logarithmic && range > 5) { + gl.allSeriesCollapsed = false + gl.yAxisScale[index] = y.forceNiceScale + ? this.logarithmicScaleNice(minY, maxY, y.logBase) + : this.logarithmicScale(minY, maxY, y.logBase) + } else { + if ( + maxY === -Number.MAX_VALUE || + !Utils.isNumber(maxY) || + minY === Number.MAX_VALUE || + !Utils.isNumber(minY) + ) { + // no data in the chart. + // Either all series collapsed or user passed a blank array. + // Show the user's yaxis with their scale options but with a range. + gl.yAxisScale[index] = this.niceScale(Number.MIN_VALUE, 0, index) + } else { + // there is some data. Turn off the allSeriesCollapsed flag + gl.allSeriesCollapsed = false + gl.yAxisScale[index] = this.niceScale(minY, maxY, index) + } + } + } + + setXScale(minX, maxX) { + const w = this.w + const gl = w.globals + let diff = Math.round(Math.abs(maxX - minX)) + if (maxX === -Number.MAX_VALUE || !Utils.isNumber(maxX)) { + // no data in the chart. Either all series collapsed or user passed a blank array + gl.xAxisScale = this.linearScale(0, 10, 10) + } else { + let ticks = gl.xTickAmount + + gl.xAxisScale = this.linearScale( + minX, + maxX, + ticks, + 0, + w.config.xaxis.stepSize + ) + } + return gl.xAxisScale + } + + scaleMultipleYAxes() { + const cnf = this.w.config + const gl = this.w.globals + + this.coreUtils.setSeriesYAxisMappings() + + let axisSeriesMap = gl.seriesYAxisMap + let minYArr = gl.minYArr + let maxYArr = gl.maxYArr + + // Compute min..max for each yaxis + gl.allSeriesCollapsed = true + gl.barGroups = [] + axisSeriesMap.forEach((axisSeries, ai) => { + let groupNames = [] + axisSeries.forEach((as) => { + let group = cnf.series[as]?.group + if (groupNames.indexOf(group) < 0) { + groupNames.push(group) + } + }) + if (axisSeries.length > 0) { + let minY = Number.MAX_VALUE + let maxY = -Number.MAX_VALUE + let lowestY = minY + let highestY = maxY + let seriesType + let seriesGroupName + if (cnf.chart.stacked) { + // Series' on this axis with the same group name will be stacked. + // Sum series in each group separately + let mapSeries = new Array(gl.dataPoints).fill(0) + let sumSeries = [] + let posSeries = [] + let negSeries = [] + groupNames.forEach(() => { + sumSeries.push(mapSeries.map(() => Number.MIN_VALUE)) + posSeries.push(mapSeries.map(() => Number.MIN_VALUE)) + negSeries.push(mapSeries.map(() => Number.MIN_VALUE)) + }) + for (let i = 0; i < axisSeries.length; i++) { + // Assume chart type but the first series that has a type overrides. + if (!seriesType && cnf.series[axisSeries[i]].type) { + seriesType = cnf.series[axisSeries[i]].type + } + // Sum all series for this yaxis at each corresponding datapoint + // For bar and column charts we need to keep positive and negative + // values separate, for each group separately. + let si = axisSeries[i] + if (cnf.series[si].group) { + seriesGroupName = cnf.series[si].group + } else { + seriesGroupName = 'axis-'.concat(ai) + } + let collapsed = !( + gl.collapsedSeriesIndices.indexOf(si) < 0 && + gl.ancillaryCollapsedSeriesIndices.indexOf(si) < 0 + ) + if (!collapsed) { + gl.allSeriesCollapsed = false + groupNames.forEach((gn, gni) => { + // Undefined group names will be grouped together as their own + // group. + if (cnf.series[si].group === gn) { + for (let j = 0; j < gl.series[si].length; j++) { + let val = gl.series[si][j] + if (val >= 0) { + posSeries[gni][j] += val + } else { + negSeries[gni][j] += val + } + sumSeries[gni][j] += val + // For non bar-like series' we need these point max/min values. + lowestY = Math.min(lowestY, val) + highestY = Math.max(highestY, val) + } + } + }) + } + if (seriesType === 'bar' || seriesType === 'column') { + gl.barGroups.push(seriesGroupName) + } + } + if (!seriesType) { + seriesType = cnf.chart.type + } + if (seriesType === 'bar' || seriesType === 'column') { + groupNames.forEach((gn, gni) => { + minY = Math.min(minY, Math.min.apply(null, negSeries[gni])) + maxY = Math.max(maxY, Math.max.apply(null, posSeries[gni])) + }) + } else { + groupNames.forEach((gn, gni) => { + lowestY = Math.min(lowestY, Math.min.apply(null, sumSeries[gni])) + highestY = Math.max( + highestY, + Math.max.apply(null, sumSeries[gni]) + ) + }) + minY = lowestY + maxY = highestY + } + if (minY === Number.MIN_VALUE && maxY === Number.MIN_VALUE) { + // No series data + maxY = -Number.MAX_VALUE + } + } else { + for (let i = 0; i < axisSeries.length; i++) { + let si = axisSeries[i] + minY = Math.min(minY, minYArr[si]) + maxY = Math.max(maxY, maxYArr[si]) + let collapsed = !( + gl.collapsedSeriesIndices.indexOf(si) < 0 && + gl.ancillaryCollapsedSeriesIndices.indexOf(si) < 0 + ) + if (!collapsed) { + gl.allSeriesCollapsed = false + } + } + } + if (cnf.yaxis[ai].min !== undefined) { + if (typeof cnf.yaxis[ai].min === 'function') { + minY = cnf.yaxis[ai].min(minY) + } else { + minY = cnf.yaxis[ai].min + } + } + if (cnf.yaxis[ai].max !== undefined) { + if (typeof cnf.yaxis[ai].max === 'function') { + maxY = cnf.yaxis[ai].max(maxY) + } else { + maxY = cnf.yaxis[ai].max + } + } + gl.barGroups = gl.barGroups.filter((v, i, a) => a.indexOf(v) === i) + // Set the scale for this yaxis + this.setYScaleForIndex(ai, minY, maxY) + // Set individual series min and max to nice values + axisSeries.forEach((si) => { + minYArr[si] = gl.yAxisScale[ai].niceMin + maxYArr[si] = gl.yAxisScale[ai].niceMax + }) + } else { + // No series referenced by this yaxis + this.setYScaleForIndex(ai, 0, -Number.MAX_VALUE) + } + }) + } +} diff --git a/node_modules/apexcharts/src/modules/Series.js b/node_modules/apexcharts/src/modules/Series.js new file mode 100644 index 0000000..5530447 --- /dev/null +++ b/node_modules/apexcharts/src/modules/Series.js @@ -0,0 +1,484 @@ +import Graphics from './Graphics' +import Utils from '../utils/Utils' + +/** + * ApexCharts Series Class for interaction with the Series of the chart. + * + * @module Series + **/ + +export default class Series { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + + this.legendInactiveClass = 'legend-mouseover-inactive' + } + + getAllSeriesEls() { + return this.w.globals.dom.baseEl.getElementsByClassName(`apexcharts-series`) + } + + getSeriesByName(seriesName) { + return this.w.globals.dom.baseEl.querySelector( + `.apexcharts-inner .apexcharts-series[seriesName='${Utils.escapeString( + seriesName + )}']` + ) + } + + isSeriesHidden(seriesName) { + const targetElement = this.getSeriesByName(seriesName) + let realIndex = parseInt(targetElement.getAttribute('data:realIndex'), 10) + let isHidden = targetElement.classList.contains( + 'apexcharts-series-collapsed' + ) + + return { isHidden, realIndex } + } + + addCollapsedClassToSeries(elSeries, index) { + const w = this.w + function iterateOnAllCollapsedSeries(series) { + for (let cs = 0; cs < series.length; cs++) { + if (series[cs].index === index) { + elSeries.node.classList.add('apexcharts-series-collapsed') + } + } + } + + iterateOnAllCollapsedSeries(w.globals.collapsedSeries) + iterateOnAllCollapsedSeries(w.globals.ancillaryCollapsedSeries) + } + + toggleSeries(seriesName) { + let isSeriesHidden = this.isSeriesHidden(seriesName) + + this.ctx.legend.legendHelpers.toggleDataSeries( + isSeriesHidden.realIndex, + isSeriesHidden.isHidden + ) + + return isSeriesHidden.isHidden + } + + showSeries(seriesName) { + let isSeriesHidden = this.isSeriesHidden(seriesName) + + if (isSeriesHidden.isHidden) { + this.ctx.legend.legendHelpers.toggleDataSeries( + isSeriesHidden.realIndex, + true + ) + } + } + + hideSeries(seriesName) { + let isSeriesHidden = this.isSeriesHidden(seriesName) + + if (!isSeriesHidden.isHidden) { + this.ctx.legend.legendHelpers.toggleDataSeries( + isSeriesHidden.realIndex, + false + ) + } + } + + resetSeries( + shouldUpdateChart = true, + shouldResetZoom = true, + shouldResetCollapsed = true + ) { + const w = this.w + + let series = Utils.clone(w.globals.initialSeries) + + w.globals.previousPaths = [] + + if (shouldResetCollapsed) { + w.globals.collapsedSeries = [] + w.globals.ancillaryCollapsedSeries = [] + w.globals.collapsedSeriesIndices = [] + w.globals.ancillaryCollapsedSeriesIndices = [] + } else { + series = this.emptyCollapsedSeries(series) + } + + w.config.series = series + + if (shouldUpdateChart) { + if (shouldResetZoom) { + w.globals.zoomed = false + this.ctx.updateHelpers.revertDefaultAxisMinMax() + } + this.ctx.updateHelpers._updateSeries( + series, + w.config.chart.animations.dynamicAnimation.enabled + ) + } + } + + emptyCollapsedSeries(series) { + const w = this.w + for (let i = 0; i < series.length; i++) { + if (w.globals.collapsedSeriesIndices.indexOf(i) > -1) { + series[i].data = [] + } + } + return series + } + + highlightSeries(seriesName) { + const w = this.w + + const targetElement = this.getSeriesByName(seriesName) + let realIndex = parseInt(targetElement?.getAttribute('data:realIndex'), 10) + + let allSeriesEls = w.globals.dom.baseEl.querySelectorAll( + `.apexcharts-series, .apexcharts-datalabels, .apexcharts-yaxis` + ) + + let seriesEl = null + let dataLabelEl = null + let yaxisEl = null + if (w.globals.axisCharts || w.config.chart.type === 'radialBar') { + if (w.globals.axisCharts) { + seriesEl = w.globals.dom.baseEl.querySelector( + `.apexcharts-series[data\\:realIndex='${realIndex}']` + ) + dataLabelEl = w.globals.dom.baseEl.querySelector( + `.apexcharts-datalabels[data\\:realIndex='${realIndex}']` + ) + let yaxisIndex = w.globals.seriesYAxisReverseMap[realIndex] + yaxisEl = w.globals.dom.baseEl.querySelector( + `.apexcharts-yaxis[rel='${yaxisIndex}']` + ) + } else { + seriesEl = w.globals.dom.baseEl.querySelector( + `.apexcharts-series[rel='${realIndex + 1}']` + ) + } + } else { + seriesEl = w.globals.dom.baseEl.querySelector( + `.apexcharts-series[rel='${realIndex + 1}'] path` + ) + } + + for (let se = 0; se < allSeriesEls.length; se++) { + allSeriesEls[se].classList.add(this.legendInactiveClass) + } + + if (seriesEl) { + if (!w.globals.axisCharts) { + seriesEl.parentNode.classList.remove(this.legendInactiveClass) + } + seriesEl.classList.remove(this.legendInactiveClass) + + if (dataLabelEl !== null) { + dataLabelEl.classList.remove(this.legendInactiveClass) + } + + if (yaxisEl !== null) { + yaxisEl.classList.remove(this.legendInactiveClass) + } + } else { + for (let se = 0; se < allSeriesEls.length; se++) { + allSeriesEls[se].classList.remove(this.legendInactiveClass) + } + } + } + + toggleSeriesOnHover(e, targetElement) { + const w = this.w + + if (!targetElement) targetElement = e.target + + let allSeriesEls = w.globals.dom.baseEl.querySelectorAll( + `.apexcharts-series, .apexcharts-datalabels, .apexcharts-yaxis` + ) + + if (e.type === 'mousemove') { + let realIndex = parseInt(targetElement.getAttribute('rel'), 10) - 1 + + this.highlightSeries(w.globals.seriesNames[realIndex]) + } else if (e.type === 'mouseout') { + for (let se = 0; se < allSeriesEls.length; se++) { + allSeriesEls[se].classList.remove(this.legendInactiveClass) + } + } + } + + highlightRangeInSeries(e, targetElement) { + const w = this.w + const allHeatMapElements = w.globals.dom.baseEl.getElementsByClassName( + 'apexcharts-heatmap-rect' + ) + + const activeInactive = (action) => { + for (let i = 0; i < allHeatMapElements.length; i++) { + allHeatMapElements[i].classList[action](this.legendInactiveClass) + } + } + + const removeInactiveClassFromHoveredRange = (range, rangeMax) => { + for (let i = 0; i < allHeatMapElements.length; i++) { + const val = Number(allHeatMapElements[i].getAttribute('val')) + if ( + val >= range.from && + (val < range.to || (range.to === rangeMax && val === rangeMax)) + ) { + allHeatMapElements[i].classList.remove(this.legendInactiveClass) + } + } + } + + if (e.type === 'mousemove') { + let seriesCnt = parseInt(targetElement.getAttribute('rel'), 10) - 1 + activeInactive('add') + + const ranges = w.config.plotOptions.heatmap.colorScale.ranges + const range = ranges[seriesCnt] + const rangeMax = ranges.reduce((acc, cur) => Math.max(acc, cur.to), 0) + + removeInactiveClassFromHoveredRange(range, rangeMax) + } else if (e.type === 'mouseout') { + activeInactive('remove') + } + } + + getActiveConfigSeriesIndex(order = 'asc', chartTypes = []) { + const w = this.w + let activeIndex = 0 + + if (w.config.series.length > 1) { + // active series flag is required to know if user has not deactivated via legend click + let activeSeriesIndex = w.config.series.map((s, index) => { + const checkChartType = () => { + if (w.globals.comboCharts) { + return ( + chartTypes.length === 0 || + (chartTypes.length && + chartTypes.indexOf(w.config.series[index].type) > -1) + ) + } + return true + } + + const hasData = + s.data && + s.data.length > 0 && + w.globals.collapsedSeriesIndices.indexOf(index) === -1 + + return hasData && checkChartType() ? index : -1 + }) + for ( + let a = order === 'asc' ? 0 : activeSeriesIndex.length - 1; + order === 'asc' ? a < activeSeriesIndex.length : a >= 0; + order === 'asc' ? a++ : a-- + ) { + if (activeSeriesIndex[a] !== -1) { + activeIndex = activeSeriesIndex[a] + break + } + } + } + + return activeIndex + } + + getBarSeriesIndices() { + const w = this.w + if (w.globals.comboCharts) { + return this.w.config.series + .map((s, i) => { + return s.type === 'bar' || s.type === 'column' ? i : -1 + }) + .filter((i) => { + return i !== -1 + }) + } + return this.w.config.series.map((s, i) => { + return i + }) + } + + getPreviousPaths() { + let w = this.w + + w.globals.previousPaths = [] + + function pushPaths(seriesEls, i, type) { + let paths = seriesEls[i].childNodes + let dArr = { + type, + paths: [], + realIndex: seriesEls[i].getAttribute('data:realIndex'), + } + + for (let j = 0; j < paths.length; j++) { + if (paths[j].hasAttribute('pathTo')) { + let d = paths[j].getAttribute('pathTo') + dArr.paths.push({ + d, + }) + } + } + + w.globals.previousPaths.push(dArr) + } + + const getPaths = (chartType) => { + return w.globals.dom.baseEl.querySelectorAll( + `.apexcharts-${chartType}-series .apexcharts-series` + ) + } + + const chartTypes = [ + 'line', + 'area', + 'bar', + 'rangebar', + 'rangeArea', + 'candlestick', + 'radar', + ] + chartTypes.forEach((type) => { + const paths = getPaths(type) + for (let p = 0; p < paths.length; p++) { + pushPaths(paths, p, type) + } + }) + + let heatTreeSeries = w.globals.dom.baseEl.querySelectorAll( + `.apexcharts-${w.config.chart.type} .apexcharts-series` + ) + + if (heatTreeSeries.length > 0) { + for (let h = 0; h < heatTreeSeries.length; h++) { + let seriesEls = w.globals.dom.baseEl.querySelectorAll( + `.apexcharts-${w.config.chart.type} .apexcharts-series[data\\:realIndex='${h}'] rect` + ) + + let dArr = [] + + for (let i = 0; i < seriesEls.length; i++) { + const getAttr = (x) => { + return seriesEls[i].getAttribute(x) + } + const rect = { + x: parseFloat(getAttr('x')), + y: parseFloat(getAttr('y')), + width: parseFloat(getAttr('width')), + height: parseFloat(getAttr('height')), + } + dArr.push({ + rect, + color: seriesEls[i].getAttribute('color'), + }) + } + w.globals.previousPaths.push(dArr) + } + } + + if (!w.globals.axisCharts) { + // for non-axis charts (i.e., circular charts, pathFrom is not usable. We need whole series) + w.globals.previousPaths = w.globals.series + } + } + + clearPreviousPaths() { + const w = this.w + w.globals.previousPaths = [] + w.globals.allSeriesCollapsed = false + } + + handleNoData() { + const w = this.w + const me = this + + const noDataOpts = w.config.noData + const graphics = new Graphics(me.ctx) + + let x = w.globals.svgWidth / 2 + let y = w.globals.svgHeight / 2 + let textAnchor = 'middle' + + w.globals.noData = true + w.globals.animationEnded = true + + if (noDataOpts.align === 'left') { + x = 10 + textAnchor = 'start' + } else if (noDataOpts.align === 'right') { + x = w.globals.svgWidth - 10 + textAnchor = 'end' + } + + if (noDataOpts.verticalAlign === 'top') { + y = 50 + } else if (noDataOpts.verticalAlign === 'bottom') { + y = w.globals.svgHeight - 50 + } + + x = x + noDataOpts.offsetX + y = y + parseInt(noDataOpts.style.fontSize, 10) + 2 + noDataOpts.offsetY + + if (noDataOpts.text !== undefined && noDataOpts.text !== '') { + let titleText = graphics.drawText({ + x, + y, + text: noDataOpts.text, + textAnchor, + fontSize: noDataOpts.style.fontSize, + fontFamily: noDataOpts.style.fontFamily, + foreColor: noDataOpts.style.color, + opacity: 1, + class: 'apexcharts-text-nodata', + }) + + w.globals.dom.Paper.add(titleText) + } + } + + // When user clicks on legends, the collapsed series is filled with [0,0,0,...,0] + // This is because we don't want to alter the series' length as it is used at many places + setNullSeriesToZeroValues(series) { + let w = this.w + for (let sl = 0; sl < series.length; sl++) { + if (series[sl].length === 0) { + for (let j = 0; j < series[w.globals.maxValsInArrayIndex].length; j++) { + series[sl].push(0) + } + } + } + return series + } + + hasAllSeriesEqualX() { + let equalLen = true + const w = this.w + + const filteredSerX = this.filteredSeriesX() + + for (let i = 0; i < filteredSerX.length - 1; i++) { + if (filteredSerX[i][0] !== filteredSerX[i + 1][0]) { + equalLen = false + break + } + } + + w.globals.allSeriesHasEqualX = equalLen + + return equalLen + } + + filteredSeriesX() { + const w = this.w + + const filteredSeriesX = w.globals.seriesX.map((ser) => + ser.length > 0 ? ser : [] + ) + + return filteredSeriesX + } +} diff --git a/node_modules/apexcharts/src/modules/Theme.js b/node_modules/apexcharts/src/modules/Theme.js new file mode 100644 index 0000000..50355c8 --- /dev/null +++ b/node_modules/apexcharts/src/modules/Theme.js @@ -0,0 +1,240 @@ +import Utils from '../utils/Utils' + +/** + * ApexCharts Theme Class for setting the colors and palettes. + * + * @module Theme + **/ + +export default class Theme { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + this.colors = [] + this.isColorFn = false + this.isHeatmapDistributed = this.checkHeatmapDistributed() + this.isBarDistributed = this.checkBarDistributed() + } + + checkHeatmapDistributed() { + const { chart, plotOptions } = this.w.config + return ( + (chart.type === 'treemap' && + plotOptions.treemap && + plotOptions.treemap.distributed) || + (chart.type === 'heatmap' && + plotOptions.heatmap && + plotOptions.heatmap.distributed) + ) + } + + checkBarDistributed() { + const { chart, plotOptions } = this.w.config + return ( + plotOptions.bar && + plotOptions.bar.distributed && + (chart.type === 'bar' || chart.type === 'rangeBar') + ) + } + + init() { + this.setDefaultColors() + } + + setDefaultColors() { + const w = this.w + const utils = new Utils() + + w.globals.dom.elWrap.classList.add( + `apexcharts-theme-${w.config.theme.mode}` + ) + + // Create a copy of config.colors array to avoid mutating the original config.colors + const configColors = [...(w.config.colors || w.config.fill.colors || [])] + w.globals.colors = this.getColors(configColors) + + this.applySeriesColors(w.globals.seriesColors, w.globals.colors) + + if (w.config.theme.monochrome.enabled) { + w.globals.colors = this.getMonochromeColors( + w.config.theme.monochrome, + w.globals.series, + utils + ) + } + + const defaultColors = w.globals.colors.slice() + this.pushExtraColors(w.globals.colors) + + this.applyColorTypes(['fill', 'stroke'], defaultColors) + this.applyDataLabelsColors(defaultColors) + this.applyRadarPolygonsColors() + this.applyMarkersColors(defaultColors) + } + + getColors(configColors) { + const w = this.w + if (!configColors || configColors.length === 0) { + return this.predefined() + } + + if ( + Array.isArray(configColors) && + configColors.length > 0 && + typeof configColors[0] === 'function' + ) { + this.isColorFn = true + return w.config.series.map((s, i) => { + let c = configColors[i] || configColors[0] + return typeof c === 'function' + ? c({ + value: w.globals.axisCharts + ? w.globals.series[i][0] || 0 + : w.globals.series[i], + seriesIndex: i, + dataPointIndex: i, + w: this.w, + }) + : c + }) + } + + return configColors + } + + applySeriesColors(seriesColors, globalsColors) { + seriesColors.forEach((c, i) => { + if (c) { + globalsColors[i] = c + } + }) + } + + getMonochromeColors(monochrome, series, utils) { + const { color, shadeIntensity, shadeTo } = monochrome + const glsCnt = + this.isBarDistributed || this.isHeatmapDistributed + ? series[0].length * series.length + : series.length + const part = 1 / (glsCnt / shadeIntensity) + let percent = 0 + + return Array.from({ length: glsCnt }, () => { + const newColor = + shadeTo === 'dark' + ? utils.shadeColor(percent * -1, color) + : utils.shadeColor(percent, color) + percent += part + return newColor + }) + } + + applyColorTypes(colorTypes, defaultColors) { + const w = this.w + colorTypes.forEach((c) => { + w.globals[c].colors = + w.config[c].colors === undefined + ? this.isColorFn + ? w.config.colors + : defaultColors + : w.config[c].colors.slice() + this.pushExtraColors(w.globals[c].colors) + }) + } + + applyDataLabelsColors(defaultColors) { + const w = this.w + w.globals.dataLabels.style.colors = + w.config.dataLabels.style.colors === undefined + ? defaultColors + : w.config.dataLabels.style.colors.slice() + this.pushExtraColors(w.globals.dataLabels.style.colors, 50) + } + + applyRadarPolygonsColors() { + const w = this.w + w.globals.radarPolygons.fill.colors = + w.config.plotOptions.radar.polygons.fill.colors === undefined + ? [w.config.theme.mode === 'dark' ? '#424242' : 'none'] + : w.config.plotOptions.radar.polygons.fill.colors.slice() + this.pushExtraColors(w.globals.radarPolygons.fill.colors, 20) + } + + applyMarkersColors(defaultColors) { + const w = this.w + w.globals.markers.colors = + w.config.markers.colors === undefined + ? defaultColors + : w.config.markers.colors.slice() + this.pushExtraColors(w.globals.markers.colors) + } + + pushExtraColors(colorSeries, length, distributed = null) { + const w = this.w + let len = length || w.globals.series.length + + if (distributed === null) { + distributed = + this.isBarDistributed || + this.isHeatmapDistributed || + (w.config.chart.type === 'heatmap' && + w.config.plotOptions.heatmap && + w.config.plotOptions.heatmap.colorScale.inverse) + } + + if (distributed && w.globals.series.length) { + len = + w.globals.series[w.globals.maxValsInArrayIndex].length * + w.globals.series.length + } + + if (colorSeries.length < len) { + let diff = len - colorSeries.length + for (let i = 0; i < diff; i++) { + colorSeries.push(colorSeries[i]) + } + } + } + + updateThemeOptions(options) { + options.chart = options.chart || {} + options.tooltip = options.tooltip || {} + const mode = options.theme.mode + const palette = + mode === 'dark' + ? 'palette4' + : mode === 'light' + ? 'palette1' + : options.theme.palette || 'palette1' + const foreColor = + mode === 'dark' + ? '#f6f7f8' + : mode === 'light' + ? '#373d3f' + : options.chart.foreColor || '#373d3f' + + options.tooltip.theme = mode || 'light' + options.chart.foreColor = foreColor + options.theme.palette = palette + + return options + } + + predefined() { + const palette = this.w.config.theme.palette + const palettes = { + palette1: ['#008FFB', '#00E396', '#FEB019', '#FF4560', '#775DD0'], + palette2: ['#3f51b5', '#03a9f4', '#4caf50', '#f9ce1d', '#FF9800'], + palette3: ['#33b2df', '#546E7A', '#d4526e', '#13d8aa', '#A5978B'], + palette4: ['#4ecdc4', '#c7f464', '#81D4FA', '#fd6a6a', '#546E7A'], + palette5: ['#2b908f', '#f9a3a4', '#90ee7e', '#fa4443', '#69d2e7'], + palette6: ['#449DD1', '#F86624', '#EA3546', '#662E9B', '#C5D86D'], + palette7: ['#D7263D', '#1B998B', '#2E294E', '#F46036', '#E2C044'], + palette8: ['#662E9B', '#F86624', '#F9C80E', '#EA3546', '#43BCCD'], + palette9: ['#5C4742', '#A5978B', '#8D5B4C', '#5A2A27', '#C4BBAF'], + palette10: ['#A300D6', '#7D02EB', '#5653FE', '#2983FF', '#00B1F2'], + default: ['#008FFB', '#00E396', '#FEB019', '#FF4560', '#775DD0'], + } + return palettes[palette] || palettes.default + } +} diff --git a/node_modules/apexcharts/src/modules/TimeScale.js b/node_modules/apexcharts/src/modules/TimeScale.js new file mode 100644 index 0000000..c0ff029 --- /dev/null +++ b/node_modules/apexcharts/src/modules/TimeScale.js @@ -0,0 +1,939 @@ +import DateTime from '../utils/DateTime' +import Dimensions from './dimensions/Dimensions' +import Graphics from './Graphics' +import Utils from '../utils/Utils' + +const MINUTES_IN_DAY = 24 * 60 +const SECONDS_IN_DAY = MINUTES_IN_DAY * 60 +const MIN_ZOOM_DAYS = 10 / SECONDS_IN_DAY + +/** + * ApexCharts TimeScale Class for generating time ticks for x-axis. + * + * @module TimeScale + **/ + +class TimeScale { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + this.timeScaleArray = [] + this.utc = this.w.config.xaxis.labels.datetimeUTC + } + + calculateTimeScaleTicks(minX, maxX) { + let w = this.w + + // null check when no series to show + if (w.globals.allSeriesCollapsed) { + w.globals.labels = [] + w.globals.timescaleLabels = [] + return [] + } + + let dt = new DateTime(this.ctx) + + const daysDiff = (maxX - minX) / (1000 * SECONDS_IN_DAY) + this.determineInterval(daysDiff) + + w.globals.disableZoomIn = false + w.globals.disableZoomOut = false + + if (daysDiff < MIN_ZOOM_DAYS) { + w.globals.disableZoomIn = true + } else if (daysDiff > 50000) { + w.globals.disableZoomOut = true + } + + const timeIntervals = dt.getTimeUnitsfromTimestamp(minX, maxX, this.utc) + + const daysWidthOnXAxis = w.globals.gridWidth / daysDiff + const hoursWidthOnXAxis = daysWidthOnXAxis / 24 + const minutesWidthOnXAxis = hoursWidthOnXAxis / 60 + const secondsWidthOnXAxis = minutesWidthOnXAxis / 60 + + let numberOfHours = Math.floor(daysDiff * 24) + let numberOfMinutes = Math.floor(daysDiff * MINUTES_IN_DAY) + let numberOfSeconds = Math.floor(daysDiff * SECONDS_IN_DAY) + let numberOfDays = Math.floor(daysDiff) + let numberOfMonths = Math.floor(daysDiff / 30) + let numberOfYears = Math.floor(daysDiff / 365) + + const firstVal = { + minMillisecond: timeIntervals.minMillisecond, + minSecond: timeIntervals.minSecond, + minMinute: timeIntervals.minMinute, + minHour: timeIntervals.minHour, + minDate: timeIntervals.minDate, + minMonth: timeIntervals.minMonth, + minYear: timeIntervals.minYear, + } + + let currentMillisecond = firstVal.minMillisecond + let currentSecond = firstVal.minSecond + let currentMinute = firstVal.minMinute + let currentHour = firstVal.minHour + let currentMonthDate = firstVal.minDate + let currentDate = firstVal.minDate + let currentMonth = firstVal.minMonth + let currentYear = firstVal.minYear + + const params = { + firstVal, + currentMillisecond, + currentSecond, + currentMinute, + currentHour, + currentMonthDate, + currentDate, + currentMonth, + currentYear, + daysWidthOnXAxis, + hoursWidthOnXAxis, + minutesWidthOnXAxis, + secondsWidthOnXAxis, + numberOfSeconds, + numberOfMinutes, + numberOfHours, + numberOfDays, + numberOfMonths, + numberOfYears, + } + + switch (this.tickInterval) { + case 'years': { + this.generateYearScale(params) + break + } + case 'months': + case 'half_year': { + this.generateMonthScale(params) + break + } + case 'months_days': + case 'months_fortnight': + case 'days': + case 'week_days': { + this.generateDayScale(params) + break + } + case 'hours': { + this.generateHourScale(params) + break + } + case 'minutes_fives': + case 'minutes': + this.generateMinuteScale(params) + break + case 'seconds_tens': + case 'seconds_fives': + case 'seconds': + this.generateSecondScale(params) + break + } + + // first, we will adjust the month values index + // as in the upper function, it is starting from 0 + // we will start them from 1 + const adjustedMonthInTimeScaleArray = this.timeScaleArray.map((ts) => { + let defaultReturn = { + position: ts.position, + unit: ts.unit, + year: ts.year, + day: ts.day ? ts.day : 1, + hour: ts.hour ? ts.hour : 0, + month: ts.month + 1, + } + if (ts.unit === 'month') { + return { + ...defaultReturn, + day: 1, + value: ts.value + 1, + } + } else if (ts.unit === 'day' || ts.unit === 'hour') { + return { + ...defaultReturn, + value: ts.value, + } + } else if (ts.unit === 'minute') { + return { + ...defaultReturn, + value: ts.value, + minute: ts.value, + } + } else if (ts.unit === 'second') { + return { + ...defaultReturn, + value: ts.value, + minute: ts.minute, + second: ts.second, + } + } + + return ts + }) + + const filteredTimeScale = adjustedMonthInTimeScaleArray.filter((ts) => { + let modulo = 1 + let ticks = Math.ceil(w.globals.gridWidth / 120) + let value = ts.value + if (w.config.xaxis.tickAmount !== undefined) { + ticks = w.config.xaxis.tickAmount + } + if (adjustedMonthInTimeScaleArray.length > ticks) { + modulo = Math.floor(adjustedMonthInTimeScaleArray.length / ticks) + } + + let shouldNotSkipUnit = false // there is a big change in unit i.e days to months + let shouldNotPrint = false // should skip these values + + switch (this.tickInterval) { + case 'years': + // make years label denser + if (ts.unit === 'year') { + shouldNotSkipUnit = true + } + break + case 'half_year': + modulo = 7 + if (ts.unit === 'year') { + shouldNotSkipUnit = true + } + break + case 'months': + modulo = 1 + if (ts.unit === 'year') { + shouldNotSkipUnit = true + } + break + case 'months_fortnight': + modulo = 15 + if (ts.unit === 'year' || ts.unit === 'month') { + shouldNotSkipUnit = true + } + if (value === 30) { + shouldNotPrint = true + } + break + case 'months_days': + modulo = 10 + if (ts.unit === 'month') { + shouldNotSkipUnit = true + } + if (value === 30) { + shouldNotPrint = true + } + break + case 'week_days': + modulo = 8 + if (ts.unit === 'month') { + shouldNotSkipUnit = true + } + break + case 'days': + modulo = 1 + if (ts.unit === 'month') { + shouldNotSkipUnit = true + } + break + case 'hours': + if (ts.unit === 'day') { + shouldNotSkipUnit = true + } + break + case 'minutes_fives': + if (value % 5 !== 0) { + shouldNotPrint = true + } + break + case 'seconds_tens': + if (value % 10 !== 0) { + shouldNotPrint = true + } + break + case 'seconds_fives': + if (value % 5 !== 0) { + shouldNotPrint = true + } + break + } + + if ( + this.tickInterval === 'hours' || + this.tickInterval === 'minutes_fives' || + this.tickInterval === 'seconds_tens' || + this.tickInterval === 'seconds_fives' + ) { + if (!shouldNotPrint) { + return true + } + } else { + if ((value % modulo === 0 || shouldNotSkipUnit) && !shouldNotPrint) { + return true + } + } + }) + + return filteredTimeScale + } + + recalcDimensionsBasedOnFormat(filteredTimeScale, inverted) { + const w = this.w + const reformattedTimescaleArray = this.formatDates(filteredTimeScale) + + const removedOverlappingTS = this.removeOverlappingTS( + reformattedTimescaleArray + ) + + w.globals.timescaleLabels = removedOverlappingTS.slice() + + // at this stage, we need to re-calculate coords of the grid as timeline labels may have altered the xaxis labels coords + // The reason we can't do this prior to this stage is because timeline labels depends on gridWidth, and as the ticks are calculated based on available gridWidth, there can be unknown number of ticks generated for different minX and maxX + // Dependency on Dimensions(), need to refactor correctly + // TODO - find an alternate way to avoid calling this Heavy method twice + let dimensions = new Dimensions(this.ctx) + dimensions.plotCoords() + } + + determineInterval(daysDiff) { + const yearsDiff = daysDiff / 365 + const hoursDiff = daysDiff * 24 + const minutesDiff = hoursDiff * 60 + const secondsDiff = minutesDiff * 60 + switch (true) { + case yearsDiff > 5: + this.tickInterval = 'years' + break + case daysDiff > 800: + this.tickInterval = 'half_year' + break + case daysDiff > 180: + this.tickInterval = 'months' + break + case daysDiff > 90: + this.tickInterval = 'months_fortnight' + break + case daysDiff > 60: + this.tickInterval = 'months_days' + break + case daysDiff > 30: + this.tickInterval = 'week_days' + break + case daysDiff > 2: + this.tickInterval = 'days' + break + case hoursDiff > 2.4: + this.tickInterval = 'hours' + break + case minutesDiff > 15: + this.tickInterval = 'minutes_fives' + break + case minutesDiff > 5: + this.tickInterval = 'minutes' + break + case minutesDiff > 1: + this.tickInterval = 'seconds_tens' + break + case secondsDiff > 20: + this.tickInterval = 'seconds_fives' + break + default: + this.tickInterval = 'seconds' + break + } + } + + generateYearScale({ + firstVal, + currentMonth, + currentYear, + daysWidthOnXAxis, + numberOfYears, + }) { + let firstTickValue = firstVal.minYear + let firstTickPosition = 0 + const dt = new DateTime(this.ctx) + + let unit = 'year' + + if (firstVal.minDate > 1 || firstVal.minMonth > 0) { + let remainingDays = dt.determineRemainingDaysOfYear( + firstVal.minYear, + firstVal.minMonth, + firstVal.minDate + ) + + // remainingDaysofFirstMonth is used to reacht the 2nd tick position + let remainingDaysOfFirstYear = + dt.determineDaysOfYear(firstVal.minYear) - remainingDays + 1 + + // calculate the first tick position + firstTickPosition = remainingDaysOfFirstYear * daysWidthOnXAxis + firstTickValue = firstVal.minYear + 1 + // push the first tick in the array + this.timeScaleArray.push({ + position: firstTickPosition, + value: firstTickValue, + unit, + year: firstTickValue, + month: Utils.monthMod(currentMonth + 1), + }) + } else if (firstVal.minDate === 1 && firstVal.minMonth === 0) { + // push the first tick in the array + this.timeScaleArray.push({ + position: firstTickPosition, + value: firstTickValue, + unit, + year: currentYear, + month: Utils.monthMod(currentMonth + 1), + }) + } + + let year = firstTickValue + let pos = firstTickPosition + + // keep drawing rest of the ticks + for (let i = 0; i < numberOfYears; i++) { + year++ + pos = dt.determineDaysOfYear(year - 1) * daysWidthOnXAxis + pos + this.timeScaleArray.push({ + position: pos, + value: year, + unit, + year, + month: 1, + }) + } + } + + generateMonthScale({ + firstVal, + currentMonthDate, + currentMonth, + currentYear, + daysWidthOnXAxis, + numberOfMonths, + }) { + let firstTickValue = currentMonth + let firstTickPosition = 0 + const dt = new DateTime(this.ctx) + let unit = 'month' + let yrCounter = 0 + + if (firstVal.minDate > 1) { + // remainingDaysofFirstMonth is used to reacht the 2nd tick position + let remainingDaysOfFirstMonth = + dt.determineDaysOfMonths(currentMonth + 1, firstVal.minYear) - + currentMonthDate + + 1 + + // calculate the first tick position + firstTickPosition = remainingDaysOfFirstMonth * daysWidthOnXAxis + firstTickValue = Utils.monthMod(currentMonth + 1) + + let year = currentYear + yrCounter + let month = Utils.monthMod(firstTickValue) + let value = firstTickValue + // it's Jan, so update the year + if (firstTickValue === 0) { + unit = 'year' + value = year + month = 1 + yrCounter += 1 + year = year + yrCounter + } + + // push the first tick in the array + this.timeScaleArray.push({ + position: firstTickPosition, + value, + unit, + year, + month, + }) + } else { + // push the first tick in the array + this.timeScaleArray.push({ + position: firstTickPosition, + value: firstTickValue, + unit, + year: currentYear, + month: Utils.monthMod(currentMonth), + }) + } + + let month = firstTickValue + 1 + let pos = firstTickPosition + + // keep drawing rest of the ticks + for (let i = 0, j = 1; i < numberOfMonths; i++, j++) { + month = Utils.monthMod(month) + + if (month === 0) { + unit = 'year' + yrCounter += 1 + } else { + unit = 'month' + } + let year = this._getYear(currentYear, month, yrCounter) + + pos = dt.determineDaysOfMonths(month, year) * daysWidthOnXAxis + pos + let monthVal = month === 0 ? year : month + this.timeScaleArray.push({ + position: pos, + value: monthVal, + unit, + year, + month: month === 0 ? 1 : month, + }) + month++ + } + } + + generateDayScale({ + firstVal, + currentMonth, + currentYear, + hoursWidthOnXAxis, + numberOfDays, + }) { + const dt = new DateTime(this.ctx) + let unit = 'day' + let firstTickValue = firstVal.minDate + 1 + let date = firstTickValue + + const changeMonth = (dateVal, month, year) => { + let monthdays = dt.determineDaysOfMonths(month + 1, year) + + if (dateVal > monthdays) { + month = month + 1 + date = 1 + unit = 'month' + val = month + return month + } + + return month + } + + let remainingHours = 24 - firstVal.minHour + let yrCounter = 0 + + // calculate the first tick position + let firstTickPosition = remainingHours * hoursWidthOnXAxis + + let val = firstTickValue + let month = changeMonth(date, currentMonth, currentYear) + + if (firstVal.minHour === 0 && firstVal.minDate === 1) { + // the first value is the first day of month + firstTickPosition = 0 + val = Utils.monthMod(firstVal.minMonth) + unit = 'month' + date = firstVal.minDate + // numberOfDays++ + // removed the above line to fix https://github.com/apexcharts/apexcharts.js/issues/305#issuecomment-1019520513 + } else if ( + firstVal.minDate !== 1 && + firstVal.minHour === 0 && + firstVal.minMinute === 0 + ) { + // fixes apexcharts/apexcharts.js/issues/1730 + firstTickPosition = 0 + firstTickValue = firstVal.minDate + date = firstTickValue + val = firstTickValue + // in case it's the last date of month, we need to check it + month = changeMonth(date, currentMonth, currentYear) + + if (val !== 1) { + unit = 'day' + } + } + + // push the first tick in the array + this.timeScaleArray.push({ + position: firstTickPosition, + value: val, + unit, + year: this._getYear(currentYear, month, yrCounter), + month: Utils.monthMod(month), + day: date, + }) + + let pos = firstTickPosition + // keep drawing rest of the ticks + for (let i = 0; i < numberOfDays; i++) { + date += 1 + unit = 'day' + month = changeMonth( + date, + month, + this._getYear(currentYear, month, yrCounter) + ) + + let year = this._getYear(currentYear, month, yrCounter) + + pos = 24 * hoursWidthOnXAxis + pos + let value = date === 1 ? Utils.monthMod(month) : date + this.timeScaleArray.push({ + position: pos, + value, + unit, + year, + month: Utils.monthMod(month), + day: value, + }) + } + } + + generateHourScale({ + firstVal, + currentDate, + currentMonth, + currentYear, + minutesWidthOnXAxis, + numberOfHours, + }) { + const dt = new DateTime(this.ctx) + + let yrCounter = 0 + let unit = 'hour' + + const changeDate = (dateVal, month) => { + let monthdays = dt.determineDaysOfMonths(month + 1, currentYear) + if (dateVal > monthdays) { + date = 1 + month = month + 1 + } + return { month, date } + } + + const changeMonth = (dateVal, month) => { + let monthdays = dt.determineDaysOfMonths(month + 1, currentYear) + if (dateVal > monthdays) { + month = month + 1 + return month + } + + return month + } + + // factor in minSeconds as well + let remainingMins = 60 - (firstVal.minMinute + firstVal.minSecond / 60.0) + + let firstTickPosition = remainingMins * minutesWidthOnXAxis + let firstTickValue = firstVal.minHour + 1 + let hour = firstTickValue + + if (remainingMins === 60) { + firstTickPosition = 0 + firstTickValue = firstVal.minHour + hour = firstTickValue + } + + let date = currentDate + + // we need to apply date switching logic here as well, to avoid duplicated labels + if (hour >= 24) { + hour = 0 + date += 1 + unit = 'day' + // Unit changed to day , Value should align unit + firstTickValue = date + } + + const checkNextMonth = changeDate(date, currentMonth) + + let month = checkNextMonth.month + month = changeMonth(date, month) + + // Check if date is greater than 31 and change month if it is + if (firstTickValue > 31) { + date = 1 + firstTickValue = date + } + + // push the first tick in the array + this.timeScaleArray.push({ + position: firstTickPosition, + value: firstTickValue, + unit, + day: date, + hour, + year: currentYear, + month: Utils.monthMod(month), + }) + + hour++ + + let pos = firstTickPosition + // keep drawing rest of the ticks + for (let i = 0; i < numberOfHours; i++) { + unit = 'hour' + + if (hour >= 24) { + hour = 0 + date += 1 + unit = 'day' + + const checkNextMonth = changeDate(date, month) + + month = checkNextMonth.month + month = changeMonth(date, month) + } + + let year = this._getYear(currentYear, month, yrCounter) + pos = 60 * minutesWidthOnXAxis + pos + let val = hour === 0 ? date : hour + this.timeScaleArray.push({ + position: pos, + value: val, + unit, + hour, + day: date, + year, + month: Utils.monthMod(month), + }) + + hour++ + } + } + + generateMinuteScale({ + currentMillisecond, + currentSecond, + currentMinute, + currentHour, + currentDate, + currentMonth, + currentYear, + minutesWidthOnXAxis, + secondsWidthOnXAxis, + numberOfMinutes, + }) { + let yrCounter = 0 + let unit = 'minute' + + let remainingSecs = 60 - currentSecond + let firstTickPosition = + (remainingSecs - currentMillisecond / 1000) * secondsWidthOnXAxis + let minute = currentMinute + 1 + + let date = currentDate + let month = currentMonth + let year = currentYear + let hour = currentHour + + let pos = firstTickPosition + for (let i = 0; i < numberOfMinutes; i++) { + if (minute >= 60) { + minute = 0 + hour += 1 + if (hour === 24) { + hour = 0 + } + } + + this.timeScaleArray.push({ + position: pos, + value: minute, + unit, + hour, + minute, + day: date, + year: this._getYear(year, month, yrCounter), + month: Utils.monthMod(month), + }) + + pos += minutesWidthOnXAxis + minute++ + } + } + + generateSecondScale({ + currentMillisecond, + currentSecond, + currentMinute, + currentHour, + currentDate, + currentMonth, + currentYear, + secondsWidthOnXAxis, + numberOfSeconds, + }) { + let yrCounter = 0 + let unit = 'second' + + const remainingMillisecs = 1000 - currentMillisecond + let firstTickPosition = (remainingMillisecs / 1000) * secondsWidthOnXAxis + + let second = currentSecond + 1 + let minute = currentMinute + let date = currentDate + let month = currentMonth + let year = currentYear + let hour = currentHour + + let pos = firstTickPosition + for (let i = 0; i < numberOfSeconds; i++) { + if (second >= 60) { + minute++ + second = 0 + if (minute >= 60) { + hour++ + minute = 0 + if (hour === 24) { + hour = 0 + } + } + } + + this.timeScaleArray.push({ + position: pos, + value: second, + unit, + hour, + minute, + second, + day: date, + year: this._getYear(year, month, yrCounter), + month: Utils.monthMod(month), + }) + + pos += secondsWidthOnXAxis + second++ + } + } + + createRawDateString(ts, value) { + let raw = ts.year + + if (ts.month === 0) { + // invalid month, correct it + ts.month = 1 + } + raw += '-' + ('0' + ts.month.toString()).slice(-2) + + // unit is day + if (ts.unit === 'day') { + raw += ts.unit === 'day' ? '-' + ('0' + value).slice(-2) : '-01' + } else { + raw += '-' + ('0' + (ts.day ? ts.day : '1')).slice(-2) + } + + // unit is hour + if (ts.unit === 'hour') { + raw += ts.unit === 'hour' ? 'T' + ('0' + value).slice(-2) : 'T00' + } else { + raw += 'T' + ('0' + (ts.hour ? ts.hour : '0')).slice(-2) + } + + if (ts.unit === 'minute') { + raw += ':' + ('0' + value).slice(-2) + } else { + raw += ':' + (ts.minute ? ('0' + ts.minute).slice(-2) : '00') + } + + if (ts.unit === 'second') { + raw += ':' + ('0' + value).slice(-2) + } else { + raw += ':00' + } + + if (this.utc) { + raw += '.000Z' + } + return raw + } + + formatDates(filteredTimeScale) { + const w = this.w + + const reformattedTimescaleArray = filteredTimeScale.map((ts) => { + let value = ts.value.toString() + + let dt = new DateTime(this.ctx) + + const raw = this.createRawDateString(ts, value) + + let dateToFormat = dt.getDate(dt.parseDate(raw)) + if (!this.utc) { + // Fixes #1726, #1544, #1485, #1255 + dateToFormat = dt.getDate(dt.parseDateWithTimezone(raw)) + } + + if (w.config.xaxis.labels.format === undefined) { + let customFormat = 'dd MMM' + const dtFormatter = w.config.xaxis.labels.datetimeFormatter + if (ts.unit === 'year') customFormat = dtFormatter.year + if (ts.unit === 'month') customFormat = dtFormatter.month + if (ts.unit === 'day') customFormat = dtFormatter.day + if (ts.unit === 'hour') customFormat = dtFormatter.hour + if (ts.unit === 'minute') customFormat = dtFormatter.minute + if (ts.unit === 'second') customFormat = dtFormatter.second + + value = dt.formatDate(dateToFormat, customFormat) + } else { + value = dt.formatDate(dateToFormat, w.config.xaxis.labels.format) + } + + return { + dateString: raw, + position: ts.position, + value, + unit: ts.unit, + year: ts.year, + month: ts.month, + } + }) + + return reformattedTimescaleArray + } + + removeOverlappingTS(arr) { + const graphics = new Graphics(this.ctx) + + let equalLabelLengthFlag = false // These labels got same length? + let constantLabelWidth // If true, what is the constant length to use + if ( + arr.length > 0 && // check arr length + arr[0].value && // check arr[0] contains value + arr.every((lb) => lb.value.length === arr[0].value.length) // check every arr label value is the same as the first one + ) { + equalLabelLengthFlag = true // These labels got same length + constantLabelWidth = graphics.getTextRects(arr[0].value).width // The constant label width to use + } + + let lastDrawnIndex = 0 + + let filteredArray = arr.map((item, index) => { + if (index > 0 && this.w.config.xaxis.labels.hideOverlappingLabels) { + const prevLabelWidth = !equalLabelLengthFlag // if vary in label length + ? graphics.getTextRects(arr[lastDrawnIndex].value).width // get individual length + : constantLabelWidth // else: use constant length + const prevPos = arr[lastDrawnIndex].position + const pos = item.position + + if (pos > prevPos + prevLabelWidth + 10) { + lastDrawnIndex = index + return item + } else { + return null + } + } else { + return item + } + }) + + filteredArray = filteredArray.filter((f) => f !== null) + + return filteredArray + } + + _getYear(currentYear, month, yrCounter) { + return currentYear + Math.floor(month / 12) + yrCounter + } +} + +export default TimeScale diff --git a/node_modules/apexcharts/src/modules/TitleSubtitle.js b/node_modules/apexcharts/src/modules/TitleSubtitle.js new file mode 100644 index 0000000..2b3f88e --- /dev/null +++ b/node_modules/apexcharts/src/modules/TitleSubtitle.js @@ -0,0 +1,52 @@ +import Graphics from './Graphics' + +export default class TitleSubtitle { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + } + + draw() { + this.drawTitleSubtitle('title') + this.drawTitleSubtitle('subtitle') + } + + drawTitleSubtitle(type) { + let w = this.w + const tsConfig = type === 'title' ? w.config.title : w.config.subtitle + + let x = w.globals.svgWidth / 2 + let y = tsConfig.offsetY + let textAnchor = 'middle' + + if (tsConfig.align === 'left') { + x = 10 + textAnchor = 'start' + } else if (tsConfig.align === 'right') { + x = w.globals.svgWidth - 10 + textAnchor = 'end' + } + + x = x + tsConfig.offsetX + y = y + parseInt(tsConfig.style.fontSize, 10) + tsConfig.margin / 2 + + if (tsConfig.text !== undefined) { + let graphics = new Graphics(this.ctx) + let titleText = graphics.drawText({ + x, + y, + text: tsConfig.text, + textAnchor, + fontSize: tsConfig.style.fontSize, + fontFamily: tsConfig.style.fontFamily, + fontWeight: tsConfig.style.fontWeight, + foreColor: tsConfig.style.color, + opacity: 1 + }) + + titleText.node.setAttribute('class', `apexcharts-${type}-text`) + + w.globals.dom.Paper.add(titleText) + } + } +} diff --git a/node_modules/apexcharts/src/modules/Toolbar.js b/node_modules/apexcharts/src/modules/Toolbar.js new file mode 100644 index 0000000..980b1e8 --- /dev/null +++ b/node_modules/apexcharts/src/modules/Toolbar.js @@ -0,0 +1,521 @@ +import Graphics from './Graphics' +import Exports from './Exports' +import Scales from './Scales' +import Utils from './../utils/Utils' +import icoPan from './../assets/ico-pan-hand.svg' +import icoZoom from './../assets/ico-zoom-in.svg' +import icoReset from './../assets/ico-home.svg' +import icoZoomIn from './../assets/ico-plus.svg' +import icoZoomOut from './../assets/ico-minus.svg' +import icoSelect from './../assets/ico-select.svg' +import icoMenu from './../assets/ico-menu.svg' + +/** + * ApexCharts Toolbar Class for creating toolbar in axis based charts. + * + * @module Toolbar + **/ + +export default class Toolbar { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + const w = this.w + + this.ev = this.w.config.chart.events + this.selectedClass = 'apexcharts-selected' + + this.localeValues = this.w.globals.locale.toolbar + + this.minX = w.globals.minX + this.maxX = w.globals.maxX + } + + createToolbar() { + let w = this.w + + const createDiv = () => { + return document.createElement('div') + } + const elToolbarWrap = createDiv() + elToolbarWrap.setAttribute('class', 'apexcharts-toolbar') + elToolbarWrap.style.top = w.config.chart.toolbar.offsetY + 'px' + elToolbarWrap.style.right = -w.config.chart.toolbar.offsetX + 3 + 'px' + w.globals.dom.elWrap.appendChild(elToolbarWrap) + + this.elZoom = createDiv() + this.elZoomIn = createDiv() + this.elZoomOut = createDiv() + this.elPan = createDiv() + this.elSelection = createDiv() + this.elZoomReset = createDiv() + this.elMenuIcon = createDiv() + this.elMenu = createDiv() + this.elCustomIcons = [] + + this.t = w.config.chart.toolbar.tools + + if (Array.isArray(this.t.customIcons)) { + for (let i = 0; i < this.t.customIcons.length; i++) { + this.elCustomIcons.push(createDiv()) + } + } + + let toolbarControls = [] + + const appendZoomControl = (type, el, ico) => { + const tool = type.toLowerCase() + if (this.t[tool] && w.config.chart.zoom.enabled) { + toolbarControls.push({ + el, + icon: typeof this.t[tool] === 'string' ? this.t[tool] : ico, + title: this.localeValues[type], + class: `apexcharts-${tool}-icon`, + }) + } + } + + appendZoomControl('zoomIn', this.elZoomIn, icoZoomIn) + appendZoomControl('zoomOut', this.elZoomOut, icoZoomOut) + + const zoomSelectionCtrls = (z) => { + if (this.t[z] && w.config.chart[z].enabled) { + toolbarControls.push({ + el: z === 'zoom' ? this.elZoom : this.elSelection, + icon: + typeof this.t[z] === 'string' + ? this.t[z] + : z === 'zoom' + ? icoZoom + : icoSelect, + title: + this.localeValues[z === 'zoom' ? 'selectionZoom' : 'selection'], + class: w.globals.isTouchDevice + ? 'apexcharts-element-hidden' + : `apexcharts-${z}-icon`, + }) + } + } + zoomSelectionCtrls('zoom') + zoomSelectionCtrls('selection') + + if (this.t.pan && w.config.chart.zoom.enabled) { + toolbarControls.push({ + el: this.elPan, + icon: typeof this.t.pan === 'string' ? this.t.pan : icoPan, + title: this.localeValues.pan, + class: w.globals.isTouchDevice + ? 'apexcharts-element-hidden' + : 'apexcharts-pan-icon', + }) + } + + appendZoomControl('reset', this.elZoomReset, icoReset) + + if (this.t.download) { + toolbarControls.push({ + el: this.elMenuIcon, + icon: typeof this.t.download === 'string' ? this.t.download : icoMenu, + title: this.localeValues.menu, + class: 'apexcharts-menu-icon', + }) + } + + for (let i = 0; i < this.elCustomIcons.length; i++) { + toolbarControls.push({ + el: this.elCustomIcons[i], + icon: this.t.customIcons[i].icon, + title: this.t.customIcons[i].title, + index: this.t.customIcons[i].index, + class: 'apexcharts-toolbar-custom-icon ' + this.t.customIcons[i].class, + }) + } + + toolbarControls.forEach((t, index) => { + if (t.index) { + Utils.moveIndexInArray(toolbarControls, index, t.index) + } + }) + + for (let i = 0; i < toolbarControls.length; i++) { + Graphics.setAttrs(toolbarControls[i].el, { + class: toolbarControls[i].class, + title: toolbarControls[i].title, + }) + + toolbarControls[i].el.innerHTML = toolbarControls[i].icon + elToolbarWrap.appendChild(toolbarControls[i].el) + } + + this._createHamburgerMenu(elToolbarWrap) + + if (w.globals.zoomEnabled) { + this.elZoom.classList.add(this.selectedClass) + } else if (w.globals.panEnabled) { + this.elPan.classList.add(this.selectedClass) + } else if (w.globals.selectionEnabled) { + this.elSelection.classList.add(this.selectedClass) + } + + this.addToolbarEventListeners() + } + + _createHamburgerMenu(parent) { + this.elMenuItems = [] + parent.appendChild(this.elMenu) + + Graphics.setAttrs(this.elMenu, { + class: 'apexcharts-menu', + }) + + const menuItems = [ + { + name: 'exportSVG', + title: this.localeValues.exportToSVG, + }, + { + name: 'exportPNG', + title: this.localeValues.exportToPNG, + }, + { + name: 'exportCSV', + title: this.localeValues.exportToCSV, + }, + ] + + for (let i = 0; i < menuItems.length; i++) { + this.elMenuItems.push(document.createElement('div')) + this.elMenuItems[i].innerHTML = menuItems[i].title + Graphics.setAttrs(this.elMenuItems[i], { + class: `apexcharts-menu-item ${menuItems[i].name}`, + title: menuItems[i].title, + }) + this.elMenu.appendChild(this.elMenuItems[i]) + } + } + + addToolbarEventListeners() { + this.elZoomReset.addEventListener('click', this.handleZoomReset.bind(this)) + this.elSelection.addEventListener( + 'click', + this.toggleZoomSelection.bind(this, 'selection') + ) + this.elZoom.addEventListener( + 'click', + this.toggleZoomSelection.bind(this, 'zoom') + ) + this.elZoomIn.addEventListener('click', this.handleZoomIn.bind(this)) + this.elZoomOut.addEventListener('click', this.handleZoomOut.bind(this)) + this.elPan.addEventListener('click', this.togglePanning.bind(this)) + this.elMenuIcon.addEventListener('click', this.toggleMenu.bind(this)) + this.elMenuItems.forEach((m) => { + if (m.classList.contains('exportSVG')) { + m.addEventListener('click', this.handleDownload.bind(this, 'svg')) + } else if (m.classList.contains('exportPNG')) { + m.addEventListener('click', this.handleDownload.bind(this, 'png')) + } else if (m.classList.contains('exportCSV')) { + m.addEventListener('click', this.handleDownload.bind(this, 'csv')) + } + }) + for (let i = 0; i < this.t.customIcons.length; i++) { + this.elCustomIcons[i].addEventListener( + 'click', + this.t.customIcons[i].click.bind(this, this.ctx, this.ctx.w) + ) + } + } + + toggleZoomSelection(type) { + const charts = this.ctx.getSyncedCharts() + + charts.forEach((ch) => { + ch.ctx.toolbar.toggleOtherControls() + + let el = + type === 'selection' + ? ch.ctx.toolbar.elSelection + : ch.ctx.toolbar.elZoom + let enabledType = + type === 'selection' ? 'selectionEnabled' : 'zoomEnabled' + + ch.w.globals[enabledType] = !ch.w.globals[enabledType] + + if (!el.classList.contains(ch.ctx.toolbar.selectedClass)) { + el.classList.add(ch.ctx.toolbar.selectedClass) + } else { + el.classList.remove(ch.ctx.toolbar.selectedClass) + } + }) + } + + getToolbarIconsReference() { + const w = this.w + if (!this.elZoom) { + this.elZoom = w.globals.dom.baseEl.querySelector('.apexcharts-zoom-icon') + } + if (!this.elPan) { + this.elPan = w.globals.dom.baseEl.querySelector('.apexcharts-pan-icon') + } + if (!this.elSelection) { + this.elSelection = w.globals.dom.baseEl.querySelector( + '.apexcharts-selection-icon' + ) + } + } + + enableZoomPanFromToolbar(type) { + this.toggleOtherControls() + + type === 'pan' + ? (this.w.globals.panEnabled = true) + : (this.w.globals.zoomEnabled = true) + + const el = type === 'pan' ? this.elPan : this.elZoom + const el2 = type === 'pan' ? this.elZoom : this.elPan + if (el) { + el.classList.add(this.selectedClass) + } + if (el2) { + el2.classList.remove(this.selectedClass) + } + } + + togglePanning() { + const charts = this.ctx.getSyncedCharts() + + charts.forEach((ch) => { + ch.ctx.toolbar.toggleOtherControls() + ch.w.globals.panEnabled = !ch.w.globals.panEnabled + + if ( + !ch.ctx.toolbar.elPan.classList.contains(ch.ctx.toolbar.selectedClass) + ) { + ch.ctx.toolbar.elPan.classList.add(ch.ctx.toolbar.selectedClass) + } else { + ch.ctx.toolbar.elPan.classList.remove(ch.ctx.toolbar.selectedClass) + } + }) + } + + toggleOtherControls() { + const w = this.w + w.globals.panEnabled = false + w.globals.zoomEnabled = false + w.globals.selectionEnabled = false + + this.getToolbarIconsReference() + + const toggleEls = [this.elPan, this.elSelection, this.elZoom] + toggleEls.forEach((el) => { + if (el) { + el.classList.remove(this.selectedClass) + } + }) + } + + handleZoomIn() { + const w = this.w + + if (w.globals.isRangeBar) { + this.minX = w.globals.minY + this.maxX = w.globals.maxY + } + + const centerX = (this.minX + this.maxX) / 2 + let newMinX = (this.minX + centerX) / 2 + let newMaxX = (this.maxX + centerX) / 2 + + const newMinXMaxX = this._getNewMinXMaxX(newMinX, newMaxX) + + if (!w.globals.disableZoomIn) { + this.zoomUpdateOptions(newMinXMaxX.minX, newMinXMaxX.maxX) + } + } + + handleZoomOut() { + const w = this.w + + if (w.globals.isRangeBar) { + this.minX = w.globals.minY + this.maxX = w.globals.maxY + } + + // avoid zooming out beyond 1000 which may result in NaN values being printed on x-axis + if ( + w.config.xaxis.type === 'datetime' && + new Date(this.minX).getUTCFullYear() < 1000 + ) { + return + } + + const centerX = (this.minX + this.maxX) / 2 + let newMinX = this.minX - (centerX - this.minX) + let newMaxX = this.maxX - (centerX - this.maxX) + + const newMinXMaxX = this._getNewMinXMaxX(newMinX, newMaxX) + + if (!w.globals.disableZoomOut) { + this.zoomUpdateOptions(newMinXMaxX.minX, newMinXMaxX.maxX) + } + } + + _getNewMinXMaxX(newMinX, newMaxX) { + const shouldFloor = this.w.config.xaxis.convertedCatToNumeric + return { + minX: shouldFloor ? Math.floor(newMinX) : newMinX, + maxX: shouldFloor ? Math.floor(newMaxX) : newMaxX, + } + } + + zoomUpdateOptions(newMinX, newMaxX) { + const w = this.w + + if (newMinX === undefined && newMaxX === undefined) { + this.handleZoomReset() + return + } + + if (w.config.xaxis.convertedCatToNumeric) { + // in category charts, avoid zooming out beyond min and max + if (newMinX < 1) { + newMinX = 1 + newMaxX = w.globals.dataPoints + } + + if (newMaxX - newMinX < 2) { + return + } + } + + let xaxis = { + min: newMinX, + max: newMaxX, + } + + const beforeZoomRange = this.getBeforeZoomRange(xaxis) + if (beforeZoomRange) { + xaxis = beforeZoomRange.xaxis + } + + let options = { + xaxis, + } + + let yaxis = Utils.clone(w.globals.initialConfig.yaxis) + + if (!w.config.chart.group) { + // if chart in a group, prevent yaxis update here + // fix issue #650 + options.yaxis = yaxis + } + + this.w.globals.zoomed = true + + this.ctx.updateHelpers._updateOptions( + options, + false, + this.w.config.chart.animations.dynamicAnimation.enabled + ) + + this.zoomCallback(xaxis, yaxis) + } + + zoomCallback(xaxis, yaxis) { + if (typeof this.ev.zoomed === 'function') { + this.ev.zoomed(this.ctx, { xaxis, yaxis }) + } + } + + getBeforeZoomRange(xaxis, yaxis) { + let newRange = null + if (typeof this.ev.beforeZoom === 'function') { + newRange = this.ev.beforeZoom(this, { xaxis, yaxis }) + } + + return newRange + } + + toggleMenu() { + window.setTimeout(() => { + if (this.elMenu.classList.contains('apexcharts-menu-open')) { + this.elMenu.classList.remove('apexcharts-menu-open') + } else { + this.elMenu.classList.add('apexcharts-menu-open') + } + }, 0) + } + + handleDownload(type) { + const w = this.w + const exprt = new Exports(this.ctx) + switch (type) { + case 'svg': + exprt.exportToSVG(this.ctx) + break + case 'png': + exprt.exportToPng(this.ctx) + break + case 'csv': + exprt.exportToCSV({ + series: w.config.series, + columnDelimiter: w.config.chart.toolbar.export.csv.columnDelimiter, + }) + break + } + } + + handleZoomReset(e) { + const charts = this.ctx.getSyncedCharts() + + charts.forEach((ch) => { + let w = ch.w + + // forget lastXAxis min/max as reset button isn't resetting the x-axis completely if zoomX is called before + w.globals.lastXAxis.min = w.globals.initialConfig.xaxis.min + w.globals.lastXAxis.max = w.globals.initialConfig.xaxis.max + + ch.updateHelpers.revertDefaultAxisMinMax() + + if (typeof w.config.chart.events.beforeResetZoom === 'function') { + // here, user get an option to control xaxis and yaxis when resetZoom is called + // at this point, whatever is returned from w.config.chart.events.beforeResetZoom + // is set as the new xaxis/yaxis min/max + const resetZoomRange = w.config.chart.events.beforeResetZoom(ch, w) + + if (resetZoomRange) { + ch.updateHelpers.revertDefaultAxisMinMax(resetZoomRange) + } + } + + if (typeof w.config.chart.events.zoomed === 'function') { + ch.ctx.toolbar.zoomCallback({ + min: w.config.xaxis.min, + max: w.config.xaxis.max, + }) + } + + w.globals.zoomed = false + + // if user has some series collapsed before hitting zoom reset button, + // those series should stay collapsed + let series = ch.ctx.series.emptyCollapsedSeries( + Utils.clone(w.globals.initialSeries) + ) + + ch.updateHelpers._updateSeries( + series, + w.config.chart.animations.dynamicAnimation.enabled + ) + }) + } + + destroy() { + this.elZoom = null + this.elZoomIn = null + this.elZoomOut = null + this.elPan = null + this.elSelection = null + this.elZoomReset = null + this.elMenuIcon = null + } +} diff --git a/node_modules/apexcharts/src/modules/ZoomPanSelection.js b/node_modules/apexcharts/src/modules/ZoomPanSelection.js new file mode 100644 index 0000000..199a96c --- /dev/null +++ b/node_modules/apexcharts/src/modules/ZoomPanSelection.js @@ -0,0 +1,949 @@ +import Graphics from './Graphics' +import Utils from './../utils/Utils' +import Toolbar from './Toolbar' +import { Box } from '@svgdotjs/svg.js' + +/** + * ApexCharts Zoom Class for handling zooming and panning on axes based charts. + * + * @module ZoomPanSelection + **/ + +export default class ZoomPanSelection extends Toolbar { + constructor(ctx) { + super(ctx) + + this.ctx = ctx + this.w = ctx.w + + this.dragged = false + this.graphics = new Graphics(this.ctx) + + this.eventList = [ + 'mousedown', + 'mouseleave', + 'mousemove', + 'touchstart', + 'touchmove', + 'mouseup', + 'touchend', + 'wheel', + ] + + this.clientX = 0 + this.clientY = 0 + this.startX = 0 + this.endX = 0 + this.dragX = 0 + this.startY = 0 + this.endY = 0 + this.dragY = 0 + this.moveDirection = 'none' + + this.debounceTimer = null + this.debounceDelay = 100 + this.wheelDelay = 400 + } + + init({ xyRatios }) { + let w = this.w + let me = this + + this.xyRatios = xyRatios + + this.zoomRect = this.graphics.drawRect(0, 0, 0, 0) + this.selectionRect = this.graphics.drawRect(0, 0, 0, 0) + + this.gridRect = w.globals.dom.baseEl.querySelector('.apexcharts-grid') + this.constraints = new Box(0, 0, w.globals.gridWidth, w.globals.gridHeight) + + this.zoomRect.node.classList.add('apexcharts-zoom-rect') + this.selectionRect.node.classList.add('apexcharts-selection-rect') + w.globals.dom.Paper.add(this.zoomRect) + w.globals.dom.Paper.add(this.selectionRect) + + if (w.config.chart.selection.type === 'x') { + this.slDraggableRect = this.selectionRect + .draggable({ + minX: 0, + minY: 0, + maxX: w.globals.gridWidth, + maxY: w.globals.gridHeight, + }) + .on('dragmove.namespace', this.selectionDragging.bind(this, 'dragging')) + } else if (w.config.chart.selection.type === 'y') { + this.slDraggableRect = this.selectionRect + .draggable({ + minX: 0, + maxX: w.globals.gridWidth, + }) + .on('dragmove.namespace', this.selectionDragging.bind(this, 'dragging')) + } else { + this.slDraggableRect = this.selectionRect + .draggable() + .on('dragmove.namespace', this.selectionDragging.bind(this, 'dragging')) + } + this.preselectedSelection() + + this.hoverArea = w.globals.dom.baseEl.querySelector( + `${w.globals.chartClass} .apexcharts-svg` + ) + this.hoverArea.classList.add('apexcharts-zoomable') + + this.eventList.forEach((event) => { + this.hoverArea.addEventListener( + event, + me.svgMouseEvents.bind(me, xyRatios), + { + capture: false, + passive: true, + } + ) + }) + + if ( + w.config.chart.zoom.enabled && + w.config.chart.zoom.allowMouseWheelZoom + ) { + this.hoverArea.addEventListener('wheel', me.mouseWheelEvent.bind(me), { + capture: false, + passive: false, + }) + } + } + + // remove the event listeners which were previously added on hover area + destroy() { + if (this.slDraggableRect) { + this.slDraggableRect.draggable(false) + this.slDraggableRect.off() + this.selectionRect.off() + } + + this.selectionRect = null + this.zoomRect = null + this.gridRect = null + } + + svgMouseEvents(xyRatios, e) { + let w = this.w + const toolbar = this.ctx.toolbar + + let zoomtype = w.globals.zoomEnabled + ? w.config.chart.zoom.type + : w.config.chart.selection.type + + const autoSelected = w.config.chart.toolbar.autoSelected + + if (e.shiftKey) { + this.shiftWasPressed = true + toolbar.enableZoomPanFromToolbar(autoSelected === 'pan' ? 'zoom' : 'pan') + } else { + if (this.shiftWasPressed) { + toolbar.enableZoomPanFromToolbar(autoSelected) + this.shiftWasPressed = false + } + } + + if (!e.target) return + + const tc = e.target.classList + let pc + if (e.target.parentNode && e.target.parentNode !== null) { + pc = e.target.parentNode.classList + } + const falsePositives = + tc.contains('apexcharts-legend-marker') || + tc.contains('apexcharts-legend-text') || + (pc && pc.contains('apexcharts-toolbar')) + + if (falsePositives) return + + this.clientX = + e.type === 'touchmove' || e.type === 'touchstart' + ? e.touches[0].clientX + : e.type === 'touchend' + ? e.changedTouches[0].clientX + : e.clientX + this.clientY = + e.type === 'touchmove' || e.type === 'touchstart' + ? e.touches[0].clientY + : e.type === 'touchend' + ? e.changedTouches[0].clientY + : e.clientY + + if ((e.type === 'mousedown' && e.which === 1) || e.type === 'touchstart') { + let gridRectDim = this.gridRect.getBoundingClientRect() + + this.startX = + this.clientX - gridRectDim.left - w.globals.barPadForNumericAxis + this.startY = this.clientY - gridRectDim.top + + this.dragged = false + this.w.globals.mousedown = true + } + + if ((e.type === 'mousemove' && e.which === 1) || e.type === 'touchmove') { + this.dragged = true + + if (w.globals.panEnabled) { + w.globals.selection = null + if (this.w.globals.mousedown) { + this.panDragging({ + context: this, + zoomtype, + xyRatios, + }) + } + } else { + if ( + (this.w.globals.mousedown && w.globals.zoomEnabled) || + (this.w.globals.mousedown && w.globals.selectionEnabled) + ) { + this.selection = this.selectionDrawing({ + context: this, + zoomtype, + }) + } + } + } + + if ( + e.type === 'mouseup' || + e.type === 'touchend' || + e.type === 'mouseleave' + ) { + this.handleMouseUp({ zoomtype }) + } + + this.makeSelectionRectDraggable() + } + + handleMouseUp({ zoomtype, isResized }) { + const w = this.w + // we will be calling getBoundingClientRect on each mousedown/mousemove/mouseup + let gridRectDim = this.gridRect?.getBoundingClientRect() + + if (gridRectDim && (this.w.globals.mousedown || isResized)) { + // user released the drag, now do all the calculations + this.endX = + this.clientX - gridRectDim.left - w.globals.barPadForNumericAxis + this.endY = this.clientY - gridRectDim.top + this.dragX = Math.abs(this.endX - this.startX) + this.dragY = Math.abs(this.endY - this.startY) + + if (w.globals.zoomEnabled || w.globals.selectionEnabled) { + this.selectionDrawn({ + context: this, + zoomtype, + }) + } + + if (w.globals.panEnabled && w.config.xaxis.convertedCatToNumeric) { + this.delayedPanScrolled() + } + } + + if (w.globals.zoomEnabled) { + this.hideSelectionRect(this.selectionRect) + } + + this.dragged = false + this.w.globals.mousedown = false + } + + mouseWheelEvent(e) { + const w = this.w + e.preventDefault() + + const now = Date.now() + + // Execute immediately if it's the first action or enough time has passed + if (now - w.globals.lastWheelExecution > this.wheelDelay) { + this.executeMouseWheelZoom(e) + w.globals.lastWheelExecution = now + } + + if (this.debounceTimer) clearTimeout(this.debounceTimer) + + this.debounceTimer = setTimeout(() => { + if (now - w.globals.lastWheelExecution > this.wheelDelay) { + this.executeMouseWheelZoom(e) + w.globals.lastWheelExecution = now + } + }, this.debounceDelay) + } + + executeMouseWheelZoom(e) { + const w = this.w + this.minX = w.globals.isRangeBar ? w.globals.minY : w.globals.minX + this.maxX = w.globals.isRangeBar ? w.globals.maxY : w.globals.maxX + + // Calculate the relative position of the mouse on the chart + const gridRectDim = this.gridRect?.getBoundingClientRect() + if (!gridRectDim) return + + const mouseX = (e.clientX - gridRectDim.left) / gridRectDim.width + + const currentMinX = this.minX + const currentMaxX = this.maxX + const totalX = currentMaxX - currentMinX + + // Determine zoom factor + const zoomFactorIn = 0.5 + const zoomFactorOut = 1.5 + let zoomRange + + let newMinX, newMaxX + if (e.deltaY < 0) { + // Zoom In + zoomRange = zoomFactorIn * totalX + const midPoint = currentMinX + mouseX * totalX + newMinX = midPoint - zoomRange / 2 + newMaxX = midPoint + zoomRange / 2 + } else { + // Zoom Out + zoomRange = zoomFactorOut * totalX + newMinX = currentMinX - zoomRange / 2 + newMaxX = currentMaxX + zoomRange / 2 + } + + // Constrain within original chart bounds + if (!w.globals.isRangeBar) { + newMinX = Math.max(newMinX, w.globals.initialMinX) + newMaxX = Math.min(newMaxX, w.globals.initialMaxX) + + // Ensure minimum range + const minRange = (w.globals.initialMaxX - w.globals.initialMinX) * 0.01 + if (newMaxX - newMinX < minRange) { + const midPoint = (newMinX + newMaxX) / 2 + newMinX = midPoint - minRange / 2 + newMaxX = midPoint + minRange / 2 + } + } + + const newMinXMaxX = this._getNewMinXMaxX(newMinX, newMaxX) + + // Apply zoom if valid + if (!isNaN(newMinXMaxX.minX) && !isNaN(newMinXMaxX.maxX)) { + this.zoomUpdateOptions(newMinXMaxX.minX, newMinXMaxX.maxX) + } + } + + makeSelectionRectDraggable() { + const w = this.w + + if (!this.selectionRect) return + + const rectDim = this.selectionRect.node.getBoundingClientRect() + if (rectDim.width > 0 && rectDim.height > 0) { + this.selectionRect.select(false).resize(false) + this.selectionRect + .select({ + createRot: () => {}, + updateRot: () => {}, + createHandle: (group, p, index, pointArr, handleName) => { + if (handleName === 'l' || handleName === 'r') + return group + .circle(8) + .css({ 'stroke-width': 1, stroke: '#333', fill: '#fff' }) + return group.circle(0) + }, + updateHandle: (group, p) => { + return group.center(p[0], p[1]) + }, + }) + .resize() + .on('resize', () => { + let zoomtype = w.globals.zoomEnabled + ? w.config.chart.zoom.type + : w.config.chart.selection.type + + this.handleMouseUp({ zoomtype, isResized: true }) + }) + } + } + + preselectedSelection() { + const w = this.w + const xyRatios = this.xyRatios + + if (!w.globals.zoomEnabled) { + if ( + typeof w.globals.selection !== 'undefined' && + w.globals.selection !== null + ) { + this.drawSelectionRect({ + ...w.globals.selection, + translateX: w.globals.translateX, + translateY: w.globals.translateY, + }) + } else { + if ( + w.config.chart.selection.xaxis.min !== undefined && + w.config.chart.selection.xaxis.max !== undefined + ) { + let x = + (w.config.chart.selection.xaxis.min - w.globals.minX) / + xyRatios.xRatio + let width = + w.globals.gridWidth - + (w.globals.maxX - w.config.chart.selection.xaxis.max) / + xyRatios.xRatio - + x + if (w.globals.isRangeBar) { + // rangebars put datetime data in y axis + x = + (w.config.chart.selection.xaxis.min - + w.globals.yAxisScale[0].niceMin) / + xyRatios.invertedYRatio + width = + (w.config.chart.selection.xaxis.max - + w.config.chart.selection.xaxis.min) / + xyRatios.invertedYRatio + } + let selectionRect = { + x, + y: 0, + width, + height: w.globals.gridHeight, + translateX: w.globals.translateX, + translateY: w.globals.translateY, + selectionEnabled: true, + } + this.drawSelectionRect(selectionRect) + this.makeSelectionRectDraggable() + if (typeof w.config.chart.events.selection === 'function') { + w.config.chart.events.selection(this.ctx, { + xaxis: { + min: w.config.chart.selection.xaxis.min, + max: w.config.chart.selection.xaxis.max, + }, + yaxis: {}, + }) + } + } + } + } + } + + drawSelectionRect({ x, y, width, height, translateX = 0, translateY = 0 }) { + const w = this.w + const zoomRect = this.zoomRect + const selectionRect = this.selectionRect + if (this.dragged || w.globals.selection !== null) { + let scalingAttrs = { + transform: 'translate(' + translateX + ', ' + translateY + ')', + } + + // change styles based on zoom or selection + // zoom is Enabled and user has dragged, so draw blue rect + if (w.globals.zoomEnabled && this.dragged) { + if (width < 0) width = 1 // fixes apexcharts.js#1168 + zoomRect.attr({ + x, + y, + width, + height, + fill: w.config.chart.zoom.zoomedArea.fill.color, + 'fill-opacity': w.config.chart.zoom.zoomedArea.fill.opacity, + stroke: w.config.chart.zoom.zoomedArea.stroke.color, + 'stroke-width': w.config.chart.zoom.zoomedArea.stroke.width, + 'stroke-opacity': w.config.chart.zoom.zoomedArea.stroke.opacity, + }) + Graphics.setAttrs(zoomRect.node, scalingAttrs) + } + + // selection is enabled + if (w.globals.selectionEnabled) { + selectionRect.attr({ + x, + y, + width: width > 0 ? width : 0, + height: height > 0 ? height : 0, + fill: w.config.chart.selection.fill.color, + 'fill-opacity': w.config.chart.selection.fill.opacity, + stroke: w.config.chart.selection.stroke.color, + 'stroke-width': w.config.chart.selection.stroke.width, + 'stroke-dasharray': w.config.chart.selection.stroke.dashArray, + 'stroke-opacity': w.config.chart.selection.stroke.opacity, + }) + + Graphics.setAttrs(selectionRect.node, scalingAttrs) + } + } + } + + hideSelectionRect(rect) { + if (rect) { + rect.attr({ + x: 0, + y: 0, + width: 0, + height: 0, + }) + } + } + + selectionDrawing({ context, zoomtype }) { + const w = this.w + let me = context + + let gridRectDim = this.gridRect.getBoundingClientRect() + + let startX = me.startX - 1 + let startY = me.startY + let inversedX = false + let inversedY = false + + const left = me.clientX - gridRectDim.left - w.globals.barPadForNumericAxis + const top = me.clientY - gridRectDim.top + + let selectionWidth = left - startX + let selectionHeight = top - startY + + let selectionRect = { + translateX: w.globals.translateX, + translateY: w.globals.translateY, + } + + if (Math.abs(selectionWidth + startX) > w.globals.gridWidth) { + // user dragged the mouse outside drawing area to the right + selectionWidth = w.globals.gridWidth - startX + } else if (left < 0) { + // user dragged the mouse outside drawing area to the left + selectionWidth = startX + } + + // inverse selection X + if (startX > left) { + inversedX = true + selectionWidth = Math.abs(selectionWidth) + } + + // inverse selection Y + if (startY > top) { + inversedY = true + selectionHeight = Math.abs(selectionHeight) + } + + if (zoomtype === 'x') { + selectionRect = { + x: inversedX ? startX - selectionWidth : startX, + y: 0, + width: selectionWidth, + height: w.globals.gridHeight, + } + } else if (zoomtype === 'y') { + selectionRect = { + x: 0, + y: inversedY ? startY - selectionHeight : startY, + width: w.globals.gridWidth, + height: selectionHeight, + } + } else { + selectionRect = { + x: inversedX ? startX - selectionWidth : startX, + y: inversedY ? startY - selectionHeight : startY, + width: selectionWidth, + height: selectionHeight, + } + } + + selectionRect = { + ...selectionRect, + translateX: w.globals.translateX, + translateY: w.globals.translateY, + } + + me.drawSelectionRect(selectionRect) + me.selectionDragging('resizing') + return selectionRect + } + + selectionDragging(type, e) { + const w = this.w + if (!e) return + + e.preventDefault() + + const { handler, box } = e.detail + + let { x, y } = box + + if (x < this.constraints.x) { + x = this.constraints.x + } + + if (y < this.constraints.y) { + y = this.constraints.y + } + + if (box.x2 > this.constraints.x2) { + x = this.constraints.x2 - box.w + } + + if (box.y2 > this.constraints.y2) { + y = this.constraints.y2 - box.h + } + + handler.move(x, y) + + const xyRatios = this.xyRatios + + const selRect = this.selectionRect + + let timerInterval = 0 + + if (type === 'resizing') { + timerInterval = 30 + } + + // update selection when selection rect is dragged + const getSelAttr = (attr) => { + return parseFloat(selRect.node.getAttribute(attr)) + } + const draggedProps = { + x: getSelAttr('x'), + y: getSelAttr('y'), + width: getSelAttr('width'), + height: getSelAttr('height'), + } + + w.globals.selection = draggedProps + // update selection ends + + if ( + typeof w.config.chart.events.selection === 'function' && + w.globals.selectionEnabled + ) { + // a small debouncer is required when resizing to avoid freezing the chart + clearTimeout(this.w.globals.selectionResizeTimer) + this.w.globals.selectionResizeTimer = window.setTimeout(() => { + const gridRectDim = this.gridRect.getBoundingClientRect() + const selectionRect = selRect.node.getBoundingClientRect() + + let minX, maxX, minY, maxY + + if (!w.globals.isRangeBar) { + // normal XY charts + minX = + w.globals.xAxisScale.niceMin + + (selectionRect.left - gridRectDim.left) * xyRatios.xRatio + maxX = + w.globals.xAxisScale.niceMin + + (selectionRect.right - gridRectDim.left) * xyRatios.xRatio + + minY = + w.globals.yAxisScale[0].niceMin + + (gridRectDim.bottom - selectionRect.bottom) * xyRatios.yRatio[0] + maxY = + w.globals.yAxisScale[0].niceMax - + (selectionRect.top - gridRectDim.top) * xyRatios.yRatio[0] + } else { + // rangeBars use y for datetime + minX = + w.globals.yAxisScale[0].niceMin + + (selectionRect.left - gridRectDim.left) * xyRatios.invertedYRatio + maxX = + w.globals.yAxisScale[0].niceMin + + (selectionRect.right - gridRectDim.left) * xyRatios.invertedYRatio + + minY = 0 + maxY = 1 + } + + const xyAxis = { + xaxis: { + min: minX, + max: maxX, + }, + yaxis: { + min: minY, + max: maxY, + }, + } + w.config.chart.events.selection(this.ctx, xyAxis) + + if ( + w.config.chart.brush.enabled && + w.config.chart.events.brushScrolled !== undefined + ) { + w.config.chart.events.brushScrolled(this.ctx, xyAxis) + } + }, timerInterval) + } + } + + selectionDrawn({ context, zoomtype }) { + const w = this.w + const me = context + const xyRatios = this.xyRatios + const toolbar = this.ctx.toolbar + + // Use boundingRect for final selection area + const selRect = w.globals.zoomEnabled + ? me.zoomRect.node.getBoundingClientRect() + : me.selectionRect.node.getBoundingClientRect() + const gridRectDim = me.gridRect.getBoundingClientRect() + + // Local coords in the chart's grid + const localStartX = + selRect.left - gridRectDim.left - w.globals.barPadForNumericAxis + const localEndX = + selRect.right - gridRectDim.left - w.globals.barPadForNumericAxis + const localStartY = selRect.top - gridRectDim.top + const localEndY = selRect.bottom - gridRectDim.top + + // Convert those local coords to actual data values + let xLowestValue, xHighestValue + + if (!w.globals.isRangeBar) { + xLowestValue = + w.globals.xAxisScale.niceMin + localStartX * xyRatios.xRatio + xHighestValue = w.globals.xAxisScale.niceMin + localEndX * xyRatios.xRatio + } else { + xLowestValue = + w.globals.yAxisScale[0].niceMin + localStartX * xyRatios.invertedYRatio + xHighestValue = + w.globals.yAxisScale[0].niceMin + localEndX * xyRatios.invertedYRatio + } + + // For Y values, pick from the first y-axis, but handle multi-axis + let yHighestValue = [] + let yLowestValue = [] + + w.config.yaxis.forEach((yaxe, index) => { + // pick whichever series is mapped to this y-axis + let seriesIndex = w.globals.seriesYAxisMap[index][0] + let highestVal = + w.globals.yAxisScale[index].niceMax - + xyRatios.yRatio[seriesIndex] * localStartY + let lowestVal = + w.globals.yAxisScale[index].niceMax - + xyRatios.yRatio[seriesIndex] * localEndY + + yHighestValue.push(highestVal) + yLowestValue.push(lowestVal) + }) + + // Only apply if user actually dragged far enough to consider it a selection + if ( + me.dragged && + (me.dragX > 10 || me.dragY > 10) && + xLowestValue !== xHighestValue + ) { + if (w.globals.zoomEnabled) { + let yaxis = Utils.clone(w.globals.initialConfig.yaxis) + let xaxis = Utils.clone(w.globals.initialConfig.xaxis) + + w.globals.zoomed = true + + if (w.config.xaxis.convertedCatToNumeric) { + xLowestValue = Math.floor(xLowestValue) + xHighestValue = Math.floor(xHighestValue) + + if (xLowestValue < 1) { + xLowestValue = 1 + xHighestValue = w.globals.dataPoints + } + + if (xHighestValue - xLowestValue < 2) { + xHighestValue = xLowestValue + 1 + } + } + + if (zoomtype === 'xy' || zoomtype === 'x') { + xaxis = { + min: xLowestValue, + max: xHighestValue, + } + } + + if (zoomtype === 'xy' || zoomtype === 'y') { + yaxis.forEach((yaxe, index) => { + yaxis[index].min = yLowestValue[index] + yaxis[index].max = yHighestValue[index] + }) + } + + if (toolbar) { + let beforeZoomRange = toolbar.getBeforeZoomRange(xaxis, yaxis) + if (beforeZoomRange) { + xaxis = beforeZoomRange.xaxis ? beforeZoomRange.xaxis : xaxis + yaxis = beforeZoomRange.yaxis ? beforeZoomRange.yaxis : yaxis + } + } + + let options = { + xaxis, + } + + if (!w.config.chart.group) { + // if chart in a group, prevent yaxis update here + // fix issue #650 + options.yaxis = yaxis + } + me.ctx.updateHelpers._updateOptions( + options, + false, + me.w.config.chart.animations.dynamicAnimation.enabled + ) + + if (typeof w.config.chart.events.zoomed === 'function') { + toolbar.zoomCallback(xaxis, yaxis) + } + } else if (w.globals.selectionEnabled) { + let yaxis = null + let xaxis = null + xaxis = { + min: xLowestValue, + max: xHighestValue, + } + if (zoomtype === 'xy' || zoomtype === 'y') { + yaxis = Utils.clone(w.config.yaxis) + yaxis.forEach((yaxe, index) => { + yaxis[index].min = yLowestValue[index] + yaxis[index].max = yHighestValue[index] + }) + } + + w.globals.selection = me.selection + if (typeof w.config.chart.events.selection === 'function') { + w.config.chart.events.selection(me.ctx, { + xaxis, + yaxis, + }) + } + } + } + } + + panDragging({ context }) { + const w = this.w + let me = context + + // check to make sure there is data to compare against + if (typeof w.globals.lastClientPosition.x !== 'undefined') { + // get the change from last position to this position + const deltaX = w.globals.lastClientPosition.x - me.clientX + const deltaY = w.globals.lastClientPosition.y - me.clientY + + // check which direction had the highest amplitude + if (Math.abs(deltaX) > Math.abs(deltaY) && deltaX > 0) { + this.moveDirection = 'left' + } else if (Math.abs(deltaX) > Math.abs(deltaY) && deltaX < 0) { + this.moveDirection = 'right' + } else if (Math.abs(deltaY) > Math.abs(deltaX) && deltaY > 0) { + this.moveDirection = 'up' + } else if (Math.abs(deltaY) > Math.abs(deltaX) && deltaY < 0) { + this.moveDirection = 'down' + } + } + + // set the new last position to the current for next time (to get the position of drag) + w.globals.lastClientPosition = { + x: me.clientX, + y: me.clientY, + } + + let xLowestValue = w.globals.isRangeBar ? w.globals.minY : w.globals.minX + + let xHighestValue = w.globals.isRangeBar ? w.globals.maxY : w.globals.maxX + + // on a category, we don't pan continuously as it causes bugs + if (!w.config.xaxis.convertedCatToNumeric) { + me.panScrolled(xLowestValue, xHighestValue) + } + } + + delayedPanScrolled() { + const w = this.w + + let newMinX = w.globals.minX + let newMaxX = w.globals.maxX + const centerX = (w.globals.maxX - w.globals.minX) / 2 + + if (this.moveDirection === 'left') { + newMinX = w.globals.minX + centerX + newMaxX = w.globals.maxX + centerX + } else if (this.moveDirection === 'right') { + newMinX = w.globals.minX - centerX + newMaxX = w.globals.maxX - centerX + } + + newMinX = Math.floor(newMinX) + newMaxX = Math.floor(newMaxX) + this.updateScrolledChart( + { xaxis: { min: newMinX, max: newMaxX } }, + newMinX, + newMaxX + ) + } + + panScrolled(xLowestValue, xHighestValue) { + const w = this.w + + const xyRatios = this.xyRatios + let yaxis = Utils.clone(w.globals.initialConfig.yaxis) + + let xRatio = xyRatios.xRatio + let minX = w.globals.minX + let maxX = w.globals.maxX + if (w.globals.isRangeBar) { + xRatio = xyRatios.invertedYRatio + minX = w.globals.minY + maxX = w.globals.maxY + } + + if (this.moveDirection === 'left') { + xLowestValue = minX + (w.globals.gridWidth / 15) * xRatio + xHighestValue = maxX + (w.globals.gridWidth / 15) * xRatio + } else if (this.moveDirection === 'right') { + xLowestValue = minX - (w.globals.gridWidth / 15) * xRatio + xHighestValue = maxX - (w.globals.gridWidth / 15) * xRatio + } + + if (!w.globals.isRangeBar) { + if ( + xLowestValue < w.globals.initialMinX || + xHighestValue > w.globals.initialMaxX + ) { + xLowestValue = minX + xHighestValue = maxX + } + } + + let xaxis = { + min: xLowestValue, + max: xHighestValue, + } + + let options = { + xaxis, + } + + if (!w.config.chart.group) { + // if chart in a group, prevent yaxis update here + // fix issue #650 + options.yaxis = yaxis + } + + this.updateScrolledChart(options, xLowestValue, xHighestValue) + } + + updateScrolledChart(options, xLowestValue, xHighestValue) { + const w = this.w + + this.ctx.updateHelpers._updateOptions(options, false, false) + + if (typeof w.config.chart.events.scrolled === 'function') { + w.config.chart.events.scrolled(this.ctx, { + xaxis: { + min: xLowestValue, + max: xHighestValue, + }, + }) + } + } +} diff --git a/node_modules/apexcharts/src/modules/annotations/Annotations.js b/node_modules/apexcharts/src/modules/annotations/Annotations.js new file mode 100644 index 0000000..cfe1c84 --- /dev/null +++ b/node_modules/apexcharts/src/modules/annotations/Annotations.js @@ -0,0 +1,325 @@ +import Graphics from '../../modules/Graphics' +import Utils from '../../utils/Utils' +import Helpers from './Helpers' +import XAxisAnnotations from './XAxisAnnotations' +import YAxisAnnotations from './YAxisAnnotations' +import PointsAnnotations from './PointsAnnotations' +import Options from './../settings/Options' + +/** + * ApexCharts Annotations Class for drawing lines/rects on both xaxis and yaxis. + * + * @module Annotations + **/ +export default class Annotations { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + this.graphics = new Graphics(this.ctx) + + if (this.w.globals.isBarHorizontal) { + this.invertAxis = true + } + + this.helpers = new Helpers(this) + this.xAxisAnnotations = new XAxisAnnotations(this) + this.yAxisAnnotations = new YAxisAnnotations(this) + this.pointsAnnotations = new PointsAnnotations(this) + + if (this.w.globals.isBarHorizontal && this.w.config.yaxis[0].reversed) { + this.inversedReversedAxis = true + } + + this.xDivision = this.w.globals.gridWidth / this.w.globals.dataPoints + } + + drawAxesAnnotations() { + const w = this.w + if (w.globals.axisCharts && w.globals.dataPoints) { + // w.globals.dataPoints check added to fix #1832 + let yAnnotations = this.yAxisAnnotations.drawYAxisAnnotations() + let xAnnotations = this.xAxisAnnotations.drawXAxisAnnotations() + let pointAnnotations = this.pointsAnnotations.drawPointAnnotations() + + const initialAnim = w.config.chart.animations.enabled + + const annoArray = [yAnnotations, xAnnotations, pointAnnotations] + const annoElArray = [ + xAnnotations.node, + yAnnotations.node, + pointAnnotations.node, + ] + for (let i = 0; i < 3; i++) { + w.globals.dom.elGraphical.add(annoArray[i]) + if (initialAnim && !w.globals.resized && !w.globals.dataChanged) { + // fixes apexcharts/apexcharts.js#685 + if ( + w.config.chart.type !== 'scatter' && + w.config.chart.type !== 'bubble' && + w.globals.dataPoints > 1 + ) { + annoElArray[i].classList.add('apexcharts-element-hidden') + } + } + w.globals.delayedElements.push({ el: annoElArray[i], index: 0 }) + } + + // background sizes needs to be calculated after text is drawn, so calling them last + this.helpers.annotationsBackground() + } + } + + drawImageAnnos() { + const w = this.w + + w.config.annotations.images.map((s, index) => { + this.addImage(s, index) + }) + } + + drawTextAnnos() { + const w = this.w + + w.config.annotations.texts.map((t, index) => { + this.addText(t, index) + }) + } + + addXaxisAnnotation(anno, parent, index) { + this.xAxisAnnotations.addXaxisAnnotation(anno, parent, index) + } + + addYaxisAnnotation(anno, parent, index) { + this.yAxisAnnotations.addYaxisAnnotation(anno, parent, index) + } + + addPointAnnotation(anno, parent, index) { + this.pointsAnnotations.addPointAnnotation(anno, parent, index) + } + + addText(params, index) { + const { + x, + y, + text, + textAnchor, + foreColor, + fontSize, + fontFamily, + fontWeight, + cssClass, + backgroundColor, + borderWidth, + strokeDashArray, + borderRadius, + borderColor, + appendTo = '.apexcharts-svg', + paddingLeft = 4, + paddingRight = 4, + paddingBottom = 2, + paddingTop = 2, + } = params + + const w = this.w + + let elText = this.graphics.drawText({ + x, + y, + text, + textAnchor: textAnchor || 'start', + fontSize: fontSize || '12px', + fontWeight: fontWeight || 'regular', + fontFamily: fontFamily || w.config.chart.fontFamily, + foreColor: foreColor || w.config.chart.foreColor, + cssClass: 'apexcharts-text ' + cssClass ? cssClass : '', + }) + + const parent = w.globals.dom.baseEl.querySelector(appendTo) + if (parent) { + parent.appendChild(elText.node) + } + + const textRect = elText.bbox() + + if (text) { + const elRect = this.graphics.drawRect( + textRect.x - paddingLeft, + textRect.y - paddingTop, + textRect.width + paddingLeft + paddingRight, + textRect.height + paddingBottom + paddingTop, + borderRadius, + backgroundColor ? backgroundColor : 'transparent', + 1, + borderWidth, + borderColor, + strokeDashArray + ) + + parent.insertBefore(elRect.node, elText.node) + } + } + + addImage(params, index) { + const w = this.w + + const { + path, + x = 0, + y = 0, + width = 20, + height = 20, + appendTo = '.apexcharts-svg', + } = params + + let img = w.globals.dom.Paper.image(path) + img.size(width, height).move(x, y) + + const parent = w.globals.dom.baseEl.querySelector(appendTo) + if (parent) { + parent.appendChild(img.node) + } + + return img + } + + // The addXaxisAnnotation method requires a parent class, and user calling this method externally on the chart instance may not specify parent, hence a different method + addXaxisAnnotationExternal(params, pushToMemory, context) { + this.addAnnotationExternal({ + params, + pushToMemory, + context, + type: 'xaxis', + contextMethod: context.addXaxisAnnotation, + }) + return context + } + + addYaxisAnnotationExternal(params, pushToMemory, context) { + this.addAnnotationExternal({ + params, + pushToMemory, + context, + type: 'yaxis', + contextMethod: context.addYaxisAnnotation, + }) + return context + } + + addPointAnnotationExternal(params, pushToMemory, context) { + if (typeof this.invertAxis === 'undefined') { + this.invertAxis = context.w.globals.isBarHorizontal + } + + this.addAnnotationExternal({ + params, + pushToMemory, + context, + type: 'point', + contextMethod: context.addPointAnnotation, + }) + return context + } + + addAnnotationExternal({ + params, + pushToMemory, + context, + type, + contextMethod, + }) { + const me = context + const w = me.w + const parent = w.globals.dom.baseEl.querySelector( + `.apexcharts-${type}-annotations` + ) + const index = parent.childNodes.length + 1 + + const options = new Options() + const axesAnno = Object.assign( + {}, + type === 'xaxis' + ? options.xAxisAnnotation + : type === 'yaxis' + ? options.yAxisAnnotation + : options.pointAnnotation + ) + + const anno = Utils.extend(axesAnno, params) + + switch (type) { + case 'xaxis': + this.addXaxisAnnotation(anno, parent, index) + break + case 'yaxis': + this.addYaxisAnnotation(anno, parent, index) + break + case 'point': + this.addPointAnnotation(anno, parent, index) + break + } + + // add background + let axesAnnoLabel = w.globals.dom.baseEl.querySelector( + `.apexcharts-${type}-annotations .apexcharts-${type}-annotation-label[rel='${index}']` + ) + const elRect = this.helpers.addBackgroundToAnno(axesAnnoLabel, anno) + if (elRect) { + parent.insertBefore(elRect.node, axesAnnoLabel) + } + + if (pushToMemory) { + w.globals.memory.methodsToExec.push({ + context: me, + id: anno.id ? anno.id : Utils.randomId(), + method: contextMethod, + label: 'addAnnotation', + params, + }) + } + + return context + } + + clearAnnotations(ctx) { + const w = ctx.w + let annos = w.globals.dom.baseEl.querySelectorAll( + '.apexcharts-yaxis-annotations, .apexcharts-xaxis-annotations, .apexcharts-point-annotations' + ) + + // annotations added externally should be cleared out too + for (let i = w.globals.memory.methodsToExec.length - 1; i >= 0; i--) { + if ( + w.globals.memory.methodsToExec[i].label === 'addText' || + w.globals.memory.methodsToExec[i].label === 'addAnnotation' + ) { + w.globals.memory.methodsToExec.splice(i, 1) + } + } + + annos = Utils.listToArray(annos) + + // delete the DOM elements + Array.prototype.forEach.call(annos, (a) => { + while (a.firstChild) { + a.removeChild(a.firstChild) + } + }) + } + + removeAnnotation(ctx, id) { + const w = ctx.w + let annos = w.globals.dom.baseEl.querySelectorAll(`.${id}`) + + if (annos) { + w.globals.memory.methodsToExec.map((m, i) => { + if (m.id === id) { + w.globals.memory.methodsToExec.splice(i, 1) + } + }) + + Array.prototype.forEach.call(annos, (a) => { + a.parentElement.removeChild(a) + }) + } + } +} diff --git a/node_modules/apexcharts/src/modules/annotations/Helpers.js b/node_modules/apexcharts/src/modules/annotations/Helpers.js new file mode 100644 index 0000000..ac06db4 --- /dev/null +++ b/node_modules/apexcharts/src/modules/annotations/Helpers.js @@ -0,0 +1,258 @@ +import CoreUtils from '../CoreUtils' + +export default class Helpers { + constructor(annoCtx) { + this.w = annoCtx.w + this.annoCtx = annoCtx + } + + setOrientations(anno, annoIndex = null) { + const w = this.w + + if (anno.label.orientation === 'vertical') { + const i = annoIndex !== null ? annoIndex : 0 + const xAnno = w.globals.dom.baseEl.querySelector( + `.apexcharts-xaxis-annotations .apexcharts-xaxis-annotation-label[rel='${i}']` + ) + + if (xAnno !== null) { + const xAnnoCoord = xAnno.getBoundingClientRect() + xAnno.setAttribute( + 'x', + parseFloat(xAnno.getAttribute('x')) - xAnnoCoord.height + 4 + ) + + const yOffset = + anno.label.position === 'top' ? xAnnoCoord.width : -xAnnoCoord.width + xAnno.setAttribute('y', parseFloat(xAnno.getAttribute('y')) + yOffset) + + const { x, y } = this.annoCtx.graphics.rotateAroundCenter(xAnno) + xAnno.setAttribute('transform', `rotate(-90 ${x} ${y})`) + } + } + } + + addBackgroundToAnno(annoEl, anno) { + const w = this.w + + if (!annoEl || !anno.label.text || !String(anno.label.text).trim()) { + return null + } + + const elGridRect = w.globals.dom.baseEl + .querySelector('.apexcharts-grid') + .getBoundingClientRect() + + const coords = annoEl.getBoundingClientRect() + + let { + left: pleft, + right: pright, + top: ptop, + bottom: pbottom, + } = anno.label.style.padding + + if (anno.label.orientation === 'vertical') { + ;[ptop, pbottom, pleft, pright] = [pleft, pright, ptop, pbottom] + } + + const x1 = coords.left - elGridRect.left - pleft + const y1 = coords.top - elGridRect.top - ptop + const elRect = this.annoCtx.graphics.drawRect( + x1 - w.globals.barPadForNumericAxis, + y1, + coords.width + pleft + pright, + coords.height + ptop + pbottom, + anno.label.borderRadius, + anno.label.style.background, + 1, + anno.label.borderWidth, + anno.label.borderColor, + 0 + ) + + if (anno.id) { + elRect.node.classList.add(anno.id) + } + + return elRect + } + + annotationsBackground() { + const w = this.w + + const add = (anno, i, type) => { + const annoLabel = w.globals.dom.baseEl.querySelector( + `.apexcharts-${type}-annotations .apexcharts-${type}-annotation-label[rel='${i}']` + ) + + if (annoLabel) { + const parent = annoLabel.parentNode + const elRect = this.addBackgroundToAnno(annoLabel, anno) + + if (elRect) { + parent.insertBefore(elRect.node, annoLabel) + + if (anno.label.mouseEnter) { + elRect.node.addEventListener( + 'mouseenter', + anno.label.mouseEnter.bind(this, anno) + ) + } + if (anno.label.mouseLeave) { + elRect.node.addEventListener( + 'mouseleave', + anno.label.mouseLeave.bind(this, anno) + ) + } + if (anno.label.click) { + elRect.node.addEventListener( + 'click', + anno.label.click.bind(this, anno) + ) + } + } + } + } + + w.config.annotations.xaxis.forEach((anno, i) => add(anno, i, 'xaxis')) + w.config.annotations.yaxis.forEach((anno, i) => add(anno, i, 'yaxis')) + w.config.annotations.points.forEach((anno, i) => add(anno, i, 'point')) + } + + getY1Y2(type, anno) { + const w = this.w + let y = type === 'y1' ? anno.y : anno.y2 + let yP + let clipped = false + + if (this.annoCtx.invertAxis) { + const labels = w.config.xaxis.convertedCatToNumeric + ? w.globals.categoryLabels + : w.globals.labels + const catIndex = labels.indexOf(y) + const xLabel = w.globals.dom.baseEl.querySelector( + `.apexcharts-yaxis-texts-g text:nth-child(${catIndex + 1})` + ) + + yP = xLabel + ? parseFloat(xLabel.getAttribute('y')) + : (w.globals.gridHeight / labels.length - 1) * (catIndex + 1) - + w.globals.barHeight + + if (anno.seriesIndex !== undefined && w.globals.barHeight) { + yP -= + (w.globals.barHeight / 2) * (w.globals.series.length - 1) - + w.globals.barHeight * anno.seriesIndex + } + } else { + const seriesIndex = w.globals.seriesYAxisMap[anno.yAxisIndex][0] + const yPos = w.config.yaxis[anno.yAxisIndex].logarithmic + ? new CoreUtils(this.annoCtx.ctx).getLogVal( + w.config.yaxis[anno.yAxisIndex].logBase, + y, + seriesIndex + ) / w.globals.yLogRatio[seriesIndex] + : (y - w.globals.minYArr[seriesIndex]) / + (w.globals.yRange[seriesIndex] / w.globals.gridHeight) + + yP = + w.globals.gridHeight - Math.min(Math.max(yPos, 0), w.globals.gridHeight) + clipped = yPos > w.globals.gridHeight || yPos < 0 + + if (anno.marker && (anno.y === undefined || anno.y === null)) { + yP = 0 + } + + if (w.config.yaxis[anno.yAxisIndex]?.reversed) { + yP = yPos + } + } + + if (typeof y === 'string' && y.includes('px')) { + yP = parseFloat(y) + } + + return { yP, clipped } + } + + getX1X2(type, anno) { + const w = this.w + const x = type === 'x1' ? anno.x : anno.x2 + const min = this.annoCtx.invertAxis ? w.globals.minY : w.globals.minX + const max = this.annoCtx.invertAxis ? w.globals.maxY : w.globals.maxX + const range = this.annoCtx.invertAxis + ? w.globals.yRange[0] + : w.globals.xRange + let clipped = false + + let xP = this.annoCtx.inversedReversedAxis + ? (max - x) / (range / w.globals.gridWidth) + : (x - min) / (range / w.globals.gridWidth) + + if ( + (w.config.xaxis.type === 'category' || + w.config.xaxis.convertedCatToNumeric) && + !this.annoCtx.invertAxis && + !w.globals.dataFormatXNumeric + ) { + if (!w.config.chart.sparkline.enabled) { + xP = this.getStringX(x) + } + } + + if (typeof x === 'string' && x.includes('px')) { + xP = parseFloat(x) + } + + if ((x === undefined || x === null) && anno.marker) { + xP = w.globals.gridWidth + } + + if ( + anno.seriesIndex !== undefined && + w.globals.barWidth && + !this.annoCtx.invertAxis + ) { + xP -= + (w.globals.barWidth / 2) * (w.globals.series.length - 1) - + w.globals.barWidth * anno.seriesIndex + } + + if (xP > w.globals.gridWidth) { + xP = w.globals.gridWidth + clipped = true + } else if (xP < 0) { + xP = 0 + clipped = true + } + + return { x: xP, clipped } + } + + getStringX(x) { + const w = this.w + let rX = x + + if ( + w.config.xaxis.convertedCatToNumeric && + w.globals.categoryLabels.length + ) { + x = w.globals.categoryLabels.indexOf(x) + 1 + } + + const catIndex = w.globals.labels + .map((item) => (Array.isArray(item) ? item.join(' ') : item)) + .indexOf(x) + + const xLabel = w.globals.dom.baseEl.querySelector( + `.apexcharts-xaxis-texts-g text:nth-child(${catIndex + 1})` + ) + + if (xLabel) { + rX = parseFloat(xLabel.getAttribute('x')) + } + + return rX + } +} diff --git a/node_modules/apexcharts/src/modules/annotations/PointsAnnotations.js b/node_modules/apexcharts/src/modules/annotations/PointsAnnotations.js new file mode 100644 index 0000000..72c45e7 --- /dev/null +++ b/node_modules/apexcharts/src/modules/annotations/PointsAnnotations.js @@ -0,0 +1,136 @@ +import Utils from '../../utils/Utils' +import Helpers from './Helpers' + +export default class PointAnnotations { + constructor(annoCtx) { + this.w = annoCtx.w + this.annoCtx = annoCtx + this.helpers = new Helpers(this.annoCtx) + } + + addPointAnnotation(anno, parent, index) { + const w = this.w + + if (w.globals.collapsedSeriesIndices.indexOf(anno.seriesIndex) > -1) { + return + } + + let result = this.helpers.getX1X2('x1', anno) + let x = result.x + let clipX = result.clipped + result = this.helpers.getY1Y2('y1', anno) + let y = result.yP + let clipY = result.clipped + + if (!Utils.isNumber(x)) return + + if (!(clipY || clipX)) { + let optsPoints = { + pSize: anno.marker.size, + pointStrokeWidth: anno.marker.strokeWidth, + pointFillColor: anno.marker.fillColor, + pointStrokeColor: anno.marker.strokeColor, + shape: anno.marker.shape, + pRadius: anno.marker.radius, + class: `apexcharts-point-annotation-marker ${anno.marker.cssClass} ${ + anno.id ? anno.id : '' + }`, + } + + let point = this.annoCtx.graphics.drawMarker( + x + anno.marker.offsetX, + y + anno.marker.offsetY, + optsPoints + ) + + parent.appendChild(point.node) + + const text = anno.label.text ? anno.label.text : '' + + let elText = this.annoCtx.graphics.drawText({ + x: x + anno.label.offsetX, + y: + y + + anno.label.offsetY - + anno.marker.size - + parseFloat(anno.label.style.fontSize) / 1.6, + text, + textAnchor: anno.label.textAnchor, + fontSize: anno.label.style.fontSize, + fontFamily: anno.label.style.fontFamily, + fontWeight: anno.label.style.fontWeight, + foreColor: anno.label.style.color, + cssClass: `apexcharts-point-annotation-label ${ + anno.label.style.cssClass + } ${anno.id ? anno.id : ''}`, + }) + + elText.attr({ + rel: index, + }) + + parent.appendChild(elText.node) + + // TODO: deprecate this as we will use custom + if (anno.customSVG.SVG) { + let g = this.annoCtx.graphics.group({ + class: + 'apexcharts-point-annotations-custom-svg ' + anno.customSVG.cssClass, + }) + + g.attr({ + transform: `translate(${x + anno.customSVG.offsetX}, ${ + y + anno.customSVG.offsetY + })`, + }) + + g.node.innerHTML = anno.customSVG.SVG + parent.appendChild(g.node) + } + + if (anno.image.path) { + let imgWidth = anno.image.width ? anno.image.width : 20 + let imgHeight = anno.image.height ? anno.image.height : 20 + + point = this.annoCtx.addImage({ + x: x + anno.image.offsetX - imgWidth / 2, + y: y + anno.image.offsetY - imgHeight / 2, + width: imgWidth, + height: imgHeight, + path: anno.image.path, + appendTo: '.apexcharts-point-annotations', + }) + } + + if (anno.mouseEnter) { + point.node.addEventListener( + 'mouseenter', + anno.mouseEnter.bind(this, anno) + ) + } + if (anno.mouseLeave) { + point.node.addEventListener( + 'mouseleave', + anno.mouseLeave.bind(this, anno) + ) + } + if (anno.click) { + point.node.addEventListener('click', anno.click.bind(this, anno)) + } + } + } + + drawPointAnnotations() { + let w = this.w + + let elg = this.annoCtx.graphics.group({ + class: 'apexcharts-point-annotations', + }) + + w.config.annotations.points.map((anno, index) => { + this.addPointAnnotation(anno, elg.node, index) + }) + + return elg + } +} diff --git a/node_modules/apexcharts/src/modules/annotations/XAxisAnnotations.js b/node_modules/apexcharts/src/modules/annotations/XAxisAnnotations.js new file mode 100644 index 0000000..0cd21bf --- /dev/null +++ b/node_modules/apexcharts/src/modules/annotations/XAxisAnnotations.js @@ -0,0 +1,133 @@ +import Utils from '../../utils/Utils' +import Helpers from './Helpers' + +export default class XAnnotations { + constructor(annoCtx) { + this.w = annoCtx.w + this.annoCtx = annoCtx + + this.invertAxis = this.annoCtx.invertAxis + + this.helpers = new Helpers(this.annoCtx) + } + + addXaxisAnnotation(anno, parent, index) { + let w = this.w + + let result = this.helpers.getX1X2('x1', anno) + let x1 = result.x + let clipX1 = result.clipped + let clipX2 = true + let x2 + + const text = anno.label.text + + let strokeDashArray = anno.strokeDashArray + + if (!Utils.isNumber(x1)) return + + if (anno.x2 === null || typeof anno.x2 === 'undefined') { + if (!clipX1) { + let line = this.annoCtx.graphics.drawLine( + x1 + anno.offsetX, // x1 + 0 + anno.offsetY, // y1 + x1 + anno.offsetX, // x2 + w.globals.gridHeight + anno.offsetY, // y2 + anno.borderColor, // lineColor + strokeDashArray, //dashArray + anno.borderWidth + ) + parent.appendChild(line.node) + if (anno.id) { + line.node.classList.add(anno.id) + } + } + } else { + let result = this.helpers.getX1X2('x2', anno) + x2 = result.x + clipX2 = result.clipped + + if (x2 < x1) { + let temp = x1 + x1 = x2 + x2 = temp + } + + let rect = this.annoCtx.graphics.drawRect( + x1 + anno.offsetX, // x1 + 0 + anno.offsetY, // y1 + x2 - x1, // x2 + w.globals.gridHeight + anno.offsetY, // y2 + 0, // radius + anno.fillColor, // color + anno.opacity, // opacity, + 1, // strokeWidth + anno.borderColor, // strokeColor + strokeDashArray // stokeDashArray + ) + rect.node.classList.add('apexcharts-annotation-rect') + rect.attr('clip-path', `url(#gridRectMask${w.globals.cuid})`) + parent.appendChild(rect.node) + if (anno.id) { + rect.node.classList.add(anno.id) + } + } + + if (!(clipX1 && clipX2)) { + let textRects = this.annoCtx.graphics.getTextRects( + text, + parseFloat(anno.label.style.fontSize) + ) + let textY = + anno.label.position === 'top' + ? 4 + : anno.label.position === 'center' + ? w.globals.gridHeight / 2 + + (anno.label.orientation === 'vertical' ? textRects.width / 2 : 0) + : w.globals.gridHeight + + let elText = this.annoCtx.graphics.drawText({ + x: x1 + anno.label.offsetX, + y: + textY + + anno.label.offsetY - + (anno.label.orientation === 'vertical' + ? anno.label.position === 'top' + ? textRects.width / 2 - 12 + : -textRects.width / 2 + : 0), + text, + textAnchor: anno.label.textAnchor, + fontSize: anno.label.style.fontSize, + fontFamily: anno.label.style.fontFamily, + fontWeight: anno.label.style.fontWeight, + foreColor: anno.label.style.color, + cssClass: `apexcharts-xaxis-annotation-label ${ + anno.label.style.cssClass + } ${anno.id ? anno.id : ''}`, + }) + + elText.attr({ + rel: index, + }) + + parent.appendChild(elText.node) + + // after placing the annotations on svg, set any vertically placed annotations + this.annoCtx.helpers.setOrientations(anno, index) + } + } + drawXAxisAnnotations() { + let w = this.w + + let elg = this.annoCtx.graphics.group({ + class: 'apexcharts-xaxis-annotations', + }) + + w.config.annotations.xaxis.map((anno, index) => { + this.addXaxisAnnotation(anno, elg.node, index) + }) + + return elg + } +} diff --git a/node_modules/apexcharts/src/modules/annotations/YAxisAnnotations.js b/node_modules/apexcharts/src/modules/annotations/YAxisAnnotations.js new file mode 100644 index 0000000..687f738 --- /dev/null +++ b/node_modules/apexcharts/src/modules/annotations/YAxisAnnotations.js @@ -0,0 +1,140 @@ +import Helpers from './Helpers' +import AxesUtils from '../axes/AxesUtils' + +export default class YAnnotations { + constructor(annoCtx) { + this.w = annoCtx.w + this.annoCtx = annoCtx + + this.helpers = new Helpers(this.annoCtx) + this.axesUtils = new AxesUtils(this.annoCtx) + + } + + addYaxisAnnotation(anno, parent, index) { + let w = this.w + + let strokeDashArray = anno.strokeDashArray + + let result = this.helpers.getY1Y2('y1', anno) + let y1 = result.yP + let clipY1 = result.clipped + let y2 + let clipY2 = true + let drawn = false + + const text = anno.label.text + + if (anno.y2 === null || typeof anno.y2 === 'undefined') { + if (!clipY1) { + drawn = true + let line = this.annoCtx.graphics.drawLine( + 0 + anno.offsetX, // x1 + y1 + anno.offsetY, // y1 + this._getYAxisAnnotationWidth(anno), // x2 + y1 + anno.offsetY, // y2 + anno.borderColor, // lineColor + strokeDashArray, // dashArray + anno.borderWidth + ) + parent.appendChild(line.node) + if (anno.id) { + line.node.classList.add(anno.id) + } + } + } else { + result = this.helpers.getY1Y2('y2', anno) + y2 = result.yP + clipY2 = result.clipped + + if (y2 > y1) { + let temp = y1 + y1 = y2 + y2 = temp + } + + if (!(clipY1 && clipY2)) { + drawn = true + let rect = this.annoCtx.graphics.drawRect( + 0 + anno.offsetX, // x1 + y2 + anno.offsetY, // y1 + this._getYAxisAnnotationWidth(anno), // x2 + y1 - y2, // y2 + 0, // radius + anno.fillColor, // color + anno.opacity, // opacity, + 1, // strokeWidth + anno.borderColor, // strokeColor + strokeDashArray // stokeDashArray + ) + rect.node.classList.add('apexcharts-annotation-rect') + rect.attr('clip-path', `url(#gridRectMask${w.globals.cuid})`) + + parent.appendChild(rect.node) + if (anno.id) { + rect.node.classList.add(anno.id) + } + } + } + if (drawn) { + let textX = + anno.label.position === 'right' + ? w.globals.gridWidth + : anno.label.position === 'center' + ? w.globals.gridWidth / 2 + : 0 + + let elText = this.annoCtx.graphics.drawText({ + x: textX + anno.label.offsetX, + y: (y2 != null ? y2 : y1) + anno.label.offsetY - 3, + text, + textAnchor: anno.label.textAnchor, + fontSize: anno.label.style.fontSize, + fontFamily: anno.label.style.fontFamily, + fontWeight: anno.label.style.fontWeight, + foreColor: anno.label.style.color, + cssClass: `apexcharts-yaxis-annotation-label ${ + anno.label.style.cssClass + } ${anno.id ? anno.id : ''}` + }) + + elText.attr({ + rel: index + }) + + parent.appendChild(elText.node) + } + } + + _getYAxisAnnotationWidth(anno) { + // issue apexcharts.js#2009 + const w = this.w + let width = w.globals.gridWidth + if (anno.width.indexOf('%') > -1) { + width = (w.globals.gridWidth * parseInt(anno.width, 10)) / 100 + } else { + width = parseInt(anno.width, 10) + } + return width + anno.offsetX + } + + drawYAxisAnnotations() { + const w = this.w + + let elg = this.annoCtx.graphics.group({ + class: 'apexcharts-yaxis-annotations' + }) + + w.config.annotations.yaxis.forEach((anno, index) => { + anno.yAxisIndex = this.axesUtils.translateYAxisIndex(anno.yAxisIndex) + if ( + !(this.axesUtils.isYAxisHidden(anno.yAxisIndex) + && this.axesUtils.yAxisAllSeriesCollapsed(anno.yAxisIndex)) + ) { + this.addYaxisAnnotation(anno, elg.node, index) + } + }) + + return elg + } +} diff --git a/node_modules/apexcharts/src/modules/axes/Axes.js b/node_modules/apexcharts/src/modules/axes/Axes.js new file mode 100644 index 0000000..07bd668 --- /dev/null +++ b/node_modules/apexcharts/src/modules/axes/Axes.js @@ -0,0 +1,45 @@ +import XAxis from './XAxis' +import YAxis from './YAxis' + +export default class Axes { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + } + + drawAxis(type, elgrid) { + let gl = this.w.globals + let cnf = this.w.config + + let xAxis = new XAxis(this.ctx, elgrid) + let yAxis = new YAxis(this.ctx, elgrid) + + if (gl.axisCharts && type !== 'radar') { + let elXaxis, elYaxis + + if (gl.isBarHorizontal) { + elYaxis = yAxis.drawYaxisInversed(0) + elXaxis = xAxis.drawXaxisInversed(0) + + gl.dom.elGraphical.add(elXaxis) + gl.dom.elGraphical.add(elYaxis) + } else { + elXaxis = xAxis.drawXaxis() + gl.dom.elGraphical.add(elXaxis) + + cnf.yaxis.map((yaxe, index) => { + if (gl.ignoreYAxisIndexes.indexOf(index) === -1) { + elYaxis = yAxis.drawYaxis(index) + gl.dom.Paper.add(elYaxis) + + if (this.w.config.grid.position === 'back') { + const inner = gl.dom.Paper.children()[1] + inner.remove() + gl.dom.Paper.add(inner) + } + } + }) + } + } + } +} diff --git a/node_modules/apexcharts/src/modules/axes/AxesUtils.js b/node_modules/apexcharts/src/modules/axes/AxesUtils.js new file mode 100644 index 0000000..68165da --- /dev/null +++ b/node_modules/apexcharts/src/modules/axes/AxesUtils.js @@ -0,0 +1,271 @@ +import Formatters from '../Formatters' +import Graphics from '../Graphics' +import CoreUtils from '../CoreUtils' +import DateTime from '../../utils/DateTime' + +export default class AxesUtils { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + } + + // Based on the formatter function, get the label text and position + getLabel( + labels, + timescaleLabels, + x, + i, + drawnLabels = [], + fontSize = '12px', + isLeafGroup = true + ) { + const w = this.w + let rawLabel = typeof labels[i] === 'undefined' ? '' : labels[i] + let label = rawLabel + + let xlbFormatter = w.globals.xLabelFormatter + let customFormatter = w.config.xaxis.labels.formatter + + let isBold = false + + let xFormat = new Formatters(this.ctx) + let timestamp = rawLabel + + if (isLeafGroup) { + label = xFormat.xLabelFormat(xlbFormatter, rawLabel, timestamp, { + i, + dateFormatter: new DateTime(this.ctx).formatDate, + w, + }) + + if (customFormatter !== undefined) { + label = customFormatter(rawLabel, labels[i], { + i, + dateFormatter: new DateTime(this.ctx).formatDate, + w, + }) + } + } + + const determineHighestUnit = (unit) => { + let highestUnit = null + timescaleLabels.forEach((t) => { + if (t.unit === 'month') { + highestUnit = 'year' + } else if (t.unit === 'day') { + highestUnit = 'month' + } else if (t.unit === 'hour') { + highestUnit = 'day' + } else if (t.unit === 'minute') { + highestUnit = 'hour' + } + }) + + return highestUnit === unit + } + if (timescaleLabels.length > 0) { + isBold = determineHighestUnit(timescaleLabels[i].unit) + x = timescaleLabels[i].position + label = timescaleLabels[i].value + } else { + if (w.config.xaxis.type === 'datetime' && customFormatter === undefined) { + label = '' + } + } + + if (typeof label === 'undefined') label = '' + + label = Array.isArray(label) ? label : label.toString() + + let graphics = new Graphics(this.ctx) + let textRect = {} + if (w.globals.rotateXLabels && isLeafGroup) { + textRect = graphics.getTextRects( + label, + parseInt(fontSize, 10), + null, + `rotate(${w.config.xaxis.labels.rotate} 0 0)`, + false + ) + } else { + textRect = graphics.getTextRects(label, parseInt(fontSize, 10)) + } + + const allowDuplicatesInTimeScale = + !w.config.xaxis.labels.showDuplicates && this.ctx.timeScale + + if ( + !Array.isArray(label) && + (String(label) === 'NaN' || + (drawnLabels.indexOf(label) >= 0 && allowDuplicatesInTimeScale)) + ) { + label = '' + } + + return { + x, + text: label, + textRect, + isBold, + } + } + + checkLabelBasedOnTickamount(i, label, labelsLen) { + const w = this.w + + let ticks = w.config.xaxis.tickAmount + if (ticks === 'dataPoints') ticks = Math.round(w.globals.gridWidth / 120) + + if (ticks > labelsLen) return label + let tickMultiple = Math.round(labelsLen / (ticks + 1)) + + if (i % tickMultiple === 0) { + return label + } else { + label.text = '' + } + + return label + } + + checkForOverflowingLabels( + i, + label, + labelsLen, + drawnLabels, + drawnLabelsRects + ) { + const w = this.w + + if (i === 0) { + // check if first label is being truncated + if (w.globals.skipFirstTimelinelabel) { + label.text = '' + } + } + + if (i === labelsLen - 1) { + // check if last label is being truncated + if (w.globals.skipLastTimelinelabel) { + label.text = '' + } + } + + if (w.config.xaxis.labels.hideOverlappingLabels && drawnLabels.length > 0) { + const prev = drawnLabelsRects[drawnLabelsRects.length - 1] + if ( + label.x < + prev.textRect.width / + (w.globals.rotateXLabels + ? Math.abs(w.config.xaxis.labels.rotate) / 12 + : 1.01) + + prev.x + ) { + label.text = '' + } + } + + return label + } + + checkForReversedLabels(i, labels) { + const w = this.w + if (w.config.yaxis[i] && w.config.yaxis[i].reversed) { + labels.reverse() + } + return labels + } + + yAxisAllSeriesCollapsed(index) { + const gl = this.w.globals + + return !gl.seriesYAxisMap[index].some((si) => { + return gl.collapsedSeriesIndices.indexOf(si) === -1 + }) + + } + + // Method to translate annotation.yAxisIndex values from + // seriesName-as-a-string values to seriesName-as-an-array values (old style + // series mapping to new style). + translateYAxisIndex(index) { + const w = this.w + const gl = w.globals + const yaxis = w.config.yaxis + let newStyle = + gl.series.length > yaxis.length + || yaxis.some((a) => Array.isArray(a.seriesName)) + if (newStyle) { + return index + } else { + return gl.seriesYAxisReverseMap[index] + } + } + + isYAxisHidden(index) { + const w = this.w + const yaxis = w.config.yaxis[index] + + if (!yaxis.show || this.yAxisAllSeriesCollapsed(index) + ) { + return true + } + if (!yaxis.showForNullSeries) { + const seriesIndices = w.globals.seriesYAxisMap[index] + const coreUtils = new CoreUtils(this.ctx) + return seriesIndices.every((si) => coreUtils.isSeriesNull(si)) + } + return false + } + + // get the label color for y-axis + // realIndex is the actual series index, while i is the tick Index + getYAxisForeColor(yColors, realIndex) { + const w = this.w + if (Array.isArray(yColors) && w.globals.yAxisScale[realIndex]) { + this.ctx.theme.pushExtraColors( + yColors, + w.globals.yAxisScale[realIndex].result.length, + false + ) + } + return yColors + } + + drawYAxisTicks( + x, + tickAmount, + axisBorder, + axisTicks, + realIndex, + labelsDivider, + elYaxis + ) { + let w = this.w + let graphics = new Graphics(this.ctx) + + // initial label position = 0; + let tY = w.globals.translateY + w.config.yaxis[realIndex].labels.offsetY + if (w.globals.isBarHorizontal) { + tY = 0 + } else if (w.config.chart.type === 'heatmap') { + tY += labelsDivider / 2 + } + + if (axisTicks.show && tickAmount > 0) { + if (w.config.yaxis[realIndex].opposite === true) x = x + axisTicks.width + + for (let i = tickAmount; i >= 0; i--) { + let elTick = graphics.drawLine( + x + axisBorder.offsetX - axisTicks.width + axisTicks.offsetX, + tY + axisTicks.offsetY, + x + axisBorder.offsetX + axisTicks.offsetX, + tY + axisTicks.offsetY, + axisTicks.color + ) + elYaxis.add(elTick) + tY += labelsDivider + } + } + } +} diff --git a/node_modules/apexcharts/src/modules/axes/Grid.js b/node_modules/apexcharts/src/modules/axes/Grid.js new file mode 100644 index 0000000..2dfe9ec --- /dev/null +++ b/node_modules/apexcharts/src/modules/axes/Grid.js @@ -0,0 +1,512 @@ +import Graphics from '../Graphics' +import XAxis from './XAxis' +import AxesUtils from './AxesUtils' + +/** + * ApexCharts Grid Class for drawing Cartesian Grid. + * + * @module Grid + **/ + +class Grid { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + + const w = this.w + this.xaxisLabels = w.globals.labels.slice() + this.axesUtils = new AxesUtils(ctx) + + this.isRangeBar = w.globals.seriesRange.length && w.globals.isBarHorizontal + + if (w.globals.timescaleLabels.length > 0) { + // timescaleLabels labels are there + this.xaxisLabels = w.globals.timescaleLabels.slice() + } + } + + drawGridArea(elGrid = null) { + const w = this.w + const graphics = new Graphics(this.ctx) + + if (!elGrid) { + elGrid = graphics.group({ class: 'apexcharts-grid' }) + } + + const elVerticalLine = graphics.drawLine( + w.globals.padHorizontal, + 1, + w.globals.padHorizontal, + w.globals.gridHeight, + 'transparent' + ) + + const elHorzLine = graphics.drawLine( + w.globals.padHorizontal, + w.globals.gridHeight, + w.globals.gridWidth, + w.globals.gridHeight, + 'transparent' + ) + + elGrid.add(elHorzLine) + elGrid.add(elVerticalLine) + + return elGrid + } + + drawGrid() { + const gl = this.w.globals + + if (gl.axisCharts) { + const elgrid = this.renderGrid() + this.drawGridArea(elgrid.el) + return elgrid + } + return null + } + + createGridMask() { + const w = this.w + const gl = w.globals + const graphics = new Graphics(this.ctx) + + const strokeSize = Array.isArray(w.config.stroke.width) + ? Math.max(...w.config.stroke.width) + : w.config.stroke.width + + const createClipPath = (id) => { + const clipPath = document.createElementNS(gl.SVGNS, 'clipPath') + clipPath.setAttribute('id', id) + return clipPath + } + + gl.dom.elGridRectMask = createClipPath(`gridRectMask${gl.cuid}`) + gl.dom.elGridRectBarMask = createClipPath(`gridRectBarMask${gl.cuid}`) + gl.dom.elGridRectMarkerMask = createClipPath(`gridRectMarkerMask${gl.cuid}`) + gl.dom.elForecastMask = createClipPath(`forecastMask${gl.cuid}`) + gl.dom.elNonForecastMask = createClipPath(`nonForecastMask${gl.cuid}`) + + const hasBar = + ['bar', 'rangeBar', 'candlestick', 'boxPlot'].includes( + w.config.chart.type + ) || w.globals.comboBarCount > 0 + + let barWidthLeft = 0 + let barWidthRight = 0 + if (hasBar && w.globals.isXNumeric && !w.globals.isBarHorizontal) { + barWidthLeft = Math.max( + w.config.grid.padding.left, + gl.barPadForNumericAxis + ) + barWidthRight = Math.max( + w.config.grid.padding.right, + gl.barPadForNumericAxis + ) + } + + gl.dom.elGridRect = graphics.drawRect( + -strokeSize / 2 - 2, + -strokeSize / 2 - 2, + gl.gridWidth + strokeSize + 4, + gl.gridHeight + strokeSize + 4, + 0, + '#fff' + ) + + gl.dom.elGridRectBar = graphics.drawRect( + -strokeSize / 2 - barWidthLeft - 2, + -strokeSize / 2 - 2, + gl.gridWidth + strokeSize + barWidthRight + barWidthLeft + 4, + gl.gridHeight + strokeSize + 4, + 0, + '#fff' + ) + + const markerSize = w.globals.markers.largestSize + + gl.dom.elGridRectMarker = graphics.drawRect( + -markerSize, + -markerSize, + gl.gridWidth + markerSize * 2, + gl.gridHeight + markerSize * 2, + 0, + '#fff' + ) + + gl.dom.elGridRectMask.appendChild(gl.dom.elGridRect.node) + gl.dom.elGridRectBarMask.appendChild(gl.dom.elGridRectBar.node) + gl.dom.elGridRectMarkerMask.appendChild(gl.dom.elGridRectMarker.node) + + const defs = gl.dom.baseEl.querySelector('defs') + defs.appendChild(gl.dom.elGridRectMask) + defs.appendChild(gl.dom.elGridRectBarMask) + defs.appendChild(gl.dom.elGridRectMarkerMask) + defs.appendChild(gl.dom.elForecastMask) + defs.appendChild(gl.dom.elNonForecastMask) + } + + _drawGridLines({ i, x1, y1, x2, y2, xCount, parent }) { + const w = this.w + + const shouldDraw = () => { + if (i === 0 && w.globals.skipFirstTimelinelabel) return false + if ( + i === xCount - 1 && + w.globals.skipLastTimelinelabel && + !w.config.xaxis.labels.formatter + ) + return false + if (w.config.chart.type === 'radar') return false + return true + } + + if (shouldDraw()) { + if (w.config.grid.xaxis.lines.show) { + this._drawGridLine({ i, x1, y1, x2, y2, xCount, parent }) + } + + let y_2 = 0 + if ( + w.globals.hasXaxisGroups && + w.config.xaxis.tickPlacement === 'between' + ) { + const groups = w.globals.groups + if (groups) { + let gacc = 0 + for (let gi = 0; gacc < i && gi < groups.length; gi++) { + gacc += groups[gi].cols + } + if (gacc === i) { + y_2 = w.globals.xAxisLabelsHeight * 0.6 + } + } + } + + const xAxis = new XAxis(this.ctx) + xAxis.drawXaxisTicks(x1, y_2, w.globals.dom.elGraphical) + } + } + + _drawGridLine({ i, x1, y1, x2, y2, xCount, parent }) { + const w = this.w + const isHorzLine = parent.node.classList.contains( + 'apexcharts-gridlines-horizontal' + ) + const offX = w.globals.barPadForNumericAxis + + const excludeBorders = + (y1 === 0 && y2 === 0) || + (x1 === 0 && x2 === 0) || + (y1 === w.globals.gridHeight && y2 === w.globals.gridHeight) || + (w.globals.isBarHorizontal && (i === 0 || i === xCount - 1)) + + const graphics = new Graphics(this) + const line = graphics.drawLine( + x1 - (isHorzLine ? offX : 0), + y1, + x2 + (isHorzLine ? offX : 0), + y2, + w.config.grid.borderColor, + w.config.grid.strokeDashArray + ) + line.node.classList.add('apexcharts-gridline') + + if (excludeBorders && w.config.grid.show) { + this.elGridBorders.add(line) + } else { + parent.add(line) + } + } + + _drawGridBandRect({ c, x1, y1, x2, y2, type }) { + const w = this.w + const graphics = new Graphics(this.ctx) + const offX = w.globals.barPadForNumericAxis + + const color = w.config.grid[type].colors[c] + + const rect = graphics.drawRect( + x1 - (type === 'row' ? offX : 0), + y1, + x2 + (type === 'row' ? offX * 2 : 0), + y2, + 0, + color, + w.config.grid[type].opacity + ) + this.elg.add(rect) + rect.attr('clip-path', `url(#gridRectMask${w.globals.cuid})`) + rect.node.classList.add(`apexcharts-grid-${type}`) + } + + _drawXYLines({ xCount, tickAmount }) { + const w = this.w + + const datetimeLines = ({ xC, x1, y1, x2, y2 }) => { + for (let i = 0; i < xC; i++) { + x1 = this.xaxisLabels[i].position + x2 = this.xaxisLabels[i].position + + this._drawGridLines({ + i, + x1, + y1, + x2, + y2, + xCount, + parent: this.elgridLinesV, + }) + } + } + + const categoryLines = ({ xC, x1, y1, x2, y2 }) => { + for (let i = 0; i < xC + (w.globals.isXNumeric ? 0 : 1); i++) { + if (i === 0 && xC === 1 && w.globals.dataPoints === 1) { + x1 = w.globals.gridWidth / 2 + x2 = x1 + } + this._drawGridLines({ + i, + x1, + y1, + x2, + y2, + xCount, + parent: this.elgridLinesV, + }) + + x1 += w.globals.gridWidth / (w.globals.isXNumeric ? xC - 1 : xC) + x2 = x1 + } + } + + if (w.config.grid.xaxis.lines.show || w.config.xaxis.axisTicks.show) { + let x1 = w.globals.padHorizontal + let y1 = 0 + let x2 + let y2 = w.globals.gridHeight + + if (w.globals.timescaleLabels.length) { + datetimeLines({ xC: xCount, x1, y1, x2, y2 }) + } else { + if (w.globals.isXNumeric) { + xCount = w.globals.xAxisScale.result.length + } + categoryLines({ xC: xCount, x1, y1, x2, y2 }) + } + } + + if (w.config.grid.yaxis.lines.show) { + let x1 = 0 + let y1 = 0 + let y2 = 0 + let x2 = w.globals.gridWidth + let tA = tickAmount + 1 + + if (this.isRangeBar) { + tA = w.globals.labels.length + } + + for (let i = 0; i < tA + (this.isRangeBar ? 1 : 0); i++) { + this._drawGridLine({ + i, + xCount: tA + (this.isRangeBar ? 1 : 0), + x1, + y1, + x2, + y2, + parent: this.elgridLinesH, + }) + + y1 += w.globals.gridHeight / (this.isRangeBar ? tA : tickAmount) + y2 = y1 + } + } + } + + _drawInvertedXYLines({ xCount }) { + const w = this.w + + if (w.config.grid.xaxis.lines.show || w.config.xaxis.axisTicks.show) { + let x1 = w.globals.padHorizontal + let y1 = 0 + let x2 + let y2 = w.globals.gridHeight + for (let i = 0; i < xCount + 1; i++) { + if (w.config.grid.xaxis.lines.show) { + this._drawGridLine({ + i, + xCount: xCount + 1, + x1, + y1, + x2, + y2, + parent: this.elgridLinesV, + }) + } + + const xAxis = new XAxis(this.ctx) + xAxis.drawXaxisTicks(x1, 0, w.globals.dom.elGraphical) + x1 += w.globals.gridWidth / xCount + x2 = x1 + } + } + + if (w.config.grid.yaxis.lines.show) { + let x1 = 0 + let y1 = 0 + let y2 = 0 + let x2 = w.globals.gridWidth + + for (let i = 0; i < w.globals.dataPoints + 1; i++) { + this._drawGridLine({ + i, + xCount: w.globals.dataPoints + 1, + x1, + y1, + x2, + y2, + parent: this.elgridLinesH, + }) + + y1 += w.globals.gridHeight / w.globals.dataPoints + y2 = y1 + } + } + } + + renderGrid() { + const w = this.w + const gl = w.globals + const graphics = new Graphics(this.ctx) + + this.elg = graphics.group({ class: 'apexcharts-grid' }) + this.elgridLinesH = graphics.group({ + class: 'apexcharts-gridlines-horizontal', + }) + this.elgridLinesV = graphics.group({ + class: 'apexcharts-gridlines-vertical', + }) + this.elGridBorders = graphics.group({ class: 'apexcharts-grid-borders' }) + + this.elg.add(this.elgridLinesH) + this.elg.add(this.elgridLinesV) + + if (!w.config.grid.show) { + this.elgridLinesV.hide() + this.elgridLinesH.hide() + this.elGridBorders.hide() + } + + let gridAxisIndex = 0 + while ( + gridAxisIndex < gl.seriesYAxisMap.length && + gl.ignoreYAxisIndexes.includes(gridAxisIndex) + ) { + gridAxisIndex++ + } + if (gridAxisIndex === gl.seriesYAxisMap.length) { + gridAxisIndex = 0 + } + + let yTickAmount = gl.yAxisScale[gridAxisIndex].result.length - 1 + + let xCount + + if (!gl.isBarHorizontal || this.isRangeBar) { + xCount = this.xaxisLabels.length + + if (this.isRangeBar) { + yTickAmount = gl.labels.length + + if (w.config.xaxis.tickAmount && w.config.xaxis.labels.formatter) { + xCount = w.config.xaxis.tickAmount + } + if ( + gl.yAxisScale?.[gridAxisIndex]?.result?.length > 0 && + w.config.xaxis.type !== 'datetime' + ) { + xCount = gl.yAxisScale[gridAxisIndex].result.length - 1 + } + } + + this._drawXYLines({ xCount, tickAmount: yTickAmount }) + } else { + xCount = yTickAmount + + // for horizontal bar chart, get the xaxis tickamount + yTickAmount = gl.xTickAmount + this._drawInvertedXYLines({ xCount, tickAmount: yTickAmount }) + } + + this.drawGridBands(xCount, yTickAmount) + return { + el: this.elg, + elGridBorders: this.elGridBorders, + xAxisTickWidth: gl.gridWidth / xCount, + } + } + + drawGridBands(xCount, tickAmount) { + const w = this.w + + const drawBands = (type, count, x1, y1, x2, y2) => { + for (let i = 0, c = 0; i < count; i++, c++) { + if (c >= w.config.grid[type].colors.length) { + c = 0 + } + this._drawGridBandRect({ c, x1, y1, x2, y2, type }) + y1 += w.globals.gridHeight / tickAmount + } + } + + if (w.config.grid.row.colors?.length > 0) { + drawBands( + 'row', + tickAmount, + 0, + 0, + w.globals.gridWidth, + w.globals.gridHeight / tickAmount + ) + } + + if (w.config.grid.column.colors?.length > 0) { + let xc = + !w.globals.isBarHorizontal && + w.config.xaxis.tickPlacement === 'on' && + (w.config.xaxis.type === 'category' || + w.config.xaxis.convertedCatToNumeric) + ? xCount - 1 + : xCount + + if (w.globals.isXNumeric) { + xc = w.globals.xAxisScale.result.length - 1 + } + + let x1 = w.globals.padHorizontal + let y1 = 0 + let x2 = w.globals.padHorizontal + w.globals.gridWidth / xc + let y2 = w.globals.gridHeight + + for (let i = 0, c = 0; i < xCount; i++, c++) { + if (c >= w.config.grid.column.colors.length) { + c = 0 + } + + if (w.config.xaxis.type === 'datetime') { + x1 = this.xaxisLabels[i].position + x2 = + (this.xaxisLabels[i + 1]?.position || w.globals.gridWidth) - + this.xaxisLabels[i].position + } + + this._drawGridBandRect({ c, x1, y1, x2, y2, type: 'column' }) + x1 += w.globals.gridWidth / xc + } + } + } +} + +export default Grid diff --git a/node_modules/apexcharts/src/modules/axes/XAxis.js b/node_modules/apexcharts/src/modules/axes/XAxis.js new file mode 100644 index 0000000..d307653 --- /dev/null +++ b/node_modules/apexcharts/src/modules/axes/XAxis.js @@ -0,0 +1,686 @@ +import Graphics from '../Graphics' +import AxesUtils from './AxesUtils' + +/** + * ApexCharts XAxis Class for drawing X-Axis. + * + * @module XAxis + **/ + +export default class XAxis { + constructor(ctx, elgrid) { + this.ctx = ctx + this.elgrid = elgrid + this.w = ctx.w + + const w = this.w + this.axesUtils = new AxesUtils(ctx) + + this.xaxisLabels = w.globals.labels.slice() + if (w.globals.timescaleLabels.length > 0 && !w.globals.isBarHorizontal) { + // timeline labels are there and chart is not rangeabr timeline + this.xaxisLabels = w.globals.timescaleLabels.slice() + } + + if (w.config.xaxis.overwriteCategories) { + this.xaxisLabels = w.config.xaxis.overwriteCategories + } + this.drawnLabels = [] + this.drawnLabelsRects = [] + + if (w.config.xaxis.position === 'top') { + this.offY = 0 + } else { + this.offY = w.globals.gridHeight + } + this.offY = this.offY + w.config.xaxis.axisBorder.offsetY + this.isCategoryBarHorizontal = + w.config.chart.type === 'bar' && w.config.plotOptions.bar.horizontal + + this.xaxisFontSize = w.config.xaxis.labels.style.fontSize + this.xaxisFontFamily = w.config.xaxis.labels.style.fontFamily + this.xaxisForeColors = w.config.xaxis.labels.style.colors + this.xaxisBorderWidth = w.config.xaxis.axisBorder.width + if (this.isCategoryBarHorizontal) { + this.xaxisBorderWidth = w.config.yaxis[0].axisBorder.width.toString() + } + + if (this.xaxisBorderWidth.indexOf('%') > -1) { + this.xaxisBorderWidth = + (w.globals.gridWidth * parseInt(this.xaxisBorderWidth, 10)) / 100 + } else { + this.xaxisBorderWidth = parseInt(this.xaxisBorderWidth, 10) + } + this.xaxisBorderHeight = w.config.xaxis.axisBorder.height + + // For bars, we will only consider single y xais, + // as we are not providing multiple yaxis for bar charts + this.yaxis = w.config.yaxis[0] + } + + drawXaxis() { + let w = this.w + let graphics = new Graphics(this.ctx) + + let elXaxis = graphics.group({ + class: 'apexcharts-xaxis', + transform: `translate(${w.config.xaxis.offsetX}, ${w.config.xaxis.offsetY})`, + }) + + let elXaxisTexts = graphics.group({ + class: 'apexcharts-xaxis-texts-g', + transform: `translate(${w.globals.translateXAxisX}, ${w.globals.translateXAxisY})`, + }) + + elXaxis.add(elXaxisTexts) + + let labels = [] + + for (let i = 0; i < this.xaxisLabels.length; i++) { + labels.push(this.xaxisLabels[i]) + } + + this.drawXAxisLabelAndGroup( + true, + graphics, + elXaxisTexts, + labels, + w.globals.isXNumeric, + (i, colWidth) => colWidth + ) + + if (w.globals.hasXaxisGroups) { + let labelsGroup = w.globals.groups + + labels = [] + for (let i = 0; i < labelsGroup.length; i++) { + labels.push(labelsGroup[i].title) + } + + let overwriteStyles = {} + if (w.config.xaxis.group.style) { + overwriteStyles.xaxisFontSize = w.config.xaxis.group.style.fontSize + overwriteStyles.xaxisFontFamily = w.config.xaxis.group.style.fontFamily + overwriteStyles.xaxisForeColors = w.config.xaxis.group.style.colors + overwriteStyles.fontWeight = w.config.xaxis.group.style.fontWeight + overwriteStyles.cssClass = w.config.xaxis.group.style.cssClass + } + + this.drawXAxisLabelAndGroup( + false, + graphics, + elXaxisTexts, + labels, + false, + (i, colWidth) => labelsGroup[i].cols * colWidth, + overwriteStyles + ) + } + + if (w.config.xaxis.title.text !== undefined) { + let elXaxisTitle = graphics.group({ + class: 'apexcharts-xaxis-title', + }) + + let elXAxisTitleText = graphics.drawText({ + x: w.globals.gridWidth / 2 + w.config.xaxis.title.offsetX, + y: + this.offY + + parseFloat(this.xaxisFontSize) + + (w.config.xaxis.position === 'bottom' + ? w.globals.xAxisLabelsHeight + : -w.globals.xAxisLabelsHeight - 10) + + w.config.xaxis.title.offsetY, + text: w.config.xaxis.title.text, + textAnchor: 'middle', + fontSize: w.config.xaxis.title.style.fontSize, + fontFamily: w.config.xaxis.title.style.fontFamily, + fontWeight: w.config.xaxis.title.style.fontWeight, + foreColor: w.config.xaxis.title.style.color, + cssClass: + 'apexcharts-xaxis-title-text ' + w.config.xaxis.title.style.cssClass, + }) + + elXaxisTitle.add(elXAxisTitleText) + + elXaxis.add(elXaxisTitle) + } + + if (w.config.xaxis.axisBorder.show) { + const offX = w.globals.barPadForNumericAxis + let elHorzLine = graphics.drawLine( + w.globals.padHorizontal + w.config.xaxis.axisBorder.offsetX - offX, + this.offY, + this.xaxisBorderWidth + offX, + this.offY, + w.config.xaxis.axisBorder.color, + 0, + this.xaxisBorderHeight + ) + if (this.elgrid && this.elgrid.elGridBorders && w.config.grid.show) { + this.elgrid.elGridBorders.add(elHorzLine) + } else { + elXaxis.add(elHorzLine) + } + } + + return elXaxis + } + + drawXAxisLabelAndGroup( + isLeafGroup, + graphics, + elXaxisTexts, + labels, + isXNumeric, + colWidthCb, + overwriteStyles = {} + ) { + let drawnLabels = [] + let drawnLabelsRects = [] + let w = this.w + + const xaxisFontSize = overwriteStyles.xaxisFontSize || this.xaxisFontSize + const xaxisFontFamily = + overwriteStyles.xaxisFontFamily || this.xaxisFontFamily + const xaxisForeColors = + overwriteStyles.xaxisForeColors || this.xaxisForeColors + const fontWeight = + overwriteStyles.fontWeight || w.config.xaxis.labels.style.fontWeight + const cssClass = + overwriteStyles.cssClass || w.config.xaxis.labels.style.cssClass + + let colWidth + + // initial x Position (keep adding column width in the loop) + let xPos = w.globals.padHorizontal + + let labelsLen = labels.length + + /** + * labelsLen can be different (whether you are drawing x-axis labels or x-axis group labels) + * hence, we introduce dataPoints to be consistent. + * Also, in datetime/numeric xaxis, dataPoints can be misleading, so we resort to labelsLen for such xaxis type + */ + let dataPoints = + w.config.xaxis.type === 'category' ? w.globals.dataPoints : labelsLen + + // when all series are collapsed, fixes #3381 + if (dataPoints === 0 && labelsLen > dataPoints) dataPoints = labelsLen + + if (isXNumeric) { + let len = Math.max( + Number(w.config.xaxis.tickAmount) || 1, + dataPoints > 1 ? dataPoints - 1 : dataPoints + ) + colWidth = w.globals.gridWidth / Math.min(len, labelsLen - 1) + + xPos = xPos + colWidthCb(0, colWidth) / 2 + w.config.xaxis.labels.offsetX + } else { + colWidth = w.globals.gridWidth / dataPoints + xPos = xPos + colWidthCb(0, colWidth) + w.config.xaxis.labels.offsetX + } + + for (let i = 0; i <= labelsLen - 1; i++) { + let x = xPos - colWidthCb(i, colWidth) / 2 + w.config.xaxis.labels.offsetX + + if ( + i === 0 && + labelsLen === 1 && + colWidth / 2 === xPos && + dataPoints === 1 + ) { + // single datapoint + x = w.globals.gridWidth / 2 + } + let label = this.axesUtils.getLabel( + labels, + w.globals.timescaleLabels, + x, + i, + drawnLabels, + xaxisFontSize, + isLeafGroup + ) + + let offsetYCorrection = 28 + if (w.globals.rotateXLabels && isLeafGroup) { + offsetYCorrection = 22 + } + + if (w.config.xaxis.title.text && w.config.xaxis.position === 'top') { + offsetYCorrection += parseFloat(w.config.xaxis.title.style.fontSize) + 2 + } + + if (!isLeafGroup) { + offsetYCorrection = + offsetYCorrection + + parseFloat(xaxisFontSize) + + (w.globals.xAxisLabelsHeight - w.globals.xAxisGroupLabelsHeight) + + (w.globals.rotateXLabels ? 10 : 0) + } + + const isCategoryTickAmounts = + typeof w.config.xaxis.tickAmount !== 'undefined' && + w.config.xaxis.tickAmount !== 'dataPoints' && + w.config.xaxis.type !== 'datetime' + + if (isCategoryTickAmounts) { + label = this.axesUtils.checkLabelBasedOnTickamount(i, label, labelsLen) + } else { + label = this.axesUtils.checkForOverflowingLabels( + i, + label, + labelsLen, + drawnLabels, + drawnLabelsRects + ) + } + + const getCatForeColor = () => { + return isLeafGroup && w.config.xaxis.convertedCatToNumeric + ? xaxisForeColors[w.globals.minX + i - 1] + : xaxisForeColors[i] + } + + if (w.config.xaxis.labels.show) { + let elText = graphics.drawText({ + x: label.x, + y: + this.offY + + w.config.xaxis.labels.offsetY + + offsetYCorrection - + (w.config.xaxis.position === 'top' + ? w.globals.xAxisHeight + w.config.xaxis.axisTicks.height - 2 + : 0), + text: label.text, + textAnchor: 'middle', + fontWeight: label.isBold ? 600 : fontWeight, + fontSize: xaxisFontSize, + fontFamily: xaxisFontFamily, + foreColor: Array.isArray(xaxisForeColors) + ? getCatForeColor() + : xaxisForeColors, + isPlainText: false, + cssClass: + (isLeafGroup + ? 'apexcharts-xaxis-label ' + : 'apexcharts-xaxis-group-label ') + cssClass, + }) + elXaxisTexts.add(elText) + + elText.on('click', (e) => { + if (typeof w.config.chart.events.xAxisLabelClick === 'function') { + const opts = Object.assign({}, w, { + labelIndex: i, + }) + + w.config.chart.events.xAxisLabelClick(e, this.ctx, opts) + } + }) + + if (isLeafGroup) { + let elTooltipTitle = document.createElementNS( + w.globals.SVGNS, + 'title' + ) + elTooltipTitle.textContent = Array.isArray(label.text) + ? label.text.join(' ') + : label.text + elText.node.appendChild(elTooltipTitle) + if (label.text !== '') { + drawnLabels.push(label.text) + drawnLabelsRects.push(label) + } + } + } + if (i < labelsLen - 1) { + xPos = xPos + colWidthCb(i + 1, colWidth) + } + } + } + + // this actually becomes the vertical axis (for bar charts) + drawXaxisInversed(realIndex) { + let w = this.w + let graphics = new Graphics(this.ctx) + + let translateYAxisX = w.config.yaxis[0].opposite + ? w.globals.translateYAxisX[realIndex] + : 0 + + let elYaxis = graphics.group({ + class: 'apexcharts-yaxis apexcharts-xaxis-inversed', + rel: realIndex, + }) + + let elYaxisTexts = graphics.group({ + class: 'apexcharts-yaxis-texts-g apexcharts-xaxis-inversed-texts-g', + transform: 'translate(' + translateYAxisX + ', 0)', + }) + + elYaxis.add(elYaxisTexts) + + let colHeight + + // initial x Position (keep adding column width in the loop) + let yPos + let labels = [] + + if (w.config.yaxis[realIndex].show) { + for (let i = 0; i < this.xaxisLabels.length; i++) { + labels.push(this.xaxisLabels[i]) + } + } + + colHeight = w.globals.gridHeight / labels.length + yPos = -(colHeight / 2.2) + + let lbFormatter = w.globals.yLabelFormatters[0] + + const ylabels = w.config.yaxis[0].labels + + if (ylabels.show) { + for (let i = 0; i <= labels.length - 1; i++) { + let label = typeof labels[i] === 'undefined' ? '' : labels[i] + + label = lbFormatter(label, { + seriesIndex: realIndex, + dataPointIndex: i, + w, + }) + + const yColors = this.axesUtils.getYAxisForeColor( + ylabels.style.colors, + realIndex + ) + const getForeColor = () => { + return Array.isArray(yColors) ? yColors[i] : yColors + } + + let multiY = 0 + if (Array.isArray(label)) { + multiY = (label.length / 2) * parseInt(ylabels.style.fontSize, 10) + } + + let offsetX = ylabels.offsetX - 15 + let textAnchor = 'end' + if (this.yaxis.opposite) { + textAnchor = 'start' + } + if (w.config.yaxis[0].labels.align === 'left') { + offsetX = ylabels.offsetX + textAnchor = 'start' + } else if (w.config.yaxis[0].labels.align === 'center') { + offsetX = ylabels.offsetX + textAnchor = 'middle' + } else if (w.config.yaxis[0].labels.align === 'right') { + textAnchor = 'end' + } + + let elLabel = graphics.drawText({ + x: offsetX, + y: yPos + colHeight + ylabels.offsetY - multiY, + text: label, + textAnchor, + foreColor: getForeColor(), + fontSize: ylabels.style.fontSize, + fontFamily: ylabels.style.fontFamily, + fontWeight: ylabels.style.fontWeight, + isPlainText: false, + cssClass: 'apexcharts-yaxis-label ' + ylabels.style.cssClass, + maxWidth: ylabels.maxWidth, + }) + + elYaxisTexts.add(elLabel) + + elLabel.on('click', (e) => { + if (typeof w.config.chart.events.xAxisLabelClick === 'function') { + const opts = Object.assign({}, w, { + labelIndex: i, + }) + + w.config.chart.events.xAxisLabelClick(e, this.ctx, opts) + } + }) + + let elTooltipTitle = document.createElementNS(w.globals.SVGNS, 'title') + elTooltipTitle.textContent = Array.isArray(label) + ? label.join(' ') + : label + elLabel.node.appendChild(elTooltipTitle) + + if (w.config.yaxis[realIndex].labels.rotate !== 0) { + let labelRotatingCenter = graphics.rotateAroundCenter(elLabel.node) + elLabel.node.setAttribute( + 'transform', + `rotate(${w.config.yaxis[realIndex].labels.rotate} 0 ${labelRotatingCenter.y})` + ) + } + yPos = yPos + colHeight + } + } + + if (w.config.yaxis[0].title.text !== undefined) { + let elXaxisTitle = graphics.group({ + class: 'apexcharts-yaxis-title apexcharts-xaxis-title-inversed', + transform: 'translate(' + translateYAxisX + ', 0)', + }) + + let elXAxisTitleText = graphics.drawText({ + x: w.config.yaxis[0].title.offsetX, + y: w.globals.gridHeight / 2 + w.config.yaxis[0].title.offsetY, + text: w.config.yaxis[0].title.text, + textAnchor: 'middle', + foreColor: w.config.yaxis[0].title.style.color, + fontSize: w.config.yaxis[0].title.style.fontSize, + fontWeight: w.config.yaxis[0].title.style.fontWeight, + fontFamily: w.config.yaxis[0].title.style.fontFamily, + cssClass: + 'apexcharts-yaxis-title-text ' + + w.config.yaxis[0].title.style.cssClass, + }) + + elXaxisTitle.add(elXAxisTitleText) + + elYaxis.add(elXaxisTitle) + } + + let offX = 0 + if (this.isCategoryBarHorizontal && w.config.yaxis[0].opposite) { + offX = w.globals.gridWidth + } + const axisBorder = w.config.xaxis.axisBorder + if (axisBorder.show) { + let elVerticalLine = graphics.drawLine( + w.globals.padHorizontal + axisBorder.offsetX + offX, + 1 + axisBorder.offsetY, + w.globals.padHorizontal + axisBorder.offsetX + offX, + w.globals.gridHeight + axisBorder.offsetY, + axisBorder.color, + 0 + ) + + if (this.elgrid && this.elgrid.elGridBorders && w.config.grid.show) { + this.elgrid.elGridBorders.add(elVerticalLine) + } else { + elYaxis.add(elVerticalLine) + } + } + + if (w.config.yaxis[0].axisTicks.show) { + this.axesUtils.drawYAxisTicks( + offX, + labels.length, + w.config.yaxis[0].axisBorder, + w.config.yaxis[0].axisTicks, + 0, + colHeight, + elYaxis + ) + } + + return elYaxis + } + + drawXaxisTicks(x1, y2, appendToElement) { + let w = this.w + let x2 = x1 + + if (x1 < 0 || x1 - 2 > w.globals.gridWidth) return + + let y1 = this.offY + w.config.xaxis.axisTicks.offsetY + y2 = y2 + y1 + w.config.xaxis.axisTicks.height + if (w.config.xaxis.position === 'top') { + y2 = y1 - w.config.xaxis.axisTicks.height + } + + if (w.config.xaxis.axisTicks.show) { + let graphics = new Graphics(this.ctx) + + let line = graphics.drawLine( + x1 + w.config.xaxis.axisTicks.offsetX, + y1 + w.config.xaxis.offsetY, + x2 + w.config.xaxis.axisTicks.offsetX, + y2 + w.config.xaxis.offsetY, + w.config.xaxis.axisTicks.color + ) + + // we are not returning anything, but appending directly to the element passed in param + appendToElement.add(line) + line.node.classList.add('apexcharts-xaxis-tick') + } + } + + getXAxisTicksPositions() { + const w = this.w + let xAxisTicksPositions = [] + + const xCount = this.xaxisLabels.length + let x1 = w.globals.padHorizontal + + if (w.globals.timescaleLabels.length > 0) { + for (let i = 0; i < xCount; i++) { + x1 = this.xaxisLabels[i].position + xAxisTicksPositions.push(x1) + } + } else { + let xCountForCategoryCharts = xCount + for (let i = 0; i < xCountForCategoryCharts; i++) { + let x1Count = xCountForCategoryCharts + if (w.globals.isXNumeric && w.config.chart.type !== 'bar') { + x1Count -= 1 + } + x1 = x1 + w.globals.gridWidth / x1Count + xAxisTicksPositions.push(x1) + } + } + + return xAxisTicksPositions + } + + // to rotate x-axis labels or to put ... for longer text in xaxis + xAxisLabelCorrections() { + let w = this.w + + let graphics = new Graphics(this.ctx) + + let xAxis = w.globals.dom.baseEl.querySelector('.apexcharts-xaxis-texts-g') + + let xAxisTexts = w.globals.dom.baseEl.querySelectorAll( + '.apexcharts-xaxis-texts-g text:not(.apexcharts-xaxis-group-label)' + ) + let yAxisTextsInversed = w.globals.dom.baseEl.querySelectorAll( + '.apexcharts-yaxis-inversed text' + ) + let xAxisTextsInversed = w.globals.dom.baseEl.querySelectorAll( + '.apexcharts-xaxis-inversed-texts-g text tspan' + ) + + if (w.globals.rotateXLabels || w.config.xaxis.labels.rotateAlways) { + for (let xat = 0; xat < xAxisTexts.length; xat++) { + let textRotatingCenter = graphics.rotateAroundCenter(xAxisTexts[xat]) + textRotatingCenter.y = textRotatingCenter.y - 1 // + tickWidth/4; + textRotatingCenter.x = textRotatingCenter.x + 1 + + xAxisTexts[xat].setAttribute( + 'transform', + `rotate(${w.config.xaxis.labels.rotate} ${textRotatingCenter.x} ${textRotatingCenter.y})` + ) + + xAxisTexts[xat].setAttribute('text-anchor', `end`) + + let offsetHeight = 10 + + xAxis.setAttribute('transform', `translate(0, ${-offsetHeight})`) + + let tSpan = xAxisTexts[xat].childNodes + + if (w.config.xaxis.labels.trim) { + Array.prototype.forEach.call(tSpan, (ts) => { + graphics.placeTextWithEllipsis( + ts, + ts.textContent, + w.globals.xAxisLabelsHeight - + (w.config.legend.position === 'bottom' ? 20 : 10) + ) + }) + } + } + } else { + let width = w.globals.gridWidth / (w.globals.labels.length + 1) + + for (let xat = 0; xat < xAxisTexts.length; xat++) { + let tSpan = xAxisTexts[xat].childNodes + + if (w.config.xaxis.labels.trim && w.config.xaxis.type !== 'datetime') { + Array.prototype.forEach.call(tSpan, (ts) => { + graphics.placeTextWithEllipsis(ts, ts.textContent, width) + }) + } + } + } + + if (yAxisTextsInversed.length > 0) { + // truncate rotated y axis in bar chart (x axis) + let firstLabelPosX = + yAxisTextsInversed[yAxisTextsInversed.length - 1].getBBox() + let lastLabelPosX = yAxisTextsInversed[0].getBBox() + + if (firstLabelPosX.x < -20) { + yAxisTextsInversed[ + yAxisTextsInversed.length - 1 + ].parentNode.removeChild( + yAxisTextsInversed[yAxisTextsInversed.length - 1] + ) + } + + if ( + lastLabelPosX.x + lastLabelPosX.width > w.globals.gridWidth && + !w.globals.isBarHorizontal + ) { + yAxisTextsInversed[0].parentNode.removeChild(yAxisTextsInversed[0]) + } + + // truncate rotated x axis in bar chart (y axis) + for (let xat = 0; xat < xAxisTextsInversed.length; xat++) { + graphics.placeTextWithEllipsis( + xAxisTextsInversed[xat], + xAxisTextsInversed[xat].textContent, + w.config.yaxis[0].labels.maxWidth - + (w.config.yaxis[0].title.text + ? parseFloat(w.config.yaxis[0].title.style.fontSize) * 2 + : 0) - + 15 + ) + } + } + } + + // renderXAxisBands() { + // let w = this.w; + + // let plotBand = document.createElementNS(w.globals.SVGNS, 'rect') + // w.globals.dom.elGraphical.add(plotBand) + // } +} diff --git a/node_modules/apexcharts/src/modules/axes/YAxis.js b/node_modules/apexcharts/src/modules/axes/YAxis.js new file mode 100644 index 0000000..b97dd7d --- /dev/null +++ b/node_modules/apexcharts/src/modules/axes/YAxis.js @@ -0,0 +1,506 @@ +import Graphics from '../Graphics' +import Utils from '../../utils/Utils' +import AxesUtils from './AxesUtils' + +/** + * ApexCharts YAxis Class for drawing Y-Axis. + * + * @module YAxis + **/ + +export default class YAxis { + constructor(ctx, elgrid) { + this.ctx = ctx + this.elgrid = elgrid + this.w = ctx.w + const w = this.w + + this.xaxisFontSize = w.config.xaxis.labels.style.fontSize + this.axisFontFamily = w.config.xaxis.labels.style.fontFamily + this.xaxisForeColors = w.config.xaxis.labels.style.colors + this.isCategoryBarHorizontal = + w.config.chart.type === 'bar' && w.config.plotOptions.bar.horizontal + this.xAxisoffX = + w.config.xaxis.position === 'bottom' ? w.globals.gridHeight : 0 + this.drawnLabels = [] + this.axesUtils = new AxesUtils(ctx) + } + + drawYaxis(realIndex) { + const w = this.w + const graphics = new Graphics(this.ctx) + const yaxisStyle = w.config.yaxis[realIndex].labels.style + const { + fontSize: yaxisFontSize, + fontFamily: yaxisFontFamily, + fontWeight: yaxisFontWeight, + } = yaxisStyle + + const elYaxis = graphics.group({ + class: 'apexcharts-yaxis', + rel: realIndex, + transform: `translate(${w.globals.translateYAxisX[realIndex]}, 0)`, + }) + + if (this.axesUtils.isYAxisHidden(realIndex)) return elYaxis + + const elYaxisTexts = graphics.group({ class: 'apexcharts-yaxis-texts-g' }) + elYaxis.add(elYaxisTexts) + + const tickAmount = w.globals.yAxisScale[realIndex].result.length - 1 + const labelsDivider = w.globals.gridHeight / tickAmount + const lbFormatter = w.globals.yLabelFormatters[realIndex] + let labels = this.axesUtils.checkForReversedLabels( + realIndex, + w.globals.yAxisScale[realIndex].result.slice() + ) + + if (w.config.yaxis[realIndex].labels.show) { + let lY = w.globals.translateY + w.config.yaxis[realIndex].labels.offsetY + if (w.globals.isBarHorizontal) lY = 0 + else if (w.config.chart.type === 'heatmap') lY -= labelsDivider / 2 + lY += parseInt(yaxisFontSize, 10) / 3 + + for (let i = tickAmount; i >= 0; i--) { + let val = lbFormatter(labels[i], i, w) + let xPad = w.config.yaxis[realIndex].labels.padding + if (w.config.yaxis[realIndex].opposite && w.config.yaxis.length !== 0) + xPad *= -1 + + const textAnchor = this.getTextAnchor( + w.config.yaxis[realIndex].labels.align, + w.config.yaxis[realIndex].opposite + ) + const yColors = this.axesUtils.getYAxisForeColor( + yaxisStyle.colors, + realIndex + ) + const foreColor = Array.isArray(yColors) ? yColors[i] : yColors + + const existingYLabels = Utils.listToArray( + w.globals.dom.baseEl.querySelectorAll( + `.apexcharts-yaxis[rel='${realIndex}'] .apexcharts-yaxis-label tspan` + ) + ).map((label) => label.textContent) + + const label = graphics.drawText({ + x: xPad, + y: lY, + text: + existingYLabels.includes(val) && + !w.config.yaxis[realIndex].labels.showDuplicates + ? '' + : val, + textAnchor, + fontSize: yaxisFontSize, + fontFamily: yaxisFontFamily, + fontWeight: yaxisFontWeight, + maxWidth: w.config.yaxis[realIndex].labels.maxWidth, + foreColor, + isPlainText: false, + cssClass: `apexcharts-yaxis-label ${yaxisStyle.cssClass}`, + }) + + elYaxisTexts.add(label) + this.addTooltip(label, val) + + if (w.config.yaxis[realIndex].labels.rotate !== 0) { + this.rotateLabel( + graphics, + label, + firstLabel, + w.config.yaxis[realIndex].labels.rotate + ) + } + + lY += labelsDivider + } + } + + this.addYAxisTitle(graphics, elYaxis, realIndex) + this.addAxisBorder(graphics, elYaxis, realIndex, tickAmount, labelsDivider) + + return elYaxis + } + + getTextAnchor(align, opposite) { + if (align === 'left') return 'start' + if (align === 'center') return 'middle' + if (align === 'right') return 'end' + return opposite ? 'start' : 'end' + } + + addTooltip(label, val) { + const elTooltipTitle = document.createElementNS( + this.w.globals.SVGNS, + 'title' + ) + elTooltipTitle.textContent = Array.isArray(val) ? val.join(' ') : val + label.node.appendChild(elTooltipTitle) + } + + rotateLabel(graphics, label, firstLabel, rotate) { + const firstLabelCenter = graphics.rotateAroundCenter(firstLabel.node) + const labelCenter = graphics.rotateAroundCenter(label.node) + label.node.setAttribute( + 'transform', + `rotate(${rotate} ${firstLabelCenter.x} ${labelCenter.y})` + ) + } + + addYAxisTitle(graphics, elYaxis, realIndex) { + const w = this.w + if (w.config.yaxis[realIndex].title.text !== undefined) { + const elYaxisTitle = graphics.group({ class: 'apexcharts-yaxis-title' }) + const x = w.config.yaxis[realIndex].opposite + ? w.globals.translateYAxisX[realIndex] + : 0 + const elYAxisTitleText = graphics.drawText({ + x, + y: + w.globals.gridHeight / 2 + + w.globals.translateY + + w.config.yaxis[realIndex].title.offsetY, + text: w.config.yaxis[realIndex].title.text, + textAnchor: 'end', + foreColor: w.config.yaxis[realIndex].title.style.color, + fontSize: w.config.yaxis[realIndex].title.style.fontSize, + fontWeight: w.config.yaxis[realIndex].title.style.fontWeight, + fontFamily: w.config.yaxis[realIndex].title.style.fontFamily, + cssClass: `apexcharts-yaxis-title-text ${w.config.yaxis[realIndex].title.style.cssClass}`, + }) + elYaxisTitle.add(elYAxisTitleText) + elYaxis.add(elYaxisTitle) + } + } + + addAxisBorder(graphics, elYaxis, realIndex, tickAmount, labelsDivider) { + const w = this.w + const axisBorder = w.config.yaxis[realIndex].axisBorder + let x = 31 + axisBorder.offsetX + if (w.config.yaxis[realIndex].opposite) x = -31 - axisBorder.offsetX + + if (axisBorder.show) { + const elVerticalLine = graphics.drawLine( + x, + w.globals.translateY + axisBorder.offsetY - 2, + x, + w.globals.gridHeight + w.globals.translateY + axisBorder.offsetY + 2, + axisBorder.color, + 0, + axisBorder.width + ) + elYaxis.add(elVerticalLine) + } + + if (w.config.yaxis[realIndex].axisTicks.show) { + this.axesUtils.drawYAxisTicks( + x, + tickAmount, + axisBorder, + w.config.yaxis[realIndex].axisTicks, + realIndex, + labelsDivider, + elYaxis + ) + } + } + + drawYaxisInversed(realIndex) { + const w = this.w + const graphics = new Graphics(this.ctx) + + const elXaxis = graphics.group({ + class: 'apexcharts-xaxis apexcharts-yaxis-inversed', + }) + + const elXaxisTexts = graphics.group({ + class: 'apexcharts-xaxis-texts-g', + transform: `translate(${w.globals.translateXAxisX}, ${w.globals.translateXAxisY})`, + }) + + elXaxis.add(elXaxisTexts) + + let tickAmount = w.globals.yAxisScale[realIndex].result.length - 1 + const labelsDivider = w.globals.gridWidth / tickAmount + 0.1 + let l = labelsDivider + w.config.xaxis.labels.offsetX + const lbFormatter = w.globals.xLabelFormatter + let labels = this.axesUtils.checkForReversedLabels( + realIndex, + w.globals.yAxisScale[realIndex].result.slice() + ) + const timescaleLabels = w.globals.timescaleLabels + + if (timescaleLabels.length > 0) { + this.xaxisLabels = timescaleLabels.slice() + labels = timescaleLabels.slice() + tickAmount = labels.length + } + + if (w.config.xaxis.labels.show) { + for ( + let i = timescaleLabels.length ? 0 : tickAmount; + timescaleLabels.length ? i < timescaleLabels.length : i >= 0; + timescaleLabels.length ? i++ : i-- + ) { + let val = lbFormatter(labels[i], i, w) + let x = + w.globals.gridWidth + + w.globals.padHorizontal - + (l - labelsDivider + w.config.xaxis.labels.offsetX) + + if (timescaleLabels.length) { + const label = this.axesUtils.getLabel( + labels, + timescaleLabels, + x, + i, + this.drawnLabels, + this.xaxisFontSize + ) + x = label.x + val = label.text + this.drawnLabels.push(label.text) + if (i === 0 && w.globals.skipFirstTimelinelabel) val = '' + if (i === labels.length - 1 && w.globals.skipLastTimelinelabel) + val = '' + } + + const elTick = graphics.drawText({ + x, + y: + this.xAxisoffX + + w.config.xaxis.labels.offsetY + + 30 - + (w.config.xaxis.position === 'top' + ? w.globals.xAxisHeight + w.config.xaxis.axisTicks.height - 2 + : 0), + text: val, + textAnchor: 'middle', + foreColor: Array.isArray(this.xaxisForeColors) + ? this.xaxisForeColors[realIndex] + : this.xaxisForeColors, + fontSize: this.xaxisFontSize, + fontFamily: this.xaxisFontFamily, + fontWeight: w.config.xaxis.labels.style.fontWeight, + isPlainText: false, + cssClass: `apexcharts-xaxis-label ${w.config.xaxis.labels.style.cssClass}`, + }) + + elXaxisTexts.add(elTick) + elTick.tspan(val) + this.addTooltip(elTick, val) + l += labelsDivider + } + } + + this.inversedYAxisTitleText(elXaxis) + this.inversedYAxisBorder(elXaxis) + + return elXaxis + } + + inversedYAxisBorder(parent) { + const w = this.w + const graphics = new Graphics(this.ctx) + const axisBorder = w.config.xaxis.axisBorder + + if (axisBorder.show) { + let lineCorrection = 0 + if (w.config.chart.type === 'bar' && w.globals.isXNumeric) + lineCorrection -= 15 + + const elHorzLine = graphics.drawLine( + w.globals.padHorizontal + lineCorrection + axisBorder.offsetX, + this.xAxisoffX, + w.globals.gridWidth, + this.xAxisoffX, + axisBorder.color, + 0, + axisBorder.height + ) + + if (this.elgrid && this.elgrid.elGridBorders && w.config.grid.show) { + this.elgrid.elGridBorders.add(elHorzLine) + } else { + parent.add(elHorzLine) + } + } + } + + inversedYAxisTitleText(parent) { + const w = this.w + const graphics = new Graphics(this.ctx) + + if (w.config.xaxis.title.text !== undefined) { + const elYaxisTitle = graphics.group({ + class: 'apexcharts-xaxis-title apexcharts-yaxis-title-inversed', + }) + const elYAxisTitleText = graphics.drawText({ + x: w.globals.gridWidth / 2 + w.config.xaxis.title.offsetX, + y: + this.xAxisoffX + + parseFloat(this.xaxisFontSize) + + parseFloat(w.config.xaxis.title.style.fontSize) + + w.config.xaxis.title.offsetY + + 20, + text: w.config.xaxis.title.text, + textAnchor: 'middle', + fontSize: w.config.xaxis.title.style.fontSize, + fontFamily: w.config.xaxis.title.style.fontFamily, + fontWeight: w.config.xaxis.title.style.fontWeight, + foreColor: w.config.xaxis.title.style.color, + cssClass: `apexcharts-xaxis-title-text ${w.config.xaxis.title.style.cssClass}`, + }) + + elYaxisTitle.add(elYAxisTitleText) + parent.add(elYaxisTitle) + } + } + + yAxisTitleRotate(realIndex, yAxisOpposite) { + const w = this.w + const graphics = new Graphics(this.ctx) + const elYAxisLabelsWrap = w.globals.dom.baseEl.querySelector( + `.apexcharts-yaxis[rel='${realIndex}'] .apexcharts-yaxis-texts-g` + ) + const yAxisLabelsCoord = elYAxisLabelsWrap + ? elYAxisLabelsWrap.getBoundingClientRect() + : { width: 0, height: 0 } + const yAxisTitle = w.globals.dom.baseEl.querySelector( + `.apexcharts-yaxis[rel='${realIndex}'] .apexcharts-yaxis-title text` + ) + const yAxisTitleCoord = yAxisTitle + ? yAxisTitle.getBoundingClientRect() + : { width: 0, height: 0 } + + if (yAxisTitle) { + const x = this.xPaddingForYAxisTitle( + realIndex, + yAxisLabelsCoord, + yAxisTitleCoord, + yAxisOpposite + ) + yAxisTitle.setAttribute('x', x.xPos - (yAxisOpposite ? 10 : 0)) + const titleRotatingCenter = graphics.rotateAroundCenter(yAxisTitle) + yAxisTitle.setAttribute( + 'transform', + `rotate(${ + yAxisOpposite + ? w.config.yaxis[realIndex].title.rotate * -1 + : w.config.yaxis[realIndex].title.rotate + } ${titleRotatingCenter.x} ${titleRotatingCenter.y})` + ) + } + } + + xPaddingForYAxisTitle( + realIndex, + yAxisLabelsCoord, + yAxisTitleCoord, + yAxisOpposite + ) { + const w = this.w + let x = 0 + let padd = 10 + + if (w.config.yaxis[realIndex].title.text === undefined || realIndex < 0) { + return { xPos: x, padd: 0 } + } + + if (yAxisOpposite) { + x = + yAxisLabelsCoord.width + + w.config.yaxis[realIndex].title.offsetX + + yAxisTitleCoord.width / 2 + + padd / 2 + } else { + x = + yAxisLabelsCoord.width * -1 + + w.config.yaxis[realIndex].title.offsetX + + padd / 2 + + yAxisTitleCoord.width / 2 + if (w.globals.isBarHorizontal) { + padd = 25 + x = + yAxisLabelsCoord.width * -1 - + w.config.yaxis[realIndex].title.offsetX - + padd + } + } + + return { xPos: x, padd } + } + + setYAxisXPosition(yaxisLabelCoords, yTitleCoords) { + const w = this.w + let xLeft = 0 + let xRight = 0 + let leftOffsetX = 18 + let rightOffsetX = 1 + + if (w.config.yaxis.length > 1) this.multipleYs = true + + w.config.yaxis.forEach((yaxe, index) => { + const shouldNotDrawAxis = + w.globals.ignoreYAxisIndexes.includes(index) || + !yaxe.show || + yaxe.floating || + yaxisLabelCoords[index].width === 0 + const axisWidth = + yaxisLabelCoords[index].width + yTitleCoords[index].width + + if (!yaxe.opposite) { + xLeft = w.globals.translateX - leftOffsetX + if (!shouldNotDrawAxis) leftOffsetX += axisWidth + 20 + w.globals.translateYAxisX[index] = xLeft + yaxe.labels.offsetX + } else { + if (w.globals.isBarHorizontal) { + xRight = w.globals.gridWidth + w.globals.translateX - 1 + w.globals.translateYAxisX[index] = xRight - yaxe.labels.offsetX + } else { + xRight = w.globals.gridWidth + w.globals.translateX + rightOffsetX + if (!shouldNotDrawAxis) rightOffsetX += axisWidth + 20 + w.globals.translateYAxisX[index] = xRight - yaxe.labels.offsetX + 20 + } + } + }) + } + + setYAxisTextAlignments() { + const w = this.w + const yaxis = Utils.listToArray( + w.globals.dom.baseEl.getElementsByClassName('apexcharts-yaxis') + ) + + yaxis.forEach((y, index) => { + const yaxe = w.config.yaxis[index] + if (yaxe && !yaxe.floating && yaxe.labels.align !== undefined) { + const yAxisInner = w.globals.dom.baseEl.querySelector( + `.apexcharts-yaxis[rel='${index}'] .apexcharts-yaxis-texts-g` + ) + const yAxisTexts = Utils.listToArray( + w.globals.dom.baseEl.querySelectorAll( + `.apexcharts-yaxis[rel='${index}'] .apexcharts-yaxis-label` + ) + ) + const rect = yAxisInner.getBoundingClientRect() + + yAxisTexts.forEach((label) => { + label.setAttribute('text-anchor', yaxe.labels.align) + }) + + if (yaxe.labels.align === 'left' && !yaxe.opposite) { + yAxisInner.setAttribute('transform', `translate(-${rect.width}, 0)`) + } else if (yaxe.labels.align === 'center') { + yAxisInner.setAttribute( + 'transform', + `translate(${(rect.width / 2) * (!yaxe.opposite ? -1 : 1)}, 0)` + ) + } else if (yaxe.labels.align === 'right' && yaxe.opposite) { + yAxisInner.setAttribute('transform', `translate(${rect.width}, 0)`) + } + } + }) + } +} diff --git a/node_modules/apexcharts/src/modules/dimensions/Dimensions.js b/node_modules/apexcharts/src/modules/dimensions/Dimensions.js new file mode 100644 index 0000000..a1e8e4f --- /dev/null +++ b/node_modules/apexcharts/src/modules/dimensions/Dimensions.js @@ -0,0 +1,360 @@ +import YAxis from '../axes/YAxis' +import Helpers from './Helpers' +import DimXAxis from './XAxis' +import DimYAxis from './YAxis' +import Grid from './Grid' + +/** + * ApexCharts Dimensions Class for calculating rects of all elements that are drawn and will be drawn. + * + * @module Dimensions + **/ + +export default class Dimensions { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + this.lgRect = {} + this.yAxisWidth = 0 + this.yAxisWidthLeft = 0 + this.yAxisWidthRight = 0 + this.xAxisHeight = 0 + this.isSparkline = this.w.config.chart.sparkline.enabled + + this.dimHelpers = new Helpers(this) + this.dimYAxis = new DimYAxis(this) + this.dimXAxis = new DimXAxis(this) + this.dimGrid = new Grid(this) + this.lgWidthForSideLegends = 0 + this.gridPad = this.w.config.grid.padding + this.xPadRight = 0 + this.xPadLeft = 0 + } + + /** + * @memberof Dimensions + * @param {object} w - chart context + **/ + plotCoords() { + let w = this.w + let gl = w.globals + + this.lgRect = this.dimHelpers.getLegendsRect() + this.datalabelsCoords = { width: 0, height: 0 } + + const maxStrokeWidth = Array.isArray(w.config.stroke.width) + ? Math.max(...w.config.stroke.width) + : w.config.stroke.width + + if (this.isSparkline) { + if (w.config.markers.discrete.length > 0 || w.config.markers.size > 0) { + Object.entries(this.gridPad).forEach(([k, v]) => { + this.gridPad[k] = Math.max( + v, + this.w.globals.markers.largestSize / 1.5 + ) + }) + } + + this.gridPad.top = Math.max(maxStrokeWidth / 2, this.gridPad.top) + this.gridPad.bottom = Math.max(maxStrokeWidth / 2, this.gridPad.bottom) + } + + if (gl.axisCharts) { + // for line / area / scatter / column + this.setDimensionsForAxisCharts() + } else { + // for pie / donuts / circle + this.setDimensionsForNonAxisCharts() + } + + this.dimGrid.gridPadFortitleSubtitle() + + // after calculating everything, apply padding set by user + gl.gridHeight = gl.gridHeight - this.gridPad.top - this.gridPad.bottom + + gl.gridWidth = + gl.gridWidth - + this.gridPad.left - + this.gridPad.right - + this.xPadRight - + this.xPadLeft + + let barWidth = this.dimGrid.gridPadForColumnsInNumericAxis(gl.gridWidth) + + gl.gridWidth = gl.gridWidth - barWidth * 2 + + gl.translateX = + gl.translateX + + this.gridPad.left + + this.xPadLeft + + (barWidth > 0 ? barWidth : 0) + gl.translateY = gl.translateY + this.gridPad.top + } + + setDimensionsForAxisCharts() { + let w = this.w + let gl = w.globals + + let yaxisLabelCoords = this.dimYAxis.getyAxisLabelsCoords() + let yTitleCoords = this.dimYAxis.getyAxisTitleCoords() + + if (gl.isSlopeChart) { + this.datalabelsCoords = this.dimHelpers.getDatalabelsRect() + } + + w.globals.yLabelsCoords = [] + w.globals.yTitleCoords = [] + w.config.yaxis.map((yaxe, index) => { + // store the labels and titles coords in global vars + w.globals.yLabelsCoords.push({ + width: yaxisLabelCoords[index].width, + index, + }) + w.globals.yTitleCoords.push({ + width: yTitleCoords[index].width, + index, + }) + }) + + this.yAxisWidth = this.dimYAxis.getTotalYAxisWidth() + + let xaxisLabelCoords = this.dimXAxis.getxAxisLabelsCoords() + let xaxisGroupLabelCoords = this.dimXAxis.getxAxisGroupLabelsCoords() + let xtitleCoords = this.dimXAxis.getxAxisTitleCoords() + + this.conditionalChecksForAxisCoords( + xaxisLabelCoords, + xtitleCoords, + xaxisGroupLabelCoords + ) + + gl.translateXAxisY = w.globals.rotateXLabels ? this.xAxisHeight / 8 : -4 + gl.translateXAxisX = + w.globals.rotateXLabels && + w.globals.isXNumeric && + w.config.xaxis.labels.rotate <= -45 + ? -this.xAxisWidth / 4 + : 0 + + if (w.globals.isBarHorizontal) { + gl.rotateXLabels = false + gl.translateXAxisY = + -1 * (parseInt(w.config.xaxis.labels.style.fontSize, 10) / 1.5) + } + + gl.translateXAxisY = gl.translateXAxisY + w.config.xaxis.labels.offsetY + gl.translateXAxisX = gl.translateXAxisX + w.config.xaxis.labels.offsetX + + let yAxisWidth = this.yAxisWidth + let xAxisHeight = this.xAxisHeight + gl.xAxisLabelsHeight = this.xAxisHeight - xtitleCoords.height + gl.xAxisGroupLabelsHeight = gl.xAxisLabelsHeight - xaxisLabelCoords.height + gl.xAxisLabelsWidth = this.xAxisWidth + gl.xAxisHeight = this.xAxisHeight + let translateY = 10 + + if (w.config.chart.type === 'radar' || this.isSparkline) { + yAxisWidth = 0 + xAxisHeight = 0 + } + + if (this.isSparkline) { + this.lgRect = { + height: 0, + width: 0, + } + } + + if (this.isSparkline || w.config.chart.type === 'treemap') { + yAxisWidth = 0 + xAxisHeight = 0 + translateY = 0 + } + + if (!this.isSparkline && w.config.chart.type !== 'treemap') { + this.dimXAxis.additionalPaddingXLabels(xaxisLabelCoords) + } + + const legendTopBottom = () => { + gl.translateX = yAxisWidth + this.datalabelsCoords.width + gl.gridHeight = + gl.svgHeight - + this.lgRect.height - + xAxisHeight - + (!this.isSparkline && w.config.chart.type !== 'treemap' + ? w.globals.rotateXLabels + ? 10 + : 15 + : 0) + gl.gridWidth = gl.svgWidth - yAxisWidth - this.datalabelsCoords.width * 2 + } + + if (w.config.xaxis.position === 'top') + translateY = gl.xAxisHeight - w.config.xaxis.axisTicks.height - 5 + + switch (w.config.legend.position) { + case 'bottom': + gl.translateY = translateY + legendTopBottom() + break + case 'top': + gl.translateY = this.lgRect.height + translateY + legendTopBottom() + break + case 'left': + gl.translateY = translateY + gl.translateX = + this.lgRect.width + yAxisWidth + this.datalabelsCoords.width + gl.gridHeight = gl.svgHeight - xAxisHeight - 12 + gl.gridWidth = + gl.svgWidth - + this.lgRect.width - + yAxisWidth - + this.datalabelsCoords.width * 2 + break + case 'right': + gl.translateY = translateY + gl.translateX = yAxisWidth + this.datalabelsCoords.width + gl.gridHeight = gl.svgHeight - xAxisHeight - 12 + gl.gridWidth = + gl.svgWidth - + this.lgRect.width - + yAxisWidth - + this.datalabelsCoords.width * 2 - + 5 + break + default: + throw new Error('Legend position not supported') + } + + this.dimGrid.setGridXPosForDualYAxis(yTitleCoords, yaxisLabelCoords) + + // after drawing everything, set the Y axis positions + let objyAxis = new YAxis(this.ctx) + objyAxis.setYAxisXPosition(yaxisLabelCoords, yTitleCoords) + } + + setDimensionsForNonAxisCharts() { + let w = this.w + let gl = w.globals + let cnf = w.config + let xPad = 0 + + if (w.config.legend.show && !w.config.legend.floating) { + xPad = 20 + } + + const type = + cnf.chart.type === 'pie' || + cnf.chart.type === 'polarArea' || + cnf.chart.type === 'donut' + ? 'pie' + : 'radialBar' + + let offY = cnf.plotOptions[type].offsetY + let offX = cnf.plotOptions[type].offsetX + + if (!cnf.legend.show || cnf.legend.floating) { + gl.gridHeight = gl.svgHeight + + const maxWidth = gl.dom.elWrap.getBoundingClientRect().width + gl.gridWidth = Math.min(maxWidth, gl.gridHeight) + + gl.translateY = offY + gl.translateX = offX + (gl.svgWidth - gl.gridWidth) / 2 + return + } + + switch (cnf.legend.position) { + case 'bottom': + gl.gridHeight = gl.svgHeight - this.lgRect.height + gl.gridWidth = gl.svgWidth + gl.translateY = offY - 10 + gl.translateX = offX + (gl.svgWidth - gl.gridWidth) / 2 + break + case 'top': + gl.gridHeight = gl.svgHeight - this.lgRect.height + gl.gridWidth = gl.svgWidth + gl.translateY = this.lgRect.height + offY + 10 + gl.translateX = offX + (gl.svgWidth - gl.gridWidth) / 2 + break + case 'left': + gl.gridWidth = gl.svgWidth - this.lgRect.width - xPad + gl.gridHeight = + cnf.chart.height !== 'auto' ? gl.svgHeight : gl.gridWidth + gl.translateY = offY + gl.translateX = offX + this.lgRect.width + xPad + break + case 'right': + gl.gridWidth = gl.svgWidth - this.lgRect.width - xPad - 5 + gl.gridHeight = + cnf.chart.height !== 'auto' ? gl.svgHeight : gl.gridWidth + gl.translateY = offY + gl.translateX = offX + 10 + break + default: + throw new Error('Legend position not supported') + } + } + + conditionalChecksForAxisCoords( + xaxisLabelCoords, + xtitleCoords, + xaxisGroupLabelCoords + ) { + const w = this.w + + const xAxisNum = w.globals.hasXaxisGroups ? 2 : 1 + + const baseXAxisHeight = + xaxisGroupLabelCoords.height + + xaxisLabelCoords.height + + xtitleCoords.height + const xAxisHeightMultiplicate = w.globals.isMultiLineX + ? 1.2 + : w.globals.LINE_HEIGHT_RATIO + const rotatedXAxisOffset = w.globals.rotateXLabels ? 22 : 10 + const rotatedXAxisLegendOffset = + w.globals.rotateXLabels && w.config.legend.position === 'bottom' + const additionalOffset = rotatedXAxisLegendOffset ? 10 : 0 + + this.xAxisHeight = + baseXAxisHeight * xAxisHeightMultiplicate + + xAxisNum * rotatedXAxisOffset + + additionalOffset + + this.xAxisWidth = xaxisLabelCoords.width + + if ( + this.xAxisHeight - xtitleCoords.height > + w.config.xaxis.labels.maxHeight + ) { + this.xAxisHeight = w.config.xaxis.labels.maxHeight + } + + if ( + w.config.xaxis.labels.minHeight && + this.xAxisHeight < w.config.xaxis.labels.minHeight + ) { + this.xAxisHeight = w.config.xaxis.labels.minHeight + } + + if (w.config.xaxis.floating) { + this.xAxisHeight = 0 + } + + let minYAxisWidth = 0 + let maxYAxisWidth = 0 + w.config.yaxis.forEach((y) => { + minYAxisWidth += y.labels.minWidth + maxYAxisWidth += y.labels.maxWidth + }) + if (this.yAxisWidth < minYAxisWidth) { + this.yAxisWidth = minYAxisWidth + } + if (this.yAxisWidth > maxYAxisWidth) { + this.yAxisWidth = maxYAxisWidth + } + } +} diff --git a/node_modules/apexcharts/src/modules/dimensions/Grid.js b/node_modules/apexcharts/src/modules/dimensions/Grid.js new file mode 100644 index 0000000..9345059 --- /dev/null +++ b/node_modules/apexcharts/src/modules/dimensions/Grid.js @@ -0,0 +1,143 @@ +import AxesUtils from '../axes/AxesUtils' + +export default class DimGrid { + constructor(dCtx) { + this.w = dCtx.w + this.dCtx = dCtx + } + + gridPadForColumnsInNumericAxis(gridWidth) { + const { w } = this + const { config: cnf, globals: gl } = w + + if ( + gl.noData || + gl.collapsedSeries.length + gl.ancillaryCollapsedSeries.length === + cnf.series.length + ) { + return 0 + } + + const hasBar = (type) => + ['bar', 'rangeBar', 'candlestick', 'boxPlot'].includes(type) + + const type = cnf.chart.type + let barWidth = 0 + let seriesLen = hasBar(type) ? cnf.series.length : 1 + + if (gl.comboBarCount > 0) { + seriesLen = gl.comboBarCount + } + + gl.collapsedSeries.forEach((c) => { + if (hasBar(c.type)) { + seriesLen -= 1 + } + }) + + if (cnf.chart.stacked) { + seriesLen = 1 + } + + const barsPresent = hasBar(type) || gl.comboBarCount > 0 + let xRange = Math.abs(gl.initialMaxX - gl.initialMinX) + + if ( + barsPresent && + gl.isXNumeric && + !gl.isBarHorizontal && + seriesLen > 0 && + xRange !== 0 + ) { + if (xRange <= 3) { + xRange = gl.dataPoints + } + + const xRatio = xRange / gridWidth + let xDivision = + gl.minXDiff && gl.minXDiff / xRatio > 0 ? gl.minXDiff / xRatio : 0 + + if (xDivision > gridWidth / 2) { + xDivision /= 2 + } + // Here, barWidth is assumed to be the width occupied by a group of bars. + // There will be one bar in the group for each series plotted. + // Note: This version of the following math is different to that over in + // Helpers.js. Don't assume they should be the same. Over there, + // xDivision is computed differently and it's used on different charts. + // They were the same, but the solution to + // https://github.com/apexcharts/apexcharts.js/issues/4178 + // was to remove the division by seriesLen. + barWidth = + (xDivision * parseInt(cnf.plotOptions.bar.columnWidth, 10)) / 100 + + if (barWidth < 1) { + barWidth = 1 + } + + gl.barPadForNumericAxis = barWidth + } + + return barWidth + } + + gridPadFortitleSubtitle() { + const { w } = this + const { globals: gl } = w + let gridShrinkOffset = this.dCtx.isSparkline || !gl.axisCharts ? 0 : 10 + + const titleSubtitle = ['title', 'subtitle'] + + titleSubtitle.forEach((t) => { + if (w.config[t].text !== undefined) { + gridShrinkOffset += w.config[t].margin + } else { + gridShrinkOffset += this.dCtx.isSparkline || !gl.axisCharts ? 0 : 5 + } + }) + + if ( + w.config.legend.show && + w.config.legend.position === 'bottom' && + !w.config.legend.floating && + !gl.axisCharts + ) { + gridShrinkOffset += 10 + } + + const titleCoords = this.dCtx.dimHelpers.getTitleSubtitleCoords('title') + const subtitleCoords = + this.dCtx.dimHelpers.getTitleSubtitleCoords('subtitle') + + gl.gridHeight -= + titleCoords.height + subtitleCoords.height + gridShrinkOffset + gl.translateY += + titleCoords.height + subtitleCoords.height + gridShrinkOffset + } + + setGridXPosForDualYAxis(yTitleCoords, yaxisLabelCoords) { + const { w } = this + const axesUtils = new AxesUtils(this.dCtx.ctx) + + w.config.yaxis.forEach((yaxe, index) => { + if ( + w.globals.ignoreYAxisIndexes.indexOf(index) === -1 && + !yaxe.floating && + !axesUtils.isYAxisHidden(index) + ) { + if (yaxe.opposite) { + w.globals.translateX -= + yaxisLabelCoords[index].width + + yTitleCoords[index].width + + parseInt(yaxe.labels.style.fontSize, 10) / 1.2 + + 12 + } + + // fixes apexcharts.js#1599 + if (w.globals.translateX < 2) { + w.globals.translateX = 2 + } + } + }) + } +} diff --git a/node_modules/apexcharts/src/modules/dimensions/Helpers.js b/node_modules/apexcharts/src/modules/dimensions/Helpers.js new file mode 100644 index 0000000..30656ca --- /dev/null +++ b/node_modules/apexcharts/src/modules/dimensions/Helpers.js @@ -0,0 +1,144 @@ +import Utils from '../../utils/Utils' +import Graphics from '../Graphics' + +export default class Helpers { + constructor(dCtx) { + this.w = dCtx.w + this.dCtx = dCtx + } + + /** + * Get Chart Title/Subtitle Dimensions + * @memberof Dimensions + * @return {{width, height}} + **/ + getTitleSubtitleCoords(type) { + let w = this.w + let width = 0 + let height = 0 + + const floating = + type === 'title' ? w.config.title.floating : w.config.subtitle.floating + + let el = w.globals.dom.baseEl.querySelector(`.apexcharts-${type}-text`) + + if (el !== null && !floating) { + let coord = el.getBoundingClientRect() + width = coord.width + height = w.globals.axisCharts ? coord.height + 5 : coord.height + } + + return { + width, + height, + } + } + + getLegendsRect() { + let w = this.w + + let elLegendWrap = w.globals.dom.elLegendWrap + + if ( + !w.config.legend.height && + (w.config.legend.position === 'top' || + w.config.legend.position === 'bottom') + ) { + // avoid legend to take up all the space + elLegendWrap.style.maxHeight = w.globals.svgHeight / 2 + 'px' + } + + let lgRect = Object.assign({}, Utils.getBoundingClientRect(elLegendWrap)) + + if ( + elLegendWrap !== null && + !w.config.legend.floating && + w.config.legend.show + ) { + this.dCtx.lgRect = { + x: lgRect.x, + y: lgRect.y, + height: lgRect.height, + width: lgRect.height === 0 ? 0 : lgRect.width, + } + } else { + this.dCtx.lgRect = { + x: 0, + y: 0, + height: 0, + width: 0, + } + } + + // if legend takes up all of the chart space, we need to restrict it. + if ( + w.config.legend.position === 'left' || + w.config.legend.position === 'right' + ) { + if (this.dCtx.lgRect.width * 1.5 > w.globals.svgWidth) { + this.dCtx.lgRect.width = w.globals.svgWidth / 1.5 + } + } + + return this.dCtx.lgRect + } + + /** + * Get Y Axis Dimensions + * @memberof Dimensions + * @return {{width, height}} + **/ + getDatalabelsRect() { + let w = this.w + + let allLabels = [] + + w.config.series.forEach((serie, seriesIndex) => { + serie.data.forEach((datum, dataPointIndex) => { + const getText = (v) => { + return w.config.dataLabels.formatter(v, { + ctx: this.dCtx.ctx, + seriesIndex, + dataPointIndex, + w, + }) + } + + val = getText(w.globals.series[seriesIndex][dataPointIndex]) + + allLabels.push(val) + }) + }) + + let val = Utils.getLargestStringFromArr(allLabels) + + let graphics = new Graphics(this.dCtx.ctx) + const dataLabelsStyle = w.config.dataLabels.style + let labelrect = graphics.getTextRects( + val, + parseInt(dataLabelsStyle.fontSize), + dataLabelsStyle.fontFamily + ) + + return { + width: labelrect.width * 1.05, + height: labelrect.height, + } + } + + getLargestStringFromMultiArr(val, arr) { + const w = this.w + let valArr = val + if (w.globals.isMultiLineX) { + // if the xaxis labels has multiline texts (array) + let maxArrs = arr.map((xl, idx) => { + return Array.isArray(xl) ? xl.length : 1 + }) + let maxArrLen = Math.max(...maxArrs) + let maxArrIndex = maxArrs.indexOf(maxArrLen) + valArr = arr[maxArrIndex] + } + + return valArr + } +} diff --git a/node_modules/apexcharts/src/modules/dimensions/XAxis.js b/node_modules/apexcharts/src/modules/dimensions/XAxis.js new file mode 100644 index 0000000..f9a8c89 --- /dev/null +++ b/node_modules/apexcharts/src/modules/dimensions/XAxis.js @@ -0,0 +1,370 @@ +import Formatters from '../Formatters' +import Graphics from '../Graphics' +import Utils from '../../utils/Utils' +import DateTime from '../../utils/DateTime' + +export default class DimXAxis { + constructor(dCtx) { + this.w = dCtx.w + this.dCtx = dCtx + } + + /** + * Get X Axis Dimensions + * @memberof Dimensions + * @return {{width, height}} + **/ + getxAxisLabelsCoords() { + let w = this.w + + let xaxisLabels = w.globals.labels.slice() + if (w.config.xaxis.convertedCatToNumeric && xaxisLabels.length === 0) { + xaxisLabels = w.globals.categoryLabels + } + + let rect + + if (w.globals.timescaleLabels.length > 0) { + const coords = this.getxAxisTimeScaleLabelsCoords() + rect = { + width: coords.width, + height: coords.height, + } + w.globals.rotateXLabels = false + } else { + this.dCtx.lgWidthForSideLegends = + (w.config.legend.position === 'left' || + w.config.legend.position === 'right') && + !w.config.legend.floating + ? this.dCtx.lgRect.width + : 0 + + // get the longest string from the labels array and also apply label formatter + let xlbFormatter = w.globals.xLabelFormatter + // prevent changing xaxisLabels to avoid issues in multi-yaxes - fix #522 + let val = Utils.getLargestStringFromArr(xaxisLabels) + let valArr = this.dCtx.dimHelpers.getLargestStringFromMultiArr( + val, + xaxisLabels + ) + + // the labels gets changed for bar charts + if (w.globals.isBarHorizontal) { + val = w.globals.yAxisScale[0].result.reduce( + (a, b) => (a.length > b.length ? a : b), + 0 + ) + valArr = val + } + + let xFormat = new Formatters(this.dCtx.ctx) + let timestamp = val + val = xFormat.xLabelFormat(xlbFormatter, val, timestamp, { + i: undefined, + dateFormatter: new DateTime(this.dCtx.ctx).formatDate, + w, + }) + valArr = xFormat.xLabelFormat(xlbFormatter, valArr, timestamp, { + i: undefined, + dateFormatter: new DateTime(this.dCtx.ctx).formatDate, + w, + }) + + if ( + (w.config.xaxis.convertedCatToNumeric && typeof val === 'undefined') || + String(val).trim() === '' + ) { + val = '1' + valArr = val + } + + let graphics = new Graphics(this.dCtx.ctx) + let xLabelrect = graphics.getTextRects( + val, + w.config.xaxis.labels.style.fontSize + ) + let xArrLabelrect = xLabelrect + if (val !== valArr) { + xArrLabelrect = graphics.getTextRects( + valArr, + w.config.xaxis.labels.style.fontSize + ) + } + + rect = { + width: + xLabelrect.width >= xArrLabelrect.width + ? xLabelrect.width + : xArrLabelrect.width, + height: + xLabelrect.height >= xArrLabelrect.height + ? xLabelrect.height + : xArrLabelrect.height, + } + + if ( + (rect.width * xaxisLabels.length > + w.globals.svgWidth - + this.dCtx.lgWidthForSideLegends - + this.dCtx.yAxisWidth - + this.dCtx.gridPad.left - + this.dCtx.gridPad.right && + w.config.xaxis.labels.rotate !== 0) || + w.config.xaxis.labels.rotateAlways + ) { + if (!w.globals.isBarHorizontal) { + w.globals.rotateXLabels = true + const getRotatedTextRects = (text) => { + return graphics.getTextRects( + text, + w.config.xaxis.labels.style.fontSize, + w.config.xaxis.labels.style.fontFamily, + `rotate(${w.config.xaxis.labels.rotate} 0 0)`, + false + ) + } + xLabelrect = getRotatedTextRects(val) + if (val !== valArr) { + xArrLabelrect = getRotatedTextRects(valArr) + } + + rect.height = + (xLabelrect.height > xArrLabelrect.height + ? xLabelrect.height + : xArrLabelrect.height) / 1.5 + rect.width = + xLabelrect.width > xArrLabelrect.width + ? xLabelrect.width + : xArrLabelrect.width + } + } else { + w.globals.rotateXLabels = false + } + } + + if (!w.config.xaxis.labels.show) { + rect = { + width: 0, + height: 0, + } + } + + return { + width: rect.width, + height: rect.height, + } + } + + /** + * Get X Axis Label Group height + * @memberof Dimensions + * @return {{width, height}} + */ + getxAxisGroupLabelsCoords() { + let w = this.w + + if (!w.globals.hasXaxisGroups) { + return { width: 0, height: 0 } + } + + const fontSize = + w.config.xaxis.group.style?.fontSize || + w.config.xaxis.labels.style.fontSize + + let xaxisLabels = w.globals.groups.map((g) => g.title) + + let rect + + // prevent changing xaxisLabels to avoid issues in multi-yaxes - fix #522 + let val = Utils.getLargestStringFromArr(xaxisLabels) + let valArr = this.dCtx.dimHelpers.getLargestStringFromMultiArr( + val, + xaxisLabels + ) + + let graphics = new Graphics(this.dCtx.ctx) + let xLabelrect = graphics.getTextRects(val, fontSize) + let xArrLabelrect = xLabelrect + if (val !== valArr) { + xArrLabelrect = graphics.getTextRects(valArr, fontSize) + } + + rect = { + width: + xLabelrect.width >= xArrLabelrect.width + ? xLabelrect.width + : xArrLabelrect.width, + height: + xLabelrect.height >= xArrLabelrect.height + ? xLabelrect.height + : xArrLabelrect.height, + } + + if (!w.config.xaxis.labels.show) { + rect = { + width: 0, + height: 0, + } + } + + return { + width: rect.width, + height: rect.height, + } + } + + /** + * Get X Axis Title Dimensions + * @memberof Dimensions + * @return {{width, height}} + **/ + getxAxisTitleCoords() { + let w = this.w + let width = 0 + let height = 0 + + if (w.config.xaxis.title.text !== undefined) { + let graphics = new Graphics(this.dCtx.ctx) + + let rect = graphics.getTextRects( + w.config.xaxis.title.text, + w.config.xaxis.title.style.fontSize + ) + + width = rect.width + height = rect.height + } + + return { + width, + height, + } + } + + getxAxisTimeScaleLabelsCoords() { + let w = this.w + let rect + + this.dCtx.timescaleLabels = w.globals.timescaleLabels.slice() + + let labels = this.dCtx.timescaleLabels.map((label) => label.value) + + // get the longest string from the labels array and also apply label formatter to it + let val = labels.reduce((a, b) => { + // if undefined, maybe user didn't pass the datetime(x) values + if (typeof a === 'undefined') { + console.error( + 'You have possibly supplied invalid Date format. Please supply a valid JavaScript Date' + ) + return 0 + } else { + return a.length > b.length ? a : b + } + }, 0) + + let graphics = new Graphics(this.dCtx.ctx) + rect = graphics.getTextRects(val, w.config.xaxis.labels.style.fontSize) + + let totalWidthRotated = rect.width * 1.05 * labels.length + + if ( + totalWidthRotated > w.globals.gridWidth && + w.config.xaxis.labels.rotate !== 0 + ) { + w.globals.overlappingXLabels = true + } + + return rect + } + + // In certain cases, the last labels gets cropped in xaxis. + // Hence, we add some additional padding based on the label length to avoid the last label being cropped or we don't draw it at all + additionalPaddingXLabels(xaxisLabelCoords) { + const w = this.w + const gl = w.globals + const cnf = w.config + const xtype = cnf.xaxis.type + + let lbWidth = xaxisLabelCoords.width + + gl.skipLastTimelinelabel = false + gl.skipFirstTimelinelabel = false + const isBarOpposite = + w.config.yaxis[0].opposite && w.globals.isBarHorizontal + + const isCollapsed = (i) => gl.collapsedSeriesIndices.indexOf(i) !== -1 + + const rightPad = (yaxe) => { + if (this.dCtx.timescaleLabels && this.dCtx.timescaleLabels.length) { + // for timeline labels, we take the last label and check if it exceeds gridWidth + const firstimescaleLabel = this.dCtx.timescaleLabels[0] + const lastTimescaleLabel = + this.dCtx.timescaleLabels[this.dCtx.timescaleLabels.length - 1] + + const lastLabelPosition = + lastTimescaleLabel.position + + lbWidth / 1.75 - + this.dCtx.yAxisWidthRight + + const firstLabelPosition = + firstimescaleLabel.position - + lbWidth / 1.75 + + this.dCtx.yAxisWidthLeft + + let lgRightRectWidth = + w.config.legend.position === 'right' && this.dCtx.lgRect.width > 0 + ? this.dCtx.lgRect.width + : 0 + if ( + lastLabelPosition > + gl.svgWidth - gl.translateX - lgRightRectWidth + ) { + gl.skipLastTimelinelabel = true + } + + if ( + firstLabelPosition < + -((!yaxe.show || yaxe.floating) && + (cnf.chart.type === 'bar' || + cnf.chart.type === 'candlestick' || + cnf.chart.type === 'rangeBar' || + cnf.chart.type === 'boxPlot') + ? lbWidth / 1.75 + : 10) + ) { + gl.skipFirstTimelinelabel = true + } + } else if (xtype === 'datetime') { + // If user has enabled DateTime, but uses own's formatter + if (this.dCtx.gridPad.right < lbWidth && !gl.rotateXLabels) { + gl.skipLastTimelinelabel = true + } + } else if (xtype !== 'datetime') { + if ( + this.dCtx.gridPad.right < lbWidth / 2 - this.dCtx.yAxisWidthRight && + !gl.rotateXLabels && + !w.config.xaxis.labels.trim + ) { + this.dCtx.xPadRight = lbWidth / 2 + 1 + } + } + } + + const padYAxe = (yaxe, i) => { + if (cnf.yaxis.length > 1 && isCollapsed(i)) return + + rightPad(yaxe) + } + + cnf.yaxis.forEach((yaxe, i) => { + if (isBarOpposite) { + if (this.dCtx.gridPad.left < lbWidth) { + this.dCtx.xPadLeft = lbWidth / 2 + 1 + } + this.dCtx.xPadRight = lbWidth / 2 + 1 + } else { + padYAxe(yaxe, i) + } + }) + } +} diff --git a/node_modules/apexcharts/src/modules/dimensions/YAxis.js b/node_modules/apexcharts/src/modules/dimensions/YAxis.js new file mode 100644 index 0000000..a09329f --- /dev/null +++ b/node_modules/apexcharts/src/modules/dimensions/YAxis.js @@ -0,0 +1,211 @@ +import Graphics from '../Graphics' +import Utils from '../../utils/Utils' +import AxesUtils from '../axes/AxesUtils' + +export default class DimYAxis { + constructor(dCtx) { + this.w = dCtx.w + this.dCtx = dCtx + } + + /** + * Get Y Axis Dimensions + * @memberof Dimensions + * @return {{width, height}} + **/ + getyAxisLabelsCoords() { + let w = this.w + + let width = 0 + let height = 0 + let ret = [] + let labelPad = 10 + const axesUtils = new AxesUtils(this.dCtx.ctx) + + w.config.yaxis.map((yaxe, index) => { + const formatterArgs = { + seriesIndex: index, + dataPointIndex: -1, + w, + } + const yS = w.globals.yAxisScale[index] + let yAxisMinWidth = 0 + if ( + !axesUtils.isYAxisHidden(index) && + yaxe.labels.show && + yaxe.labels.minWidth !== undefined + ) + yAxisMinWidth = yaxe.labels.minWidth + + if ( + !axesUtils.isYAxisHidden(index) && + yaxe.labels.show && + yS.result.length + ) { + let lbFormatter = w.globals.yLabelFormatters[index] + let minV = yS.niceMin === Number.MIN_VALUE ? 0 : yS.niceMin + let val = yS.result.reduce((acc, curr) => { + return String(lbFormatter(acc, formatterArgs))?.length > + String(lbFormatter(curr, formatterArgs))?.length + ? acc + : curr + }, minV) + + val = lbFormatter(val, formatterArgs) + + // the second parameter -1 is the index of tick which user can use in the formatter + let valArr = val + + // if user has specified a custom formatter, and the result is null or empty, we need to discard the formatter and take the value as it is. + if (typeof val === 'undefined' || val.length === 0) { + val = yS.niceMax + } + + if (w.globals.isBarHorizontal) { + labelPad = 0 + + let barYaxisLabels = w.globals.labels.slice() + + // get the longest string from the labels array and also apply label formatter to it + val = Utils.getLargestStringFromArr(barYaxisLabels) + + val = lbFormatter(val, { seriesIndex: index, dataPointIndex: -1, w }) + valArr = this.dCtx.dimHelpers.getLargestStringFromMultiArr( + val, + barYaxisLabels + ) + } + + let graphics = new Graphics(this.dCtx.ctx) + + let rotateStr = 'rotate('.concat(yaxe.labels.rotate, ' 0 0)') + let rect = graphics.getTextRects( + val, + yaxe.labels.style.fontSize, + yaxe.labels.style.fontFamily, + rotateStr, + false + ) + + let arrLabelrect = rect + + if (val !== valArr) { + arrLabelrect = graphics.getTextRects( + valArr, + yaxe.labels.style.fontSize, + yaxe.labels.style.fontFamily, + rotateStr, + false + ) + } + + ret.push({ + width: + (yAxisMinWidth > arrLabelrect.width || yAxisMinWidth > rect.width + ? yAxisMinWidth + : arrLabelrect.width > rect.width + ? arrLabelrect.width + : rect.width) + labelPad, + height: + arrLabelrect.height > rect.height + ? arrLabelrect.height + : rect.height, + }) + } else { + ret.push({ + width, + height, + }) + } + }) + + return ret + } + + /** + * Get Y Axis Dimensions + * @memberof Dimensions + * @return {{width, height}} + **/ + getyAxisTitleCoords() { + let w = this.w + let ret = [] + + w.config.yaxis.map((yaxe, index) => { + if (yaxe.show && yaxe.title.text !== undefined) { + let graphics = new Graphics(this.dCtx.ctx) + let rotateStr = 'rotate('.concat(yaxe.title.rotate, ' 0 0)') + let rect = graphics.getTextRects( + yaxe.title.text, + yaxe.title.style.fontSize, + yaxe.title.style.fontFamily, + rotateStr, + false + ) + + ret.push({ + width: rect.width, + height: rect.height, + }) + } else { + ret.push({ + width: 0, + height: 0, + }) + } + }) + + return ret + } + + getTotalYAxisWidth() { + let w = this.w + let yAxisWidth = 0 + let yAxisWidthLeft = 0 + let yAxisWidthRight = 0 + let padding = w.globals.yAxisScale.length > 1 ? 10 : 0 + const axesUtils = new AxesUtils(this.dCtx.ctx) + + const isHiddenYAxis = function (index) { + return w.globals.ignoreYAxisIndexes.indexOf(index) > -1 + } + + const padForLabelTitle = (coord, index) => { + let floating = w.config.yaxis[index].floating + let width = 0 + + if (coord.width > 0 && !floating) { + width = coord.width + padding + if (isHiddenYAxis(index)) { + width = width - coord.width - padding + } + } else { + width = floating || axesUtils.isYAxisHidden(index) ? 0 : 5 + } + + w.config.yaxis[index].opposite + ? (yAxisWidthRight = yAxisWidthRight + width) + : (yAxisWidthLeft = yAxisWidthLeft + width) + + yAxisWidth = yAxisWidth + width + } + + w.globals.yLabelsCoords.map((yLabelCoord, index) => { + padForLabelTitle(yLabelCoord, index) + }) + + w.globals.yTitleCoords.map((yTitleCoord, index) => { + padForLabelTitle(yTitleCoord, index) + }) + + if (w.globals.isBarHorizontal && !w.config.yaxis[0].floating) { + yAxisWidth = + w.globals.yLabelsCoords[0].width + w.globals.yTitleCoords[0].width + 15 + } + + this.dCtx.yAxisWidthLeft = yAxisWidthLeft + this.dCtx.yAxisWidthRight = yAxisWidthRight + + return yAxisWidth + } +} diff --git a/node_modules/apexcharts/src/modules/helpers/Destroy.js b/node_modules/apexcharts/src/modules/helpers/Destroy.js new file mode 100644 index 0000000..ad0f820 --- /dev/null +++ b/node_modules/apexcharts/src/modules/helpers/Destroy.js @@ -0,0 +1,89 @@ +export default class Destroy { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + } + + clear({ isUpdating }) { + if (this.ctx.zoomPanSelection) { + this.ctx.zoomPanSelection.destroy() + } + if (this.ctx.toolbar) { + this.ctx.toolbar.destroy() + } + + this.ctx.animations = null + this.ctx.axes = null + this.ctx.annotations = null + this.ctx.core = null + this.ctx.data = null + this.ctx.grid = null + this.ctx.series = null + this.ctx.responsive = null + this.ctx.theme = null + this.ctx.formatters = null + this.ctx.titleSubtitle = null + this.ctx.legend = null + this.ctx.dimensions = null + this.ctx.options = null + this.ctx.crosshairs = null + this.ctx.zoomPanSelection = null + this.ctx.updateHelpers = null + this.ctx.toolbar = null + this.ctx.localization = null + this.ctx.w.globals.tooltip = null + this.clearDomElements({ isUpdating }) + } + + killSVG(draw) { + draw.each(function () { + this.removeClass('*') + this.off() + // this.stop() + }, true) + // draw.ungroup() + draw.clear() + } + + clearDomElements({ isUpdating }) { + const elSVG = this.w.globals.dom.Paper.node + // fixes apexcharts.js#1654 & vue-apexcharts#256 + if (elSVG.parentNode && elSVG.parentNode.parentNode && !isUpdating) { + elSVG.parentNode.parentNode.style.minHeight = 'unset' + } + + // detach root event + const baseEl = this.w.globals.dom.baseEl + if (baseEl) { + // see https://github.com/apexcharts/vue-apexcharts/issues/275 + this.ctx.eventList.forEach((event) => { + baseEl.removeEventListener(event, this.ctx.events.documentEvent) + }) + } + + const domEls = this.w.globals.dom + + if (this.ctx.el !== null) { + // remove all child elements - resetting the whole chart + while (this.ctx.el.firstChild) { + this.ctx.el.removeChild(this.ctx.el.firstChild) + } + } + + this.killSVG(domEls.Paper) + domEls.Paper.remove() + + domEls.elWrap = null + domEls.elGraphical = null + domEls.elLegendWrap = null + domEls.elLegendForeign = null + domEls.baseEl = null + domEls.elGridRect = null + domEls.elGridRectMask = null + domEls.elGridRectBarMask = null + domEls.elGridRectMarkerMask = null + domEls.elForecastMask = null + domEls.elNonForecastMask = null + domEls.elDefs = null + } +} diff --git a/node_modules/apexcharts/src/modules/helpers/InitCtxVariables.js b/node_modules/apexcharts/src/modules/helpers/InitCtxVariables.js new file mode 100644 index 0000000..74289bb --- /dev/null +++ b/node_modules/apexcharts/src/modules/helpers/InitCtxVariables.js @@ -0,0 +1,114 @@ +import Events from '../Events' +import Localization from './Localization' +import Animations from '../Animations' +import Axes from '../axes/Axes' +import Config from '../settings/Config' +import CoreUtils from '../CoreUtils' +import Crosshairs from '../Crosshairs' +import Grid from '../axes/Grid' +import Graphics from '../Graphics' +import Exports from '../Exports' +import Fill from '../Fill.js' +import Options from '../settings/Options' +import Responsive from '../Responsive' +import Series from '../Series' +import Theme from '../Theme' +import Formatters from '../Formatters' +import TitleSubtitle from '../TitleSubtitle' +import Legend from '../legend/Legend' +import Toolbar from '../Toolbar' +import Dimensions from '../dimensions/Dimensions' +import ZoomPanSelection from '../ZoomPanSelection' +import Tooltip from '../tooltip/Tooltip' +import Core from '../Core' +import Data from '../Data' +import UpdateHelpers from './UpdateHelpers' + +import { SVG } from '@svgdotjs/svg.js' +import '../../svgjs/svg.pathmorphing.js' +import '@svgdotjs/svg.filter.js' +import '@svgdotjs/svg.draggable.js' +import '@svgdotjs/svg.select.js' +import '@svgdotjs/svg.resize.js' + +if (typeof window.SVG === 'undefined') { + window.SVG = SVG +} + +// global Apex object which user can use to override chart's defaults globally +if (typeof window.Apex === 'undefined') { + window.Apex = {} +} + +export default class InitCtxVariables { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + } + + initModules() { + this.ctx.publicMethods = [ + 'updateOptions', + 'updateSeries', + 'appendData', + 'appendSeries', + 'isSeriesHidden', + 'highlightSeries', + 'toggleSeries', + 'showSeries', + 'hideSeries', + 'setLocale', + 'resetSeries', + 'zoomX', + 'toggleDataPointSelection', + 'dataURI', + 'exportToCSV', + 'addXaxisAnnotation', + 'addYaxisAnnotation', + 'addPointAnnotation', + 'clearAnnotations', + 'removeAnnotation', + 'paper', + 'destroy', + ] + + this.ctx.eventList = [ + 'click', + 'mousedown', + 'mousemove', + 'mouseleave', + 'touchstart', + 'touchmove', + 'touchleave', + 'mouseup', + 'touchend', + ] + + this.ctx.animations = new Animations(this.ctx) + this.ctx.axes = new Axes(this.ctx) + this.ctx.core = new Core(this.ctx.el, this.ctx) + this.ctx.config = new Config({}) + this.ctx.data = new Data(this.ctx) + this.ctx.grid = new Grid(this.ctx) + this.ctx.graphics = new Graphics(this.ctx) + this.ctx.coreUtils = new CoreUtils(this.ctx) + this.ctx.crosshairs = new Crosshairs(this.ctx) + this.ctx.events = new Events(this.ctx) + this.ctx.exports = new Exports(this.ctx) + this.ctx.fill = new Fill(this.ctx) + this.ctx.localization = new Localization(this.ctx) + this.ctx.options = new Options() + this.ctx.responsive = new Responsive(this.ctx) + this.ctx.series = new Series(this.ctx) + this.ctx.theme = new Theme(this.ctx) + this.ctx.formatters = new Formatters(this.ctx) + this.ctx.titleSubtitle = new TitleSubtitle(this.ctx) + this.ctx.legend = new Legend(this.ctx) + this.ctx.toolbar = new Toolbar(this.ctx) + this.ctx.tooltip = new Tooltip(this.ctx) + this.ctx.dimensions = new Dimensions(this.ctx) + this.ctx.updateHelpers = new UpdateHelpers(this.ctx) + this.ctx.zoomPanSelection = new ZoomPanSelection(this.ctx) + this.ctx.w.globals.tooltip = new Tooltip(this.ctx) + } +} diff --git a/node_modules/apexcharts/src/modules/helpers/Localization.js b/node_modules/apexcharts/src/modules/helpers/Localization.js new file mode 100644 index 0000000..c06e862 --- /dev/null +++ b/node_modules/apexcharts/src/modules/helpers/Localization.js @@ -0,0 +1,39 @@ +import Utils from '../../utils/Utils' + +import en from '../../locales/en.json' + +export default class Localization { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + } + + setCurrentLocaleValues(localeName) { + let locales = this.w.config.chart.locales + + // check if user has specified locales in global Apex variable + // if yes - then extend those with local chart's locale + if ( + window.Apex.chart && + window.Apex.chart.locales && + window.Apex.chart.locales.length > 0 + ) { + locales = this.w.config.chart.locales.concat(window.Apex.chart.locales) + } + + // find the locale from the array of locales which user has set (either by chart.defaultLocale or by calling setLocale() method.) + const selectedLocale = locales.filter((c) => c.name === localeName)[0] + + if (selectedLocale) { + // create a complete locale object by extending defaults so you don't get undefined errors. + let ret = Utils.extend(en, selectedLocale) + + // store these locale options in global var for ease access + this.w.globals.locale = ret.options + } else { + throw new Error( + 'Wrong locale name provided. Please make sure you set the correct locale name in options' + ) + } + } +} diff --git a/node_modules/apexcharts/src/modules/helpers/UpdateHelpers.js b/node_modules/apexcharts/src/modules/helpers/UpdateHelpers.js new file mode 100644 index 0000000..9886f9c --- /dev/null +++ b/node_modules/apexcharts/src/modules/helpers/UpdateHelpers.js @@ -0,0 +1,304 @@ +import Defaults from '../settings/Defaults' +import Config from '../settings/Config' +import CoreUtils from '../CoreUtils' +import Graphics from '../Graphics' +import Utils from '../../utils/Utils' + +export default class UpdateHelpers { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + } + + /** + * private method to update Options. + * + * @param {object} options - A new config object can be passed which will be merged with the existing config object + * @param {boolean} redraw - should redraw from beginning or should use existing paths and redraw from there + * @param {boolean} animate - should animate or not on updating Options + * @param {boolean} overwriteInitialConfig - should update the initial config or not + */ + _updateOptions( + options, + redraw = false, + animate = true, + updateSyncedCharts = true, + overwriteInitialConfig = false + ) { + return new Promise((resolve) => { + let charts = [this.ctx] + if (updateSyncedCharts) { + charts = this.ctx.getSyncedCharts() + } + + if (this.ctx.w.globals.isExecCalled) { + // If the user called exec method, we don't want to get grouped charts as user specifically provided a chartID to update + charts = [this.ctx] + this.ctx.w.globals.isExecCalled = false + } + + charts.forEach((ch, chartIndex) => { + let w = ch.w + + w.globals.shouldAnimate = animate + + if (!redraw) { + w.globals.resized = true + w.globals.dataChanged = true + + if (animate) { + ch.series.getPreviousPaths() + } + } + + if (options && typeof options === 'object') { + ch.config = new Config(options) + options = CoreUtils.extendArrayProps(ch.config, options, w) + + // fixes #914, #623 + if (ch.w.globals.chartID !== this.ctx.w.globals.chartID) { + // don't overwrite series of synchronized charts + delete options.series + } + + w.config = Utils.extend(w.config, options) + + if (overwriteInitialConfig) { + // we need to forget the lastXAxis and lastYAxis as user forcefully overwriteInitialConfig. If we do not do this, and next time when user zooms the chart after setting yaxis.min/max or xaxis.min/max - the stored lastXAxis will never allow the chart to use the updated min/max by user. + w.globals.lastXAxis = options.xaxis + ? Utils.clone(options.xaxis) + : [] + w.globals.lastYAxis = options.yaxis + ? Utils.clone(options.yaxis) + : [] + + // After forgetting lastAxes, we need to restore the new config in initialConfig/initialSeries + w.globals.initialConfig = Utils.extend({}, w.config) + w.globals.initialSeries = Utils.clone(w.config.series) + + if (options.series) { + // Replace the collapsed series data + for ( + let i = 0; + i < w.globals.collapsedSeriesIndices.length; + i++ + ) { + let series = + w.config.series[w.globals.collapsedSeriesIndices[i]] + w.globals.collapsedSeries[i].data = w.globals.axisCharts + ? series.data.slice() + : series + } + for ( + let i = 0; + i < w.globals.ancillaryCollapsedSeriesIndices.length; + i++ + ) { + let series = + w.config.series[w.globals.ancillaryCollapsedSeriesIndices[i]] + w.globals.ancillaryCollapsedSeries[i].data = w.globals + .axisCharts + ? series.data.slice() + : series + } + + // Ensure that auto-generated axes are scaled to the visible data + ch.series.emptyCollapsedSeries(w.config.series) + } + } + } + + return ch.update(options).then(() => { + if (chartIndex === charts.length - 1) { + resolve(ch) + } + }) + }) + }) + } + + /** + * Private method to update Series. + * + * @param {array} series - New series which will override the existing + */ + _updateSeries(newSeries, animate, overwriteInitialSeries = false) { + return new Promise((resolve) => { + const w = this.w + + w.globals.shouldAnimate = animate + + w.globals.dataChanged = true + + if (animate) { + this.ctx.series.getPreviousPaths() + } + + let existingSeries + + // axis charts + if (w.globals.axisCharts) { + existingSeries = newSeries.map((s, i) => { + return this._extendSeries(s, i) + }) + + if (existingSeries.length === 0) { + existingSeries = [{ data: [] }] + } + w.config.series = existingSeries + } else { + // non-axis chart (pie/radialbar) + w.config.series = newSeries.slice() + } + + if (overwriteInitialSeries) { + w.globals.initialConfig.series = Utils.clone(w.config.series) + w.globals.initialSeries = Utils.clone(w.config.series) + } + return this.ctx.update().then(() => { + resolve(this.ctx) + }) + }) + } + + _extendSeries(s, i) { + const w = this.w + const ser = w.config.series[i] + + return { + ...w.config.series[i], + name: s.name ? s.name : ser?.name, + color: s.color ? s.color : ser?.color, + type: s.type ? s.type : ser?.type, + group: s.group ? s.group : ser?.group, + hidden: typeof s.hidden !== 'undefined' ? s.hidden : ser?.hidden, + data: s.data ? s.data : ser?.data, + zIndex: typeof s.zIndex !== 'undefined' ? s.zIndex : i, + } + } + + toggleDataPointSelection(seriesIndex, dataPointIndex) { + const w = this.w + let elPath = null + const parent = `.apexcharts-series[data\\:realIndex='${seriesIndex}']` + + if (w.globals.axisCharts) { + elPath = w.globals.dom.Paper.findOne( + `${parent} path[j='${dataPointIndex}'], ${parent} circle[j='${dataPointIndex}'], ${parent} rect[j='${dataPointIndex}']` + ) + } else { + // dataPointIndex will be undefined here, hence using seriesIndex + if (typeof dataPointIndex === 'undefined') { + elPath = w.globals.dom.Paper.findOne( + `${parent} path[j='${seriesIndex}']` + ) + + if ( + w.config.chart.type === 'pie' || + w.config.chart.type === 'polarArea' || + w.config.chart.type === 'donut' + ) { + this.ctx.pie.pieClicked(seriesIndex) + } + } + } + + if (elPath) { + const graphics = new Graphics(this.ctx) + graphics.pathMouseDown(elPath, null) + } else { + console.warn('toggleDataPointSelection: Element not found') + return null + } + + return elPath.node ? elPath.node : null + } + + forceXAxisUpdate(options) { + const w = this.w + const minmax = ['min', 'max'] + + minmax.forEach((a) => { + if (typeof options.xaxis[a] !== 'undefined') { + w.config.xaxis[a] = options.xaxis[a] + w.globals.lastXAxis[a] = options.xaxis[a] + } + }) + + if (options.xaxis.categories && options.xaxis.categories.length) { + w.config.xaxis.categories = options.xaxis.categories + } + + if (w.config.xaxis.convertedCatToNumeric) { + const defaults = new Defaults(options) + options = defaults.convertCatToNumericXaxis(options, this.ctx) + } + return options + } + + forceYAxisUpdate(options) { + if ( + options.chart && + options.chart.stacked && + options.chart.stackType === '100%' + ) { + if (Array.isArray(options.yaxis)) { + options.yaxis.forEach((yaxe, index) => { + options.yaxis[index].min = 0 + options.yaxis[index].max = 100 + }) + } else { + options.yaxis.min = 0 + options.yaxis.max = 100 + } + } + return options + } + + /** + * This function reverts the yaxis and xaxis min/max values to what it was when the chart was defined. + * This function fixes an important bug where a user might load a new series after zooming in/out of previous series which resulted in wrong min/max + * Also, this should never be called internally on zoom/pan - the reset should only happen when user calls the updateSeries() function externally + * The function also accepts an object {xaxis, yaxis} which when present is set as the new xaxis/yaxis + */ + revertDefaultAxisMinMax(opts) { + const w = this.w + + let xaxis = w.globals.lastXAxis + let yaxis = w.globals.lastYAxis + + if (opts && opts.xaxis) { + xaxis = opts.xaxis + } + if (opts && opts.yaxis) { + yaxis = opts.yaxis + } + w.config.xaxis.min = xaxis.min + w.config.xaxis.max = xaxis.max + + const getLastYAxis = (index) => { + if (typeof yaxis[index] !== 'undefined') { + w.config.yaxis[index].min = yaxis[index].min + w.config.yaxis[index].max = yaxis[index].max + } + } + + w.config.yaxis.map((yaxe, index) => { + if (w.globals.zoomed) { + // user has zoomed, check the last yaxis + getLastYAxis(index) + } else { + // user hasn't zoomed, check the last yaxis first + if (typeof yaxis[index] !== 'undefined') { + getLastYAxis(index) + } else { + // if last y-axis don't exist, check the original yaxis + if (typeof this.ctx.opts.yaxis[index] !== 'undefined') { + yaxe.min = this.ctx.opts.yaxis[index].min + yaxe.max = this.ctx.opts.yaxis[index].max + } + } + } + }) + } +} diff --git a/node_modules/apexcharts/src/modules/legend/Helpers.js b/node_modules/apexcharts/src/modules/legend/Helpers.js new file mode 100644 index 0000000..0e3ff56 --- /dev/null +++ b/node_modules/apexcharts/src/modules/legend/Helpers.js @@ -0,0 +1,311 @@ +import Graphics from '../Graphics' +import Utils from '../../utils/Utils' + +export default class Helpers { + constructor(lgCtx) { + this.w = lgCtx.w + this.lgCtx = lgCtx + } + + getLegendStyles() { + let stylesheet = document.createElement('style') + stylesheet.setAttribute('type', 'text/css') + const nonce = + this.lgCtx.ctx?.opts?.chart?.nonce || this.w.config.chart.nonce + if (nonce) { + stylesheet.setAttribute('nonce', nonce) + } + + const text = ` + .apexcharts-flip-y { + transform: scaleY(-1) translateY(-100%); + transform-origin: top; + transform-box: fill-box; + } + .apexcharts-flip-x { + transform: scaleX(-1); + transform-origin: center; + transform-box: fill-box; + } + .apexcharts-legend { + display: flex; + overflow: auto; + padding: 0 10px; + } + .apexcharts-legend.apexcharts-legend-group-horizontal { + flex-direction: column; + } + .apexcharts-legend-group { + display: flex; + } + .apexcharts-legend-group-vertical { + flex-direction: column-reverse; + } + .apexcharts-legend.apx-legend-position-bottom, .apexcharts-legend.apx-legend-position-top { + flex-wrap: wrap + } + .apexcharts-legend.apx-legend-position-right, .apexcharts-legend.apx-legend-position-left { + flex-direction: column; + bottom: 0; + } + .apexcharts-legend.apx-legend-position-bottom.apexcharts-align-left, .apexcharts-legend.apx-legend-position-top.apexcharts-align-left, .apexcharts-legend.apx-legend-position-right, .apexcharts-legend.apx-legend-position-left { + justify-content: flex-start; + align-items: flex-start; + } + .apexcharts-legend.apx-legend-position-bottom.apexcharts-align-center, .apexcharts-legend.apx-legend-position-top.apexcharts-align-center { + justify-content: center; + align-items: center; + } + .apexcharts-legend.apx-legend-position-bottom.apexcharts-align-right, .apexcharts-legend.apx-legend-position-top.apexcharts-align-right { + justify-content: flex-end; + align-items: flex-end; + } + .apexcharts-legend-series { + cursor: pointer; + line-height: normal; + display: flex; + align-items: center; + } + .apexcharts-legend-text { + position: relative; + font-size: 14px; + } + .apexcharts-legend-text *, .apexcharts-legend-marker * { + pointer-events: none; + } + .apexcharts-legend-marker { + position: relative; + display: flex; + align-items: center; + justify-content: center; + cursor: pointer; + margin-right: 1px; + } + + .apexcharts-legend-series.apexcharts-no-click { + cursor: auto; + } + .apexcharts-legend .apexcharts-hidden-zero-series, .apexcharts-legend .apexcharts-hidden-null-series { + display: none !important; + } + .apexcharts-inactive-legend { + opacity: 0.45; + } + + ` + + let rules = document.createTextNode(text) + + stylesheet.appendChild(rules) + + return stylesheet + } + + getLegendDimensions() { + const w = this.w + let currLegendsWrap = + w.globals.dom.baseEl.querySelector('.apexcharts-legend') + let { width: currLegendsWrapWidth, height: currLegendsWrapHeight } = + currLegendsWrap.getBoundingClientRect() + + return { + clwh: currLegendsWrapHeight, + clww: currLegendsWrapWidth, + } + } + + appendToForeignObject() { + const gl = this.w.globals + + gl.dom.elLegendForeign.appendChild(this.getLegendStyles()) + } + + toggleDataSeries(seriesCnt, isHidden) { + const w = this.w + if (w.globals.axisCharts || w.config.chart.type === 'radialBar') { + w.globals.resized = true // we don't want initial animations again + + let seriesEl = null + + let realIndex = null + + // yes, make it null. 1 series will rise at a time + w.globals.risingSeries = [] + + if (w.globals.axisCharts) { + seriesEl = w.globals.dom.baseEl.querySelector( + `.apexcharts-series[data\\:realIndex='${seriesCnt}']` + ) + realIndex = parseInt(seriesEl.getAttribute('data:realIndex'), 10) + } else { + seriesEl = w.globals.dom.baseEl.querySelector( + `.apexcharts-series[rel='${seriesCnt + 1}']` + ) + realIndex = parseInt(seriesEl.getAttribute('rel'), 10) - 1 + } + + if (isHidden) { + const seriesToMakeVisible = [ + { + cs: w.globals.collapsedSeries, + csi: w.globals.collapsedSeriesIndices, + }, + { + cs: w.globals.ancillaryCollapsedSeries, + csi: w.globals.ancillaryCollapsedSeriesIndices, + }, + ] + seriesToMakeVisible.forEach((r) => { + this.riseCollapsedSeries(r.cs, r.csi, realIndex) + }) + } else { + this.hideSeries({ seriesEl, realIndex }) + } + } else { + // for non-axis charts i.e pie / donuts + let seriesEl = w.globals.dom.Paper.findOne( + ` .apexcharts-series[rel='${seriesCnt + 1}'] path` + ) + + const type = w.config.chart.type + if (type === 'pie' || type === 'polarArea' || type === 'donut') { + let dataLabels = w.config.plotOptions.pie.donut.labels + + const graphics = new Graphics(this.lgCtx.ctx) + graphics.pathMouseDown(seriesEl, null) + this.lgCtx.ctx.pie.printDataLabelsInner(seriesEl.node, dataLabels) + } + + seriesEl.fire('click') + } + } + + getSeriesAfterCollapsing({ realIndex }) { + const w = this.w + const gl = w.globals + + let series = Utils.clone(w.config.series) + + if (gl.axisCharts) { + let yaxis = w.config.yaxis[gl.seriesYAxisReverseMap[realIndex]] + + const collapseData = { + index: realIndex, + data: series[realIndex].data.slice(), + type: series[realIndex].type || w.config.chart.type, + } + if (yaxis && yaxis.show && yaxis.showAlways) { + if (gl.ancillaryCollapsedSeriesIndices.indexOf(realIndex) < 0) { + gl.ancillaryCollapsedSeries.push(collapseData) + gl.ancillaryCollapsedSeriesIndices.push(realIndex) + } + } else { + if (gl.collapsedSeriesIndices.indexOf(realIndex) < 0) { + gl.collapsedSeries.push(collapseData) + gl.collapsedSeriesIndices.push(realIndex) + + let removeIndexOfRising = gl.risingSeries.indexOf(realIndex) + gl.risingSeries.splice(removeIndexOfRising, 1) + } + } + } else { + gl.collapsedSeries.push({ + index: realIndex, + data: series[realIndex], + }) + gl.collapsedSeriesIndices.push(realIndex) + } + + gl.allSeriesCollapsed = + gl.collapsedSeries.length + gl.ancillaryCollapsedSeries.length === + w.config.series.length + + return this._getSeriesBasedOnCollapsedState(series) + } + + hideSeries({ seriesEl, realIndex }) { + const w = this.w + + let series = this.getSeriesAfterCollapsing({ + realIndex, + }) + + let seriesChildren = seriesEl.childNodes + for (let sc = 0; sc < seriesChildren.length; sc++) { + if ( + seriesChildren[sc].classList.contains('apexcharts-series-markers-wrap') + ) { + if (seriesChildren[sc].classList.contains('apexcharts-hide')) { + seriesChildren[sc].classList.remove('apexcharts-hide') + } else { + seriesChildren[sc].classList.add('apexcharts-hide') + } + } + } + + this.lgCtx.ctx.updateHelpers._updateSeries( + series, + w.config.chart.animations.dynamicAnimation.enabled + ) + } + + riseCollapsedSeries(collapsedSeries, seriesIndices, realIndex) { + const w = this.w + let series = Utils.clone(w.config.series) + + if (collapsedSeries.length > 0) { + for (let c = 0; c < collapsedSeries.length; c++) { + if (collapsedSeries[c].index === realIndex) { + if (w.globals.axisCharts) { + series[realIndex].data = collapsedSeries[c].data.slice() + } else { + series[realIndex] = collapsedSeries[c].data + } + if (typeof series[realIndex] !== 'number') { + series[realIndex].hidden = false + } + collapsedSeries.splice(c, 1) + seriesIndices.splice(c, 1) + w.globals.risingSeries.push(realIndex) + } + } + + series = this._getSeriesBasedOnCollapsedState(series) + + this.lgCtx.ctx.updateHelpers._updateSeries( + series, + w.config.chart.animations.dynamicAnimation.enabled + ) + } + } + + _getSeriesBasedOnCollapsedState(series) { + const w = this.w + let collapsed = 0 + + if (w.globals.axisCharts) { + series.forEach((s, sI) => { + if ( + !( + w.globals.collapsedSeriesIndices.indexOf(sI) < 0 && + w.globals.ancillaryCollapsedSeriesIndices.indexOf(sI) < 0 + ) + ) { + series[sI].data = [] + collapsed++ + } + }) + } else { + series.forEach((s, sI) => { + if (!w.globals.collapsedSeriesIndices.indexOf(sI) < 0) { + series[sI] = 0 + collapsed++ + } + }) + } + + w.globals.allSeriesCollapsed = collapsed === series.length + + return series + } +} diff --git a/node_modules/apexcharts/src/modules/legend/Legend.js b/node_modules/apexcharts/src/modules/legend/Legend.js new file mode 100644 index 0000000..a983296 --- /dev/null +++ b/node_modules/apexcharts/src/modules/legend/Legend.js @@ -0,0 +1,510 @@ +import CoreUtils from '../CoreUtils' +import Dimensions from '../dimensions/Dimensions' +import Graphics from '../Graphics' +import Series from '../Series' +import Utils from '../../utils/Utils' +import Helpers from './Helpers' +import Markers from '../Markers' + +/** + * ApexCharts Legend Class to draw legend. + * + * @module Legend + **/ + +class Legend { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + + this.onLegendClick = this.onLegendClick.bind(this) + this.onLegendHovered = this.onLegendHovered.bind(this) + + this.isBarsDistributed = + this.w.config.chart.type === 'bar' && + this.w.config.plotOptions.bar.distributed && + this.w.config.series.length === 1 + + this.legendHelpers = new Helpers(this) + } + + init() { + const w = this.w + + const gl = w.globals + const cnf = w.config + + const showLegendAlways = + (cnf.legend.showForSingleSeries && gl.series.length === 1) || + this.isBarsDistributed || + gl.series.length > 1 + + this.legendHelpers.appendToForeignObject() + + if ((showLegendAlways || !gl.axisCharts) && cnf.legend.show) { + while (gl.dom.elLegendWrap.firstChild) { + gl.dom.elLegendWrap.removeChild(gl.dom.elLegendWrap.firstChild) + } + + this.drawLegends() + + if (cnf.legend.position === 'bottom' || cnf.legend.position === 'top') { + this.legendAlignHorizontal() + } else if ( + cnf.legend.position === 'right' || + cnf.legend.position === 'left' + ) { + this.legendAlignVertical() + } + } + } + + createLegendMarker({ i, fillcolor }) { + const w = this.w + const elMarker = document.createElement('span') + elMarker.classList.add('apexcharts-legend-marker') + + let mShape = w.config.legend.markers.shape || w.config.markers.shape + let shape = mShape + if (Array.isArray(mShape)) { + shape = mShape[i] + } + let mSize = Array.isArray(w.config.legend.markers.size) + ? parseFloat(w.config.legend.markers.size[i]) + : parseFloat(w.config.legend.markers.size) + let mOffsetX = Array.isArray(w.config.legend.markers.offsetX) + ? parseFloat(w.config.legend.markers.offsetX[i]) + : parseFloat(w.config.legend.markers.offsetX) + let mOffsetY = Array.isArray(w.config.legend.markers.offsetY) + ? parseFloat(w.config.legend.markers.offsetY[i]) + : parseFloat(w.config.legend.markers.offsetY) + let mBorderWidth = Array.isArray(w.config.legend.markers.strokeWidth) + ? parseFloat(w.config.legend.markers.strokeWidth[i]) + : parseFloat(w.config.legend.markers.strokeWidth) + + let mStyle = elMarker.style + + mStyle.height = (mSize + mBorderWidth) * 2 + 'px' + mStyle.width = (mSize + mBorderWidth) * 2 + 'px' + mStyle.left = mOffsetX + 'px' + mStyle.top = mOffsetY + 'px' + + if (w.config.legend.markers.customHTML) { + mStyle.background = 'transparent' + mStyle.color = fillcolor[i] + + if (Array.isArray(w.config.legend.markers.customHTML)) { + if (w.config.legend.markers.customHTML[i]) { + elMarker.innerHTML = w.config.legend.markers.customHTML[i]() + } + } else { + elMarker.innerHTML = w.config.legend.markers.customHTML() + } + } else { + let markers = new Markers(this.ctx) + + const markerConfig = markers.getMarkerConfig({ + cssClass: `apexcharts-legend-marker apexcharts-marker apexcharts-marker-${shape}`, + seriesIndex: i, + strokeWidth: mBorderWidth, + size: mSize, + }) + + const SVGMarker = window.SVG().addTo(elMarker).size('100%', '100%') + const marker = new Graphics(this.ctx).drawMarker(0, 0, { + ...markerConfig, + pointFillColor: Array.isArray(fillcolor) + ? fillcolor[i] + : markerConfig.pointFillColor, + shape, + }) + + const shapesEls = w.globals.dom.Paper.find( + '.apexcharts-legend-marker.apexcharts-marker' + ) + shapesEls.forEach((shapeEl) => { + if (shapeEl.node.classList.contains('apexcharts-marker-triangle')) { + shapeEl.node.style.transform = 'translate(50%, 45%)' + } else { + shapeEl.node.style.transform = 'translate(50%, 50%)' + } + }) + SVGMarker.add(marker) + } + return elMarker + } + + drawLegends() { + let me = this + let w = this.w + + let fontFamily = w.config.legend.fontFamily + + let legendNames = w.globals.seriesNames + let fillcolor = w.config.legend.markers.fillColors + ? w.config.legend.markers.fillColors.slice() + : w.globals.colors.slice() + + if (w.config.chart.type === 'heatmap') { + const ranges = w.config.plotOptions.heatmap.colorScale.ranges + legendNames = ranges.map((colorScale) => { + return colorScale.name + ? colorScale.name + : colorScale.from + ' - ' + colorScale.to + }) + fillcolor = ranges.map((color) => color.color) + } else if (this.isBarsDistributed) { + legendNames = w.globals.labels.slice() + } + + if (w.config.legend.customLegendItems.length) { + legendNames = w.config.legend.customLegendItems + } + let legendFormatter = w.globals.legendFormatter + + let isLegendInversed = w.config.legend.inverseOrder + + let legendGroups = [] + + if ( + w.globals.seriesGroups.length > 1 && + w.config.legend.clusterGroupedSeries + ) { + w.globals.seriesGroups.forEach((_, gi) => { + legendGroups[gi] = document.createElement('div') + legendGroups[gi].classList.add( + 'apexcharts-legend-group', + `apexcharts-legend-group-${gi}` + ) + if (w.config.legend.clusterGroupedSeriesOrientation === 'horizontal') { + w.globals.dom.elLegendWrap.classList.add( + 'apexcharts-legend-group-horizontal' + ) + } else { + legendGroups[gi].classList.add('apexcharts-legend-group-vertical') + } + }) + } + + for ( + let i = isLegendInversed ? legendNames.length - 1 : 0; + isLegendInversed ? i >= 0 : i <= legendNames.length - 1; + isLegendInversed ? i-- : i++ + ) { + let text = legendFormatter(legendNames[i], { seriesIndex: i, w }) + + let collapsedSeries = false + let ancillaryCollapsedSeries = false + if (w.globals.collapsedSeries.length > 0) { + for (let c = 0; c < w.globals.collapsedSeries.length; c++) { + if (w.globals.collapsedSeries[c].index === i) { + collapsedSeries = true + } + } + } + + if (w.globals.ancillaryCollapsedSeriesIndices.length > 0) { + for ( + let c = 0; + c < w.globals.ancillaryCollapsedSeriesIndices.length; + c++ + ) { + if (w.globals.ancillaryCollapsedSeriesIndices[c] === i) { + ancillaryCollapsedSeries = true + } + } + } + + let elMarker = this.createLegendMarker({ i, fillcolor }) + + Graphics.setAttrs(elMarker, { + rel: i + 1, + 'data:collapsed': collapsedSeries || ancillaryCollapsedSeries, + }) + + if (collapsedSeries || ancillaryCollapsedSeries) { + elMarker.classList.add('apexcharts-inactive-legend') + } + + let elLegend = document.createElement('div') + + let elLegendText = document.createElement('span') + elLegendText.classList.add('apexcharts-legend-text') + elLegendText.innerHTML = Array.isArray(text) ? text.join(' ') : text + + let textColor = w.config.legend.labels.useSeriesColors + ? w.globals.colors[i] + : Array.isArray(w.config.legend.labels.colors) + ? w.config.legend.labels.colors?.[i] + : w.config.legend.labels.colors + + if (!textColor) { + textColor = w.config.chart.foreColor + } + + elLegendText.style.color = textColor + + elLegendText.style.fontSize = parseFloat(w.config.legend.fontSize) + 'px' + elLegendText.style.fontWeight = w.config.legend.fontWeight + elLegendText.style.fontFamily = fontFamily || w.config.chart.fontFamily + + Graphics.setAttrs(elLegendText, { + rel: i + 1, + i, + 'data:default-text': encodeURIComponent(text), + 'data:collapsed': collapsedSeries || ancillaryCollapsedSeries, + }) + + elLegend.appendChild(elMarker) + elLegend.appendChild(elLegendText) + + const coreUtils = new CoreUtils(this.ctx) + if (!w.config.legend.showForZeroSeries) { + const total = coreUtils.getSeriesTotalByIndex(i) + + if ( + total === 0 && + coreUtils.seriesHaveSameValues(i) && + !coreUtils.isSeriesNull(i) && + w.globals.collapsedSeriesIndices.indexOf(i) === -1 && + w.globals.ancillaryCollapsedSeriesIndices.indexOf(i) === -1 + ) { + elLegend.classList.add('apexcharts-hidden-zero-series') + } + } + + if (!w.config.legend.showForNullSeries) { + if ( + coreUtils.isSeriesNull(i) && + w.globals.collapsedSeriesIndices.indexOf(i) === -1 && + w.globals.ancillaryCollapsedSeriesIndices.indexOf(i) === -1 + ) { + elLegend.classList.add('apexcharts-hidden-null-series') + } + } + + if (legendGroups.length) { + w.globals.seriesGroups.forEach((group, gi) => { + if (group.includes(w.config.series[i]?.name)) { + w.globals.dom.elLegendWrap.appendChild(legendGroups[gi]) + legendGroups[gi].appendChild(elLegend) + } + }) + } else { + w.globals.dom.elLegendWrap.appendChild(elLegend) + } + + w.globals.dom.elLegendWrap.classList.add( + `apexcharts-align-${w.config.legend.horizontalAlign}` + ) + w.globals.dom.elLegendWrap.classList.add( + 'apx-legend-position-' + w.config.legend.position + ) + + elLegend.classList.add('apexcharts-legend-series') + elLegend.style.margin = `${w.config.legend.itemMargin.vertical}px ${w.config.legend.itemMargin.horizontal}px` + w.globals.dom.elLegendWrap.style.width = w.config.legend.width + ? w.config.legend.width + 'px' + : '' + w.globals.dom.elLegendWrap.style.height = w.config.legend.height + ? w.config.legend.height + 'px' + : '' + + Graphics.setAttrs(elLegend, { + rel: i + 1, + seriesName: Utils.escapeString(legendNames[i]), + 'data:collapsed': collapsedSeries || ancillaryCollapsedSeries, + }) + + if (collapsedSeries || ancillaryCollapsedSeries) { + elLegend.classList.add('apexcharts-inactive-legend') + } + + if (!w.config.legend.onItemClick.toggleDataSeries) { + elLegend.classList.add('apexcharts-no-click') + } + } + + w.globals.dom.elWrap.addEventListener('click', me.onLegendClick, true) + + if ( + w.config.legend.onItemHover.highlightDataSeries && + w.config.legend.customLegendItems.length === 0 + ) { + w.globals.dom.elWrap.addEventListener( + 'mousemove', + me.onLegendHovered, + true + ) + w.globals.dom.elWrap.addEventListener( + 'mouseout', + me.onLegendHovered, + true + ) + } + } + + setLegendWrapXY(offsetX, offsetY) { + let w = this.w + + let elLegendWrap = w.globals.dom.elLegendWrap + + const legendHeight = elLegendWrap.clientHeight + + let x = 0 + let y = 0 + + if (w.config.legend.position === 'bottom') { + y = + w.globals.svgHeight - + Math.min(legendHeight, w.globals.svgHeight / 2) - + 5 + } else if (w.config.legend.position === 'top') { + const dim = new Dimensions(this.ctx) + const titleH = dim.dimHelpers.getTitleSubtitleCoords('title').height + const subtitleH = dim.dimHelpers.getTitleSubtitleCoords('subtitle').height + + y = (titleH > 0 ? titleH - 10 : 0) + (subtitleH > 0 ? subtitleH - 10 : 0) + } + + elLegendWrap.style.position = 'absolute' + + x = x + offsetX + w.config.legend.offsetX + y = y + offsetY + w.config.legend.offsetY + + elLegendWrap.style.left = x + 'px' + elLegendWrap.style.top = y + 'px' + + if (w.config.legend.position === 'right') { + elLegendWrap.style.left = 'auto' + elLegendWrap.style.right = 25 + w.config.legend.offsetX + 'px' + } + + const fixedHeigthWidth = ['width', 'height'] + fixedHeigthWidth.forEach((hw) => { + if (elLegendWrap.style[hw]) { + elLegendWrap.style[hw] = parseInt(w.config.legend[hw], 10) + 'px' + } + }) + } + + legendAlignHorizontal() { + let w = this.w + + let elLegendWrap = w.globals.dom.elLegendWrap + + elLegendWrap.style.right = 0 + + let dimensions = new Dimensions(this.ctx) + let titleRect = dimensions.dimHelpers.getTitleSubtitleCoords('title') + let subtitleRect = dimensions.dimHelpers.getTitleSubtitleCoords('subtitle') + + let offsetX = 20 + let offsetY = 0 + + if (w.config.legend.position === 'top') { + offsetY = + titleRect.height + + subtitleRect.height + + w.config.title.margin + + w.config.subtitle.margin - + 10 + } + + this.setLegendWrapXY(offsetX, offsetY) + } + + legendAlignVertical() { + let w = this.w + + let lRect = this.legendHelpers.getLegendDimensions() + + let offsetY = 20 + let offsetX = 0 + + if (w.config.legend.position === 'left') { + offsetX = 20 + } + + if (w.config.legend.position === 'right') { + offsetX = w.globals.svgWidth - lRect.clww - 10 + } + + this.setLegendWrapXY(offsetX, offsetY) + } + + onLegendHovered(e) { + const w = this.w + + const hoverOverLegend = + e.target.classList.contains('apexcharts-legend-series') || + e.target.classList.contains('apexcharts-legend-text') || + e.target.classList.contains('apexcharts-legend-marker') + + if (w.config.chart.type !== 'heatmap' && !this.isBarsDistributed) { + if ( + !e.target.classList.contains('apexcharts-inactive-legend') && + hoverOverLegend + ) { + let series = new Series(this.ctx) + series.toggleSeriesOnHover(e, e.target) + } + } else { + // for heatmap handling + if (hoverOverLegend) { + let seriesCnt = parseInt(e.target.getAttribute('rel'), 10) - 1 + this.ctx.events.fireEvent('legendHover', [this.ctx, seriesCnt, this.w]) + + let series = new Series(this.ctx) + series.highlightRangeInSeries(e, e.target) + } + } + } + + onLegendClick(e) { + const w = this.w + + if (w.config.legend.customLegendItems.length) return + + if ( + e.target.classList.contains('apexcharts-legend-series') || + e.target.classList.contains('apexcharts-legend-text') || + e.target.classList.contains('apexcharts-legend-marker') + ) { + let seriesCnt = parseInt(e.target.getAttribute('rel'), 10) - 1 + let isHidden = e.target.getAttribute('data:collapsed') === 'true' + + const legendClick = this.w.config.chart.events.legendClick + if (typeof legendClick === 'function') { + legendClick(this.ctx, seriesCnt, this.w) + } + + this.ctx.events.fireEvent('legendClick', [this.ctx, seriesCnt, this.w]) + + const markerClick = this.w.config.legend.markers.onClick + if ( + typeof markerClick === 'function' && + e.target.classList.contains('apexcharts-legend-marker') + ) { + markerClick(this.ctx, seriesCnt, this.w) + this.ctx.events.fireEvent('legendMarkerClick', [ + this.ctx, + seriesCnt, + this.w, + ]) + } + + // for now - just prevent click on heatmap legend - and allow hover only + const clickAllowed = + w.config.chart.type !== 'treemap' && + w.config.chart.type !== 'heatmap' && + !this.isBarsDistributed + + if (clickAllowed && w.config.legend.onItemClick.toggleDataSeries) { + this.legendHelpers.toggleDataSeries(seriesCnt, isHidden) + } + } + } +} + +export default Legend diff --git a/node_modules/apexcharts/src/modules/settings/Config.js b/node_modules/apexcharts/src/modules/settings/Config.js new file mode 100644 index 0000000..efc4b91 --- /dev/null +++ b/node_modules/apexcharts/src/modules/settings/Config.js @@ -0,0 +1,338 @@ +import Defaults from './Defaults' +import Utils from './../../utils/Utils' +import Options from './Options' + +/** + * ApexCharts Config Class for extending user options with pre-defined ApexCharts config. + * + * @module Config + **/ +export default class Config { + constructor(opts) { + this.opts = opts + } + + init({ responsiveOverride }) { + let opts = this.opts + let options = new Options() + let defaults = new Defaults(opts) + + this.chartType = opts.chart.type + + opts = this.extendYAxis(opts) + opts = this.extendAnnotations(opts) + + let config = options.init() + let newDefaults = {} + if (opts && typeof opts === 'object') { + let chartDefaults = {} + const chartTypes = [ + 'line', + 'area', + 'bar', + 'candlestick', + 'boxPlot', + 'rangeBar', + 'rangeArea', + 'bubble', + 'scatter', + 'heatmap', + 'treemap', + 'pie', + 'polarArea', + 'donut', + 'radar', + 'radialBar', + ] + + if (chartTypes.indexOf(opts.chart.type) !== -1) { + chartDefaults = defaults[opts.chart.type]() + } else { + chartDefaults = defaults.line() + } + + if (opts.plotOptions?.bar?.isFunnel) { + chartDefaults = defaults.funnel() + } + + if (opts.chart.stacked && opts.chart.type === 'bar') { + chartDefaults = defaults.stackedBars() + } + + if (opts.chart.brush?.enabled) { + chartDefaults = defaults.brush(chartDefaults) + } + + if (opts.plotOptions?.line?.isSlopeChart) { + chartDefaults = defaults.slope() + } + + if (opts.chart.stacked && opts.chart.stackType === '100%') { + opts = defaults.stacked100(opts) + } + + if (opts.plotOptions?.bar?.isDumbbell) { + opts = defaults.dumbbell(opts) + } + + // If user has specified a dark theme, make the tooltip dark too + this.checkForDarkTheme(window.Apex) // check global window Apex options + this.checkForDarkTheme(opts) // check locally passed options + + opts.xaxis = opts.xaxis || window.Apex.xaxis || {} + + // an important boolean needs to be set here + // otherwise all the charts will have this flag set to true window.Apex.xaxis is set globally + if (!responsiveOverride) { + opts.xaxis.convertedCatToNumeric = false + } + + opts = this.checkForCatToNumericXAxis(this.chartType, chartDefaults, opts) + + if ( + opts.chart.sparkline?.enabled || + window.Apex.chart?.sparkline?.enabled + ) { + chartDefaults = defaults.sparkline(chartDefaults) + } + newDefaults = Utils.extend(config, chartDefaults) + } + + // config should cascade in this fashion + // default-config < global-apex-variable-config < user-defined-config + + // get GLOBALLY defined options and merge with the default config + let mergedWithDefaultConfig = Utils.extend(newDefaults, window.Apex) + + // get the merged config and extend with user defined config + config = Utils.extend(mergedWithDefaultConfig, opts) + + // some features are not supported. those mismatches should be handled + config = this.handleUserInputErrors(config) + + return config + } + + checkForCatToNumericXAxis(chartType, chartDefaults, opts) { + let defaults = new Defaults(opts) + + const isBarHorizontal = + (chartType === 'bar' || chartType === 'boxPlot') && + opts.plotOptions?.bar?.horizontal + + const unsupportedZoom = + chartType === 'pie' || + chartType === 'polarArea' || + chartType === 'donut' || + chartType === 'radar' || + chartType === 'radialBar' || + chartType === 'heatmap' + + const notNumericXAxis = + opts.xaxis.type !== 'datetime' && opts.xaxis.type !== 'numeric' + + let tickPlacement = opts.xaxis.tickPlacement + ? opts.xaxis.tickPlacement + : chartDefaults.xaxis && chartDefaults.xaxis.tickPlacement + if ( + !isBarHorizontal && + !unsupportedZoom && + notNumericXAxis && + tickPlacement !== 'between' + ) { + opts = defaults.convertCatToNumeric(opts) + } + + return opts + } + + extendYAxis(opts, w) { + let options = new Options() + + if ( + typeof opts.yaxis === 'undefined' || + !opts.yaxis || + (Array.isArray(opts.yaxis) && opts.yaxis.length === 0) + ) { + opts.yaxis = {} + } + + // extend global yaxis config (only if object is provided / not an array) + if ( + opts.yaxis.constructor !== Array && + window.Apex.yaxis && + window.Apex.yaxis.constructor !== Array + ) { + opts.yaxis = Utils.extend(opts.yaxis, window.Apex.yaxis) + } + + // as we can't extend nested object's array with extend, we need to do it first + // user can provide either an array or object in yaxis config + if (opts.yaxis.constructor !== Array) { + // convert the yaxis to array if user supplied object + opts.yaxis = [Utils.extend(options.yAxis, opts.yaxis)] + } else { + opts.yaxis = Utils.extendArray(opts.yaxis, options.yAxis) + } + + let isLogY = false + opts.yaxis.forEach((y) => { + if (y.logarithmic) { + isLogY = true + } + }) + + let series = opts.series + if (w && !series) { + series = w.config.series + } + + // A logarithmic chart works correctly when each series has a corresponding y-axis + // If this is not the case, we manually create yaxis for multi-series log chart + if (isLogY && series.length !== opts.yaxis.length && series.length) { + opts.yaxis = series.map((s, i) => { + if (!s.name) { + series[i].name = `series-${i + 1}` + } + if (opts.yaxis[i]) { + opts.yaxis[i].seriesName = series[i].name + return opts.yaxis[i] + } else { + const newYaxis = Utils.extend(options.yAxis, opts.yaxis[0]) + newYaxis.show = false + return newYaxis + } + }) + } + + if (isLogY && series.length > 1 && series.length !== opts.yaxis.length) { + console.warn( + 'A multi-series logarithmic chart should have equal number of series and y-axes' + ) + } + return opts + } + + // annotations also accepts array, so we need to extend them manually + extendAnnotations(opts) { + if (typeof opts.annotations === 'undefined') { + opts.annotations = {} + opts.annotations.yaxis = [] + opts.annotations.xaxis = [] + opts.annotations.points = [] + } + + opts = this.extendYAxisAnnotations(opts) + opts = this.extendXAxisAnnotations(opts) + opts = this.extendPointAnnotations(opts) + + return opts + } + + extendYAxisAnnotations(opts) { + let options = new Options() + + opts.annotations.yaxis = Utils.extendArray( + typeof opts.annotations.yaxis !== 'undefined' + ? opts.annotations.yaxis + : [], + options.yAxisAnnotation + ) + return opts + } + + extendXAxisAnnotations(opts) { + let options = new Options() + + opts.annotations.xaxis = Utils.extendArray( + typeof opts.annotations.xaxis !== 'undefined' + ? opts.annotations.xaxis + : [], + options.xAxisAnnotation + ) + return opts + } + extendPointAnnotations(opts) { + let options = new Options() + + opts.annotations.points = Utils.extendArray( + typeof opts.annotations.points !== 'undefined' + ? opts.annotations.points + : [], + options.pointAnnotation + ) + return opts + } + + checkForDarkTheme(opts) { + if (opts.theme && opts.theme.mode === 'dark') { + if (!opts.tooltip) { + opts.tooltip = {} + } + if (opts.tooltip.theme !== 'light') { + opts.tooltip.theme = 'dark' + } + + if (!opts.chart.foreColor) { + opts.chart.foreColor = '#f6f7f8' + } + + if (!opts.theme.palette) { + opts.theme.palette = 'palette4' + } + } + } + + handleUserInputErrors(opts) { + let config = opts + // conflicting tooltip option. intersect makes sure to focus on 1 point at a time. Shared cannot be used along with it + if (config.tooltip.shared && config.tooltip.intersect) { + throw new Error( + 'tooltip.shared cannot be enabled when tooltip.intersect is true. Turn off any other option by setting it to false.' + ) + } + + if (config.chart.type === 'bar' && config.plotOptions.bar.horizontal) { + // No multiple yaxis for bars + if (config.yaxis.length > 1) { + throw new Error( + 'Multiple Y Axis for bars are not supported. Switch to column chart by setting plotOptions.bar.horizontal=false' + ) + } + + // if yaxis is reversed in horizontal bar chart, you should draw the y-axis on right side + if (config.yaxis[0].reversed) { + config.yaxis[0].opposite = true + } + + config.xaxis.tooltip.enabled = false // no xaxis tooltip for horizontal bar + config.yaxis[0].tooltip.enabled = false // no xaxis tooltip for horizontal bar + config.chart.zoom.enabled = false // no zooming for horz bars + } + + if (config.chart.type === 'bar' || config.chart.type === 'rangeBar') { + if (config.tooltip.shared) { + if ( + config.xaxis.crosshairs.width === 'barWidth' && + config.series.length > 1 + ) { + config.xaxis.crosshairs.width = 'tickWidth' + } + } + } + + if ( + config.chart.type === 'candlestick' || + config.chart.type === 'boxPlot' + ) { + if (config.yaxis[0].reversed) { + console.warn( + `Reversed y-axis in ${config.chart.type} chart is not supported.` + ) + config.yaxis[0].reversed = false + } + } + + return config + } +} diff --git a/node_modules/apexcharts/src/modules/settings/Defaults.js b/node_modules/apexcharts/src/modules/settings/Defaults.js new file mode 100644 index 0000000..531e925 --- /dev/null +++ b/node_modules/apexcharts/src/modules/settings/Defaults.js @@ -0,0 +1,1211 @@ +import Utils from '../../utils/Utils' +import DateTime from '../../utils/DateTime' +import Formatters from '../Formatters' + +/** + * ApexCharts Default Class for setting default options for all chart types. + * + * @module Defaults + **/ + +const getRangeValues = ({ + isTimeline, + ctx, + seriesIndex, + dataPointIndex, + y1, + y2, + w, +}) => { + let start = w.globals.seriesRangeStart[seriesIndex][dataPointIndex] + let end = w.globals.seriesRangeEnd[seriesIndex][dataPointIndex] + let ylabel = w.globals.labels[dataPointIndex] + let seriesName = w.config.series[seriesIndex].name + ? w.config.series[seriesIndex].name + : '' + const yLbFormatter = w.globals.ttKeyFormatter + const yLbTitleFormatter = w.config.tooltip.y.title.formatter + + const opts = { + w, + seriesIndex, + dataPointIndex, + start, + end, + } + + if (typeof yLbTitleFormatter === 'function') { + seriesName = yLbTitleFormatter(seriesName, opts) + } + if (w.config.series[seriesIndex].data[dataPointIndex]?.x) { + ylabel = w.config.series[seriesIndex].data[dataPointIndex].x + } + + if (!isTimeline) { + if (w.config.xaxis.type === 'datetime') { + let xFormat = new Formatters(ctx) + ylabel = xFormat.xLabelFormat(w.globals.ttKeyFormatter, ylabel, ylabel, { + i: undefined, + dateFormatter: new DateTime(ctx).formatDate, + w, + }) + } + } + + if (typeof yLbFormatter === 'function') { + ylabel = yLbFormatter(ylabel, opts) + } + if (Number.isFinite(y1) && Number.isFinite(y2)) { + start = y1 + end = y2 + } + + let startVal = '' + let endVal = '' + + const color = w.globals.colors[seriesIndex] + if (w.config.tooltip.x.formatter === undefined) { + if (w.config.xaxis.type === 'datetime') { + let datetimeObj = new DateTime(ctx) + startVal = datetimeObj.formatDate( + datetimeObj.getDate(start), + w.config.tooltip.x.format + ) + endVal = datetimeObj.formatDate( + datetimeObj.getDate(end), + w.config.tooltip.x.format + ) + } else { + startVal = start + endVal = end + } + } else { + startVal = w.config.tooltip.x.formatter(start) + endVal = w.config.tooltip.x.formatter(end) + } + + return { start, end, startVal, endVal, ylabel, color, seriesName } +} +const buildRangeTooltipHTML = (opts) => { + let { color, seriesName, ylabel, start, end, seriesIndex, dataPointIndex } = + opts + + const formatter = opts.ctx.tooltip.tooltipLabels.getFormatters(seriesIndex) + + start = formatter.yLbFormatter(start) + end = formatter.yLbFormatter(end) + const val = formatter.yLbFormatter( + opts.w.globals.series[seriesIndex][dataPointIndex] + ) + + let valueHTML = '' + const rangeValues = ` + ${start} + - + ${end} + ` + + if (opts.w.globals.comboCharts) { + if ( + opts.w.config.series[seriesIndex].type === 'rangeArea' || + opts.w.config.series[seriesIndex].type === 'rangeBar' + ) { + valueHTML = rangeValues + } else { + valueHTML = `${val}` + } + } else { + valueHTML = rangeValues + } + return ( + '
' + + '
' + + (seriesName ? seriesName : '') + + '
' + + '
' + + ylabel + + ': ' + + valueHTML + + '
' + + '
' + ) +} + +export default class Defaults { + constructor(opts) { + this.opts = opts + } + + hideYAxis() { + this.opts.yaxis[0].show = false + this.opts.yaxis[0].title.text = '' + this.opts.yaxis[0].axisBorder.show = false + this.opts.yaxis[0].axisTicks.show = false + this.opts.yaxis[0].floating = true + } + + line() { + return { + dataLabels: { + enabled: false, + }, + stroke: { + width: 5, + curve: 'straight', + }, + markers: { + size: 0, + hover: { + sizeOffset: 6, + }, + }, + xaxis: { + crosshairs: { + width: 1, + }, + }, + } + } + + sparkline(defaults) { + this.hideYAxis() + const ret = { + grid: { + show: false, + padding: { + left: 0, + right: 0, + top: 0, + bottom: 0, + }, + }, + legend: { + show: false, + }, + xaxis: { + labels: { + show: false, + }, + tooltip: { + enabled: false, + }, + axisBorder: { + show: false, + }, + axisTicks: { + show: false, + }, + }, + chart: { + toolbar: { + show: false, + }, + zoom: { + enabled: false, + }, + }, + dataLabels: { + enabled: false, + }, + } + + return Utils.extend(defaults, ret) + } + + slope() { + this.hideYAxis() + + return { + chart: { + toolbar: { + show: false, + }, + zoom: { + enabled: false, + }, + }, + dataLabels: { + enabled: true, + formatter(val, opts) { + const seriesName = opts.w.config.series[opts.seriesIndex].name + return val !== null ? seriesName + ': ' + val : '' + }, + background: { + enabled: false, + }, + offsetX: -5, + }, + grid: { + xaxis: { + lines: { + show: true, + }, + }, + yaxis: { + lines: { + show: false, + }, + }, + }, + xaxis: { + position: 'top', + labels: { + style: { + fontSize: 14, + fontWeight: 900, + }, + }, + tooltip: { + enabled: false, + }, + crosshairs: { + show: false, + }, + }, + markers: { + size: 8, + hover: { + sizeOffset: 1, + }, + }, + legend: { + show: false, + }, + tooltip: { + shared: false, + intersect: true, + followCursor: true, + }, + stroke: { + width: 5, + curve: 'straight', + }, + } + } + + bar() { + return { + chart: { + stacked: false, + }, + plotOptions: { + bar: { + dataLabels: { + position: 'center', + }, + }, + }, + dataLabels: { + style: { + colors: ['#fff'], + }, + background: { + enabled: false, + }, + }, + stroke: { + width: 0, + lineCap: 'square', + }, + fill: { + opacity: 0.85, + }, + legend: { + markers: { + shape: 'square', + }, + }, + tooltip: { + shared: false, + intersect: true, + }, + xaxis: { + tooltip: { + enabled: false, + }, + tickPlacement: 'between', + crosshairs: { + width: 'barWidth', + position: 'back', + fill: { + type: 'gradient', + }, + dropShadow: { + enabled: false, + }, + stroke: { + width: 0, + }, + }, + }, + } + } + + funnel() { + this.hideYAxis() + + return { + ...this.bar(), + chart: { + animations: { + speed: 800, + animateGradually: { + enabled: false, + }, + }, + }, + plotOptions: { + bar: { + horizontal: true, + borderRadiusApplication: 'around', + borderRadius: 0, + dataLabels: { + position: 'center', + }, + }, + }, + grid: { + show: false, + padding: { + left: 0, + right: 0, + }, + }, + xaxis: { + labels: { + show: false, + }, + tooltip: { + enabled: false, + }, + axisBorder: { + show: false, + }, + axisTicks: { + show: false, + }, + }, + } + } + + candlestick() { + return { + stroke: { + width: 1, + colors: ['#333'], + }, + fill: { + opacity: 1, + }, + dataLabels: { + enabled: false, + }, + tooltip: { + shared: true, + custom: ({ seriesIndex, dataPointIndex, w }) => { + return this._getBoxTooltip( + w, + seriesIndex, + dataPointIndex, + ['Open', 'High', '', 'Low', 'Close'], + 'candlestick' + ) + }, + }, + states: { + active: { + filter: { + type: 'none', + }, + }, + }, + xaxis: { + crosshairs: { + width: 1, + }, + }, + } + } + + boxPlot() { + return { + chart: { + animations: { + dynamicAnimation: { + enabled: false, + }, + }, + }, + stroke: { + width: 1, + colors: ['#24292e'], + }, + dataLabels: { + enabled: false, + }, + tooltip: { + shared: true, + custom: ({ seriesIndex, dataPointIndex, w }) => { + return this._getBoxTooltip( + w, + seriesIndex, + dataPointIndex, + ['Minimum', 'Q1', 'Median', 'Q3', 'Maximum'], + 'boxPlot' + ) + }, + }, + markers: { + size: 7, + strokeWidth: 1, + strokeColors: '#111', + }, + xaxis: { + crosshairs: { + width: 1, + }, + }, + } + } + + rangeBar() { + const handleTimelineTooltip = (opts) => { + const { color, seriesName, ylabel, startVal, endVal } = getRangeValues({ + ...opts, + isTimeline: true, + }) + return buildRangeTooltipHTML({ + ...opts, + color, + seriesName, + ylabel, + start: startVal, + end: endVal, + }) + } + + const handleRangeColumnTooltip = (opts) => { + const { color, seriesName, ylabel, start, end } = getRangeValues(opts) + return buildRangeTooltipHTML({ + ...opts, + color, + seriesName, + ylabel, + start, + end, + }) + } + return { + chart: { + animations: { + animateGradually: false, + }, + }, + stroke: { + width: 0, + lineCap: 'square', + }, + plotOptions: { + bar: { + borderRadius: 0, + dataLabels: { + position: 'center', + }, + }, + }, + dataLabels: { + enabled: false, + formatter(val, { ctx, seriesIndex, dataPointIndex, w }) { + const getVal = () => { + const start = + w.globals.seriesRangeStart[seriesIndex][dataPointIndex] + const end = w.globals.seriesRangeEnd[seriesIndex][dataPointIndex] + return end - start + } + if (w.globals.comboCharts) { + if ( + w.config.series[seriesIndex].type === 'rangeBar' || + w.config.series[seriesIndex].type === 'rangeArea' + ) { + return getVal() + } else { + return val + } + } else { + return getVal() + } + }, + background: { + enabled: false, + }, + style: { + colors: ['#fff'], + }, + }, + markers: { + size: 10, + }, + tooltip: { + shared: false, + followCursor: true, + custom(opts) { + if ( + opts.w.config.plotOptions && + opts.w.config.plotOptions.bar && + opts.w.config.plotOptions.bar.horizontal + ) { + return handleTimelineTooltip(opts) + } else { + return handleRangeColumnTooltip(opts) + } + }, + }, + xaxis: { + tickPlacement: 'between', + tooltip: { + enabled: false, + }, + crosshairs: { + stroke: { + width: 0, + }, + }, + }, + } + } + + dumbbell(opts) { + if (!opts.plotOptions.bar?.barHeight) { + opts.plotOptions.bar.barHeight = 2 + } + if (!opts.plotOptions.bar?.columnWidth) { + opts.plotOptions.bar.columnWidth = 2 + } + return opts + } + + area() { + return { + stroke: { + width: 4, + fill: { + type: 'solid', + gradient: { + inverseColors: false, + shade: 'light', + type: 'vertical', + opacityFrom: 0.65, + opacityTo: 0.5, + stops: [0, 100, 100], + }, + }, + }, + fill: { + type: 'gradient', + gradient: { + inverseColors: false, + shade: 'light', + type: 'vertical', + opacityFrom: 0.65, + opacityTo: 0.5, + stops: [0, 100, 100], + }, + }, + markers: { + size: 0, + hover: { + sizeOffset: 6, + }, + }, + tooltip: { + followCursor: false, + }, + } + } + + rangeArea() { + const handleRangeAreaTooltip = (opts) => { + const { color, seriesName, ylabel, start, end } = getRangeValues(opts) + return buildRangeTooltipHTML({ + ...opts, + color, + seriesName, + ylabel, + start, + end, + }) + } + return { + stroke: { + curve: 'straight', + width: 0, + }, + fill: { + type: 'solid', + opacity: 0.6, + }, + markers: { + size: 0, + }, + states: { + hover: { + filter: { + type: 'none', + }, + }, + active: { + filter: { + type: 'none', + }, + }, + }, + tooltip: { + intersect: false, + shared: true, + followCursor: true, + custom(opts) { + return handleRangeAreaTooltip(opts) + }, + }, + } + } + + brush(defaults) { + const ret = { + chart: { + toolbar: { + autoSelected: 'selection', + show: false, + }, + zoom: { + enabled: false, + }, + }, + dataLabels: { + enabled: false, + }, + stroke: { + width: 1, + }, + tooltip: { + enabled: false, + }, + xaxis: { + tooltip: { + enabled: false, + }, + }, + } + + return Utils.extend(defaults, ret) + } + + stacked100(opts) { + opts.dataLabels = opts.dataLabels || {} + opts.dataLabels.formatter = opts.dataLabels.formatter || undefined + const existingDataLabelFormatter = opts.dataLabels.formatter + + opts.yaxis.forEach((yaxe, index) => { + opts.yaxis[index].min = 0 + opts.yaxis[index].max = 100 + }) + + const isBar = opts.chart.type === 'bar' + + if (isBar) { + opts.dataLabels.formatter = + existingDataLabelFormatter || + function (val) { + if (typeof val === 'number') { + return val ? val.toFixed(0) + '%' : val + } + return val + } + } + return opts + } + + stackedBars() { + const barDefaults = this.bar() + return { + ...barDefaults, + plotOptions: { + ...barDefaults.plotOptions, + bar: { + ...barDefaults.plotOptions.bar, + borderRadiusApplication: 'end', + borderRadiusWhenStacked: 'last', + }, + }, + } + } + + // This function removes the left and right spacing in chart for line/area/scatter if xaxis type = category for those charts by converting xaxis = numeric. Numeric/Datetime xaxis prevents the unnecessary spacing in the left/right of the chart area + convertCatToNumeric(opts) { + opts.xaxis.convertedCatToNumeric = true + + return opts + } + + convertCatToNumericXaxis(opts, ctx, cats) { + opts.xaxis.type = 'numeric' + opts.xaxis.labels = opts.xaxis.labels || {} + opts.xaxis.labels.formatter = + opts.xaxis.labels.formatter || + function (val) { + return Utils.isNumber(val) ? Math.floor(val) : val + } + + const defaultFormatter = opts.xaxis.labels.formatter + let labels = + opts.xaxis.categories && opts.xaxis.categories.length + ? opts.xaxis.categories + : opts.labels + + if (cats && cats.length) { + labels = cats.map((c) => { + return Array.isArray(c) ? c : String(c) + }) + } + + if (labels && labels.length) { + opts.xaxis.labels.formatter = function (val) { + return Utils.isNumber(val) + ? defaultFormatter(labels[Math.floor(val) - 1]) + : defaultFormatter(val) + } + } + + opts.xaxis.categories = [] + opts.labels = [] + opts.xaxis.tickAmount = opts.xaxis.tickAmount || 'dataPoints' + return opts + } + + bubble() { + return { + dataLabels: { + style: { + colors: ['#fff'], + }, + }, + tooltip: { + shared: false, + intersect: true, + }, + xaxis: { + crosshairs: { + width: 0, + }, + }, + fill: { + type: 'solid', + gradient: { + shade: 'light', + inverse: true, + shadeIntensity: 0.55, + opacityFrom: 0.4, + opacityTo: 0.8, + }, + }, + } + } + + scatter() { + return { + dataLabels: { + enabled: false, + }, + tooltip: { + shared: false, + intersect: true, + }, + markers: { + size: 6, + strokeWidth: 1, + hover: { + sizeOffset: 2, + }, + }, + } + } + + heatmap() { + return { + chart: { + stacked: false, + }, + fill: { + opacity: 1, + }, + dataLabels: { + style: { + colors: ['#fff'], + }, + }, + stroke: { + colors: ['#fff'], + }, + tooltip: { + followCursor: true, + marker: { + show: false, + }, + x: { + show: false, + }, + }, + legend: { + position: 'top', + markers: { + shape: 'square', + }, + }, + grid: { + padding: { + right: 20, + }, + }, + } + } + + treemap() { + return { + chart: { + zoom: { + enabled: false, + }, + }, + dataLabels: { + style: { + fontSize: 14, + fontWeight: 600, + colors: ['#fff'], + }, + }, + stroke: { + show: true, + width: 2, + colors: ['#fff'], + }, + legend: { + show: false, + }, + fill: { + opacity: 1, + gradient: { + stops: [0, 100], + }, + }, + tooltip: { + followCursor: true, + x: { + show: false, + }, + }, + grid: { + padding: { + left: 0, + right: 0, + }, + }, + xaxis: { + crosshairs: { + show: false, + }, + tooltip: { + enabled: false, + }, + }, + } + } + + pie() { + return { + chart: { + toolbar: { + show: false, + }, + }, + plotOptions: { + pie: { + donut: { + labels: { + show: false, + }, + }, + }, + }, + dataLabels: { + formatter(val) { + return val.toFixed(1) + '%' + }, + style: { + colors: ['#fff'], + }, + background: { + enabled: false, + }, + dropShadow: { + enabled: true, + }, + }, + stroke: { + colors: ['#fff'], + }, + fill: { + opacity: 1, + gradient: { + shade: 'light', + stops: [0, 100], + }, + }, + tooltip: { + theme: 'dark', + fillSeriesColor: true, + }, + legend: { + position: 'right', + }, + grid: { + padding: { + left: 0, + right: 0, + top: 0, + bottom: 0, + }, + }, + } + } + + donut() { + return { + chart: { + toolbar: { + show: false, + }, + }, + dataLabels: { + formatter(val) { + return val.toFixed(1) + '%' + }, + style: { + colors: ['#fff'], + }, + background: { + enabled: false, + }, + dropShadow: { + enabled: true, + }, + }, + stroke: { + colors: ['#fff'], + }, + fill: { + opacity: 1, + gradient: { + shade: 'light', + shadeIntensity: 0.35, + stops: [80, 100], + opacityFrom: 1, + opacityTo: 1, + }, + }, + tooltip: { + theme: 'dark', + fillSeriesColor: true, + }, + legend: { + position: 'right', + }, + grid: { + padding: { + left: 0, + right: 0, + top: 0, + bottom: 0, + }, + }, + } + } + + polarArea() { + return { + chart: { + toolbar: { + show: false, + }, + }, + dataLabels: { + formatter(val) { + return val.toFixed(1) + '%' + }, + enabled: false, + }, + stroke: { + show: true, + width: 2, + }, + fill: { + opacity: 0.7, + }, + tooltip: { + theme: 'dark', + fillSeriesColor: true, + }, + legend: { + position: 'right', + }, + grid: { + padding: { + left: 0, + right: 0, + top: 0, + bottom: 0, + }, + }, + } + } + + radar() { + this.opts.yaxis[0].labels.offsetY = this.opts.yaxis[0].labels.offsetY + ? this.opts.yaxis[0].labels.offsetY + : 6 + + return { + dataLabels: { + enabled: false, + style: { + fontSize: '11px', + }, + }, + stroke: { + width: 2, + }, + markers: { + size: 5, + strokeWidth: 1, + strokeOpacity: 1, + }, + fill: { + opacity: 0.2, + }, + tooltip: { + shared: false, + intersect: true, + followCursor: true, + }, + grid: { + show: false, + padding: { + left: 0, + right: 0, + top: 0, + bottom: 0, + }, + }, + xaxis: { + labels: { + formatter: (val) => val, + style: { + colors: ['#a8a8a8'], + fontSize: '11px', + }, + }, + tooltip: { + enabled: false, + }, + crosshairs: { + show: false, + }, + }, + } + } + + radialBar() { + return { + chart: { + animations: { + dynamicAnimation: { + enabled: true, + speed: 800, + }, + }, + toolbar: { + show: false, + }, + }, + fill: { + gradient: { + shade: 'dark', + shadeIntensity: 0.4, + inverseColors: false, + type: 'diagonal2', + opacityFrom: 1, + opacityTo: 1, + stops: [70, 98, 100], + }, + }, + legend: { + show: false, + position: 'right', + }, + tooltip: { + enabled: false, + fillSeriesColor: true, + }, + grid: { + padding: { + left: 0, + right: 0, + top: 0, + bottom: 0, + }, + }, + } + } + + _getBoxTooltip(w, seriesIndex, dataPointIndex, labels, chartType) { + const o = w.globals.seriesCandleO[seriesIndex][dataPointIndex] + const h = w.globals.seriesCandleH[seriesIndex][dataPointIndex] + const m = w.globals.seriesCandleM[seriesIndex][dataPointIndex] + const l = w.globals.seriesCandleL[seriesIndex][dataPointIndex] + const c = w.globals.seriesCandleC[seriesIndex][dataPointIndex] + + if ( + w.config.series[seriesIndex].type && + w.config.series[seriesIndex].type !== chartType + ) { + return `
+ ${ + w.config.series[seriesIndex].name + ? w.config.series[seriesIndex].name + : 'series-' + (seriesIndex + 1) + }: ${w.globals.series[seriesIndex][dataPointIndex]} +
` + } else { + return ( + `
` + + `
${labels[0]}: ` + + o + + '
' + + `
${labels[1]}: ` + + h + + '
' + + (m + ? `
${labels[2]}: ` + m + '
' + : '') + + `
${labels[3]}: ` + + l + + '
' + + `
${labels[4]}: ` + + c + + '
' + + '
' + ) + } + } +} diff --git a/node_modules/apexcharts/src/modules/settings/Globals.js b/node_modules/apexcharts/src/modules/settings/Globals.js new file mode 100644 index 0000000..8fb4793 --- /dev/null +++ b/node_modules/apexcharts/src/modules/settings/Globals.js @@ -0,0 +1,261 @@ +import Utils from './../../utils/Utils' + +export default class Globals { + initGlobalVars(gl) { + gl.series = [] // the MAIN series array (y values) + gl.seriesCandleO = [] + gl.seriesCandleH = [] + gl.seriesCandleM = [] + gl.seriesCandleL = [] + gl.seriesCandleC = [] + gl.seriesRangeStart = [] + gl.seriesRangeEnd = [] + gl.seriesRange = [] + gl.seriesPercent = [] + gl.seriesGoals = [] + gl.seriesX = [] + gl.seriesZ = [] + gl.seriesNames = [] + gl.seriesTotals = [] + gl.seriesLog = [] + gl.seriesColors = [] + gl.stackedSeriesTotals = [] + gl.seriesXvalues = [] // we will need this in tooltip (it's x position) + // when we will have unequal x values, we will need + // some way to get x value depending on mouse pointer + gl.seriesYvalues = [] // we will need this when deciding which series + // user hovered on + gl.labels = [] + gl.hasXaxisGroups = false + gl.groups = [] + gl.barGroups = [] + gl.lineGroups = [] + gl.areaGroups = [] + gl.hasSeriesGroups = false + gl.seriesGroups = [] + gl.categoryLabels = [] + gl.timescaleLabels = [] + gl.noLabelsProvided = false + gl.resizeTimer = null + gl.selectionResizeTimer = null + gl.lastWheelExecution = 0 + gl.delayedElements = [] + gl.pointsArray = [] + gl.dataLabelsRects = [] + gl.isXNumeric = false + gl.skipLastTimelinelabel = false + gl.skipFirstTimelinelabel = false + gl.isDataXYZ = false + gl.isMultiLineX = false + gl.isMultipleYAxis = false + gl.maxY = -Number.MAX_VALUE + gl.minY = Number.MIN_VALUE + gl.minYArr = [] + gl.maxYArr = [] + gl.maxX = -Number.MAX_VALUE + gl.minX = Number.MAX_VALUE + gl.initialMaxX = -Number.MAX_VALUE + gl.initialMinX = Number.MAX_VALUE + gl.maxDate = 0 + gl.minDate = Number.MAX_VALUE + gl.minZ = Number.MAX_VALUE + gl.maxZ = -Number.MAX_VALUE + gl.minXDiff = Number.MAX_VALUE + gl.yAxisScale = [] + gl.xAxisScale = null + gl.xAxisTicksPositions = [] + gl.yLabelsCoords = [] + gl.yTitleCoords = [] + gl.barPadForNumericAxis = 0 + gl.padHorizontal = 0 + gl.xRange = 0 + gl.yRange = [] + gl.zRange = 0 + gl.dataPoints = 0 + gl.xTickAmount = 0 + gl.multiAxisTickAmount = 0 + } + + globalVars(config) { + return { + chartID: null, // chart ID - apexcharts-cuid + cuid: null, // chart ID - random numbers excluding "apexcharts" part + events: { + beforeMount: [], + mounted: [], + updated: [], + clicked: [], + selection: [], + dataPointSelection: [], + zoomed: [], + scrolled: [], + }, + colors: [], + clientX: null, + clientY: null, + fill: { + colors: [], + }, + stroke: { + colors: [], + }, + dataLabels: { + style: { + colors: [], + }, + }, + radarPolygons: { + fill: { + colors: [], + }, + }, + markers: { + colors: [], + size: config.markers.size, + largestSize: 0, + }, + animationEnded: false, + isTouchDevice: 'ontouchstart' in window || navigator.msMaxTouchPoints, + isDirty: false, // chart has been updated after the initial render. This is different than dataChanged property. isDirty means user manually called some method to update + isExecCalled: false, // whether user updated the chart through the exec method + initialConfig: null, // we will store the first config user has set to go back when user finishes interactions like zooming and come out of it + initialSeries: [], + lastXAxis: [], + lastYAxis: [], + columnSeries: null, + labels: [], // store the text to draw on x axis + // Don't mutate the labels, many things including tooltips depends on it! + timescaleLabels: [], // store the timescaleLabels Labels in another variable + noLabelsProvided: false, // if user didn't provide any categories/labels or x values, fallback to 1,2,3,4... + allSeriesCollapsed: false, + collapsedSeries: [], // when user collapses a series, it goes into this array + collapsedSeriesIndices: [], // this stores the index of the collapsedSeries instead of whole object for quick access + ancillaryCollapsedSeries: [], // when user collapses an "alwaysVisible" series, it goes into this array + ancillaryCollapsedSeriesIndices: [], // this stores the index of the ancillaryCollapsedSeries whose y-axis is always visible + risingSeries: [], // when user re-opens a collapsed series, it goes here + dataFormatXNumeric: false, // boolean value to indicate user has passed numeric x values + capturedSeriesIndex: -1, + capturedDataPointIndex: -1, + selectedDataPoints: [], + invalidLogScale: false, // if a user enabled log scale but the data provided is not valid to generate a log scale, turn on this flag + ignoreYAxisIndexes: [], // when series are being collapsed in multiple y axes, ignore certain index + maxValsInArrayIndex: 0, + radialSize: 0, + selection: undefined, + zoomEnabled: + config.chart.toolbar.autoSelected === 'zoom' && + config.chart.toolbar.tools.zoom && + config.chart.zoom.enabled, + panEnabled: + config.chart.toolbar.autoSelected === 'pan' && + config.chart.toolbar.tools.pan, + selectionEnabled: + config.chart.toolbar.autoSelected === 'selection' && + config.chart.toolbar.tools.selection, + yaxis: null, + mousedown: false, + lastClientPosition: {}, // don't reset this variable this the chart is destroyed. It is used to detect right or left mousemove in panning + visibleXRange: undefined, + yValueDecimal: 0, // are there floating numbers in the series. If yes, this represent the len of the decimals + total: 0, + SVGNS: 'http://www.w3.org/2000/svg', // svg namespace + svgWidth: 0, // the whole svg width + svgHeight: 0, // the whole svg height + noData: false, // whether there is any data to display or not + locale: {}, // the current locale values will be preserved here for global access + dom: {}, // for storing all dom nodes in this particular property + memory: { + methodsToExec: [], + }, + shouldAnimate: true, + skipLastTimelinelabel: false, // when last label is cropped, skip drawing it + skipFirstTimelinelabel: false, // when first label is cropped, skip drawing it + delayedElements: [], // element which appear after animation has finished + axisCharts: true, // chart type = line or area or bar + // (refer them also as plot charts in the code) + isDataXYZ: false, // bool: data was provided in a {[x,y,z]} pattern + isSlopeChart: config.plotOptions.line.isSlopeChart, + resized: false, // bool: user has resized + resizeTimer: null, // timeout function to make a small delay before + // drawing when user resized + comboCharts: false, // bool: whether it's a combination of line/column + dataChanged: false, // bool: has data changed dynamically + previousPaths: [], // array: when data is changed, it will animate from + // previous paths + allSeriesHasEqualX: true, + pointsArray: [], // store the points positions here to draw later on hover + // format is - [[x,y],[x,y]... [x,y]] + dataLabelsRects: [], // store the positions of datalabels to prevent collision + lastDrawnDataLabelsIndexes: [], + hasNullValues: false, // bool: whether series contains null values + zoomed: false, // whether user has zoomed or not + gridWidth: 0, // drawable width of actual graphs (series paths) + gridHeight: 0, // drawable height of actual graphs (series paths) + rotateXLabels: false, + defaultLabels: false, + xLabelFormatter: undefined, // formatter for x axis labels + yLabelFormatters: [], + xaxisTooltipFormatter: undefined, // formatter for x axis tooltip + ttKeyFormatter: undefined, + ttVal: undefined, + ttZFormatter: undefined, + LINE_HEIGHT_RATIO: 1.618, + xAxisLabelsHeight: 0, + xAxisGroupLabelsHeight: 0, + xAxisLabelsWidth: 0, + yAxisLabelsWidth: 0, + scaleX: 1, + scaleY: 1, + translateX: 0, + translateY: 0, + translateYAxisX: [], + yAxisWidths: [], + translateXAxisY: 0, + translateXAxisX: 0, + tooltip: null, + // Rules for niceScaleAllowedMagMsd: + // 1) An array of two arrays only ([[],[]]): + // * array[0][]: influences labelling of data series that contain only integers + // - must contain only integers (or expect ugly ticks) + // * array[1][]: influences labelling of data series that contain at least one float + // - may contain floats + // * both arrays: + // - each array[][i] ideally satisfy: 10 mod array[][i] == 0 (or expect ugly ticks) + // - to avoid clipping data point keep each array[][i] >= i + // 2) each array[i][] contains 11 values, for all possible index values 0..10. + // array[][0] should not be needed (not proven) but ensures non-zero is returned. + // + // Users can effectively force their preferred "magMsd" through stepSize and + // forceNiceScale. With forceNiceScale: true, stepSize becomes normalizable to the + // axis's min..max range, which allows users to set stepSize to an integer 1..10, for + // example, stepSize: 3. This value will be preferred to the value determined through + // this array. The range-normalized value is checked for consistency with other + // user defined options and will be ignored if inconsistent. + niceScaleAllowedMagMsd: [ + [1, 1, 2, 5, 5, 5, 10, 10, 10, 10, 10], + [1, 1, 2, 5, 5, 5, 10, 10, 10, 10, 10], + ], + // Default ticks based on SVG size. These values have high numbers + // of divisors. The array is indexed using a calculated maxTicks value + // divided by 2 simply to halve the array size. See Scales.niceScale(). + niceScaleDefaultTicks: [ + 1, 2, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 24, + ], + seriesYAxisMap: [], // Given yAxis index, return all series indices belonging to it. Multiple series can be referenced to each yAxis. + seriesYAxisReverseMap: [], // Given a Series index, return its yAxis index. + } + } + + init(config) { + let globals = this.globalVars(config) + this.initGlobalVars(globals) + + globals.initialConfig = Utils.extend({}, config) + globals.initialSeries = Utils.clone(config.series) + + globals.lastXAxis = Utils.clone(globals.initialConfig.xaxis) + globals.lastYAxis = Utils.clone(globals.initialConfig.yaxis) + return globals + } +} diff --git a/node_modules/apexcharts/src/modules/settings/Options.js b/node_modules/apexcharts/src/modules/settings/Options.js new file mode 100644 index 0000000..81dd21b --- /dev/null +++ b/node_modules/apexcharts/src/modules/settings/Options.js @@ -0,0 +1,1148 @@ +/** + * ApexCharts Options for setting the initial configuration of ApexCharts + **/ +import en from './../../locales/en.json' + +export default class Options { + constructor() { + this.yAxis = { + show: true, + showAlways: false, + showForNullSeries: true, + seriesName: undefined, + opposite: false, + reversed: false, + logarithmic: false, + logBase: 10, + tickAmount: undefined, + stepSize: undefined, + forceNiceScale: false, + max: undefined, + min: undefined, + floating: false, + decimalsInFloat: undefined, + labels: { + show: true, + showDuplicates: false, + minWidth: 0, + maxWidth: 160, + offsetX: 0, + offsetY: 0, + align: undefined, + rotate: 0, + padding: 20, + style: { + colors: [], + fontSize: '11px', + fontWeight: 400, + fontFamily: undefined, + cssClass: '', + }, + formatter: undefined, + }, + axisBorder: { + show: false, + color: '#e0e0e0', + width: 1, + offsetX: 0, + offsetY: 0, + }, + axisTicks: { + show: false, + color: '#e0e0e0', + width: 6, + offsetX: 0, + offsetY: 0, + }, + title: { + text: undefined, + rotate: -90, + offsetY: 0, + offsetX: 0, + style: { + color: undefined, + fontSize: '11px', + fontWeight: 900, + fontFamily: undefined, + cssClass: '', + }, + }, + tooltip: { + enabled: false, + offsetX: 0, + }, + crosshairs: { + show: true, + position: 'front', + stroke: { + color: '#b6b6b6', + width: 1, + dashArray: 0, + }, + }, + } + + this.pointAnnotation = { + id: undefined, + x: 0, + y: null, + yAxisIndex: 0, + seriesIndex: undefined, + mouseEnter: undefined, + mouseLeave: undefined, + click: undefined, + marker: { + size: 4, + fillColor: '#fff', + strokeWidth: 2, + strokeColor: '#333', + shape: 'circle', + offsetX: 0, + offsetY: 0, + // radius: 2, // DEPRECATED + cssClass: '', + }, + label: { + borderColor: '#c2c2c2', + borderWidth: 1, + borderRadius: 2, + text: undefined, + textAnchor: 'middle', + offsetX: 0, + offsetY: 0, + mouseEnter: undefined, + mouseLeave: undefined, + click: undefined, + style: { + background: '#fff', + color: undefined, + fontSize: '11px', + fontFamily: undefined, + fontWeight: 400, + cssClass: '', + padding: { + left: 5, + right: 5, + top: 2, + bottom: 2, + }, + }, + }, + customSVG: { + // this will be deprecated in the next major version as it is going to be replaced with a better alternative below (image) + SVG: undefined, + cssClass: undefined, + offsetX: 0, + offsetY: 0, + }, + image: { + path: undefined, + width: 20, + height: 20, + offsetX: 0, + offsetY: 0, + }, + } + + this.yAxisAnnotation = { + id: undefined, + y: 0, + y2: null, + strokeDashArray: 1, + fillColor: '#c2c2c2', + borderColor: '#c2c2c2', + borderWidth: 1, + opacity: 0.3, + offsetX: 0, + offsetY: 0, + width: '100%', + yAxisIndex: 0, + label: { + borderColor: '#c2c2c2', + borderWidth: 1, + borderRadius: 2, + text: undefined, + textAnchor: 'end', + position: 'right', + offsetX: 0, + offsetY: -3, + mouseEnter: undefined, + mouseLeave: undefined, + click: undefined, + style: { + background: '#fff', + color: undefined, + fontSize: '11px', + fontFamily: undefined, + fontWeight: 400, + cssClass: '', + padding: { + left: 5, + right: 5, + top: 2, + bottom: 2, + }, + }, + }, + } + + this.xAxisAnnotation = { + id: undefined, + x: 0, + x2: null, + strokeDashArray: 1, + fillColor: '#c2c2c2', + borderColor: '#c2c2c2', + borderWidth: 1, + opacity: 0.3, + offsetX: 0, + offsetY: 0, + label: { + borderColor: '#c2c2c2', + borderWidth: 1, + borderRadius: 2, + text: undefined, + textAnchor: 'middle', + orientation: 'vertical', + position: 'top', + offsetX: 0, + offsetY: 0, + mouseEnter: undefined, + mouseLeave: undefined, + click: undefined, + style: { + background: '#fff', + color: undefined, + fontSize: '11px', + fontFamily: undefined, + fontWeight: 400, + cssClass: '', + padding: { + left: 5, + right: 5, + top: 2, + bottom: 2, + }, + }, + }, + } + + this.text = { + x: 0, + y: 0, + text: '', + textAnchor: 'start', + foreColor: undefined, + fontSize: '13px', + fontFamily: undefined, + fontWeight: 400, + appendTo: '.apexcharts-annotations', + backgroundColor: 'transparent', + borderColor: '#c2c2c2', + borderRadius: 0, + borderWidth: 0, + paddingLeft: 4, + paddingRight: 4, + paddingTop: 2, + paddingBottom: 2, + } + } + init() { + return { + annotations: { + yaxis: [this.yAxisAnnotation], + xaxis: [this.xAxisAnnotation], + points: [this.pointAnnotation], + texts: [], + images: [], + shapes: [], + }, + chart: { + animations: { + enabled: true, + speed: 800, + animateGradually: { + delay: 150, + enabled: true, + }, + dynamicAnimation: { + enabled: true, + speed: 350, + }, + }, + background: '', + locales: [en], + defaultLocale: 'en', + dropShadow: { + enabled: false, + enabledOnSeries: undefined, + top: 2, + left: 2, + blur: 4, + color: '#000', + opacity: 0.7, + }, + events: { + animationEnd: undefined, + beforeMount: undefined, + mounted: undefined, + updated: undefined, + click: undefined, + mouseMove: undefined, + mouseLeave: undefined, + xAxisLabelClick: undefined, + legendClick: undefined, + markerClick: undefined, + selection: undefined, + dataPointSelection: undefined, + dataPointMouseEnter: undefined, + dataPointMouseLeave: undefined, + beforeZoom: undefined, + beforeResetZoom: undefined, + zoomed: undefined, + scrolled: undefined, + brushScrolled: undefined, + }, + foreColor: '#373d3f', + fontFamily: 'Helvetica, Arial, sans-serif', + height: 'auto', + parentHeightOffset: 15, + redrawOnParentResize: true, + redrawOnWindowResize: true, + id: undefined, + group: undefined, + nonce: undefined, + offsetX: 0, + offsetY: 0, + selection: { + enabled: false, + type: 'x', + // selectedPoints: undefined, // default datapoints that should be selected automatically + fill: { + color: '#24292e', + opacity: 0.1, + }, + stroke: { + width: 1, + color: '#24292e', + opacity: 0.4, + dashArray: 3, + }, + xaxis: { + min: undefined, + max: undefined, + }, + yaxis: { + min: undefined, + max: undefined, + }, + }, + sparkline: { + enabled: false, + }, + brush: { + enabled: false, + autoScaleYaxis: true, + target: undefined, + targets: undefined, + }, + stacked: false, + stackOnlyBar: true, // mixed chart with stacked bars and line series - incorrect line draw #907 + stackType: 'normal', + toolbar: { + show: true, + offsetX: 0, + offsetY: 0, + tools: { + download: true, + selection: true, + zoom: true, + zoomin: true, + zoomout: true, + pan: true, + reset: true, + customIcons: [], + }, + export: { + csv: { + filename: undefined, + columnDelimiter: ',', + headerCategory: 'category', + headerValue: 'value', + categoryFormatter: undefined, + valueFormatter: undefined, + }, + png: { + filename: undefined, + }, + svg: { + filename: undefined, + }, + scale: undefined, + width: undefined, + }, + autoSelected: 'zoom', // accepts -> zoom, pan, selection + }, + type: 'line', + width: '100%', + zoom: { + enabled: true, + type: 'x', + autoScaleYaxis: false, + allowMouseWheelZoom: true, + zoomedArea: { + fill: { + color: '#90CAF9', + opacity: 0.4, + }, + stroke: { + color: '#0D47A1', + opacity: 0.4, + width: 1, + }, + }, + }, + }, + plotOptions: { + line: { + isSlopeChart: false, + colors: { + threshold: 0, + colorAboveThreshold: undefined, + colorBelowThreshold: undefined, + }, + }, + area: { + fillTo: 'origin', + }, + bar: { + horizontal: false, + columnWidth: '70%', // should be in percent 0 - 100 + barHeight: '70%', // should be in percent 0 - 100 + distributed: false, + borderRadius: 0, + borderRadiusApplication: 'around', // [around, end] + borderRadiusWhenStacked: 'last', // [all, last] + rangeBarOverlap: true, + rangeBarGroupRows: false, + hideZeroBarsWhenGrouped: false, + isDumbbell: false, + dumbbellColors: undefined, + isFunnel: false, + isFunnel3d: true, + colors: { + ranges: [], + backgroundBarColors: [], + backgroundBarOpacity: 1, + backgroundBarRadius: 0, + }, + dataLabels: { + position: 'top', // top, center, bottom + maxItems: 100, + hideOverflowingLabels: true, + orientation: 'horizontal', + total: { + enabled: false, + formatter: undefined, + offsetX: 0, + offsetY: 0, + style: { + color: '#373d3f', + fontSize: '12px', + fontFamily: undefined, + fontWeight: 600, + }, + }, + }, + }, + bubble: { + zScaling: true, + minBubbleRadius: undefined, + maxBubbleRadius: undefined, + }, + candlestick: { + colors: { + upward: '#00B746', + downward: '#EF403C', + }, + wick: { + useFillColor: true, + }, + }, + boxPlot: { + colors: { + upper: '#00E396', + lower: '#008FFB', + }, + }, + heatmap: { + radius: 2, + enableShades: true, + shadeIntensity: 0.5, + reverseNegativeShade: false, + distributed: false, + useFillColorAsStroke: false, + colorScale: { + inverse: false, + ranges: [], + min: undefined, + max: undefined, + }, + }, + treemap: { + enableShades: true, + shadeIntensity: 0.5, + distributed: false, + reverseNegativeShade: false, + useFillColorAsStroke: false, + borderRadius: 4, + dataLabels: { + format: 'scale', // scale | truncate + }, + colorScale: { + inverse: false, + ranges: [], + min: undefined, + max: undefined, + }, + seriesTitle: { + show: true, + offsetY: 1, + offsetX: 1, + borderColor: '#000', + borderWidth: 1, + borderRadius: 2, + style: { + background: 'rgba(0, 0, 0, 0.6)', + color: '#fff', + fontSize: '12px', + fontFamily: undefined, + fontWeight: 400, + cssClass: '', + padding: { + left: 6, + right: 6, + top: 2, + bottom: 2, + }, + }, + }, + }, + radialBar: { + inverseOrder: false, + startAngle: 0, + endAngle: 360, + offsetX: 0, + offsetY: 0, + hollow: { + margin: 5, + size: '50%', + background: 'transparent', + image: undefined, + imageWidth: 150, + imageHeight: 150, + imageOffsetX: 0, + imageOffsetY: 0, + imageClipped: true, + position: 'front', + dropShadow: { + enabled: false, + top: 0, + left: 0, + blur: 3, + color: '#000', + opacity: 0.5, + }, + }, + track: { + show: true, + startAngle: undefined, + endAngle: undefined, + background: '#f2f2f2', + strokeWidth: '97%', + opacity: 1, + margin: 5, // margin is in pixels + dropShadow: { + enabled: false, + top: 0, + left: 0, + blur: 3, + color: '#000', + opacity: 0.5, + }, + }, + dataLabels: { + show: true, + name: { + show: true, + fontSize: '16px', + fontFamily: undefined, + fontWeight: 600, + color: undefined, + offsetY: 0, + formatter(val) { + return val + }, + }, + value: { + show: true, + fontSize: '14px', + fontFamily: undefined, + fontWeight: 400, + color: undefined, + offsetY: 16, + formatter(val) { + return val + '%' + }, + }, + total: { + show: false, + label: 'Total', + fontSize: '16px', + fontWeight: 600, + fontFamily: undefined, + color: undefined, + formatter(w) { + return ( + w.globals.seriesTotals.reduce((a, b) => a + b, 0) / + w.globals.series.length + + '%' + ) + }, + }, + }, + barLabels: { + enabled: false, + offsetX: 0, + offsetY: 0, + useSeriesColors: true, + fontFamily: undefined, + fontWeight: 600, + fontSize: '16px', + formatter(val) { + return val + }, + onClick: undefined, + }, + }, + pie: { + customScale: 1, + offsetX: 0, + offsetY: 0, + startAngle: 0, + endAngle: 360, + expandOnClick: true, + dataLabels: { + // These are the percentage values which are displayed on slice + offset: 0, // offset by which labels will move outside + minAngleToShowLabel: 10, + }, + donut: { + size: '65%', + background: 'transparent', + labels: { + // These are the inner labels appearing inside donut + show: false, + name: { + show: true, + fontSize: '16px', + fontFamily: undefined, + fontWeight: 600, + color: undefined, + offsetY: -10, + formatter(val) { + return val + }, + }, + value: { + show: true, + fontSize: '20px', + fontFamily: undefined, + fontWeight: 400, + color: undefined, + offsetY: 10, + formatter(val) { + return val + }, + }, + total: { + show: false, + showAlways: false, + label: 'Total', + fontSize: '16px', + fontWeight: 400, + fontFamily: undefined, + color: undefined, + formatter(w) { + return w.globals.seriesTotals.reduce((a, b) => a + b, 0) + }, + }, + }, + }, + }, + polarArea: { + rings: { + strokeWidth: 1, + strokeColor: '#e8e8e8', + }, + spokes: { + strokeWidth: 1, + connectorColors: '#e8e8e8', + }, + }, + radar: { + size: undefined, + offsetX: 0, + offsetY: 0, + polygons: { + // strokeColor: '#e8e8e8', // should be deprecated in the minor version i.e 3.2 + strokeWidth: 1, + strokeColors: '#e8e8e8', + connectorColors: '#e8e8e8', + fill: { + colors: undefined, + }, + }, + }, + }, + colors: undefined, + dataLabels: { + enabled: true, + enabledOnSeries: undefined, + formatter(val) { + return val !== null ? val : '' + }, + textAnchor: 'middle', + distributed: false, + offsetX: 0, + offsetY: 0, + style: { + fontSize: '12px', + fontFamily: undefined, + fontWeight: 600, + colors: undefined, + }, + background: { + enabled: true, + foreColor: '#fff', + borderRadius: 2, + padding: 4, + opacity: 0.9, + borderWidth: 1, + borderColor: '#fff', + dropShadow: { + enabled: false, + top: 1, + left: 1, + blur: 1, + color: '#000', + opacity: 0.8, + }, + }, + dropShadow: { + enabled: false, + top: 1, + left: 1, + blur: 1, + color: '#000', + opacity: 0.8, + }, + }, + fill: { + type: 'solid', + colors: undefined, // array of colors + opacity: 0.85, + gradient: { + shade: 'dark', + type: 'horizontal', + shadeIntensity: 0.5, + gradientToColors: undefined, + inverseColors: true, + opacityFrom: 1, + opacityTo: 1, + stops: [0, 50, 100], + colorStops: [], + }, + image: { + src: [], + width: undefined, // optional + height: undefined, // optional + }, + pattern: { + style: 'squares', // String | Array of Strings + width: 6, + height: 6, + strokeWidth: 2, + }, + }, + forecastDataPoints: { + count: 0, + fillOpacity: 0.5, + strokeWidth: undefined, + dashArray: 4, + }, + grid: { + show: true, + borderColor: '#e0e0e0', + strokeDashArray: 0, + position: 'back', + xaxis: { + lines: { + show: false, + }, + }, + yaxis: { + lines: { + show: true, + }, + }, + row: { + colors: undefined, // takes as array which will be repeated on rows + opacity: 0.5, + }, + column: { + colors: undefined, // takes an array which will be repeated on columns + opacity: 0.5, + }, + padding: { + top: 0, + right: 10, + bottom: 0, + left: 12, + }, + }, + labels: [], + legend: { + show: true, + showForSingleSeries: false, + showForNullSeries: true, + showForZeroSeries: true, + floating: false, + position: 'bottom', // whether to position legends in 1 of 4 + // direction - top, bottom, left, right + horizontalAlign: 'center', // when position top/bottom, you can specify whether to align legends left, right or center + inverseOrder: false, + fontSize: '12px', + fontFamily: undefined, + fontWeight: 400, + width: undefined, + height: undefined, + formatter: undefined, + tooltipHoverFormatter: undefined, + offsetX: -20, + offsetY: 4, + customLegendItems: [], + clusterGroupedSeries: true, + clusterGroupedSeriesOrientation: 'vertical', + labels: { + colors: undefined, + useSeriesColors: false, + }, + markers: { + size: 7, + fillColors: undefined, + strokeWidth: 1, + shape: undefined, + offsetX: 0, + offsetY: 0, + customHTML: undefined, + onClick: undefined, + }, + itemMargin: { + horizontal: 5, + vertical: 4, + }, + onItemClick: { + toggleDataSeries: true, + }, + onItemHover: { + highlightDataSeries: true, + }, + }, + markers: { + discrete: [], + size: 0, + colors: undefined, + strokeColors: '#fff', + strokeWidth: 2, + strokeOpacity: 0.9, + strokeDashArray: 0, + fillOpacity: 1, + shape: 'circle', + offsetX: 0, + offsetY: 0, + showNullDataPoints: true, + onClick: undefined, + onDblClick: undefined, + hover: { + size: undefined, + sizeOffset: 3, + }, + }, + noData: { + text: undefined, + align: 'center', + verticalAlign: 'middle', + offsetX: 0, + offsetY: 0, + style: { + color: undefined, + fontSize: '14px', + fontFamily: undefined, + }, + }, + responsive: [], // breakpoints should follow ascending order 400, then 700, then 1000 + series: undefined, + states: { + hover: { + filter: { + type: 'lighten', + }, + }, + active: { + allowMultipleDataPointsSelection: false, + filter: { + type: 'darken', + }, + }, + }, + title: { + text: undefined, + align: 'left', + margin: 5, + offsetX: 0, + offsetY: 0, + floating: false, + style: { + fontSize: '14px', + fontWeight: 900, + fontFamily: undefined, + color: undefined, + }, + }, + subtitle: { + text: undefined, + align: 'left', + margin: 5, + offsetX: 0, + offsetY: 30, + floating: false, + style: { + fontSize: '12px', + fontWeight: 400, + fontFamily: undefined, + color: undefined, + }, + }, + stroke: { + show: true, + curve: 'smooth', // "smooth" / "straight" / "monotoneCubic" / "stepline" / "linestep" + lineCap: 'butt', // round, butt , square + width: 2, + colors: undefined, // array of colors + dashArray: 0, // single value or array of values + fill: { + type: 'solid', + colors: undefined, // array of colors + opacity: 0.85, + gradient: { + shade: 'dark', + type: 'horizontal', + shadeIntensity: 0.5, + gradientToColors: undefined, + inverseColors: true, + opacityFrom: 1, + opacityTo: 1, + stops: [0, 50, 100], + colorStops: [], + }, + }, + }, + tooltip: { + enabled: true, + enabledOnSeries: undefined, + shared: true, + hideEmptySeries: false, + followCursor: false, // when disabled, the tooltip will show on top of the series instead of mouse position + intersect: false, // when enabled, tooltip will only show when user directly hovers over point + inverseOrder: false, + custom: undefined, + fillSeriesColor: false, + theme: 'light', + cssClass: '', + style: { + fontSize: '12px', + fontFamily: undefined, + }, + onDatasetHover: { + highlightDataSeries: false, + }, + x: { + // x value + show: true, + format: 'dd MMM', // dd/MM, dd MMM yy, dd MMM yyyy + formatter: undefined, // a custom user supplied formatter function + }, + y: { + formatter: undefined, + title: { + formatter(seriesName) { + return seriesName ? seriesName + ': ' : '' + }, + }, + }, + z: { + formatter: undefined, + title: 'Size: ', + }, + marker: { + show: true, + fillColors: undefined, + }, + items: { + display: 'flex', + }, + fixed: { + enabled: false, + position: 'topRight', // topRight, topLeft, bottomRight, bottomLeft + offsetX: 0, + offsetY: 0, + }, + }, + xaxis: { + type: 'category', + categories: [], + convertedCatToNumeric: false, // internal property which should not be altered outside + offsetX: 0, + offsetY: 0, + overwriteCategories: undefined, + labels: { + show: true, + rotate: -45, + rotateAlways: false, + hideOverlappingLabels: true, + trim: false, + minHeight: undefined, + maxHeight: 120, + showDuplicates: true, + style: { + colors: [], + fontSize: '12px', + fontWeight: 400, + fontFamily: undefined, + cssClass: '', + }, + offsetX: 0, + offsetY: 0, + format: undefined, + formatter: undefined, // custom formatter function which will override format + datetimeUTC: true, + datetimeFormatter: { + year: 'yyyy', + month: "MMM 'yy", + day: 'dd MMM', + hour: 'HH:mm', + minute: 'HH:mm:ss', + second: 'HH:mm:ss', + }, + }, + group: { + groups: [], + style: { + colors: [], + fontSize: '12px', + fontWeight: 400, + fontFamily: undefined, + cssClass: '', + }, + }, + axisBorder: { + show: true, + color: '#e0e0e0', + width: '100%', + height: 1, + offsetX: 0, + offsetY: 0, + }, + axisTicks: { + show: true, + color: '#e0e0e0', + height: 6, + offsetX: 0, + offsetY: 0, + }, + stepSize: undefined, + tickAmount: undefined, + tickPlacement: 'on', + min: undefined, + max: undefined, + range: undefined, + floating: false, + decimalsInFloat: undefined, + position: 'bottom', + title: { + text: undefined, + offsetX: 0, + offsetY: 0, + style: { + color: undefined, + fontSize: '12px', + fontWeight: 900, + fontFamily: undefined, + cssClass: '', + }, + }, + crosshairs: { + show: true, + width: 1, // tickWidth/barWidth or an integer + position: 'back', + opacity: 0.9, + stroke: { + color: '#b6b6b6', + width: 1, + dashArray: 3, + }, + fill: { + type: 'solid', // solid, gradient + color: '#B1B9C4', + gradient: { + colorFrom: '#D8E3F0', + colorTo: '#BED1E6', + stops: [0, 100], + opacityFrom: 0.4, + opacityTo: 0.5, + }, + }, + dropShadow: { + enabled: false, + left: 0, + top: 0, + blur: 1, + opacity: 0.8, + }, + }, + tooltip: { + enabled: true, + offsetY: 0, + formatter: undefined, + style: { + fontSize: '12px', + fontFamily: undefined, + }, + }, + }, + yaxis: this.yAxis, + theme: { + mode: '', + palette: 'palette1', // If defined, it will overwrite globals.colors variable + monochrome: { + // monochrome allows you to select just 1 color and fill out the rest with light/dark shade (intensity can be selected) + enabled: false, + color: '#008FFB', + shadeTo: 'light', + shadeIntensity: 0.65, + }, + }, + } + } +} diff --git a/node_modules/apexcharts/src/modules/tooltip/AxesTooltip.js b/node_modules/apexcharts/src/modules/tooltip/AxesTooltip.js new file mode 100644 index 0000000..0a727ab --- /dev/null +++ b/node_modules/apexcharts/src/modules/tooltip/AxesTooltip.js @@ -0,0 +1,195 @@ +/** + * ApexCharts Tooltip.AxesTooltip Class. + * This file deals with the x-axis and y-axis tooltips. + * + * @module Tooltip.AxesTooltip + **/ + +class AxesTooltip { + constructor(tooltipContext) { + this.w = tooltipContext.w + this.ttCtx = tooltipContext + } + + /** + * This method adds the secondary tooltip which appears below x axis + * @memberof Tooltip + **/ + drawXaxisTooltip() { + let w = this.w + const ttCtx = this.ttCtx + + const isBottom = w.config.xaxis.position === 'bottom' + + ttCtx.xaxisOffY = isBottom + ? w.globals.gridHeight + 1 + : -w.globals.xAxisHeight - w.config.xaxis.axisTicks.height + 3 + const tooltipCssClass = isBottom + ? 'apexcharts-xaxistooltip apexcharts-xaxistooltip-bottom' + : 'apexcharts-xaxistooltip apexcharts-xaxistooltip-top' + + let renderTo = w.globals.dom.elWrap + + if (ttCtx.isXAxisTooltipEnabled) { + let xaxisTooltip = w.globals.dom.baseEl.querySelector( + '.apexcharts-xaxistooltip' + ) + + if (xaxisTooltip === null) { + ttCtx.xaxisTooltip = document.createElement('div') + ttCtx.xaxisTooltip.setAttribute( + 'class', + tooltipCssClass + ' apexcharts-theme-' + w.config.tooltip.theme + ) + + renderTo.appendChild(ttCtx.xaxisTooltip) + + ttCtx.xaxisTooltipText = document.createElement('div') + ttCtx.xaxisTooltipText.classList.add('apexcharts-xaxistooltip-text') + + ttCtx.xaxisTooltipText.style.fontFamily = + w.config.xaxis.tooltip.style.fontFamily || w.config.chart.fontFamily + ttCtx.xaxisTooltipText.style.fontSize = + w.config.xaxis.tooltip.style.fontSize + + ttCtx.xaxisTooltip.appendChild(ttCtx.xaxisTooltipText) + } + } + } + + /** + * This method adds the secondary tooltip which appears below x axis + * @memberof Tooltip + **/ + drawYaxisTooltip() { + let w = this.w + const ttCtx = this.ttCtx + + for (let i = 0; i < w.config.yaxis.length; i++) { + const isRight = + w.config.yaxis[i].opposite || w.config.yaxis[i].crosshairs.opposite + + ttCtx.yaxisOffX = isRight ? w.globals.gridWidth + 1 : 1 + let tooltipCssClass = isRight + ? `apexcharts-yaxistooltip apexcharts-yaxistooltip-${i} apexcharts-yaxistooltip-right` + : `apexcharts-yaxistooltip apexcharts-yaxistooltip-${i} apexcharts-yaxistooltip-left` + + let renderTo = w.globals.dom.elWrap + + let yaxisTooltip = w.globals.dom.baseEl.querySelector( + `.apexcharts-yaxistooltip apexcharts-yaxistooltip-${i}` + ) + + if (yaxisTooltip === null) { + ttCtx.yaxisTooltip = document.createElement('div') + ttCtx.yaxisTooltip.setAttribute( + 'class', + tooltipCssClass + ' apexcharts-theme-' + w.config.tooltip.theme + ) + + renderTo.appendChild(ttCtx.yaxisTooltip) + + if (i === 0) ttCtx.yaxisTooltipText = [] + + ttCtx.yaxisTooltipText[i] = document.createElement('div') + ttCtx.yaxisTooltipText[i].classList.add('apexcharts-yaxistooltip-text') + + ttCtx.yaxisTooltip.appendChild(ttCtx.yaxisTooltipText[i]) + } + } + } + + /** + * @memberof Tooltip + **/ + setXCrosshairWidth() { + let w = this.w + const ttCtx = this.ttCtx + + // set xcrosshairs width + const xcrosshairs = ttCtx.getElXCrosshairs() + ttCtx.xcrosshairsWidth = parseInt(w.config.xaxis.crosshairs.width, 10) + + if (!w.globals.comboCharts) { + if (w.config.xaxis.crosshairs.width === 'tickWidth') { + let count = w.globals.labels.length + ttCtx.xcrosshairsWidth = w.globals.gridWidth / count + } else if (w.config.xaxis.crosshairs.width === 'barWidth') { + let bar = w.globals.dom.baseEl.querySelector('.apexcharts-bar-area') + if (bar !== null) { + let barWidth = parseFloat(bar.getAttribute('barWidth')) + ttCtx.xcrosshairsWidth = barWidth + } else { + ttCtx.xcrosshairsWidth = 1 + } + } + } else { + let bar = w.globals.dom.baseEl.querySelector('.apexcharts-bar-area') + if (bar !== null && w.config.xaxis.crosshairs.width === 'barWidth') { + let barWidth = parseFloat(bar.getAttribute('barWidth')) + ttCtx.xcrosshairsWidth = barWidth + } else { + if (w.config.xaxis.crosshairs.width === 'tickWidth') { + let count = w.globals.labels.length + ttCtx.xcrosshairsWidth = w.globals.gridWidth / count + } + } + } + + if (w.globals.isBarHorizontal) { + ttCtx.xcrosshairsWidth = 0 + } + if (xcrosshairs !== null && ttCtx.xcrosshairsWidth > 0) { + xcrosshairs.setAttribute('width', ttCtx.xcrosshairsWidth) + } + } + + handleYCrosshair() { + let w = this.w + const ttCtx = this.ttCtx + + // set ycrosshairs height + ttCtx.ycrosshairs = w.globals.dom.baseEl.querySelector( + '.apexcharts-ycrosshairs' + ) + + ttCtx.ycrosshairsHidden = w.globals.dom.baseEl.querySelector( + '.apexcharts-ycrosshairs-hidden' + ) + } + + drawYaxisTooltipText(index, clientY, xyRatios) { + const ttCtx = this.ttCtx + const w = this.w + const gl = w.globals + const yAxisSeriesArr = gl.seriesYAxisMap[index] + + if (ttCtx.yaxisTooltips[index] && yAxisSeriesArr.length > 0) { + const lbFormatter = gl.yLabelFormatters[index] + const elGrid = ttCtx.getElGrid() + const seriesBound = elGrid.getBoundingClientRect() + + // We can use the index of any series referenced by the Yaxis + // because they will all return the same value. + const seriesIndex = yAxisSeriesArr[0] + let translationsIndex = 0 + if (xyRatios.yRatio.length > 1) { + translationsIndex = seriesIndex + } + const hoverY = + (clientY - seriesBound.top) * xyRatios.yRatio[translationsIndex] + const height = gl.maxYArr[seriesIndex] - gl.minYArr[seriesIndex] + let val = gl.minYArr[seriesIndex] + (height - hoverY) + + if (w.config.yaxis[index].reversed) { + val = gl.maxYArr[seriesIndex] - (height - hoverY) + } + + ttCtx.tooltipPosition.moveYCrosshairs(clientY - seriesBound.top) + ttCtx.yaxisTooltipText[index].innerHTML = lbFormatter(val) + ttCtx.tooltipPosition.moveYAxisTooltip(index) + } + } +} + +export default AxesTooltip diff --git a/node_modules/apexcharts/src/modules/tooltip/Intersect.js b/node_modules/apexcharts/src/modules/tooltip/Intersect.js new file mode 100644 index 0000000..dfeaf6b --- /dev/null +++ b/node_modules/apexcharts/src/modules/tooltip/Intersect.js @@ -0,0 +1,344 @@ +import Utils from '../../utils/Utils' + +/** + * ApexCharts Tooltip.Intersect Class. + * This file deals with functions related to intersecting tooltips + * (tooltips that appear when user hovers directly over a data-point whether) + * + * @module Tooltip.Intersect + **/ + +class Intersect { + constructor(tooltipContext) { + this.w = tooltipContext.w + const w = this.w + this.ttCtx = tooltipContext + + this.isVerticalGroupedRangeBar = + !w.globals.isBarHorizontal && + w.config.chart.type === 'rangeBar' && + w.config.plotOptions.bar.rangeBarGroupRows + } + + // a helper function to get an element's attribute value + getAttr(e, attr) { + return parseFloat(e.target.getAttribute(attr)) + } + + // handle tooltip for heatmaps and treemaps + handleHeatTreeTooltip({ e, opt, x, y, type }) { + const ttCtx = this.ttCtx + const w = this.w + + if (e.target.classList.contains(`apexcharts-${type}-rect`)) { + let i = this.getAttr(e, 'i') + let j = this.getAttr(e, 'j') + let cx = this.getAttr(e, 'cx') + let cy = this.getAttr(e, 'cy') + let width = this.getAttr(e, 'width') + let height = this.getAttr(e, 'height') + + ttCtx.tooltipLabels.drawSeriesTexts({ + ttItems: opt.ttItems, + i, + j, + shared: false, + e, + }) + + w.globals.capturedSeriesIndex = i + w.globals.capturedDataPointIndex = j + + x = cx + ttCtx.tooltipRect.ttWidth / 2 + width + y = cy + ttCtx.tooltipRect.ttHeight / 2 - height / 2 + + ttCtx.tooltipPosition.moveXCrosshairs(cx + width / 2) + + if (x > w.globals.gridWidth / 2) { + x = cx - ttCtx.tooltipRect.ttWidth / 2 + width + } + if (ttCtx.w.config.tooltip.followCursor) { + let seriesBound = w.globals.dom.elWrap.getBoundingClientRect() + x = + w.globals.clientX - + seriesBound.left - + (x > w.globals.gridWidth / 2 ? ttCtx.tooltipRect.ttWidth : 0) + y = + w.globals.clientY - + seriesBound.top - + (y > w.globals.gridHeight / 2 ? ttCtx.tooltipRect.ttHeight : 0) + } + } + + return { + x, + y, + } + } + + /** + * handle tooltips for line/area/scatter charts where tooltip.intersect is true + * when user hovers over the marker directly, this function is executed + */ + handleMarkerTooltip({ e, opt, x, y }) { + let w = this.w + const ttCtx = this.ttCtx + + let i + let j + if (e.target.classList.contains('apexcharts-marker')) { + let cx = parseInt(opt.paths.getAttribute('cx'), 10) + let cy = parseInt(opt.paths.getAttribute('cy'), 10) + let val = parseFloat(opt.paths.getAttribute('val')) + + j = parseInt(opt.paths.getAttribute('rel'), 10) + i = + parseInt( + opt.paths.parentNode.parentNode.parentNode.getAttribute('rel'), + 10 + ) - 1 + + if (ttCtx.intersect) { + const el = Utils.findAncestor(opt.paths, 'apexcharts-series') + if (el) { + i = parseInt(el.getAttribute('data:realIndex'), 10) + } + } + + ttCtx.tooltipLabels.drawSeriesTexts({ + ttItems: opt.ttItems, + i, + j, + shared: ttCtx.showOnIntersect ? false : w.config.tooltip.shared, + e, + }) + + if (e.type === 'mouseup') { + ttCtx.markerClick(e, i, j) + } + + w.globals.capturedSeriesIndex = i + w.globals.capturedDataPointIndex = j + + x = cx + y = cy + w.globals.translateY - ttCtx.tooltipRect.ttHeight * 1.4 + + if (ttCtx.w.config.tooltip.followCursor) { + const elGrid = ttCtx.getElGrid() + const seriesBound = elGrid.getBoundingClientRect() + y = ttCtx.e.clientY + w.globals.translateY - seriesBound.top + } + + if (val < 0) { + y = cy + } + ttCtx.marker.enlargeCurrentPoint(j, opt.paths, x, y) + } + + return { + x, + y, + } + } + + /** + * handle tooltips for bar/column charts + */ + handleBarTooltip({ e, opt }) { + const w = this.w + const ttCtx = this.ttCtx + + const tooltipEl = ttCtx.getElTooltip() + + let bx = 0 + let x = 0 + let y = 0 + let i = 0 + let strokeWidth + let barXY = this.getBarTooltipXY({ + e, + opt, + }) + if (barXY.j === null && barXY.barHeight === 0 && barXY.barWidth === 0) { + return // bar was not hovered and didn't receive correct coords + } + + i = barXY.i + let j = barXY.j + + w.globals.capturedSeriesIndex = i + w.globals.capturedDataPointIndex = j + + if ( + (w.globals.isBarHorizontal && ttCtx.tooltipUtil.hasBars()) || + !w.config.tooltip.shared + ) { + x = barXY.x + y = barXY.y + strokeWidth = Array.isArray(w.config.stroke.width) + ? w.config.stroke.width[i] + : w.config.stroke.width + bx = x + } else { + if (!w.globals.comboCharts && !w.config.tooltip.shared) { + // todo: re-check this condition as it's always 0 + bx = bx / 2 + } + } + + // y is NaN, make it touch the bottom of grid area + if (isNaN(y)) { + y = w.globals.svgHeight - ttCtx.tooltipRect.ttHeight + } + + const seriesIndex = parseInt( + opt.paths.parentNode.getAttribute('data:realIndex'), + 10 + ) + + if (x + ttCtx.tooltipRect.ttWidth > w.globals.gridWidth) { + x = x - ttCtx.tooltipRect.ttWidth + } else if (x < 0) { + x = 0 + } + + if (ttCtx.w.config.tooltip.followCursor) { + const elGrid = ttCtx.getElGrid() + const seriesBound = elGrid.getBoundingClientRect() + y = ttCtx.e.clientY - seriesBound.top + } + + // if tooltip is still null, querySelector + if (ttCtx.tooltip === null) { + ttCtx.tooltip = w.globals.dom.baseEl.querySelector('.apexcharts-tooltip') + } + + if (!w.config.tooltip.shared) { + if (w.globals.comboBarCount > 0) { + ttCtx.tooltipPosition.moveXCrosshairs(bx + strokeWidth / 2) + } else { + ttCtx.tooltipPosition.moveXCrosshairs(bx) + } + } + + // move tooltip here + if ( + !ttCtx.fixedTooltip && + (!w.config.tooltip.shared || + (w.globals.isBarHorizontal && ttCtx.tooltipUtil.hasBars())) + ) { + y = y + w.globals.translateY - ttCtx.tooltipRect.ttHeight / 2 + + tooltipEl.style.left = x + w.globals.translateX + 'px' + tooltipEl.style.top = y + 'px' + } + } + + getBarTooltipXY({ e, opt }) { + let w = this.w + let j = null + const ttCtx = this.ttCtx + let i = 0 + let x = 0 + let y = 0 + let barWidth = 0 + let barHeight = 0 + + const cl = e.target.classList + + if ( + cl.contains('apexcharts-bar-area') || + cl.contains('apexcharts-candlestick-area') || + cl.contains('apexcharts-boxPlot-area') || + cl.contains('apexcharts-rangebar-area') + ) { + let bar = e.target + let barRect = bar.getBoundingClientRect() + + let seriesBound = opt.elGrid.getBoundingClientRect() + + let bh = barRect.height + barHeight = barRect.height + let bw = barRect.width + + let cx = parseInt(bar.getAttribute('cx'), 10) + let cy = parseInt(bar.getAttribute('cy'), 10) + barWidth = parseFloat(bar.getAttribute('barWidth')) + const clientX = e.type === 'touchmove' ? e.touches[0].clientX : e.clientX + + j = parseInt(bar.getAttribute('j'), 10) + i = parseInt(bar.parentNode.getAttribute('rel'), 10) - 1 + + let y1 = bar.getAttribute('data-range-y1') + let y2 = bar.getAttribute('data-range-y2') + + if (w.globals.comboCharts) { + i = parseInt(bar.parentNode.getAttribute('data:realIndex'), 10) + } + + const handleXForColumns = (x) => { + if (w.globals.isXNumeric) { + x = cx - bw / 2 + } else { + if (this.isVerticalGroupedRangeBar) { + x = cx + bw / 2 + } else { + x = cx - ttCtx.dataPointsDividedWidth + bw / 2 + } + } + return x + } + + const handleYForBars = () => { + return ( + cy - + ttCtx.dataPointsDividedHeight + + bh / 2 - + ttCtx.tooltipRect.ttHeight / 2 + ) + } + + ttCtx.tooltipLabels.drawSeriesTexts({ + ttItems: opt.ttItems, + i, + j, + y1: y1 ? parseInt(y1, 10) : null, + y2: y2 ? parseInt(y2, 10) : null, + shared: ttCtx.showOnIntersect ? false : w.config.tooltip.shared, + e, + }) + + if (w.config.tooltip.followCursor) { + if (w.globals.isBarHorizontal) { + x = clientX - seriesBound.left + 15 + y = handleYForBars() + } else { + x = handleXForColumns(x) + y = e.clientY - seriesBound.top - ttCtx.tooltipRect.ttHeight / 2 - 15 + } + } else { + if (w.globals.isBarHorizontal) { + x = cx + if (x < ttCtx.xyRatios.baseLineInvertedY) { + x = cx - ttCtx.tooltipRect.ttWidth + } + y = handleYForBars() + } else { + x = handleXForColumns(x) + y = cy // - ttCtx.tooltipRect.ttHeight / 2 + 10 + } + } + } + + return { + x, + y, + barHeight, + barWidth, + i, + j, + } + } +} + +export default Intersect diff --git a/node_modules/apexcharts/src/modules/tooltip/Labels.js b/node_modules/apexcharts/src/modules/tooltip/Labels.js new file mode 100644 index 0000000..90feb7e --- /dev/null +++ b/node_modules/apexcharts/src/modules/tooltip/Labels.js @@ -0,0 +1,550 @@ +import Formatters from '../Formatters' +import DateTime from '../../utils/DateTime' +import Utils from './Utils' +import Data from '../Data' + +/** + * ApexCharts Tooltip.Labels Class to draw texts on the tooltip. + * This file deals with printing actual text on the tooltip. + * + * @module Tooltip.Labels + **/ + +export default class Labels { + constructor(tooltipContext) { + this.w = tooltipContext.w + this.ctx = tooltipContext.ctx + this.ttCtx = tooltipContext + this.tooltipUtil = new Utils(tooltipContext) + } + + drawSeriesTexts({ shared = true, ttItems, i = 0, j = null, y1, y2, e }) { + let w = this.w + + if (w.config.tooltip.custom !== undefined) { + this.handleCustomTooltip({ i, j, y1, y2, w }) + } else { + this.toggleActiveInactiveSeries(shared, i) + } + + let values = this.getValuesToPrint({ + i, + j, + }) + + this.printLabels({ + i, + j, + values, + ttItems, + shared, + e, + }) + + // Re-calculate tooltip dimensions now that we have drawn the text + const tooltipEl = this.ttCtx.getElTooltip() + + this.ttCtx.tooltipRect.ttWidth = tooltipEl.getBoundingClientRect().width + this.ttCtx.tooltipRect.ttHeight = tooltipEl.getBoundingClientRect().height + } + + printLabels({ i, j, values, ttItems, shared, e }) { + const w = this.w + let val + let goalVals = [] + const hasGoalValues = (gi) => { + return ( + w.globals.seriesGoals[gi] && + w.globals.seriesGoals[gi][j] && + Array.isArray(w.globals.seriesGoals[gi][j]) + ) + } + + const { xVal, zVal, xAxisTTVal } = values + + let seriesName = '' + + let pColor = w.globals.colors[i] // The pColor here is for the markers inside tooltip + if (j !== null && w.config.plotOptions.bar.distributed) { + pColor = w.globals.colors[j] + } + + for ( + let t = 0, inverset = w.globals.series.length - 1; + t < w.globals.series.length; + t++, inverset-- + ) { + let f = this.getFormatters(i) + seriesName = this.getSeriesName({ + fn: f.yLbTitleFormatter, + index: i, + seriesIndex: i, + j, + }) + + if (w.config.chart.type === 'treemap') { + seriesName = f.yLbTitleFormatter(String(w.config.series[i].data[j].x), { + series: w.globals.series, + seriesIndex: i, + dataPointIndex: j, + w, + }) + } + + const tIndex = w.config.tooltip.inverseOrder ? inverset : t + + if (w.globals.axisCharts) { + const getValBySeriesIndex = (index) => { + if (w.globals.isRangeData) { + return ( + f.yLbFormatter(w.globals.seriesRangeStart?.[index]?.[j], { + series: w.globals.seriesRangeStart, + seriesIndex: index, + dataPointIndex: j, + w, + }) + + ' - ' + + f.yLbFormatter(w.globals.seriesRangeEnd?.[index]?.[j], { + series: w.globals.seriesRangeEnd, + seriesIndex: index, + dataPointIndex: j, + w, + }) + ) + } + return f.yLbFormatter(w.globals.series[index][j], { + series: w.globals.series, + seriesIndex: index, + dataPointIndex: j, + w, + }) + } + if (shared) { + f = this.getFormatters(tIndex) + + seriesName = this.getSeriesName({ + fn: f.yLbTitleFormatter, + index: tIndex, + seriesIndex: i, + j, + }) + pColor = w.globals.colors[tIndex] + + val = getValBySeriesIndex(tIndex) + if (hasGoalValues(tIndex)) { + goalVals = w.globals.seriesGoals[tIndex][j].map((goal) => { + return { + attrs: goal, + val: f.yLbFormatter(goal.value, { + seriesIndex: tIndex, + dataPointIndex: j, + w, + }), + } + }) + } + } else { + // get a color from a hover area (if it's a line pattern then get from a first line) + const targetFill = e?.target?.getAttribute('fill') + if (targetFill) { + if (targetFill.indexOf('url') !== -1) { + // pattern fill + if (targetFill.indexOf('Pattern') !== -1) { + pColor = w.globals.dom.baseEl + .querySelector(targetFill.substr(4).slice(0, -1)) + .childNodes[0].getAttribute('stroke') + } + } else { + pColor = targetFill + } + } + val = getValBySeriesIndex(i) + if (hasGoalValues(i) && Array.isArray(w.globals.seriesGoals[i][j])) { + goalVals = w.globals.seriesGoals[i][j].map((goal) => { + return { + attrs: goal, + val: f.yLbFormatter(goal.value, { + seriesIndex: i, + dataPointIndex: j, + w, + }), + } + }) + } + } + } + + // for pie / donuts + if (j === null) { + val = f.yLbFormatter(w.globals.series[i], { + ...w, + seriesIndex: i, + dataPointIndex: i, + }) + } + + this.DOMHandling({ + i, + t: tIndex, + j, + ttItems, + values: { + val, + goalVals, + xVal, + xAxisTTVal, + zVal, + }, + seriesName, + shared, + pColor, + }) + } + } + + getFormatters(i) { + const w = this.w + + let yLbFormatter = w.globals.yLabelFormatters[i] + let yLbTitleFormatter + + if (w.globals.ttVal !== undefined) { + if (Array.isArray(w.globals.ttVal)) { + yLbFormatter = w.globals.ttVal[i] && w.globals.ttVal[i].formatter + yLbTitleFormatter = + w.globals.ttVal[i] && + w.globals.ttVal[i].title && + w.globals.ttVal[i].title.formatter + } else { + yLbFormatter = w.globals.ttVal.formatter + if (typeof w.globals.ttVal.title.formatter === 'function') { + yLbTitleFormatter = w.globals.ttVal.title.formatter + } + } + } else { + yLbTitleFormatter = w.config.tooltip.y.title.formatter + } + + if (typeof yLbFormatter !== 'function') { + if (w.globals.yLabelFormatters[0]) { + yLbFormatter = w.globals.yLabelFormatters[0] + } else { + yLbFormatter = function (label) { + return label + } + } + } + + if (typeof yLbTitleFormatter !== 'function') { + yLbTitleFormatter = function (label) { + // refrence used from line: 966 in Options.js + return label ? label + ': ' : '' + } + } + + return { + yLbFormatter, + yLbTitleFormatter, + } + } + + getSeriesName({ fn, index, seriesIndex, j }) { + const w = this.w + return fn(String(w.globals.seriesNames[index]), { + series: w.globals.series, + seriesIndex, + dataPointIndex: j, + w, + }) + } + + DOMHandling({ i, t, j, ttItems, values, seriesName, shared, pColor }) { + const w = this.w + const ttCtx = this.ttCtx + + const { val, goalVals, xVal, xAxisTTVal, zVal } = values + + let ttItemsChildren = null + ttItemsChildren = ttItems[t].children + + if (w.config.tooltip.fillSeriesColor) { + ttItems[t].style.backgroundColor = pColor + ttItemsChildren[0].style.display = 'none' + } + + if (ttCtx.showTooltipTitle) { + if (ttCtx.tooltipTitle === null) { + // get it once if null, and store it in class property + ttCtx.tooltipTitle = w.globals.dom.baseEl.querySelector( + '.apexcharts-tooltip-title' + ) + } + ttCtx.tooltipTitle.innerHTML = xVal + } + + // if xaxis tooltip is constructed, we need to replace the innerHTML + if (ttCtx.isXAxisTooltipEnabled) { + ttCtx.xaxisTooltipText.innerHTML = xAxisTTVal !== '' ? xAxisTTVal : xVal + } + + const ttYLabel = ttItems[t].querySelector( + '.apexcharts-tooltip-text-y-label' + ) + if (ttYLabel) { + ttYLabel.innerHTML = seriesName ? seriesName : '' + } + const ttYVal = ttItems[t].querySelector('.apexcharts-tooltip-text-y-value') + if (ttYVal) { + ttYVal.innerHTML = typeof val !== 'undefined' ? val : '' + } + + if ( + ttItemsChildren[0] && + ttItemsChildren[0].classList.contains('apexcharts-tooltip-marker') + ) { + if ( + w.config.tooltip.marker.fillColors && + Array.isArray(w.config.tooltip.marker.fillColors) + ) { + pColor = w.config.tooltip.marker.fillColors[t] + } + + if (w.config.tooltip.fillSeriesColor) { + ttItemsChildren[0].style.backgroundColor = pColor + } else { + ttItemsChildren[0].style.color = pColor + } + } + + if (!w.config.tooltip.marker.show) { + ttItemsChildren[0].style.display = 'none' + } + + const ttGLabel = ttItems[t].querySelector( + '.apexcharts-tooltip-text-goals-label' + ) + const ttGVal = ttItems[t].querySelector( + '.apexcharts-tooltip-text-goals-value' + ) + + if (goalVals.length && w.globals.seriesGoals[t]) { + const createGoalsHtml = () => { + let gLabels = '
' + let gVals = '
' + goalVals.forEach((goal, gi) => { + gLabels += `
${goal.attrs.name}
` + gVals += `
${goal.val}
` + }) + ttGLabel.innerHTML = gLabels + `
` + ttGVal.innerHTML = gVals + `
` + } + if (shared) { + if ( + w.globals.seriesGoals[t][j] && + Array.isArray(w.globals.seriesGoals[t][j]) + ) { + createGoalsHtml() + } else { + ttGLabel.innerHTML = '' + ttGVal.innerHTML = '' + } + } else { + createGoalsHtml() + } + } else { + ttGLabel.innerHTML = '' + ttGVal.innerHTML = '' + } + + if (zVal !== null) { + const ttZLabel = ttItems[t].querySelector( + '.apexcharts-tooltip-text-z-label' + ) + ttZLabel.innerHTML = w.config.tooltip.z.title + const ttZVal = ttItems[t].querySelector( + '.apexcharts-tooltip-text-z-value' + ) + ttZVal.innerHTML = typeof zVal !== 'undefined' ? zVal : '' + } + + if (shared && ttItemsChildren[0]) { + // hide when no Val or series collapsed + if (w.config.tooltip.hideEmptySeries) { + let ttItemMarker = ttItems[t].querySelector( + '.apexcharts-tooltip-marker' + ) + let ttItemText = ttItems[t].querySelector('.apexcharts-tooltip-text') + if (parseFloat(val) == 0) { + ttItemMarker.style.display = 'none' + ttItemText.style.display = 'none' + } else { + ttItemMarker.style.display = 'block' + ttItemText.style.display = 'block' + } + } + if ( + typeof val === 'undefined' || + val === null || + w.globals.ancillaryCollapsedSeriesIndices.indexOf(t) > -1 || + w.globals.collapsedSeriesIndices.indexOf(t) > -1 || + (Array.isArray(ttCtx.tConfig.enabledOnSeries) && + ttCtx.tConfig.enabledOnSeries.indexOf(t) === -1) + ) { + ttItemsChildren[0].parentNode.style.display = 'none' + } else { + ttItemsChildren[0].parentNode.style.display = + w.config.tooltip.items.display + } + } else { + if ( + Array.isArray(ttCtx.tConfig.enabledOnSeries) && + ttCtx.tConfig.enabledOnSeries.indexOf(t) === -1 + ) { + ttItemsChildren[0].parentNode.style.display = 'none' + } + } + } + + toggleActiveInactiveSeries(shared, i) { + const w = this.w + if (shared) { + // make all tooltips active + this.tooltipUtil.toggleAllTooltipSeriesGroups('enable') + } else { + // disable all tooltip text groups + this.tooltipUtil.toggleAllTooltipSeriesGroups('disable') + + // enable the first tooltip text group + let firstTooltipSeriesGroup = w.globals.dom.baseEl.querySelector( + `.apexcharts-tooltip-series-group-${i}` + ) + + if (firstTooltipSeriesGroup) { + firstTooltipSeriesGroup.classList.add('apexcharts-active') + firstTooltipSeriesGroup.style.display = w.config.tooltip.items.display + } + } + } + + getValuesToPrint({ i, j }) { + const w = this.w + const filteredSeriesX = this.ctx.series.filteredSeriesX() + + let xVal = '' + let xAxisTTVal = '' + let zVal = null + let val = null + + const customFormatterOpts = { + series: w.globals.series, + seriesIndex: i, + dataPointIndex: j, + w, + } + + let zFormatter = w.globals.ttZFormatter + + if (j === null) { + val = w.globals.series[i] + } else { + if (w.globals.isXNumeric && w.config.chart.type !== 'treemap') { + xVal = filteredSeriesX[i][j] + if (filteredSeriesX[i].length === 0) { + // a series (possibly the first one) might be collapsed, so get the next active index + const firstActiveSeriesIndex = + this.tooltipUtil.getFirstActiveXArray(filteredSeriesX) + xVal = filteredSeriesX[firstActiveSeriesIndex][j] + } + } else { + const dataFormat = new Data(this.ctx) + if (dataFormat.isFormatXY()) { + xVal = + typeof w.config.series[i].data[j] !== 'undefined' + ? w.config.series[i].data[j].x + : '' + } else { + xVal = + typeof w.globals.labels[j] !== 'undefined' + ? w.globals.labels[j] + : '' + } + } + } + + let bufferXVal = xVal + + if (w.globals.isXNumeric && w.config.xaxis.type === 'datetime') { + let xFormat = new Formatters(this.ctx) + xVal = xFormat.xLabelFormat( + w.globals.ttKeyFormatter, + bufferXVal, + bufferXVal, + { + i: undefined, + dateFormatter: new DateTime(this.ctx).formatDate, + w: this.w, + } + ) + } else { + if (w.globals.isBarHorizontal) { + xVal = w.globals.yLabelFormatters[0](bufferXVal, customFormatterOpts) + } else { + xVal = w.globals.xLabelFormatter(bufferXVal, customFormatterOpts) + } + } + + // override default x-axis formatter with tooltip formatter + if (w.config.tooltip.x.formatter !== undefined) { + xVal = w.globals.ttKeyFormatter(bufferXVal, customFormatterOpts) + } + + if (w.globals.seriesZ.length > 0 && w.globals.seriesZ[i].length > 0) { + zVal = zFormatter(w.globals.seriesZ[i][j], w) + } + + if (typeof w.config.xaxis.tooltip.formatter === 'function') { + xAxisTTVal = w.globals.xaxisTooltipFormatter( + bufferXVal, + customFormatterOpts + ) + } else { + xAxisTTVal = xVal + } + + return { + val: Array.isArray(val) ? val.join(' ') : val, + xVal: Array.isArray(xVal) ? xVal.join(' ') : xVal, + xAxisTTVal: Array.isArray(xAxisTTVal) ? xAxisTTVal.join(' ') : xAxisTTVal, + zVal, + } + } + + handleCustomTooltip({ i, j, y1, y2, w }) { + const tooltipEl = this.ttCtx.getElTooltip() + let fn = w.config.tooltip.custom + + if (Array.isArray(fn) && fn[i]) { + fn = fn[i] + } + + const customTooltip = fn({ + ctx: this.ctx, + series: w.globals.series, + seriesIndex: i, + dataPointIndex: j, + y1, + y2, + w, + }) + + if (typeof customTooltip === 'string') { + tooltipEl.innerHTML = customTooltip + } else if ( + customTooltip instanceof Element || + typeof customTooltip.nodeName === 'string' + ) { + tooltipEl.innerHTML = '' + tooltipEl.appendChild(customTooltip.cloneNode(true)) + } + } +} diff --git a/node_modules/apexcharts/src/modules/tooltip/Marker.js b/node_modules/apexcharts/src/modules/tooltip/Marker.js new file mode 100644 index 0000000..2aa20c1 --- /dev/null +++ b/node_modules/apexcharts/src/modules/tooltip/Marker.js @@ -0,0 +1,195 @@ +import Graphics from '../Graphics' +import Position from './Position' +import Markers from '../../modules/Markers' +import Utils from '../../utils/Utils' + +/** + * ApexCharts Tooltip.Marker Class to draw texts on the tooltip. + * This file deals with the markers that appear near tooltip in line/area charts. + * These markers helps the user to associate the data-points and the values + * that are shown in the tooltip + * + * @module Tooltip.Marker + **/ + +export default class Marker { + constructor(tooltipContext) { + this.w = tooltipContext.w + this.ttCtx = tooltipContext + this.ctx = tooltipContext.ctx + this.tooltipPosition = new Position(tooltipContext) + } + + drawDynamicPoints() { + let w = this.w + + let graphics = new Graphics(this.ctx) + let marker = new Markers(this.ctx) + + let elsSeries = w.globals.dom.baseEl.querySelectorAll('.apexcharts-series') + + elsSeries = [...elsSeries] + + if (w.config.chart.stacked) { + elsSeries.sort((a, b) => { + return ( + parseFloat(a.getAttribute('data:realIndex')) - + parseFloat(b.getAttribute('data:realIndex')) + ) + }) + } + + for (let i = 0; i < elsSeries.length; i++) { + let pointsMain = elsSeries[i].querySelector( + `.apexcharts-series-markers-wrap` + ) + + if (pointsMain !== null) { + // it can be null as we have tooltips in donut/bar charts + let point + + let PointClasses = `apexcharts-marker w${(Math.random() + 1) + .toString(36) + .substring(4)}` + if ( + (w.config.chart.type === 'line' || w.config.chart.type === 'area') && + !w.globals.comboCharts && + !w.config.tooltip.intersect + ) { + PointClasses += ' no-pointer-events' + } + + let elPointOptions = marker.getMarkerConfig({ + cssClass: PointClasses, + seriesIndex: Number(pointsMain.getAttribute('data:realIndex')), // fixes apexcharts/apexcharts.js #1427 + }) + + point = graphics.drawMarker(0, 0, elPointOptions) + + point.node.setAttribute('default-marker-size', 0) + + let elPointsG = document.createElementNS(w.globals.SVGNS, 'g') + elPointsG.classList.add('apexcharts-series-markers') + + elPointsG.appendChild(point.node) + pointsMain.appendChild(elPointsG) + } + } + } + + enlargeCurrentPoint(rel, point, x = null, y = null) { + let w = this.w + + if (w.config.chart.type !== 'bubble') { + this.newPointSize(rel, point) + } + + let cx = point.getAttribute('cx') + let cy = point.getAttribute('cy') + + if (x !== null && y !== null) { + cx = x + cy = y + } + + this.tooltipPosition.moveXCrosshairs(cx) + + if (!this.fixedTooltip) { + if (w.config.chart.type === 'radar') { + const elGrid = this.ttCtx.getElGrid() + const seriesBound = elGrid.getBoundingClientRect() + + cx = this.ttCtx.e.clientX - seriesBound.left + } + + this.tooltipPosition.moveTooltip(cx, cy, w.config.markers.hover.size) + } + } + + enlargePoints(j) { + let w = this.w + let me = this + const ttCtx = this.ttCtx + + let col = j + + let points = w.globals.dom.baseEl.querySelectorAll( + '.apexcharts-series:not(.apexcharts-series-collapsed) .apexcharts-marker' + ) + + let newSize = w.config.markers.hover.size + + for (let p = 0; p < points.length; p++) { + let rel = points[p].getAttribute('rel') + let index = points[p].getAttribute('index') + + if (newSize === undefined) { + newSize = + w.globals.markers.size[index] + w.config.markers.hover.sizeOffset + } + + if (col === parseInt(rel, 10)) { + me.newPointSize(col, points[p]) + + let cx = points[p].getAttribute('cx') + let cy = points[p].getAttribute('cy') + + me.tooltipPosition.moveXCrosshairs(cx) + + if (!ttCtx.fixedTooltip) { + me.tooltipPosition.moveTooltip(cx, cy, newSize) + } + } else { + me.oldPointSize(points[p]) + } + } + } + + newPointSize(rel, point) { + let w = this.w + let newSize = w.config.markers.hover.size + + let elPoint = + rel === 0 ? point.parentNode.firstChild : point.parentNode.lastChild + + if (elPoint.getAttribute('default-marker-size') !== '0') { + const index = parseInt(elPoint.getAttribute('index'), 10) + if (newSize === undefined) { + newSize = + w.globals.markers.size[index] + w.config.markers.hover.sizeOffset + } + + if (newSize < 0) { + newSize = 0 + } + + const path = this.ttCtx.tooltipUtil.getPathFromPoint(point, newSize) + point.setAttribute('d', path) + } + } + + oldPointSize(point) { + const size = parseFloat(point.getAttribute('default-marker-size')) + const path = this.ttCtx.tooltipUtil.getPathFromPoint(point, size) + point.setAttribute('d', path) + } + + resetPointsSize() { + let w = this.w + + let points = w.globals.dom.baseEl.querySelectorAll( + '.apexcharts-series:not(.apexcharts-series-collapsed) .apexcharts-marker' + ) + + for (let p = 0; p < points.length; p++) { + const size = parseFloat(points[p].getAttribute('default-marker-size')) + + if (Utils.isNumber(size) && size > 0) { + const path = this.ttCtx.tooltipUtil.getPathFromPoint(points[p], size) + points[p].setAttribute('d', path) + } else { + points[p].setAttribute('d', 'M0,0') + } + } + } +} diff --git a/node_modules/apexcharts/src/modules/tooltip/Position.js b/node_modules/apexcharts/src/modules/tooltip/Position.js new file mode 100644 index 0000000..112ff70 --- /dev/null +++ b/node_modules/apexcharts/src/modules/tooltip/Position.js @@ -0,0 +1,451 @@ +import Graphics from '../Graphics' +import Series from '../Series' + +/** + * ApexCharts Tooltip.Position Class to move the tooltip based on x and y position. + * + * @module Tooltip.Position + **/ + +export default class Position { + constructor(tooltipContext) { + this.ttCtx = tooltipContext + this.ctx = tooltipContext.ctx + this.w = tooltipContext.w + } + + /** + * This will move the crosshair (the vertical/horz line that moves along with mouse) + * Along with this, this function also calls the xaxisMove function + * @memberof Position + * @param {int} - cx = point's x position, wherever point's x is, you need to move crosshair + */ + moveXCrosshairs(cx, j = null) { + const ttCtx = this.ttCtx + let w = this.w + + const xcrosshairs = ttCtx.getElXCrosshairs() + + let x = cx - ttCtx.xcrosshairsWidth / 2 + + let tickAmount = w.globals.labels.slice().length + if (j !== null) { + x = (w.globals.gridWidth / tickAmount) * j + } + + if (xcrosshairs !== null && !w.globals.isBarHorizontal) { + xcrosshairs.setAttribute('x', x) + xcrosshairs.setAttribute('x1', x) + xcrosshairs.setAttribute('x2', x) + xcrosshairs.setAttribute('y2', w.globals.gridHeight) + xcrosshairs.classList.add('apexcharts-active') + } + + if (x < 0) { + x = 0 + } + + if (x > w.globals.gridWidth) { + x = w.globals.gridWidth + } + + if (ttCtx.isXAxisTooltipEnabled) { + let tx = x + if ( + w.config.xaxis.crosshairs.width === 'tickWidth' || + w.config.xaxis.crosshairs.width === 'barWidth' + ) { + tx = x + ttCtx.xcrosshairsWidth / 2 + } + this.moveXAxisTooltip(tx) + } + } + + /** + * This will move the crosshair (the vertical/horz line that moves along with mouse) + * Along with this, this function also calls the xaxisMove function + * @memberof Position + * @param {int} - cx = point's x position, wherever point's x is, you need to move crosshair + */ + moveYCrosshairs(cy) { + const ttCtx = this.ttCtx + + if (ttCtx.ycrosshairs !== null) { + Graphics.setAttrs(ttCtx.ycrosshairs, { + y1: cy, + y2: cy, + }) + } + if (ttCtx.ycrosshairsHidden !== null) { + Graphics.setAttrs(ttCtx.ycrosshairsHidden, { + y1: cy, + y2: cy, + }) + } + } + + /** + ** AxisTooltip is the small rectangle which appears on x axis with x value, when user moves + * @memberof Position + * @param {int} - cx = point's x position, wherever point's x is, you need to move + */ + moveXAxisTooltip(cx) { + let w = this.w + const ttCtx = this.ttCtx + + if (ttCtx.xaxisTooltip !== null && ttCtx.xcrosshairsWidth !== 0) { + ttCtx.xaxisTooltip.classList.add('apexcharts-active') + + let cy = + ttCtx.xaxisOffY + + w.config.xaxis.tooltip.offsetY + + w.globals.translateY + + 1 + + w.config.xaxis.offsetY + + let xaxisTTText = ttCtx.xaxisTooltip.getBoundingClientRect() + let xaxisTTTextWidth = xaxisTTText.width + + cx = cx - xaxisTTTextWidth / 2 + + if (!isNaN(cx)) { + cx = cx + w.globals.translateX + + let textRect = 0 + const graphics = new Graphics(this.ctx) + textRect = graphics.getTextRects(ttCtx.xaxisTooltipText.innerHTML) + + ttCtx.xaxisTooltipText.style.minWidth = textRect.width + 'px' + ttCtx.xaxisTooltip.style.left = cx + 'px' + ttCtx.xaxisTooltip.style.top = cy + 'px' + } + } + } + + moveYAxisTooltip(index) { + const w = this.w + const ttCtx = this.ttCtx + + if (ttCtx.yaxisTTEls === null) { + ttCtx.yaxisTTEls = w.globals.dom.baseEl.querySelectorAll( + '.apexcharts-yaxistooltip' + ) + } + + const ycrosshairsHiddenRectY1 = parseInt( + ttCtx.ycrosshairsHidden.getAttribute('y1'), + 10 + ) + let cy = w.globals.translateY + ycrosshairsHiddenRectY1 + + const yAxisTTRect = ttCtx.yaxisTTEls[index].getBoundingClientRect() + const yAxisTTHeight = yAxisTTRect.height + let cx = w.globals.translateYAxisX[index] - 2 + + if (w.config.yaxis[index].opposite) { + cx = cx - 26 + } + + cy = cy - yAxisTTHeight / 2 + + if (w.globals.ignoreYAxisIndexes.indexOf(index) === -1) { + ttCtx.yaxisTTEls[index].classList.add('apexcharts-active') + ttCtx.yaxisTTEls[index].style.top = cy + 'px' + ttCtx.yaxisTTEls[index].style.left = + cx + w.config.yaxis[index].tooltip.offsetX + 'px' + } else { + ttCtx.yaxisTTEls[index].classList.remove('apexcharts-active') + } + } + + /** + ** moves the whole tooltip by changing x, y attrs + * @memberof Position + * @param {int} - cx = point's x position, wherever point's x is, you need to move tooltip + * @param {int} - cy = point's y position, wherever point's y is, you need to move tooltip + * @param {int} - markerSize = point's size + */ + moveTooltip(cx, cy, markerSize = null) { + let w = this.w + + let ttCtx = this.ttCtx + const tooltipEl = ttCtx.getElTooltip() + let tooltipRect = ttCtx.tooltipRect + + let pointSize = markerSize !== null ? parseFloat(markerSize) : 1 + + let x = parseFloat(cx) + pointSize + 5 + let y = parseFloat(cy) + pointSize / 2 // - tooltipRect.ttHeight / 2 + + if (x > w.globals.gridWidth / 2) { + x = x - tooltipRect.ttWidth - pointSize - 10 + } + + if (x > w.globals.gridWidth - tooltipRect.ttWidth - 10) { + x = w.globals.gridWidth - tooltipRect.ttWidth + } + + if (x < -20) { + x = -20 + } + + if (w.config.tooltip.followCursor) { + const elGrid = ttCtx.getElGrid() + const seriesBound = elGrid.getBoundingClientRect() + + x = ttCtx.e.clientX - seriesBound.left + if (x > w.globals.gridWidth / 2) { + x = x - ttCtx.tooltipRect.ttWidth + } + y = ttCtx.e.clientY + w.globals.translateY - seriesBound.top + if (y > w.globals.gridHeight / 2) { + y = y - ttCtx.tooltipRect.ttHeight + } + } else { + if (!w.globals.isBarHorizontal) { + if (tooltipRect.ttHeight / 2 + y > w.globals.gridHeight) { + y = w.globals.gridHeight - tooltipRect.ttHeight + w.globals.translateY + } + } + } + + if (!isNaN(x)) { + x = x + w.globals.translateX + + tooltipEl.style.left = x + 'px' + tooltipEl.style.top = y + 'px' + } + } + + moveMarkers(i, j) { + let w = this.w + let ttCtx = this.ttCtx + + if (w.globals.markers.size[i] > 0) { + let allPoints = w.globals.dom.baseEl.querySelectorAll( + ` .apexcharts-series[data\\:realIndex='${i}'] .apexcharts-marker` + ) + for (let p = 0; p < allPoints.length; p++) { + if (parseInt(allPoints[p].getAttribute('rel'), 10) === j) { + ttCtx.marker.resetPointsSize() + ttCtx.marker.enlargeCurrentPoint(j, allPoints[p]) + } + } + } else { + ttCtx.marker.resetPointsSize() + this.moveDynamicPointOnHover(j, i) + } + } + + // This function is used when you need to show markers/points only on hover - + // DIFFERENT X VALUES in multiple series + moveDynamicPointOnHover(j, capturedSeries) { + let w = this.w + let ttCtx = this.ttCtx + let cx = 0 + let cy = 0 + const graphics = new Graphics(this.ctx) + + let pointsArr = w.globals.pointsArray + + let hoverSize = ttCtx.tooltipUtil.getHoverMarkerSize(capturedSeries) + + const serType = w.config.series[capturedSeries].type + if ( + serType && + (serType === 'column' || + serType === 'candlestick' || + serType === 'boxPlot') + ) { + // fix error mentioned in #811 + return + } + + cx = pointsArr[capturedSeries][j]?.[0] + cy = pointsArr[capturedSeries][j]?.[1] || 0 + + let point = w.globals.dom.baseEl.querySelector( + `.apexcharts-series[data\\:realIndex='${capturedSeries}'] .apexcharts-series-markers path` + ) + + if (point && cy < w.globals.gridHeight && cy > 0) { + const shape = point.getAttribute('shape') + + const path = graphics.getMarkerPath(cx, cy, shape, hoverSize * 1.5) + point.setAttribute('d', path) + } + + this.moveXCrosshairs(cx) + + if (!ttCtx.fixedTooltip) { + this.moveTooltip(cx, cy, hoverSize) + } + } + + // This function is used when you need to show markers/points only on hover - + // SAME X VALUES in multiple series + moveDynamicPointsOnHover(j) { + const ttCtx = this.ttCtx + let w = ttCtx.w + let cx = 0 + let cy = 0 + let activeSeries = 0 + + let pointsArr = w.globals.pointsArray + + let series = new Series(this.ctx) + const graphics = new Graphics(this.ctx) + + activeSeries = series.getActiveConfigSeriesIndex('asc', [ + 'line', + 'area', + 'scatter', + 'bubble', + ]) + + let hoverSize = ttCtx.tooltipUtil.getHoverMarkerSize(activeSeries) + + if (pointsArr[activeSeries]) { + cx = pointsArr[activeSeries][j][0] + cy = pointsArr[activeSeries][j][1] + } + if (isNaN(cx)) { + return + } + + let points = ttCtx.tooltipUtil.getAllMarkers() + + if (points.length) { + for (let p = 0; p < w.globals.series.length; p++) { + let pointArr = pointsArr[p] + + if (w.globals.comboCharts) { + // in a combo chart, if column charts are present, markers will not match with the number of series, hence this patch to push a null value in points array + if (typeof pointArr === 'undefined') { + // nodelist to array + points.splice(p, 0, null) + } + } + if (pointArr && pointArr.length) { + let pcy = pointsArr[p][j][1] + let pcy2 + points[p].setAttribute('cx', cx) + + const shape = points[p].getAttribute('shape') + + if (w.config.chart.type === 'rangeArea' && !w.globals.comboCharts) { + const rangeStartIndex = j + w.globals.series[p].length + pcy2 = pointsArr[p][rangeStartIndex][1] + const pcyDiff = Math.abs(pcy - pcy2) / 2 + + pcy = pcy - pcyDiff + } + if ( + pcy !== null && + !isNaN(pcy) && + pcy < w.globals.gridHeight + hoverSize && + pcy + hoverSize > 0 + ) { + const path = graphics.getMarkerPath(cx, pcy, shape, hoverSize) + points[p].setAttribute('d', path) + } else { + points[p].setAttribute('d', '') + } + } + } + } + + this.moveXCrosshairs(cx) + + if (!ttCtx.fixedTooltip) { + this.moveTooltip(cx, cy || w.globals.gridHeight, hoverSize) + } + } + + moveStickyTooltipOverBars(j, capturedSeries) { + const w = this.w + const ttCtx = this.ttCtx + + let barLen = w.globals.columnSeries + ? w.globals.columnSeries.length + : w.globals.series.length + + if (w.config.chart.stacked) { + barLen = w.globals.barGroups.length + } + + let i = + barLen >= 2 && barLen % 2 === 0 + ? Math.floor(barLen / 2) + : Math.floor(barLen / 2) + 1 + + if (w.globals.isBarHorizontal) { + let series = new Series(this.ctx) + i = series.getActiveConfigSeriesIndex('desc') + 1 + } + let jBar = w.globals.dom.baseEl.querySelector( + `.apexcharts-bar-series .apexcharts-series[rel='${i}'] path[j='${j}'], .apexcharts-candlestick-series .apexcharts-series[rel='${i}'] path[j='${j}'], .apexcharts-boxPlot-series .apexcharts-series[rel='${i}'] path[j='${j}'], .apexcharts-rangebar-series .apexcharts-series[rel='${i}'] path[j='${j}']` + ) + if (!jBar && typeof capturedSeries === 'number') { + // Try with captured series index + jBar = w.globals.dom.baseEl.querySelector( + `.apexcharts-bar-series .apexcharts-series[data\\:realIndex='${capturedSeries}'] path[j='${j}'], + .apexcharts-candlestick-series .apexcharts-series[data\\:realIndex='${capturedSeries}'] path[j='${j}'], + .apexcharts-boxPlot-series .apexcharts-series[data\\:realIndex='${capturedSeries}'] path[j='${j}'], + .apexcharts-rangebar-series .apexcharts-series[data\\:realIndex='${capturedSeries}'] path[j='${j}']` + ) + } + + let bcx = jBar ? parseFloat(jBar.getAttribute('cx')) : 0 + let bcy = jBar ? parseFloat(jBar.getAttribute('cy')) : 0 + let bw = jBar ? parseFloat(jBar.getAttribute('barWidth')) : 0 + + const elGrid = ttCtx.getElGrid() + let seriesBound = elGrid.getBoundingClientRect() + + const isBoxOrCandle = + jBar && + (jBar.classList.contains('apexcharts-candlestick-area') || + jBar.classList.contains('apexcharts-boxPlot-area')) + if (w.globals.isXNumeric) { + if (jBar && !isBoxOrCandle) { + bcx = bcx - (barLen % 2 !== 0 ? bw / 2 : 0) + } + + if ( + jBar && // fixes apexcharts.js#2354 + isBoxOrCandle + ) { + bcx = bcx - bw / 2 + } + } else { + if (!w.globals.isBarHorizontal) { + bcx = + ttCtx.xAxisTicksPositions[j - 1] + ttCtx.dataPointsDividedWidth / 2 + if (isNaN(bcx)) { + bcx = ttCtx.xAxisTicksPositions[j] - ttCtx.dataPointsDividedWidth / 2 + } + } + } + + if (!w.globals.isBarHorizontal) { + if (w.config.tooltip.followCursor) { + bcy = ttCtx.e.clientY - seriesBound.top - ttCtx.tooltipRect.ttHeight / 2 + } else { + if (bcy + ttCtx.tooltipRect.ttHeight + 15 > w.globals.gridHeight) { + bcy = w.globals.gridHeight + } + } + } else { + bcy = bcy - ttCtx.tooltipRect.ttHeight + } + + if (!w.globals.isBarHorizontal) { + this.moveXCrosshairs(bcx) + } + + if (!ttCtx.fixedTooltip) { + this.moveTooltip(bcx, bcy || w.globals.gridHeight) + } + } +} diff --git a/node_modules/apexcharts/src/modules/tooltip/README.md b/node_modules/apexcharts/src/modules/tooltip/README.md new file mode 100644 index 0000000..bae129b --- /dev/null +++ b/node_modules/apexcharts/src/modules/tooltip/README.md @@ -0,0 +1,20 @@ +### AxesTooltip.js +This file deals with the x-axis and y-axis tooltips. + +### Intersect.js +This file deals with functions related to intersecting tooltips (tooltips that appear when user hovers directly over a data-point whether). + +### Labels.js +This file deals with printing actual text on the tooltip. + +### Marker.js +This file deals with the markers that appear near tooltip in line/area charts. These markers helps the user to associate the data-points and the values that are shown in the tooltip + +### Position.js +This file deals with positioning of the tooltip. + +### Tooltip.js +This is the primary file which is an entry point for all tooltip related functionality. + +### Utils.js +Helper functions related to tooltips. diff --git a/node_modules/apexcharts/src/modules/tooltip/Tooltip.js b/node_modules/apexcharts/src/modules/tooltip/Tooltip.js new file mode 100644 index 0000000..afdeac6 --- /dev/null +++ b/node_modules/apexcharts/src/modules/tooltip/Tooltip.js @@ -0,0 +1,928 @@ +import Labels from './Labels' +import Position from './Position' +import Marker from './Marker' +import Intersect from './Intersect' +import AxesTooltip from './AxesTooltip' +import Graphics from '../Graphics' +import Series from '../Series' +import XAxis from './../axes/XAxis' +import Utils from './Utils' + +/** + * ApexCharts Core Tooltip Class to handle the tooltip generation. + * + * @module Tooltip + **/ + +export default class Tooltip { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + const w = this.w + + this.tConfig = w.config.tooltip + + this.tooltipUtil = new Utils(this) + this.tooltipLabels = new Labels(this) + this.tooltipPosition = new Position(this) + this.marker = new Marker(this) + this.intersect = new Intersect(this) + this.axesTooltip = new AxesTooltip(this) + this.showOnIntersect = this.tConfig.intersect + this.showTooltipTitle = this.tConfig.x.show + this.fixedTooltip = this.tConfig.fixed.enabled + this.xaxisTooltip = null + this.yaxisTTEls = null + this.isBarShared = !w.globals.isBarHorizontal && this.tConfig.shared + this.lastHoverTime = Date.now() + } + + getElTooltip(ctx) { + if (!ctx) ctx = this + if (!ctx.w.globals.dom.baseEl) return null + + return ctx.w.globals.dom.baseEl.querySelector('.apexcharts-tooltip') + } + + getElXCrosshairs() { + return this.w.globals.dom.baseEl.querySelector('.apexcharts-xcrosshairs') + } + + getElGrid() { + return this.w.globals.dom.baseEl.querySelector('.apexcharts-grid') + } + + drawTooltip(xyRatios) { + let w = this.w + this.xyRatios = xyRatios + this.isXAxisTooltipEnabled = + w.config.xaxis.tooltip.enabled && w.globals.axisCharts + this.yaxisTooltips = w.config.yaxis.map((y, i) => { + return y.show && y.tooltip.enabled && w.globals.axisCharts ? true : false + }) + this.allTooltipSeriesGroups = [] + + if (!w.globals.axisCharts) { + this.showTooltipTitle = false + } + + const tooltipEl = document.createElement('div') + tooltipEl.classList.add('apexcharts-tooltip') + if (w.config.tooltip.cssClass) { + tooltipEl.classList.add(w.config.tooltip.cssClass) + } + tooltipEl.classList.add(`apexcharts-theme-${this.tConfig.theme}`) + w.globals.dom.elWrap.appendChild(tooltipEl) + + if (w.globals.axisCharts) { + this.axesTooltip.drawXaxisTooltip() + this.axesTooltip.drawYaxisTooltip() + this.axesTooltip.setXCrosshairWidth() + this.axesTooltip.handleYCrosshair() + + let xAxis = new XAxis(this.ctx) + this.xAxisTicksPositions = xAxis.getXAxisTicksPositions() + } + + // we forcefully set intersect true for these conditions + if ( + (w.globals.comboCharts || + this.tConfig.intersect || + w.config.chart.type === 'rangeBar') && + !this.tConfig.shared + ) { + this.showOnIntersect = true + } + + if (w.config.markers.size === 0 || w.globals.markers.largestSize === 0) { + // when user don't want to show points all the time, but only on when hovering on series + this.marker.drawDynamicPoints(this) + } + + // no visible series, exit + if (w.globals.collapsedSeries.length === w.globals.series.length) return + + this.dataPointsDividedHeight = w.globals.gridHeight / w.globals.dataPoints + this.dataPointsDividedWidth = w.globals.gridWidth / w.globals.dataPoints + + if (this.showTooltipTitle) { + this.tooltipTitle = document.createElement('div') + this.tooltipTitle.classList.add('apexcharts-tooltip-title') + this.tooltipTitle.style.fontFamily = + this.tConfig.style.fontFamily || w.config.chart.fontFamily + this.tooltipTitle.style.fontSize = this.tConfig.style.fontSize + tooltipEl.appendChild(this.tooltipTitle) + } + + let ttItemsCnt = w.globals.series.length // whether shared or not, default is shared + if ((w.globals.xyCharts || w.globals.comboCharts) && this.tConfig.shared) { + if (!this.showOnIntersect) { + ttItemsCnt = w.globals.series.length + } else { + ttItemsCnt = 1 + } + } + + this.legendLabels = w.globals.dom.baseEl.querySelectorAll( + '.apexcharts-legend-text' + ) + + this.ttItems = this.createTTElements(ttItemsCnt) + this.addSVGEvents() + } + + createTTElements(ttItemsCnt) { + const w = this.w + let ttItems = [] + + const tooltipEl = this.getElTooltip() + for (let i = 0; i < ttItemsCnt; i++) { + let gTxt = document.createElement('div') + + gTxt.classList.add( + 'apexcharts-tooltip-series-group', + `apexcharts-tooltip-series-group-${i}` + ) + gTxt.style.order = w.config.tooltip.inverseOrder ? ttItemsCnt - i : i + 1 + + let point = document.createElement('span') + point.classList.add('apexcharts-tooltip-marker') + + if (w.config.tooltip.fillSeriesColor) { + point.style.backgroundColor = w.globals.colors[i] + } else { + point.style.color = w.globals.colors[i] + } + + let mShape = w.config.markers.shape + let shape = mShape + if (Array.isArray(mShape)) { + shape = mShape[i] + } + + point.setAttribute('shape', shape) + gTxt.appendChild(point) + + const gYZ = document.createElement('div') + gYZ.classList.add('apexcharts-tooltip-text') + + gYZ.style.fontFamily = + this.tConfig.style.fontFamily || w.config.chart.fontFamily + gYZ.style.fontSize = this.tConfig.style.fontSize + ;['y', 'goals', 'z'].forEach((g) => { + const gValText = document.createElement('div') + gValText.classList.add(`apexcharts-tooltip-${g}-group`) + + let txtLabel = document.createElement('span') + txtLabel.classList.add(`apexcharts-tooltip-text-${g}-label`) + gValText.appendChild(txtLabel) + + let txtValue = document.createElement('span') + txtValue.classList.add(`apexcharts-tooltip-text-${g}-value`) + gValText.appendChild(txtValue) + + gYZ.appendChild(gValText) + }) + + gTxt.appendChild(gYZ) + + tooltipEl.appendChild(gTxt) + + ttItems.push(gTxt) + } + + return ttItems + } + + addSVGEvents() { + const w = this.w + let type = w.config.chart.type + const tooltipEl = this.getElTooltip() + + const commonBar = !!( + type === 'bar' || + type === 'candlestick' || + type === 'boxPlot' || + type === 'rangeBar' + ) + + const chartWithmarkers = + type === 'area' || + type === 'line' || + type === 'scatter' || + type === 'bubble' || + type === 'radar' + + let hoverArea = w.globals.dom.Paper.node + + const elGrid = this.getElGrid() + if (elGrid) { + this.seriesBound = elGrid.getBoundingClientRect() + } + + let tooltipY = [] + let tooltipX = [] + + let seriesHoverParams = { + hoverArea, + elGrid, + tooltipEl, + tooltipY, + tooltipX, + ttItems: this.ttItems, + } + + let points + + if (w.globals.axisCharts) { + if (chartWithmarkers) { + points = w.globals.dom.baseEl.querySelectorAll( + ".apexcharts-series[data\\:longestSeries='true'] .apexcharts-marker" + ) + } else if (commonBar) { + points = w.globals.dom.baseEl.querySelectorAll( + '.apexcharts-series .apexcharts-bar-area, .apexcharts-series .apexcharts-candlestick-area, .apexcharts-series .apexcharts-boxPlot-area, .apexcharts-series .apexcharts-rangebar-area' + ) + } else if (type === 'heatmap' || type === 'treemap') { + points = w.globals.dom.baseEl.querySelectorAll( + '.apexcharts-series .apexcharts-heatmap, .apexcharts-series .apexcharts-treemap' + ) + } + + if (points && points.length) { + for (let p = 0; p < points.length; p++) { + tooltipY.push(points[p].getAttribute('cy')) + tooltipX.push(points[p].getAttribute('cx')) + } + } + } + + const validSharedChartTypes = + (w.globals.xyCharts && !this.showOnIntersect) || + (w.globals.comboCharts && !this.showOnIntersect) || + (commonBar && this.tooltipUtil.hasBars() && this.tConfig.shared) + + if (validSharedChartTypes) { + this.addPathsEventListeners([hoverArea], seriesHoverParams) + } else if ( + (commonBar && !w.globals.comboCharts) || + (chartWithmarkers && this.showOnIntersect) + ) { + this.addDatapointEventsListeners(seriesHoverParams) + } else if ( + !w.globals.axisCharts || + type === 'heatmap' || + type === 'treemap' + ) { + let seriesAll = + w.globals.dom.baseEl.querySelectorAll('.apexcharts-series') + this.addPathsEventListeners(seriesAll, seriesHoverParams) + } + + if (this.showOnIntersect) { + let lineAreaPoints = w.globals.dom.baseEl.querySelectorAll( + '.apexcharts-line-series .apexcharts-marker, .apexcharts-area-series .apexcharts-marker' + ) + if (lineAreaPoints.length > 0) { + // if we find any lineSeries, addEventListeners for them + this.addPathsEventListeners(lineAreaPoints, seriesHoverParams) + } + + // combo charts may have bars, so add event listeners here too + if (this.tooltipUtil.hasBars() && !this.tConfig.shared) { + this.addDatapointEventsListeners(seriesHoverParams) + } + } + } + + drawFixedTooltipRect() { + let w = this.w + + const tooltipEl = this.getElTooltip() + + let tooltipRect = tooltipEl.getBoundingClientRect() + + let ttWidth = tooltipRect.width + 10 + let ttHeight = tooltipRect.height + 10 + let x = this.tConfig.fixed.offsetX + let y = this.tConfig.fixed.offsetY + + const fixed = this.tConfig.fixed.position.toLowerCase() + + if (fixed.indexOf('right') > -1) { + x = x + w.globals.svgWidth - ttWidth + 10 + } + if (fixed.indexOf('bottom') > -1) { + y = y + w.globals.svgHeight - ttHeight - 10 + } + + tooltipEl.style.left = x + 'px' + tooltipEl.style.top = y + 'px' + + return { + x, + y, + ttWidth, + ttHeight, + } + } + + addDatapointEventsListeners(seriesHoverParams) { + let w = this.w + let points = w.globals.dom.baseEl.querySelectorAll( + '.apexcharts-series-markers .apexcharts-marker, .apexcharts-bar-area, .apexcharts-candlestick-area, .apexcharts-boxPlot-area, .apexcharts-rangebar-area' + ) + this.addPathsEventListeners(points, seriesHoverParams) + } + + addPathsEventListeners(paths, opts) { + let self = this + + for (let p = 0; p < paths.length; p++) { + let extendedOpts = { + paths: paths[p], + tooltipEl: opts.tooltipEl, + tooltipY: opts.tooltipY, + tooltipX: opts.tooltipX, + elGrid: opts.elGrid, + hoverArea: opts.hoverArea, + ttItems: opts.ttItems, + } + + let events = ['mousemove', 'mouseup', 'touchmove', 'mouseout', 'touchend'] + + events.map((ev) => { + return paths[p].addEventListener( + ev, + self.onSeriesHover.bind(self, extendedOpts), + { capture: false, passive: true } + ) + }) + } + } + + /* + ** Check to see if the tooltips should be updated based on a mouse / touch event + */ + onSeriesHover(opt, e) { + // If a user is moving their mouse quickly, don't bother updating the tooltip every single frame + + const targetDelay = 20 + const timeSinceLastUpdate = Date.now() - this.lastHoverTime + if (timeSinceLastUpdate >= targetDelay) { + // The tooltip was last updated over 100ms ago - redraw it even if the user is still moving their + // mouse so they get some feedback that their moves are being registered + this.seriesHover(opt, e) + } else { + // The tooltip was last updated less than 100ms ago + // Cancel any other delayed draw, so we don't show stale data + clearTimeout(this.seriesHoverTimeout) + + // Schedule the next draw so that it happens about 100ms after the last update + this.seriesHoverTimeout = setTimeout(() => { + this.seriesHover(opt, e) + }, targetDelay - timeSinceLastUpdate) + } + } + + /* + ** The actual series hover function + */ + seriesHover(opt, e) { + this.lastHoverTime = Date.now() + let chartGroups = [] + const w = this.w + + // if user has more than one charts in group, we need to sync + if (w.config.chart.group) { + chartGroups = this.ctx.getGroupedCharts() + } + + if ( + w.globals.axisCharts && + ((w.globals.minX === -Infinity && w.globals.maxX === Infinity) || + w.globals.dataPoints === 0) + ) { + return + } + + if (chartGroups.length) { + chartGroups.forEach((ch) => { + const tooltipEl = this.getElTooltip(ch) + + const newOpts = { + paths: opt.paths, + tooltipEl, + tooltipY: opt.tooltipY, + tooltipX: opt.tooltipX, + elGrid: opt.elGrid, + hoverArea: opt.hoverArea, + ttItems: ch.w.globals.tooltip.ttItems, + } + + // all the charts should have the same minX and maxX (same xaxis) for multiple tooltips to work correctly + if ( + ch.w.globals.minX === this.w.globals.minX && + ch.w.globals.maxX === this.w.globals.maxX + ) { + ch.w.globals.tooltip.seriesHoverByContext({ + chartCtx: ch, + ttCtx: ch.w.globals.tooltip, + opt: newOpts, + e, + }) + } + }) + } else { + this.seriesHoverByContext({ + chartCtx: this.ctx, + ttCtx: this.w.globals.tooltip, + opt, + e, + }) + } + } + + seriesHoverByContext({ chartCtx, ttCtx, opt, e }) { + let w = chartCtx.w + const tooltipEl = this.getElTooltip(chartCtx) + + if (!tooltipEl) return + + // tooltipRect is calculated on every mousemove, because the text is dynamic + ttCtx.tooltipRect = { + x: 0, + y: 0, + ttWidth: tooltipEl.getBoundingClientRect().width, + ttHeight: tooltipEl.getBoundingClientRect().height, + } + ttCtx.e = e + + // highlight the current hovered bars + if ( + ttCtx.tooltipUtil.hasBars() && + !w.globals.comboCharts && + !ttCtx.isBarShared + ) { + if (this.tConfig.onDatasetHover.highlightDataSeries) { + let series = new Series(chartCtx) + series.toggleSeriesOnHover(e, e.target.parentNode) + } + } + + if (ttCtx.fixedTooltip) { + ttCtx.drawFixedTooltipRect() + } + + if (w.globals.axisCharts) { + ttCtx.axisChartsTooltips({ + e, + opt, + tooltipRect: ttCtx.tooltipRect, + }) + } else { + // non-plot charts i.e pie/donut/circle + ttCtx.nonAxisChartsTooltips({ + e, + opt, + tooltipRect: ttCtx.tooltipRect, + }) + } + } + + // tooltip handling for line/area/bar/columns/scatter + axisChartsTooltips({ e, opt }) { + let w = this.w + let x, y + + let seriesBound = opt.elGrid.getBoundingClientRect() + + const clientX = e.type === 'touchmove' ? e.touches[0].clientX : e.clientX + const clientY = e.type === 'touchmove' ? e.touches[0].clientY : e.clientY + + this.clientY = clientY + this.clientX = clientX + + w.globals.capturedSeriesIndex = -1 + w.globals.capturedDataPointIndex = -1 + + if ( + clientY < seriesBound.top || + clientY > seriesBound.top + seriesBound.height + ) { + this.handleMouseOut(opt) + return + } + + if ( + Array.isArray(this.tConfig.enabledOnSeries) && + !w.config.tooltip.shared + ) { + const index = parseInt(opt.paths.getAttribute('index'), 10) + if (this.tConfig.enabledOnSeries.indexOf(index) < 0) { + this.handleMouseOut(opt) + return + } + } + + const tooltipEl = this.getElTooltip() + const xcrosshairs = this.getElXCrosshairs() + + let syncedCharts = [] + if (w.config.chart.group) { + // we need to fallback to sticky tooltip in case charts are synced + syncedCharts = this.ctx.getSyncedCharts() + } + + let isStickyTooltip = + w.globals.xyCharts || + (w.config.chart.type === 'bar' && + !w.globals.isBarHorizontal && + this.tooltipUtil.hasBars() && + this.tConfig.shared) || + (w.globals.comboCharts && this.tooltipUtil.hasBars()) + + if ( + e.type === 'mousemove' || + e.type === 'touchmove' || + e.type === 'mouseup' + ) { + // there is no series to hover over + if ( + w.globals.collapsedSeries.length + + w.globals.ancillaryCollapsedSeries.length === + w.globals.series.length + ) { + return + } + + if (xcrosshairs !== null) { + xcrosshairs.classList.add('apexcharts-active') + } + + const hasYAxisTooltip = this.yaxisTooltips.filter((b) => { + return b === true + }) + if (this.ycrosshairs !== null && hasYAxisTooltip.length) { + this.ycrosshairs.classList.add('apexcharts-active') + } + + if ( + (isStickyTooltip && !this.showOnIntersect) || + syncedCharts.length > 1 + ) { + this.handleStickyTooltip(e, clientX, clientY, opt) + } else { + if ( + w.config.chart.type === 'heatmap' || + w.config.chart.type === 'treemap' + ) { + let markerXY = this.intersect.handleHeatTreeTooltip({ + e, + opt, + x, + y, + type: w.config.chart.type, + }) + x = markerXY.x + y = markerXY.y + + tooltipEl.style.left = x + 'px' + tooltipEl.style.top = y + 'px' + } else { + if (this.tooltipUtil.hasBars()) { + this.intersect.handleBarTooltip({ + e, + opt, + }) + } + + if (this.tooltipUtil.hasMarkers()) { + // intersect - line/area/scatter/bubble + this.intersect.handleMarkerTooltip({ + e, + opt, + x, + y, + }) + } + } + } + + if (this.yaxisTooltips.length) { + for (let yt = 0; yt < w.config.yaxis.length; yt++) { + this.axesTooltip.drawYaxisTooltipText(yt, clientY, this.xyRatios) + } + } + + w.globals.dom.baseEl.classList.add('apexcharts-tooltip-active') + opt.tooltipEl.classList.add('apexcharts-active') + } else if (e.type === 'mouseout' || e.type === 'touchend') { + this.handleMouseOut(opt) + } + } + + // tooltip handling for pie/donuts + nonAxisChartsTooltips({ e, opt, tooltipRect }) { + let w = this.w + let rel = opt.paths.getAttribute('rel') + + const tooltipEl = this.getElTooltip() + + let seriesBound = w.globals.dom.elWrap.getBoundingClientRect() + + if (e.type === 'mousemove' || e.type === 'touchmove') { + w.globals.dom.baseEl.classList.add('apexcharts-tooltip-active') + tooltipEl.classList.add('apexcharts-active') + + this.tooltipLabels.drawSeriesTexts({ + ttItems: opt.ttItems, + i: parseInt(rel, 10) - 1, + shared: false, + }) + + let x = w.globals.clientX - seriesBound.left - tooltipRect.ttWidth / 2 + let y = w.globals.clientY - seriesBound.top - tooltipRect.ttHeight - 10 + + tooltipEl.style.left = x + 'px' + tooltipEl.style.top = y + 'px' + + if (w.config.legend.tooltipHoverFormatter) { + let legendFormatter = w.config.legend.tooltipHoverFormatter + + const i = rel - 1 + const legendName = + this.legendLabels[i].getAttribute('data:default-text') + + let text = legendFormatter(legendName, { + seriesIndex: i, + dataPointIndex: i, + w, + }) + + this.legendLabels[i].innerHTML = text + } + } else if (e.type === 'mouseout' || e.type === 'touchend') { + tooltipEl.classList.remove('apexcharts-active') + w.globals.dom.baseEl.classList.remove('apexcharts-tooltip-active') + if (w.config.legend.tooltipHoverFormatter) { + this.legendLabels.forEach((l) => { + const defaultText = l.getAttribute('data:default-text') + l.innerHTML = decodeURIComponent(defaultText) + }) + } + } + } + + handleStickyTooltip(e, clientX, clientY, opt) { + const w = this.w + let capj = this.tooltipUtil.getNearestValues({ + context: this, + hoverArea: opt.hoverArea, + elGrid: opt.elGrid, + clientX, + clientY, + }) + + let j = capj.j + let capturedSeries = capj.capturedSeries + + if (w.globals.collapsedSeriesIndices.includes(capturedSeries)) + capturedSeries = null + + const bounds = opt.elGrid.getBoundingClientRect() + if (capj.hoverX < 0 || capj.hoverX > bounds.width) { + this.handleMouseOut(opt) + return + } + + if (capturedSeries !== null) { + this.handleStickyCapturedSeries(e, capturedSeries, opt, j) + } else { + // couldn't capture any series. check if shared X is same, + // if yes, draw a grouped tooltip + if (this.tooltipUtil.isXoverlap(j) || w.globals.isBarHorizontal) { + const firstVisibleSeries = w.globals.series.findIndex( + (s, i) => !w.globals.collapsedSeriesIndices.includes(i) + ) + this.create(e, this, firstVisibleSeries, j, opt.ttItems) + } + } + } + + handleStickyCapturedSeries(e, capturedSeries, opt, j) { + const w = this.w + if (!this.tConfig.shared) { + let ignoreNull = w.globals.series[capturedSeries][j] === null + if (ignoreNull) { + this.handleMouseOut(opt) + return + } + } + + if (typeof w.globals.series[capturedSeries][j] !== 'undefined') { + if ( + this.tConfig.shared && + this.tooltipUtil.isXoverlap(j) && + this.tooltipUtil.isInitialSeriesSameLen() + ) { + this.create(e, this, capturedSeries, j, opt.ttItems) + } else { + this.create(e, this, capturedSeries, j, opt.ttItems, false) + } + } else { + if (this.tooltipUtil.isXoverlap(j)) { + const firstVisibleSeries = w.globals.series.findIndex( + (s, i) => !w.globals.collapsedSeriesIndices.includes(i) + ) + this.create(e, this, firstVisibleSeries, j, opt.ttItems) + } + } + } + + deactivateHoverFilter() { + let w = this.w + let graphics = new Graphics(this.ctx) + + let allPaths = w.globals.dom.Paper.find(`.apexcharts-bar-area`) + + for (let b = 0; b < allPaths.length; b++) { + graphics.pathMouseLeave(allPaths[b]) + } + } + + handleMouseOut(opt) { + const w = this.w + + const xcrosshairs = this.getElXCrosshairs() + w.globals.dom.baseEl.classList.remove('apexcharts-tooltip-active') + + opt.tooltipEl.classList.remove('apexcharts-active') + this.deactivateHoverFilter() + if (w.config.chart.type !== 'bubble') { + this.marker.resetPointsSize() + } + if (xcrosshairs !== null) { + xcrosshairs.classList.remove('apexcharts-active') + } + if (this.ycrosshairs !== null) { + this.ycrosshairs.classList.remove('apexcharts-active') + } + if (this.isXAxisTooltipEnabled) { + this.xaxisTooltip.classList.remove('apexcharts-active') + } + if (this.yaxisTooltips.length) { + if (this.yaxisTTEls === null) { + this.yaxisTTEls = w.globals.dom.baseEl.querySelectorAll( + '.apexcharts-yaxistooltip' + ) + } + for (let i = 0; i < this.yaxisTTEls.length; i++) { + this.yaxisTTEls[i].classList.remove('apexcharts-active') + } + } + + if (w.config.legend.tooltipHoverFormatter) { + this.legendLabels.forEach((l) => { + const defaultText = l.getAttribute('data:default-text') + l.innerHTML = decodeURIComponent(defaultText) + }) + } + } + + markerClick(e, seriesIndex, dataPointIndex) { + const w = this.w + if (typeof w.config.chart.events.markerClick === 'function') { + w.config.chart.events.markerClick(e, this.ctx, { + seriesIndex, + dataPointIndex, + w, + }) + } + this.ctx.events.fireEvent('markerClick', [ + e, + this.ctx, + { seriesIndex, dataPointIndex, w }, + ]) + } + + create(e, context, capturedSeries, j, ttItems, shared = null) { + let w = this.w + let ttCtx = context + + if (e.type === 'mouseup') { + this.markerClick(e, capturedSeries, j) + } + + if (shared === null) shared = this.tConfig.shared + + const hasMarkers = this.tooltipUtil.hasMarkers(capturedSeries) + + const bars = this.tooltipUtil.getElBars() + + const handlePoints = () => { + if (w.globals.markers.largestSize > 0) { + ttCtx.marker.enlargePoints(j) + } else { + ttCtx.tooltipPosition.moveDynamicPointsOnHover(j) + } + } + + if (w.config.legend.tooltipHoverFormatter) { + let legendFormatter = w.config.legend.tooltipHoverFormatter + + let els = Array.from(this.legendLabels) + + // reset all legend values first + els.forEach((l) => { + const legendName = l.getAttribute('data:default-text') + l.innerHTML = decodeURIComponent(legendName) + }) + + // for irregular time series + for (let i = 0; i < els.length; i++) { + const l = els[i] + const lsIndex = parseInt(l.getAttribute('i'), 10) + const legendName = decodeURIComponent( + l.getAttribute('data:default-text') + ) + + let text = legendFormatter(legendName, { + seriesIndex: shared ? lsIndex : capturedSeries, + dataPointIndex: j, + w, + }) + + if (!shared) { + l.innerHTML = lsIndex === capturedSeries ? text : legendName + if (capturedSeries === lsIndex) { + break + } + } else { + l.innerHTML = + w.globals.collapsedSeriesIndices.indexOf(lsIndex) < 0 + ? text + : legendName + } + } + } + + const commonSeriesTextsParams = { + ttItems, + i: capturedSeries, + j, + ...(typeof w.globals.seriesRange?.[capturedSeries]?.[j]?.y[0]?.y1 !== + 'undefined' && { + y1: w.globals.seriesRange?.[capturedSeries]?.[j]?.y[0]?.y1, + }), + ...(typeof w.globals.seriesRange?.[capturedSeries]?.[j]?.y[0]?.y2 !== + 'undefined' && { + y2: w.globals.seriesRange?.[capturedSeries]?.[j]?.y[0]?.y2, + }), + } + if (shared) { + ttCtx.tooltipLabels.drawSeriesTexts({ + ...commonSeriesTextsParams, + shared: this.showOnIntersect ? false : this.tConfig.shared, + }) + + if (hasMarkers) { + handlePoints() + } else if (this.tooltipUtil.hasBars()) { + this.barSeriesHeight = this.tooltipUtil.getBarsHeight(bars) + if (this.barSeriesHeight > 0) { + // hover state, activate snap filter + let graphics = new Graphics(this.ctx) + let paths = w.globals.dom.Paper.find(`.apexcharts-bar-area[j='${j}']`) + + // de-activate first + this.deactivateHoverFilter() + + ttCtx.tooltipPosition.moveStickyTooltipOverBars(j, capturedSeries) + let points = ttCtx.tooltipUtil.getAllMarkers(true) + + if (points.length) { + handlePoints() + } + + for (let b = 0; b < paths.length; b++) { + graphics.pathMouseEnter(paths[b]) + } + } + } + } else { + ttCtx.tooltipLabels.drawSeriesTexts({ + shared: false, + ...commonSeriesTextsParams, + }) + + if (this.tooltipUtil.hasBars()) { + ttCtx.tooltipPosition.moveStickyTooltipOverBars(j, capturedSeries) + } + + if (hasMarkers) { + ttCtx.tooltipPosition.moveMarkers(capturedSeries, j) + } + } + } +} diff --git a/node_modules/apexcharts/src/modules/tooltip/Utils.js b/node_modules/apexcharts/src/modules/tooltip/Utils.js new file mode 100644 index 0000000..ec928df --- /dev/null +++ b/node_modules/apexcharts/src/modules/tooltip/Utils.js @@ -0,0 +1,375 @@ +import Utilities from '../../utils/Utils' +import Graphics from '../Graphics' + +/** + * ApexCharts Tooltip.Utils Class to support Tooltip functionality. + * + * @module Tooltip.Utils + **/ + +export default class Utils { + constructor(tooltipContext) { + this.w = tooltipContext.w + this.ttCtx = tooltipContext + this.ctx = tooltipContext.ctx + } + + /** + ** When hovering over series, you need to capture which series is being hovered on. + ** This function will return both capturedseries index as well as inner index of that series + * @memberof Utils + * @param {object} + * - hoverArea = the rect on which user hovers + * - elGrid = dimensions of the hover rect (it can be different than hoverarea) + */ + getNearestValues({ hoverArea, elGrid, clientX, clientY }) { + let w = this.w + + const seriesBound = elGrid.getBoundingClientRect() + const hoverWidth = seriesBound.width + const hoverHeight = seriesBound.height + + let xDivisor = hoverWidth / (w.globals.dataPoints - 1) + let yDivisor = hoverHeight / w.globals.dataPoints + + const hasBars = this.hasBars() + + if ( + (w.globals.comboCharts || hasBars) && + !w.config.xaxis.convertedCatToNumeric + ) { + xDivisor = hoverWidth / w.globals.dataPoints + } + + let hoverX = clientX - seriesBound.left - w.globals.barPadForNumericAxis + let hoverY = clientY - seriesBound.top + + const notInRect = + hoverX < 0 || hoverY < 0 || hoverX > hoverWidth || hoverY > hoverHeight + + if (notInRect) { + hoverArea.classList.remove('hovering-zoom') + hoverArea.classList.remove('hovering-pan') + } else { + if (w.globals.zoomEnabled) { + hoverArea.classList.remove('hovering-pan') + hoverArea.classList.add('hovering-zoom') + } else if (w.globals.panEnabled) { + hoverArea.classList.remove('hovering-zoom') + hoverArea.classList.add('hovering-pan') + } + } + + let j = Math.round(hoverX / xDivisor) + let jHorz = Math.floor(hoverY / yDivisor) + + if (hasBars && !w.config.xaxis.convertedCatToNumeric) { + j = Math.ceil(hoverX / xDivisor) + j = j - 1 + } + + let capturedSeries = null + let closest = null + + let seriesXValArr = w.globals.seriesXvalues.map((seriesXVal) => { + return seriesXVal.filter((s) => Utilities.isNumber(s)) + }) + let seriesYValArr = w.globals.seriesYvalues.map((seriesYVal) => { + return seriesYVal.filter((s) => Utilities.isNumber(s)) + }) + + // if X axis type is not category and tooltip is not shared, then we need to find the cursor position and get the nearest value + if (w.globals.isXNumeric) { + // Change origin of cursor position so that we can compute the relative nearest point to the cursor on our chart + // we only need to scale because all points are relative to the bounds.left and bounds.top => origin is virtually (0, 0) + const chartGridEl = this.ttCtx.getElGrid() + const chartGridElBoundingRect = chartGridEl.getBoundingClientRect() + const transformedHoverX = + hoverX * (chartGridElBoundingRect.width / hoverWidth) + const transformedHoverY = + hoverY * (chartGridElBoundingRect.height / hoverHeight) + + closest = this.closestInMultiArray( + transformedHoverX, + transformedHoverY, + seriesXValArr, + seriesYValArr + ) + capturedSeries = closest.index + j = closest.j + + if (capturedSeries !== null && w.globals.hasNullValues) { + // initial push, it should be a little smaller than the 1st val + seriesXValArr = w.globals.seriesXvalues[capturedSeries] + + closest = this.closestInArray(transformedHoverX, seriesXValArr) + + j = closest.j + } + } + + w.globals.capturedSeriesIndex = + capturedSeries === null ? -1 : capturedSeries + + if (!j || j < 1) j = 0 + + if (w.globals.isBarHorizontal) { + w.globals.capturedDataPointIndex = jHorz + } else { + w.globals.capturedDataPointIndex = j + } + + return { + capturedSeries, + j: w.globals.isBarHorizontal ? jHorz : j, + hoverX, + hoverY, + } + } + + getFirstActiveXArray(Xarrays) { + const w = this.w + let activeIndex = 0 + + let firstActiveSeriesIndex = Xarrays.map((xarr, index) => { + return xarr.length > 0 ? index : -1 + }) + + for (let a = 0; a < firstActiveSeriesIndex.length; a++) { + if ( + firstActiveSeriesIndex[a] !== -1 && + w.globals.collapsedSeriesIndices.indexOf(a) === -1 && + w.globals.ancillaryCollapsedSeriesIndices.indexOf(a) === -1 + ) { + activeIndex = firstActiveSeriesIndex[a] + break + } + } + return activeIndex + } + + closestInMultiArray(hoverX, hoverY, Xarrays, Yarrays) { + const w = this.w + + // Determine which series are active (not collapsed) + const isActiveSeries = (seriesIndex) => { + return ( + w.globals.collapsedSeriesIndices.indexOf(seriesIndex) === -1 && + w.globals.ancillaryCollapsedSeriesIndices.indexOf(seriesIndex) === -1 + ) + } + + let closestDist = Infinity + let closestSeriesIndex = null + let closestPointIndex = null + + // Iterate through all series and points to find the closest (x,y) to (hoverX, hoverY) + for (let i = 0; i < Xarrays.length; i++) { + if (!isActiveSeries(i)) { + continue + } + + const xArr = Xarrays[i] + const yArr = Yarrays[i] + + const len = Math.min(xArr.length, yArr.length) + + for (let j = 0; j < len; j++) { + const xVal = xArr[j] + const distX = hoverX - xVal + let dist = Math.sqrt(distX * distX) + + if (!w.globals.allSeriesHasEqualX) { + const yVal = yArr[j] + const distY = hoverY - yVal + dist = Math.sqrt(distX * distX + distY * distY) + } + + if (dist < closestDist) { + closestDist = dist + closestSeriesIndex = i + closestPointIndex = j + } + } + } + + return { + index: closestSeriesIndex, + j: closestPointIndex, + } + } + + closestInArray(val, arr) { + let curr = arr[0] + let currIndex = null + let diff = Math.abs(val - curr) + + for (let i = 0; i < arr.length; i++) { + let newdiff = Math.abs(val - arr[i]) + if (newdiff < diff) { + diff = newdiff + currIndex = i + } + } + + return { + j: currIndex, + } + } + + /** + * When there are multiple series, it is possible to have different x values for each series. + * But it may be possible in those multiple series, that there is same x value for 2 or more + * series. + * @memberof Utils + * @param {int} + * - j = is the inner index of series -> (series[i][j]) + * @return {bool} + */ + isXoverlap(j) { + let w = this.w + let xSameForAllSeriesJArr = [] + + const seriesX = w.globals.seriesX.filter((s) => typeof s[0] !== 'undefined') + + if (seriesX.length > 0) { + for (let i = 0; i < seriesX.length - 1; i++) { + if ( + typeof seriesX[i][j] !== 'undefined' && + typeof seriesX[i + 1][j] !== 'undefined' + ) { + if (seriesX[i][j] !== seriesX[i + 1][j]) { + xSameForAllSeriesJArr.push('unEqual') + } + } + } + } + + if (xSameForAllSeriesJArr.length === 0) { + return true + } + + return false + } + + isInitialSeriesSameLen() { + let sameLen = true + + const initialSeries = this.w.globals.initialSeries + + for (let i = 0; i < initialSeries.length - 1; i++) { + if (initialSeries[i].data.length !== initialSeries[i + 1].data.length) { + sameLen = false + break + } + } + + return sameLen + } + + getBarsHeight(allbars) { + let bars = [...allbars] + const totalHeight = bars.reduce((acc, bar) => acc + bar.getBBox().height, 0) + + return totalHeight + } + + getElMarkers(capturedSeries) { + // The selector .apexcharts-series-markers-wrap > * includes marker groups for which the + // .apexcharts-series-markers class is not added due to null values or discrete markers + if (typeof capturedSeries == 'number') { + return this.w.globals.dom.baseEl.querySelectorAll( + `.apexcharts-series[data\\:realIndex='${capturedSeries}'] .apexcharts-series-markers-wrap > *` + ) + } + return this.w.globals.dom.baseEl.querySelectorAll( + '.apexcharts-series-markers-wrap > *' + ) + } + + getAllMarkers(filterCollapsed = false) { + // first get all marker parents. This parent class contains series-index + // which helps to sort the markers as they are dynamic + let markersWraps = this.w.globals.dom.baseEl.querySelectorAll( + '.apexcharts-series-markers-wrap' + ) + + markersWraps = [...markersWraps] + + if (filterCollapsed) { + markersWraps = markersWraps.filter((m) => { + const realIndex = Number(m.getAttribute('data:realIndex')) + return this.w.globals.collapsedSeriesIndices.indexOf(realIndex) === -1 + }) + } + + markersWraps.sort((a, b) => { + var indexA = Number(a.getAttribute('data:realIndex')) + var indexB = Number(b.getAttribute('data:realIndex')) + return indexB < indexA ? 1 : indexB > indexA ? -1 : 0 + }) + + let markers = [] + markersWraps.forEach((m) => { + markers.push(m.querySelector('.apexcharts-marker')) + }) + + return markers + } + + hasMarkers(capturedSeries) { + const markers = this.getElMarkers(capturedSeries) + return markers.length > 0 + } + + getPathFromPoint(point, size) { + let cx = Number(point.getAttribute('cx')) + let cy = Number(point.getAttribute('cy')) + let shape = point.getAttribute('shape') + return new Graphics(this.ctx).getMarkerPath(cx, cy, shape, size) + } + + getElBars() { + return this.w.globals.dom.baseEl.querySelectorAll( + '.apexcharts-bar-series, .apexcharts-candlestick-series, .apexcharts-boxPlot-series, .apexcharts-rangebar-series' + ) + } + + hasBars() { + const bars = this.getElBars() + return bars.length > 0 + } + + getHoverMarkerSize(index) { + const w = this.w + let hoverSize = w.config.markers.hover.size + + if (hoverSize === undefined) { + hoverSize = + w.globals.markers.size[index] + w.config.markers.hover.sizeOffset + } + return hoverSize + } + + toggleAllTooltipSeriesGroups(state) { + let w = this.w + const ttCtx = this.ttCtx + + if (ttCtx.allTooltipSeriesGroups.length === 0) { + ttCtx.allTooltipSeriesGroups = w.globals.dom.baseEl.querySelectorAll( + '.apexcharts-tooltip-series-group' + ) + } + + let allTooltipSeriesGroups = ttCtx.allTooltipSeriesGroups + for (let i = 0; i < allTooltipSeriesGroups.length; i++) { + if (state === 'enable') { + allTooltipSeriesGroups[i].classList.add('apexcharts-active') + allTooltipSeriesGroups[i].style.display = w.config.tooltip.items.display + } else { + allTooltipSeriesGroups[i].classList.remove('apexcharts-active') + allTooltipSeriesGroups[i].style.display = 'none' + } + } + } +} diff --git a/node_modules/apexcharts/src/svgjs/svg.pathmorphing.js b/node_modules/apexcharts/src/svgjs/svg.pathmorphing.js new file mode 100644 index 0000000..25a319a --- /dev/null +++ b/node_modules/apexcharts/src/svgjs/svg.pathmorphing.js @@ -0,0 +1,425 @@ +import * as SVG from '@svgdotjs/svg.js' + +/*! +* svg.pathmorphing.js - Enables pathmorphing / path animation in svg.js +* @version 0.1.3 +* +* +* @copyright (c) 2018 Ulrich-Matthias Schäfer +* @license MIT +*/; +;(function() { + "use strict"; + + SVG.extend(SVG.PathArray, { + morph: function(fromArray, toArray, pos, stepper, context) { + var startArr = this.parse(fromArray) + , destArr = this.parse(toArray) + + var startOffsetM = 0 + , destOffsetM = 0 + + var startOffsetNextM = false + , destOffsetNextM = false + + while(true){ + // stop if there is no M anymore + if(startOffsetM === false && destOffsetM === false) break + + // find the next M in path array + startOffsetNextM = findNextM(startArr, startOffsetM === false ? false : startOffsetM+1) + destOffsetNextM = findNextM( destArr, destOffsetM === false ? false : destOffsetM+1) + + // We have to add one M to the startArray + if(startOffsetM === false){ + var bbox = new SVG.PathArray(result.start).bbox() + + // when the last block had no bounding box we simply take the first M we got + if(bbox.height == 0 || bbox.width == 0){ + startOffsetM = startArr.push(startArr[0]) - 1 + }else{ + // we take the middle of the bbox instead when we got one + startOffsetM = startArr.push( ['M', bbox.x + bbox.width/2, bbox.y + bbox.height/2 ] ) - 1 + } + } + + // We have to add one M to the destArray + if( destOffsetM === false){ + var bbox = new SVG.PathArray(result.dest).bbox() + + if(bbox.height == 0 || bbox.width == 0){ + destOffsetM = destArr.push(destArr[0]) - 1 + }else{ + destOffsetM = destArr.push( ['M', bbox.x + bbox.width/2, bbox.y + bbox.height/2 ] ) - 1 + } + } + + // handle block from M to next M + var result = handleBlock(startArr, startOffsetM, startOffsetNextM, destArr, destOffsetM, destOffsetNextM) + + // update the arrays to their new values + startArr = startArr.slice(0, startOffsetM).concat(result.start, startOffsetNextM === false ? [] : startArr.slice(startOffsetNextM)) + destArr = destArr.slice(0, destOffsetM).concat(result.dest , destOffsetNextM === false ? [] : destArr.slice( destOffsetNextM)) + + // update offsets + startOffsetM = startOffsetNextM === false ? false : startOffsetM + result.start.length + destOffsetM = destOffsetNextM === false ? false : destOffsetM + result.dest.length + + } + + // copy back arrays + this._array = startArr + this.destination = new SVG.PathArray() + this.destination._array = destArr; + + const finalArr = this.fromArray(startArr.map(function (from, fromIndex) { + + const step = destArr[fromIndex].map((to, toIndex) => { + if (toIndex === 0) return to; + return stepper.step(from[toIndex], destArr[fromIndex][toIndex], pos, context[fromIndex], context); + }); + return step; + })); + + return finalArr; + } + }) + + + + // sorry for the long declaration + // slices out one block (from M to M) and syncronize it so the types and length match + function handleBlock(startArr = [], startOffsetM, startOffsetNextM, destArr, destOffsetM, destOffsetNextM, undefined){ + + // slice out the block we need + var startArrTemp = startArr.slice(startOffsetM, startOffsetNextM || undefined) + , destArrTemp = destArr.slice( destOffsetM, destOffsetNextM || undefined) + + var i = 0 + , posStart = {pos:[0,0], start:[0,0]} + , posDest = {pos:[0,0], start:[0,0]} + + do{ + + // convert shorthand types to long form + startArrTemp[i] = simplyfy.call(posStart, startArrTemp[i]) + destArrTemp[i] = simplyfy.call(posDest , destArrTemp[i]) + + // check if both shape types match + // 2 elliptical arc curve commands ('A'), are considered different if the + // flags (large-arc-flag, sweep-flag) don't match + if(startArrTemp[i][0] != destArrTemp[i][0] || startArrTemp[i][0] == 'M' || + (startArrTemp[i][0] == 'A' && + (startArrTemp[i][4] != destArrTemp[i][4] || startArrTemp[i][5] != destArrTemp[i][5]) + ) + ) { + // if not, convert shapes to beziere + Array.prototype.splice.apply(startArrTemp, [i, 1].concat(toBeziere.call(posStart, startArrTemp[i]))) + Array.prototype.splice.apply(destArrTemp, [i, 1].concat(toBeziere.call(posDest, destArrTemp[i]))) + + } else { + + // only update positions otherwise + startArrTemp[i] = setPosAndReflection.call(posStart, startArrTemp[i]) + destArrTemp[i] = setPosAndReflection.call(posDest , destArrTemp[i]) + + } + + // we are at the end at both arrays. stop here + if(++i == startArrTemp.length && i == destArrTemp.length) break + + // destArray is longer. Add one element + if(i == startArrTemp.length){ + startArrTemp.push([ + 'C', + posStart.pos[0], + posStart.pos[1], + posStart.pos[0], + posStart.pos[1], + posStart.pos[0], + posStart.pos[1], + ]) + } + + // startArr is longer. Add one element + if(i == destArrTemp.length){ + destArrTemp.push([ + 'C', + posDest.pos[0], + posDest.pos[1], + posDest.pos[0], + posDest.pos[1], + posDest.pos[0], + posDest.pos[1] + ]) + } + + + }while(true) + + // return the updated block + return {start:startArrTemp, dest:destArrTemp} + } + + // converts shorthand types to long form + function simplyfy(val){ + + switch(val[0]){ + case 'z': // shorthand line to start + case 'Z': + val[0] = 'L' + val[1] = this.start[0] + val[2] = this.start[1] + break + case 'H': // shorthand horizontal line + val[0] = 'L' + val[2] = this.pos[1] + break + case 'V': // shorthand vertical line + val[0] = 'L' + val[2] = val[1] + val[1] = this.pos[0] + break + case 'T': // shorthand quadratic beziere + val[0] = 'Q' + val[3] = val[1] + val[4] = val[2] + val[1] = this.reflection[1] + val[2] = this.reflection[0] + break + case 'S': // shorthand cubic beziere + val[0] = 'C' + val[6] = val[4] + val[5] = val[3] + val[4] = val[2] + val[3] = val[1] + val[2] = this.reflection[1] + val[1] = this.reflection[0] + break + } + + return val + + } + + // updates reflection point and current position + function setPosAndReflection(val){ + + var len = val.length + + this.pos = [ val[len-2], val[len-1] ] + + if('SCQT'.indexOf(val[0]) != -1) + this.reflection = [ 2 * this.pos[0] - val[len-4], 2 * this.pos[1] - val[len-3] ] + + return val + } + + // converts all types to cubic beziere + function toBeziere(val){ + var retVal = [val] + + switch(val[0]){ + case 'M': // special handling for M + this.pos = this.start = [val[1], val[2]] + return retVal + case 'L': + val[5] = val[3] = val[1] + val[6] = val[4] = val[2] + val[1] = this.pos[0] + val[2] = this.pos[1] + break + case 'Q': + val[6] = val[4] + val[5] = val[3] + val[4] = val[4] * 1/3 + val[2] * 2/3 + val[3] = val[3] * 1/3 + val[1] * 2/3 + val[2] = this.pos[1] * 1/3 + val[2] * 2/3 + val[1] = this.pos[0] * 1/3 + val[1] * 2/3 + break + case 'A': + retVal = arcToBeziere(this.pos, val) + val = retVal[0] + break + } + + val[0] = 'C' + this.pos = [val[5], val[6]] + this.reflection = [2 * val[5] - val[3], 2 * val[6] - val[4]] + + return retVal + + } + + // finds the next position of type M + function findNextM(arr = [], offset){ + + if(offset === false) return false + + for(var i = offset, len = arr.length;i < len;++i){ + + if(arr[i][0] == 'M') return i + + } + + return false + } + + + + // Convert an arc segment into equivalent cubic Bezier curves + // Depending on the arc, up to 4 curves might be used to represent it since a + // curve gives a good approximation for only a quarter of an ellipse + // The curves are returned as an array of SVG curve commands: + // [ ['C', x1, y1, x2, y2, x, y] ... ] + function arcToBeziere(pos, val) { + // Parameters extraction, handle out-of-range parameters as specified in the SVG spec + // See: https://www.w3.org/TR/SVG11/implnote.html#ArcOutOfRangeParameters + var rx = Math.abs(val[1]), ry = Math.abs(val[2]), xAxisRotation = val[3] % 360 + , largeArcFlag = val[4], sweepFlag = val[5], x = val[6], y = val[7] + , A = new SVG.Point(pos), B = new SVG.Point(x, y) + , primedCoord, lambda, mat, k, c, cSquare, t, O, OA, OB, tetaStart, tetaEnd + , deltaTeta, nbSectors, f, arcSegPoints, angle, sinAngle, cosAngle, pt, i, il + , retVal = [], x1, y1, x2, y2 + + // Ensure radii are non-zero + if(rx === 0 || ry === 0 || (A.x === B.x && A.y === B.y)) { + // treat this arc as a straight line segment + return [['C', A.x, A.y, B.x, B.y, B.x, B.y]] + } + + // Ensure radii are large enough using the algorithm provided in the SVG spec + // See: https://www.w3.org/TR/SVG11/implnote.html#ArcCorrectionOutOfRangeRadii + primedCoord = new SVG.Point((A.x-B.x)/2, (A.y-B.y)/2).transform(new SVG.Matrix().rotate(xAxisRotation)) + lambda = (primedCoord.x * primedCoord.x) / (rx * rx) + (primedCoord.y * primedCoord.y) / (ry * ry) + if(lambda > 1) { + lambda = Math.sqrt(lambda) + rx = lambda*rx + ry = lambda*ry + } + + // To simplify calculations, we make the arc part of a unit circle (rayon is 1) instead of an ellipse + mat = new SVG.Matrix().rotate(xAxisRotation).scale(1/rx, 1/ry).rotate(-xAxisRotation) + A = A.transform(mat) + B = B.transform(mat) + + // Calculate the horizontal and vertical distance between the initial and final point of the arc + k = [B.x-A.x, B.y-A.y] + + // Find the length of the chord formed by A and B + cSquare = k[0]*k[0] + k[1]*k[1] + c = Math.sqrt(cSquare) + + // Calculate the ratios of the horizontal and vertical distance on the length of the chord + k[0] /= c + k[1] /= c + + // Calculate the distance between the circle center and the chord midpoint + // using this formula: t = sqrt(r^2 - c^2 / 4) + // where t is the distance between the cirle center and the chord midpoint, + // r is the rayon of the circle and c is the chord length + // From: http://www.ajdesigner.com/phpcircle/circle_segment_chord_t.php + // Because of the imprecision of floating point numbers, cSquare might end + // up being slightly above 4 which would result in a negative radicand + // To prevent that, a test is made before computing the square root + t = (cSquare < 4) ? Math.sqrt(1 - cSquare/4) : 0 + + // For most situations, there are actually two different ellipses that + // satisfy the constraints imposed by the points A and B, the radii rx and ry, + // and the xAxisRotation + // When the flags largeArcFlag and sweepFlag are equal, it means that the + // second ellipse is used as a solution + // See: https://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands + if(largeArcFlag === sweepFlag) { + t *= -1 + } + + // Calculate the coordinates of the center of the circle from the midpoint of the chord + // This is done by multiplying the ratios calculated previously by the distance between + // the circle center and the chord midpoint and using these values to go from the midpoint + // to the center of the circle + // The negative of the vertical distance ratio is used to modify the x coordinate while + // the horizontal distance ratio is used to modify the y coordinate + // That is because the center of the circle is perpendicular to the chord and perpendicular + // lines are negative reciprocals + O = new SVG.Point((B.x+A.x)/2 + t*-k[1], (B.y+A.y)/2 + t*k[0]) + // Move the center of the circle at the origin + OA = new SVG.Point(A.x-O.x, A.y-O.y) + OB = new SVG.Point(B.x-O.x, B.y-O.y) + + // Calculate the start and end angle + tetaStart = Math.acos(OA.x/Math.sqrt(OA.x*OA.x + OA.y*OA.y)) + if (OA.y < 0) { + tetaStart *= -1 + } + tetaEnd = Math.acos(OB.x/Math.sqrt(OB.x*OB.x + OB.y*OB.y)) + if (OB.y < 0) { + tetaEnd *= -1 + } + + // If sweep-flag is '1', then the arc will be drawn in a "positive-angle" direction, + // make sure that the end angle is above the start angle + if (sweepFlag && tetaStart > tetaEnd) { + tetaEnd += 2*Math.PI + } + // If sweep-flag is '0', then the arc will be drawn in a "negative-angle" direction, + // make sure that the end angle is below the start angle + if (!sweepFlag && tetaStart < tetaEnd) { + tetaEnd -= 2*Math.PI + } + + // Find the number of Bezier curves that are required to represent the arc + // A cubic Bezier curve gives a good enough approximation when representing at most a quarter of a circle + nbSectors = Math.ceil(Math.abs(tetaStart-tetaEnd) * 2/Math.PI) + + // Calculate the coordinates of the points of all the Bezier curves required to represent the arc + // For an in-depth explanation of this part see: http://pomax.github.io/bezierinfo/#circles_cubic + arcSegPoints = [] + angle = tetaStart + deltaTeta = (tetaEnd-tetaStart)/nbSectors + f = 4*Math.tan(deltaTeta/4)/3 + for (i = 0; i <= nbSectors; i++) { // The <= is because a Bezier curve have a start and a endpoint + cosAngle = Math.cos(angle) + sinAngle = Math.sin(angle) + + pt = new SVG.Point(O.x+cosAngle, O.y+sinAngle) + arcSegPoints[i] = [new SVG.Point(pt.x+f*sinAngle, pt.y-f*cosAngle), pt, new SVG.Point(pt.x-f*sinAngle, pt.y+f*cosAngle)] + + angle += deltaTeta + } + + // Remove the first control point of the first segment point and remove the second control point of the last segment point + // These two control points are not used in the approximation of the arc, that is why they are removed + arcSegPoints[0][0] = arcSegPoints[0][1].clone() + arcSegPoints[arcSegPoints.length-1][2] = arcSegPoints[arcSegPoints.length-1][1].clone() + + // Revert the transformation that was applied to make the arc part of a unit circle instead of an ellipse + mat = new SVG.Matrix().rotate(xAxisRotation).scale(rx, ry).rotate(-xAxisRotation) + for (i = 0, il = arcSegPoints.length; i < il; i++) { + arcSegPoints[i][0] = arcSegPoints[i][0].transform(mat) + arcSegPoints[i][1] = arcSegPoints[i][1].transform(mat) + arcSegPoints[i][2] = arcSegPoints[i][2].transform(mat) + } + + + // Convert the segments points to SVG curve commands + for (i = 1, il = arcSegPoints.length; i < il; i++) { + pt = arcSegPoints[i-1][2] + x1 = pt.x + y1 = pt.y + + pt = arcSegPoints[i][0] + x2 = pt.x + y2 = pt.y + + pt = arcSegPoints[i][1] + x = pt.x + y = pt.y + + retVal.push(['C', x1, y1, x2, y2, x, y]) + } + + return retVal + } + }()); + \ No newline at end of file diff --git a/node_modules/apexcharts/src/utils/DateTime.js b/node_modules/apexcharts/src/utils/DateTime.js new file mode 100644 index 0000000..1468416 --- /dev/null +++ b/node_modules/apexcharts/src/utils/DateTime.js @@ -0,0 +1,243 @@ +import Utils from './Utils' + +/** + * DateTime Class to manipulate datetime values. + * + * @module DateTime + **/ + +class DateTime { + constructor(ctx) { + this.ctx = ctx + this.w = ctx.w + + this.months31 = [1, 3, 5, 7, 8, 10, 12] + this.months30 = [2, 4, 6, 9, 11] + + this.daysCntOfYear = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334] + } + + isValidDate(date) { + if (typeof date === 'number') { + return false // don't test for timestamps + } + return !isNaN(this.parseDate(date)) + } + + getTimeStamp(dateStr) { + if (!Date.parse(dateStr)) { + return dateStr + } + const utc = this.w.config.xaxis.labels.datetimeUTC + return !utc + ? new Date(dateStr).getTime() + : new Date(new Date(dateStr).toISOString().substr(0, 25)).getTime() + } + + getDate(timestamp) { + const utc = this.w.config.xaxis.labels.datetimeUTC + + return utc + ? new Date(new Date(timestamp).toUTCString()) + : new Date(timestamp) + } + + parseDate(dateStr) { + const parsed = Date.parse(dateStr) + if (!isNaN(parsed)) { + return this.getTimeStamp(dateStr) + } + + let output = Date.parse(dateStr.replace(/-/g, '/').replace(/[a-z]+/gi, ' ')) + output = this.getTimeStamp(output) + return output + } + + // This fixes the difference of x-axis labels between chrome/safari + // Fixes #1726, #1544, #1485, #1255 + parseDateWithTimezone(dateStr) { + return Date.parse(dateStr.replace(/-/g, '/').replace(/[a-z]+/gi, ' ')) + } + + // http://stackoverflow.com/questions/14638018/current-time-formatting-with-javascript#answer-14638191 + formatDate(date, format) { + const locale = this.w.globals.locale + + const utc = this.w.config.xaxis.labels.datetimeUTC + + let MMMM = ['\x00', ...locale.months] + let MMM = ['\x01', ...locale.shortMonths] + let dddd = ['\x02', ...locale.days] + let ddd = ['\x03', ...locale.shortDays] + + function ii(i, len) { + let s = i + '' + len = len || 2 + while (s.length < len) s = '0' + s + return s + } + + let y = utc ? date.getUTCFullYear() : date.getFullYear() + format = format.replace(/(^|[^\\])yyyy+/g, '$1' + y) + format = format.replace(/(^|[^\\])yy/g, '$1' + y.toString().substr(2, 2)) + format = format.replace(/(^|[^\\])y/g, '$1' + y) + + let M = (utc ? date.getUTCMonth() : date.getMonth()) + 1 + format = format.replace(/(^|[^\\])MMMM+/g, '$1' + MMMM[0]) + format = format.replace(/(^|[^\\])MMM/g, '$1' + MMM[0]) + format = format.replace(/(^|[^\\])MM/g, '$1' + ii(M)) + format = format.replace(/(^|[^\\])M/g, '$1' + M) + + let d = utc ? date.getUTCDate() : date.getDate() + format = format.replace(/(^|[^\\])dddd+/g, '$1' + dddd[0]) + format = format.replace(/(^|[^\\])ddd/g, '$1' + ddd[0]) + format = format.replace(/(^|[^\\])dd/g, '$1' + ii(d)) + format = format.replace(/(^|[^\\])d/g, '$1' + d) + + let H = utc ? date.getUTCHours() : date.getHours() + format = format.replace(/(^|[^\\])HH+/g, '$1' + ii(H)) + format = format.replace(/(^|[^\\])H/g, '$1' + H) + + let h = H > 12 ? H - 12 : H === 0 ? 12 : H + format = format.replace(/(^|[^\\])hh+/g, '$1' + ii(h)) + format = format.replace(/(^|[^\\])h/g, '$1' + h) + + let m = utc ? date.getUTCMinutes() : date.getMinutes() + format = format.replace(/(^|[^\\])mm+/g, '$1' + ii(m)) + format = format.replace(/(^|[^\\])m/g, '$1' + m) + + let s = utc ? date.getUTCSeconds() : date.getSeconds() + format = format.replace(/(^|[^\\])ss+/g, '$1' + ii(s)) + format = format.replace(/(^|[^\\])s/g, '$1' + s) + + let f = utc ? date.getUTCMilliseconds() : date.getMilliseconds() + format = format.replace(/(^|[^\\])fff+/g, '$1' + ii(f, 3)) + f = Math.round(f / 10) + format = format.replace(/(^|[^\\])ff/g, '$1' + ii(f)) + f = Math.round(f / 10) + format = format.replace(/(^|[^\\])f/g, '$1' + f) + + let T = H < 12 ? 'AM' : 'PM' + format = format.replace(/(^|[^\\])TT+/g, '$1' + T) + format = format.replace(/(^|[^\\])T/g, '$1' + T.charAt(0)) + + let t = T.toLowerCase() + format = format.replace(/(^|[^\\])tt+/g, '$1' + t) + format = format.replace(/(^|[^\\])t/g, '$1' + t.charAt(0)) + + let tz = -date.getTimezoneOffset() + let K = utc || !tz ? 'Z' : tz > 0 ? '+' : '-' + + if (!utc) { + tz = Math.abs(tz) + let tzHrs = Math.floor(tz / 60) + let tzMin = tz % 60 + K += ii(tzHrs) + ':' + ii(tzMin) + } + + format = format.replace(/(^|[^\\])K/g, '$1' + K) + + let day = (utc ? date.getUTCDay() : date.getDay()) + 1 + format = format.replace(new RegExp(dddd[0], 'g'), dddd[day]) + format = format.replace(new RegExp(ddd[0], 'g'), ddd[day]) + + format = format.replace(new RegExp(MMMM[0], 'g'), MMMM[M]) + format = format.replace(new RegExp(MMM[0], 'g'), MMM[M]) + + format = format.replace(/\\(.)/g, '$1') + + return format + } + + getTimeUnitsfromTimestamp(minX, maxX, utc) { + let w = this.w + + if (w.config.xaxis.min !== undefined) { + minX = w.config.xaxis.min + } + if (w.config.xaxis.max !== undefined) { + maxX = w.config.xaxis.max + } + + const tsMin = this.getDate(minX) + const tsMax = this.getDate(maxX) + + const minD = this.formatDate(tsMin, 'yyyy MM dd HH mm ss fff').split(' ') + const maxD = this.formatDate(tsMax, 'yyyy MM dd HH mm ss fff').split(' ') + + return { + minMillisecond: parseInt(minD[6], 10), + maxMillisecond: parseInt(maxD[6], 10), + minSecond: parseInt(minD[5], 10), + maxSecond: parseInt(maxD[5], 10), + minMinute: parseInt(minD[4], 10), + maxMinute: parseInt(maxD[4], 10), + minHour: parseInt(minD[3], 10), + maxHour: parseInt(maxD[3], 10), + minDate: parseInt(minD[2], 10), + maxDate: parseInt(maxD[2], 10), + minMonth: parseInt(minD[1], 10) - 1, + maxMonth: parseInt(maxD[1], 10) - 1, + minYear: parseInt(minD[0], 10), + maxYear: parseInt(maxD[0], 10), + } + } + + isLeapYear(year) { + return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0 + } + + calculcateLastDaysOfMonth(month, year, subtract) { + const days = this.determineDaysOfMonths(month, year) + + // whatever days we get, subtract the number of days asked + return days - subtract + } + + determineDaysOfYear(year) { + let days = 365 + + if (this.isLeapYear(year)) { + days = 366 + } + + return days + } + + determineRemainingDaysOfYear(year, month, date) { + let dayOfYear = this.daysCntOfYear[month] + date + if (month > 1 && this.isLeapYear()) dayOfYear++ + return dayOfYear + } + + determineDaysOfMonths(month, year) { + let days = 30 + + month = Utils.monthMod(month) + + switch (true) { + case this.months30.indexOf(month) > -1: + if (month === 2) { + if (this.isLeapYear(year)) { + days = 29 + } else { + days = 28 + } + } + + break + + case this.months31.indexOf(month) > -1: + days = 31 + break + + default: + days = 31 + break + } + + return days + } +} + +export default DateTime diff --git a/node_modules/apexcharts/src/utils/Resize.js b/node_modules/apexcharts/src/utils/Resize.js new file mode 100644 index 0000000..6a10be8 --- /dev/null +++ b/node_modules/apexcharts/src/utils/Resize.js @@ -0,0 +1,47 @@ +// Helpers to react to element resizes, regardless of what caused them +// TODO Currently this creates a new ResizeObserver every time we want to observe an element for resizes +// Ideally, we should be able to use a single observer for all elements +let ros = new WeakMap() // Map callbacks to ResizeObserver instances for easy removal + +export function addResizeListener(el, fn) { + let called = false + + if (el.nodeType !== Node.DOCUMENT_FRAGMENT_NODE) { + const elRect = el.getBoundingClientRect() + if (el.style.display === 'none' || elRect.width === 0) { + // if elRect.width=0, the chart is not rendered at all + // (it has either display none or hidden in a different tab) + // fixes https://github.com/apexcharts/apexcharts.js/issues/2825 + // fixes https://github.com/apexcharts/apexcharts.js/issues/2991 + // fixes https://github.com/apexcharts/apexcharts.js/issues/2992 + called = true + } + } + + let ro = new ResizeObserver((r) => { + // ROs fire immediately after being created, + // per spec: https://drafts.csswg.org/resize-observer/#ref-for-element%E2%91%A3 + // we don't want that so we just discard the first run + if (called) { + fn.call(el, r) + } + called = true + }) + + if (el.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { + // Document fragment, observe children instead (needed for Shadow DOM, see #1332) + Array.from(el.children).forEach((c) => ro.observe(c)) + } else { + ro.observe(el) + } + + ros.set(fn, ro) +} + +export function removeResizeListener(el, fn) { + let ro = ros.get(fn) + if (ro) { + ro.disconnect() + ros.delete(fn) + } +} diff --git a/node_modules/apexcharts/src/utils/Utils.js b/node_modules/apexcharts/src/utils/Utils.js new file mode 100644 index 0000000..894e853 --- /dev/null +++ b/node_modules/apexcharts/src/utils/Utils.js @@ -0,0 +1,425 @@ +/* + ** Generic functions which are not dependent on ApexCharts + */ + +class Utils { + static bind(fn, me) { + return function () { + return fn.apply(me, arguments) + } + } + + static isObject(item) { + return ( + item && typeof item === 'object' && !Array.isArray(item) && item != null + ) + } + + // Type checking that works across different window objects + static is(type, val) { + return Object.prototype.toString.call(val) === '[object ' + type + ']' + } + + static listToArray(list) { + let i, + array = [] + for (i = 0; i < list.length; i++) { + array[i] = list[i] + } + return array + } + + // to extend defaults with user options + // credit: http://stackoverflow.com/questions/27936772/deep-object-merging-in-es6-es7#answer-34749873 + static extend(target, source) { + if (typeof Object.assign !== 'function') { + ;(function () { + Object.assign = function (target) { + 'use strict' + // We must check against these specific cases. + if (target === undefined || target === null) { + throw new TypeError('Cannot convert undefined or null to object') + } + + let output = Object(target) + for (let index = 1; index < arguments.length; index++) { + let source = arguments[index] + if (source !== undefined && source !== null) { + for (let nextKey in source) { + if (source.hasOwnProperty(nextKey)) { + output[nextKey] = source[nextKey] + } + } + } + } + return output + } + })() + } + + let output = Object.assign({}, target) + if (this.isObject(target) && this.isObject(source)) { + Object.keys(source).forEach((key) => { + if (this.isObject(source[key])) { + if (!(key in target)) { + Object.assign(output, { + [key]: source[key], + }) + } else { + output[key] = this.extend(target[key], source[key]) + } + } else { + Object.assign(output, { + [key]: source[key], + }) + } + }) + } + return output + } + + static extendArray(arrToExtend, resultArr) { + let extendedArr = [] + arrToExtend.map((item) => { + extendedArr.push(Utils.extend(resultArr, item)) + }) + arrToExtend = extendedArr + return arrToExtend + } + + // If month counter exceeds 12, it starts again from 1 + static monthMod(month) { + return month % 12 + } + + static clone(source, visited = new WeakMap()) { + if (source === null || typeof source !== 'object') { + return source + } + + if (visited.has(source)) { + return visited.get(source) + } + + let cloneResult + + if (Array.isArray(source)) { + cloneResult = [] + visited.set(source, cloneResult) + for (let i = 0; i < source.length; i++) { + cloneResult[i] = this.clone(source[i], visited) + } + } else if (source instanceof Date) { + cloneResult = new Date(source.getTime()) + } else { + cloneResult = {} + visited.set(source, cloneResult) + for (let prop in source) { + if (source.hasOwnProperty(prop)) { + cloneResult[prop] = this.clone(source[prop], visited) + } + } + } + return cloneResult + } + + static log10(x) { + return Math.log(x) / Math.LN10 + } + + static roundToBase10(x) { + return Math.pow(10, Math.floor(Math.log10(x))) + } + + static roundToBase(x, base) { + return Math.pow(base, Math.floor(Math.log(x) / Math.log(base))) + } + + static parseNumber(val) { + if (val === null) return val + return parseFloat(val) + } + + static stripNumber(num, precision = 2) { + return Number.isInteger(num) ? num : parseFloat(num.toPrecision(precision)) + } + + static randomId() { + return (Math.random() + 1).toString(36).substring(4) + } + + static noExponents(num) { + // Check if the number contains 'e' (exponential notation) + if (num.toString().includes('e')) { + return Math.round(num) // Round the number + } + return num // Return as-is if no exponential notation + } + + static elementExists(element) { + if (!element || !element.isConnected) { + return false + } + return true + } + + static getDimensions(el) { + const computedStyle = getComputedStyle(el, null) + + let elementHeight = el.clientHeight + let elementWidth = el.clientWidth + elementHeight -= + parseFloat(computedStyle.paddingTop) + + parseFloat(computedStyle.paddingBottom) + elementWidth -= + parseFloat(computedStyle.paddingLeft) + + parseFloat(computedStyle.paddingRight) + + return [elementWidth, elementHeight] + } + + static getBoundingClientRect(element) { + const rect = element.getBoundingClientRect() + return { + top: rect.top, + right: rect.right, + bottom: rect.bottom, + left: rect.left, + width: element.clientWidth, + height: element.clientHeight, + x: rect.left, + y: rect.top, + } + } + + static getLargestStringFromArr(arr) { + return arr.reduce((a, b) => { + if (Array.isArray(b)) { + b = b.reduce((aa, bb) => (aa.length > bb.length ? aa : bb)) + } + return a.length > b.length ? a : b + }, 0) + } + + // http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb#answer-12342275 + static hexToRgba(hex = '#999999', opacity = 0.6) { + if (hex.substring(0, 1) !== '#') { + hex = '#999999' + } + + let h = hex.replace('#', '') + h = h.match(new RegExp('(.{' + h.length / 3 + '})', 'g')) + + for (let i = 0; i < h.length; i++) { + h[i] = parseInt(h[i].length === 1 ? h[i] + h[i] : h[i], 16) + } + + if (typeof opacity !== 'undefined') h.push(opacity) + + return 'rgba(' + h.join(',') + ')' + } + + static getOpacityFromRGBA(rgba) { + return parseFloat(rgba.replace(/^.*,(.+)\)/, '$1')) + } + + static rgb2hex(rgb) { + rgb = rgb.match( + /^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i + ) + return rgb && rgb.length === 4 + ? '#' + + ('0' + parseInt(rgb[1], 10).toString(16)).slice(-2) + + ('0' + parseInt(rgb[2], 10).toString(16)).slice(-2) + + ('0' + parseInt(rgb[3], 10).toString(16)).slice(-2) + : '' + } + + shadeRGBColor(percent, color) { + let f = color.split(','), + t = percent < 0 ? 0 : 255, + p = percent < 0 ? percent * -1 : percent, + R = parseInt(f[0].slice(4), 10), + G = parseInt(f[1], 10), + B = parseInt(f[2], 10) + return ( + 'rgb(' + + (Math.round((t - R) * p) + R) + + ',' + + (Math.round((t - G) * p) + G) + + ',' + + (Math.round((t - B) * p) + B) + + ')' + ) + } + + shadeHexColor(percent, color) { + let f = parseInt(color.slice(1), 16), + t = percent < 0 ? 0 : 255, + p = percent < 0 ? percent * -1 : percent, + R = f >> 16, + G = (f >> 8) & 0x00ff, + B = f & 0x0000ff + return ( + '#' + + ( + 0x1000000 + + (Math.round((t - R) * p) + R) * 0x10000 + + (Math.round((t - G) * p) + G) * 0x100 + + (Math.round((t - B) * p) + B) + ) + .toString(16) + .slice(1) + ) + } + + // beautiful color shading blending code + // http://stackoverflow.com/questions/5560248/programmatically-lighten-or-darken-a-hex-color-or-rgb-and-blend-colors + shadeColor(p, color) { + if (Utils.isColorHex(color)) { + return this.shadeHexColor(p, color) + } else { + return this.shadeRGBColor(p, color) + } + } + + static isColorHex(color) { + return /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)|(^#[0-9A-F]{8}$)/i.test(color) + } + + static getPolygonPos(size, dataPointsLen) { + let dotsArray = [] + let angle = (Math.PI * 2) / dataPointsLen + for (let i = 0; i < dataPointsLen; i++) { + let curPos = {} + curPos.x = size * Math.sin(i * angle) + curPos.y = -size * Math.cos(i * angle) + dotsArray.push(curPos) + } + return dotsArray + } + + static polarToCartesian(centerX, centerY, radius, angleInDegrees) { + let angleInRadians = ((angleInDegrees - 90) * Math.PI) / 180.0 + + return { + x: centerX + radius * Math.cos(angleInRadians), + y: centerY + radius * Math.sin(angleInRadians), + } + } + + static escapeString(str, escapeWith = 'x') { + let newStr = str.toString().slice() + newStr = newStr.replace( + /[` ~!@#$%^&*()|+\=?;:'",.<>{}[\]\\/]/gi, + escapeWith + ) + return newStr + } + + static negToZero(val) { + return val < 0 ? 0 : val + } + + static moveIndexInArray(arr, old_index, new_index) { + if (new_index >= arr.length) { + let k = new_index - arr.length + 1 + while (k--) { + arr.push(undefined) + } + } + arr.splice(new_index, 0, arr.splice(old_index, 1)[0]) + return arr + } + + static extractNumber(s) { + return parseFloat(s.replace(/[^\d.]*/g, '')) + } + + static findAncestor(el, cls) { + while ((el = el.parentElement) && !el.classList.contains(cls)); + return el + } + + static setELstyles(el, styles) { + for (let key in styles) { + if (styles.hasOwnProperty(key)) { + el.style.key = styles[key] + } + } + } + // prevents JS prevision errors when adding + static preciseAddition(a, b) { + let aDecimals = (String(a).split('.')[1] || '').length + let bDecimals = (String(b).split('.')[1] || '').length + + let factor = Math.pow(10, Math.max(aDecimals, bDecimals)) + + return (Math.round(a * factor) + Math.round(b * factor)) / factor + } + + static isNumber(value) { + return ( + !isNaN(value) && + parseFloat(Number(value)) === value && + !isNaN(parseInt(value, 10)) + ) + } + + static isFloat(n) { + return Number(n) === n && n % 1 !== 0 + } + + static isMsEdge() { + let ua = window.navigator.userAgent + + let edge = ua.indexOf('Edge/') + if (edge > 0) { + // Edge (IE 12+) => return version number + return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10) + } + + // other browser + return false + } + // + // Find the Greatest Common Divisor of two numbers + // + static getGCD(a, b, p = 7) { + let big = Math.pow(10, p - Math.floor(Math.log10(Math.max(a, b)))) + a = Math.round(Math.abs(a) * big) + b = Math.round(Math.abs(b) * big) + + while (b) { + let t = b + b = a % b + a = t + } + return a / big + } + + static getPrimeFactors(n) { + const factors = [] + let divisor = 2 + + while (n >= 2) { + if (n % divisor == 0) { + factors.push(divisor) + n = n / divisor + } else { + divisor++ + } + } + return factors + } + + static mod(a, b, p = 7) { + let big = Math.pow(10, p - Math.floor(Math.log10(Math.max(a, b)))) + a = Math.round(Math.abs(a) * big) + b = Math.round(Math.abs(b) * big) + + return (a % b) / big + } +} + +export default Utils diff --git a/node_modules/apexcharts/types/apexcharts.d.ts b/node_modules/apexcharts/types/apexcharts.d.ts new file mode 100644 index 0000000..a7fa0ed --- /dev/null +++ b/node_modules/apexcharts/types/apexcharts.d.ts @@ -0,0 +1,1280 @@ +// Typescript declarations for Apex class and module. +// Note: When you have a class and a module with the same name; the module is merged +// with the class. This is necessary since apexcharts exports the main ApexCharts class only. +// +// This is a sparse typed declarations of chart interfaces. See Apex Chart documentation +// for comprehensive API: https://apexcharts.com/docs/options +// +// There is on-going work to provide a comprehensive typed definition for this component. +// See https://github.com/DefinitelyTyped/DefinitelyTyped/pull/28733 + +declare class ApexCharts { + constructor(el: any, options: any) + render(): Promise + updateOptions( + options: any, + redrawPaths?: boolean, + animate?: boolean, + updateSyncedCharts?: boolean + ): Promise + updateSeries( + newSeries: ApexAxisChartSeries | ApexNonAxisChartSeries, + animate?: boolean + ): Promise + appendSeries( + newSeries: ApexAxisChartSeries | ApexNonAxisChartSeries, + animate?: boolean + ): Promise + appendData(data: any[], overwriteInitialSeries?: boolean): void + toggleSeries(seriesName: string): any + highlightSeries(seriesName: string): any + showSeries(seriesName: string): void + hideSeries(seriesName: string): void + resetSeries(): void + zoomX(min: number, max: number): void + toggleDataPointSelection(seriesIndex: number, dataPointIndex?: number): any + destroy(): void + setLocale(localeName: string): void + paper(): void + addXaxisAnnotation(options: any, pushToMemory?: boolean, context?: any): void + addYaxisAnnotation(options: any, pushToMemory?: boolean, context?: any): void + addPointAnnotation(options: any, pushToMemory?: boolean, context?: any): void + removeAnnotation(id: string, options?: any): void + clearAnnotations(options?: any): void + dataURI(options?: { scale?: number, width?: number }): Promise<{ imgURI: string } | { blob: Blob }> + static exec(chartID: string, fn: string, ...args: Array): any + static getChartByID(chartID: string): ApexCharts | undefined + static initOnLoad(): void + exports: { + cleanup(): string + svgUrl(): string + dataURI(options?: { scale?: number, width?: number }): Promise<{ imgURI: string } | { blob: Blob }> + exportToSVG(): void + exportToPng(): void + exportToCSV(options?: { series?: any, fileName?: string, columnDelimiter?: string, lineDelimiter?: string }): void + getSvgString(scale?: number): void + triggerDownload(href: string, filename?: string, ext?: string): void + } +} + +declare module ApexCharts { + export interface ApexOptions { + annotations?: ApexAnnotations + chart?: ApexChart + colors?: any[] + dataLabels?: ApexDataLabels + fill?: ApexFill + forecastDataPoints?: ApexForecastDataPoints + grid?: ApexGrid + labels?: string[] + legend?: ApexLegend + markers?: ApexMarkers + noData?: ApexNoData + plotOptions?: ApexPlotOptions + responsive?: ApexResponsive[] + series?: ApexAxisChartSeries | ApexNonAxisChartSeries + states?: ApexStates + stroke?: ApexStroke + subtitle?: ApexTitleSubtitle + theme?: ApexTheme + title?: ApexTitleSubtitle + tooltip?: ApexTooltip + xaxis?: ApexXAxis + yaxis?: ApexYAxis | ApexYAxis[] + } +} + +type ApexDropShadow = { + enabled?: boolean + top?: number + left?: number + blur?: number + opacity?: number + color?: string +} + +/** + * Main Chart options + * See https://apexcharts.com/docs/options/chart/ + */ +type ApexChart = { + width?: string | number + height?: string | number + type?: + | 'line' + | 'area' + | 'bar' + | 'pie' + | 'donut' + | 'radialBar' + | 'scatter' + | 'bubble' + | 'heatmap' + | 'candlestick' + | 'boxPlot' + | 'radar' + | 'polarArea' + | 'rangeBar' + | 'rangeArea' + | 'treemap' + foreColor?: string + fontFamily?: string + background?: string + offsetX?: number + offsetY?: number + dropShadow?: ApexDropShadow & { + enabledOnSeries?: undefined | number[] + color?: string | string[] + } + events?: { + animationEnd?(chart: any, options?: any): void + beforeMount?(chart: any, options?: any): void + mounted?(chart: any, options?: any): void + updated?(chart: any, options?: any): void + mouseMove?(e: any, chart?: any, options?: any): void + mouseLeave?(e: any, chart?: any, options?: any): void + click?(e: any, chart?: any, options?: any): void + xAxisLabelClick?(e: any, chart?: any, options?: any): void + legendClick?(chart: any, seriesIndex?: number, options?: any): void + markerClick?(e: any, chart?: any, options?: any): void + selection?(chart: any, options?: any): void + dataPointSelection?(e: any, chart?: any, options?: any): void + dataPointMouseEnter?(e: any, chart?: any, options?: any): void + dataPointMouseLeave?(e: any, chart?: any, options?: any): void + beforeZoom?(chart: any, options?: any): void + beforeResetZoom?(chart: any, options?: any): void + zoomed?(chart: any, options?: any): void + scrolled?(chart: any, options?: any): void + brushScrolled?(chart: any, options?: any): void + } + brush?: { + enabled?: boolean + autoScaleYaxis?: boolean + target?: string + targets?: string[] + } + id?: string + group?: string + locales?: ApexLocale[] + defaultLocale?: string + parentHeightOffset?: number + redrawOnParentResize?: boolean + redrawOnWindowResize?: boolean | Function + sparkline?: { + enabled?: boolean + } + stacked?: boolean + stackType?: 'normal' | '100%' + stackOnlyBar?: boolean; + toolbar?: { + show?: boolean + offsetX?: number + offsetY?: number + tools?: { + download?: boolean | string + selection?: boolean | string + zoom?: boolean | string + zoomin?: boolean | string + zoomout?: boolean | string + pan?: boolean | string + reset?: boolean | string + customIcons?: { + icon?: string + title?: string + index?: number + class?: string + click?(chart?: any, options?: any, e?: any): any + }[] + } + export?: { + csv?: { + filename?: undefined | string + columnDelimiter?: string + headerCategory?: string + headerValue?: string + categoryFormatter?(value?: number): any + valueFormatter?(value?: number): any + }, + svg?: { + filename?: undefined | string + } + png?: { + filename?: undefined | string + } + width?: number + scale?: number + } + autoSelected?: 'zoom' | 'selection' | 'pan' + } + zoom?: { + enabled?: boolean + type?: 'x' | 'y' | 'xy' + autoScaleYaxis?: boolean + allowMouseWheelZoom?: boolean + zoomedArea?: { + fill?: { + color?: string + opacity?: number + } + stroke?: { + color?: string + opacity?: number + width?: number + } + } + } + selection?: { + enabled?: boolean + type?: string + fill?: { + color?: string + opacity?: number + } + stroke?: { + width?: number + color?: string + opacity?: number + dashArray?: number + } + xaxis?: { + min?: number + max?: number + } + yaxis?: { + min?: number + max?: number + } + } + animations?: { + enabled?: boolean + speed?: number + animateGradually?: { + enabled?: boolean + delay?: number + } + dynamicAnimation?: { + enabled?: boolean + speed?: number + } + } +} + +type ApexStates = { + hover?: { + filter?: { + type?: string + } + } + active?: { + allowMultipleDataPointsSelection?: boolean + filter?: { + type?: string + } + } +} + +/** + * Chart Title options + * See https://apexcharts.com/docs/options/title/ + */ +type ApexTitleSubtitle = { + text?: string + align?: 'left' | 'center' | 'right' + margin?: number + offsetX?: number + offsetY?: number + floating?: boolean + style?: { + fontSize?: string + fontFamily?: string + fontWeight?: string | number + color?: string + } +} + +/** + * Chart Series options. + * Use ApexNonAxisChartSeries for Pie and Donut charts. + * See https://apexcharts.com/docs/options/series/ + * + * According to the documentation at + * https://apexcharts.com/docs/series/ + * Section 1: data can be a list of single numbers + * Sections 2.1 and 3.1: data can be a list of tuples of two numbers + * Sections 2.2 and 3.2: data can be a list of objects where x is a string + * and y is a number + * And according to the demos, data can contain null. + * https://apexcharts.com/javascript-chart-demos/line-charts/null-values/ + */ +type ApexAxisChartSeries = { + name?: string + type?: string + color?: string + group?: string + hidden?: boolean + zIndex?: number + data: + | (number | null)[] + | { + x: any; + y: any; + fill?: ApexFill; + fillColor?: string; + strokeColor?: string; + meta?: any; + goals?: { + name?: string, + value: number, + strokeHeight?: number; + strokeWidth?: number; + strokeColor?: string; + strokeDashArray?: number; + strokeLineCap?: 'butt' | 'square' | 'round' + }[]; + barHeightOffset?: number; + columnWidthOffset?: number; + }[] + | [number, number | null][] + | [number, (number | null)[]][] + | number[][]; +}[] + +type ApexNonAxisChartSeries = number[] + +/** + * Options for the line drawn on line and area charts. + * See https://apexcharts.com/docs/options/stroke/ + */ +type ApexStroke = { + show?: boolean + curve?: 'smooth' | 'straight' | 'stepline' | 'linestep' | 'monotoneCubic' | ('smooth' | 'straight' | 'stepline' | 'linestep' | 'monotoneCubic')[] + lineCap?: 'butt' | 'square' | 'round' + colors?: any[] | string[] + width?: number | number[] + dashArray?: number | number[] + fill?: ApexFill +} + +type ApexAnnotations = { + yaxis?: YAxisAnnotations[] + xaxis?: XAxisAnnotations[] + points?: PointAnnotations[] + texts?: TextAnnotations[] + images?: ImageAnnotations[] +} + +type AnnotationLabel = { + borderColor?: string + borderWidth?: number + borderRadius?: number + text?: string + textAnchor?: string + offsetX?: number + offsetY?: number + style?: AnnotationStyle + position?: string + orientation?: string + mouseEnter?: Function + mouseLeave?: Function + click?: Function +} + +type AnnotationStyle = { + background?: string + color?: string + fontFamily?: string + fontWeight?: string | number + fontSize?: string + cssClass?: string + padding?: { + left?: number + right?: number + top?: number + bottom?: number + } +} + +type XAxisAnnotations = { + id?: number | string + x?: null | number | string + x2?: null | number | string + strokeDashArray?: number + fillColor?: string + borderColor?: string + borderWidth?: number + opacity?: number + offsetX?: number + offsetY?: number + label?: AnnotationLabel +} + +type YAxisAnnotations = { + id?: number | string + y?: null | number | string + y2?: null | number | string + strokeDashArray?: number + fillColor?: string + borderColor?: string + borderWidth?: number + opacity?: number + offsetX?: number + offsetY?: number + width?: number | string + yAxisIndex?: number + label?: AnnotationLabel +} + +type PointAnnotations = { + id?: number | string + x?: number | string + y?: null | number + yAxisIndex?: number + seriesIndex?: number + mouseEnter?: Function + mouseLeave?: Function + click?: Function + marker?: { + size?: number + fillColor?: string + strokeColor?: string + strokeWidth?: number + shape?: string + offsetX?: number + offsetY?: number + cssClass?: string + } + label?: AnnotationLabel + image?: { + path?: string + width?: number + height?: number + offsetX?: number + offsetY?: number + } +} + + +type TextAnnotations = { + x?: number + y?: number + text?: string + textAnchor?: string + foreColor?: string + fontSize?: string | number + fontFamily?: undefined | string + fontWeight?: string | number + backgroundColor?: string + borderColor?: string + borderRadius?: number + borderWidth?: number + paddingLeft?: number + paddingRight?: number + paddingTop?: number + paddingBottom?: number +} + +type ImageAnnotations = { + path?: string + x?: number, + y?: number, + width?: number, + height?: number, +} + +/** + * Options for localization. + * See https://apexcharts.com/docs/options/chart/locales + */ +type ApexLocale = { + name?: string + options?: { + months?: string[] + shortMonths?: string[] + days?: string[] + shortDays?: string[] + toolbar?: { + download?: string + selection?: string + selectionZoom?: string + zoomIn?: string + zoomOut?: string + pan?: string + reset?: string + exportToSVG?: string + exportToPNG?: string + exportToCSV?: string + } + } +} + +/** + * PlotOptions for specifying chart-type-specific configuration. + * See https://apexcharts.com/docs/options/plotoptions/bar/ + */ +type ApexPlotOptions = { + line?: { + isSlopeChart?: boolean + colors?: { + threshold?: number, + colorAboveThreshold?: string, + colorBelowThreshold?: string, + }, + } + area?: { + fillTo?: 'origin' | 'end' + } + bar?: { + horizontal?: boolean + columnWidth?: string | number; + barHeight?: string | number; + distributed?: boolean + borderRadius?: number; + borderRadiusApplication?: 'around' | 'end'; + borderRadiusWhenStacked?: 'all' | 'last'; + hideZeroBarsWhenGrouped?: boolean + rangeBarOverlap?: boolean + rangeBarGroupRows?: boolean + isDumbbell?: boolean; + dumbbellColors?: string[][]; + isFunnel?: boolean; + isFunnel3d?: boolean; + colors?: { + ranges?: { + from?: number + to?: number + color?: string + }[] + backgroundBarColors?: string[] + backgroundBarOpacity?: number + backgroundBarRadius?: number + } + dataLabels?: { + maxItems?: number + hideOverflowingLabels?: boolean + position?: string + orientation?: 'horizontal' | 'vertical', + total?: { + enabled?: boolean, + formatter?(val?: string, opts?: any): string, + offsetX?: number, + offsetY?: number, + style?: { + color?: string, + fontSize?: string, + fontFamily?: string, + fontWeight?: number | string + } + } + } + } + bubble?: { + zScaling?: boolean + minBubbleRadius?: number + maxBubbleRadius?: number + } + candlestick?: { + colors?: { + upward?: string | string[] + downward?: string | string[] + } + wick?: { + useFillColor?: boolean + } + } + boxPlot?: { + colors?: { + upper?: string | string[] + lower?: string | string[] + } + } + heatmap?: { + radius?: number + enableShades?: boolean + shadeIntensity?: number + reverseNegativeShade?: boolean + distributed?: boolean + useFillColorAsStroke?: boolean + colorScale?: { + ranges?: { + from?: number + to?: number + color?: string + foreColor?: string + name?: string + }[] + inverse?: boolean + min?: number + max?: number + } + } + treemap?: { + enableShades?: boolean + shadeIntensity?: number + distributed?: boolean + reverseNegativeShade?: boolean + useFillColorAsStroke?: boolean + dataLabels?: { format?: 'scale' | 'truncate' } + borderRadius?: number + colorScale?: { + inverse?: boolean + ranges?: { + from?: number + to?: number + color?: string + foreColor?: string + name?: string + }[]; + min?: number + max?: number + }; + seriesTitle?: { + show?: boolean, + offsetY?: number, + offsetX?: number, + borderColor?: string, + borderWidth?: number, + borderRadius?: number, + style?: { + background?: string, + color?: string, + fontSize?: string, + fontFamily?: string, + fontWeight?: number | string, + cssClass?: string, + padding?: { + left?: number, + right?: number, + top?: number, + bottom?: number, + }, + }, + } + } + pie?: { + startAngle?: number + endAngle?: number + customScale?: number + offsetX?: number + offsetY?: number + expandOnClick?: boolean + dataLabels?: { + offset?: number + minAngleToShowLabel?: number + } + donut?: { + size?: string + background?: string + labels?: { + show?: boolean + name?: { + show?: boolean + fontSize?: string + fontFamily?: string + fontWeight?: string | number + color?: string + offsetY?: number, + formatter?(val: string): string + } + value?: { + show?: boolean + fontSize?: string + fontFamily?: string + fontWeight?: string | number + color?: string + offsetY?: number + formatter?(val: string): string + } + total?: { + show?: boolean + showAlways?: boolean + fontFamily?: string + fontWeight?: string | number + fontSize?: string + label?: string + color?: string + formatter?(w: any): string + } + } + } + } + polarArea?: { + rings?: { + strokeWidth?: number + strokeColor?: string + } + spokes?: { + strokeWidth?: number; + connectorColors?: string | string[]; + }; + } + radar?: { + size?: number + offsetX?: number + offsetY?: number + polygons?: { + strokeColors?: string | string[] + strokeWidth?: string | string[] + connectorColors?: string | string[] + fill?: { + colors?: string[] + } + } + } + radialBar?: { + inverseOrder?: boolean + startAngle?: number + endAngle?: number + offsetX?: number + offsetY?: number + hollow?: { + margin?: number + size?: string + background?: string + image?: string + imageWidth?: number + imageHeight?: number + imageOffsetX?: number + imageOffsetY?: number + imageClipped?: boolean + position?: 'front' | 'back' + dropShadow?: ApexDropShadow + } + track?: { + show?: boolean + startAngle?: number + endAngle?: number + background?: string | string[] + strokeWidth?: string + opacity?: number + margin?: number + dropShadow?: ApexDropShadow + } + dataLabels?: { + show?: boolean + name?: { + show?: boolean + fontFamily?: string + fontWeight?: string | number + fontSize?: string + color?: string + offsetY?: number + } + value?: { + show?: boolean + fontFamily?: string + fontSize?: string + fontWeight?: string | number + color?: string + offsetY?: number + formatter?(val: number): string + } + total?: { + show?: boolean + label?: string + color?: string + fontFamily?: string + fontWeight?: string | number + fontSize?: string + formatter?(opts: any): string + } + } + barLabels?: { + enabled?: boolean + offsetX?: number + offsetY?: number + useSeriesColors?: boolean + fontFamily?: string + fontWeight?: string | number + fontSize?: string + formatter?: (barName: string, opts?: any) => string + onClick?: (barName: string, opts?: any) => void + } + } +} + +type ApexColorStop = { + offset: number + color: string + opacity: number +} + +type ApexFill = { + colors?: any[] + opacity?: number | number[] + type?: string | string[] + gradient?: { + shade?: string + type?: string + shadeIntensity?: number + gradientToColors?: string[] + inverseColors?: boolean + opacityFrom?: number | number[] + opacityTo?: number | number[] + stops?: number[], + colorStops?: ApexColorStop[][] | ApexColorStop[] + } + image?: { + src?: string | string[] + width?: number + height?: number + } + pattern?: { + style?: string | string[] + width?: number + height?: number + strokeWidth?: number + } +} + +/** + * Chart Legend configuration options. + * See https://apexcharts.com/docs/options/legend/ + */ +type ApexLegend = { + show?: boolean + showForSingleSeries?: boolean + showForNullSeries?: boolean + showForZeroSeries?: boolean + floating?: boolean + inverseOrder?: boolean + position?: 'top' | 'right' | 'bottom' | 'left' + horizontalAlign?: 'left' | 'center' | 'right' + fontSize?: string + fontFamily?: string + fontWeight?: string | number + width?: number + height?: number + offsetX?: number + offsetY?: number + formatter?(legendName: string, opts?: any): string + tooltipHoverFormatter?(legendName: string, opts?: any): string + customLegendItems?: string[] + clusterGroupedSeries?: boolean; + clusterGroupedSeriesOrientation?: string; + labels?: { + colors?: string | string[] + useSeriesColors?: boolean + } + markers?: { + size?: number + strokeWidth?: number + fillColors?: string[] + shape?: ApexMarkerShape + offsetX?: number + offsetY?: number + customHTML?(): any + onClick?(): void + } + itemMargin?: { + horizontal?: number + vertical?: number + } + onItemClick?: { + toggleDataSeries?: boolean + } + onItemHover?: { + highlightDataSeries?: boolean + } +} + +type MarkerShapeOptions = "circle" | "square" | "rect" | "line" | 'cross' | 'plus' | 'star' | 'sparkle' | 'diamond' | 'triangle' + +type ApexMarkerShape = MarkerShapeOptions | MarkerShapeOptions[] + +type ApexDiscretePoint = { + seriesIndex?: number + dataPointIndex?: number + fillColor?: string + strokeColor?: string + size?: number + shape?: ApexMarkerShape +} + +type ApexMarkers = { + size?: number | number[] + colors?: string | string[] + strokeColors?: string | string[] + strokeWidth?: number | number[] + strokeOpacity?: number | number[] + strokeDashArray?: number | number[] + fillOpacity?: number | number[] + discrete?: ApexDiscretePoint[] + shape?: ApexMarkerShape + offsetX?: number + offsetY?: number + showNullDataPoints?: boolean + onClick?(e?: any): void + onDblClick?(e?: any): void + hover?: { + size?: number + sizeOffset?: number + } +} + +type ApexNoData = { + text?: string + align?: 'left' | 'right' | 'center' + verticalAlign?: 'top' | 'middle' | 'bottom' + offsetX?: number + offsetY?: number + style?: { + color?: string + fontSize?: string + fontFamily?: string + } +} + +/** + * Chart Datalabels options + * See https://apexcharts.com/docs/options/datalabels/ + */ +type ApexDataLabels = { + enabled?: boolean + enabledOnSeries?: undefined | number[] + textAnchor?: 'start' | 'middle' | 'end' + distributed?: boolean + offsetX?: number + offsetY?: number + style?: { + fontSize?: string + fontFamily?: string + fontWeight?: string | number + colors?: any[] + } + background?: { + enabled?: boolean + foreColor?: string + borderRadius?: number + padding?: number + opacity?: number + borderWidth?: number + borderColor?: string + dropShadow?: ApexDropShadow + } + dropShadow?: ApexDropShadow + formatter?(val: string | number | number[], opts?: any): string | number | (string | string)[] +} + +type ApexResponsive = { + breakpoint?: number + options?: any +} + +type ApexTooltipY = { + title?: { + formatter?(seriesName: string, opts?: any): string + } + formatter?(val: number, opts?: any): string +} + +/** + * Chart Tooltip options + * See https://apexcharts.com/docs/options/tooltip/ + */ +type ApexTooltip = { + enabled?: boolean + enabledOnSeries?: undefined | number[] + shared?: boolean + followCursor?: boolean + intersect?: boolean + inverseOrder?: boolean + custom?: ((options: any) => any) | ((options: any) => any)[] + fillSeriesColor?: boolean + theme?: string + cssClass?: string + hideEmptySeries?: boolean + style?: { + fontSize?: string + fontFamily?: string + } + onDatasetHover?: { + highlightDataSeries?: boolean + } + x?: { + show?: boolean + format?: string + formatter?(val: number, opts?: any): string + } + y?: ApexTooltipY | ApexTooltipY[] + z?: { + title?: string + formatter?(val: number): string + } + marker?: { + show?: boolean + fillColors?: string[] + } + items?: { + display?: string + } + fixed?: { + enabled?: boolean + position?: string // topRight; topLeft; bottomRight; bottomLeft + offsetX?: number + offsetY?: number + } +} + +/** + * X Axis options + * See https://apexcharts.com/docs/options/xaxis/ + */ +type ApexXAxis = { + type?: 'category' | 'datetime' | 'numeric' + categories?: any; + overwriteCategories?: number[] | string[] | undefined; + offsetX?: number; + offsetY?: number; + sorted?: boolean; + labels?: { + show?: boolean + rotate?: number + rotateAlways?: boolean + hideOverlappingLabels?: boolean + showDuplicates?: boolean + trim?: boolean + minHeight?: number + maxHeight?: number + style?: { + colors?: string | string[] + fontSize?: string + fontFamily?: string + fontWeight?: string | number + cssClass?: string + } + offsetX?: number + offsetY?: number + format?: string + formatter?(value: string, timestamp?: number, opts?: any): string | string[] + datetimeUTC?: boolean + datetimeFormatter?: { + year?: string + month?: string + day?: string + hour?: string + minute?: string + second?: string + } + } + group?: { + groups?: { title: string, cols: number }[], + style?: { + colors?: string | string[] + fontSize?: string + fontFamily?: string + fontWeight?: string | number + cssClass?: string + } + } + axisBorder?: { + show?: boolean + color?: string + offsetX?: number + offsetY?: number + strokeWidth?: number + } + axisTicks?: { + show?: boolean + borderType?: string + color?: string + height?: number + offsetX?: number + offsetY?: number + } + tickPlacement?: string + tickAmount?: number | 'dataPoints' + stepSize?: number + min?: number + max?: number + range?: number + floating?: boolean + decimalsInFloat?: number + position?: string + title?: { + text?: string + offsetX?: number + offsetY?: number + style?: { + color?: string + fontFamily?: string + fontWeight?: string | number + fontSize?: string + cssClass?: string + } + } + crosshairs?: { + show?: boolean + width?: number | string + position?: string + opacity?: number + stroke?: { + color?: string + width?: number + dashArray?: number + } + fill?: { + type?: string + color?: string + gradient?: { + colorFrom?: string + colorTo?: string + stops?: number[] + opacityFrom?: number + opacityTo?: number + } + } + dropShadow?: ApexDropShadow + } + tooltip?: { + enabled?: boolean + offsetY?: number + formatter?(value: string, opts?: object): string + style?: { + fontSize?: string + fontFamily?: string + } + } +} + +/** + * Y Axis options + * See https://apexcharts.com/docs/options/yaxis/ + */ + +type ApexYAxis = { + show?: boolean + showAlways?: boolean + showForNullSeries?: boolean + seriesName?: string | string[] + opposite?: boolean + reversed?: boolean + logarithmic?: boolean, + logBase?: number, + tickAmount?: number + stepSize?: number + forceNiceScale?: boolean + min?: number | ((min: number) => number) + max?: number | ((max: number) => number) + floating?: boolean + decimalsInFloat?: number + labels?: { + show?: boolean + showDuplicates?: boolean + minWidth?: number + maxWidth?: number + offsetX?: number + offsetY?: number + rotate?: number + align?: 'left' | 'center' | 'right' + padding?: number + style?: { + colors?: string | string[] + fontSize?: string + fontWeight?: string | number + fontFamily?: string + cssClass?: string + } + formatter?(val: number, opts?: any): string | string[] + } + axisBorder?: { + show?: boolean + color?: string + width?: number + offsetX?: number + offsetY?: number + } + axisTicks?: { + show?: boolean + color?: string + width?: number + offsetX?: number + offsetY?: number + } + title?: { + text?: string + rotate?: number + offsetX?: number + offsetY?: number + style?: { + color?: string + fontSize?: string + fontWeight?: string | number + fontFamily?: string + cssClass?: string + } + } + crosshairs?: { + show?: boolean + position?: string + stroke?: { + color?: string + width?: number + dashArray?: number + } + } + tooltip?: { + enabled?: boolean + offsetX?: number + } +} + +type ApexForecastDataPoints = { + count?: number + fillOpacity?: number + strokeWidth?: undefined | number + dashArray?: number +} + +/** + * Plot X and Y grid options + * See https://apexcharts.com/docs/options/grid/ + */ +type ApexGrid = { + show?: boolean + borderColor?: string + strokeDashArray?: number + position?: 'front' | 'back' + xaxis?: { + lines?: { + show?: boolean + offsetX?: number + offsetY?: number + } + } + yaxis?: { + lines?: { + show?: boolean + offsetX?: number + offsetY?: number + } + } + row?: { + colors?: string[] + opacity?: number + } + column?: { + colors?: string[] + opacity?: number + } + padding?: { + top?: number + right?: number + bottom?: number + left?: number + } +} + +type ApexTheme = { + mode?: 'light' | 'dark' + palette?: string + monochrome?: { + enabled?: boolean + color?: string + shadeTo?: 'light' | 'dark' + shadeIntensity?: number + } +} + +declare module 'apexcharts' { + export = ApexCharts +} diff --git a/node_modules/js-tokens/CHANGELOG.md b/node_modules/js-tokens/CHANGELOG.md new file mode 100644 index 0000000..755e6f6 --- /dev/null +++ b/node_modules/js-tokens/CHANGELOG.md @@ -0,0 +1,151 @@ +### Version 4.0.0 (2018-01-28) ### + +- Added: Support for ES2018. The only change needed was recognizing the `s` + regex flag. +- Changed: _All_ tokens returned by the `matchToToken` function now have a + `closed` property. It is set to `undefined` for the tokens where “closed” + doesn’t make sense. This means that all tokens objects have the same shape, + which might improve performance. + +These are the breaking changes: + +- `'/a/s'.match(jsTokens)` no longer returns `['/', 'a', '/', 's']`, but + `['/a/s']`. (There are of course other variations of this.) +- Code that rely on some token objects not having the `closed` property could + now behave differently. + + +### Version 3.0.2 (2017-06-28) ### + +- No code changes. Just updates to the readme. + + +### Version 3.0.1 (2017-01-30) ### + +- Fixed: ES2015 unicode escapes with more than 6 hex digits are now matched + correctly. + + +### Version 3.0.0 (2017-01-11) ### + +This release contains one breaking change, that should [improve performance in +V8][v8-perf]: + +> So how can you, as a JavaScript developer, ensure that your RegExps are fast? +> If you are not interested in hooking into RegExp internals, make sure that +> neither the RegExp instance, nor its prototype is modified in order to get the +> best performance: +> +> ```js +> var re = /./g; +> re.exec(''); // Fast path. +> re.new_property = 'slow'; +> ``` + +This module used to export a single regex, with `.matchToToken` bolted +on, just like in the above example. This release changes the exports of +the module to avoid this issue. + +Before: + +```js +import jsTokens from "js-tokens" +// or: +var jsTokens = require("js-tokens") +var matchToToken = jsTokens.matchToToken +``` + +After: + +```js +import jsTokens, {matchToToken} from "js-tokens" +// or: +var jsTokens = require("js-tokens").default +var matchToToken = require("js-tokens").matchToToken +``` + +[v8-perf]: http://v8project.blogspot.se/2017/01/speeding-up-v8-regular-expressions.html + + +### Version 2.0.0 (2016-06-19) ### + +- Added: Support for ES2016. In other words, support for the `**` exponentiation + operator. + +These are the breaking changes: + +- `'**'.match(jsTokens)` no longer returns `['*', '*']`, but `['**']`. +- `'**='.match(jsTokens)` no longer returns `['*', '*=']`, but `['**=']`. + + +### Version 1.0.3 (2016-03-27) ### + +- Improved: Made the regex ever so slightly smaller. +- Updated: The readme. + + +### Version 1.0.2 (2015-10-18) ### + +- Improved: Limited npm package contents for a smaller download. Thanks to + @zertosh! + + +### Version 1.0.1 (2015-06-20) ### + +- Fixed: Declared an undeclared variable. + + +### Version 1.0.0 (2015-02-26) ### + +- Changed: Merged the 'operator' and 'punctuation' types into 'punctuator'. That + type is now equivalent to the Punctuator token in the ECMAScript + specification. (Backwards-incompatible change.) +- Fixed: A `-` followed by a number is now correctly matched as a punctuator + followed by a number. It used to be matched as just a number, but there is no + such thing as negative number literals. (Possibly backwards-incompatible + change.) + + +### Version 0.4.1 (2015-02-21) ### + +- Added: Support for the regex `u` flag. + + +### Version 0.4.0 (2015-02-21) ### + +- Improved: `jsTokens.matchToToken` performance. +- Added: Support for octal and binary number literals. +- Added: Support for template strings. + + +### Version 0.3.1 (2015-01-06) ### + +- Fixed: Support for unicode spaces. They used to be allowed in names (which is + very confusing), and some unicode newlines were wrongly allowed in strings and + regexes. + + +### Version 0.3.0 (2014-12-19) ### + +- Changed: The `jsTokens.names` array has been replaced with the + `jsTokens.matchToToken` function. The capturing groups of `jsTokens` are no + longer part of the public API; instead use said function. See this [gist] for + an example. (Backwards-incompatible change.) +- Changed: The empty string is now considered an “invalid” token, instead an + “empty” token (its own group). (Backwards-incompatible change.) +- Removed: component support. (Backwards-incompatible change.) + +[gist]: https://gist.github.com/lydell/be49dbf80c382c473004 + + +### Version 0.2.0 (2014-06-19) ### + +- Changed: Match ES6 function arrows (`=>`) as an operator, instead of its own + category (“functionArrow”), for simplicity. (Backwards-incompatible change.) +- Added: ES6 splats (`...`) are now matched as an operator (instead of three + punctuations). (Backwards-incompatible change.) + + +### Version 0.1.0 (2014-03-08) ### + +- Initial release. diff --git a/node_modules/js-tokens/LICENSE b/node_modules/js-tokens/LICENSE new file mode 100644 index 0000000..54aef52 --- /dev/null +++ b/node_modules/js-tokens/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014, 2015, 2016, 2017, 2018 Simon Lydell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/js-tokens/README.md b/node_modules/js-tokens/README.md new file mode 100644 index 0000000..00cdf16 --- /dev/null +++ b/node_modules/js-tokens/README.md @@ -0,0 +1,240 @@ +Overview [![Build Status](https://travis-ci.org/lydell/js-tokens.svg?branch=master)](https://travis-ci.org/lydell/js-tokens) +======== + +A regex that tokenizes JavaScript. + +```js +var jsTokens = require("js-tokens").default + +var jsString = "var foo=opts.foo;\n..." + +jsString.match(jsTokens) +// ["var", " ", "foo", "=", "opts", ".", "foo", ";", "\n", ...] +``` + + +Installation +============ + +`npm install js-tokens` + +```js +import jsTokens from "js-tokens" +// or: +var jsTokens = require("js-tokens").default +``` + + +Usage +===== + +### `jsTokens` ### + +A regex with the `g` flag that matches JavaScript tokens. + +The regex _always_ matches, even invalid JavaScript and the empty string. + +The next match is always directly after the previous. + +### `var token = matchToToken(match)` ### + +```js +import {matchToToken} from "js-tokens" +// or: +var matchToToken = require("js-tokens").matchToToken +``` + +Takes a `match` returned by `jsTokens.exec(string)`, and returns a `{type: +String, value: String}` object. The following types are available: + +- string +- comment +- regex +- number +- name +- punctuator +- whitespace +- invalid + +Multi-line comments and strings also have a `closed` property indicating if the +token was closed or not (see below). + +Comments and strings both come in several flavors. To distinguish them, check if +the token starts with `//`, `/*`, `'`, `"` or `` ` ``. + +Names are ECMAScript IdentifierNames, that is, including both identifiers and +keywords. You may use [is-keyword-js] to tell them apart. + +Whitespace includes both line terminators and other whitespace. + +[is-keyword-js]: https://github.com/crissdev/is-keyword-js + + +ECMAScript support +================== + +The intention is to always support the latest ECMAScript version whose feature +set has been finalized. + +If adding support for a newer version requires changes, a new version with a +major verion bump will be released. + +Currently, ECMAScript 2018 is supported. + + +Invalid code handling +===================== + +Unterminated strings are still matched as strings. JavaScript strings cannot +contain (unescaped) newlines, so unterminated strings simply end at the end of +the line. Unterminated template strings can contain unescaped newlines, though, +so they go on to the end of input. + +Unterminated multi-line comments are also still matched as comments. They +simply go on to the end of the input. + +Unterminated regex literals are likely matched as division and whatever is +inside the regex. + +Invalid ASCII characters have their own capturing group. + +Invalid non-ASCII characters are treated as names, to simplify the matching of +names (except unicode spaces which are treated as whitespace). Note: See also +the [ES2018](#es2018) section. + +Regex literals may contain invalid regex syntax. They are still matched as +regex literals. They may also contain repeated regex flags, to keep the regex +simple. + +Strings may contain invalid escape sequences. + + +Limitations +=========== + +Tokenizing JavaScript using regexes—in fact, _one single regex_—won’t be +perfect. But that’s not the point either. + +You may compare jsTokens with [esprima] by using `esprima-compare.js`. +See `npm run esprima-compare`! + +[esprima]: http://esprima.org/ + +### Template string interpolation ### + +Template strings are matched as single tokens, from the starting `` ` `` to the +ending `` ` ``, including interpolations (whose tokens are not matched +individually). + +Matching template string interpolations requires recursive balancing of `{` and +`}`—something that JavaScript regexes cannot do. Only one level of nesting is +supported. + +### Division and regex literals collision ### + +Consider this example: + +```js +var g = 9.82 +var number = bar / 2/g + +var regex = / 2/g +``` + +A human can easily understand that in the `number` line we’re dealing with +division, and in the `regex` line we’re dealing with a regex literal. How come? +Because humans can look at the whole code to put the `/` characters in context. +A JavaScript regex cannot. It only sees forwards. (Well, ES2018 regexes can also +look backwards. See the [ES2018](#es2018) section). + +When the `jsTokens` regex scans throught the above, it will see the following +at the end of both the `number` and `regex` rows: + +```js +/ 2/g +``` + +It is then impossible to know if that is a regex literal, or part of an +expression dealing with division. + +Here is a similar case: + +```js +foo /= 2/g +foo(/= 2/g) +``` + +The first line divides the `foo` variable with `2/g`. The second line calls the +`foo` function with the regex literal `/= 2/g`. Again, since `jsTokens` only +sees forwards, it cannot tell the two cases apart. + +There are some cases where we _can_ tell division and regex literals apart, +though. + +First off, we have the simple cases where there’s only one slash in the line: + +```js +var foo = 2/g +foo /= 2 +``` + +Regex literals cannot contain newlines, so the above cases are correctly +identified as division. Things are only problematic when there are more than +one non-comment slash in a single line. + +Secondly, not every character is a valid regex flag. + +```js +var number = bar / 2/e +``` + +The above example is also correctly identified as division, because `e` is not a +valid regex flag. I initially wanted to future-proof by allowing `[a-zA-Z]*` +(any letter) as flags, but it is not worth it since it increases the amount of +ambigous cases. So only the standard `g`, `m`, `i`, `y` and `u` flags are +allowed. This means that the above example will be identified as division as +long as you don’t rename the `e` variable to some permutation of `gmiyus` 1 to 6 +characters long. + +Lastly, we can look _forward_ for information. + +- If the token following what looks like a regex literal is not valid after a + regex literal, but is valid in a division expression, then the regex literal + is treated as division instead. For example, a flagless regex cannot be + followed by a string, number or name, but all of those three can be the + denominator of a division. +- Generally, if what looks like a regex literal is followed by an operator, the + regex literal is treated as division instead. This is because regexes are + seldomly used with operators (such as `+`, `*`, `&&` and `==`), but division + could likely be part of such an expression. + +Please consult the regex source and the test cases for precise information on +when regex or division is matched (should you need to know). In short, you +could sum it up as: + +If the end of a statement looks like a regex literal (even if it isn’t), it +will be treated as one. Otherwise it should work as expected (if you write sane +code). + +### ES2018 ### + +ES2018 added some nice regex improvements to the language. + +- [Unicode property escapes] should allow telling names and invalid non-ASCII + characters apart without blowing up the regex size. +- [Lookbehind assertions] should allow matching telling division and regex + literals apart in more cases. +- [Named capture groups] might simplify some things. + +These things would be nice to do, but are not critical. They probably have to +wait until the oldest maintained Node.js LTS release supports those features. + +[Unicode property escapes]: http://2ality.com/2017/07/regexp-unicode-property-escapes.html +[Lookbehind assertions]: http://2ality.com/2017/05/regexp-lookbehind-assertions.html +[Named capture groups]: http://2ality.com/2017/05/regexp-named-capture-groups.html + + +License +======= + +[MIT](LICENSE). diff --git a/node_modules/js-tokens/index.js b/node_modules/js-tokens/index.js new file mode 100644 index 0000000..b23a4a0 --- /dev/null +++ b/node_modules/js-tokens/index.js @@ -0,0 +1,23 @@ +// Copyright 2014, 2015, 2016, 2017, 2018 Simon Lydell +// License: MIT. (See LICENSE.) + +Object.defineProperty(exports, "__esModule", { + value: true +}) + +// This regex comes from regex.coffee, and is inserted here by generate-index.js +// (run `npm run build`). +exports.default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g + +exports.matchToToken = function(match) { + var token = {type: "invalid", value: match[0], closed: undefined} + if (match[ 1]) token.type = "string" , token.closed = !!(match[3] || match[4]) + else if (match[ 5]) token.type = "comment" + else if (match[ 6]) token.type = "comment", token.closed = !!match[7] + else if (match[ 8]) token.type = "regex" + else if (match[ 9]) token.type = "number" + else if (match[10]) token.type = "name" + else if (match[11]) token.type = "punctuator" + else if (match[12]) token.type = "whitespace" + return token +} diff --git a/node_modules/js-tokens/package.json b/node_modules/js-tokens/package.json new file mode 100644 index 0000000..66752fa --- /dev/null +++ b/node_modules/js-tokens/package.json @@ -0,0 +1,30 @@ +{ + "name": "js-tokens", + "version": "4.0.0", + "author": "Simon Lydell", + "license": "MIT", + "description": "A regex that tokenizes JavaScript.", + "keywords": [ + "JavaScript", + "js", + "token", + "tokenize", + "regex" + ], + "files": [ + "index.js" + ], + "repository": "lydell/js-tokens", + "scripts": { + "test": "mocha --ui tdd", + "esprima-compare": "node esprima-compare ./index.js everything.js/es5.js", + "build": "node generate-index.js", + "dev": "npm run build && npm test" + }, + "devDependencies": { + "coffeescript": "2.1.1", + "esprima": "4.0.0", + "everything.js": "1.0.3", + "mocha": "5.0.0" + } +} diff --git a/node_modules/loose-envify/LICENSE b/node_modules/loose-envify/LICENSE new file mode 100644 index 0000000..fbafb48 --- /dev/null +++ b/node_modules/loose-envify/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Andres Suarez + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/loose-envify/README.md b/node_modules/loose-envify/README.md new file mode 100644 index 0000000..7f4e07b --- /dev/null +++ b/node_modules/loose-envify/README.md @@ -0,0 +1,45 @@ +# loose-envify + +[![Build Status](https://travis-ci.org/zertosh/loose-envify.svg?branch=master)](https://travis-ci.org/zertosh/loose-envify) + +Fast (and loose) selective `process.env` replacer using [js-tokens](https://github.com/lydell/js-tokens) instead of an AST. Works just like [envify](https://github.com/hughsk/envify) but much faster. + +## Gotchas + +* Doesn't handle broken syntax. +* Doesn't look inside embedded expressions in template strings. + - **this won't work:** + ```js + console.log(`the current env is ${process.env.NODE_ENV}`); + ``` +* Doesn't replace oddly-spaced or oddly-commented expressions. + - **this won't work:** + ```js + console.log(process./*won't*/env./*work*/NODE_ENV); + ``` + +## Usage/Options + +loose-envify has the exact same interface as [envify](https://github.com/hughsk/envify), including the CLI. + +## Benchmark + +``` +envify: + + $ for i in {1..5}; do node bench/bench.js 'envify'; done + 708ms + 727ms + 791ms + 719ms + 720ms + +loose-envify: + + $ for i in {1..5}; do node bench/bench.js '../'; done + 51ms + 52ms + 52ms + 52ms + 52ms +``` diff --git a/node_modules/loose-envify/cli.js b/node_modules/loose-envify/cli.js new file mode 100644 index 0000000..c0b63cb --- /dev/null +++ b/node_modules/loose-envify/cli.js @@ -0,0 +1,16 @@ +#!/usr/bin/env node +'use strict'; + +var looseEnvify = require('./'); +var fs = require('fs'); + +if (process.argv[2]) { + fs.createReadStream(process.argv[2], {encoding: 'utf8'}) + .pipe(looseEnvify(process.argv[2])) + .pipe(process.stdout); +} else { + process.stdin.resume() + process.stdin + .pipe(looseEnvify(__filename)) + .pipe(process.stdout); +} diff --git a/node_modules/loose-envify/custom.js b/node_modules/loose-envify/custom.js new file mode 100644 index 0000000..6389bfa --- /dev/null +++ b/node_modules/loose-envify/custom.js @@ -0,0 +1,4 @@ +// envify compatibility +'use strict'; + +module.exports = require('./loose-envify'); diff --git a/node_modules/loose-envify/index.js b/node_modules/loose-envify/index.js new file mode 100644 index 0000000..8cd8305 --- /dev/null +++ b/node_modules/loose-envify/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./loose-envify')(process.env); diff --git a/node_modules/loose-envify/loose-envify.js b/node_modules/loose-envify/loose-envify.js new file mode 100644 index 0000000..b5a5be2 --- /dev/null +++ b/node_modules/loose-envify/loose-envify.js @@ -0,0 +1,36 @@ +'use strict'; + +var stream = require('stream'); +var util = require('util'); +var replace = require('./replace'); + +var jsonExtRe = /\.json$/; + +module.exports = function(rootEnv) { + rootEnv = rootEnv || process.env; + return function (file, trOpts) { + if (jsonExtRe.test(file)) { + return stream.PassThrough(); + } + var envs = trOpts ? [rootEnv, trOpts] : [rootEnv]; + return new LooseEnvify(envs); + }; +}; + +function LooseEnvify(envs) { + stream.Transform.call(this); + this._data = ''; + this._envs = envs; +} +util.inherits(LooseEnvify, stream.Transform); + +LooseEnvify.prototype._transform = function(buf, enc, cb) { + this._data += buf; + cb(); +}; + +LooseEnvify.prototype._flush = function(cb) { + var replaced = replace(this._data, this._envs); + this.push(replaced); + cb(); +}; diff --git a/node_modules/loose-envify/package.json b/node_modules/loose-envify/package.json new file mode 100644 index 0000000..5e3d0e2 --- /dev/null +++ b/node_modules/loose-envify/package.json @@ -0,0 +1,36 @@ +{ + "name": "loose-envify", + "version": "1.4.0", + "description": "Fast (and loose) selective `process.env` replacer using js-tokens instead of an AST", + "keywords": [ + "environment", + "variables", + "browserify", + "browserify-transform", + "transform", + "source", + "configuration" + ], + "homepage": "https://github.com/zertosh/loose-envify", + "license": "MIT", + "author": "Andres Suarez ", + "main": "index.js", + "bin": { + "loose-envify": "cli.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/zertosh/loose-envify.git" + }, + "scripts": { + "test": "tap test/*.js" + }, + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "devDependencies": { + "browserify": "^13.1.1", + "envify": "^3.4.0", + "tap": "^8.0.0" + } +} diff --git a/node_modules/loose-envify/replace.js b/node_modules/loose-envify/replace.js new file mode 100644 index 0000000..ec15e81 --- /dev/null +++ b/node_modules/loose-envify/replace.js @@ -0,0 +1,65 @@ +'use strict'; + +var jsTokens = require('js-tokens').default; + +var processEnvRe = /\bprocess\.env\.[_$a-zA-Z][$\w]+\b/; +var spaceOrCommentRe = /^(?:\s|\/[/*])/; + +function replace(src, envs) { + if (!processEnvRe.test(src)) { + return src; + } + + var out = []; + var purge = envs.some(function(env) { + return env._ && env._.indexOf('purge') !== -1; + }); + + jsTokens.lastIndex = 0 + var parts = src.match(jsTokens); + + for (var i = 0; i < parts.length; i++) { + if (parts[i ] === 'process' && + parts[i + 1] === '.' && + parts[i + 2] === 'env' && + parts[i + 3] === '.') { + var prevCodeToken = getAdjacentCodeToken(-1, parts, i); + var nextCodeToken = getAdjacentCodeToken(1, parts, i + 4); + var replacement = getReplacementString(envs, parts[i + 4], purge); + if (prevCodeToken !== '.' && + nextCodeToken !== '.' && + nextCodeToken !== '=' && + typeof replacement === 'string') { + out.push(replacement); + i += 4; + continue; + } + } + out.push(parts[i]); + } + + return out.join(''); +} + +function getAdjacentCodeToken(dir, parts, i) { + while (true) { + var part = parts[i += dir]; + if (!spaceOrCommentRe.test(part)) { + return part; + } + } +} + +function getReplacementString(envs, name, purge) { + for (var j = 0; j < envs.length; j++) { + var env = envs[j]; + if (typeof env[name] !== 'undefined') { + return JSON.stringify(env[name]); + } + } + if (purge) { + return 'undefined'; + } +} + +module.exports = replace; diff --git a/node_modules/object-assign/index.js b/node_modules/object-assign/index.js new file mode 100644 index 0000000..0930cf8 --- /dev/null +++ b/node_modules/object-assign/index.js @@ -0,0 +1,90 @@ +/* +object-assign +(c) Sindre Sorhus +@license MIT +*/ + +'use strict'; +/* eslint-disable no-unused-vars */ +var getOwnPropertySymbols = Object.getOwnPropertySymbols; +var hasOwnProperty = Object.prototype.hasOwnProperty; +var propIsEnumerable = Object.prototype.propertyIsEnumerable; + +function toObject(val) { + if (val === null || val === undefined) { + throw new TypeError('Object.assign cannot be called with null or undefined'); + } + + return Object(val); +} + +function shouldUseNative() { + try { + if (!Object.assign) { + return false; + } + + // Detect buggy property enumeration order in older V8 versions. + + // https://bugs.chromium.org/p/v8/issues/detail?id=4118 + var test1 = new String('abc'); // eslint-disable-line no-new-wrappers + test1[5] = 'de'; + if (Object.getOwnPropertyNames(test1)[0] === '5') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test2 = {}; + for (var i = 0; i < 10; i++) { + test2['_' + String.fromCharCode(i)] = i; + } + var order2 = Object.getOwnPropertyNames(test2).map(function (n) { + return test2[n]; + }); + if (order2.join('') !== '0123456789') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test3 = {}; + 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { + test3[letter] = letter; + }); + if (Object.keys(Object.assign({}, test3)).join('') !== + 'abcdefghijklmnopqrst') { + return false; + } + + return true; + } catch (err) { + // We don't expect any of the above to throw, but better to be safe. + return false; + } +} + +module.exports = shouldUseNative() ? Object.assign : function (target, source) { + var from; + var to = toObject(target); + var symbols; + + for (var s = 1; s < arguments.length; s++) { + from = Object(arguments[s]); + + for (var key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } + } + + if (getOwnPropertySymbols) { + symbols = getOwnPropertySymbols(from); + for (var i = 0; i < symbols.length; i++) { + if (propIsEnumerable.call(from, symbols[i])) { + to[symbols[i]] = from[symbols[i]]; + } + } + } + } + + return to; +}; diff --git a/node_modules/object-assign/license b/node_modules/object-assign/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/object-assign/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/object-assign/package.json b/node_modules/object-assign/package.json new file mode 100644 index 0000000..503eb1e --- /dev/null +++ b/node_modules/object-assign/package.json @@ -0,0 +1,42 @@ +{ + "name": "object-assign", + "version": "4.1.1", + "description": "ES2015 `Object.assign()` ponyfill", + "license": "MIT", + "repository": "sindresorhus/object-assign", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "xo && ava", + "bench": "matcha bench.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "object", + "assign", + "extend", + "properties", + "es2015", + "ecmascript", + "harmony", + "ponyfill", + "prollyfill", + "polyfill", + "shim", + "browser" + ], + "devDependencies": { + "ava": "^0.16.0", + "lodash": "^4.16.4", + "matcha": "^0.7.0", + "xo": "^0.16.0" + } +} diff --git a/node_modules/object-assign/readme.md b/node_modules/object-assign/readme.md new file mode 100644 index 0000000..1be09d3 --- /dev/null +++ b/node_modules/object-assign/readme.md @@ -0,0 +1,61 @@ +# object-assign [![Build Status](https://travis-ci.org/sindresorhus/object-assign.svg?branch=master)](https://travis-ci.org/sindresorhus/object-assign) + +> ES2015 [`Object.assign()`](http://www.2ality.com/2014/01/object-assign.html) [ponyfill](https://ponyfill.com) + + +## Use the built-in + +Node.js 4 and up, as well as every evergreen browser (Chrome, Edge, Firefox, Opera, Safari), +support `Object.assign()` :tada:. If you target only those environments, then by all +means, use `Object.assign()` instead of this package. + + +## Install + +``` +$ npm install --save object-assign +``` + + +## Usage + +```js +const objectAssign = require('object-assign'); + +objectAssign({foo: 0}, {bar: 1}); +//=> {foo: 0, bar: 1} + +// multiple sources +objectAssign({foo: 0}, {bar: 1}, {baz: 2}); +//=> {foo: 0, bar: 1, baz: 2} + +// overwrites equal keys +objectAssign({foo: 0}, {foo: 1}, {foo: 2}); +//=> {foo: 2} + +// ignores null and undefined sources +objectAssign({foo: 0}, null, {bar: 1}, undefined); +//=> {foo: 0, bar: 1} +``` + + +## API + +### objectAssign(target, [source, ...]) + +Assigns enumerable own properties of `source` objects to the `target` object and returns the `target` object. Additional `source` objects will overwrite previous ones. + + +## Resources + +- [ES2015 spec - Object.assign](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign) + + +## Related + +- [deep-assign](https://github.com/sindresorhus/deep-assign) - Recursive `Object.assign()` + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/prop-types/LICENSE b/node_modules/prop-types/LICENSE new file mode 100644 index 0000000..188fb2b --- /dev/null +++ b/node_modules/prop-types/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2013-present, Facebook, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/prop-types/README.md b/node_modules/prop-types/README.md new file mode 100644 index 0000000..e54d435 --- /dev/null +++ b/node_modules/prop-types/README.md @@ -0,0 +1,302 @@ +# prop-types [![Build Status](https://travis-ci.com/facebook/prop-types.svg?branch=main)](https://travis-ci.org/facebook/prop-types) + +Runtime type checking for React props and similar objects. + +You can use prop-types to document the intended types of properties passed to +components. React (and potentially other libraries—see the `checkPropTypes()` +reference below) will check props passed to your components against those +definitions, and warn in development if they don’t match. + +## Installation + +```shell +npm install --save prop-types +``` + +## Importing + +```js +import PropTypes from 'prop-types'; // ES6 +var PropTypes = require('prop-types'); // ES5 with npm +``` + +### CDN + +If you prefer to exclude `prop-types` from your application and use it +globally via `window.PropTypes`, the `prop-types` package provides +single-file distributions, which are hosted on the following CDNs: + +* [**unpkg**](https://unpkg.com/prop-types/) +```html + + + + + +``` + +* [**cdnjs**](https://cdnjs.com/libraries/prop-types) +```html + + + + + +``` + +To load a specific version of `prop-types` replace `15.6.0` with the version number. + +## Usage + +PropTypes was originally exposed as part of the React core module, and is +commonly used with React components. +Here is an example of using PropTypes with a React component, which also +documents the different validators provided: + +```js +import React from 'react'; +import PropTypes from 'prop-types'; + +class MyComponent extends React.Component { + render() { + // ... do things with the props + } +} + +MyComponent.propTypes = { + // You can declare that a prop is a specific JS primitive. By default, these + // are all optional. + optionalArray: PropTypes.array, + optionalBigInt: PropTypes.bigint, + optionalBool: PropTypes.bool, + optionalFunc: PropTypes.func, + optionalNumber: PropTypes.number, + optionalObject: PropTypes.object, + optionalString: PropTypes.string, + optionalSymbol: PropTypes.symbol, + + // Anything that can be rendered: numbers, strings, elements or an array + // (or fragment) containing these types. + // see https://reactjs.org/docs/rendering-elements.html for more info + optionalNode: PropTypes.node, + + // A React element (ie. ). + optionalElement: PropTypes.element, + + // A React element type (eg. MyComponent). + // a function, string, or "element-like" object (eg. React.Fragment, Suspense, etc.) + // see https://github.com/facebook/react/blob/HEAD/packages/shared/isValidElementType.js + optionalElementType: PropTypes.elementType, + + // You can also declare that a prop is an instance of a class. This uses + // JS's instanceof operator. + optionalMessage: PropTypes.instanceOf(Message), + + // You can ensure that your prop is limited to specific values by treating + // it as an enum. + optionalEnum: PropTypes.oneOf(['News', 'Photos']), + + // An object that could be one of many types + optionalUnion: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.number, + PropTypes.instanceOf(Message) + ]), + + // An array of a certain type + optionalArrayOf: PropTypes.arrayOf(PropTypes.number), + + // An object with property values of a certain type + optionalObjectOf: PropTypes.objectOf(PropTypes.number), + + // You can chain any of the above with `isRequired` to make sure a warning + // is shown if the prop isn't provided. + + // An object taking on a particular shape + optionalObjectWithShape: PropTypes.shape({ + optionalProperty: PropTypes.string, + requiredProperty: PropTypes.number.isRequired + }), + + // An object with warnings on extra properties + optionalObjectWithStrictShape: PropTypes.exact({ + optionalProperty: PropTypes.string, + requiredProperty: PropTypes.number.isRequired + }), + + requiredFunc: PropTypes.func.isRequired, + + // A value of any data type + requiredAny: PropTypes.any.isRequired, + + // You can also specify a custom validator. It should return an Error + // object if the validation fails. Don't `console.warn` or throw, as this + // won't work inside `oneOfType`. + customProp: function(props, propName, componentName) { + if (!/matchme/.test(props[propName])) { + return new Error( + 'Invalid prop `' + propName + '` supplied to' + + ' `' + componentName + '`. Validation failed.' + ); + } + }, + + // You can also supply a custom validator to `arrayOf` and `objectOf`. + // It should return an Error object if the validation fails. The validator + // will be called for each key in the array or object. The first two + // arguments of the validator are the array or object itself, and the + // current item's key. + customArrayProp: PropTypes.arrayOf(function(propValue, key, componentName, location, propFullName) { + if (!/matchme/.test(propValue[key])) { + return new Error( + 'Invalid prop `' + propFullName + '` supplied to' + + ' `' + componentName + '`. Validation failed.' + ); + } + }) +}; +``` + +Refer to the [React documentation](https://facebook.github.io/react/docs/typechecking-with-proptypes.html) for more information. + +## Migrating from React.PropTypes + +Check out [Migrating from React.PropTypes](https://facebook.github.io/react/blog/2017/04/07/react-v15.5.0.html#migrating-from-react.proptypes) for details on how to migrate to `prop-types` from `React.PropTypes`. + +Note that this blog posts **mentions a codemod script that performs the conversion automatically**. + +There are also important notes below. + +## How to Depend on This Package? + +For apps, we recommend putting it in `dependencies` with a caret range. +For example: + +```js + "dependencies": { + "prop-types": "^15.5.7" + } +``` + +For libraries, we *also* recommend leaving it in `dependencies`: + +```js + "dependencies": { + "prop-types": "^15.5.7" + }, + "peerDependencies": { + "react": "^15.5.0" + } +``` + +**Note:** there are known issues in versions before 15.5.7 so we recommend using it as the minimal version. + +Make sure that the version range uses a caret (`^`) and thus is broad enough for npm to efficiently deduplicate packages. + +For UMD bundles of your components, make sure you **don’t** include `PropTypes` in the build. Usually this is done by marking it as an external (the specifics depend on your bundler), just like you do with React. + +## Compatibility + +### React 0.14 + +This package is compatible with **React 0.14.9**. Compared to 0.14.8 (which was released in March of 2016), there are no other changes in 0.14.9, so it should be a painless upgrade. + +```shell +# ATTENTION: Only run this if you still use React 0.14! +npm install --save react@^0.14.9 react-dom@^0.14.9 +``` + +### React 15+ + +This package is compatible with **React 15.3.0** and higher. + +``` +npm install --save react@^15.3.0 react-dom@^15.3.0 +``` + +### What happens on other React versions? + +It outputs warnings with the message below even though the developer doesn’t do anything wrong. Unfortunately there is no solution for this other than updating React to either 15.3.0 or higher, or 0.14.9 if you’re using React 0.14. + +## Difference from `React.PropTypes`: Don’t Call Validator Functions + +First of all, **which version of React are you using**? You might be seeing this message because a component library has updated to use `prop-types` package, but your version of React is incompatible with it. See the [above section](#compatibility) for more details. + +Are you using either React 0.14.9 or a version higher than React 15.3.0? Read on. + +When you migrate components to use the standalone `prop-types`, **all validator functions will start throwing an error if you call them directly**. This makes sure that nobody relies on them in production code, and it is safe to strip their implementations to optimize the bundle size. + +Code like this is still fine: + +```js +MyComponent.propTypes = { + myProp: PropTypes.bool +}; +``` + +However, code like this will not work with the `prop-types` package: + +```js +// Will not work with `prop-types` package! +var errorOrNull = PropTypes.bool(42, 'myProp', 'MyComponent', 'prop'); +``` + +It will throw an error: + +``` +Calling PropTypes validators directly is not supported by the `prop-types` package. +Use PropTypes.checkPropTypes() to call them. +``` + +(If you see **a warning** rather than an error with this message, please check the [above section about compatibility](#compatibility).) + +This is new behavior, and you will only encounter it when you migrate from `React.PropTypes` to the `prop-types` package. For the vast majority of components, this doesn’t matter, and if you didn’t see [this warning](https://facebook.github.io/react/warnings/dont-call-proptypes.html) in your components, your code is safe to migrate. This is not a breaking change in React because you are only opting into this change for a component by explicitly changing your imports to use `prop-types`. If you temporarily need the old behavior, you can keep using `React.PropTypes` until React 16. + +**If you absolutely need to trigger the validation manually**, call `PropTypes.checkPropTypes()`. Unlike the validators themselves, this function is safe to call in production, as it will be replaced by an empty function: + +```js +// Works with standalone PropTypes +PropTypes.checkPropTypes(MyComponent.propTypes, props, 'prop', 'MyComponent'); +``` +See below for more info. + +**If you DO want to use validation in production**, you can choose to use the **development version** by importing/requiring `prop-types/prop-types` instead of `prop-types`. + +**You might also see this error** if you’re calling a `PropTypes` validator from your own custom `PropTypes` validator. In this case, the fix is to make sure that you are passing *all* of the arguments to the inner function. There is a more in-depth explanation of how to fix it [on this page](https://facebook.github.io/react/warnings/dont-call-proptypes.html#fixing-the-false-positive-in-third-party-proptypes). Alternatively, you can temporarily keep using `React.PropTypes` until React 16, as it would still only warn in this case. + +If you use a bundler like Browserify or Webpack, don’t forget to [follow these instructions](https://reactjs.org/docs/optimizing-performance.html#use-the-production-build) to correctly bundle your application in development or production mode. Otherwise you’ll ship unnecessary code to your users. + +## PropTypes.checkPropTypes + +React will automatically check the propTypes you set on the component, but if +you are using PropTypes without React then you may want to manually call +`PropTypes.checkPropTypes`, like so: + +```js +const myPropTypes = { + name: PropTypes.string, + age: PropTypes.number, + // ... define your prop validations +}; + +const props = { + name: 'hello', // is valid + age: 'world', // not valid +}; + +// Let's say your component is called 'MyComponent' + +// Works with standalone PropTypes +PropTypes.checkPropTypes(myPropTypes, props, 'prop', 'MyComponent'); +// This will warn as follows: +// Warning: Failed prop type: Invalid prop `age` of type `string` supplied to +// `MyComponent`, expected `number`. +``` + +## PropTypes.resetWarningCache() + +`PropTypes.checkPropTypes(...)` only `console.error`s a given message once. To reset the error warning cache in tests, call `PropTypes.resetWarningCache()` + +### License + +prop-types is [MIT licensed](./LICENSE). diff --git a/node_modules/prop-types/checkPropTypes.js b/node_modules/prop-types/checkPropTypes.js new file mode 100644 index 0000000..481f2cf --- /dev/null +++ b/node_modules/prop-types/checkPropTypes.js @@ -0,0 +1,103 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +var printWarning = function() {}; + +if (process.env.NODE_ENV !== 'production') { + var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); + var loggedTypeFailures = {}; + var has = require('./lib/has'); + + printWarning = function(text) { + var message = 'Warning: ' + text; + if (typeof console !== 'undefined') { + console.error(message); + } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) { /**/ } + }; +} + +/** + * Assert that the values match with the type specs. + * Error messages are memorized and will only be shown once. + * + * @param {object} typeSpecs Map of name to a ReactPropType + * @param {object} values Runtime values that need to be type-checked + * @param {string} location e.g. "prop", "context", "child context" + * @param {string} componentName Name of the component for error messages. + * @param {?Function} getStack Returns the component stack. + * @private + */ +function checkPropTypes(typeSpecs, values, location, componentName, getStack) { + if (process.env.NODE_ENV !== 'production') { + for (var typeSpecName in typeSpecs) { + if (has(typeSpecs, typeSpecName)) { + var error; + // Prop type validation may throw. In case they do, we don't want to + // fail the render phase where it didn't fail before. So we log it. + // After these have been cleaned up, we'll let them throw. + try { + // This is intentionally an invariant that gets caught. It's the same + // behavior as without this statement except with a better message. + if (typeof typeSpecs[typeSpecName] !== 'function') { + var err = Error( + (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.' + ); + err.name = 'Invariant Violation'; + throw err; + } + error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); + } catch (ex) { + error = ex; + } + if (error && !(error instanceof Error)) { + printWarning( + (componentName || 'React class') + ': type specification of ' + + location + ' `' + typeSpecName + '` is invalid; the type checker ' + + 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' + + 'You may have forgotten to pass an argument to the type checker ' + + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + + 'shape all require an argument).' + ); + } + if (error instanceof Error && !(error.message in loggedTypeFailures)) { + // Only monitor this failure once because there tends to be a lot of the + // same error. + loggedTypeFailures[error.message] = true; + + var stack = getStack ? getStack() : ''; + + printWarning( + 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '') + ); + } + } + } + } +} + +/** + * Resets warning cache when testing. + * + * @private + */ +checkPropTypes.resetWarningCache = function() { + if (process.env.NODE_ENV !== 'production') { + loggedTypeFailures = {}; + } +} + +module.exports = checkPropTypes; diff --git a/node_modules/prop-types/factory.js b/node_modules/prop-types/factory.js new file mode 100644 index 0000000..abdf8e6 --- /dev/null +++ b/node_modules/prop-types/factory.js @@ -0,0 +1,19 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +// React 15.5 references this module, and assumes PropTypes are still callable in production. +// Therefore we re-export development-only version with all the PropTypes checks here. +// However if one is migrating to the `prop-types` npm library, they will go through the +// `index.js` entry point, and it will branch depending on the environment. +var factory = require('./factoryWithTypeCheckers'); +module.exports = function(isValidElement) { + // It is still allowed in 15.5. + var throwOnDirectAccess = false; + return factory(isValidElement, throwOnDirectAccess); +}; diff --git a/node_modules/prop-types/factoryWithThrowingShims.js b/node_modules/prop-types/factoryWithThrowingShims.js new file mode 100644 index 0000000..ac88267 --- /dev/null +++ b/node_modules/prop-types/factoryWithThrowingShims.js @@ -0,0 +1,65 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); + +function emptyFunction() {} +function emptyFunctionWithReset() {} +emptyFunctionWithReset.resetWarningCache = emptyFunction; + +module.exports = function() { + function shim(props, propName, componentName, location, propFullName, secret) { + if (secret === ReactPropTypesSecret) { + // It is still safe when called from React. + return; + } + var err = new Error( + 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + + 'Use PropTypes.checkPropTypes() to call them. ' + + 'Read more at http://fb.me/use-check-prop-types' + ); + err.name = 'Invariant Violation'; + throw err; + }; + shim.isRequired = shim; + function getShim() { + return shim; + }; + // Important! + // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. + var ReactPropTypes = { + array: shim, + bigint: shim, + bool: shim, + func: shim, + number: shim, + object: shim, + string: shim, + symbol: shim, + + any: shim, + arrayOf: getShim, + element: shim, + elementType: shim, + instanceOf: getShim, + node: shim, + objectOf: getShim, + oneOf: getShim, + oneOfType: getShim, + shape: getShim, + exact: getShim, + + checkPropTypes: emptyFunctionWithReset, + resetWarningCache: emptyFunction + }; + + ReactPropTypes.PropTypes = ReactPropTypes; + + return ReactPropTypes; +}; diff --git a/node_modules/prop-types/factoryWithTypeCheckers.js b/node_modules/prop-types/factoryWithTypeCheckers.js new file mode 100644 index 0000000..a88068e --- /dev/null +++ b/node_modules/prop-types/factoryWithTypeCheckers.js @@ -0,0 +1,610 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +var ReactIs = require('react-is'); +var assign = require('object-assign'); + +var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); +var has = require('./lib/has'); +var checkPropTypes = require('./checkPropTypes'); + +var printWarning = function() {}; + +if (process.env.NODE_ENV !== 'production') { + printWarning = function(text) { + var message = 'Warning: ' + text; + if (typeof console !== 'undefined') { + console.error(message); + } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} + }; +} + +function emptyFunctionThatReturnsNull() { + return null; +} + +module.exports = function(isValidElement, throwOnDirectAccess) { + /* global Symbol */ + var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; + var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. + + /** + * Returns the iterator method function contained on the iterable object. + * + * Be sure to invoke the function with the iterable as context: + * + * var iteratorFn = getIteratorFn(myIterable); + * if (iteratorFn) { + * var iterator = iteratorFn.call(myIterable); + * ... + * } + * + * @param {?object} maybeIterable + * @return {?function} + */ + function getIteratorFn(maybeIterable) { + var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); + if (typeof iteratorFn === 'function') { + return iteratorFn; + } + } + + /** + * Collection of methods that allow declaration and validation of props that are + * supplied to React components. Example usage: + * + * var Props = require('ReactPropTypes'); + * var MyArticle = React.createClass({ + * propTypes: { + * // An optional string prop named "description". + * description: Props.string, + * + * // A required enum prop named "category". + * category: Props.oneOf(['News','Photos']).isRequired, + * + * // A prop named "dialog" that requires an instance of Dialog. + * dialog: Props.instanceOf(Dialog).isRequired + * }, + * render: function() { ... } + * }); + * + * A more formal specification of how these methods are used: + * + * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) + * decl := ReactPropTypes.{type}(.isRequired)? + * + * Each and every declaration produces a function with the same signature. This + * allows the creation of custom validation functions. For example: + * + * var MyLink = React.createClass({ + * propTypes: { + * // An optional string or URI prop named "href". + * href: function(props, propName, componentName) { + * var propValue = props[propName]; + * if (propValue != null && typeof propValue !== 'string' && + * !(propValue instanceof URI)) { + * return new Error( + * 'Expected a string or an URI for ' + propName + ' in ' + + * componentName + * ); + * } + * } + * }, + * render: function() {...} + * }); + * + * @internal + */ + + var ANONYMOUS = '<>'; + + // Important! + // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. + var ReactPropTypes = { + array: createPrimitiveTypeChecker('array'), + bigint: createPrimitiveTypeChecker('bigint'), + bool: createPrimitiveTypeChecker('boolean'), + func: createPrimitiveTypeChecker('function'), + number: createPrimitiveTypeChecker('number'), + object: createPrimitiveTypeChecker('object'), + string: createPrimitiveTypeChecker('string'), + symbol: createPrimitiveTypeChecker('symbol'), + + any: createAnyTypeChecker(), + arrayOf: createArrayOfTypeChecker, + element: createElementTypeChecker(), + elementType: createElementTypeTypeChecker(), + instanceOf: createInstanceTypeChecker, + node: createNodeChecker(), + objectOf: createObjectOfTypeChecker, + oneOf: createEnumTypeChecker, + oneOfType: createUnionTypeChecker, + shape: createShapeTypeChecker, + exact: createStrictShapeTypeChecker, + }; + + /** + * inlined Object.is polyfill to avoid requiring consumers ship their own + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is + */ + /*eslint-disable no-self-compare*/ + function is(x, y) { + // SameValue algorithm + if (x === y) { + // Steps 1-5, 7-10 + // Steps 6.b-6.e: +0 != -0 + return x !== 0 || 1 / x === 1 / y; + } else { + // Step 6.a: NaN == NaN + return x !== x && y !== y; + } + } + /*eslint-enable no-self-compare*/ + + /** + * We use an Error-like object for backward compatibility as people may call + * PropTypes directly and inspect their output. However, we don't use real + * Errors anymore. We don't inspect their stack anyway, and creating them + * is prohibitively expensive if they are created too often, such as what + * happens in oneOfType() for any type before the one that matched. + */ + function PropTypeError(message, data) { + this.message = message; + this.data = data && typeof data === 'object' ? data: {}; + this.stack = ''; + } + // Make `instanceof Error` still work for returned errors. + PropTypeError.prototype = Error.prototype; + + function createChainableTypeChecker(validate) { + if (process.env.NODE_ENV !== 'production') { + var manualPropTypeCallCache = {}; + var manualPropTypeWarningCount = 0; + } + function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { + componentName = componentName || ANONYMOUS; + propFullName = propFullName || propName; + + if (secret !== ReactPropTypesSecret) { + if (throwOnDirectAccess) { + // New behavior only for users of `prop-types` package + var err = new Error( + 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + + 'Use `PropTypes.checkPropTypes()` to call them. ' + + 'Read more at http://fb.me/use-check-prop-types' + ); + err.name = 'Invariant Violation'; + throw err; + } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') { + // Old behavior for people using React.PropTypes + var cacheKey = componentName + ':' + propName; + if ( + !manualPropTypeCallCache[cacheKey] && + // Avoid spamming the console because they are often not actionable except for lib authors + manualPropTypeWarningCount < 3 + ) { + printWarning( + 'You are manually calling a React.PropTypes validation ' + + 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' + + 'and will throw in the standalone `prop-types` package. ' + + 'You may be seeing this warning due to a third-party PropTypes ' + + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.' + ); + manualPropTypeCallCache[cacheKey] = true; + manualPropTypeWarningCount++; + } + } + } + if (props[propName] == null) { + if (isRequired) { + if (props[propName] === null) { + return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); + } + return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); + } + return null; + } else { + return validate(props, propName, componentName, location, propFullName); + } + } + + var chainedCheckType = checkType.bind(null, false); + chainedCheckType.isRequired = checkType.bind(null, true); + + return chainedCheckType; + } + + function createPrimitiveTypeChecker(expectedType) { + function validate(props, propName, componentName, location, propFullName, secret) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== expectedType) { + // `propValue` being instance of, say, date/regexp, pass the 'object' + // check, but we can offer a more precise error message here rather than + // 'of type `object`'. + var preciseType = getPreciseType(propValue); + + return new PropTypeError( + 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'), + {expectedType: expectedType} + ); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createAnyTypeChecker() { + return createChainableTypeChecker(emptyFunctionThatReturnsNull); + } + + function createArrayOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); + } + var propValue = props[propName]; + if (!Array.isArray(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); + } + for (var i = 0; i < propValue.length; i++) { + var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret); + if (error instanceof Error) { + return error; + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createElementTypeChecker() { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + if (!isValidElement(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createElementTypeTypeChecker() { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + if (!ReactIs.isValidElementType(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createInstanceTypeChecker(expectedClass) { + function validate(props, propName, componentName, location, propFullName) { + if (!(props[propName] instanceof expectedClass)) { + var expectedClassName = expectedClass.name || ANONYMOUS; + var actualClassName = getClassName(props[propName]); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createEnumTypeChecker(expectedValues) { + if (!Array.isArray(expectedValues)) { + if (process.env.NODE_ENV !== 'production') { + if (arguments.length > 1) { + printWarning( + 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' + + 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).' + ); + } else { + printWarning('Invalid argument supplied to oneOf, expected an array.'); + } + } + return emptyFunctionThatReturnsNull; + } + + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + for (var i = 0; i < expectedValues.length; i++) { + if (is(propValue, expectedValues[i])) { + return null; + } + } + + var valuesString = JSON.stringify(expectedValues, function replacer(key, value) { + var type = getPreciseType(value); + if (type === 'symbol') { + return String(value); + } + return value; + }); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); + } + return createChainableTypeChecker(validate); + } + + function createObjectOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); + } + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); + } + for (var key in propValue) { + if (has(propValue, key)) { + var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error instanceof Error) { + return error; + } + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createUnionTypeChecker(arrayOfTypeCheckers) { + if (!Array.isArray(arrayOfTypeCheckers)) { + process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; + return emptyFunctionThatReturnsNull; + } + + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + if (typeof checker !== 'function') { + printWarning( + 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + + 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.' + ); + return emptyFunctionThatReturnsNull; + } + } + + function validate(props, propName, componentName, location, propFullName) { + var expectedTypes = []; + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret); + if (checkerResult == null) { + return null; + } + if (checkerResult.data && has(checkerResult.data, 'expectedType')) { + expectedTypes.push(checkerResult.data.expectedType); + } + } + var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': ''; + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.')); + } + return createChainableTypeChecker(validate); + } + + function createNodeChecker() { + function validate(props, propName, componentName, location, propFullName) { + if (!isNode(props[propName])) { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function invalidValidatorError(componentName, location, propFullName, key, type) { + return new PropTypeError( + (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' + + 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.' + ); + } + + function createShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + for (var key in shapeTypes) { + var checker = shapeTypes[key]; + if (typeof checker !== 'function') { + return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker)); + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error) { + return error; + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createStrictShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + // We need to check all keys in case some are required but missing from props. + var allKeys = assign({}, props[propName], shapeTypes); + for (var key in allKeys) { + var checker = shapeTypes[key]; + if (has(shapeTypes, key) && typeof checker !== 'function') { + return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker)); + } + if (!checker) { + return new PropTypeError( + 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + + '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + + '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') + ); + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error) { + return error; + } + } + return null; + } + + return createChainableTypeChecker(validate); + } + + function isNode(propValue) { + switch (typeof propValue) { + case 'number': + case 'string': + case 'undefined': + return true; + case 'boolean': + return !propValue; + case 'object': + if (Array.isArray(propValue)) { + return propValue.every(isNode); + } + if (propValue === null || isValidElement(propValue)) { + return true; + } + + var iteratorFn = getIteratorFn(propValue); + if (iteratorFn) { + var iterator = iteratorFn.call(propValue); + var step; + if (iteratorFn !== propValue.entries) { + while (!(step = iterator.next()).done) { + if (!isNode(step.value)) { + return false; + } + } + } else { + // Iterator will provide entry [k,v] tuples rather than values. + while (!(step = iterator.next()).done) { + var entry = step.value; + if (entry) { + if (!isNode(entry[1])) { + return false; + } + } + } + } + } else { + return false; + } + + return true; + default: + return false; + } + } + + function isSymbol(propType, propValue) { + // Native Symbol. + if (propType === 'symbol') { + return true; + } + + // falsy value can't be a Symbol + if (!propValue) { + return false; + } + + // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' + if (propValue['@@toStringTag'] === 'Symbol') { + return true; + } + + // Fallback for non-spec compliant Symbols which are polyfilled. + if (typeof Symbol === 'function' && propValue instanceof Symbol) { + return true; + } + + return false; + } + + // Equivalent of `typeof` but with special handling for array and regexp. + function getPropType(propValue) { + var propType = typeof propValue; + if (Array.isArray(propValue)) { + return 'array'; + } + if (propValue instanceof RegExp) { + // Old webkits (at least until Android 4.0) return 'function' rather than + // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ + // passes PropTypes.object. + return 'object'; + } + if (isSymbol(propType, propValue)) { + return 'symbol'; + } + return propType; + } + + // This handles more types than `getPropType`. Only used for error messages. + // See `createPrimitiveTypeChecker`. + function getPreciseType(propValue) { + if (typeof propValue === 'undefined' || propValue === null) { + return '' + propValue; + } + var propType = getPropType(propValue); + if (propType === 'object') { + if (propValue instanceof Date) { + return 'date'; + } else if (propValue instanceof RegExp) { + return 'regexp'; + } + } + return propType; + } + + // Returns a string that is postfixed to a warning about an invalid type. + // For example, "undefined" or "of type array" + function getPostfixForTypeWarning(value) { + var type = getPreciseType(value); + switch (type) { + case 'array': + case 'object': + return 'an ' + type; + case 'boolean': + case 'date': + case 'regexp': + return 'a ' + type; + default: + return type; + } + } + + // Returns class name of the object, if any. + function getClassName(propValue) { + if (!propValue.constructor || !propValue.constructor.name) { + return ANONYMOUS; + } + return propValue.constructor.name; + } + + ReactPropTypes.checkPropTypes = checkPropTypes; + ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache; + ReactPropTypes.PropTypes = ReactPropTypes; + + return ReactPropTypes; +}; diff --git a/node_modules/prop-types/index.js b/node_modules/prop-types/index.js new file mode 100644 index 0000000..e9ef51d --- /dev/null +++ b/node_modules/prop-types/index.js @@ -0,0 +1,19 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +if (process.env.NODE_ENV !== 'production') { + var ReactIs = require('react-is'); + + // By explicitly using `prop-types` you are opting into new development behavior. + // http://fb.me/prop-types-in-prod + var throwOnDirectAccess = true; + module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess); +} else { + // By explicitly using `prop-types` you are opting into new production behavior. + // http://fb.me/prop-types-in-prod + module.exports = require('./factoryWithThrowingShims')(); +} diff --git a/node_modules/prop-types/lib/ReactPropTypesSecret.js b/node_modules/prop-types/lib/ReactPropTypesSecret.js new file mode 100644 index 0000000..f54525e --- /dev/null +++ b/node_modules/prop-types/lib/ReactPropTypesSecret.js @@ -0,0 +1,12 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; + +module.exports = ReactPropTypesSecret; diff --git a/node_modules/prop-types/lib/has.js b/node_modules/prop-types/lib/has.js new file mode 100644 index 0000000..007bae3 --- /dev/null +++ b/node_modules/prop-types/lib/has.js @@ -0,0 +1 @@ +module.exports = Function.call.bind(Object.prototype.hasOwnProperty); diff --git a/node_modules/prop-types/package.json b/node_modules/prop-types/package.json new file mode 100644 index 0000000..63daf70 --- /dev/null +++ b/node_modules/prop-types/package.json @@ -0,0 +1,60 @@ +{ + "name": "prop-types", + "version": "15.8.1", + "description": "Runtime type checking for React props and similar objects.", + "sideEffects": false, + "main": "index.js", + "license": "MIT", + "files": [ + "LICENSE", + "README.md", + "checkPropTypes.js", + "factory.js", + "factoryWithThrowingShims.js", + "factoryWithTypeCheckers.js", + "index.js", + "prop-types.js", + "prop-types.min.js", + "lib" + ], + "repository": "facebook/prop-types", + "keywords": [ + "react" + ], + "bugs": { + "url": "https://github.com/facebook/prop-types/issues" + }, + "homepage": "https://facebook.github.io/react/", + "dependencies": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + }, + "scripts": { + "pretest": "npm run lint", + "lint": "eslint .", + "test": "npm run tests-only", + "tests-only": "jest", + "umd": "NODE_ENV=development browserify index.js -t loose-envify --standalone PropTypes -o prop-types.js", + "umd-min": "NODE_ENV=production browserify index.js -t loose-envify -t uglifyify --standalone PropTypes -p bundle-collapser/plugin -o | uglifyjs --compress unused,dead_code -o prop-types.min.js", + "build": "yarn umd && yarn umd-min", + "prepublish": "not-in-publish || yarn build" + }, + "devDependencies": { + "babel-jest": "^19.0.0", + "babel-preset-react": "^6.24.1", + "browserify": "^16.5.0", + "bundle-collapser": "^1.4.0", + "eslint": "^8.6.0", + "in-publish": "^2.0.1", + "jest": "^19.0.2", + "react": "^15.7.0", + "uglifyify": "^5.0.2", + "uglifyjs": "^2.4.11" + }, + "browserify": { + "transform": [ + "loose-envify" + ] + } +} diff --git a/node_modules/prop-types/prop-types.js b/node_modules/prop-types/prop-types.js new file mode 100644 index 0000000..a5a15dd --- /dev/null +++ b/node_modules/prop-types/prop-types.js @@ -0,0 +1,1315 @@ +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.PropTypes = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i 1) { + printWarning( + 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' + + 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).' + ); + } else { + printWarning('Invalid argument supplied to oneOf, expected an array.'); + } + } + return emptyFunctionThatReturnsNull; + } + + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + for (var i = 0; i < expectedValues.length; i++) { + if (is(propValue, expectedValues[i])) { + return null; + } + } + + var valuesString = JSON.stringify(expectedValues, function replacer(key, value) { + var type = getPreciseType(value); + if (type === 'symbol') { + return String(value); + } + return value; + }); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); + } + return createChainableTypeChecker(validate); + } + + function createObjectOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); + } + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); + } + for (var key in propValue) { + if (has(propValue, key)) { + var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error instanceof Error) { + return error; + } + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createUnionTypeChecker(arrayOfTypeCheckers) { + if (!Array.isArray(arrayOfTypeCheckers)) { + "development" !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; + return emptyFunctionThatReturnsNull; + } + + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + if (typeof checker !== 'function') { + printWarning( + 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + + 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.' + ); + return emptyFunctionThatReturnsNull; + } + } + + function validate(props, propName, componentName, location, propFullName) { + var expectedTypes = []; + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret); + if (checkerResult == null) { + return null; + } + if (checkerResult.data.hasOwnProperty('expectedType')) { + expectedTypes.push(checkerResult.data.expectedType); + } + } + var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': ''; + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.')); + } + return createChainableTypeChecker(validate); + } + + function createNodeChecker() { + function validate(props, propName, componentName, location, propFullName) { + if (!isNode(props[propName])) { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function invalidValidatorError(componentName, location, propFullName, key, type) { + return new PropTypeError( + (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' + + 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.' + ); + } + + function createShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + for (var key in shapeTypes) { + var checker = shapeTypes[key]; + if (typeof checker !== 'function') { + return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker)); + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error) { + return error; + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createStrictShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + // We need to check all keys in case some are required but missing from props. + var allKeys = assign({}, props[propName], shapeTypes); + for (var key in allKeys) { + var checker = shapeTypes[key]; + if (has(shapeTypes, key) && typeof checker !== 'function') { + return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker)); + } + if (!checker) { + return new PropTypeError( + 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + + '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + + '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') + ); + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error) { + return error; + } + } + return null; + } + + return createChainableTypeChecker(validate); + } + + function isNode(propValue) { + switch (typeof propValue) { + case 'number': + case 'string': + case 'undefined': + return true; + case 'boolean': + return !propValue; + case 'object': + if (Array.isArray(propValue)) { + return propValue.every(isNode); + } + if (propValue === null || isValidElement(propValue)) { + return true; + } + + var iteratorFn = getIteratorFn(propValue); + if (iteratorFn) { + var iterator = iteratorFn.call(propValue); + var step; + if (iteratorFn !== propValue.entries) { + while (!(step = iterator.next()).done) { + if (!isNode(step.value)) { + return false; + } + } + } else { + // Iterator will provide entry [k,v] tuples rather than values. + while (!(step = iterator.next()).done) { + var entry = step.value; + if (entry) { + if (!isNode(entry[1])) { + return false; + } + } + } + } + } else { + return false; + } + + return true; + default: + return false; + } + } + + function isSymbol(propType, propValue) { + // Native Symbol. + if (propType === 'symbol') { + return true; + } + + // falsy value can't be a Symbol + if (!propValue) { + return false; + } + + // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' + if (propValue['@@toStringTag'] === 'Symbol') { + return true; + } + + // Fallback for non-spec compliant Symbols which are polyfilled. + if (typeof Symbol === 'function' && propValue instanceof Symbol) { + return true; + } + + return false; + } + + // Equivalent of `typeof` but with special handling for array and regexp. + function getPropType(propValue) { + var propType = typeof propValue; + if (Array.isArray(propValue)) { + return 'array'; + } + if (propValue instanceof RegExp) { + // Old webkits (at least until Android 4.0) return 'function' rather than + // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ + // passes PropTypes.object. + return 'object'; + } + if (isSymbol(propType, propValue)) { + return 'symbol'; + } + return propType; + } + + // This handles more types than `getPropType`. Only used for error messages. + // See `createPrimitiveTypeChecker`. + function getPreciseType(propValue) { + if (typeof propValue === 'undefined' || propValue === null) { + return '' + propValue; + } + var propType = getPropType(propValue); + if (propType === 'object') { + if (propValue instanceof Date) { + return 'date'; + } else if (propValue instanceof RegExp) { + return 'regexp'; + } + } + return propType; + } + + // Returns a string that is postfixed to a warning about an invalid type. + // For example, "undefined" or "of type array" + function getPostfixForTypeWarning(value) { + var type = getPreciseType(value); + switch (type) { + case 'array': + case 'object': + return 'an ' + type; + case 'boolean': + case 'date': + case 'regexp': + return 'a ' + type; + default: + return type; + } + } + + // Returns class name of the object, if any. + function getClassName(propValue) { + if (!propValue.constructor || !propValue.constructor.name) { + return ANONYMOUS; + } + return propValue.constructor.name; + } + + ReactPropTypes.checkPropTypes = checkPropTypes; + ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache; + ReactPropTypes.PropTypes = ReactPropTypes; + + return ReactPropTypes; +}; + +},{"./checkPropTypes":1,"./lib/ReactPropTypesSecret":5,"./lib/has":6,"object-assign":7,"react-is":11}],4:[function(require,module,exports){ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +if ("development" !== 'production') { + var ReactIs = require('react-is'); + + // By explicitly using `prop-types` you are opting into new development behavior. + // http://fb.me/prop-types-in-prod + var throwOnDirectAccess = true; + module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess); +} else { + // By explicitly using `prop-types` you are opting into new production behavior. + // http://fb.me/prop-types-in-prod + module.exports = require('./factoryWithThrowingShims')(); +} + +},{"./factoryWithThrowingShims":2,"./factoryWithTypeCheckers":3,"react-is":11}],5:[function(require,module,exports){ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; + +module.exports = ReactPropTypesSecret; + +},{}],6:[function(require,module,exports){ +module.exports = Function.call.bind(Object.prototype.hasOwnProperty); + +},{}],7:[function(require,module,exports){ +/* +object-assign +(c) Sindre Sorhus +@license MIT +*/ + +'use strict'; +/* eslint-disable no-unused-vars */ +var getOwnPropertySymbols = Object.getOwnPropertySymbols; +var hasOwnProperty = Object.prototype.hasOwnProperty; +var propIsEnumerable = Object.prototype.propertyIsEnumerable; + +function toObject(val) { + if (val === null || val === undefined) { + throw new TypeError('Object.assign cannot be called with null or undefined'); + } + + return Object(val); +} + +function shouldUseNative() { + try { + if (!Object.assign) { + return false; + } + + // Detect buggy property enumeration order in older V8 versions. + + // https://bugs.chromium.org/p/v8/issues/detail?id=4118 + var test1 = new String('abc'); // eslint-disable-line no-new-wrappers + test1[5] = 'de'; + if (Object.getOwnPropertyNames(test1)[0] === '5') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test2 = {}; + for (var i = 0; i < 10; i++) { + test2['_' + String.fromCharCode(i)] = i; + } + var order2 = Object.getOwnPropertyNames(test2).map(function (n) { + return test2[n]; + }); + if (order2.join('') !== '0123456789') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test3 = {}; + 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { + test3[letter] = letter; + }); + if (Object.keys(Object.assign({}, test3)).join('') !== + 'abcdefghijklmnopqrst') { + return false; + } + + return true; + } catch (err) { + // We don't expect any of the above to throw, but better to be safe. + return false; + } +} + +module.exports = shouldUseNative() ? Object.assign : function (target, source) { + var from; + var to = toObject(target); + var symbols; + + for (var s = 1; s < arguments.length; s++) { + from = Object(arguments[s]); + + for (var key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } + } + + if (getOwnPropertySymbols) { + symbols = getOwnPropertySymbols(from); + for (var i = 0; i < symbols.length; i++) { + if (propIsEnumerable.call(from, symbols[i])) { + to[symbols[i]] = from[symbols[i]]; + } + } + } + } + + return to; +}; + +},{}],8:[function(require,module,exports){ +// shim for using process in browser +var process = module.exports = {}; + +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. + +var cachedSetTimeout; +var cachedClearTimeout; + +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} +function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); +} +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +} ()) +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + + +} +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + + + +} +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; + +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } +} + +function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} + +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; + +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; + +process.listeners = function (name) { return [] } + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; + +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; + +},{}],9:[function(require,module,exports){ +(function (process){(function (){ +/** @license React v16.13.1 + * react-is.development.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + + + +if (process.env.NODE_ENV !== "production") { + (function() { +'use strict'; + +// The Symbol used to tag the ReactElement-like types. If there is no native Symbol +// nor polyfill, then a plain number is used for performance. +var hasSymbol = typeof Symbol === 'function' && Symbol.for; +var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; +var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca; +var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb; +var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc; +var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2; +var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd; +var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary +// (unstable) APIs that have been removed. Can we remove the symbols? + +var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf; +var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf; +var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0; +var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1; +var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8; +var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; +var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; +var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9; +var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5; +var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6; +var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7; + +function isValidElementType(type) { + return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. + type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE); +} + +function typeOf(object) { + if (typeof object === 'object' && object !== null) { + var $$typeof = object.$$typeof; + + switch ($$typeof) { + case REACT_ELEMENT_TYPE: + var type = object.type; + + switch (type) { + case REACT_ASYNC_MODE_TYPE: + case REACT_CONCURRENT_MODE_TYPE: + case REACT_FRAGMENT_TYPE: + case REACT_PROFILER_TYPE: + case REACT_STRICT_MODE_TYPE: + case REACT_SUSPENSE_TYPE: + return type; + + default: + var $$typeofType = type && type.$$typeof; + + switch ($$typeofType) { + case REACT_CONTEXT_TYPE: + case REACT_FORWARD_REF_TYPE: + case REACT_LAZY_TYPE: + case REACT_MEMO_TYPE: + case REACT_PROVIDER_TYPE: + return $$typeofType; + + default: + return $$typeof; + } + + } + + case REACT_PORTAL_TYPE: + return $$typeof; + } + } + + return undefined; +} // AsyncMode is deprecated along with isAsyncMode + +var AsyncMode = REACT_ASYNC_MODE_TYPE; +var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE; +var ContextConsumer = REACT_CONTEXT_TYPE; +var ContextProvider = REACT_PROVIDER_TYPE; +var Element = REACT_ELEMENT_TYPE; +var ForwardRef = REACT_FORWARD_REF_TYPE; +var Fragment = REACT_FRAGMENT_TYPE; +var Lazy = REACT_LAZY_TYPE; +var Memo = REACT_MEMO_TYPE; +var Portal = REACT_PORTAL_TYPE; +var Profiler = REACT_PROFILER_TYPE; +var StrictMode = REACT_STRICT_MODE_TYPE; +var Suspense = REACT_SUSPENSE_TYPE; +var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated + +function isAsyncMode(object) { + { + if (!hasWarnedAboutDeprecatedIsAsyncMode) { + hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint + + console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.'); + } + } + + return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE; +} +function isConcurrentMode(object) { + return typeOf(object) === REACT_CONCURRENT_MODE_TYPE; +} +function isContextConsumer(object) { + return typeOf(object) === REACT_CONTEXT_TYPE; +} +function isContextProvider(object) { + return typeOf(object) === REACT_PROVIDER_TYPE; +} +function isElement(object) { + return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; +} +function isForwardRef(object) { + return typeOf(object) === REACT_FORWARD_REF_TYPE; +} +function isFragment(object) { + return typeOf(object) === REACT_FRAGMENT_TYPE; +} +function isLazy(object) { + return typeOf(object) === REACT_LAZY_TYPE; +} +function isMemo(object) { + return typeOf(object) === REACT_MEMO_TYPE; +} +function isPortal(object) { + return typeOf(object) === REACT_PORTAL_TYPE; +} +function isProfiler(object) { + return typeOf(object) === REACT_PROFILER_TYPE; +} +function isStrictMode(object) { + return typeOf(object) === REACT_STRICT_MODE_TYPE; +} +function isSuspense(object) { + return typeOf(object) === REACT_SUSPENSE_TYPE; +} + +exports.AsyncMode = AsyncMode; +exports.ConcurrentMode = ConcurrentMode; +exports.ContextConsumer = ContextConsumer; +exports.ContextProvider = ContextProvider; +exports.Element = Element; +exports.ForwardRef = ForwardRef; +exports.Fragment = Fragment; +exports.Lazy = Lazy; +exports.Memo = Memo; +exports.Portal = Portal; +exports.Profiler = Profiler; +exports.StrictMode = StrictMode; +exports.Suspense = Suspense; +exports.isAsyncMode = isAsyncMode; +exports.isConcurrentMode = isConcurrentMode; +exports.isContextConsumer = isContextConsumer; +exports.isContextProvider = isContextProvider; +exports.isElement = isElement; +exports.isForwardRef = isForwardRef; +exports.isFragment = isFragment; +exports.isLazy = isLazy; +exports.isMemo = isMemo; +exports.isPortal = isPortal; +exports.isProfiler = isProfiler; +exports.isStrictMode = isStrictMode; +exports.isSuspense = isSuspense; +exports.isValidElementType = isValidElementType; +exports.typeOf = typeOf; + })(); +} + +}).call(this)}).call(this,require('_process')) +},{"_process":8}],10:[function(require,module,exports){ +/** @license React v16.13.1 + * react-is.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict';var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b? +Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119; +function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d; +exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t}; +exports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p}; +exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z; + +},{}],11:[function(require,module,exports){ +(function (process){(function (){ +'use strict'; + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/react-is.production.min.js'); +} else { + module.exports = require('./cjs/react-is.development.js'); +} + +}).call(this)}).call(this,require('_process')) +},{"./cjs/react-is.development.js":9,"./cjs/react-is.production.min.js":10,"_process":8}]},{},[4])(4) +}); diff --git a/node_modules/prop-types/prop-types.min.js b/node_modules/prop-types/prop-types.min.js new file mode 100644 index 0000000..7a746e1 --- /dev/null +++ b/node_modules/prop-types/prop-types.min.js @@ -0,0 +1 @@ +!function(f){"object"==typeof exports&&"undefined"!=typeof module?module.exports=f():"function"==typeof define&&define.amd?define([],f):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).PropTypes=f()}(function(){return function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var p="function"==typeof require&&require;if(!f&&p)return p(i,!0);if(u)return u(i,!0);throw(p=new Error("Cannot find module '"+i+"'")).code="MODULE_NOT_FOUND",p}p=n[i]={exports:{}},e[i][0].call(p.exports,function(r){return o(e[i][1][r]||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i

+ +

+ License + build + ver +

+ +

+ +

+ +

React.js wrapper for ApexCharts to build interactive visualizations in react.

+ +

+ + +## Download and Installation + +##### Installing via npm + +```bash +npm install react-apexcharts apexcharts +``` + +## Usage + +```js +import Chart from 'react-apexcharts' +``` + +To create a basic bar chart with minimal configuration, write as follows: +```javascript +class App extends Component { + constructor(props) { + super(props); + + this.state = { + options: { + chart: { + id: 'apexchart-example' + }, + xaxis: { + categories: [1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999] + } + }, + series: [{ + name: 'series-1', + data: [30, 40, 35, 50, 49, 60, 70, 91, 125] + }] + } + } + render() { + return ( + + ) + } +} +``` + +This will render the following chart +

+ +### How do I update the chart? +Simple! Just change the `series` or any `option` and it will automatically re-render the chart. +

+ +View this example on codesandbox + + +**Important:** While updating the options, make sure to update the outermost property even when you need to update the nested property. + +✅ Do this +```javascript +this.setState({ + options: { + ...this.state.options, + xaxis: { + ...this.state.options.xaxis, + categories: ['X1', 'X2', 'X3'] + } + } +}) +``` + +❌ Not this +```javascript +this.setState({ + options.xaxis.categories: ['X1', 'X2', 'X3'] +}) +``` + + +## Props + + +| Prop | Type | Description | +| ------------- |-------------| -----| +| **series** | `Array` | The series is a set of data. To know more about the format of the data, checkout [Series docs](https://apexcharts.com/docs/series/) on the website. | +| **type** | `String` | `line`, `area`, `bar`, `pie`, `donut`, `scatter`, `bubble`, `heatmap`, `radialBar` | +| **width** | `Number or String` | Possible values for width can be `100%`, `400px` or `400` (by default is `100%`) | +| **height** | `Number or String` | Possible values for height can be `100%`, `300px` or `300` (by default is `auto`) | +| **options** | `Object` | The configuration object, see options on [API (Reference)](https://apexcharts.com/docs/options/chart/type/) | + +## How to call methods of ApexCharts programmatically? +Sometimes, you may want to call other methods of the core ApexCharts library, and you can do so on `ApexCharts` global variable directly + +Example +```js +ApexCharts.exec('reactchart-example', 'updateSeries', [{ + data: [40, 55, 65, 11, 23, 44, 54, 33] +}]) +``` +More info on the `.exec()` method can be found here + +All other methods of ApexCharts can be called this way + +## What's included + +The repository includes the following files and directories. + +``` +react-apexcharts/ +├── dist/ +│ ├── react-apexcharts.min.js +│ └── react-apexcharts.js +└── example/ +│ ├── src/ +│ ├── public/ +│ ├── package.json +│ └── README.md +└── src/ + └── react-apexcharts.jsx +``` + +## Development + +#### Install dependencies + +```bash +npm install +``` + +## Running the example + +Basic example including update is included to show how to get started using ApexCharts with React easily. + +To run the examples, +```bash +cd example +npm install +npm run start +``` + +#### Bundling + +##### To build for Development + +```bash +npm run dev-build +``` + +##### To build for Production + +```bash +npm run build +``` + +## License + +React-ApexCharts is released under MIT license. You are free to use, modify and distribute this software, as long as the copyright header is left intact. diff --git a/node_modules/react-apexcharts/dist/react-apexcharts.d.ts b/node_modules/react-apexcharts/dist/react-apexcharts.d.ts new file mode 100644 index 0000000..dcb0148 --- /dev/null +++ b/node_modules/react-apexcharts/dist/react-apexcharts.d.ts @@ -0,0 +1,33 @@ +/// +import { ApexOptions } from "apexcharts"; +import React from "react"; +/** + * Basic type definitions from https://apexcharts.com/docs/react-charts/#props + */ +declare module "react-apexcharts" { + export interface Props { + type?: + | "line" + | "area" + | "bar" + | "pie" + | "donut" + | "radialBar" + | "scatter" + | "bubble" + | "heatmap" + | "candlestick" + | "boxPlot" + | "radar" + | "polarArea" + | "rangeBar" + | "rangeArea" + | "treemap"; + series?: ApexOptions["series"]; + width?: string | number; + height?: string | number; + options?: ApexOptions; + [key: string]: any; + } + export default class ReactApexChart extends React.Component {} +} diff --git a/node_modules/react-apexcharts/dist/react-apexcharts.iife.min.js b/node_modules/react-apexcharts/dist/react-apexcharts.iife.min.js new file mode 100644 index 0000000..3626022 --- /dev/null +++ b/node_modules/react-apexcharts/dist/react-apexcharts.iife.min.js @@ -0,0 +1 @@ +var ReactApexChart=function(e,r,t){"use strict";function n(e,r,t){return(r=function(e){var r=function(e,r){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==typeof r?r:r+""}(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function o(){return o=Object.assign?Object.assign.bind():function(e){for(var r=1;r2&&void 0!==arguments[2]?arguments[2]:new WeakSet;if(e===r)return!0;if("object"!==c(e)||null===e||"object"!==c(r)||null===r)return!1;if(t.has(e)||t.has(r))return!0;t.add(e),t.add(r);var n=Object.keys(e),o=Object.keys(r);if(n.length!==o.length)return!1;for(var i=0,u=n;i=4.0.0", + "react": ">=0.13" + }, + "devDependencies": { + "@babel/core": "^7.25.8", + "@babel/plugin-proposal-object-rest-spread": "^7.20.7", + "@babel/preset-env": "^7.25.8", + "@babel/preset-react": "^7.25.7", + "@rollup/plugin-babel": "^6.0.4", + "@rollup/plugin-node-resolve": "^15.3.0", + "@rollup/plugin-terser": "^0.4.4", + "@types/react": "^18.3.11", + "concurrently": "^9.0.1", + "eslint": "^9.12.0", + "eslint-plugin-react": "^7.37.1", + "gulp": "^5.0.0", + "gulp-babel": "^8.0.0", + "gulp-concat": "^2.6.1", + "gulp-uglify": "^3.0.2", + "jest": "^29.7.0", + "jest-environment-jsdom": "^29.7.0", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "react-test-renderer": "^18.3.1", + "rollup": "4.24.0", + "rollup-plugin-postcss": "^4.0.2" + } +} diff --git a/node_modules/react-apexcharts/types/react-apexcharts.d.ts b/node_modules/react-apexcharts/types/react-apexcharts.d.ts new file mode 100644 index 0000000..dcb0148 --- /dev/null +++ b/node_modules/react-apexcharts/types/react-apexcharts.d.ts @@ -0,0 +1,33 @@ +/// +import { ApexOptions } from "apexcharts"; +import React from "react"; +/** + * Basic type definitions from https://apexcharts.com/docs/react-charts/#props + */ +declare module "react-apexcharts" { + export interface Props { + type?: + | "line" + | "area" + | "bar" + | "pie" + | "donut" + | "radialBar" + | "scatter" + | "bubble" + | "heatmap" + | "candlestick" + | "boxPlot" + | "radar" + | "polarArea" + | "rangeBar" + | "rangeArea" + | "treemap"; + series?: ApexOptions["series"]; + width?: string | number; + height?: string | number; + options?: ApexOptions; + [key: string]: any; + } + export default class ReactApexChart extends React.Component {} +} diff --git a/node_modules/react-is/LICENSE b/node_modules/react-is/LICENSE new file mode 100644 index 0000000..b96dcb0 --- /dev/null +++ b/node_modules/react-is/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/react-is/README.md b/node_modules/react-is/README.md new file mode 100644 index 0000000..d255977 --- /dev/null +++ b/node_modules/react-is/README.md @@ -0,0 +1,104 @@ +# `react-is` + +This package allows you to test arbitrary values and see if they're a particular React element type. + +## Installation + +```sh +# Yarn +yarn add react-is + +# NPM +npm install react-is +``` + +## Usage + +### Determining if a Component is Valid + +```js +import React from "react"; +import * as ReactIs from "react-is"; + +class ClassComponent extends React.Component { + render() { + return React.createElement("div"); + } +} + +const FunctionComponent = () => React.createElement("div"); + +const ForwardRefComponent = React.forwardRef((props, ref) => + React.createElement(Component, { forwardedRef: ref, ...props }) +); + +const Context = React.createContext(false); + +ReactIs.isValidElementType("div"); // true +ReactIs.isValidElementType(ClassComponent); // true +ReactIs.isValidElementType(FunctionComponent); // true +ReactIs.isValidElementType(ForwardRefComponent); // true +ReactIs.isValidElementType(Context.Provider); // true +ReactIs.isValidElementType(Context.Consumer); // true +ReactIs.isValidElementType(React.createFactory("div")); // true +``` + +### Determining an Element's Type + +#### Context + +```js +import React from "react"; +import * as ReactIs from 'react-is'; + +const ThemeContext = React.createContext("blue"); + +ReactIs.isContextConsumer(); // true +ReactIs.isContextProvider(); // true +ReactIs.typeOf() === ReactIs.ContextProvider; // true +ReactIs.typeOf() === ReactIs.ContextConsumer; // true +``` + +#### Element + +```js +import React from "react"; +import * as ReactIs from 'react-is'; + +ReactIs.isElement(
); // true +ReactIs.typeOf(
) === ReactIs.Element; // true +``` + +#### Fragment + +```js +import React from "react"; +import * as ReactIs from 'react-is'; + +ReactIs.isFragment(<>); // true +ReactIs.typeOf(<>) === ReactIs.Fragment; // true +``` + +#### Portal + +```js +import React from "react"; +import ReactDOM from "react-dom"; +import * as ReactIs from 'react-is'; + +const div = document.createElement("div"); +const portal = ReactDOM.createPortal(
, div); + +ReactIs.isPortal(portal); // true +ReactIs.typeOf(portal) === ReactIs.Portal; // true +``` + +#### StrictMode + +```js +import React from "react"; +import * as ReactIs from 'react-is'; + +ReactIs.isStrictMode(); // true +ReactIs.typeOf() === ReactIs.StrictMode; // true +``` diff --git a/node_modules/react-is/build-info.json b/node_modules/react-is/build-info.json new file mode 100644 index 0000000..4094da6 --- /dev/null +++ b/node_modules/react-is/build-info.json @@ -0,0 +1,8 @@ +{ + "branch": "pull/18344", + "buildNumber": "106499", + "checksum": "7fe5a2e", + "commit": "da834083c", + "environment": "ci", + "reactVersion": "16.12.0-da834083c" +} diff --git a/node_modules/react-is/cjs/react-is.development.js b/node_modules/react-is/cjs/react-is.development.js new file mode 100644 index 0000000..8a80b76 --- /dev/null +++ b/node_modules/react-is/cjs/react-is.development.js @@ -0,0 +1,181 @@ +/** @license React v16.13.1 + * react-is.development.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + + + +if (process.env.NODE_ENV !== "production") { + (function() { +'use strict'; + +// The Symbol used to tag the ReactElement-like types. If there is no native Symbol +// nor polyfill, then a plain number is used for performance. +var hasSymbol = typeof Symbol === 'function' && Symbol.for; +var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; +var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca; +var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb; +var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc; +var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2; +var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd; +var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary +// (unstable) APIs that have been removed. Can we remove the symbols? + +var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf; +var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf; +var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0; +var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1; +var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8; +var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; +var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; +var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9; +var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5; +var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6; +var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7; + +function isValidElementType(type) { + return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. + type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE); +} + +function typeOf(object) { + if (typeof object === 'object' && object !== null) { + var $$typeof = object.$$typeof; + + switch ($$typeof) { + case REACT_ELEMENT_TYPE: + var type = object.type; + + switch (type) { + case REACT_ASYNC_MODE_TYPE: + case REACT_CONCURRENT_MODE_TYPE: + case REACT_FRAGMENT_TYPE: + case REACT_PROFILER_TYPE: + case REACT_STRICT_MODE_TYPE: + case REACT_SUSPENSE_TYPE: + return type; + + default: + var $$typeofType = type && type.$$typeof; + + switch ($$typeofType) { + case REACT_CONTEXT_TYPE: + case REACT_FORWARD_REF_TYPE: + case REACT_LAZY_TYPE: + case REACT_MEMO_TYPE: + case REACT_PROVIDER_TYPE: + return $$typeofType; + + default: + return $$typeof; + } + + } + + case REACT_PORTAL_TYPE: + return $$typeof; + } + } + + return undefined; +} // AsyncMode is deprecated along with isAsyncMode + +var AsyncMode = REACT_ASYNC_MODE_TYPE; +var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE; +var ContextConsumer = REACT_CONTEXT_TYPE; +var ContextProvider = REACT_PROVIDER_TYPE; +var Element = REACT_ELEMENT_TYPE; +var ForwardRef = REACT_FORWARD_REF_TYPE; +var Fragment = REACT_FRAGMENT_TYPE; +var Lazy = REACT_LAZY_TYPE; +var Memo = REACT_MEMO_TYPE; +var Portal = REACT_PORTAL_TYPE; +var Profiler = REACT_PROFILER_TYPE; +var StrictMode = REACT_STRICT_MODE_TYPE; +var Suspense = REACT_SUSPENSE_TYPE; +var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated + +function isAsyncMode(object) { + { + if (!hasWarnedAboutDeprecatedIsAsyncMode) { + hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint + + console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.'); + } + } + + return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE; +} +function isConcurrentMode(object) { + return typeOf(object) === REACT_CONCURRENT_MODE_TYPE; +} +function isContextConsumer(object) { + return typeOf(object) === REACT_CONTEXT_TYPE; +} +function isContextProvider(object) { + return typeOf(object) === REACT_PROVIDER_TYPE; +} +function isElement(object) { + return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; +} +function isForwardRef(object) { + return typeOf(object) === REACT_FORWARD_REF_TYPE; +} +function isFragment(object) { + return typeOf(object) === REACT_FRAGMENT_TYPE; +} +function isLazy(object) { + return typeOf(object) === REACT_LAZY_TYPE; +} +function isMemo(object) { + return typeOf(object) === REACT_MEMO_TYPE; +} +function isPortal(object) { + return typeOf(object) === REACT_PORTAL_TYPE; +} +function isProfiler(object) { + return typeOf(object) === REACT_PROFILER_TYPE; +} +function isStrictMode(object) { + return typeOf(object) === REACT_STRICT_MODE_TYPE; +} +function isSuspense(object) { + return typeOf(object) === REACT_SUSPENSE_TYPE; +} + +exports.AsyncMode = AsyncMode; +exports.ConcurrentMode = ConcurrentMode; +exports.ContextConsumer = ContextConsumer; +exports.ContextProvider = ContextProvider; +exports.Element = Element; +exports.ForwardRef = ForwardRef; +exports.Fragment = Fragment; +exports.Lazy = Lazy; +exports.Memo = Memo; +exports.Portal = Portal; +exports.Profiler = Profiler; +exports.StrictMode = StrictMode; +exports.Suspense = Suspense; +exports.isAsyncMode = isAsyncMode; +exports.isConcurrentMode = isConcurrentMode; +exports.isContextConsumer = isContextConsumer; +exports.isContextProvider = isContextProvider; +exports.isElement = isElement; +exports.isForwardRef = isForwardRef; +exports.isFragment = isFragment; +exports.isLazy = isLazy; +exports.isMemo = isMemo; +exports.isPortal = isPortal; +exports.isProfiler = isProfiler; +exports.isStrictMode = isStrictMode; +exports.isSuspense = isSuspense; +exports.isValidElementType = isValidElementType; +exports.typeOf = typeOf; + })(); +} diff --git a/node_modules/react-is/cjs/react-is.production.min.js b/node_modules/react-is/cjs/react-is.production.min.js new file mode 100644 index 0000000..3e83c7a --- /dev/null +++ b/node_modules/react-is/cjs/react-is.production.min.js @@ -0,0 +1,15 @@ +/** @license React v16.13.1 + * react-is.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict';var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b? +Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119; +function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d; +exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t}; +exports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p}; +exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z; diff --git a/node_modules/react-is/index.js b/node_modules/react-is/index.js new file mode 100644 index 0000000..3ae098d --- /dev/null +++ b/node_modules/react-is/index.js @@ -0,0 +1,7 @@ +'use strict'; + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/react-is.production.min.js'); +} else { + module.exports = require('./cjs/react-is.development.js'); +} diff --git a/node_modules/react-is/package.json b/node_modules/react-is/package.json new file mode 100644 index 0000000..5f32de2 --- /dev/null +++ b/node_modules/react-is/package.json @@ -0,0 +1,27 @@ +{ + "name": "react-is", + "version": "16.13.1", + "description": "Brand checking of React Elements.", + "main": "index.js", + "repository": { + "type": "git", + "url": "https://github.com/facebook/react.git", + "directory": "packages/react-is" + }, + "keywords": [ + "react" + ], + "license": "MIT", + "bugs": { + "url": "https://github.com/facebook/react/issues" + }, + "homepage": "https://reactjs.org/", + "files": [ + "LICENSE", + "README.md", + "build-info.json", + "index.js", + "cjs/", + "umd/" + ] +} diff --git a/node_modules/react-is/umd/react-is.development.js b/node_modules/react-is/umd/react-is.development.js new file mode 100644 index 0000000..a6bc018 --- /dev/null +++ b/node_modules/react-is/umd/react-is.development.js @@ -0,0 +1,181 @@ +/** @license React v16.13.1 + * react-is.development.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = global || self, factory(global.ReactIs = {})); +}(this, (function (exports) { 'use strict'; + + // The Symbol used to tag the ReactElement-like types. If there is no native Symbol + // nor polyfill, then a plain number is used for performance. + var hasSymbol = typeof Symbol === 'function' && Symbol.for; + var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; + var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca; + var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb; + var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc; + var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2; + var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd; + var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary + // (unstable) APIs that have been removed. Can we remove the symbols? + + var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf; + var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf; + var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0; + var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1; + var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8; + var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; + var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; + var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9; + var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5; + var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6; + var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7; + + function isValidElementType(type) { + return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. + type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE); + } + + function typeOf(object) { + if (typeof object === 'object' && object !== null) { + var $$typeof = object.$$typeof; + + switch ($$typeof) { + case REACT_ELEMENT_TYPE: + var type = object.type; + + switch (type) { + case REACT_ASYNC_MODE_TYPE: + case REACT_CONCURRENT_MODE_TYPE: + case REACT_FRAGMENT_TYPE: + case REACT_PROFILER_TYPE: + case REACT_STRICT_MODE_TYPE: + case REACT_SUSPENSE_TYPE: + return type; + + default: + var $$typeofType = type && type.$$typeof; + + switch ($$typeofType) { + case REACT_CONTEXT_TYPE: + case REACT_FORWARD_REF_TYPE: + case REACT_LAZY_TYPE: + case REACT_MEMO_TYPE: + case REACT_PROVIDER_TYPE: + return $$typeofType; + + default: + return $$typeof; + } + + } + + case REACT_PORTAL_TYPE: + return $$typeof; + } + } + + return undefined; + } // AsyncMode is deprecated along with isAsyncMode + + var AsyncMode = REACT_ASYNC_MODE_TYPE; + var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE; + var ContextConsumer = REACT_CONTEXT_TYPE; + var ContextProvider = REACT_PROVIDER_TYPE; + var Element = REACT_ELEMENT_TYPE; + var ForwardRef = REACT_FORWARD_REF_TYPE; + var Fragment = REACT_FRAGMENT_TYPE; + var Lazy = REACT_LAZY_TYPE; + var Memo = REACT_MEMO_TYPE; + var Portal = REACT_PORTAL_TYPE; + var Profiler = REACT_PROFILER_TYPE; + var StrictMode = REACT_STRICT_MODE_TYPE; + var Suspense = REACT_SUSPENSE_TYPE; + var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated + + function isAsyncMode(object) { + { + if (!hasWarnedAboutDeprecatedIsAsyncMode) { + hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint + + console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.'); + } + } + + return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE; + } + function isConcurrentMode(object) { + return typeOf(object) === REACT_CONCURRENT_MODE_TYPE; + } + function isContextConsumer(object) { + return typeOf(object) === REACT_CONTEXT_TYPE; + } + function isContextProvider(object) { + return typeOf(object) === REACT_PROVIDER_TYPE; + } + function isElement(object) { + return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; + } + function isForwardRef(object) { + return typeOf(object) === REACT_FORWARD_REF_TYPE; + } + function isFragment(object) { + return typeOf(object) === REACT_FRAGMENT_TYPE; + } + function isLazy(object) { + return typeOf(object) === REACT_LAZY_TYPE; + } + function isMemo(object) { + return typeOf(object) === REACT_MEMO_TYPE; + } + function isPortal(object) { + return typeOf(object) === REACT_PORTAL_TYPE; + } + function isProfiler(object) { + return typeOf(object) === REACT_PROFILER_TYPE; + } + function isStrictMode(object) { + return typeOf(object) === REACT_STRICT_MODE_TYPE; + } + function isSuspense(object) { + return typeOf(object) === REACT_SUSPENSE_TYPE; + } + + exports.AsyncMode = AsyncMode; + exports.ConcurrentMode = ConcurrentMode; + exports.ContextConsumer = ContextConsumer; + exports.ContextProvider = ContextProvider; + exports.Element = Element; + exports.ForwardRef = ForwardRef; + exports.Fragment = Fragment; + exports.Lazy = Lazy; + exports.Memo = Memo; + exports.Portal = Portal; + exports.Profiler = Profiler; + exports.StrictMode = StrictMode; + exports.Suspense = Suspense; + exports.isAsyncMode = isAsyncMode; + exports.isConcurrentMode = isConcurrentMode; + exports.isContextConsumer = isContextConsumer; + exports.isContextProvider = isContextProvider; + exports.isElement = isElement; + exports.isForwardRef = isForwardRef; + exports.isFragment = isFragment; + exports.isLazy = isLazy; + exports.isMemo = isMemo; + exports.isPortal = isPortal; + exports.isProfiler = isProfiler; + exports.isStrictMode = isStrictMode; + exports.isSuspense = isSuspense; + exports.isValidElementType = isValidElementType; + exports.typeOf = typeOf; + +}))); diff --git a/node_modules/react-is/umd/react-is.production.min.js b/node_modules/react-is/umd/react-is.production.min.js new file mode 100644 index 0000000..62fe6b2 --- /dev/null +++ b/node_modules/react-is/umd/react-is.production.min.js @@ -0,0 +1,13 @@ +/** @license React v16.13.1 + * react-is.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +'use strict';(function(b,d){"object"===typeof exports&&"undefined"!==typeof module?d(exports):"function"===typeof define&&define.amd?define(["exports"],d):(b=b||self,d(b.ReactIs={}))})(this,function(b){function d(a){if("object"===typeof a&&null!==a){var b=a.$$typeof;switch(b){case r:switch(a=a.type,a){case t:case e:case f:case g:case h:case k:return a;default:switch(a=a&&a.$$typeof,a){case l:case m:case n:case p:case q:return a;default:return b}}case u:return b}}}function v(a){return d(a)===e}var c= +"function"===typeof Symbol&&Symbol.for,r=c?Symbol.for("react.element"):60103,u=c?Symbol.for("react.portal"):60106,f=c?Symbol.for("react.fragment"):60107,h=c?Symbol.for("react.strict_mode"):60108,g=c?Symbol.for("react.profiler"):60114,q=c?Symbol.for("react.provider"):60109,l=c?Symbol.for("react.context"):60110,t=c?Symbol.for("react.async_mode"):60111,e=c?Symbol.for("react.concurrent_mode"):60111,m=c?Symbol.for("react.forward_ref"):60112,k=c?Symbol.for("react.suspense"):60113,w=c?Symbol.for("react.suspense_list"): +60120,p=c?Symbol.for("react.memo"):60115,n=c?Symbol.for("react.lazy"):60116,x=c?Symbol.for("react.block"):60121,y=c?Symbol.for("react.fundamental"):60117,z=c?Symbol.for("react.responder"):60118,A=c?Symbol.for("react.scope"):60119;b.AsyncMode=t;b.ConcurrentMode=e;b.ContextConsumer=l;b.ContextProvider=q;b.Element=r;b.ForwardRef=m;b.Fragment=f;b.Lazy=n;b.Memo=p;b.Portal=u;b.Profiler=g;b.StrictMode=h;b.Suspense=k;b.isAsyncMode=function(a){return v(a)||d(a)===t};b.isConcurrentMode=v;b.isContextConsumer= +function(a){return d(a)===l};b.isContextProvider=function(a){return d(a)===q};b.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===r};b.isForwardRef=function(a){return d(a)===m};b.isFragment=function(a){return d(a)===f};b.isLazy=function(a){return d(a)===n};b.isMemo=function(a){return d(a)===p};b.isPortal=function(a){return d(a)===u};b.isProfiler=function(a){return d(a)===g};b.isStrictMode=function(a){return d(a)===h};b.isSuspense=function(a){return d(a)===k};b.isValidElementType= +function(a){return"string"===typeof a||"function"===typeof a||a===f||a===e||a===g||a===h||a===k||a===w||"object"===typeof a&&null!==a&&(a.$$typeof===n||a.$$typeof===p||a.$$typeof===q||a.$$typeof===l||a.$$typeof===m||a.$$typeof===y||a.$$typeof===z||a.$$typeof===A||a.$$typeof===x)};b.typeOf=d}); diff --git a/node_modules/react/LICENSE b/node_modules/react/LICENSE new file mode 100644 index 0000000..b93be90 --- /dev/null +++ b/node_modules/react/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Meta Platforms, Inc. and affiliates. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/react/README.md b/node_modules/react/README.md new file mode 100644 index 0000000..20a855e --- /dev/null +++ b/node_modules/react/README.md @@ -0,0 +1,37 @@ +# `react` + +React is a JavaScript library for creating user interfaces. + +The `react` package contains only the functionality necessary to define React components. It is typically used together with a React renderer like `react-dom` for the web, or `react-native` for the native environments. + +**Note:** by default, React will be in development mode. The development version includes extra warnings about common mistakes, whereas the production version includes extra performance optimizations and strips all error messages. Don't forget to use the [production build](https://reactjs.org/docs/optimizing-performance.html#use-the-production-build) when deploying your application. + +## Usage + +```js +import { useState } from 'react'; +import { createRoot } from 'react-dom/client'; + +function Counter() { + const [count, setCount] = useState(0); + return ( + <> +

{count}

+ + + ); +} + +const root = createRoot(document.getElementById('root')); +root.render(); +``` + +## Documentation + +See https://react.dev/ + +## API + +See https://react.dev/reference/react diff --git a/node_modules/react/cjs/react-compiler-runtime.development.js b/node_modules/react/cjs/react-compiler-runtime.development.js new file mode 100644 index 0000000..84ceaac --- /dev/null +++ b/node_modules/react/cjs/react-compiler-runtime.development.js @@ -0,0 +1,24 @@ +/** + * @license React + * react-compiler-runtime.development.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +"production" !== process.env.NODE_ENV && + (function () { + var ReactSharedInternals = + require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; + exports.c = function (size) { + var dispatcher = ReactSharedInternals.H; + null === dispatcher && + console.error( + "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem." + ); + return dispatcher.useMemoCache(size); + }; + })(); diff --git a/node_modules/react/cjs/react-compiler-runtime.production.js b/node_modules/react/cjs/react-compiler-runtime.production.js new file mode 100644 index 0000000..4d5ade3 --- /dev/null +++ b/node_modules/react/cjs/react-compiler-runtime.production.js @@ -0,0 +1,16 @@ +/** + * @license React + * react-compiler-runtime.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +var ReactSharedInternals = + require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; +exports.c = function (size) { + return ReactSharedInternals.H.useMemoCache(size); +}; diff --git a/node_modules/react/cjs/react-compiler-runtime.profiling.js b/node_modules/react/cjs/react-compiler-runtime.profiling.js new file mode 100644 index 0000000..9b93257 --- /dev/null +++ b/node_modules/react/cjs/react-compiler-runtime.profiling.js @@ -0,0 +1,16 @@ +/** + * @license React + * react-compiler-runtime.profiling.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +var ReactSharedInternals = + require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; +exports.c = function (size) { + return ReactSharedInternals.H.useMemoCache(size); +}; diff --git a/node_modules/react/cjs/react-jsx-dev-runtime.development.js b/node_modules/react/cjs/react-jsx-dev-runtime.development.js new file mode 100644 index 0000000..8dd24a4 --- /dev/null +++ b/node_modules/react/cjs/react-jsx-dev-runtime.development.js @@ -0,0 +1,349 @@ +/** + * @license React + * react-jsx-dev-runtime.development.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +"production" !== process.env.NODE_ENV && + (function () { + function getComponentNameFromType(type) { + if (null == type) return null; + if ("function" === typeof type) + return type.$$typeof === REACT_CLIENT_REFERENCE + ? null + : type.displayName || type.name || null; + if ("string" === typeof type) return type; + switch (type) { + case REACT_FRAGMENT_TYPE: + return "Fragment"; + case REACT_PROFILER_TYPE: + return "Profiler"; + case REACT_STRICT_MODE_TYPE: + return "StrictMode"; + case REACT_SUSPENSE_TYPE: + return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + case REACT_ACTIVITY_TYPE: + return "Activity"; + } + if ("object" === typeof type) + switch ( + ("number" === typeof type.tag && + console.error( + "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." + ), + type.$$typeof) + ) { + case REACT_PORTAL_TYPE: + return "Portal"; + case REACT_CONTEXT_TYPE: + return (type.displayName || "Context") + ".Provider"; + case REACT_CONSUMER_TYPE: + return (type._context.displayName || "Context") + ".Consumer"; + case REACT_FORWARD_REF_TYPE: + var innerType = type.render; + type = type.displayName; + type || + ((type = innerType.displayName || innerType.name || ""), + (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef")); + return type; + case REACT_MEMO_TYPE: + return ( + (innerType = type.displayName || null), + null !== innerType + ? innerType + : getComponentNameFromType(type.type) || "Memo" + ); + case REACT_LAZY_TYPE: + innerType = type._payload; + type = type._init; + try { + return getComponentNameFromType(type(innerType)); + } catch (x) {} + } + return null; + } + function testStringCoercion(value) { + return "" + value; + } + function checkKeyStringCoercion(value) { + try { + testStringCoercion(value); + var JSCompiler_inline_result = !1; + } catch (e) { + JSCompiler_inline_result = !0; + } + if (JSCompiler_inline_result) { + JSCompiler_inline_result = console; + var JSCompiler_temp_const = JSCompiler_inline_result.error; + var JSCompiler_inline_result$jscomp$0 = + ("function" === typeof Symbol && + Symbol.toStringTag && + value[Symbol.toStringTag]) || + value.constructor.name || + "Object"; + JSCompiler_temp_const.call( + JSCompiler_inline_result, + "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", + JSCompiler_inline_result$jscomp$0 + ); + return testStringCoercion(value); + } + } + function getTaskName(type) { + if (type === REACT_FRAGMENT_TYPE) return "<>"; + if ( + "object" === typeof type && + null !== type && + type.$$typeof === REACT_LAZY_TYPE + ) + return "<...>"; + try { + var name = getComponentNameFromType(type); + return name ? "<" + name + ">" : "<...>"; + } catch (x) { + return "<...>"; + } + } + function getOwner() { + var dispatcher = ReactSharedInternals.A; + return null === dispatcher ? null : dispatcher.getOwner(); + } + function UnknownOwner() { + return Error("react-stack-top-frame"); + } + function hasValidKey(config) { + if (hasOwnProperty.call(config, "key")) { + var getter = Object.getOwnPropertyDescriptor(config, "key").get; + if (getter && getter.isReactWarning) return !1; + } + return void 0 !== config.key; + } + function defineKeyPropWarningGetter(props, displayName) { + function warnAboutAccessingKey() { + specialPropKeyWarningShown || + ((specialPropKeyWarningShown = !0), + console.error( + "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", + displayName + )); + } + warnAboutAccessingKey.isReactWarning = !0; + Object.defineProperty(props, "key", { + get: warnAboutAccessingKey, + configurable: !0 + }); + } + function elementRefGetterWithDeprecationWarning() { + var componentName = getComponentNameFromType(this.type); + didWarnAboutElementRef[componentName] || + ((didWarnAboutElementRef[componentName] = !0), + console.error( + "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release." + )); + componentName = this.props.ref; + return void 0 !== componentName ? componentName : null; + } + function ReactElement( + type, + key, + self, + source, + owner, + props, + debugStack, + debugTask + ) { + self = props.ref; + type = { + $$typeof: REACT_ELEMENT_TYPE, + type: type, + key: key, + props: props, + _owner: owner + }; + null !== (void 0 !== self ? self : null) + ? Object.defineProperty(type, "ref", { + enumerable: !1, + get: elementRefGetterWithDeprecationWarning + }) + : Object.defineProperty(type, "ref", { enumerable: !1, value: null }); + type._store = {}; + Object.defineProperty(type._store, "validated", { + configurable: !1, + enumerable: !1, + writable: !0, + value: 0 + }); + Object.defineProperty(type, "_debugInfo", { + configurable: !1, + enumerable: !1, + writable: !0, + value: null + }); + Object.defineProperty(type, "_debugStack", { + configurable: !1, + enumerable: !1, + writable: !0, + value: debugStack + }); + Object.defineProperty(type, "_debugTask", { + configurable: !1, + enumerable: !1, + writable: !0, + value: debugTask + }); + Object.freeze && (Object.freeze(type.props), Object.freeze(type)); + return type; + } + function jsxDEVImpl( + type, + config, + maybeKey, + isStaticChildren, + source, + self, + debugStack, + debugTask + ) { + var children = config.children; + if (void 0 !== children) + if (isStaticChildren) + if (isArrayImpl(children)) { + for ( + isStaticChildren = 0; + isStaticChildren < children.length; + isStaticChildren++ + ) + validateChildKeys(children[isStaticChildren]); + Object.freeze && Object.freeze(children); + } else + console.error( + "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead." + ); + else validateChildKeys(children); + if (hasOwnProperty.call(config, "key")) { + children = getComponentNameFromType(type); + var keys = Object.keys(config).filter(function (k) { + return "key" !== k; + }); + isStaticChildren = + 0 < keys.length + ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" + : "{key: someKey}"; + didWarnAboutKeySpread[children + isStaticChildren] || + ((keys = + 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"), + console.error( + 'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />', + isStaticChildren, + children, + keys, + children + ), + (didWarnAboutKeySpread[children + isStaticChildren] = !0)); + } + children = null; + void 0 !== maybeKey && + (checkKeyStringCoercion(maybeKey), (children = "" + maybeKey)); + hasValidKey(config) && + (checkKeyStringCoercion(config.key), (children = "" + config.key)); + if ("key" in config) { + maybeKey = {}; + for (var propName in config) + "key" !== propName && (maybeKey[propName] = config[propName]); + } else maybeKey = config; + children && + defineKeyPropWarningGetter( + maybeKey, + "function" === typeof type + ? type.displayName || type.name || "Unknown" + : type + ); + return ReactElement( + type, + children, + self, + source, + getOwner(), + maybeKey, + debugStack, + debugTask + ); + } + function validateChildKeys(node) { + "object" === typeof node && + null !== node && + node.$$typeof === REACT_ELEMENT_TYPE && + node._store && + (node._store.validated = 1); + } + var React = require("react"), + REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_PORTAL_TYPE = Symbol.for("react.portal"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), + REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), + REACT_PROFILER_TYPE = Symbol.for("react.profiler"); + Symbol.for("react.provider"); + var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), + REACT_CONTEXT_TYPE = Symbol.for("react.context"), + REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), + REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), + REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), + REACT_MEMO_TYPE = Symbol.for("react.memo"), + REACT_LAZY_TYPE = Symbol.for("react.lazy"), + REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), + REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), + ReactSharedInternals = + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, + hasOwnProperty = Object.prototype.hasOwnProperty, + isArrayImpl = Array.isArray, + createTask = console.createTask + ? console.createTask + : function () { + return null; + }; + React = { + "react-stack-bottom-frame": function (callStackForError) { + return callStackForError(); + } + }; + var specialPropKeyWarningShown; + var didWarnAboutElementRef = {}; + var unknownOwnerDebugStack = React["react-stack-bottom-frame"].bind( + React, + UnknownOwner + )(); + var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner)); + var didWarnAboutKeySpread = {}; + exports.Fragment = REACT_FRAGMENT_TYPE; + exports.jsxDEV = function ( + type, + config, + maybeKey, + isStaticChildren, + source, + self + ) { + var trackActualOwner = + 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++; + return jsxDEVImpl( + type, + config, + maybeKey, + isStaticChildren, + source, + self, + trackActualOwner + ? Error("react-stack-top-frame") + : unknownOwnerDebugStack, + trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask + ); + }; + })(); diff --git a/node_modules/react/cjs/react-jsx-dev-runtime.production.js b/node_modules/react/cjs/react-jsx-dev-runtime.production.js new file mode 100644 index 0000000..22ad886 --- /dev/null +++ b/node_modules/react/cjs/react-jsx-dev-runtime.production.js @@ -0,0 +1,14 @@ +/** + * @license React + * react-jsx-dev-runtime.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"); +exports.Fragment = REACT_FRAGMENT_TYPE; +exports.jsxDEV = void 0; diff --git a/node_modules/react/cjs/react-jsx-dev-runtime.profiling.js b/node_modules/react/cjs/react-jsx-dev-runtime.profiling.js new file mode 100644 index 0000000..f9e8942 --- /dev/null +++ b/node_modules/react/cjs/react-jsx-dev-runtime.profiling.js @@ -0,0 +1,14 @@ +/** + * @license React + * react-jsx-dev-runtime.profiling.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"); +exports.Fragment = REACT_FRAGMENT_TYPE; +exports.jsxDEV = void 0; diff --git a/node_modules/react/cjs/react-jsx-dev-runtime.react-server.development.js b/node_modules/react/cjs/react-jsx-dev-runtime.react-server.development.js new file mode 100644 index 0000000..9052d7e --- /dev/null +++ b/node_modules/react/cjs/react-jsx-dev-runtime.react-server.development.js @@ -0,0 +1,385 @@ +/** + * @license React + * react-jsx-dev-runtime.react-server.development.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +"production" !== process.env.NODE_ENV && + (function () { + function getComponentNameFromType(type) { + if (null == type) return null; + if ("function" === typeof type) + return type.$$typeof === REACT_CLIENT_REFERENCE + ? null + : type.displayName || type.name || null; + if ("string" === typeof type) return type; + switch (type) { + case REACT_FRAGMENT_TYPE: + return "Fragment"; + case REACT_PROFILER_TYPE: + return "Profiler"; + case REACT_STRICT_MODE_TYPE: + return "StrictMode"; + case REACT_SUSPENSE_TYPE: + return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + case REACT_ACTIVITY_TYPE: + return "Activity"; + } + if ("object" === typeof type) + switch ( + ("number" === typeof type.tag && + console.error( + "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." + ), + type.$$typeof) + ) { + case REACT_PORTAL_TYPE: + return "Portal"; + case REACT_CONTEXT_TYPE: + return (type.displayName || "Context") + ".Provider"; + case REACT_CONSUMER_TYPE: + return (type._context.displayName || "Context") + ".Consumer"; + case REACT_FORWARD_REF_TYPE: + var innerType = type.render; + type = type.displayName; + type || + ((type = innerType.displayName || innerType.name || ""), + (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef")); + return type; + case REACT_MEMO_TYPE: + return ( + (innerType = type.displayName || null), + null !== innerType + ? innerType + : getComponentNameFromType(type.type) || "Memo" + ); + case REACT_LAZY_TYPE: + innerType = type._payload; + type = type._init; + try { + return getComponentNameFromType(type(innerType)); + } catch (x) {} + } + return null; + } + function testStringCoercion(value) { + return "" + value; + } + function checkKeyStringCoercion(value) { + try { + testStringCoercion(value); + var JSCompiler_inline_result = !1; + } catch (e) { + JSCompiler_inline_result = !0; + } + if (JSCompiler_inline_result) { + JSCompiler_inline_result = console; + var JSCompiler_temp_const = JSCompiler_inline_result.error; + var JSCompiler_inline_result$jscomp$0 = + ("function" === typeof Symbol && + Symbol.toStringTag && + value[Symbol.toStringTag]) || + value.constructor.name || + "Object"; + JSCompiler_temp_const.call( + JSCompiler_inline_result, + "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", + JSCompiler_inline_result$jscomp$0 + ); + return testStringCoercion(value); + } + } + function getTaskName(type) { + if (type === REACT_FRAGMENT_TYPE) return "<>"; + if ( + "object" === typeof type && + null !== type && + type.$$typeof === REACT_LAZY_TYPE + ) + return "<...>"; + try { + var name = getComponentNameFromType(type); + return name ? "<" + name + ">" : "<...>"; + } catch (x) { + return "<...>"; + } + } + function getOwner() { + var dispatcher = ReactSharedInternalsServer.A; + return null === dispatcher ? null : dispatcher.getOwner(); + } + function UnknownOwner() { + return Error("react-stack-top-frame"); + } + function hasValidKey(config) { + if (hasOwnProperty.call(config, "key")) { + var getter = Object.getOwnPropertyDescriptor(config, "key").get; + if (getter && getter.isReactWarning) return !1; + } + return void 0 !== config.key; + } + function defineKeyPropWarningGetter(props, displayName) { + function warnAboutAccessingKey() { + specialPropKeyWarningShown || + ((specialPropKeyWarningShown = !0), + console.error( + "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", + displayName + )); + } + warnAboutAccessingKey.isReactWarning = !0; + Object.defineProperty(props, "key", { + get: warnAboutAccessingKey, + configurable: !0 + }); + } + function elementRefGetterWithDeprecationWarning() { + var componentName = getComponentNameFromType(this.type); + didWarnAboutElementRef[componentName] || + ((didWarnAboutElementRef[componentName] = !0), + console.error( + "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release." + )); + componentName = this.props.ref; + return void 0 !== componentName ? componentName : null; + } + function ReactElement( + type, + key, + self, + source, + owner, + props, + debugStack, + debugTask + ) { + self = props.ref; + type = { + $$typeof: REACT_ELEMENT_TYPE, + type: type, + key: key, + props: props, + _owner: owner + }; + null !== (void 0 !== self ? self : null) + ? Object.defineProperty(type, "ref", { + enumerable: !1, + get: elementRefGetterWithDeprecationWarning + }) + : Object.defineProperty(type, "ref", { enumerable: !1, value: null }); + type._store = {}; + Object.defineProperty(type._store, "validated", { + configurable: !1, + enumerable: !1, + writable: !0, + value: 0 + }); + Object.defineProperty(type, "_debugInfo", { + configurable: !1, + enumerable: !1, + writable: !0, + value: null + }); + Object.defineProperty(type, "_debugStack", { + configurable: !1, + enumerable: !1, + writable: !0, + value: debugStack + }); + Object.defineProperty(type, "_debugTask", { + configurable: !1, + enumerable: !1, + writable: !0, + value: debugTask + }); + Object.freeze && (Object.freeze(type.props), Object.freeze(type)); + return type; + } + function jsxDEVImpl( + type, + config, + maybeKey, + isStaticChildren, + source, + self, + debugStack, + debugTask + ) { + var children = config.children; + if (void 0 !== children) + if (isStaticChildren) + if (isArrayImpl(children)) { + for ( + isStaticChildren = 0; + isStaticChildren < children.length; + isStaticChildren++ + ) + validateChildKeys(children[isStaticChildren]); + Object.freeze && Object.freeze(children); + } else + console.error( + "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead." + ); + else validateChildKeys(children); + if (hasOwnProperty.call(config, "key")) { + children = getComponentNameFromType(type); + var keys = Object.keys(config).filter(function (k) { + return "key" !== k; + }); + isStaticChildren = + 0 < keys.length + ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" + : "{key: someKey}"; + didWarnAboutKeySpread[children + isStaticChildren] || + ((keys = + 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"), + console.error( + 'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />', + isStaticChildren, + children, + keys, + children + ), + (didWarnAboutKeySpread[children + isStaticChildren] = !0)); + } + children = null; + void 0 !== maybeKey && + (checkKeyStringCoercion(maybeKey), (children = "" + maybeKey)); + hasValidKey(config) && + (checkKeyStringCoercion(config.key), (children = "" + config.key)); + if ("key" in config) { + maybeKey = {}; + for (var propName in config) + "key" !== propName && (maybeKey[propName] = config[propName]); + } else maybeKey = config; + children && + defineKeyPropWarningGetter( + maybeKey, + "function" === typeof type + ? type.displayName || type.name || "Unknown" + : type + ); + return ReactElement( + type, + children, + self, + source, + getOwner(), + maybeKey, + debugStack, + debugTask + ); + } + function validateChildKeys(node) { + "object" === typeof node && + null !== node && + node.$$typeof === REACT_ELEMENT_TYPE && + node._store && + (node._store.validated = 1); + } + var React = require("react"), + REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_PORTAL_TYPE = Symbol.for("react.portal"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), + REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), + REACT_PROFILER_TYPE = Symbol.for("react.profiler"); + Symbol.for("react.provider"); + var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), + REACT_CONTEXT_TYPE = Symbol.for("react.context"), + REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), + REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), + REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), + REACT_MEMO_TYPE = Symbol.for("react.memo"), + REACT_LAZY_TYPE = Symbol.for("react.lazy"), + REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), + REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), + ReactSharedInternalsServer = + React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; + if (!ReactSharedInternalsServer) + throw Error( + 'The "react" package in this environment is not configured correctly. The "react-server" condition must be enabled in any environment that runs React Server Components.' + ); + var hasOwnProperty = Object.prototype.hasOwnProperty, + isArrayImpl = Array.isArray, + createTask = console.createTask + ? console.createTask + : function () { + return null; + }; + React = { + "react-stack-bottom-frame": function (callStackForError) { + return callStackForError(); + } + }; + var specialPropKeyWarningShown; + var didWarnAboutElementRef = {}; + var unknownOwnerDebugStack = React["react-stack-bottom-frame"].bind( + React, + UnknownOwner + )(); + var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner)); + var didWarnAboutKeySpread = {}; + exports.Fragment = REACT_FRAGMENT_TYPE; + exports.jsx = function (type, config, maybeKey, source, self) { + var trackActualOwner = + 1e4 > ReactSharedInternalsServer.recentlyCreatedOwnerStacks++; + return jsxDEVImpl( + type, + config, + maybeKey, + !1, + source, + self, + trackActualOwner + ? Error("react-stack-top-frame") + : unknownOwnerDebugStack, + trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask + ); + }; + exports.jsxDEV = function ( + type, + config, + maybeKey, + isStaticChildren, + source, + self + ) { + var trackActualOwner = + 1e4 > ReactSharedInternalsServer.recentlyCreatedOwnerStacks++; + return jsxDEVImpl( + type, + config, + maybeKey, + isStaticChildren, + source, + self, + trackActualOwner + ? Error("react-stack-top-frame") + : unknownOwnerDebugStack, + trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask + ); + }; + exports.jsxs = function (type, config, maybeKey, source, self) { + var trackActualOwner = + 1e4 > ReactSharedInternalsServer.recentlyCreatedOwnerStacks++; + return jsxDEVImpl( + type, + config, + maybeKey, + !0, + source, + self, + trackActualOwner + ? Error("react-stack-top-frame") + : unknownOwnerDebugStack, + trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask + ); + }; + })(); diff --git a/node_modules/react/cjs/react-jsx-dev-runtime.react-server.production.js b/node_modules/react/cjs/react-jsx-dev-runtime.react-server.production.js new file mode 100644 index 0000000..0664121 --- /dev/null +++ b/node_modules/react/cjs/react-jsx-dev-runtime.react-server.production.js @@ -0,0 +1,40 @@ +/** + * @license React + * react-jsx-dev-runtime.react-server.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +var React = require("react"), + REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"); +if (!React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE) + throw Error( + 'The "react" package in this environment is not configured correctly. The "react-server" condition must be enabled in any environment that runs React Server Components.' + ); +function jsxProd(type, config, maybeKey) { + var key = null; + void 0 !== maybeKey && (key = "" + maybeKey); + void 0 !== config.key && (key = "" + config.key); + if ("key" in config) { + maybeKey = {}; + for (var propName in config) + "key" !== propName && (maybeKey[propName] = config[propName]); + } else maybeKey = config; + config = maybeKey.ref; + return { + $$typeof: REACT_ELEMENT_TYPE, + type: type, + key: key, + ref: void 0 !== config ? config : null, + props: maybeKey + }; +} +exports.Fragment = REACT_FRAGMENT_TYPE; +exports.jsx = jsxProd; +exports.jsxDEV = void 0; +exports.jsxs = jsxProd; diff --git a/node_modules/react/cjs/react-jsx-runtime.development.js b/node_modules/react/cjs/react-jsx-runtime.development.js new file mode 100644 index 0000000..2a821e1 --- /dev/null +++ b/node_modules/react/cjs/react-jsx-runtime.development.js @@ -0,0 +1,358 @@ +/** + * @license React + * react-jsx-runtime.development.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +"production" !== process.env.NODE_ENV && + (function () { + function getComponentNameFromType(type) { + if (null == type) return null; + if ("function" === typeof type) + return type.$$typeof === REACT_CLIENT_REFERENCE + ? null + : type.displayName || type.name || null; + if ("string" === typeof type) return type; + switch (type) { + case REACT_FRAGMENT_TYPE: + return "Fragment"; + case REACT_PROFILER_TYPE: + return "Profiler"; + case REACT_STRICT_MODE_TYPE: + return "StrictMode"; + case REACT_SUSPENSE_TYPE: + return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + case REACT_ACTIVITY_TYPE: + return "Activity"; + } + if ("object" === typeof type) + switch ( + ("number" === typeof type.tag && + console.error( + "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." + ), + type.$$typeof) + ) { + case REACT_PORTAL_TYPE: + return "Portal"; + case REACT_CONTEXT_TYPE: + return (type.displayName || "Context") + ".Provider"; + case REACT_CONSUMER_TYPE: + return (type._context.displayName || "Context") + ".Consumer"; + case REACT_FORWARD_REF_TYPE: + var innerType = type.render; + type = type.displayName; + type || + ((type = innerType.displayName || innerType.name || ""), + (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef")); + return type; + case REACT_MEMO_TYPE: + return ( + (innerType = type.displayName || null), + null !== innerType + ? innerType + : getComponentNameFromType(type.type) || "Memo" + ); + case REACT_LAZY_TYPE: + innerType = type._payload; + type = type._init; + try { + return getComponentNameFromType(type(innerType)); + } catch (x) {} + } + return null; + } + function testStringCoercion(value) { + return "" + value; + } + function checkKeyStringCoercion(value) { + try { + testStringCoercion(value); + var JSCompiler_inline_result = !1; + } catch (e) { + JSCompiler_inline_result = !0; + } + if (JSCompiler_inline_result) { + JSCompiler_inline_result = console; + var JSCompiler_temp_const = JSCompiler_inline_result.error; + var JSCompiler_inline_result$jscomp$0 = + ("function" === typeof Symbol && + Symbol.toStringTag && + value[Symbol.toStringTag]) || + value.constructor.name || + "Object"; + JSCompiler_temp_const.call( + JSCompiler_inline_result, + "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", + JSCompiler_inline_result$jscomp$0 + ); + return testStringCoercion(value); + } + } + function getTaskName(type) { + if (type === REACT_FRAGMENT_TYPE) return "<>"; + if ( + "object" === typeof type && + null !== type && + type.$$typeof === REACT_LAZY_TYPE + ) + return "<...>"; + try { + var name = getComponentNameFromType(type); + return name ? "<" + name + ">" : "<...>"; + } catch (x) { + return "<...>"; + } + } + function getOwner() { + var dispatcher = ReactSharedInternals.A; + return null === dispatcher ? null : dispatcher.getOwner(); + } + function UnknownOwner() { + return Error("react-stack-top-frame"); + } + function hasValidKey(config) { + if (hasOwnProperty.call(config, "key")) { + var getter = Object.getOwnPropertyDescriptor(config, "key").get; + if (getter && getter.isReactWarning) return !1; + } + return void 0 !== config.key; + } + function defineKeyPropWarningGetter(props, displayName) { + function warnAboutAccessingKey() { + specialPropKeyWarningShown || + ((specialPropKeyWarningShown = !0), + console.error( + "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", + displayName + )); + } + warnAboutAccessingKey.isReactWarning = !0; + Object.defineProperty(props, "key", { + get: warnAboutAccessingKey, + configurable: !0 + }); + } + function elementRefGetterWithDeprecationWarning() { + var componentName = getComponentNameFromType(this.type); + didWarnAboutElementRef[componentName] || + ((didWarnAboutElementRef[componentName] = !0), + console.error( + "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release." + )); + componentName = this.props.ref; + return void 0 !== componentName ? componentName : null; + } + function ReactElement( + type, + key, + self, + source, + owner, + props, + debugStack, + debugTask + ) { + self = props.ref; + type = { + $$typeof: REACT_ELEMENT_TYPE, + type: type, + key: key, + props: props, + _owner: owner + }; + null !== (void 0 !== self ? self : null) + ? Object.defineProperty(type, "ref", { + enumerable: !1, + get: elementRefGetterWithDeprecationWarning + }) + : Object.defineProperty(type, "ref", { enumerable: !1, value: null }); + type._store = {}; + Object.defineProperty(type._store, "validated", { + configurable: !1, + enumerable: !1, + writable: !0, + value: 0 + }); + Object.defineProperty(type, "_debugInfo", { + configurable: !1, + enumerable: !1, + writable: !0, + value: null + }); + Object.defineProperty(type, "_debugStack", { + configurable: !1, + enumerable: !1, + writable: !0, + value: debugStack + }); + Object.defineProperty(type, "_debugTask", { + configurable: !1, + enumerable: !1, + writable: !0, + value: debugTask + }); + Object.freeze && (Object.freeze(type.props), Object.freeze(type)); + return type; + } + function jsxDEVImpl( + type, + config, + maybeKey, + isStaticChildren, + source, + self, + debugStack, + debugTask + ) { + var children = config.children; + if (void 0 !== children) + if (isStaticChildren) + if (isArrayImpl(children)) { + for ( + isStaticChildren = 0; + isStaticChildren < children.length; + isStaticChildren++ + ) + validateChildKeys(children[isStaticChildren]); + Object.freeze && Object.freeze(children); + } else + console.error( + "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead." + ); + else validateChildKeys(children); + if (hasOwnProperty.call(config, "key")) { + children = getComponentNameFromType(type); + var keys = Object.keys(config).filter(function (k) { + return "key" !== k; + }); + isStaticChildren = + 0 < keys.length + ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" + : "{key: someKey}"; + didWarnAboutKeySpread[children + isStaticChildren] || + ((keys = + 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"), + console.error( + 'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />', + isStaticChildren, + children, + keys, + children + ), + (didWarnAboutKeySpread[children + isStaticChildren] = !0)); + } + children = null; + void 0 !== maybeKey && + (checkKeyStringCoercion(maybeKey), (children = "" + maybeKey)); + hasValidKey(config) && + (checkKeyStringCoercion(config.key), (children = "" + config.key)); + if ("key" in config) { + maybeKey = {}; + for (var propName in config) + "key" !== propName && (maybeKey[propName] = config[propName]); + } else maybeKey = config; + children && + defineKeyPropWarningGetter( + maybeKey, + "function" === typeof type + ? type.displayName || type.name || "Unknown" + : type + ); + return ReactElement( + type, + children, + self, + source, + getOwner(), + maybeKey, + debugStack, + debugTask + ); + } + function validateChildKeys(node) { + "object" === typeof node && + null !== node && + node.$$typeof === REACT_ELEMENT_TYPE && + node._store && + (node._store.validated = 1); + } + var React = require("react"), + REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_PORTAL_TYPE = Symbol.for("react.portal"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), + REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), + REACT_PROFILER_TYPE = Symbol.for("react.profiler"); + Symbol.for("react.provider"); + var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), + REACT_CONTEXT_TYPE = Symbol.for("react.context"), + REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), + REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), + REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), + REACT_MEMO_TYPE = Symbol.for("react.memo"), + REACT_LAZY_TYPE = Symbol.for("react.lazy"), + REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), + REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), + ReactSharedInternals = + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, + hasOwnProperty = Object.prototype.hasOwnProperty, + isArrayImpl = Array.isArray, + createTask = console.createTask + ? console.createTask + : function () { + return null; + }; + React = { + "react-stack-bottom-frame": function (callStackForError) { + return callStackForError(); + } + }; + var specialPropKeyWarningShown; + var didWarnAboutElementRef = {}; + var unknownOwnerDebugStack = React["react-stack-bottom-frame"].bind( + React, + UnknownOwner + )(); + var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner)); + var didWarnAboutKeySpread = {}; + exports.Fragment = REACT_FRAGMENT_TYPE; + exports.jsx = function (type, config, maybeKey, source, self) { + var trackActualOwner = + 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++; + return jsxDEVImpl( + type, + config, + maybeKey, + !1, + source, + self, + trackActualOwner + ? Error("react-stack-top-frame") + : unknownOwnerDebugStack, + trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask + ); + }; + exports.jsxs = function (type, config, maybeKey, source, self) { + var trackActualOwner = + 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++; + return jsxDEVImpl( + type, + config, + maybeKey, + !0, + source, + self, + trackActualOwner + ? Error("react-stack-top-frame") + : unknownOwnerDebugStack, + trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask + ); + }; + })(); diff --git a/node_modules/react/cjs/react-jsx-runtime.production.js b/node_modules/react/cjs/react-jsx-runtime.production.js new file mode 100644 index 0000000..12d6088 --- /dev/null +++ b/node_modules/react/cjs/react-jsx-runtime.production.js @@ -0,0 +1,34 @@ +/** + * @license React + * react-jsx-runtime.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"); +function jsxProd(type, config, maybeKey) { + var key = null; + void 0 !== maybeKey && (key = "" + maybeKey); + void 0 !== config.key && (key = "" + config.key); + if ("key" in config) { + maybeKey = {}; + for (var propName in config) + "key" !== propName && (maybeKey[propName] = config[propName]); + } else maybeKey = config; + config = maybeKey.ref; + return { + $$typeof: REACT_ELEMENT_TYPE, + type: type, + key: key, + ref: void 0 !== config ? config : null, + props: maybeKey + }; +} +exports.Fragment = REACT_FRAGMENT_TYPE; +exports.jsx = jsxProd; +exports.jsxs = jsxProd; diff --git a/node_modules/react/cjs/react-jsx-runtime.profiling.js b/node_modules/react/cjs/react-jsx-runtime.profiling.js new file mode 100644 index 0000000..68a28d6 --- /dev/null +++ b/node_modules/react/cjs/react-jsx-runtime.profiling.js @@ -0,0 +1,34 @@ +/** + * @license React + * react-jsx-runtime.profiling.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"); +function jsxProd(type, config, maybeKey) { + var key = null; + void 0 !== maybeKey && (key = "" + maybeKey); + void 0 !== config.key && (key = "" + config.key); + if ("key" in config) { + maybeKey = {}; + for (var propName in config) + "key" !== propName && (maybeKey[propName] = config[propName]); + } else maybeKey = config; + config = maybeKey.ref; + return { + $$typeof: REACT_ELEMENT_TYPE, + type: type, + key: key, + ref: void 0 !== config ? config : null, + props: maybeKey + }; +} +exports.Fragment = REACT_FRAGMENT_TYPE; +exports.jsx = jsxProd; +exports.jsxs = jsxProd; diff --git a/node_modules/react/cjs/react-jsx-runtime.react-server.development.js b/node_modules/react/cjs/react-jsx-runtime.react-server.development.js new file mode 100644 index 0000000..8d8c4f3 --- /dev/null +++ b/node_modules/react/cjs/react-jsx-runtime.react-server.development.js @@ -0,0 +1,385 @@ +/** + * @license React + * react-jsx-runtime.react-server.development.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +"production" !== process.env.NODE_ENV && + (function () { + function getComponentNameFromType(type) { + if (null == type) return null; + if ("function" === typeof type) + return type.$$typeof === REACT_CLIENT_REFERENCE + ? null + : type.displayName || type.name || null; + if ("string" === typeof type) return type; + switch (type) { + case REACT_FRAGMENT_TYPE: + return "Fragment"; + case REACT_PROFILER_TYPE: + return "Profiler"; + case REACT_STRICT_MODE_TYPE: + return "StrictMode"; + case REACT_SUSPENSE_TYPE: + return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + case REACT_ACTIVITY_TYPE: + return "Activity"; + } + if ("object" === typeof type) + switch ( + ("number" === typeof type.tag && + console.error( + "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." + ), + type.$$typeof) + ) { + case REACT_PORTAL_TYPE: + return "Portal"; + case REACT_CONTEXT_TYPE: + return (type.displayName || "Context") + ".Provider"; + case REACT_CONSUMER_TYPE: + return (type._context.displayName || "Context") + ".Consumer"; + case REACT_FORWARD_REF_TYPE: + var innerType = type.render; + type = type.displayName; + type || + ((type = innerType.displayName || innerType.name || ""), + (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef")); + return type; + case REACT_MEMO_TYPE: + return ( + (innerType = type.displayName || null), + null !== innerType + ? innerType + : getComponentNameFromType(type.type) || "Memo" + ); + case REACT_LAZY_TYPE: + innerType = type._payload; + type = type._init; + try { + return getComponentNameFromType(type(innerType)); + } catch (x) {} + } + return null; + } + function testStringCoercion(value) { + return "" + value; + } + function checkKeyStringCoercion(value) { + try { + testStringCoercion(value); + var JSCompiler_inline_result = !1; + } catch (e) { + JSCompiler_inline_result = !0; + } + if (JSCompiler_inline_result) { + JSCompiler_inline_result = console; + var JSCompiler_temp_const = JSCompiler_inline_result.error; + var JSCompiler_inline_result$jscomp$0 = + ("function" === typeof Symbol && + Symbol.toStringTag && + value[Symbol.toStringTag]) || + value.constructor.name || + "Object"; + JSCompiler_temp_const.call( + JSCompiler_inline_result, + "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", + JSCompiler_inline_result$jscomp$0 + ); + return testStringCoercion(value); + } + } + function getTaskName(type) { + if (type === REACT_FRAGMENT_TYPE) return "<>"; + if ( + "object" === typeof type && + null !== type && + type.$$typeof === REACT_LAZY_TYPE + ) + return "<...>"; + try { + var name = getComponentNameFromType(type); + return name ? "<" + name + ">" : "<...>"; + } catch (x) { + return "<...>"; + } + } + function getOwner() { + var dispatcher = ReactSharedInternalsServer.A; + return null === dispatcher ? null : dispatcher.getOwner(); + } + function UnknownOwner() { + return Error("react-stack-top-frame"); + } + function hasValidKey(config) { + if (hasOwnProperty.call(config, "key")) { + var getter = Object.getOwnPropertyDescriptor(config, "key").get; + if (getter && getter.isReactWarning) return !1; + } + return void 0 !== config.key; + } + function defineKeyPropWarningGetter(props, displayName) { + function warnAboutAccessingKey() { + specialPropKeyWarningShown || + ((specialPropKeyWarningShown = !0), + console.error( + "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", + displayName + )); + } + warnAboutAccessingKey.isReactWarning = !0; + Object.defineProperty(props, "key", { + get: warnAboutAccessingKey, + configurable: !0 + }); + } + function elementRefGetterWithDeprecationWarning() { + var componentName = getComponentNameFromType(this.type); + didWarnAboutElementRef[componentName] || + ((didWarnAboutElementRef[componentName] = !0), + console.error( + "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release." + )); + componentName = this.props.ref; + return void 0 !== componentName ? componentName : null; + } + function ReactElement( + type, + key, + self, + source, + owner, + props, + debugStack, + debugTask + ) { + self = props.ref; + type = { + $$typeof: REACT_ELEMENT_TYPE, + type: type, + key: key, + props: props, + _owner: owner + }; + null !== (void 0 !== self ? self : null) + ? Object.defineProperty(type, "ref", { + enumerable: !1, + get: elementRefGetterWithDeprecationWarning + }) + : Object.defineProperty(type, "ref", { enumerable: !1, value: null }); + type._store = {}; + Object.defineProperty(type._store, "validated", { + configurable: !1, + enumerable: !1, + writable: !0, + value: 0 + }); + Object.defineProperty(type, "_debugInfo", { + configurable: !1, + enumerable: !1, + writable: !0, + value: null + }); + Object.defineProperty(type, "_debugStack", { + configurable: !1, + enumerable: !1, + writable: !0, + value: debugStack + }); + Object.defineProperty(type, "_debugTask", { + configurable: !1, + enumerable: !1, + writable: !0, + value: debugTask + }); + Object.freeze && (Object.freeze(type.props), Object.freeze(type)); + return type; + } + function jsxDEVImpl( + type, + config, + maybeKey, + isStaticChildren, + source, + self, + debugStack, + debugTask + ) { + var children = config.children; + if (void 0 !== children) + if (isStaticChildren) + if (isArrayImpl(children)) { + for ( + isStaticChildren = 0; + isStaticChildren < children.length; + isStaticChildren++ + ) + validateChildKeys(children[isStaticChildren]); + Object.freeze && Object.freeze(children); + } else + console.error( + "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead." + ); + else validateChildKeys(children); + if (hasOwnProperty.call(config, "key")) { + children = getComponentNameFromType(type); + var keys = Object.keys(config).filter(function (k) { + return "key" !== k; + }); + isStaticChildren = + 0 < keys.length + ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" + : "{key: someKey}"; + didWarnAboutKeySpread[children + isStaticChildren] || + ((keys = + 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"), + console.error( + 'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />', + isStaticChildren, + children, + keys, + children + ), + (didWarnAboutKeySpread[children + isStaticChildren] = !0)); + } + children = null; + void 0 !== maybeKey && + (checkKeyStringCoercion(maybeKey), (children = "" + maybeKey)); + hasValidKey(config) && + (checkKeyStringCoercion(config.key), (children = "" + config.key)); + if ("key" in config) { + maybeKey = {}; + for (var propName in config) + "key" !== propName && (maybeKey[propName] = config[propName]); + } else maybeKey = config; + children && + defineKeyPropWarningGetter( + maybeKey, + "function" === typeof type + ? type.displayName || type.name || "Unknown" + : type + ); + return ReactElement( + type, + children, + self, + source, + getOwner(), + maybeKey, + debugStack, + debugTask + ); + } + function validateChildKeys(node) { + "object" === typeof node && + null !== node && + node.$$typeof === REACT_ELEMENT_TYPE && + node._store && + (node._store.validated = 1); + } + var React = require("react"), + REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_PORTAL_TYPE = Symbol.for("react.portal"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), + REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), + REACT_PROFILER_TYPE = Symbol.for("react.profiler"); + Symbol.for("react.provider"); + var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), + REACT_CONTEXT_TYPE = Symbol.for("react.context"), + REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), + REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), + REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), + REACT_MEMO_TYPE = Symbol.for("react.memo"), + REACT_LAZY_TYPE = Symbol.for("react.lazy"), + REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), + REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), + ReactSharedInternalsServer = + React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; + if (!ReactSharedInternalsServer) + throw Error( + 'The "react" package in this environment is not configured correctly. The "react-server" condition must be enabled in any environment that runs React Server Components.' + ); + var hasOwnProperty = Object.prototype.hasOwnProperty, + isArrayImpl = Array.isArray, + createTask = console.createTask + ? console.createTask + : function () { + return null; + }; + React = { + "react-stack-bottom-frame": function (callStackForError) { + return callStackForError(); + } + }; + var specialPropKeyWarningShown; + var didWarnAboutElementRef = {}; + var unknownOwnerDebugStack = React["react-stack-bottom-frame"].bind( + React, + UnknownOwner + )(); + var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner)); + var didWarnAboutKeySpread = {}; + exports.Fragment = REACT_FRAGMENT_TYPE; + exports.jsx = function (type, config, maybeKey, source, self) { + var trackActualOwner = + 1e4 > ReactSharedInternalsServer.recentlyCreatedOwnerStacks++; + return jsxDEVImpl( + type, + config, + maybeKey, + !1, + source, + self, + trackActualOwner + ? Error("react-stack-top-frame") + : unknownOwnerDebugStack, + trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask + ); + }; + exports.jsxDEV = function ( + type, + config, + maybeKey, + isStaticChildren, + source, + self + ) { + var trackActualOwner = + 1e4 > ReactSharedInternalsServer.recentlyCreatedOwnerStacks++; + return jsxDEVImpl( + type, + config, + maybeKey, + isStaticChildren, + source, + self, + trackActualOwner + ? Error("react-stack-top-frame") + : unknownOwnerDebugStack, + trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask + ); + }; + exports.jsxs = function (type, config, maybeKey, source, self) { + var trackActualOwner = + 1e4 > ReactSharedInternalsServer.recentlyCreatedOwnerStacks++; + return jsxDEVImpl( + type, + config, + maybeKey, + !0, + source, + self, + trackActualOwner + ? Error("react-stack-top-frame") + : unknownOwnerDebugStack, + trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask + ); + }; + })(); diff --git a/node_modules/react/cjs/react-jsx-runtime.react-server.production.js b/node_modules/react/cjs/react-jsx-runtime.react-server.production.js new file mode 100644 index 0000000..486facb --- /dev/null +++ b/node_modules/react/cjs/react-jsx-runtime.react-server.production.js @@ -0,0 +1,40 @@ +/** + * @license React + * react-jsx-runtime.react-server.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +var React = require("react"), + REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"); +if (!React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE) + throw Error( + 'The "react" package in this environment is not configured correctly. The "react-server" condition must be enabled in any environment that runs React Server Components.' + ); +function jsxProd(type, config, maybeKey) { + var key = null; + void 0 !== maybeKey && (key = "" + maybeKey); + void 0 !== config.key && (key = "" + config.key); + if ("key" in config) { + maybeKey = {}; + for (var propName in config) + "key" !== propName && (maybeKey[propName] = config[propName]); + } else maybeKey = config; + config = maybeKey.ref; + return { + $$typeof: REACT_ELEMENT_TYPE, + type: type, + key: key, + ref: void 0 !== config ? config : null, + props: maybeKey + }; +} +exports.Fragment = REACT_FRAGMENT_TYPE; +exports.jsx = jsxProd; +exports.jsxDEV = void 0; +exports.jsxs = jsxProd; diff --git a/node_modules/react/cjs/react.development.js b/node_modules/react/cjs/react.development.js new file mode 100644 index 0000000..bd66364 --- /dev/null +++ b/node_modules/react/cjs/react.development.js @@ -0,0 +1,1242 @@ +/** + * @license React + * react.development.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +"production" !== process.env.NODE_ENV && + (function () { + function defineDeprecationWarning(methodName, info) { + Object.defineProperty(Component.prototype, methodName, { + get: function () { + console.warn( + "%s(...) is deprecated in plain JavaScript React classes. %s", + info[0], + info[1] + ); + } + }); + } + function getIteratorFn(maybeIterable) { + if (null === maybeIterable || "object" !== typeof maybeIterable) + return null; + maybeIterable = + (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || + maybeIterable["@@iterator"]; + return "function" === typeof maybeIterable ? maybeIterable : null; + } + function warnNoop(publicInstance, callerName) { + publicInstance = + ((publicInstance = publicInstance.constructor) && + (publicInstance.displayName || publicInstance.name)) || + "ReactClass"; + var warningKey = publicInstance + "." + callerName; + didWarnStateUpdateForUnmountedComponent[warningKey] || + (console.error( + "Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.", + callerName, + publicInstance + ), + (didWarnStateUpdateForUnmountedComponent[warningKey] = !0)); + } + function Component(props, context, updater) { + this.props = props; + this.context = context; + this.refs = emptyObject; + this.updater = updater || ReactNoopUpdateQueue; + } + function ComponentDummy() {} + function PureComponent(props, context, updater) { + this.props = props; + this.context = context; + this.refs = emptyObject; + this.updater = updater || ReactNoopUpdateQueue; + } + function testStringCoercion(value) { + return "" + value; + } + function checkKeyStringCoercion(value) { + try { + testStringCoercion(value); + var JSCompiler_inline_result = !1; + } catch (e) { + JSCompiler_inline_result = !0; + } + if (JSCompiler_inline_result) { + JSCompiler_inline_result = console; + var JSCompiler_temp_const = JSCompiler_inline_result.error; + var JSCompiler_inline_result$jscomp$0 = + ("function" === typeof Symbol && + Symbol.toStringTag && + value[Symbol.toStringTag]) || + value.constructor.name || + "Object"; + JSCompiler_temp_const.call( + JSCompiler_inline_result, + "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", + JSCompiler_inline_result$jscomp$0 + ); + return testStringCoercion(value); + } + } + function getComponentNameFromType(type) { + if (null == type) return null; + if ("function" === typeof type) + return type.$$typeof === REACT_CLIENT_REFERENCE + ? null + : type.displayName || type.name || null; + if ("string" === typeof type) return type; + switch (type) { + case REACT_FRAGMENT_TYPE: + return "Fragment"; + case REACT_PROFILER_TYPE: + return "Profiler"; + case REACT_STRICT_MODE_TYPE: + return "StrictMode"; + case REACT_SUSPENSE_TYPE: + return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + case REACT_ACTIVITY_TYPE: + return "Activity"; + } + if ("object" === typeof type) + switch ( + ("number" === typeof type.tag && + console.error( + "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." + ), + type.$$typeof) + ) { + case REACT_PORTAL_TYPE: + return "Portal"; + case REACT_CONTEXT_TYPE: + return (type.displayName || "Context") + ".Provider"; + case REACT_CONSUMER_TYPE: + return (type._context.displayName || "Context") + ".Consumer"; + case REACT_FORWARD_REF_TYPE: + var innerType = type.render; + type = type.displayName; + type || + ((type = innerType.displayName || innerType.name || ""), + (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef")); + return type; + case REACT_MEMO_TYPE: + return ( + (innerType = type.displayName || null), + null !== innerType + ? innerType + : getComponentNameFromType(type.type) || "Memo" + ); + case REACT_LAZY_TYPE: + innerType = type._payload; + type = type._init; + try { + return getComponentNameFromType(type(innerType)); + } catch (x) {} + } + return null; + } + function getTaskName(type) { + if (type === REACT_FRAGMENT_TYPE) return "<>"; + if ( + "object" === typeof type && + null !== type && + type.$$typeof === REACT_LAZY_TYPE + ) + return "<...>"; + try { + var name = getComponentNameFromType(type); + return name ? "<" + name + ">" : "<...>"; + } catch (x) { + return "<...>"; + } + } + function getOwner() { + var dispatcher = ReactSharedInternals.A; + return null === dispatcher ? null : dispatcher.getOwner(); + } + function UnknownOwner() { + return Error("react-stack-top-frame"); + } + function hasValidKey(config) { + if (hasOwnProperty.call(config, "key")) { + var getter = Object.getOwnPropertyDescriptor(config, "key").get; + if (getter && getter.isReactWarning) return !1; + } + return void 0 !== config.key; + } + function defineKeyPropWarningGetter(props, displayName) { + function warnAboutAccessingKey() { + specialPropKeyWarningShown || + ((specialPropKeyWarningShown = !0), + console.error( + "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", + displayName + )); + } + warnAboutAccessingKey.isReactWarning = !0; + Object.defineProperty(props, "key", { + get: warnAboutAccessingKey, + configurable: !0 + }); + } + function elementRefGetterWithDeprecationWarning() { + var componentName = getComponentNameFromType(this.type); + didWarnAboutElementRef[componentName] || + ((didWarnAboutElementRef[componentName] = !0), + console.error( + "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release." + )); + componentName = this.props.ref; + return void 0 !== componentName ? componentName : null; + } + function ReactElement( + type, + key, + self, + source, + owner, + props, + debugStack, + debugTask + ) { + self = props.ref; + type = { + $$typeof: REACT_ELEMENT_TYPE, + type: type, + key: key, + props: props, + _owner: owner + }; + null !== (void 0 !== self ? self : null) + ? Object.defineProperty(type, "ref", { + enumerable: !1, + get: elementRefGetterWithDeprecationWarning + }) + : Object.defineProperty(type, "ref", { enumerable: !1, value: null }); + type._store = {}; + Object.defineProperty(type._store, "validated", { + configurable: !1, + enumerable: !1, + writable: !0, + value: 0 + }); + Object.defineProperty(type, "_debugInfo", { + configurable: !1, + enumerable: !1, + writable: !0, + value: null + }); + Object.defineProperty(type, "_debugStack", { + configurable: !1, + enumerable: !1, + writable: !0, + value: debugStack + }); + Object.defineProperty(type, "_debugTask", { + configurable: !1, + enumerable: !1, + writable: !0, + value: debugTask + }); + Object.freeze && (Object.freeze(type.props), Object.freeze(type)); + return type; + } + function cloneAndReplaceKey(oldElement, newKey) { + newKey = ReactElement( + oldElement.type, + newKey, + void 0, + void 0, + oldElement._owner, + oldElement.props, + oldElement._debugStack, + oldElement._debugTask + ); + oldElement._store && + (newKey._store.validated = oldElement._store.validated); + return newKey; + } + function isValidElement(object) { + return ( + "object" === typeof object && + null !== object && + object.$$typeof === REACT_ELEMENT_TYPE + ); + } + function escape(key) { + var escaperLookup = { "=": "=0", ":": "=2" }; + return ( + "$" + + key.replace(/[=:]/g, function (match) { + return escaperLookup[match]; + }) + ); + } + function getElementKey(element, index) { + return "object" === typeof element && + null !== element && + null != element.key + ? (checkKeyStringCoercion(element.key), escape("" + element.key)) + : index.toString(36); + } + function noop$1() {} + function resolveThenable(thenable) { + switch (thenable.status) { + case "fulfilled": + return thenable.value; + case "rejected": + throw thenable.reason; + default: + switch ( + ("string" === typeof thenable.status + ? thenable.then(noop$1, noop$1) + : ((thenable.status = "pending"), + thenable.then( + function (fulfilledValue) { + "pending" === thenable.status && + ((thenable.status = "fulfilled"), + (thenable.value = fulfilledValue)); + }, + function (error) { + "pending" === thenable.status && + ((thenable.status = "rejected"), + (thenable.reason = error)); + } + )), + thenable.status) + ) { + case "fulfilled": + return thenable.value; + case "rejected": + throw thenable.reason; + } + } + throw thenable; + } + function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) { + var type = typeof children; + if ("undefined" === type || "boolean" === type) children = null; + var invokeCallback = !1; + if (null === children) invokeCallback = !0; + else + switch (type) { + case "bigint": + case "string": + case "number": + invokeCallback = !0; + break; + case "object": + switch (children.$$typeof) { + case REACT_ELEMENT_TYPE: + case REACT_PORTAL_TYPE: + invokeCallback = !0; + break; + case REACT_LAZY_TYPE: + return ( + (invokeCallback = children._init), + mapIntoArray( + invokeCallback(children._payload), + array, + escapedPrefix, + nameSoFar, + callback + ) + ); + } + } + if (invokeCallback) { + invokeCallback = children; + callback = callback(invokeCallback); + var childKey = + "" === nameSoFar ? "." + getElementKey(invokeCallback, 0) : nameSoFar; + isArrayImpl(callback) + ? ((escapedPrefix = ""), + null != childKey && + (escapedPrefix = + childKey.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), + mapIntoArray(callback, array, escapedPrefix, "", function (c) { + return c; + })) + : null != callback && + (isValidElement(callback) && + (null != callback.key && + ((invokeCallback && invokeCallback.key === callback.key) || + checkKeyStringCoercion(callback.key)), + (escapedPrefix = cloneAndReplaceKey( + callback, + escapedPrefix + + (null == callback.key || + (invokeCallback && invokeCallback.key === callback.key) + ? "" + : ("" + callback.key).replace( + userProvidedKeyEscapeRegex, + "$&/" + ) + "/") + + childKey + )), + "" !== nameSoFar && + null != invokeCallback && + isValidElement(invokeCallback) && + null == invokeCallback.key && + invokeCallback._store && + !invokeCallback._store.validated && + (escapedPrefix._store.validated = 2), + (callback = escapedPrefix)), + array.push(callback)); + return 1; + } + invokeCallback = 0; + childKey = "" === nameSoFar ? "." : nameSoFar + ":"; + if (isArrayImpl(children)) + for (var i = 0; i < children.length; i++) + (nameSoFar = children[i]), + (type = childKey + getElementKey(nameSoFar, i)), + (invokeCallback += mapIntoArray( + nameSoFar, + array, + escapedPrefix, + type, + callback + )); + else if (((i = getIteratorFn(children)), "function" === typeof i)) + for ( + i === children.entries && + (didWarnAboutMaps || + console.warn( + "Using Maps as children is not supported. Use an array of keyed ReactElements instead." + ), + (didWarnAboutMaps = !0)), + children = i.call(children), + i = 0; + !(nameSoFar = children.next()).done; + + ) + (nameSoFar = nameSoFar.value), + (type = childKey + getElementKey(nameSoFar, i++)), + (invokeCallback += mapIntoArray( + nameSoFar, + array, + escapedPrefix, + type, + callback + )); + else if ("object" === type) { + if ("function" === typeof children.then) + return mapIntoArray( + resolveThenable(children), + array, + escapedPrefix, + nameSoFar, + callback + ); + array = String(children); + throw Error( + "Objects are not valid as a React child (found: " + + ("[object Object]" === array + ? "object with keys {" + Object.keys(children).join(", ") + "}" + : array) + + "). If you meant to render a collection of children, use an array instead." + ); + } + return invokeCallback; + } + function mapChildren(children, func, context) { + if (null == children) return children; + var result = [], + count = 0; + mapIntoArray(children, result, "", "", function (child) { + return func.call(context, child, count++); + }); + return result; + } + function lazyInitializer(payload) { + if (-1 === payload._status) { + var ctor = payload._result; + ctor = ctor(); + ctor.then( + function (moduleObject) { + if (0 === payload._status || -1 === payload._status) + (payload._status = 1), (payload._result = moduleObject); + }, + function (error) { + if (0 === payload._status || -1 === payload._status) + (payload._status = 2), (payload._result = error); + } + ); + -1 === payload._status && + ((payload._status = 0), (payload._result = ctor)); + } + if (1 === payload._status) + return ( + (ctor = payload._result), + void 0 === ctor && + console.error( + "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?", + ctor + ), + "default" in ctor || + console.error( + "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))", + ctor + ), + ctor.default + ); + throw payload._result; + } + function resolveDispatcher() { + var dispatcher = ReactSharedInternals.H; + null === dispatcher && + console.error( + "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem." + ); + return dispatcher; + } + function noop() {} + function enqueueTask(task) { + if (null === enqueueTaskImpl) + try { + var requireString = ("require" + Math.random()).slice(0, 7); + enqueueTaskImpl = (module && module[requireString]).call( + module, + "timers" + ).setImmediate; + } catch (_err) { + enqueueTaskImpl = function (callback) { + !1 === didWarnAboutMessageChannel && + ((didWarnAboutMessageChannel = !0), + "undefined" === typeof MessageChannel && + console.error( + "This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning." + )); + var channel = new MessageChannel(); + channel.port1.onmessage = callback; + channel.port2.postMessage(void 0); + }; + } + return enqueueTaskImpl(task); + } + function aggregateErrors(errors) { + return 1 < errors.length && "function" === typeof AggregateError + ? new AggregateError(errors) + : errors[0]; + } + function popActScope(prevActQueue, prevActScopeDepth) { + prevActScopeDepth !== actScopeDepth - 1 && + console.error( + "You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. " + ); + actScopeDepth = prevActScopeDepth; + } + function recursivelyFlushAsyncActWork(returnValue, resolve, reject) { + var queue = ReactSharedInternals.actQueue; + if (null !== queue) + if (0 !== queue.length) + try { + flushActQueue(queue); + enqueueTask(function () { + return recursivelyFlushAsyncActWork(returnValue, resolve, reject); + }); + return; + } catch (error) { + ReactSharedInternals.thrownErrors.push(error); + } + else ReactSharedInternals.actQueue = null; + 0 < ReactSharedInternals.thrownErrors.length + ? ((queue = aggregateErrors(ReactSharedInternals.thrownErrors)), + (ReactSharedInternals.thrownErrors.length = 0), + reject(queue)) + : resolve(returnValue); + } + function flushActQueue(queue) { + if (!isFlushing) { + isFlushing = !0; + var i = 0; + try { + for (; i < queue.length; i++) { + var callback = queue[i]; + do { + ReactSharedInternals.didUsePromise = !1; + var continuation = callback(!1); + if (null !== continuation) { + if (ReactSharedInternals.didUsePromise) { + queue[i] = callback; + queue.splice(0, i); + return; + } + callback = continuation; + } else break; + } while (1); + } + queue.length = 0; + } catch (error) { + queue.splice(0, i + 1), ReactSharedInternals.thrownErrors.push(error); + } finally { + isFlushing = !1; + } + } + } + "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && + "function" === + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && + __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); + var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_PORTAL_TYPE = Symbol.for("react.portal"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), + REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), + REACT_PROFILER_TYPE = Symbol.for("react.profiler"); + Symbol.for("react.provider"); + var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), + REACT_CONTEXT_TYPE = Symbol.for("react.context"), + REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), + REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), + REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), + REACT_MEMO_TYPE = Symbol.for("react.memo"), + REACT_LAZY_TYPE = Symbol.for("react.lazy"), + REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), + MAYBE_ITERATOR_SYMBOL = Symbol.iterator, + didWarnStateUpdateForUnmountedComponent = {}, + ReactNoopUpdateQueue = { + isMounted: function () { + return !1; + }, + enqueueForceUpdate: function (publicInstance) { + warnNoop(publicInstance, "forceUpdate"); + }, + enqueueReplaceState: function (publicInstance) { + warnNoop(publicInstance, "replaceState"); + }, + enqueueSetState: function (publicInstance) { + warnNoop(publicInstance, "setState"); + } + }, + assign = Object.assign, + emptyObject = {}; + Object.freeze(emptyObject); + Component.prototype.isReactComponent = {}; + Component.prototype.setState = function (partialState, callback) { + if ( + "object" !== typeof partialState && + "function" !== typeof partialState && + null != partialState + ) + throw Error( + "takes an object of state variables to update or a function which returns an object of state variables." + ); + this.updater.enqueueSetState(this, partialState, callback, "setState"); + }; + Component.prototype.forceUpdate = function (callback) { + this.updater.enqueueForceUpdate(this, callback, "forceUpdate"); + }; + var deprecatedAPIs = { + isMounted: [ + "isMounted", + "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks." + ], + replaceState: [ + "replaceState", + "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)." + ] + }, + fnName; + for (fnName in deprecatedAPIs) + deprecatedAPIs.hasOwnProperty(fnName) && + defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); + ComponentDummy.prototype = Component.prototype; + deprecatedAPIs = PureComponent.prototype = new ComponentDummy(); + deprecatedAPIs.constructor = PureComponent; + assign(deprecatedAPIs, Component.prototype); + deprecatedAPIs.isPureReactComponent = !0; + var isArrayImpl = Array.isArray, + REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), + ReactSharedInternals = { + H: null, + A: null, + T: null, + S: null, + V: null, + actQueue: null, + isBatchingLegacy: !1, + didScheduleLegacyUpdate: !1, + didUsePromise: !1, + thrownErrors: [], + getCurrentStack: null, + recentlyCreatedOwnerStacks: 0 + }, + hasOwnProperty = Object.prototype.hasOwnProperty, + createTask = console.createTask + ? console.createTask + : function () { + return null; + }; + deprecatedAPIs = { + "react-stack-bottom-frame": function (callStackForError) { + return callStackForError(); + } + }; + var specialPropKeyWarningShown, didWarnAboutOldJSXRuntime; + var didWarnAboutElementRef = {}; + var unknownOwnerDebugStack = deprecatedAPIs[ + "react-stack-bottom-frame" + ].bind(deprecatedAPIs, UnknownOwner)(); + var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner)); + var didWarnAboutMaps = !1, + userProvidedKeyEscapeRegex = /\/+/g, + reportGlobalError = + "function" === typeof reportError + ? reportError + : function (error) { + if ( + "object" === typeof window && + "function" === typeof window.ErrorEvent + ) { + var event = new window.ErrorEvent("error", { + bubbles: !0, + cancelable: !0, + message: + "object" === typeof error && + null !== error && + "string" === typeof error.message + ? String(error.message) + : String(error), + error: error + }); + if (!window.dispatchEvent(event)) return; + } else if ( + "object" === typeof process && + "function" === typeof process.emit + ) { + process.emit("uncaughtException", error); + return; + } + console.error(error); + }, + didWarnAboutMessageChannel = !1, + enqueueTaskImpl = null, + actScopeDepth = 0, + didWarnNoAwaitAct = !1, + isFlushing = !1, + queueSeveralMicrotasks = + "function" === typeof queueMicrotask + ? function (callback) { + queueMicrotask(function () { + return queueMicrotask(callback); + }); + } + : enqueueTask; + deprecatedAPIs = Object.freeze({ + __proto__: null, + c: function (size) { + return resolveDispatcher().useMemoCache(size); + } + }); + exports.Children = { + map: mapChildren, + forEach: function (children, forEachFunc, forEachContext) { + mapChildren( + children, + function () { + forEachFunc.apply(this, arguments); + }, + forEachContext + ); + }, + count: function (children) { + var n = 0; + mapChildren(children, function () { + n++; + }); + return n; + }, + toArray: function (children) { + return ( + mapChildren(children, function (child) { + return child; + }) || [] + ); + }, + only: function (children) { + if (!isValidElement(children)) + throw Error( + "React.Children.only expected to receive a single React element child." + ); + return children; + } + }; + exports.Component = Component; + exports.Fragment = REACT_FRAGMENT_TYPE; + exports.Profiler = REACT_PROFILER_TYPE; + exports.PureComponent = PureComponent; + exports.StrictMode = REACT_STRICT_MODE_TYPE; + exports.Suspense = REACT_SUSPENSE_TYPE; + exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = + ReactSharedInternals; + exports.__COMPILER_RUNTIME = deprecatedAPIs; + exports.act = function (callback) { + var prevActQueue = ReactSharedInternals.actQueue, + prevActScopeDepth = actScopeDepth; + actScopeDepth++; + var queue = (ReactSharedInternals.actQueue = + null !== prevActQueue ? prevActQueue : []), + didAwaitActCall = !1; + try { + var result = callback(); + } catch (error) { + ReactSharedInternals.thrownErrors.push(error); + } + if (0 < ReactSharedInternals.thrownErrors.length) + throw ( + (popActScope(prevActQueue, prevActScopeDepth), + (callback = aggregateErrors(ReactSharedInternals.thrownErrors)), + (ReactSharedInternals.thrownErrors.length = 0), + callback) + ); + if ( + null !== result && + "object" === typeof result && + "function" === typeof result.then + ) { + var thenable = result; + queueSeveralMicrotasks(function () { + didAwaitActCall || + didWarnNoAwaitAct || + ((didWarnNoAwaitAct = !0), + console.error( + "You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);" + )); + }); + return { + then: function (resolve, reject) { + didAwaitActCall = !0; + thenable.then( + function (returnValue) { + popActScope(prevActQueue, prevActScopeDepth); + if (0 === prevActScopeDepth) { + try { + flushActQueue(queue), + enqueueTask(function () { + return recursivelyFlushAsyncActWork( + returnValue, + resolve, + reject + ); + }); + } catch (error$0) { + ReactSharedInternals.thrownErrors.push(error$0); + } + if (0 < ReactSharedInternals.thrownErrors.length) { + var _thrownError = aggregateErrors( + ReactSharedInternals.thrownErrors + ); + ReactSharedInternals.thrownErrors.length = 0; + reject(_thrownError); + } + } else resolve(returnValue); + }, + function (error) { + popActScope(prevActQueue, prevActScopeDepth); + 0 < ReactSharedInternals.thrownErrors.length + ? ((error = aggregateErrors( + ReactSharedInternals.thrownErrors + )), + (ReactSharedInternals.thrownErrors.length = 0), + reject(error)) + : reject(error); + } + ); + } + }; + } + var returnValue$jscomp$0 = result; + popActScope(prevActQueue, prevActScopeDepth); + 0 === prevActScopeDepth && + (flushActQueue(queue), + 0 !== queue.length && + queueSeveralMicrotasks(function () { + didAwaitActCall || + didWarnNoAwaitAct || + ((didWarnNoAwaitAct = !0), + console.error( + "A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)" + )); + }), + (ReactSharedInternals.actQueue = null)); + if (0 < ReactSharedInternals.thrownErrors.length) + throw ( + ((callback = aggregateErrors(ReactSharedInternals.thrownErrors)), + (ReactSharedInternals.thrownErrors.length = 0), + callback) + ); + return { + then: function (resolve, reject) { + didAwaitActCall = !0; + 0 === prevActScopeDepth + ? ((ReactSharedInternals.actQueue = queue), + enqueueTask(function () { + return recursivelyFlushAsyncActWork( + returnValue$jscomp$0, + resolve, + reject + ); + })) + : resolve(returnValue$jscomp$0); + } + }; + }; + exports.cache = function (fn) { + return function () { + return fn.apply(null, arguments); + }; + }; + exports.captureOwnerStack = function () { + var getCurrentStack = ReactSharedInternals.getCurrentStack; + return null === getCurrentStack ? null : getCurrentStack(); + }; + exports.cloneElement = function (element, config, children) { + if (null === element || void 0 === element) + throw Error( + "The argument must be a React element, but you passed " + + element + + "." + ); + var props = assign({}, element.props), + key = element.key, + owner = element._owner; + if (null != config) { + var JSCompiler_inline_result; + a: { + if ( + hasOwnProperty.call(config, "ref") && + (JSCompiler_inline_result = Object.getOwnPropertyDescriptor( + config, + "ref" + ).get) && + JSCompiler_inline_result.isReactWarning + ) { + JSCompiler_inline_result = !1; + break a; + } + JSCompiler_inline_result = void 0 !== config.ref; + } + JSCompiler_inline_result && (owner = getOwner()); + hasValidKey(config) && + (checkKeyStringCoercion(config.key), (key = "" + config.key)); + for (propName in config) + !hasOwnProperty.call(config, propName) || + "key" === propName || + "__self" === propName || + "__source" === propName || + ("ref" === propName && void 0 === config.ref) || + (props[propName] = config[propName]); + } + var propName = arguments.length - 2; + if (1 === propName) props.children = children; + else if (1 < propName) { + JSCompiler_inline_result = Array(propName); + for (var i = 0; i < propName; i++) + JSCompiler_inline_result[i] = arguments[i + 2]; + props.children = JSCompiler_inline_result; + } + props = ReactElement( + element.type, + key, + void 0, + void 0, + owner, + props, + element._debugStack, + element._debugTask + ); + for (key = 2; key < arguments.length; key++) + (owner = arguments[key]), + isValidElement(owner) && owner._store && (owner._store.validated = 1); + return props; + }; + exports.createContext = function (defaultValue) { + defaultValue = { + $$typeof: REACT_CONTEXT_TYPE, + _currentValue: defaultValue, + _currentValue2: defaultValue, + _threadCount: 0, + Provider: null, + Consumer: null + }; + defaultValue.Provider = defaultValue; + defaultValue.Consumer = { + $$typeof: REACT_CONSUMER_TYPE, + _context: defaultValue + }; + defaultValue._currentRenderer = null; + defaultValue._currentRenderer2 = null; + return defaultValue; + }; + exports.createElement = function (type, config, children) { + for (var i = 2; i < arguments.length; i++) { + var node = arguments[i]; + isValidElement(node) && node._store && (node._store.validated = 1); + } + i = {}; + node = null; + if (null != config) + for (propName in (didWarnAboutOldJSXRuntime || + !("__self" in config) || + "key" in config || + ((didWarnAboutOldJSXRuntime = !0), + console.warn( + "Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform" + )), + hasValidKey(config) && + (checkKeyStringCoercion(config.key), (node = "" + config.key)), + config)) + hasOwnProperty.call(config, propName) && + "key" !== propName && + "__self" !== propName && + "__source" !== propName && + (i[propName] = config[propName]); + var childrenLength = arguments.length - 2; + if (1 === childrenLength) i.children = children; + else if (1 < childrenLength) { + for ( + var childArray = Array(childrenLength), _i = 0; + _i < childrenLength; + _i++ + ) + childArray[_i] = arguments[_i + 2]; + Object.freeze && Object.freeze(childArray); + i.children = childArray; + } + if (type && type.defaultProps) + for (propName in ((childrenLength = type.defaultProps), childrenLength)) + void 0 === i[propName] && (i[propName] = childrenLength[propName]); + node && + defineKeyPropWarningGetter( + i, + "function" === typeof type + ? type.displayName || type.name || "Unknown" + : type + ); + var propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++; + return ReactElement( + type, + node, + void 0, + void 0, + getOwner(), + i, + propName ? Error("react-stack-top-frame") : unknownOwnerDebugStack, + propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask + ); + }; + exports.createRef = function () { + var refObject = { current: null }; + Object.seal(refObject); + return refObject; + }; + exports.forwardRef = function (render) { + null != render && render.$$typeof === REACT_MEMO_TYPE + ? console.error( + "forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))." + ) + : "function" !== typeof render + ? console.error( + "forwardRef requires a render function but was given %s.", + null === render ? "null" : typeof render + ) + : 0 !== render.length && + 2 !== render.length && + console.error( + "forwardRef render functions accept exactly two parameters: props and ref. %s", + 1 === render.length + ? "Did you forget to use the ref parameter?" + : "Any additional parameter will be undefined." + ); + null != render && + null != render.defaultProps && + console.error( + "forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?" + ); + var elementType = { $$typeof: REACT_FORWARD_REF_TYPE, render: render }, + ownName; + Object.defineProperty(elementType, "displayName", { + enumerable: !1, + configurable: !0, + get: function () { + return ownName; + }, + set: function (name) { + ownName = name; + render.name || + render.displayName || + (Object.defineProperty(render, "name", { value: name }), + (render.displayName = name)); + } + }); + return elementType; + }; + exports.isValidElement = isValidElement; + exports.lazy = function (ctor) { + return { + $$typeof: REACT_LAZY_TYPE, + _payload: { _status: -1, _result: ctor }, + _init: lazyInitializer + }; + }; + exports.memo = function (type, compare) { + null == type && + console.error( + "memo: The first argument must be a component. Instead received: %s", + null === type ? "null" : typeof type + ); + compare = { + $$typeof: REACT_MEMO_TYPE, + type: type, + compare: void 0 === compare ? null : compare + }; + var ownName; + Object.defineProperty(compare, "displayName", { + enumerable: !1, + configurable: !0, + get: function () { + return ownName; + }, + set: function (name) { + ownName = name; + type.name || + type.displayName || + (Object.defineProperty(type, "name", { value: name }), + (type.displayName = name)); + } + }); + return compare; + }; + exports.startTransition = function (scope) { + var prevTransition = ReactSharedInternals.T, + currentTransition = {}; + ReactSharedInternals.T = currentTransition; + currentTransition._updatedFibers = new Set(); + try { + var returnValue = scope(), + onStartTransitionFinish = ReactSharedInternals.S; + null !== onStartTransitionFinish && + onStartTransitionFinish(currentTransition, returnValue); + "object" === typeof returnValue && + null !== returnValue && + "function" === typeof returnValue.then && + returnValue.then(noop, reportGlobalError); + } catch (error) { + reportGlobalError(error); + } finally { + null === prevTransition && + currentTransition._updatedFibers && + ((scope = currentTransition._updatedFibers.size), + currentTransition._updatedFibers.clear(), + 10 < scope && + console.warn( + "Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table." + )), + (ReactSharedInternals.T = prevTransition); + } + }; + exports.unstable_useCacheRefresh = function () { + return resolveDispatcher().useCacheRefresh(); + }; + exports.use = function (usable) { + return resolveDispatcher().use(usable); + }; + exports.useActionState = function (action, initialState, permalink) { + return resolveDispatcher().useActionState( + action, + initialState, + permalink + ); + }; + exports.useCallback = function (callback, deps) { + return resolveDispatcher().useCallback(callback, deps); + }; + exports.useContext = function (Context) { + var dispatcher = resolveDispatcher(); + Context.$$typeof === REACT_CONSUMER_TYPE && + console.error( + "Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?" + ); + return dispatcher.useContext(Context); + }; + exports.useDebugValue = function (value, formatterFn) { + return resolveDispatcher().useDebugValue(value, formatterFn); + }; + exports.useDeferredValue = function (value, initialValue) { + return resolveDispatcher().useDeferredValue(value, initialValue); + }; + exports.useEffect = function (create, createDeps, update) { + null == create && + console.warn( + "React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?" + ); + var dispatcher = resolveDispatcher(); + if ("function" === typeof update) + throw Error( + "useEffect CRUD overload is not enabled in this build of React." + ); + return dispatcher.useEffect(create, createDeps); + }; + exports.useId = function () { + return resolveDispatcher().useId(); + }; + exports.useImperativeHandle = function (ref, create, deps) { + return resolveDispatcher().useImperativeHandle(ref, create, deps); + }; + exports.useInsertionEffect = function (create, deps) { + null == create && + console.warn( + "React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?" + ); + return resolveDispatcher().useInsertionEffect(create, deps); + }; + exports.useLayoutEffect = function (create, deps) { + null == create && + console.warn( + "React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?" + ); + return resolveDispatcher().useLayoutEffect(create, deps); + }; + exports.useMemo = function (create, deps) { + return resolveDispatcher().useMemo(create, deps); + }; + exports.useOptimistic = function (passthrough, reducer) { + return resolveDispatcher().useOptimistic(passthrough, reducer); + }; + exports.useReducer = function (reducer, initialArg, init) { + return resolveDispatcher().useReducer(reducer, initialArg, init); + }; + exports.useRef = function (initialValue) { + return resolveDispatcher().useRef(initialValue); + }; + exports.useState = function (initialState) { + return resolveDispatcher().useState(initialState); + }; + exports.useSyncExternalStore = function ( + subscribe, + getSnapshot, + getServerSnapshot + ) { + return resolveDispatcher().useSyncExternalStore( + subscribe, + getSnapshot, + getServerSnapshot + ); + }; + exports.useTransition = function () { + return resolveDispatcher().useTransition(); + }; + exports.version = "19.1.0"; + "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && + "function" === + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && + __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); + })(); diff --git a/node_modules/react/cjs/react.production.js b/node_modules/react/cjs/react.production.js new file mode 100644 index 0000000..fb59cdd --- /dev/null +++ b/node_modules/react/cjs/react.production.js @@ -0,0 +1,546 @@ +/** + * @license React + * react.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_PORTAL_TYPE = Symbol.for("react.portal"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), + REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), + REACT_PROFILER_TYPE = Symbol.for("react.profiler"), + REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), + REACT_CONTEXT_TYPE = Symbol.for("react.context"), + REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), + REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), + REACT_MEMO_TYPE = Symbol.for("react.memo"), + REACT_LAZY_TYPE = Symbol.for("react.lazy"), + MAYBE_ITERATOR_SYMBOL = Symbol.iterator; +function getIteratorFn(maybeIterable) { + if (null === maybeIterable || "object" !== typeof maybeIterable) return null; + maybeIterable = + (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || + maybeIterable["@@iterator"]; + return "function" === typeof maybeIterable ? maybeIterable : null; +} +var ReactNoopUpdateQueue = { + isMounted: function () { + return !1; + }, + enqueueForceUpdate: function () {}, + enqueueReplaceState: function () {}, + enqueueSetState: function () {} + }, + assign = Object.assign, + emptyObject = {}; +function Component(props, context, updater) { + this.props = props; + this.context = context; + this.refs = emptyObject; + this.updater = updater || ReactNoopUpdateQueue; +} +Component.prototype.isReactComponent = {}; +Component.prototype.setState = function (partialState, callback) { + if ( + "object" !== typeof partialState && + "function" !== typeof partialState && + null != partialState + ) + throw Error( + "takes an object of state variables to update or a function which returns an object of state variables." + ); + this.updater.enqueueSetState(this, partialState, callback, "setState"); +}; +Component.prototype.forceUpdate = function (callback) { + this.updater.enqueueForceUpdate(this, callback, "forceUpdate"); +}; +function ComponentDummy() {} +ComponentDummy.prototype = Component.prototype; +function PureComponent(props, context, updater) { + this.props = props; + this.context = context; + this.refs = emptyObject; + this.updater = updater || ReactNoopUpdateQueue; +} +var pureComponentPrototype = (PureComponent.prototype = new ComponentDummy()); +pureComponentPrototype.constructor = PureComponent; +assign(pureComponentPrototype, Component.prototype); +pureComponentPrototype.isPureReactComponent = !0; +var isArrayImpl = Array.isArray, + ReactSharedInternals = { H: null, A: null, T: null, S: null, V: null }, + hasOwnProperty = Object.prototype.hasOwnProperty; +function ReactElement(type, key, self, source, owner, props) { + self = props.ref; + return { + $$typeof: REACT_ELEMENT_TYPE, + type: type, + key: key, + ref: void 0 !== self ? self : null, + props: props + }; +} +function cloneAndReplaceKey(oldElement, newKey) { + return ReactElement( + oldElement.type, + newKey, + void 0, + void 0, + void 0, + oldElement.props + ); +} +function isValidElement(object) { + return ( + "object" === typeof object && + null !== object && + object.$$typeof === REACT_ELEMENT_TYPE + ); +} +function escape(key) { + var escaperLookup = { "=": "=0", ":": "=2" }; + return ( + "$" + + key.replace(/[=:]/g, function (match) { + return escaperLookup[match]; + }) + ); +} +var userProvidedKeyEscapeRegex = /\/+/g; +function getElementKey(element, index) { + return "object" === typeof element && null !== element && null != element.key + ? escape("" + element.key) + : index.toString(36); +} +function noop$1() {} +function resolveThenable(thenable) { + switch (thenable.status) { + case "fulfilled": + return thenable.value; + case "rejected": + throw thenable.reason; + default: + switch ( + ("string" === typeof thenable.status + ? thenable.then(noop$1, noop$1) + : ((thenable.status = "pending"), + thenable.then( + function (fulfilledValue) { + "pending" === thenable.status && + ((thenable.status = "fulfilled"), + (thenable.value = fulfilledValue)); + }, + function (error) { + "pending" === thenable.status && + ((thenable.status = "rejected"), (thenable.reason = error)); + } + )), + thenable.status) + ) { + case "fulfilled": + return thenable.value; + case "rejected": + throw thenable.reason; + } + } + throw thenable; +} +function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) { + var type = typeof children; + if ("undefined" === type || "boolean" === type) children = null; + var invokeCallback = !1; + if (null === children) invokeCallback = !0; + else + switch (type) { + case "bigint": + case "string": + case "number": + invokeCallback = !0; + break; + case "object": + switch (children.$$typeof) { + case REACT_ELEMENT_TYPE: + case REACT_PORTAL_TYPE: + invokeCallback = !0; + break; + case REACT_LAZY_TYPE: + return ( + (invokeCallback = children._init), + mapIntoArray( + invokeCallback(children._payload), + array, + escapedPrefix, + nameSoFar, + callback + ) + ); + } + } + if (invokeCallback) + return ( + (callback = callback(children)), + (invokeCallback = + "" === nameSoFar ? "." + getElementKey(children, 0) : nameSoFar), + isArrayImpl(callback) + ? ((escapedPrefix = ""), + null != invokeCallback && + (escapedPrefix = + invokeCallback.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), + mapIntoArray(callback, array, escapedPrefix, "", function (c) { + return c; + })) + : null != callback && + (isValidElement(callback) && + (callback = cloneAndReplaceKey( + callback, + escapedPrefix + + (null == callback.key || + (children && children.key === callback.key) + ? "" + : ("" + callback.key).replace( + userProvidedKeyEscapeRegex, + "$&/" + ) + "/") + + invokeCallback + )), + array.push(callback)), + 1 + ); + invokeCallback = 0; + var nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":"; + if (isArrayImpl(children)) + for (var i = 0; i < children.length; i++) + (nameSoFar = children[i]), + (type = nextNamePrefix + getElementKey(nameSoFar, i)), + (invokeCallback += mapIntoArray( + nameSoFar, + array, + escapedPrefix, + type, + callback + )); + else if (((i = getIteratorFn(children)), "function" === typeof i)) + for ( + children = i.call(children), i = 0; + !(nameSoFar = children.next()).done; + + ) + (nameSoFar = nameSoFar.value), + (type = nextNamePrefix + getElementKey(nameSoFar, i++)), + (invokeCallback += mapIntoArray( + nameSoFar, + array, + escapedPrefix, + type, + callback + )); + else if ("object" === type) { + if ("function" === typeof children.then) + return mapIntoArray( + resolveThenable(children), + array, + escapedPrefix, + nameSoFar, + callback + ); + array = String(children); + throw Error( + "Objects are not valid as a React child (found: " + + ("[object Object]" === array + ? "object with keys {" + Object.keys(children).join(", ") + "}" + : array) + + "). If you meant to render a collection of children, use an array instead." + ); + } + return invokeCallback; +} +function mapChildren(children, func, context) { + if (null == children) return children; + var result = [], + count = 0; + mapIntoArray(children, result, "", "", function (child) { + return func.call(context, child, count++); + }); + return result; +} +function lazyInitializer(payload) { + if (-1 === payload._status) { + var ctor = payload._result; + ctor = ctor(); + ctor.then( + function (moduleObject) { + if (0 === payload._status || -1 === payload._status) + (payload._status = 1), (payload._result = moduleObject); + }, + function (error) { + if (0 === payload._status || -1 === payload._status) + (payload._status = 2), (payload._result = error); + } + ); + -1 === payload._status && ((payload._status = 0), (payload._result = ctor)); + } + if (1 === payload._status) return payload._result.default; + throw payload._result; +} +var reportGlobalError = + "function" === typeof reportError + ? reportError + : function (error) { + if ( + "object" === typeof window && + "function" === typeof window.ErrorEvent + ) { + var event = new window.ErrorEvent("error", { + bubbles: !0, + cancelable: !0, + message: + "object" === typeof error && + null !== error && + "string" === typeof error.message + ? String(error.message) + : String(error), + error: error + }); + if (!window.dispatchEvent(event)) return; + } else if ( + "object" === typeof process && + "function" === typeof process.emit + ) { + process.emit("uncaughtException", error); + return; + } + console.error(error); + }; +function noop() {} +exports.Children = { + map: mapChildren, + forEach: function (children, forEachFunc, forEachContext) { + mapChildren( + children, + function () { + forEachFunc.apply(this, arguments); + }, + forEachContext + ); + }, + count: function (children) { + var n = 0; + mapChildren(children, function () { + n++; + }); + return n; + }, + toArray: function (children) { + return ( + mapChildren(children, function (child) { + return child; + }) || [] + ); + }, + only: function (children) { + if (!isValidElement(children)) + throw Error( + "React.Children.only expected to receive a single React element child." + ); + return children; + } +}; +exports.Component = Component; +exports.Fragment = REACT_FRAGMENT_TYPE; +exports.Profiler = REACT_PROFILER_TYPE; +exports.PureComponent = PureComponent; +exports.StrictMode = REACT_STRICT_MODE_TYPE; +exports.Suspense = REACT_SUSPENSE_TYPE; +exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = + ReactSharedInternals; +exports.__COMPILER_RUNTIME = { + __proto__: null, + c: function (size) { + return ReactSharedInternals.H.useMemoCache(size); + } +}; +exports.cache = function (fn) { + return function () { + return fn.apply(null, arguments); + }; +}; +exports.cloneElement = function (element, config, children) { + if (null === element || void 0 === element) + throw Error( + "The argument must be a React element, but you passed " + element + "." + ); + var props = assign({}, element.props), + key = element.key, + owner = void 0; + if (null != config) + for (propName in (void 0 !== config.ref && (owner = void 0), + void 0 !== config.key && (key = "" + config.key), + config)) + !hasOwnProperty.call(config, propName) || + "key" === propName || + "__self" === propName || + "__source" === propName || + ("ref" === propName && void 0 === config.ref) || + (props[propName] = config[propName]); + var propName = arguments.length - 2; + if (1 === propName) props.children = children; + else if (1 < propName) { + for (var childArray = Array(propName), i = 0; i < propName; i++) + childArray[i] = arguments[i + 2]; + props.children = childArray; + } + return ReactElement(element.type, key, void 0, void 0, owner, props); +}; +exports.createContext = function (defaultValue) { + defaultValue = { + $$typeof: REACT_CONTEXT_TYPE, + _currentValue: defaultValue, + _currentValue2: defaultValue, + _threadCount: 0, + Provider: null, + Consumer: null + }; + defaultValue.Provider = defaultValue; + defaultValue.Consumer = { + $$typeof: REACT_CONSUMER_TYPE, + _context: defaultValue + }; + return defaultValue; +}; +exports.createElement = function (type, config, children) { + var propName, + props = {}, + key = null; + if (null != config) + for (propName in (void 0 !== config.key && (key = "" + config.key), config)) + hasOwnProperty.call(config, propName) && + "key" !== propName && + "__self" !== propName && + "__source" !== propName && + (props[propName] = config[propName]); + var childrenLength = arguments.length - 2; + if (1 === childrenLength) props.children = children; + else if (1 < childrenLength) { + for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++) + childArray[i] = arguments[i + 2]; + props.children = childArray; + } + if (type && type.defaultProps) + for (propName in ((childrenLength = type.defaultProps), childrenLength)) + void 0 === props[propName] && + (props[propName] = childrenLength[propName]); + return ReactElement(type, key, void 0, void 0, null, props); +}; +exports.createRef = function () { + return { current: null }; +}; +exports.forwardRef = function (render) { + return { $$typeof: REACT_FORWARD_REF_TYPE, render: render }; +}; +exports.isValidElement = isValidElement; +exports.lazy = function (ctor) { + return { + $$typeof: REACT_LAZY_TYPE, + _payload: { _status: -1, _result: ctor }, + _init: lazyInitializer + }; +}; +exports.memo = function (type, compare) { + return { + $$typeof: REACT_MEMO_TYPE, + type: type, + compare: void 0 === compare ? null : compare + }; +}; +exports.startTransition = function (scope) { + var prevTransition = ReactSharedInternals.T, + currentTransition = {}; + ReactSharedInternals.T = currentTransition; + try { + var returnValue = scope(), + onStartTransitionFinish = ReactSharedInternals.S; + null !== onStartTransitionFinish && + onStartTransitionFinish(currentTransition, returnValue); + "object" === typeof returnValue && + null !== returnValue && + "function" === typeof returnValue.then && + returnValue.then(noop, reportGlobalError); + } catch (error) { + reportGlobalError(error); + } finally { + ReactSharedInternals.T = prevTransition; + } +}; +exports.unstable_useCacheRefresh = function () { + return ReactSharedInternals.H.useCacheRefresh(); +}; +exports.use = function (usable) { + return ReactSharedInternals.H.use(usable); +}; +exports.useActionState = function (action, initialState, permalink) { + return ReactSharedInternals.H.useActionState(action, initialState, permalink); +}; +exports.useCallback = function (callback, deps) { + return ReactSharedInternals.H.useCallback(callback, deps); +}; +exports.useContext = function (Context) { + return ReactSharedInternals.H.useContext(Context); +}; +exports.useDebugValue = function () {}; +exports.useDeferredValue = function (value, initialValue) { + return ReactSharedInternals.H.useDeferredValue(value, initialValue); +}; +exports.useEffect = function (create, createDeps, update) { + var dispatcher = ReactSharedInternals.H; + if ("function" === typeof update) + throw Error( + "useEffect CRUD overload is not enabled in this build of React." + ); + return dispatcher.useEffect(create, createDeps); +}; +exports.useId = function () { + return ReactSharedInternals.H.useId(); +}; +exports.useImperativeHandle = function (ref, create, deps) { + return ReactSharedInternals.H.useImperativeHandle(ref, create, deps); +}; +exports.useInsertionEffect = function (create, deps) { + return ReactSharedInternals.H.useInsertionEffect(create, deps); +}; +exports.useLayoutEffect = function (create, deps) { + return ReactSharedInternals.H.useLayoutEffect(create, deps); +}; +exports.useMemo = function (create, deps) { + return ReactSharedInternals.H.useMemo(create, deps); +}; +exports.useOptimistic = function (passthrough, reducer) { + return ReactSharedInternals.H.useOptimistic(passthrough, reducer); +}; +exports.useReducer = function (reducer, initialArg, init) { + return ReactSharedInternals.H.useReducer(reducer, initialArg, init); +}; +exports.useRef = function (initialValue) { + return ReactSharedInternals.H.useRef(initialValue); +}; +exports.useState = function (initialState) { + return ReactSharedInternals.H.useState(initialState); +}; +exports.useSyncExternalStore = function ( + subscribe, + getSnapshot, + getServerSnapshot +) { + return ReactSharedInternals.H.useSyncExternalStore( + subscribe, + getSnapshot, + getServerSnapshot + ); +}; +exports.useTransition = function () { + return ReactSharedInternals.H.useTransition(); +}; +exports.version = "19.1.0"; diff --git a/node_modules/react/cjs/react.react-server.development.js b/node_modules/react/cjs/react.react-server.development.js new file mode 100644 index 0000000..0adf5aa --- /dev/null +++ b/node_modules/react/cjs/react.react-server.development.js @@ -0,0 +1,815 @@ +/** + * @license React + * react.react-server.development.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +"production" !== process.env.NODE_ENV && + (function () { + function getIteratorFn(maybeIterable) { + if (null === maybeIterable || "object" !== typeof maybeIterable) + return null; + maybeIterable = + (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || + maybeIterable["@@iterator"]; + return "function" === typeof maybeIterable ? maybeIterable : null; + } + function testStringCoercion(value) { + return "" + value; + } + function checkKeyStringCoercion(value) { + try { + testStringCoercion(value); + var JSCompiler_inline_result = !1; + } catch (e) { + JSCompiler_inline_result = !0; + } + if (JSCompiler_inline_result) { + JSCompiler_inline_result = console; + var JSCompiler_temp_const = JSCompiler_inline_result.error; + var JSCompiler_inline_result$jscomp$0 = + ("function" === typeof Symbol && + Symbol.toStringTag && + value[Symbol.toStringTag]) || + value.constructor.name || + "Object"; + JSCompiler_temp_const.call( + JSCompiler_inline_result, + "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", + JSCompiler_inline_result$jscomp$0 + ); + return testStringCoercion(value); + } + } + function getComponentNameFromType(type) { + if (null == type) return null; + if ("function" === typeof type) + return type.$$typeof === REACT_CLIENT_REFERENCE + ? null + : type.displayName || type.name || null; + if ("string" === typeof type) return type; + switch (type) { + case REACT_FRAGMENT_TYPE: + return "Fragment"; + case REACT_PROFILER_TYPE: + return "Profiler"; + case REACT_STRICT_MODE_TYPE: + return "StrictMode"; + case REACT_SUSPENSE_TYPE: + return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + case REACT_ACTIVITY_TYPE: + return "Activity"; + } + if ("object" === typeof type) + switch ( + ("number" === typeof type.tag && + console.error( + "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." + ), + type.$$typeof) + ) { + case REACT_PORTAL_TYPE: + return "Portal"; + case REACT_CONTEXT_TYPE: + return (type.displayName || "Context") + ".Provider"; + case REACT_CONSUMER_TYPE: + return (type._context.displayName || "Context") + ".Consumer"; + case REACT_FORWARD_REF_TYPE: + var innerType = type.render; + type = type.displayName; + type || + ((type = innerType.displayName || innerType.name || ""), + (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef")); + return type; + case REACT_MEMO_TYPE: + return ( + (innerType = type.displayName || null), + null !== innerType + ? innerType + : getComponentNameFromType(type.type) || "Memo" + ); + case REACT_LAZY_TYPE: + innerType = type._payload; + type = type._init; + try { + return getComponentNameFromType(type(innerType)); + } catch (x) {} + } + return null; + } + function getTaskName(type) { + if (type === REACT_FRAGMENT_TYPE) return "<>"; + if ( + "object" === typeof type && + null !== type && + type.$$typeof === REACT_LAZY_TYPE + ) + return "<...>"; + try { + var name = getComponentNameFromType(type); + return name ? "<" + name + ">" : "<...>"; + } catch (x) { + return "<...>"; + } + } + function getOwner() { + var dispatcher = ReactSharedInternals.A; + return null === dispatcher ? null : dispatcher.getOwner(); + } + function UnknownOwner() { + return Error("react-stack-top-frame"); + } + function hasValidKey(config) { + if (hasOwnProperty.call(config, "key")) { + var getter = Object.getOwnPropertyDescriptor(config, "key").get; + if (getter && getter.isReactWarning) return !1; + } + return void 0 !== config.key; + } + function defineKeyPropWarningGetter(props, displayName) { + function warnAboutAccessingKey() { + specialPropKeyWarningShown || + ((specialPropKeyWarningShown = !0), + console.error( + "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", + displayName + )); + } + warnAboutAccessingKey.isReactWarning = !0; + Object.defineProperty(props, "key", { + get: warnAboutAccessingKey, + configurable: !0 + }); + } + function elementRefGetterWithDeprecationWarning() { + var componentName = getComponentNameFromType(this.type); + didWarnAboutElementRef[componentName] || + ((didWarnAboutElementRef[componentName] = !0), + console.error( + "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release." + )); + componentName = this.props.ref; + return void 0 !== componentName ? componentName : null; + } + function ReactElement( + type, + key, + self, + source, + owner, + props, + debugStack, + debugTask + ) { + self = props.ref; + type = { + $$typeof: REACT_ELEMENT_TYPE, + type: type, + key: key, + props: props, + _owner: owner + }; + null !== (void 0 !== self ? self : null) + ? Object.defineProperty(type, "ref", { + enumerable: !1, + get: elementRefGetterWithDeprecationWarning + }) + : Object.defineProperty(type, "ref", { enumerable: !1, value: null }); + type._store = {}; + Object.defineProperty(type._store, "validated", { + configurable: !1, + enumerable: !1, + writable: !0, + value: 0 + }); + Object.defineProperty(type, "_debugInfo", { + configurable: !1, + enumerable: !1, + writable: !0, + value: null + }); + Object.defineProperty(type, "_debugStack", { + configurable: !1, + enumerable: !1, + writable: !0, + value: debugStack + }); + Object.defineProperty(type, "_debugTask", { + configurable: !1, + enumerable: !1, + writable: !0, + value: debugTask + }); + Object.freeze && (Object.freeze(type.props), Object.freeze(type)); + return type; + } + function cloneAndReplaceKey(oldElement, newKey) { + newKey = ReactElement( + oldElement.type, + newKey, + void 0, + void 0, + oldElement._owner, + oldElement.props, + oldElement._debugStack, + oldElement._debugTask + ); + oldElement._store && + (newKey._store.validated = oldElement._store.validated); + return newKey; + } + function isValidElement(object) { + return ( + "object" === typeof object && + null !== object && + object.$$typeof === REACT_ELEMENT_TYPE + ); + } + function escape(key) { + var escaperLookup = { "=": "=0", ":": "=2" }; + return ( + "$" + + key.replace(/[=:]/g, function (match) { + return escaperLookup[match]; + }) + ); + } + function getElementKey(element, index) { + return "object" === typeof element && + null !== element && + null != element.key + ? (checkKeyStringCoercion(element.key), escape("" + element.key)) + : index.toString(36); + } + function noop() {} + function resolveThenable(thenable) { + switch (thenable.status) { + case "fulfilled": + return thenable.value; + case "rejected": + throw thenable.reason; + default: + switch ( + ("string" === typeof thenable.status + ? thenable.then(noop, noop) + : ((thenable.status = "pending"), + thenable.then( + function (fulfilledValue) { + "pending" === thenable.status && + ((thenable.status = "fulfilled"), + (thenable.value = fulfilledValue)); + }, + function (error) { + "pending" === thenable.status && + ((thenable.status = "rejected"), + (thenable.reason = error)); + } + )), + thenable.status) + ) { + case "fulfilled": + return thenable.value; + case "rejected": + throw thenable.reason; + } + } + throw thenable; + } + function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) { + var type = typeof children; + if ("undefined" === type || "boolean" === type) children = null; + var invokeCallback = !1; + if (null === children) invokeCallback = !0; + else + switch (type) { + case "bigint": + case "string": + case "number": + invokeCallback = !0; + break; + case "object": + switch (children.$$typeof) { + case REACT_ELEMENT_TYPE: + case REACT_PORTAL_TYPE: + invokeCallback = !0; + break; + case REACT_LAZY_TYPE: + return ( + (invokeCallback = children._init), + mapIntoArray( + invokeCallback(children._payload), + array, + escapedPrefix, + nameSoFar, + callback + ) + ); + } + } + if (invokeCallback) { + invokeCallback = children; + callback = callback(invokeCallback); + var childKey = + "" === nameSoFar ? "." + getElementKey(invokeCallback, 0) : nameSoFar; + isArrayImpl(callback) + ? ((escapedPrefix = ""), + null != childKey && + (escapedPrefix = + childKey.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), + mapIntoArray(callback, array, escapedPrefix, "", function (c) { + return c; + })) + : null != callback && + (isValidElement(callback) && + (null != callback.key && + ((invokeCallback && invokeCallback.key === callback.key) || + checkKeyStringCoercion(callback.key)), + (escapedPrefix = cloneAndReplaceKey( + callback, + escapedPrefix + + (null == callback.key || + (invokeCallback && invokeCallback.key === callback.key) + ? "" + : ("" + callback.key).replace( + userProvidedKeyEscapeRegex, + "$&/" + ) + "/") + + childKey + )), + "" !== nameSoFar && + null != invokeCallback && + isValidElement(invokeCallback) && + null == invokeCallback.key && + invokeCallback._store && + !invokeCallback._store.validated && + (escapedPrefix._store.validated = 2), + (callback = escapedPrefix)), + array.push(callback)); + return 1; + } + invokeCallback = 0; + childKey = "" === nameSoFar ? "." : nameSoFar + ":"; + if (isArrayImpl(children)) + for (var i = 0; i < children.length; i++) + (nameSoFar = children[i]), + (type = childKey + getElementKey(nameSoFar, i)), + (invokeCallback += mapIntoArray( + nameSoFar, + array, + escapedPrefix, + type, + callback + )); + else if (((i = getIteratorFn(children)), "function" === typeof i)) + for ( + i === children.entries && + (didWarnAboutMaps || + console.warn( + "Using Maps as children is not supported. Use an array of keyed ReactElements instead." + ), + (didWarnAboutMaps = !0)), + children = i.call(children), + i = 0; + !(nameSoFar = children.next()).done; + + ) + (nameSoFar = nameSoFar.value), + (type = childKey + getElementKey(nameSoFar, i++)), + (invokeCallback += mapIntoArray( + nameSoFar, + array, + escapedPrefix, + type, + callback + )); + else if ("object" === type) { + if ("function" === typeof children.then) + return mapIntoArray( + resolveThenable(children), + array, + escapedPrefix, + nameSoFar, + callback + ); + array = String(children); + throw Error( + "Objects are not valid as a React child (found: " + + ("[object Object]" === array + ? "object with keys {" + Object.keys(children).join(", ") + "}" + : array) + + "). If you meant to render a collection of children, use an array instead." + ); + } + return invokeCallback; + } + function mapChildren(children, func, context) { + if (null == children) return children; + var result = [], + count = 0; + mapIntoArray(children, result, "", "", function (child) { + return func.call(context, child, count++); + }); + return result; + } + function resolveDispatcher() { + var dispatcher = ReactSharedInternals.H; + null === dispatcher && + console.error( + "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem." + ); + return dispatcher; + } + function lazyInitializer(payload) { + if (-1 === payload._status) { + var ctor = payload._result; + ctor = ctor(); + ctor.then( + function (moduleObject) { + if (0 === payload._status || -1 === payload._status) + (payload._status = 1), (payload._result = moduleObject); + }, + function (error) { + if (0 === payload._status || -1 === payload._status) + (payload._status = 2), (payload._result = error); + } + ); + -1 === payload._status && + ((payload._status = 0), (payload._result = ctor)); + } + if (1 === payload._status) + return ( + (ctor = payload._result), + void 0 === ctor && + console.error( + "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?", + ctor + ), + "default" in ctor || + console.error( + "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))", + ctor + ), + ctor.default + ); + throw payload._result; + } + function createCacheRoot() { + return new WeakMap(); + } + function createCacheNode() { + return { s: 0, v: void 0, o: null, p: null }; + } + var ReactSharedInternals = { + H: null, + A: null, + getCurrentStack: null, + recentlyCreatedOwnerStacks: 0 + }, + isArrayImpl = Array.isArray, + REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_PORTAL_TYPE = Symbol.for("react.portal"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), + REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), + REACT_PROFILER_TYPE = Symbol.for("react.profiler"); + Symbol.for("react.provider"); + var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), + REACT_CONTEXT_TYPE = Symbol.for("react.context"), + REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), + REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), + REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), + REACT_MEMO_TYPE = Symbol.for("react.memo"), + REACT_LAZY_TYPE = Symbol.for("react.lazy"), + REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), + MAYBE_ITERATOR_SYMBOL = Symbol.iterator, + REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), + hasOwnProperty = Object.prototype.hasOwnProperty, + assign = Object.assign, + createTask = console.createTask + ? console.createTask + : function () { + return null; + }, + createFakeCallStack = { + "react-stack-bottom-frame": function (callStackForError) { + return callStackForError(); + } + }, + specialPropKeyWarningShown, + didWarnAboutOldJSXRuntime; + var didWarnAboutElementRef = {}; + var unknownOwnerDebugStack = createFakeCallStack[ + "react-stack-bottom-frame" + ].bind(createFakeCallStack, UnknownOwner)(); + var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner)); + var didWarnAboutMaps = !1, + userProvidedKeyEscapeRegex = /\/+/g; + exports.Children = { + map: mapChildren, + forEach: function (children, forEachFunc, forEachContext) { + mapChildren( + children, + function () { + forEachFunc.apply(this, arguments); + }, + forEachContext + ); + }, + count: function (children) { + var n = 0; + mapChildren(children, function () { + n++; + }); + return n; + }, + toArray: function (children) { + return ( + mapChildren(children, function (child) { + return child; + }) || [] + ); + }, + only: function (children) { + if (!isValidElement(children)) + throw Error( + "React.Children.only expected to receive a single React element child." + ); + return children; + } + }; + exports.Fragment = REACT_FRAGMENT_TYPE; + exports.Profiler = REACT_PROFILER_TYPE; + exports.StrictMode = REACT_STRICT_MODE_TYPE; + exports.Suspense = REACT_SUSPENSE_TYPE; + exports.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = + ReactSharedInternals; + exports.cache = function (fn) { + return function () { + var dispatcher = ReactSharedInternals.A; + if (!dispatcher) return fn.apply(null, arguments); + var fnMap = dispatcher.getCacheForType(createCacheRoot); + dispatcher = fnMap.get(fn); + void 0 === dispatcher && + ((dispatcher = createCacheNode()), fnMap.set(fn, dispatcher)); + fnMap = 0; + for (var l = arguments.length; fnMap < l; fnMap++) { + var arg = arguments[fnMap]; + if ( + "function" === typeof arg || + ("object" === typeof arg && null !== arg) + ) { + var objectCache = dispatcher.o; + null === objectCache && + (dispatcher.o = objectCache = new WeakMap()); + dispatcher = objectCache.get(arg); + void 0 === dispatcher && + ((dispatcher = createCacheNode()), + objectCache.set(arg, dispatcher)); + } else + (objectCache = dispatcher.p), + null === objectCache && (dispatcher.p = objectCache = new Map()), + (dispatcher = objectCache.get(arg)), + void 0 === dispatcher && + ((dispatcher = createCacheNode()), + objectCache.set(arg, dispatcher)); + } + if (1 === dispatcher.s) return dispatcher.v; + if (2 === dispatcher.s) throw dispatcher.v; + try { + var result = fn.apply(null, arguments); + fnMap = dispatcher; + fnMap.s = 1; + return (fnMap.v = result); + } catch (error) { + throw ( + ((result = dispatcher), (result.s = 2), (result.v = error), error) + ); + } + }; + }; + exports.captureOwnerStack = function () { + var getCurrentStack = ReactSharedInternals.getCurrentStack; + return null === getCurrentStack ? null : getCurrentStack(); + }; + exports.cloneElement = function (element, config, children) { + if (null === element || void 0 === element) + throw Error( + "The argument must be a React element, but you passed " + + element + + "." + ); + var props = assign({}, element.props), + key = element.key, + owner = element._owner; + if (null != config) { + var JSCompiler_inline_result; + a: { + if ( + hasOwnProperty.call(config, "ref") && + (JSCompiler_inline_result = Object.getOwnPropertyDescriptor( + config, + "ref" + ).get) && + JSCompiler_inline_result.isReactWarning + ) { + JSCompiler_inline_result = !1; + break a; + } + JSCompiler_inline_result = void 0 !== config.ref; + } + JSCompiler_inline_result && (owner = getOwner()); + hasValidKey(config) && + (checkKeyStringCoercion(config.key), (key = "" + config.key)); + for (propName in config) + !hasOwnProperty.call(config, propName) || + "key" === propName || + "__self" === propName || + "__source" === propName || + ("ref" === propName && void 0 === config.ref) || + (props[propName] = config[propName]); + } + var propName = arguments.length - 2; + if (1 === propName) props.children = children; + else if (1 < propName) { + JSCompiler_inline_result = Array(propName); + for (var i = 0; i < propName; i++) + JSCompiler_inline_result[i] = arguments[i + 2]; + props.children = JSCompiler_inline_result; + } + props = ReactElement( + element.type, + key, + void 0, + void 0, + owner, + props, + element._debugStack, + element._debugTask + ); + for (key = 2; key < arguments.length; key++) + (owner = arguments[key]), + isValidElement(owner) && owner._store && (owner._store.validated = 1); + return props; + }; + exports.createElement = function (type, config, children) { + for (var i = 2; i < arguments.length; i++) { + var node = arguments[i]; + isValidElement(node) && node._store && (node._store.validated = 1); + } + i = {}; + node = null; + if (null != config) + for (propName in (didWarnAboutOldJSXRuntime || + !("__self" in config) || + "key" in config || + ((didWarnAboutOldJSXRuntime = !0), + console.warn( + "Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform" + )), + hasValidKey(config) && + (checkKeyStringCoercion(config.key), (node = "" + config.key)), + config)) + hasOwnProperty.call(config, propName) && + "key" !== propName && + "__self" !== propName && + "__source" !== propName && + (i[propName] = config[propName]); + var childrenLength = arguments.length - 2; + if (1 === childrenLength) i.children = children; + else if (1 < childrenLength) { + for ( + var childArray = Array(childrenLength), _i = 0; + _i < childrenLength; + _i++ + ) + childArray[_i] = arguments[_i + 2]; + Object.freeze && Object.freeze(childArray); + i.children = childArray; + } + if (type && type.defaultProps) + for (propName in ((childrenLength = type.defaultProps), childrenLength)) + void 0 === i[propName] && (i[propName] = childrenLength[propName]); + node && + defineKeyPropWarningGetter( + i, + "function" === typeof type + ? type.displayName || type.name || "Unknown" + : type + ); + var propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++; + return ReactElement( + type, + node, + void 0, + void 0, + getOwner(), + i, + propName ? Error("react-stack-top-frame") : unknownOwnerDebugStack, + propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask + ); + }; + exports.createRef = function () { + var refObject = { current: null }; + Object.seal(refObject); + return refObject; + }; + exports.forwardRef = function (render) { + null != render && render.$$typeof === REACT_MEMO_TYPE + ? console.error( + "forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))." + ) + : "function" !== typeof render + ? console.error( + "forwardRef requires a render function but was given %s.", + null === render ? "null" : typeof render + ) + : 0 !== render.length && + 2 !== render.length && + console.error( + "forwardRef render functions accept exactly two parameters: props and ref. %s", + 1 === render.length + ? "Did you forget to use the ref parameter?" + : "Any additional parameter will be undefined." + ); + null != render && + null != render.defaultProps && + console.error( + "forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?" + ); + var elementType = { $$typeof: REACT_FORWARD_REF_TYPE, render: render }, + ownName; + Object.defineProperty(elementType, "displayName", { + enumerable: !1, + configurable: !0, + get: function () { + return ownName; + }, + set: function (name) { + ownName = name; + render.name || + render.displayName || + (Object.defineProperty(render, "name", { value: name }), + (render.displayName = name)); + } + }); + return elementType; + }; + exports.isValidElement = isValidElement; + exports.lazy = function (ctor) { + return { + $$typeof: REACT_LAZY_TYPE, + _payload: { _status: -1, _result: ctor }, + _init: lazyInitializer + }; + }; + exports.memo = function (type, compare) { + null == type && + console.error( + "memo: The first argument must be a component. Instead received: %s", + null === type ? "null" : typeof type + ); + compare = { + $$typeof: REACT_MEMO_TYPE, + type: type, + compare: void 0 === compare ? null : compare + }; + var ownName; + Object.defineProperty(compare, "displayName", { + enumerable: !1, + configurable: !0, + get: function () { + return ownName; + }, + set: function (name) { + ownName = name; + type.name || + type.displayName || + (Object.defineProperty(type, "name", { value: name }), + (type.displayName = name)); + } + }); + return compare; + }; + exports.use = function (usable) { + return resolveDispatcher().use(usable); + }; + exports.useCallback = function (callback, deps) { + return resolveDispatcher().useCallback(callback, deps); + }; + exports.useDebugValue = function (value, formatterFn) { + return resolveDispatcher().useDebugValue(value, formatterFn); + }; + exports.useId = function () { + return resolveDispatcher().useId(); + }; + exports.useMemo = function (create, deps) { + return resolveDispatcher().useMemo(create, deps); + }; + exports.version = "19.1.0"; + })(); diff --git a/node_modules/react/cjs/react.react-server.production.js b/node_modules/react/cjs/react.react-server.production.js new file mode 100644 index 0000000..c777112 --- /dev/null +++ b/node_modules/react/cjs/react.react-server.production.js @@ -0,0 +1,429 @@ +/** + * @license React + * react.react-server.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +var ReactSharedInternals = { H: null, A: null }; +function formatProdErrorMessage(code) { + var url = "https://react.dev/errors/" + code; + if (1 < arguments.length) { + url += "?args[]=" + encodeURIComponent(arguments[1]); + for (var i = 2; i < arguments.length; i++) + url += "&args[]=" + encodeURIComponent(arguments[i]); + } + return ( + "Minified React error #" + + code + + "; visit " + + url + + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings." + ); +} +var isArrayImpl = Array.isArray, + REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_PORTAL_TYPE = Symbol.for("react.portal"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), + REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), + REACT_PROFILER_TYPE = Symbol.for("react.profiler"), + REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), + REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), + REACT_MEMO_TYPE = Symbol.for("react.memo"), + REACT_LAZY_TYPE = Symbol.for("react.lazy"), + MAYBE_ITERATOR_SYMBOL = Symbol.iterator; +function getIteratorFn(maybeIterable) { + if (null === maybeIterable || "object" !== typeof maybeIterable) return null; + maybeIterable = + (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || + maybeIterable["@@iterator"]; + return "function" === typeof maybeIterable ? maybeIterable : null; +} +var hasOwnProperty = Object.prototype.hasOwnProperty, + assign = Object.assign; +function ReactElement(type, key, self, source, owner, props) { + self = props.ref; + return { + $$typeof: REACT_ELEMENT_TYPE, + type: type, + key: key, + ref: void 0 !== self ? self : null, + props: props + }; +} +function cloneAndReplaceKey(oldElement, newKey) { + return ReactElement( + oldElement.type, + newKey, + void 0, + void 0, + void 0, + oldElement.props + ); +} +function isValidElement(object) { + return ( + "object" === typeof object && + null !== object && + object.$$typeof === REACT_ELEMENT_TYPE + ); +} +function escape(key) { + var escaperLookup = { "=": "=0", ":": "=2" }; + return ( + "$" + + key.replace(/[=:]/g, function (match) { + return escaperLookup[match]; + }) + ); +} +var userProvidedKeyEscapeRegex = /\/+/g; +function getElementKey(element, index) { + return "object" === typeof element && null !== element && null != element.key + ? escape("" + element.key) + : index.toString(36); +} +function noop() {} +function resolveThenable(thenable) { + switch (thenable.status) { + case "fulfilled": + return thenable.value; + case "rejected": + throw thenable.reason; + default: + switch ( + ("string" === typeof thenable.status + ? thenable.then(noop, noop) + : ((thenable.status = "pending"), + thenable.then( + function (fulfilledValue) { + "pending" === thenable.status && + ((thenable.status = "fulfilled"), + (thenable.value = fulfilledValue)); + }, + function (error) { + "pending" === thenable.status && + ((thenable.status = "rejected"), (thenable.reason = error)); + } + )), + thenable.status) + ) { + case "fulfilled": + return thenable.value; + case "rejected": + throw thenable.reason; + } + } + throw thenable; +} +function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) { + var type = typeof children; + if ("undefined" === type || "boolean" === type) children = null; + var invokeCallback = !1; + if (null === children) invokeCallback = !0; + else + switch (type) { + case "bigint": + case "string": + case "number": + invokeCallback = !0; + break; + case "object": + switch (children.$$typeof) { + case REACT_ELEMENT_TYPE: + case REACT_PORTAL_TYPE: + invokeCallback = !0; + break; + case REACT_LAZY_TYPE: + return ( + (invokeCallback = children._init), + mapIntoArray( + invokeCallback(children._payload), + array, + escapedPrefix, + nameSoFar, + callback + ) + ); + } + } + if (invokeCallback) + return ( + (callback = callback(children)), + (invokeCallback = + "" === nameSoFar ? "." + getElementKey(children, 0) : nameSoFar), + isArrayImpl(callback) + ? ((escapedPrefix = ""), + null != invokeCallback && + (escapedPrefix = + invokeCallback.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), + mapIntoArray(callback, array, escapedPrefix, "", function (c) { + return c; + })) + : null != callback && + (isValidElement(callback) && + (callback = cloneAndReplaceKey( + callback, + escapedPrefix + + (null == callback.key || + (children && children.key === callback.key) + ? "" + : ("" + callback.key).replace( + userProvidedKeyEscapeRegex, + "$&/" + ) + "/") + + invokeCallback + )), + array.push(callback)), + 1 + ); + invokeCallback = 0; + var nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":"; + if (isArrayImpl(children)) + for (var i = 0; i < children.length; i++) + (nameSoFar = children[i]), + (type = nextNamePrefix + getElementKey(nameSoFar, i)), + (invokeCallback += mapIntoArray( + nameSoFar, + array, + escapedPrefix, + type, + callback + )); + else if (((i = getIteratorFn(children)), "function" === typeof i)) + for ( + children = i.call(children), i = 0; + !(nameSoFar = children.next()).done; + + ) + (nameSoFar = nameSoFar.value), + (type = nextNamePrefix + getElementKey(nameSoFar, i++)), + (invokeCallback += mapIntoArray( + nameSoFar, + array, + escapedPrefix, + type, + callback + )); + else if ("object" === type) { + if ("function" === typeof children.then) + return mapIntoArray( + resolveThenable(children), + array, + escapedPrefix, + nameSoFar, + callback + ); + array = String(children); + throw Error( + formatProdErrorMessage( + 31, + "[object Object]" === array + ? "object with keys {" + Object.keys(children).join(", ") + "}" + : array + ) + ); + } + return invokeCallback; +} +function mapChildren(children, func, context) { + if (null == children) return children; + var result = [], + count = 0; + mapIntoArray(children, result, "", "", function (child) { + return func.call(context, child, count++); + }); + return result; +} +function lazyInitializer(payload) { + if (-1 === payload._status) { + var ctor = payload._result; + ctor = ctor(); + ctor.then( + function (moduleObject) { + if (0 === payload._status || -1 === payload._status) + (payload._status = 1), (payload._result = moduleObject); + }, + function (error) { + if (0 === payload._status || -1 === payload._status) + (payload._status = 2), (payload._result = error); + } + ); + -1 === payload._status && ((payload._status = 0), (payload._result = ctor)); + } + if (1 === payload._status) return payload._result.default; + throw payload._result; +} +function createCacheRoot() { + return new WeakMap(); +} +function createCacheNode() { + return { s: 0, v: void 0, o: null, p: null }; +} +exports.Children = { + map: mapChildren, + forEach: function (children, forEachFunc, forEachContext) { + mapChildren( + children, + function () { + forEachFunc.apply(this, arguments); + }, + forEachContext + ); + }, + count: function (children) { + var n = 0; + mapChildren(children, function () { + n++; + }); + return n; + }, + toArray: function (children) { + return ( + mapChildren(children, function (child) { + return child; + }) || [] + ); + }, + only: function (children) { + if (!isValidElement(children)) throw Error(formatProdErrorMessage(143)); + return children; + } +}; +exports.Fragment = REACT_FRAGMENT_TYPE; +exports.Profiler = REACT_PROFILER_TYPE; +exports.StrictMode = REACT_STRICT_MODE_TYPE; +exports.Suspense = REACT_SUSPENSE_TYPE; +exports.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = + ReactSharedInternals; +exports.cache = function (fn) { + return function () { + var dispatcher = ReactSharedInternals.A; + if (!dispatcher) return fn.apply(null, arguments); + var fnMap = dispatcher.getCacheForType(createCacheRoot); + dispatcher = fnMap.get(fn); + void 0 === dispatcher && + ((dispatcher = createCacheNode()), fnMap.set(fn, dispatcher)); + fnMap = 0; + for (var l = arguments.length; fnMap < l; fnMap++) { + var arg = arguments[fnMap]; + if ( + "function" === typeof arg || + ("object" === typeof arg && null !== arg) + ) { + var objectCache = dispatcher.o; + null === objectCache && (dispatcher.o = objectCache = new WeakMap()); + dispatcher = objectCache.get(arg); + void 0 === dispatcher && + ((dispatcher = createCacheNode()), objectCache.set(arg, dispatcher)); + } else + (objectCache = dispatcher.p), + null === objectCache && (dispatcher.p = objectCache = new Map()), + (dispatcher = objectCache.get(arg)), + void 0 === dispatcher && + ((dispatcher = createCacheNode()), + objectCache.set(arg, dispatcher)); + } + if (1 === dispatcher.s) return dispatcher.v; + if (2 === dispatcher.s) throw dispatcher.v; + try { + var result = fn.apply(null, arguments); + fnMap = dispatcher; + fnMap.s = 1; + return (fnMap.v = result); + } catch (error) { + throw ((result = dispatcher), (result.s = 2), (result.v = error), error); + } + }; +}; +exports.captureOwnerStack = function () { + return null; +}; +exports.cloneElement = function (element, config, children) { + if (null === element || void 0 === element) + throw Error(formatProdErrorMessage(267, element)); + var props = assign({}, element.props), + key = element.key, + owner = void 0; + if (null != config) + for (propName in (void 0 !== config.ref && (owner = void 0), + void 0 !== config.key && (key = "" + config.key), + config)) + !hasOwnProperty.call(config, propName) || + "key" === propName || + "__self" === propName || + "__source" === propName || + ("ref" === propName && void 0 === config.ref) || + (props[propName] = config[propName]); + var propName = arguments.length - 2; + if (1 === propName) props.children = children; + else if (1 < propName) { + for (var childArray = Array(propName), i = 0; i < propName; i++) + childArray[i] = arguments[i + 2]; + props.children = childArray; + } + return ReactElement(element.type, key, void 0, void 0, owner, props); +}; +exports.createElement = function (type, config, children) { + var propName, + props = {}, + key = null; + if (null != config) + for (propName in (void 0 !== config.key && (key = "" + config.key), config)) + hasOwnProperty.call(config, propName) && + "key" !== propName && + "__self" !== propName && + "__source" !== propName && + (props[propName] = config[propName]); + var childrenLength = arguments.length - 2; + if (1 === childrenLength) props.children = children; + else if (1 < childrenLength) { + for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++) + childArray[i] = arguments[i + 2]; + props.children = childArray; + } + if (type && type.defaultProps) + for (propName in ((childrenLength = type.defaultProps), childrenLength)) + void 0 === props[propName] && + (props[propName] = childrenLength[propName]); + return ReactElement(type, key, void 0, void 0, null, props); +}; +exports.createRef = function () { + return { current: null }; +}; +exports.forwardRef = function (render) { + return { $$typeof: REACT_FORWARD_REF_TYPE, render: render }; +}; +exports.isValidElement = isValidElement; +exports.lazy = function (ctor) { + return { + $$typeof: REACT_LAZY_TYPE, + _payload: { _status: -1, _result: ctor }, + _init: lazyInitializer + }; +}; +exports.memo = function (type, compare) { + return { + $$typeof: REACT_MEMO_TYPE, + type: type, + compare: void 0 === compare ? null : compare + }; +}; +exports.use = function (usable) { + return ReactSharedInternals.H.use(usable); +}; +exports.useCallback = function (callback, deps) { + return ReactSharedInternals.H.useCallback(callback, deps); +}; +exports.useDebugValue = function () {}; +exports.useId = function () { + return ReactSharedInternals.H.useId(); +}; +exports.useMemo = function (create, deps) { + return ReactSharedInternals.H.useMemo(create, deps); +}; +exports.version = "19.1.0"; diff --git a/node_modules/react/compiler-runtime.js b/node_modules/react/compiler-runtime.js new file mode 100644 index 0000000..ab6aabb --- /dev/null +++ b/node_modules/react/compiler-runtime.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/react-compiler-runtime.production.js'); +} else { + module.exports = require('./cjs/react-compiler-runtime.development.js'); +} diff --git a/node_modules/react/index.js b/node_modules/react/index.js new file mode 100644 index 0000000..d830d7a --- /dev/null +++ b/node_modules/react/index.js @@ -0,0 +1,7 @@ +'use strict'; + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/react.production.js'); +} else { + module.exports = require('./cjs/react.development.js'); +} diff --git a/node_modules/react/jsx-dev-runtime.js b/node_modules/react/jsx-dev-runtime.js new file mode 100644 index 0000000..0a80857 --- /dev/null +++ b/node_modules/react/jsx-dev-runtime.js @@ -0,0 +1,7 @@ +'use strict'; + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/react-jsx-dev-runtime.production.js'); +} else { + module.exports = require('./cjs/react-jsx-dev-runtime.development.js'); +} diff --git a/node_modules/react/jsx-dev-runtime.react-server.js b/node_modules/react/jsx-dev-runtime.react-server.js new file mode 100644 index 0000000..d11e6e8 --- /dev/null +++ b/node_modules/react/jsx-dev-runtime.react-server.js @@ -0,0 +1,7 @@ +'use strict'; + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/react-jsx-dev-runtime.react-server.production.js'); +} else { + module.exports = require('./cjs/react-jsx-dev-runtime.react-server.development.js'); +} diff --git a/node_modules/react/jsx-runtime.js b/node_modules/react/jsx-runtime.js new file mode 100644 index 0000000..8679b72 --- /dev/null +++ b/node_modules/react/jsx-runtime.js @@ -0,0 +1,7 @@ +'use strict'; + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/react-jsx-runtime.production.js'); +} else { + module.exports = require('./cjs/react-jsx-runtime.development.js'); +} diff --git a/node_modules/react/jsx-runtime.react-server.js b/node_modules/react/jsx-runtime.react-server.js new file mode 100644 index 0000000..2d23c8c --- /dev/null +++ b/node_modules/react/jsx-runtime.react-server.js @@ -0,0 +1,7 @@ +'use strict'; + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/react-jsx-runtime.react-server.production.js'); +} else { + module.exports = require('./cjs/react-jsx-runtime.react-server.development.js'); +} diff --git a/node_modules/react/package.json b/node_modules/react/package.json new file mode 100644 index 0000000..30fcf53 --- /dev/null +++ b/node_modules/react/package.json @@ -0,0 +1,51 @@ +{ + "name": "react", + "description": "React is a JavaScript library for building user interfaces.", + "keywords": [ + "react" + ], + "version": "19.1.0", + "homepage": "https://react.dev/", + "bugs": "https://github.com/facebook/react/issues", + "license": "MIT", + "files": [ + "LICENSE", + "README.md", + "index.js", + "cjs/", + "compiler-runtime.js", + "jsx-runtime.js", + "jsx-runtime.react-server.js", + "jsx-dev-runtime.js", + "jsx-dev-runtime.react-server.js", + "react.react-server.js" + ], + "main": "index.js", + "exports": { + ".": { + "react-server": "./react.react-server.js", + "default": "./index.js" + }, + "./package.json": "./package.json", + "./jsx-runtime": { + "react-server": "./jsx-runtime.react-server.js", + "default": "./jsx-runtime.js" + }, + "./jsx-dev-runtime": { + "react-server": "./jsx-dev-runtime.react-server.js", + "default": "./jsx-dev-runtime.js" + }, + "./compiler-runtime": { + "react-server": "./compiler-runtime.js", + "default": "./compiler-runtime.js" + } + }, + "repository": { + "type": "git", + "url": "https://github.com/facebook/react.git", + "directory": "packages/react" + }, + "engines": { + "node": ">=0.10.0" + } +} \ No newline at end of file diff --git a/node_modules/react/react.react-server.js b/node_modules/react/react.react-server.js new file mode 100644 index 0000000..c66e3b7 --- /dev/null +++ b/node_modules/react/react.react-server.js @@ -0,0 +1,7 @@ +'use strict'; + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/react.react-server.production.js'); +} else { + module.exports = require('./cjs/react.react-server.development.js'); +} diff --git a/package-lock.json b/package-lock.json index e05d47b..f07a264 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,156 @@ { - "name": "BEE멸의 칼날 프로젝트", + "name": "coin_project", "lockfileVersion": 3, "requires": true, - "packages": {} + "packages": { + "": { + "dependencies": { + "apexcharts": "^4.5.0", + "react-apexcharts": "^1.7.0" + } + }, + "node_modules/@svgdotjs/svg.draggable.js": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@svgdotjs/svg.draggable.js/-/svg.draggable.js-3.0.6.tgz", + "integrity": "sha512-7iJFm9lL3C40HQcqzEfezK2l+dW2CpoVY3b77KQGqc8GXWa6LhhmX5Ckv7alQfUXBuZbjpICZ+Dvq1czlGx7gA==", + "license": "MIT", + "peerDependencies": { + "@svgdotjs/svg.js": "^3.2.4" + } + }, + "node_modules/@svgdotjs/svg.filter.js": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/@svgdotjs/svg.filter.js/-/svg.filter.js-3.0.9.tgz", + "integrity": "sha512-/69XMRCDoam2HgC4ldHIaDgeQf1ViHIsa0Ld4uWgiXtZ+E24DWHe/9Ib6kbNiZ7WRIdlVokUDR1Fg0kjIpkfbw==", + "license": "MIT", + "dependencies": { + "@svgdotjs/svg.js": "^3.2.4" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/@svgdotjs/svg.js": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@svgdotjs/svg.js/-/svg.js-3.2.4.tgz", + "integrity": "sha512-BjJ/7vWNowlX3Z8O4ywT58DqbNRyYlkk6Yz/D13aB7hGmfQTvGX4Tkgtm/ApYlu9M7lCQi15xUEidqMUmdMYwg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Fuzzyma" + } + }, + "node_modules/@svgdotjs/svg.resize.js": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@svgdotjs/svg.resize.js/-/svg.resize.js-2.0.5.tgz", + "integrity": "sha512-4heRW4B1QrJeENfi7326lUPYBCevj78FJs8kfeDxn5st0IYPIRXoTtOSYvTzFWgaWWXd3YCDE6ao4fmv91RthA==", + "license": "MIT", + "engines": { + "node": ">= 14.18" + }, + "peerDependencies": { + "@svgdotjs/svg.js": "^3.2.4", + "@svgdotjs/svg.select.js": "^4.0.1" + } + }, + "node_modules/@svgdotjs/svg.select.js": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@svgdotjs/svg.select.js/-/svg.select.js-4.0.2.tgz", + "integrity": "sha512-5gWdrvoQX3keo03SCmgaBbD+kFftq0F/f2bzCbNnpkkvW6tk4rl4MakORzFuNjvXPWwB4az9GwuvVxQVnjaK2g==", + "license": "MIT", + "engines": { + "node": ">= 14.18" + }, + "peerDependencies": { + "@svgdotjs/svg.js": "^3.2.4" + } + }, + "node_modules/@yr/monotone-cubic-spline": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@yr/monotone-cubic-spline/-/monotone-cubic-spline-1.0.3.tgz", + "integrity": "sha512-FQXkOta0XBSUPHndIKON2Y9JeQz5ZeMqLYZVVK93FliNBFm7LNMIZmY6FrMEB9XPcDbE2bekMbZD6kzDkxwYjA==", + "license": "MIT" + }, + "node_modules/apexcharts": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/apexcharts/-/apexcharts-4.5.0.tgz", + "integrity": "sha512-E7ZkrVqPNBUWy/Rmg8DEIqHNBmElzICE/oxOX5Ekvs2ICQUOK/VkEkMH09JGJu+O/EA0NL31hxlmF+wrwrSLaQ==", + "license": "MIT", + "dependencies": { + "@svgdotjs/svg.draggable.js": "^3.0.4", + "@svgdotjs/svg.filter.js": "^3.0.8", + "@svgdotjs/svg.js": "^3.2.4", + "@svgdotjs/svg.resize.js": "^2.0.2", + "@svgdotjs/svg.select.js": "^4.0.1", + "@yr/monotone-cubic-spline": "^1.0.3" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "license": "MIT" + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "license": "MIT", + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/prop-types": { + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + } + }, + "node_modules/react": { + "version": "19.1.0", + "resolved": "https://registry.npmjs.org/react/-/react-19.1.0.tgz", + "integrity": "sha512-FS+XFBNvn3GTAWq26joslQgWNoFu08F4kl0J4CgdNKADkdSGXQyTCnKteIAJy96Br6YbpEU1LSzV5dYtjMkMDg==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-apexcharts": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/react-apexcharts/-/react-apexcharts-1.7.0.tgz", + "integrity": "sha512-03oScKJyNLRf0Oe+ihJxFZliBQM9vW3UWwomVn4YVRTN1jsIR58dLWt0v1sb8RwJVHDMbeHiKQueM0KGpn7nOA==", + "license": "MIT", + "dependencies": { + "prop-types": "^15.8.1" + }, + "peerDependencies": { + "apexcharts": ">=4.0.0", + "react": ">=0.13" + } + }, + "node_modules/react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "license": "MIT" + } + } } diff --git a/package.json b/package.json new file mode 100644 index 0000000..b6715e2 --- /dev/null +++ b/package.json @@ -0,0 +1,6 @@ +{ + "dependencies": { + "apexcharts": "^4.5.0", + "react-apexcharts": "^1.7.0" + } +} diff --git a/script.js b/script.js deleted file mode 100644 index 2786337..0000000 --- a/script.js +++ /dev/null @@ -1,114 +0,0 @@ - - - -// DOM이 모두 로드된 뒤 실행 -document.addEventListener("DOMContentLoaded", () => { - // 탭 전환 기능 - const tabButtons = document.querySelectorAll(".tab-btn"); - const contentBoxes = document.querySelectorAll(".content-box"); - - tabButtons.forEach((btn) => { - btn.addEventListener("click", () => { - // 모든 content-box에서 active 제거 - contentBoxes.forEach((box) => box.classList.remove("active")); - // 클릭한 버튼에 해당하는 content-box만 active 추가 - const target = document.getElementById(btn.dataset.target); - if (target) { - target.classList.add("active"); - } - }); - }); - - // 예시: 로그인 버튼 클릭 시 login.html로 이동 - const loginBtn = document.getElementById("loginBtn"); - if (loginBtn) { - loginBtn.addEventListener("click", () => { - window.location.href = "login.html"; - }); - } - - // 검색 버튼 클릭 시 예시 기능 - const searchBtn = document.getElementById("searchBtn"); - if (searchBtn) { - searchBtn.addEventListener("click", () => { - const coinName = document.getElementById("coinSearch").value; - alert(`'${coinName}'로 검색을 수행합니다(예시).`); - // 실제로는 서버나 DB에서 검색 결과를 받아 아래 목록에 반영하는 로직 필요 - }); - } - - // 샘플 데이터 표시(실제론 서버나 DB에서 받아와서 표시) - document.getElementById("total-assets").textContent = "10,000,000"; // 총 투자자산 예시 - document.getElementById("available-balance").textContent = "2,000,000"; // 예수금 예시 - document.getElementById("totalHoldings").textContent = "8,000,000"; // 총 보유자산 예시 - document.getElementById("krwBalance").textContent = "1,000,000"; // 보유 KRW 예시 - - // 예시 거래내역 - const historyList = document.getElementById("historyList"); - if (historyList) { - const sampleHistory = [ - { date: "2025-03-01", type: "매수", coin: "BTC", amount: 0.01 }, - { date: "2025-03-02", type: "매도", coin: "ETH", amount: 0.5 }, - ]; - sampleHistory.forEach((item) => { - const li = document.createElement("li"); - li.textContent = `${item.date} | ${item.type} | ${item.coin} ${item.amount}`; - historyList.appendChild(li); - }); - } - - // 예시 미체결 - const openOrdersList = document.getElementById("openOrdersList"); - if (openOrdersList) { - const sampleOpenOrders = [ - { date: "2025-03-03", type: "매수", coin: "XRP", amount: 100 }, - ]; - sampleOpenOrders.forEach((item) => { - const li = document.createElement("li"); - li.textContent = `${item.date} | ${item.type} | ${item.coin} ${item.amount}`; - openOrdersList.appendChild(li); - }); - } - - // 예시 입출금대기 - const pendingDepositList = document.getElementById("pendingDepositList"); - if (pendingDepositList) { - const samplePending = [ - { date: "2025-03-04", action: "출금대기", coin: "KRW", amount: 500000 }, - ]; - samplePending.forEach((item) => { - const li = document.createElement("li"); - li.textContent = `${item.date} | ${item.action} | ${item.coin} ${item.amount}`; - pendingDepositList.appendChild(li); - }); - } - - // 예시 투자손익 - const profitLossList = document.getElementById("profitLossList"); - if (profitLossList) { - const sampleProfitLoss = [ - { coin: "BTC", profit: 300000 }, - { coin: "ETH", profit: -50000 }, - ]; - sampleProfitLoss.forEach((item) => { - const li = document.createElement("li"); - li.textContent = `${item.coin} | 손익: ${item.profit} KRW`; - profitLossList.appendChild(li); - }); - } - - // 예시 보유 코인 목록 - const coinHoldingsList = document.getElementById("coinHoldingsList"); - if (coinHoldingsList) { - const sampleHoldings = [ - { coin: "BTC", amount: 0.05 }, - { coin: "ETH", amount: 1.2 }, - { coin: "XRP", amount: 500 }, - ]; - sampleHoldings.forEach((item) => { - const li = document.createElement("li"); - li.textContent = `${item.coin} : ${item.amount}`; - coinHoldingsList.appendChild(li); - }); - } - }); \ No newline at end of file diff --git a/sql/user.sql b/sql/user.sql new file mode 100644 index 0000000..474cd2e --- /dev/null +++ b/sql/user.sql @@ -0,0 +1,24 @@ +Create database coin; +DROP DATABASE coin; + +use coin; + +create table User( + user_id varchar(100) primary key, + user_pw varchar(100) not null, + user_name varchar(100) not null, + is_admin boolean not null default false +); + +select * from User; +select * from auth_user; +select * from coin_recent; +select * from coin_archive; +select * from trade_request; +select * from asset; +select * from trade_history; + + +show tables; + +Insert into user(user_id, user_pw, user_name, is_admin) values('test', 'test', 'test', True); diff --git "a/\355\210\254\354\236\220\353\202\264\354\227\255 \355\216\230\354\235\264\354\247\200.html" "b/\355\210\254\354\236\220\353\202\264\354\227\255 \355\216\230\354\235\264\354\247\200.html" deleted file mode 100644 index 0952517..0000000 --- "a/\355\210\254\354\236\220\353\202\264\354\227\255 \355\216\230\354\235\264\354\247\200.html" +++ /dev/null @@ -1,83 +0,0 @@ - - - - - 레이아웃 예시 - - - - - -
- - - - - -
- - -
- -
-
-

계좌 목록

- -
-
-

잔고 조회

- -
-
-

주문 내역

- -
-
- - -
-
-

총 보유 자산

- -
-
-

메인 차트 / 분석 영역

- -
-
- - -
-
-

로그 / 알림 / 상세 정보

- -
-
-
- - - - -