diff --git a/Dockerfile b/Dockerfile
index 92ecbb66a..c6124d5ab 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM python:3.11-alpine
+FROM python:3.12-alpine
RUN apk add --no-cache ffmpeg nginx git && \
mkdir /opt/reAudioPlayer && \
diff --git a/Dockerfile.dev b/Dockerfile.dev
index 19d7425f6..fe5c38415 100644
--- a/Dockerfile.dev
+++ b/Dockerfile.dev
@@ -1,4 +1,4 @@
-FROM python:3.11
+FROM python:3.12
RUN apt-get update && apt-get upgrade -y && \
apt-get install -y ffmpeg nginx
diff --git a/docker-compose.yml b/docker-compose.yml
index f2a6de3ec..028cf964f 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,9 +1,9 @@
version: "3.9"
services:
- reap-one:
- image: "ghcr.io/reaudioplayer/reap-one:1.0.0"
- ports:
- - "1234:80"
- volumes:
- - ./src/usr/:/opt/reAudioPlayer/usr/
- - ./src/cache/:/opt/reAudioPlayer/server/_cache/
+ reap-one:
+ image: "ghcr.io/reaudioplayer/reap-one:1.1.0"
+ ports:
+ - "1234:80"
+ volumes:
+ - ./src/usr/:/opt/reAudioPlayer/usr/
+ - ./src/cache/:/opt/reAudioPlayer/server/_cache/
diff --git a/one.bat b/one.bat
index 630f4178d..8e1bfc6b1 100644
--- a/one.bat
+++ b/one.bat
@@ -1,6 +1,6 @@
@echo off
-set VERSION=1.0.0
+set VERSION=1.1.0
set command=%1
set arg=%2
diff --git a/rebuild.sh b/rebuild.sh
index afcd1ff65..3d8c36fb3 100644
--- a/rebuild.sh
+++ b/rebuild.sh
@@ -1,5 +1,5 @@
docker compose down
-docker rmi ghcr.io/reaudioplayer/reap-one:1.0.0
+docker rmi ghcr.io/reaudioplayer/reap-one:1.1.0
sudo bash -c 'echo "nameserver 1.1.1.1" > /etc/resolv.conf'
-docker build -t ghcr.io/reaudioplayer/reap-one:1.0.0 .
+docker build -t ghcr.io/reaudioplayer/reap-one:1.1.0 .
docker compose up -d
diff --git a/src/server/config/cacheStrategy.py b/src/server/config/cacheStrategy.py
index f0334e0bc..c12718f6b 100644
--- a/src/server/config/cacheStrategy.py
+++ b/src/server/config/cacheStrategy.py
@@ -76,7 +76,7 @@ async def onStrategyLoad(self) -> None:
async def _task() -> None:
for playlist in self._player.playlistManager.playlists:
for song in playlist:
- await self._downloader.downloadSong(song.model)
+ await self._downloader.downloadSong(song, internal=True)
asyncio.create_task(_task())
@@ -88,7 +88,7 @@ async def _downloadTask(self) -> None:
assert self._playlist is not None
SongCache.prune(self._playlist)
for song in self._playlist:
- await self._downloader.downloadSong(song.model)
+ await self._downloader.downloadSong(song, internal = True)
async def onStrategyLoad(self) -> None:
await super().onStrategyLoad()
@@ -115,4 +115,4 @@ async def onSongLoad(self, song: Song) -> None:
assert self._playlist is not None
currentSong, nextSong = song, self._playlist.next(True)
SongCache.prune([currentSong, nextSong])
- await self._downloader.downloadSong(nextSong.model)
+ await self._downloader.downloadSong(nextSong, internal = True)
diff --git a/src/server/dataModel/song.py b/src/server/dataModel/song.py
index dece15311..a977daff3 100644
--- a/src/server/dataModel/song.py
+++ b/src/server/dataModel/song.py
@@ -97,10 +97,8 @@ def toDict(self) -> Dict[str, Any]:
result["metadata"] = self.metadata.toDict()
return result
- def downloadPath(self, forExport: bool = False) -> str:
+ def downloadPath(self) -> str:
"""return download path"""
- if forExport:
- return f"{self.model.id}.dl"
return str(self.model.id)
@classmethod
diff --git a/src/server/db/table/songs.py b/src/server/db/table/songs.py
index 13716b8b5..1b1bcf768 100644
--- a/src/server/db/table/songs.py
+++ b/src/server/db/table/songs.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
"""reAudioPlayer ONE"""
+
from __future__ import annotations
__copyright__ = "Copyright (c) 2023 https://github.com/reAudioPlayer"
@@ -281,20 +282,23 @@ def albumHash(self, value: str) -> None:
self._albumHash = value
self._fireChanged()
+ @property
+ def hash(self) -> str:
+ """return hash"""
+ return str(hashids.encode(self.id))
+
@property
def url(self) -> str:
"""return url"""
- return f"/track/{hashids.encode(self.id)}"
+ return f"/track/{self.hash}"
@property
def albumUrl(self) -> str:
"""return album url"""
return f"/album/{self._albumHash}"
- def downloadPath(self, forExport: bool = False) -> str:
+ def downloadPath(self) -> str:
"""return download path"""
- if forExport:
- return f"{self.id}.dl"
return str(self.id)
def toDict(self) -> Dict[str, Any]:
@@ -303,7 +307,11 @@ def toDict(self) -> Dict[str, Any]:
"id": self.id,
"title": self.name,
"artist": self.artist,
- "album": {"name": self._album, "id": self._albumHash, "href": self.albumUrl},
+ "album": {
+ "name": self._album,
+ "id": self._albumHash,
+ "href": self.albumUrl,
+ },
"cover": self.cover,
"favourite": self.favourite,
"duration": self.duration,
diff --git a/src/server/downloader/downloader.py b/src/server/downloader/downloader.py
index 0a295d89d..5c5dd5183 100644
--- a/src/server/downloader/downloader.py
+++ b/src/server/downloader/downloader.py
@@ -1,14 +1,16 @@
# -*- coding: utf-8 -*-
"""reAudioPlayer ONE"""
-__copyright__ = "Copyright (c) 2022 https://github.com/reAudioPlayer"
+__copyright__ = "Copyright (c) 2024 https://github.com/reAudioPlayer"
import asyncio
+from enum import StrEnum
from os import path
import os
from typing import Any, Dict, Optional
import logging
import shutil
from queue import Queue, Empty
+import subprocess
from pyaddict import JDict
import aiohttp
@@ -16,11 +18,10 @@
import eyed3 # type: ignore
from eyed3.id3.frames import ImageFrame # type: ignore
from eyed3.id3 import Tag # type: ignore
-from yt_dlp import YoutubeDL # type: ignore
from helper.asyncThread import asyncRunInThreadWithReturn
from helper.singleton import Singleton
-from config.customData import LocalTrack
+from config.customData import LocalTrack, LocalCover
from db.database import Database
from db.table.songs import SongModel
from dataModel.song import Song
@@ -29,65 +30,41 @@
DOWNLOADING = []
+class DownloadState(StrEnum):
+ """download state"""
+
+ DOWNLOADING = "downloading"
+ FINISHED = "finished"
+ ERROR = "error"
+
+
class DownloadStatus:
"""download status"""
__slots__ = (
- "_total",
- "_downloaded",
- "_percent",
- "_speed",
- "_elapsed",
- "_songId",
- "_eta",
"_status",
- "_filename",
- "_chunk",
+ "_song",
+ "_internal",
)
- def __init__(self, data: Dict[str, Any]) -> None:
- dex = JDict(data)
- self._status = dex.ensure("status", str)
- self._downloaded = dex.ensure("downloaded_bytes", int, 0)
- self._total = dex.ensure("total_bytes", int, self._downloaded)
- self._percent = float(
- dex.ensure("_percent_str", str, "0%").replace("%", "").replace(" ", "")
- )
- self._speed = dex.ensure("_speed_str", str, "0")
- self._elapsed = dex.ensure("_elapsed_str", str, "0")
- self._eta = dex.ensure("eta", int, 0)
- self._filename = dex.ensure("filename", str, "")
- # './_cache/159.dl.mp3' -> 159
- # consider chunks!
-
- nameNoPath = self._filename.split("/")[-1]
- self._songId = int(nameNoPath.split(".")[0])
- self._chunk: Optional[str] = None
- if len(nameNoPath.split(".")) > 3:
- self._chunk = nameNoPath.split(".")[2]
+ def __init__(self, status: DownloadState, song: Song, internal: bool = False) -> None:
+ self._status = status
+ self._song = song
+ self._internal = internal
@property
def showInUI(self) -> bool:
"""show in ui"""
- return ".dl" in self._filename
+ return not self._internal
- def toDict(self, downloaded: Dict[int, SongModel]) -> Dict[str, Any]:
+ def toDict(self) -> Dict[str, Any]:
"""to dict"""
res = {
- "songId": self._songId,
- "filename": self._filename,
+ "id": self._song.model.hash,
+ "song": self._song.toDict(),
"status": self._status,
- "total": self._total,
- "downloaded": self._downloaded,
- "percent": round(self._percent, 2),
- "speed": self._speed,
- "elapsed": self._elapsed,
- "eta": self._eta,
- "chunk": self._chunk,
"internal": not self.showInUI,
}
- if self._songId in downloaded:
- res["song"] = downloaded[self._songId].toDict()
return res
@@ -102,30 +79,54 @@ class Downloader(metaclass=Singleton):
"_websocketClients",
"_downloadStatusTask",
"_db",
- "_downloaded",
)
def __init__(self) -> None:
self._opts = {
"noplaylist": True,
- "outtmpl": "./_cache/upNow.%(ext)s",
"postprocessors": [{"key": "FFmpegExtractAudio", "preferredcodec": "mp3"}],
}
- self._ydl = YoutubeDL(self._opts)
- self._ydl.add_progress_hook(self._hook)
self._logger = logging.getLogger("downloader")
self._statusQueue: Queue[DownloadStatus] = Queue()
self._websocketClients: set[web.WebSocketResponse] = set()
self._downloadStatusTask: Optional[asyncio.Task[None]] = None
self._db = Database()
- self._downloaded: Dict[int, SongModel] = {}
+
+ if not path.exists("./_cache"):
+ os.mkdir("./_cache")
+
+ async def _getCover(self, song: SongModel) -> bytes:
+ if song.cover.startswith("local:"):
+ cover = LocalCover.fromDisplayPath(song.cover)
+ with open(cover.absPath, "rb") as file:
+ return file.read()
+
+ async with aiohttp.ClientSession() as session:
+ async with session.get(song.cover) as resp:
+ if resp.status != 200:
+ raise LookupError()
+ return await resp.read()
+
+ async def _applyMetadata(self, filename: str, song: SongModel) -> None:
+ file = eyed3.load(filename)
+ tag = file.tag or Tag()
+
+ if song.artists:
+ tag.artist = ", ".join(song.artists)
+ tag.title = song.name
+ tag.album = song.album
+
+ tag.images.set(ImageFrame.FRONT_COVER, await self._getCover(song), "image/jpeg", "Cover")
+
+ file.tag = tag
+ tag.save(version=eyed3.id3.ID3_V2_3)
async def _downloadStatusLoop(self) -> None:
while True:
try:
status = self._statusQueue.get(False)
for client in self._websocketClients:
- await client.send_json(status.toDict(self._downloaded))
+ await client.send_json(status.toDict())
self._statusQueue.task_done()
except Empty:
pass
@@ -141,19 +142,20 @@ async def _handleMessage(data: JDict) -> Optional[Dict[str, Any]]:
if data.ensure("action", str) == "download":
if data.ensure("source", str) == "db":
songId = data.ensure("songId", int, -1)
- song = await self._db.songs.byId(songId)
- if not song:
+ songModel = await self._db.songs.byId(songId)
+ if not songModel:
return {
"action": "download",
"status": "error",
"message": "song not found",
"songId": songId,
}
+ song = Song(songModel)
else:
- song = Song.fromDict(data).model
+ song = Song.fromDict(data)
self._logger.info("download custom song %s", song)
- asyncio.create_task(self.downloadSong(song, True, True))
- return {"action": "download", "status": "ok", "songId": song.id}
+ asyncio.create_task(self.downloadSong(song))
+ return {"action": "download", "status": "ok", "songId": song.model.id}
return {
"action": data.optionalGet("action", str),
"status": "error",
@@ -174,85 +176,53 @@ async def _handleMessage(data: JDict) -> Optional[Dict[str, Any]]:
self._websocketClients.remove(ws)
return ws
- async def _getCover(self, song: SongModel) -> bytes:
- async with aiohttp.ClientSession() as session:
- async with session.get(song.cover) as resp:
- if resp.status != 200:
- raise LookupError()
- return await resp.read()
-
- async def _applyMetadata(self, filename: str, song: SongModel) -> None:
- fullPath = f"./_cache/{filename}.mp3"
- file = eyed3.load(fullPath)
- tag = file.tag or Tag()
-
- if song.artists:
- tag.artist = ", ".join(song.artists)
- tag.title = song.name
- tag.album = song.album
-
- tag.images.set(ImageFrame.FRONT_COVER, await self._getCover(song), "image/jpeg", "Cover")
-
- file.tag = tag
- tag.save(version=eyed3.id3.ID3_V2_3)
-
- async def downloadSong(
- self, song: SongModel, forExport: bool = False, withMetadata: bool = False
- ) -> bool:
- """downloads a song"""
- filename = Song(song).downloadPath(forExport)
- self._downloaded[song.id] = song
- result = await self.download(song.source, filename)
- if not result:
- return False
- if withMetadata:
- await self._applyMetadata(filename, song)
- self._emulateHook("finished", filename)
- return True
-
- def _hook(self, data: Dict[str, Any]) -> None:
- if not data.get("emulated") and data["status"] != "downloading":
- return
- self._statusQueue.put(DownloadStatus(data))
-
- def _emulateHook(self, status: str, filename: str) -> None:
- self._hook({"status": status, "filename": filename, "emulated": True})
-
- def getSongById(self, songId: int) -> Optional[SongModel]:
- """gets a song by id"""
- return self._downloaded.get(songId)
+ def _hook(self, status: DownloadStatus) -> None:
+ self._statusQueue.put(status)
def pop(self, songId: int) -> bool:
"""checks if a song is ready"""
- if songId not in self._downloaded:
+ if not path.exists(f"./_cache/{songId}.mp3"):
return False
- if not path.exists(f"./_cache/{songId}.dl.mp3"):
+ return True
+
+ async def downloadSong(self, song: Song, internal: bool = False) -> bool:
+ """downloads a song"""
+ self._hook(
+ DownloadStatus(
+ DownloadState.DOWNLOADING,
+ song,
+ internal=internal,
+ )
+ )
+ result = await self.download(song)
+ self._hook(
+ DownloadStatus(
+ DownloadState.FINISHED if result else DownloadState.ERROR,
+ song,
+ internal=internal,
+ )
+ )
+ if not result:
return False
- self._downloaded.pop(songId)
return True
- async def download(self, link: Optional[str], filename: str) -> bool:
+ async def download(self, song: Song) -> bool:
"""downloads a song from a link (low level)"""
if self._downloadStatusTask is None:
self._downloadStatusTask = asyncio.create_task(self._downloadStatusLoop())
+ filename = song.downloadPath()
+ link = song.model.source
self._logger.info("downloading %s (%s)", link, filename)
- if link is None:
- self._logger.warning("link is None")
- return False
-
# relative dest path
relName = f"./_cache/{filename}.%(ext)s"
dest = relName.replace("%(ext)s", "mp3")
- # dest folder
- if not path.exists("./_cache"):
- os.mkdir("./_cache")
-
isLink = link.startswith("http")
+ # don't download twice
if filename in DOWNLOADING:
while filename in DOWNLOADING:
await asyncio.sleep(1)
@@ -267,13 +237,12 @@ async def download(self, link: Optional[str], filename: str) -> bool:
if path.exists(link):
self._logger.debug("copying %s to %s", link, dest)
shutil.copy(os.path.normpath(link), os.path.normpath(relName.replace("%(ext)s", "mp3")))
- self._emulateHook("finished", filename)
+ await self._applyMetadata(dest, song.model)
return True
# already at dest
if path.exists(dest):
self._logger.debug("already at dest %s", dest)
- self._emulateHook("finished", filename)
return True
# copy failed, can't download
@@ -283,18 +252,23 @@ async def download(self, link: Optional[str], filename: str) -> bool:
# download
DOWNLOADING.append(filename)
- self._ydl.params["outtmpl"] = {"default": relName, "noplaylist": True}
+
+ def _implement() -> int:
+ return subprocess.run(
+ ["yt-dlp", "--extract-audio", "--audio-format", "mp3", link, "-o", relName],
+ check=False,
+ ).returncode
while DOWNLOADING[0] != filename:
self._logger.debug("%s queued, position %s", filename, DOWNLOADING.index(filename))
await asyncio.sleep(2)
try:
- err = await asyncRunInThreadWithReturn(self._ydl.download, [link])
+ err = await asyncRunInThreadWithReturn(_implement)
+ await self._applyMetadata(dest, song.model)
DOWNLOADING.remove(filename)
return isinstance(err, int) and err == 0
except Exception as err: # pylint: disable=broad-except
- self._emulateHook("error", filename)
self._logger.exception(err)
self._logger.error(
"%s could not be downloaded (%s / %s)",
diff --git a/src/server/handler/download.py b/src/server/handler/download.py
index 617565cb3..4c4c53ee4 100644
--- a/src/server/handler/download.py
+++ b/src/server/handler/download.py
@@ -23,36 +23,27 @@ def __init__(self, downloader: Downloader, player: Player) -> None:
self._downloader = downloader
self._player = player
- async def downloadTrack(self, request: web.Request) -> web.Response:
+ async def downloadTrack(self, request: web.Request) -> web.StreamResponse:
"""get(/api/tracks/{id}/download)"""
id_ = int(request.match_info["id"])
- song = self._downloader.getSongById(id_)
+ song = await self._dbManager.songs.byId(id_)
if not song:
- return web.HTTPExpectationFailed(text="not downloaded")
+ raise web.HTTPNotFound(text="song not found")
- pathAndName = f"./_cache/{song.id}.dl.mp3"
+ pathAndName = f"./_cache/{song.id}.mp3"
if not self._downloader.pop(id_):
return web.HTTPExpectationFailed(text="not downloaded")
filename = f"{song.artist} - {song.name}".replace(",", "%2C") # header
- res = web.FileResponse(
+ return web.FileResponse(
pathAndName,
headers=MultiDict({"Content-Disposition": f"Attachment;filename={filename}.mp3"}),
)
- # NOTE, not:
- # return res
- # because we need to remove the file after it has been sent
-
- await res.prepare(request)
- await res.write_eof()
- os.remove(pathAndName)
- return web.Response()
-
- @withObjectPayload( # type: ignore
+ @withObjectPayload( # type: ignore
Object(
{
"id": Integer().coerce(),
@@ -71,7 +62,7 @@ async def deleteFromCache(
return web.Response()
return web.Response(status=404)
- @withObjectPayload( # type: ignore
+ @withObjectPayload( # type: ignore
Object(
{
"id": Integer().coerce(),
diff --git a/src/server/handler/playlist.py b/src/server/handler/playlist.py
index 1ac8b3237..5274db1c8 100644
--- a/src/server/handler/playlist.py
+++ b/src/server/handler/playlist.py
@@ -51,6 +51,7 @@ async def addSong(self, request: web.Request) -> web.Response:
"""post(/api/playlists/{id}/tracks)"""
id_ = str(request.match_info["id"])
jdata = await request.json()
+ success = False
if isinstance(jdata, list):
success = await self._playlistManager.addAllToPlaylist(
diff --git a/src/server/handler/spotifyAuth.py b/src/server/handler/spotifyAuth.py
index ecc3842f8..2113ef4c2 100644
--- a/src/server/handler/spotifyAuth.py
+++ b/src/server/handler/spotifyAuth.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
"""reAudioPlayer ONE"""
from __future__ import annotations
+
__copyright__ = "Copyright (c) 2022 https://github.com/reAudioPlayer"
import os
@@ -13,7 +14,7 @@
import aiohttp
from aiohttp import web
from pyaddict import JDict
-from spotipy.oauth2 import SpotifyOAuth # type: ignore
+from spotipy.oauth2 import SpotifyOAuth # type: ignore
from config.runtime import Runtime
from helper.cacheDecorator import clearCache
@@ -21,11 +22,12 @@
SCOPE = "user-library-read user-follow-read user-follow-modify"
-REDIRECT = "http://localhost:1234/api/spotify/callback"
+REDIRECT = "{origin}/api/spotify/callback"
class SpotifyAuth(Logged):
"""Handles Spotify Authentication"""
+
def __init__(self) -> None:
super().__init__(self.__class__.__name__)
self._attemptedClientAuth = False
@@ -34,13 +36,14 @@ async def _refresh(self, token: str) -> bool:
"""attempts to use the refresh token to get a new access token"""
# spotify api docs: https://developer.spotify.com/documentation/general/guides/authorization-guide/#refreshing-access-tokens # pylint: disable=line-too-long
async with aiohttp.ClientSession() as session:
- async with session.post("https://accounts.spotify.com/api/token", data = {
- "grant_type": "refresh_token",
- "refresh_token": token
- }, headers = {
- "Content-Type": "application/x-www-form-urlencoded",
- "Authorization": SpotifyAuth._getSpotifyAuthHeader()
- }) as response:
+ async with session.post(
+ "https://accounts.spotify.com/api/token",
+ data={"grant_type": "refresh_token", "refresh_token": token},
+ headers={
+ "Content-Type": "application/x-www-form-urlencoded",
+ "Authorization": SpotifyAuth._getSpotifyAuthHeader(),
+ },
+ ) as response:
self._logger.debug("refresh response: %s", response.status)
if response.status != 200:
return False
@@ -48,7 +51,7 @@ async def _refresh(self, token: str) -> bool:
data = await response.json()
data["refresh_token"] = token
data["expires_at"] = time() + data["expires_in"]
- with open(".cache", "w", encoding = "utf8") as file:
+ with open(".cache", "w+", encoding="utf8") as file:
file.write(json.dumps(data))
return True
@@ -62,7 +65,7 @@ async def shouldAuth(self, forceRefresh: bool = False) -> bool:
self._logger.info("Spotify is not authenticated (no cache file)")
return True
- with open(".cache", "r", encoding = "utf8") as file:
+ with open(".cache", "r", encoding="utf8") as file:
data = json.loads(file.read())
if not forceRefresh and not JDict(data).ensure("expires_at", int) < time():
@@ -84,7 +87,7 @@ def isAuth(self) -> bool:
def authorizeUrl(self) -> str:
"""Returns the Spotify Authorize Url"""
clientId, _ = SpotifyAuth._getSpotifyAuthData()
- return f"https://accounts.spotify.com/authorize?client_id={clientId}&response_type=code&redirect_uri={REDIRECT}&scope={SCOPE}" # pylint: disable=line-too-long
+ return f"https://accounts.spotify.com/authorize?client_id={clientId}&response_type=code&redirect_uri={REDIRECT}&scope={SCOPE}" # pylint: disable=line-too-long
@staticmethod
def isDisabled() -> bool:
@@ -113,17 +116,15 @@ def _getSpotifyAuthHeader() -> Optional[str]:
return None
clientId, secret = SpotifyAuth._getSpotifyAuthData()
- return "Basic " + \
- base64.b64encode(f"{clientId}:{secret}"\
- .encode("utf-8")).decode("utf-8")
+ return "Basic " + base64.b64encode(f"{clientId}:{secret}".encode("utf-8")).decode("utf-8")
@staticmethod
- def getSpotifyAuth() -> Optional[SpotifyOAuth]: # pylint: disable=invalid-name
+ def getSpotifyAuth() -> Optional[SpotifyOAuth]: # pylint: disable=invalid-name
"""Returns the SpotifyOAuth object"""
if SpotifyAuth.isDisabled():
return None
id_, secret = SpotifyAuth._getSpotifyAuthData()
- return SpotifyOAuth(id_, secret, "localhost", scope = SCOPE)
+ return SpotifyOAuth(id_, secret, "localhost", scope=SCOPE)
async def getSpotifyConfig(self, _: web.Request) -> web.Response:
"""get(/api/config/spotify)"""
@@ -134,10 +135,7 @@ async def getSpotifyConfig(self, _: web.Request) -> web.Response:
return web.HTTPUnauthorized()
id_, secret = SpotifyAuth._getSpotifyAuthData()
- return web.json_response({
- "id": id_,
- "secret": secret
- })
+ return web.json_response({"id": id_, "secret": secret})
async def clientSideAuthHandler(self, _: web.Request) -> web.Response:
"""Returns the client side auth data"""
@@ -157,7 +155,7 @@ async def _reset() -> None:
self._attemptedClientAuth = True
# redirect to spotify auth
- return web.Response(text = self.authorizeUrl)
+ return web.Response(text=self.authorizeUrl)
async def callbackHandler(self, request: web.Request) -> web.Response:
"""Handles the callback from Spotify"""
@@ -177,20 +175,20 @@ async def getSpotifyToken(self, code: str) -> Optional[str]:
return None
async with aiohttp.ClientSession() as session:
- async with session.post("https://accounts.spotify.com/api/token", data = {
- "grant_type": "authorization_code",
- "code": code,
- "redirect_uri": REDIRECT
- }, headers = {
- "Content-Type": "application/x-www-form-urlencoded",
- "Authorization": SpotifyAuth._getSpotifyAuthHeader()
- }) as resp:
+ async with session.post(
+ "https://accounts.spotify.com/api/token",
+ data={"grant_type": "authorization_code", "code": code, "redirect_uri": REDIRECT},
+ headers={
+ "Content-Type": "application/x-www-form-urlencoded",
+ "Authorization": SpotifyAuth._getSpotifyAuthHeader(),
+ },
+ ) as resp:
if resp.status == 200:
data = await resp.json()
data["expires_at"] = data["expires_in"] + int(time())
- with open(".cache", "w", encoding = "utf8") as file:
+ with open(".cache", "w+", encoding="utf8") as file:
file.write(json.dumps(data))
clearCache()
@@ -218,7 +216,7 @@ def addExpiresAt(self) -> bool:
if not os.path.isfile(".cache"):
return False
- with open(".cache", "r", encoding = "utf8") as file:
+ with open(".cache", "r", encoding="utf8") as file:
data = json.loads(file.read())
if "expires_at" in data:
@@ -226,7 +224,7 @@ def addExpiresAt(self) -> bool:
data["expires_at"] = data["expires_in"] + int(time())
- with open(".cache", "w", encoding = "utf8") as file:
+ with open(".cache", "w+", encoding="utf8") as file:
file.write(json.dumps(data))
return True
diff --git a/src/server/meta/metadata.py b/src/server/meta/metadata.py
index efdcbb195..af664b300 100644
--- a/src/server/meta/metadata.py
+++ b/src/server/meta/metadata.py
@@ -4,7 +4,7 @@
from typing import Any, Dict, Optional
-import validators # type: ignore
+import validators
from meta.spotify import Spotify
from dataModel.track import ITrack, SoundcloudTrack, YoutubeTrack, SpotifyTrack
diff --git a/src/server/meta/scorereader.py b/src/server/meta/scorereader.py
index 0f655d21a..c23cbad0d 100644
--- a/src/server/meta/scorereader.py
+++ b/src/server/meta/scorereader.py
@@ -47,6 +47,7 @@ def toJson(self) -> Dict[str, Any]:
class OneFootballMatch(Match):
"""https://www.onefootball.com/"""
def __init__(self, url: str) -> None:
+ nurl = ""
if "/team" in url:
nurl = OneFootballTeam.getFirstMatch(url)
if "/competition" in url:
diff --git a/src/server/player/player.py b/src/server/player/player.py
index 3c6fa8ab0..c598b3fb8 100644
--- a/src/server/player/player.py
+++ b/src/server/player/player.py
@@ -154,7 +154,7 @@ async def _preloadSong(self, song: Optional[Song]) -> None:
if not self._queue or not song:
return
initial = self._queue.cursor
- while not await self._downloader.downloadSong(song.model):
+ while not await self._downloader.downloadSong(song, internal=True):
self._logger.debug("invalid [%s], preload next", song)
song = self._queue.next()
assert initial != self._queue.cursor, "no valid song"
diff --git a/src/server/requirements.txt b/src/server/requirements.txt
index f64a7193a..7b516ba33 100644
Binary files a/src/server/requirements.txt and b/src/server/requirements.txt differ
diff --git a/src/ui/.storybook/preview-head.html b/src/ui/.storybook/preview-head.html
index ff0b0ee6c..ffefecba0 100644
--- a/src/ui/.storybook/preview-head.html
+++ b/src/ui/.storybook/preview-head.html
@@ -1,4 +1,4 @@
\ No newline at end of file
diff --git a/src/ui/dist/assets/Album-1148dcd6.js b/src/ui/dist/assets/Album-1148dcd6.js
deleted file mode 100644
index 77d2d838c..000000000
--- a/src/ui/dist/assets/Album-1148dcd6.js
+++ /dev/null
@@ -1 +0,0 @@
-import{e as B,B as N,q as j,D as S,n,E as D,y as F,f as L,o as l,c as i,i as p,a7 as P,d as y,g as v,L as U,a,H,K as M,t as I,P as V,F as h,h as $,a2 as q,w as R,al as z,ar as J,ap as K,ag as O,l as G,m as Q,_ as T}from"./index-4a15a213.js";import{P as W}from"./PlaylistEntry-4f48a6f3.js";import"./EditSong.vue_vue_type_script_setup_true_lang-0170f423.js";import"./playerInPicture-af203fdf.js";const C=c=>(G("data-v-4203b278"),c=c(),Q(),c),X={key:1,class:"fill-page"},Y={key:2,class:"artist p-4"},Z={class:"wrap"},ee={class:"artist__data"},se={class:"upper"},ae={class:"track__info__details flex flex-col justify-end"},te={class:"text-secondary my-0 text-2xl font-bold"},le={key:0,class:"text-muted text-base ml-4 font-light"},oe={class:"trac__info__details__normal"},ne={class:"flex flew-row items-center"},ie={class:"font-black text-5xl"},re=C(()=>a("hr",{class:"mb-4"},null,-1)),ue={class:"items"},ce=C(()=>a("h2",null,"All songs from this album",-1)),de={class:"items"},_e=B({__name:"Album",setup(c){const b=N();j();const E=S(()=>b.params.hash),s=n(null),m=n([]),r=n(null),d=n(null),f=n("url"),g=n(!1),x=async()=>{const e=await(await fetch(`/api/albums/${E.value}`)).json();if(e.spotify=e.spotify?JSON.parse(e.spotify):null,e.spotify)try{e.spotify.releaseDate=new Date(e.spotify.releaseDate)}catch{e.spotify.releaseDate=null}s.value=e,r.value=null,d.value="",g.value=!1,s.value.spotify.url.length&&(d.value=s.value.spotify.url,A(s.value.spotify.id),g.value=!0),f.value="link"},A=async t=>{const e=await fetch(`/api/spotify/albums/${t}`);if(!e){J.addError("Failed to fetch album from Spotify",await e.text(),3e3);return}m.value=await e.json()};D(d,()=>{var t,e;if(((e=(t=s.value)==null?void 0:t.spotify)==null?void 0:e.id)==K(d.value,"album")){f.value="link";return}f.value="save"});const w=S(()=>{var t,e,_;return((_=(e=(t=s.value)==null?void 0:t.spotify)==null?void 0:e.releaseDate)==null?void 0:_.toLocaleDateString())??""});return F(x),D(()=>b.params.name,()=>{s.value=null,x()}),(t,e)=>{var k;const _=L("Card");return l(),i(h,null,[s.value?(l(),p(P,{key:0,src:s.value.image,class:"-z-10"},null,8,["src"])):y("",!0),s.value?(l(),i("div",Y,[a("div",Z,[a("div",ee,[a("div",se,[v(H,{src:s.value.image,class:"max-w-sm rounded-xl",placeholder:"library_music",name:s.value.name},null,8,["src","name"]),a("div",ae,[a("h3",te,[v(M,{artist:s.value.artists.join(", "),class:"inline"},null,8,["artist"]),w.value?(l(),i("span",le,I(w.value),1)):y("",!0)]),a("div",oe,[a("div",ne,[a("h1",ie,I(s.value.name),1)])])])]),v(V,{class:"hideIfMobile mt-8","with-more":""}),re,a("div",ue,[(l(!0),i(h,null,$(s.value.songs,o=>q((l(),p(W,{index:s.value.songs.findIndex(u=>u.source==o.source),selected:r.value==o.id,song:o,"playlist-id":"album","with-cover":"","with-more":"",album:s.value.id,onClick:u=>r.value==o.id?r.value=-1:r.value=o.id,onUpdate:e[0]||(e[0]=u=>t.$emit("update"))},null,8,["index","selected","song","album","onClick"])),[[O,!0]])),256))]),(k=m.value)!=null&&k.length?(l(),p(_,{key:0,class:"p-4"},{default:R(()=>[ce,a("div",de,[(l(!0),i(h,null,$(m.value,(o,u)=>(l(),p(z,{index:u,song:o,"can-import":"","cannot-add":"","with-cover":"","with-more":"",onUpdate:e[1]||(e[1]=pe=>t.$emit("update"))},null,8,["index","song"]))),256))])]),_:1})):y("",!0)])])])):(l(),i("div",X,[v(U)]))],64)}}});const he=T(_e,[["__scopeId","data-v-4203b278"]]);export{he as default};
diff --git a/src/ui/dist/assets/Album-1148dcd6.js.gz b/src/ui/dist/assets/Album-1148dcd6.js.gz
deleted file mode 100644
index 727519635..000000000
Binary files a/src/ui/dist/assets/Album-1148dcd6.js.gz and /dev/null differ
diff --git a/src/ui/dist/assets/Album-8d95da06.css b/src/ui/dist/assets/Album-BkvN1zsQ.css
similarity index 92%
rename from src/ui/dist/assets/Album-8d95da06.css
rename to src/ui/dist/assets/Album-BkvN1zsQ.css
index 29d238f91..472b95f3e 100644
--- a/src/ui/dist/assets/Album-8d95da06.css
+++ b/src/ui/dist/assets/Album-BkvN1zsQ.css
@@ -1 +1 @@
-.artist .spotify-enable{width:24px;height:24px;cursor:pointer}.artist .spotify-enable path{fill:var(--fg-base)!important}.artist .spotify-enable.enabled path{fill:var(--fg-secondary)!important}.related[data-v-4203b278]{max-height:calc(768px + 1rem)}.spotify-infos[data-v-4203b278]{display:grid;grid-template-columns:fit-content(100%) 24px 1fr 24px;gap:1rem;align-items:center;height:calc(46px + 1.5rem)}.spotify-infos .meta[data-v-4203b278]{display:grid;grid-template-columns:repeat(3,fit-content(100%))}.spotify-infos .meta>*[data-v-4203b278]:not(:last-child){margin-right:1rem}.spotify-suggestions[data-v-4203b278]{display:grid;grid-template-columns:2fr 1fr;align-items:start;gap:2rem}.artist__data .upper[data-v-4203b278]{display:grid;grid-template-columns:fit-content(100%) minmax(500px,1fr);gap:2rem}.wrap[data-v-4203b278]{grid-template-columns:1fr;display:grid;align-items:start}
+.artist .spotify-enable{width:24px;height:24px;cursor:pointer}.artist .spotify-enable path{fill:var(--fg-base)!important}.artist .spotify-enable.enabled path{fill:var(--fg-secondary)!important}.related[data-v-4203b278]{max-height:calc(768px + 1rem)}.spotify-infos[data-v-4203b278]{display:grid;grid-template-columns:fit-content(100%) 24px 1fr 24px;gap:1rem;align-items:center;height:calc(46px + 1.5rem)}.spotify-infos .meta[data-v-4203b278]{display:grid;grid-template-columns:repeat(3,fit-content(100%))}.spotify-infos .meta[data-v-4203b278]>*:not(:last-child){margin-right:1rem}.spotify-suggestions[data-v-4203b278]{display:grid;grid-template-columns:2fr 1fr;align-items:start;gap:2rem}.artist__data .upper[data-v-4203b278]{display:grid;grid-template-columns:fit-content(100%) minmax(500px,1fr);gap:2rem}.wrap[data-v-4203b278]{grid-template-columns:1fr;display:grid;align-items:start}
diff --git a/src/ui/dist/assets/Album-ncRMQdec.js b/src/ui/dist/assets/Album-ncRMQdec.js
new file mode 100644
index 000000000..9c0190a56
--- /dev/null
+++ b/src/ui/dist/assets/Album-ncRMQdec.js
@@ -0,0 +1 @@
+import{e as B,B as j,q as A,D as S,n as i,E as D,y as F,f as L,o as l,c as n,i as m,a8 as P,d as h,g as _,L as U,a,H as q,K as H,t as I,P as M,F as y,h as $,a3 as V,w as R,am as z,N as J,aq as K,ah as O,l as G,m as Q,_ as T}from"./index-DnhwPdfm.js";import{P as W}from"./PlaylistEntry-B2l8v20L.js";import"./EditSong.vue_vue_type_script_setup_true_lang-C5fIPhus.js";import"./playerInPicture-Dfp9IAsf.js";const C=c=>(G("data-v-4203b278"),c=c(),Q(),c),X={key:1,class:"fill-page"},Y={key:2,class:"artist p-4"},Z={class:"wrap"},ee={class:"artist__data"},se={class:"upper"},ae={class:"track__info__details flex flex-col justify-end"},te={class:"text-secondary my-0 text-2xl font-bold"},le={key:0,class:"text-muted text-base ml-4 font-light"},oe={class:"trac__info__details__normal"},ie={class:"flex flew-row items-center"},ne={class:"font-black text-5xl"},re=C(()=>a("hr",{class:"mb-4"},null,-1)),ue={class:"items"},ce=C(()=>a("h2",null,"All songs from this album",-1)),de={class:"items"},pe=B({__name:"Album",setup(c){const b=j();A();const E=S(()=>b.params.hash),s=i(null),f=i([]),r=i(null),d=i(null),v=i("url"),w=i(!1),x=async()=>{const e=await(await fetch(`/api/albums/${E.value}`)).json();if(e.spotify=e.spotify?JSON.parse(e.spotify):null,e.spotify)try{e.spotify.releaseDate=new Date(e.spotify.releaseDate)}catch{e.spotify.releaseDate=null}s.value=e,r.value=null,d.value="",w.value=!1,s.value.spotify.url.length&&(d.value=s.value.spotify.url,N(s.value.spotify.id),w.value=!0),v.value="link"},N=async t=>{const e=await fetch(`/api/spotify/albums/${t}`);if(!e){J.addError("Failed to fetch album from Spotify",await e.text(),3e3);return}f.value=await e.json()};D(d,()=>{var t,e;if(((e=(t=s.value)==null?void 0:t.spotify)==null?void 0:e.id)==K(d.value,"album")){v.value="link";return}v.value="save"});const g=S(()=>{var t,e,p;return((p=(e=(t=s.value)==null?void 0:t.spotify)==null?void 0:e.releaseDate)==null?void 0:p.toLocaleDateString())??""});return F(x),D(()=>b.params.name,()=>{s.value=null,x()}),(t,e)=>{var k;const p=L("Card");return l(),n(y,null,[s.value?(l(),m(P,{key:0,src:s.value.image,class:"-z-10"},null,8,["src"])):h("",!0),s.value?(l(),n("div",Y,[a("div",Z,[a("div",ee,[a("div",se,[_(q,{src:s.value.image,class:"max-w-sm rounded-xl",placeholder:"library_music",name:s.value.name},null,8,["src","name"]),a("div",ae,[a("h3",te,[_(H,{artist:s.value.artists.join(", "),class:"inline"},null,8,["artist"]),g.value?(l(),n("span",le,I(g.value),1)):h("",!0)]),a("div",oe,[a("div",ie,[a("h1",ne,I(s.value.name),1)])])])]),_(M,{class:"hideIfMobile mt-8","with-more":""}),re,a("div",ue,[(l(!0),n(y,null,$(s.value.songs,o=>V((l(),m(W,{index:s.value.songs.findIndex(u=>u.source==o.source),selected:r.value==o.id,song:o,"playlist-id":"album","with-cover":"","with-more":"",album:s.value.id,onClick:u=>r.value==o.id?r.value=-1:r.value=o.id,onUpdate:e[0]||(e[0]=u=>t.$emit("update"))},null,8,["index","selected","song","album","onClick"])),[[O,!0]])),256))]),(k=f.value)!=null&&k.length?(l(),m(p,{key:0,class:"p-4"},{default:R(()=>[ce,a("div",de,[(l(!0),n(y,null,$(f.value,(o,u)=>(l(),m(z,{index:u,song:o,"can-import":"","cannot-add":"","with-cover":"","with-more":"",onUpdate:e[1]||(e[1]=me=>t.$emit("update"))},null,8,["index","song"]))),256))])]),_:1})):h("",!0)])])])):(l(),n("div",X,[_(U)]))],64)}}}),ye=T(pe,[["__scopeId","data-v-4203b278"]]);export{ye as default};
diff --git a/src/ui/dist/assets/Album-ncRMQdec.js.gz b/src/ui/dist/assets/Album-ncRMQdec.js.gz
new file mode 100644
index 000000000..627fa96e8
Binary files /dev/null and b/src/ui/dist/assets/Album-ncRMQdec.js.gz differ
diff --git a/src/ui/dist/assets/Artist-CNrEVT3R.js b/src/ui/dist/assets/Artist-CNrEVT3R.js
new file mode 100644
index 000000000..a741443ed
--- /dev/null
+++ b/src/ui/dist/assets/Artist-CNrEVT3R.js
@@ -0,0 +1 @@
+import{e as L,o as a,i as r,w as x,b as j,t as m,C as g,_ as P,B as q,q as A,D,n as h,E as U,y as R,c as o,a8 as z,d as i,g as y,L as M,a as t,H as V,Q as B,F as v,h as w,u as J,$ as O,P as Q,a3 as W,am as Y,aq as E,ar as G,ah as K,l as X,m as Z}from"./index-DnhwPdfm.js";import{F}from"./FactCard-D7mi8_uS.js";import{P as ee}from"./PlaylistEntry-B2l8v20L.js";import{s as ae}from"./spotify-BVNWZn3O.js";import"./EditSong.vue_vue_type_script_setup_true_lang-C5fIPhus.js";import"./playerInPicture-Dfp9IAsf.js";const te=L({__name:"Tag",props:{tag:{type:String,required:!0},withHash:{type:Boolean,default:!1}},setup(c){return(b,$)=>(a(),r(g,{class:"tag px-4 py-2 cursor-pointer","with-hover":""},{default:x(()=>[j(m(c.withHash?"#":"")+m(c.tag),1)]),_:1}))}}),se=P(te,[["__scopeId","data-v-2712639d"]]),k=c=>(X("data-v-13b2922c"),c=c(),Z(),c),le={key:1,class:"fill-page"},oe={key:2,class:"artist p-4"},re={class:"wrap"},ne={class:"artist__data"},ie={class:"upper"},ue={class:"trac__info__details__normal"},de={key:0,class:"mt-0 mb-2 flex flex-row gap-2"},ce={class:"flex flew-row items-center"},pe={class:"font-black text-5xl ml-4"},ve={class:"features flex flex-row gap-4 mt-4 overflow-x-auto"},me={class:"spotify-infos pt-4 pb-2"},_e={class:"meta items-center"},fe={key:0,class:"flex flex-row align-items"},he=k(()=>t("span",{class:"material-symbols-rounded ms-fill mr-2"},"local_fire_department",-1)),ye={class:"font-bold"},we=k(()=>t("hr",{class:"mb-4"},null,-1)),xe={class:"items"},ge={key:0,class:"spotify-suggestions mt-4"},ke=k(()=>t("h2",null,"Top Tracks",-1)),be={class:"items"},$e=k(()=>t("h2",null,"Related Artists",-1)),Ce={class:"flex flex-row items-center gap-4"},Ie={class:"flex flex-col"},Se={class:"font-bold"},Te=L({__name:"Artist",setup(c){const b=q();A();const $=D(()=>b.params.name),e=h(null),_=h(null),u=h(null),f=h("url"),d=h(!1),C=async()=>{const n=await fetch(`/api/artists/${$.value}`);e.value=await n.json(),_.value=null,u.value="",d.value=!1,e.value.metadata.id.length==22&&(u.value="https://open.spotify.com/artist/"+e.value.metadata.id,d.value=!0),f.value="link"},I=async n=>{await fetch(`/api/artists/${$.value}`,{method:"PUT",body:JSON.stringify({spotifyId:n})}),e.value=null,await C()};U(u,()=>{var n,l;if(((l=(n=e.value)==null?void 0:n.metadata)==null?void 0:l.id)==E(u.value,"artist")){f.value="link";return}f.value="save"});const H=()=>{if(f.value=="link"){G(u.value);return}I(E(u.value,"artist"))};return R(C),U(()=>b.params.name,()=>{e.value=null,C()}),(n,l)=>{var S,T,N;return a(),o(v,null,[e.value?(a(),r(z,{key:0,src:e.value.cover,class:"-z-10"},null,8,["src"])):i("",!0),e.value?(a(),o("div",oe,[t("div",re,[t("div",ne,[t("div",ie,[y(V,{src:e.value.cover,class:"max-w-sm rounded-xl",placeholder:"person"},null,8,["src"]),t("div",{class:B([{"justify-end":e.value.metadata,"justify-center":!e.value.metadata},"track__info__details flex flex-col"])},[t("div",ue,[(S=e.value.metadata)!=null&&S.genres?(a(),o("div",de,[(a(!0),o(v,null,w(e.value.metadata.genres,s=>(a(),r(se,{tag:s,"with-hash":""},null,8,["tag"]))),256))])):i("",!0),t("div",ce,[t("h1",pe,m(e.value.name),1)])]),e.value.metadata?(a(),o(v,{key:0},[t("div",ve,[e.value.metadata.followers?(a(),r(F,{key:0,"primary-text":e.value.metadata.followers.toLocaleString(),class:"w-full","secondary-text":"Followers"},null,8,["primary-text"])):i("",!0),e.value.songs.length?(a(),r(F,{key:1,"primary-text":e.value.songs.length,class:"w-full","secondary-text":"Tracks in Your Library"},null,8,["primary-text"])):i("",!0)]),t("div",me,[t("div",_e,[e.value.metadata.popularity?(a(),o("span",fe,[he,t("span",ye,m(e.value.metadata.popularity),1)])):i("",!0)]),y(J(ae),{class:B([{enabled:d.value},"spotify-enable"]),onClick:l[0]||(l[0]=s=>d.value=!d.value)},null,8,["class"]),d.value?(a(),r(O,{key:0,modelValue:u.value,"onUpdate:modelValue":l[1]||(l[1]=s=>u.value=s),icon:f.value,onClick:H},null,8,["modelValue","icon"])):i("",!0),t("span",{class:"material-symbols-rounded cursor-pointer",onClick:l[2]||(l[2]=s=>d.value?I(!1):I(!0))},m(d.value?"delete":"search"),1)])],64)):i("",!0)],2)]),y(Q,{class:"hideIfMobile mt-8","with-album":"","with-more":""}),we,t("div",xe,[(a(!0),o(v,null,w(e.value.songs,s=>W((a(),r(ee,{index:e.value.songs.findIndex(p=>p.source==s.source),selected:_.value==s.id,song:s,"playlist-id":"artist","with-album":"","with-cover":"","with-more":"",artist:e.value.name,onClick:p=>_.value==s.id?_.value=-1:_.value=s.id,onUpdate:l[3]||(l[3]=p=>n.$emit("update"))},null,8,["index","selected","song","artist","onClick"])),[[K,!0]])),256))]),e.value.metadata?(a(),o("div",ge,[(T=e.value.metadata.topTracks)!=null&&T.length?(a(),r(g,{key:0,class:"p-4"},{default:x(()=>[ke,t("div",be,[(a(!0),o(v,null,w(e.value.metadata.topTracks,(s,p)=>(a(),r(Y,{index:p,song:s,"can-import":"","cannot-add":"","with-album":"","with-cover":"","with-more":"",onUpdate:l[4]||(l[4]=Ne=>n.$emit("update"))},null,8,["index","song"]))),256))])]),_:1})):i("",!0),(N=e.value.metadata.related)!=null&&N.length?(a(),r(g,{key:1,class:"p-4 flex flex-col gap-2 related overflow-y-auto"},{default:x(()=>[$e,(a(!0),o(v,null,w(e.value.metadata.related,s=>(a(),r(g,{class:"cursor-pointer px-4 py-2","with-hover":"",onClick:p=>n.$router.push(`/artist/${s.name}`)},{default:x(()=>[t("div",Ce,[y(V,{src:s.cover,class:"w-8 h-8 rounded-xl",placeholder:"person"},null,8,["src"]),t("div",Ie,[t("h3",Se,m(s.name),1)])])]),_:2},1032,["onClick"]))),256))]),_:1})):i("",!0)])):i("",!0)])])])):(a(),o("div",le,[y(M)]))],64)}}}),Pe=P(Te,[["__scopeId","data-v-13b2922c"]]);export{Pe as default};
diff --git a/src/ui/dist/assets/Artist-CNrEVT3R.js.gz b/src/ui/dist/assets/Artist-CNrEVT3R.js.gz
new file mode 100644
index 000000000..d3243b284
Binary files /dev/null and b/src/ui/dist/assets/Artist-CNrEVT3R.js.gz differ
diff --git a/src/ui/dist/assets/Artist-c9fc4a3d.css b/src/ui/dist/assets/Artist-DAREyzq0.css
similarity index 93%
rename from src/ui/dist/assets/Artist-c9fc4a3d.css
rename to src/ui/dist/assets/Artist-DAREyzq0.css
index 0b010c19c..bb0a9ced0 100644
--- a/src/ui/dist/assets/Artist-c9fc4a3d.css
+++ b/src/ui/dist/assets/Artist-DAREyzq0.css
@@ -1 +1 @@
-.tag[data-v-2712639d]{border-radius:1000vmax;color:var(--fg-base-dk)}.tag[data-v-2712639d]:hover{color:var(--fg-base)}.artist .spotify-enable{width:24px;height:24px;cursor:pointer}.artist .spotify-enable path{fill:var(--fg-base)!important}.artist .spotify-enable.enabled path{fill:var(--fg-secondary)!important}.related[data-v-13b2922c]{max-height:calc(768px + 1rem)}.spotify-infos[data-v-13b2922c]{display:grid;grid-template-columns:fit-content(100%) 24px 1fr 24px;gap:1rem;align-items:center;height:calc(46px + 1.5rem)}.spotify-infos .meta[data-v-13b2922c]{display:grid;grid-template-columns:repeat(3,fit-content(100%))}.spotify-infos .meta>*[data-v-13b2922c]:not(:last-child){margin-right:1rem}.spotify-suggestions[data-v-13b2922c]{display:grid;grid-template-columns:2fr 1fr;align-items:start;gap:2rem}.artist__data .upper[data-v-13b2922c]{display:grid;grid-template-columns:fit-content(100%) minmax(500px,1fr);gap:2rem}.wrap[data-v-13b2922c]{grid-template-columns:1fr;display:grid;align-items:start}
+.tag[data-v-2712639d]{border-radius:1000vmax;color:var(--fg-base-dk)}.tag[data-v-2712639d]:hover{color:var(--fg-base)}.artist .spotify-enable{width:24px;height:24px;cursor:pointer}.artist .spotify-enable path{fill:var(--fg-base)!important}.artist .spotify-enable.enabled path{fill:var(--fg-secondary)!important}.related[data-v-13b2922c]{max-height:calc(768px + 1rem)}.spotify-infos[data-v-13b2922c]{display:grid;grid-template-columns:fit-content(100%) 24px 1fr 24px;gap:1rem;align-items:center;height:calc(46px + 1.5rem)}.spotify-infos .meta[data-v-13b2922c]{display:grid;grid-template-columns:repeat(3,fit-content(100%))}.spotify-infos .meta[data-v-13b2922c]>*:not(:last-child){margin-right:1rem}.spotify-suggestions[data-v-13b2922c]{display:grid;grid-template-columns:2fr 1fr;align-items:start;gap:2rem}.artist__data .upper[data-v-13b2922c]{display:grid;grid-template-columns:fit-content(100%) minmax(500px,1fr);gap:2rem}.wrap[data-v-13b2922c]{grid-template-columns:1fr;display:grid;align-items:start}
diff --git a/src/ui/dist/assets/Artist-d789cf52.js b/src/ui/dist/assets/Artist-d789cf52.js
deleted file mode 100644
index 569945a0e..000000000
--- a/src/ui/dist/assets/Artist-d789cf52.js
+++ /dev/null
@@ -1 +0,0 @@
-import{e as F,o as t,i as n,w as x,b as H,t as v,C as w,_ as L,B as j,q,D,n as h,E as U,y as R,c as o,a7 as z,d as i,g as y,L as M,a,H as V,O as B,F as p,h as g,u as O,Z as J,P as W,a2 as Y,al as Z,ap as E,aq as G,ag as K,l as Q,m as X}from"./index-4a15a213.js";import{F as A}from"./FactCard-07fe2677.js";import{P as ee}from"./PlaylistEntry-4f48a6f3.js";import{s as te}from"./spotify-2bf3aeb7.js";import"./EditSong.vue_vue_type_script_setup_true_lang-0170f423.js";import"./playerInPicture-af203fdf.js";const ae=F({__name:"Tag",props:{tag:{type:String,required:!0},withHash:{type:Boolean,default:!1}},setup(c){return(b,C)=>(t(),n(w,{class:"tag px-4 py-2 cursor-pointer","with-hover":""},{default:x(()=>[H(v(c.withHash?"#":"")+v(c.tag),1)]),_:1}))}});const se=L(ae,[["__scopeId","data-v-2712639d"]]),k=c=>(Q("data-v-13b2922c"),c=c(),X(),c),le={key:1,class:"fill-page"},oe={key:2,class:"artist p-4"},ne={class:"wrap"},re={class:"artist__data"},ie={class:"upper"},ue={class:"trac__info__details__normal"},de={key:0,class:"mt-0 mb-2 flex flex-row gap-2"},ce={class:"flex flew-row items-center"},_e={class:"font-black text-5xl ml-4"},pe={class:"features flex flex-row gap-4 mt-4 overflow-x-auto"},ve={class:"spotify-infos pt-4 pb-2"},me={class:"meta items-center"},fe={key:0,class:"flex flex-row align-items"},he=k(()=>a("span",{class:"material-symbols-rounded ms-fill mr-2"},"local_fire_department",-1)),ye={class:"font-bold"},ge=k(()=>a("hr",{class:"mb-4"},null,-1)),xe={class:"items"},we={key:0,class:"spotify-suggestions mt-4"},ke=k(()=>a("h2",null,"Top Tracks",-1)),be={class:"items"},Ce=k(()=>a("h2",null,"Related Artists",-1)),$e={class:"flex flex-row items-center gap-4"},Ie={class:"flex flex-col"},Se={class:"font-bold"},Te=F({__name:"Artist",setup(c){const b=j();q();const C=D(()=>b.params.name),e=h(null),m=h(null),u=h(null),f=h("url"),d=h(!1),$=async()=>{const r=await fetch(`/api/artists/${C.value}`);e.value=await r.json(),m.value=null,u.value="",d.value=!1,e.value.metadata.id.length==22&&(u.value="https://open.spotify.com/artist/"+e.value.metadata.id,d.value=!0),f.value="link"},I=async r=>{await fetch(`/api/artists/${C.value}`,{method:"PUT",body:JSON.stringify({spotifyId:r})}),e.value=null,await $()};U(u,()=>{var r,l;if(((l=(r=e.value)==null?void 0:r.metadata)==null?void 0:l.id)==E(u.value,"artist")){f.value="link";return}f.value="save"});const P=()=>{if(f.value=="link"){G(u.value);return}I(E(u.value,"artist"))};return R($),U(()=>b.params.name,()=>{e.value=null,$()}),(r,l)=>{var S,T,N;return t(),o(p,null,[e.value?(t(),n(z,{key:0,src:e.value.cover,class:"-z-10"},null,8,["src"])):i("",!0),e.value?(t(),o("div",oe,[a("div",ne,[a("div",re,[a("div",ie,[y(V,{src:e.value.cover,class:"max-w-sm rounded-xl",placeholder:"person"},null,8,["src"]),a("div",{class:B([{"justify-end":e.value.metadata,"justify-center":!e.value.metadata},"track__info__details flex flex-col"])},[a("div",ue,[(S=e.value.metadata)!=null&&S.genres?(t(),o("div",de,[(t(!0),o(p,null,g(e.value.metadata.genres,s=>(t(),n(se,{tag:s,"with-hash":""},null,8,["tag"]))),256))])):i("",!0),a("div",ce,[a("h1",_e,v(e.value.name),1)])]),e.value.metadata?(t(),o(p,{key:0},[a("div",pe,[e.value.metadata.followers?(t(),n(A,{key:0,"primary-text":e.value.metadata.followers.toLocaleString(),class:"w-full","secondary-text":"Followers"},null,8,["primary-text"])):i("",!0),e.value.songs.length?(t(),n(A,{key:1,"primary-text":e.value.songs.length,class:"w-full","secondary-text":"Tracks in Your Library"},null,8,["primary-text"])):i("",!0)]),a("div",ve,[a("div",me,[e.value.metadata.popularity?(t(),o("span",fe,[he,a("span",ye,v(e.value.metadata.popularity),1)])):i("",!0)]),y(O(te),{class:B([{enabled:d.value},"spotify-enable"]),onClick:l[0]||(l[0]=s=>d.value=!d.value)},null,8,["class"]),d.value?(t(),n(J,{key:0,modelValue:u.value,"onUpdate:modelValue":l[1]||(l[1]=s=>u.value=s),icon:f.value,onClick:P},null,8,["modelValue","icon"])):i("",!0),a("span",{class:"material-symbols-rounded cursor-pointer",onClick:l[2]||(l[2]=s=>d.value?I(!1):I(!0))},v(d.value?"delete":"search"),1)])],64)):i("",!0)],2)]),y(W,{class:"hideIfMobile mt-8","with-album":"","with-more":""}),ge,a("div",xe,[(t(!0),o(p,null,g(e.value.songs,s=>Y((t(),n(ee,{index:e.value.songs.findIndex(_=>_.source==s.source),selected:m.value==s.id,song:s,"playlist-id":"artist","with-album":"","with-cover":"","with-more":"",artist:e.value.name,onClick:_=>m.value==s.id?m.value=-1:m.value=s.id,onUpdate:l[3]||(l[3]=_=>r.$emit("update"))},null,8,["index","selected","song","artist","onClick"])),[[K,!0]])),256))]),e.value.metadata?(t(),o("div",we,[(T=e.value.metadata.topTracks)!=null&&T.length?(t(),n(w,{key:0,class:"p-4"},{default:x(()=>[ke,a("div",be,[(t(!0),o(p,null,g(e.value.metadata.topTracks,(s,_)=>(t(),n(Z,{index:_,song:s,"can-import":"","cannot-add":"","with-album":"","with-cover":"","with-more":"",onUpdate:l[4]||(l[4]=Ne=>r.$emit("update"))},null,8,["index","song"]))),256))])]),_:1})):i("",!0),(N=e.value.metadata.related)!=null&&N.length?(t(),n(w,{key:1,class:"p-4 flex flex-col gap-2 related overflow-y-auto"},{default:x(()=>[Ce,(t(!0),o(p,null,g(e.value.metadata.related,s=>(t(),n(w,{class:"cursor-pointer px-4 py-2","with-hover":"",onClick:_=>r.$router.push(`/artist/${s.name}`)},{default:x(()=>[a("div",$e,[y(V,{src:s.cover,class:"w-8 h-8 rounded-xl",placeholder:"person"},null,8,["src"]),a("div",Ie,[a("h3",Se,v(s.name),1)])])]),_:2},1032,["onClick"]))),256))]),_:1})):i("",!0)])):i("",!0)])])])):(t(),o("div",le,[y(M)]))],64)}}});const Le=L(Te,[["__scopeId","data-v-13b2922c"]]);export{Le as default};
diff --git a/src/ui/dist/assets/Artist-d789cf52.js.gz b/src/ui/dist/assets/Artist-d789cf52.js.gz
deleted file mode 100644
index 9dd203662..000000000
Binary files a/src/ui/dist/assets/Artist-d789cf52.js.gz and /dev/null differ
diff --git a/src/ui/dist/assets/BigPlayer-199abb6d.css b/src/ui/dist/assets/BigPlayer-199abb6d.css
deleted file mode 100644
index 5241ad203..000000000
--- a/src/ui/dist/assets/BigPlayer-199abb6d.css
+++ /dev/null
@@ -1 +0,0 @@
-.bigPlayer .upNow img{width:80%;height:auto;max-width:600px;border-radius:20px;transition:transform .5s;animation:pump 20s infinite ease-in-out}.bigPlayer .upNow img:not(.playing){transform:scale(.95);animation:none}.bigPlayer .upNow img:not(.animate){animation:none}div.body:has(.bigPlayer){overflow:visible!important}@keyframes pump{0%{transform:scale(1);opacity:0}6%{transform:scale(1);opacity:0}7%{transform:scale(1);opacity:1}85%{transform:scale(1);opacity:1}95%{transform:scale(5);opacity:0}97%{transform:scale(0);opacity:0}to{transform:scale(1);opacity:0}}.settings[data-v-3f7ac95c]{position:absolute;bottom:0;left:0;display:flex;flex-direction:row;justify-content:flex-end;padding:10px}.playlist-overflow[data-v-3f7ac95c]{flex:2;height:calc(100% - 220px);margin:100px 0;overflow:hidden}.playlist-overflow .playlist[data-v-3f7ac95c]{overflow-y:auto;height:100%;padding:10px 20px}.iconButton[data-v-3f7ac95c]{font-size:2em;border-radius:10px;padding:5px;font-variation-settings:"wght" 200}.iconButton[data-v-3f7ac95c]:hover{cursor:pointer;background-clip:text;-webkit-background-clip:text;color:transparent;background:var(--bg-hover-lt);color:var(--fg-secondary)}.bigPlayer[data-v-3f7ac95c]{position:relative;display:flex;flex-direction:row;padding:40px;align-items:center;z-index:1;height:100%;filter:none}.bigPlayer .upNow[data-v-3f7ac95c]{flex:3;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:1em;position:relative}.bigPlayer .upNow .blocks[data-v-3f7ac95c]{display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start;width:80%;height:100%;max-width:min(80%,600px);border-radius:20px;position:absolute}@keyframes increase1-3f7ac95c{0%{transform:scaleX(0);transform-origin:0% 50%}1%{transform:scaleX(0)}4%{transform:scaleX(1);transform-origin:0% 50%}6%{transform:scaleX(1);transform-origin:100% 50%}9%{transform:scaleX(0)}to{transform:scaleX(0);transform-origin:100% 50%}}.bigPlayer .upNow .blocks .block[data-v-3f7ac95c]{transform:scaleX(0);background:var(--fg-contrast);width:100%;flex:1;transform-origin:0% 50%;animation:increase1-3f7ac95c 20s infinite ease-in-out}.bigPlayer .upNow .blocks .block[data-v-3f7ac95c]:first-child{border-radius:20px 20px 0 0}.bigPlayer .upNow .blocks .block[data-v-3f7ac95c]:last-child{border-radius:0 0 20px 20px}.bigPlayer .upNow .blocks:not(.animate) .block[data-v-3f7ac95c],.bigPlayer .upNow .blocks:not(.playing) .block[data-v-3f7ac95c]{animation:none;opacity:0}.no-playlist-selected[data-v-3f7ac95c]{display:flex;flex-direction:column;justify-content:center;align-items:center;height:100%;width:100%}.no-playlist-selected .wrapper[data-v-3f7ac95c]{width:80%;background:var(--bg-base-lt);border-radius:20px;overflow:hidden;padding:20px}.no-playlist-selected .wrapper h2[data-v-3f7ac95c]{margin-top:0}.no-playlist-selected .wrapper .playlists[data-v-3f7ac95c]{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr))}.no-playlist-selected .wrapper .playlists .wrapper[data-v-3f7ac95c]{padding:0}
diff --git a/src/ui/dist/assets/BigPlayer-199abb6d.css.gz b/src/ui/dist/assets/BigPlayer-199abb6d.css.gz
deleted file mode 100644
index ba8034fad..000000000
Binary files a/src/ui/dist/assets/BigPlayer-199abb6d.css.gz and /dev/null differ
diff --git a/src/ui/dist/assets/BigPlayer-87137347.js b/src/ui/dist/assets/BigPlayer-87137347.js
deleted file mode 100644
index f4c6fb6ae..000000000
--- a/src/ui/dist/assets/BigPlayer-87137347.js
+++ /dev/null
@@ -1 +0,0 @@
-import{e as q,a6 as z,j as D,D as i,n as u,E as T,y as V,f as E,o,c as d,u as a,F as f,a as s,g as h,O as k,H as F,i as w,w as M,d as O,t as x,z as R,h as j,l as A,m as H,_ as L}from"./index-4a15a213.js";import{_ as Q}from"./Playlist.vue_vue_type_script_setup_true_lang-1d932c09.js";import{P as G}from"./PlaylistCard-915b2cc1.js";import"./PlaylistEntry-4f48a6f3.js";import"./EditSong.vue_vue_type_script_setup_true_lang-0170f423.js";import"./playerInPicture-af203fdf.js";import"./vuedraggable.umd-c5c8aeea.js";const p=r=>(A("data-v-3f7ac95c"),r=r(),H(),r),J={class:"bigPlayer"},K={class:"upNow"},U=p(()=>s("div",{style:{"animation-delay":"0s"},class:"block"},null,-1)),W=p(()=>s("div",{style:{"animation-delay":".25s"},class:"block"},null,-1)),X=p(()=>s("div",{style:{"animation-delay":".5s"},class:"block"},null,-1)),Y=[U,W,X],Z={class:"settings"},ee={key:1,class:"no-playlist-selected"},se={class:"wrapper"},ae=p(()=>s("h2",null,"Nothing playing yet...",-1)),te={class:"playlists"},le=q({__name:"BigPlayer",emits:["maximise"],setup(r,{emit:B}){const e=z(),b=D(),y=i(()=>e.playing),C=i(()=>e.song.cover),P=i(()=>e.song.id),v=i(()=>e.loaded?`${e.song.title} • ${e.song.artist}`:"reAudioPlayer One"),S=i(()=>b.playlists),m=u(null),$=B;document.title=v.value,T(v,t=>{document.title=t}),V(()=>{window.setTimeout(()=>{var t;(t=m.value)!=null&&t.scrollTop||m.value.scrollToSong(P.value)},1e3)});let c=u(!1);const I=()=>{c.value=!c.value,$("maximise",c.value)},_=u(!1),n=u(!1);return(t,l)=>{const N=E("Card");return o(),d("div",J,[a(e).loaded?(o(),d(f,{key:0},[s("div",K,[h(F,{class:k([{playing:y.value,animate:n.value},"drop-shadow-2xl"]),src:C.value,type:"track","with-ambient":"",name:a(e).song.title},null,8,["class","src","name"]),s("div",{class:k([{playing:y.value,animate:n.value},"blocks"])},Y,2)]),a(e).queue&&a(e).playlist?(o(),w(N,{class:"playlist-overflow drop-shadow-2xl relative",key:a(e).playlist.id},{default:M(()=>[h(Q,{ref_key:"playlistScroll",ref:m,playlist:{...a(e).playlist,queue:a(e).queue},"use-queue":"",draggable:"",onRearrange:a(e).rearrangeQueue},null,8,["playlist","onRearrange"])]),_:1})):O("",!0),s("div",Z,[s("span",{class:"iconButton material-symbols-rounded",onClick:I},x(a(c)?"fullscreen_exit":"fullscreen"),1),s("span",{style:R({transform:`rotate(${_.value?0:180}deg)`}),class:"iconButton material-symbols-rounded",onClick:l[0]||(l[0]=()=>_.value=!_.value)},"menu_open",4),s("span",{class:"iconButton material-symbols-rounded",onClick:l[1]||(l[1]=()=>n.value=!n.value)},x(n.value?"motion_photos_off":"animation"),1),s("span",{class:"iconButton material-symbols-rounded",onClick:l[2]||(l[2]=g=>t.$router.push("/player/insights"))}," insights ")])],64)):(o(),d("div",ee,[s("div",se,[ae,s("div",te,[(o(!0),d(f,null,j(S.value,g=>(o(),w(G,{playlist:g},null,8,["playlist"]))),256))])])]))])}}});const pe=L(le,[["__scopeId","data-v-3f7ac95c"]]);export{pe as default};
diff --git a/src/ui/dist/assets/BigPlayer-87137347.js.gz b/src/ui/dist/assets/BigPlayer-87137347.js.gz
deleted file mode 100644
index 59da1ae30..000000000
Binary files a/src/ui/dist/assets/BigPlayer-87137347.js.gz and /dev/null differ
diff --git a/src/ui/dist/assets/Breaking-BYk6Hg3k.js b/src/ui/dist/assets/Breaking-BYk6Hg3k.js
new file mode 100644
index 000000000..33b166710
--- /dev/null
+++ b/src/ui/dist/assets/Breaking-BYk6Hg3k.js
@@ -0,0 +1 @@
+import{T as r}from"./Template-CN0MoJmO.js";import{i as o,o as t}from"./index-DnhwPdfm.js";import"./PlaylistEntry-B2l8v20L.js";import"./EditSong.vue_vue_type_script_setup_true_lang-C5fIPhus.js";import"./playerInPicture-Dfp9IAsf.js";import"./vuedraggable.umd-D7qFKUf_.js";import"./FactCard-D7mi8_uS.js";import"./gistClient-BQBNGijJ.js";import"./Markdown.vue_vue_type_style_index_0_lang-fjKVBP59.js";const l={__name:"Breaking",setup(e){return(i,p)=>(t(),o(r,{id:"breaking","cover-icon":"trending_up"}))}};export{l as default};
diff --git a/src/ui/dist/assets/Breaking-bca7f1ee.js b/src/ui/dist/assets/Breaking-bca7f1ee.js
deleted file mode 100644
index fc84af485..000000000
--- a/src/ui/dist/assets/Breaking-bca7f1ee.js
+++ /dev/null
@@ -1 +0,0 @@
-import{T as r}from"./Template-96d3b86b.js";import{i as o,o as t}from"./index-4a15a213.js";import"./PlaylistEntry-4f48a6f3.js";import"./EditSong.vue_vue_type_script_setup_true_lang-0170f423.js";import"./playerInPicture-af203fdf.js";import"./vuedraggable.umd-c5c8aeea.js";import"./FactCard-07fe2677.js";import"./gistClient-56b8a233.js";import"./Markdown.vue_vue_type_style_index_0_lang-99c6b55d.js";const l={__name:"Breaking",setup(e){return(i,p)=>(t(),o(r,{id:"breaking","cover-icon":"trending_up"}))}};export{l as default};
diff --git a/src/ui/dist/assets/Create-5e460494.js b/src/ui/dist/assets/Create-5e460494.js
deleted file mode 100644
index f2548b2d1..000000000
--- a/src/ui/dist/assets/Create-5e460494.js
+++ /dev/null
@@ -1 +0,0 @@
-import{e as d,q as p,B as y,y as m,o as f,c as x,a as e,g as n,w as r,C as i,U as h,l as v,m as C,_ as w}from"./index-4a15a213.js";const s=a=>(v("data-v-907ec981"),a=a(),C(),a),b={class:"flex h-full w-full items-center justify-center"},k={class:"types"},B=s(()=>e("div",{class:"flex flex-row justify-center"},[e("span",{class:"text-9xl material-symbols-rounded icon"},"library_music")],-1)),I=s(()=>e("h4",null,"Classic Playlist",-1)),S=s(()=>e("p",{class:"text-sm text-muted"},"Manage your playlist manually",-1)),g=s(()=>e("div",{class:"flex flex-row justify-center"},[e("span",{class:"text-9xl material-symbols-rounded icon"},"bolt")],-1)),j=s(()=>e("h4",null,"Smart Playlist",-1)),q=s(()=>e("p",{class:"text-sm text-muted"}," Define rules to automatically update your playlist ",-1)),P=d({__name:"Create",setup(a){const u=p(),l=y(),o=async c=>{const t=await h(c);u.push(t)};return m(()=>{l.query.type&&o(l.query.type)}),(c,t)=>(f(),x("div",b,[e("div",k,[n(i,{"with-hover":"",class:"cursor-pointer",onClick:t[0]||(t[0]=_=>o("classic"))},{default:r(()=>[B,I,S]),_:1}),n(i,{"with-hover":"",class:"cursor-pointer",onClick:t[1]||(t[1]=_=>o("smart"))},{default:r(()=>[g,j,q]),_:1})])]))}});const N=w(P,[["__scopeId","data-v-907ec981"]]);export{N as default};
diff --git a/src/ui/dist/assets/Create-5e460494.js.gz b/src/ui/dist/assets/Create-5e460494.js.gz
deleted file mode 100644
index 4d81806be..000000000
Binary files a/src/ui/dist/assets/Create-5e460494.js.gz and /dev/null differ
diff --git a/src/ui/dist/assets/Create-8ab3526b.css b/src/ui/dist/assets/Create-8ab3526b.css
deleted file mode 100644
index a040ffe67..000000000
--- a/src/ui/dist/assets/Create-8ab3526b.css
+++ /dev/null
@@ -1 +0,0 @@
-.types[data-v-907ec981]{display:grid;grid-template-columns:repeat(auto-fit,minmax(300px,500px));gap:1rem;min-width:800px}.types>div[data-v-907ec981]{padding:1em}.icon[data-v-907ec981]{color:var(--fg-secondary)}
diff --git a/src/ui/dist/assets/Create-Cv1N05w-.css b/src/ui/dist/assets/Create-Cv1N05w-.css
new file mode 100644
index 000000000..1fe52cb7a
--- /dev/null
+++ b/src/ui/dist/assets/Create-Cv1N05w-.css
@@ -0,0 +1 @@
+.types[data-v-ebdf2322]{display:grid;grid-template-columns:repeat(auto-fit,minmax(300px,500px));gap:1rem;min-width:800px}.types>div[data-v-ebdf2322]{padding:1em}.icon[data-v-ebdf2322]{color:var(--fg-secondary)}
diff --git a/src/ui/dist/assets/Create-D3JcGYih.js b/src/ui/dist/assets/Create-D3JcGYih.js
new file mode 100644
index 000000000..59158464b
--- /dev/null
+++ b/src/ui/dist/assets/Create-D3JcGYih.js
@@ -0,0 +1 @@
+import{e as p,q as _,B as y,y as f,o as m,c as x,a as t,g as r,w as n,C as i,V as h,l as v,m as w,_ as C}from"./index-DnhwPdfm.js";const e=a=>(v("data-v-ebdf2322"),a=a(),w(),a),b={class:"flex h-full w-full items-center justify-center"},k={class:"types"},B=e(()=>t("div",{class:"flex flex-row justify-center"},[t("span",{class:"text-9xl material-symbols-rounded icon"},"library_music")],-1)),I=e(()=>t("h4",null,"Classic Playlist",-1)),S=e(()=>t("p",{class:"text-sm text-muted"},"Manage your playlist manually",-1)),j=e(()=>t("div",{class:"flex flex-row justify-center"},[t("span",{class:"text-9xl material-symbols-rounded icon"},"bolt")],-1)),q=e(()=>t("h4",null,"Smart Playlist",-1)),P=e(()=>t("p",{class:"text-sm text-muted"}," Define rules to automatically update your playlist ",-1)),V=p({__name:"Create",setup(a){const u=_(),l=y(),o=async c=>{const s=await h(c);u.push(s)};return f(()=>{l.query.type&&o(l.query.type)}),(c,s)=>(m(),x("div",b,[t("div",k,[r(i,{"with-hover":"",class:"cursor-pointer",onClick:s[0]||(s[0]=d=>o("classic"))},{default:n(()=>[B,I,S]),_:1}),r(i,{"with-hover":"",class:"cursor-pointer",onClick:s[1]||(s[1]=d=>o("smart"))},{default:n(()=>[j,q,P]),_:1})])]))}}),M=C(V,[["__scopeId","data-v-ebdf2322"]]);export{M as default};
diff --git a/src/ui/dist/assets/Create-D3JcGYih.js.gz b/src/ui/dist/assets/Create-D3JcGYih.js.gz
new file mode 100644
index 000000000..d1aa41b63
Binary files /dev/null and b/src/ui/dist/assets/Create-D3JcGYih.js.gz differ
diff --git a/src/ui/dist/assets/EditSong.vue_vue_type_script_setup_true_lang-0170f423.js b/src/ui/dist/assets/EditSong.vue_vue_type_script_setup_true_lang-0170f423.js
deleted file mode 100644
index c8e06305f..000000000
--- a/src/ui/dist/assets/EditSong.vue_vue_type_script_setup_true_lang-0170f423.js
+++ /dev/null
@@ -1 +0,0 @@
-import{e as y,n as u,E as b,o as w,i as _,w as h,g as x,v as S,a9 as k,cT as q,ar as F}from"./index-4a15a213.js";const T=y({__name:"EditSong",props:{song:{type:Object,required:!0}},emits:["close","update"],setup(p,{expose:m,emit:d}){const a=p,v=d,r=async(t,e)=>{const o=new FormData,i="."+e.name.split(".").pop();var n=e.slice(0,e.size,e.type),g=new File([n],a.song.id+i,{type:e.type});return o.append("file",g),await(await fetch(t,{method:"POST",body:o})).text()},s=u([{name:"source",type:"upload",icon:"music_note",accept:"audio/mp3",required:!0,onUpload:t=>{r("/api/config/tracks",t).then(e=>s.value.find(o=>o.name=="source").value=e)},value:a.song.source},{name:"title",type:"text",icon:"title",required:!0,value:a.song.title},{name:"artist",type:"text",icon:"person",required:!0,value:a.song.artist},{name:"album",type:"text",icon:"album",value:a.song.album.name},{name:"cover",type:"upload",icon:"art_track",accept:"image/*",imagePreview:!0,value:a.song.cover,onUpload:t=>{r("/api/config/images",t).then(e=>s.value.find(o=>o.name=="cover").value=e)}}]),f=async()=>{const t=l.value.toObject();await q({...a.song,...t}),v("update"),F.addSuccess(t.title,"Updated",3e3)},c=u(null),l=u(null);return m({show:()=>{c.value.show()}}),b(a,()=>{var t,e,o;for(const i of s.value.map(n=>n.name)){if(i=="album"){s.value.find(n=>n.name==i).value=(e=(t=a.song)==null?void 0:t.album)==null?void 0:e.name;continue}s.value.find(n=>n.name==i).value=(o=a.song)==null?void 0:o[i]}},{deep:!0}),(t,e)=>(w(),_(k,{ref_key:"modal",ref:c,submit:{label:"Save",icon:"save"},name:"Edit Song",onClose:e[0]||(e[0]=o=>t.$emit("close")),onSubmit:f},{default:h(()=>[x(S,{ref_key:"form",ref:l,options:s.value},null,8,["options"])]),_:1},512))}});export{T as _};
diff --git a/src/ui/dist/assets/EditSong.vue_vue_type_script_setup_true_lang-0170f423.js.gz b/src/ui/dist/assets/EditSong.vue_vue_type_script_setup_true_lang-0170f423.js.gz
deleted file mode 100644
index a70b7a44f..000000000
Binary files a/src/ui/dist/assets/EditSong.vue_vue_type_script_setup_true_lang-0170f423.js.gz and /dev/null differ
diff --git a/src/ui/dist/assets/EditSong.vue_vue_type_script_setup_true_lang-C5fIPhus.js b/src/ui/dist/assets/EditSong.vue_vue_type_script_setup_true_lang-C5fIPhus.js
new file mode 100644
index 000000000..2fb23c49a
--- /dev/null
+++ b/src/ui/dist/assets/EditSong.vue_vue_type_script_setup_true_lang-C5fIPhus.js
@@ -0,0 +1 @@
+import{e as y,n as u,E as b,o as w,i as _,w as h,g as x,v as S,aa as k,cV as q,N as F}from"./index-DnhwPdfm.js";const O=y({__name:"EditSong",props:{song:{type:Object,required:!0}},emits:["close","update"],setup(p,{expose:m,emit:d}){const a=p,v=d,r=async(t,e)=>{const o=new FormData,i="."+e.name.split(".").pop();var n=e.slice(0,e.size,e.type),g=new File([n],a.song.id+i,{type:e.type});return o.append("file",g),await(await fetch(t,{method:"POST",body:o})).text()},s=u([{name:"source",type:"upload",icon:"music_note",accept:"audio/mp3",required:!0,onUpload:t=>{r("/api/config/tracks",t).then(e=>s.value.find(o=>o.name=="source").value=e)},value:a.song.source},{name:"title",type:"text",icon:"title",required:!0,value:a.song.title},{name:"artist",type:"text",icon:"person",required:!0,value:a.song.artist},{name:"album",type:"text",icon:"album",value:a.song.album.name},{name:"cover",type:"upload",icon:"art_track",accept:"image/*",imagePreview:!0,value:a.song.cover,onUpload:t=>{r("/api/config/images",t).then(e=>s.value.find(o=>o.name=="cover").value=e)}}]),f=async()=>{const t=l.value.toObject();await q({...a.song,...t}),v("update"),F.addSuccess(t.title,"Updated",3e3)},c=u(null),l=u(null);return m({show:()=>{c.value.show()}}),b(a,()=>{var t,e,o;for(const i of s.value.map(n=>n.name)){if(i=="album"){s.value.find(n=>n.name==i).value=(e=(t=a.song)==null?void 0:t.album)==null?void 0:e.name;continue}s.value.find(n=>n.name==i).value=(o=a.song)==null?void 0:o[i]}},{deep:!0}),(t,e)=>(w(),_(k,{ref_key:"modal",ref:c,submit:{label:"Save",icon:"save"},name:"Edit Song",onClose:e[0]||(e[0]=o=>t.$emit("close")),onSubmit:f},{default:h(()=>[x(S,{ref_key:"form",ref:l,options:s.value},null,8,["options"])]),_:1},512))}});export{O as _};
diff --git a/src/ui/dist/assets/EditSong.vue_vue_type_script_setup_true_lang-C5fIPhus.js.gz b/src/ui/dist/assets/EditSong.vue_vue_type_script_setup_true_lang-C5fIPhus.js.gz
new file mode 100644
index 000000000..9100678c8
Binary files /dev/null and b/src/ui/dist/assets/EditSong.vue_vue_type_script_setup_true_lang-C5fIPhus.js.gz differ
diff --git a/src/ui/dist/assets/Editor-133a20fa.css b/src/ui/dist/assets/Editor-133a20fa.css
deleted file mode 100644
index e860bc4c5..000000000
--- a/src/ui/dist/assets/Editor-133a20fa.css
+++ /dev/null
@@ -1 +0,0 @@
-.playlist-editor[data-v-1b0238f2]{display:grid;align-items:start;grid-template-columns:1fr 1fr;gap:1em;padding:1em}.playlist-editor .sort[data-v-1b0238f2]{display:flex;align-items:center;gap:.5em}.playlist-editor h1[data-v-1b0238f2]{grid-column:1/span 2}.playlist-editor .filters .item[data-v-1b0238f2]{display:grid;grid-template-columns:1fr auto;gap:1em;align-items:center}.playlist-editor .filters .items[data-v-1b0238f2],.playlist-editor .filters[data-v-1b0238f2]{display:flex;flex-direction:column;gap:1em}.playlist-editor .filter[data-v-1b0238f2]{padding:1em}.playlist-editor .filter h3[data-v-1b0238f2]{text-transform:capitalize}.playlist-editor .material-symbols-rounded[data-v-1b0238f2]{cursor:pointer}.playlist-editor .editor[data-v-1b0238f2]{position:sticky;top:0}
diff --git a/src/ui/dist/assets/Editor-2ef03efe.js b/src/ui/dist/assets/Editor-2ef03efe.js
deleted file mode 100644
index ebee0c13f..000000000
--- a/src/ui/dist/assets/Editor-2ef03efe.js
+++ /dev/null
@@ -1 +0,0 @@
-import{e as S,B as x,q as I,D as E,j as B,n as _,E as $,V as U,W as A,y as F,X as R,o as i,c as n,a as l,g as s,I as c,Y as L,t as f,Z as y,F as b,h,w as M,C as N,$ as O,a0 as T,_ as W}from"./index-4a15a213.js";import{_ as j}from"./Playlist.vue_vue_type_script_setup_true_lang-1d932c09.js";import"./PlaylistEntry-4f48a6f3.js";import"./EditSong.vue_vue_type_script_setup_true_lang-0170f423.js";import"./playerInPicture-af203fdf.js";import"./vuedraggable.umd-c5c8aeea.js";const q={class:"playlist-editor"},X={class:"editor"},Y={class:"sort my-2"},Z={class:"filters"},z={class:"uppercase mt-0"},G={class:"items"},H={class:"item"},J=["onClick"],K={class:"preview"},Q=S({__name:"Editor",setup(ee){const w=x(),V=I(),r=E(()=>w.params.id),d=B(),e=_({direction:"asc",sort:"id",limit:25,filter:{title:[],artist:[],album:[],duration:{}}}),m=_();$([()=>e.value.sort,()=>e.value.filter,()=>e.value.direction],U.debounce(async()=>{m.value=await A(e.value)},3*1e3),{deep:!0});const C=[{value:"title",label:"Title",icon:"title"},{value:"artist",label:"Artist",icon:"person"},{value:"album",label:"Album",icon:"album"},{value:"duration",label:"Duration",icon:"timer"},{value:"id",label:"Added",icon:"date_range"}],p=["title","artist","album"],k={title:"title",artist:"person",album:"album"};F(async()=>{e.value=await R(r.value),e.value.filter||(e.value.filter={title:[],artist:[],album:[],duration:{}});const o=e.value.filter;for(const a of p)o[a]||(o[a]=[]);e.value.filter=o});const g=async()=>{await O(r.value,e.value),d.fetchPlaylists()},D=async()=>{await T(r.value),d.fetchPlaylists(),V.push("/")};return(o,a)=>(i(),n("div",q,[l("div",X,[l("div",Y,[s(c,{label:"Save",icon:"save",type:"success",class:"!mt-0",onClick:g}),s(c,{label:"Delete",icon:"delete",type:"danger",class:"!mt-0",onClick:D}),s(L,{modelValue:e.value.sort,"onUpdate:modelValue":a[0]||(a[0]=t=>e.value.sort=t),options:C,icon:"filter_list"},null,8,["modelValue"]),l("span",{class:"cursor-pointer material-symbols-rounded ms-wght-100 text-5xl",onClick:a[1]||(a[1]=t=>e.value.direction=e.value.direction=="asc"?"desc":"asc")},f(e.value.direction=="asc"?"arrow_drop_up":"arrow_drop_down"),1),s(y,{modelValue:e.value.limit,"onUpdate:modelValue":a[2]||(a[2]=t=>e.value.limit=t),type:"number",placeholder:"Limit...",icon:"123"},null,8,["modelValue"])]),l("div",Z,[(i(),n(b,null,h(p,t=>s(N,{class:"filter"},{default:M(()=>[l("h4",z,f(t),1),l("div",G,[(i(!0),n(b,null,h(e.value.filter[t],(P,u)=>(i(),n("div",H,[s(y,{modelValue:e.value.filter[t][u],"onUpdate:modelValue":v=>e.value.filter[t][u]=v,icon:k[t]},null,8,["modelValue","onUpdate:modelValue","icon"]),l("span",{class:"material-symbols-rounded",onClick:v=>e.value.filter[t].splice(u,1)}," delete ",8,J)]))),256)),s(c,{label:"OR",icon:"add",onClick:P=>e.value.filter[t].push("")},null,8,["onClick"])])]),_:2},1024)),64))])]),l("div",K,[s(j,{playlist:m.value},null,8,["playlist"])])]))}});const ne=W(Q,[["__scopeId","data-v-1b0238f2"]]);export{ne as default};
diff --git a/src/ui/dist/assets/Editor-2ef03efe.js.gz b/src/ui/dist/assets/Editor-2ef03efe.js.gz
deleted file mode 100644
index ca17ce945..000000000
Binary files a/src/ui/dist/assets/Editor-2ef03efe.js.gz and /dev/null differ
diff --git a/src/ui/dist/assets/Editor-BrVboH8Y.js b/src/ui/dist/assets/Editor-BrVboH8Y.js
new file mode 100644
index 000000000..72bcf58d4
--- /dev/null
+++ b/src/ui/dist/assets/Editor-BrVboH8Y.js
@@ -0,0 +1 @@
+import{e as g,B as I,q as x,D as B,j as E,n as _,E as $,W as U,X as A,y as F,Y as R,o as i,c as n,a as l,g as s,I as c,Z as L,t as f,$ as y,F as b,h,w as M,C as N,a0 as O,a1 as T,_ as W}from"./index-DnhwPdfm.js";import{_ as j}from"./Playlist.vue_vue_type_script_setup_true_lang-D7rgrOmb.js";import"./PlaylistEntry-B2l8v20L.js";import"./EditSong.vue_vue_type_script_setup_true_lang-C5fIPhus.js";import"./playerInPicture-Dfp9IAsf.js";import"./vuedraggable.umd-D7qFKUf_.js";const q={class:"playlist-editor"},X={class:"editor"},Y={class:"sort my-2"},Z={class:"filters"},z={class:"uppercase mt-0"},G={class:"items"},H={class:"item"},J=["onClick"],K={class:"preview"},Q=g({__name:"Editor",setup(ee){const w=I(),V=x(),r=B(()=>w.params.id),d=E(),e=_({direction:"asc",sort:"id",limit:25,filter:{title:[],artist:[],album:[],duration:{}}}),m=_();$([()=>e.value.sort,()=>e.value.filter,()=>e.value.direction],U.debounce(async()=>{m.value=await A(e.value)},3*1e3),{deep:!0});const C=[{value:"title",label:"Title",icon:"title"},{value:"artist",label:"Artist",icon:"person"},{value:"album",label:"Album",icon:"album"},{value:"duration",label:"Duration",icon:"timer"},{value:"id",label:"Added",icon:"date_range"}],p=["title","artist","album"],k={title:"title",artist:"person",album:"album"};F(async()=>{e.value=await R(r.value),e.value.filter||(e.value.filter={title:[],artist:[],album:[],duration:{}});const o=e.value.filter;for(const a of p)o[a]||(o[a]=[]);e.value.filter=o});const D=async()=>{await O(r.value,e.value),d.fetchPlaylists()},P=async()=>{await T(r.value),d.fetchPlaylists(),V.push("/")};return(o,a)=>(i(),n("div",q,[l("div",X,[l("div",Y,[s(c,{label:"Save",icon:"save",type:"success",class:"!mt-0",onClick:D}),s(c,{label:"Delete",icon:"delete",type:"danger",class:"!mt-0",onClick:P}),s(L,{modelValue:e.value.sort,"onUpdate:modelValue":a[0]||(a[0]=t=>e.value.sort=t),options:C,icon:"filter_list"},null,8,["modelValue"]),l("span",{class:"cursor-pointer material-symbols-rounded ms-wght-100 text-5xl",onClick:a[1]||(a[1]=t=>e.value.direction=e.value.direction=="asc"?"desc":"asc")},f(e.value.direction=="asc"?"arrow_drop_up":"arrow_drop_down"),1),s(y,{modelValue:e.value.limit,"onUpdate:modelValue":a[2]||(a[2]=t=>e.value.limit=t),type:"number",placeholder:"Limit...",icon:"123"},null,8,["modelValue"])]),l("div",Z,[(i(),n(b,null,h(p,t=>s(N,{class:"filter"},{default:M(()=>[l("h4",z,f(t),1),l("div",G,[(i(!0),n(b,null,h(e.value.filter[t],(S,u)=>(i(),n("div",H,[s(y,{modelValue:e.value.filter[t][u],"onUpdate:modelValue":v=>e.value.filter[t][u]=v,icon:k[t]},null,8,["modelValue","onUpdate:modelValue","icon"]),l("span",{class:"material-symbols-rounded",onClick:v=>e.value.filter[t].splice(u,1)}," delete ",8,J)]))),256)),s(c,{label:"OR",icon:"add",onClick:S=>e.value.filter[t].push("")},null,8,["onClick"])])]),_:2},1024)),64))])]),l("div",K,[s(j,{playlist:m.value},null,8,["playlist"])])]))}}),ne=W(Q,[["__scopeId","data-v-1509e325"]]);export{ne as default};
diff --git a/src/ui/dist/assets/Editor-BrVboH8Y.js.gz b/src/ui/dist/assets/Editor-BrVboH8Y.js.gz
new file mode 100644
index 000000000..d91a9900e
Binary files /dev/null and b/src/ui/dist/assets/Editor-BrVboH8Y.js.gz differ
diff --git a/src/ui/dist/assets/Editor-DJucXreQ.css b/src/ui/dist/assets/Editor-DJucXreQ.css
new file mode 100644
index 000000000..df1aece84
--- /dev/null
+++ b/src/ui/dist/assets/Editor-DJucXreQ.css
@@ -0,0 +1 @@
+.playlist-editor[data-v-1509e325]{display:grid;align-items:start;grid-template-columns:1fr 1fr;gap:1em;padding:1em}.playlist-editor .sort[data-v-1509e325]{display:flex;align-items:center;gap:.5em}.playlist-editor h1[data-v-1509e325]{grid-column:1/span 2}.playlist-editor .filters .item[data-v-1509e325]{display:grid;grid-template-columns:1fr auto;gap:1em;align-items:center}.playlist-editor .filters .items[data-v-1509e325],.playlist-editor .filters[data-v-1509e325]{display:flex;flex-direction:column;gap:1em}.playlist-editor .filter[data-v-1509e325]{padding:1em}.playlist-editor .filter h3[data-v-1509e325]{text-transform:capitalize}.playlist-editor .material-symbols-rounded[data-v-1509e325]{cursor:pointer}.playlist-editor .editor[data-v-1509e325]{position:sticky;top:0}
diff --git a/src/ui/dist/assets/Error-f18c7956.css b/src/ui/dist/assets/Error-BUy8S0OX.css
similarity index 100%
rename from src/ui/dist/assets/Error-f18c7956.css
rename to src/ui/dist/assets/Error-BUy8S0OX.css
diff --git a/src/ui/dist/assets/Error-e5e93467.js b/src/ui/dist/assets/Error-e5e93467.js
deleted file mode 100644
index 80343b83a..000000000
--- a/src/ui/dist/assets/Error-e5e93467.js
+++ /dev/null
@@ -1 +0,0 @@
-import{e as r,o as _,c as o,a as s,_ as t}from"./index-4a15a213.js";const n={class:"error"},a=["innerHTML"],c=r({__name:"Error",props:{msg:{type:String,required:!0}},setup(e){return(d,p)=>(_(),o("div",n,[s("h1",{innerHTML:e.msg},null,8,a)]))}});const l=t(c,[["__scopeId","data-v-03ad8ef0"]]);export{l as E};
diff --git a/src/ui/dist/assets/Error-hTSpQMK3.js b/src/ui/dist/assets/Error-hTSpQMK3.js
new file mode 100644
index 000000000..e0ebc2950
--- /dev/null
+++ b/src/ui/dist/assets/Error-hTSpQMK3.js
@@ -0,0 +1 @@
+import{e as r,o,c as s,a as t,_ as n}from"./index-DnhwPdfm.js";const a={class:"error"},c=["innerHTML"],_=r({__name:"Error",props:{msg:{type:String,required:!0}},setup(e){return(i,p)=>(o(),s("div",a,[t("h1",{innerHTML:e.msg},null,8,c)]))}}),m=n(_,[["__scopeId","data-v-03ad8ef0"]]);export{m as E};
diff --git a/src/ui/dist/assets/Explore-0f64f4c4.js b/src/ui/dist/assets/Explore-0f64f4c4.js
deleted file mode 100644
index d3c63ed2d..000000000
--- a/src/ui/dist/assets/Explore-0f64f4c4.js
+++ /dev/null
@@ -1 +0,0 @@
-import{_,o as r,c as n,a as e,r as u,z as h,l as f,m,F as y,h as v,p,A as k,f as g,g as o,w as c,M as d,u as S}from"./index-4a15a213.js";const $={props:{src:String}},x=s=>(f("data-v-0c755b69"),s=s(),m(),s),C=x(()=>e("div",{class:"filter"},null,-1)),I={class:"info"};function b(s,a,l,i,t,N){return r(),n("div",{class:"image",style:h({backgroundImage:"url("+l.src+")"})},[C,e("div",I,[u(s.$slots,"default",{},void 0,!0)])],4)}const O=_($,[["render",b],["__scopeId","data-v-0c755b69"]]);const w={class:"songContent"},E={class:"play"},H=["onClick"],M={class:"info"},P={data(){return fetch("/api/playlists").then(async s=>{this.playlists=await s.json(),this.pick()}),{playlists:[],picks:[]}},mounted(){},methods:{parseCover:p,pick(){this.songs=this.playlists.map(s=>s.songs).flat();for(let s=0;s<4;s++)this.picks.push(this.songs[Math.floor(Math.random()*this.songs.length)])},onScroll(){this.$refs.container.clientHeight+this.$refs.container.scrollTop>=this.$refs.container.scrollHeight-100&&this.pick()},href(s){return`/track/${k(s.id)}`},loadPlaylist(s){fetch("/api/player/load",{method:"POST",body:JSON.stringify({id:s,type:"track"})})}}},B=Object.assign(P,{__name:"Explore",setup(s){return(a,l)=>{const i=g("router-link");return r(),n("div",{ref:"container",class:"explore",onScroll:l[0]||(l[0]=(...t)=>a.onScroll&&a.onScroll(...t))},[(r(!0),n(y,null,v(a.picks,t=>(r(),n("div",{key:t.name,class:"item"},[o(O,{src:S(p)(t.cover)},{default:c(()=>[e("div",w,[e("div",E,[e("span",{id:"loadPlaylist",class:"material-symbols-rounded play",onClick:()=>a.loadPlaylist(t.id)},"play_circle",8,H)]),e("div",M,[o(i,{to:a.href(t),class:"linkOnHover"},{default:c(()=>[e("h1",null,[o(d,{text:t.title},null,8,["text"])])]),_:2},1032,["to"]),o(i,{to:`/search/${t.artist}`,class:"linkOnHover"},{default:c(()=>[e("p",null,[o(d,{text:t.artist},null,8,["text"])])]),_:2},1032,["to"])])])]),_:2},1032,["src"])]))),128))],544)}}}),j=_(B,[["__scopeId","data-v-51105a59"]]);export{j as default};
diff --git a/src/ui/dist/assets/Explore-0f64f4c4.js.gz b/src/ui/dist/assets/Explore-0f64f4c4.js.gz
deleted file mode 100644
index f0a5ce810..000000000
Binary files a/src/ui/dist/assets/Explore-0f64f4c4.js.gz and /dev/null differ
diff --git a/src/ui/dist/assets/Explore-d8c77810.css b/src/ui/dist/assets/Explore-BBlOvIn4.css
similarity index 100%
rename from src/ui/dist/assets/Explore-d8c77810.css
rename to src/ui/dist/assets/Explore-BBlOvIn4.css
diff --git a/src/ui/dist/assets/Explore-d8c77810.css.gz b/src/ui/dist/assets/Explore-BBlOvIn4.css.gz
similarity index 100%
rename from src/ui/dist/assets/Explore-d8c77810.css.gz
rename to src/ui/dist/assets/Explore-BBlOvIn4.css.gz
diff --git a/src/ui/dist/assets/Explore-CImr0VNX.js b/src/ui/dist/assets/Explore-CImr0VNX.js
new file mode 100644
index 000000000..6b5844a00
--- /dev/null
+++ b/src/ui/dist/assets/Explore-CImr0VNX.js
@@ -0,0 +1 @@
+import{_ as p,o as r,c as i,a as e,r as _,z as u,l as f,m,F as k,h as y,p as h,A as v,f as S,g as o,w as c,M as d,u as $}from"./index-DnhwPdfm.js";const g={props:{src:String}},C=s=>(f("data-v-0c755b69"),s=s(),m(),s),I=C(()=>e("div",{class:"filter"},null,-1)),b={class:"info"};function x(s,a,l,n,t,N){return r(),i("div",{class:"image",style:u({backgroundImage:"url("+l.src+")"})},[I,e("div",b,[_(s.$slots,"default",{},void 0,!0)])],4)}const O=p(g,[["render",x],["__scopeId","data-v-0c755b69"]]),w={class:"songContent"},H={class:"play"},M=["onClick"],P={class:"info"},B={data(){return fetch("/api/playlists").then(async s=>{this.playlists=await s.json(),this.pick()}),{playlists:[],picks:[]}},mounted(){},methods:{parseCover:h,pick(){this.songs=this.playlists.map(s=>s.songs).flat();for(let s=0;s<4;s++)this.picks.push(this.songs[Math.floor(Math.random()*this.songs.length)])},onScroll(){this.$refs.container.clientHeight+this.$refs.container.scrollTop>=this.$refs.container.scrollHeight-100&&this.pick()},href(s){return`/track/${v(s.id)}`},loadPlaylist(s){fetch("/api/player/load",{method:"POST",body:JSON.stringify({id:s,type:"track"})})}}},E=Object.assign(B,{__name:"Explore",setup(s){return(a,l)=>{const n=S("router-link");return r(),i("div",{ref:"container",class:"explore",onScroll:l[0]||(l[0]=(...t)=>a.onScroll&&a.onScroll(...t))},[(r(!0),i(k,null,y(a.picks,t=>(r(),i("div",{key:t.name,class:"item"},[o(O,{src:$(h)(t.cover)},{default:c(()=>[e("div",w,[e("div",H,[e("span",{id:"loadPlaylist",class:"material-symbols-rounded play",onClick:()=>a.loadPlaylist(t.id)},"play_circle",8,M)]),e("div",P,[o(n,{to:a.href(t),class:"linkOnHover"},{default:c(()=>[e("h1",null,[o(d,{text:t.title},null,8,["text"])])]),_:2},1032,["to"]),o(n,{to:`/search/${t.artist}`,class:"linkOnHover"},{default:c(()=>[e("p",null,[o(d,{text:t.artist},null,8,["text"])])]),_:2},1032,["to"])])])]),_:2},1032,["src"])]))),128))],544)}}}),j=p(E,[["__scopeId","data-v-51105a59"]]);export{j as default};
diff --git a/src/ui/dist/assets/Explore-CImr0VNX.js.gz b/src/ui/dist/assets/Explore-CImr0VNX.js.gz
new file mode 100644
index 000000000..da77e3ff1
Binary files /dev/null and b/src/ui/dist/assets/Explore-CImr0VNX.js.gz differ
diff --git a/src/ui/dist/assets/Export-b9da4cc1.js b/src/ui/dist/assets/Export-B-H9t4Ft.js
similarity index 68%
rename from src/ui/dist/assets/Export-b9da4cc1.js
rename to src/ui/dist/assets/Export-B-H9t4Ft.js
index a8432d979..c73c13960 100644
--- a/src/ui/dist/assets/Export-b9da4cc1.js
+++ b/src/ui/dist/assets/Export-B-H9t4Ft.js
@@ -1,6 +1,6 @@
-import{H as Yt,C as qt,p as Wt,ab as Ht,_ as wt,i as xt,w as Jt,f as W,o as L,a as _,g as q,c as V,t as N,d as Z,b as yt,F as Bt,aD as dt,ae as Xt,j as zt,I as Kt,h as Zt,l as Qt,m as vt}from"./index-4a15a213.js";import{G as Q}from"./gistClient-56b8a233.js";var gt={},H={};H.byteLength=ir;H.toByteArray=nr;H.fromByteArray=ur;var R=[],T=[],tr=typeof Uint8Array<"u"?Uint8Array:Array,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var M=0,rr=v.length;M0)throw new Error("Invalid string. Length must be a multiple of 4");var h=l.indexOf("=");h===-1&&(h=c);var p=h===c?0:4-h%4;return[h,p]}function ir(l){var c=mt(l),h=c[0],p=c[1];return(h+p)*3/4-p}function er(l,c,h){return(c+h)*3/4-h}function nr(l){var c,h=mt(l),p=h[0],y=h[1],f=new tr(er(l,p,y)),a=0,o=y>0?p-4:p,w;for(w=0;w>16&255,f[a++]=c>>8&255,f[a++]=c&255;return y===2&&(c=T[l.charCodeAt(w)]<<2|T[l.charCodeAt(w+1)]>>4,f[a++]=c&255),y===1&&(c=T[l.charCodeAt(w)]<<10|T[l.charCodeAt(w+1)]<<4|T[l.charCodeAt(w+2)]>>2,f[a++]=c>>8&255,f[a++]=c&255),f}function or(l){return R[l>>18&63]+R[l>>12&63]+R[l>>6&63]+R[l&63]}function sr(l,c,h){for(var p,y=[],f=c;fo?o:a+f));return p===1?(c=l[h-1],y.push(R[c>>2]+R[c<<4&63]+"==")):p===2&&(c=(l[h-2]<<8)+l[h-1],y.push(R[c>>10]+R[c>>4&63]+R[c<<2&63]+"=")),y.join("")}var tt={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */tt.read=function(l,c,h,p,y){var f,a,o=y*8-p-1,w=(1<>1,I=-7,F=h?y-1:0,P=h?-1:1,A=l[c+F];for(F+=P,f=A&(1<<-I)-1,A>>=-I,I+=o;I>0;f=f*256+l[c+F],F+=P,I-=8);for(a=f&(1<<-I)-1,f>>=-I,I+=p;I>0;a=a*256+l[c+F],F+=P,I-=8);if(f===0)f=1-C;else{if(f===w)return a?NaN:(A?-1:1)*(1/0);a=a+Math.pow(2,p),f=f-C}return(A?-1:1)*a*Math.pow(2,f-p)};tt.write=function(l,c,h,p,y,f){var a,o,w,C=f*8-y-1,I=(1<>1,P=y===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=p?0:f-1,O=p?1:-1,G=c<0||c===0&&1/c<0?1:0;for(c=Math.abs(c),isNaN(c)||c===1/0?(o=isNaN(c)?1:0,a=I):(a=Math.floor(Math.log(c)/Math.LN2),c*(w=Math.pow(2,-a))<1&&(a--,w*=2),a+F>=1?c+=P/w:c+=P*Math.pow(2,1-F),c*w>=2&&(a++,w/=2),a+F>=I?(o=0,a=I):a+F>=1?(o=(c*w-1)*Math.pow(2,y),a=a+F):(o=c*Math.pow(2,F-1)*Math.pow(2,y),a=0));y>=8;l[h+A]=o&255,A+=O,o/=256,y-=8);for(a=a<0;l[h+A]=a&255,A+=O,a/=256,C-=8);l[h+A-O]|=G*128};/*!
+import{H as Yt,C as qt,p as Wt,ac as Ht,_ as wt,i as xt,f as W,o as N,w as Jt,a as A,g as q,c as V,t as L,d as Z,b as yt,F as Bt,aC as dt,af as Xt,j as zt,I as Kt,h as Zt,l as Qt,m as vt}from"./index-DnhwPdfm.js";import{G as Q}from"./gistClient-BQBNGijJ.js";var gt={},H={};H.byteLength=ir;H.toByteArray=nr;H.fromByteArray=ur;var R=[],T=[],tr=typeof Uint8Array<"u"?Uint8Array:Array,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var $=0,rr=v.length;$0)throw new Error("Invalid string. Length must be a multiple of 4");var h=l.indexOf("=");h===-1&&(h=c);var p=h===c?0:4-h%4;return[h,p]}function ir(l){var c=mt(l),h=c[0],p=c[1];return(h+p)*3/4-p}function er(l,c,h){return(c+h)*3/4-h}function nr(l){var c,h=mt(l),p=h[0],y=h[1],f=new tr(er(l,p,y)),a=0,o=y>0?p-4:p,w;for(w=0;w>16&255,f[a++]=c>>8&255,f[a++]=c&255;return y===2&&(c=T[l.charCodeAt(w)]<<2|T[l.charCodeAt(w+1)]>>4,f[a++]=c&255),y===1&&(c=T[l.charCodeAt(w)]<<10|T[l.charCodeAt(w+1)]<<4|T[l.charCodeAt(w+2)]>>2,f[a++]=c>>8&255,f[a++]=c&255),f}function or(l){return R[l>>18&63]+R[l>>12&63]+R[l>>6&63]+R[l&63]}function sr(l,c,h){for(var p,y=[],f=c;fo?o:a+f));return p===1?(c=l[h-1],y.push(R[c>>2]+R[c<<4&63]+"==")):p===2&&(c=(l[h-2]<<8)+l[h-1],y.push(R[c>>10]+R[c>>4&63]+R[c<<2&63]+"=")),y.join("")}var tt={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */tt.read=function(l,c,h,p,y){var f,a,o=y*8-p-1,w=(1<>1,I=-7,F=h?y-1:0,P=h?-1:1,_=l[c+F];for(F+=P,f=_&(1<<-I)-1,_>>=-I,I+=o;I>0;f=f*256+l[c+F],F+=P,I-=8);for(a=f&(1<<-I)-1,f>>=-I,I+=p;I>0;a=a*256+l[c+F],F+=P,I-=8);if(f===0)f=1-C;else{if(f===w)return a?NaN:(_?-1:1)*(1/0);a=a+Math.pow(2,p),f=f-C}return(_?-1:1)*a*Math.pow(2,f-p)};tt.write=function(l,c,h,p,y,f){var a,o,w,C=f*8-y-1,I=(1<>1,P=y===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=p?0:f-1,O=p?1:-1,G=c<0||c===0&&1/c<0?1:0;for(c=Math.abs(c),isNaN(c)||c===1/0?(o=isNaN(c)?1:0,a=I):(a=Math.floor(Math.log(c)/Math.LN2),c*(w=Math.pow(2,-a))<1&&(a--,w*=2),a+F>=1?c+=P/w:c+=P*Math.pow(2,1-F),c*w>=2&&(a++,w/=2),a+F>=I?(o=0,a=I):a+F>=1?(o=(c*w-1)*Math.pow(2,y),a=a+F):(o=c*Math.pow(2,F-1)*Math.pow(2,y),a=0));y>=8;l[h+_]=o&255,_+=O,o/=256,y-=8);for(a=a<0;l[h+_]=a&255,_+=O,a/=256,C-=8);l[h+_-O]|=G*128};/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh
* @license MIT
- */(function(l){const c=H,h=tt,p=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;l.Buffer=o,l.SlowBuffer=Ft,l.INSPECT_MAX_BYTES=50;const y=2147483647;l.kMaxLength=y,o.TYPED_ARRAY_SUPPORT=f(),!o.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function f(){try{const i=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(i,t),i.foo()===42}catch{return!1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function a(i){if(i>y)throw new RangeError('The value "'+i+'" is invalid for option "size"');const t=new Uint8Array(i);return Object.setPrototypeOf(t,o.prototype),t}function o(i,t,r){if(typeof i=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return F(i)}return w(i,t,r)}o.poolSize=8192;function w(i,t,r){if(typeof i=="string")return P(i,t);if(ArrayBuffer.isView(i))return O(i);if(i==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i);if(S(i,ArrayBuffer)||i&&S(i.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(S(i,SharedArrayBuffer)||i&&S(i.buffer,SharedArrayBuffer)))return G(i,t,r);if(typeof i=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const e=i.valueOf&&i.valueOf();if(e!=null&&e!==i)return o.from(e,t,r);const n=It(i);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof i[Symbol.toPrimitive]=="function")return o.from(i[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i)}o.from=function(i,t,r){return w(i,t,r)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function C(i){if(typeof i!="number")throw new TypeError('"size" argument must be of type number');if(i<0)throw new RangeError('The value "'+i+'" is invalid for option "size"')}function I(i,t,r){return C(i),i<=0?a(i):t!==void 0?typeof r=="string"?a(i).fill(t,r):a(i).fill(t):a(i)}o.alloc=function(i,t,r){return I(i,t,r)};function F(i){return C(i),a(i<0?0:J(i)|0)}o.allocUnsafe=function(i){return F(i)},o.allocUnsafeSlow=function(i){return F(i)};function P(i,t){if((typeof t!="string"||t==="")&&(t="utf8"),!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=rt(i,t)|0;let e=a(r);const n=e.write(i,t);return n!==r&&(e=e.slice(0,n)),e}function A(i){const t=i.length<0?0:J(i.length)|0,r=a(t);for(let e=0;e=y)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+y.toString(16)+" bytes");return i|0}function Ft(i){return+i!=i&&(i=0),o.alloc(+i)}o.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==o.prototype},o.compare=function(t,r){if(S(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),S(r,Uint8Array)&&(r=o.from(r,r.offset,r.byteLength)),!o.isBuffer(t)||!o.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;let e=t.length,n=r.length;for(let s=0,u=Math.min(e,n);sn.length?(o.isBuffer(u)||(u=o.from(u)),u.copy(n,s)):Uint8Array.prototype.set.call(n,u,s);else if(o.isBuffer(u))u.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=u.length}return n};function rt(i,t){if(o.isBuffer(i))return i.length;if(ArrayBuffer.isView(i)||S(i,ArrayBuffer))return i.byteLength;if(typeof i!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof i);const r=i.length,e=arguments.length>2&&arguments[2]===!0;if(!e&&r===0)return 0;let n=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return z(i).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return pt(i).length;default:if(n)return e?-1:z(i).length;t=(""+t).toLowerCase(),n=!0}}o.byteLength=rt;function _t(i,t,r){let e=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(i||(i="utf8");;)switch(i){case"hex":return Nt(this,t,r);case"utf8":case"utf-8":return nt(this,t,r);case"ascii":return bt(this,t,r);case"latin1":case"binary":return kt(this,t,r);case"base64":return Rt(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Lt(this,t,r);default:if(e)throw new TypeError("Unknown encoding: "+i);i=(i+"").toLowerCase(),e=!0}}o.prototype._isBuffer=!0;function k(i,t,r){const e=i[t];i[t]=i[r],i[r]=e}o.prototype.swap16=function(){const t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;rr&&(t+=" ... "),""},p&&(o.prototype[p]=o.prototype.inspect),o.prototype.compare=function(t,r,e,n,s){if(S(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(r===void 0&&(r=0),e===void 0&&(e=t?t.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),r<0||e>t.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&r>=e)return 0;if(n>=s)return-1;if(r>=e)return 1;if(r>>>=0,e>>>=0,n>>>=0,s>>>=0,this===t)return 0;let u=s-n,d=e-r;const g=Math.min(u,d),B=this.slice(n,s),m=t.slice(r,e);for(let x=0;x2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,K(r)&&(r=n?0:i.length-1),r<0&&(r=i.length+r),r>=i.length){if(n)return-1;r=i.length-1}else if(r<0)if(n)r=0;else return-1;if(typeof t=="string"&&(t=o.from(t,e)),o.isBuffer(t))return t.length===0?-1:et(i,t,r,e,n);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(i,t,r):Uint8Array.prototype.lastIndexOf.call(i,t,r):et(i,[t],r,e,n);throw new TypeError("val must be string, number or Buffer")}function et(i,t,r,e,n){let s=1,u=i.length,d=t.length;if(e!==void 0&&(e=String(e).toLowerCase(),e==="ucs2"||e==="ucs-2"||e==="utf16le"||e==="utf-16le")){if(i.length<2||t.length<2)return-1;s=2,u/=2,d/=2,r/=2}function g(m,x){return s===1?m[x]:m.readUInt16BE(x*s)}let B;if(n){let m=-1;for(B=r;Bu&&(r=u-d),B=r;B>=0;B--){let m=!0;for(let x=0;xn&&(e=n)):e=n;const s=t.length;e>s/2&&(e=s/2);let u;for(u=0;u>>0,isFinite(e)?(e=e>>>0,n===void 0&&(n="utf8")):(n=e,e=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const s=this.length-r;if((e===void 0||e>s)&&(e=s),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let u=!1;for(;;)switch(n){case"hex":return At(this,t,r,e);case"utf8":case"utf-8":return Ut(this,t,r,e);case"ascii":case"latin1":case"binary":return Ct(this,t,r,e);case"base64":return Tt(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return St(this,t,r,e);default:if(u)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),u=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Rt(i,t,r){return t===0&&r===i.length?c.fromByteArray(i):c.fromByteArray(i.slice(t,r))}function nt(i,t,r){r=Math.min(i.length,r);const e=[];let n=t;for(;n239?4:s>223?3:s>191?2:1;if(n+d<=r){let g,B,m,x;switch(d){case 1:s<128&&(u=s);break;case 2:g=i[n+1],(g&192)===128&&(x=(s&31)<<6|g&63,x>127&&(u=x));break;case 3:g=i[n+1],B=i[n+2],(g&192)===128&&(B&192)===128&&(x=(s&15)<<12|(g&63)<<6|B&63,x>2047&&(x<55296||x>57343)&&(u=x));break;case 4:g=i[n+1],B=i[n+2],m=i[n+3],(g&192)===128&&(B&192)===128&&(m&192)===128&&(x=(s&15)<<18|(g&63)<<12|(B&63)<<6|m&63,x>65535&&x<1114112&&(u=x))}}u===null?(u=65533,d=1):u>65535&&(u-=65536,e.push(u>>>10&1023|55296),u=56320|u&1023),e.push(u),n+=d}return Pt(e)}const ot=4096;function Pt(i){const t=i.length;if(t<=ot)return String.fromCharCode.apply(String,i);let r="",e=0;for(;ee)&&(r=e);let n="";for(let s=t;se&&(t=e),r<0?(r+=e,r<0&&(r=0)):r>e&&(r=e),rr)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(t,r,e){t=t>>>0,r=r>>>0,e||E(t,r,this.length);let n=this[t],s=1,u=0;for(;++u>>0,r=r>>>0,e||E(t,r,this.length);let n=this[t+--r],s=1;for(;r>0&&(s*=256);)n+=this[t+--r]*s;return n},o.prototype.readUint8=o.prototype.readUInt8=function(t,r){return t=t>>>0,r||E(t,1,this.length),this[t]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||E(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||E(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||E(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||E(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readBigUInt64LE=b(function(t){t=t>>>0,D(t,"offset");const r=this[t],e=this[t+7];(r===void 0||e===void 0)&&j(t,this.length-8);const n=r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,s=this[++t]+this[++t]*2**8+this[++t]*2**16+e*2**24;return BigInt(n)+(BigInt(s)<>>0,D(t,"offset");const r=this[t],e=this[t+7];(r===void 0||e===void 0)&&j(t,this.length-8);const n=r*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],s=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+e;return(BigInt(n)<>>0,r=r>>>0,e||E(t,r,this.length);let n=this[t],s=1,u=0;for(;++u=s&&(n-=Math.pow(2,8*r)),n},o.prototype.readIntBE=function(t,r,e){t=t>>>0,r=r>>>0,e||E(t,r,this.length);let n=r,s=1,u=this[t+--n];for(;n>0&&(s*=256);)u+=this[t+--n]*s;return s*=128,u>=s&&(u-=Math.pow(2,8*r)),u},o.prototype.readInt8=function(t,r){return t=t>>>0,r||E(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]},o.prototype.readInt16LE=function(t,r){t=t>>>0,r||E(t,2,this.length);const e=this[t]|this[t+1]<<8;return e&32768?e|4294901760:e},o.prototype.readInt16BE=function(t,r){t=t>>>0,r||E(t,2,this.length);const e=this[t+1]|this[t]<<8;return e&32768?e|4294901760:e},o.prototype.readInt32LE=function(t,r){return t=t>>>0,r||E(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,r){return t=t>>>0,r||E(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readBigInt64LE=b(function(t){t=t>>>0,D(t,"offset");const r=this[t],e=this[t+7];(r===void 0||e===void 0)&&j(t,this.length-8);const n=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(e<<24);return(BigInt(n)<>>0,D(t,"offset");const r=this[t],e=this[t+7];(r===void 0||e===void 0)&&j(t,this.length-8);const n=(r<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(n)<>>0,r||E(t,4,this.length),h.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,r){return t=t>>>0,r||E(t,4,this.length),h.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||E(t,8,this.length),h.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||E(t,8,this.length),h.read(this,t,!1,52,8)};function U(i,t,r,e,n,s){if(!o.isBuffer(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||ti.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(t,r,e,n){if(t=+t,r=r>>>0,e=e>>>0,!n){const d=Math.pow(2,8*e)-1;U(this,t,r,e,d,0)}let s=1,u=0;for(this[r]=t&255;++u>>0,e=e>>>0,!n){const d=Math.pow(2,8*e)-1;U(this,t,r,e,d,0)}let s=e-1,u=1;for(this[r+s]=t&255;--s>=0&&(u*=256);)this[r+s]=t/u&255;return r+e},o.prototype.writeUint8=o.prototype.writeUInt8=function(t,r,e){return t=+t,r=r>>>0,e||U(this,t,r,1,255,0),this[r]=t&255,r+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(t,r,e){return t=+t,r=r>>>0,e||U(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(t,r,e){return t=+t,r=r>>>0,e||U(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(t,r,e){return t=+t,r=r>>>0,e||U(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(t,r,e){return t=+t,r=r>>>0,e||U(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};function st(i,t,r,e,n){ft(t,e,n,i,r,7);let s=Number(t&BigInt(4294967295));i[r++]=s,s=s>>8,i[r++]=s,s=s>>8,i[r++]=s,s=s>>8,i[r++]=s;let u=Number(t>>BigInt(32)&BigInt(4294967295));return i[r++]=u,u=u>>8,i[r++]=u,u=u>>8,i[r++]=u,u=u>>8,i[r++]=u,r}function ut(i,t,r,e,n){ft(t,e,n,i,r,7);let s=Number(t&BigInt(4294967295));i[r+7]=s,s=s>>8,i[r+6]=s,s=s>>8,i[r+5]=s,s=s>>8,i[r+4]=s;let u=Number(t>>BigInt(32)&BigInt(4294967295));return i[r+3]=u,u=u>>8,i[r+2]=u,u=u>>8,i[r+1]=u,u=u>>8,i[r]=u,r+8}o.prototype.writeBigUInt64LE=b(function(t,r=0){return st(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=b(function(t,r=0){return ut(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r=r>>>0,!n){const g=Math.pow(2,8*e-1);U(this,t,r,e,g-1,-g)}let s=0,u=1,d=0;for(this[r]=t&255;++s>0)-d&255;return r+e},o.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r=r>>>0,!n){const g=Math.pow(2,8*e-1);U(this,t,r,e,g-1,-g)}let s=e-1,u=1,d=0;for(this[r+s]=t&255;--s>=0&&(u*=256);)t<0&&d===0&&this[r+s+1]!==0&&(d=1),this[r+s]=(t/u>>0)-d&255;return r+e},o.prototype.writeInt8=function(t,r,e){return t=+t,r=r>>>0,e||U(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1},o.prototype.writeInt16LE=function(t,r,e){return t=+t,r=r>>>0,e||U(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2},o.prototype.writeInt16BE=function(t,r,e){return t=+t,r=r>>>0,e||U(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2},o.prototype.writeInt32LE=function(t,r,e){return t=+t,r=r>>>0,e||U(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4},o.prototype.writeInt32BE=function(t,r,e){return t=+t,r=r>>>0,e||U(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4},o.prototype.writeBigInt64LE=b(function(t,r=0){return st(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=b(function(t,r=0){return ut(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function lt(i,t,r,e,n,s){if(r+e>i.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function ct(i,t,r,e,n){return t=+t,r=r>>>0,n||lt(i,t,r,4),h.write(i,t,r,e,23,4),r+4}o.prototype.writeFloatLE=function(t,r,e){return ct(this,t,r,!0,e)},o.prototype.writeFloatBE=function(t,r,e){return ct(this,t,r,!1,e)};function at(i,t,r,e,n){return t=+t,r=r>>>0,n||lt(i,t,r,8),h.write(i,t,r,e,52,8),r+8}o.prototype.writeDoubleLE=function(t,r,e){return at(this,t,r,!0,e)},o.prototype.writeDoubleBE=function(t,r,e){return at(this,t,r,!1,e)},o.prototype.copy=function(t,r,e,n){if(!o.isBuffer(t))throw new TypeError("argument should be a Buffer");if(e||(e=0),!n&&n!==0&&(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r>>0,e=e===void 0?this.length:e>>>0,t||(t=0);let s;if(typeof t=="number")for(s=r;s2**32?n=ht(String(r)):typeof r=="bigint"&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=ht(n)),n+="n"),e+=` It must be ${t}. Received ${n}`,e},RangeError);function ht(i){let t="",r=i.length;const e=i[0]==="-"?1:0;for(;r>=e+4;r-=3)t=`_${i.slice(r-3,r)}${t}`;return`${i.slice(0,r)}${t}`}function $t(i,t,r){D(t,"offset"),(i[t]===void 0||i[t+r]===void 0)&&j(t,i.length-(r+1))}function ft(i,t,r,e,n,s){if(i>r||i3?t===0||t===BigInt(0)?d=`>= 0${u} and < 2${u} ** ${(s+1)*8}${u}`:d=`>= -(2${u} ** ${(s+1)*8-1}${u}) and < 2 ** ${(s+1)*8-1}${u}`:d=`>= ${t}${u} and <= ${r}${u}`,new $.ERR_OUT_OF_RANGE("value",d,i)}$t(e,n,s)}function D(i,t){if(typeof i!="number")throw new $.ERR_INVALID_ARG_TYPE(t,"number",i)}function j(i,t,r){throw Math.floor(i)!==i?(D(i,r),new $.ERR_OUT_OF_RANGE(r||"offset","an integer",i)):t<0?new $.ERR_BUFFER_OUT_OF_BOUNDS:new $.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,i)}const Dt=/[^+/0-9A-Za-z-_]/g;function Mt(i){if(i=i.split("=")[0],i=i.trim().replace(Dt,""),i.length<2)return"";for(;i.length%4!==0;)i=i+"=";return i}function z(i,t){t=t||1/0;let r;const e=i.length;let n=null;const s=[];for(let u=0;u55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(u+1===e){(t-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(t-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function Ot(i){const t=[];for(let r=0;r>8,n=r%256,s.push(n),s.push(e);return s}function pt(i){return c.toByteArray(Mt(i))}function Y(i,t,r,e){let n;for(n=0;n=t.length||n>=i.length);++n)t[n+r]=i[n];return n}function S(i,t){return i instanceof t||i!=null&&i.constructor!=null&&i.constructor.name!=null&&i.constructor.name===t.name}function K(i){return i!==i}const jt=function(){const i="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const e=r*16;for(let n=0;n<16;++n)t[e+n]=i[r]+i[n]}return t}();function b(i){return typeof BigInt>"u"?Vt:i}function Vt(){throw new Error("BigInt not supported")}})(gt);const lr={name:"cloudPlaylist",components:{Cover:Yt,Card:qt},props:{playlist:Object,localPlaylists:Array,cloudPlaylists:Array},data(){return{statusText:"",toAdd:[]}},methods:{parseCover:Wt,async import(){if(this.statusIcon!="cloud_done"){if(this.statusIcon=="cloud_sync"){for(let l=0;ly.name==this.playlist.name))==null?void 0:h[0];if(!c)return this.localPlaylists?"cloud":"cloud_off";if(this.playlist.description!=c.description)return"cloud_sync";this.toAdd=[];for(let y=0;y[_("span",{class:"close material-symbols-rounded",onClick:c[0]||(c[0]=()=>l.$emit("remove"))},"close"),q(a,{src:f.cover},null,8,["src"]),_("div",cr,[_("div",ar,[h.playlist.type!="classic"?(L(),V("span",hr,N(h.playlist.type=="smart"?"neurology":"bolt"),1)):Z("",!0),_("h4",null,N(h.playlist.name),1)]),_("div",fr,[yt(N(h.playlist.songs.length)+" "+N(h.playlist.songs.length==1?"song":"songs"),1),h.playlist.description?(L(),V(Bt,{key:0},[yt(" • "),_("i",null,N(h.playlist.description),1)],64)):Z("",!0)]),_("div",pr,[_("span",yr,N(f.statusIcon),1),y.statusText?(L(),V("div",dr,[_("i",null,N(y.statusText),1)])):Z("",!0)])])]),_:1})}const xr=wt(lr,[["render",wr],["__scopeId","data-v-572c1094"]]);window.Buffer=gt.Buffer;const Br={name:"import",methods:{async downloadFile(){const l=await dt(this.playlists);Xt(l)},async openGist(){window.open(await Q.gistUrl(),"_blank")},async upload(){const l=await dt(this.playlists);console.log(await Q.saveOrUpdate({"my.one.collection":l})),this.fetchGists()},async fetchGists(){this.cloudPlaylists=await Q.getContent()},async fetchLocalPlaylists(){var l,c;if(!this.loadingPlaylists){this.loadingPlaylists=!0,this.playlists=[];for(const h of(c=(l=this.dataStore)==null?void 0:l.playlists)==null?void 0:c.filter(p=>p.type!="special")){const p=Object.assign({},h);this.playlists.push(p)}this.loadingPlaylists=!1}}},watch:{dataStore:{handler(l,c){this.fetchLocalPlaylists()},deep:!0}},mounted(){this.fetchLocalPlaylists()},data(){return this.fetchGists(),{playlists:[],loadingPlaylists:!1,userData:{},cloudPlaylists:[],dataStore:zt()}},components:{IconButton:Kt,CloudPlaylist:xr}};const Et=l=>(Qt("data-v-fad8b539"),l=l(),vt(),l),gr={class:"export"},mr={class:"action"},Er=Et(()=>_("h1",null,"Save to File",-1)),Ir={class:"action"},Fr=Et(()=>_("h1",null,"Save to Github Gists",-1)),_r={class:"flex flex-row gap-2"},Ar={class:"data"};function Ur(l,c,h,p,y,f){const a=W("IconButton"),o=W("CloudPlaylist");return L(),V("div",gr,[_("div",mr,[Er,q(a,{icon:"file_download",label:"Save",onClick:f.downloadFile},null,8,["onClick"])]),_("div",Ir,[Fr,_("div",_r,[q(a,{icon:"cloud_upload",label:"Synchronise",onClick:f.upload},null,8,["onClick"]),q(a,{icon:"link",label:"Browse",onClick:f.openGist},null,8,["onClick"])])]),_("div",Ar,[(L(!0),V(Bt,null,Zt(y.playlists,(w,C)=>(L(),xt(o,{key:C,cloudPlaylists:y.cloudPlaylists,playlist:w,onRemove:()=>y.playlists.splice(C,1)},null,8,["cloudPlaylists","playlist","onRemove"]))),128))])])}const Rr=wt(Br,[["render",Ur],["__scopeId","data-v-fad8b539"]]);export{Rr as default};
+ */(function(l){const c=H,h=tt,p=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;l.Buffer=o,l.SlowBuffer=Ft,l.INSPECT_MAX_BYTES=50;const y=2147483647;l.kMaxLength=y,o.TYPED_ARRAY_SUPPORT=f(),!o.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function f(){try{const i=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(i,t),i.foo()===42}catch{return!1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function a(i){if(i>y)throw new RangeError('The value "'+i+'" is invalid for option "size"');const t=new Uint8Array(i);return Object.setPrototypeOf(t,o.prototype),t}function o(i,t,r){if(typeof i=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return F(i)}return w(i,t,r)}o.poolSize=8192;function w(i,t,r){if(typeof i=="string")return P(i,t);if(ArrayBuffer.isView(i))return O(i);if(i==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i);if(S(i,ArrayBuffer)||i&&S(i.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(S(i,SharedArrayBuffer)||i&&S(i.buffer,SharedArrayBuffer)))return G(i,t,r);if(typeof i=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const e=i.valueOf&&i.valueOf();if(e!=null&&e!==i)return o.from(e,t,r);const n=It(i);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof i[Symbol.toPrimitive]=="function")return o.from(i[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i)}o.from=function(i,t,r){return w(i,t,r)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function C(i){if(typeof i!="number")throw new TypeError('"size" argument must be of type number');if(i<0)throw new RangeError('The value "'+i+'" is invalid for option "size"')}function I(i,t,r){return C(i),i<=0?a(i):t!==void 0?typeof r=="string"?a(i).fill(t,r):a(i).fill(t):a(i)}o.alloc=function(i,t,r){return I(i,t,r)};function F(i){return C(i),a(i<0?0:J(i)|0)}o.allocUnsafe=function(i){return F(i)},o.allocUnsafeSlow=function(i){return F(i)};function P(i,t){if((typeof t!="string"||t==="")&&(t="utf8"),!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=rt(i,t)|0;let e=a(r);const n=e.write(i,t);return n!==r&&(e=e.slice(0,n)),e}function _(i){const t=i.length<0?0:J(i.length)|0,r=a(t);for(let e=0;e=y)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+y.toString(16)+" bytes");return i|0}function Ft(i){return+i!=i&&(i=0),o.alloc(+i)}o.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==o.prototype},o.compare=function(t,r){if(S(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),S(r,Uint8Array)&&(r=o.from(r,r.offset,r.byteLength)),!o.isBuffer(t)||!o.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;let e=t.length,n=r.length;for(let s=0,u=Math.min(e,n);sn.length?(o.isBuffer(u)||(u=o.from(u)),u.copy(n,s)):Uint8Array.prototype.set.call(n,u,s);else if(o.isBuffer(u))u.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=u.length}return n};function rt(i,t){if(o.isBuffer(i))return i.length;if(ArrayBuffer.isView(i)||S(i,ArrayBuffer))return i.byteLength;if(typeof i!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof i);const r=i.length,e=arguments.length>2&&arguments[2]===!0;if(!e&&r===0)return 0;let n=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return z(i).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return pt(i).length;default:if(n)return e?-1:z(i).length;t=(""+t).toLowerCase(),n=!0}}o.byteLength=rt;function At(i,t,r){let e=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(i||(i="utf8");;)switch(i){case"hex":return Lt(this,t,r);case"utf8":case"utf-8":return nt(this,t,r);case"ascii":return bt(this,t,r);case"latin1":case"binary":return kt(this,t,r);case"base64":return Rt(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Nt(this,t,r);default:if(e)throw new TypeError("Unknown encoding: "+i);i=(i+"").toLowerCase(),e=!0}}o.prototype._isBuffer=!0;function k(i,t,r){const e=i[t];i[t]=i[r],i[r]=e}o.prototype.swap16=function(){const t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;rr&&(t+=" ... "),""},p&&(o.prototype[p]=o.prototype.inspect),o.prototype.compare=function(t,r,e,n,s){if(S(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(r===void 0&&(r=0),e===void 0&&(e=t?t.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),r<0||e>t.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&r>=e)return 0;if(n>=s)return-1;if(r>=e)return 1;if(r>>>=0,e>>>=0,n>>>=0,s>>>=0,this===t)return 0;let u=s-n,d=e-r;const g=Math.min(u,d),B=this.slice(n,s),m=t.slice(r,e);for(let x=0;x2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,K(r)&&(r=n?0:i.length-1),r<0&&(r=i.length+r),r>=i.length){if(n)return-1;r=i.length-1}else if(r<0)if(n)r=0;else return-1;if(typeof t=="string"&&(t=o.from(t,e)),o.isBuffer(t))return t.length===0?-1:et(i,t,r,e,n);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(i,t,r):Uint8Array.prototype.lastIndexOf.call(i,t,r):et(i,[t],r,e,n);throw new TypeError("val must be string, number or Buffer")}function et(i,t,r,e,n){let s=1,u=i.length,d=t.length;if(e!==void 0&&(e=String(e).toLowerCase(),e==="ucs2"||e==="ucs-2"||e==="utf16le"||e==="utf-16le")){if(i.length<2||t.length<2)return-1;s=2,u/=2,d/=2,r/=2}function g(m,x){return s===1?m[x]:m.readUInt16BE(x*s)}let B;if(n){let m=-1;for(B=r;Bu&&(r=u-d),B=r;B>=0;B--){let m=!0;for(let x=0;xn&&(e=n)):e=n;const s=t.length;e>s/2&&(e=s/2);let u;for(u=0;u>>0,isFinite(e)?(e=e>>>0,n===void 0&&(n="utf8")):(n=e,e=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const s=this.length-r;if((e===void 0||e>s)&&(e=s),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let u=!1;for(;;)switch(n){case"hex":return _t(this,t,r,e);case"utf8":case"utf-8":return Ut(this,t,r,e);case"ascii":case"latin1":case"binary":return Ct(this,t,r,e);case"base64":return Tt(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return St(this,t,r,e);default:if(u)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),u=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Rt(i,t,r){return t===0&&r===i.length?c.fromByteArray(i):c.fromByteArray(i.slice(t,r))}function nt(i,t,r){r=Math.min(i.length,r);const e=[];let n=t;for(;n239?4:s>223?3:s>191?2:1;if(n+d<=r){let g,B,m,x;switch(d){case 1:s<128&&(u=s);break;case 2:g=i[n+1],(g&192)===128&&(x=(s&31)<<6|g&63,x>127&&(u=x));break;case 3:g=i[n+1],B=i[n+2],(g&192)===128&&(B&192)===128&&(x=(s&15)<<12|(g&63)<<6|B&63,x>2047&&(x<55296||x>57343)&&(u=x));break;case 4:g=i[n+1],B=i[n+2],m=i[n+3],(g&192)===128&&(B&192)===128&&(m&192)===128&&(x=(s&15)<<18|(g&63)<<12|(B&63)<<6|m&63,x>65535&&x<1114112&&(u=x))}}u===null?(u=65533,d=1):u>65535&&(u-=65536,e.push(u>>>10&1023|55296),u=56320|u&1023),e.push(u),n+=d}return Pt(e)}const ot=4096;function Pt(i){const t=i.length;if(t<=ot)return String.fromCharCode.apply(String,i);let r="",e=0;for(;ee)&&(r=e);let n="";for(let s=t;se&&(t=e),r<0?(r+=e,r<0&&(r=0)):r>e&&(r=e),rr)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(t,r,e){t=t>>>0,r=r>>>0,e||E(t,r,this.length);let n=this[t],s=1,u=0;for(;++u>>0,r=r>>>0,e||E(t,r,this.length);let n=this[t+--r],s=1;for(;r>0&&(s*=256);)n+=this[t+--r]*s;return n},o.prototype.readUint8=o.prototype.readUInt8=function(t,r){return t=t>>>0,r||E(t,1,this.length),this[t]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||E(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||E(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||E(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||E(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readBigUInt64LE=b(function(t){t=t>>>0,D(t,"offset");const r=this[t],e=this[t+7];(r===void 0||e===void 0)&&j(t,this.length-8);const n=r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,s=this[++t]+this[++t]*2**8+this[++t]*2**16+e*2**24;return BigInt(n)+(BigInt(s)<>>0,D(t,"offset");const r=this[t],e=this[t+7];(r===void 0||e===void 0)&&j(t,this.length-8);const n=r*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],s=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+e;return(BigInt(n)<>>0,r=r>>>0,e||E(t,r,this.length);let n=this[t],s=1,u=0;for(;++u=s&&(n-=Math.pow(2,8*r)),n},o.prototype.readIntBE=function(t,r,e){t=t>>>0,r=r>>>0,e||E(t,r,this.length);let n=r,s=1,u=this[t+--n];for(;n>0&&(s*=256);)u+=this[t+--n]*s;return s*=128,u>=s&&(u-=Math.pow(2,8*r)),u},o.prototype.readInt8=function(t,r){return t=t>>>0,r||E(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]},o.prototype.readInt16LE=function(t,r){t=t>>>0,r||E(t,2,this.length);const e=this[t]|this[t+1]<<8;return e&32768?e|4294901760:e},o.prototype.readInt16BE=function(t,r){t=t>>>0,r||E(t,2,this.length);const e=this[t+1]|this[t]<<8;return e&32768?e|4294901760:e},o.prototype.readInt32LE=function(t,r){return t=t>>>0,r||E(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,r){return t=t>>>0,r||E(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readBigInt64LE=b(function(t){t=t>>>0,D(t,"offset");const r=this[t],e=this[t+7];(r===void 0||e===void 0)&&j(t,this.length-8);const n=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(e<<24);return(BigInt(n)<>>0,D(t,"offset");const r=this[t],e=this[t+7];(r===void 0||e===void 0)&&j(t,this.length-8);const n=(r<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(n)<>>0,r||E(t,4,this.length),h.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,r){return t=t>>>0,r||E(t,4,this.length),h.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||E(t,8,this.length),h.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||E(t,8,this.length),h.read(this,t,!1,52,8)};function U(i,t,r,e,n,s){if(!o.isBuffer(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||ti.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(t,r,e,n){if(t=+t,r=r>>>0,e=e>>>0,!n){const d=Math.pow(2,8*e)-1;U(this,t,r,e,d,0)}let s=1,u=0;for(this[r]=t&255;++u>>0,e=e>>>0,!n){const d=Math.pow(2,8*e)-1;U(this,t,r,e,d,0)}let s=e-1,u=1;for(this[r+s]=t&255;--s>=0&&(u*=256);)this[r+s]=t/u&255;return r+e},o.prototype.writeUint8=o.prototype.writeUInt8=function(t,r,e){return t=+t,r=r>>>0,e||U(this,t,r,1,255,0),this[r]=t&255,r+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(t,r,e){return t=+t,r=r>>>0,e||U(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(t,r,e){return t=+t,r=r>>>0,e||U(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(t,r,e){return t=+t,r=r>>>0,e||U(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(t,r,e){return t=+t,r=r>>>0,e||U(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};function st(i,t,r,e,n){ft(t,e,n,i,r,7);let s=Number(t&BigInt(4294967295));i[r++]=s,s=s>>8,i[r++]=s,s=s>>8,i[r++]=s,s=s>>8,i[r++]=s;let u=Number(t>>BigInt(32)&BigInt(4294967295));return i[r++]=u,u=u>>8,i[r++]=u,u=u>>8,i[r++]=u,u=u>>8,i[r++]=u,r}function ut(i,t,r,e,n){ft(t,e,n,i,r,7);let s=Number(t&BigInt(4294967295));i[r+7]=s,s=s>>8,i[r+6]=s,s=s>>8,i[r+5]=s,s=s>>8,i[r+4]=s;let u=Number(t>>BigInt(32)&BigInt(4294967295));return i[r+3]=u,u=u>>8,i[r+2]=u,u=u>>8,i[r+1]=u,u=u>>8,i[r]=u,r+8}o.prototype.writeBigUInt64LE=b(function(t,r=0){return st(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=b(function(t,r=0){return ut(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r=r>>>0,!n){const g=Math.pow(2,8*e-1);U(this,t,r,e,g-1,-g)}let s=0,u=1,d=0;for(this[r]=t&255;++s>0)-d&255;return r+e},o.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r=r>>>0,!n){const g=Math.pow(2,8*e-1);U(this,t,r,e,g-1,-g)}let s=e-1,u=1,d=0;for(this[r+s]=t&255;--s>=0&&(u*=256);)t<0&&d===0&&this[r+s+1]!==0&&(d=1),this[r+s]=(t/u>>0)-d&255;return r+e},o.prototype.writeInt8=function(t,r,e){return t=+t,r=r>>>0,e||U(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1},o.prototype.writeInt16LE=function(t,r,e){return t=+t,r=r>>>0,e||U(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2},o.prototype.writeInt16BE=function(t,r,e){return t=+t,r=r>>>0,e||U(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2},o.prototype.writeInt32LE=function(t,r,e){return t=+t,r=r>>>0,e||U(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4},o.prototype.writeInt32BE=function(t,r,e){return t=+t,r=r>>>0,e||U(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4},o.prototype.writeBigInt64LE=b(function(t,r=0){return st(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=b(function(t,r=0){return ut(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function lt(i,t,r,e,n,s){if(r+e>i.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function ct(i,t,r,e,n){return t=+t,r=r>>>0,n||lt(i,t,r,4),h.write(i,t,r,e,23,4),r+4}o.prototype.writeFloatLE=function(t,r,e){return ct(this,t,r,!0,e)},o.prototype.writeFloatBE=function(t,r,e){return ct(this,t,r,!1,e)};function at(i,t,r,e,n){return t=+t,r=r>>>0,n||lt(i,t,r,8),h.write(i,t,r,e,52,8),r+8}o.prototype.writeDoubleLE=function(t,r,e){return at(this,t,r,!0,e)},o.prototype.writeDoubleBE=function(t,r,e){return at(this,t,r,!1,e)},o.prototype.copy=function(t,r,e,n){if(!o.isBuffer(t))throw new TypeError("argument should be a Buffer");if(e||(e=0),!n&&n!==0&&(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r>>0,e=e===void 0?this.length:e>>>0,t||(t=0);let s;if(typeof t=="number")for(s=r;s2**32?n=ht(String(r)):typeof r=="bigint"&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=ht(n)),n+="n"),e+=` It must be ${t}. Received ${n}`,e},RangeError);function ht(i){let t="",r=i.length;const e=i[0]==="-"?1:0;for(;r>=e+4;r-=3)t=`_${i.slice(r-3,r)}${t}`;return`${i.slice(0,r)}${t}`}function Mt(i,t,r){D(t,"offset"),(i[t]===void 0||i[t+r]===void 0)&&j(t,i.length-(r+1))}function ft(i,t,r,e,n,s){if(i>r||i= 0${u} and < 2${u} ** ${(s+1)*8}${u}`:d=`>= -(2${u} ** ${(s+1)*8-1}${u}) and < 2 ** ${(s+1)*8-1}${u}`,new M.ERR_OUT_OF_RANGE("value",d,i)}Mt(e,n,s)}function D(i,t){if(typeof i!="number")throw new M.ERR_INVALID_ARG_TYPE(t,"number",i)}function j(i,t,r){throw Math.floor(i)!==i?(D(i,r),new M.ERR_OUT_OF_RANGE("offset","an integer",i)):t<0?new M.ERR_BUFFER_OUT_OF_BOUNDS:new M.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${t}`,i)}const Dt=/[^+/0-9A-Za-z-_]/g;function $t(i){if(i=i.split("=")[0],i=i.trim().replace(Dt,""),i.length<2)return"";for(;i.length%4!==0;)i=i+"=";return i}function z(i,t){t=t||1/0;let r;const e=i.length;let n=null;const s=[];for(let u=0;u55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(u+1===e){(t-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(t-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function Ot(i){const t=[];for(let r=0;r>8,n=r%256,s.push(n),s.push(e);return s}function pt(i){return c.toByteArray($t(i))}function Y(i,t,r,e){let n;for(n=0;n=t.length||n>=i.length);++n)t[n+r]=i[n];return n}function S(i,t){return i instanceof t||i!=null&&i.constructor!=null&&i.constructor.name!=null&&i.constructor.name===t.name}function K(i){return i!==i}const jt=function(){const i="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const e=r*16;for(let n=0;n<16;++n)t[e+n]=i[r]+i[n]}return t}();function b(i){return typeof BigInt>"u"?Vt:i}function Vt(){throw new Error("BigInt not supported")}})(gt);const lr={name:"cloudPlaylist",components:{Cover:Yt,Card:qt},props:{playlist:Object,localPlaylists:Array,cloudPlaylists:Array},data(){return{statusText:"",toAdd:[]}},methods:{parseCover:Wt,async import(){if(this.statusIcon!="cloud_done"){if(this.statusIcon=="cloud_sync"){for(let l=0;ly.name==this.playlist.name))==null?void 0:h[0];if(!c)return this.localPlaylists?"cloud":"cloud_off";if(this.playlist.description!=c.description)return"cloud_sync";this.toAdd=[];for(let y=0;y[A("span",{class:"close material-symbols-rounded",onClick:c[0]||(c[0]=()=>l.$emit("remove"))},"close"),q(a,{src:f.cover},null,8,["src"]),A("div",cr,[A("div",ar,[h.playlist.type!="classic"?(N(),V("span",hr,L(h.playlist.type=="smart"?"neurology":"bolt"),1)):Z("",!0),A("h4",null,L(h.playlist.name),1)]),A("div",fr,[yt(L(h.playlist.songs.length)+" "+L(h.playlist.songs.length==1?"song":"songs"),1),h.playlist.description?(N(),V(Bt,{key:0},[yt(" • "),A("i",null,L(h.playlist.description),1)],64)):Z("",!0)]),A("div",pr,[A("span",yr,L(f.statusIcon),1),y.statusText?(N(),V("div",dr,[A("i",null,L(y.statusText),1)])):Z("",!0)])])]),_:1})}const xr=wt(lr,[["render",wr],["__scopeId","data-v-572c1094"]]);window.Buffer=gt.Buffer;const Br={name:"import",methods:{async downloadFile(){const l=await dt(this.playlists);Xt(l)},async openGist(){window.open(await Q.gistUrl(),"_blank")},async upload(){const l=await dt(this.playlists);console.log(await Q.saveOrUpdate({"my.one.collection":l})),this.fetchGists()},async fetchGists(){this.cloudPlaylists=await Q.getContent()},async fetchLocalPlaylists(){var l,c;if(!this.loadingPlaylists){this.loadingPlaylists=!0,this.playlists=[];for(const h of(c=(l=this.dataStore)==null?void 0:l.playlists)==null?void 0:c.filter(p=>p.type!="special")){const p=Object.assign({},h);this.playlists.push(p)}this.loadingPlaylists=!1}}},watch:{dataStore:{handler(l,c){this.fetchLocalPlaylists()},deep:!0}},mounted(){this.fetchLocalPlaylists()},data(){return this.fetchGists(),{playlists:[],loadingPlaylists:!1,userData:{},cloudPlaylists:[],dataStore:zt()}},components:{IconButton:Kt,CloudPlaylist:xr}},Et=l=>(Qt("data-v-fad8b539"),l=l(),vt(),l),gr={class:"export"},mr={class:"action"},Er=Et(()=>A("h1",null,"Save to File",-1)),Ir={class:"action"},Fr=Et(()=>A("h1",null,"Save to Github Gists",-1)),Ar={class:"flex flex-row gap-2"},_r={class:"data"};function Ur(l,c,h,p,y,f){const a=W("IconButton"),o=W("CloudPlaylist");return N(),V("div",gr,[A("div",mr,[Er,q(a,{icon:"file_download",label:"Save",onClick:f.downloadFile},null,8,["onClick"])]),A("div",Ir,[Fr,A("div",Ar,[q(a,{icon:"cloud_upload",label:"Synchronise",onClick:f.upload},null,8,["onClick"]),q(a,{icon:"link",label:"Browse",onClick:f.openGist},null,8,["onClick"])])]),A("div",_r,[(N(!0),V(Bt,null,Zt(y.playlists,(w,C)=>(N(),xt(o,{key:C,cloudPlaylists:y.cloudPlaylists,playlist:w,onRemove:()=>y.playlists.splice(C,1)},null,8,["cloudPlaylists","playlist","onRemove"]))),128))])])}const Rr=wt(Br,[["render",Ur],["__scopeId","data-v-fad8b539"]]);export{Rr as default};
diff --git a/src/ui/dist/assets/Export-B-H9t4Ft.js.gz b/src/ui/dist/assets/Export-B-H9t4Ft.js.gz
new file mode 100644
index 000000000..dbc55e79f
Binary files /dev/null and b/src/ui/dist/assets/Export-B-H9t4Ft.js.gz differ
diff --git a/src/ui/dist/assets/Export-a03f6dd4.css b/src/ui/dist/assets/Export-DQXjuUsA.css
similarity index 100%
rename from src/ui/dist/assets/Export-a03f6dd4.css
rename to src/ui/dist/assets/Export-DQXjuUsA.css
diff --git a/src/ui/dist/assets/Export-a03f6dd4.css.gz b/src/ui/dist/assets/Export-DQXjuUsA.css.gz
similarity index 100%
rename from src/ui/dist/assets/Export-a03f6dd4.css.gz
rename to src/ui/dist/assets/Export-DQXjuUsA.css.gz
diff --git a/src/ui/dist/assets/Export-b9da4cc1.js.gz b/src/ui/dist/assets/Export-b9da4cc1.js.gz
deleted file mode 100644
index 5bbacb6e0..000000000
Binary files a/src/ui/dist/assets/Export-b9da4cc1.js.gz and /dev/null differ
diff --git a/src/ui/dist/assets/FactCard-07fe2677.js b/src/ui/dist/assets/FactCard-07fe2677.js
deleted file mode 100644
index a9af290ed..000000000
--- a/src/ui/dist/assets/FactCard-07fe2677.js
+++ /dev/null
@@ -1 +0,0 @@
-import{e as s,o as t,i as c,w as o,a as r,t as a,c as d,d as n,C as l,_}from"./index-4a15a213.js";const i={class:"mx-4"},m={key:0,class:"my-0 text-muted"},p=s({__name:"FactCard",props:{withHover:{type:Boolean,default:!1},primaryText:{type:null,default:""},secondaryText:{type:String,default:"",required:!1}},setup(e){return(u,y)=>(t(),c(l,{"with-hover":e.withHover,class:"card p-4"},{default:o(()=>[r("h2",i,a(e.primaryText),1),e.secondaryText?(t(),d("p",m,a(e.secondaryText),1)):n("",!0)]),_:1},8,["with-hover"]))}});const h=_(p,[["__scopeId","data-v-23b147ec"]]);export{h as F};
diff --git a/src/ui/dist/assets/FactCard-D7mi8_uS.js b/src/ui/dist/assets/FactCard-D7mi8_uS.js
new file mode 100644
index 000000000..cbd972e1b
--- /dev/null
+++ b/src/ui/dist/assets/FactCard-D7mi8_uS.js
@@ -0,0 +1 @@
+import{e as s,o as t,i as r,w as o,a as c,t as a,c as d,d as n,C as i,_ as l}from"./index-DnhwPdfm.js";const m={class:"mx-4"},h={key:0,class:"my-0 text-muted"},p=s({__name:"FactCard",props:{withHover:{type:Boolean,default:!1},primaryText:{type:null,default:""},secondaryText:{type:String,default:"",required:!1}},setup(e){return(u,x)=>(t(),r(i,{"with-hover":e.withHover,class:"card p-4"},{default:o(()=>[c("h2",m,a(e.primaryText),1),e.secondaryText?(t(),d("p",h,a(e.secondaryText),1)):n("",!0)]),_:1},8,["with-hover"]))}}),f=l(p,[["__scopeId","data-v-23b147ec"]]);export{f as F};
diff --git a/src/ui/dist/assets/FactCard-3c5d1fcf.css b/src/ui/dist/assets/FactCard-ei9UWMOf.css
similarity index 100%
rename from src/ui/dist/assets/FactCard-3c5d1fcf.css
rename to src/ui/dist/assets/FactCard-ei9UWMOf.css
diff --git a/src/ui/dist/assets/FullShelf-62d1d109.css b/src/ui/dist/assets/FullShelf-62d1d109.css
deleted file mode 100644
index a1780feba..000000000
--- a/src/ui/dist/assets/FullShelf-62d1d109.css
+++ /dev/null
@@ -1 +0,0 @@
-span.icon[data-v-8fb8961a]{transform:translateY(3px);margin-left:20px}.header[data-v-8fb8961a]{margin:10px 10px 0;display:flex;flex-direction:row;justify-content:space-between}.header>h2[data-v-8fb8961a]{align-self:flex-start;margin-top:0;margin-bottom:10px}.header>h5[data-v-8fb8961a]{text-transform:uppercase;align-self:center;margin:0}.header>h5[data-v-8fb8961a]:hover{cursor:pointer}.items[data-v-8fb8961a]{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));grid-template-rows:1fr;gap:1em;overflow-y:auto}
diff --git a/src/ui/dist/assets/FullShelf-CoDkvkMi.css b/src/ui/dist/assets/FullShelf-CoDkvkMi.css
new file mode 100644
index 000000000..ff4cd7043
--- /dev/null
+++ b/src/ui/dist/assets/FullShelf-CoDkvkMi.css
@@ -0,0 +1 @@
+span.icon[data-v-9502e6e9]{transform:translateY(3px);margin-left:20px}.header[data-v-9502e6e9]{margin:10px 10px 0;display:flex;flex-direction:row;justify-content:space-between}.header>h2[data-v-9502e6e9]{align-self:flex-start;margin-top:0;margin-bottom:10px}.header>h5[data-v-9502e6e9]{text-transform:uppercase;align-self:center;margin:0}.header>h5[data-v-9502e6e9]:hover{cursor:pointer}.items[data-v-9502e6e9]{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));grid-template-rows:1fr;gap:1em;overflow-y:auto}
diff --git a/src/ui/dist/assets/FullShelf-DRbcKza6.js b/src/ui/dist/assets/FullShelf-DRbcKza6.js
new file mode 100644
index 000000000..d5b7f94aa
--- /dev/null
+++ b/src/ui/dist/assets/FullShelf-DRbcKza6.js
@@ -0,0 +1 @@
+import{_ as c,o as t,c as a,a as s,b as i,t as o,d,r}from"./index-DnhwPdfm.js";const l={name:"FullShelf",props:{heading:String,icon:String}},_={class:"shelf"},h={class:"header"},u={key:0,class:"icon material-icons-outlined"},f={class:"items"};function m(n,p,e,S,g,v){return t(),a("div",_,[s("div",h,[s("h2",null,[i(o(e.heading),1),e.icon?(t(),a("span",u,o(e.icon),1)):d("",!0)])]),s("div",f,[r(n.$slots,"default",{},void 0,!0)])])}const x=c(l,[["render",m],["__scopeId","data-v-9502e6e9"]]);export{x as F};
diff --git a/src/ui/dist/assets/FullShelf-b2b7ffe5.js b/src/ui/dist/assets/FullShelf-b2b7ffe5.js
deleted file mode 100644
index 9543e6a67..000000000
--- a/src/ui/dist/assets/FullShelf-b2b7ffe5.js
+++ /dev/null
@@ -1 +0,0 @@
-import{_ as c,o as t,c as a,a as s,b as i,t as n,d as l,r as _}from"./index-4a15a213.js";const d={name:"FullShelf",props:{heading:String,icon:String}},r={class:"shelf"},u={class:"header"},f={key:0,class:"icon material-icons-outlined"},h={class:"items"};function m(o,p,e,S,g,v){return t(),a("div",r,[s("div",u,[s("h2",null,[i(n(e.heading),1),e.icon?(t(),a("span",f,n(e.icon),1)):l("",!0)])]),s("div",h,[_(o.$slots,"default",{},void 0,!0)])])}const y=c(d,[["render",m],["__scopeId","data-v-8fb8961a"]]);export{y as F};
diff --git a/src/ui/dist/assets/Import-2ae5cf6c.js b/src/ui/dist/assets/Import-2ae5cf6c.js
deleted file mode 100644
index ff42bd036..000000000
--- a/src/ui/dist/assets/Import-2ae5cf6c.js
+++ /dev/null
@@ -1,4 +0,0 @@
-import{e as M,D as N,o as d,c as m,g as P,H as V,a as r,M as K,K as W,t as S,F as B,h as D,O as F,d as h,_ as G,i as C,w as I,b as j,C as q,n as k,j as A,E as Q,y as R,I as U,L as X,aD as Y,x as Z,$ as ee,a0 as te,l as se,m as ae,aE as le,aF as ne,aG as oe}from"./index-4a15a213.js";import{G as J}from"./gistClient-56b8a233.js";const ie=(e,c)=>{const t={source:e.source,id:e.id,changed:{}},a=t.changed,i=["id","href","duration","plays","artists"];for(const l of Object.keys(e))if(!i.includes(l)){if(l==="metadata"){const f=e.metadata,p=c.metadata;if(f&&p){if(!f.spotify&&!p.spotify)continue;if(!f.spotify&&p.spotify){a.metadata={from:f,to:p};continue}if(f.spotify&&!p.spotify){a.metadata={from:f,to:p};continue}f.spotify.id!==p.spotify.id&&(a.metadata={from:f,to:p})}else(f||p)&&(a.metadata={from:f,to:p});continue}l!=="id"&&e[l]!==c[l]&&(a[l]={from:e[l],to:c[l]})}return Object.keys(a).length?t:null},de=(e,c)=>{const t={name:e.playlist.name,id:e.playlist.id,added:[],removed:[],modified:[]};if(e.playlist.type!==c.playlist.type)return null;if(e.playlist.type==="smart"){const a=e.playlist,i=c.playlist;return JSON.stringify(a.definition)!==JSON.stringify(i.definition)?t:null}if(c.playlist.type!=="smart"){for(const a of e.playlist.songs){const i=c.playlist.songs.find(l=>l.source===a.source);if(i){const l=ie(a,i);l&&t.modified.push(l)}else t.removed.push(a)}for(const a of c.playlist.songs)e.playlist.songs.find(l=>l.source===a.source)||t.added.push(a);return t.added.length||t.removed.length||t.modified.length?t:null}},ce=(e,c)=>{const t={added:[],removed:[],modified:[]};for(const a of e.collection){const i=c.collection.find(l=>l.playlist.name===a.playlist.name);if(i){const l=de(a,i);l&&t.modified.push(l)}else t.removed.push(a)}for(const a of c.collection)e.collection.find(l=>l.playlist.name===a.playlist.name)||t.added.push(a);return t},re={class:"overflow-hidden"},ue={class:"title my-0"},fe={key:0,class:"info"},pe={class:"key"},ye={class:"value"},me=M({__name:"SongDiff",props:{song:{type:Object,required:!0},diff:{type:Object,required:!0},isBase:{type:Boolean,required:!1},expanded:{type:Object,required:!1}},emits:["exclude","toggle-expanded"],setup(e,{emit:c}){const t=e,a=N(()=>t.diff.removed.some(o=>o.source===t.song.source)?"removed":t.diff.modified.some(o=>o.source===t.song.source)?"modified":t.isBase?"base":t.diff.added.some(o=>o.source===t.song.source)?"added":"base"),i=c,l=()=>{i("toggle-expanded",t.song)},f=["title","artist","album","source","cover","favourite","metadata"],p=o=>{var _,b,E;const x=(b=(_=t.diff.modified.find($=>$.source===t.song.source))==null?void 0:_.changed)==null?void 0:b[o],v=t.isBase?"from":"to",y=(x==null?void 0:x[v])??t.song[o];return o=="metadata"?(E=y==null?void 0:y.spotify)==null?void 0:E.id:y};return(o,x)=>{var v,y;return!e.isBase&&a.value=="removed"?h("",!0):(d(),m("div",{key:0,class:F([a.value,"song px-4 py-2"])},[P(V,{src:e.song.cover,class:"rounded-md"},null,8,["src"]),r("div",re,[r("p",ue,[P(K,{text:e.song.title},null,8,["text"])]),P(W,{artist:e.song.artist,class:"artist text-muted"},null,8,["artist"])]),r("span",{class:"material-symbols-rounded cursor-pointer",onClick:l},S(((v=e.expanded)==null?void 0:v.source)==e.song.source?"expand_less":"expand_more"),1),((y=e.expanded)==null?void 0:y.source)==e.song.source?(d(),m("div",fe,[(d(),m(B,null,D(f,_=>{var b,E;return r("div",{key:_,class:F([{modified:(E=(b=e.diff.modified.find($=>$.source===e.song.source))==null?void 0:b.changed)==null?void 0:E[_]},"info__table"])},[r("span",pe,S(_),1),r("span",ye,S(p(_)),1)],2)}),64))])):h("",!0)],2))}}});const ge=G(me,[["__scopeId","data-v-1805c709"]]),ve={class:"info"},xe={class:"title"},he={key:0,class:"material-symbols-rounded"},_e={key:0,class:"text-muted"},be={class:"flex flex-row justify-between items-center"},Se={key:0,class:"text-very-muted"},ke={key:0},Pe=M({__name:"PlaylistDiff",props:{playlist:{type:Object,required:!0},diff:{type:Object,required:!0},isBase:{type:Boolean,required:!1},expanded:{type:Boolean,required:!1},expandedSong:{type:Object,required:!1}},emits:["exclude","toggle-expanded","toggle-expanded-song"],setup(e,{emit:c}){const t=e,a=N(()=>t.diff.removed.some(o=>o.playlist.name===t.playlist.name)?"removed":t.diff.modified.some(o=>o.name===t.playlist.name)?"modified":t.isBase?"base":t.diff.added.some(o=>o.playlist.name===t.playlist.name)?"added":"base"),i=c,l=()=>{i("toggle-expanded",t.playlist)},f=o=>{i("toggle-expanded-song",o)},p=o=>{const x=t.diff.modified.find(v=>v.name===o.name);return x||{name:o.name,added:[],removed:[],modified:[]}};return(o,x)=>(d(),C(q,{class:F([a.value,"playlist p-4 rounded-xl relative"])},{default:I(()=>{var v;return[P(V,{src:e.playlist.cover,class:"rounded-xl self-start"},null,8,["src"]),r("div",ve,[r("div",xe,[e.playlist.type!="classic"?(d(),m("span",he,S(e.playlist.type=="smart"?"neurology":"bolt"),1)):h("",!0),r("h2",null,S(e.playlist.name),1)]),e.playlist.description?(d(),m("p",_e,S(e.playlist.description),1)):h("",!0),r("div",be,[e.playlist.type==="classic"?(d(),m("p",Se,[r("strong",null,S((v=e.playlist.songs)==null?void 0:v.length),1),j(" tracks ")])):h("",!0),r("span",{class:"material-symbols-rounded cursor-pointer",title:"Expand",onClick:l},S(e.expanded?"expand_less":"expand_more"),1)])]),e.expanded?(d(),C(q,{key:0,class:"col-span-2 flex flex-col gap-2 z-10 p-4"},{default:I(()=>[e.playlist.type==="classic"?(d(!0),m(B,{key:0},D(e.playlist.songs,y=>(d(),C(ge,{key:y.source,diff:p(e.playlist),expanded:e.expandedSong,"is-base":e.isBase,song:y,onToggleExpanded:f},null,8,["diff","expanded","is-base","song"]))),128)):h("",!0),r("pre",null,[j(" "),e.playlist.type==="smart"?(d(),m("code",ke,`
-`+S(JSON.stringify(e.playlist.definition,null,4))+`
- `,1)):h("",!0),j(`
- `)])]),_:1})):h("",!0),a.value!="base"?(d(),m("span",{key:1,class:"material-symbols-rounded exclude",title:"Exclude",onClick:x[0]||(x[0]=y=>o.$emit("exclude",e.playlist))}," block ")):h("",!0)]}),_:1},8,["class"]))}});const T=G(Pe,[["__scopeId","data-v-51b40518"]]),L=e=>(se("data-v-3e5b815e"),e=e(),ae(),e),Ee={class:"pb-4 pr-4 flex flex-col gap-4 h-full"},we={class:"flex flex-row justify-end"},$e=L(()=>r("div",{class:"grid grid-cols-2 gap-4"},[r("h1",null,"Local"),r("h1",null,"Incoming")],-1)),Be={key:1,class:"fill-page"},Ce={key:1,class:"fill-page !grid !grid-cols-2 gap-4"},Oe=L(()=>r("h2",null,[r("span",{class:"material-symbols-rounded"},"file_upload"),j(" From File ")],-1)),je=L(()=>r("h2",null,[r("span",{class:"material-symbols-rounded"},"cloud_download"),j(" GitHub Gist ")],-1)),De=M({__name:"Import",setup(e){const c=k(!1),t=k(null),a=k({}),i=k({}),l=N(()=>ce(a.value,i.value)),f=A();let p=!1;const o=async()=>{var g;if(c.value||p)return;p=!0;const n=[];for(const s of(g=f.playlists)==null?void 0:g.filter(u=>u.type!="special")){const u=Object.assign({},s);n.push(u)}a.value=await Y(n),p=!1};Q(()=>f.playlists,o),R(o);const x=n=>{a.value.collection=a.value.collection.filter(g=>g.playlist.name!==n.name),i.value.collection=i.value.collection.filter(g=>g.playlist.name!==n.name)},v=k(null),y=k(null),_=n=>{var g;((g=v.value)==null?void 0:g.name)===n.name?v.value=null:v.value=n},b=n=>{var g;((g=y.value)==null?void 0:g.id)===n.id?y.value=null:y.value=n},E=async()=>{c.value=!0;const n=[],g=s=>{n.push(le(s.id,s.added));for(const u of s.removed)n.push(ne(s.id,u.id));for(const u of s.modified)for(const w of Object.keys(u.changed))n.push(oe(u.id,w,u.changed[w].to))};for(const s of l.value.added)s.playlist.type!=="special"&&(a.value.collection.push(s),n.push(Z(s.playlist.type,s.playlist.name,s.playlist.description,s.playlist.cover).then(u=>{s.playlist.id=u,s.playlist.type==="classic"?g({id:s.playlist.id,name:s.playlist.name,added:s.playlist.songs,removed:[],modified:[]}):s.playlist.type==="smart"&&n.push(ee(s.playlist.id,s.playlist.definition))})));for(const s of l.value.modified)g(s);for(const s of l.value.removed)n.push(te(s.playlist.id));await Promise.all(n),window.setTimeout(async()=>{await f.fetchPlaylists(),c.value=!1,await o()},1e3)},$=k(!1);J.connected().then(n=>$.value=n);const z=async()=>{const n=document.createElement("input");n.type="file",n.accept=".one.*",n.name="my.one.collection",n.onchange=async()=>{if(!n.files)return;const s=await n.files[0].text(),u=JSON.parse(s);i.value=u,t.value="file"},n.click()},H=async()=>{i.value=await J.getContent(),t.value="gist"};return k(null),(n,g)=>(d(),m("div",Ee,[r("div",we,[P(U,{icon:"merge",label:"Merge",onClick:E})]),t.value?(d(),m(B,{key:0},[c.value?(d(),m("div",Be,[P(X)])):(d(),m(B,{key:0},[$e,(d(!0),m(B,null,D(a.value.collection,s=>{var u,w;return d(),m("div",{key:s.playlist.name,class:"grid grid-cols-2 gap-4"},[a.value.collection.some(O=>O.playlist.name===s.playlist.name)?(d(),C(T,{key:0,diff:l.value,expanded:((u=v.value)==null?void 0:u.name)===s.playlist.name,"expanded-song":y.value,playlist:s.playlist,class:"grid-1","is-base":"",onExclude:x,onToggleExpanded:_,onToggleExpandedSong:b},null,8,["diff","expanded","expanded-song","playlist"])):h("",!0),i.value.collection.some(O=>O.playlist.name===s.playlist.name)?(d(),C(T,{key:1,diff:l.value,expanded:((w=v.value)==null?void 0:w.name)===s.playlist.name,"expanded-song":y.value,playlist:i.value.collection.find(O=>O.playlist.name===s.playlist.name).playlist,class:"grid-2",onExclude:x,onToggleExpanded:_,onToggleExpandedSong:b},null,8,["diff","expanded","expanded-song","playlist"])):h("",!0)])}),128)),(d(!0),m(B,null,D(l.value.added,s=>{var u;return d(),m("div",{key:s.playlist.name,class:"grid grid-cols-2 gap-4"},[i.value.collection.some(w=>w.playlist.name===s.playlist.name)?(d(),C(T,{key:0,diff:l.value,expanded:((u=v.value)==null?void 0:u.name)===s.playlist.name,"expanded-song":y.value,playlist:s.playlist,class:"grid-2",onExclude:x,onToggleExpanded:_,onToggleExpandedSong:b},null,8,["diff","expanded","expanded-song","playlist"])):h("",!0)])}),128))],64))],64)):(d(),m("div",Ce,[P(q,{"with-hover":"",class:"cursor-pointer",onClick:z},{default:I(()=>[Oe]),_:1}),P(q,{disabled:!$.value,"with-hover":"",class:"cursor-pointer",onClick:H},{default:I(()=>[je]),_:1},8,["disabled"])]))]))}});const Te=G(De,[["__scopeId","data-v-3e5b815e"]]);export{Te as default};
diff --git a/src/ui/dist/assets/Import-2ae5cf6c.js.gz b/src/ui/dist/assets/Import-2ae5cf6c.js.gz
deleted file mode 100644
index b75edf407..000000000
Binary files a/src/ui/dist/assets/Import-2ae5cf6c.js.gz and /dev/null differ
diff --git a/src/ui/dist/assets/Import-C1fifzbd.js b/src/ui/dist/assets/Import-C1fifzbd.js
new file mode 100644
index 000000000..df7da7bc1
--- /dev/null
+++ b/src/ui/dist/assets/Import-C1fifzbd.js
@@ -0,0 +1,4 @@
+import{e as M,D as N,o as d,c as m,g as E,H as V,a as r,M as K,K as W,t as S,F as $,h as D,Q as F,d as h,_ as G,i as B,w as q,b as j,C as I,n as _,j as A,E as Q,y as R,I as U,L as X,aC as Y,x as Z,a0 as ee,a1 as te,l as se,m as ae,aD as le,aE as ne,aF as ie}from"./index-DnhwPdfm.js";import{G as J}from"./gistClient-BQBNGijJ.js";const oe=(e,c)=>{const t={source:e.source,id:e.id,changed:{}},a=t.changed,o=["id","href","duration","plays","artists"];for(const l of Object.keys(e))if(!o.includes(l)){if(l==="metadata"){const f=e.metadata,p=c.metadata;if(f&&p){if(!f.spotify&&!p.spotify)continue;if(!f.spotify&&p.spotify){a.metadata={from:f,to:p};continue}if(f.spotify&&!p.spotify){a.metadata={from:f,to:p};continue}f.spotify.id!==p.spotify.id&&(a.metadata={from:f,to:p})}else(f||p)&&(a.metadata={from:f,to:p});continue}l!=="id"&&e[l]!==c[l]&&(a[l]={from:e[l],to:c[l]})}return Object.keys(a).length?t:null},de=(e,c)=>{const t={name:e.playlist.name,id:e.playlist.id,added:[],removed:[],modified:[]};if(e.playlist.type!==c.playlist.type)return null;if(e.playlist.type==="smart"){const a=e.playlist,o=c.playlist;return JSON.stringify(a.definition)!==JSON.stringify(o.definition)?t:null}if(c.playlist.type!=="smart"){for(const a of e.playlist.songs){const o=c.playlist.songs.find(l=>l.source===a.source);if(o){const l=oe(a,o);l&&t.modified.push(l)}else t.removed.push(a)}for(const a of c.playlist.songs)e.playlist.songs.find(l=>l.source===a.source)||t.added.push(a);return t.added.length||t.removed.length||t.modified.length?t:null}},ce=(e,c)=>{const t={added:[],removed:[],modified:[]};for(const a of e.collection){const o=c.collection.find(l=>l.playlist.name===a.playlist.name);if(o){const l=de(a,o);l&&t.modified.push(l)}else t.removed.push(a)}for(const a of c.collection)e.collection.find(l=>l.playlist.name===a.playlist.name)||t.added.push(a);return t},re={class:"overflow-hidden"},ue={class:"title my-0"},fe={key:0,class:"info"},pe={class:"key"},ye={class:"value"},me=M({__name:"SongDiff",props:{song:{type:Object,required:!0},diff:{type:Object,required:!0},isBase:{type:Boolean,required:!1},expanded:{type:Object,required:!1}},emits:["exclude","toggle-expanded"],setup(e,{emit:c}){const t=e,a=N(()=>t.diff.removed.some(i=>i.source===t.song.source)?"removed":t.diff.modified.some(i=>i.source===t.song.source)?"modified":t.isBase?"base":t.diff.added.some(i=>i.source===t.song.source)?"added":"base"),o=c,l=()=>{o("toggle-expanded",t.song)},f=["title","artist","album","source","cover","favourite","metadata"],p=i=>{var b,k,P;const x=(k=(b=t.diff.modified.find(C=>C.source===t.song.source))==null?void 0:b.changed)==null?void 0:k[i],v=t.isBase?"from":"to",y=(x==null?void 0:x[v])??t.song[i];return i=="metadata"?(P=y==null?void 0:y.spotify)==null?void 0:P.id:y};return(i,x)=>{var v,y;return!e.isBase&&a.value=="removed"?h("",!0):(d(),m("div",{key:0,class:F([a.value,"song px-4 py-2"])},[E(V,{src:e.song.cover,class:"rounded-md"},null,8,["src"]),r("div",re,[r("p",ue,[E(K,{text:e.song.title},null,8,["text"])]),E(W,{artist:e.song.artist,class:"artist text-muted"},null,8,["artist"])]),r("span",{class:"material-symbols-rounded cursor-pointer",onClick:l},S(((v=e.expanded)==null?void 0:v.source)==e.song.source?"expand_less":"expand_more"),1),((y=e.expanded)==null?void 0:y.source)==e.song.source?(d(),m("div",fe,[(d(),m($,null,D(f,b=>{var k,P;return r("div",{key:b,class:F([{modified:(P=(k=e.diff.modified.find(C=>C.source===e.song.source))==null?void 0:k.changed)==null?void 0:P[b]},"info__table"])},[r("span",pe,S(b),1),r("span",ye,S(p(b)),1)],2)}),64))])):h("",!0)],2))}}}),ge=G(me,[["__scopeId","data-v-1805c709"]]),ve={class:"info"},xe={class:"title"},he={key:0,class:"material-symbols-rounded"},be={key:0,class:"text-muted"},ke={class:"flex flex-row justify-between items-center"},Se={key:0,class:"text-very-muted"},_e={key:0},Ee=M({__name:"PlaylistDiff",props:{playlist:{type:Object,required:!0},diff:{type:Object,required:!0},isBase:{type:Boolean,required:!1},expanded:{type:Boolean,required:!1},expandedSong:{type:Object,required:!1}},emits:["exclude","toggle-expanded","toggle-expanded-song"],setup(e,{emit:c}){const t=e,a=N(()=>t.diff.removed.some(i=>i.playlist.name===t.playlist.name)?"removed":t.diff.modified.some(i=>i.name===t.playlist.name)?"modified":t.isBase?"base":t.diff.added.some(i=>i.playlist.name===t.playlist.name)?"added":"base"),o=c,l=()=>{o("toggle-expanded",t.playlist)},f=i=>{o("toggle-expanded-song",i)},p=i=>{const x=t.diff.modified.find(v=>v.name===i.name);return x||{name:i.name,added:[],removed:[],modified:[]}};return(i,x)=>(d(),B(I,{class:F([a.value,"playlist p-4 rounded-xl relative"])},{default:q(()=>{var v;return[E(V,{src:e.playlist.cover,class:"rounded-xl self-start"},null,8,["src"]),r("div",ve,[r("div",xe,[e.playlist.type!="classic"?(d(),m("span",he,S(e.playlist.type=="smart"?"neurology":"bolt"),1)):h("",!0),r("h2",null,S(e.playlist.name),1)]),e.playlist.description?(d(),m("p",be,S(e.playlist.description),1)):h("",!0),r("div",ke,[e.playlist.type==="classic"?(d(),m("p",Se,[r("strong",null,S((v=e.playlist.songs)==null?void 0:v.length),1),j(" tracks ")])):h("",!0),r("span",{class:"material-symbols-rounded cursor-pointer",title:"Expand",onClick:l},S(e.expanded?"expand_less":"expand_more"),1)])]),e.expanded?(d(),B(I,{key:0,class:"col-span-2 flex flex-col gap-2 z-10 p-4"},{default:q(()=>[e.playlist.type==="classic"?(d(!0),m($,{key:0},D(e.playlist.songs,y=>(d(),B(ge,{key:y.source,diff:p(e.playlist),expanded:e.expandedSong,"is-base":e.isBase,song:y,onToggleExpanded:f},null,8,["diff","expanded","is-base","song"]))),128)):h("",!0),r("pre",null,[j(" "),e.playlist.type==="smart"?(d(),m("code",_e,`
+`+S(JSON.stringify(e.playlist.definition,null,4))+`
+ `,1)):h("",!0),j(`
+ `)])]),_:1})):h("",!0),a.value!="base"?(d(),m("span",{key:1,class:"material-symbols-rounded exclude",title:"Exclude",onClick:x[0]||(x[0]=y=>i.$emit("exclude",e.playlist))}," block ")):h("",!0)]}),_:1},8,["class"]))}}),T=G(Ee,[["__scopeId","data-v-51b40518"]]),L=e=>(se("data-v-3e5b815e"),e=e(),ae(),e),Pe={class:"pb-4 pr-4 flex flex-col gap-4 h-full"},we={class:"flex flex-row justify-end"},Ce=L(()=>r("div",{class:"grid grid-cols-2 gap-4"},[r("h1",null,"Local"),r("h1",null,"Incoming")],-1)),$e={key:1,class:"fill-page"},Be={key:1,class:"fill-page !grid !grid-cols-2 gap-4"},Oe=L(()=>r("h2",null,[r("span",{class:"material-symbols-rounded"},"file_upload"),j(" From File ")],-1)),je=L(()=>r("h2",null,[r("span",{class:"material-symbols-rounded"},"cloud_download"),j(" GitHub Gist ")],-1)),De=M({__name:"Import",setup(e){const c=_(!1),t=_(null),a=_({}),o=_({}),l=N(()=>ce(a.value,o.value)),f=A();let p=!1;const i=async()=>{var g;if(c.value||p)return;p=!0;const n=[];for(const s of(g=f.playlists)==null?void 0:g.filter(u=>u.type!="special")){const u=Object.assign({},s);n.push(u)}a.value=await Y(n),p=!1};Q(()=>f.playlists,i),R(i);const x=n=>{a.value.collection=a.value.collection.filter(g=>g.playlist.name!==n.name),o.value.collection=o.value.collection.filter(g=>g.playlist.name!==n.name)},v=_(null),y=_(null),b=n=>{var g;((g=v.value)==null?void 0:g.name)===n.name?v.value=null:v.value=n},k=n=>{var g;((g=y.value)==null?void 0:g.id)===n.id?y.value=null:y.value=n},P=async()=>{c.value=!0;const n=[],g=s=>{n.push(le(s.id,s.added));for(const u of s.removed)n.push(ne(s.id,u.id));for(const u of s.modified)for(const w of Object.keys(u.changed))n.push(ie(u.id,w,u.changed[w].to))};for(const s of l.value.added)s.playlist.type!=="special"&&(a.value.collection.push(s),n.push(Z(s.playlist.type,s.playlist.name,s.playlist.description,s.playlist.cover).then(u=>{s.playlist.id=u,s.playlist.type==="classic"?g({id:s.playlist.id,name:s.playlist.name,added:s.playlist.songs,removed:[],modified:[]}):s.playlist.type==="smart"&&n.push(ee(s.playlist.id,s.playlist.definition))})));for(const s of l.value.modified)g(s);for(const s of l.value.removed)n.push(te(s.playlist.id));await Promise.all(n),window.setTimeout(async()=>{await f.fetchPlaylists(),c.value=!1,await i()},1e3)},C=_(!1);J.connected().then(n=>C.value=n);const z=async()=>{const n=document.createElement("input");n.type="file",n.accept=".one.*",n.name="my.one.collection",n.onchange=async()=>{if(!n.files)return;const s=await n.files[0].text(),u=JSON.parse(s);o.value=u,t.value="file"},n.click()},H=async()=>{o.value=await J.getContent(),t.value="gist"};return _(null),(n,g)=>(d(),m("div",Pe,[r("div",we,[E(U,{icon:"merge",label:"Merge",onClick:P})]),t.value?(d(),m($,{key:0},[c.value?(d(),m("div",$e,[E(X)])):(d(),m($,{key:0},[Ce,(d(!0),m($,null,D(a.value.collection,s=>{var u,w;return d(),m("div",{key:s.playlist.name,class:"grid grid-cols-2 gap-4"},[a.value.collection.some(O=>O.playlist.name===s.playlist.name)?(d(),B(T,{key:0,diff:l.value,expanded:((u=v.value)==null?void 0:u.name)===s.playlist.name,"expanded-song":y.value,playlist:s.playlist,class:"grid-1","is-base":"",onExclude:x,onToggleExpanded:b,onToggleExpandedSong:k},null,8,["diff","expanded","expanded-song","playlist"])):h("",!0),o.value.collection.some(O=>O.playlist.name===s.playlist.name)?(d(),B(T,{key:1,diff:l.value,expanded:((w=v.value)==null?void 0:w.name)===s.playlist.name,"expanded-song":y.value,playlist:o.value.collection.find(O=>O.playlist.name===s.playlist.name).playlist,class:"grid-2",onExclude:x,onToggleExpanded:b,onToggleExpandedSong:k},null,8,["diff","expanded","expanded-song","playlist"])):h("",!0)])}),128)),(d(!0),m($,null,D(l.value.added,s=>{var u;return d(),m("div",{key:s.playlist.name,class:"grid grid-cols-2 gap-4"},[o.value.collection.some(w=>w.playlist.name===s.playlist.name)?(d(),B(T,{key:0,diff:l.value,expanded:((u=v.value)==null?void 0:u.name)===s.playlist.name,"expanded-song":y.value,playlist:s.playlist,class:"grid-2",onExclude:x,onToggleExpanded:b,onToggleExpandedSong:k},null,8,["diff","expanded","expanded-song","playlist"])):h("",!0)])}),128))],64))],64)):(d(),m("div",Be,[E(I,{"with-hover":"",class:"cursor-pointer",onClick:z},{default:q(()=>[Oe]),_:1}),E(I,{disabled:!C.value,"with-hover":"",class:"cursor-pointer",onClick:H},{default:q(()=>[je]),_:1},8,["disabled"])]))]))}}),Te=G(De,[["__scopeId","data-v-3e5b815e"]]);export{Te as default};
diff --git a/src/ui/dist/assets/Import-C1fifzbd.js.gz b/src/ui/dist/assets/Import-C1fifzbd.js.gz
new file mode 100644
index 000000000..92d61c057
Binary files /dev/null and b/src/ui/dist/assets/Import-C1fifzbd.js.gz differ
diff --git a/src/ui/dist/assets/Import-15b3ffd5.css b/src/ui/dist/assets/Import-D3M1Q5kJ.css
similarity index 100%
rename from src/ui/dist/assets/Import-15b3ffd5.css
rename to src/ui/dist/assets/Import-D3M1Q5kJ.css
diff --git a/src/ui/dist/assets/Import-15b3ffd5.css.gz b/src/ui/dist/assets/Import-D3M1Q5kJ.css.gz
similarity index 100%
rename from src/ui/dist/assets/Import-15b3ffd5.css.gz
rename to src/ui/dist/assets/Import-D3M1Q5kJ.css.gz
diff --git a/src/ui/dist/assets/ImportLink-33e77c3a.js b/src/ui/dist/assets/ImportLink-33e77c3a.js
deleted file mode 100644
index 18d09f5ad..000000000
--- a/src/ui/dist/assets/ImportLink-33e77c3a.js
+++ /dev/null
@@ -1 +0,0 @@
-import{e as w,B as b,q as C,n as _,y as B,o as a,c as n,a as s,t as c,b as d,i as I,w as $,F as j,h as L,g as m,I as f,u as N,C as R,aH as V,_ as F}from"./index-4a15a213.js";const S={class:"max-w-[60ch] w-full h-full flex items-center justify-center"},q={class:"flex-col"},A={key:0,class:"text-muted italic text-sm"},D={class:"ml-0"},E={class:"flex gap-2 items-center"},H={class:"text-muted uppercase text-sm"},M=["onClick"],O={class:"buttons flex gap-2"},T=w({__name:"ImportLink",setup(z){const h=b(),l=C(),r=_(""),e=_([]);B(async()=>{const i=h.params.id,o=atob(i),[t,...u]=o.split(":");if(t==="gist"){const[p,v,y]=u,g=`https://gist.githubusercontent.com/${p}/${v}/raw/${y}`,k=await(await fetch(g)).json();e.value=[k],r.value=p}});const x=async()=>{await V(e.value),l.push("/")};return(i,o)=>(a(),n("div",S,[s("div",q,[s("strong",null,c(r.value),1),d(" wants to share: "),e.value.length==0?(a(),n("span",A,"Nothing")):(a(),I(R,{key:1,class:"p-4 mt-4 w-max flex flex-col gap-4"},{default:$(()=>[s("ul",D,[(a(!0),n(j,null,L(e.value,t=>(a(),n("li",E,[s("span",H,c(t.type),1),d(" "+c(t.playlist.name)+" ",1),s("span",{class:"material-symbols-rounded cursor-pointer",onClick:u=>e.value.splice(e.value.indexOf(t),1)}," delete ",8,M)]))),256))]),s("div",O,[m(f,{type:"success",icon:"check",label:"Accept",onClick:x}),m(f,{type:"danger",icon:"close",label:"Reject",onClick:o[0]||(o[0]=t=>N(l).push("/"))})])]),_:1}))])]))}});const K=F(T,[["__scopeId","data-v-608ea9fa"]]);export{K as default};
diff --git a/src/ui/dist/assets/ImportLink-33e77c3a.js.gz b/src/ui/dist/assets/ImportLink-33e77c3a.js.gz
deleted file mode 100644
index f9d0f12e0..000000000
Binary files a/src/ui/dist/assets/ImportLink-33e77c3a.js.gz and /dev/null differ
diff --git a/src/ui/dist/assets/ImportLink-fa9af2ae.css b/src/ui/dist/assets/ImportLink-CQI6kQMZ.css
similarity index 100%
rename from src/ui/dist/assets/ImportLink-fa9af2ae.css
rename to src/ui/dist/assets/ImportLink-CQI6kQMZ.css
diff --git a/src/ui/dist/assets/ImportLink-Qnxy-SGQ.js b/src/ui/dist/assets/ImportLink-Qnxy-SGQ.js
new file mode 100644
index 000000000..9f90ee128
--- /dev/null
+++ b/src/ui/dist/assets/ImportLink-Qnxy-SGQ.js
@@ -0,0 +1 @@
+import{e as w,B as b,q as C,n as d,y as B,o as a,c as n,a as s,t as c,b as _,i as I,w as $,F as j,h as N,g as m,I as f,u as L,C as R,aG as V,_ as F}from"./index-DnhwPdfm.js";const S={class:"max-w-[60ch] w-full h-full flex items-center justify-center"},q={class:"flex-col"},A={key:0,class:"text-muted italic text-sm"},D={class:"ml-0"},E={class:"flex gap-2 items-center"},G={class:"text-muted uppercase text-sm"},M=["onClick"],O={class:"buttons flex gap-2"},T=w({__name:"ImportLink",setup(z){const h=b(),l=C(),r=d(""),e=d([]);B(async()=>{const i=h.params.id,o=atob(i),[t,...u]=o.split(":");if(t==="gist"){const[p,g,v]=u,y=`https://gist.githubusercontent.com/${p}/${g}/raw/${v}`,k=await(await fetch(y)).json();e.value=[k],r.value=p}});const x=async()=>{await V(e.value),l.push("/")};return(i,o)=>(a(),n("div",S,[s("div",q,[s("strong",null,c(r.value),1),_(" wants to share: "),e.value.length==0?(a(),n("span",A,"Nothing")):(a(),I(R,{key:1,class:"p-4 mt-4 w-max flex flex-col gap-4"},{default:$(()=>[s("ul",D,[(a(!0),n(j,null,N(e.value,t=>(a(),n("li",E,[s("span",G,c(t.type),1),_(" "+c(t.playlist.name)+" ",1),s("span",{class:"material-symbols-rounded cursor-pointer",onClick:u=>e.value.splice(e.value.indexOf(t),1)}," delete ",8,M)]))),256))]),s("div",O,[m(f,{type:"success",icon:"check",label:"Accept",onClick:x}),m(f,{type:"danger",icon:"close",label:"Reject",onClick:o[0]||(o[0]=t=>L(l).push("/"))})])]),_:1}))])]))}}),K=F(T,[["__scopeId","data-v-608ea9fa"]]);export{K as default};
diff --git a/src/ui/dist/assets/ImportLink-Qnxy-SGQ.js.gz b/src/ui/dist/assets/ImportLink-Qnxy-SGQ.js.gz
new file mode 100644
index 000000000..1cad9ec1a
Binary files /dev/null and b/src/ui/dist/assets/ImportLink-Qnxy-SGQ.js.gz differ
diff --git a/src/ui/dist/assets/Insight-02bf27fd.js b/src/ui/dist/assets/Insight-02bf27fd.js
deleted file mode 100644
index 629b1d99c..000000000
--- a/src/ui/dist/assets/Insight-02bf27fd.js
+++ /dev/null
@@ -1,18 +0,0 @@
-var Kn=Object.defineProperty;var qn=(i,t,e)=>t in i?Kn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var S=(i,t,e)=>(qn(i,typeof t!="symbol"?t+"":t,e),e);import{e as Gn,n as Zt,a6 as Zn,aM as Qn,y as Jn,o as to,c as eo,g as wt,u as Mt,a7 as io,a as I,w as Vt,C as Nt,t as ei,F as so,l as no,m as oo,_ as ao}from"./index-4a15a213.js";/*!
- * @kurkle/color v0.3.2
- * https://github.com/kurkle/color#readme
- * (c) 2023 Jukka Kurkela
- * Released under the MIT License
- */function be(i){return i+.5|0}const gt=(i,t,e)=>Math.max(Math.min(i,e),t);function se(i){return gt(be(i*2.55),0,255)}function _t(i){return gt(be(i*255),0,255)}function dt(i){return gt(be(i/2.55)/100,0,1)}function Ni(i){return gt(be(i*100),0,100)}const Q={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},ui=[..."0123456789ABCDEF"],ro=i=>ui[i&15],lo=i=>ui[(i&240)>>4]+ui[i&15],ke=i=>(i&240)>>4===(i&15),co=i=>ke(i.r)&&ke(i.g)&&ke(i.b)&&ke(i.a);function ho(i){var t=i.length,e;return i[0]==="#"&&(t===4||t===5?e={r:255&Q[i[1]]*17,g:255&Q[i[2]]*17,b:255&Q[i[3]]*17,a:t===5?Q[i[4]]*17:255}:(t===7||t===9)&&(e={r:Q[i[1]]<<4|Q[i[2]],g:Q[i[3]]<<4|Q[i[4]],b:Q[i[5]]<<4|Q[i[6]],a:t===9?Q[i[7]]<<4|Q[i[8]]:255})),e}const fo=(i,t)=>i<255?t(i):"";function uo(i){var t=co(i)?ro:lo;return i?"#"+t(i.r)+t(i.g)+t(i.b)+fo(i.a,t):void 0}const go=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function on(i,t,e){const s=t*Math.min(e,1-e),n=(o,a=(o+i/30)%12)=>e-s*Math.max(Math.min(a-3,9-a,1),-1);return[n(0),n(8),n(4)]}function po(i,t,e){const s=(n,o=(n+i/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[s(5),s(3),s(1)]}function mo(i,t,e){const s=on(i,1,.5);let n;for(t+e>1&&(n=1/(t+e),t*=n,e*=n),n=0;n<3;n++)s[n]*=1-t-e,s[n]+=t;return s}function bo(i,t,e,s,n){return i===n?(t-e)/s+(t.5?h/(2-o-a):h/(o+a),l=bo(e,s,n,h,o),l=l*60+.5),[l|0,c||0,r]}function Pi(i,t,e,s){return(Array.isArray(t)?i(t[0],t[1],t[2]):i(t,e,s)).map(_t)}function Ci(i,t,e){return Pi(on,i,t,e)}function _o(i,t,e){return Pi(mo,i,t,e)}function xo(i,t,e){return Pi(po,i,t,e)}function an(i){return(i%360+360)%360}function yo(i){const t=go.exec(i);let e=255,s;if(!t)return;t[5]!==s&&(e=t[6]?se(+t[5]):_t(+t[5]));const n=an(+t[2]),o=+t[3]/100,a=+t[4]/100;return t[1]==="hwb"?s=_o(n,o,a):t[1]==="hsv"?s=xo(n,o,a):s=Ci(n,o,a),{r:s[0],g:s[1],b:s[2],a:e}}function vo(i,t){var e=Si(i);e[0]=an(e[0]+t),e=Ci(e),i.r=e[0],i.g=e[1],i.b=e[2]}function ko(i){if(!i)return;const t=Si(i),e=t[0],s=Ni(t[1]),n=Ni(t[2]);return i.a<255?`hsla(${e}, ${s}%, ${n}%, ${dt(i.a)})`:`hsl(${e}, ${s}%, ${n}%)`}const ji={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},$i={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function wo(){const i={},t=Object.keys($i),e=Object.keys(ji);let s,n,o,a,r;for(s=0;s>16&255,o>>8&255,o&255]}return i}let we;function Mo(i){we||(we=wo(),we.transparent=[0,0,0,0]);const t=we[i.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const So=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function Po(i){const t=So.exec(i);let e=255,s,n,o;if(t){if(t[7]!==s){const a=+t[7];e=t[8]?se(a):gt(a*255,0,255)}return s=+t[1],n=+t[3],o=+t[5],s=255&(t[2]?se(s):gt(s,0,255)),n=255&(t[4]?se(n):gt(n,0,255)),o=255&(t[6]?se(o):gt(o,0,255)),{r:s,g:n,b:o,a:e}}}function Co(i){return i&&(i.a<255?`rgba(${i.r}, ${i.g}, ${i.b}, ${dt(i.a)})`:`rgb(${i.r}, ${i.g}, ${i.b})`)}const ii=i=>i<=.0031308?i*12.92:Math.pow(i,1/2.4)*1.055-.055,jt=i=>i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4);function Do(i,t,e){const s=jt(dt(i.r)),n=jt(dt(i.g)),o=jt(dt(i.b));return{r:_t(ii(s+e*(jt(dt(t.r))-s))),g:_t(ii(n+e*(jt(dt(t.g))-n))),b:_t(ii(o+e*(jt(dt(t.b))-o))),a:i.a+e*(t.a-i.a)}}function Me(i,t,e){if(i){let s=Si(i);s[t]=Math.max(0,Math.min(s[t]+s[t]*e,t===0?360:1)),s=Ci(s),i.r=s[0],i.g=s[1],i.b=s[2]}}function rn(i,t){return i&&Object.assign(t||{},i)}function Yi(i){var t={r:0,g:0,b:0,a:255};return Array.isArray(i)?i.length>=3&&(t={r:i[0],g:i[1],b:i[2],a:255},i.length>3&&(t.a=_t(i[3]))):(t=rn(i,{r:0,g:0,b:0,a:1}),t.a=_t(t.a)),t}function Oo(i){return i.charAt(0)==="r"?Po(i):yo(i)}class de{constructor(t){if(t instanceof de)return t;const e=typeof t;let s;e==="object"?s=Yi(t):e==="string"&&(s=ho(t)||Mo(t)||Oo(t)),this._rgb=s,this._valid=!!s}get valid(){return this._valid}get rgb(){var t=rn(this._rgb);return t&&(t.a=dt(t.a)),t}set rgb(t){this._rgb=Yi(t)}rgbString(){return this._valid?Co(this._rgb):void 0}hexString(){return this._valid?uo(this._rgb):void 0}hslString(){return this._valid?ko(this._rgb):void 0}mix(t,e){if(t){const s=this.rgb,n=t.rgb;let o;const a=e===o?.5:e,r=2*a-1,l=s.a-n.a,c=((r*l===-1?r:(r+l)/(1+r*l))+1)/2;o=1-c,s.r=255&c*s.r+o*n.r+.5,s.g=255&c*s.g+o*n.g+.5,s.b=255&c*s.b+o*n.b+.5,s.a=a*s.a+(1-a)*n.a,this.rgb=s}return this}interpolate(t,e){return t&&(this._rgb=Do(this._rgb,t._rgb,e)),this}clone(){return new de(this.rgb)}alpha(t){return this._rgb.a=_t(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=be(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){const e=this._rgb;return e.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Me(this._rgb,2,t),this}darken(t){return Me(this._rgb,2,-t),this}saturate(t){return Me(this._rgb,1,t),this}desaturate(t){return Me(this._rgb,1,-t),this}rotate(t){return vo(this._rgb,t),this}}/*!
- * Chart.js v4.4.2
- * https://www.chartjs.org
- * (c) 2024 Chart.js Contributors
- * Released under the MIT License
- */function lt(){}const To=(()=>{let i=0;return()=>i++})();function A(i){return i===null||typeof i>"u"}function E(i){if(Array.isArray&&Array.isArray(i))return!0;const t=Object.prototype.toString.call(i);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function T(i){return i!==null&&Object.prototype.toString.call(i)==="[object Object]"}function V(i){return(typeof i=="number"||i instanceof Number)&&isFinite(+i)}function K(i,t){return V(i)?i:t}function D(i,t){return typeof i>"u"?t:i}const Lo=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100*t:+i;function R(i,t,e){if(i&&typeof i.call=="function")return i.apply(e,t)}function F(i,t,e,s){let n,o,a;if(E(i))if(o=i.length,s)for(n=o-1;n>=0;n--)t.call(e,i[n],n);else for(n=0;ni,x:i=>i.x,y:i=>i.y};function Io(i){const t=i.split("."),e=[];let s="";for(const n of t)s+=n,s.endsWith("\\")?s=s.slice(0,-1)+".":(e.push(s),s="");return e}function Ro(i){const t=Io(i);return e=>{for(const s of t){if(s==="")break;e=e&&e[s]}return e}}function Yt(i,t){return(Ui[t]||(Ui[t]=Ro(t)))(i)}function Di(i){return i.charAt(0).toUpperCase()+i.slice(1)}const ue=i=>typeof i<"u",xt=i=>typeof i=="function",Xi=(i,t)=>{if(i.size!==t.size)return!1;for(const e of i)if(!t.has(e))return!1;return!0};function Eo(i){return i.type==="mouseup"||i.type==="click"||i.type==="contextmenu"}const H=Math.PI,tt=2*H,zo=tt+H,Ue=Number.POSITIVE_INFINITY,Bo=H/180,q=H/2,St=H/4,Ki=H*2/3,pt=Math.log10,at=Math.sign;function le(i,t,e){return Math.abs(i-t)n-o).pop(),t}function Ut(i){return!isNaN(parseFloat(i))&&isFinite(i)}function Wo(i,t){const e=Math.round(i);return e-t<=i&&e+t>=i}function cn(i,t,e){let s,n,o;for(s=0,n=i.length;sl&&c=Math.min(t,e)-s&&i<=Math.max(t,e)+s}function Ti(i,t,e){e=e||(a=>i[a]1;)o=n+s>>1,e(o)?n=o:s=o;return{lo:n,hi:s}}const At=(i,t,e,s)=>Ti(i,e,s?n=>{const o=i[n][t];return oi[n][t]Ti(i,e,s=>i[s][t]>=e);function Yo(i,t,e){let s=0,n=i.length;for(;ss&&i[n-1]>e;)n--;return s>0||n{const s="_onData"+Di(e),n=i[e];Object.defineProperty(i,e,{configurable:!0,enumerable:!1,value(...o){const a=n.apply(this,o);return i._chartjs.listeners.forEach(r=>{typeof r[s]=="function"&&r[s](...o)}),a}})})}function Zi(i,t){const e=i._chartjs;if(!e)return;const s=e.listeners,n=s.indexOf(t);n!==-1&&s.splice(n,1),!(s.length>0)&&(dn.forEach(o=>{delete i[o]}),delete i._chartjs)}function fn(i){const t=new Set(i);return t.size===i.length?i:Array.from(t)}const un=function(){return typeof window>"u"?function(i){return i()}:window.requestAnimationFrame}();function gn(i,t){let e=[],s=!1;return function(...n){e=n,s||(s=!0,un.call(window,()=>{s=!1,i.apply(t,e)}))}}function Xo(i,t){let e;return function(...s){return t?(clearTimeout(e),e=setTimeout(i,t,s)):i.apply(this,s),t}}const Li=i=>i==="start"?"left":i==="end"?"right":"center",j=(i,t,e)=>i==="start"?t:i==="end"?e:(t+e)/2,Ko=(i,t,e,s)=>i===(s?"left":"right")?e:i==="center"?(t+e)/2:t;function pn(i,t,e){const s=t.length;let n=0,o=s;if(i._sorted){const{iScale:a,_parsed:r}=i,l=a.axis,{min:c,max:h,minDefined:d,maxDefined:f}=a.getUserBounds();d&&(n=G(Math.min(At(r,l,c).lo,e?s:At(t,l,a.getPixelForValue(c)).lo),0,s-1)),f?o=G(Math.max(At(r,a.axis,h,!0).hi+1,e?0:At(t,l,a.getPixelForValue(h),!0).hi+1),n,s)-n:o=s-n}return{start:n,count:o}}function mn(i){const{xScale:t,yScale:e,_scaleRanges:s}=i,n={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!s)return i._scaleRanges=n,!0;const o=s.xmin!==t.min||s.xmax!==t.max||s.ymin!==e.min||s.ymax!==e.max;return Object.assign(s,n),o}const Se=i=>i===0||i===1,Qi=(i,t,e)=>-(Math.pow(2,10*(i-=1))*Math.sin((i-t)*tt/e)),Ji=(i,t,e)=>Math.pow(2,-10*i)*Math.sin((i-t)*tt/e)+1,ce={linear:i=>i,easeInQuad:i=>i*i,easeOutQuad:i=>-i*(i-2),easeInOutQuad:i=>(i/=.5)<1?.5*i*i:-.5*(--i*(i-2)-1),easeInCubic:i=>i*i*i,easeOutCubic:i=>(i-=1)*i*i+1,easeInOutCubic:i=>(i/=.5)<1?.5*i*i*i:.5*((i-=2)*i*i+2),easeInQuart:i=>i*i*i*i,easeOutQuart:i=>-((i-=1)*i*i*i-1),easeInOutQuart:i=>(i/=.5)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2),easeInQuint:i=>i*i*i*i*i,easeOutQuint:i=>(i-=1)*i*i*i*i+1,easeInOutQuint:i=>(i/=.5)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2),easeInSine:i=>-Math.cos(i*q)+1,easeOutSine:i=>Math.sin(i*q),easeInOutSine:i=>-.5*(Math.cos(H*i)-1),easeInExpo:i=>i===0?0:Math.pow(2,10*(i-1)),easeOutExpo:i=>i===1?1:-Math.pow(2,-10*i)+1,easeInOutExpo:i=>Se(i)?i:i<.5?.5*Math.pow(2,10*(i*2-1)):.5*(-Math.pow(2,-10*(i*2-1))+2),easeInCirc:i=>i>=1?i:-(Math.sqrt(1-i*i)-1),easeOutCirc:i=>Math.sqrt(1-(i-=1)*i),easeInOutCirc:i=>(i/=.5)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1),easeInElastic:i=>Se(i)?i:Qi(i,.075,.3),easeOutElastic:i=>Se(i)?i:Ji(i,.075,.3),easeInOutElastic(i){return Se(i)?i:i<.5?.5*Qi(i*2,.1125,.45):.5+.5*Ji(i*2-1,.1125,.45)},easeInBack(i){return i*i*((1.70158+1)*i-1.70158)},easeOutBack(i){return(i-=1)*i*((1.70158+1)*i+1.70158)+1},easeInOutBack(i){let t=1.70158;return(i/=.5)<1?.5*(i*i*(((t*=1.525)+1)*i-t)):.5*((i-=2)*i*(((t*=1.525)+1)*i+t)+2)},easeInBounce:i=>1-ce.easeOutBounce(1-i),easeOutBounce(i){return i<1/2.75?7.5625*i*i:i<2/2.75?7.5625*(i-=1.5/2.75)*i+.75:i<2.5/2.75?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*(i-=2.625/2.75)*i+.984375},easeInOutBounce:i=>i<.5?ce.easeInBounce(i*2)*.5:ce.easeOutBounce(i*2-1)*.5+.5};function Ai(i){if(i&&typeof i=="object"){const t=i.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function ts(i){return Ai(i)?i:new de(i)}function si(i){return Ai(i)?i:new de(i).saturate(.5).darken(.1).hexString()}const qo=["x","y","borderWidth","radius","tension"],Go=["color","borderColor","backgroundColor"];function Zo(i){i.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),i.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),i.set("animations",{colors:{type:"color",properties:Go},numbers:{type:"number",properties:qo}}),i.describe("animations",{_fallback:"animation"}),i.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function Qo(i){i.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const es=new Map;function Jo(i,t){t=t||{};const e=i+JSON.stringify(t);let s=es.get(e);return s||(s=new Intl.NumberFormat(i,t),es.set(e,s)),s}function Fi(i,t,e){return Jo(t,e).format(i)}const bn={values(i){return E(i)?i:""+i},numeric(i,t,e){if(i===0)return"0";const s=this.chart.options.locale;let n,o=i;if(e.length>1){const c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(n="scientific"),o=ta(i,e)}const a=pt(Math.abs(o)),r=isNaN(a)?1:Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:n,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(l,this.options.ticks.format),Fi(i,s,l)},logarithmic(i,t,e){if(i===0)return"0";const s=e[t].significand||i/Math.pow(10,Math.floor(pt(i)));return[1,2,3,5,10,15].includes(s)||t>.8*e.length?bn.numeric.call(this,i,t,e):""}};function ta(i,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&i!==Math.floor(i)&&(e=i-Math.floor(i)),e}var Qe={formatters:bn};function ea(i){i.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Qe.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),i.route("scale.ticks","color","","color"),i.route("scale.grid","color","","borderColor"),i.route("scale.border","color","","borderColor"),i.route("scale.title","color","","color"),i.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),i.describe("scales",{_fallback:"scale"}),i.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Et=Object.create(null),pi=Object.create(null);function he(i,t){if(!t)return i;const e=t.split(".");for(let s=0,n=e.length;ss.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(s,n)=>si(n.backgroundColor),this.hoverBorderColor=(s,n)=>si(n.borderColor),this.hoverColor=(s,n)=>si(n.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return ni(this,t,e)}get(t){return he(this,t)}describe(t,e){return ni(pi,t,e)}override(t,e){return ni(Et,t,e)}route(t,e,s,n){const o=he(this,t),a=he(this,s),r="_"+e;Object.defineProperties(o,{[r]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const l=this[r],c=a[n];return T(l)?Object.assign({},c,l):D(l,c)},set(l){this[r]=l}}})}apply(t){t.forEach(e=>e(this))}}var z=new ia({_scriptable:i=>!i.startsWith("on"),_indexable:i=>i!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Zo,Qo,ea]);function sa(i){return!i||A(i.size)||A(i.family)?null:(i.style?i.style+" ":"")+(i.weight?i.weight+" ":"")+i.size+"px "+i.family}function Xe(i,t,e,s,n){let o=t[n];return o||(o=t[n]=i.measureText(n).width,e.push(n)),o>s&&(s=o),s}function na(i,t,e,s){s=s||{};let n=s.data=s.data||{},o=s.garbageCollect=s.garbageCollect||[];s.font!==t&&(n=s.data={},o=s.garbageCollect=[],s.font=t),i.save(),i.font=t;let a=0;const r=e.length;let l,c,h,d,f;for(l=0;le.length){for(l=0;l0&&i.stroke()}}function ft(i,t,e){return e=e||.5,!t||i&&i.x>t.left-e&&i.xt.top-e&&i.y0&&o.strokeColor!=="";let l,c;for(i.save(),i.font=n.string,ra(i,o),l=0;l+i||0;function xn(i,t){const e={},s=T(t),n=s?Object.keys(t):t,o=T(i)?s?a=>D(i[a],i[t[a]]):a=>i[a]:()=>i;for(const a of n)e[a]=ua(o(a));return e}function yn(i){return xn(i,{top:"y",right:"x",bottom:"y",left:"x"})}function Ft(i){return xn(i,["topLeft","topRight","bottomLeft","bottomRight"])}function $(i){const t=yn(i);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function W(i,t){i=i||{},t=t||z.font;let e=D(i.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let s=D(i.style,t.style);s&&!(""+s).match(da)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const n={family:D(i.family,t.family),lineHeight:fa(D(i.lineHeight,t.lineHeight),e),size:e,style:s,weight:D(i.weight,t.weight),string:""};return n.string=sa(n),n}function Pe(i,t,e,s){let n=!0,o,a,r;for(o=0,a=i.length;oe&&r===0?0:r+l;return{min:a(s,-Math.abs(o)),max:a(n,o)}}function yt(i,t){return Object.assign(Object.create(i),t)}function Ei(i,t=[""],e,s,n=()=>i[0]){const o=e||i;typeof s>"u"&&(s=Mn("_fallback",i));const a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:i,_rootScopes:o,_fallback:s,_getTarget:n,override:r=>Ei([r,...i],t,o,s)};return new Proxy(a,{deleteProperty(r,l){return delete r[l],delete r._keys,delete i[0][l],!0},get(r,l){return kn(r,l,()=>ka(l,t,i,r))},getOwnPropertyDescriptor(r,l){return Reflect.getOwnPropertyDescriptor(r._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(i[0])},has(r,l){return ns(r).includes(l)},ownKeys(r){return ns(r)},set(r,l,c){const h=r._storage||(r._storage=n());return r[l]=h[l]=c,delete r._keys,!0}})}function Xt(i,t,e,s){const n={_cacheable:!1,_proxy:i,_context:t,_subProxy:e,_stack:new Set,_descriptors:vn(i,s),setContext:o=>Xt(i,o,e,s),override:o=>Xt(i.override(o),t,e,s)};return new Proxy(n,{deleteProperty(o,a){return delete o[a],delete i[a],!0},get(o,a,r){return kn(o,a,()=>ma(o,a,r))},getOwnPropertyDescriptor(o,a){return o._descriptors.allKeys?Reflect.has(i,a)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(i,a)},getPrototypeOf(){return Reflect.getPrototypeOf(i)},has(o,a){return Reflect.has(i,a)},ownKeys(){return Reflect.ownKeys(i)},set(o,a,r){return i[a]=r,delete o[a],!0}})}function vn(i,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:s=t.indexable,_allKeys:n=t.allKeys}=i;return{allKeys:n,scriptable:e,indexable:s,isScriptable:xt(e)?e:()=>e,isIndexable:xt(s)?s:()=>s}}const pa=(i,t)=>i?i+Di(t):t,zi=(i,t)=>T(t)&&i!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function kn(i,t,e){if(Object.prototype.hasOwnProperty.call(i,t))return i[t];const s=e();return i[t]=s,s}function ma(i,t,e){const{_proxy:s,_context:n,_subProxy:o,_descriptors:a}=i;let r=s[t];return xt(r)&&a.isScriptable(t)&&(r=ba(t,r,i,e)),E(r)&&r.length&&(r=_a(t,r,i,a.isIndexable)),zi(t,r)&&(r=Xt(r,n,o&&o[t],a)),r}function ba(i,t,e,s){const{_proxy:n,_context:o,_subProxy:a,_stack:r}=e;if(r.has(i))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+i);r.add(i);let l=t(o,a||s);return r.delete(i),zi(i,l)&&(l=Bi(n._scopes,n,i,l)),l}function _a(i,t,e,s){const{_proxy:n,_context:o,_subProxy:a,_descriptors:r}=e;if(typeof o.index<"u"&&s(i))return t[o.index%t.length];if(T(t[0])){const l=t,c=n._scopes.filter(h=>h!==l);t=[];for(const h of l){const d=Bi(c,n,i,h);t.push(Xt(d,o,a&&a[i],r))}}return t}function wn(i,t,e){return xt(i)?i(t,e):i}const xa=(i,t)=>i===!0?t:typeof i=="string"?Yt(t,i):void 0;function ya(i,t,e,s,n){for(const o of t){const a=xa(e,o);if(a){i.add(a);const r=wn(a._fallback,e,n);if(typeof r<"u"&&r!==e&&r!==s)return r}else if(a===!1&&typeof s<"u"&&e!==s)return null}return!1}function Bi(i,t,e,s){const n=t._rootScopes,o=wn(t._fallback,e,s),a=[...i,...n],r=new Set;r.add(s);let l=ss(r,a,e,o||e,s);return l===null||typeof o<"u"&&o!==e&&(l=ss(r,a,o,l,s),l===null)?!1:Ei(Array.from(r),[""],n,o,()=>va(t,e,s))}function ss(i,t,e,s,n){for(;e;)e=ya(i,t,e,s,n);return e}function va(i,t,e){const s=i._getTarget();t in s||(s[t]={});const n=s[t];return E(n)&&T(e)?e:n||{}}function ka(i,t,e,s){let n;for(const o of t)if(n=Mn(pa(o,i),e),typeof n<"u")return zi(i,n)?Bi(e,s,i,n):n}function Mn(i,t){for(const e of t){if(!e)continue;const s=e[i];if(typeof s<"u")return s}}function ns(i){let t=i._keys;return t||(t=i._keys=wa(i._scopes)),t}function wa(i){const t=new Set;for(const e of i)for(const s of Object.keys(e).filter(n=>!n.startsWith("_")))t.add(s);return Array.from(t)}const Ma=Number.EPSILON||1e-14,Kt=(i,t)=>ti==="x"?"y":"x";function Sa(i,t,e,s){const n=i.skip?t:i,o=t,a=e.skip?t:e,r=gi(o,n),l=gi(a,o);let c=r/(r+l),h=l/(r+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const d=s*c,f=s*h;return{previous:{x:o.x-d*(a.x-n.x),y:o.y-d*(a.y-n.y)},next:{x:o.x+f*(a.x-n.x),y:o.y+f*(a.y-n.y)}}}function Pa(i,t,e){const s=i.length;let n,o,a,r,l,c=Kt(i,0);for(let h=0;h!c.skip)),t.cubicInterpolationMode==="monotone")Da(i,n);else{let c=s?i[i.length-1]:i[0];for(o=0,a=i.length;oi.ownerDocument.defaultView.getComputedStyle(i,null);function La(i,t){return Je(i).getPropertyValue(t)}const Aa=["top","right","bottom","left"];function It(i,t,e){const s={};e=e?"-"+e:"";for(let n=0;n<4;n++){const o=Aa[n];s[o]=parseFloat(i[t+"-"+o+e])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}const Fa=(i,t,e)=>(i>0||t>0)&&(!e||!e.shadowRoot);function Ia(i,t){const e=i.touches,s=e&&e.length?e[0]:i,{offsetX:n,offsetY:o}=s;let a=!1,r,l;if(Fa(n,o,i.target))r=n,l=o;else{const c=t.getBoundingClientRect();r=s.clientX-c.left,l=s.clientY-c.top,a=!0}return{x:r,y:l,box:a}}function Ot(i,t){if("native"in i)return i;const{canvas:e,currentDevicePixelRatio:s}=t,n=Je(e),o=n.boxSizing==="border-box",a=It(n,"padding"),r=It(n,"border","width"),{x:l,y:c,box:h}=Ia(i,e),d=a.left+(h&&r.left),f=a.top+(h&&r.top);let{width:u,height:p}=t;return o&&(u-=a.width+r.width,p-=a.height+r.height),{x:Math.round((l-d)/u*e.width/s),y:Math.round((c-f)/p*e.height/s)}}function Ra(i,t,e){let s,n;if(t===void 0||e===void 0){const o=Wi(i);if(!o)t=i.clientWidth,e=i.clientHeight;else{const a=o.getBoundingClientRect(),r=Je(o),l=It(r,"border","width"),c=It(r,"padding");t=a.width-c.width-l.width,e=a.height-c.height-l.height,s=Ke(r.maxWidth,o,"clientWidth"),n=Ke(r.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:s||Ue,maxHeight:n||Ue}}const De=i=>Math.round(i*10)/10;function Ea(i,t,e,s){const n=Je(i),o=It(n,"margin"),a=Ke(n.maxWidth,i,"clientWidth")||Ue,r=Ke(n.maxHeight,i,"clientHeight")||Ue,l=Ra(i,t,e);let{width:c,height:h}=l;if(n.boxSizing==="content-box"){const f=It(n,"border","width"),u=It(n,"padding");c-=u.width+f.width,h-=u.height+f.height}return c=Math.max(0,c-o.width),h=Math.max(0,s?c/s:h-o.height),c=De(Math.min(c,a,l.maxWidth)),h=De(Math.min(h,r,l.maxHeight)),c&&!h&&(h=De(c/2)),(t!==void 0||e!==void 0)&&s&&l.height&&h>l.height&&(h=l.height,c=De(Math.floor(h*s))),{width:c,height:h}}function os(i,t,e){const s=t||1,n=Math.floor(i.height*s),o=Math.floor(i.width*s);i.height=Math.floor(i.height),i.width=Math.floor(i.width);const a=i.canvas;return a.style&&(e||!a.style.height&&!a.style.width)&&(a.style.height=`${i.height}px`,a.style.width=`${i.width}px`),i.currentDevicePixelRatio!==s||a.height!==n||a.width!==o?(i.currentDevicePixelRatio=s,a.height=n,a.width=o,i.ctx.setTransform(s,0,0,s,0,0),!0):!1}const za=function(){let i=!1;try{const t={get passive(){return i=!0,!1}};Hi()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return i}();function as(i,t){const e=La(i,t),s=e&&e.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function Tt(i,t,e,s){return{x:i.x+e*(t.x-i.x),y:i.y+e*(t.y-i.y)}}function Ba(i,t,e,s){return{x:i.x+e*(t.x-i.x),y:s==="middle"?e<.5?i.y:t.y:s==="after"?e<1?i.y:t.y:e>0?t.y:i.y}}function Ha(i,t,e,s){const n={x:i.cp2x,y:i.cp2y},o={x:t.cp1x,y:t.cp1y},a=Tt(i,n,e),r=Tt(n,o,e),l=Tt(o,t,e),c=Tt(a,r,e),h=Tt(r,l,e);return Tt(c,h,e)}const Wa=function(i,t){return{x(e){return i+i+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,s){return e-s},leftForLtr(e,s){return e-s}}},Va=function(){return{x(i){return i},setWidth(i){},textAlign(i){return i},xPlus(i,t){return i+t},leftForLtr(i,t){return i}}};function $t(i,t,e){return i?Wa(t,e):Va()}function Pn(i,t){let e,s;(t==="ltr"||t==="rtl")&&(e=i.canvas.style,s=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),i.prevTextDirection=s)}function Cn(i,t){t!==void 0&&(delete i.prevTextDirection,i.canvas.style.setProperty("direction",t[0],t[1]))}function Dn(i){return i==="angle"?{between:hn,compare:No,normalize:et}:{between:Lt,compare:(t,e)=>t-e,normalize:t=>t}}function rs({start:i,end:t,count:e,loop:s,style:n}){return{start:i%e,end:t%e,loop:s&&(t-i+1)%e===0,style:n}}function Na(i,t,e){const{property:s,start:n,end:o}=e,{between:a,normalize:r}=Dn(s),l=t.length;let{start:c,end:h,loop:d}=i,f,u;if(d){for(c+=l,h+=l,f=0,u=l;fl(n,v,b)&&r(n,v)!==0,x=()=>r(o,b)===0||l(o,v,b),M=()=>g||y(),k=()=>!g||x();for(let w=h,P=h;w<=d;++w)_=t[w%a],!_.skip&&(b=c(_[s]),b!==v&&(g=l(b,n,o),m===null&&M()&&(m=r(b,n)===0?w:P),m!==null&&k()&&(p.push(rs({start:m,end:w,loop:f,count:a,style:u})),m=null),P=w,v=b));return m!==null&&p.push(rs({start:m,end:d,loop:f,count:a,style:u})),p}function $a(i,t){const e=[],s=i.segments;for(let n=0;nn&&i[o%t].skip;)o--;return o%=t,{start:n,end:o}}function Ua(i,t,e,s){const n=i.length,o=[];let a=t,r=i[t],l;for(l=t+1;l<=e;++l){const c=i[l%n];c.skip||c.stop?r.skip||(s=!1,o.push({start:t%n,end:(l-1)%n,loop:s}),t=a=c.stop?l:null):(a=l,r.skip&&(t=l)),r=c}return a!==null&&o.push({start:t%n,end:a%n,loop:s}),o}function Xa(i,t){const e=i.points,s=i.options.spanGaps,n=e.length;if(!n)return[];const o=!!i._loop,{start:a,end:r}=Ya(e,n,o,s);if(s===!0)return ls(i,[{start:a,end:r,loop:o}],e,t);const l=rr({chart:t,initial:e.initial,numSteps:a,currentStep:Math.min(s-e.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=un.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((s,n)=>{if(!s.running||!s.items.length)return;const o=s.items;let a=o.length-1,r=!1,l;for(;a>=0;--a)l=o[a],l._active?(l._total>s.duration&&(s.duration=l._total),l.tick(t),r=!0):(o[a]=o[o.length-1],o.pop());r&&(n.draw(),this._notify(n,s,t,"progress")),o.length||(s.running=!1,this._notify(n,s,t,"complete"),s.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let s=e.get(t);return s||(s={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,s)),s}listen(t,e,s){this._getAnims(t).listeners[e].push(s)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((s,n)=>Math.max(s,n._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const s=e.items;let n=s.length-1;for(;n>=0;--n)s[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var ct=new Ga;const hs="transparent",Za={boolean(i,t,e){return e>.5?t:i},color(i,t,e){const s=ts(i||hs),n=s.valid&&ts(t||hs);return n&&n.valid?n.mix(s,e).hexString():t},number(i,t,e){return i+(t-i)*e}};class Qa{constructor(t,e,s,n){const o=e[s];n=Pe([t.to,n,o,t.from]);const a=Pe([t.from,o,n]);this._active=!0,this._fn=t.fn||Za[t.type||typeof a],this._easing=ce[t.easing]||ce.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=s,this._from=a,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,s){if(this._active){this._notify(!1);const n=this._target[this._prop],o=s-this._start,a=this._duration-o;this._start=s,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=Pe([t.to,e,n,t.from]),this._from=Pe([t.from,n,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,s=this._duration,n=this._prop,o=this._from,a=this._loop,r=this._to;let l;if(this._active=o!==r&&(a||e1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[n]=this._fn(o,r,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,s)=>{t.push({res:e,rej:s})})}_notify(t){const e=t?"res":"rej",s=this._promises||[];for(let n=0;n{const o=t[n];if(!T(o))return;const a={};for(const r of e)a[r]=o[r];(E(o.properties)&&o.properties||[n]).forEach(r=>{(r===n||!s.has(r))&&s.set(r,a)})})}_animateOptions(t,e){const s=e.options,n=tr(t,s);if(!n)return[];const o=this._createAnimations(n,s);return s.$shared&&Ja(t.options.$animations,s).then(()=>{t.options=s},()=>{}),o}_createAnimations(t,e){const s=this._properties,n=[],o=t.$animations||(t.$animations={}),a=Object.keys(e),r=Date.now();let l;for(l=a.length-1;l>=0;--l){const c=a[l];if(c.charAt(0)==="$")continue;if(c==="options"){n.push(...this._animateOptions(t,e));continue}const h=e[c];let d=o[c];const f=s.get(c);if(d)if(f&&d.active()){d.update(f,h,r);continue}else d.cancel();if(!f||!f.duration){t[c]=h;continue}o[c]=d=new Qa(f,t,c,h),n.push(d)}return n}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const s=this._createAnimations(t,e);if(s.length)return ct.add(this._chart,s),!0}}function Ja(i,t){const e=[],s=Object.keys(t);for(let n=0;n0||!e&&o<0)return n.index}return null}function ps(i,t){const{chart:e,_cachedMeta:s}=i,n=e._stacks||(e._stacks={}),{iScale:o,vScale:a,index:r}=s,l=o.axis,c=a.axis,h=nr(o,a,s),d=t.length;let f;for(let u=0;ue[s].axis===t).shift()}function rr(i,t){return yt(i,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function lr(i,t,e){return yt(i,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function Qt(i,t){const e=i.controller.index,s=i.vScale&&i.vScale.axis;if(s){t=t||i._parsed;for(const n of t){const o=n._stacks;if(!o||o[s]===void 0||o[s][e]===void 0)return;delete o[s][e],o[s]._visualValues!==void 0&&o[s]._visualValues[e]!==void 0&&delete o[s]._visualValues[e]}}}const ai=i=>i==="reset"||i==="none",ms=(i,t)=>t?i:Object.assign({},i),cr=(i,t,e)=>i&&!t.hidden&&t._stacked&&{keys:Tn(e,!0),values:null};class Rt{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=us(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&Qt(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,s=this.getDataset(),n=(d,f,u,p)=>d==="x"?f:d==="r"?p:u,o=e.xAxisID=D(s.xAxisID,oi(t,"x")),a=e.yAxisID=D(s.yAxisID,oi(t,"y")),r=e.rAxisID=D(s.rAxisID,oi(t,"r")),l=e.indexAxis,c=e.iAxisID=n(l,o,a,r),h=e.vAxisID=n(l,a,o,r);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(a),e.rScale=this.getScaleForId(r),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Zi(this._data,this),t._stacked&&Qt(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),s=this._data;if(T(e))this._data=sr(e);else if(s!==e){if(s){Zi(s,this);const n=this._cachedMeta;Qt(n),n._parsed=[]}e&&Object.isExtensible(e)&&Uo(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,s=this.getDataset();let n=!1;this._dataCheck();const o=e._stacked;e._stacked=us(e.vScale,e),e.stack!==s.stack&&(n=!0,Qt(e),e.stack=s.stack),this._resyncElements(t),(n||o!==e._stacked)&&ps(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),s=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(s,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:s,_data:n}=this,{iScale:o,_stacked:a}=s,r=o.axis;let l=t===0&&e===n.length?!0:s._sorted,c=t>0&&s._parsed[t-1],h,d,f;if(this._parsing===!1)s._parsed=n,s._sorted=!0,f=n;else{E(n[t])?f=this.parseArrayData(s,n,t,e):T(n[t])?f=this.parseObjectData(s,n,t,e):f=this.parsePrimitiveData(s,n,t,e);const u=()=>d[r]===null||c&&d[r]g||d=0;--f)if(!p()){this.updateRangeFromParsed(c,t,u,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,s=[];let n,o,a;for(n=0,o=e.length;n=0&&tthis.getContext(s,n,e),g=c.resolveNamedOptions(f,u,p,d);return g.$shared&&(g.$shared=l,o[a]=Object.freeze(ms(g,l))),g}_resolveAnimations(t,e,s){const n=this.chart,o=this._cachedDataOpts,a=`animation-${e}`,r=o[a];if(r)return r;let l;if(n.options.animation!==!1){const h=this.chart.config,d=h.datasetAnimationScopeKeys(this._type,e),f=h.getOptionScopes(this.getDataset(),d);l=h.createResolver(f,this.getContext(t,s,e))}const c=new On(n,l&&l.animations);return l&&l._cacheable&&(o[a]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||ai(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const s=this.resolveDataElementOptions(t,e),n=this._sharedOptions,o=this.getSharedOptions(s),a=this.includeOptions(e,o)||o!==n;return this.updateSharedOptions(o,e,s),{sharedOptions:o,includeOptions:a}}updateElement(t,e,s,n){ai(n)?Object.assign(t,s):this._resolveAnimations(e,n).update(t,s)}updateSharedOptions(t,e,s){t&&!ai(e)&&this._resolveAnimations(void 0,e).update(t,s)}_setStyle(t,e,s,n){t.active=n;const o=this.getStyle(e,n);this._resolveAnimations(e,s,n).update(t,{options:!n&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,s){this._setStyle(t,s,"active",!1)}setHoverStyle(t,e,s){this._setStyle(t,s,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,s=this._cachedMeta.data;for(const[r,l,c]of this._syncList)this[r](l,c);this._syncList=[];const n=s.length,o=e.length,a=Math.min(o,n);a&&this.parse(0,a),o>n?this._insertElements(n,o-n,t):o{for(c.length+=e,r=c.length-1;r>=a;r--)c[r]=c[r-e]};for(l(o),r=t;rn-o))}return i._cache.$bar}function dr(i){const t=i.iScale,e=hr(t,i.type);let s=t._length,n,o,a,r;const l=()=>{a===32767||a===-32768||(ue(r)&&(s=Math.min(s,Math.abs(a-r)||s)),r=a)};for(n=0,o=e.length;n0?n[i-1]:null,r=iMath.abs(r)&&(l=r,c=a),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:n,end:o,min:a,max:r}}function Ln(i,t,e,s){return E(i)?gr(i,t,e,s):t[e.axis]=e.parse(i,s),t}function bs(i,t,e,s){const n=i.iScale,o=i.vScale,a=n.getLabels(),r=n===o,l=[];let c,h,d,f;for(c=e,h=e+s;c=e?1:-1)}function mr(i){let t,e,s,n,o;return i.horizontal?(t=i.base>i.x,e="left",s="right"):(t=i.basel.controller.options.grouped),o=s.options.stacked,a=[],r=l=>{const c=l.controller.getParsed(e),h=c&&c[l.vScale.axis];if(A(h)||isNaN(h))return!0};for(const l of n)if(!(e!==void 0&&r(l))&&((o===!1||a.indexOf(l.stack)===-1||o===void 0&&l.stack===void 0)&&a.push(l.stack),l.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,s){const n=this._getStacks(t,s),o=e!==void 0?n.indexOf(e):-1;return o===-1?n.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,s=e.iScale,n=[];let o,a;for(o=0,a=e.data.length;o0&&this.getParsed(e-1);for(let x=0;x=_){k.skip=!0;continue}const w=this.getParsed(x),P=A(w[u]),O=k[f]=a.getPixelForValue(w[f],x),C=k[u]=o||P?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,w,l):w[u],x);k.skip=isNaN(O)||isNaN(C)||P,k.stop=x>0&&Math.abs(w[f]-y[f])>m,g&&(k.parsed=w,k.raw=c.data[x]),d&&(k.options=h||this.resolveDataElementOptions(x,M.active?"active":n)),b||this.updateElement(M,x,k,n),y=w}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,s=e.options&&e.options.borderWidth||0,n=t.data||[];if(!n.length)return s;const o=n[0].size(this.resolveDataElementOptions(0)),a=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(s,o,a)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}S(Be,"id","line"),S(Be,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),S(Be,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class He extends Rt{getLabelAndValue(t){const e=this._cachedMeta,s=this.chart.data.labels||[],{xScale:n,yScale:o}=e,a=this.getParsed(t),r=n.getLabelForValue(a.x),l=o.getLabelForValue(a.y);return{label:s[t]||"",value:"("+r+", "+l+")"}}update(t){const e=this._cachedMeta,{data:s=[]}=e,n=this.chart._animationsDisabled;let{start:o,count:a}=pn(e,s,n);if(this._drawStart=o,this._drawCount=a,mn(e)&&(o=0,a=s.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:r,_dataset:l}=e;r._chart=this.chart,r._datasetIndex=this.index,r._decimated=!!l._decimated,r.points=s;const c=this.resolveDatasetElementOptions(t);c.segment=this.options.segment,this.updateElement(r,void 0,{animated:!n,options:c},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(s,o,a,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,s,n){const o=n==="reset",{iScale:a,vScale:r,_stacked:l,_dataset:c}=this._cachedMeta,h=this.resolveDataElementOptions(e,n),d=this.getSharedOptions(h),f=this.includeOptions(n,d),u=a.axis,p=r.axis,{spanGaps:g,segment:m}=this.options,b=Ut(g)?g:Number.POSITIVE_INFINITY,_=this.chart._animationsDisabled||o||n==="none";let v=e>0&&this.getParsed(e-1);for(let y=e;y0&&Math.abs(M[u]-v[u])>b,m&&(k.parsed=M,k.raw=c.data[y]),f&&(k.options=d||this.resolveDataElementOptions(y,x.active?"active":n)),_||this.updateElement(x,y,k,n),v=M}this.updateSharedOptions(d,n,h)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let r=0;for(let l=e.length-1;l>=0;--l)r=Math.max(r,e[l].size(this.resolveDataElementOptions(l))/2);return r>0&&r}const s=t.dataset,n=s.options&&s.options.borderWidth||0;if(!e.length)return n;const o=e[0].size(this.resolveDataElementOptions(0)),a=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(n,o,a)/2}}S(He,"id","scatter"),S(He,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),S(He,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}});function Ct(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Vi{constructor(t){S(this,"options");this.options=t||{}}static override(t){Object.assign(Vi.prototype,t)}init(){}formats(){return Ct()}parse(){return Ct()}format(){return Ct()}add(){return Ct()}diff(){return Ct()}startOf(){return Ct()}endOf(){return Ct()}}var yr={_date:Vi};function vr(i,t,e,s){const{controller:n,data:o,_sorted:a}=i,r=n._cachedMeta.iScale;if(r&&t===r.axis&&t!=="r"&&a&&o.length){const l=r._reversePixels?$o:At;if(s){if(n._sharedOptions){const c=o[0],h=typeof c.getRange=="function"&&c.getRange(t);if(h){const d=l(o,t,e-h),f=l(o,t,e+h);return{lo:d.lo,hi:f.hi}}}}else return l(o,t,e)}return{lo:0,hi:o.length-1}}function _e(i,t,e,s,n){const o=i.getSortedVisibleDatasetMetas(),a=e[t];for(let r=0,l=o.length;r{l[a](t[e],n)&&(o.push({element:l,datasetIndex:c,index:h}),r=r||l.inRange(t.x,t.y,n))}),s&&!r?[]:o}var Sr={evaluateInteractionItems:_e,modes:{index(i,t,e,s){const n=Ot(t,i),o=e.axis||"x",a=e.includeInvisible||!1,r=e.intersect?li(i,n,o,s,a):ci(i,n,o,!1,s,a),l=[];return r.length?(i.getSortedVisibleDatasetMetas().forEach(c=>{const h=r[0].index,d=c.data[h];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:h})}),l):[]},dataset(i,t,e,s){const n=Ot(t,i),o=e.axis||"xy",a=e.includeInvisible||!1;let r=e.intersect?li(i,n,o,s,a):ci(i,n,o,!1,s,a);if(r.length>0){const l=r[0].datasetIndex,c=i.getDatasetMeta(l).data;r=[];for(let h=0;he.pos===t)}function vs(i,t){return i.filter(e=>An.indexOf(e.pos)===-1&&e.box.axis===t)}function te(i,t){return i.sort((e,s)=>{const n=t?s:e,o=t?e:s;return n.weight===o.weight?n.index-o.index:n.weight-o.weight})}function Pr(i){const t=[];let e,s,n,o,a,r;for(e=0,s=(i||[]).length;ec.box.fullSize),!0),s=te(Jt(t,"left"),!0),n=te(Jt(t,"right")),o=te(Jt(t,"top"),!0),a=te(Jt(t,"bottom")),r=vs(t,"x"),l=vs(t,"y");return{fullSize:e,leftAndTop:s.concat(o),rightAndBottom:n.concat(l).concat(a).concat(r),chartArea:Jt(t,"chartArea"),vertical:s.concat(n).concat(l),horizontal:o.concat(a).concat(r)}}function ks(i,t,e,s){return Math.max(i[e],t[e])+Math.max(i[s],t[s])}function Fn(i,t){i.top=Math.max(i.top,t.top),i.left=Math.max(i.left,t.left),i.bottom=Math.max(i.bottom,t.bottom),i.right=Math.max(i.right,t.right)}function Tr(i,t,e,s){const{pos:n,box:o}=e,a=i.maxPadding;if(!T(n)){e.size&&(i[n]-=e.size);const d=s[e.stack]||{size:0,count:1};d.size=Math.max(d.size,e.horizontal?o.height:o.width),e.size=d.size/d.count,i[n]+=e.size}o.getPadding&&Fn(a,o.getPadding());const r=Math.max(0,t.outerWidth-ks(a,i,"left","right")),l=Math.max(0,t.outerHeight-ks(a,i,"top","bottom")),c=r!==i.w,h=l!==i.h;return i.w=r,i.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function Lr(i){const t=i.maxPadding;function e(s){const n=Math.max(t[s]-i[s],0);return i[s]+=n,n}i.y+=e("top"),i.x+=e("left"),e("right"),e("bottom")}function Ar(i,t){const e=t.maxPadding;function s(n){const o={left:0,top:0,right:0,bottom:0};return n.forEach(a=>{o[a]=Math.max(t[a],e[a])}),o}return s(i?["left","right"]:["top","bottom"])}function ne(i,t,e,s){const n=[];let o,a,r,l,c,h;for(o=0,a=i.length,c=0;o{typeof g.beforeLayout=="function"&&g.beforeLayout()});const h=l.reduce((g,m)=>m.box.options&&m.box.options.display===!1?g:g+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:e,padding:n,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/h,hBoxMaxHeight:a/2}),f=Object.assign({},n);Fn(f,$(s));const u=Object.assign({maxPadding:f,w:o,h:a,x:n.left,y:n.top},n),p=Dr(l.concat(c),d);ne(r.fullSize,u,d,p),ne(l,u,d,p),ne(c,u,d,p)&&ne(l,u,d,p),Lr(u),ws(r.leftAndTop,u,d,p),u.x+=u.w,u.y+=u.h,ws(r.rightAndBottom,u,d,p),i.chartArea={left:u.left,top:u.top,right:u.left+u.w,bottom:u.top+u.h,height:u.h,width:u.w},F(r.chartArea,g=>{const m=g.box;Object.assign(m,i.chartArea),m.update(u.w,u.h,{left:0,top:0,right:0,bottom:0})})}};class In{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,s){}removeEventListener(t,e,s){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,s,n){return e=Math.max(0,e||t.width),s=s||t.height,{width:e,height:Math.max(0,n?Math.floor(e/n):s)}}isAttached(t){return!0}updateConfig(t){}}class Fr extends In{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const We="$chartjs",Ir={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Ms=i=>i===null||i==="";function Rr(i,t){const e=i.style,s=i.getAttribute("height"),n=i.getAttribute("width");if(i[We]={initial:{height:s,width:n,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",Ms(n)){const o=as(i,"width");o!==void 0&&(i.width=o)}if(Ms(s))if(i.style.height==="")i.height=i.width/(t||2);else{const o=as(i,"height");o!==void 0&&(i.height=o)}return i}const Rn=za?{passive:!0}:!1;function Er(i,t,e){i&&i.addEventListener(t,e,Rn)}function zr(i,t,e){i&&i.canvas&&i.canvas.removeEventListener(t,e,Rn)}function Br(i,t){const e=Ir[i.type]||i.type,{x:s,y:n}=Ot(i,t);return{type:e,chart:t,native:i,x:s!==void 0?s:null,y:n!==void 0?n:null}}function qe(i,t){for(const e of i)if(e===t||e.contains(t))return!0}function Hr(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||qe(r.addedNodes,s),a=a&&!qe(r.removedNodes,s);a&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}function Wr(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||qe(r.removedNodes,s),a=a&&!qe(r.addedNodes,s);a&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}const pe=new Map;let Ss=0;function En(){const i=window.devicePixelRatio;i!==Ss&&(Ss=i,pe.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function Vr(i,t){pe.size||window.addEventListener("resize",En),pe.set(i,t)}function Nr(i){pe.delete(i),pe.size||window.removeEventListener("resize",En)}function jr(i,t,e){const s=i.canvas,n=s&&Wi(s);if(!n)return;const o=gn((r,l)=>{const c=n.clientWidth;e(r,l),c{const l=r[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||o(c,h)});return a.observe(n),Vr(i,o),a}function hi(i,t,e){e&&e.disconnect(),t==="resize"&&Nr(i)}function $r(i,t,e){const s=i.canvas,n=gn(o=>{i.ctx!==null&&e(Br(o,i))},i);return Er(s,t,n),n}class Yr extends In{acquireContext(t,e){const s=t&&t.getContext&&t.getContext("2d");return s&&s.canvas===t?(Rr(t,e),s):null}releaseContext(t){const e=t.canvas;if(!e[We])return!1;const s=e[We].initial;["height","width"].forEach(o=>{const a=s[o];A(a)?e.removeAttribute(o):e.setAttribute(o,a)});const n=s.style||{};return Object.keys(n).forEach(o=>{e.style[o]=n[o]}),e.width=e.width,delete e[We],!0}addEventListener(t,e,s){this.removeEventListener(t,e);const n=t.$proxies||(t.$proxies={}),a={attach:Hr,detach:Wr,resize:jr}[e]||$r;n[e]=a(t,e,s)}removeEventListener(t,e){const s=t.$proxies||(t.$proxies={}),n=s[e];if(!n)return;({attach:hi,detach:hi,resize:hi}[e]||zr)(t,e,n),s[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,s,n){return Ea(t,e,s,n)}isAttached(t){const e=Wi(t);return!!(e&&e.isConnected)}}function Ur(i){return!Hi()||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?Fr:Yr}class rt{constructor(){S(this,"x");S(this,"y");S(this,"active",!1);S(this,"options");S(this,"$animations")}tooltipPosition(t){const{x:e,y:s}=this.getProps(["x","y"],t);return{x:e,y:s}}hasValue(){return Ut(this.x)&&Ut(this.y)}getProps(t,e){const s=this.$animations;if(!e||!s)return this;const n={};return t.forEach(o=>{n[o]=s[o]&&s[o].active()?s[o]._to:this[o]}),n}}S(rt,"defaults",{}),S(rt,"defaultRoutes");function Xr(i,t){const e=i.options.ticks,s=Kr(i),n=Math.min(e.maxTicksLimit||s,s),o=e.major.enabled?Gr(t):[],a=o.length,r=o[0],l=o[a-1],c=[];if(a>n)return Zr(t,c,o,a/n),c;const h=qr(o,t,n);if(a>0){let d,f;const u=a>1?Math.round((l-r)/(a-1)):null;for(Te(t,c,h,A(u)?0:r-u,r),d=0,f=a-1;dn)return l}return Math.max(n,1)}function Gr(i){const t=[];let e,s;for(e=0,s=i.length;ei==="left"?"right":i==="right"?"left":i,Ps=(i,t,e)=>t==="top"||t==="left"?i[t]+e:i[t]-e,Cs=(i,t)=>Math.min(t||i,i);function Ds(i,t){const e=[],s=i.length/t,n=i.length;let o=0;for(;oa+r)))return l}function el(i,t){F(i,e=>{const s=e.gc,n=s.length/2;let o;if(n>t){for(o=0;os?s:e,s=n&&e>s?e:s,{min:K(e,K(s,e)),max:K(s,K(e,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){R(this.options.beforeUpdate,[this])}update(t,e,s){const{beginAtZero:n,grace:o,ticks:a}=this.options,r=a.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=s=Object.assign({left:0,right:0,top:0,bottom:0},s),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+s.left+s.right:this.height+s.top+s.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=ga(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=r=o||s<=1||!this.isHorizontal()){this.labelRotation=n;return}const h=this._getLabelSizes(),d=h.widest.width,f=h.highest.height,u=G(this.chart.width-d,0,this.maxWidth);r=t.offset?this.maxWidth/s:u/(s-1),d+6>r&&(r=u/(s-(t.offset?.5:1)),l=this.maxHeight-ee(t.grid)-e.padding-Os(t.title,this.chart.options.font),c=Math.sqrt(d*d+f*f),a=Oi(Math.min(Math.asin(G((h.highest.height+6)/r,-1,1)),Math.asin(G(l/c,-1,1))-Math.asin(G(f/c,-1,1)))),a=Math.max(n,Math.min(o,a))),this.labelRotation=a}afterCalculateLabelRotation(){R(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){R(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:s,title:n,grid:o}}=this,a=this._isVisible(),r=this.isHorizontal();if(a){const l=Os(n,e.options.font);if(r?(t.width=this.maxWidth,t.height=ee(o)+l):(t.height=this.maxHeight,t.width=ee(o)+l),s.display&&this.ticks.length){const{first:c,last:h,widest:d,highest:f}=this._getLabelSizes(),u=s.padding*2,p=mt(this.labelRotation),g=Math.cos(p),m=Math.sin(p);if(r){const b=s.mirror?0:m*d.width+g*f.height;t.height=Math.min(this.maxHeight,t.height+b+u)}else{const b=s.mirror?0:g*d.width+m*f.height;t.width=Math.min(this.maxWidth,t.width+b+u)}this._calculatePadding(c,h,m,g)}}this._handleMargins(),r?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,s,n){const{ticks:{align:o,padding:a},position:r}=this.options,l=this.labelRotation!==0,c=r!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,u=0;l?c?(f=n*t.width,u=s*e.height):(f=s*t.height,u=n*e.width):o==="start"?u=e.width:o==="end"?f=t.width:o!=="inner"&&(f=t.width/2,u=e.width/2),this.paddingLeft=Math.max((f-h+a)*this.width/(this.width-h),0),this.paddingRight=Math.max((u-d+a)*this.width/(this.width-d),0)}else{let h=e.height/2,d=t.height/2;o==="start"?(h=0,d=t.height):o==="end"&&(h=e.height,d=0),this.paddingTop=h+a,this.paddingBottom=d+a}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){R(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,s;for(e=0,s=t.length;e({width:a[P]||0,height:r[P]||0});return{first:w(0),last:w(e-1),widest:w(M),highest:w(k),widths:a,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return jo(this._alignToPixels?Pt(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&tr*n?r/s:l/n:l*n0}_computeGridLineItems(t){const e=this.axis,s=this.chart,n=this.options,{grid:o,position:a,border:r}=n,l=o.offset,c=this.isHorizontal(),d=this.ticks.length+(l?1:0),f=ee(o),u=[],p=r.setContext(this.getContext()),g=p.display?p.width:0,m=g/2,b=function(N){return Pt(s,N,g)};let _,v,y,x,M,k,w,P,O,C,L,Y;if(a==="top")_=b(this.bottom),k=this.bottom-f,P=_-m,C=b(t.top)+m,Y=t.bottom;else if(a==="bottom")_=b(this.top),C=t.top,Y=b(t.bottom)-m,k=_+m,P=this.top+f;else if(a==="left")_=b(this.right),M=this.right-f,w=_-m,O=b(t.left)+m,L=t.right;else if(a==="right")_=b(this.left),O=t.left,L=b(t.right)-m,M=_+m,w=this.left+f;else if(e==="x"){if(a==="center")_=b((t.top+t.bottom)/2+.5);else if(T(a)){const N=Object.keys(a)[0],Z=a[N];_=b(this.chart.scales[N].getPixelForValue(Z))}C=t.top,Y=t.bottom,k=_+m,P=k+f}else if(e==="y"){if(a==="center")_=b((t.left+t.right)/2);else if(T(a)){const N=Object.keys(a)[0],Z=a[N];_=b(this.chart.scales[N].getPixelForValue(Z))}M=_-m,w=M-f,O=t.left,L=t.right}const st=D(n.ticks.maxTicksLimit,d),B=Math.max(1,Math.ceil(d/st));for(v=0;v0&&(kt-=vt/2);break}ve={left:kt,top:Gt,width:vt+Wt.width,height:qt+Wt.height,color:B.backdropColor}}m.push({label:y,font:P,textOffset:L,options:{rotation:g,color:Z,strokeColor:xe,strokeWidth:ye,textAlign:Ht,textBaseline:Y,translation:[x,M],backdrop:ve}})}return m}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-mt(this.labelRotation))return t==="top"?"left":"right";let n="center";return e.align==="start"?n="left":e.align==="end"?n="right":e.align==="inner"&&(n="inner"),n}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:s,mirror:n,padding:o}}=this.options,a=this._getLabelSizes(),r=t+o,l=a.widest.width;let c,h;return e==="left"?n?(h=this.right+o,s==="near"?c="left":s==="center"?(c="center",h+=l/2):(c="right",h+=l)):(h=this.right-r,s==="near"?c="right":s==="center"?(c="center",h-=l/2):(c="left",h=this.left)):e==="right"?n?(h=this.left+o,s==="near"?c="right":s==="center"?(c="center",h-=l/2):(c="left",h-=l)):(h=this.left+r,s==="near"?c="left":s==="center"?(c="center",h+=l/2):(c="right",h=this.right)):c="right",{textAlign:c,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:s,top:n,width:o,height:a}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(s,n,o,a),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const n=this.ticks.findIndex(o=>o.value===t);return n>=0?e.setContext(this.getContext(n)).lineWidth:0}drawGrid(t){const e=this.options.grid,s=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,a;const r=(l,c,h)=>{!h.width||!h.color||(s.save(),s.lineWidth=h.width,s.strokeStyle=h.color,s.setLineDash(h.borderDash||[]),s.lineDashOffset=h.borderDashOffset,s.beginPath(),s.moveTo(l.x,l.y),s.lineTo(c.x,c.y),s.stroke(),s.restore())};if(e.display)for(o=0,a=n.length;o{this.draw(o)}}]:[{z:s,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),s=this.axis+"AxisID",n=[];let o,a;for(o=0,a=e.length;o{const s=e.split("."),n=s.pop(),o=[i].concat(s).join("."),a=t[e].split("."),r=a.pop(),l=a.join(".");z.route(o,n,l,r)})}function ll(i){return"id"in i&&"defaults"in i}class cl{constructor(){this.controllers=new Le(Rt,"datasets",!0),this.elements=new Le(rt,"elements"),this.plugins=new Le(Object,"plugins"),this.scales=new Le(Bt,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,s){[...e].forEach(n=>{const o=s||this._getRegistryForType(n);s||o.isForType(n)||o===this.plugins&&n.id?this._exec(t,o,n):F(n,a=>{const r=s||this._getRegistryForType(a);this._exec(t,r,a)})})}_exec(t,e,s){const n=Di(t);R(s["before"+n],[],s),e[t](s),R(s["after"+n],[],s)}_getRegistryForType(t){for(let e=0;eo.filter(r=>!a.some(l=>r.plugin.id===l.plugin.id));this._notify(n(e,s),t,"stop"),this._notify(n(s,e),t,"start")}}function dl(i){const t={},e=[],s=Object.keys(ot.plugins.items);for(let o=0;o1&&Ts(i[0].toLowerCase());if(s)return s}throw new Error(`Cannot determine type of '${i}' axis. Please provide 'axis' or 'position' option.`)}function Ls(i,t,e){if(e[t+"AxisID"]===i)return{axis:t}}function _l(i,t){if(t.data&&t.data.datasets){const e=t.data.datasets.filter(s=>s.xAxisID===i||s.yAxisID===i);if(e.length)return Ls(i,"x",e[0])||Ls(i,"y",e[0])}return{}}function xl(i,t){const e=Et[i.type]||{scales:{}},s=t.scales||{},n=bi(i.type,t),o=Object.create(null);return Object.keys(s).forEach(a=>{const r=s[a];if(!T(r))return console.error(`Invalid scale configuration for scale: ${a}`);if(r._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);const l=_i(a,r,_l(a,i),z.scales[r.type]),c=ml(l,n),h=e.scales||{};o[a]=re(Object.create(null),[{axis:l},r,h[l],h[c]])}),i.data.datasets.forEach(a=>{const r=a.type||i.type,l=a.indexAxis||bi(r,t),h=(Et[r]||{}).scales||{};Object.keys(h).forEach(d=>{const f=pl(d,l),u=a[f+"AxisID"]||f;o[u]=o[u]||Object.create(null),re(o[u],[{axis:f},s[u],h[d]])})}),Object.keys(o).forEach(a=>{const r=o[a];re(r,[z.scales[r.type],z.scale])}),o}function zn(i){const t=i.options||(i.options={});t.plugins=D(t.plugins,{}),t.scales=xl(i,t)}function Bn(i){return i=i||{},i.datasets=i.datasets||[],i.labels=i.labels||[],i}function yl(i){return i=i||{},i.data=Bn(i.data),zn(i),i}const As=new Map,Hn=new Set;function Ae(i,t){let e=As.get(i);return e||(e=t(),As.set(i,e),Hn.add(e)),e}const ie=(i,t,e)=>{const s=Yt(t,e);s!==void 0&&i.add(s)};class vl{constructor(t){this._config=yl(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Bn(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),zn(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Ae(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return Ae(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return Ae(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,s=this.type;return Ae(`${s}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const s=this._scopeCache;let n=s.get(t);return(!n||e)&&(n=new Map,s.set(t,n)),n}getOptionScopes(t,e,s){const{options:n,type:o}=this,a=this._cachedScopes(t,s),r=a.get(e);if(r)return r;const l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(d=>ie(l,t,d))),h.forEach(d=>ie(l,n,d)),h.forEach(d=>ie(l,Et[o]||{},d)),h.forEach(d=>ie(l,z,d)),h.forEach(d=>ie(l,pi,d))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Hn.has(e)&&a.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,Et[e]||{},z.datasets[e]||{},{type:e},z,pi]}resolveNamedOptions(t,e,s,n=[""]){const o={$shared:!0},{resolver:a,subPrefixes:r}=Fs(this._resolverCache,t,n);let l=a;if(wl(a,e)){o.$shared=!1,s=xt(s)?s():s;const c=this.createResolver(t,s,r);l=Xt(a,s,c)}for(const c of e)o[c]=l[c];return o}createResolver(t,e,s=[""],n){const{resolver:o}=Fs(this._resolverCache,t,s);return T(e)?Xt(o,e,void 0,n):o}}function Fs(i,t,e){let s=i.get(t);s||(s=new Map,i.set(t,s));const n=e.join();let o=s.get(n);return o||(o={resolver:Ei(t,e),subPrefixes:e.filter(r=>!r.toLowerCase().includes("hover"))},s.set(n,o)),o}const kl=i=>T(i)&&Object.getOwnPropertyNames(i).some(t=>xt(i[t]));function wl(i,t){const{isScriptable:e,isIndexable:s}=vn(i);for(const n of t){const o=e(n),a=s(n),r=(a||o)&&i[n];if(o&&(xt(r)||kl(r))||a&&E(r))return!0}return!1}var Ml="4.4.2";const Sl=["top","bottom","left","right","chartArea"];function Is(i,t){return i==="top"||i==="bottom"||Sl.indexOf(i)===-1&&t==="x"}function Rs(i,t){return function(e,s){return e[i]===s[i]?e[t]-s[t]:e[i]-s[i]}}function Es(i){const t=i.chart,e=t.options.animation;t.notifyPlugins("afterRender"),R(e&&e.onComplete,[i],t)}function Pl(i){const t=i.chart,e=t.options.animation;R(e&&e.onProgress,[i],t)}function Wn(i){return Hi()&&typeof i=="string"?i=document.getElementById(i):i&&i.length&&(i=i[0]),i&&i.canvas&&(i=i.canvas),i}const Ve={},zs=i=>{const t=Wn(i);return Object.values(Ve).filter(e=>e.canvas===t).pop()};function Cl(i,t,e){const s=Object.keys(i);for(const n of s){const o=+n;if(o>=t){const a=i[n];delete i[n],(e>0||o>t)&&(i[o+e]=a)}}}function Dl(i,t,e,s){return!e||i.type==="mouseout"?null:s?t:i}function Fe(i,t,e){return i.options.clip?i[e]:t[e]}function Ol(i,t){const{xScale:e,yScale:s}=i;return e&&s?{left:Fe(e,t,"left"),right:Fe(e,t,"right"),top:Fe(s,t,"top"),bottom:Fe(s,t,"bottom")}:t}class it{static register(...t){ot.add(...t),Bs()}static unregister(...t){ot.remove(...t),Bs()}constructor(t,e){const s=this.config=new vl(e),n=Wn(t),o=zs(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const a=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||Ur(n)),this.platform.updateConfig(s);const r=this.platform.acquireContext(n,a.aspectRatio),l=r&&r.canvas,c=l&&l.height,h=l&&l.width;if(this.id=To(),this.ctx=r,this.canvas=l,this.width=h,this.height=c,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new hl,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Xo(d=>this.update(d),a.resizeDelay||0),this._dataChanges=[],Ve[this.id]=this,!r||!l){console.error("Failed to create chart: can't acquire context from the given item");return}ct.listen(this,"complete",Es),ct.listen(this,"progress",Pl),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:s,height:n,_aspectRatio:o}=this;return A(t)?e&&o?o:n?s/n:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return ot}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():os(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return is(this.canvas,this.ctx),this}stop(){return ct.stop(this),this}resize(t,e){ct.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const s=this.options,n=this.canvas,o=s.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(n,t,e,o),r=s.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,os(this,r,!0)&&(this.notifyPlugins("resize",{size:a}),R(s.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};F(e,(s,n)=>{s.id=n})}buildOrUpdateScales(){const t=this.options,e=t.scales,s=this.scales,n=Object.keys(s).reduce((a,r)=>(a[r]=!1,a),{});let o=[];e&&(o=o.concat(Object.keys(e).map(a=>{const r=e[a],l=_i(a,r),c=l==="r",h=l==="x";return{options:r,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),F(o,a=>{const r=a.options,l=r.id,c=_i(l,r),h=D(r.type,a.dtype);(r.position===void 0||Is(r.position,c)!==Is(a.dposition))&&(r.position=a.dposition),n[l]=!0;let d=null;if(l in s&&s[l].type===h)d=s[l];else{const f=ot.getScale(h);d=new f({id:l,type:h,ctx:this.ctx,chart:this}),s[d.id]=d}d.init(r,t)}),F(n,(a,r)=>{a||delete s[r]}),F(s,a=>{J.configure(this,a,a.options),J.addBox(this,a)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,s=t.length;if(t.sort((n,o)=>n.index-o.index),s>e){for(let n=e;ne.length&&delete this._stacks,t.forEach((s,n)=>{e.filter(o=>o===s._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let s,n;for(this._removeUnreferencedMetasets(),s=0,n=e.length;s{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const s=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),n=this._animationsDisabled=!s.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let c=0,h=this.data.datasets.length;c{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Rs("z","_idx"));const{_active:r,_lastEvent:l}=this;l?this._eventHandler(l,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){F(this.scales,t=>{J.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),s=new Set(t.events);(!Xi(e,s)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:s,start:n,count:o}of e){const a=s==="_removeElements"?-o:o;Cl(t,n,a)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,s=o=>new Set(t.filter(a=>a[0]===o).map((a,r)=>r+","+a.splice(1).join(","))),n=s(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;J.update(this,this.width,this.height,t);const e=this.chartArea,s=e.width<=0||e.height<=0;this._layers=[],F(this.boxes,n=>{s&&n.position==="chartArea"||(n.configure&&n.configure(),this._layers.push(...n._layers()))},this),this._layers.forEach((n,o)=>{n._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,s=this.data.datasets.length;e=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,s=t._clip,n=!s.disabled,o=Ol(t,this.chartArea),a={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",a)!==!1&&(n&&Ii(e,{left:s.left===!1?0:o.left-s.left,right:s.right===!1?this.width:o.right+s.right,top:s.top===!1?0:o.top-s.top,bottom:s.bottom===!1?this.height:o.bottom+s.bottom}),t.controller.draw(),n&&Ri(e),a.cancelable=!1,this.notifyPlugins("afterDatasetDraw",a))}isPointInArea(t){return ft(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,s,n){const o=Sr.modes[e];return typeof o=="function"?o(this,t,s,n):[]}getDatasetMeta(t){const e=this.data.datasets[t],s=this._metasets;let n=s.filter(o=>o&&o._dataset===e).pop();return n||(n={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},s.push(n)),n}getContext(){return this.$context||(this.$context=yt(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const s=this.getDatasetMeta(t);return typeof s.hidden=="boolean"?!s.hidden:!e.hidden}setDatasetVisibility(t,e){const s=this.getDatasetMeta(t);s.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,s){const n=s?"show":"hide",o=this.getDatasetMeta(t),a=o.controller._resolveAnimations(void 0,n);ue(e)?(o.data[e].hidden=!s,this.update()):(this.setDatasetVisibility(t,s),a.update(o,{visible:s}),this.update(r=>r.datasetIndex===t?n:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),ct.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,o,a),t[o]=a},n=(o,a,r)=>{o.offsetX=a,o.offsetY=r,this._eventHandler(o)};F(this.options.events,o=>s(o,n))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,s=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},n=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let a;const r=()=>{n("attach",r),this.attached=!0,this.resize(),s("resize",o),s("detach",a)};a=()=>{this.attached=!1,n("resize",o),this._stop(),this._resize(0,0),s("attach",r)},e.isAttached(this.canvas)?r():a()}unbindEvents(){F(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},F(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,s){const n=s?"set":"remove";let o,a,r,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+n+"DatasetHoverStyle"]()),r=0,l=t.length;r{const r=this.getDatasetMeta(o);if(!r)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:r.data[a],index:a}});!$e(s,e)&&(this._active=s,this._lastEvent=null,this._updateHoverStyles(s,e))}notifyPlugins(t,e,s){return this._plugins.notify(this,t,e,s)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,s){const n=this.options.hover,o=(l,c)=>l.filter(h=>!c.some(d=>h.datasetIndex===d.datasetIndex&&h.index===d.index)),a=o(e,t),r=s?t:o(t,e);a.length&&this.updateHoverStyle(a,n.mode,!1),r.length&&n.mode&&this.updateHoverStyle(r,n.mode,!0)}_eventHandler(t,e){const s={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},n=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",s,n)===!1)return;const o=this._handleEvent(t,e,s.inChartArea);return s.cancelable=!1,this.notifyPlugins("afterEvent",s,n),(o||s.changed)&&this.render(),this}_handleEvent(t,e,s){const{_active:n=[],options:o}=this,a=e,r=this._getActiveElements(t,n,s,a),l=Eo(t),c=Dl(t,this._lastEvent,s,l);s&&(this._lastEvent=null,R(o.onHover,[t,r,this],this),l&&R(o.onClick,[t,r,this],this));const h=!$e(r,n);return(h||e)&&(this._active=r,this._updateHoverStyles(r,n,e)),this._lastEvent=c,h}_getActiveElements(t,e,s,n){if(t.type==="mouseout")return[];if(!s)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,n)}}S(it,"defaults",z),S(it,"instances",Ve),S(it,"overrides",Et),S(it,"registry",ot),S(it,"version",Ml),S(it,"getChart",zs);function Bs(){return F(it.instances,i=>i._plugins.invalidate())}function Vn(i,t,e=t){i.lineCap=D(e.borderCapStyle,t.borderCapStyle),i.setLineDash(D(e.borderDash,t.borderDash)),i.lineDashOffset=D(e.borderDashOffset,t.borderDashOffset),i.lineJoin=D(e.borderJoinStyle,t.borderJoinStyle),i.lineWidth=D(e.borderWidth,t.borderWidth),i.strokeStyle=D(e.borderColor,t.borderColor)}function Tl(i,t,e){i.lineTo(e.x,e.y)}function Ll(i){return i.stepped?oa:i.tension||i.cubicInterpolationMode==="monotone"?aa:Tl}function Nn(i,t,e={}){const s=i.length,{start:n=0,end:o=s-1}=e,{start:a,end:r}=t,l=Math.max(n,a),c=Math.min(o,r),h=nr&&o>r;return{count:s,start:l,loop:t.loop,ilen:c(a+(c?r-y:y))%o,v=()=>{g!==m&&(i.lineTo(h,m),i.lineTo(h,g),i.lineTo(h,b))};for(l&&(u=n[_(0)],i.moveTo(u.x,u.y)),f=0;f<=r;++f){if(u=n[_(f)],u.skip)continue;const y=u.x,x=u.y,M=y|0;M===p?(xm&&(m=x),h=(d*h+y)/++d):(v(),i.lineTo(y,x),p=M,d=0,g=m=x),b=x}v()}function xi(i){const t=i.options,e=t.borderDash&&t.borderDash.length;return!i._decimated&&!i._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?Fl:Al}function Il(i){return i.stepped?Ba:i.tension||i.cubicInterpolationMode==="monotone"?Ha:Tt}function Rl(i,t,e,s){let n=t._path;n||(n=t._path=new Path2D,t.path(n,e,s)&&n.closePath()),Vn(i,t.options),i.stroke(n)}function El(i,t,e,s){const{segments:n,options:o}=t,a=xi(t);for(const r of n)Vn(i,o,r.style),i.beginPath(),a(i,t,r,{start:e,end:e+s-1})&&i.closePath(),i.stroke()}const zl=typeof Path2D=="function";function Bl(i,t,e,s){zl&&!t.options.segment?Rl(i,t,e,s):El(i,t,e,s)}class oe extends rt{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const s=this.options;if((s.tension||s.cubicInterpolationMode==="monotone")&&!s.stepped&&!this._pointsUpdated){const n=s.spanGaps?this._loop:this._fullLoop;Ta(this._points,s,t,n,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Xa(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,s=t.length;return s&&e[t[s-1].end]}interpolate(t,e){const s=this.options,n=t[e],o=this.points,a=$a(this,{property:e,start:n,end:n});if(!a.length)return;const r=[],l=Il(s);let c,h;for(c=0,h=a.length;ct!=="borderDash"&&t!=="fill"});function Hs(i,t,e,s){const n=i.options,{[e]:o}=i.getProps([e],s);return Math.abs(t-o){let{boxHeight:e=t,boxWidth:s=t}=i;return i.usePointStyle&&(e=Math.min(e,t),s=i.pointStyleWidth||Math.min(s,t)),{boxWidth:s,boxHeight:e,itemHeight:Math.max(t,e)}},$l=(i,t)=>i!==null&&t!==null&&i.datasetIndex===t.datasetIndex&&i.index===t.index;class Vs extends rt{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,s){this.maxWidth=t,this.maxHeight=e,this._margins=s,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=R(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(s=>t.filter(s,this.chart.data))),t.sort&&(e=e.sort((s,n)=>t.sort(s,n,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}const s=t.labels,n=W(s.font),o=n.size,a=this._computeTitleHeight(),{boxWidth:r,itemHeight:l}=Ws(s,o);let c,h;e.font=n.string,this.isHorizontal()?(c=this.maxWidth,h=this._fitRows(a,o,r,l)+10):(h=this.maxHeight,c=this._fitCols(a,n,r,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,s,n){const{ctx:o,maxWidth:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],h=n+r;let d=t;o.textAlign="left",o.textBaseline="middle";let f=-1,u=-h;return this.legendItems.forEach((p,g)=>{const m=s+e/2+o.measureText(p.text).width;(g===0||c[c.length-1]+m+2*r>a)&&(d+=h,c[c.length-(g>0?0:1)]=0,u+=h,f++),l[g]={left:0,top:u,row:f,width:m,height:n},c[c.length-1]+=m+r}),d}_fitCols(t,e,s,n){const{ctx:o,maxHeight:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],h=a-t;let d=r,f=0,u=0,p=0,g=0;return this.legendItems.forEach((m,b)=>{const{itemWidth:_,itemHeight:v}=Yl(s,e,o,m,n);b>0&&u+v+2*r>h&&(d+=f+r,c.push({width:f,height:u}),p+=f+r,g++,f=u=0),l[b]={left:p,top:u,col:g,width:_,height:v},f=Math.max(f,_),u+=v+r}),d+=f,c.push({width:f,height:u}),d}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:s,labels:{padding:n},rtl:o}}=this,a=$t(o,this.left,this.width);if(this.isHorizontal()){let r=0,l=j(s,this.left+n,this.right-this.lineWidths[r]);for(const c of e)r!==c.row&&(r=c.row,l=j(s,this.left+n,this.right-this.lineWidths[r])),c.top+=this.top+t+n,c.left=a.leftForLtr(a.x(l),c.width),l+=c.width+n}else{let r=0,l=j(s,this.top+t+n,this.bottom-this.columnSizes[r].height);for(const c of e)c.col!==r&&(r=c.col,l=j(s,this.top+t+n,this.bottom-this.columnSizes[r].height)),c.top=l,c.left+=this.left+n,c.left=a.leftForLtr(a.x(c.left),c.width),l+=c.height+n}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;Ii(t,this),this._draw(),Ri(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:s,ctx:n}=this,{align:o,labels:a}=t,r=z.color,l=$t(t.rtl,this.left,this.width),c=W(a.font),{padding:h}=a,d=c.size,f=d/2;let u;this.drawTitle(),n.textAlign=l.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=c.string;const{boxWidth:p,boxHeight:g,itemHeight:m}=Ws(a,d),b=function(M,k,w){if(isNaN(p)||p<=0||isNaN(g)||g<0)return;n.save();const P=D(w.lineWidth,1);if(n.fillStyle=D(w.fillStyle,r),n.lineCap=D(w.lineCap,"butt"),n.lineDashOffset=D(w.lineDashOffset,0),n.lineJoin=D(w.lineJoin,"miter"),n.lineWidth=P,n.strokeStyle=D(w.strokeStyle,r),n.setLineDash(D(w.lineDash,[])),a.usePointStyle){const O={radius:g*Math.SQRT2/2,pointStyle:w.pointStyle,rotation:w.rotation,borderWidth:P},C=l.xPlus(M,p/2),L=k+f;_n(n,O,C,L,a.pointStyleWidth&&p)}else{const O=k+Math.max((d-g)/2,0),C=l.leftForLtr(M,p),L=Ft(w.borderRadius);n.beginPath(),Object.values(L).some(Y=>Y!==0)?ge(n,{x:C,y:O,w:p,h:g,radius:L}):n.rect(C,O,p,g),n.fill(),P!==0&&n.stroke()}n.restore()},_=function(M,k,w){zt(n,w.text,M,k+m/2,c,{strikethrough:w.hidden,textAlign:l.textAlign(w.textAlign)})},v=this.isHorizontal(),y=this._computeTitleHeight();v?u={x:j(o,this.left+h,this.right-s[0]),y:this.top+h+y,line:0}:u={x:this.left+h,y:j(o,this.top+y+h,this.bottom-e[0].height),line:0},Pn(this.ctx,t.textDirection);const x=m+h;this.legendItems.forEach((M,k)=>{n.strokeStyle=M.fontColor,n.fillStyle=M.fontColor;const w=n.measureText(M.text).width,P=l.textAlign(M.textAlign||(M.textAlign=a.textAlign)),O=p+f+w;let C=u.x,L=u.y;l.setWidth(this.width),v?k>0&&C+O+h>this.right&&(L=u.y+=x,u.line++,C=u.x=j(o,this.left+h,this.right-s[u.line])):k>0&&L+x>this.bottom&&(C=u.x=C+e[u.line].width+h,u.line++,L=u.y=j(o,this.top+y+h,this.bottom-e[u.line].height));const Y=l.x(C);if(b(Y,L,M),C=Ko(P,C+p+f,v?C+O:this.right,t.rtl),_(l.x(C),L,M),v)u.x+=O+h;else if(typeof M.text!="string"){const st=c.lineHeight;u.y+=$n(M,st)+h}else u.y+=x}),Cn(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,s=W(e.font),n=$(e.padding);if(!e.display)return;const o=$t(t.rtl,this.left,this.width),a=this.ctx,r=e.position,l=s.size/2,c=n.top+l;let h,d=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),h=this.top+c,d=j(t.align,d,this.right-f);else{const p=this.columnSizes.reduce((g,m)=>Math.max(g,m.height),0);h=c+j(t.align,this.top,this.bottom-p-t.labels.padding-this._computeTitleHeight())}const u=j(r,d,d+f);a.textAlign=o.textAlign(Li(r)),a.textBaseline="middle",a.strokeStyle=e.color,a.fillStyle=e.color,a.font=s.string,zt(a,e.text,u,h,s)}_computeTitleHeight(){const t=this.options.title,e=W(t.font),s=$(t.padding);return t.display?e.lineHeight+s.height:0}_getLegendItemAt(t,e){let s,n,o;if(Lt(t,this.left,this.right)&&Lt(e,this.top,this.bottom)){for(o=this.legendHitBoxes,s=0;so.length>a.length?o:a)),t+e.size/2+s.measureText(n).width}function Xl(i,t,e){let s=i;return typeof t.text!="string"&&(s=$n(t,e)),s}function $n(i,t){const e=i.text?i.text.length:0;return t*e}function Kl(i,t){return!!((i==="mousemove"||i==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(i==="click"||i==="mouseup"))}var ql={id:"legend",_element:Vs,start(i,t,e){const s=i.legend=new Vs({ctx:i.ctx,options:e,chart:i});J.configure(i,s,e),J.addBox(i,s)},stop(i){J.removeBox(i,i.legend),delete i.legend},beforeUpdate(i,t,e){const s=i.legend;J.configure(i,s,e),s.options=e},afterUpdate(i){const t=i.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(i,t){t.replay||i.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(i,t,e){const s=t.datasetIndex,n=e.chart;n.isDatasetVisible(s)?(n.hide(s),t.hidden=!0):(n.show(s),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:i=>i.chart.options.color,boxWidth:40,padding:10,generateLabels(i){const t=i.data.datasets,{labels:{usePointStyle:e,pointStyle:s,textAlign:n,color:o,useBorderRadius:a,borderRadius:r}}=i.legend.options;return i._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(e?0:void 0),h=$(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:c.borderColor,pointStyle:s||c.pointStyle,rotation:c.rotation,textAlign:n||c.textAlign,borderRadius:a&&(r||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:i=>i.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:i=>!i.startsWith("on"),labels:{_scriptable:i=>!["generateLabels","filter","sort"].includes(i)}}};class Yn extends rt{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const s=this.options;if(this.left=0,this.top=0,!s.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;const n=E(s.text)?s.text.length:1;this._padding=$(s.padding);const o=n*W(s.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:e,left:s,bottom:n,right:o,options:a}=this,r=a.align;let l=0,c,h,d;return this.isHorizontal()?(h=j(r,s,o),d=e+t,c=o-s):(a.position==="left"?(h=s+t,d=j(r,n,e),l=H*-.5):(h=o-t,d=j(r,e,n),l=H*.5),c=n-e),{titleX:h,titleY:d,maxWidth:c,rotation:l}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const s=W(e.font),o=s.lineHeight/2+this._padding.top,{titleX:a,titleY:r,maxWidth:l,rotation:c}=this._drawArgs(o);zt(t,e.text,0,0,s,{color:e.color,maxWidth:l,rotation:c,textAlign:Li(e.align),textBaseline:"middle",translation:[a,r]})}}function Gl(i,t){const e=new Yn({ctx:i.ctx,options:t,chart:i});J.configure(i,e,t),J.addBox(i,e),i.titleBlock=e}var Zl={id:"title",_element:Yn,start(i,t,e){Gl(i,e)},stop(i){const t=i.titleBlock;J.removeBox(i,t),delete i.titleBlock},beforeUpdate(i,t,e){const s=i.titleBlock;J.configure(i,s,e),s.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const ae={average(i){if(!i.length)return!1;let t,e,s=new Set,n=0,o=0;for(t=0,e=i.length;tr+l)/s.size,y:n/o}},nearest(i,t){if(!i.length)return!1;let e=t.x,s=t.y,n=Number.POSITIVE_INFINITY,o,a,r;for(o=0,a=i.length;o-1?i.split(`
-`):i}function Ql(i,t){const{element:e,datasetIndex:s,index:n}=t,o=i.getDatasetMeta(s).controller,{label:a,value:r}=o.getLabelAndValue(n);return{chart:i,label:a,parsed:o.getParsed(n),raw:i.data.datasets[s].data[n],formattedValue:r,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:e}}function Ns(i,t){const e=i.chart.ctx,{body:s,footer:n,title:o}=i,{boxWidth:a,boxHeight:r}=t,l=W(t.bodyFont),c=W(t.titleFont),h=W(t.footerFont),d=o.length,f=n.length,u=s.length,p=$(t.padding);let g=p.height,m=0,b=s.reduce((y,x)=>y+x.before.length+x.lines.length+x.after.length,0);if(b+=i.beforeBody.length+i.afterBody.length,d&&(g+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),b){const y=t.displayColors?Math.max(r,l.lineHeight):l.lineHeight;g+=u*y+(b-u)*l.lineHeight+(b-1)*t.bodySpacing}f&&(g+=t.footerMarginTop+f*h.lineHeight+(f-1)*t.footerSpacing);let _=0;const v=function(y){m=Math.max(m,e.measureText(y).width+_)};return e.save(),e.font=c.string,F(i.title,v),e.font=l.string,F(i.beforeBody.concat(i.afterBody),v),_=t.displayColors?a+2+t.boxPadding:0,F(s,y=>{F(y.before,v),F(y.lines,v),F(y.after,v)}),_=0,e.font=h.string,F(i.footer,v),e.restore(),m+=p.width,{width:m,height:g}}function Jl(i,t){const{y:e,height:s}=t;return ei.height-s/2?"bottom":"center"}function tc(i,t,e,s){const{x:n,width:o}=s,a=e.caretSize+e.caretPadding;if(i==="left"&&n+o+a>t.width||i==="right"&&n-o-a<0)return!0}function ec(i,t,e,s){const{x:n,width:o}=e,{width:a,chartArea:{left:r,right:l}}=i;let c="center";return s==="center"?c=n<=(r+l)/2?"left":"right":n<=o/2?c="left":n>=a-o/2&&(c="right"),tc(c,i,t,e)&&(c="center"),c}function js(i,t,e){const s=e.yAlign||t.yAlign||Jl(i,e);return{xAlign:e.xAlign||t.xAlign||ec(i,t,e,s),yAlign:s}}function ic(i,t){let{x:e,width:s}=i;return t==="right"?e-=s:t==="center"&&(e-=s/2),e}function sc(i,t,e){let{y:s,height:n}=i;return t==="top"?s+=e:t==="bottom"?s-=n+e:s-=n/2,s}function $s(i,t,e,s){const{caretSize:n,caretPadding:o,cornerRadius:a}=i,{xAlign:r,yAlign:l}=e,c=n+o,{topLeft:h,topRight:d,bottomLeft:f,bottomRight:u}=Ft(a);let p=ic(t,r);const g=sc(t,l,c);return l==="center"?r==="left"?p+=c:r==="right"&&(p-=c):r==="left"?p-=Math.max(h,f)+n:r==="right"&&(p+=Math.max(d,u)+n),{x:G(p,0,s.width-t.width),y:G(g,0,s.height-t.height)}}function Ie(i,t,e){const s=$(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-s.right:i.x+s.left}function Ys(i){return nt([],ht(i))}function nc(i,t,e){return yt(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Us(i,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}const Un={beforeTitle:lt,title(i){if(i.length>0){const t=i[0],e=t.chart.data.labels,s=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(s>0&&t.dataIndex"u"?Un[t].call(e,s):n}class yi extends rt{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,s=this.options.setContext(this.getContext()),n=s.enabled&&e.options.animation&&s.animations,o=new On(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=nc(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:s}=e,n=U(s,"beforeTitle",this,t),o=U(s,"title",this,t),a=U(s,"afterTitle",this,t);let r=[];return r=nt(r,ht(n)),r=nt(r,ht(o)),r=nt(r,ht(a)),r}getBeforeBody(t,e){return Ys(U(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:s}=e,n=[];return F(t,o=>{const a={before:[],lines:[],after:[]},r=Us(s,o);nt(a.before,ht(U(r,"beforeLabel",this,o))),nt(a.lines,U(r,"label",this,o)),nt(a.after,ht(U(r,"afterLabel",this,o))),n.push(a)}),n}getAfterBody(t,e){return Ys(U(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:s}=e,n=U(s,"beforeFooter",this,t),o=U(s,"footer",this,t),a=U(s,"afterFooter",this,t);let r=[];return r=nt(r,ht(n)),r=nt(r,ht(o)),r=nt(r,ht(a)),r}_createItems(t){const e=this._active,s=this.chart.data,n=[],o=[],a=[];let r=[],l,c;for(l=0,c=e.length;lt.filter(h,d,f,s))),t.itemSort&&(r=r.sort((h,d)=>t.itemSort(h,d,s))),F(r,h=>{const d=Us(t.callbacks,h);n.push(U(d,"labelColor",this,h)),o.push(U(d,"labelPointStyle",this,h)),a.push(U(d,"labelTextColor",this,h))}),this.labelColors=n,this.labelPointStyles=o,this.labelTextColors=a,this.dataPoints=r,r}update(t,e){const s=this.options.setContext(this.getContext()),n=this._active;let o,a=[];if(!n.length)this.opacity!==0&&(o={opacity:0});else{const r=ae[s.position].call(this,n,this._eventPosition);a=this._createItems(s),this.title=this.getTitle(a,s),this.beforeBody=this.getBeforeBody(a,s),this.body=this.getBody(a,s),this.afterBody=this.getAfterBody(a,s),this.footer=this.getFooter(a,s);const l=this._size=Ns(this,s),c=Object.assign({},r,l),h=js(this.chart,s,c),d=$s(s,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX:r.x,caretY:r.y}}this._tooltipItems=a,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&s.external&&s.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,s,n){const o=this.getCaretPosition(t,s,n);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,s){const{xAlign:n,yAlign:o}=this,{caretSize:a,cornerRadius:r}=s,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:d}=Ft(r),{x:f,y:u}=t,{width:p,height:g}=e;let m,b,_,v,y,x;return o==="center"?(y=u+g/2,n==="left"?(m=f,b=m-a,v=y+a,x=y-a):(m=f+p,b=m+a,v=y-a,x=y+a),_=m):(n==="left"?b=f+Math.max(l,h)+a:n==="right"?b=f+p-Math.max(c,d)-a:b=this.caretX,o==="top"?(v=u,y=v-a,m=b-a,_=b+a):(v=u+g,y=v+a,m=b+a,_=b-a),x=v),{x1:m,x2:b,x3:_,y1:v,y2:y,y3:x}}drawTitle(t,e,s){const n=this.title,o=n.length;let a,r,l;if(o){const c=$t(s.rtl,this.x,this.width);for(t.x=Ie(this,s.titleAlign,s),e.textAlign=c.textAlign(s.titleAlign),e.textBaseline="middle",a=W(s.titleFont),r=s.titleSpacing,e.fillStyle=s.titleColor,e.font=a.string,l=0;l_!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,ge(t,{x:g,y:p,w:c,h:l,radius:b}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),ge(t,{x:m,y:p+1,w:c-2,h:l-2,radius:b}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(g,p,c,l),t.strokeRect(g,p,c,l),t.fillStyle=a.backgroundColor,t.fillRect(m,p+1,c-2,l-2))}t.fillStyle=this.labelTextColors[s]}drawBody(t,e,s){const{body:n}=this,{bodySpacing:o,bodyAlign:a,displayColors:r,boxHeight:l,boxWidth:c,boxPadding:h}=s,d=W(s.bodyFont);let f=d.lineHeight,u=0;const p=$t(s.rtl,this.x,this.width),g=function(w){e.fillText(w,p.x(t.x+u),t.y+f/2),t.y+=f+o},m=p.textAlign(a);let b,_,v,y,x,M,k;for(e.textAlign=a,e.textBaseline="middle",e.font=d.string,t.x=Ie(this,m,s),e.fillStyle=s.bodyColor,F(this.beforeBody,g),u=r&&m!=="right"?a==="center"?c/2+h:c+2+h:0,y=0,M=n.length;y0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,s=this.$animations,n=s&&s.x,o=s&&s.y;if(n||o){const a=ae[t.position].call(this,this._active,this._eventPosition);if(!a)return;const r=this._size=Ns(this,t),l=Object.assign({},a,this._size),c=js(e,t,l),h=$s(t,l,c,e);(n._to!==h.x||o._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=r.width,this.height=r.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let s=this.opacity;if(!s)return;this._updateAnimationTarget(e);const n={width:this.width,height:this.height},o={x:this.x,y:this.y};s=Math.abs(s)<.001?0:s;const a=$(e.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&r&&(t.save(),t.globalAlpha=s,this.drawBackground(o,t,n,e),Pn(t,e.textDirection),o.y+=a.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),Cn(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const s=this._active,n=t.map(({datasetIndex:r,index:l})=>{const c=this.chart.getDatasetMeta(r);if(!c)throw new Error("Cannot find a dataset at index "+r);return{datasetIndex:r,element:c.data[l],index:l}}),o=!$e(s,n),a=this._positionChanged(n,e);(o||a)&&(this._active=n,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,s=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const n=this.options,o=this._active||[],a=this._getActiveElements(t,o,e,s),r=this._positionChanged(a,t),l=e||!$e(a,o)||r;return l&&(this._active=a,(n.enabled||n.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,s,n){const o=this.options;if(t.type==="mouseout")return[];if(!n)return e.filter(r=>this.chart.data.datasets[r.datasetIndex]&&this.chart.getDatasetMeta(r.datasetIndex).controller.getParsed(r.index)!==void 0);const a=this.chart.getElementsAtEventForMode(t,o.mode,o,s);return o.reverse&&a.reverse(),a}_positionChanged(t,e){const{caretX:s,caretY:n,options:o}=this,a=ae[o.position].call(this,t,e);return a!==!1&&(s!==a.x||n!==a.y)}}S(yi,"positioners",ae);var oc={id:"tooltip",_element:yi,positioners:ae,afterInit(i,t,e){e&&(i.tooltip=new yi({chart:i,options:e}))},beforeUpdate(i,t,e){i.tooltip&&i.tooltip.initialize(e)},reset(i,t,e){i.tooltip&&i.tooltip.initialize(e)},afterDraw(i){const t=i.tooltip;if(t&&t._willRender()){const e={tooltip:t};if(i.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(i.ctx),i.notifyPlugins("afterTooltipDraw",e)}},afterEvent(i,t){if(i.tooltip){const e=t.replay;i.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(i,t)=>t.bodyFont.size,boxWidth:(i,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Un},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:i=>i!=="filter"&&i!=="itemSort"&&i!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const ac=(i,t,e,s)=>(typeof t=="string"?(e=i.push(t)-1,s.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function rc(i,t,e,s){const n=i.indexOf(t);if(n===-1)return ac(i,t,e,s);const o=i.lastIndexOf(t);return n!==o?e:n}const lc=(i,t)=>i===null?null:G(Math.round(i),0,t);function Xs(i){const t=this.getLabels();return i>=0&&ie.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}S(vi,"id","category"),S(vi,"defaults",{ticks:{callback:Xs}});function cc(i,t){const e=[],{bounds:n,step:o,min:a,max:r,precision:l,count:c,maxTicks:h,maxDigits:d,includeBounds:f}=i,u=o||1,p=h-1,{min:g,max:m}=t,b=!A(a),_=!A(r),v=!A(c),y=(m-g)/(d+1);let x=qi((m-g)/p/u)*u,M,k,w,P;if(x<1e-14&&!b&&!_)return[{value:g},{value:m}];P=Math.ceil(m/x)-Math.floor(g/x),P>p&&(x=qi(P*x/p/u)*u),A(l)||(M=Math.pow(10,l),x=Math.ceil(x*M)/M),n==="ticks"?(k=Math.floor(g/x)*x,w=Math.ceil(m/x)*x):(k=g,w=m),b&&_&&o&&Wo((r-a)/o,x/1e3)?(P=Math.round(Math.min((r-a)/x,h)),x=(r-a)/P,k=a,w=r):v?(k=b?a:k,w=_?r:w,P=c-1,x=(w-k)/P):(P=(w-k)/x,le(P,Math.round(P),x/1e3)?P=Math.round(P):P=Math.ceil(P));const O=Math.max(Gi(x),Gi(k));M=Math.pow(10,A(l)?O:l),k=Math.round(k*M)/M,w=Math.round(w*M)/M;let C=0;for(b&&(f&&k!==a?(e.push({value:a}),kr)break;e.push({value:L})}return _&&f&&w!==r?e.length&&le(e[e.length-1].value,r,Ks(r,y,i))?e[e.length-1].value=r:e.push({value:r}):(!_||w===r)&&e.push({value:w}),e}function Ks(i,t,{horizontal:e,minRotation:s}){const n=mt(s),o=(e?Math.sin(n):Math.cos(n))||.001,a=.75*t*(""+i).length;return Math.min(t/o,a)}class Ge extends Bt{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return A(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:s}=this.getUserBounds();let{min:n,max:o}=this;const a=l=>n=e?n:l,r=l=>o=s?o:l;if(t){const l=at(n),c=at(o);l<0&&c<0?r(0):l>0&&c>0&&a(0)}if(n===o){let l=o===0?1:Math.abs(o*.05);r(o+l),t||a(n-l)}this.min=n,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:s}=t,n;return s?(n=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),e=e||11),e&&(n=Math.min(e,n)),n}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let s=this.getTickLimit();s=Math.max(2,s);const n={maxTicks:s,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,a=cc(n,o);return t.bounds==="ticks"&&cn(a,this,"value"),t.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){const t=this.ticks;let e=this.min,s=this.max;if(super.configure(),this.options.offset&&t.length){const n=(s-e)/Math.max(t.length-1,1)/2;e-=n,s+=n}this._startValue=e,this._endValue=s,this._valueRange=s-e}getLabelForValue(t){return Fi(t,this.chart.options.locale,this.options.ticks.format)}}class ki extends Ge{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=V(t)?t:0,this.max=V(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,s=mt(this.options.ticks.minRotation),n=(t?Math.sin(s):Math.cos(s))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/n))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}S(ki,"id","linear"),S(ki,"defaults",{ticks:{callback:Qe.formatters.numeric}});const me=i=>Math.floor(pt(i)),Dt=(i,t)=>Math.pow(10,me(i)+t);function qs(i){return i/Math.pow(10,me(i))===1}function Gs(i,t,e){const s=Math.pow(10,e),n=Math.floor(i/s);return Math.ceil(t/s)-n}function hc(i,t){const e=t-i;let s=me(e);for(;Gs(i,t,s)>10;)s++;for(;Gs(i,t,s)<10;)s--;return Math.min(s,me(i))}function dc(i,{min:t,max:e}){t=K(i.min,t);const s=[],n=me(t);let o=hc(t,e),a=o<0?Math.pow(10,Math.abs(o)):1;const r=Math.pow(10,o),l=n>o?Math.pow(10,n):0,c=Math.round((t-l)*a)/a,h=Math.floor((t-l)/r/10)*r*10;let d=Math.floor((c-h)/Math.pow(10,o)),f=K(i.min,Math.round((l+h+d*Math.pow(10,o))*a)/a);for(;f=10?d=d<15?15:20:d++,d>=20&&(o++,d=2,a=o>=0?1:a),f=Math.round((l+h+d*Math.pow(10,o))*a)/a;const u=K(i.max,f);return s.push({value:u,major:qs(u),significand:d}),s}class wi extends Bt{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const s=Ge.prototype.parse.apply(this,[t,e]);if(s===0){this._zero=!0;return}return V(s)&&s>0?s:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=V(t)?Math.max(0,t):null,this.max=V(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!V(this._userMin)&&(this.min=t===Dt(this.min,0)?Dt(this.min,-1):Dt(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let s=this.min,n=this.max;const o=r=>s=t?s:r,a=r=>n=e?n:r;s===n&&(s<=0?(o(1),a(10)):(o(Dt(s,-1)),a(Dt(n,1)))),s<=0&&o(Dt(n,-1)),n<=0&&a(Dt(s,1)),this.min=s,this.max=n}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},s=dc(e,this);return t.bounds==="ticks"&&cn(s,this,"value"),t.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}getLabelForValue(t){return t===void 0?"0":Fi(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=pt(t),this._valueRange=pt(this.max)-pt(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(pt(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}S(wi,"id","logarithmic"),S(wi,"defaults",{ticks:{callback:Qe.formatters.logarithmic,major:{enabled:!0}}});function Mi(i){const t=i.ticks;if(t.display&&i.display){const e=$(t.backdropPadding);return D(t.font&&t.font.size,z.font.size)+e.height}return 0}function fc(i,t,e){return e=E(e)?e:[e],{w:na(i,t.string,e),h:e.length*t.lineHeight}}function Zs(i,t,e,s,n){return i===s||i===n?{start:t-e/2,end:t+e/2}:in?{start:t-e,end:t}:{start:t,end:t+e}}function uc(i){const t={l:i.left+i._padding.left,r:i.right-i._padding.right,t:i.top+i._padding.top,b:i.bottom-i._padding.bottom},e=Object.assign({},t),s=[],n=[],o=i._pointLabels.length,a=i.options.pointLabels,r=a.centerPointLabels?H/o:0;for(let l=0;lt.r&&(r=(s.end-t.r)/o,i.r=Math.max(i.r,t.r+r)),n.startt.b&&(l=(n.end-t.b)/a,i.b=Math.max(i.b,t.b+l))}function pc(i,t,e){const s=i.drawingArea,{extra:n,additionalAngle:o,padding:a,size:r}=e,l=i.getPointPosition(t,s+n+a,o),c=Math.round(Oi(et(l.angle+q))),h=yc(l.y,r.h,c),d=_c(c),f=xc(l.x,r.w,d);return{visible:!0,x:l.x,y:h,textAlign:d,left:f,top:h,right:f+r.w,bottom:h+r.h}}function mc(i,t){if(!t)return!0;const{left:e,top:s,right:n,bottom:o}=i;return!(ft({x:e,y:s},t)||ft({x:e,y:o},t)||ft({x:n,y:s},t)||ft({x:n,y:o},t))}function bc(i,t,e){const s=[],n=i._pointLabels.length,o=i.options,{centerPointLabels:a,display:r}=o.pointLabels,l={extra:Mi(o)/2,additionalAngle:a?H/n:0};let c;for(let h=0;h270||e<90)&&(i-=t),i}function vc(i,t,e){const{left:s,top:n,right:o,bottom:a}=e,{backdropColor:r}=t;if(!A(r)){const l=Ft(t.borderRadius),c=$(t.backdropPadding);i.fillStyle=r;const h=s-c.left,d=n-c.top,f=o-s+c.width,u=a-n+c.height;Object.values(l).some(p=>p!==0)?(i.beginPath(),ge(i,{x:h,y:d,w:f,h:u,radius:l}),i.fill()):i.fillRect(h,d,f,u)}}function kc(i,t){const{ctx:e,options:{pointLabels:s}}=i;for(let n=t-1;n>=0;n--){const o=i._pointLabelItems[n];if(!o.visible)continue;const a=s.setContext(i.getPointLabelContext(n));vc(e,a,o);const r=W(a.font),{x:l,y:c,textAlign:h}=o;zt(e,i._pointLabels[n],l,c+r.lineHeight/2,r,{color:a.color,textAlign:h,textBaseline:"middle"})}}function Xn(i,t,e,s){const{ctx:n}=i;if(e)n.arc(i.xCenter,i.yCenter,t,0,tt);else{let o=i.getPointPosition(0,t);n.moveTo(o.x,o.y);for(let a=1;a{const n=R(this.options.pointLabels.callback,[e,s],this);return n||n===0?n:""}).filter((e,s)=>this.chart.getDataVisibility(s))}fit(){const t=this.options;t.display&&t.pointLabels.display?uc(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,s,n){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((s-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,s,n))}getIndexAngle(t){const e=tt/(this._pointLabels.length||1),s=this.options.startAngle||0;return et(t*e+mt(s))}getDistanceFromCenterForValue(t){if(A(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(A(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t{if(d!==0||d===0&&this.min<0){l=this.getDistanceFromCenterForValue(h.value);const f=this.getContext(d),u=n.setContext(f),p=o.setContext(f);wc(this,u,l,a,p)}}),s.display){for(t.save(),r=a-1;r>=0;r--){const h=s.setContext(this.getPointLabelContext(r)),{color:d,lineWidth:f}=h;!f||!d||(t.lineWidth=f,t.strokeStyle=d,t.setLineDash(h.borderDash),t.lineDashOffset=h.borderDashOffset,l=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),c=this.getPointPosition(r,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,s=e.ticks;if(!s.display)return;const n=this.getIndexAngle(0);let o,a;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(n),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((r,l)=>{if(l===0&&this.min>=0&&!e.reverse)return;const c=s.setContext(this.getContext(l)),h=W(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=h.string,a=t.measureText(r.label).width,t.fillStyle=c.backdropColor;const d=$(c.backdropPadding);t.fillRect(-a/2-d.left,-o-h.size/2-d.top,a+d.width,h.size+d.height)}zt(t,r.label,0,-o,h,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}}S(Re,"id","radialLinear"),S(Re,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Qe.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),S(Re,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),S(Re,"descriptors",{angleLines:{_fallback:"grid"}});const ti={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},X=Object.keys(ti);function Qs(i,t){return i-t}function Js(i,t){if(A(t))return null;const e=i._adapter,{parser:s,round:n,isoWeekday:o}=i._parseOpts;let a=t;return typeof s=="function"&&(a=s(a)),V(a)||(a=typeof s=="string"?e.parse(a,s):e.parse(a)),a===null?null:(n&&(a=n==="week"&&(Ut(o)||o===!0)?e.startOf(a,"isoWeek",o):e.startOf(a,n)),+a)}function tn(i,t,e,s){const n=X.length;for(let o=X.indexOf(i);o=X.indexOf(e);o--){const a=X[o];if(ti[a].common&&i._adapter.diff(n,s,a)>=t-1)return a}return X[e?X.indexOf(e):0]}function Pc(i){for(let t=X.indexOf(i)+1,e=X.length;t=t?e[s]:e[n];i[o]=!0}}function Cc(i,t,e,s){const n=i._adapter,o=+n.startOf(t[0].value,s),a=t[t.length-1].value;let r,l;for(r=o;r<=a;r=+n.add(r,1,s))l=e[r],l>=0&&(t[l].major=!0);return t}function sn(i,t,e){const s=[],n={},o=t.length;let a,r;for(a=0;a+t.value))}initOffsets(t=[]){let e=0,s=0,n,o;this.options.offset&&t.length&&(n=this.getDecimalForValue(t[0]),t.length===1?e=1-n:e=(this.getDecimalForValue(t[1])-n)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?s=o:s=(o-this.getDecimalForValue(t[t.length-2]))/2);const a=t.length<3?.5:.25;e=G(e,0,a),s=G(s,0,a),this._offsets={start:e,end:s,factor:1/(e+1+s)}}_generate(){const t=this._adapter,e=this.min,s=this.max,n=this.options,o=n.time,a=o.unit||tn(o.minUnit,e,s,this._getLabelCapacity(e)),r=D(n.ticks.stepSize,1),l=a==="week"?o.isoWeekday:!1,c=Ut(l)||l===!0,h={};let d=e,f,u;if(c&&(d=+t.startOf(d,"isoWeek",l)),d=+t.startOf(d,c?"day":a),t.diff(s,e,a)>1e5*r)throw new Error(e+" and "+s+" are too far apart with stepSize of "+r+" "+a);const p=n.ticks.source==="data"&&this.getDataTimestamps();for(f=d,u=0;f+g)}getLabelForValue(t){const e=this._adapter,s=this.options.time;return s.tooltipFormat?e.format(t,s.tooltipFormat):e.format(t,s.displayFormats.datetime)}format(t,e){const n=this.options.time.displayFormats,o=this._unit,a=e||n[o];return this._adapter.format(t,a)}_tickFormatFunction(t,e,s,n){const o=this.options,a=o.ticks.callback;if(a)return R(a,[t,e,s],this);const r=o.time.displayFormats,l=this._unit,c=this._majorUnit,h=l&&r[l],d=c&&r[c],f=s[e],u=c&&d&&f&&f.major;return this._adapter.format(t,n||(u?d:h))}generateTickLabels(t){let e,s,n;for(e=0,s=t.length;e0?r:1}getDataTimestamps(){let t=this._cache.data||[],e,s;if(t.length)return t;const n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(e=0,s=n.length;e=i[s].pos&&t<=i[n].pos&&({lo:s,hi:n}=At(i,"pos",t)),{pos:o,time:r}=i[s],{pos:a,time:l}=i[n]):(t>=i[s].time&&t<=i[n].time&&({lo:s,hi:n}=At(i,"time",t)),{time:o,pos:r}=i[s],{time:a,pos:l}=i[n]);const c=a-o;return c?r+(l-r)*(t-o)/c:r}class nn extends Ze{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=Ee(e,this.min),this._tableRange=Ee(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:s}=this,n=[],o=[];let a,r,l,c,h;for(a=0,r=t.length;a=e&&c<=s&&n.push(c);if(n.length<2)return[{time:e,pos:0},{time:s,pos:1}];for(a=0,r=n.length;an-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),s=this.getLabelTimestamps();return e.length&&s.length?t=this.normalize(e.concat(s)):t=e.length?e:s,t=this._cache.all=t,t}getDecimalForValue(t){return(Ee(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,s=this.getDecimalForPixel(t)/e.factor-e.end;return Ee(this._table,s*this._tableRange+this._minPos,!0)}}S(nn,"id","timeseries"),S(nn,"defaults",Ze.defaults);const ut=i=>(no("data-v-99f7d66f"),i=i(),oo(),i),Dc={class:"insights"},Oc=ut(()=>I("h1",null,[I("span",{class:"material-symbols-rounded"},"insights"),I("span",null,"Insights")],-1)),Tc={class:"left"},Lc={class:"right"},Ac=ut(()=>I("span",{class:"label uppercase"}," short term ",-1)),Fc=ut(()=>I("span",{class:"label uppercase"}," integrated ",-1)),Ic=ut(()=>I("span",{class:"label uppercase"}," max momentary ",-1)),Rc={class:"meter"},Ec=ut(()=>I("span",{class:"label uppercase"}," L ",-1)),zc=["value"],Bc={class:"meter"},Hc=ut(()=>I("span",{class:"label uppercase"}," R ",-1)),Wc=["value"],Vc=ut(()=>I("h4",null,"Correlation",-1)),Nc={class:"meter"},jc=ut(()=>I("span",{class:"label uppercase"}," L/R ",-1)),$c=["value"],Yc=ut(()=>I("h4",null,"Stereo Field",-1)),Uc={class:"container stereo-field"},Xc={class:"inner"},Kc=Gn({__name:"Insight",setup(i){it.register(Be,ze,Ne,oe,Zl,oc,ql,je,vi,ki,wi,He);const t=Zt(),e=Zt(),s=Zt(),n=Zn(),o=Qn(),a=Zt([]),r=Zt([]),l=Array.from({length:60},()=>-1/0),c=f=>{var u,p;f.width=(u=f.parentElement)==null?void 0:u.clientWidth,f.height=(p=f.parentElement)==null?void 0:p.clientHeight,window.addEventListener("resize",()=>{var g,m;f.width=(g=f.parentElement)==null?void 0:g.clientWidth,f.height=(m=f.parentElement)==null?void 0:m.clientHeight})};Jn(()=>{c(e.value),c(t.value),c(s.value),a.value=l,r.value=l;const f=new it(t.value,{data:{labels:Array.from({length:60},(m,b)=>b),datasets:h()},options:{responsive:!0,maintainAspectRatio:!1,scales:{y:{min:-30,max:0,ticks:{font:{family:"Poppins",size:10}},title:{display:!0,text:"Loudness (LUFS)",font:{family:"Poppins"}}},x:{ticks:{display:!1},title:{display:!0,text:"Time (s)",font:{family:"Poppins"}}}},animation:{duration:0}}}),u=new it(e.value,{type:"scatter",data:{datasets:[{data:[],backgroundColor:"#00c48b",borderColor:"#00c48b",pointRadius:.5},{data:[],backgroundColor:"#00c48b99",borderColor:"#00c48bcc",pointRadius:.3},{data:[],backgroundColor:"#00c48b33",borderColor:"#00c48b99",pointRadius:.1}]},options:{responsive:!0,maintainAspectRatio:!0,aspectRatio:1,animation:!1,scales:{y:{min:-1.5,max:1.5,ticks:{callback:m=>m,font:{family:"Poppins"}},title:{display:!0,text:"Left",font:{family:"Poppins"}}},x:{min:-1.5,max:1.5,ticks:{callback:m=>m,font:{family:"Poppins"}},title:{display:!0,text:"Right",font:{family:"Poppins"}}}},plugins:{legend:{display:!1}}}}),p=new it(s.value,{data:{datasets:[{type:"line",tension:1,cubicInterpolationMode:"monotone",data:[{x:0,y:0},{x:255,y:50}],borderColor:"#00c48b"}]},options:{responsive:!0,maintainAspectRatio:!1,scales:{y:{min:0,max:255,ticks:{display:!1},title:{display:!0,text:"Gain",font:{family:"Poppins"}}},x:{min:0,max:18e3,type:"logarithmic",ticks:{callback:m=>m>=1e3?m/1e3+"k":m,font:{family:"Poppins"}},title:{display:!0,text:"Frequency (Hz)",font:{family:"Poppins"}}}},plugins:{legend:{display:!1}}}});let g=0;setInterval(()=>{if(!n.playing||(u.data.datasets[2].data=u.data.datasets[1].data,u.data.datasets[1].data=u.data.datasets[0].data,u.data.datasets[0].data=o.stereo.field,u.update(),g++%10!==0))return;const m=o.tonalBalance.data.reduce((b,_,v)=>(b.push({x:v*188,y:_}),b),[]);p.data.datasets[0].data=m,p.update(),f.data.datasets[0].data.shift(),f.data.datasets[0].data.push(o.loudness.shortterm),f.data.datasets[1].data.shift(),f.data.datasets[1].data.push(o.loudness.integrated),f.data.datasets[2].data.shift(),f.data.datasets[2].data.push([-60,o.loudness.momentary]),f.update()},100)});const h=()=>[{label:"short term",type:"line",data:l.map(f=>f),borderColor:"#c7aa19"},{label:"integrated",type:"line",data:l.map(f=>f),borderColor:"#189de4"},{label:"momentary",type:"bar",data:l.map(f=>[f,-1/0]),backgroundColor:"#e8545426"}],d=f=>Math.round(f*100)/100+" LUFS";return(f,u)=>(to(),eo(so,null,[wt(io,{src:Mt(n).song.cover,direction:"to top right"},null,8,["src"]),I("div",Dc,[Oc,I("div",Tc,[wt(Nt,{class:"relative loudness-chart p-2"},{default:Vt(()=>[I("canvas",{ref_key:"chart",ref:t},null,512)]),_:1}),wt(Nt,{class:"relative tonal-balance-chart p-2"},{default:Vt(()=>[I("canvas",{ref_key:"tonalBalanceChart",ref:s},null,512)]),_:1})]),I("div",Lc,[wt(Nt,{class:"mode"},{default:Vt(()=>[Ac,I("span",null,ei(d(Mt(o).loudness.shortterm)),1)]),_:1}),wt(Nt,{class:"mode"},{default:Vt(()=>[Fc,I("span",null,ei(d(Mt(o).loudness.integrated)),1)]),_:1}),wt(Nt,{class:"mode"},{default:Vt(()=>[Ic,I("span",null,ei(d(Mt(o).loudness.maxMomentary)),1)]),_:1}),wt(Nt,{class:"meters"},{default:Vt(()=>[I("div",Rc,[Ec,I("meter",{optimum:"0.25",low:"0.5",high:"0.75",min:"0",max:"1",value:Mt(o).stereo.left},null,8,zc)]),I("div",Bc,[Hc,I("meter",{optimum:"0.25",low:"0.5",high:"0.75",min:"0",max:"1",value:Mt(o).stereo.right},null,8,Wc)]),Vc,I("div",Nc,[jc,I("meter",{optimum:"1",low:"-0.5",high:"0",min:"-1",max:"1",value:Mt(o).stereo.correlation},null,8,$c)]),Yc,I("div",Uc,[I("div",Xc,[I("canvas",{ref_key:"stereoFieldChart",ref:e},null,512)])])]),_:1})])])],64))}});const Zc=ao(Kc,[["__scopeId","data-v-99f7d66f"]]);export{Zc as default};
diff --git a/src/ui/dist/assets/Insight-02bf27fd.js.gz b/src/ui/dist/assets/Insight-02bf27fd.js.gz
deleted file mode 100644
index 0b64fab89..000000000
Binary files a/src/ui/dist/assets/Insight-02bf27fd.js.gz and /dev/null differ
diff --git a/src/ui/dist/assets/Insight-BJxao_m3.css b/src/ui/dist/assets/Insight-BJxao_m3.css
new file mode 100644
index 000000000..c77be61eb
--- /dev/null
+++ b/src/ui/dist/assets/Insight-BJxao_m3.css
@@ -0,0 +1 @@
+.meters[data-v-29855a4f]{display:flex;flex-direction:column;justify-content:center;gap:1em;padding:.5em;grid-column:1/-1;overflow:hidden}.meters .stereo-field[data-v-29855a4f]{align-self:center;aspect-ratio:1;flex:1;position:relative;height:100%}.meters .stereo-field .inner[data-v-29855a4f]{position:absolute;top:0;right:0;bottom:0;left:0;aspect-ratio:1;height:100%;margin:auto}.meters h4[data-v-29855a4f]{margin-bottom:0}.meters .meter[data-v-29855a4f]{display:grid;grid-template-columns:1ch 1fr;align-items:center;gap:1em}.meters .meter .label[data-v-29855a4f]{font-size:.8em;color:var(--fg-base-dk)}.meters .meter meter[data-v-29855a4f]{width:100%}.insights[data-v-29855a4f]{display:grid;grid-template-columns:2fr 1fr;gap:1em;padding:1em;height:100%;overflow:hidden}.insights>h1[data-v-29855a4f]{grid-column:1/-1}.insights>h1 span[data-v-29855a4f]{margin-right:.5em}.left[data-v-29855a4f]{display:grid;grid-template-rows:1fr max-content;gap:1em}.left .loudness-chart[data-v-29855a4f]{width:100%;height:calc(2 * (100vh - var(--h-header) - var(--h-player) - 2.25rem - 5em) / 3)}.left .tonal-balance-chart[data-v-29855a4f]{width:100%;height:calc(1 * (100vh - var(--h-header) - var(--h-player) - 2.25rem - 5em) / 3)}.right[data-v-29855a4f]{display:grid;grid-template-columns:repeat(3,1fr);gap:1em;overflow:hidden}.right .mode[data-v-29855a4f]{padding:.5em;display:flex;flex-direction:column;align-items:center;width:100%}.right .mode .label[data-v-29855a4f]{font-size:.8em;color:var(--fg-base-dk)}meter[data-v-29855a4f]{--background: var(--bg-base);--optimum: var(--success);--sub-optimum: var(--warning);--sub-sub-optimum: var(--fail);display:block;width:100%}meter[data-v-29855a4f]::-webkit-meter-bar{background:var(--background);border:2px solid var(--border-base)}meter[data-v-29855a4f]:-moz-meter-optimum::-moz-meter-bar{background:var(--optimum)}meter[data-v-29855a4f]::-webkit-meter-optimum-value{background:var(--optimum)}meter[data-v-29855a4f]:-moz-meter-sub-optimum::-moz-meter-bar{background:var(--sub-optimum)}meter[data-v-29855a4f]::-webkit-meter-suboptimum-value{background:var(--sub-optimum)}meter[data-v-29855a4f]:-moz-meter-sub-sub-optimum::-moz-meter-bar{background:var(--sub-sub-optimum)}meter[data-v-29855a4f]::-webkit-meter-even-less-good-value{background:var(--sub-sub-optimum)}
diff --git a/src/ui/dist/assets/Insight-BJxao_m3.css.gz b/src/ui/dist/assets/Insight-BJxao_m3.css.gz
new file mode 100644
index 000000000..52d8fa656
Binary files /dev/null and b/src/ui/dist/assets/Insight-BJxao_m3.css.gz differ
diff --git a/src/ui/dist/assets/Insight-YxgeZZYl.js b/src/ui/dist/assets/Insight-YxgeZZYl.js
new file mode 100644
index 000000000..f96a92442
--- /dev/null
+++ b/src/ui/dist/assets/Insight-YxgeZZYl.js
@@ -0,0 +1,18 @@
+var Kn=Object.defineProperty;var qn=(i,t,e)=>t in i?Kn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var S=(i,t,e)=>qn(i,typeof t!="symbol"?t+"":t,e);import{e as Gn,n as Zt,a7 as Zn,aL as Qn,y as Jn,o as to,c as eo,g as wt,u as Mt,a8 as io,a as I,w as Vt,C as Nt,t as ei,F as so,l as no,m as oo,_ as ao}from"./index-DnhwPdfm.js";/*!
+ * @kurkle/color v0.3.2
+ * https://github.com/kurkle/color#readme
+ * (c) 2023 Jukka Kurkela
+ * Released under the MIT License
+ */function be(i){return i+.5|0}const gt=(i,t,e)=>Math.max(Math.min(i,e),t);function se(i){return gt(be(i*2.55),0,255)}function xt(i){return gt(be(i*255),0,255)}function dt(i){return gt(be(i/2.55)/100,0,1)}function Ni(i){return gt(be(i*100),0,100)}const Q={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},ui=[..."0123456789ABCDEF"],ro=i=>ui[i&15],lo=i=>ui[(i&240)>>4]+ui[i&15],ke=i=>(i&240)>>4===(i&15),co=i=>ke(i.r)&&ke(i.g)&&ke(i.b)&&ke(i.a);function ho(i){var t=i.length,e;return i[0]==="#"&&(t===4||t===5?e={r:255&Q[i[1]]*17,g:255&Q[i[2]]*17,b:255&Q[i[3]]*17,a:t===5?Q[i[4]]*17:255}:(t===7||t===9)&&(e={r:Q[i[1]]<<4|Q[i[2]],g:Q[i[3]]<<4|Q[i[4]],b:Q[i[5]]<<4|Q[i[6]],a:t===9?Q[i[7]]<<4|Q[i[8]]:255})),e}const fo=(i,t)=>i<255?t(i):"";function uo(i){var t=co(i)?ro:lo;return i?"#"+t(i.r)+t(i.g)+t(i.b)+fo(i.a,t):void 0}const go=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function on(i,t,e){const s=t*Math.min(e,1-e),n=(o,a=(o+i/30)%12)=>e-s*Math.max(Math.min(a-3,9-a,1),-1);return[n(0),n(8),n(4)]}function po(i,t,e){const s=(n,o=(n+i/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[s(5),s(3),s(1)]}function mo(i,t,e){const s=on(i,1,.5);let n;for(t+e>1&&(n=1/(t+e),t*=n,e*=n),n=0;n<3;n++)s[n]*=1-t-e,s[n]+=t;return s}function bo(i,t,e,s,n){return i===n?(t-e)/s+(t.5?h/(2-o-a):h/(o+a),l=bo(e,s,n,h,o),l=l*60+.5),[l|0,c||0,r]}function Pi(i,t,e,s){return(Array.isArray(t)?i(t[0],t[1],t[2]):i(t,e,s)).map(xt)}function Ci(i,t,e){return Pi(on,i,t,e)}function xo(i,t,e){return Pi(mo,i,t,e)}function _o(i,t,e){return Pi(po,i,t,e)}function an(i){return(i%360+360)%360}function yo(i){const t=go.exec(i);let e=255,s;if(!t)return;t[5]!==s&&(e=t[6]?se(+t[5]):xt(+t[5]));const n=an(+t[2]),o=+t[3]/100,a=+t[4]/100;return t[1]==="hwb"?s=xo(n,o,a):t[1]==="hsv"?s=_o(n,o,a):s=Ci(n,o,a),{r:s[0],g:s[1],b:s[2],a:e}}function vo(i,t){var e=Si(i);e[0]=an(e[0]+t),e=Ci(e),i.r=e[0],i.g=e[1],i.b=e[2]}function ko(i){if(!i)return;const t=Si(i),e=t[0],s=Ni(t[1]),n=Ni(t[2]);return i.a<255?`hsla(${e}, ${s}%, ${n}%, ${dt(i.a)})`:`hsl(${e}, ${s}%, ${n}%)`}const ji={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},$i={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function wo(){const i={},t=Object.keys($i),e=Object.keys(ji);let s,n,o,a,r;for(s=0;s>16&255,o>>8&255,o&255]}return i}let we;function Mo(i){we||(we=wo(),we.transparent=[0,0,0,0]);const t=we[i.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const So=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function Po(i){const t=So.exec(i);let e=255,s,n,o;if(t){if(t[7]!==s){const a=+t[7];e=t[8]?se(a):gt(a*255,0,255)}return s=+t[1],n=+t[3],o=+t[5],s=255&(t[2]?se(s):gt(s,0,255)),n=255&(t[4]?se(n):gt(n,0,255)),o=255&(t[6]?se(o):gt(o,0,255)),{r:s,g:n,b:o,a:e}}}function Co(i){return i&&(i.a<255?`rgba(${i.r}, ${i.g}, ${i.b}, ${dt(i.a)})`:`rgb(${i.r}, ${i.g}, ${i.b})`)}const ii=i=>i<=.0031308?i*12.92:Math.pow(i,1/2.4)*1.055-.055,jt=i=>i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4);function Do(i,t,e){const s=jt(dt(i.r)),n=jt(dt(i.g)),o=jt(dt(i.b));return{r:xt(ii(s+e*(jt(dt(t.r))-s))),g:xt(ii(n+e*(jt(dt(t.g))-n))),b:xt(ii(o+e*(jt(dt(t.b))-o))),a:i.a+e*(t.a-i.a)}}function Me(i,t,e){if(i){let s=Si(i);s[t]=Math.max(0,Math.min(s[t]+s[t]*e,t===0?360:1)),s=Ci(s),i.r=s[0],i.g=s[1],i.b=s[2]}}function rn(i,t){return i&&Object.assign(t||{},i)}function Yi(i){var t={r:0,g:0,b:0,a:255};return Array.isArray(i)?i.length>=3&&(t={r:i[0],g:i[1],b:i[2],a:255},i.length>3&&(t.a=xt(i[3]))):(t=rn(i,{r:0,g:0,b:0,a:1}),t.a=xt(t.a)),t}function Oo(i){return i.charAt(0)==="r"?Po(i):yo(i)}class de{constructor(t){if(t instanceof de)return t;const e=typeof t;let s;e==="object"?s=Yi(t):e==="string"&&(s=ho(t)||Mo(t)||Oo(t)),this._rgb=s,this._valid=!!s}get valid(){return this._valid}get rgb(){var t=rn(this._rgb);return t&&(t.a=dt(t.a)),t}set rgb(t){this._rgb=Yi(t)}rgbString(){return this._valid?Co(this._rgb):void 0}hexString(){return this._valid?uo(this._rgb):void 0}hslString(){return this._valid?ko(this._rgb):void 0}mix(t,e){if(t){const s=this.rgb,n=t.rgb;let o;const a=e===o?.5:e,r=2*a-1,l=s.a-n.a,c=((r*l===-1?r:(r+l)/(1+r*l))+1)/2;o=1-c,s.r=255&c*s.r+o*n.r+.5,s.g=255&c*s.g+o*n.g+.5,s.b=255&c*s.b+o*n.b+.5,s.a=a*s.a+(1-a)*n.a,this.rgb=s}return this}interpolate(t,e){return t&&(this._rgb=Do(this._rgb,t._rgb,e)),this}clone(){return new de(this.rgb)}alpha(t){return this._rgb.a=xt(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=be(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){const e=this._rgb;return e.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Me(this._rgb,2,t),this}darken(t){return Me(this._rgb,2,-t),this}saturate(t){return Me(this._rgb,1,t),this}desaturate(t){return Me(this._rgb,1,-t),this}rotate(t){return vo(this._rgb,t),this}}/*!
+ * Chart.js v4.4.3
+ * https://www.chartjs.org
+ * (c) 2024 Chart.js Contributors
+ * Released under the MIT License
+ */function lt(){}const To=(()=>{let i=0;return()=>i++})();function A(i){return i===null||typeof i>"u"}function E(i){if(Array.isArray&&Array.isArray(i))return!0;const t=Object.prototype.toString.call(i);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function T(i){return i!==null&&Object.prototype.toString.call(i)==="[object Object]"}function V(i){return(typeof i=="number"||i instanceof Number)&&isFinite(+i)}function K(i,t){return V(i)?i:t}function D(i,t){return typeof i>"u"?t:i}const Lo=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100*t:+i;function R(i,t,e){if(i&&typeof i.call=="function")return i.apply(e,t)}function F(i,t,e,s){let n,o,a;if(E(i))for(o=i.length,n=0;ni,x:i=>i.x,y:i=>i.y};function Io(i){const t=i.split("."),e=[];let s="";for(const n of t)s+=n,s.endsWith("\\")?s=s.slice(0,-1)+".":(e.push(s),s="");return e}function Ro(i){const t=Io(i);return e=>{for(const s of t){if(s==="")break;e=e&&e[s]}return e}}function Yt(i,t){return(Ui[t]||(Ui[t]=Ro(t)))(i)}function Di(i){return i.charAt(0).toUpperCase()+i.slice(1)}const ue=i=>typeof i<"u",_t=i=>typeof i=="function",Xi=(i,t)=>{if(i.size!==t.size)return!1;for(const e of i)if(!t.has(e))return!1;return!0};function Eo(i){return i.type==="mouseup"||i.type==="click"||i.type==="contextmenu"}const H=Math.PI,tt=2*H,zo=tt+H,Ue=Number.POSITIVE_INFINITY,Bo=H/180,q=H/2,St=H/4,Ki=H*2/3,pt=Math.log10,at=Math.sign;function le(i,t,e){return Math.abs(i-t)n-o).pop(),t}function Ut(i){return!isNaN(parseFloat(i))&&isFinite(i)}function Wo(i,t){const e=Math.round(i);return e-t<=i&&e+t>=i}function cn(i,t,e){let s,n,o;for(s=0,n=i.length;sl&&c=Math.min(t,e)-s&&i<=Math.max(t,e)+s}function Ti(i,t,e){e=e||(a=>i[a]1;)o=n+s>>1,e(o)?n=o:s=o;return{lo:n,hi:s}}const At=(i,t,e,s)=>Ti(i,e,s?n=>{const o=i[n][t];return oi[n][t]Ti(i,e,s=>i[s][t]>=e);function Yo(i,t,e){let s=0,n=i.length;for(;ss&&i[n-1]>e;)n--;return s>0||n{const s="_onData"+Di(e),n=i[e];Object.defineProperty(i,e,{configurable:!0,enumerable:!1,value(...o){const a=n.apply(this,o);return i._chartjs.listeners.forEach(r=>{typeof r[s]=="function"&&r[s](...o)}),a}})})}function Zi(i,t){const e=i._chartjs;if(!e)return;const s=e.listeners,n=s.indexOf(t);n!==-1&&s.splice(n,1),!(s.length>0)&&(dn.forEach(o=>{delete i[o]}),delete i._chartjs)}function fn(i){const t=new Set(i);return t.size===i.length?i:Array.from(t)}const un=function(){return typeof window>"u"?function(i){return i()}:window.requestAnimationFrame}();function gn(i,t){let e=[],s=!1;return function(...n){e=n,s||(s=!0,un.call(window,()=>{s=!1,i.apply(t,e)}))}}function Xo(i,t){let e;return function(...s){return t?(clearTimeout(e),e=setTimeout(i,t,s)):i.apply(this,s),t}}const Li=i=>i==="start"?"left":i==="end"?"right":"center",j=(i,t,e)=>i==="start"?t:i==="end"?e:(t+e)/2,Ko=(i,t,e,s)=>i===(s?"left":"right")?e:i==="center"?(t+e)/2:t;function pn(i,t,e){const s=t.length;let n=0,o=s;if(i._sorted){const{iScale:a,_parsed:r}=i,l=a.axis,{min:c,max:h,minDefined:d,maxDefined:f}=a.getUserBounds();d&&(n=G(Math.min(At(r,l,c).lo,e?s:At(t,l,a.getPixelForValue(c)).lo),0,s-1)),f?o=G(Math.max(At(r,a.axis,h,!0).hi+1,e?0:At(t,l,a.getPixelForValue(h),!0).hi+1),n,s)-n:o=s-n}return{start:n,count:o}}function mn(i){const{xScale:t,yScale:e,_scaleRanges:s}=i,n={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!s)return i._scaleRanges=n,!0;const o=s.xmin!==t.min||s.xmax!==t.max||s.ymin!==e.min||s.ymax!==e.max;return Object.assign(s,n),o}const Se=i=>i===0||i===1,Qi=(i,t,e)=>-(Math.pow(2,10*(i-=1))*Math.sin((i-t)*tt/e)),Ji=(i,t,e)=>Math.pow(2,-10*i)*Math.sin((i-t)*tt/e)+1,ce={linear:i=>i,easeInQuad:i=>i*i,easeOutQuad:i=>-i*(i-2),easeInOutQuad:i=>(i/=.5)<1?.5*i*i:-.5*(--i*(i-2)-1),easeInCubic:i=>i*i*i,easeOutCubic:i=>(i-=1)*i*i+1,easeInOutCubic:i=>(i/=.5)<1?.5*i*i*i:.5*((i-=2)*i*i+2),easeInQuart:i=>i*i*i*i,easeOutQuart:i=>-((i-=1)*i*i*i-1),easeInOutQuart:i=>(i/=.5)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2),easeInQuint:i=>i*i*i*i*i,easeOutQuint:i=>(i-=1)*i*i*i*i+1,easeInOutQuint:i=>(i/=.5)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2),easeInSine:i=>-Math.cos(i*q)+1,easeOutSine:i=>Math.sin(i*q),easeInOutSine:i=>-.5*(Math.cos(H*i)-1),easeInExpo:i=>i===0?0:Math.pow(2,10*(i-1)),easeOutExpo:i=>i===1?1:-Math.pow(2,-10*i)+1,easeInOutExpo:i=>Se(i)?i:i<.5?.5*Math.pow(2,10*(i*2-1)):.5*(-Math.pow(2,-10*(i*2-1))+2),easeInCirc:i=>i>=1?i:-(Math.sqrt(1-i*i)-1),easeOutCirc:i=>Math.sqrt(1-(i-=1)*i),easeInOutCirc:i=>(i/=.5)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1),easeInElastic:i=>Se(i)?i:Qi(i,.075,.3),easeOutElastic:i=>Se(i)?i:Ji(i,.075,.3),easeInOutElastic(i){return Se(i)?i:i<.5?.5*Qi(i*2,.1125,.45):.5+.5*Ji(i*2-1,.1125,.45)},easeInBack(i){return i*i*((1.70158+1)*i-1.70158)},easeOutBack(i){return(i-=1)*i*((1.70158+1)*i+1.70158)+1},easeInOutBack(i){let t=1.70158;return(i/=.5)<1?.5*(i*i*(((t*=1.525)+1)*i-t)):.5*((i-=2)*i*(((t*=1.525)+1)*i+t)+2)},easeInBounce:i=>1-ce.easeOutBounce(1-i),easeOutBounce(i){return i<1/2.75?7.5625*i*i:i<2/2.75?7.5625*(i-=1.5/2.75)*i+.75:i<2.5/2.75?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*(i-=2.625/2.75)*i+.984375},easeInOutBounce:i=>i<.5?ce.easeInBounce(i*2)*.5:ce.easeOutBounce(i*2-1)*.5+.5};function Ai(i){if(i&&typeof i=="object"){const t=i.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function ts(i){return Ai(i)?i:new de(i)}function si(i){return Ai(i)?i:new de(i).saturate(.5).darken(.1).hexString()}const qo=["x","y","borderWidth","radius","tension"],Go=["color","borderColor","backgroundColor"];function Zo(i){i.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),i.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),i.set("animations",{colors:{type:"color",properties:Go},numbers:{type:"number",properties:qo}}),i.describe("animations",{_fallback:"animation"}),i.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function Qo(i){i.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const es=new Map;function Jo(i,t){t=t||{};const e=i+JSON.stringify(t);let s=es.get(e);return s||(s=new Intl.NumberFormat(i,t),es.set(e,s)),s}function Fi(i,t,e){return Jo(t,e).format(i)}const bn={values(i){return E(i)?i:""+i},numeric(i,t,e){if(i===0)return"0";const s=this.chart.options.locale;let n,o=i;if(e.length>1){const c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(n="scientific"),o=ta(i,e)}const a=pt(Math.abs(o)),r=isNaN(a)?1:Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:n,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(l,this.options.ticks.format),Fi(i,s,l)},logarithmic(i,t,e){if(i===0)return"0";const s=e[t].significand||i/Math.pow(10,Math.floor(pt(i)));return[1,2,3,5,10,15].includes(s)||t>.8*e.length?bn.numeric.call(this,i,t,e):""}};function ta(i,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&i!==Math.floor(i)&&(e=i-Math.floor(i)),e}var Qe={formatters:bn};function ea(i){i.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Qe.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),i.route("scale.ticks","color","","color"),i.route("scale.grid","color","","borderColor"),i.route("scale.border","color","","borderColor"),i.route("scale.title","color","","color"),i.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),i.describe("scales",{_fallback:"scale"}),i.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Et=Object.create(null),pi=Object.create(null);function he(i,t){if(!t)return i;const e=t.split(".");for(let s=0,n=e.length;ss.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(s,n)=>si(n.backgroundColor),this.hoverBorderColor=(s,n)=>si(n.borderColor),this.hoverColor=(s,n)=>si(n.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return ni(this,t,e)}get(t){return he(this,t)}describe(t,e){return ni(pi,t,e)}override(t,e){return ni(Et,t,e)}route(t,e,s,n){const o=he(this,t),a=he(this,s),r="_"+e;Object.defineProperties(o,{[r]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const l=this[r],c=a[n];return T(l)?Object.assign({},c,l):D(l,c)},set(l){this[r]=l}}})}apply(t){t.forEach(e=>e(this))}}var z=new ia({_scriptable:i=>!i.startsWith("on"),_indexable:i=>i!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Zo,Qo,ea]);function sa(i){return!i||A(i.size)||A(i.family)?null:(i.style?i.style+" ":"")+(i.weight?i.weight+" ":"")+i.size+"px "+i.family}function Xe(i,t,e,s,n){let o=t[n];return o||(o=t[n]=i.measureText(n).width,e.push(n)),o>s&&(s=o),s}function na(i,t,e,s){s=s||{};let n=s.data=s.data||{},o=s.garbageCollect=s.garbageCollect||[];s.font!==t&&(n=s.data={},o=s.garbageCollect=[],s.font=t),i.save(),i.font=t;let a=0;const r=e.length;let l,c,h,d,f;for(l=0;le.length){for(l=0;l0&&i.stroke()}}function ft(i,t,e){return e=e||.5,!t||i&&i.x>t.left-e&&i.xt.top-e&&i.y0&&o.strokeColor!=="";let l,c;for(i.save(),i.font=n.string,ra(i,o),l=0;l+i||0;function _n(i,t){const e={},s=T(t),n=s?Object.keys(t):t,o=T(i)?s?a=>D(i[a],i[t[a]]):a=>i[a]:()=>i;for(const a of n)e[a]=ua(o(a));return e}function yn(i){return _n(i,{top:"y",right:"x",bottom:"y",left:"x"})}function Ft(i){return _n(i,["topLeft","topRight","bottomLeft","bottomRight"])}function $(i){const t=yn(i);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function W(i,t){i=i||{},t=t||z.font;let e=D(i.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let s=D(i.style,t.style);s&&!(""+s).match(da)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const n={family:D(i.family,t.family),lineHeight:fa(D(i.lineHeight,t.lineHeight),e),size:e,style:s,weight:D(i.weight,t.weight),string:""};return n.string=sa(n),n}function Pe(i,t,e,s){let n,o,a;for(n=0,o=i.length;ne&&r===0?0:r+l;return{min:a(s,-Math.abs(o)),max:a(n,o)}}function yt(i,t){return Object.assign(Object.create(i),t)}function Ei(i,t=[""],e,s,n=()=>i[0]){const o=e||i;typeof s>"u"&&(s=Mn("_fallback",i));const a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:i,_rootScopes:o,_fallback:s,_getTarget:n,override:r=>Ei([r,...i],t,o,s)};return new Proxy(a,{deleteProperty(r,l){return delete r[l],delete r._keys,delete i[0][l],!0},get(r,l){return kn(r,l,()=>ka(l,t,i,r))},getOwnPropertyDescriptor(r,l){return Reflect.getOwnPropertyDescriptor(r._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(i[0])},has(r,l){return ns(r).includes(l)},ownKeys(r){return ns(r)},set(r,l,c){const h=r._storage||(r._storage=n());return r[l]=h[l]=c,delete r._keys,!0}})}function Xt(i,t,e,s){const n={_cacheable:!1,_proxy:i,_context:t,_subProxy:e,_stack:new Set,_descriptors:vn(i,s),setContext:o=>Xt(i,o,e,s),override:o=>Xt(i.override(o),t,e,s)};return new Proxy(n,{deleteProperty(o,a){return delete o[a],delete i[a],!0},get(o,a,r){return kn(o,a,()=>ma(o,a,r))},getOwnPropertyDescriptor(o,a){return o._descriptors.allKeys?Reflect.has(i,a)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(i,a)},getPrototypeOf(){return Reflect.getPrototypeOf(i)},has(o,a){return Reflect.has(i,a)},ownKeys(){return Reflect.ownKeys(i)},set(o,a,r){return i[a]=r,delete o[a],!0}})}function vn(i,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:s=t.indexable,_allKeys:n=t.allKeys}=i;return{allKeys:n,scriptable:e,indexable:s,isScriptable:_t(e)?e:()=>e,isIndexable:_t(s)?s:()=>s}}const pa=(i,t)=>i?i+Di(t):t,zi=(i,t)=>T(t)&&i!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function kn(i,t,e){if(Object.prototype.hasOwnProperty.call(i,t)||t==="constructor")return i[t];const s=e();return i[t]=s,s}function ma(i,t,e){const{_proxy:s,_context:n,_subProxy:o,_descriptors:a}=i;let r=s[t];return _t(r)&&a.isScriptable(t)&&(r=ba(t,r,i,e)),E(r)&&r.length&&(r=xa(t,r,i,a.isIndexable)),zi(t,r)&&(r=Xt(r,n,o&&o[t],a)),r}function ba(i,t,e,s){const{_proxy:n,_context:o,_subProxy:a,_stack:r}=e;if(r.has(i))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+i);r.add(i);let l=t(o,a||s);return r.delete(i),zi(i,l)&&(l=Bi(n._scopes,n,i,l)),l}function xa(i,t,e,s){const{_proxy:n,_context:o,_subProxy:a,_descriptors:r}=e;if(typeof o.index<"u"&&s(i))return t[o.index%t.length];if(T(t[0])){const l=t,c=n._scopes.filter(h=>h!==l);t=[];for(const h of l){const d=Bi(c,n,i,h);t.push(Xt(d,o,a&&a[i],r))}}return t}function wn(i,t,e){return _t(i)?i(t,e):i}const _a=(i,t)=>i===!0?t:typeof i=="string"?Yt(t,i):void 0;function ya(i,t,e,s,n){for(const o of t){const a=_a(e,o);if(a){i.add(a);const r=wn(a._fallback,e,n);if(typeof r<"u"&&r!==e&&r!==s)return r}else if(a===!1&&typeof s<"u"&&e!==s)return null}return!1}function Bi(i,t,e,s){const n=t._rootScopes,o=wn(t._fallback,e,s),a=[...i,...n],r=new Set;r.add(s);let l=ss(r,a,e,o||e,s);return l===null||typeof o<"u"&&o!==e&&(l=ss(r,a,o,l,s),l===null)?!1:Ei(Array.from(r),[""],n,o,()=>va(t,e,s))}function ss(i,t,e,s,n){for(;e;)e=ya(i,t,e,s,n);return e}function va(i,t,e){const s=i._getTarget();t in s||(s[t]={});const n=s[t];return E(n)&&T(e)?e:n||{}}function ka(i,t,e,s){let n;for(const o of t)if(n=Mn(pa(o,i),e),typeof n<"u")return zi(i,n)?Bi(e,s,i,n):n}function Mn(i,t){for(const e of t){if(!e)continue;const s=e[i];if(typeof s<"u")return s}}function ns(i){let t=i._keys;return t||(t=i._keys=wa(i._scopes)),t}function wa(i){const t=new Set;for(const e of i)for(const s of Object.keys(e).filter(n=>!n.startsWith("_")))t.add(s);return Array.from(t)}const Ma=Number.EPSILON||1e-14,Kt=(i,t)=>ti==="x"?"y":"x";function Sa(i,t,e,s){const n=i.skip?t:i,o=t,a=e.skip?t:e,r=gi(o,n),l=gi(a,o);let c=r/(r+l),h=l/(r+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const d=s*c,f=s*h;return{previous:{x:o.x-d*(a.x-n.x),y:o.y-d*(a.y-n.y)},next:{x:o.x+f*(a.x-n.x),y:o.y+f*(a.y-n.y)}}}function Pa(i,t,e){const s=i.length;let n,o,a,r,l,c=Kt(i,0);for(let h=0;h!c.skip)),t.cubicInterpolationMode==="monotone")Da(i,n);else{let c=s?i[i.length-1]:i[0];for(o=0,a=i.length;oi.ownerDocument.defaultView.getComputedStyle(i,null);function La(i,t){return Je(i).getPropertyValue(t)}const Aa=["top","right","bottom","left"];function It(i,t,e){const s={};e=e?"-"+e:"";for(let n=0;n<4;n++){const o=Aa[n];s[o]=parseFloat(i[t+"-"+o+e])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}const Fa=(i,t,e)=>(i>0||t>0)&&(!e||!e.shadowRoot);function Ia(i,t){const e=i.touches,s=e&&e.length?e[0]:i,{offsetX:n,offsetY:o}=s;let a=!1,r,l;if(Fa(n,o,i.target))r=n,l=o;else{const c=t.getBoundingClientRect();r=s.clientX-c.left,l=s.clientY-c.top,a=!0}return{x:r,y:l,box:a}}function Ot(i,t){if("native"in i)return i;const{canvas:e,currentDevicePixelRatio:s}=t,n=Je(e),o=n.boxSizing==="border-box",a=It(n,"padding"),r=It(n,"border","width"),{x:l,y:c,box:h}=Ia(i,e),d=a.left+(h&&r.left),f=a.top+(h&&r.top);let{width:u,height:p}=t;return o&&(u-=a.width+r.width,p-=a.height+r.height),{x:Math.round((l-d)/u*e.width/s),y:Math.round((c-f)/p*e.height/s)}}function Ra(i,t,e){let s,n;if(t===void 0||e===void 0){const o=i&&Wi(i);if(!o)t=i.clientWidth,e=i.clientHeight;else{const a=o.getBoundingClientRect(),r=Je(o),l=It(r,"border","width"),c=It(r,"padding");t=a.width-c.width-l.width,e=a.height-c.height-l.height,s=Ke(r.maxWidth,o,"clientWidth"),n=Ke(r.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:s||Ue,maxHeight:n||Ue}}const De=i=>Math.round(i*10)/10;function Ea(i,t,e,s){const n=Je(i),o=It(n,"margin"),a=Ke(n.maxWidth,i,"clientWidth")||Ue,r=Ke(n.maxHeight,i,"clientHeight")||Ue,l=Ra(i,t,e);let{width:c,height:h}=l;if(n.boxSizing==="content-box"){const f=It(n,"border","width"),u=It(n,"padding");c-=u.width+f.width,h-=u.height+f.height}return c=Math.max(0,c-o.width),h=Math.max(0,s?c/s:h-o.height),c=De(Math.min(c,a,l.maxWidth)),h=De(Math.min(h,r,l.maxHeight)),c&&!h&&(h=De(c/2)),(t!==void 0||e!==void 0)&&s&&l.height&&h>l.height&&(h=l.height,c=De(Math.floor(h*s))),{width:c,height:h}}function os(i,t,e){const s=t||1,n=Math.floor(i.height*s),o=Math.floor(i.width*s);i.height=Math.floor(i.height),i.width=Math.floor(i.width);const a=i.canvas;return a.style&&(e||!a.style.height&&!a.style.width)&&(a.style.height=`${i.height}px`,a.style.width=`${i.width}px`),i.currentDevicePixelRatio!==s||a.height!==n||a.width!==o?(i.currentDevicePixelRatio=s,a.height=n,a.width=o,i.ctx.setTransform(s,0,0,s,0,0),!0):!1}const za=function(){let i=!1;try{const t={get passive(){return i=!0,!1}};Hi()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return i}();function as(i,t){const e=La(i,t),s=e&&e.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function Tt(i,t,e,s){return{x:i.x+e*(t.x-i.x),y:i.y+e*(t.y-i.y)}}function Ba(i,t,e,s){return{x:i.x+e*(t.x-i.x),y:s==="middle"?e<.5?i.y:t.y:s==="after"?e<1?i.y:t.y:e>0?t.y:i.y}}function Ha(i,t,e,s){const n={x:i.cp2x,y:i.cp2y},o={x:t.cp1x,y:t.cp1y},a=Tt(i,n,e),r=Tt(n,o,e),l=Tt(o,t,e),c=Tt(a,r,e),h=Tt(r,l,e);return Tt(c,h,e)}const Wa=function(i,t){return{x(e){return i+i+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,s){return e-s},leftForLtr(e,s){return e-s}}},Va=function(){return{x(i){return i},setWidth(i){},textAlign(i){return i},xPlus(i,t){return i+t},leftForLtr(i,t){return i}}};function $t(i,t,e){return i?Wa(t,e):Va()}function Pn(i,t){let e,s;(t==="ltr"||t==="rtl")&&(e=i.canvas.style,s=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),i.prevTextDirection=s)}function Cn(i,t){t!==void 0&&(delete i.prevTextDirection,i.canvas.style.setProperty("direction",t[0],t[1]))}function Dn(i){return i==="angle"?{between:hn,compare:No,normalize:et}:{between:Lt,compare:(t,e)=>t-e,normalize:t=>t}}function rs({start:i,end:t,count:e,loop:s,style:n}){return{start:i%e,end:t%e,loop:s&&(t-i+1)%e===0,style:n}}function Na(i,t,e){const{property:s,start:n,end:o}=e,{between:a,normalize:r}=Dn(s),l=t.length;let{start:c,end:h,loop:d}=i,f,u;if(d){for(c+=l,h+=l,f=0,u=l;fl(n,v,b)&&r(n,v)!==0,_=()=>r(o,b)===0||l(o,v,b),M=()=>g||y(),k=()=>!g||_();for(let w=h,P=h;w<=d;++w)x=t[w%a],!x.skip&&(b=c(x[s]),b!==v&&(g=l(b,n,o),m===null&&M()&&(m=r(b,n)===0?w:P),m!==null&&k()&&(p.push(rs({start:m,end:w,loop:f,count:a,style:u})),m=null),P=w,v=b));return m!==null&&p.push(rs({start:m,end:d,loop:f,count:a,style:u})),p}function $a(i,t){const e=[],s=i.segments;for(let n=0;nn&&i[o%t].skip;)o--;return o%=t,{start:n,end:o}}function Ua(i,t,e,s){const n=i.length,o=[];let a=t,r=i[t],l;for(l=t+1;l<=e;++l){const c=i[l%n];c.skip||c.stop?r.skip||(s=!1,o.push({start:t%n,end:(l-1)%n,loop:s}),t=a=c.stop?l:null):(a=l,r.skip&&(t=l)),r=c}return a!==null&&o.push({start:t%n,end:a%n,loop:s}),o}function Xa(i,t){const e=i.points,s=i.options.spanGaps,n=e.length;if(!n)return[];const o=!!i._loop,{start:a,end:r}=Ya(e,n,o,s);if(s===!0)return ls(i,[{start:a,end:r,loop:o}],e,t);const l=rr({chart:t,initial:e.initial,numSteps:a,currentStep:Math.min(s-e.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=un.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((s,n)=>{if(!s.running||!s.items.length)return;const o=s.items;let a=o.length-1,r=!1,l;for(;a>=0;--a)l=o[a],l._active?(l._total>s.duration&&(s.duration=l._total),l.tick(t),r=!0):(o[a]=o[o.length-1],o.pop());r&&(n.draw(),this._notify(n,s,t,"progress")),o.length||(s.running=!1,this._notify(n,s,t,"complete"),s.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let s=e.get(t);return s||(s={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,s)),s}listen(t,e,s){this._getAnims(t).listeners[e].push(s)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((s,n)=>Math.max(s,n._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const s=e.items;let n=s.length-1;for(;n>=0;--n)s[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var ct=new Ga;const hs="transparent",Za={boolean(i,t,e){return e>.5?t:i},color(i,t,e){const s=ts(i||hs),n=s.valid&&ts(t||hs);return n&&n.valid?n.mix(s,e).hexString():t},number(i,t,e){return i+(t-i)*e}};class Qa{constructor(t,e,s,n){const o=e[s];n=Pe([t.to,n,o,t.from]);const a=Pe([t.from,o,n]);this._active=!0,this._fn=t.fn||Za[t.type||typeof a],this._easing=ce[t.easing]||ce.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=s,this._from=a,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,s){if(this._active){this._notify(!1);const n=this._target[this._prop],o=s-this._start,a=this._duration-o;this._start=s,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=Pe([t.to,e,n,t.from]),this._from=Pe([t.from,n,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,s=this._duration,n=this._prop,o=this._from,a=this._loop,r=this._to;let l;if(this._active=o!==r&&(a||e1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[n]=this._fn(o,r,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,s)=>{t.push({res:e,rej:s})})}_notify(t){const e=t?"res":"rej",s=this._promises||[];for(let n=0;n{const o=t[n];if(!T(o))return;const a={};for(const r of e)a[r]=o[r];(E(o.properties)&&o.properties||[n]).forEach(r=>{(r===n||!s.has(r))&&s.set(r,a)})})}_animateOptions(t,e){const s=e.options,n=tr(t,s);if(!n)return[];const o=this._createAnimations(n,s);return s.$shared&&Ja(t.options.$animations,s).then(()=>{t.options=s},()=>{}),o}_createAnimations(t,e){const s=this._properties,n=[],o=t.$animations||(t.$animations={}),a=Object.keys(e),r=Date.now();let l;for(l=a.length-1;l>=0;--l){const c=a[l];if(c.charAt(0)==="$")continue;if(c==="options"){n.push(...this._animateOptions(t,e));continue}const h=e[c];let d=o[c];const f=s.get(c);if(d)if(f&&d.active()){d.update(f,h,r);continue}else d.cancel();if(!f||!f.duration){t[c]=h;continue}o[c]=d=new Qa(f,t,c,h),n.push(d)}return n}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const s=this._createAnimations(t,e);if(s.length)return ct.add(this._chart,s),!0}}function Ja(i,t){const e=[],s=Object.keys(t);for(let n=0;n0||!e&&o<0)return n.index}return null}function ps(i,t){const{chart:e,_cachedMeta:s}=i,n=e._stacks||(e._stacks={}),{iScale:o,vScale:a,index:r}=s,l=o.axis,c=a.axis,h=nr(o,a,s),d=t.length;let f;for(let u=0;ue[s].axis===t).shift()}function rr(i,t){return yt(i,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function lr(i,t,e){return yt(i,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function Qt(i,t){const e=i.controller.index,s=i.vScale&&i.vScale.axis;if(s){t=t||i._parsed;for(const n of t){const o=n._stacks;if(!o||o[s]===void 0||o[s][e]===void 0)return;delete o[s][e],o[s]._visualValues!==void 0&&o[s]._visualValues[e]!==void 0&&delete o[s]._visualValues[e]}}}const ai=i=>i==="reset"||i==="none",ms=(i,t)=>t?i:Object.assign({},i),cr=(i,t,e)=>i&&!t.hidden&&t._stacked&&{keys:Tn(e,!0),values:null};class Rt{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=us(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&Qt(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,s=this.getDataset(),n=(d,f,u,p)=>d==="x"?f:d==="r"?p:u,o=e.xAxisID=D(s.xAxisID,oi(t,"x")),a=e.yAxisID=D(s.yAxisID,oi(t,"y")),r=e.rAxisID=D(s.rAxisID,oi(t,"r")),l=e.indexAxis,c=e.iAxisID=n(l,o,a,r),h=e.vAxisID=n(l,a,o,r);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(a),e.rScale=this.getScaleForId(r),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Zi(this._data,this),t._stacked&&Qt(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),s=this._data;if(T(e)){const n=this._cachedMeta;this._data=sr(e,n)}else if(s!==e){if(s){Zi(s,this);const n=this._cachedMeta;Qt(n),n._parsed=[]}e&&Object.isExtensible(e)&&Uo(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,s=this.getDataset();let n=!1;this._dataCheck();const o=e._stacked;e._stacked=us(e.vScale,e),e.stack!==s.stack&&(n=!0,Qt(e),e.stack=s.stack),this._resyncElements(t),(n||o!==e._stacked)&&ps(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),s=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(s,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:s,_data:n}=this,{iScale:o,_stacked:a}=s,r=o.axis;let l=t===0&&e===n.length?!0:s._sorted,c=t>0&&s._parsed[t-1],h,d,f;if(this._parsing===!1)s._parsed=n,s._sorted=!0,f=n;else{E(n[t])?f=this.parseArrayData(s,n,t,e):T(n[t])?f=this.parseObjectData(s,n,t,e):f=this.parsePrimitiveData(s,n,t,e);const u=()=>d[r]===null||c&&d[r]g||d=0;--f)if(!p()){this.updateRangeFromParsed(c,t,u,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,s=[];let n,o,a;for(n=0,o=e.length;n=0&&tthis.getContext(s,n,e),g=c.resolveNamedOptions(f,u,p,d);return g.$shared&&(g.$shared=l,o[a]=Object.freeze(ms(g,l))),g}_resolveAnimations(t,e,s){const n=this.chart,o=this._cachedDataOpts,a=`animation-${e}`,r=o[a];if(r)return r;let l;if(n.options.animation!==!1){const h=this.chart.config,d=h.datasetAnimationScopeKeys(this._type,e),f=h.getOptionScopes(this.getDataset(),d);l=h.createResolver(f,this.getContext(t,s,e))}const c=new On(n,l&&l.animations);return l&&l._cacheable&&(o[a]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||ai(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const s=this.resolveDataElementOptions(t,e),n=this._sharedOptions,o=this.getSharedOptions(s),a=this.includeOptions(e,o)||o!==n;return this.updateSharedOptions(o,e,s),{sharedOptions:o,includeOptions:a}}updateElement(t,e,s,n){ai(n)?Object.assign(t,s):this._resolveAnimations(e,n).update(t,s)}updateSharedOptions(t,e,s){t&&!ai(e)&&this._resolveAnimations(void 0,e).update(t,s)}_setStyle(t,e,s,n){t.active=n;const o=this.getStyle(e,n);this._resolveAnimations(e,s,n).update(t,{options:!n&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,s){this._setStyle(t,s,"active",!1)}setHoverStyle(t,e,s){this._setStyle(t,s,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,s=this._cachedMeta.data;for(const[r,l,c]of this._syncList)this[r](l,c);this._syncList=[];const n=s.length,o=e.length,a=Math.min(o,n);a&&this.parse(0,a),o>n?this._insertElements(n,o-n,t):o{for(c.length+=e,r=c.length-1;r>=a;r--)c[r]=c[r-e]};for(l(o),r=t;rn-o))}return i._cache.$bar}function dr(i){const t=i.iScale,e=hr(t,i.type);let s=t._length,n,o,a,r;const l=()=>{a===32767||a===-32768||(ue(r)&&(s=Math.min(s,Math.abs(a-r)||s)),r=a)};for(n=0,o=e.length;n0?n[i-1]:null,r=iMath.abs(r)&&(l=r,c=a),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:n,end:o,min:a,max:r}}function Ln(i,t,e,s){return E(i)?gr(i,t,e,s):t[e.axis]=e.parse(i,s),t}function bs(i,t,e,s){const n=i.iScale,o=i.vScale,a=n.getLabels(),r=n===o,l=[];let c,h,d,f;for(c=e,h=e+s;c=e?1:-1)}function mr(i){let t,e,s,n,o;return i.horizontal?(t=i.base>i.x,e="left",s="right"):(t=i.basel.controller.options.grouped),o=s.options.stacked,a=[],r=l=>{const c=l.controller.getParsed(e),h=c&&c[l.vScale.axis];if(A(h)||isNaN(h))return!0};for(const l of n)if(!(e!==void 0&&r(l))&&((o===!1||a.indexOf(l.stack)===-1||o===void 0&&l.stack===void 0)&&a.push(l.stack),l.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,s){const n=this._getStacks(t,s),o=e!==void 0?n.indexOf(e):-1;return o===-1?n.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,s=e.iScale,n=[];let o,a;for(o=0,a=e.data.length;o0&&this.getParsed(e-1);for(let _=0;_=x){k.skip=!0;continue}const w=this.getParsed(_),P=A(w[u]),O=k[f]=a.getPixelForValue(w[f],_),C=k[u]=o||P?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,w,l):w[u],_);k.skip=isNaN(O)||isNaN(C)||P,k.stop=_>0&&Math.abs(w[f]-y[f])>m,g&&(k.parsed=w,k.raw=c.data[_]),d&&(k.options=h||this.resolveDataElementOptions(_,M.active?"active":n)),b||this.updateElement(M,_,k,n),y=w}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,s=e.options&&e.options.borderWidth||0,n=t.data||[];if(!n.length)return s;const o=n[0].size(this.resolveDataElementOptions(0)),a=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(s,o,a)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}S(Be,"id","line"),S(Be,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),S(Be,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class He extends Rt{getLabelAndValue(t){const e=this._cachedMeta,s=this.chart.data.labels||[],{xScale:n,yScale:o}=e,a=this.getParsed(t),r=n.getLabelForValue(a.x),l=o.getLabelForValue(a.y);return{label:s[t]||"",value:"("+r+", "+l+")"}}update(t){const e=this._cachedMeta,{data:s=[]}=e,n=this.chart._animationsDisabled;let{start:o,count:a}=pn(e,s,n);if(this._drawStart=o,this._drawCount=a,mn(e)&&(o=0,a=s.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:r,_dataset:l}=e;r._chart=this.chart,r._datasetIndex=this.index,r._decimated=!!l._decimated,r.points=s;const c=this.resolveDatasetElementOptions(t);c.segment=this.options.segment,this.updateElement(r,void 0,{animated:!n,options:c},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(s,o,a,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,s,n){const o=n==="reset",{iScale:a,vScale:r,_stacked:l,_dataset:c}=this._cachedMeta,h=this.resolveDataElementOptions(e,n),d=this.getSharedOptions(h),f=this.includeOptions(n,d),u=a.axis,p=r.axis,{spanGaps:g,segment:m}=this.options,b=Ut(g)?g:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||o||n==="none";let v=e>0&&this.getParsed(e-1);for(let y=e;y0&&Math.abs(M[u]-v[u])>b,m&&(k.parsed=M,k.raw=c.data[y]),f&&(k.options=d||this.resolveDataElementOptions(y,_.active?"active":n)),x||this.updateElement(_,y,k,n),v=M}this.updateSharedOptions(d,n,h)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let r=0;for(let l=e.length-1;l>=0;--l)r=Math.max(r,e[l].size(this.resolveDataElementOptions(l))/2);return r>0&&r}const s=t.dataset,n=s.options&&s.options.borderWidth||0;if(!e.length)return n;const o=e[0].size(this.resolveDataElementOptions(0)),a=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(n,o,a)/2}}S(He,"id","scatter"),S(He,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),S(He,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}});function Ct(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Vi{constructor(t){S(this,"options");this.options=t||{}}static override(t){Object.assign(Vi.prototype,t)}init(){}formats(){return Ct()}parse(){return Ct()}format(){return Ct()}add(){return Ct()}diff(){return Ct()}startOf(){return Ct()}endOf(){return Ct()}}var yr={_date:Vi};function vr(i,t,e,s){const{controller:n,data:o,_sorted:a}=i,r=n._cachedMeta.iScale;if(r&&t===r.axis&&t!=="r"&&a&&o.length){const l=r._reversePixels?$o:At;if(s){if(n._sharedOptions){const c=o[0],h=typeof c.getRange=="function"&&c.getRange(t);if(h){const d=l(o,t,e-h),f=l(o,t,e+h);return{lo:d.lo,hi:f.hi}}}}else return l(o,t,e)}return{lo:0,hi:o.length-1}}function xe(i,t,e,s,n){const o=i.getSortedVisibleDatasetMetas(),a=e[t];for(let r=0,l=o.length;r{l[a](t[e],n)&&(o.push({element:l,datasetIndex:c,index:h}),r=r||l.inRange(t.x,t.y,n))}),s&&!r?[]:o}var Sr={evaluateInteractionItems:xe,modes:{index(i,t,e,s){const n=Ot(t,i),o=e.axis||"x",a=e.includeInvisible||!1,r=e.intersect?li(i,n,o,s,a):ci(i,n,o,!1,s,a),l=[];return r.length?(i.getSortedVisibleDatasetMetas().forEach(c=>{const h=r[0].index,d=c.data[h];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:h})}),l):[]},dataset(i,t,e,s){const n=Ot(t,i),o=e.axis||"xy",a=e.includeInvisible||!1;let r=e.intersect?li(i,n,o,s,a):ci(i,n,o,!1,s,a);if(r.length>0){const l=r[0].datasetIndex,c=i.getDatasetMeta(l).data;r=[];for(let h=0;he.pos===t)}function vs(i,t){return i.filter(e=>An.indexOf(e.pos)===-1&&e.box.axis===t)}function te(i,t){return i.sort((e,s)=>{const n=t?s:e,o=t?e:s;return n.weight===o.weight?n.index-o.index:n.weight-o.weight})}function Pr(i){const t=[];let e,s,n,o,a,r;for(e=0,s=(i||[]).length;ec.box.fullSize),!0),s=te(Jt(t,"left"),!0),n=te(Jt(t,"right")),o=te(Jt(t,"top"),!0),a=te(Jt(t,"bottom")),r=vs(t,"x"),l=vs(t,"y");return{fullSize:e,leftAndTop:s.concat(o),rightAndBottom:n.concat(l).concat(a).concat(r),chartArea:Jt(t,"chartArea"),vertical:s.concat(n).concat(l),horizontal:o.concat(a).concat(r)}}function ks(i,t,e,s){return Math.max(i[e],t[e])+Math.max(i[s],t[s])}function Fn(i,t){i.top=Math.max(i.top,t.top),i.left=Math.max(i.left,t.left),i.bottom=Math.max(i.bottom,t.bottom),i.right=Math.max(i.right,t.right)}function Tr(i,t,e,s){const{pos:n,box:o}=e,a=i.maxPadding;if(!T(n)){e.size&&(i[n]-=e.size);const d=s[e.stack]||{size:0,count:1};d.size=Math.max(d.size,e.horizontal?o.height:o.width),e.size=d.size/d.count,i[n]+=e.size}o.getPadding&&Fn(a,o.getPadding());const r=Math.max(0,t.outerWidth-ks(a,i,"left","right")),l=Math.max(0,t.outerHeight-ks(a,i,"top","bottom")),c=r!==i.w,h=l!==i.h;return i.w=r,i.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function Lr(i){const t=i.maxPadding;function e(s){const n=Math.max(t[s]-i[s],0);return i[s]+=n,n}i.y+=e("top"),i.x+=e("left"),e("right"),e("bottom")}function Ar(i,t){const e=t.maxPadding;function s(n){const o={left:0,top:0,right:0,bottom:0};return n.forEach(a=>{o[a]=Math.max(t[a],e[a])}),o}return s(i?["left","right"]:["top","bottom"])}function ne(i,t,e,s){const n=[];let o,a,r,l,c,h;for(o=0,a=i.length,c=0;o{typeof g.beforeLayout=="function"&&g.beforeLayout()});const h=l.reduce((g,m)=>m.box.options&&m.box.options.display===!1?g:g+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:e,padding:n,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/h,hBoxMaxHeight:a/2}),f=Object.assign({},n);Fn(f,$(s));const u=Object.assign({maxPadding:f,w:o,h:a,x:n.left,y:n.top},n),p=Dr(l.concat(c),d);ne(r.fullSize,u,d,p),ne(l,u,d,p),ne(c,u,d,p)&&ne(l,u,d,p),Lr(u),ws(r.leftAndTop,u,d,p),u.x+=u.w,u.y+=u.h,ws(r.rightAndBottom,u,d,p),i.chartArea={left:u.left,top:u.top,right:u.left+u.w,bottom:u.top+u.h,height:u.h,width:u.w},F(r.chartArea,g=>{const m=g.box;Object.assign(m,i.chartArea),m.update(u.w,u.h,{left:0,top:0,right:0,bottom:0})})}};class In{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,s){}removeEventListener(t,e,s){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,s,n){return e=Math.max(0,e||t.width),s=s||t.height,{width:e,height:Math.max(0,n?Math.floor(e/n):s)}}isAttached(t){return!0}updateConfig(t){}}class Fr extends In{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const We="$chartjs",Ir={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Ms=i=>i===null||i==="";function Rr(i,t){const e=i.style,s=i.getAttribute("height"),n=i.getAttribute("width");if(i[We]={initial:{height:s,width:n,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",Ms(n)){const o=as(i,"width");o!==void 0&&(i.width=o)}if(Ms(s))if(i.style.height==="")i.height=i.width/(t||2);else{const o=as(i,"height");o!==void 0&&(i.height=o)}return i}const Rn=za?{passive:!0}:!1;function Er(i,t,e){i&&i.addEventListener(t,e,Rn)}function zr(i,t,e){i&&i.canvas&&i.canvas.removeEventListener(t,e,Rn)}function Br(i,t){const e=Ir[i.type]||i.type,{x:s,y:n}=Ot(i,t);return{type:e,chart:t,native:i,x:s!==void 0?s:null,y:n!==void 0?n:null}}function qe(i,t){for(const e of i)if(e===t||e.contains(t))return!0}function Hr(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||qe(r.addedNodes,s),a=a&&!qe(r.removedNodes,s);a&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}function Wr(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||qe(r.removedNodes,s),a=a&&!qe(r.addedNodes,s);a&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}const pe=new Map;let Ss=0;function En(){const i=window.devicePixelRatio;i!==Ss&&(Ss=i,pe.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function Vr(i,t){pe.size||window.addEventListener("resize",En),pe.set(i,t)}function Nr(i){pe.delete(i),pe.size||window.removeEventListener("resize",En)}function jr(i,t,e){const s=i.canvas,n=s&&Wi(s);if(!n)return;const o=gn((r,l)=>{const c=n.clientWidth;e(r,l),c{const l=r[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||o(c,h)});return a.observe(n),Vr(i,o),a}function hi(i,t,e){e&&e.disconnect(),t==="resize"&&Nr(i)}function $r(i,t,e){const s=i.canvas,n=gn(o=>{i.ctx!==null&&e(Br(o,i))},i);return Er(s,t,n),n}class Yr extends In{acquireContext(t,e){const s=t&&t.getContext&&t.getContext("2d");return s&&s.canvas===t?(Rr(t,e),s):null}releaseContext(t){const e=t.canvas;if(!e[We])return!1;const s=e[We].initial;["height","width"].forEach(o=>{const a=s[o];A(a)?e.removeAttribute(o):e.setAttribute(o,a)});const n=s.style||{};return Object.keys(n).forEach(o=>{e.style[o]=n[o]}),e.width=e.width,delete e[We],!0}addEventListener(t,e,s){this.removeEventListener(t,e);const n=t.$proxies||(t.$proxies={}),a={attach:Hr,detach:Wr,resize:jr}[e]||$r;n[e]=a(t,e,s)}removeEventListener(t,e){const s=t.$proxies||(t.$proxies={}),n=s[e];if(!n)return;({attach:hi,detach:hi,resize:hi}[e]||zr)(t,e,n),s[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,s,n){return Ea(t,e,s,n)}isAttached(t){const e=t&&Wi(t);return!!(e&&e.isConnected)}}function Ur(i){return!Hi()||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?Fr:Yr}class rt{constructor(){S(this,"x");S(this,"y");S(this,"active",!1);S(this,"options");S(this,"$animations")}tooltipPosition(t){const{x:e,y:s}=this.getProps(["x","y"],t);return{x:e,y:s}}hasValue(){return Ut(this.x)&&Ut(this.y)}getProps(t,e){const s=this.$animations;if(!e||!s)return this;const n={};return t.forEach(o=>{n[o]=s[o]&&s[o].active()?s[o]._to:this[o]}),n}}S(rt,"defaults",{}),S(rt,"defaultRoutes");function Xr(i,t){const e=i.options.ticks,s=Kr(i),n=Math.min(e.maxTicksLimit||s,s),o=e.major.enabled?Gr(t):[],a=o.length,r=o[0],l=o[a-1],c=[];if(a>n)return Zr(t,c,o,a/n),c;const h=qr(o,t,n);if(a>0){let d,f;const u=a>1?Math.round((l-r)/(a-1)):null;for(Te(t,c,h,A(u)?0:r-u,r),d=0,f=a-1;dn)return l}return Math.max(n,1)}function Gr(i){const t=[];let e,s;for(e=0,s=i.length;ei==="left"?"right":i==="right"?"left":i,Ps=(i,t,e)=>t==="top"||t==="left"?i[t]+e:i[t]-e,Cs=(i,t)=>Math.min(t||i,i);function Ds(i,t){const e=[],s=i.length/t,n=i.length;let o=0;for(;oa+r)))return l}function el(i,t){F(i,e=>{const s=e.gc,n=s.length/2;let o;if(n>t){for(o=0;os?s:e,s=n&&e>s?e:s,{min:K(e,K(s,e)),max:K(s,K(e,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){R(this.options.beforeUpdate,[this])}update(t,e,s){const{beginAtZero:n,grace:o,ticks:a}=this.options,r=a.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=s=Object.assign({left:0,right:0,top:0,bottom:0},s),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+s.left+s.right:this.height+s.top+s.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=ga(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=r=o||s<=1||!this.isHorizontal()){this.labelRotation=n;return}const h=this._getLabelSizes(),d=h.widest.width,f=h.highest.height,u=G(this.chart.width-d,0,this.maxWidth);r=t.offset?this.maxWidth/s:u/(s-1),d+6>r&&(r=u/(s-(t.offset?.5:1)),l=this.maxHeight-ee(t.grid)-e.padding-Os(t.title,this.chart.options.font),c=Math.sqrt(d*d+f*f),a=Oi(Math.min(Math.asin(G((h.highest.height+6)/r,-1,1)),Math.asin(G(l/c,-1,1))-Math.asin(G(f/c,-1,1)))),a=Math.max(n,Math.min(o,a))),this.labelRotation=a}afterCalculateLabelRotation(){R(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){R(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:s,title:n,grid:o}}=this,a=this._isVisible(),r=this.isHorizontal();if(a){const l=Os(n,e.options.font);if(r?(t.width=this.maxWidth,t.height=ee(o)+l):(t.height=this.maxHeight,t.width=ee(o)+l),s.display&&this.ticks.length){const{first:c,last:h,widest:d,highest:f}=this._getLabelSizes(),u=s.padding*2,p=mt(this.labelRotation),g=Math.cos(p),m=Math.sin(p);if(r){const b=s.mirror?0:m*d.width+g*f.height;t.height=Math.min(this.maxHeight,t.height+b+u)}else{const b=s.mirror?0:g*d.width+m*f.height;t.width=Math.min(this.maxWidth,t.width+b+u)}this._calculatePadding(c,h,m,g)}}this._handleMargins(),r?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,s,n){const{ticks:{align:o,padding:a},position:r}=this.options,l=this.labelRotation!==0,c=r!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,u=0;l?c?(f=n*t.width,u=s*e.height):(f=s*t.height,u=n*e.width):o==="start"?u=e.width:o==="end"?f=t.width:o!=="inner"&&(f=t.width/2,u=e.width/2),this.paddingLeft=Math.max((f-h+a)*this.width/(this.width-h),0),this.paddingRight=Math.max((u-d+a)*this.width/(this.width-d),0)}else{let h=e.height/2,d=t.height/2;o==="start"?(h=0,d=t.height):o==="end"&&(h=e.height,d=0),this.paddingTop=h+a,this.paddingBottom=d+a}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){R(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,s;for(e=0,s=t.length;e({width:a[P]||0,height:r[P]||0});return{first:w(0),last:w(e-1),widest:w(M),highest:w(k),widths:a,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return jo(this._alignToPixels?Pt(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&tr*n?r/s:l/n:l*n0}_computeGridLineItems(t){const e=this.axis,s=this.chart,n=this.options,{grid:o,position:a,border:r}=n,l=o.offset,c=this.isHorizontal(),d=this.ticks.length+(l?1:0),f=ee(o),u=[],p=r.setContext(this.getContext()),g=p.display?p.width:0,m=g/2,b=function(N){return Pt(s,N,g)};let x,v,y,_,M,k,w,P,O,C,L,Y;if(a==="top")x=b(this.bottom),k=this.bottom-f,P=x-m,C=b(t.top)+m,Y=t.bottom;else if(a==="bottom")x=b(this.top),C=t.top,Y=b(t.bottom)-m,k=x+m,P=this.top+f;else if(a==="left")x=b(this.right),M=this.right-f,w=x-m,O=b(t.left)+m,L=t.right;else if(a==="right")x=b(this.left),O=t.left,L=b(t.right)-m,M=x+m,w=this.left+f;else if(e==="x"){if(a==="center")x=b((t.top+t.bottom)/2+.5);else if(T(a)){const N=Object.keys(a)[0],Z=a[N];x=b(this.chart.scales[N].getPixelForValue(Z))}C=t.top,Y=t.bottom,k=x+m,P=k+f}else if(e==="y"){if(a==="center")x=b((t.left+t.right)/2);else if(T(a)){const N=Object.keys(a)[0],Z=a[N];x=b(this.chart.scales[N].getPixelForValue(Z))}M=x-m,w=M-f,O=t.left,L=t.right}const st=D(n.ticks.maxTicksLimit,d),B=Math.max(1,Math.ceil(d/st));for(v=0;v0&&(kt-=vt/2);break}ve={left:kt,top:Gt,width:vt+Wt.width,height:qt+Wt.height,color:B.backdropColor}}m.push({label:y,font:P,textOffset:L,options:{rotation:g,color:Z,strokeColor:_e,strokeWidth:ye,textAlign:Ht,textBaseline:Y,translation:[_,M],backdrop:ve}})}return m}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-mt(this.labelRotation))return t==="top"?"left":"right";let n="center";return e.align==="start"?n="left":e.align==="end"?n="right":e.align==="inner"&&(n="inner"),n}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:s,mirror:n,padding:o}}=this.options,a=this._getLabelSizes(),r=t+o,l=a.widest.width;let c,h;return e==="left"?n?(h=this.right+o,s==="near"?c="left":s==="center"?(c="center",h+=l/2):(c="right",h+=l)):(h=this.right-r,s==="near"?c="right":s==="center"?(c="center",h-=l/2):(c="left",h=this.left)):e==="right"?n?(h=this.left+o,s==="near"?c="right":s==="center"?(c="center",h-=l/2):(c="left",h-=l)):(h=this.left+r,s==="near"?c="left":s==="center"?(c="center",h+=l/2):(c="right",h=this.right)):c="right",{textAlign:c,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:s,top:n,width:o,height:a}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(s,n,o,a),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const n=this.ticks.findIndex(o=>o.value===t);return n>=0?e.setContext(this.getContext(n)).lineWidth:0}drawGrid(t){const e=this.options.grid,s=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,a;const r=(l,c,h)=>{!h.width||!h.color||(s.save(),s.lineWidth=h.width,s.strokeStyle=h.color,s.setLineDash(h.borderDash||[]),s.lineDashOffset=h.borderDashOffset,s.beginPath(),s.moveTo(l.x,l.y),s.lineTo(c.x,c.y),s.stroke(),s.restore())};if(e.display)for(o=0,a=n.length;o{this.draw(o)}}]:[{z:s,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),s=this.axis+"AxisID",n=[];let o,a;for(o=0,a=e.length;o{const s=e.split("."),n=s.pop(),o=[i].concat(s).join("."),a=t[e].split("."),r=a.pop(),l=a.join(".");z.route(o,n,l,r)})}function ll(i){return"id"in i&&"defaults"in i}class cl{constructor(){this.controllers=new Le(Rt,"datasets",!0),this.elements=new Le(rt,"elements"),this.plugins=new Le(Object,"plugins"),this.scales=new Le(Bt,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,s){[...e].forEach(n=>{const o=s||this._getRegistryForType(n);s||o.isForType(n)||o===this.plugins&&n.id?this._exec(t,o,n):F(n,a=>{const r=s||this._getRegistryForType(a);this._exec(t,r,a)})})}_exec(t,e,s){const n=Di(t);R(s["before"+n],[],s),e[t](s),R(s["after"+n],[],s)}_getRegistryForType(t){for(let e=0;eo.filter(r=>!a.some(l=>r.plugin.id===l.plugin.id));this._notify(n(e,s),t,"stop"),this._notify(n(s,e),t,"start")}}function dl(i){const t={},e=[],s=Object.keys(ot.plugins.items);for(let o=0;o1&&Ts(i[0].toLowerCase());if(s)return s}throw new Error(`Cannot determine type of '${i}' axis. Please provide 'axis' or 'position' option.`)}function Ls(i,t,e){if(e[t+"AxisID"]===i)return{axis:t}}function xl(i,t){if(t.data&&t.data.datasets){const e=t.data.datasets.filter(s=>s.xAxisID===i||s.yAxisID===i);if(e.length)return Ls(i,"x",e[0])||Ls(i,"y",e[0])}return{}}function _l(i,t){const e=Et[i.type]||{scales:{}},s=t.scales||{},n=bi(i.type,t),o=Object.create(null);return Object.keys(s).forEach(a=>{const r=s[a];if(!T(r))return console.error(`Invalid scale configuration for scale: ${a}`);if(r._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);const l=xi(a,r,xl(a,i),z.scales[r.type]),c=ml(l,n),h=e.scales||{};o[a]=re(Object.create(null),[{axis:l},r,h[l],h[c]])}),i.data.datasets.forEach(a=>{const r=a.type||i.type,l=a.indexAxis||bi(r,t),h=(Et[r]||{}).scales||{};Object.keys(h).forEach(d=>{const f=pl(d,l),u=a[f+"AxisID"]||f;o[u]=o[u]||Object.create(null),re(o[u],[{axis:f},s[u],h[d]])})}),Object.keys(o).forEach(a=>{const r=o[a];re(r,[z.scales[r.type],z.scale])}),o}function zn(i){const t=i.options||(i.options={});t.plugins=D(t.plugins,{}),t.scales=_l(i,t)}function Bn(i){return i=i||{},i.datasets=i.datasets||[],i.labels=i.labels||[],i}function yl(i){return i=i||{},i.data=Bn(i.data),zn(i),i}const As=new Map,Hn=new Set;function Ae(i,t){let e=As.get(i);return e||(e=t(),As.set(i,e),Hn.add(e)),e}const ie=(i,t,e)=>{const s=Yt(t,e);s!==void 0&&i.add(s)};class vl{constructor(t){this._config=yl(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Bn(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),zn(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Ae(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return Ae(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return Ae(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,s=this.type;return Ae(`${s}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const s=this._scopeCache;let n=s.get(t);return(!n||e)&&(n=new Map,s.set(t,n)),n}getOptionScopes(t,e,s){const{options:n,type:o}=this,a=this._cachedScopes(t,s),r=a.get(e);if(r)return r;const l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(d=>ie(l,t,d))),h.forEach(d=>ie(l,n,d)),h.forEach(d=>ie(l,Et[o]||{},d)),h.forEach(d=>ie(l,z,d)),h.forEach(d=>ie(l,pi,d))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Hn.has(e)&&a.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,Et[e]||{},z.datasets[e]||{},{type:e},z,pi]}resolveNamedOptions(t,e,s,n=[""]){const o={$shared:!0},{resolver:a,subPrefixes:r}=Fs(this._resolverCache,t,n);let l=a;if(wl(a,e)){o.$shared=!1,s=_t(s)?s():s;const c=this.createResolver(t,s,r);l=Xt(a,s,c)}for(const c of e)o[c]=l[c];return o}createResolver(t,e,s=[""],n){const{resolver:o}=Fs(this._resolverCache,t,s);return T(e)?Xt(o,e,void 0,n):o}}function Fs(i,t,e){let s=i.get(t);s||(s=new Map,i.set(t,s));const n=e.join();let o=s.get(n);return o||(o={resolver:Ei(t,e),subPrefixes:e.filter(r=>!r.toLowerCase().includes("hover"))},s.set(n,o)),o}const kl=i=>T(i)&&Object.getOwnPropertyNames(i).some(t=>_t(i[t]));function wl(i,t){const{isScriptable:e,isIndexable:s}=vn(i);for(const n of t){const o=e(n),a=s(n),r=(a||o)&&i[n];if(o&&(_t(r)||kl(r))||a&&E(r))return!0}return!1}var Ml="4.4.3";const Sl=["top","bottom","left","right","chartArea"];function Is(i,t){return i==="top"||i==="bottom"||Sl.indexOf(i)===-1&&t==="x"}function Rs(i,t){return function(e,s){return e[i]===s[i]?e[t]-s[t]:e[i]-s[i]}}function Es(i){const t=i.chart,e=t.options.animation;t.notifyPlugins("afterRender"),R(e&&e.onComplete,[i],t)}function Pl(i){const t=i.chart,e=t.options.animation;R(e&&e.onProgress,[i],t)}function Wn(i){return Hi()&&typeof i=="string"?i=document.getElementById(i):i&&i.length&&(i=i[0]),i&&i.canvas&&(i=i.canvas),i}const Ve={},zs=i=>{const t=Wn(i);return Object.values(Ve).filter(e=>e.canvas===t).pop()};function Cl(i,t,e){const s=Object.keys(i);for(const n of s){const o=+n;if(o>=t){const a=i[n];delete i[n],(e>0||o>t)&&(i[o+e]=a)}}}function Dl(i,t,e,s){return!e||i.type==="mouseout"?null:s?t:i}function Fe(i,t,e){return i.options.clip?i[e]:t[e]}function Ol(i,t){const{xScale:e,yScale:s}=i;return e&&s?{left:Fe(e,t,"left"),right:Fe(e,t,"right"),top:Fe(s,t,"top"),bottom:Fe(s,t,"bottom")}:t}class it{static register(...t){ot.add(...t),Bs()}static unregister(...t){ot.remove(...t),Bs()}constructor(t,e){const s=this.config=new vl(e),n=Wn(t),o=zs(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const a=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||Ur(n)),this.platform.updateConfig(s);const r=this.platform.acquireContext(n,a.aspectRatio),l=r&&r.canvas,c=l&&l.height,h=l&&l.width;if(this.id=To(),this.ctx=r,this.canvas=l,this.width=h,this.height=c,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new hl,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Xo(d=>this.update(d),a.resizeDelay||0),this._dataChanges=[],Ve[this.id]=this,!r||!l){console.error("Failed to create chart: can't acquire context from the given item");return}ct.listen(this,"complete",Es),ct.listen(this,"progress",Pl),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:s,height:n,_aspectRatio:o}=this;return A(t)?e&&o?o:n?s/n:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return ot}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():os(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return is(this.canvas,this.ctx),this}stop(){return ct.stop(this),this}resize(t,e){ct.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const s=this.options,n=this.canvas,o=s.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(n,t,e,o),r=s.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,os(this,r,!0)&&(this.notifyPlugins("resize",{size:a}),R(s.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};F(e,(s,n)=>{s.id=n})}buildOrUpdateScales(){const t=this.options,e=t.scales,s=this.scales,n=Object.keys(s).reduce((a,r)=>(a[r]=!1,a),{});let o=[];e&&(o=o.concat(Object.keys(e).map(a=>{const r=e[a],l=xi(a,r),c=l==="r",h=l==="x";return{options:r,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),F(o,a=>{const r=a.options,l=r.id,c=xi(l,r),h=D(r.type,a.dtype);(r.position===void 0||Is(r.position,c)!==Is(a.dposition))&&(r.position=a.dposition),n[l]=!0;let d=null;if(l in s&&s[l].type===h)d=s[l];else{const f=ot.getScale(h);d=new f({id:l,type:h,ctx:this.ctx,chart:this}),s[d.id]=d}d.init(r,t)}),F(n,(a,r)=>{a||delete s[r]}),F(s,a=>{J.configure(this,a,a.options),J.addBox(this,a)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,s=t.length;if(t.sort((n,o)=>n.index-o.index),s>e){for(let n=e;ne.length&&delete this._stacks,t.forEach((s,n)=>{e.filter(o=>o===s._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let s,n;for(this._removeUnreferencedMetasets(),s=0,n=e.length;s{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const s=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),n=this._animationsDisabled=!s.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let c=0,h=this.data.datasets.length;c{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Rs("z","_idx"));const{_active:r,_lastEvent:l}=this;l?this._eventHandler(l,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){F(this.scales,t=>{J.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),s=new Set(t.events);(!Xi(e,s)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:s,start:n,count:o}of e){const a=s==="_removeElements"?-o:o;Cl(t,n,a)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,s=o=>new Set(t.filter(a=>a[0]===o).map((a,r)=>r+","+a.splice(1).join(","))),n=s(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;J.update(this,this.width,this.height,t);const e=this.chartArea,s=e.width<=0||e.height<=0;this._layers=[],F(this.boxes,n=>{s&&n.position==="chartArea"||(n.configure&&n.configure(),this._layers.push(...n._layers()))},this),this._layers.forEach((n,o)=>{n._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,s=this.data.datasets.length;e=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,s=t._clip,n=!s.disabled,o=Ol(t,this.chartArea),a={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",a)!==!1&&(n&&Ii(e,{left:s.left===!1?0:o.left-s.left,right:s.right===!1?this.width:o.right+s.right,top:s.top===!1?0:o.top-s.top,bottom:s.bottom===!1?this.height:o.bottom+s.bottom}),t.controller.draw(),n&&Ri(e),a.cancelable=!1,this.notifyPlugins("afterDatasetDraw",a))}isPointInArea(t){return ft(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,s,n){const o=Sr.modes[e];return typeof o=="function"?o(this,t,s,n):[]}getDatasetMeta(t){const e=this.data.datasets[t],s=this._metasets;let n=s.filter(o=>o&&o._dataset===e).pop();return n||(n={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},s.push(n)),n}getContext(){return this.$context||(this.$context=yt(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const s=this.getDatasetMeta(t);return typeof s.hidden=="boolean"?!s.hidden:!e.hidden}setDatasetVisibility(t,e){const s=this.getDatasetMeta(t);s.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,s){const n=s?"show":"hide",o=this.getDatasetMeta(t),a=o.controller._resolveAnimations(void 0,n);ue(e)?(o.data[e].hidden=!s,this.update()):(this.setDatasetVisibility(t,s),a.update(o,{visible:s}),this.update(r=>r.datasetIndex===t?n:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),ct.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,o,a),t[o]=a},n=(o,a,r)=>{o.offsetX=a,o.offsetY=r,this._eventHandler(o)};F(this.options.events,o=>s(o,n))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,s=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},n=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let a;const r=()=>{n("attach",r),this.attached=!0,this.resize(),s("resize",o),s("detach",a)};a=()=>{this.attached=!1,n("resize",o),this._stop(),this._resize(0,0),s("attach",r)},e.isAttached(this.canvas)?r():a()}unbindEvents(){F(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},F(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,s){const n=s?"set":"remove";let o,a,r,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+n+"DatasetHoverStyle"]()),r=0,l=t.length;r{const r=this.getDatasetMeta(o);if(!r)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:r.data[a],index:a}});!$e(s,e)&&(this._active=s,this._lastEvent=null,this._updateHoverStyles(s,e))}notifyPlugins(t,e,s){return this._plugins.notify(this,t,e,s)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,s){const n=this.options.hover,o=(l,c)=>l.filter(h=>!c.some(d=>h.datasetIndex===d.datasetIndex&&h.index===d.index)),a=o(e,t),r=s?t:o(t,e);a.length&&this.updateHoverStyle(a,n.mode,!1),r.length&&n.mode&&this.updateHoverStyle(r,n.mode,!0)}_eventHandler(t,e){const s={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},n=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",s,n)===!1)return;const o=this._handleEvent(t,e,s.inChartArea);return s.cancelable=!1,this.notifyPlugins("afterEvent",s,n),(o||s.changed)&&this.render(),this}_handleEvent(t,e,s){const{_active:n=[],options:o}=this,a=e,r=this._getActiveElements(t,n,s,a),l=Eo(t),c=Dl(t,this._lastEvent,s,l);s&&(this._lastEvent=null,R(o.onHover,[t,r,this],this),l&&R(o.onClick,[t,r,this],this));const h=!$e(r,n);return(h||e)&&(this._active=r,this._updateHoverStyles(r,n,e)),this._lastEvent=c,h}_getActiveElements(t,e,s,n){if(t.type==="mouseout")return[];if(!s)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,n)}}S(it,"defaults",z),S(it,"instances",Ve),S(it,"overrides",Et),S(it,"registry",ot),S(it,"version",Ml),S(it,"getChart",zs);function Bs(){return F(it.instances,i=>i._plugins.invalidate())}function Vn(i,t,e=t){i.lineCap=D(e.borderCapStyle,t.borderCapStyle),i.setLineDash(D(e.borderDash,t.borderDash)),i.lineDashOffset=D(e.borderDashOffset,t.borderDashOffset),i.lineJoin=D(e.borderJoinStyle,t.borderJoinStyle),i.lineWidth=D(e.borderWidth,t.borderWidth),i.strokeStyle=D(e.borderColor,t.borderColor)}function Tl(i,t,e){i.lineTo(e.x,e.y)}function Ll(i){return i.stepped?oa:i.tension||i.cubicInterpolationMode==="monotone"?aa:Tl}function Nn(i,t,e={}){const s=i.length,{start:n=0,end:o=s-1}=e,{start:a,end:r}=t,l=Math.max(n,a),c=Math.min(o,r),h=nr&&o>r;return{count:s,start:l,loop:t.loop,ilen:c(a+(c?r-y:y))%o,v=()=>{g!==m&&(i.lineTo(h,m),i.lineTo(h,g),i.lineTo(h,b))};for(l&&(u=n[x(0)],i.moveTo(u.x,u.y)),f=0;f<=r;++f){if(u=n[x(f)],u.skip)continue;const y=u.x,_=u.y,M=y|0;M===p?(_m&&(m=_),h=(d*h+y)/++d):(v(),i.lineTo(y,_),p=M,d=0,g=m=_),b=_}v()}function _i(i){const t=i.options,e=t.borderDash&&t.borderDash.length;return!i._decimated&&!i._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?Fl:Al}function Il(i){return i.stepped?Ba:i.tension||i.cubicInterpolationMode==="monotone"?Ha:Tt}function Rl(i,t,e,s){let n=t._path;n||(n=t._path=new Path2D,t.path(n,e,s)&&n.closePath()),Vn(i,t.options),i.stroke(n)}function El(i,t,e,s){const{segments:n,options:o}=t,a=_i(t);for(const r of n)Vn(i,o,r.style),i.beginPath(),a(i,t,r,{start:e,end:e+s-1})&&i.closePath(),i.stroke()}const zl=typeof Path2D=="function";function Bl(i,t,e,s){zl&&!t.options.segment?Rl(i,t,e,s):El(i,t,e,s)}class oe extends rt{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const s=this.options;if((s.tension||s.cubicInterpolationMode==="monotone")&&!s.stepped&&!this._pointsUpdated){const n=s.spanGaps?this._loop:this._fullLoop;Ta(this._points,s,t,n,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Xa(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,s=t.length;return s&&e[t[s-1].end]}interpolate(t,e){const s=this.options,n=t[e],o=this.points,a=$a(this,{property:e,start:n,end:n});if(!a.length)return;const r=[],l=Il(s);let c,h;for(c=0,h=a.length;ct!=="borderDash"&&t!=="fill"});function Hs(i,t,e,s){const n=i.options,{[e]:o}=i.getProps([e],s);return Math.abs(t-o){let{boxHeight:e=t,boxWidth:s=t}=i;return i.usePointStyle&&(e=Math.min(e,t),s=i.pointStyleWidth||Math.min(s,t)),{boxWidth:s,boxHeight:e,itemHeight:Math.max(t,e)}},$l=(i,t)=>i!==null&&t!==null&&i.datasetIndex===t.datasetIndex&&i.index===t.index;class Vs extends rt{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,s){this.maxWidth=t,this.maxHeight=e,this._margins=s,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=R(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(s=>t.filter(s,this.chart.data))),t.sort&&(e=e.sort((s,n)=>t.sort(s,n,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}const s=t.labels,n=W(s.font),o=n.size,a=this._computeTitleHeight(),{boxWidth:r,itemHeight:l}=Ws(s,o);let c,h;e.font=n.string,this.isHorizontal()?(c=this.maxWidth,h=this._fitRows(a,o,r,l)+10):(h=this.maxHeight,c=this._fitCols(a,n,r,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,s,n){const{ctx:o,maxWidth:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],h=n+r;let d=t;o.textAlign="left",o.textBaseline="middle";let f=-1,u=-h;return this.legendItems.forEach((p,g)=>{const m=s+e/2+o.measureText(p.text).width;(g===0||c[c.length-1]+m+2*r>a)&&(d+=h,c[c.length-(g>0?0:1)]=0,u+=h,f++),l[g]={left:0,top:u,row:f,width:m,height:n},c[c.length-1]+=m+r}),d}_fitCols(t,e,s,n){const{ctx:o,maxHeight:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],h=a-t;let d=r,f=0,u=0,p=0,g=0;return this.legendItems.forEach((m,b)=>{const{itemWidth:x,itemHeight:v}=Yl(s,e,o,m,n);b>0&&u+v+2*r>h&&(d+=f+r,c.push({width:f,height:u}),p+=f+r,g++,f=u=0),l[b]={left:p,top:u,col:g,width:x,height:v},f=Math.max(f,x),u+=v+r}),d+=f,c.push({width:f,height:u}),d}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:s,labels:{padding:n},rtl:o}}=this,a=$t(o,this.left,this.width);if(this.isHorizontal()){let r=0,l=j(s,this.left+n,this.right-this.lineWidths[r]);for(const c of e)r!==c.row&&(r=c.row,l=j(s,this.left+n,this.right-this.lineWidths[r])),c.top+=this.top+t+n,c.left=a.leftForLtr(a.x(l),c.width),l+=c.width+n}else{let r=0,l=j(s,this.top+t+n,this.bottom-this.columnSizes[r].height);for(const c of e)c.col!==r&&(r=c.col,l=j(s,this.top+t+n,this.bottom-this.columnSizes[r].height)),c.top=l,c.left+=this.left+n,c.left=a.leftForLtr(a.x(c.left),c.width),l+=c.height+n}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;Ii(t,this),this._draw(),Ri(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:s,ctx:n}=this,{align:o,labels:a}=t,r=z.color,l=$t(t.rtl,this.left,this.width),c=W(a.font),{padding:h}=a,d=c.size,f=d/2;let u;this.drawTitle(),n.textAlign=l.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=c.string;const{boxWidth:p,boxHeight:g,itemHeight:m}=Ws(a,d),b=function(M,k,w){if(isNaN(p)||p<=0||isNaN(g)||g<0)return;n.save();const P=D(w.lineWidth,1);if(n.fillStyle=D(w.fillStyle,r),n.lineCap=D(w.lineCap,"butt"),n.lineDashOffset=D(w.lineDashOffset,0),n.lineJoin=D(w.lineJoin,"miter"),n.lineWidth=P,n.strokeStyle=D(w.strokeStyle,r),n.setLineDash(D(w.lineDash,[])),a.usePointStyle){const O={radius:g*Math.SQRT2/2,pointStyle:w.pointStyle,rotation:w.rotation,borderWidth:P},C=l.xPlus(M,p/2),L=k+f;xn(n,O,C,L,a.pointStyleWidth&&p)}else{const O=k+Math.max((d-g)/2,0),C=l.leftForLtr(M,p),L=Ft(w.borderRadius);n.beginPath(),Object.values(L).some(Y=>Y!==0)?ge(n,{x:C,y:O,w:p,h:g,radius:L}):n.rect(C,O,p,g),n.fill(),P!==0&&n.stroke()}n.restore()},x=function(M,k,w){zt(n,w.text,M,k+m/2,c,{strikethrough:w.hidden,textAlign:l.textAlign(w.textAlign)})},v=this.isHorizontal(),y=this._computeTitleHeight();v?u={x:j(o,this.left+h,this.right-s[0]),y:this.top+h+y,line:0}:u={x:this.left+h,y:j(o,this.top+y+h,this.bottom-e[0].height),line:0},Pn(this.ctx,t.textDirection);const _=m+h;this.legendItems.forEach((M,k)=>{n.strokeStyle=M.fontColor,n.fillStyle=M.fontColor;const w=n.measureText(M.text).width,P=l.textAlign(M.textAlign||(M.textAlign=a.textAlign)),O=p+f+w;let C=u.x,L=u.y;l.setWidth(this.width),v?k>0&&C+O+h>this.right&&(L=u.y+=_,u.line++,C=u.x=j(o,this.left+h,this.right-s[u.line])):k>0&&L+_>this.bottom&&(C=u.x=C+e[u.line].width+h,u.line++,L=u.y=j(o,this.top+y+h,this.bottom-e[u.line].height));const Y=l.x(C);if(b(Y,L,M),C=Ko(P,C+p+f,v?C+O:this.right,t.rtl),x(l.x(C),L,M),v)u.x+=O+h;else if(typeof M.text!="string"){const st=c.lineHeight;u.y+=$n(M,st)+h}else u.y+=_}),Cn(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,s=W(e.font),n=$(e.padding);if(!e.display)return;const o=$t(t.rtl,this.left,this.width),a=this.ctx,r=e.position,l=s.size/2,c=n.top+l;let h,d=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),h=this.top+c,d=j(t.align,d,this.right-f);else{const p=this.columnSizes.reduce((g,m)=>Math.max(g,m.height),0);h=c+j(t.align,this.top,this.bottom-p-t.labels.padding-this._computeTitleHeight())}const u=j(r,d,d+f);a.textAlign=o.textAlign(Li(r)),a.textBaseline="middle",a.strokeStyle=e.color,a.fillStyle=e.color,a.font=s.string,zt(a,e.text,u,h,s)}_computeTitleHeight(){const t=this.options.title,e=W(t.font),s=$(t.padding);return t.display?e.lineHeight+s.height:0}_getLegendItemAt(t,e){let s,n,o;if(Lt(t,this.left,this.right)&&Lt(e,this.top,this.bottom)){for(o=this.legendHitBoxes,s=0;so.length>a.length?o:a)),t+e.size/2+s.measureText(n).width}function Xl(i,t,e){let s=i;return typeof t.text!="string"&&(s=$n(t,e)),s}function $n(i,t){const e=i.text?i.text.length:0;return t*e}function Kl(i,t){return!!((i==="mousemove"||i==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(i==="click"||i==="mouseup"))}var ql={id:"legend",_element:Vs,start(i,t,e){const s=i.legend=new Vs({ctx:i.ctx,options:e,chart:i});J.configure(i,s,e),J.addBox(i,s)},stop(i){J.removeBox(i,i.legend),delete i.legend},beforeUpdate(i,t,e){const s=i.legend;J.configure(i,s,e),s.options=e},afterUpdate(i){const t=i.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(i,t){t.replay||i.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(i,t,e){const s=t.datasetIndex,n=e.chart;n.isDatasetVisible(s)?(n.hide(s),t.hidden=!0):(n.show(s),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:i=>i.chart.options.color,boxWidth:40,padding:10,generateLabels(i){const t=i.data.datasets,{labels:{usePointStyle:e,pointStyle:s,textAlign:n,color:o,useBorderRadius:a,borderRadius:r}}=i.legend.options;return i._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(e?0:void 0),h=$(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:c.borderColor,pointStyle:s||c.pointStyle,rotation:c.rotation,textAlign:n||c.textAlign,borderRadius:a&&(r||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:i=>i.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:i=>!i.startsWith("on"),labels:{_scriptable:i=>!["generateLabels","filter","sort"].includes(i)}}};class Yn extends rt{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const s=this.options;if(this.left=0,this.top=0,!s.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;const n=E(s.text)?s.text.length:1;this._padding=$(s.padding);const o=n*W(s.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:e,left:s,bottom:n,right:o,options:a}=this,r=a.align;let l=0,c,h,d;return this.isHorizontal()?(h=j(r,s,o),d=e+t,c=o-s):(a.position==="left"?(h=s+t,d=j(r,n,e),l=H*-.5):(h=o-t,d=j(r,e,n),l=H*.5),c=n-e),{titleX:h,titleY:d,maxWidth:c,rotation:l}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const s=W(e.font),o=s.lineHeight/2+this._padding.top,{titleX:a,titleY:r,maxWidth:l,rotation:c}=this._drawArgs(o);zt(t,e.text,0,0,s,{color:e.color,maxWidth:l,rotation:c,textAlign:Li(e.align),textBaseline:"middle",translation:[a,r]})}}function Gl(i,t){const e=new Yn({ctx:i.ctx,options:t,chart:i});J.configure(i,e,t),J.addBox(i,e),i.titleBlock=e}var Zl={id:"title",_element:Yn,start(i,t,e){Gl(i,e)},stop(i){const t=i.titleBlock;J.removeBox(i,t),delete i.titleBlock},beforeUpdate(i,t,e){const s=i.titleBlock;J.configure(i,s,e),s.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const ae={average(i){if(!i.length)return!1;let t,e,s=new Set,n=0,o=0;for(t=0,e=i.length;tr+l)/s.size,y:n/o}},nearest(i,t){if(!i.length)return!1;let e=t.x,s=t.y,n=Number.POSITIVE_INFINITY,o,a,r;for(o=0,a=i.length;o-1?i.split(`
+`):i}function Ql(i,t){const{element:e,datasetIndex:s,index:n}=t,o=i.getDatasetMeta(s).controller,{label:a,value:r}=o.getLabelAndValue(n);return{chart:i,label:a,parsed:o.getParsed(n),raw:i.data.datasets[s].data[n],formattedValue:r,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:e}}function Ns(i,t){const e=i.chart.ctx,{body:s,footer:n,title:o}=i,{boxWidth:a,boxHeight:r}=t,l=W(t.bodyFont),c=W(t.titleFont),h=W(t.footerFont),d=o.length,f=n.length,u=s.length,p=$(t.padding);let g=p.height,m=0,b=s.reduce((y,_)=>y+_.before.length+_.lines.length+_.after.length,0);if(b+=i.beforeBody.length+i.afterBody.length,d&&(g+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),b){const y=t.displayColors?Math.max(r,l.lineHeight):l.lineHeight;g+=u*y+(b-u)*l.lineHeight+(b-1)*t.bodySpacing}f&&(g+=t.footerMarginTop+f*h.lineHeight+(f-1)*t.footerSpacing);let x=0;const v=function(y){m=Math.max(m,e.measureText(y).width+x)};return e.save(),e.font=c.string,F(i.title,v),e.font=l.string,F(i.beforeBody.concat(i.afterBody),v),x=t.displayColors?a+2+t.boxPadding:0,F(s,y=>{F(y.before,v),F(y.lines,v),F(y.after,v)}),x=0,e.font=h.string,F(i.footer,v),e.restore(),m+=p.width,{width:m,height:g}}function Jl(i,t){const{y:e,height:s}=t;return ei.height-s/2?"bottom":"center"}function tc(i,t,e,s){const{x:n,width:o}=s,a=e.caretSize+e.caretPadding;if(i==="left"&&n+o+a>t.width||i==="right"&&n-o-a<0)return!0}function ec(i,t,e,s){const{x:n,width:o}=e,{width:a,chartArea:{left:r,right:l}}=i;let c="center";return s==="center"?c=n<=(r+l)/2?"left":"right":n<=o/2?c="left":n>=a-o/2&&(c="right"),tc(c,i,t,e)&&(c="center"),c}function js(i,t,e){const s=e.yAlign||t.yAlign||Jl(i,e);return{xAlign:e.xAlign||t.xAlign||ec(i,t,e,s),yAlign:s}}function ic(i,t){let{x:e,width:s}=i;return t==="right"?e-=s:t==="center"&&(e-=s/2),e}function sc(i,t,e){let{y:s,height:n}=i;return t==="top"?s+=e:t==="bottom"?s-=n+e:s-=n/2,s}function $s(i,t,e,s){const{caretSize:n,caretPadding:o,cornerRadius:a}=i,{xAlign:r,yAlign:l}=e,c=n+o,{topLeft:h,topRight:d,bottomLeft:f,bottomRight:u}=Ft(a);let p=ic(t,r);const g=sc(t,l,c);return l==="center"?r==="left"?p+=c:r==="right"&&(p-=c):r==="left"?p-=Math.max(h,f)+n:r==="right"&&(p+=Math.max(d,u)+n),{x:G(p,0,s.width-t.width),y:G(g,0,s.height-t.height)}}function Ie(i,t,e){const s=$(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-s.right:i.x+s.left}function Ys(i){return nt([],ht(i))}function nc(i,t,e){return yt(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Us(i,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}const Un={beforeTitle:lt,title(i){if(i.length>0){const t=i[0],e=t.chart.data.labels,s=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(s>0&&t.dataIndex"u"?Un[t].call(e,s):n}class yi extends rt{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,s=this.options.setContext(this.getContext()),n=s.enabled&&e.options.animation&&s.animations,o=new On(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=nc(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:s}=e,n=U(s,"beforeTitle",this,t),o=U(s,"title",this,t),a=U(s,"afterTitle",this,t);let r=[];return r=nt(r,ht(n)),r=nt(r,ht(o)),r=nt(r,ht(a)),r}getBeforeBody(t,e){return Ys(U(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:s}=e,n=[];return F(t,o=>{const a={before:[],lines:[],after:[]},r=Us(s,o);nt(a.before,ht(U(r,"beforeLabel",this,o))),nt(a.lines,U(r,"label",this,o)),nt(a.after,ht(U(r,"afterLabel",this,o))),n.push(a)}),n}getAfterBody(t,e){return Ys(U(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:s}=e,n=U(s,"beforeFooter",this,t),o=U(s,"footer",this,t),a=U(s,"afterFooter",this,t);let r=[];return r=nt(r,ht(n)),r=nt(r,ht(o)),r=nt(r,ht(a)),r}_createItems(t){const e=this._active,s=this.chart.data,n=[],o=[],a=[];let r=[],l,c;for(l=0,c=e.length;lt.filter(h,d,f,s))),t.itemSort&&(r=r.sort((h,d)=>t.itemSort(h,d,s))),F(r,h=>{const d=Us(t.callbacks,h);n.push(U(d,"labelColor",this,h)),o.push(U(d,"labelPointStyle",this,h)),a.push(U(d,"labelTextColor",this,h))}),this.labelColors=n,this.labelPointStyles=o,this.labelTextColors=a,this.dataPoints=r,r}update(t,e){const s=this.options.setContext(this.getContext()),n=this._active;let o,a=[];if(!n.length)this.opacity!==0&&(o={opacity:0});else{const r=ae[s.position].call(this,n,this._eventPosition);a=this._createItems(s),this.title=this.getTitle(a,s),this.beforeBody=this.getBeforeBody(a,s),this.body=this.getBody(a,s),this.afterBody=this.getAfterBody(a,s),this.footer=this.getFooter(a,s);const l=this._size=Ns(this,s),c=Object.assign({},r,l),h=js(this.chart,s,c),d=$s(s,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX:r.x,caretY:r.y}}this._tooltipItems=a,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&s.external&&s.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,s,n){const o=this.getCaretPosition(t,s,n);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,s){const{xAlign:n,yAlign:o}=this,{caretSize:a,cornerRadius:r}=s,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:d}=Ft(r),{x:f,y:u}=t,{width:p,height:g}=e;let m,b,x,v,y,_;return o==="center"?(y=u+g/2,n==="left"?(m=f,b=m-a,v=y+a,_=y-a):(m=f+p,b=m+a,v=y-a,_=y+a),x=m):(n==="left"?b=f+Math.max(l,h)+a:n==="right"?b=f+p-Math.max(c,d)-a:b=this.caretX,o==="top"?(v=u,y=v-a,m=b-a,x=b+a):(v=u+g,y=v+a,m=b+a,x=b-a),_=v),{x1:m,x2:b,x3:x,y1:v,y2:y,y3:_}}drawTitle(t,e,s){const n=this.title,o=n.length;let a,r,l;if(o){const c=$t(s.rtl,this.x,this.width);for(t.x=Ie(this,s.titleAlign,s),e.textAlign=c.textAlign(s.titleAlign),e.textBaseline="middle",a=W(s.titleFont),r=s.titleSpacing,e.fillStyle=s.titleColor,e.font=a.string,l=0;lx!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,ge(t,{x:g,y:p,w:c,h:l,radius:b}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),ge(t,{x:m,y:p+1,w:c-2,h:l-2,radius:b}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(g,p,c,l),t.strokeRect(g,p,c,l),t.fillStyle=a.backgroundColor,t.fillRect(m,p+1,c-2,l-2))}t.fillStyle=this.labelTextColors[s]}drawBody(t,e,s){const{body:n}=this,{bodySpacing:o,bodyAlign:a,displayColors:r,boxHeight:l,boxWidth:c,boxPadding:h}=s,d=W(s.bodyFont);let f=d.lineHeight,u=0;const p=$t(s.rtl,this.x,this.width),g=function(w){e.fillText(w,p.x(t.x+u),t.y+f/2),t.y+=f+o},m=p.textAlign(a);let b,x,v,y,_,M,k;for(e.textAlign=a,e.textBaseline="middle",e.font=d.string,t.x=Ie(this,m,s),e.fillStyle=s.bodyColor,F(this.beforeBody,g),u=r&&m!=="right"?a==="center"?c/2+h:c+2+h:0,y=0,M=n.length;y0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,s=this.$animations,n=s&&s.x,o=s&&s.y;if(n||o){const a=ae[t.position].call(this,this._active,this._eventPosition);if(!a)return;const r=this._size=Ns(this,t),l=Object.assign({},a,this._size),c=js(e,t,l),h=$s(t,l,c,e);(n._to!==h.x||o._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=r.width,this.height=r.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let s=this.opacity;if(!s)return;this._updateAnimationTarget(e);const n={width:this.width,height:this.height},o={x:this.x,y:this.y};s=Math.abs(s)<.001?0:s;const a=$(e.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&r&&(t.save(),t.globalAlpha=s,this.drawBackground(o,t,n,e),Pn(t,e.textDirection),o.y+=a.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),Cn(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const s=this._active,n=t.map(({datasetIndex:r,index:l})=>{const c=this.chart.getDatasetMeta(r);if(!c)throw new Error("Cannot find a dataset at index "+r);return{datasetIndex:r,element:c.data[l],index:l}}),o=!$e(s,n),a=this._positionChanged(n,e);(o||a)&&(this._active=n,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,s=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const n=this.options,o=this._active||[],a=this._getActiveElements(t,o,e,s),r=this._positionChanged(a,t),l=e||!$e(a,o)||r;return l&&(this._active=a,(n.enabled||n.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,s,n){const o=this.options;if(t.type==="mouseout")return[];if(!n)return e.filter(r=>this.chart.data.datasets[r.datasetIndex]&&this.chart.getDatasetMeta(r.datasetIndex).controller.getParsed(r.index)!==void 0);const a=this.chart.getElementsAtEventForMode(t,o.mode,o,s);return o.reverse&&a.reverse(),a}_positionChanged(t,e){const{caretX:s,caretY:n,options:o}=this,a=ae[o.position].call(this,t,e);return a!==!1&&(s!==a.x||n!==a.y)}}S(yi,"positioners",ae);var oc={id:"tooltip",_element:yi,positioners:ae,afterInit(i,t,e){e&&(i.tooltip=new yi({chart:i,options:e}))},beforeUpdate(i,t,e){i.tooltip&&i.tooltip.initialize(e)},reset(i,t,e){i.tooltip&&i.tooltip.initialize(e)},afterDraw(i){const t=i.tooltip;if(t&&t._willRender()){const e={tooltip:t};if(i.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(i.ctx),i.notifyPlugins("afterTooltipDraw",e)}},afterEvent(i,t){if(i.tooltip){const e=t.replay;i.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(i,t)=>t.bodyFont.size,boxWidth:(i,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Un},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:i=>i!=="filter"&&i!=="itemSort"&&i!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const ac=(i,t,e,s)=>(typeof t=="string"?(e=i.push(t)-1,s.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function rc(i,t,e,s){const n=i.indexOf(t);if(n===-1)return ac(i,t,e,s);const o=i.lastIndexOf(t);return n!==o?e:n}const lc=(i,t)=>i===null?null:G(Math.round(i),0,t);function Xs(i){const t=this.getLabels();return i>=0&&ie.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}S(vi,"id","category"),S(vi,"defaults",{ticks:{callback:Xs}});function cc(i,t){const e=[],{bounds:n,step:o,min:a,max:r,precision:l,count:c,maxTicks:h,maxDigits:d,includeBounds:f}=i,u=o||1,p=h-1,{min:g,max:m}=t,b=!A(a),x=!A(r),v=!A(c),y=(m-g)/(d+1);let _=qi((m-g)/p/u)*u,M,k,w,P;if(_<1e-14&&!b&&!x)return[{value:g},{value:m}];P=Math.ceil(m/_)-Math.floor(g/_),P>p&&(_=qi(P*_/p/u)*u),A(l)||(M=Math.pow(10,l),_=Math.ceil(_*M)/M),n==="ticks"?(k=Math.floor(g/_)*_,w=Math.ceil(m/_)*_):(k=g,w=m),b&&x&&o&&Wo((r-a)/o,_/1e3)?(P=Math.round(Math.min((r-a)/_,h)),_=(r-a)/P,k=a,w=r):v?(k=b?a:k,w=x?r:w,P=c-1,_=(w-k)/P):(P=(w-k)/_,le(P,Math.round(P),_/1e3)?P=Math.round(P):P=Math.ceil(P));const O=Math.max(Gi(_),Gi(k));M=Math.pow(10,A(l)?O:l),k=Math.round(k*M)/M,w=Math.round(w*M)/M;let C=0;for(b&&(f&&k!==a?(e.push({value:a}),kr)break;e.push({value:L})}return x&&f&&w!==r?e.length&&le(e[e.length-1].value,r,Ks(r,y,i))?e[e.length-1].value=r:e.push({value:r}):(!x||w===r)&&e.push({value:w}),e}function Ks(i,t,{horizontal:e,minRotation:s}){const n=mt(s),o=(e?Math.sin(n):Math.cos(n))||.001,a=.75*t*(""+i).length;return Math.min(t/o,a)}class Ge extends Bt{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return A(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:s}=this.getUserBounds();let{min:n,max:o}=this;const a=l=>n=e?n:l,r=l=>o=s?o:l;if(t){const l=at(n),c=at(o);l<0&&c<0?r(0):l>0&&c>0&&a(0)}if(n===o){let l=o===0?1:Math.abs(o*.05);r(o+l),t||a(n-l)}this.min=n,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:s}=t,n;return s?(n=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),e=e||11),e&&(n=Math.min(e,n)),n}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let s=this.getTickLimit();s=Math.max(2,s);const n={maxTicks:s,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,a=cc(n,o);return t.bounds==="ticks"&&cn(a,this,"value"),t.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){const t=this.ticks;let e=this.min,s=this.max;if(super.configure(),this.options.offset&&t.length){const n=(s-e)/Math.max(t.length-1,1)/2;e-=n,s+=n}this._startValue=e,this._endValue=s,this._valueRange=s-e}getLabelForValue(t){return Fi(t,this.chart.options.locale,this.options.ticks.format)}}class ki extends Ge{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=V(t)?t:0,this.max=V(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,s=mt(this.options.ticks.minRotation),n=(t?Math.sin(s):Math.cos(s))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/n))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}S(ki,"id","linear"),S(ki,"defaults",{ticks:{callback:Qe.formatters.numeric}});const me=i=>Math.floor(pt(i)),Dt=(i,t)=>Math.pow(10,me(i)+t);function qs(i){return i/Math.pow(10,me(i))===1}function Gs(i,t,e){const s=Math.pow(10,e),n=Math.floor(i/s);return Math.ceil(t/s)-n}function hc(i,t){const e=t-i;let s=me(e);for(;Gs(i,t,s)>10;)s++;for(;Gs(i,t,s)<10;)s--;return Math.min(s,me(i))}function dc(i,{min:t,max:e}){t=K(i.min,t);const s=[],n=me(t);let o=hc(t,e),a=o<0?Math.pow(10,Math.abs(o)):1;const r=Math.pow(10,o),l=n>o?Math.pow(10,n):0,c=Math.round((t-l)*a)/a,h=Math.floor((t-l)/r/10)*r*10;let d=Math.floor((c-h)/Math.pow(10,o)),f=K(i.min,Math.round((l+h+d*Math.pow(10,o))*a)/a);for(;f=10?d=d<15?15:20:d++,d>=20&&(o++,d=2,a=o>=0?1:a),f=Math.round((l+h+d*Math.pow(10,o))*a)/a;const u=K(i.max,f);return s.push({value:u,major:qs(u),significand:d}),s}class wi extends Bt{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const s=Ge.prototype.parse.apply(this,[t,e]);if(s===0){this._zero=!0;return}return V(s)&&s>0?s:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=V(t)?Math.max(0,t):null,this.max=V(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!V(this._userMin)&&(this.min=t===Dt(this.min,0)?Dt(this.min,-1):Dt(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let s=this.min,n=this.max;const o=r=>s=t?s:r,a=r=>n=e?n:r;s===n&&(s<=0?(o(1),a(10)):(o(Dt(s,-1)),a(Dt(n,1)))),s<=0&&o(Dt(n,-1)),n<=0&&a(Dt(s,1)),this.min=s,this.max=n}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},s=dc(e,this);return t.bounds==="ticks"&&cn(s,this,"value"),t.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}getLabelForValue(t){return t===void 0?"0":Fi(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=pt(t),this._valueRange=pt(this.max)-pt(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(pt(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}S(wi,"id","logarithmic"),S(wi,"defaults",{ticks:{callback:Qe.formatters.logarithmic,major:{enabled:!0}}});function Mi(i){const t=i.ticks;if(t.display&&i.display){const e=$(t.backdropPadding);return D(t.font&&t.font.size,z.font.size)+e.height}return 0}function fc(i,t,e){return e=E(e)?e:[e],{w:na(i,t.string,e),h:e.length*t.lineHeight}}function Zs(i,t,e,s,n){return i===s||i===n?{start:t-e/2,end:t+e/2}:in?{start:t-e,end:t}:{start:t,end:t+e}}function uc(i){const t={l:i.left+i._padding.left,r:i.right-i._padding.right,t:i.top+i._padding.top,b:i.bottom-i._padding.bottom},e=Object.assign({},t),s=[],n=[],o=i._pointLabels.length,a=i.options.pointLabels,r=a.centerPointLabels?H/o:0;for(let l=0;lt.r&&(r=(s.end-t.r)/o,i.r=Math.max(i.r,t.r+r)),n.startt.b&&(l=(n.end-t.b)/a,i.b=Math.max(i.b,t.b+l))}function pc(i,t,e){const s=i.drawingArea,{extra:n,additionalAngle:o,padding:a,size:r}=e,l=i.getPointPosition(t,s+n+a,o),c=Math.round(Oi(et(l.angle+q))),h=yc(l.y,r.h,c),d=xc(c),f=_c(l.x,r.w,d);return{visible:!0,x:l.x,y:h,textAlign:d,left:f,top:h,right:f+r.w,bottom:h+r.h}}function mc(i,t){if(!t)return!0;const{left:e,top:s,right:n,bottom:o}=i;return!(ft({x:e,y:s},t)||ft({x:e,y:o},t)||ft({x:n,y:s},t)||ft({x:n,y:o},t))}function bc(i,t,e){const s=[],n=i._pointLabels.length,o=i.options,{centerPointLabels:a,display:r}=o.pointLabels,l={extra:Mi(o)/2,additionalAngle:a?H/n:0};let c;for(let h=0;h